summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2012-03-11 20:50:15 +0200
committerMichael Stahl <mstahl@redhat.com>2012-03-13 23:19:54 +0100
commitaa998adbe3f7132998ba5aff438b540ff18a10bb (patch)
tree46bea42040e16ec1a4f6785ca718e6d175552350 /sw/source
parent64cba6e58263e906aba6a110937f362d1e31ebe5 (diff)
Convert tools/table.hxx to std::set in SwSrcEditWindow in SW module
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/ui/docvw/srcedtw.cxx23
-rw-r--r--sw/source/ui/inc/srcedtw.hxx7
2 files changed, 13 insertions, 17 deletions
diff --git a/sw/source/ui/docvw/srcedtw.cxx b/sw/source/ui/docvw/srcedtw.cxx
index 9bd534ca484b..2ffd91801bb3 100644
--- a/sw/source/ui/docvw/srcedtw.cxx
+++ b/sw/source/ui/docvw/srcedtw.cxx
@@ -595,7 +595,6 @@ IMPL_LINK( SwSrcEditWindow, SyntaxTimerHdl, Timer *, pTimer )
SAL_WARN_IF(pTextView == 0, "sw", "No View yet, but syntax highlighting?!");
bHighlighting = sal_True;
- sal_uInt16 nLine;
sal_uInt16 nCount = 0;
// at first the region around the cursor is processed
TextSelection aSel = pTextView->GetSelection();
@@ -604,16 +603,15 @@ IMPL_LINK( SwSrcEditWindow, SyntaxTimerHdl, Timer *, pTimer )
nCur -= 40;
else
nCur = 0;
- if(aSyntaxLineTable.Count())
+ if(!aSyntaxLineTable.empty())
for(sal_uInt16 i = 0; i < 80 && nCount < 40; i++, nCur++)
{
- void * p = aSyntaxLineTable.Get(nCur);
- if(p)
+ if(aSyntaxLineTable.find(nCur) != aSyntaxLineTable.end())
{
DoSyntaxHighlight( nCur );
- aSyntaxLineTable.Remove( nCur );
+ aSyntaxLineTable.erase( nCur );
nCount++;
- if(!aSyntaxLineTable.Count())
+ if(aSyntaxLineTable.empty())
break;
if((Time( Time::SYSTEM ).GetTime() - aSyntaxCheckStart.GetTime()) > MAX_HIGHLIGHTTIME )
{
@@ -624,14 +622,11 @@ IMPL_LINK( SwSrcEditWindow, SyntaxTimerHdl, Timer *, pTimer )
}
// when there is still anything left by then, go on from the beginning
- void* p = aSyntaxLineTable.First();
- while ( p && nCount < MAX_SYNTAX_HIGHLIGHT)
+ while ( !aSyntaxLineTable.empty() && nCount < MAX_SYNTAX_HIGHLIGHT)
{
- nLine = (sal_uInt16)aSyntaxLineTable.GetCurKey();
+ sal_uInt16 nLine = *aSyntaxLineTable.begin();
DoSyntaxHighlight( nLine );
- sal_uInt16 nCurKey = (sal_uInt16)aSyntaxLineTable.GetCurKey();
- p = aSyntaxLineTable.Next();
- aSyntaxLineTable.Remove(nCurKey);
+ aSyntaxLineTable.erase(nLine);
nCount ++;
if(Time( Time::SYSTEM ).GetTime() - aSyntaxCheckStart.GetTime() > MAX_HIGHLIGHTTIME)
{
@@ -640,7 +635,7 @@ IMPL_LINK( SwSrcEditWindow, SyntaxTimerHdl, Timer *, pTimer )
}
}
- if(aSyntaxLineTable.Count() && !pTimer->IsActive())
+ if(!aSyntaxLineTable.empty() && !pTimer->IsActive())
pTimer->Start();
// SyntaxTimerHdl is called when text changed
// => good opportunity to determine text width!
@@ -681,7 +676,7 @@ void SwSrcEditWindow::DoDelayedSyntaxHighlight( sal_uInt16 nPara )
{
if ( !bHighlighting && bDoSyntaxHighlight )
{
- aSyntaxLineTable.Insert( nPara, (void*)(sal_uInt16)1 );
+ aSyntaxLineTable.insert( nPara );
aSyntaxIdleTimer.Start();
}
}
diff --git a/sw/source/ui/inc/srcedtw.hxx b/sw/source/ui/inc/srcedtw.hxx
index 3439b19478ba..8f4a443deaf6 100644
--- a/sw/source/ui/inc/srcedtw.hxx
+++ b/sw/source/ui/inc/srcedtw.hxx
@@ -32,8 +32,8 @@
#include <svl/lstner.hxx>
#include <vcl/timer.hxx>
-#include <tools/table.hxx>
#include <svtools/xtextedt.hxx>
+#include <set>
namespace com { namespace sun { namespace star { namespace beans {
class XMultiPropertySet;
@@ -68,12 +68,13 @@ public:
};
//------------------------------------------------------------
+typedef std::set<sal_uInt16> SyntaxLineSet;
+
class SwSrcEditWindow : public Window, public SfxListener
{
private:
class ChangesListener;
friend class ChangesListener;
-
ExtTextView* pTextView;
ExtTextEngine* pTextEngine;
@@ -96,7 +97,7 @@ private:
sal_Bool bHighlighting;
Timer aSyntaxIdleTimer;
- Table aSyntaxLineTable;
+ SyntaxLineSet aSyntaxLineTable;
void ImpDoHighlight( const String& rSource, sal_uInt16 nLineOff );