summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/source/ui/inc/hdrcont.hxx4
-rw-r--r--sc/source/ui/view/colrowba.cxx8
-rw-r--r--sc/source/ui/view/hdrcont.cxx62
3 files changed, 70 insertions, 4 deletions
diff --git a/sc/source/ui/inc/hdrcont.hxx b/sc/source/ui/inc/hdrcont.hxx
index 745367e57136..3a8a46fc199b 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 3bc9c474d707..e8a9baff0f4e 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 40997f2da53e..9257f1fd9365 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 );