Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
99327498
Kaydet (Commit)
99327498
authored
Eki 22, 2013
tarafından
Stephan Bergmann
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Use conventional std::vector idioms
Change-Id: I4d26372ea40e7890b76461a764435f8948466ae1
üst
b7f20ef3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
36 deletions
+44
-36
baside2b.cxx
basctl/source/basicide/baside2b.cxx
+36
-28
BasCodeTagger.cxx
helpcompiler/source/BasCodeTagger.cxx
+5
-5
editsyntaxhighlighter.cxx
svtools/source/edit/editsyntaxhighlighter.cxx
+3
-3
No files found.
basctl/source/basicide/baside2b.cxx
Dosyayı görüntüle @
99327498
...
@@ -17,6 +17,10 @@
...
@@ -17,6 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
*/
#include "sal/config.h"
#include <cassert>
#include "helpid.hrc"
#include "helpid.hrc"
#include "baside2.hrc"
#include "baside2.hrc"
...
@@ -597,17 +601,18 @@ void EditorWindow::HandleAutoCorrect()
...
@@ -597,17 +601,18 @@ void EditorWindow::HandleAutoCorrect()
std
::
vector
<
HighlightPortion
>
aPortions
;
std
::
vector
<
HighlightPortion
>
aPortions
;
aHighlighter
.
getHighlightPortions
(
nLine
,
aLine
,
aPortions
);
aHighlighter
.
getHighlightPortions
(
nLine
,
aLine
,
aPortions
);
if
(
aPortions
.
size
()
==
0
)
if
(
aPortions
.
empty
()
)
return
;
return
;
HighlightPortion
&
r
=
aPortions
[
aPortions
.
size
()
-
1
]
;
HighlightPortion
&
r
=
aPortions
.
back
()
;
if
(
nIndex
!=
aPortions
.
size
()
-
1
)
if
(
nIndex
!=
aPortions
.
size
()
-
1
)
{
//cursor is not standing at the end of the line
{
//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
;
break
;
}
}
}
}
...
@@ -671,14 +676,16 @@ TextSelection EditorWindow::GetLastHighlightPortionTextSelection()
...
@@ -671,14 +676,16 @@ TextSelection EditorWindow::GetLastHighlightPortionTextSelection()
std
::
vector
<
HighlightPortion
>
aPortions
;
std
::
vector
<
HighlightPortion
>
aPortions
;
aHighlighter
.
getHighlightPortions
(
nLine
,
aLine
,
aPortions
);
aHighlighter
.
getHighlightPortions
(
nLine
,
aLine
,
aPortions
);
HighlightPortion
&
r
=
aPortions
[
aPortions
.
size
()
-
1
];
assert
(
!
aPortions
.
empty
());
HighlightPortion
&
r
=
aPortions
.
back
();
if
(
nIndex
!=
aPortions
.
size
()
-
1
)
if
(
nIndex
!=
aPortions
.
size
()
-
1
)
{
//cursor is not standing at the end of the line
{
//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
;
break
;
}
}
}
}
...
@@ -717,10 +724,10 @@ void EditorWindow::HandleAutoCloseDoubleQuotes()
...
@@ -717,10 +724,10 @@ void EditorWindow::HandleAutoCloseDoubleQuotes()
std
::
vector
<
HighlightPortion
>
aPortions
;
std
::
vector
<
HighlightPortion
>
aPortions
;
aHighlighter
.
getHighlightPortions
(
nLine
,
aLine
,
aPortions
);
aHighlighter
.
getHighlightPortions
(
nLine
,
aLine
,
aPortions
);
if
(
aPortions
.
size
()
==
0
)
if
(
aPortions
.
empty
()
)
return
;
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
(
"
\"
"
));
GetEditView
()
->
InsertText
(
OUString
(
"
\"
"
));
//leave the cursor on it's place: inside the two double quotes
//leave the cursor on it's place: inside the two double quotes
...
@@ -738,7 +745,7 @@ void EditorWindow::HandleProcedureCompletion()
...
@@ -738,7 +745,7 @@ void EditorWindow::HandleProcedureCompletion()
std
::
vector
<
HighlightPortion
>
aPortions
;
std
::
vector
<
HighlightPortion
>
aPortions
;
aHighlighter
.
getHighlightPortions
(
nLine
,
aLine
,
aPortions
);
aHighlighter
.
getHighlightPortions
(
nLine
,
aLine
,
aPortions
);
if
(
aPortions
.
size
()
==
0
)
if
(
aPortions
.
empty
()
)
return
;
return
;
OUString
sProcType
;
OUString
sProcType
;
...
@@ -746,18 +753,18 @@ void EditorWindow::HandleProcedureCompletion()
...
@@ -746,18 +753,18 @@ void EditorWindow::HandleProcedureCompletion()
bool
bFoundType
=
false
;
bool
bFoundType
=
false
;
bool
bFoundName
=
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
(
i
->
nBegin
,
i
->
nEnd
-
i
->
nBegin
);
OUString
sTokStr
=
aLine
.
copy
(
r
.
nBegin
,
r
.
nEnd
-
r
.
nBegin
);
if
(
r
.
tokenType
==
9
&&
(
sTokStr
.
equalsIgnoreAsciiCase
(
"sub"
)
if
(
i
->
tokenType
==
9
&&
(
sTokStr
.
equalsIgnoreAsciiCase
(
"sub"
)
||
sTokStr
.
equalsIgnoreAsciiCase
(
"function"
))
)
||
sTokStr
.
equalsIgnoreAsciiCase
(
"function"
))
)
{
{
sProcType
=
sTokStr
;
sProcType
=
sTokStr
;
bFoundType
=
true
;
bFoundType
=
true
;
}
}
if
(
r
.
tokenType
==
1
&&
bFoundType
)
if
(
i
->
tokenType
==
1
&&
bFoundType
)
{
{
sProcName
=
sTokStr
;
sProcName
=
sTokStr
;
bFoundName
=
true
;
bFoundName
=
true
;
...
@@ -790,7 +797,7 @@ void EditorWindow::HandleProcedureCompletion()
...
@@ -790,7 +797,7 @@ void EditorWindow::HandleProcedureCompletion()
if
(
aCurrPortions
.
size
()
>=
3
)
if
(
aCurrPortions
.
size
()
>=
3
)
{
//at least 3 tokens: (sub|function) whitespace idetifier ....
{
//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
);
OUString
sStr
=
aCurrLine
.
copy
(
r
.
nBegin
,
r
.
nEnd
-
r
.
nBegin
);
if
(
r
.
tokenType
==
9
)
if
(
r
.
tokenType
==
9
)
...
@@ -821,18 +828,19 @@ void EditorWindow::HandleCodeCompletion()
...
@@ -821,18 +828,19 @@ void EditorWindow::HandleCodeCompletion()
std
::
vector
<
HighlightPortion
>
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
.
empty
()
)
{
//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
(
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
(
i
->
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
break
;
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
/* an example: Dim aLocVar2 as com.sun.star.beans.PropertyValue
* here, aLocVar2.Name, and PropertyValue's Name field is treated as a keyword(?!)
* 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
if
(
aVect
.
size
()
==
0
)
//nothing to do
...
@@ -1189,11 +1197,11 @@ void EditorWindow::ImpDoHighlight( sal_uLong nLine )
...
@@ -1189,11 +1197,11 @@ void EditorWindow::ImpDoHighlight( sal_uLong nLine )
std
::
vector
<
HighlightPortion
>
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
(
std
::
vector
<
HighlightPortion
>::
iterator
i
(
aPortions
.
begin
());
i
!=
aPortions
.
end
();
++
i
)
{
{
HighlightPortion
&
r
=
aPortions
[
i
];
Color
const
aColor
=
rModulWindow
.
GetLayout
().
GetSyntaxColor
(
i
->
tokenType
);
Color
const
aColor
=
rModulWindow
.
GetLayout
().
GetSyntaxColor
(
r
.
tokenType
);
pEditEngine
->
SetAttrib
(
TextAttribFontColor
(
aColor
),
nLine
,
i
->
nBegin
,
i
->
nEnd
,
true
);
pEditEngine
->
SetAttrib
(
TextAttribFontColor
(
aColor
),
nLine
,
r
.
nBegin
,
r
.
nEnd
,
true
);
}
}
pEditEngine
->
SetModified
(
bWasModified
);
pEditEngine
->
SetModified
(
bWasModified
);
...
...
helpcompiler/source/BasCodeTagger.cxx
Dosyayı görüntüle @
99327498
...
@@ -152,14 +152,14 @@ void BasicCodeTagger::tagParagraph( xmlNodePtr paragraph )
...
@@ -152,14 +152,14 @@ void BasicCodeTagger::tagParagraph( xmlNodePtr paragraph )
m_Highlighter
.
notifyChange
(
0
,
0
,
&
strLine
,
1
);
m_Highlighter
.
notifyChange
(
0
,
0
,
&
strLine
,
1
);
std
::
vector
<
HighlightPortion
>
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
(
std
::
vector
<
HighlightPortion
>::
iterator
i
(
portions
.
begin
());
i
!=
portions
.
end
();
++
i
)
{
{
HighlightPortion
&
r
=
portions
[
i
];
OString
sToken
(
OUStringToOString
(
strLine
.
copy
(
i
->
nBegin
,
i
->
nEnd
-
i
->
nBegin
),
RTL_TEXTENCODING_UTF8
));
OString
sToken
(
OUStringToOString
(
strLine
.
copy
(
r
.
nBegin
,
r
.
nEnd
-
r
.
nBegin
),
RTL_TEXTENCODING_UTF8
));
xmlNodePtr
text
=
xmlNewText
((
const
xmlChar
*
)
sToken
.
getStr
());
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
);
curNode
=
xmlNewTextChild
(
paragraph
,
0
,
(
xmlChar
*
)
"item"
,
0
);
xmlNewProp
(
curNode
,
(
xmlChar
*
)
"type"
,
typeStr
);
xmlNewProp
(
curNode
,
(
xmlChar
*
)
"type"
,
typeStr
);
xmlAddChild
(
curNode
,
text
);
xmlAddChild
(
curNode
,
text
);
...
...
svtools/source/edit/editsyntaxhighlighter.cxx
Dosyayı görüntüle @
99327498
...
@@ -176,10 +176,10 @@ void MultiLineEditSyntaxHighlight::UpdateData()
...
@@ -176,10 +176,10 @@ void MultiLineEditSyntaxHighlight::UpdateData()
GetTextEngine
()
->
RemoveAttribs
(
nLine
,
sal_True
);
GetTextEngine
()
->
RemoveAttribs
(
nLine
,
sal_True
);
std
::
vector
<
HighlightPortion
>
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
(
std
::
vector
<
HighlightPortion
>::
iterator
i
(
aPortions
.
begin
());
i
!=
aPortions
.
end
();
++
i
)
{
{
HighlightPortion
&
r
=
aPortions
[
i
];
GetTextEngine
()
->
SetAttrib
(
TextAttribFontColor
(
GetColorValue
(
i
->
tokenType
)
),
nLine
,
i
->
nBegin
,
i
->
nEnd
,
sal_True
);
GetTextEngine
()
->
SetAttrib
(
TextAttribFontColor
(
GetColorValue
(
r
.
tokenType
)
),
nLine
,
r
.
nBegin
,
r
.
nEnd
,
sal_True
);
}
}
}
}
GetTextView
()
->
ShowCursor
(
false
,
true
);
GetTextView
()
->
ShowCursor
(
false
,
true
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment