Rebased ref, commits from common ancestor: commit 713d6b45bb3141db12777b5bc068a9a7719ae458 Author: Andrzej Hunt <andrzej.h...@collabora.com> Date: Wed Aug 27 14:29:07 2014 +0200
Use GetScrPos so that col/row-headers match the grid. Without this we can still get single pixel errors which can sum up over multiple columns/row. Change-Id: Id428dafab1ca771c123c84d815261263a7d33fed diff --git a/sc/source/ui/view/colrowba.cxx b/sc/source/ui/view/colrowba.cxx index e560855..ad61654 100644 --- a/sc/source/ui/view/colrowba.cxx +++ b/sc/source/ui/view/colrowba.cxx @@ -81,9 +81,18 @@ sal_uInt16 ScColBar::GetEntrySize( SCCOLROW nEntryNo ) const ScDocument* pDoc = pViewData->GetDocument(); SCTAB nTab = pViewData->GetTabNo(); if (pDoc->ColHidden(static_cast<SCCOL>(nEntryNo), nTab)) + { return 0; + } else - return (sal_uInt16) ScViewData::ToPixel( pDoc->GetColWidth( static_cast<SCCOL>(nEntryNo), nTab ), pViewData->GetPPTX() ); + { + Point aBefore = pViewData->GetScrPos( nEntryNo, 0, SC_SPLIT_BOTTOMLEFT ); + Point aAfter = pViewData->GetScrPos( nEntryNo + 1, 0, SC_SPLIT_BOTTOMLEFT ); + + bool bLayoutRTL = IsLayoutRTL(); + long nLayoutSign = bLayoutRTL ? -1 : 1; + return ( aAfter.getX() - aBefore.getX() ) * nLayoutSign; + } } OUString ScColBar::GetEntryText( SCCOLROW nEntryNo ) const @@ -236,10 +245,16 @@ sal_uInt16 ScRowBar::GetEntrySize( SCCOLROW nEntryNo ) const SCTAB nTab = pViewData->GetTabNo(); SCROW nLastRow = -1; if (pDoc->RowHidden(nEntryNo, nTab, NULL, &nLastRow)) + { return 0; + } else - return (sal_uInt16) ScViewData::ToPixel( pDoc->GetOriginalHeight( nEntryNo, - nTab ), pViewData->GetPPTY() ); + { + Point aBefore = pViewData->GetScrPos( 0, nEntryNo, SC_SPLIT_BOTTOMLEFT ); + Point aAfter = pViewData->GetScrPos( 0, nEntryNo + 1, SC_SPLIT_BOTTOMLEFT ); + + return aAfter.getY() - aBefore.getY(); + } } OUString ScRowBar::GetEntryText( SCCOLROW nEntryNo ) const commit 503f504dc53d9d488e60920877405cc8264bfabd Author: Andrzej Hunt <andrzej.h...@collabora.com> Date: Wed Aug 27 20:52:09 2014 +0200 Match TiledRendering scaling to the new ViewData PaintMapMode. This is a bit hacky, still need to figure out what's going wrong that we need this weird conversion. Change-Id: Id1c62401f9f85c6d436bdd73b51ccf126100cbc4 diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index 58f7fe3..4281693 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -964,21 +964,30 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice, // that VirtualDevices use a DPI of 96. We might as well do this // calculation now, rather than after another dimension conversion, // to minimise errors. - Fraction scaleX = Fraction( nOutputWidth, 96 ) * Fraction(1440L) / + // TODO: width wise we need the print scaling compensation stuff? + Fraction scaleX = Fraction( 100*nOutputWidth, 96*96 ) * Fraction(1440L) / Fraction( nTileWidth); - Fraction scaleY = Fraction( nOutputHeight, 96 ) * Fraction(1440L) / + if ( pViewData->GetDocShell() ) + { + scaleX *= pViewData->GetDocShell()->GetOutputFactor(); + } + Fraction scaleY = Fraction( 100*nOutputHeight, 96*96 ) * Fraction(1440L) / Fraction( nTileHeight); rDevice.SetOutputSizePixel( Size( nOutputWidth, nOutputHeight ) ); - MapMode aMapMode( rDevice.GetMapMode() ); - aMapMode.SetMapUnit( MAP_TWIP ); - aMapMode.SetOrigin( Point( -nTilePosX, -nTilePosY ) ); - aMapMode.SetScaleX( scaleX ); - aMapMode.SetScaleY( scaleY ); + pViewData->SetZoom( scaleX, scaleY, false ); + // We now need to force a recalculation of PaintMapMode, which + // happens when ScViewData::CalcPPT is called by RefreshZoom. + pViewData->RefreshZoom(); - maPaintMapMode = aMapMode; -// rDevice.SetMapMode( aMapMode ); + // We only need to propagate the origin through to Draw() + // through the device. + MapMode aMapMode( rDevice.GetMapMode() ); + aMapMode.SetOrigin( rDevice.LogicToPixel( + Point(-nTilePosX, -nTilePosY ), + pViewData->GetPaintMapMode() ) ); + rDevice.SetMapMode( aMapMode ); ScTabViewShell* pTabViewSh = pViewData->GetViewShell(); SdrView* pDrawView = pTabViewSh->GetScDrawView(); commit f3e1e93df5fe7290b9486cb2d06feb40fae4bbe6 Author: Andrzej Hunt <andrzej.h...@collabora.com> Date: Wed Aug 27 20:42:48 2014 +0200 Don't use UpdateVisibleRange for calc tiled rendering. Change-Id: Iaba02741acc280dfc4c500e0d08271b39560149b diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index cae7e98..58f7fe3 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -464,7 +464,13 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod OSL_ENSURE( ValidCol(nX2) && ValidRow(nY2), "GridWin Draw Bereich zu gross" ); - UpdateVisibleRange(); + // We can only do this for non-tiled rendering as it manipulates + // maVisibleRange on the basis of what pViewData thinks is on screen, + // whereas for tiled rendering we are completely independent of our + // usual screen-rendering assumptions and therefore have already + // set maVisibleRange as appropriate in Paint(). + if ( pOutDev == this ) + UpdateVisibleRange(); if (nX2 < maVisibleRange.mnCol1 || nY2 < maVisibleRange.mnRow1) return; commit e87d0e50777c9c5e0f6922b97cfcdf60b47610df Author: Andrzej Hunt <andrzej.h...@collabora.com> Date: Wed Aug 27 20:37:45 2014 +0200 Set visible range from origin for Calc Tiled Rendering. Change-Id: I255b8865786088751c5d71da9db2ba38defed3bd diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index 040fd17..cae7e98 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -380,7 +380,21 @@ void ScGridWindow::Paint( const Rectangle& rRect, OutputDevice* pOutDev ) // We specifically need to set the visible range here -- by default it is // set in UpdateVisibleRange which however uses the viewdata, which is // completely irrelevant for tiled rendering. - maVisibleRange.set( nX1, nY1, nX2, nY2 ); + // However we don't want to fiddle with the visible range for normal + // rendering (i.e. pOutDev == this). + if ( pOutDev != this ) + { + // We need to iterate positions from the origin when doing tiled + // rendering to ensure that tile edges actually match -- the + // visible area is used for FillData which is used for the + // position determination. + // However ultimately we probably want to kill the use of FillData + // for position determination since we no longer scale the values + // that we put in there? + nX1 = 0; + nY1 = 0; + maVisibleRange.set( nX1, nY1, nX2, nY2 ); + } Draw( nX1,nY1,nX2,nY2, SC_UPDATE_MARKS, pOutDev ); // nicht weiterzeichnen bIsInPaint = false; } commit b1a031d50d3de4b722ca6b8f2afe4a8c13b79897 Author: Andrzej Hunt <andrzej.h...@collabora.com> Date: Wed Aug 27 14:46:06 2014 +0200 Allow PaintMapMode retrieval. We need this for conversions elsewhere (outside of ScViewData). Conflicts: sc/source/ui/inc/viewdata.hxx Change-Id: I86ce18a22095488d3d3750bd13a5fab46a352be5 diff --git a/sc/source/ui/inc/viewdata.hxx b/sc/source/ui/inc/viewdata.hxx index 4623b24..fd3cf26 100644 --- a/sc/source/ui/inc/viewdata.hxx +++ b/sc/source/ui/inc/viewdata.hxx @@ -482,6 +482,8 @@ public: static inline long ToPixel( sal_uInt16 nTwips, double nFactor ); + MapMode& GetPaintMapMode() { return maPaintMapMode; } + /** while (rScrY <= nEndPixels && rPosY <= nEndRow) add pixels of row heights converted with nPPTY to rScrY, optimized for row height segments. Upon return rPosY is the last row evaluated <= nEndRow, rScrY commit 40a1470c8a6947bcbb46116f135462227255421e Author: Andrzej Hunt <andrzej.h...@collabora.com> Date: Fri Aug 15 16:48:01 2014 +0200 Use MapMode instead of nPPTX/nPPTY. This is far from complete: we need to replace all uses of nPPTX/nPPTY for things to work correctly. Change-Id: I7c8aca62c537d8770903f4a6ae0a164479af3fc1 diff --git a/sc/source/ui/inc/viewdata.hxx b/sc/source/ui/inc/viewdata.hxx index 683e985..4623b24 100644 --- a/sc/source/ui/inc/viewdata.hxx +++ b/sc/source/ui/inc/viewdata.hxx @@ -156,6 +156,7 @@ class SC_DLLPUBLIC ScViewData { private: double nPPTX, nPPTY; // Scaling factors + MapMode maPaintMapMode; ::std::vector<ScViewDataTable*> maTabData; boost::scoped_ptr<ScMarkData> mpMarkData; diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index d7c25b2..6db5e56 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -2151,42 +2151,16 @@ void ScViewData::UpdateScreenZoom( const Fraction& rNewX, const Fraction& rNewY void ScViewData::CalcPPT() { - nPPTX = ScGlobal::nScreenPPTX * (double) GetZoomX(); - if (pDocShell) - nPPTX = nPPTX / pDocShell->GetOutputFactor(); // Faktor ist Drucker zu Bildschirm - nPPTY = ScGlobal::nScreenPPTY * (double) GetZoomY(); - - // if detective objects are present, - // try to adjust horizontal scale so the most common column width has minimal rounding errors, - // to avoid differences between cell and drawing layer output + maPaintMapMode.SetMapUnit( MAP_TWIP ); - if ( pDoc && pDoc->HasDetectiveObjects(nTabNo) ) + Fraction aScaleX = GetZoomX() * Fraction(0.96); + if ( pDocShell ) { - SCCOL nEndCol = 0; - SCROW nDummy = 0; - pDoc->GetTableArea( nTabNo, nEndCol, nDummy ); - if (nEndCol<20) - nEndCol = 20; // same end position as when determining draw scale - - sal_uInt16 nTwips = pDoc->GetCommonWidth( nEndCol, nTabNo ); - if ( nTwips ) - { - double fOriginal = nTwips * nPPTX; - if ( fOriginal < static_cast<double>(nEndCol) ) - { - // if one column is smaller than the column count, - // rounding errors are likely to add up to a whole column. - - double fRounded = ::rtl::math::approxFloor( fOriginal + 0.5 ); - if ( fRounded > 0.0 ) - { - double fScale = fRounded / fOriginal + 1E-6; - if ( fScale >= 0.9 && fScale <= 1.1 ) - nPPTX *= fScale; - } - } - } + aScaleX /= pDocShell->GetOutputFactor(); } + + maPaintMapMode.SetScaleX( aScaleX ); + maPaintMapMode.SetScaleY( GetZoomY() * Fraction(0.96) ); } #define SC_OLD_TABSEP '/' commit 332f911c9f04e0497f61d8b59738c6b5d1332599 Author: Andrzej Hunt <andrzej.h...@collabora.com> Date: Fri Aug 15 16:46:11 2014 +0200 ScOutputData needs ScViewData for scaling. Change-Id: I14cd3e835ba8233478514d5f6832737aa2c99bf9 diff --git a/sc/source/ui/inc/output.hxx b/sc/source/ui/inc/output.hxx index e7dd3d5..760883b 100644 --- a/sc/source/ui/inc/output.hxx +++ b/sc/source/ui/inc/output.hxx @@ -48,6 +48,7 @@ class ScTabViewShell; class ScPageBreakData; class FmFormView; class ScFieldEditEngine; +class ScViewData; class SdrPaintWindow; #define SC_SCENARIO_HSPACE 60 @@ -143,6 +144,11 @@ private: OutputDevice* mpDev; // Device OutputDevice* mpRefDevice; // printer if used for preview OutputDevice* pFmtDevice; // reference for text formatting + + // This may be NULL -- i.e. it should be used when available, + // but otherwise ignored. + ScViewData* mpViewData; + ScTableInfo& mrTabInfo; RowInfo* pRowInfo; // Info block SCSIZE nArrCount; // occupied lines in info block @@ -258,6 +264,7 @@ private: public: ScOutputData( OutputDevice* pNewDev, ScOutputType eNewType, + ScViewData* pViewData, ScTableInfo& rTabInfo, ScDocument* pNewDoc, SCTAB nNewTab, long nNewScrX, long nNewScrY, SCCOL nNewX1, SCROW nNewY1, SCCOL nNewX2, SCROW nNewY2, diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index e777df8..4d5ad0a 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -4627,7 +4627,7 @@ void ScGridWindow::UpdateFormulas() Fraction aZoomX = pViewData->GetZoomX(); Fraction aZoomY = pViewData->GetZoomY(); - ScOutputData aOutputData( this, OUTTYPE_WINDOW, aTabInfo, &rDoc, nTab, + ScOutputData aOutputData( this, OUTTYPE_WINDOW, pViewData, aTabInfo, &rDoc, nTab, nScrX, nScrY, nX1, nY1, nX2, nY2, nPPTX, nPPTY, &aZoomX, &aZoomY ); aOutputData.SetMirrorWidth( nMirrorWidth ); diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index 022f6e3..040fd17 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -533,7 +533,7 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod Fraction aZoomX = pViewData->GetZoomX(); Fraction aZoomY = pViewData->GetZoomY(); - ScOutputData aOutputData( pOutDev, OUTTYPE_WINDOW, aTabInfo, &rDoc, nTab, + ScOutputData aOutputData( pOutDev, OUTTYPE_WINDOW, pViewData, aTabInfo, &rDoc, nTab, nScrX, nScrY, nX1, nY1, nX2, nY2, nPPTX, nPPTY, &aZoomX, &aZoomY ); diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx index 6b19602..97bb09c 100644 --- a/sc/source/ui/view/output.cxx +++ b/sc/source/ui/view/output.cxx @@ -141,6 +141,7 @@ void ScActionColorChanger::Update( const ScChangeAction& rAction ) } ScOutputData::ScOutputData( OutputDevice* pNewDev, ScOutputType eNewType, + ScViewData* pViewData, ScTableInfo& rTabInfo, ScDocument* pNewDoc, SCTAB nNewTab, long nNewScrX, long nNewScrY, SCCOL nNewX1, SCROW nNewY1, SCCOL nNewX2, SCROW nNewY2, @@ -149,6 +150,7 @@ ScOutputData::ScOutputData( OutputDevice* pNewDev, ScOutputType eNewType, mpDev( pNewDev ), mpRefDevice( pNewDev ), // default is output device pFmtDevice( pNewDev ), // default is output device + mpViewData( pViewData ), mrTabInfo( rTabInfo ), pRowInfo( rTabInfo.mpRowInfo ), nArrCount( rTabInfo.mnArrCount ), diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx index 4869702..e78545a 100644 --- a/sc/source/ui/view/printfun.cxx +++ b/sc/source/ui/view/printfun.cxx @@ -509,7 +509,7 @@ void ScPrintFunc::DrawToDev( ScDocument* pDoc, OutputDevice* pDev, double /* nPr long nAddY = (long)( aLines.Top() * nScaleY ); nScrY += ( nAddY ? nAddY : 1 ); - ScOutputData aOutputData( pDev, OUTTYPE_PRINTER, aTabInfo, pDoc, nTab, + ScOutputData aOutputData( pDev, OUTTYPE_PRINTER, pViewData, aTabInfo, pDoc, nTab, nScrX, nScrY, nX1, nY1, nX2, nY2, nScaleX, nScaleY ); aOutputData.SetMetaFileMode(bMetaFile); aOutputData.SetShowNullValues(bNullVal); @@ -1344,7 +1344,7 @@ void ScPrintFunc::DrawBorder( long nScrX, long nScrY, long nScrW, long nScrH, aTabInfo.mpRowInfo[0].pCellInfo[1].nWidth = aTabInfo.mpRowInfo[1].pCellInfo[1].nWidth = (sal_uInt16) nEffWidth; - ScOutputData aOutputData( pDev, OUTTYPE_PRINTER, aTabInfo, pBorderDoc.get(), 0, + ScOutputData aOutputData( pDev, OUTTYPE_PRINTER, 0, aTabInfo, pBorderDoc.get(), 0, nScrX+nLeft, nScrY+nTop, 0,0, 0,0, nScaleX, nScaleY ); aOutputData.SetUseStyleColor( bUseStyleColor ); @@ -1559,7 +1559,7 @@ void ScPrintFunc::PrintArea( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, if (bEmbed) pDoc->SetEmbedded(aERange); - ScOutputData aOutputData( pDev, OUTTYPE_PRINTER, aTabInfo, pDoc, nPrintTab, + ScOutputData aOutputData( pDev, OUTTYPE_PRINTER, 0, aTabInfo, pDoc, nPrintTab, nScrX, nScrY, nX1, nY1, nX2, nY2, nScaleX, nScaleY ); // #114135# commit ab0ccff829847653f2d745acfc1aa56528dca0b9 Author: Andrzej Hunt <andrzej.h...@collabora.com> Date: Fri Aug 15 16:06:06 2014 +0200 Make nPrtToScreenFactor and GetOutputFactor fractions. These are then used for our output MapMode which required Fractions too. Change-Id: Icbfd9f808a6efe297096c94dc4043cef88c0ba0b diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index 0db4a22e..b42155f 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -1458,7 +1458,8 @@ bool ScDocShell::ConvertFrom( SfxMedium& rMedium ) if ( bRet && (bSetColWidths || bSetRowHeights) ) { // Adjust column width/row height; base 100% zoom Fraction aZoom( 1, 1 ); - double nPPTX = ScGlobal::nScreenPPTX * (double) aZoom / GetOutputFactor(); // Factor is printer display ratio + double nPPTX = ScGlobal::nScreenPPTX * (double) aZoom / + static_cast< double >( GetOutputFactor() ); // Factor is printer display ratio double nPPTY = ScGlobal::nScreenPPTY * (double) aZoom; VirtualDevice aVirtDev; // all sheets (for Excel import) @@ -2633,7 +2634,7 @@ ScDocShell::ScDocShell( const ScDocShell& rShell ) : SfxListener(), aDocument ( SCDOCMODE_DOCUMENT, this ), aDdeTextFmt(OUString("TEXT")), - nPrtToScreenFactor( 1.0 ), + nPrtToScreenFactor( 1, 1 ), pImpl ( new DocShell_Impl ), bHeaderOn ( true ), bFooterOn ( true ), @@ -2678,7 +2679,7 @@ ScDocShell::ScDocShell( const sal_uInt64 i_nSfxCreationFlags ) : SfxObjectShell( i_nSfxCreationFlags ), aDocument ( SCDOCMODE_DOCUMENT, this ), aDdeTextFmt(OUString("TEXT")), - nPrtToScreenFactor( 1.0 ), + nPrtToScreenFactor( 1, 1 ), pImpl ( new DocShell_Impl ), bHeaderOn ( true ), bFooterOn ( true ), diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx index 74ed306..f59c068 100644 --- a/sc/source/ui/docshell/docsh3.cxx +++ b/sc/source/ui/docshell/docsh3.cxx @@ -338,14 +338,14 @@ void ScDocShell::CalcOutputFactor() { if (bIsInplace) { - nPrtToScreenFactor = 1.0; // passt sonst nicht zur inaktiven Darstellung + nPrtToScreenFactor = Fraction( 1, 1 ); // passt sonst nicht zur inaktiven Darstellung return; } bool bTextWysiwyg = SC_MOD()->GetInputOptions().GetTextWysiwyg(); if (bTextWysiwyg) { - nPrtToScreenFactor = 1.0; + nPrtToScreenFactor = Fraction( 1, 1 ); return; } @@ -376,11 +376,13 @@ void ScDocShell::CalcOutputFactor() nWindowWidth = (long) ( nWindowWidth / ScGlobal::nScreenPPTX * HMM_PER_TWIPS ); if (nPrinterWidth && nWindowWidth) - nPrtToScreenFactor = nPrinterWidth / (double) nWindowWidth; + { + nPrtToScreenFactor = Fraction( nPrinterWidth, nWindowWidth ); + } else { OSL_FAIL("GetTextSize gibt 0 ??"); - nPrtToScreenFactor = 1.0; + nPrtToScreenFactor = Fraction( 1, 1 ); } } diff --git a/sc/source/ui/docshell/sizedev.cxx b/sc/source/ui/docshell/sizedev.cxx index e0ff33c..99524b6 100644 --- a/sc/source/ui/docshell/sizedev.cxx +++ b/sc/source/ui/docshell/sizedev.cxx @@ -49,7 +49,7 @@ ScSizeDeviceProvider::ScSizeDeviceProvider( ScDocShell* pDocSh ) nPPTY = aLogic.Y() / 1000.0; if ( !bTextWysiwyg ) - nPPTX /= pDocSh->GetOutputFactor(); + nPPTX /= static_cast< double >( pDocSh->GetOutputFactor() ); } ScSizeDeviceProvider::~ScSizeDeviceProvider() diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx index 98f7109..7ea78b6 100644 --- a/sc/source/ui/inc/docsh.hxx +++ b/sc/source/ui/inc/docsh.hxx @@ -88,7 +88,7 @@ class SC_DLLPUBLIC ScDocShell: public SfxObjectShell, public SfxListener OUString aDdeTextFmt; - double nPrtToScreenFactor; + Fraction nPrtToScreenFactor; DocShell_Impl* pImpl; ScDocFunc* pDocFunc; @@ -372,7 +372,7 @@ public: void SetInUndo(bool bSet); void CalcOutputFactor(); - double GetOutputFactor() const { return nPrtToScreenFactor;} + Fraction GetOutputFactor() const { return nPrtToScreenFactor;} void GetPageOnFromPageStyleSet( const SfxItemSet* pStyleSet, SCTAB nCurTab, bool& rbHeader, diff --git a/sc/source/ui/view/drawvie4.cxx b/sc/source/ui/view/drawvie4.cxx index c2f7370..2dc2e3b 100644 --- a/sc/source/ui/view/drawvie4.cxx +++ b/sc/source/ui/view/drawvie4.cxx @@ -443,7 +443,7 @@ void ScDrawView::CalcNormScale( Fraction& rFractX, Fraction& rFractY ) const double nPPTY = ScGlobal::nScreenPPTY; if (pViewData) - nPPTX /= pViewData->GetDocShell()->GetOutputFactor(); + nPPTX /= static_cast< double >( pViewData->GetDocShell()->GetOutputFactor() ); SCCOL nEndCol = 0; SCROW nEndRow = 0; diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx index dbd970d..911b0ec 100644 --- a/sc/source/ui/view/preview.cxx +++ b/sc/source/ui/view/preview.cxx @@ -345,7 +345,9 @@ void ScPreview::DoPrint( ScPreviewLocationData* pFillLocation ) } Fraction aPreviewZoom( nZoom, 100 ); - Fraction aHorPrevZoom( (long)( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 ); + Fraction aHorPrevZoom( (long)( 100 * nZoom / + static_cast< double>( pDocShell->GetOutputFactor() ) ), + 10000 ); MapMode aMMMode( MAP_100TH_MM, Point(), aHorPrevZoom, aPreviewZoom ); bool bDoPrint = ( pFillLocation == NULL ); @@ -733,7 +735,9 @@ void ScPreview::SetZoom(sal_uInt16 nNewZoom) // apply new MapMode and call UpdateScrollBars to update aOffset Fraction aPreviewZoom( nZoom, 100 ); - Fraction aHorPrevZoom( (long)( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 ); + Fraction aHorPrevZoom( (long)( 100 * nZoom / + static_cast< double >( pDocShell->GetOutputFactor() ) ), + 10000 ); MapMode aMMMode( MAP_100TH_MM, Point(), aHorPrevZoom, aPreviewZoom ); SetMapMode( aMMMode ); @@ -802,7 +806,8 @@ static Size lcl_GetDocPageSize( ScDocument* pDoc, SCTAB nTab ) sal_uInt16 ScPreview::GetOptimalZoom(bool bWidthOnly) { - double nWinScaleX = ScGlobal::nScreenPPTX / pDocShell->GetOutputFactor(); + double nWinScaleX = ScGlobal::nScreenPPTX / + static_cast< double >( pDocShell->GetOutputFactor() ); double nWinScaleY = ScGlobal::nScreenPPTY; Size aWinSize = GetOutputSizePixel(); @@ -962,7 +967,9 @@ void ScPreview::DataChanged( const DataChangedEvent& rDCEvt ) void ScPreview::MouseButtonDown( const MouseEvent& rMEvt ) { Fraction aPreviewZoom( nZoom, 100 ); - Fraction aHorPrevZoom( (long)( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 ); + Fraction aHorPrevZoom( (long)( 100 * nZoom / + static_cast< double >( pDocShell->GetOutputFactor() ) ), + 10000 ); MapMode aMMMode( MAP_100TH_MM, Point(), aHorPrevZoom, aPreviewZoom ); aButtonDownChangePoint = PixelToLogic( rMEvt.GetPosPixel(),aMMMode ); @@ -1045,7 +1052,9 @@ void ScPreview::MouseButtonDown( const MouseEvent& rMEvt ) void ScPreview::MouseButtonUp( const MouseEvent& rMEvt ) { Fraction aPreviewZoom( nZoom, 100 ); - Fraction aHorPrevZoom( (long)( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 ); + Fraction aHorPrevZoom( (long)( 100 * nZoom / + static_cast< double >( pDocShell->GetOutputFactor() ) ), + 10000 ); MapMode aMMMode( MAP_100TH_MM, Point(), aHorPrevZoom, aPreviewZoom ); aButtonUpPt = PixelToLogic( rMEvt.GetPosPixel(),aMMMode ); @@ -1295,7 +1304,9 @@ void ScPreview::MouseButtonUp( const MouseEvent& rMEvt ) void ScPreview::MouseMove( const MouseEvent& rMEvt ) { Fraction aPreviewZoom( nZoom, 100 ); - Fraction aHorPrevZoom( (long)( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 ); + Fraction aHorPrevZoom( (long)( 100 * nZoom / + static_cast< double >( pDocShell->GetOutputFactor() ) ), + 10000 ); MapMode aMMMode( MAP_100TH_MM, Point(), aHorPrevZoom, aPreviewZoom ); Point aMouseMovePoint = PixelToLogic( rMEvt.GetPosPixel(), aMMMode ); @@ -1541,7 +1552,9 @@ void ScPreview::SwitchView() void ScPreview::DragMove( long nDragMovePos, sal_uInt16 nFlags ) { Fraction aPreviewZoom( nZoom, 100 ); - Fraction aHorPrevZoom( (long)( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 ); + Fraction aHorPrevZoom( (long)( 100 * nZoom / + static_cast< double >( pDocShell->GetOutputFactor() ) ), + 10000 ); MapMode aMMMode( MAP_100TH_MM, Point(), aHorPrevZoom, aPreviewZoom ); SetMapMode( aMMMode ); long nPos = nDragMovePos; diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx index c79d356..01f7c2a 100644 --- a/sc/source/ui/view/tabview2.cxx +++ b/sc/source/ui/view/tabview2.cxx @@ -1238,7 +1238,8 @@ sal_uInt16 ScTabView::CalcZoom( SvxZoomType eType, sal_uInt16 nOldZoom ) aWinSize.Height() += GetGridHeight( SC_SPLIT_TOP ); ScDocShell* pDocSh = aViewData.GetDocShell(); - double nPPTX = ScGlobal::nScreenPPTX / pDocSh->GetOutputFactor(); + double nPPTX = ScGlobal::nScreenPPTX / + static_cast< double >( pDocSh->GetOutputFactor() ); double nPPTY = ScGlobal::nScreenPPTY; sal_uInt16 nMin = MINZOOM; @@ -1331,7 +1332,8 @@ sal_uInt16 ScTabView::CalcZoom( SvxZoomType eType, sal_uInt16 nOldZoom ) aWinSize.Height() = nOtherHeight; } - double nPPTX = ScGlobal::nScreenPPTX / aViewData.GetDocShell()->GetOutputFactor(); + double nPPTX = ScGlobal::nScreenPPTX / + static_cast< double >( aViewData.GetDocShell()->GetOutputFactor() ); double nPPTY = ScGlobal::nScreenPPTY; long nZoomX = (long) ( aWinSize.Width() * 100 / diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index da88b3b..d7c25b2 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -2404,7 +2404,8 @@ void ScViewData::WriteExtOptions( ScExtDocOptions& rDocOpt ) const rSplitPos = Point( bHSplit ? pViewTab->nHSplitPos : 0, bVSplit ? pViewTab->nVSplitPos : 0 ); rSplitPos = Application::GetDefaultDevice()->PixelToLogic( rSplitPos, MapMode( MAP_TWIP ) ); if( pDocShell ) - rSplitPos.X() = (long)((double)rSplitPos.X() / pDocShell->GetOutputFactor()); + rSplitPos.X() = (long)((double)rSplitPos.X() / + static_cast< double >( pDocShell->GetOutputFactor()) ); } else if( bFrozen ) { @@ -2534,7 +2535,7 @@ void ScViewData::ReadExtOptions( const ScExtDocOptions& rDocOpt ) // effectively results in the nFactor = 1.0 regardless of the Option setting. if( pDocShell && SC_MOD()->GetInputOptions().GetTextWysiwyg()) { - double nFactor = pDocShell->GetOutputFactor(); + double nFactor = static_cast< double >( pDocShell->GetOutputFactor() ); aPixel.X() = (long)( aPixel.X() * nFactor + 0.5 ); } diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index c3782e4..179cc1c 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -2308,7 +2308,9 @@ void ScViewFunc::ModifyCellSize( ScDirection eDir, bool bOptimal ) nMargin = sal::static_int_cast<sal_uInt16>( nMargin + ((const SfxUInt16Item&)pPattern->GetItem(ATTR_INDENT)).GetValue() ); - nWidth = (sal_uInt16)(nEdit * pDocSh->GetOutputFactor() / HMM_PER_TWIPS) + nWidth = (sal_uInt16)( nEdit * + static_cast< double>( pDocSh->GetOutputFactor() ) / + HMM_PER_TWIPS ) + nMargin + STD_EXTRA_WIDTH; } } commit 6a7051c30b57ba86f8847587f7f74cc93307288b Author: Andrzej Hunt <andrzej.h...@collabora.com> Date: Fri Aug 15 09:54:58 2014 +0200 ScViewData::GetActiveWin can be const. We need to reuse this in other const methods, so lets make it const too. Change-Id: I6d96fa2370081d515f8629998d8a1e218bec643a diff --git a/sc/source/ui/inc/viewdata.hxx b/sc/source/ui/inc/viewdata.hxx index fff44d9..683e985 100644 --- a/sc/source/ui/inc/viewdata.hxx +++ b/sc/source/ui/inc/viewdata.hxx @@ -241,7 +241,7 @@ public: const ScMarkData& GetMarkData() const; vcl::Window* GetDialogParent(); // forwarded from tabvwsh - ScGridWindow* GetActiveWin(); // from View + ScGridWindow* GetActiveWin() const; // from View ScDrawView* GetScDrawView(); // from View bool IsMinimized(); // from View diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index 2702966..da88b3b 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -2112,7 +2112,7 @@ vcl::Window* ScViewData::GetDialogParent() return pViewShell->GetDialogParent(); } -ScGridWindow* ScViewData::GetActiveWin() +ScGridWindow* ScViewData::GetActiveWin() const { OSL_ENSURE( pView, "GetActiveWin() ohne View" ); return pView->GetActiveWin(); commit 79b1d94c66dd5166276e88a7625c6ee5ea03cfdf Author: Andrzej Hunt <andrzej.h...@collabora.com> Date: Fri Aug 15 09:53:56 2014 +0200 Allow overriding limits for SetZoom for Tiled Rendering. Change-Id: Ic656012921408ce5c8dc691933a71a9e0ac78e5d diff --git a/sc/source/ui/inc/viewdata.hxx b/sc/source/ui/inc/viewdata.hxx index e187ec0..fff44d9 100644 --- a/sc/source/ui/inc/viewdata.hxx +++ b/sc/source/ui/inc/viewdata.hxx @@ -305,8 +305,13 @@ public: void SetZoomType( SvxZoomType eNew, bool bAll ); void SetZoomType( SvxZoomType eNew, std::vector< SCTAB >& tabs ); - void SetZoom( const Fraction& rNewX, const Fraction& rNewY, std::vector< SCTAB >& tabs ); - void SetZoom( const Fraction& rNewX, const Fraction& rNewY, bool bAll ); + // bIgnoreLimits in this context disables checking that our zoom is within the + // range of 20%-400% -- i.e. should be used for tiled rendering where such checks + // should be done by the client. + void SetZoom( const Fraction& rNewX, const Fraction& rNewY, + std::vector< SCTAB >& tabs, const bool bIgnoreLimits = false ); + void SetZoom( const Fraction& rNewX, const Fraction& rNewY, + bool bAll, const bool bIgnoreLimits = false ); void RefreshZoom(); void SetSelCtrlMouseClick( bool bTmp ) { bSelCtrlMouseClick = bTmp; } diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index 0940d61..2702966 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -616,25 +616,34 @@ void ScViewData::SetZoomType( SvxZoomType eNew, bool bAll ) SetZoomType( eNew, vTabs ); } -void ScViewData::SetZoom( const Fraction& rNewX, const Fraction& rNewY, std::vector< SCTAB >& tabs ) +void ScViewData::SetZoom( const Fraction& rNewX, const Fraction& rNewY, + std::vector< SCTAB >& tabs, + const bool bIgnoreLimits ) { bool bAll = ( tabs.empty() ); if ( !bAll ) // create associated table data CreateTabData( tabs ); - Fraction aFrac20( 1,5 ); - Fraction aFrac400( 4,1 ); Fraction aValidX = rNewX; - if (aValidX<aFrac20) - aValidX = aFrac20; - if (aValidX>aFrac400) - aValidX = aFrac400; - Fraction aValidY = rNewY; - if (aValidY<aFrac20) - aValidY = aFrac20; - if (aValidY>aFrac400) - aValidY = aFrac400; + + // We probably don't want these limits for tiled rendering, hence + // we make them optional. + if ( !bIgnoreLimits ) + { + const Fraction aFrac20( 1, 5 ); + const Fraction aFrac400( 4, 1 ); + + if ( aValidX < aFrac20 ) + aValidX = aFrac20; + else if ( aValidX > aFrac400 ) + aValidX = aFrac400; + + if ( aValidY < aFrac20 ) + aValidY = aFrac20; + else if ( aValidY > aFrac400 ) + aValidY = aFrac400; + } if ( bAll ) { @@ -690,7 +699,8 @@ void ScViewData::SetZoom( const Fraction& rNewX, const Fraction& rNewY, std::vec RefreshZoom(); } -void ScViewData::SetZoom( const Fraction& rNewX, const Fraction& rNewY, bool bAll ) +void ScViewData::SetZoom( const Fraction& rNewX, const Fraction& rNewY, + bool bAll, const bool bIgnoreLimits ) { std::vector< SCTAB > vTabs; if ( !bAll ) // get selected tabs @@ -698,7 +708,7 @@ void ScViewData::SetZoom( const Fraction& rNewX, const Fraction& rNewY, bool bAl ScMarkData::iterator itr = mpMarkData->begin(), itrEnd = mpMarkData->end(); vTabs.insert(vTabs.begin(), itr, itrEnd); } - SetZoom( rNewX, rNewY, vTabs ); + SetZoom( rNewX, rNewY, vTabs, bIgnoreLimits ); } void ScViewData::SetShowGrid( bool bShow ) commit 86e7595b39914fd5b0809bee4d9eccac6e2ae594 Author: Andrzej Hunt <andrzej.h...@collabora.com> Date: Fri Aug 15 09:52:58 2014 +0200 aScrSize should be mutable. Change-Id: I7376ea17aa4f66c9d9085757b84fb69dd0ad71cb diff --git a/sc/source/ui/inc/viewdata.hxx b/sc/source/ui/inc/viewdata.hxx index 515bc67..e187ec0 100644 --- a/sc/source/ui/inc/viewdata.hxx +++ b/sc/source/ui/inc/viewdata.hxx @@ -170,7 +170,7 @@ private: Size aScenButSize; - Size aScrSize; + mutable Size aScrSize; MapMode aLogicMode; // skalierter 1/100mm-MapMode SvxZoomType eDefZoomType; // default zoom and type for missing TabData diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index 688813c..0940d61 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -1518,8 +1518,8 @@ Point ScViewData::GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScSplitPos eWhich, if (pView) { - ((ScViewData*)this)->aScrSize.Width() = pView->GetGridWidth(eWhichX); - ((ScViewData*)this)->aScrSize.Height() = pView->GetGridHeight(eWhichY); + aScrSize.Width() = pView->GetGridWidth(eWhichX); + aScrSize.Height() = pView->GetGridHeight(eWhichY); } sal_uInt16 nTSize; @@ -1612,7 +1612,7 @@ SCCOL ScViewData::CellsAtX( SCsCOL nPosX, SCsCOL nDir, ScHSplitPos eWhichX, sal_ OSL_ENSURE( nDir==1 || nDir==-1, "falscher CellsAt Aufruf" ); if (pView) - ((ScViewData*)this)->aScrSize.Width() = pView->GetGridWidth(eWhichX); + aScrSize.Width() = pView->GetGridWidth(eWhichX); SCsCOL nX; sal_uInt16 nScrPosX = 0; @@ -1654,7 +1654,7 @@ SCROW ScViewData::CellsAtY( SCsROW nPosY, SCsROW nDir, ScVSplitPos eWhichY, sal_ OSL_ENSURE( nDir==1 || nDir==-1, "falscher CellsAt Aufruf" ); if (pView) - ((ScViewData*)this)->aScrSize.Height() = pView->GetGridHeight(eWhichY); + aScrSize.Height() = pView->GetGridHeight(eWhichY); if (nScrSizeY == SC_SIZE_NONE) nScrSizeY = (sal_uInt16) aScrSize.Height(); commit 05ff705e3a9a3b2f4d257efc4773951a07b74abc Author: Andrzej Hunt <andr...@ahunt.org> Date: Tue Sep 9 06:12:44 2014 +0200 Fix PaintTile scaling preparation. Change-Id: I0a725fd5c030f3c089c2bbd25947088c321eb2d4 diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index a890abc..022f6e3 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -940,21 +940,25 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice, int nTilePosX, int nTilePosY, long nTileWidth, long nTileHeight ) { + // Scaling. Must convert from pixels to TWIPs. We know + // that VirtualDevices use a DPI of 96. We might as well do this + // calculation now, rather than after another dimension conversion, + // to minimise errors. + Fraction scaleX = Fraction( nOutputWidth, 96 ) * Fraction(1440L) / + Fraction( nTileWidth); + Fraction scaleY = Fraction( nOutputHeight, 96 ) * Fraction(1440L) / + Fraction( 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 ); + + maPaintMapMode = aMapMode; +// rDevice.SetMapMode( aMapMode ); ScTabViewShell* pTabViewSh = pViewData->GetViewShell(); SdrView* pDrawView = pTabViewSh->GetScDrawView(); commit 678434a7426b27e068691cf5ae2f82374ddb0a59 Author: Andrzej Hunt <andrzej.h...@collabora.com> Date: Thu Jun 26 17:06:58 2014 +0100 Ensure we actually render all cells in the selected area. Only cells within maVisibleRange are rendered, even if we request a larger area (and maVisibleRange is otherwise not updated for tiled rendering). Hence we should explicitly set it here. Change-Id: I399be9df1f266a2b3d32a95483960b21f561c6b3 diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index 7a8e10a..a890abc 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -377,6 +377,10 @@ void ScGridWindow::Paint( const Rectangle& rRect, OutputDevice* pOutDev ) ScViewData::AddPixelsWhile( nScrY, aPixRect.Bottom(), nY2, MAXROW, nPPTY, pDoc, nTab); } + // We specifically need to set the visible range here -- by default it is + // set in UpdateVisibleRange which however uses the viewdata, which is + // completely irrelevant for tiled rendering. + maVisibleRange.set( nX1, nY1, nX2, nY2 ); Draw( nX1,nY1,nX2,nY2, SC_UPDATE_MARKS, pOutDev ); // nicht weiterzeichnen bIsInPaint = false; } commit 0684631240cfeba65c78657cbac946feb92eaf35 Author: Andrzej Hunt <andrzej.h...@collabora.com> Date: Thu Jun 26 14:30:08 2014 +0100 Take into account drawing layer for data area size. The drawing layer could potentially have items that are outwith the data area, but we probably want to have them included for tiled rendering. Change-Id: I958c4fa29491cdb0fd80392dfcfa033306f2b76c diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index c9a0cfee7..7a8e10a 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -29,6 +29,7 @@ #include <sfx2/printer.hxx> #include <vcl/settings.hxx> +#include <svx/svdpage.hxx> #include <svx/svdview.hxx> #include "tabvwsh.hxx" @@ -388,17 +389,32 @@ Size ScGridWindow::GetDataAreaSize() SCTAB nTab = pViewData->GetTabNo(); + // Actual data area pDoc->ShrinkToDataArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow ); + // Drawing layer area -- is completely independent of the data area. + ScTabViewShell* pTabViewShell = pViewData->GetViewShell(); + SdrView* pDrawView = pTabViewShell->GetSdrView(); + SdrPageView* pPageView = pDrawView->GetSdrPageView(); + SdrPage* pPage = pPageView->GetPage(); + Rectangle aDrawDataArea = pPage->GetAllObjBoundRect(); + // Draw layer works in 100th mm, whereas we're working with TWIPs. + aDrawDataArea.SetPos( aDrawDataArea.TopLeft() * 1440 / 2540 ); + aDrawDataArea.SetSize( Size( aDrawDataArea.GetSize().Width() * 1440 / 2540, + aDrawDataArea.GetSize().Height() * 1440 / 2540 ) ); + + // We specifically keep iterating until we have covered both the + // data area AND the drawing layer area. We also make sure that + // we return an area corresponding to a whole number of cells. long nX = 0; - for ( SCCOL i = 0; i <= nEndCol; i++ ) + for ( SCCOL i = 0; i <= nEndCol || nX < aDrawDataArea.Right(); i++ ) { nX += pDoc->GetColWidth( i, nTab ); } long nY = 0; - for ( SCROW i = 0; i <= nEndRow; i++ ) + for ( SCROW i = 0; i <= nEndRow || nY < aDrawDataArea.Bottom(); i++ ) { nY += pDoc->GetRowHeight( i, nTab ); } commit db30bfa2249b951f522c50935eda12a1f7ecd4bd Author: Andrzej Hunt <andrzej.h...@collabora.com> Date: Wed Jun 18 09:33:16 2014 +0100 Implement data area size retrieval. Cell dimensions appear to be in TWIPs (but the drawing layer is in 100th mm). diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx index d099a10..fb42fff 100644 --- a/sc/source/ui/inc/gridwin.hxx +++ b/sc/source/ui/inc/gridwin.hxx @@ -321,10 +321,19 @@ public: virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE; virtual void Tracking( const TrackingEvent& rTEvt ) SAL_OVERRIDE; + // Paint a tile -- all tile dimensions are in TWIPS. + // It is possible to request an infinitely large area, i.e. you are not + // restricted to the area in GetDataAreaSize. void PaintTile( VirtualDevice& rDevice, int nOutputWidth, int nOutputHeight, int nTilePosX, int nTilePosY, long nTileWidth, long nTileHeight ); + // Get the area in the document that contains renderable content. This + // is primarily a guide as to the area that should be rendered for read + // only documents, however for writeable documents you probably want to + // dynamically grab more cells in case the user wants to write to them etc. + // This returns a size in TWIPS, suitable for use in PaintTile. + Size GetDataAreaSize(); virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible() SAL_OVERRIDE; diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 0bf4d85..8687ef1 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -481,10 +481,15 @@ int ScModelObj::getPart() 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( 3200, 3200 ); + // 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(); + + // We simply return the data area -- it is however possible to request + // tiles to be rendered outside this area, ie this is the minimum that + // the client should allow the user to see. + return pGridWindow->GetDataAreaSize(); } 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 94f2c51..c9a0cfee7 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -380,6 +380,36 @@ void ScGridWindow::Paint( const Rectangle& rRect, OutputDevice* pOutDev ) bIsInPaint = false; } +Size ScGridWindow::GetDataAreaSize() +{ + ScDocument* pDoc = pViewData->GetDocument(); + SCCOL nStartCol = 0, nEndCol = MAXCOL; + SCROW nStartRow = 0, nEndRow = MAXROW; + + SCTAB nTab = pViewData->GetTabNo(); + + pDoc->ShrinkToDataArea( nTab, + nStartCol, nStartRow, nEndCol, nEndRow ); + + long nX = 0; + for ( SCCOL i = 0; i <= nEndCol; i++ ) + { + nX += pDoc->GetColWidth( i, nTab ); + } + + long nY = 0; + for ( SCROW i = 0; i <= nEndRow; i++ ) + { + nY += pDoc->GetRowHeight( i, nTab ); + } + + // TODO: this ignores any images / etc., which could be outside + // the data area. + + // This doesn't include the final (bottom & right) borders... + return Size( nX, nY ); +} + // Draw ---------------------------------------------------------------- void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMode eMode, OutputDevice* pOutDev ) @@ -482,6 +512,7 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod Fraction aZoomX = pViewData->GetZoomX(); Fraction aZoomY = pViewData->GetZoomY(); + ScOutputData aOutputData( pOutDev, OUTTYPE_WINDOW, aTabInfo, &rDoc, nTab, nScrX, nScrY, nX1, nY1, nX2, nY2, nPPTX, nPPTY, &aZoomX, &aZoomY ); commit 1916b4112f04fd009ef57d7a8ad00adbcbd1efb1 Author: Andrzej Hunt <andrzej.h...@collabora.com> Date: Wed Jun 18 08:28:04 2014 +0100 Allow overriding of device for Paint, and use that for Tiles. Paint handles figuring out which cells are within the visible area for us etc. Gridwin being a Window which paints to itself is a bit of a pain, since we now need to be able to reroute painting calls to alternative output devices, however these changes seem to be sufficient to at least get the cells in the desired tile rendered. Change-Id: I7bd1434c97acc6e9ef6e1e63cbcf039b987c88e4 diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx index 696232f..d099a10 100644 --- a/sc/source/ui/inc/gridwin.hxx +++ b/sc/source/ui/inc/gridwin.hxx @@ -291,6 +291,7 @@ protected: virtual void Resize( const Size& rSize ); virtual void PrePaint() SAL_OVERRIDE; virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE; + virtual void Paint( const Rectangle& rRect, OutputDevice* pOutDev); virtual void KeyInput(const KeyEvent& rKEvt) SAL_OVERRIDE; virtual void GetFocus() SAL_OVERRIDE; virtual void LoseFocus() SAL_OVERRIDE; @@ -360,7 +361,7 @@ public: using Window::Draw; void Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMode eMode = SC_UPDATE_ALL, - OutputDevice* pOutDev = 0 ); + OutputDevice* pOutDev = 0); void CreateAnchorHandle(SdrHdlList& rHdl, const ScAddress& rAddress); diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index 4b586d7..94f2c51 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -301,6 +301,11 @@ void ScGridWindow::PrePaint() void ScGridWindow::Paint( const Rectangle& rRect ) { + Paint( rRect, this ); +} + +void ScGridWindow::Paint( const Rectangle& rRect, OutputDevice* pOutDev ) +{ ScDocument* pDoc = pViewData->GetDocument(); if ( pDoc->IsInInterpreter() ) { @@ -330,7 +335,7 @@ void ScGridWindow::Paint( const Rectangle& rRect ) bIsInPaint = true; - Rectangle aPixRect = LogicToPixel( rRect ); + Rectangle aPixRect = pOutDev->LogicToPixel( rRect ); SCCOL nX1 = pViewData->GetPosX(eHWhich); SCROW nY1 = pViewData->GetPosY(eVWhich); @@ -371,8 +376,7 @@ void ScGridWindow::Paint( const Rectangle& rRect ) ScViewData::AddPixelsWhile( nScrY, aPixRect.Bottom(), nY2, MAXROW, nPPTY, pDoc, nTab); } - Draw( nX1,nY1,nX2,nY2, SC_UPDATE_MARKS ); // nicht weiterzeichnen - + Draw( nX1,nY1,nX2,nY2, SC_UPDATE_MARKS, pOutDev ); // nicht weiterzeichnen bIsInPaint = false; } @@ -590,7 +594,7 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod } // get logic positions - aDrawingRectLogic = PixelToLogic(aDrawingRectPixel, aDrawMode); + aDrawingRectLogic = pOutDev->PixelToLogic(aDrawingRectPixel, aDrawMode); } // device for document content, used by overlay manager @@ -848,7 +852,7 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod DrawRect( Rectangle( aStart,aEnd ) ); SetMapMode(pViewData->GetLogicMode()); - pEditView->Paint( PixelToLogic( Rectangle( Point( nScrX, nScrY ), + pEditView->Paint( pOutDev->PixelToLogic( Rectangle( Point( nScrX, nScrY ), Size( aOutputData.GetScrW(), aOutputData.GetScrH() ) ) ) ); SetMapMode(MAP_PIXEL); } @@ -908,7 +912,9 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice, pDrawView->AddWindowToPaintView( &rDevice ); } - Draw( 0, 0, 3, 3, SC_UPDATE_ALL, &rDevice ); + Paint( Rectangle( Point(nTilePosX, nTilePosY), + rDevice.PixelToLogic(Size(nOutputWidth, nOutputHeight))), + &rDevice ); if ( pDrawView ) { commit 258ed8a3a4690feff5ed387a3e8b4d2ee4497814 Author: Andrzej Hunt <andrzej.h...@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 3a4d945..4b586d7 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" @@ -900,7 +901,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 f8ca48f943b0195f5a80f71607b4b0f3d2e26e5f Author: Andrzej Hunt <andrzej.h...@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 05f9994..696232f 100644 --- a/sc/source/ui/inc/gridwin.hxx +++ b/sc/source/ui/inc/gridwin.hxx @@ -359,7 +359,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 c4c5b0a..0bf4d85 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -484,7 +484,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 cbdd99d..3a4d945 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -376,9 +376,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 +477,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, &rDoc, nTab, + ScOutputData aOutputData( pOutDev, OUTTYPE_WINDOW, aTabInfo, &rDoc, nTab, nScrX, nScrY, nX1, nY1, nX2, nY2, nPPTX, nPPTY, &aZoomX, &aZoomY ); @@ -587,7 +592,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 +611,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 @@ -877,13 +884,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 8730974f3da0ce385cac84b81b8ae3169001399c Author: Chris Sherlock <chris.sherloc...@gmail.com> Date: Sun Sep 28 22:33:50 2014 +1000 vcl: cleanup headers - remove comments, tabify Change-Id: I718832960abe07450bc9fdda15297cb5e56f84e4 Reviewed-on: https://gerrit.libreoffice.org/11674 Reviewed-by: Chris Sherlock <chris.sherloc...@gmail.com> Tested-by: Chris Sherlock <chris.sherloc...@gmail.com> diff --git a/include/vcl/abstdlg.hxx b/include/vcl/abstdlg.hxx index d877e6d..2b31b1b 100644 --- a/include/vcl/abstdlg.hxx +++ b/include/vcl/abstdlg.hxx @@ -29,50 +29,52 @@ class Link; class VCL_DLLPUBLIC VclAbstractDialog { public: - virtual short Execute() = 0; - virtual ~VclAbstractDialog(); + virtual ~VclAbstractDialog(); + + virtual short Execute() = 0; }; class VCL_DLLPUBLIC VclAbstractDialog2 { public: - virtual void StartExecuteModal( const Link& rEndDialogHdl ) = 0; - virtual long GetResult() = 0; - virtual ~VclAbstractDialog2(); + virtual ~VclAbstractDialog2(); + + virtual void StartExecuteModal( const Link& rEndDialogHdl ) = 0; + virtual long GetResult() = 0; }; class VCL_DLLPUBLIC VclAbstractTerminatedDialog : public VclAbstractDialog { public: - virtual void EndDialog(long nResult =0) = 0; + virtual void EndDialog(long nResult =0) = 0; }; class VCL_DLLPUBLIC VclAbstractRefreshableDialog : public VclAbstractDialog { public: - virtual void Update() = 0; - virtual void Sync() = 0; + virtual void Update() = 0; + virtual void Sync() = 0; }; class VCL_DLLPUBLIC AbstractPasswordToOpenModifyDialog : public VclAbstractDialog { public: - virtual OUString GetPasswordToOpen() const = 0; - virtual OUString GetPasswordToModify() const = 0; - virtual bool IsRecommendToOpenReadonly() const = 0; + virtual OUString GetPasswordToOpen() const = 0; + virtual OUString GetPasswordToModify() const = 0; + virtual bool IsRecommendToOpenReadonly() const = 0; }; class VCL_DLLPUBLIC VclAbstractDialogFactory { public: - virtual ~VclAbstractDialogFactory(); // needed for export of vtable - static VclAbstractDialogFactory* Create(); + virtual ~VclAbstractDialogFactory(); // needed for export of vtable + static VclAbstractDialogFactory* Create(); // nDialogId was previously a ResId without ResMgr; the ResourceId is now // an implementation detail of the factory - virtual VclAbstractDialog* CreateVclDialog( vcl::Window* pParent, sal_uInt32 nResId ) = 0; + virtual VclAbstractDialog* CreateVclDialog( vcl::Window* pParent, sal_uInt32 nResId ) = 0; // creates instance of PasswordToOpenModifyDialog from cui - virtual AbstractPasswordToOpenModifyDialog * CreatePasswordToOpenModifyDialog( vcl::Window * pParent, sal_uInt16 nMinPasswdLen, sal_uInt16 nMaxPasswdLen, bool bIsPasswordToModify ) = 0; + virtual AbstractPasswordToOpenModifyDialog* CreatePasswordToOpenModifyDialog( vcl::Window * pParent, sal_uInt16 nMinPasswdLen, sal_uInt16 nMaxPasswdLen, bool bIsPasswordToModify ) = 0; }; #endif diff --git a/include/vcl/accel.hxx b/include/vcl/accel.hxx index 2e6e26d..5088dc5 100644 --- a/include/vcl/accel.hxx +++ b/include/vcl/accel.hxx @@ -34,65 +34,69 @@ class VCL_DLLPUBLIC Accelerator : public Resource friend class ImplAccelManager; private: - ImplAccelData* mpData; - OUString maHelpStr; - Link maActivateHdl; - Link maDeactivateHdl; - Link maSelectHdl; + ImplAccelData* mpData; + OUString maHelpStr; + Link maActivateHdl; + Link maDeactivateHdl; + Link maSelectHdl; // Will be set by AcceleratorManager - vcl::KeyCode maCurKeyCode; - sal_uInt16 mnCurId; - sal_uInt16 mnCurRepeat; - bool mbIsCancel; - bool* mpDel; - - SAL_DLLPRIVATE void ImplInit(); - SAL_DLLPRIVATE void ImplCopyData( ImplAccelData& rAccelData ); - SAL_DLLPRIVATE void ImplDeleteData(); - SAL_DLLPRIVATE void ImplInsertAccel( sal_uInt16 nItemId, const vcl::KeyCode& rKeyCode, - bool bEnable, Accelerator* pAutoAccel ); - - SAL_DLLPRIVATE ImplAccelEntry* ImplGetAccelData( const vcl::KeyCode& rKeyCode ) const; + vcl::KeyCode maCurKeyCode; + sal_uInt16 mnCurId; + sal_uInt16 mnCurRepeat; + bool mbIsCancel; + bool* mpDel; + + SAL_DLLPRIVATE void ImplInit(); + SAL_DLLPRIVATE void ImplCopyData( ImplAccelData& rAccelData ); + SAL_DLLPRIVATE void ImplDeleteData(); + SAL_DLLPRIVATE void ImplInsertAccel( + sal_uInt16 nItemId, + const vcl::KeyCode& rKeyCode, + bool bEnable, + Accelerator* pAutoAccel ); + + SAL_DLLPRIVATE ImplAccelEntry* + ImplGetAccelData( const vcl::KeyCode& rKeyCode ) const; protected: - SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); + SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); public: - Accelerator(); - Accelerator( const Accelerator& rAccel ); - Accelerator( const ResId& rResId ); - virtual ~Accelerator(); + Accelerator(); + Accelerator( const Accelerator& rAccel ); + Accelerator( const ResId& rResId ); + virtual ~Accelerator(); - virtual void Activate(); - virtual void Deactivate(); - virtual void Select(); + virtual void Activate(); + virtual void Deactivate(); + virtual void Select(); - void InsertItem( sal_uInt16 nItemId, const vcl::KeyCode& rKeyCode ); - void InsertItem( const ResId& rResId ); + void InsertItem( sal_uInt16 nItemId, const vcl::KeyCode& rKeyCode ); + void InsertItem( const ResId& rResId ); - sal_uInt16 GetCurItemId() const { return mnCurId; } - const vcl::KeyCode& GetCurKeyCode() const { return maCurKeyCode; } - sal_uInt16 GetCurRepeat() const { return mnCurRepeat; } - bool IsCancel() const { return mbIsCancel; } + sal_uInt16 GetCurItemId() const { return mnCurId; } + const vcl::KeyCode& GetCurKeyCode() const { return maCurKeyCode; } + sal_uInt16 GetCurRepeat() const { return mnCurRepeat; } + bool IsCancel() const { return mbIsCancel; } - sal_uInt16 GetItemCount() const; - sal_uInt16 GetItemId( sal_uInt16 nPos ) const; - vcl::KeyCode GetKeyCode( sal_uInt16 nItemId ) const; + sal_uInt16 GetItemCount() const; + sal_uInt16 GetItemId( sal_uInt16 nPos ) const; + vcl::KeyCode GetKeyCode( sal_uInt16 nItemId ) const; - Accelerator* GetAccel( sal_uInt16 nItemId ) const; + Accelerator* GetAccel( sal_uInt16 nItemId ) const; - void SetHelpText( const OUString& rHelpText ) { maHelpStr = rHelpText; } - const OUString& GetHelpText() const { return maHelpStr; } + void SetHelpText( const OUString& rHelpText ) { maHelpStr = rHelpText; } + const OUString& GetHelpText() const { return maHelpStr; } - void SetActivateHdl( const Link& rLink ) { maActivateHdl = rLink; } - const Link& GetActivateHdl() const { return maActivateHdl; } - void SetDeactivateHdl( const Link& rLink ) { maDeactivateHdl = rLink; } - const Link& GetDeactivateHdl() const { return maDeactivateHdl; } - void SetSelectHdl( const Link& rLink ) { maSelectHdl = rLink; } - const Link& GetSelectHdl() const { return maSelectHdl; } + void SetActivateHdl( const Link& rLink ) { maActivateHdl = rLink; } + const Link& GetActivateHdl() const { return maActivateHdl; } + void SetDeactivateHdl( const Link& rLink ) { maDeactivateHdl = rLink; } + const Link& GetDeactivateHdl() const { return maDeactivateHdl; } + void SetSelectHdl( const Link& rLink ) { maSelectHdl = rLink; } + const Link& GetSelectHdl() const { return maSelectHdl; } - Accelerator& operator=( const Accelerator& rAccel ); + Accelerator& operator=( const Accelerator& rAccel ); }; #endif // INCLUDED_VCL_ACCEL_HXX diff --git a/include/vcl/alpha.hxx b/include/vcl/alpha.hxx index bd8ce8a..fd84765 100644 --- a/include/vcl/alpha.hxx +++ b/include/vcl/alpha.hxx @@ -24,108 +24,60 @@ #include <vcl/bitmap.hxx> -// - AlphaMask - - - class ImageList; class BitmapEx; class VCL_DLLPUBLIC AlphaMask : private Bitmap { -private: - friend class BitmapEx; - friend class OutputDevice; - friend bool VCL_DLLPUBLIC ReadDIBBitmapEx(BitmapEx& rTarget, SvStream& rIStm); - - SAL_DLLPRIVATE const Bitmap& ImplGetBitmap() const; - SAL_DLLPRIVATE void ImplSetBitmap( const Bitmap& rBitmap ); - public: - AlphaMask(); - AlphaMask( const Bitmap& rBitmap ); - AlphaMask( const AlphaMask& rAlphaMask ); - AlphaMask( const Size& rSizePixel, sal_uInt8* pEraseTransparency = NULL ); - virtual ~AlphaMask(); + AlphaMask(); + AlphaMask( const Bitmap& rBitmap ); + AlphaMask( const AlphaMask& rAlphaMask ); + AlphaMask( const Size& rSizePixel, sal_uInt8* pEraseTransparency = NULL ); + virtual ~AlphaMask(); AlphaMask& operator=( const Bitmap& rBitmap ); - AlphaMask& operator=( const AlphaMask& rAlphaMask ) - { - return static_cast<AlphaMask&>( Bitmap::operator=( rAlphaMask ) ); - } - - bool operator!() const - { - return Bitmap::operator!(); - } - - bool operator==( const AlphaMask& rAlphaMask ) const - { - return Bitmap::operator==( rAlphaMask ); - } - - bool operator!=( const AlphaMask& rAlphaMask ) const - { - return Bitmap::operator!=( rAlphaMask ); - } - - const MapMode& GetPrefMapMode() const - { - return Bitmap::GetPrefMapMode(); - } - - void SetPrefMapMode( const MapMode& rMapMode ) - { - Bitmap::SetPrefMapMode( rMapMode ); - } - - const Size& GetPrefSize() const - { - return Bitmap::GetPrefSize(); - } - - void SetPrefSize( const Size& rSize ) - { - Bitmap::SetPrefSize( rSize ); - } - - Size GetSizePixel() const - { - return Bitmap::GetSizePixel(); - } - - sal_uLong GetSizeBytes() const - { - return Bitmap::GetSizeBytes(); - } - sal_uLong GetChecksum() const - { - return Bitmap::GetChecksum(); - } - - Bitmap GetBitmap() const; - - bool Erase( sal_uInt8 cTransparency ); - bool Replace( const Bitmap& rMask, sal_uInt8 rReplaceTransparency ); - bool Replace( sal_uInt8 cSearchTransparency, sal_uInt8 cReplaceTransparency, - sal_uLong nTol = 0UL ); - - BitmapReadAccess* AcquireReadAccess() - { - return Bitmap::AcquireReadAccess(); - } - - BitmapWriteAccess* AcquireWriteAccess() - { - return Bitmap::AcquireWriteAccess(); - } - - void ReleaseAccess( BitmapReadAccess* pAccess ); + AlphaMask& operator=( const AlphaMask& rAlphaMask ) { return static_cast<AlphaMask&>( Bitmap::operator=( rAlphaMask ) ); } + bool operator!() const { return Bitmap::operator!(); } + bool operator==( const AlphaMask& rAlphaMask ) const { return Bitmap::operator==( rAlphaMask ); } + bool operator!=( const AlphaMask& rAlphaMask ) const { return Bitmap::operator!=( rAlphaMask ); } + + const MapMode& GetPrefMapMode() const { return Bitmap::GetPrefMapMode(); } + void SetPrefMapMode( const MapMode& rMapMode ) { Bitmap::SetPrefMapMode( rMapMode ); } + + const Size& GetPrefSize() const { return Bitmap::GetPrefSize(); } + void SetPrefSize( const Size& rSize ) { Bitmap::SetPrefSize( rSize ); } + + Size GetSizePixel() const { return Bitmap::GetSizePixel(); } + sal_uLong GetSizeBytes() const { return Bitmap::GetSizeBytes(); } + + sal_uLong GetChecksum() const { return Bitmap::GetChecksum(); } + + Bitmap GetBitmap() const; + + bool Erase( sal_uInt8 cTransparency ); + bool Replace( const Bitmap& rMask, sal_uInt8 rReplaceTransparency ); + bool Replace( sal_uInt8 cSearchTransparency, sal_uInt8 cReplaceTransparency, sal_uLong nTol = 0UL ); + + BitmapReadAccess* AcquireReadAccess() { return Bitmap::AcquireReadAccess(); } + BitmapWriteAccess* AcquireWriteAccess() { return Bitmap::AcquireWriteAccess(); } + + void ReleaseAccess( BitmapReadAccess* pAccess ); typedef vcl::ScopedBitmapAccess< BitmapReadAccess, AlphaMask, &AlphaMask::AcquireReadAccess > ScopedReadAccess; typedef vcl::ScopedBitmapAccess< BitmapWriteAccess, AlphaMask, &AlphaMask::AcquireWriteAccess > ScopedWriteAccess; + +private: + friend class BitmapEx; + friend class OutputDevice; + friend bool VCL_DLLPUBLIC ReadDIBBitmapEx(BitmapEx& rTarget, SvStream& rIStm); + + SAL_DLLPRIVATE const Bitmap& ImplGetBitmap() const; + SAL_DLLPRIVATE void ImplSetBitmap( const Bitmap& rBitmap ); + }; #endif // INCLUDED_VCL_ALPHA_HXX diff --git a/include/vcl/animate.hxx b/include/vcl/animate.hxx index f75caf6..25f10f0 100644 --- a/include/vcl/animate.hxx +++ b/include/vcl/animate.hxx @@ -45,59 +45,58 @@ enum CycleMode struct VCL_DLLPUBLIC AnimationBitmap { - BitmapEx aBmpEx; - Point aPosPix; - Size aSizePix; - long nWait; - Disposal eDisposal; - bool bUserInput; - - AnimationBitmap() - : nWait(0) - , eDisposal(DISPOSE_NOT) - , bUserInput(false) - { - } - - AnimationBitmap( - const BitmapEx& rBmpEx, - const Point& rPosPix, - const Size& rSizePix, - long _nWait = 0L, - Disposal _eDisposal = DISPOSE_NOT - ) : - aBmpEx ( rBmpEx ), - aPosPix ( rPosPix ), - aSizePix ( rSizePix ), - nWait ( _nWait ), - eDisposal ( _eDisposal ), - bUserInput ( false ) - {} - - bool operator==( const AnimationBitmap& rAnimBmp ) const - { - return( rAnimBmp.aBmpEx == aBmpEx && - rAnimBmp.aPosPix == aPosPix && - rAnimBmp.aSizePix == aSizePix && - rAnimBmp.nWait == nWait && - rAnimBmp.eDisposal == eDisposal && - rAnimBmp.bUserInput == bUserInput ); - } - - bool operator!=( const AnimationBitmap& rAnimBmp ) const - { return !( *this == rAnimBmp ); } - - bool IsEqual( const AnimationBitmap& rAnimBmp ) const - { - return( rAnimBmp.aPosPix == aPosPix && - rAnimBmp.aSizePix == aSizePix && - rAnimBmp.nWait == nWait && - rAnimBmp.eDisposal == eDisposal && - rAnimBmp.bUserInput == bUserInput && - rAnimBmp.aBmpEx.IsEqual( aBmpEx ) ); - } - - sal_uLong GetChecksum() const; + BitmapEx aBmpEx; + Point aPosPix; + Size aSizePix; + long nWait; + Disposal eDisposal; + bool bUserInput; + + AnimationBitmap() + : nWait(0) + , eDisposal(DISPOSE_NOT) + , bUserInput(false) + {} + + AnimationBitmap( + const BitmapEx& rBmpEx, + const Point& rPosPix, + const Size& rSizePix, + long _nWait = 0L, + Disposal _eDisposal = DISPOSE_NOT + ) : + aBmpEx ( rBmpEx ), + aPosPix ( rPosPix ), + aSizePix ( rSizePix ), + nWait ( _nWait ), + eDisposal ( _eDisposal ), + bUserInput ( false ) + {} + + bool operator==( const AnimationBitmap& rAnimBmp ) const + { + return( rAnimBmp.aBmpEx == aBmpEx && + rAnimBmp.aPosPix == aPosPix && + rAnimBmp.aSizePix == aSizePix && + rAnimBmp.nWait == nWait && + rAnimBmp.eDisposal == eDisposal && + rAnimBmp.bUserInput == bUserInput ); + } + + bool operator!=( const AnimationBitmap& rAnimBmp ) const + { return !( *this == rAnimBmp ); } + + bool IsEqual( const AnimationBitmap& rAnimBmp ) const + { + return( rAnimBmp.aPosPix == aPosPix && + rAnimBmp.aSizePix == aSizePix && + rAnimBmp.nWait == nWait && + rAnimBmp.eDisposal == eDisposal && + rAnimBmp.bUserInput == bUserInput && + rAnimBmp.aBmpEx.IsEqual( aBmpEx ) ); + } + + sal_uLong GetChecksum() const; }; struct AInfo @@ -112,8 +111,8 @@ struct AInfo OutputDevice* pOutDev; void* pViewData; long nExtraData; - bool bWithSize; - bool bPause; + bool bWithSize; + bool bPause; AInfo() : pOutDev( NULL ), pViewData( NULL ), @@ -128,111 +127,115 @@ typedef ::std::vector< ImplAnimView* > AnimViewList_impl; class VCL_DLLPUBLIC Animation { - SAL_DLLPRIVATE static sal_uLong mnAnimCount; - - AnimationBitmapList_impl maList; - AnimViewList_impl maViewList; - Link maNotifyLink; - BitmapEx maBitmapEx; - Timer maTimer; - Size maGlobalSize; - long mnLoopCount; - long mnLoops; - size_t mnPos; - CycleMode meCycleMode; - bool mbIsInAnimation; - bool mbLoopTerminated; - bool mbIsWaiting; - - - SAL_DLLPRIVATE void ImplRestartTimer( sal_uLong nTimeout ); - DECL_DLLPRIVATE_LINK( ImplTimeoutHdl, void* ); - public: + Animation(); + Animation( const Animation& rAnimation ); + ~Animation(); - SAL_DLLPRIVATE static void ImplIncAnimCount() { mnAnimCount++; } - SAL_DLLPRIVATE static void ImplDecAnimCount() { mnAnimCount--; } - SAL_DLLPRIVATE sal_uLong ImplGetCurPos() const { return mnPos; } + Animation& operator=( const Animation& rAnimation ); + bool operator==( const Animation& rAnimation ) const; + bool operator!=( const Animation& rAnimation ) const + { return !(*this==rAnimation); } + void Clear(); -public: - Animation(); - Animation( const Animation& rAnimation ); - ~Animation(); + bool Start( + OutputDevice* pOutDev, + const Point& rDestPt, + const Size& rDestSz, + long nExtraData = 0, + OutputDevice* pFirstFrameOutDev = NULL); - Animation& operator=( const Animation& rAnimation ); - bool operator==( const Animation& rAnimation ) const; - bool operator!=( const Animation& rAnimation ) const - { return !(*this==rAnimation); } + void Stop( OutputDevice* pOutDev = NULL, long nExtraData = 0 ); - void Clear(); + void Draw( OutputDevice* pOutDev, const Point& rDestPt ) const; + void Draw( OutputDevice* pOutDev, const Point& rDestPt, const Size& rDestSz ) const; - bool Start( - OutputDevice* pOutDev, - const Point& rDestPt, - const Size& rDestSz, - long nExtraData = 0, - OutputDevice* pFirstFrameOutDev = NULL - ); - void Stop( OutputDevice* pOutDev = NULL, long nExtraData = 0 ); + bool IsInAnimation() const { return mbIsInAnimation; } + bool IsTransparent() const; + bool IsTerminated() const { return mbLoopTerminated; } - void Draw( OutputDevice* pOutDev, const Point& rDestPt ) const; - void Draw( OutputDevice* pOutDev, const Point& rDestPt, const Size& rDestSz ) const; + const Size& GetDisplaySizePixel() const { return maGlobalSize; } + void SetDisplaySizePixel( const Size& rSize ) { maGlobalSize = rSize; } - bool IsInAnimation() const { return mbIsInAnimation; } - bool IsTransparent() const; - bool IsTerminated() const { return mbLoopTerminated; } + const BitmapEx& GetBitmapEx() const { return maBitmapEx; } + void SetBitmapEx( const BitmapEx& rBmpEx ) { maBitmapEx = rBmpEx; } - const Size& GetDisplaySizePixel() const { return maGlobalSize; } - void SetDisplaySizePixel( const Size& rSize ) { maGlobalSize = rSize; } + sal_uLong GetLoopCount() const { return mnLoopCount; } + void SetLoopCount( const sal_uLong nLoopCount ); + void ResetLoopCount(); - const BitmapEx& GetBitmapEx() const { return maBitmapEx; } - void SetBitmapEx( const BitmapEx& rBmpEx ) { maBitmapEx = rBmpEx; } + void SetCycleMode( CycleMode eMode ); + CycleMode GetCycleMode() const { return meCycleMode; } - sal_uLong GetLoopCount() const { return mnLoopCount; } - void SetLoopCount( const sal_uLong nLoopCount ); - void ResetLoopCount(); + void SetNotifyHdl( const Link& rLink ) { maNotifyLink = rLink; } + const Link& GetNotifyHdl() const { return maNotifyLink; } - void SetCycleMode( CycleMode eMode ); - CycleMode GetCycleMode() const { return meCycleMode; } + size_t Count() const { return maList.size(); } + bool Insert( const AnimationBitmap& rAnimationBitmap ); + const AnimationBitmap& + Get( sal_uInt16 nAnimation ) const; + void Replace( const AnimationBitmap& rNewAnimationBmp, sal_uInt16 nAnimation ); - void SetNotifyHdl( const Link& rLink ) { maNotifyLink = rLink; } - const Link& GetNotifyHdl() const { return maNotifyLink; } + sal_uLong GetSizeBytes() const; + sal_uLong GetChecksum() const; - size_t Count() const { return maList.size(); } - bool Insert( const AnimationBitmap& rAnimationBitmap ); - const AnimationBitmap& Get( sal_uInt16 nAnimation ) const; - void Replace( const AnimationBitmap& rNewAnimationBmp, sal_uInt16 nAnimation ); +public: - sal_uLong GetSizeBytes() const; - sal_uLong GetChecksum() const; + bool Convert( BmpConversion eConversion ); + bool ReduceColors( + sal_uInt16 nNewColorCount, + BmpReduce eReduce = BMP_REDUCE_SIMPLE ); + + bool Invert(); + bool Mirror( sal_uLong nMirrorFlags ); + bool Adjust( + short nLuminancePercent = 0, + short nContrastPercent = 0, + short nChannelRPercent = 0, + short nChannelGPercent = 0, + short nChannelBPercent = 0, + double fGamma = 1.0, + bool bInvert = false ); + + bool Filter( + BmpFilter eFilter, + const BmpFilterParam* pFilterParam = NULL, + const Link* pProgress = NULL ); + + friend VCL_DLLPUBLIC SvStream& ReadAnimation( SvStream& rIStream, Animation& rAnimation ); + friend VCL_DLLPUBLIC SvStream& WriteAnimation( SvStream& rOStream, const Animation& rAnimation ); public: - bool Convert( BmpConversion eConversion ); - bool ReduceColors( - sal_uInt16 nNewColorCount, - BmpReduce eReduce = BMP_REDUCE_SIMPLE - ); - bool Invert(); - bool Mirror( sal_uLong nMirrorFlags ); - bool Adjust( - short nLuminancePercent = 0, - short nContrastPercent = 0, - short nChannelRPercent = 0, - short nChannelGPercent = 0, - short nChannelBPercent = 0, - double fGamma = 1.0, - bool bInvert = false - ); - bool Filter( - BmpFilter eFilter, - const BmpFilterParam* pFilterParam = NULL, - const Link* pProgress = NULL - ); - - friend VCL_DLLPUBLIC SvStream& ReadAnimation( SvStream& rIStream, Animation& rAnimation ); - friend VCL_DLLPUBLIC SvStream& WriteAnimation( SvStream& rOStream, const Animation& rAnimation ); + SAL_DLLPRIVATE static void + ImplIncAnimCount() { mnAnimCount++; } + SAL_DLLPRIVATE static void + ImplDecAnimCount() { mnAnimCount--; } + SAL_DLLPRIVATE sal_uLong + ImplGetCurPos() const { return mnPos; } + +private: + SAL_DLLPRIVATE static sal_uLong mnAnimCount; + + AnimationBitmapList_impl maList; + AnimViewList_impl maViewList; + + Link maNotifyLink; + BitmapEx maBitmapEx; + Timer maTimer; + Size maGlobalSize; + long mnLoopCount; + long mnLoops; + size_t mnPos; + CycleMode meCycleMode; + bool mbIsInAnimation; + bool mbLoopTerminated; + bool mbIsWaiting; + + SAL_DLLPRIVATE void ImplRestartTimer( sal_uLong nTimeout ); + DECL_DLLPRIVATE_LINK( ImplTimeoutHdl, void* ); + }; #endif // INCLUDED_VCL_ANIMATE_HXX diff --git a/include/vcl/apptypes.hxx b/include/vcl/apptypes.hxx index 60ead54..bc0307c 100644 --- a/include/vcl/apptypes.hxx +++ b/include/vcl/apptypes.hxx @@ -23,13 +23,13 @@ #include <vcl/dllapi.h> #include <tools/rtti.hxx> -#define EXC_RSCNOTLOADED ((sal_uInt16)0x0100) -#define EXC_SYSTEM ((sal_uInt16)0x0300) -#define EXC_DISPLAY ((sal_uInt16)0x0400) -#define EXC_REMOTE ((sal_uInt16)0x0500) -#define EXC_USER ((sal_uInt16)0x1000) -#define EXC_MAJORTYPE ((sal_uInt16)0xFF00) -#define EXC_MINORTYPE ((sal_uInt16)0x00FF) +#define EXC_RSCNOTLOADED ((sal_uInt16)0x0100) +#define EXC_SYSTEM ((sal_uInt16)0x0300) +#define EXC_DISPLAY ((sal_uInt16)0x0400) +#define EXC_REMOTE ((sal_uInt16)0x0500) +#define EXC_USER ((sal_uInt16)0x1000) +#define EXC_MAJORTYPE ((sal_uInt16)0xFF00) +#define EXC_MINORTYPE ((sal_uInt16)0x00FF) #define VCL_INPUT_MOUSE 0x0001 #define VCL_INPUT_KEYBOARD 0x0002 diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx index d2f0cac..6f66f9c 100644 --- a/include/vcl/bitmap.hxx +++ b/include/vcl/bitmap.hxx @@ -60,7 +60,7 @@ #define BMP_VECTORIZE_BOUND_ONLY 0x00000004UL #define BMP_VECTORIZE_REDUCE_EDGES 0x00000008UL -#define BMP_COL_TRANS Color( 252, 3, 251 ) +#define BMP_COL_TRANS Color( 252, 3, 251 ) enum BmpConversion { @@ -127,39 +127,6 @@ enum BmpFilter class VCL_DLLPUBLIC BmpFilterParam { - friend class Bitmap; - friend class BitmapEx; - friend class Animation; - -private: - BmpFilter meFilter; - sal_uLong mnProgressStart; - sal_uLong mnProgressEnd; - -public: - struct MosaicTileSize - { - sal_uLong mnTileWidth; - sal_uLong mnTileHeight; - }; - - struct EmbossAngles - { - sal_uInt16 mnAzimuthAngle100; - sal_uInt16 mnElevationAngle100; - }; - -private: - union - { - sal_uInt16 mnSepiaPercent; - sal_uInt8 mcSolarGreyThreshold; - double mnRadius; - - MosaicTileSize maMosaicTileSize; - EmbossAngles maEmbossAngles; - }; - public: BmpFilterParam( sal_uLong nProgressStart = 0, sal_uLong nProgressEnd = 0 ) : @@ -190,36 +157,68 @@ public: maEmbossAngles.mnAzimuthAngle100 = nEmbossAzimuthAngle100; maEmbossAngles.mnElevationAngle100 = nEmbossElevationAngle100; } -}; +private: + friend class Bitmap; + friend class BitmapEx; + friend class Animation; -// Resample kernels +private: + BmpFilter meFilter; + sal_uLong mnProgressStart; + sal_uLong mnProgressEnd; + +public: + struct MosaicTileSize + { + sal_uLong mnTileWidth; + sal_uLong mnTileHeight; + }; + + struct EmbossAngles + { + sal_uInt16 mnAzimuthAngle100; + sal_uInt16 mnElevationAngle100; + }; + +private: + union + { + sal_uInt16 mnSepiaPercent; + sal_uInt8 mcSolarGreyThreshold; + double mnRadius; + + MosaicTileSize maMosaicTileSize; + EmbossAngles maEmbossAngles; + }; +}; + +// Resample kernels class Kernel { public: - Kernel () {} - virtual ~Kernel() {} + Kernel () {} + virtual ~Kernel() {} - virtual double GetWidth() const = 0; - virtual double Calculate( double x ) const = 0; + virtual double GetWidth() const = 0; + virtual double Calculate( double x ) const = 0; }; class Lanczos3Kernel : public Kernel { - typedef boost::math::policies::policy< - boost::math::policies::promote_double<false> > SincPolicy; public: - Lanczos3Kernel() : Kernel () {} - virtual double GetWidth() const SAL_OVERRIDE { return 3.0; } - virtual double Calculate (double x) const SAL_OVERRIDE + Lanczos3Kernel() : Kernel () {} + + virtual double GetWidth() const SAL_OVERRIDE { return 3.0; } + virtual double Calculate (double x) const SAL_OVERRIDE { return (-3.0 <= x && x < 3.0) ? SincFilter(x) * SincFilter( x / 3.0 ) : 0.0; } - inline double SincFilter(double x) const + inline double SincFilter(double x) const { if (x == 0.0) { @@ -228,14 +227,20 @@ public: x = x * M_PI; return boost::math::sinc_pi(x, SincPolicy()); } + +private: + typedef boost::math::policies::policy< + boost::math::policies::promote_double<false> > SincPolicy; }; -class BicubicKernel : public Kernel { +class BicubicKernel : public Kernel +{ public: - BicubicKernel() : Kernel () {} + BicubicKernel() : Kernel () {} + private: - virtual double GetWidth() const SAL_OVERRIDE { return 2.0; } - virtual double Calculate (double x) const SAL_OVERRIDE + virtual double GetWidth() const SAL_OVERRIDE { return 2.0; } + virtual double Calculate (double x) const SAL_OVERRIDE { if (x < 0.0) { @@ -254,12 +259,13 @@ private: } }; -class BilinearKernel : public Kernel { +class BilinearKernel : public Kernel +{ public: - BilinearKernel() : Kernel () {} + BilinearKernel() : Kernel () {} private: - virtual double GetWidth() const SAL_OVERRIDE { return 1.0; } - virtual double Calculate (double x) const SAL_OVERRIDE + virtual double GetWidth() const SAL_OVERRIDE { return 1.0; } + virtual double Calculate (double x) const SAL_OVERRIDE { if (x < 0.0) { @@ -273,12 +279,14 @@ private: } }; -class BoxKernel : public Kernel { +class BoxKernel : public Kernel +{ public: - BoxKernel() : Kernel () {} + BoxKernel() : Kernel () {} + private: - virtual double GetWidth() const SAL_OVERRIDE { return 0.5; } - virtual double Calculate (double x) const SAL_OVERRIDE + virtual double GetWidth() const SAL_OVERRIDE { return 0.5; } + virtual double Calculate (double x) const SAL_OVERRIDE { if (-0.5 <= x && x < 0.5) return 1.0; @@ -313,67 +321,14 @@ struct BitmapSystemData class VCL_DLLPUBLIC Bitmap { -private: - - ImpBitmap* mpImpBmp; - MapMode maPrefMapMode; - Size maPrefSize; - -public: - - SAL_DLLPRIVATE void ImplReleaseRef(); - SAL_DLLPRIVATE void ImplMakeUnique(); - ImpBitmap* ImplGetImpBitmap() const { return mpImpBmp;} - SAL_DLLPRIVATE void ImplSetImpBitmap( ImpBitmap* pImpBmp ); - SAL_DLLPRIVATE void ImplAssignWithSize( const Bitmap& rBitmap ); - - SAL_DLLPRIVATE void ImplAdaptBitCount(Bitmap& rNew) const; - SAL_DLLPRIVATE bool ImplScaleFast( const double& rScaleX, const double& rScaleY ); - SAL_DLLPRIVATE bool ImplScaleInterpolate( const double& rScaleX, const double& rScaleY ); - SAL_DLLPRIVATE bool ImplScaleSuper( const double& rScaleX, const double& rScaleY ); - SAL_DLLPRIVATE bool ImplScaleConvolution( const double& rScaleX, const double& rScaleY, const Kernel& aKernel); - - SAL_DLLPRIVATE bool ImplConvolutionPass( Bitmap& aNewBitmap, const int nNewSize, BitmapReadAccess* pReadAcc, - int aNumberOfContributions, double* pWeights, int* pPixels, int* pCount ); - - SAL_DLLPRIVATE bool ImplMakeMono( sal_uInt8 cThreshold ); - SAL_DLLPRIVATE bool ImplMakeMonoDither(); - SAL_DLLPRIVATE bool ImplMakeGreyscales( sal_uInt16 nGreyscales ); - SAL_DLLPRIVATE bool ImplConvertUp( sal_uInt16 nBitCount, Color* pExtColor = NULL ); - SAL_DLLPRIVATE bool ImplConvertDown( sal_uInt16 nBitCount, Color* pExtColor = NULL ); - SAL_DLLPRIVATE bool ImplConvertGhosted(); - SAL_DLLPRIVATE bool ImplDitherMatrix(); - SAL_DLLPRIVATE bool ImplDitherFloyd(); - SAL_DLLPRIVATE bool ImplDitherFloyd16(); - SAL_DLLPRIVATE bool ImplReduceSimple( sal_uInt16 nColorCount ); - SAL_DLLPRIVATE bool ImplReducePopular( sal_uInt16 nColorCount ); - SAL_DLLPRIVATE bool ImplReduceMedian( sal_uInt16 nColorCount ); - SAL_DLLPRIVATE void ImplMedianCut( sal_uLong* pColBuf, BitmapPalette& rPal, - long nR1, long nR2, long nG1, long nG2, long nB1, long nB2, - long nColors, long nPixels, long& rIndex ); - SAL_DLLPRIVATE bool ImplConvolute3( const long* pMatrix, long nDivisor, - const BmpFilterParam* pFilterParam, const Link* pProgress ); - SAL_DLLPRIVATE bool ImplMedianFilter( const BmpFilterParam* pFilterParam, const Link* pProgress ); - SAL_DLLPRIVATE bool ImplSobelGrey( const BmpFilterParam* pFilterParam, const Link* pProgress ); - SAL_DLLPRIVATE bool ImplEmbossGrey( const BmpFilterParam* pFilterParam, const Link* pProgress ); - SAL_DLLPRIVATE bool ImplSolarize( const BmpFilterParam* pFilterParam, const Link* pProgress ); - SAL_DLLPRIVATE bool ImplSepia( const BmpFilterParam* pFilterParam, const Link* pProgress ); - SAL_DLLPRIVATE bool ImplMosaic( const BmpFilterParam* pFilterParam, const Link* pProgress ); - SAL_DLLPRIVATE bool ImplPopArt( const BmpFilterParam* pFilterParam, const Link* pProgress ); - - SAL_DLLPRIVATE bool ImplSeparableBlurFilter( const double aRadius = 0.7 ); - SAL_DLLPRIVATE bool ImplSeparableUnsharpenFilter( const double aRadius = 0.7 ); - SAL_DLLPRIVATE bool ImplDuotoneFilter( const sal_uLong nColorOne, sal_uLong nColorTwo ); - SAL_DLLPRIVATE void ImplBlurContributions( const int aSize, const int aNumberOfContributions, - double* pBlurVector, double*& pWeights, int*& pPixels, int*& pCount ); public: - Bitmap(); - Bitmap( const Bitmap& rBitmap ); - Bitmap( const Size& rSizePixel, sal_uInt16 nBitCount, const BitmapPalette* pPal = NULL ); - Bitmap( const ResId& rResId ); - Bitmap( SalBitmap* pSalBitmap ); - virtual ~Bitmap(); + Bitmap(); + Bitmap( const Bitmap& rBitmap ); + Bitmap( const Size& rSizePixel, sal_uInt16 nBitCount, const BitmapPalette* pPal = NULL ); + Bitmap( const ResId& rResId ); + Bitmap( SalBitmap* pSalBitmap ); + virtual ~Bitmap(); Bitmap& operator=( const Bitmap& rBitmap ); inline bool operator!() const; @@ -394,9 +349,9 @@ public: Size GetSizePixel() const; - sal_uInt16 GetBitCount() const; - inline sal_uLong GetColorCount() const; - inline sal_uLong GetSizeBytes() const; + sal_uInt16 GetBitCount() const; + inline sal_uLong GetColorCount() const; + inline sal_uLong GetSizeBytes() const; bool HasGreyPalette() const; /** get system dependent bitmap data @@ -407,16 +362,17 @@ public: */ bool GetSystemData( BitmapSystemData& rData ) const; - sal_uLong GetChecksum() const; + sal_uLong GetChecksum() const; Bitmap CreateDisplayBitmap( OutputDevice* pDisplay ); Bitmap GetColorTransformedBitmap() const; - static const BitmapPalette& GetGreyPalette( int nEntries ); + static const BitmapPalette& + GetGreyPalette( int nEntries ); public: - bool MakeMono( sal_uInt8 cThreshold ); + bool MakeMono( sal_uInt8 cThreshold ); /** Convert bitmap format @@ -438,8 +394,9 @@ public: @return true, if the color reduction operation was completed successfully. */ - bool ReduceColors( sal_uInt16 nNewColorCount, - BmpReduce eReduce = BMP_REDUCE_SIMPLE ); + bool ReduceColors( + sal_uInt16 nNewColorCount, + BmpReduce eReduce = BMP_REDUCE_SIMPLE ); /** Apply a dither algorithm to the bitmap @@ -483,8 +440,9 @@ public: not only returned when the operation failed, but also if nothing had to be done, e.g. because nDX and nDY were zero. */ - bool Expand( sal_uLong nDX, sal_uLong nDY, - const Color* pInitColor = NULL ); + bool Expand( + sal_uLong nDX, sal_uLong nDY, + const Color* pInitColor = NULL ); /** Copy a rectangular area from another bitmap @@ -508,12 +466,15 @@ public: nothing had to be done, e.g. because one of the rectangles are empty. */ - bool CopyPixel( const Rectangle& rRectDst, - const Rectangle& rRectSrc, - const Bitmap* pBmpSrc = NULL ); + bool CopyPixel( + const Rectangle& rRectDst, + const Rectangle& rRectSrc, + const Bitmap* pBmpSrc = NULL ); - bool CopyPixel_AlphaOptimized( const Rectangle& rRectDst, const Rectangle& rRectSrc, ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits