editeng/source/editeng/editview.cxx | 10 + editeng/source/editeng/impedit.cxx | 11 ++ editeng/source/editeng/impedit.hxx | 4 editeng/source/editeng/impedit3.cxx | 3 editeng/source/outliner/outlvw.cxx | 4 include/editeng/editview.hxx | 3 include/editeng/outliner.hxx | 3 include/svx/svdmodel.hxx | 13 ++ sc/inc/docuno.hxx | 22 +++- sc/source/ui/app/inputhdl.cxx | 9 + sc/source/ui/inc/gridwin.hxx | 9 + sc/source/ui/inc/inputhdl.hxx | 2 sc/source/ui/inc/output.hxx | 1 sc/source/ui/inc/tabvwsh.hxx | 1 sc/source/ui/unoobj/docuno.cxx | 74 +++++++++----- sc/source/ui/view/gridwin4.cxx | 181 +++++++++++++++++++----------------- sc/source/ui/view/tabvwsh4.cxx | 95 ++++++++---------- sd/source/ui/unoidl/unomodel.cxx | 1 svx/source/svdraw/svdedxv.cxx | 1 svx/source/svdraw/svdmodel.cxx | 25 ++++ 20 files changed, 307 insertions(+), 165 deletions(-)
New commits: commit 6ef2c6733545a849284897e728fe23dcbe6d2480 Author: Jan Holesovsky <[email protected]> Date: Tue Mar 10 18:00:05 2015 +0100 Fix build. Change-Id: Ie072b9d51ee41f0c02421c4930bbfce5d281a8d9 diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index 05e563b..5a30d49 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -30,7 +30,7 @@ #include <vcl/settings.hxx> #define LOK_USE_UNSTABLE_API -#include <LibreOfficeKit/LibreOfficeKitEnums.h> +#include <LibreOfficeKit/LibreOfficeKit.h> #include <svx/svdview.hxx> #include "tabvwsh.hxx" @@ -962,12 +962,14 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice, void ScGridWindow::LogicInvalidate(const ::vcl::Region* pRegion) { + /* OString sRectangle; if (!pRegion) sRectangle = "EMPTY"; else sRectangle = pRegion->GetBoundRect().toString(); pViewData->GetDocument()->GetDrawLayer()->libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr()); + */ } void ScGridWindow::CheckNeedsRepaint() commit d3524c3a03c8f92e425d1454d7ed1864b1549ebc Author: Jan Holesovsky <[email protected]> Date: Mon Mar 9 12:25:30 2015 +0100 sc tiled rendering: Don't adjust the text width according to printer. When we don't set the 'wysiwyg' text, tiled rendering gets confused, because nPrtToScreenFactor is not 1.0, and everything gets horizontally shrunk. There is still a problem with vertical direction unfortunately - in order to have the same height of all the cells, the zooms where it does not fit the pixels can lead to an offset there too; but still this commit improves the situation a lot already. Also sort the includes when touching this, otherwise no idea where to add the inputopt.hxx :-) Change-Id: I15bf367af72a898248af81f34dc857ceb66187af diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 46471c9..75bdcc6 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -65,44 +65,46 @@ #include <opencl/platforminfo.hxx> #endif -#include "docuno.hxx" #include "cellsuno.hxx" -#include "nameuno.hxx" +#include <columnspanset.hxx> +#include "convuno.hxx" #include "datauno.hxx" +#include "docfunc.hxx" +#include "dociter.hxx" +#include "docoptio.hxx" +#include "docsh.hxx" +#include "docuno.hxx" +#include "drwlayer.hxx" +#include "forbiuno.hxx" +#include "formulacell.hxx" +#include "formulagroup.hxx" +#include "gridwin.hxx" +#include "hints.hxx" +#include <inputopt.hxx> +#include "interpre.hxx" +#include "linkuno.hxx" +#include "markdata.hxx" #include "miscuno.hxx" +#include "nameuno.hxx" #include "notesuno.hxx" -#include "styleuno.hxx" -#include "linkuno.hxx" -#include "servuno.hxx" -#include "targuno.hxx" -#include "convuno.hxx" #include "optuno.hxx" -#include "forbiuno.hxx" -#include "docsh.hxx" -#include "hints.hxx" -#include "docfunc.hxx" +#include "pfuncache.hxx" #include "postit.hxx" -#include "dociter.hxx" -#include "formulacell.hxx" -#include "drwlayer.hxx" +#include "printfun.hxx" #include "rangeutl.hxx" -#include "markdata.hxx" -#include "docoptio.hxx" -#include "unonames.hxx" +#include "scmod.hxx" +#include "scresid.hxx" +#include "servuno.hxx" #include "shapeuno.hxx" -#include "viewuno.hxx" +#include "sheetevents.hxx" +#include "styleuno.hxx" #include "tabvwsh.hxx" -#include "printfun.hxx" -#include "pfuncache.hxx" -#include "scmod.hxx" +#include "targuno.hxx" +#include "unonames.hxx" #include "ViewSettingsSequenceDefines.hxx" -#include "sheetevents.hxx" +#include "viewuno.hxx" + #include "sc.hrc" -#include "scresid.hxx" -#include "interpre.hxx" -#include "formulagroup.hxx" -#include "gridwin.hxx" -#include <columnspanset.hxx> using namespace com::sun::star; @@ -520,6 +522,12 @@ void ScModelObj::initializeForTiledRendering() { SolarMutexGuard aGuard; pDocShell->GetDocument().GetDrawLayer()->setTiledRendering(true); + + // show us the text exactly + ScInputOptions aInputOptions(SC_MOD()->GetInputOptions()); + aInputOptions.SetTextWysiwyg(true); + SC_MOD()->SetInputOptions(aInputOptions); + pDocShell->CalcOutputFactor(); } uno::Any SAL_CALL ScModelObj::queryInterface( const uno::Type& rType ) commit 88834835e9c097b0bee691a508a23ef92ba15682 Author: Jan Holesovsky <[email protected]> Date: Mon Mar 9 09:41:48 2015 +0100 sc tiled rendering: RefreshZoom() is called already in SetZoom(). Change-Id: I985275e3a1a944dffebe3987dee748f604e065f9 diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index aa8baf1..05e563b 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -934,8 +934,8 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice, Fraction aFracX(long(nOutputWidth * TWIPS_PER_PIXEL), nTileWidth); Fraction aFracY(long(nOutputHeight * TWIPS_PER_PIXEL), nTileHeight); + // page break zoom pViewData->SetZoom(aFracX, aFracY, true); - pViewData->RefreshZoom(); double fTilePosXPixel = static_cast<double>(nTilePosX) * nOutputWidth / nTileWidth; double fTilePosYPixel = static_cast<double>(nTilePosY) * nOutputHeight / nTileHeight; commit e9d5fb8a300fada7463d16bd9477c981f74f1671 Author: Jan Holesovsky <[email protected]> Date: Fri Mar 6 22:27:27 2015 +0100 sc tiled rendering: Simplify the zoom computation. In principle, we should avoid messing up with zoom, and instead just work with the MapMode, but we are not there yet - lots of places are hardcoded to work in pixels. Change-Id: I572b0d54fbfc72494c44ef95e7fda5e655f83fde diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index b848bf6..aa8baf1 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -927,22 +927,18 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice, // FIXME the painting works using a mixture of drawing with coordinates in // pixels and in logic coordinates; it should be cleaned up to use logic - // coords only. + // coords only, and avoid all the SetMapMode()'s. + // Similarly to Writer, we should set the mapmode once on the rDevice, and + // not care about any zoom settings. - // TODO : zooming isn't perfect. Find out why. - double nOutWTwips = static_cast<double>(nOutputWidth) / PIXEL_PER_TWIPS; - double nOutHTwips = static_cast<double>(nOutputHeight) / PIXEL_PER_TWIPS; - - nOutWTwips /= nTileWidth; - nOutHTwips /= nTileHeight; - Fraction aFracX(nOutWTwips); - Fraction aFracY(nOutHTwips); + Fraction aFracX(long(nOutputWidth * TWIPS_PER_PIXEL), nTileWidth); + Fraction aFracY(long(nOutputHeight * TWIPS_PER_PIXEL), nTileHeight); pViewData->SetZoom(aFracX, aFracY, true); pViewData->RefreshZoom(); - double fTilePosXPixel = static_cast<double>(nTilePosX) * PIXEL_PER_TWIPS * static_cast<double>(aFracX); - double fTilePosYPixel = static_cast<double>(nTilePosY) * PIXEL_PER_TWIPS * static_cast<double>(aFracY); + double fTilePosXPixel = static_cast<double>(nTilePosX) * nOutputWidth / nTileWidth; + double fTilePosYPixel = static_cast<double>(nTilePosY) * nOutputHeight / nTileHeight; SCTAB nTab = pViewData->GetTabNo(); ScDocument* pDoc = pViewData->GetDocument(); @@ -957,7 +953,9 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice, ScTableInfo aTabInfo; pDoc->FillInfo(aTabInfo, nCol1, nRow1, nCol2, nRow2, nTab, fPPTX, fPPTY, false, false, NULL); - ScOutputData aOutputData(&rDevice, OUTTYPE_WINDOW, aTabInfo, pDoc, nTab, -fTilePosXPixel, -fTilePosYPixel, nCol1, nRow1, nCol2, nRow2, fPPTX, fPPTY); + ScOutputData aOutputData(&rDevice, OUTTYPE_WINDOW, aTabInfo, pDoc, nTab, + -fTilePosXPixel, -fTilePosYPixel, nCol1, nRow1, nCol2, nRow2, + fPPTX, fPPTY); DrawContent(rDevice, aTabInfo, aOutputData, true, SC_UPDATE_ALL); } commit 62c52ba84794146f98906be100b3c9334cc5a270 Author: Jan Holesovsky <[email protected]> Date: Fri Mar 6 22:00:15 2015 +0100 sc tiled rendering: Make the drawings and charts work. Change-Id: Ibd7e9e398fe24ec2b3553c8488b46b65de316da6 diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx index 776bb44..deb5916 100644 --- a/sc/source/ui/inc/gridwin.hxx +++ b/sc/source/ui/inc/gridwin.hxx @@ -377,6 +377,7 @@ public: bool ShowNoteMarker( SCsCOL nPosX, SCsROW nPosY, bool bKeyboard ); void HideNoteMarker(); + /// MapMode for the drawinglayer objects. MapMode GetDrawMapMode( bool bForce = false ); void ContinueDrag(); diff --git a/sc/source/ui/inc/output.hxx b/sc/source/ui/inc/output.hxx index d605d53..d9e1a46 100644 --- a/sc/source/ui/inc/output.hxx +++ b/sc/source/ui/inc/output.hxx @@ -60,6 +60,7 @@ class ScFieldEditEngine; class ScOutputData { friend class ScDrawStringsVars; +friend class ScGridWindow; private: struct OutputAreaParam { @@ -147,7 +148,6 @@ private: RowInfo* pRowInfo; // Info block SCSIZE nArrCount; // occupied lines in info block ScDocument* mpDoc; // Document -public: SCTAB nTab; // sheet long nScrX; // Output Startpos. (Pixel) long nScrY; @@ -158,7 +158,6 @@ public: SCROW nY1; // ( incl. hidden ) SCCOL nX2; SCROW nY2; -private: SCCOL nVisX1; // Start-/End coordinates SCROW nVisY1; // ( visible range ) SCCOL nVisX2; diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index 9366163..b848bf6 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -531,6 +531,7 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI ScDocShell* pDocSh = pViewData->GetDocShell(); ScDocument& rDoc = pDocSh->GetDocument(); const ScViewOptions& rOpts = pViewData->GetOptions(); + bool bIsTiledRendering = rDoc.GetDrawLayer()->isTiledRendering(); SCTAB nTab = aOutputData.nTab; SCCOL nX1 = aOutputData.nX1; @@ -595,7 +596,15 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI } // define drawing layer map mode and paint rectangle - const MapMode aDrawMode = GetDrawMapMode(); + MapMode aDrawMode = GetDrawMapMode(); + if (bIsTiledRendering) + { + // FIXME this shouldn't be necessary once we change this to work in the + // logic coordinates instead of in pixels (and get rid of all the + // SetMapMode()'s) + aDrawMode = pViewData->GetLogicMode(eWhich); + aDrawMode.SetOrigin(PixelToLogic(Point(nScrX, nScrY), aDrawMode)); + } Rectangle aDrawingRectLogic; bool bLayoutRTL = rDoc.IsLayoutRTL( nTab ); @@ -628,7 +637,6 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI OutputDevice* pContentDev = &rDevice; // device for document content, used by overlay manager SdrPaintWindow* pTargetPaintWindow = 0; // #i74769# work with SdrPaintWindow directly - bool bIsTiledRendering = rDoc.GetDrawLayer()->isTiledRendering(); if (!bIsTiledRendering) { @@ -894,10 +902,10 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI flushOverlayManager(); // set MapMode for text edit - SetMapMode(pViewData->GetLogicMode()); + rDevice.SetMapMode(pViewData->GetLogicMode()); } else - SetMapMode(aDrawMode); + rDevice.SetMapMode(aDrawMode); if ( pNoteMarker ) pNoteMarker->Draw(); // ueber den Cursor, im Drawing-MapMode @@ -917,6 +925,10 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice, // dependent of the zoom level. Determine the correct zoom level before // we start. + // FIXME the painting works using a mixture of drawing with coordinates in + // pixels and in logic coordinates; it should be cleaned up to use logic + // coords only. + // TODO : zooming isn't perfect. Find out why. double nOutWTwips = static_cast<double>(nOutputWidth) / PIXEL_PER_TWIPS; double nOutHTwips = static_cast<double>(nOutputHeight) / PIXEL_PER_TWIPS; commit be28965b119c1e9bbb4f1b8f16b777efd5deb85a Author: Jan Holesovsky <[email protected]> Date: Fri Mar 6 18:21:02 2015 +0100 sc tiled rendering: tdf#85848: Use DrawContent() in PaintTile() too. From now on, the code for the tiled rendering is shared with the desktop rendering, modulo few isTiledRendering() calls. Drawing of the shapes & charts needs fixing, it does not honor the output device settings. Change-Id: I74cdb4e09da59aa71f31b18130829de28a93fab4 diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index 3607e2e..9366163 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -382,6 +382,16 @@ void ScGridWindow::Paint( const Rectangle& rRect ) void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMode eMode ) { + ScDocShell* pDocSh = pViewData->GetDocShell(); + ScDocument& rDoc = pDocSh->GetDocument(); + + // let's ignore the normal Draw() attempts when doing the tiled rendering, + // all the rendering should go through PaintTile() in that case. + // TODO revisit if we can actually turn this into an assert(), and clean + // up the callers + if (rDoc.GetDrawLayer()->isTiledRendering()) + return; + ScModule* pScMod = SC_MOD(); bool bTextWysiwyg = pScMod->GetInputOptions().GetTextWysiwyg(); @@ -418,10 +428,7 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod ++nPaintCount; // merken, dass gemalt wird (wichtig beim Invertieren) - ScDocShell* pDocSh = pViewData->GetDocShell(); - ScDocument& rDoc = pDocSh->GetDocument(); SCTAB nTab = pViewData->GetTabNo(); - rDoc.ExtendHidden( nX1, nY1, nX2, nY2, nTab ); Point aScrPos = pViewData->GetScrPos( nX1, nY1, eWhich ); @@ -619,9 +626,11 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI aDrawingRectLogic = PixelToLogic(aDrawingRectPixel, aDrawMode); } - OutputDevice* pContentDev = this; // device for document content, used by overlay manager + OutputDevice* pContentDev = &rDevice; // device for document content, used by overlay manager SdrPaintWindow* pTargetPaintWindow = 0; // #i74769# work with SdrPaintWindow directly + bool bIsTiledRendering = rDoc.GetDrawLayer()->isTiledRendering(); + if (!bIsTiledRendering) { // init redraw ScTabViewShell* pTabViewShell = pViewData->GetViewShell(); @@ -832,6 +841,7 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI } } + if (!bIsTiledRendering) { // end redraw ScTabViewShell* pTabViewShell = pViewData->GetViewShell(); @@ -858,25 +868,24 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI if ( bEditMode && (pViewData->GetRefTabNo() == pViewData->GetTabNo()) ) { //! use pContentDev for EditView? - SetMapMode(MAP_PIXEL); + rDevice.SetMapMode(MAP_PIXEL); SCCOL nCol1 = pViewData->GetEditStartCol(); SCROW nRow1 = pViewData->GetEditStartRow(); SCCOL nCol2 = pViewData->GetEditEndCol(); SCROW nRow2 = pViewData->GetEditEndRow(); - SetLineColor(); - SetFillColor( pEditView->GetBackgroundColor() ); + rDevice.SetLineColor(); + rDevice.SetFillColor(pEditView->GetBackgroundColor()); Point aStart = pViewData->GetScrPos( nCol1, nRow1, eWhich ); Point aEnd = pViewData->GetScrPos( nCol2+1, nRow2+1, eWhich ); long nLayoutSign = bLayoutRTL ? -1 : 1; aEnd.X() -= 2 * nLayoutSign; // don't overwrite grid aEnd.Y() -= 2; - DrawRect( Rectangle( aStart,aEnd ) ); + rDevice.DrawRect(Rectangle(aStart, aEnd)); - SetMapMode(pViewData->GetLogicMode()); - pEditView->Paint( PixelToLogic( Rectangle( Point( nScrX, nScrY ), - Size( aOutputData.GetScrW(), aOutputData.GetScrH() ) ) ) ); - SetMapMode(MAP_PIXEL); + rDevice.SetMapMode(pViewData->GetLogicMode()); + pEditView->Paint(PixelToLogic(Rectangle(Point(nScrX, nScrY), Size(aOutputData.GetScrW(), aOutputData.GetScrH()))), &rDevice); + rDevice.SetMapMode(MAP_PIXEL); } if (pViewData->HasEditView(eWhich)) @@ -936,74 +945,9 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice, ScTableInfo aTabInfo; pDoc->FillInfo(aTabInfo, nCol1, nRow1, nCol2, nRow2, nTab, fPPTX, fPPTY, false, false, NULL); - ScOutputData aOutData( - &rDevice, OUTTYPE_WINDOW, aTabInfo, pDoc, nTab, -fTilePosXPixel, -fTilePosYPixel, nCol1, nRow1, nCol2, nRow2, fPPTX, fPPTY); - - const svtools::ColorConfig& rColorCfg = SC_MOD()->GetColorConfig(); - Color aGridColor = rColorCfg.GetColorValue(svtools::CALCGRID, false).nColor; - if (aGridColor.GetColor() == COL_TRANSPARENT) - { - // use view options' grid color only if color config has "automatic" color - const ScViewOptions& rOpts = pViewData->GetOptions(); - aGridColor = rOpts.GetGridColor(); - } - aOutData.SetGridColor(aGridColor); - - aOutData.DrawClear(); - aOutData.DrawDocumentBackground(); - aOutData.DrawBackground(); - aOutData.DrawGrid(true, false); - - aOutData.DrawShadow(); - aOutData.DrawFrame(); - - // Set scaling to map mode only for text rendering, to get texts to scale - // correctly. - MapMode aOldMapMode = rDevice.GetMapMode(); - MapMode aNewMapMode = aOldMapMode; - aNewMapMode.SetScaleX(aFracX); - aNewMapMode.SetScaleY(aFracY); - rDevice.SetMapMode(aNewMapMode); + ScOutputData aOutputData(&rDevice, OUTTYPE_WINDOW, aTabInfo, pDoc, nTab, -fTilePosXPixel, -fTilePosYPixel, nCol1, nRow1, nCol2, nRow2, fPPTX, fPPTY); - aOutData.DrawStrings(true); - - // Edit texts need 1/100mm map mode to be rendered correctly. - aNewMapMode.SetMapUnit(MAP_100TH_MM); - rDevice.SetMapMode(aNewMapMode); - aOutData.DrawEdit(true); - - rDevice.SetMapMode(aOldMapMode); - - EditView* pEditView = NULL; - { - SCCOL nEditCol; - SCROW nEditRow; - pViewData->GetEditView( eWhich, pEditView, nEditCol, nEditRow ); - } - // InPlace Edit-View - // moved after EndDrawLayers() to get it outside the overlay buffer and - // on top of everything - if (pEditView) - { - //! use pContentDev for EditView? - rDevice.SetMapMode(MAP_PIXEL); - SCCOL nEditCol1 = pViewData->GetEditStartCol(); - SCROW nEditRow1 = pViewData->GetEditStartRow(); - SCCOL nEditCol2 = pViewData->GetEditEndCol(); - SCROW nEditRow2 = pViewData->GetEditEndRow(); - rDevice.SetLineColor(); - rDevice.SetFillColor( pEditView->GetBackgroundColor() ); - Point aStart = pViewData->GetScrPos( nEditCol1, nEditRow1, eWhich ); - Point aEnd = pViewData->GetScrPos( nEditCol2+1, nEditRow2+1, eWhich ); - aEnd.X() -= 2; // don't overwrite grid - aEnd.Y() -= 2; - rDevice.DrawRect( Rectangle( aStart,aEnd ) ); - - rDevice.SetMapMode(pViewData->GetLogicMode()); - pEditView->Paint( PixelToLogic( Rectangle( Point( fTilePosXPixel, fTilePosYPixel ), - Size( aOutData.GetScrW(), aOutData.GetScrH() ) ) ), &rDevice ); - rDevice.SetMapMode(MAP_PIXEL); - } + DrawContent(rDevice, aTabInfo, aOutputData, true, SC_UPDATE_ALL); } void ScGridWindow::LogicInvalidate(const ::vcl::Region* pRegion) commit 19dcbfbd8d97b69a7d81ec66c7207cb06af1ecc3 Author: Jan Holesovsky <[email protected]> Date: Fri Mar 6 16:44:46 2015 +0100 sc tiled rendering: Split ScGridWindow::Draw() to setup and drawing. The drawing part is planned to be shared with the tiled rendering, while the setup part has to be different. Change-Id: I9101111d44f4602cdb92916ff3889b52bf10a8bf diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx index b579148..776bb44 100644 --- a/sc/source/ui/inc/gridwin.hxx +++ b/sc/source/ui/inc/gridwin.hxx @@ -357,12 +357,15 @@ public: ::com::sun::star::sheet::DataPilotFieldOrientation GetDPFieldOrientation( SCCOL nCol, SCROW nRow ) const; - void DrawButtons( SCCOL nX1, SCCOL nX2, ScTableInfo& rTabInfo, OutputDevice* pContentDev); + void DrawButtons(SCCOL nX1, SCCOL nX2, const ScTableInfo& rTabInfo, OutputDevice* pContentDev); using Window::Draw; void Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMode eMode = SC_UPDATE_ALL ); + /// Draw content of the gridwindow; shared between the desktop and the tiled rendering. + void DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableInfo, ScOutputData& aOutputData, bool bLogicText, ScUpdateMode eMode); + void CreateAnchorHandle(SdrHdlList& rHdl, const ScAddress& rAddress); void HideCursor(); diff --git a/sc/source/ui/inc/output.hxx b/sc/source/ui/inc/output.hxx index ffb6bea..d605d53 100644 --- a/sc/source/ui/inc/output.hxx +++ b/sc/source/ui/inc/output.hxx @@ -147,6 +147,7 @@ private: RowInfo* pRowInfo; // Info block SCSIZE nArrCount; // occupied lines in info block ScDocument* mpDoc; // Document +public: SCTAB nTab; // sheet long nScrX; // Output Startpos. (Pixel) long nScrY; @@ -157,6 +158,7 @@ private: SCROW nY1; // ( incl. hidden ) SCCOL nX2; SCROW nY2; +private: SCCOL nVisX1; // Start-/End coordinates SCROW nVisY1; // ( visible range ) SCCOL nVisX2; diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index 54dee5f..3607e2e 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -427,7 +427,6 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod Point aScrPos = pViewData->GetScrPos( nX1, nY1, eWhich ); long nMirrorWidth = GetSizePixel().Width(); bool bLayoutRTL = rDoc.IsLayoutRTL( nTab ); - long nLayoutSign = bLayoutRTL ? -1 : 1; if ( bLayoutRTL ) { long nEndPixel = pViewData->GetScrPos( nX2+1, maVisibleRange.mnRow1, eWhich ).X(); @@ -463,14 +462,12 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod double nPPTY = pViewData->GetPPTY(); const ScViewOptions& rOpts = pViewData->GetOptions(); - bool bFormulaMode = rOpts.GetOption( VOPT_FORMULAS ); - bool bMarkClipped = rOpts.GetOption( VOPT_CLIPMARKS ); // Datenblock ScTableInfo aTabInfo; rDoc.FillInfo( aTabInfo, nX1, nY1, nX2, nY2, nTab, - nPPTX, nPPTY, false, bFormulaMode, + nPPTX, nPPTY, false, rOpts.GetOption(VOPT_FORMULAS), &pViewData->GetMarkData() ); Fraction aZoomX = pViewData->GetZoomX(); @@ -505,6 +502,37 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod bLogicText = true; // use logic MapMode } + DrawContent(*this, aTabInfo, aOutputData, bLogicText, eMode); + + // Wenn waehrend des Paint etwas invertiert wurde (Selektion geaendert aus Basic-Macro), + // ist das jetzt durcheinandergekommen und es muss neu gemalt werden + + OSL_ENSURE(nPaintCount, "nPaintCount falsch"); + --nPaintCount; + if (!nPaintCount) + CheckNeedsRepaint(); + + // Flag drawn formula cells "unchanged". + rDoc.ResetChanged(ScRange(nX1, nY1, nTab, nX2, nY2, nTab)); + rDoc.ClearFormulaContext(); +} + +void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableInfo, ScOutputData& aOutputData, + bool bLogicText, ScUpdateMode eMode) +{ + ScModule* pScMod = SC_MOD(); + ScDocShell* pDocSh = pViewData->GetDocShell(); + ScDocument& rDoc = pDocSh->GetDocument(); + const ScViewOptions& rOpts = pViewData->GetOptions(); + + SCTAB nTab = aOutputData.nTab; + SCCOL nX1 = aOutputData.nX1; + SCROW nY1 = aOutputData.nY1; + SCCOL nX2 = aOutputData.nX2; + SCROW nY2 = aOutputData.nY2; + long nScrX = aOutputData.nScrX; + long nScrY = aOutputData.nScrY; + const svtools::ColorConfig& rColorCfg = pScMod->GetColorConfig(); Color aGridColor( rColorCfg.GetColorValue( svtools::CALCGRID, false ).nColor ); if ( aGridColor.GetColor() == COL_TRANSPARENT ) @@ -516,9 +544,9 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod aOutputData.SetSyntaxMode ( pViewData->IsSyntaxMode() ); aOutputData.SetGridColor ( aGridColor ); aOutputData.SetShowNullValues ( rOpts.GetOption( VOPT_NULLVALS ) ); - aOutputData.SetShowFormulas ( bFormulaMode ); + aOutputData.SetShowFormulas ( rOpts.GetOption( VOPT_FORMULAS ) ); aOutputData.SetShowSpellErrors ( rDoc.GetDocOptions().IsAutoSpell() ); - aOutputData.SetMarkClipped ( bMarkClipped ); + aOutputData.SetMarkClipped ( rOpts.GetOption( VOPT_CLIPMARKS ) ); aOutputData.SetUseStyleColor( true ); // always set in table view @@ -562,6 +590,7 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod // define drawing layer map mode and paint rectangle const MapMode aDrawMode = GetDrawMapMode(); Rectangle aDrawingRectLogic; + bool bLayoutRTL = rDoc.IsLayoutRTL( nTab ); { // get drawing pixel rect @@ -704,13 +733,13 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod pContentDev->SetMapMode(pViewData->GetLogicMode(eWhich)); if ( bLogicText ) - aOutputData.DrawStrings(true); // in logic MapMode if bTextWysiwyg is set + aOutputData.DrawStrings(true); // in logic MapMode if bLogicText is set aOutputData.DrawEdit(true); pContentDev->SetMapMode(MAP_PIXEL); // Autofilter- und Pivot-Buttons - DrawButtons( nX1, nX2, aTabInfo, pContentDev ); // Pixel + DrawButtons(nX1, nX2, rTableInfo, pContentDev); // Pixel // Notiz-Anzeiger @@ -838,6 +867,8 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod SetFillColor( pEditView->GetBackgroundColor() ); Point aStart = pViewData->GetScrPos( nCol1, nRow1, eWhich ); Point aEnd = pViewData->GetScrPos( nCol2+1, nRow2+1, eWhich ); + + long nLayoutSign = bLayoutRTL ? -1 : 1; aEnd.X() -= 2 * nLayoutSign; // don't overwrite grid aEnd.Y() -= 2; DrawRect( Rectangle( aStart,aEnd ) ); @@ -861,18 +892,6 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod if ( pNoteMarker ) pNoteMarker->Draw(); // ueber den Cursor, im Drawing-MapMode - - // Wenn waehrend des Paint etwas invertiert wurde (Selektion geaendert aus Basic-Macro), - // ist das jetzt durcheinandergekommen und es muss neu gemalt werden - - OSL_ENSURE(nPaintCount, "nPaintCount falsch"); - --nPaintCount; - if (!nPaintCount) - CheckNeedsRepaint(); - - // Flag drawn formula cells "unchanged". - rDoc.ResetChanged(ScRange(nX1,nY1,nTab,nX2,nY2,nTab)); - rDoc.ClearFormulaContext(); } void ScGridWindow::PaintTile( VirtualDevice& rDevice, @@ -1219,7 +1238,7 @@ void ScGridWindow::DrawPagePreview( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, } } -void ScGridWindow::DrawButtons( SCCOL nX1, SCCOL nX2, ScTableInfo& rTabInfo, OutputDevice* pContentDev) +void ScGridWindow::DrawButtons(SCCOL nX1, SCCOL nX2, const ScTableInfo& rTabInfo, OutputDevice* pContentDev) { aComboButton.SetOutputDevice( pContentDev ); commit b19dda0ce0ea870f973ea8e747dc331aa99b71bb Author: Miklos Vajna <[email protected]> Date: Wed Feb 25 16:01:30 2015 +0100 Clean up not needed ScTabViewShell LOK methods Change-Id: Ic834d61cccdd422af96bd1b5933eb1a77e8efc16 diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx index 09622b3..4187feb 100644 --- a/sc/source/ui/inc/tabvwsh.hxx +++ b/sc/source/ui/inc/tabvwsh.hxx @@ -181,9 +181,6 @@ private: OUString maName; OUString maScope; - LibreOfficeKitCallback mpLibreOfficeKitCallback; - void* mpLibreOfficeKitData; - private: void Construct( sal_uInt8 nForceDesignMode = SC_FORCEMODE_NONE ); @@ -417,12 +414,6 @@ public: // #i123629# bool GetForceFocusOnCurCell() const { return bForceFocusOnCurCell; } void SetForceFocusOnCurCell(bool bFlag) { bForceFocusOnCurCell=bFlag; } - - /// The actual implementation of the vcl::ITiledRenderable::registerCallback() API. - void registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallback, void* pLibreOfficeKitData); - - /// Invokes the registered callback, if there are any. - void libreOfficeKitCallback(int nType, const char* pPayload) const; }; #endif diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 1a72f0a..46471c9 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -513,7 +513,7 @@ Size ScModelObj::getDocumentSize() void ScModelObj::registerCallback(LibreOfficeKitCallback pCallback, void* pData) { SolarMutexGuard aGuard; - pDocShell->GetBestViewShell()->registerLibreOfficeKitCallback(pCallback, pData); + pDocShell->GetDocument().GetDrawLayer()->registerLibreOfficeKitCallback(pCallback, pData); } void ScModelObj::initializeForTiledRendering() diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index dc88981..54dee5f 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -994,7 +994,7 @@ void ScGridWindow::LogicInvalidate(const ::vcl::Region* pRegion) sRectangle = "EMPTY"; else sRectangle = pRegion->GetBoundRect().toString(); - pViewData->GetViewShell()->libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr()); + pViewData->GetDocument()->GetDrawLayer()->libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr()); } void ScGridWindow::CheckNeedsRepaint() diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx index ef4f9f0..e657c47 100644 --- a/sc/source/ui/view/tabvwsh4.cxx +++ b/sc/source/ui/view/tabvwsh4.cxx @@ -1695,9 +1695,7 @@ ScTabViewShell::ScTabViewShell( SfxViewFrame* pViewFrame, bForceFocusOnCurCell(false), nCurRefDlgId(0), pAccessibilityBroadcaster(NULL), - mbInSwitch(false), - mpLibreOfficeKitCallback(NULL), - mpLibreOfficeKitData(NULL) + mbInSwitch(false) { const ScAppOptions& rAppOpt = SC_MOD()->GetAppOptions(); diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx index 1f20316..bc5cff7 100644 --- a/sc/source/ui/view/tabvwshc.cxx +++ b/sc/source/ui/view/tabvwshc.cxx @@ -477,16 +477,4 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog( return pResult; } -void ScTabViewShell::registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallback, void* pData) -{ - mpLibreOfficeKitCallback = pCallback; - mpLibreOfficeKitData = pData; -} - -void ScTabViewShell::libreOfficeKitCallback(int nType, const char* pPayload) const -{ - if (mpLibreOfficeKitCallback) - mpLibreOfficeKitCallback(nType, pPayload, mpLibreOfficeKitData); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit d7bead47d5859b0d9ea98b259662bc2ef9f4ff48 Author: Miklos Vajna <[email protected]> Date: Wed Feb 25 15:38:40 2015 +0100 ScInputHandler::ImplCreateEditEngine: don't invalidate unconditionally In the desktop case we still have to Paint() directly. This fixes the small rendering delay in the desktop case introduced by the previous commit. Change-Id: If07e2d47f62cbe17816439d18c45f129be6ce210 diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx index a5ae0d2..f277efc 100644 --- a/sc/inc/docuno.hxx +++ b/sc/inc/docuno.hxx @@ -391,6 +391,9 @@ public: // @see vcl::ITiledRenderable::registerCallback(). virtual void registerCallback(LibreOfficeKitCallback pCallback, void* pData) SAL_OVERRIDE; + + /// @see vcl::ITiledRenderable::initializeForTiledRendering(). + virtual void initializeForTiledRendering() SAL_OVERRIDE; }; class ScDrawPagesObj : public cppu::WeakImplHelper2< diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 623ee34..b3478dd 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -631,9 +631,12 @@ void ScInputHandler::ImplCreateEditEngine() // set the EditEngine so that it invalidates the view instead of direct // paint - EditView *pEditView = pEngine->GetActiveView(); - if (pEditView && !pEditView->isTiledRendering()) - pEditView->setTiledRendering(true); + if (pActiveViewSh) + { + ScDocument& rDoc = pActiveViewSh->GetViewData().GetDocShell()->GetDocument(); + if (EditView* pEditView = pEngine->GetActiveView()) + pEditView->setTiledRendering(rDoc.GetDrawLayer()->isTiledRendering()); + } } void ScInputHandler::UpdateAutoCorrFlag() diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 36640fa..1a72f0a 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -516,6 +516,12 @@ void ScModelObj::registerCallback(LibreOfficeKitCallback pCallback, void* pData) pDocShell->GetBestViewShell()->registerLibreOfficeKitCallback(pCallback, pData); } +void ScModelObj::initializeForTiledRendering() +{ + SolarMutexGuard aGuard; + pDocShell->GetDocument().GetDrawLayer()->setTiledRendering(true); +} + uno::Any SAL_CALL ScModelObj::queryInterface( const uno::Type& rType ) throw(uno::RuntimeException, std::exception) { commit 7629a600d808809ca92e6b13bf145c3edfef75f9 Author: Jan Holesovsky <[email protected]> Date: Wed Feb 25 15:06:00 2015 +0100 sc: Make characters appear during tiled rendering as they are typed. TODO FIXME proof-of-concept cut'n'paste This entire ScGridWindow::PaintTile() must share code with ScGridWindow::Draw(), that's the only way how to get also the shapes, charts and everything. Change-Id: I72d7363edc0c46a9920c3ca0d5d51c982e748a77 diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 180c864..623ee34 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -628,6 +628,12 @@ void ScInputHandler::ImplCreateEditEngine() pEngine->SetControlWord( pEngine->GetControlWord() | EE_CNTRL_AUTOCORRECT ); pEngine->SetModifyHdl( LINK( this, ScInputHandler, ModifyHdl ) ); } + + // set the EditEngine so that it invalidates the view instead of direct + // paint + EditView *pEditView = pEngine->GetActiveView(); + if (pEditView && !pEditView->isTiledRendering()) + pEditView->setTiledRendering(true); } void ScInputHandler::UpdateAutoCorrFlag() diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index cb119c5..dc88981 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -954,6 +954,37 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice, aOutData.DrawEdit(true); rDevice.SetMapMode(aOldMapMode); + + EditView* pEditView = NULL; + { + SCCOL nEditCol; + SCROW nEditRow; + pViewData->GetEditView( eWhich, pEditView, nEditCol, nEditRow ); + } + // InPlace Edit-View + // moved after EndDrawLayers() to get it outside the overlay buffer and + // on top of everything + if (pEditView) + { + //! use pContentDev for EditView? + rDevice.SetMapMode(MAP_PIXEL); + SCCOL nEditCol1 = pViewData->GetEditStartCol(); + SCROW nEditRow1 = pViewData->GetEditStartRow(); + SCCOL nEditCol2 = pViewData->GetEditEndCol(); + SCROW nEditRow2 = pViewData->GetEditEndRow(); + rDevice.SetLineColor(); + rDevice.SetFillColor( pEditView->GetBackgroundColor() ); + Point aStart = pViewData->GetScrPos( nEditCol1, nEditRow1, eWhich ); + Point aEnd = pViewData->GetScrPos( nEditCol2+1, nEditRow2+1, eWhich ); + aEnd.X() -= 2; // don't overwrite grid + aEnd.Y() -= 2; + rDevice.DrawRect( Rectangle( aStart,aEnd ) ); + + rDevice.SetMapMode(pViewData->GetLogicMode()); + pEditView->Paint( PixelToLogic( Rectangle( Point( fTilePosXPixel, fTilePosYPixel ), + Size( aOutData.GetScrW(), aOutData.GetScrH() ) ) ), &rDevice ); + rDevice.SetMapMode(MAP_PIXEL); + } } void ScGridWindow::LogicInvalidate(const ::vcl::Region* pRegion) commit b267bb658f935a85272d79a9be574cdbb0342518 Author: Jan Holesovsky <[email protected]> Date: Tue Feb 24 13:58:55 2015 +0100 sc: Initial support for tiled editing in Calc. Change-Id: Ifa5f84934a68fec86d4f30ee998bf75edfe331c5 diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx index 9f7ed0a..a5ae0d2 100644 --- a/sc/inc/docuno.hxx +++ b/sc/inc/docuno.hxx @@ -368,7 +368,7 @@ public: virtual sal_Int32 SAL_CALL getFormulaCellNumberLimit() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; - // ITiledRenderable + // @see vcl::ITiledRenderable::paintTile(). virtual void paintTile( VirtualDevice& rDevice, int nOutputWidth, int nOutputHeight, @@ -376,10 +376,21 @@ public: int nTilePosY, long nTileWidth, long nTileHeight ) SAL_OVERRIDE; + + // @see vcl::ITiledRenderable::getDocumentSize(). virtual Size getDocumentSize() SAL_OVERRIDE; - virtual void setPart( int nPart ) SAL_OVERRIDE; - virtual int getPart() SAL_OVERRIDE; - virtual int getParts() SAL_OVERRIDE; + + // @see vcl::ITiledRenderable::setPart(). + virtual void setPart(int nPart) SAL_OVERRIDE; + + // @see vcl::ITiledRenderable::getPart(). + virtual int getPart() SAL_OVERRIDE; + + // @see vcl::ITiledRenderable::getParts(). + virtual int getParts() SAL_OVERRIDE; + + // @see vcl::ITiledRenderable::registerCallback(). + virtual void registerCallback(LibreOfficeKitCallback pCallback, void* pData) SAL_OVERRIDE; }; class ScDrawPagesObj : public cppu::WeakImplHelper2< diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx index fe43cf2..b579148 100644 --- a/sc/source/ui/inc/gridwin.hxx +++ b/sc/source/ui/inc/gridwin.hxx @@ -324,6 +324,9 @@ public: int nTilePosX, int nTilePosY, long nTileWidth, long nTileHeight ); + /// @see OutputDevice::LogicInvalidate(). + void LogicInvalidate(const ::vcl::Region* pRegion) SAL_OVERRIDE; + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible() SAL_OVERRIDE; void FakeButtonUp(); diff --git a/sc/source/ui/inc/inputhdl.hxx b/sc/source/ui/inc/inputhdl.hxx index 65ea47c..829ec97 100644 --- a/sc/source/ui/inc/inputhdl.hxx +++ b/sc/source/ui/inc/inputhdl.hxx @@ -56,7 +56,7 @@ class ScInputHandler : boost::noncopyable private: ScInputWindow* pInputWin; - ScEditEngineDefaulter* pEngine; // edited data in the sheet + ScEditEngineDefaulter* pEngine; ///< Edited data in the sheet (when the user clicks into the sheet, and starts writing there). EditView* pTableView; // associated active EditView EditView* pTopView; // EditView in dthe input row diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx index 9020c21..09622b3 100644 --- a/sc/source/ui/inc/tabvwsh.hxx +++ b/sc/source/ui/inc/tabvwsh.hxx @@ -180,6 +180,10 @@ private: bool mbInSwitch; OUString maName; OUString maScope; + + LibreOfficeKitCallback mpLibreOfficeKitCallback; + void* mpLibreOfficeKitData; + private: void Construct( sal_uInt8 nForceDesignMode = SC_FORCEMODE_NONE ); @@ -413,6 +417,12 @@ public: // #i123629# bool GetForceFocusOnCurCell() const { return bForceFocusOnCurCell; } void SetForceFocusOnCurCell(bool bFlag) { bForceFocusOnCurCell=bFlag; } + + /// The actual implementation of the vcl::ITiledRenderable::registerCallback() API. + void registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallback, void* pLibreOfficeKitData); + + /// Invokes the registered callback, if there are any. + void libreOfficeKitCallback(int nType, const char* pPayload) const; }; #endif diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index faf655b..36640fa 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -510,6 +510,12 @@ Size ScModelObj::getDocumentSize() return aSize; } +void ScModelObj::registerCallback(LibreOfficeKitCallback pCallback, void* pData) +{ + SolarMutexGuard aGuard; + pDocShell->GetBestViewShell()->registerLibreOfficeKitCallback(pCallback, pData); +} + 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 07a5d62..cb119c5 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -29,6 +29,9 @@ #include <sfx2/printer.hxx> #include <vcl/settings.hxx> +#define LOK_USE_UNSTABLE_API +#include <LibreOfficeKit/LibreOfficeKitEnums.h> + #include <svx/svdview.hxx> #include "tabvwsh.hxx" @@ -953,6 +956,16 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice, rDevice.SetMapMode(aOldMapMode); } +void ScGridWindow::LogicInvalidate(const ::vcl::Region* pRegion) +{ + OString sRectangle; + if (!pRegion) + sRectangle = "EMPTY"; + else + sRectangle = pRegion->GetBoundRect().toString(); + pViewData->GetViewShell()->libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr()); +} + void ScGridWindow::CheckNeedsRepaint() { // called at the end of painting, and from timer after background text width calculation diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx index 2563bdf..ef4f9f0 100644 --- a/sc/source/ui/view/tabvwsh4.cxx +++ b/sc/source/ui/view/tabvwsh4.cxx @@ -1449,53 +1449,6 @@ bool ScTabViewShell::KeyInput( const KeyEvent &rKeyEvent ) return TabKeyInput( rKeyEvent ); } -#define __INIT_ScTabViewShell \ - eCurOST(OST_NONE), \ - nDrawSfxId(0), \ - nCtrlSfxId(USHRT_MAX), \ - nFormSfxId(USHRT_MAX), \ - pDrawShell(NULL), \ - pDrawTextShell(NULL), \ - pEditShell(NULL), \ - pPivotShell(NULL), \ - pAuditingShell(NULL), \ - pDrawFormShell(NULL), \ - pCellShell(NULL), \ - pOleObjectShell(NULL), \ - pChartShell(NULL), \ - pGraphicShell(NULL), \ - pMediaShell(NULL), \ - pPageBreakShell(NULL), \ - pExtrusionBarShell(NULL), \ - pFontworkBarShell(NULL), \ - pFormShell(NULL), \ - pInputHandler(NULL), \ - pCurFrameLine(NULL), \ - aTarget( this ), \ - pDialogDPObject(NULL), \ - pNavSettings(NULL), \ - bActiveDrawSh(false), \ - bActiveDrawTextSh(false), \ - bActivePivotSh(false), \ - bActiveAuditingSh(false), \ - bActiveDrawFormSh(false), \ - bActiveOleObjectSh(false), \ - bActiveChartSh(false), \ - bActiveGraphicSh(false), \ - bActiveMediaSh(false), \ - bActiveEditSh(false), \ - bFormShellAtTop(false), \ - bDontSwitch(false), \ - bInFormatDialog(false), \ - bPrintSelected(false), \ - bReadOnly(false), \ - pScSbxObject(NULL), \ - bChartAreaValid(false), \ - bForceFocusOnCurCell(false),\ - nCurRefDlgId(0), \ - pAccessibilityBroadcaster(NULL), \ - mbInSwitch(false) - void ScTabViewShell::Construct( sal_uInt8 nForceDesignMode ) { SfxApplication* pSfxApp = SfxGetpApp(); @@ -1698,7 +1651,53 @@ ScTabViewShell::ScTabViewShell( SfxViewFrame* pViewFrame, SfxViewShell* pOldSh ) : SfxViewShell( pViewFrame, SFX_VIEW_CAN_PRINT | SFX_VIEW_HAS_PRINTOPTIONS ), ScDBFunc( &pViewFrame->GetWindow(), static_cast<ScDocShell&>(*pViewFrame->GetObjectShell()), this ), - __INIT_ScTabViewShell + eCurOST(OST_NONE), + nDrawSfxId(0), + nCtrlSfxId(USHRT_MAX), + nFormSfxId(USHRT_MAX), + pDrawShell(NULL), + pDrawTextShell(NULL), + pEditShell(NULL), + pPivotShell(NULL), + pAuditingShell(NULL), + pDrawFormShell(NULL), + pCellShell(NULL), + pOleObjectShell(NULL), + pChartShell(NULL), + pGraphicShell(NULL), + pMediaShell(NULL), + pPageBreakShell(NULL), + pExtrusionBarShell(NULL), + pFontworkBarShell(NULL), + pFormShell(NULL), + pInputHandler(NULL), + pCurFrameLine(NULL), + aTarget(this), + pDialogDPObject(NULL), + pNavSettings(NULL), + bActiveDrawSh(false), + bActiveDrawTextSh(false), + bActivePivotSh(false), + bActiveAuditingSh(false), + bActiveDrawFormSh(false), + bActiveOleObjectSh(false), + bActiveChartSh(false), + bActiveGraphicSh(false), + bActiveMediaSh(false), + bActiveEditSh(false), + bFormShellAtTop(false), + bDontSwitch(false), + bInFormatDialog(false), + bPrintSelected(false), + bReadOnly(false), + pScSbxObject(NULL), + bChartAreaValid(false), + bForceFocusOnCurCell(false), + nCurRefDlgId(0), + pAccessibilityBroadcaster(NULL), + mbInSwitch(false), + mpLibreOfficeKitCallback(NULL), + mpLibreOfficeKitData(NULL) { const ScAppOptions& rAppOpt = SC_MOD()->GetAppOptions(); @@ -1744,8 +1743,6 @@ ScTabViewShell::ScTabViewShell( SfxViewFrame* pViewFrame, MakeDrawLayer(); } -#undef __INIT_ScTabViewShell - ScTabViewShell::~ScTabViewShell() { ScDocShell* pDocSh = GetViewData().GetDocShell(); diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx index bc5cff7..1f20316 100644 --- a/sc/source/ui/view/tabvwshc.cxx +++ b/sc/source/ui/view/tabvwshc.cxx @@ -477,4 +477,16 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog( return pResult; } +void ScTabViewShell::registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallback, void* pData) +{ + mpLibreOfficeKitCallback = pCallback; + mpLibreOfficeKitData = pData; +} + +void ScTabViewShell::libreOfficeKitCallback(int nType, const char* pPayload) const +{ + if (mpLibreOfficeKitCallback) + mpLibreOfficeKitCallback(nType, pPayload, mpLibreOfficeKitData); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit cae41ff97c206341f4accfed3057f787f4a9eece Author: Miklos Vajna <[email protected]> Date: Fri Feb 20 14:51:06 2015 +0100 sd::ViewShell -> SdrModel for LOK callback One one hand, this fixes missing invalidations after typing characters in editeng on Android. Previously it was assumed that there is only one sd::ViewShell for one Impress document, but that's obviously not true. On the other hand, this will be handy when later svx code wants to invoke the LOK callback as well, when it was stored in sd, that wasn't possible. Conflicts: sd/source/ui/unoidl/unomodel.cxx sd/source/ui/view/sdwindow.cxx Change-Id: Id467be01ad008aecaaabdd85b2a6b29a14f1eb86 diff --git a/include/svx/svdmodel.hxx b/include/svx/svdmodel.hxx index d456828..8310773 100644 --- a/include/svx/svdmodel.hxx +++ b/include/svx/svdmodel.hxx @@ -37,6 +37,7 @@ #include <svx/xtable.hxx> #include <svx/pageitem.hxx> #include <vcl/field.hxx> +#include <vcl/ITiledRenderable.hxx> #include <boost/shared_ptr.hpp> @@ -173,6 +174,8 @@ protected: OutputDevice* pRefOutDev; // ReferenceDevice for the EditEngine /// Set if we are doing tiled rendering. bool mbTiledRendering; + LibreOfficeKitCallback mpLibreOfficeKitCallback; + void* mpLibreOfficeKitData; sal_uIntPtr nProgressAkt; // for the sal_uIntPtr nProgressMax; // ProgressBar- sal_uIntPtr nProgressOfs; // -Handler @@ -341,6 +344,10 @@ public: void setTiledRendering(bool bTiledRendering); /// Are we doing tiled rendering? bool isTiledRendering() const; + /// The actual implementation of the vcl::ITiledRenderable::registerCallback() API. + void registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallback, void* pLibreOfficeKitData); + /// Invokes the registered callback, if there are any. + void libreOfficeKitCallback(int nType, const char* pPayload) const; // If a new MapMode is set on the RefDevice (or similar) void RefDeviceChanged(); // not yet implemented // default font heigth in logical units diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx index 8cca27d..c9898e6 100644 --- a/svx/source/svdraw/svdmodel.cxx +++ b/svx/source/svdraw/svdmodel.cxx @@ -125,6 +125,8 @@ void SdrModel::ImpCtor(SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* _pEmbe pHitTestOutliner=NULL; pRefOutDev=NULL; mbTiledRendering = false; + mpLibreOfficeKitCallback = 0; + mpLibreOfficeKitData = 0; nProgressAkt=0; nProgressMax=0; nProgressOfs=0; @@ -819,6 +821,18 @@ bool SdrModel::isTiledRendering() const return mbTiledRendering; } +void SdrModel::registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallback, void* pData) +{ + mpLibreOfficeKitCallback = pCallback; + mpLibreOfficeKitData = pData; +} + +void SdrModel::libreOfficeKitCallback(int nType, const char* pPayload) const +{ + if (mpLibreOfficeKitCallback) + mpLibreOfficeKitCallback(nType, pPayload, mpLibreOfficeKitData); +} + void SdrModel::ImpReformatAllTextObjects() { if( isLocked() ) commit 0cc0c420c666246e85d623a2a796e66434cc33fd Author: Miklos Vajna <[email protected]> Date: Thu Feb 19 14:38:53 2015 +0100 ImpEditEngine::UpdateViews: need to go via Invalidate() for tiled rendering This makes typed characters appear as you type it (and not only after the editing of the shape text is finished) in Impress. Change-Id: Id47efe8223ddfdbad36f436366c9c8c8e0cb45f4 diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index cc3db19..cfd4fc5 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -572,6 +572,16 @@ Color EditView::GetBackgroundColor() const return pImpEditView->GetBackgroundColor(); } +void EditView::setTiledRendering(bool bTiledRendering) +{ + pImpEditView->setTiledRendering(bTiledRendering); +} + +bool EditView::isTiledRendering() +{ + return pImpEditView->isTiledRendering(); +} + void EditView::SetControlWord( sal_uInt32 nWord ) { pImpEditView->nControl = nWord; diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx index 4ec83bb..ed543cb 100644 --- a/editeng/source/editeng/impedit.cxx +++ b/editeng/source/editeng/impedit.cxx @@ -75,6 +75,7 @@ ImpEditView::ImpEditView( EditView* pView, EditEngine* pEng, vcl::Window* pWindo pOutWin = pWindow; pPointer = NULL; pBackgroundColor = NULL; + mbTiledRendering = false; nScrollDiffX = 0; nExtraCursorFlags = 0; nCursorBidiLevel = CURSOR_BIDILEVEL_DONTKNOW; @@ -112,6 +113,16 @@ void ImpEditView::SetBackgroundColor( const Color& rColor ) pBackgroundColor = new Color( rColor ); } +void ImpEditView::setTiledRendering(bool bTiledRendering) +{ + mbTiledRendering = bTiledRendering; +} + +bool ImpEditView::isTiledRendering() const +{ + return mbTiledRendering; +} + void ImpEditView::SetEditSelection( const EditSelection& rEditSelection ) { // set state before notification diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index 78128ab..0bcaa38 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -215,6 +215,7 @@ private: EditView* pEditView; vcl::Cursor* pCursor; Color* pBackgroundColor; + bool mbTiledRendering; EditEngine* pEditEngine; vcl::Window* pOutWin; Pointer* pPointer; @@ -363,6 +364,9 @@ public: const Color& GetBackgroundColor() const { return ( pBackgroundColor ? *pBackgroundColor : pOutWin->GetBackground().GetColor() ); } + void setTiledRendering(bool bTiledRendering); + bool isTiledRendering() const; + bool IsWrongSpelledWord( const EditPaM& rPaM, bool bMarkIfWrong ); OUString SpellIgnoreOrAddWord( bool bAdd ); diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index 57cedf4..62e5596 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -290,7 +290,8 @@ void ImpEditEngine::UpdateViews( EditView* pCurView ) // convert to window coordinates .... aClipRect = pView->pImpEditView->GetWindowPos( aClipRect ); - if ( pView == pCurView ) + // For tiled rendering, we have to always go via Invalidate(). + if ( pView == pCurView && !pView->isTiledRendering()) Paint( pView->pImpEditView, aClipRect, 0, true ); else pView->GetWindow()->Invalidate( aClipRect ); diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx index 652fcaa..e545e9f 100644 --- a/editeng/source/outliner/outlvw.cxx +++ b/editeng/source/outliner/outlvw.cxx @@ -1420,6 +1420,10 @@ void OutlinerView::SetBackgroundColor( const Color& rColor ) pEditView->SetBackgroundColor( rColor ); } +void OutlinerView::setTiledRendering(bool bTiledRendering) +{ + pEditView->setTiledRendering(bTiledRendering); +} Color OutlinerView::GetBackgroundColor() { diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx index cf26a62..131f605 100644 --- a/include/editeng/editview.hxx +++ b/include/editeng/editview.hxx @@ -169,6 +169,9 @@ public: void SetBackgroundColor( const Color& rColor ); Color GetBackgroundColor() const; + void setTiledRendering(bool bTiledRendering); + bool isTiledRendering(); + void SetControlWord( sal_uInt32 nWord ); sal_uInt32 GetControlWord() const; diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx index f27818f..1e6bb4a 100644 --- a/include/editeng/outliner.hxx +++ b/include/editeng/outliner.hxx @@ -257,6 +257,9 @@ public: void SetBackgroundColor( const Color& rColor ); Color GetBackgroundColor(); + /// Set if we are doing tiled rendering. + void setTiledRendering(bool bTiledRendering); + SfxItemSet GetAttribs(); void Cut(); diff --git a/include/svx/svdmodel.hxx b/include/svx/svdmodel.hxx index a923c78..d456828 100644 --- a/include/svx/svdmodel.hxx +++ b/include/svx/svdmodel.hxx @@ -171,6 +171,8 @@ protected: SdrOutliner* pHitTestOutliner;// an Outliner for the HitTest sal_uIntPtr nDefTextHgt; // Default text heigth in logical units OutputDevice* pRefOutDev; // ReferenceDevice for the EditEngine + /// Set if we are doing tiled rendering. + bool mbTiledRendering; sal_uIntPtr nProgressAkt; // for the sal_uIntPtr nProgressMax; // ProgressBar- sal_uIntPtr nProgressOfs; // -Handler @@ -335,6 +337,10 @@ public: // ReferenceDevice for the EditEngine void SetRefDevice(OutputDevice* pDev); OutputDevice* GetRefDevice() const { return pRefOutDev; } + /// Set if we are doing tiled rendering. + void setTiledRendering(bool bTiledRendering); + /// Are we doing tiled rendering? + bool isTiledRendering() const; // If a new MapMode is set on the RefDevice (or similar) void RefDeviceChanged(); // not yet implemented // default font heigth in logical units diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 431e4c6..d6cd0ad 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -2351,6 +2351,7 @@ void SdXImpressDocument::initializeForTiledRendering() { // tiled rendering works only when we are in the 'Normal' view, switch to that mpDocShell->GetViewShell()->GetViewFrame()->GetDispatcher()->Execute(SID_VIEWSHELL0, SfxCallMode::SYNCHRON | SfxCallMode::RECORD); + mpDoc->setTiledRendering(true); } uno::Reference< i18n::XForbiddenCharacters > SdXImpressDocument::getForbiddenCharsTable() diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index d3dcf97..3914681 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -446,6 +446,7 @@ OutlinerView* SdrObjEditView::ImpMakeOutlinerView(vcl::Window* pWin, bool /*bNoP } pOutlView->SetControlWord(nStat); pOutlView->SetBackgroundColor( aBackground ); + pOutlView->setTiledRendering(GetModel()->isTiledRendering()); if (pText!=NULL) { pOutlView->SetAnchorMode((EVAnchorMode)(pText->GetOutlinerViewAnchorMode())); diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx index 60aec94..8cca27d 100644 --- a/svx/source/svdraw/svdmodel.cxx +++ b/svx/source/svdraw/svdmodel.cxx @@ -124,6 +124,7 @@ void SdrModel::ImpCtor(SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* _pEmbe pDrawOutliner=NULL; pHitTestOutliner=NULL; pRefOutDev=NULL; + mbTiledRendering = false; nProgressAkt=0; nProgressMax=0; nProgressOfs=0; @@ -808,6 +809,16 @@ void SdrModel::SetRefDevice(OutputDevice* pDev) RefDeviceChanged(); } +void SdrModel::setTiledRendering(bool bTiledRendering) +{ + mbTiledRendering = bTiledRendering; +} + +bool SdrModel::isTiledRendering() const +{ + return mbTiledRendering; +} + void SdrModel::ImpReformatAllTextObjects() { if( isLocked() ) _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
