summaryrefslogtreecommitdiff
path: root/helpcompiler/source/BasCodeTagger.cxx
diff options
context:
space:
mode:
authorAndras Timar <atimar@suse.com>2013-02-12 22:32:53 +0100
committerAndras Timar <atimar@suse.com>2013-02-13 10:19:21 +0100
commit67b8c0339e90c42dca402a925a624fce67f8ea5c (patch)
treee36a9870897415f5f1f169eb7b4f543ebfc01093 /helpcompiler/source/BasCodeTagger.cxx
parentfb1f3db03df25bee8b17a85e26774e79483de791 (diff)
fdo#41737 syntax highlighting of Basic code examples in offline help
Change-Id: I7dc5b189e98a0351bac0eab28c1161b5893f5ef1
Diffstat (limited to 'helpcompiler/source/BasCodeTagger.cxx')
-rw-r--r--helpcompiler/source/BasCodeTagger.cxx27
1 files changed, 6 insertions, 21 deletions
diff --git a/helpcompiler/source/BasCodeTagger.cxx b/helpcompiler/source/BasCodeTagger.cxx
index 339d96bb1ef6..585291288342 100644
--- a/helpcompiler/source/BasCodeTagger.cxx
+++ b/helpcompiler/source/BasCodeTagger.cxx
@@ -137,15 +137,9 @@ void BasicCodeTagger::tagParagraph( xmlNodePtr paragraph )
}
//3. create new paragraph content
- String strLine(
- OUString(
- reinterpret_cast<const sal_Char*>(codeSnippet),
- strlen(
- reinterpret_cast<const char*>(codeSnippet)
- ),
- RTL_TEXTENCODING_UTF8
- )
- ) ;
+ OUString strLine( reinterpret_cast<const sal_Char*>(codeSnippet),
+ strlen(reinterpret_cast<const char*>(codeSnippet)),
+ RTL_TEXTENCODING_UTF8 );
m_Highlighter.notifyChange ( 0, 0, &strLine, 1 );
HighlightPortions portions;
m_Highlighter.getHighlightPortions( 0, strLine, portions );
@@ -155,7 +149,7 @@ void BasicCodeTagger::tagParagraph( xmlNodePtr paragraph )
for ( size_t i=0; i<portions.size(); i++ )
{
HighlightPortion& r = portions[i];
- subStr = xmlStrsub( codeSnippet, r.nBegin, r.nEnd-r.nBegin );
+ subStr = (xmlChar*) OUStringToOString( strLine.copy( r.nBegin, r.nEnd-r.nBegin ), RTL_TEXTENCODING_UTF8 ).getStr();
text = xmlNewText( subStr );
if ( r.tokenType != TT_WHITESPACE )
{
@@ -185,7 +179,7 @@ void BasicCodeTagger::tagBasicCodes()
{
getBasicCodeContainerNodes();
}
- catch (TaggerException ex)
+ catch (TaggerException &ex)
{
std::cout << "BasCodeTagger error occured. Error code:" << ex << std::endl;
}
@@ -229,7 +223,7 @@ xmlChar* BasicCodeTagger::getTypeString( TokenTypes tokenType )
str = "operator";
break;
case TT_KEYWORDS :
- str = "keywords";
+ str = "keyword";
break;
case TT_PARAMETER :
str = "parameter";
@@ -240,12 +234,3 @@ xmlChar* BasicCodeTagger::getTypeString( TokenTypes tokenType )
}
return xmlCharStrdup( str );
}
-
-//! Saves the current xml DOM to file with the provided libxml2 encoding string in an unformatted way.
-void BasicCodeTagger::saveTreeToFile( const std::string& filePath, const std::string& encoding )
-{
- //saveDocument
- int ret = xmlSaveFormatFileEnc( filePath.c_str(), m_pDocument, encoding.c_str(), 0 );
- if ( ret == -1 )
- throw FILE_WRITING;
-}