summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2013-10-28 11:38:36 +0100
committerStephan Bergmann <sbergman@redhat.com>2013-10-28 13:48:13 +0100
commitf5e8be8bb1681f0e2494337bc769b33332ef3fff (patch)
tree87c8d679befb417b7691233c5d46d15b951ff61d
parentfdo#68903 Import .tsv and .xls plain text files in Calc by default (diff)
downloadcore-f5e8be8bb1681f0e2494337bc769b33332ef3fff.tar.gz
core-f5e8be8bb1681f0e2494337bc769b33332ef3fff.zip
Remove unused SimpleTokenizer_Impl::nLine/nCol
...which are never read; remove thereby unused parameters from functions. Change-Id: I644d2dc1b2d13ae2f932d04243521eef97e67e3e
-rw-r--r--basctl/source/basicide/baside2b.cxx18
-rw-r--r--comphelper/qa/unit/syntaxhighlighttest.cxx12
-rw-r--r--comphelper/source/misc/syntaxhighlight.cxx28
-rw-r--r--helpcompiler/source/BasCodeTagger.cxx4
-rw-r--r--include/comphelper/syntaxhighlight.hxx16
-rw-r--r--svtools/source/edit/editsyntaxhighlighter.cxx4
6 files changed, 31 insertions, 51 deletions
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index 485d69655b58..0a527604ca1a 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -599,7 +599,7 @@ void EditorWindow::HandleAutoCorrect()
const OUString& sActSubName = GetActualSubName( nLine ); // the actual procedure
std::vector<HighlightPortion> aPortions;
- aHighlighter.getHighlightPortions( nLine, aLine, aPortions );
+ aHighlighter.getHighlightPortions( aLine, aPortions );
if( aPortions.empty() )
return;
@@ -674,7 +674,7 @@ TextSelection EditorWindow::GetLastHighlightPortionTextSelection()
sal_uInt16 nIndex = GetEditView()->GetSelection().GetStart().GetIndex();
OUString aLine( pEditEngine->GetText( nLine ) ); // the line being modified
std::vector<HighlightPortion> aPortions;
- aHighlighter.getHighlightPortions( nLine, aLine, aPortions );
+ aHighlighter.getHighlightPortions( aLine, aPortions );
assert(!aPortions.empty());
HighlightPortion& r = aPortions.back();
@@ -722,7 +722,7 @@ void EditorWindow::HandleAutoCloseDoubleQuotes()
OUString aLine( pEditEngine->GetText( nLine ) ); // the line being modified
std::vector<HighlightPortion> aPortions;
- aHighlighter.getHighlightPortions( nLine, aLine, aPortions );
+ aHighlighter.getHighlightPortions( aLine, aPortions );
if( aPortions.empty() )
return;
@@ -743,7 +743,7 @@ void EditorWindow::HandleProcedureCompletion()
OUString aLine( pEditEngine->GetText( nLine ) );
std::vector<HighlightPortion> aPortions;
- aHighlighter.getHighlightPortions( nLine, aLine, aPortions );
+ aHighlighter.getHighlightPortions( aLine, aPortions );
if( aPortions.empty() )
return;
@@ -793,7 +793,7 @@ void EditorWindow::HandleProcedureCompletion()
{//searching forward for end token, or another sub/function definition
OUString aCurrLine = pEditEngine->GetText( i );
std::vector<HighlightPortion> aCurrPortions;
- aHighlighter.getHighlightPortions( i, aCurrLine, aCurrPortions );
+ aHighlighter.getHighlightPortions( aCurrLine, aCurrPortions );
if( aCurrPortions.size() >= 3 )
{//at least 3 tokens: (sub|function) whitespace idetifier ....
@@ -827,7 +827,7 @@ void EditorWindow::HandleCodeCompletion()
std::vector<HighlightPortion> aPortions;
aLine = aLine.copy(0, aSel.GetEnd().GetIndex());
- aHighlighter.getHighlightPortions( nLine, aLine, aPortions );
+ aHighlighter.getHighlightPortions( aLine, aPortions );
if( !aPortions.empty() )
{//use the syntax highlighter to grab out nested reflection calls, eg. aVar.aMethod("aa").aOtherMethod ..
for( std::vector<HighlightPortion>::reverse_iterator i(
@@ -1190,12 +1190,12 @@ void EditorWindow::ImpDoHighlight( sal_uLong nLine )
if ( bDoSyntaxHighlight )
{
OUString aLine( pEditEngine->GetText( nLine ) );
- aHighlighter.notifyChange( nLine, 0, &aLine, 1 );
+ aHighlighter.notifyChange( &aLine, 1 );
bool const bWasModified = pEditEngine->IsModified();
pEditEngine->RemoveAttribs( nLine, true );
std::vector<HighlightPortion> aPortions;
- aHighlighter.getHighlightPortions( nLine, aLine, aPortions );
+ aHighlighter.getHighlightPortions( aLine, aPortions );
for (std::vector<HighlightPortion>::iterator i(aPortions.begin());
i != aPortions.end(); ++i)
@@ -1332,7 +1332,7 @@ void EditorWindow::ParagraphInsertedDeleted( sal_uLong nPara, bool bInserted )
if ( bDoSyntaxHighlight )
{
OUString aDummy;
- aHighlighter.notifyChange( nPara, bInserted ? 1 : (-1), &aDummy, 1 );
+ aHighlighter.notifyChange( &aDummy, 1 );
}
}
}
diff --git a/comphelper/qa/unit/syntaxhighlighttest.cxx b/comphelper/qa/unit/syntaxhighlighttest.cxx
index 294db3e76fc0..af834a638de0 100644
--- a/comphelper/qa/unit/syntaxhighlighttest.cxx
+++ b/comphelper/qa/unit/syntaxhighlighttest.cxx
@@ -42,7 +42,7 @@ void SyntaxHighlightTest::testBasicString() {
h.initialize(HIGHLIGHT_BASIC);
OUString s("\"foo\"");
std::vector<HighlightPortion> ps;
- h.getHighlightPortions(0, s, ps);
+ h.getHighlightPortions(s, ps);
CPPUNIT_ASSERT_EQUAL(
static_cast<std::vector<HighlightPortion>::size_type>(1), ps.size());
CPPUNIT_ASSERT_EQUAL(0, ps[0].nBegin);
@@ -55,7 +55,7 @@ void SyntaxHighlightTest::testBasicComment() {
h.initialize(HIGHLIGHT_BASIC);
OUString s("' foo");
std::vector<HighlightPortion> ps;
- h.getHighlightPortions(0, s, ps);
+ h.getHighlightPortions(s, ps);
CPPUNIT_ASSERT_EQUAL(
static_cast<std::vector<HighlightPortion>::size_type>(1), ps.size());
CPPUNIT_ASSERT_EQUAL(0, ps[0].nBegin);
@@ -68,7 +68,7 @@ void SyntaxHighlightTest::testBasicCommentNewline() {
h.initialize(HIGHLIGHT_BASIC);
OUString s("' foo\n");
std::vector<HighlightPortion> ps;
- h.getHighlightPortions(0, s, ps);
+ h.getHighlightPortions(s, ps);
CPPUNIT_ASSERT_EQUAL(
static_cast<std::vector<HighlightPortion>::size_type>(2), ps.size());
CPPUNIT_ASSERT_EQUAL(0, ps[0].nBegin);
@@ -84,7 +84,7 @@ void SyntaxHighlightTest::testBasicEmptyComment() {
h.initialize(HIGHLIGHT_BASIC);
OUString s("'");
std::vector<HighlightPortion> ps;
- h.getHighlightPortions(0, s, ps);
+ h.getHighlightPortions(s, ps);
CPPUNIT_ASSERT_EQUAL(
static_cast<std::vector<HighlightPortion>::size_type>(1), ps.size());
CPPUNIT_ASSERT_EQUAL(0, ps[0].nBegin);
@@ -97,7 +97,7 @@ void SyntaxHighlightTest::testBasicEmptyCommentNewline() {
h.initialize(HIGHLIGHT_BASIC);
OUString s("'\n");
std::vector<HighlightPortion> ps;
- h.getHighlightPortions(0, s, ps);
+ h.getHighlightPortions(s, ps);
CPPUNIT_ASSERT_EQUAL(
static_cast<std::vector<HighlightPortion>::size_type>(2), ps.size());
CPPUNIT_ASSERT_EQUAL(0, ps[0].nBegin);
@@ -116,7 +116,7 @@ void SyntaxHighlightTest::testBasic()
aHighlighter.initialize( HIGHLIGHT_BASIC );
std::vector<HighlightPortion> aPortions;
- aHighlighter.getHighlightPortions( 0, aBasicString, aPortions );
+ aHighlighter.getHighlightPortions( aBasicString, aPortions );
sal_Int32 prevEnd = 0;
for(std::vector<HighlightPortion>::const_iterator itr =
diff --git a/comphelper/source/misc/syntaxhighlight.cxx b/comphelper/source/misc/syntaxhighlight.cxx
index ca3207d73387..fd8ee2665c41 100644
--- a/comphelper/source/misc/syntaxhighlight.cxx
+++ b/comphelper/source/misc/syntaxhighlight.cxx
@@ -529,10 +529,6 @@ sal_Bool SimpleTokenizer_Impl::getNextToken( /*out*/TokenTypes& reType,
if( cNext != c && testCharFlags( cNext, CHAR_EOL ) == sal_True )
getChar();
- // Set position data at the line start
- nCol = 0;
- nLine++;
-
reType = TT_EOL;
}
@@ -635,15 +631,11 @@ SimpleTokenizer_Impl* getSimpleTokenizer( void )
return pSimpleTokenizer;
}
-sal_uInt16 SimpleTokenizer_Impl::parseLine( sal_uInt32 nParseLine, const OUString* aSource )
+sal_uInt16 SimpleTokenizer_Impl::parseLine( const OUString* aSource )
{
// Set the position to the beginning of the source string
mpStringBegin = mpActualPos = aSource->getStr();
- // Initialize row and column
- nLine = nParseLine;
- nCol = 0L;
-
// Variables for the out parameter
TokenTypes eType;
const sal_Unicode* pStartPos;
@@ -657,16 +649,12 @@ sal_uInt16 SimpleTokenizer_Impl::parseLine( sal_uInt32 nParseLine, const OUStrin
return nTokenCount;
}
-void SimpleTokenizer_Impl::getHighlightPortions( sal_uInt32 nParseLine, const OUString& rLine,
+void SimpleTokenizer_Impl::getHighlightPortions( const OUString& rLine,
/*out*/std::vector<HighlightPortion>& portions )
{
// Set the position to the beginning of the source string
mpStringBegin = mpActualPos = rLine.getStr();
- // Initialize row and column
- nLine = nParseLine;
- nCol = 0L;
-
// Variables for the out parameter
TokenTypes eType;
const sal_Unicode* pStartPos;
@@ -716,19 +704,17 @@ void SyntaxHighlighter::initialize( HighlighterLanguage eLanguage_ )
}
}
-void SyntaxHighlighter::notifyChange( sal_uInt32 nLine, sal_Int32 nLineCountDifference,
- const OUString* pChangedLines, sal_uInt32 nArrayLength)
+void SyntaxHighlighter::notifyChange(
+ const OUString* pChangedLines, sal_uInt32 nArrayLength)
{
- (void)nLineCountDifference;
-
for( sal_uInt32 i=0 ; i < nArrayLength ; i++ )
- m_pSimpleTokenizer->parseLine(nLine+i, &pChangedLines[i]);
+ m_pSimpleTokenizer->parseLine(&pChangedLines[i]);
}
-void SyntaxHighlighter::getHighlightPortions( sal_uInt32 nLine, const OUString& rLine,
+void SyntaxHighlighter::getHighlightPortions( const OUString& rLine,
/*out*/std::vector<HighlightPortion>& portions )
{
- m_pSimpleTokenizer->getHighlightPortions( nLine, rLine, portions );
+ m_pSimpleTokenizer->getHighlightPortions( rLine, portions );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/helpcompiler/source/BasCodeTagger.cxx b/helpcompiler/source/BasCodeTagger.cxx
index 6e698f504ce2..782bcdc3ec6a 100644
--- a/helpcompiler/source/BasCodeTagger.cxx
+++ b/helpcompiler/source/BasCodeTagger.cxx
@@ -149,9 +149,9 @@ void BasicCodeTagger::tagParagraph( xmlNodePtr paragraph )
OUString strLine( reinterpret_cast<const sal_Char*>(codeSnippet),
strlen(reinterpret_cast<const char*>(codeSnippet)),
RTL_TEXTENCODING_UTF8 );
- m_Highlighter.notifyChange ( 0, 0, &strLine, 1 );
+ m_Highlighter.notifyChange ( &strLine, 1 );
std::vector<HighlightPortion> portions;
- m_Highlighter.getHighlightPortions( 0, strLine, portions );
+ m_Highlighter.getHighlightPortions( strLine, portions );
for (std::vector<HighlightPortion>::iterator i(portions.begin());
i != portions.end(); ++i)
{
diff --git a/include/comphelper/syntaxhighlight.hxx b/include/comphelper/syntaxhighlight.hxx
index dc1631ac6d63..cbeb95ee9c14 100644
--- a/include/comphelper/syntaxhighlight.hxx
+++ b/include/comphelper/syntaxhighlight.hxx
@@ -88,12 +88,8 @@ class SimpleTokenizer_Impl
const sal_Unicode* mpStringBegin;
const sal_Unicode* mpActualPos;
- // Lines and columns
- sal_uInt32 nLine;
- sal_uInt32 nCol;
-
sal_Unicode peekChar( void ) { return *mpActualPos; }
- sal_Unicode getChar( void ) { nCol++; return *mpActualPos++; }
+ sal_Unicode getChar( void ) { return *mpActualPos++; }
// Auxiliary function: testing of the character flags
sal_Bool testCharFlags( sal_Unicode c, sal_uInt16 nTestFlags );
@@ -109,8 +105,8 @@ public:
SimpleTokenizer_Impl( HighlighterLanguage aLang = HIGHLIGHT_BASIC );
~SimpleTokenizer_Impl( void );
- sal_uInt16 parseLine( sal_uInt32 nLine, const OUString* aSource );
- void getHighlightPortions( sal_uInt32 nParseLine, const OUString& rLine,
+ sal_uInt16 parseLine( const OUString* aSource );
+ void getHighlightPortions( const OUString& rLine,
/*out*/std::vector<HighlightPortion>& portions );
void setKeyWords( const char** ppKeyWords, sal_uInt16 nCount );
};
@@ -136,13 +132,11 @@ public:
// (Re-)initialize Highlighter. The line-table will be completely erased,
// meaning that on completion an empty Source is assumed.
- // notifyChange() can only be given line 0
void initialize( HighlighterLanguage eLanguage_ );
- void notifyChange( sal_uInt32 nLine, sal_Int32 nLineCountDifference,
- const OUString* pChangedLines, sal_uInt32 nArrayLength);
+ void notifyChange(const OUString* pChangedLines, sal_uInt32 nArrayLength);
- void getHighlightPortions( sal_uInt32 nLine, const OUString& rLine,
+ void getHighlightPortions( const OUString& rLine,
std::vector<HighlightPortion>& pPortions );
HighlighterLanguage GetLanguage() { return eLanguage;}
diff --git a/svtools/source/edit/editsyntaxhighlighter.cxx b/svtools/source/edit/editsyntaxhighlighter.cxx
index ba1aca286faa..d84fc15e06e0 100644
--- a/svtools/source/edit/editsyntaxhighlighter.cxx
+++ b/svtools/source/edit/editsyntaxhighlighter.cxx
@@ -171,11 +171,11 @@ void MultiLineEditSyntaxHighlight::UpdateData()
for (unsigned int nLine=0; nLine < GetTextEngine()->GetParagraphCount(); nLine++)
{
OUString aLine( GetTextEngine()->GetText( nLine ) );
- aHighlighter.notifyChange( nLine, 0, &aLine, 1 );
+ aHighlighter.notifyChange( &aLine, 1 );
GetTextEngine()->RemoveAttribs( nLine, sal_True );
std::vector<HighlightPortion> aPortions;
- aHighlighter.getHighlightPortions( nLine, aLine, aPortions );
+ aHighlighter.getHighlightPortions( aLine, aPortions );
for (std::vector<HighlightPortion>::iterator i(aPortions.begin());
i != aPortions.end(); ++i)
{