[Libreoffice-commits] core.git: Branch 'feature/calctiledrendering' - sc/source
Andrzej Hunt
andrzej.hunt at collabora.com
Wed Jun 25 14:38:33 PDT 2014
sc/source/ui/inc/hdrcont.hxx | 4 +-
sc/source/ui/view/colrowba.cxx | 8 +++--
sc/source/ui/view/hdrcont.cxx | 62 +++++++++++++++++++++++++++++++++++++++++
3 files changed, 70 insertions(+), 4 deletions(-)
New commits:
commit 2d90abfb94ed579f9427b94691b4a704bd8f4355
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date: Wed Jun 25 22:37:54 2014 +0100
DO NOT USE
An early attempt at getting the column/rowbars
cooperating with the tiled rendering-induced scaling/sizing
changes.
Change-Id: I15c2bc7210f26cededd63bc89dbd782e6e4c03b8
diff --git a/sc/source/ui/inc/hdrcont.hxx b/sc/source/ui/inc/hdrcont.hxx
index 745367e..3a8a46f 100644
--- a/sc/source/ui/inc/hdrcont.hxx
+++ b/sc/source/ui/inc/hdrcont.hxx
@@ -23,6 +23,7 @@
#include <vcl/window.hxx>
#include <vcl/seleng.hxx>
#include "address.hxx"
+#include "fillinfo.hxx"
#define HDR_SIZE_OPTIMUM 0xFFFF
@@ -79,7 +80,8 @@ protected:
virtual void RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE;
// new methods
-
+ ScTableInfo mTabInfo;
+ void UpdateTabInfo( SCCOL nX1, SCCOL nX2, SCCOL nY1, SCCOL nY2 );
virtual SCCOLROW GetPos() const = 0; // current position (Scrolling)
virtual sal_uInt16 GetEntrySize( SCCOLROW nEntryNo ) const = 0; // width / height (Pixel)
virtual OUString GetEntryText( SCCOLROW nEntryNo ) const = 0;
diff --git a/sc/source/ui/view/colrowba.cxx b/sc/source/ui/view/colrowba.cxx
index 3bc9c47..e8a9baf 100644
--- a/sc/source/ui/view/colrowba.cxx
+++ b/sc/source/ui/view/colrowba.cxx
@@ -83,7 +83,8 @@ sal_uInt16 ScColBar::GetEntrySize( SCCOLROW nEntryNo ) const
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() );
+ return mTabInfo.mpRowInfo[0].pCellInfo[nEntryNo].nWidth / 16;
+// return (sal_uInt16) ScViewData::ToPixel( pDoc->GetColWidth( static_cast<SCCOL>(nEntryNo), nTab ), pViewData->GetPPTX() );
}
OUString ScColBar::GetEntryText( SCCOLROW nEntryNo ) const
@@ -238,8 +239,9 @@ sal_uInt16 ScRowBar::GetEntrySize( SCCOLROW nEntryNo ) const
if (pDoc->RowHidden(nEntryNo, nTab, NULL, &nLastRow))
return 0;
else
- return (sal_uInt16) ScViewData::ToPixel( pDoc->GetOriginalHeight( nEntryNo,
- nTab ), pViewData->GetPPTY() );
+ return mTabInfo.mpRowInfo[0].nHeight / 16;
+// return (sal_uInt16) ScViewData::ToPixel( pDoc->GetOriginalHeight( nEntryNo,
+// nTab ), pViewData->GetPPTY() );
}
OUString ScRowBar::GetEntryText( SCCOLROW nEntryNo ) const
diff --git a/sc/source/ui/view/hdrcont.cxx b/sc/source/ui/view/hdrcont.cxx
index 40997f2..9257f1f 100644
--- a/sc/source/ui/view/hdrcont.cxx
+++ b/sc/source/ui/view/hdrcont.cxx
@@ -106,11 +106,58 @@ ScHeaderControl::~ScHeaderControl()
{
}
+void ScHeaderControl::UpdateTabInfo( SCCOL nX1, SCCOL nX2, SCCOL nY1, SCCOL nY2 )
+{
+ ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>(SfxViewShell::Current());
+ if (!pViewSh)
+ return;
+
+ ScViewData& rViewData = pViewSh->GetViewData();
+
+ int nTab = rViewData.GetTabNo();
+ ScDocument* pDoc = rViewData.GetDocument();
+
+ const ScViewOptions& rOpts = rViewData.GetOptions();
+ bool bFormulaMode = rOpts.GetOption( VOPT_FORMULAS );
+
+ pDoc->FillInfo( mTabInfo, nX1, nY1, nX2, nY2, nTab,
+ rViewData.GetPPTX(), rViewData.GetPPTY(),
+ false, bFormulaMode,
+ &rViewData.GetMarkData() );
+}
+
void ScHeaderControl::DoPaint( SCCOLROW nStart, SCCOLROW nEnd )
{
bool bLayoutRTL = IsLayoutRTL();
long nLayoutSign = bLayoutRTL ? -1 : 1;
+ if ( nStart == nEnd )
+ {
+ // No point in painting 0 items...
+ // This happens e.g. during the construction, and can actually cause
+ // problems at that point as we don't yet have a viewshell, hence
+ // we can't populate the tab info, hence we get segfaults when trying
+ // to access inexistent data in the tabinfo.
+ return;
+ }
+
+ // We need to make sure we have at least one row and one column, or we won't
+ // get valid data out from UpdateTabInfo (and specifically FillInfo).
+ SCROW nY1 = 0, nY2 = 1;
+ SCCOL nX1 = 0, nX2 = 1;
+ if ( bVertical )
+ {
+ nY1 = nStart;
+ nY2 = nEnd + 1; // We request the size of nEnd+1 too below
+ }
+ else
+ {
+ nX1 = nStart;
+ nX2 = nEnd + 1; // We request the size of nEnd+1 too below
+ }
+
+ UpdateTabInfo( nX1, nX2, nY1, nY2 );
+
Rectangle aRect( Point(0,0), GetOutputSizePixel() );
if ( bVertical )
{
@@ -239,6 +286,19 @@ void ScHeaderControl::Paint( const Rectangle& rRect )
{
// fuer VCL ist es wichtig, wenig Aufrufe zu haben, darum werden die aeusseren
// Linien zusammengefasst
+ ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>(SfxViewShell::Current());
+ if (!pViewSh)
+ {
+ assert(false);
+ return;
+ }
+
+ ScViewData& rViewData = pViewSh->GetViewData();
+ MapMode aMapMode( GetMapMode() );
+// aMapMode.SetMapUnit( MAP_TWIP );
+ aMapMode.SetScaleX( rViewData.GetZoomX() * Fraction(0.96) );
+ aMapMode.SetScaleY( rViewData.GetZoomY() * Fraction(0.96) );
+ SetMapMode( aMapMode );
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
bool bHighContrast = rStyleSettings.GetHighContrastMode();
@@ -300,6 +360,8 @@ void ScHeaderControl::Paint( const Rectangle& rRect )
long nLineEnd = nInitScrPos - nLayoutSign;
+ UpdateTabInfo( 0, bVertical ? 1 : nSize, 0, bVertical ? nSize : 1 );
+
for (SCCOLROW i=nPos; i<nSize; i++)
{
sal_uInt16 nSizePix = GetEntrySize( i );
More information about the Libreoffice-commits
mailing list