summaryrefslogtreecommitdiff
path: root/sc/source/ui/view
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/ui/view')
-rw-r--r--sc/source/ui/view/gridwin.cxx76
-rw-r--r--sc/source/ui/view/gridwin2.cxx2
-rw-r--r--sc/source/ui/view/gridwin4.cxx33
-rw-r--r--sc/source/ui/view/output.cxx14
-rw-r--r--sc/source/ui/view/output2.cxx34
-rw-r--r--sc/source/ui/view/prevwsh2.cxx4
-rw-r--r--sc/source/ui/view/scextopt.cxx21
-rw-r--r--sc/source/ui/view/tabview3.cxx1
-rw-r--r--sc/source/ui/view/viewdata.cxx161
-rw-r--r--sc/source/ui/view/viewfun2.cxx2
-rw-r--r--sc/source/ui/view/viewfun3.cxx4
11 files changed, 220 insertions, 132 deletions
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index db72d87f30a2..0f07b8772254 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -69,6 +69,8 @@
#include <com/sun/star/sheet/MemberResultFlags.hpp>
#include <com/sun/star/awt/KeyModifier.hpp>
#include <com/sun/star/awt/MouseButton.hpp>
+#include <com/sun/star/script/vba/VBAEventId.hpp>
+#include <com/sun/star/script/vba/XVBAEventProcessor.hpp>
#include "gridwin.hxx"
#include "tabvwsh.hxx"
@@ -119,6 +121,7 @@
#include "tabprotection.hxx"
#include "postit.hxx"
#include "dpcontrol.hxx"
+#include "cellsuno.hxx"
#include "drawview.hxx"
#include <svx/sdrpagewindow.hxx>
@@ -366,6 +369,32 @@ void lcl_UnLockComment( ScDrawView* pView, SdrPageView* pPV, SdrModel* pDrDoc, c
}
}
+sal_Bool lcl_GetHyperlinkCell(ScDocument* pDoc, SCCOL& rPosX, SCROW& rPosY, SCTAB nTab, ScBaseCell*& rpCell )
+{
+ BOOL bFound = FALSE;
+ do
+ {
+ pDoc->GetCell( rPosX, rPosY, nTab, rpCell );
+ if ( !rpCell || rpCell->GetCellType() == CELLTYPE_NOTE )
+ {
+ if ( rPosX <= 0 )
+ return FALSE; // alles leer bis links
+ else
+ --rPosX; // weitersuchen
+ }
+ else if ( rpCell->GetCellType() == CELLTYPE_EDIT)
+ bFound = TRUE;
+ else if (rpCell->GetCellType() == CELLTYPE_FORMULA &&
+ static_cast<ScFormulaCell*>(rpCell)->IsHyperLinkCell())
+ bFound = TRUE;
+ else
+ return FALSE; // andere Zelle
+ }
+ while ( !bFound );
+
+ return bFound;
+}
+
// ---------------------------------------------------------------------------
// WB_DIALOGCONTROL noetig fuer UNO-Controls
ScGridWindow::ScGridWindow( Window* pParent, ScViewData* pData, ScSplitPos eWhichPos )
@@ -2100,6 +2129,30 @@ void __EXPORT ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt )
{
nMouseStatus = SC_GM_NONE; // keinen Doppelklick anfangen
ScGlobal::OpenURL( aUrl, aTarget );
+
+ // fire worksheet_followhyperlink event
+ uno::Reference< script::vba::XVBAEventProcessor > xVbaEvents = pDoc->GetVbaEventProcessor();
+ if( xVbaEvents.is() ) try
+ {
+ Point aPos = rMEvt.GetPosPixel();
+ SCsCOL nPosX;
+ SCsROW nPosY;
+ SCTAB nTab = pViewData->GetTabNo();
+ pViewData->GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nPosX, nPosY );
+ ScBaseCell* pCell = NULL;
+ if( lcl_GetHyperlinkCell( pDoc, nPosX, nPosY, nTab, pCell ) )
+ {
+ ScAddress aCellPos( nPosX, nPosY, nTab );
+ uno::Reference< table::XCell > xCell( new ScCellObj( pViewData->GetDocShell(), aCellPos ) );
+ uno::Sequence< uno::Any > aArgs(1);
+ aArgs[0] <<= xCell;
+ xVbaEvents->processVbaEvent( script::vba::VBAEventId::WORKSHEET_FOLLOWHYPERLINK, aArgs );
+ }
+ }
+ catch( uno::Exception& )
+ {
+ }
+
return;
}
}
@@ -4818,26 +4871,9 @@ BOOL ScGridWindow::GetEditUrlOrError( BOOL bSpellErr, const Point& rPos,
ScDocument* pDoc = pDocSh->GetDocument();
ScBaseCell* pCell = NULL;
- BOOL bFound = FALSE;
- do
- {
- pDoc->GetCell( nPosX, nPosY, nTab, pCell );
- if ( !pCell || pCell->GetCellType() == CELLTYPE_NOTE )
- {
- if ( nPosX <= 0 )
- return FALSE; // alles leer bis links
- else
- --nPosX; // weitersuchen
- }
- else if ( pCell->GetCellType() == CELLTYPE_EDIT)
- bFound = TRUE;
- else if (pCell->GetCellType() == CELLTYPE_FORMULA &&
- static_cast<ScFormulaCell*>(pCell)->IsHyperLinkCell())
- bFound = TRUE;
- else
- return FALSE; // andere Zelle
- }
- while ( !bFound );
+ BOOL bFound = lcl_GetHyperlinkCell( pDoc, nPosX, nPosY, nTab, pCell );
+ if( !bFound )
+ return FALSE;
ScHideTextCursor aHideCursor( pViewData, eWhich ); // before GetEditArea (MapMode is changed)
diff --git a/sc/source/ui/view/gridwin2.cxx b/sc/source/ui/view/gridwin2.cxx
index f8b5c25c4a70..a64814d952ef 100644
--- a/sc/source/ui/view/gridwin2.cxx
+++ b/sc/source/ui/view/gridwin2.cxx
@@ -144,7 +144,7 @@ bool ScGridWindow::DoAutoFilterButton( SCCOL nCol, SCROW nRow, const MouseEvent&
Size aScrSize(nSizeX-1, nSizeY-1);
// Check if the mouse cursor is clicking on the popup arrow box.
- mpFilterButton.reset(new ScDPFieldButton(this, &GetSettings().GetStyleSettings(), &pViewData->GetZoomX(), &pViewData->GetZoomY()));
+ mpFilterButton.reset(new ScDPFieldButton(this, &GetSettings().GetStyleSettings(), &pViewData->GetZoomX(), &pViewData->GetZoomY(), pDoc));
mpFilterButton->setBoundingBox(aScrPos, aScrSize);
Point aPopupPos;
Size aPopupSize;
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index d8024e439173..ba73fbf00269 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -401,17 +401,13 @@ void __EXPORT ScGridWindow::Paint( const Rectangle& rRect )
nScrX += ScViewData::ToPixel( pDoc->GetColWidth( nX2, nTab ), nPPTX );
}
- long nScrY = ScViewData::ToPixel( pDoc->GetRowHeight( nY1, nTab ), nPPTY );
- while ( nScrY <= aPixRect.Top() && nY1 < MAXROW )
- {
- ++nY1;
- nScrY += ScViewData::ToPixel( pDoc->GetRowHeight( nY1, nTab ), nPPTY );
- }
+ long nScrY = 0;
+ ScViewData::AddPixelsWhile( nScrY, aPixRect.Top(), nY1, MAXROW, nPPTY, pDoc, nTab);
SCROW nY2 = nY1;
- while ( nScrY <= aPixRect.Bottom() && nY2 < MAXROW )
+ if (nScrY <= aPixRect.Bottom() && nY2 < MAXROW)
{
++nY2;
- nScrY += ScViewData::ToPixel( pDoc->GetRowHeight( nY2, nTab ), nPPTY );
+ ScViewData::AddPixelsWhile( nScrY, aPixRect.Bottom(), nY2, MAXROW, nPPTY, pDoc, nTab);
}
Draw( nX1,nY1,nX2,nY2, SC_UPDATE_MARKS ); // nicht weiterzeichnen
@@ -750,6 +746,15 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod
if ( !bLogicText )
aOutputData.DrawStrings(FALSE); // in pixel MapMode
+ // edit cells and printer-metrics text must be before the buttons
+ // (DataPilot buttons contain labels in UI font)
+
+ pContentDev->SetMapMode(pViewData->GetLogicMode(eWhich));
+ if ( bLogicText )
+ aOutputData.DrawStrings(TRUE); // in logic MapMode if bTextWysiwyg is set
+ aOutputData.DrawEdit(TRUE);
+ pContentDev->SetMapMode(MAP_PIXEL);
+
// Autofilter- und Pivot-Buttons
DrawButtons( nX1, nY1, nX2, nY2, aTabInfo, pContentDev ); // Pixel
@@ -759,14 +764,6 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod
if ( rOpts.GetOption( VOPT_NOTES ) )
aOutputData.DrawNoteMarks();
- // Edit-Zellen
-
- pContentDev->SetMapMode(pViewData->GetLogicMode(eWhich));
- if ( bLogicText )
- aOutputData.DrawStrings(TRUE); // in logic MapMode if bTextWysiwyg is set
- aOutputData.DrawEdit(TRUE);
-
- pContentDev->SetMapMode(MAP_PIXEL);
if ( !bGridFirst && ( bGrid || bPage ) )
{
aOutputData.DrawGrid( bGrid, bPage );
@@ -1208,14 +1205,14 @@ void ScGridWindow::DrawButtons( SCCOL nX1, SCROW /*nY1*/, SCCOL nX2, SCROW /*nY2
{
aComboButton.SetOutputDevice( pContentDev );
- ScDPFieldButton aCellBtn(pContentDev, &GetSettings().GetStyleSettings(), &pViewData->GetZoomX(), &pViewData->GetZoomY());
+ ScDocument* pDoc = pViewData->GetDocument();
+ ScDPFieldButton aCellBtn(pContentDev, &GetSettings().GetStyleSettings(), &pViewData->GetZoomX(), &pViewData->GetZoomY(), pDoc);
SCCOL nCol;
SCROW nRow;
SCSIZE nArrY;
SCSIZE nQuery;
SCTAB nTab = pViewData->GetTabNo();
- ScDocument* pDoc = pViewData->GetDocument();
ScDBData* pDBData = NULL;
ScQueryParam* pQueryParam = NULL;
diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index 961572fc0185..7b27ddf3f8cc 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -489,6 +489,8 @@ void ScOutputData::DrawGrid( BOOL bGrid, BOOL bPage )
// Horizontale Linien
//
+ bool bHiddenRow = true;
+ SCROW nHiddenEndRow = -1;
nPosY = nScrY;
for (nArrY=1; nArrY+1<nArrCount; nArrY++)
{
@@ -503,9 +505,17 @@ void ScOutputData::DrawGrid( BOOL bGrid, BOOL bPage )
{
for (SCROW i = nYplus1; i <= MAXROW; ++i)
{
+ if (i > nHiddenEndRow)
+ bHiddenRow = pDoc->RowHidden(i, nTab, nHiddenEndRow);
+ /* TODO: optimize the row break thing for large hidden
+ * segments where HasRowBreak() has to be called
+ * nevertheless for each row, as a row break is drawn also
+ * for hidden rows, above them. This needed to be done only
+ * once per hidden segment, maybe giving manual breaks
+ * priority. Something like GetNextRowBreak() and
+ * GetNextManualRowBreak(). */
nBreak = pDoc->HasRowBreak(i, nTab);
- bool bHidden = pDoc->RowHidden(i, nTab);
- if (nBreak || !bHidden)
+ if (!bHiddenRow || nBreak)
break;
}
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index b0b040f9b5e0..6d40d304fb13 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -171,12 +171,11 @@ public:
private:
void SetHashText();
- long GetMaxDigitWidth();
+ long GetMaxDigitWidth(); // in logic units
long GetSignWidth();
long GetDotWidth();
long GetExpWidth();
void TextChanged();
- long ConvertWidthLogicToPixel( long nWidth ) const;
};
//==================================================================
@@ -518,6 +517,10 @@ void ScDrawStringsVars::SetHashText()
void ScDrawStringsVars::SetTextToWidthOrHash( ScBaseCell* pCell, long nWidth )
{
+ // #i113045# do the single-character width calculations in logic units
+ if (bPixelToLogic)
+ nWidth = pOutput->pRefDevice->PixelToLogic(Size(nWidth,0)).Width();
+
if (!pCell)
return;
@@ -565,6 +568,12 @@ void ScDrawStringsVars::SetTextToWidthOrHash( ScBaseCell* pCell, long nWidth )
else if (c == sal_Unicode('E'))
++nExpCount;
}
+
+ // #i112250# A small value might be formatted as "0" when only counting the digits,
+ // but fit into the column when considering the smaller width of the decimal separator.
+ if (aString.EqualsAscii("0") && fVal != 0.0)
+ nDecimalCount = 1;
+
if (nDecimalCount)
nWidth += (nMaxDigit - GetDotWidth()) * nDecimalCount;
if (nSignCount)
@@ -582,10 +591,6 @@ void ScDrawStringsVars::SetTextToWidthOrHash( ScBaseCell* pCell, long nWidth )
}
long nActualTextWidth = pOutput->pFmtDevice->GetTextWidth(aString);
-
- if (bPixelToLogic)
- nActualTextWidth = ConvertWidthLogicToPixel(nActualTextWidth);
-
if (nActualTextWidth > nWidth)
{
// Even after the decimal adjustment the text doesn't fit. Give up.
@@ -594,6 +599,7 @@ void ScDrawStringsVars::SetTextToWidthOrHash( ScBaseCell* pCell, long nWidth )
}
TextChanged();
+ pLastCell = NULL; // #i113022# equal cell and format in another column may give different string
}
void ScDrawStringsVars::SetAutoText( const String& rAutoText )
@@ -638,9 +644,6 @@ long ScDrawStringsVars::GetMaxDigitWidth()
long n = pOutput->pFmtDevice->GetTextWidth(String(cDigit));
nMaxDigitWidth = ::std::max(nMaxDigitWidth, n);
}
-
- if (bPixelToLogic)
- nMaxDigitWidth = ConvertWidthLogicToPixel(nMaxDigitWidth);
return nMaxDigitWidth;
}
@@ -650,8 +653,6 @@ long ScDrawStringsVars::GetSignWidth()
return nSignWidth;
nSignWidth = pOutput->pFmtDevice->GetTextWidth(String('-'));
- if (bPixelToLogic)
- nSignWidth = ConvertWidthLogicToPixel(nSignWidth);
return nSignWidth;
}
@@ -662,8 +663,6 @@ long ScDrawStringsVars::GetDotWidth()
const ::rtl::OUString& sep = ScGlobal::GetpLocaleData()->getLocaleItem().decimalSeparator;
nDotWidth = pOutput->pFmtDevice->GetTextWidth(sep);
- if (bPixelToLogic)
- nDotWidth = ConvertWidthLogicToPixel(nDotWidth);
return nDotWidth;
}
@@ -673,8 +672,6 @@ long ScDrawStringsVars::GetExpWidth()
return nExpWidth;
nExpWidth = pOutput->pFmtDevice->GetTextWidth(String('E'));
- if (bPixelToLogic)
- nExpWidth = ConvertWidthLogicToPixel(nExpWidth);
return nExpWidth;
}
@@ -704,13 +701,6 @@ void ScDrawStringsVars::TextChanged()
aTextSize = pRefDevice->LogicToPixel( aTextSize );
}
-long ScDrawStringsVars::ConvertWidthLogicToPixel( long nWidth ) const
-{
- Size aSize(nWidth, pOutput->pFmtDevice->GetTextHeight());
- aSize = pOutput->pRefDevice->LogicToPixel(aSize);
- return aSize.Width();
-}
-
BOOL ScDrawStringsVars::HasEditCharacters() const
{
static const sal_Unicode pChars[] =
diff --git a/sc/source/ui/view/prevwsh2.cxx b/sc/source/ui/view/prevwsh2.cxx
index 07af90f797aa..84868b5377de 100644
--- a/sc/source/ui/view/prevwsh2.cxx
+++ b/sc/source/ui/view/prevwsh2.cxx
@@ -126,10 +126,6 @@
//#define _GRAPH_HXX
#define _SOUND_HXX
-#if defined WIN
-#define _MENUBTN_HXX
-#endif
-
//svtools
#define _SCRWIN_HXX
#define _RULER_HXX
diff --git a/sc/source/ui/view/scextopt.cxx b/sc/source/ui/view/scextopt.cxx
index 1faa105d2bd7..d5816ecdd289 100644
--- a/sc/source/ui/view/scextopt.cxx
+++ b/sc/source/ui/view/scextopt.cxx
@@ -197,20 +197,27 @@ ScExtTabSettings& ScExtDocOptions::GetOrCreateTabSettings( SCTAB nTab )
return mxImpl->maTabSett.GetOrCreateTabSettings( nTab );
}
-size_t ScExtDocOptions::GetCodeNameCount() const
+SCTAB ScExtDocOptions::GetCodeNameCount() const
{
- return mxImpl->maCodeNames.size();
+ return static_cast< SCTAB >( mxImpl->maCodeNames.size() );
}
-const String& ScExtDocOptions::GetCodeName( size_t nIdx ) const
+const String& ScExtDocOptions::GetCodeName( SCTAB nTab ) const
{
- DBG_ASSERT( nIdx < GetCodeNameCount(), "ScExtDocOptions::GetCodeName - invalid index" );
- return (nIdx < GetCodeNameCount()) ? mxImpl->maCodeNames[ nIdx ] : EMPTY_STRING;
+ DBG_ASSERT( (0 <= nTab) && (nTab < GetCodeNameCount()), "ScExtDocOptions::GetCodeName - invalid sheet index" );
+ return ((0 <= nTab) && (nTab < GetCodeNameCount())) ? mxImpl->maCodeNames[ static_cast< size_t >( nTab ) ] : EMPTY_STRING;
}
-void ScExtDocOptions::AppendCodeName( const String& rCodeName )
+void ScExtDocOptions::SetCodeName( SCTAB nTab, const String& rCodeName )
{
- mxImpl->maCodeNames.push_back( rCodeName );
+ DBG_ASSERT( nTab >= 0, "ScExtDocOptions::SetCodeName - invalid sheet index" );
+ if( nTab >= 0 )
+ {
+ size_t nIndex = static_cast< size_t >( nTab );
+ if( nIndex >= mxImpl->maCodeNames.size() )
+ mxImpl->maCodeNames.resize( nIndex + 1 );
+ mxImpl->maCodeNames[ nIndex ] = rCodeName;
+ }
}
// ============================================================================
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index 86f68a1878cc..90bfe0c24e5c 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -1682,6 +1682,7 @@ void ScTabView::SetTabNo( SCTAB nTab, BOOL bNew, BOOL bExtendSelection )
}
TabChanged(); // DrawView
+
aViewData.GetViewShell()->WindowChanged(); // falls das aktive Fenster anders ist
if ( !bUnoRefDialog )
aViewData.GetViewShell()->DisconnectAllClients(); // important for floating frames
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index c034836d4d4a..7b35328f68bb 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -1696,50 +1696,32 @@ SCROW ScViewData::CellsAtY( SCsROW nPosY, SCsROW nDir, ScVSplitPos eWhichY, USHO
if (pView)
((ScViewData*)this)->aScrSize.Height() = pView->GetGridHeight(eWhichY);
- SCROW nY;
- USHORT nScrPosY = 0;
-
if (nScrSizeY == SC_SIZE_NONE) nScrSizeY = (USHORT) aScrSize.Height();
- if (nDir==1)
- nY = nPosY; // vorwaerts
- else
- nY = nPosY-1; // rueckwaerts
-
- BOOL bOut = FALSE;
- for ( ; nScrPosY<=nScrSizeY && !bOut; nY+=nDir )
- {
- SCsROW nRowNo = nY;
- if ( nRowNo < 0 || nRowNo > MAXROW )
- bOut = TRUE;
- else
- {
- USHORT nTSize = pDoc->GetRowHeight( nRowNo, nTabNo );
- if (nTSize)
- {
- long nSizeYPix = ToPixel( nTSize, nPPTY );
- nScrPosY = sal::static_int_cast<USHORT>( nScrPosY + (USHORT) nSizeYPix );
- }
- else if ( nDir == 1 && nRowNo < MAXROW )
- {
- // skip multiple hidden rows (forward only for now)
- SCROW nNext = pDoc->FirstVisibleRow(nRowNo + 1, MAXROW, nTabNo);
- if ( nNext > MAXROW )
- {
- // same behavior as without the optimization: set bOut with nY=MAXROW+1
- nY = MAXROW+1;
- bOut = TRUE;
- }
- else
- nY = nNext - 1; // +=nDir advances to next visible row
- }
- }
- }
+ SCROW nY;
if (nDir==1)
+ {
+ // forward
+ nY = nPosY;
+ long nScrPosY = 0;
+ AddPixelsWhile( nScrPosY, nScrSizeY, nY, MAXROW, nPPTY, pDoc, nTabNo);
+ // Original loop ended on last evaluated +1 or if that was MAXROW even
+ // on MAXROW+2.
+ nY += (nY == MAXROW ? 2 : 1);
nY -= nPosY;
+ }
else
+ {
+ // backward
+ nY = nPosY-1;
+ long nScrPosY = 0;
+ AddPixelsWhileBackward( nScrPosY, nScrSizeY, nY, 0, nPPTY, pDoc, nTabNo);
+ // Original loop ended on last evaluated -1 or if that was 0 even on
+ // -2.
+ nY -= (nY == 0 ? 2 : 1);
nY = (nPosY-1)-nY;
+ }
if (nY>0) --nY;
return nY;
@@ -1855,16 +1837,10 @@ BOOL ScViewData::GetPosFromPixel( long nClickX, long nClickY, ScSplitPos eWhich,
}
if (nClickY > 0)
- {
- while ( rPosY<=MAXROW && nClickY >= nScrY )
- {
- nScrY += ToPixel( pDoc->GetRowHeight( rPosY, nTabNo ), nPPTY );
- ++rPosY;
- }
- --rPosY;
- }
+ AddPixelsWhile( nScrY, nClickY, rPosY, MAXROW, nPPTY, pDoc, nTabNo );
else
{
+ /* TODO: could need some "SubPixelsWhileBackward" method */
while ( rPosY>0 && nClickY < nScrY )
{
--rPosY;
@@ -1984,20 +1960,24 @@ void ScViewData::SetPosY( ScVSplitPos eWhich, SCROW nNewPosY )
SCROW nOldPosY = pThisTab->nPosY[eWhich];
long nTPosY = pThisTab->nTPosY[eWhich];
long nPixPosY = pThisTab->nPixPosY[eWhich];
- SCROW i;
+ SCROW i, nHeightEndRow;
if ( nNewPosY > nOldPosY )
for ( i=nOldPosY; i<nNewPosY; i++ )
{
- long nThis = pDoc->GetRowHeight( i,nTabNo );
- nTPosY -= nThis;
- nPixPosY -= ToPixel(sal::static_int_cast<USHORT>(nThis), nPPTY);
+ long nThis = pDoc->GetRowHeight( i, nTabNo, NULL, &nHeightEndRow );
+ SCROW nRows = std::min( nNewPosY, nHeightEndRow + 1) - i;
+ i = nHeightEndRow;
+ nTPosY -= nThis * nRows;
+ nPixPosY -= ToPixel(sal::static_int_cast<USHORT>(nThis), nPPTY) * nRows;
}
else
for ( i=nNewPosY; i<nOldPosY; i++ )
{
- long nThis = pDoc->GetRowHeight( i,nTabNo );
- nTPosY += nThis;
- nPixPosY += ToPixel(sal::static_int_cast<USHORT>(nThis), nPPTY);
+ long nThis = pDoc->GetRowHeight( i, nTabNo, NULL, &nHeightEndRow );
+ SCROW nRows = std::min( nOldPosY, nHeightEndRow + 1) - i;
+ i = nHeightEndRow;
+ nTPosY += nThis * nRows;
+ nPixPosY += ToPixel(sal::static_int_cast<USHORT>(nThis), nPPTY) * nRows;
}
pThisTab->nPosY[eWhich] = nNewPosY;
@@ -3118,5 +3098,82 @@ ScAddress ScViewData::GetCurPos() const
}
+// static
+void ScViewData::AddPixelsWhile( long & rScrY, long nEndPixels, SCROW & rPosY,
+ SCROW nEndRow, double nPPTY, const ScDocument * pDoc, SCTAB nTabNo )
+{
+ SCROW nRow = rPosY;
+ while (rScrY <= nEndPixels && nRow <= nEndRow)
+ {
+ SCROW nHeightEndRow;
+ USHORT nHeight = pDoc->GetRowHeight( nRow, nTabNo, NULL, &nHeightEndRow);
+ if (nHeightEndRow > nEndRow)
+ nHeightEndRow = nEndRow;
+ if (!nHeight)
+ nRow = nHeightEndRow + 1;
+ else
+ {
+ SCROW nRows = nHeightEndRow - nRow + 1;
+ sal_Int64 nPixel = ToPixel( nHeight, nPPTY);
+ sal_Int64 nAdd = nPixel * nRows;
+ if (nAdd + rScrY > nEndPixels)
+ {
+ sal_Int64 nDiff = rScrY + nAdd - nEndPixels;
+ nRows -= static_cast<SCROW>(nDiff / nPixel);
+ nAdd = nPixel * nRows;
+ // We're looking for a value that satisfies loop condition.
+ if (nAdd + rScrY <= nEndPixels)
+ {
+ ++nRows;
+ nAdd += nPixel;
+ }
+ }
+ rScrY += static_cast<long>(nAdd);
+ nRow += nRows;
+ }
+ }
+ if (nRow > rPosY)
+ --nRow;
+ rPosY = nRow;
+}
+// static
+void ScViewData::AddPixelsWhileBackward( long & rScrY, long nEndPixels,
+ SCROW & rPosY, SCROW nStartRow, double nPPTY, const ScDocument * pDoc,
+ SCTAB nTabNo )
+{
+ SCROW nRow = rPosY;
+ while (rScrY <= nEndPixels && nRow >= nStartRow)
+ {
+ SCROW nHeightStartRow;
+ USHORT nHeight = pDoc->GetRowHeight( nRow, nTabNo, &nHeightStartRow, NULL);
+ if (nHeightStartRow < nStartRow)
+ nHeightStartRow = nStartRow;
+ if (!nHeight)
+ nRow = nHeightStartRow - 1;
+ else
+ {
+ SCROW nRows = nRow - nHeightStartRow + 1;
+ sal_Int64 nPixel = ToPixel( nHeight, nPPTY);
+ sal_Int64 nAdd = nPixel * nRows;
+ if (nAdd + rScrY > nEndPixels)
+ {
+ sal_Int64 nDiff = nAdd + rScrY - nEndPixels;
+ nRows -= static_cast<SCROW>(nDiff / nPixel);
+ nAdd = nPixel * nRows;
+ // We're looking for a value that satisfies loop condition.
+ if (nAdd + rScrY <= nEndPixels)
+ {
+ ++nRows;
+ nAdd += nPixel;
+ }
+ }
+ rScrY += static_cast<long>(nAdd);
+ nRow -= nRows;
+ }
+ }
+ if (nRow < rPosY)
+ ++nRow;
+ rPosY = nRow;
+}
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 34fbbfdad5b5..a125cbea6f50 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -28,8 +28,6 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sc.hxx"
-
-
// INCLUDE ---------------------------------------------------------------
#include "scitems.hxx"
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index 24fab9ac2eba..3104b7ed8b8f 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -34,10 +34,6 @@
#define _SV_NOXSOUND
-#ifdef WIN
- #define _MENUBTN_HXX
-#endif
-
#define _BASE_DLGS_HXX
#define _BIGINT_HXX
#define _CACHESTR_HXX