Kaydet (Commit) b7f20ef3 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Unwind HighlightPortions typedef

Change-Id: I0ecc15f9bfd557d0a70a05536906a4984a46463c
üst c9bca105
...@@ -594,7 +594,7 @@ void EditorWindow::HandleAutoCorrect() ...@@ -594,7 +594,7 @@ void EditorWindow::HandleAutoCorrect()
OUString aLine( pEditEngine->GetText( nLine ) ); // the line being modified OUString aLine( pEditEngine->GetText( nLine ) ); // the line being modified
const OUString& sActSubName = GetActualSubName( nLine ); // the actual procedure const OUString& sActSubName = GetActualSubName( nLine ); // the actual procedure
HighlightPortions aPortions; std::vector<HighlightPortion> aPortions;
aHighlighter.getHighlightPortions( nLine, aLine, aPortions ); aHighlighter.getHighlightPortions( nLine, aLine, aPortions );
if( aPortions.size() == 0 ) if( aPortions.size() == 0 )
...@@ -668,7 +668,7 @@ TextSelection EditorWindow::GetLastHighlightPortionTextSelection() ...@@ -668,7 +668,7 @@ TextSelection EditorWindow::GetLastHighlightPortionTextSelection()
sal_uLong nLine = GetEditView()->GetSelection().GetStart().GetPara(); sal_uLong nLine = GetEditView()->GetSelection().GetStart().GetPara();
sal_uLong nIndex = GetEditView()->GetSelection().GetStart().GetIndex(); sal_uLong nIndex = GetEditView()->GetSelection().GetStart().GetIndex();
OUString aLine( pEditEngine->GetText( nLine ) ); // the line being modified OUString aLine( pEditEngine->GetText( nLine ) ); // the line being modified
HighlightPortions aPortions; std::vector<HighlightPortion> aPortions;
aHighlighter.getHighlightPortions( nLine, aLine, aPortions ); aHighlighter.getHighlightPortions( nLine, aLine, aPortions );
HighlightPortion& r = aPortions[aPortions.size()-1]; HighlightPortion& r = aPortions[aPortions.size()-1];
...@@ -714,7 +714,7 @@ void EditorWindow::HandleAutoCloseDoubleQuotes() ...@@ -714,7 +714,7 @@ void EditorWindow::HandleAutoCloseDoubleQuotes()
sal_uLong nLine = aSel.GetStart().GetPara(); sal_uLong nLine = aSel.GetStart().GetPara();
OUString aLine( pEditEngine->GetText( nLine ) ); // the line being modified OUString aLine( pEditEngine->GetText( nLine ) ); // the line being modified
HighlightPortions aPortions; std::vector<HighlightPortion> aPortions;
aHighlighter.getHighlightPortions( nLine, aLine, aPortions ); aHighlighter.getHighlightPortions( nLine, aLine, aPortions );
if( aPortions.size() == 0 ) if( aPortions.size() == 0 )
...@@ -735,7 +735,7 @@ void EditorWindow::HandleProcedureCompletion() ...@@ -735,7 +735,7 @@ void EditorWindow::HandleProcedureCompletion()
sal_uLong nLine = aSel.GetStart().GetPara(); sal_uLong nLine = aSel.GetStart().GetPara();
OUString aLine( pEditEngine->GetText( nLine ) ); OUString aLine( pEditEngine->GetText( nLine ) );
HighlightPortions aPortions; std::vector<HighlightPortion> aPortions;
aHighlighter.getHighlightPortions( nLine, aLine, aPortions ); aHighlighter.getHighlightPortions( nLine, aLine, aPortions );
if( aPortions.size() == 0 ) if( aPortions.size() == 0 )
...@@ -785,7 +785,7 @@ void EditorWindow::HandleProcedureCompletion() ...@@ -785,7 +785,7 @@ void EditorWindow::HandleProcedureCompletion()
for( sal_uLong i = nLine+1; i < pEditEngine->GetParagraphCount(); ++i ) for( sal_uLong i = nLine+1; i < pEditEngine->GetParagraphCount(); ++i )
{//searching forward for end token, or another sub/function definition {//searching forward for end token, or another sub/function definition
OUString aCurrLine = pEditEngine->GetText( i ); OUString aCurrLine = pEditEngine->GetText( i );
HighlightPortions aCurrPortions; std::vector<HighlightPortion> aCurrPortions;
aHighlighter.getHighlightPortions( i, aCurrLine, aCurrPortions ); aHighlighter.getHighlightPortions( i, aCurrLine, aCurrPortions );
if( aCurrPortions.size() >= 3 ) if( aCurrPortions.size() >= 3 )
...@@ -818,12 +818,12 @@ void EditorWindow::HandleCodeCompletion() ...@@ -818,12 +818,12 @@ void EditorWindow::HandleCodeCompletion()
OUString aLine( pEditEngine->GetText( nLine ) ); // the line being modified OUString aLine( pEditEngine->GetText( nLine ) ); // the line being modified
std::vector< OUString > aVect; //vector to hold the base variable+methods for the nested reflection std::vector< OUString > aVect; //vector to hold the base variable+methods for the nested reflection
HighlightPortions aPortions; std::vector<HighlightPortion> aPortions;
aLine = aLine.copy(0, aSel.GetEnd().GetIndex()); aLine = aLine.copy(0, aSel.GetEnd().GetIndex());
aHighlighter.getHighlightPortions( nLine, aLine, aPortions ); aHighlighter.getHighlightPortions( nLine, aLine, aPortions );
if( aPortions.size() > 0 ) if( aPortions.size() > 0 )
{//use the syntax highlighter to grab out nested reflection calls, eg. aVar.aMethod("aa").aOtherMethod .. {//use the syntax highlighter to grab out nested reflection calls, eg. aVar.aMethod("aa").aOtherMethod ..
for( HighlightPortions::reverse_iterator aIt = aPortions.rbegin(); aIt != aPortions.rend(); ++aIt ) for( std::vector<HighlightPortion>::reverse_iterator aIt = aPortions.rbegin(); aIt != aPortions.rend(); ++aIt )
{ {
HighlightPortion r = *aIt; HighlightPortion r = *aIt;
if( r.tokenType == TT_WHITESPACE ) // a whitespace: stop; if there is no ws, it goes to the beginning of the line if( r.tokenType == TT_WHITESPACE ) // a whitespace: stop; if there is no ws, it goes to the beginning of the line
...@@ -1186,7 +1186,7 @@ void EditorWindow::ImpDoHighlight( sal_uLong nLine ) ...@@ -1186,7 +1186,7 @@ void EditorWindow::ImpDoHighlight( sal_uLong nLine )
bool const bWasModified = pEditEngine->IsModified(); bool const bWasModified = pEditEngine->IsModified();
pEditEngine->RemoveAttribs( nLine, true ); pEditEngine->RemoveAttribs( nLine, true );
HighlightPortions aPortions; std::vector<HighlightPortion> aPortions;
aHighlighter.getHighlightPortions( nLine, aLine, aPortions ); aHighlighter.getHighlightPortions( nLine, aLine, aPortions );
for ( size_t i = 0; i < aPortions.size(); i++ ) for ( size_t i = 0; i < aPortions.size(); i++ )
......
...@@ -659,7 +659,7 @@ sal_uInt16 SimpleTokenizer_Impl::parseLine( sal_uInt32 nParseLine, const OUStrin ...@@ -659,7 +659,7 @@ sal_uInt16 SimpleTokenizer_Impl::parseLine( sal_uInt32 nParseLine, const OUStrin
} }
void SimpleTokenizer_Impl::getHighlightPortions( sal_uInt32 nParseLine, const OUString& rLine, void SimpleTokenizer_Impl::getHighlightPortions( sal_uInt32 nParseLine, const OUString& rLine,
/*out*/HighlightPortions& portions ) /*out*/std::vector<HighlightPortion>& portions )
{ {
// Set the position to the beginning of the source string // Set the position to the beginning of the source string
mpStringBegin = mpActualPos = rLine.getStr(); mpStringBegin = mpActualPos = rLine.getStr();
...@@ -731,7 +731,7 @@ void SyntaxHighlighter::notifyChange( sal_uInt32 nLine, sal_Int32 nLineCountDiff ...@@ -731,7 +731,7 @@ void SyntaxHighlighter::notifyChange( sal_uInt32 nLine, sal_Int32 nLineCountDiff
} }
void SyntaxHighlighter::getHighlightPortions( sal_uInt32 nLine, const OUString& rLine, void SyntaxHighlighter::getHighlightPortions( sal_uInt32 nLine, const OUString& rLine,
/*out*/HighlightPortions& portions ) /*out*/std::vector<HighlightPortion>& portions )
{ {
m_pSimpleTokenizer->getHighlightPortions( nLine, rLine, portions ); m_pSimpleTokenizer->getHighlightPortions( nLine, rLine, portions );
} }
......
...@@ -150,7 +150,7 @@ void BasicCodeTagger::tagParagraph( xmlNodePtr paragraph ) ...@@ -150,7 +150,7 @@ void BasicCodeTagger::tagParagraph( xmlNodePtr paragraph )
strlen(reinterpret_cast<const char*>(codeSnippet)), strlen(reinterpret_cast<const char*>(codeSnippet)),
RTL_TEXTENCODING_UTF8 ); RTL_TEXTENCODING_UTF8 );
m_Highlighter.notifyChange ( 0, 0, &strLine, 1 ); m_Highlighter.notifyChange ( 0, 0, &strLine, 1 );
HighlightPortions portions; std::vector<HighlightPortion> portions;
m_Highlighter.getHighlightPortions( 0, strLine, portions ); m_Highlighter.getHighlightPortions( 0, strLine, portions );
for ( size_t i=0; i<portions.size(); i++ ) for ( size_t i=0; i<portions.size(); i++ )
{ {
......
...@@ -46,9 +46,6 @@ enum TokenTypes ...@@ -46,9 +46,6 @@ enum TokenTypes
struct HighlightPortion { sal_uInt16 nBegin; sal_uInt16 nEnd; TokenTypes tokenType; }; struct HighlightPortion { sal_uInt16 nBegin; sal_uInt16 nEnd; TokenTypes tokenType; };
typedef std::vector<HighlightPortion> HighlightPortions;
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// Auxiliary class to support JavaScript modules, next to find functions which // Auxiliary class to support JavaScript modules, next to find functions which
// will later will be used for syntax highlighting // will later will be used for syntax highlighting
...@@ -108,7 +105,7 @@ public: ...@@ -108,7 +105,7 @@ public:
sal_uInt16 parseLine( sal_uInt32 nLine, const OUString* aSource ); sal_uInt16 parseLine( sal_uInt32 nLine, const OUString* aSource );
void getHighlightPortions( sal_uInt32 nParseLine, const OUString& rLine, void getHighlightPortions( sal_uInt32 nParseLine, const OUString& rLine,
/*out*/HighlightPortions& portions ); /*out*/std::vector<HighlightPortion>& portions );
void setKeyWords( const char** ppKeyWords, sal_uInt16 nCount ); void setKeyWords( const char** ppKeyWords, sal_uInt16 nCount );
}; };
...@@ -140,7 +137,7 @@ public: ...@@ -140,7 +137,7 @@ public:
const OUString* pChangedLines, sal_uInt32 nArrayLength); const OUString* pChangedLines, sal_uInt32 nArrayLength);
void getHighlightPortions( sal_uInt32 nLine, const OUString& rLine, void getHighlightPortions( sal_uInt32 nLine, const OUString& rLine,
HighlightPortions& pPortions ); std::vector<HighlightPortion>& pPortions );
HighlighterLanguage GetLanguage() { return eLanguage;} HighlighterLanguage GetLanguage() { return eLanguage;}
}; };
......
...@@ -174,7 +174,7 @@ void MultiLineEditSyntaxHighlight::UpdateData() ...@@ -174,7 +174,7 @@ void MultiLineEditSyntaxHighlight::UpdateData()
aHighlighter.notifyChange( nLine, 0, &aLine, 1 ); aHighlighter.notifyChange( nLine, 0, &aLine, 1 );
GetTextEngine()->RemoveAttribs( nLine, sal_True ); GetTextEngine()->RemoveAttribs( nLine, sal_True );
HighlightPortions aPortions; std::vector<HighlightPortion> aPortions;
aHighlighter.getHighlightPortions( nLine, aLine, aPortions ); aHighlighter.getHighlightPortions( nLine, aLine, aPortions );
for ( size_t i = 0; i < aPortions.size(); i++ ) for ( size_t i = 0; i < aPortions.size(); i++ )
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment