[Libreoffice-commits] .: 5 commits - sc/inc sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Mon Dec 20 22:25:36 PST 2010


 sc/inc/segmenttree.hxx                      |    5 -
 sc/source/core/data/dpsave.cxx              |    8 +-
 sc/source/core/data/segmenttree.cxx         |   20 -----
 sc/source/filter/excel/xepivot.cxx          |    2 
 sc/source/filter/xml/XMLExportDataPilot.cxx |    2 
 sc/source/ui/app/scmod.cxx                  |    6 -
 sc/source/ui/dbgui/validate.cxx             |    2 
 sc/source/ui/inc/gridwin.hxx                |    9 --
 sc/source/ui/inc/select.hxx                 |    3 
 sc/source/ui/miscdlgs/conflictsdlg.cxx      |    2 
 sc/source/ui/unoobj/docuno.cxx              |    2 
 sc/source/ui/view/gridwin4.cxx              |   35 ---------
 sc/source/ui/view/select.cxx                |  102 ++++++++++++++++++++++++++--
 13 files changed, 113 insertions(+), 85 deletions(-)

New commits:
commit 1538cb23efced9865d595d28241b47e284dc0520
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Tue Dec 21 01:23:51 2010 -0500

    2 callcatchers

diff --git a/sc/inc/segmenttree.hxx b/sc/inc/segmenttree.hxx
index 986a1e8..88d9c1f 100644
--- a/sc/inc/segmenttree.hxx
+++ b/sc/inc/segmenttree.hxx
@@ -105,12 +105,10 @@ public:
 
     void setTrue(SCCOL nCol1, SCCOL nCol2);
     void setFalse(SCCOL nCol1, SCCOL nCol2);
-    bool getValue(SCCOL nCol);
     bool getRangeData(SCCOL nCol, RangeData& rData);
     void removeSegment(SCCOL nCol1, SCCOL nCol2);
     void insertSegment(SCCOL nCol, SCCOL nSize, bool bSkipStartBoundary);
 
-    void enableTreeSearch(bool bEnable);
     void setInsertFromBack(bool bInsertFromBack);
 
 private:
diff --git a/sc/source/core/data/segmenttree.cxx b/sc/source/core/data/segmenttree.cxx
index 684398f..678363c 100644
--- a/sc/source/core/data/segmenttree.cxx
+++ b/sc/source/core/data/segmenttree.cxx
@@ -430,11 +430,6 @@ void ScFlatBoolColSegments::setFalse(SCCOL nCol1, SCCOL nCol2)
     mpImpl->setFalse(static_cast<SCCOLROW>(nCol1), static_cast<SCCOLROW>(nCol2));
 }
 
-bool ScFlatBoolColSegments::getValue(SCCOL nCol)
-{
-    return mpImpl->getValue(static_cast<SCCOLROW>(nCol));
-}
-
 bool ScFlatBoolColSegments::getRangeData(SCCOL nCol, RangeData& rData)
 {
     ScFlatBoolSegmentsImpl::RangeData aData;
@@ -457,11 +452,6 @@ void ScFlatBoolColSegments::insertSegment(SCCOL nCol, SCCOL nSize, bool bSkipSta
     mpImpl->insertSegment(static_cast<SCCOLROW>(nCol), static_cast<SCCOLROW>(nSize), bSkipStartBoundary);
 }
 
-void ScFlatBoolColSegments::enableTreeSearch(bool bEnable)
-{
-    mpImpl->enableTreeSearch(bEnable);
-}
-
 void ScFlatBoolColSegments::setInsertFromBack(bool bInsertFromBack)
 {
     mpImpl->setInsertFromBack(bInsertFromBack);
commit 0a366506a8089fcdc07051c556e0f297caaa156a
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Tue Dec 21 01:23:25 2010 -0500

    callcatcher ScGridWindow::DrawComboButton

diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index 4bd6ced..9c37369 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -265,19 +265,10 @@ private:
     void			DrawMarkDropObj( SdrObject* pObj );
     SdrObject*		GetEditObject();
     BOOL			IsMyModel(SdrEditView* pSdrView);
-    //void			DrawStartTimer();
 
     void			DrawRedraw( ScOutputData& rOutputData, ScUpdateMode eMode, ULONG nLayer );
     void            DrawSdrGrid( const Rectangle& rDrawingRect, OutputDevice* pContentDev );
-    //BOOL			DrawBeforeScroll();
     void			DrawAfterScroll(/*BOOL bVal*/);
-    //void			DrawMarks();
-    //BOOL			NeedDrawMarks();
-    void 			DrawComboButton( const Point&	rCellPos,
-                                     long			nCellSizeX,
-                                     long			nCellSizeY,
-                                     BOOL           bArrowState,
-                                     BOOL			bBtnIn  = FALSE );
     Rectangle		GetListValButtonRect( const ScAddress& rButtonPos );
 
     void            DrawPagePreview( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, OutputDevice* pContentDev );
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 0253659..2cf4dbb 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1365,41 +1365,6 @@ BOOL ScGridWindow::IsAutoFilterActive( SCCOL nCol, SCROW nRow, SCTAB nTab )
     return ( bSimpleQuery && bColumnFound );
 }
 
-void ScGridWindow::DrawComboButton( const Point&	rCellPos,
-                                    long			nCellSizeX,
-                                    long			nCellSizeY,
-                                    BOOL            bArrowState,
-                                    BOOL			bBtnIn )
-{
-    Point	aScrPos	 = rCellPos;
-    Size	aBtnSize = aComboButton.GetSizePixel();
-
-    if ( nCellSizeX < aBtnSize.Width() || nCellSizeY < aBtnSize.Height() )
-    {
-        if ( nCellSizeX < aBtnSize.Width() )
-            aBtnSize.Width() = nCellSizeX;
-
-        if ( nCellSizeY < aBtnSize.Height() )
-            aBtnSize.Height() = nCellSizeY;
-
-        aComboButton.SetSizePixel( aBtnSize );
-    }
-
-    BOOL bLayoutRTL = pViewData->GetDocument()->IsLayoutRTL( pViewData->GetTabNo() );
-
-    if ( bLayoutRTL )
-        aScrPos.X() -= nCellSizeX - 1;
-    else
-        aScrPos.X() += nCellSizeX - aBtnSize.Width();
-    aScrPos.Y() += nCellSizeY - aBtnSize.Height();
-
-    aComboButton.SetPosPixel( aScrPos );
-
-    HideCursor();
-    aComboButton.Draw( bArrowState, bBtnIn );
-    ShowCursor();
-}
-
 void ScGridWindow::InvertSimple( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2,
                                     BOOL bTestMerge, BOOL bRepeat )
 {
commit 88d5f60b8f85e32d458aecc3062d718cce111918
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Tue Dec 21 01:22:29 2010 -0500

    cppcheck: Some removing of postfix operators

diff --git a/sc/source/core/data/dpsave.cxx b/sc/source/core/data/dpsave.cxx
index e3c6aee..64eea08 100644
--- a/sc/source/core/data/dpsave.cxx
+++ b/sc/source/core/data/dpsave.cxx
@@ -236,7 +236,7 @@ ScDPSaveDimension::ScDPSaveDimension(const ScDPSaveDimension& r) :
             pSubTotalFuncs[nSub] = r.pSubTotalFuncs[nSub];
     }
 
-    for (MemberList::const_iterator i=r.maMemberList.begin(); i != r.maMemberList.end() ; i++)
+    for (MemberList::const_iterator i=r.maMemberList.begin(); i != r.maMemberList.end() ; ++i)
     {
         const String& rName =  (*i)->GetName();
         ScDPSaveMember* pNew = new ScDPSaveMember( **i );
@@ -271,7 +271,7 @@ ScDPSaveDimension::ScDPSaveDimension(const ScDPSaveDimension& r) :
 
 ScDPSaveDimension::~ScDPSaveDimension()
 {
-    for (MemberHash::const_iterator i=maMemberHash.begin(); i != maMemberHash.end() ; i++)
+    for (MemberHash::const_iterator i=maMemberHash.begin(); i != maMemberHash.end() ; ++i)
         delete i->second;
     delete pReferenceValue;
     delete pSortInfo;
@@ -687,7 +687,7 @@ void ScDPSaveDimension::WriteToSource( const uno::Reference<uno::XInterface>& xD
                         if ( !pSortInfo || pSortInfo->Mode == sheet::DataPilotFieldSortMode::MANUAL )
                             nPosition = 0;
 
-                        for (MemberList::const_iterator i=maMemberList.begin(); i != maMemberList.end() ; i++)
+                        for (MemberList::const_iterator i=maMemberList.begin(); i != maMemberList.end() ; ++i)
                         {
                             ScDPSaveMember* pMember = *i;
                             if (!pMember->GetIsVisible())
@@ -1451,7 +1451,7 @@ void ScDPSaveDimension::Refresh( const com::sun::star::uno::Reference<
             if ( pCache->GetIdByItemData( nSrcDim, aMemberName ) == -1 ) 
                 i = maMemberList.erase( i );
             else
-                i++;      
+                ++i;
         }
     }
 }
diff --git a/sc/source/filter/excel/xepivot.cxx b/sc/source/filter/excel/xepivot.cxx
index c7b3d18..84d3c15 100644
--- a/sc/source/filter/excel/xepivot.cxx
+++ b/sc/source/filter/excel/xepivot.cxx
@@ -1131,7 +1131,7 @@ void XclExpPTField::SetPropertiesFromDim( const ScDPSaveDimension& rSaveDim )
 
     // item properties
     const ScDPSaveDimension::MemberList &rMembers = rSaveDim.GetMembers();
-    for (ScDPSaveDimension::MemberList::const_iterator i=rMembers.begin(); i != rMembers.end() ; i++)
+    for (ScDPSaveDimension::MemberList::const_iterator i=rMembers.begin(); i != rMembers.end() ; ++i)
         if( XclExpPTItem* pItem = GetItemAcc( (*i)->GetName() ) )
             pItem->SetPropertiesFromMember( **i );
 }
diff --git a/sc/source/filter/xml/XMLExportDataPilot.cxx b/sc/source/filter/xml/XMLExportDataPilot.cxx
index 6cb026c..f6d3d05 100644
--- a/sc/source/filter/xml/XMLExportDataPilot.cxx
+++ b/sc/source/filter/xml/XMLExportDataPilot.cxx
@@ -479,7 +479,7 @@ void ScXMLExportDataPilot::WriteMembers(ScDPSaveDimension* pDim)
     {
         SvXMLElementExport aElemDPMs(rExport, XML_NAMESPACE_TABLE, XML_DATA_PILOT_MEMBERS, sal_True, sal_True);
         rExport.CheckAttrList();
-        for (ScDPSaveDimension::MemberList::const_iterator i=rMembers.begin(); i != rMembers.end() ; i++)
+        for (ScDPSaveDimension::MemberList::const_iterator i=rMembers.begin(); i != rMembers.end() ; ++i)
         {
             rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_NAME, rtl::OUString((*i)->GetName()));
 
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index 2666bcc..f66832b 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -2263,7 +2263,7 @@ Window *  ScModule::Find1RefWindow( USHORT nSlotId, Window *pWndAncestor )
 
     while( Window *pParent = pWndAncestor->GetParent() ) pWndAncestor = pParent;
 
-    for( std::list<Window*>::iterator i = rlRefWindow.begin(); i!=rlRefWindow.end(); i++ )
+    for( std::list<Window*>::iterator i = rlRefWindow.begin(); i!=rlRefWindow.end(); ++i )
         if ( pWndAncestor->IsWindowOrChild( *i, (*i)->IsSystemWindow() ) )
             return *i;
 
@@ -2278,8 +2278,8 @@ Window *  ScModule::Find1RefWindow( Window *pWndAncestor )
     while( Window *pParent = pWndAncestor->GetParent() ) pWndAncestor = pParent;
 
     for( std::map<USHORT, std::list<Window*> >::iterator i = m_mapRefWindow.begin();
-        i!=m_mapRefWindow.end(); i++ )
-        for( std::list<Window*>::iterator j = i->second.begin(); j!=i->second.end(); j++ )
+        i!=m_mapRefWindow.end(); ++i )
+        for( std::list<Window*>::iterator j = i->second.begin(); j!=i->second.end(); ++j )
             if ( pWndAncestor->IsWindowOrChild( *j, (*j)->IsSystemWindow() ) )
                 return *j;
 
diff --git a/sc/source/ui/dbgui/validate.cxx b/sc/source/ui/dbgui/validate.cxx
index b42987c..be4cca0 100644
--- a/sc/source/ui/dbgui/validate.cxx
+++ b/sc/source/ui/dbgui/validate.cxx
@@ -570,7 +570,7 @@ void ScTPValidationValue::TidyListBoxes()
 
         if ( pWnd )
         {
-            for ( std::list<Window*>::iterator i = alstOrder.begin(); i!=alstOrder.end(); i++ )
+            for ( std::list<Window*>::iterator i = alstOrder.begin(); i!=alstOrder.end(); ++i )
             {
                 Window *pParent = (*i)->GetParent();
                 (*i)->SetParent( pWnd );
diff --git a/sc/source/ui/miscdlgs/conflictsdlg.cxx b/sc/source/ui/miscdlgs/conflictsdlg.cxx
index 4ac66f5..1606d8a 100644
--- a/sc/source/ui/miscdlgs/conflictsdlg.cxx
+++ b/sc/source/ui/miscdlgs/conflictsdlg.cxx
@@ -132,7 +132,7 @@ void ScConflictsListHelper::Transform_Impl( ScChangeActionList& rActionList, ScC
         if ( aItrMap != pMergeMap->end() )
         {
             *aItr = aItrMap->second;
-            aItr++;
+            ++aItr;
         }
         else
         {
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 0bbb068..54fc721 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -1256,7 +1256,7 @@ void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, const uno::Any& aSelec
                 //  external link, use as-is
                 pPDFData->SetLinkURL( aIter->nLinkId, aBookmark );
             }
-            aIter++;
+            ++aIter;
         }
         rBookmarks.clear();
     }
commit 79837b251f1614761ef6faec6b90a7c5a6ae88a2
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Tue Dec 21 01:21:55 2010 -0500

    callcatchers ScFlatBoolRowSegments

diff --git a/sc/inc/segmenttree.hxx b/sc/inc/segmenttree.hxx
index f3f202a..986a1e8 100644
--- a/sc/inc/segmenttree.hxx
+++ b/sc/inc/segmenttree.hxx
@@ -84,9 +84,6 @@ public:
 
     SCROW findLastNotOf(bool bValue) const;
 
-    void enableTreeSearch(bool bEnable);
-    void setInsertFromBack(bool bInsertFromBack);
-
 private:
     ::std::auto_ptr<ScFlatBoolSegmentsImpl> mpImpl;
 };
diff --git a/sc/source/core/data/segmenttree.cxx b/sc/source/core/data/segmenttree.cxx
index b24ba26..684398f 100644
--- a/sc/source/core/data/segmenttree.cxx
+++ b/sc/source/core/data/segmenttree.cxx
@@ -404,16 +404,6 @@ SCROW ScFlatBoolRowSegments::findLastNotOf(bool bValue) const
     return static_cast<SCROW>(mpImpl->findLastNotOf(bValue));
 }
 
-void ScFlatBoolRowSegments::enableTreeSearch(bool bEnable)
-{
-    mpImpl->enableTreeSearch(bEnable);
-}
-
-void ScFlatBoolRowSegments::setInsertFromBack(bool bInsertFromBack)
-{
-    mpImpl->setInsertFromBack(bInsertFromBack);
-}
-
 // ============================================================================
 
 ScFlatBoolColSegments::ScFlatBoolColSegments() :
commit 2bfb1c3ecafb81dd62da1831a78cf88b99fdfe60
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Tue Dec 21 01:09:23 2010 -0500

    Adjust scroll speed based on the position of the mouse cursor.
    
    With this, farther the mouse cursor is from the edge of the window
    the faster the scroll speed becomes.

diff --git a/sc/source/ui/inc/select.hxx b/sc/source/ui/inc/select.hxx
index b920c63..c16bfbd 100644
--- a/sc/source/ui/inc/select.hxx
+++ b/sc/source/ui/inc/select.hxx
@@ -64,6 +64,9 @@ private:
 
     ScSplitPos		GetWhich();
 
+    ULONG           CalcUpdateInterval( const Size& rWinSize, const Point& rEffPos,
+                                        bool bLeftScroll, bool bTopScroll, bool bRightScroll, bool bBottomScroll );
+
 public:
                     ScViewFunctionSet( ScViewData* pNewViewData );
 
diff --git a/sc/source/ui/view/select.cxx b/sc/source/ui/view/select.cxx
index 0063d02..2034b29 100644
--- a/sc/source/ui/view/select.cxx
+++ b/sc/source/ui/view/select.cxx
@@ -35,6 +35,7 @@
 
 #include <tools/urlobj.hxx>
 #include <vcl/sound.hxx>
+#include <vcl/svapp.hxx>
 #include <sfx2/docfile.hxx>
 
 #include "select.hxx"
@@ -46,6 +47,8 @@
 #include "docsh.hxx"
 #include "tabprotection.hxx"
 
+#define SC_SELENG_REFMODE_UPDATE_INTERVAL_MIN 65
+
 extern USHORT nScFillModeMouseModifier;				// global.cxx
 
 using namespace com::sun::star;
@@ -78,6 +81,83 @@ ScSplitPos ScViewFunctionSet::GetWhich()
         return pViewData->GetActivePart();
 }
 
+ULONG ScViewFunctionSet::CalcUpdateInterval( const Size& rWinSize, const Point& rEffPos,
+                                             bool bLeftScroll, bool bTopScroll, bool bRightScroll, bool bBottomScroll )
+{
+    ULONG nUpdateInterval = SELENG_AUTOREPEAT_INTERVAL_MAX;
+    Window* pWin = pEngine->GetWindow();
+    Rectangle aScrRect = pWin->GetDesktopRectPixel();
+    Point aRootPos = pWin->OutputToAbsoluteScreenPixel(Point(0,0));
+    if (bRightScroll)
+    {
+        double nWinRight = rWinSize.getWidth() + aRootPos.getX();
+        double nMarginRight = aScrRect.GetWidth() - nWinRight;
+        double nHOffset = rEffPos.X() - rWinSize.Width();
+        double nHAccelRate = nHOffset / nMarginRight;
+
+        if (nHAccelRate > 1.0)
+            nHAccelRate = 1.0;
+
+        nUpdateInterval = static_cast<ULONG>(SELENG_AUTOREPEAT_INTERVAL_MAX*(1.0 - nHAccelRate));
+    }
+
+    if (bLeftScroll)
+    {
+        double nMarginLeft = aRootPos.getX();
+        double nHOffset = -rEffPos.X();
+        double nHAccelRate = nHOffset / nMarginLeft;
+
+        if (nHAccelRate > 1.0)
+            nHAccelRate = 1.0;
+
+        ULONG nTmp = static_cast<ULONG>(SELENG_AUTOREPEAT_INTERVAL_MAX*(1.0 - nHAccelRate));
+        if (nUpdateInterval > nTmp)
+            nUpdateInterval = nTmp;
+    }
+
+    if (bBottomScroll)
+    {
+        double nWinBottom = rWinSize.getHeight() + aRootPos.getY();
+        double nMarginBottom = aScrRect.GetHeight() - nWinBottom;
+        double nVOffset = rEffPos.Y() - rWinSize.Height();
+        double nVAccelRate = nVOffset / nMarginBottom;
+
+        if (nVAccelRate > 1.0)
+            nVAccelRate = 1.0;
+
+        ULONG nTmp = static_cast<ULONG>(SELENG_AUTOREPEAT_INTERVAL_MAX*(1.0 - nVAccelRate));
+        if (nUpdateInterval > nTmp)
+            nUpdateInterval = nTmp;
+    }
+
+    if (bTopScroll)
+    {
+        double nMarginTop = aRootPos.getY();
+        double nVOffset = -rEffPos.Y();
+        double nVAccelRate = nVOffset / nMarginTop;
+
+        if (nVAccelRate > 1.0)
+            nVAccelRate = 1.0;
+
+        ULONG nTmp = static_cast<ULONG>(SELENG_AUTOREPEAT_INTERVAL_MAX*(1.0 - nVAccelRate));
+        if (nUpdateInterval > nTmp)
+            nUpdateInterval = nTmp;
+    }
+
+#ifdef WNT
+    ScTabViewShell* pViewShell = pViewData->GetViewShell();
+    bool bRefMode = pViewShell && pViewShell->IsRefInputMode();
+    if (bRefMode && nUpdateInterval < SC_SELENG_REFMODE_UPDATE_INTERVAL_MIN)
+        // Lower the update interval during ref mode, because re-draw can be
+        // expensive on Windows.  Making this interval too small would queue up
+        // the scroll/paint requests which would cause semi-infinite
+        // scrolls even after the mouse cursor is released.  We don't have
+        // this problem on Linux.
+        nUpdateInterval = SC_SELENG_REFMODE_UPDATE_INTERVAL_MIN;
+#endif
+    return nUpdateInterval;
+}
+
 void ScViewFunctionSet::SetSelectionEngine( ScViewSelectionEngine* pSelEngine )
 {
     pEngine = pSelEngine;
@@ -255,10 +335,11 @@ BOOL ScViewFunctionSet::SetCursorAtPoint( const Point& rPointPixel, BOOL /* bDon
     //	Scrolling
 
     Size aWinSize = pEngine->GetWindow()->GetOutputSizePixel();
-    BOOL bRightScroll  = ( aEffPos.X() >= aWinSize.Width() );
-    BOOL bBottomScroll = ( aEffPos.Y() >= aWinSize.Height() );
-    BOOL bNegScroll    = ( aEffPos.X() < 0 || aEffPos.Y() < 0 );
-    BOOL bScroll = bRightScroll || bBottomScroll || bNegScroll;
+    bool bRightScroll  = ( aEffPos.X() >= aWinSize.Width() );
+    bool bLeftScroll  = ( aEffPos.X() < 0 );
+    bool bBottomScroll = ( aEffPos.Y() >= aWinSize.Height() );
+    bool bTopScroll = ( aEffPos.Y() < 0 );
+    bool bScroll = bRightScroll || bBottomScroll || bLeftScroll || bTopScroll;
 
     SCsCOL	nPosX;
     SCsROW	nPosY;
@@ -311,6 +392,19 @@ BOOL ScViewFunctionSet::SetCursorAtPoint( const Point& rPointPixel, BOOL /* bDon
             }
     }
 
+    if (bScroll)
+    {
+        // Adjust update interval based on how far the mouse pointer is from the edge.
+        ULONG nUpdateInterval = CalcUpdateInterval(
+            aWinSize, aEffPos, bLeftScroll, bTopScroll, bRightScroll, bBottomScroll);
+        pEngine->SetUpdateInterval(nUpdateInterval);
+    }
+    else
+    {
+        // Don't forget to reset the interval when not scrolling!
+        pEngine->SetUpdateInterval(SELENG_AUTOREPEAT_INTERVAL);
+    }
+
     pViewData->ResetOldCursor();
     return SetCursorAtCell( nPosX, nPosY, bScroll );
 }


More information about the Libreoffice-commits mailing list