basctl/source/basicide/baside2b.cxx | 82 +++++++++-------- comphelper/source/misc/syntaxhighlight.cxx | 28 ++---- helpcompiler/source/BasCodeTagger.cxx | 12 +- include/comphelper/syntaxhighlight.hxx | 21 ++-- svtools/source/edit/editsyntaxhighlighter.cxx | 8 - writerfilter/source/doctok/Dff.cxx | 121 -------------------------- writerfilter/source/doctok/Dff.hxx | 34 ------- 7 files changed, 79 insertions(+), 227 deletions(-)
New commits: commit a4d39c8a2938b7d2b4d4a07e3718c3c1a5fc8df7 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Tue Oct 22 18:13:38 2013 +0200 writerfilter: remove unused DffBlock class in doctok Change-Id: I4b8cd7d7166f100bd718d2bf00ae44d347000f6d diff --git a/writerfilter/source/doctok/Dff.cxx b/writerfilter/source/doctok/Dff.cxx index 202bbd1..a2dd077 100644 --- a/writerfilter/source/doctok/Dff.cxx +++ b/writerfilter/source/doctok/Dff.cxx @@ -323,127 +323,6 @@ Sprm::Kind DffRecord::getKind() return Sprm::UNKNOWN; } -DffBlock::DffBlock(WW8Stream & rStream, sal_uInt32 nOffset, - sal_uInt32 nCount, sal_uInt32 nPadding) -: WW8StructBase(rStream, nOffset, nCount), mnPadding(nPadding) -{ -} - -DffBlock::DffBlock(WW8StructBase * pParent, sal_uInt32 nOffset, - sal_uInt32 nCount, sal_uInt32 nPadding) -: WW8StructBase(pParent, nOffset, nCount), mnPadding(nPadding) -{ -} - -DffBlock::DffBlock(const DffBlock & rSrc) -: WW8StructBase(rSrc), writerfilter::Reference<Properties>(rSrc), - mnPadding(rSrc.mnPadding) -{ -} - -Records_t DffBlock::findRecords(sal_uInt32 nType, bool bRecursive, bool bAny) -{ - Records_t aResult; - - findRecords(nType, aResult, bRecursive, bAny); - - return aResult; -} - -void DffBlock::findRecords -(sal_uInt32 nType, Records_t & rRecords, bool bRecursive, bool bAny) -{ - Records_t::iterator aIt = begin(); - - while (aIt != end()) - { - DffRecord::Pointer_t pPointer(*aIt); - - if (bAny || pPointer->getRecordType() == nType) - rRecords.push_back(pPointer); - - if (bRecursive) - pPointer->findRecords(nType, rRecords, bRecursive, - bAny); - - ++aIt; - } -} - -void DffBlock::resolve(Properties & rHandler) -{ - Records_t::iterator aIt; - - for (aIt = begin(); aIt != end(); ++aIt) - { - DffRecord * pDff = aIt->get(); - rHandler.sprm(*pDff); - } -} - -DffRecord::Pointer_t DffBlock::getShape(sal_uInt32 nSpid) -{ - DffRecord::Pointer_t pResult; - - Records_t aRecords = findRecords(0xf004); - Records_t::iterator aIt; - for (aIt = aRecords.begin(); aIt != aRecords.end(); ++aIt) - { - DffRecord::Pointer_t pPointer = *aIt; - - Records_t aFSPs = pPointer->findRecords(0xf00a); - Records_t::iterator aItFSP = aFSPs.begin(); - - if (aItFSP != aFSPs.end()) - { - DffFSP * pFSP = dynamic_cast<DffFSP *>((*aItFSP).get()); - - if (pFSP->get_shpid() == nSpid) - { - pResult = pPointer; - - break; - } - } - } - - return pResult; -} - -DffRecord::Pointer_t DffBlock::getBlip(sal_uInt32 nBlip) -{ - DffRecord::Pointer_t pResult; - - if (nBlip > 0) - { - nBlip--; - - Records_t aRecords = findRecords(0xf007); - - if (nBlip < aRecords.size()) - { - pResult = aRecords[nBlip]; - } - } - - return pResult; -} - -Records_t::iterator DffBlock::begin() -{ - return mRecords.begin(); -} - -Records_t::iterator DffBlock::end() -{ - return mRecords.end(); -} - -string DffBlock::getType() const -{ - return "DffBlock"; -} - }} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/doctok/Dff.hxx b/writerfilter/source/doctok/Dff.hxx index 3cb66e9..cf78ff7 100644 --- a/writerfilter/source/doctok/Dff.hxx +++ b/writerfilter/source/doctok/Dff.hxx @@ -29,8 +29,6 @@ namespace doctok { using std::vector; -class DffBlock; - class DffRecord : public WW8StructBase, public writerfilter::Reference<Properties>, public Sprm { @@ -92,38 +90,6 @@ public: typedef vector<DffRecord::Pointer_t> Records_t; -class DffBlock : public WW8StructBase, - public writerfilter::Reference<Properties> -{ - sal_uInt32 mnPadding; - - Records_t mRecords; - -public: - typedef boost::shared_ptr<DffBlock> Pointer_t; - - DffBlock(WW8Stream & rStream, sal_uInt32 nOffset, sal_uInt32 nCount, sal_uInt32 nPadding); - DffBlock(WW8StructBase * pParent, sal_uInt32 nOffset, sal_uInt32 nCount, sal_uInt32 nPadding); - DffBlock(const DffBlock & rSrc); - virtual ~DffBlock() {} - - Records_t findRecords(sal_uInt32 nType, bool bRecursive = true, - bool bAny = false); - - void findRecords(sal_uInt32 nType, Records_t & rRecords, - bool bRecursive = true, bool bAny = false); - - DffRecord::Pointer_t getShape(sal_uInt32 nSpid); - DffRecord::Pointer_t getBlip(sal_uInt32 nBlip); - - Records_t::iterator begin(); - Records_t::iterator end(); - - /* Properties methods */ - virtual void resolve(Properties & rHandler); - virtual string getType() const; -}; - }} #endif commit 520a67ccd3f974c66e222b3f5dbc6d343ec90666 Author: Stephan Bergmann <sberg...@redhat.com> Date: Tue Oct 22 18:18:31 2013 +0200 Make violation of "trailing OUString NUL is impl. detail" more obvious Change-Id: I4e91b73dc276f984a4fe324c3a80cb94e8df6ee3 diff --git a/comphelper/source/misc/syntaxhighlight.cxx b/comphelper/source/misc/syntaxhighlight.cxx index 153ec90..83bcb59 100644 --- a/comphelper/source/misc/syntaxhighlight.cxx +++ b/comphelper/source/misc/syntaxhighlight.cxx @@ -270,7 +270,7 @@ sal_Bool SimpleTokenizer_Impl::getNextToken( /*out*/TokenTypes& reType, rpStartPos = mpActualPos; sal_Unicode c = peekChar(); - if( c == CHAR_EOF ) + if( c == 0 ) return sal_False; getChar(); @@ -331,7 +331,7 @@ sal_Bool SimpleTokenizer_Impl::getNextToken( /*out*/TokenTypes& reType, { // Remove all characters until end of line or EOF sal_Unicode cPeek = peekChar(); - while( cPeek != CHAR_EOF && testCharFlags( cPeek, CHAR_EOL ) == sal_False ) + while( cPeek != 0 && testCharFlags( cPeek, CHAR_EOL ) == sal_False ) { c = getChar(); cPeek = peekChar(); @@ -372,7 +372,7 @@ sal_Bool SimpleTokenizer_Impl::getNextToken( /*out*/TokenTypes& reType, if (cPeekNext=='-') { // Remove all characters until end of line or EOF - while( cPeekNext != CHAR_EOF && testCharFlags( cPeekNext, CHAR_EOL ) == sal_False ) + while( cPeekNext != 0 && testCharFlags( cPeekNext, CHAR_EOL ) == sal_False ) { getChar(); cPeekNext = peekChar(); @@ -386,7 +386,7 @@ sal_Bool SimpleTokenizer_Impl::getNextToken( /*out*/TokenTypes& reType, if (cPeekNext=='/') { // Remove all characters until end of line or EOF - while( cPeekNext != CHAR_EOF && testCharFlags( cPeekNext, CHAR_EOL ) == sal_False ) + while( cPeekNext != 0 && testCharFlags( cPeekNext, CHAR_EOL ) == sal_False ) { getChar(); cPeekNext = peekChar(); @@ -403,7 +403,7 @@ sal_Bool SimpleTokenizer_Impl::getNextToken( /*out*/TokenTypes& reType, // Remove all characters until end of line or EOF sal_Unicode cPeek = c; - while( cPeek != CHAR_EOF && testCharFlags( cPeek, CHAR_EOL ) == sal_False ) + while( cPeek != 0 && testCharFlags( cPeek, CHAR_EOL ) == sal_False ) { getChar(); cPeek = peekChar(); @@ -497,7 +497,7 @@ sal_Bool SimpleTokenizer_Impl::getNextToken( /*out*/TokenTypes& reType, while( peekChar() != cEndString ) { // Detect EOF before getChar(), so we do not loose EOF - if( peekChar() == CHAR_EOF ) + if( peekChar() == 0 ) { // ERROR: unterminated string literal reType = TT_ERROR; @@ -540,7 +540,7 @@ sal_Bool SimpleTokenizer_Impl::getNextToken( /*out*/TokenTypes& reType, // All other will remain TT_UNKNOWN // Save end position - rpEndPos = *mpActualPos == CHAR_EOF ? mpActualPos - 1 : mpActualPos; + rpEndPos = *mpActualPos == 0 ? mpActualPos - 1 : mpActualPos; return sal_True; } diff --git a/include/comphelper/syntaxhighlight.hxx b/include/comphelper/syntaxhighlight.hxx index 32790ee..7ad9e2a 100644 --- a/include/comphelper/syntaxhighlight.hxx +++ b/include/comphelper/syntaxhighlight.hxx @@ -71,9 +71,6 @@ struct HighlightPortion { #define CHAR_SPACE 0x0100 #define CHAR_EOL 0x0200 -#define CHAR_EOF 0x00 - - // Language mode of the Highlighter (possibly to be refined later with keyword // lists, C comment flags) enum HighlighterLanguage commit 8e48edad588dbbb79c0857c3d8bbfd7434a40594 Author: Stephan Bergmann <sberg...@redhat.com> Date: Tue Oct 22 18:15:48 2013 +0200 Minor clean-up Change-Id: I48280cf6e12a5219adaa34f57323a93d21c3f554 diff --git a/comphelper/source/misc/syntaxhighlight.cxx b/comphelper/source/misc/syntaxhighlight.cxx index 68d1701..153ec90 100644 --- a/comphelper/source/misc/syntaxhighlight.cxx +++ b/comphelper/source/misc/syntaxhighlight.cxx @@ -676,13 +676,9 @@ void SimpleTokenizer_Impl::getHighlightPortions( sal_uInt32 nParseLine, const OU // Loop over all the tokens while( getNextToken( eType, pStartPos, pEndPos ) ) { - HighlightPortion portion; - - portion.nBegin = pStartPos - mpStringBegin; - portion.nEnd = pEndPos - mpStringBegin; - portion.tokenType = eType; - - portions.push_back(portion); + portions.push_back( + HighlightPortion( + pStartPos - mpStringBegin, pEndPos - mpStringBegin, eType)); } } diff --git a/include/comphelper/syntaxhighlight.hxx b/include/comphelper/syntaxhighlight.hxx index a82986c..32790ee 100644 --- a/include/comphelper/syntaxhighlight.hxx +++ b/include/comphelper/syntaxhighlight.hxx @@ -48,6 +48,11 @@ struct HighlightPortion { sal_Int32 nBegin; sal_Int32 nEnd; TokenTypes tokenType; + + HighlightPortion( + sal_Int32 theBegin, sal_Int32 theEnd, TokenTypes theTokenType): + nBegin(theBegin), nEnd(theEnd), tokenType(theTokenType) + {} }; ///////////////////////////////////////////////////////////////////////// commit 93e652d1faf6584173161f8ba8ab00003280203e Author: Stephan Bergmann <sberg...@redhat.com> Date: Tue Oct 22 18:10:37 2013 +0200 HighlightPortion's indizes into strings should be sal_Int32 (Had to fix type of some variables holding TextPaM::GetIndex() values from sal_uLong to sal_uInt16 to avoid -Werror,-Wsign-compare failures when comparing those against HightlightPortion's nEnd.) Change-Id: Ia8a0ba682ae28e86e394ee48adff3225eb8de053 diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index df405c8..5e23916 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -594,7 +594,7 @@ void EditorWindow::HandleAutoCorrect() { TextSelection aSel = GetEditView()->GetSelection(); sal_uLong nLine = aSel.GetStart().GetPara(); - sal_uLong nIndex = aSel.GetStart().GetIndex(); + sal_uInt16 nIndex = aSel.GetStart().GetIndex(); OUString aLine( pEditEngine->GetText( nLine ) ); // the line being modified const OUString& sActSubName = GetActualSubName( nLine ); // the actual procedure @@ -671,7 +671,7 @@ void EditorWindow::HandleAutoCorrect() TextSelection EditorWindow::GetLastHighlightPortionTextSelection() {//creates a text selection from the highlight portion on the cursor sal_uLong nLine = GetEditView()->GetSelection().GetStart().GetPara(); - sal_uLong nIndex = GetEditView()->GetSelection().GetStart().GetIndex(); + 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 ); diff --git a/comphelper/source/misc/syntaxhighlight.cxx b/comphelper/source/misc/syntaxhighlight.cxx index 63a4b1b..68d1701 100644 --- a/comphelper/source/misc/syntaxhighlight.cxx +++ b/comphelper/source/misc/syntaxhighlight.cxx @@ -678,8 +678,8 @@ void SimpleTokenizer_Impl::getHighlightPortions( sal_uInt32 nParseLine, const OU { HighlightPortion portion; - portion.nBegin = (sal_uInt16)(pStartPos - mpStringBegin); - portion.nEnd = (sal_uInt16)(pEndPos - mpStringBegin); + portion.nBegin = pStartPos - mpStringBegin; + portion.nEnd = pEndPos - mpStringBegin; portion.tokenType = eType; portions.push_back(portion); diff --git a/include/comphelper/syntaxhighlight.hxx b/include/comphelper/syntaxhighlight.hxx index 5161a56..a82986c 100644 --- a/include/comphelper/syntaxhighlight.hxx +++ b/include/comphelper/syntaxhighlight.hxx @@ -44,7 +44,11 @@ enum TokenTypes TT_PARAMETER }; -struct HighlightPortion { sal_uInt16 nBegin; sal_uInt16 nEnd; TokenTypes tokenType; }; +struct HighlightPortion { + sal_Int32 nBegin; + sal_Int32 nEnd; + TokenTypes tokenType; +}; ///////////////////////////////////////////////////////////////////////// // Auxiliary class to support JavaScript modules, next to find functions which commit 99327498541ed25304d5909d29ae2f126d855f23 Author: Stephan Bergmann <sberg...@redhat.com> Date: Tue Oct 22 17:41:32 2013 +0200 Use conventional std::vector idioms Change-Id: I4d26372ea40e7890b76461a764435f8948466ae1 diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index e26312d..df405c8 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include "sal/config.h" + +#include <cassert> + #include "helpid.hrc" #include "baside2.hrc" @@ -597,17 +601,18 @@ void EditorWindow::HandleAutoCorrect() std::vector<HighlightPortion> aPortions; aHighlighter.getHighlightPortions( nLine, aLine, aPortions ); - if( aPortions.size() == 0 ) + if( aPortions.empty() ) return; - HighlightPortion& r = aPortions[aPortions.size()-1]; + HighlightPortion& r = aPortions.back(); if( nIndex != aPortions.size()-1 ) {//cursor is not standing at the end of the line - for( size_t i = 0; i < aPortions.size(); i++ ) + for (std::vector<HighlightPortion>::iterator i(aPortions.begin()); + i != aPortions.end(); ++i) { - if( aPortions[i].nEnd == nIndex ) + if( i->nEnd == nIndex ) { - r = aPortions[i]; + r = *i; break; } } @@ -671,14 +676,16 @@ TextSelection EditorWindow::GetLastHighlightPortionTextSelection() std::vector<HighlightPortion> aPortions; aHighlighter.getHighlightPortions( nLine, aLine, aPortions ); - HighlightPortion& r = aPortions[aPortions.size()-1]; + assert(!aPortions.empty()); + HighlightPortion& r = aPortions.back(); if( nIndex != aPortions.size()-1 ) {//cursor is not standing at the end of the line - for( size_t i = 0; i < aPortions.size(); i++ ) + for (std::vector<HighlightPortion>::iterator i(aPortions.begin()); + i != aPortions.end(); ++i) { - if( aPortions[i].nEnd == nIndex ) + if( i->nEnd == nIndex ) { - r = aPortions[i]; + r = *i; break; } } @@ -717,10 +724,10 @@ void EditorWindow::HandleAutoCloseDoubleQuotes() std::vector<HighlightPortion> aPortions; aHighlighter.getHighlightPortions( nLine, aLine, aPortions ); - if( aPortions.size() == 0 ) + if( aPortions.empty() ) return; - if( aLine.getLength() > 0 && aLine[aLine.getLength()-1] != '"' && (aPortions[aPortions.size()-1].tokenType != TT_STRING) ) + if( aLine.getLength() > 0 && aLine[aLine.getLength()-1] != '"' && (aPortions.back().tokenType != TT_STRING) ) { GetEditView()->InsertText(OUString("\"")); //leave the cursor on it's place: inside the two double quotes @@ -738,7 +745,7 @@ void EditorWindow::HandleProcedureCompletion() std::vector<HighlightPortion> aPortions; aHighlighter.getHighlightPortions( nLine, aLine, aPortions ); - if( aPortions.size() == 0 ) + if( aPortions.empty() ) return; OUString sProcType; @@ -746,18 +753,18 @@ void EditorWindow::HandleProcedureCompletion() bool bFoundType = false; bool bFoundName = false; - for ( size_t i = 0; i < aPortions.size(); i++ ) + for (std::vector<HighlightPortion>::iterator i(aPortions.begin()); + i != aPortions.end(); ++i) { - HighlightPortion& r = aPortions[i]; - OUString sTokStr = aLine.copy(r.nBegin, r.nEnd - r.nBegin); + OUString sTokStr = aLine.copy(i->nBegin, i->nEnd - i->nBegin); - if( r.tokenType == 9 && ( sTokStr.equalsIgnoreAsciiCase("sub") + if( i->tokenType == 9 && ( sTokStr.equalsIgnoreAsciiCase("sub") || sTokStr.equalsIgnoreAsciiCase("function")) ) { sProcType = sTokStr; bFoundType = true; } - if( r.tokenType == 1 && bFoundType ) + if( i->tokenType == 1 && bFoundType ) { sProcName = sTokStr; bFoundName = true; @@ -790,7 +797,7 @@ void EditorWindow::HandleProcedureCompletion() if( aCurrPortions.size() >= 3 ) {//at least 3 tokens: (sub|function) whitespace idetifier .... - HighlightPortion& r = aCurrPortions[0]; + HighlightPortion& r = aCurrPortions.front(); OUString sStr = aCurrLine.copy(r.nBegin, r.nEnd - r.nBegin); if( r.tokenType == 9 ) @@ -821,18 +828,19 @@ void EditorWindow::HandleCodeCompletion() std::vector<HighlightPortion> aPortions; aLine = aLine.copy(0, aSel.GetEnd().GetIndex()); aHighlighter.getHighlightPortions( nLine, aLine, aPortions ); - if( aPortions.size() > 0 ) + if( !aPortions.empty() ) {//use the syntax highlighter to grab out nested reflection calls, eg. aVar.aMethod("aa").aOtherMethod .. - for( std::vector<HighlightPortion>::reverse_iterator aIt = aPortions.rbegin(); aIt != aPortions.rend(); ++aIt ) + for( std::vector<HighlightPortion>::reverse_iterator i( + aPortions.rbegin()); + i != aPortions.rend(); ++i) { - 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( i->tokenType == TT_WHITESPACE ) // a whitespace: stop; if there is no ws, it goes to the beginning of the line break; - if( r.tokenType == TT_IDENTIFIER || r.tokenType == TT_KEYWORDS ) // extract the identifers(methods, base variable) + if( i->tokenType == TT_IDENTIFIER || i->tokenType == TT_KEYWORDS ) // extract the identifers(methods, base variable) /* an example: Dim aLocVar2 as com.sun.star.beans.PropertyValue * here, aLocVar2.Name, and PropertyValue's Name field is treated as a keyword(?!) * */ - aVect.insert( aVect.begin(), aLine.copy(r.nBegin, r.nEnd - r.nBegin) ); + aVect.insert( aVect.begin(), aLine.copy(i->nBegin, i->nEnd - i->nBegin) ); } if( aVect.size() == 0 )//nothing to do @@ -1189,11 +1197,11 @@ void EditorWindow::ImpDoHighlight( sal_uLong nLine ) std::vector<HighlightPortion> aPortions; aHighlighter.getHighlightPortions( nLine, aLine, aPortions ); - for ( size_t i = 0; i < aPortions.size(); i++ ) + for (std::vector<HighlightPortion>::iterator i(aPortions.begin()); + i != aPortions.end(); ++i) { - HighlightPortion& r = aPortions[i]; - Color const aColor = rModulWindow.GetLayout().GetSyntaxColor(r.tokenType); - pEditEngine->SetAttrib( TextAttribFontColor(aColor), nLine, r.nBegin, r.nEnd, true ); + Color const aColor = rModulWindow.GetLayout().GetSyntaxColor(i->tokenType); + pEditEngine->SetAttrib( TextAttribFontColor(aColor), nLine, i->nBegin, i->nEnd, true ); } pEditEngine->SetModified( bWasModified ); diff --git a/helpcompiler/source/BasCodeTagger.cxx b/helpcompiler/source/BasCodeTagger.cxx index 6eaf063..6e698f5 100644 --- a/helpcompiler/source/BasCodeTagger.cxx +++ b/helpcompiler/source/BasCodeTagger.cxx @@ -152,14 +152,14 @@ void BasicCodeTagger::tagParagraph( xmlNodePtr paragraph ) m_Highlighter.notifyChange ( 0, 0, &strLine, 1 ); std::vector<HighlightPortion> portions; m_Highlighter.getHighlightPortions( 0, strLine, portions ); - for ( size_t i=0; i<portions.size(); i++ ) + for (std::vector<HighlightPortion>::iterator i(portions.begin()); + i != portions.end(); ++i) { - HighlightPortion& r = portions[i]; - OString sToken(OUStringToOString(strLine.copy(r.nBegin, r.nEnd-r.nBegin), RTL_TEXTENCODING_UTF8)); + OString sToken(OUStringToOString(strLine.copy(i->nBegin, i->nEnd-i->nBegin), RTL_TEXTENCODING_UTF8)); xmlNodePtr text = xmlNewText((const xmlChar*)sToken.getStr()); - if ( r.tokenType != TT_WHITESPACE ) + if ( i->tokenType != TT_WHITESPACE ) { - xmlChar* typeStr = getTypeString( r.tokenType ); + xmlChar* typeStr = getTypeString( i->tokenType ); curNode = xmlNewTextChild( paragraph, 0, (xmlChar*)"item", 0 ); xmlNewProp( curNode, (xmlChar*)"type", typeStr ); xmlAddChild( curNode, text ); diff --git a/svtools/source/edit/editsyntaxhighlighter.cxx b/svtools/source/edit/editsyntaxhighlighter.cxx index 0d480d2..ba1aca2 100644 --- a/svtools/source/edit/editsyntaxhighlighter.cxx +++ b/svtools/source/edit/editsyntaxhighlighter.cxx @@ -176,10 +176,10 @@ void MultiLineEditSyntaxHighlight::UpdateData() GetTextEngine()->RemoveAttribs( nLine, sal_True ); std::vector<HighlightPortion> aPortions; aHighlighter.getHighlightPortions( nLine, aLine, aPortions ); - for ( size_t i = 0; i < aPortions.size(); i++ ) + for (std::vector<HighlightPortion>::iterator i(aPortions.begin()); + i != aPortions.end(); ++i) { - HighlightPortion& r = aPortions[i]; - GetTextEngine()->SetAttrib( TextAttribFontColor( GetColorValue(r.tokenType) ), nLine, r.nBegin, r.nEnd, sal_True ); + GetTextEngine()->SetAttrib( TextAttribFontColor( GetColorValue(i->tokenType) ), nLine, i->nBegin, i->nEnd, sal_True ); } } GetTextView()->ShowCursor( false, true ); commit b7f20ef33f5a32cc4726db3ff22056850426073e Author: Stephan Bergmann <sberg...@redhat.com> Date: Tue Oct 22 16:48:15 2013 +0200 Unwind HighlightPortions typedef Change-Id: I0ecc15f9bfd557d0a70a05536906a4984a46463c diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index 10ee7b4..e26312d 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -594,7 +594,7 @@ void EditorWindow::HandleAutoCorrect() OUString aLine( pEditEngine->GetText( nLine ) ); // the line being modified const OUString& sActSubName = GetActualSubName( nLine ); // the actual procedure - HighlightPortions aPortions; + std::vector<HighlightPortion> aPortions; aHighlighter.getHighlightPortions( nLine, aLine, aPortions ); if( aPortions.size() == 0 ) @@ -668,7 +668,7 @@ TextSelection EditorWindow::GetLastHighlightPortionTextSelection() sal_uLong nLine = GetEditView()->GetSelection().GetStart().GetPara(); sal_uLong nIndex = GetEditView()->GetSelection().GetStart().GetIndex(); OUString aLine( pEditEngine->GetText( nLine ) ); // the line being modified - HighlightPortions aPortions; + std::vector<HighlightPortion> aPortions; aHighlighter.getHighlightPortions( nLine, aLine, aPortions ); HighlightPortion& r = aPortions[aPortions.size()-1]; @@ -714,7 +714,7 @@ void EditorWindow::HandleAutoCloseDoubleQuotes() sal_uLong nLine = aSel.GetStart().GetPara(); OUString aLine( pEditEngine->GetText( nLine ) ); // the line being modified - HighlightPortions aPortions; + std::vector<HighlightPortion> aPortions; aHighlighter.getHighlightPortions( nLine, aLine, aPortions ); if( aPortions.size() == 0 ) @@ -735,7 +735,7 @@ void EditorWindow::HandleProcedureCompletion() sal_uLong nLine = aSel.GetStart().GetPara(); OUString aLine( pEditEngine->GetText( nLine ) ); - HighlightPortions aPortions; + std::vector<HighlightPortion> aPortions; aHighlighter.getHighlightPortions( nLine, aLine, aPortions ); if( aPortions.size() == 0 ) @@ -785,7 +785,7 @@ void EditorWindow::HandleProcedureCompletion() for( sal_uLong i = nLine+1; i < pEditEngine->GetParagraphCount(); ++i ) {//searching forward for end token, or another sub/function definition OUString aCurrLine = pEditEngine->GetText( i ); - HighlightPortions aCurrPortions; + std::vector<HighlightPortion> aCurrPortions; aHighlighter.getHighlightPortions( i, aCurrLine, aCurrPortions ); if( aCurrPortions.size() >= 3 ) @@ -818,12 +818,12 @@ void EditorWindow::HandleCodeCompletion() OUString aLine( pEditEngine->GetText( nLine ) ); // the line being modified 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()); aHighlighter.getHighlightPortions( nLine, aLine, aPortions ); if( aPortions.size() > 0 ) {//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; 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 ) bool const bWasModified = pEditEngine->IsModified(); pEditEngine->RemoveAttribs( nLine, true ); - HighlightPortions aPortions; + std::vector<HighlightPortion> aPortions; aHighlighter.getHighlightPortions( nLine, aLine, aPortions ); for ( size_t i = 0; i < aPortions.size(); i++ ) diff --git a/comphelper/source/misc/syntaxhighlight.cxx b/comphelper/source/misc/syntaxhighlight.cxx index 82fc060..63a4b1b 100644 --- a/comphelper/source/misc/syntaxhighlight.cxx +++ b/comphelper/source/misc/syntaxhighlight.cxx @@ -659,7 +659,7 @@ sal_uInt16 SimpleTokenizer_Impl::parseLine( sal_uInt32 nParseLine, const OUStrin } 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 mpStringBegin = mpActualPos = rLine.getStr(); @@ -731,7 +731,7 @@ void SyntaxHighlighter::notifyChange( sal_uInt32 nLine, sal_Int32 nLineCountDiff } void SyntaxHighlighter::getHighlightPortions( sal_uInt32 nLine, const OUString& rLine, - /*out*/HighlightPortions& portions ) + /*out*/std::vector<HighlightPortion>& portions ) { m_pSimpleTokenizer->getHighlightPortions( nLine, rLine, portions ); } diff --git a/helpcompiler/source/BasCodeTagger.cxx b/helpcompiler/source/BasCodeTagger.cxx index d394e1a..6eaf063 100644 --- a/helpcompiler/source/BasCodeTagger.cxx +++ b/helpcompiler/source/BasCodeTagger.cxx @@ -150,7 +150,7 @@ void BasicCodeTagger::tagParagraph( xmlNodePtr paragraph ) strlen(reinterpret_cast<const char*>(codeSnippet)), RTL_TEXTENCODING_UTF8 ); m_Highlighter.notifyChange ( 0, 0, &strLine, 1 ); - HighlightPortions portions; + std::vector<HighlightPortion> portions; m_Highlighter.getHighlightPortions( 0, strLine, portions ); for ( size_t i=0; i<portions.size(); i++ ) { diff --git a/include/comphelper/syntaxhighlight.hxx b/include/comphelper/syntaxhighlight.hxx index dfea10f..5161a56 100644 --- a/include/comphelper/syntaxhighlight.hxx +++ b/include/comphelper/syntaxhighlight.hxx @@ -46,9 +46,6 @@ enum TokenTypes 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 // will later will be used for syntax highlighting @@ -108,7 +105,7 @@ public: sal_uInt16 parseLine( sal_uInt32 nLine, const OUString* aSource ); void getHighlightPortions( sal_uInt32 nParseLine, const OUString& rLine, - /*out*/HighlightPortions& portions ); + /*out*/std::vector<HighlightPortion>& portions ); void setKeyWords( const char** ppKeyWords, sal_uInt16 nCount ); }; @@ -140,7 +137,7 @@ public: const OUString* pChangedLines, sal_uInt32 nArrayLength); void getHighlightPortions( sal_uInt32 nLine, const OUString& rLine, - HighlightPortions& pPortions ); + std::vector<HighlightPortion>& pPortions ); HighlighterLanguage GetLanguage() { return eLanguage;} }; diff --git a/svtools/source/edit/editsyntaxhighlighter.cxx b/svtools/source/edit/editsyntaxhighlighter.cxx index d8bde9c..0d480d2 100644 --- a/svtools/source/edit/editsyntaxhighlighter.cxx +++ b/svtools/source/edit/editsyntaxhighlighter.cxx @@ -174,7 +174,7 @@ void MultiLineEditSyntaxHighlight::UpdateData() aHighlighter.notifyChange( nLine, 0, &aLine, 1 ); GetTextEngine()->RemoveAttribs( nLine, sal_True ); - HighlightPortions aPortions; + std::vector<HighlightPortion> aPortions; aHighlighter.getHighlightPortions( nLine, aLine, aPortions ); for ( size_t i = 0; i < aPortions.size(); i++ ) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits