diff options
author | Jan Holesovsky <kendy@collabora.com> | 2015-03-06 16:44:46 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-03-09 10:16:18 +0100 |
commit | d38c2cd2d51212dfcd50197d6a86c61dd74dcb68 (patch) | |
tree | 77d56ffed742b229b8f3ecef512a0a2f2b85edc8 /sc/source | |
parent | 658f762dcdb80e73fc9007756f9dff801d3bd452 (diff) |
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
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/ui/inc/gridwin.hxx | 5 | ||||
-rw-r--r-- | sc/source/ui/inc/output.hxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin4.cxx | 61 |
3 files changed, 46 insertions, 22 deletions
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx index 712fb7245c62..17a255f7aacc 100644 --- a/sc/source/ui/inc/gridwin.hxx +++ b/sc/source/ui/inc/gridwin.hxx @@ -355,12 +355,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 ffb6bea95872..d605d5370ee6 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 17f1ae0f4cf6..314df1d190eb 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 ); |