Archiv des LibreOffice- und OpenOffice.org-Wiki

[ÜberSicht] [TitelIndex] [WortIndex] [SeiteFinden

Besondere Lizenzbedingungen für Programmcode

This library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

   1 '*****************************************************************************
   2 ' Writer2MoinMoin
   3 ' Creates a new document that contains the current document in MoinMoin format
   4 '
   5 ' Created: 2004-12-08
   6 ' Last modified: 2011-02-08
   7 '
   8 '*****************************************************************************
   9 ' Copyright (c) 2005 Ian Laurenson, 2005 Klaus Heinisch, 2005 Marc Santhoff,
  10 '               2009 Don Shea, 2011 Joerg Schmidt
  11 '
  12 ' This library is free software: you can redistribute it and/or modify it
  13 ' under the terms of the GNU Lesser General Public License as published by the
  14 ' Free Software Foundation, either version 3 of the License, or (at your
  15 ' option) any later version.
  16 ' This library is distributed in the hope that it will be useful, but WITHOUT
  17 ' ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  18 ' FITNESS FOR A PARTICULAR PURPOSE. See http://www.gnu.org/licenses/lgpl.html
  19 ' for more details.
  20 
  21 '*****************************************************************************
  22 '	Links for Programmers:
  23 '	http://master.moinmo.in/HelpOnMoinWikiSyntax
  24 '
  25 '	- done: "inline:picturename.png" from embedded graphics
  26 '			- dection: graphics anchored at paragraph
  27 '			- dection: graphics anchored at char
  28 '	- done: reworked indentation of simple paragraphs and lists based on indentation
  29 '	- todo: complex tables
  30 '	- todo: remove old code thought for DokuWiki
  31 
  32 '*****************************************************************************
  33 const sBOLDSTART = "'''"
  34 const sBOLDEND = "'''"
  35 const sUNDERSTART = "__"
  36 const sUNDEREND = "__"
  37 const sITALICSTART = "''"
  38 const sITALICEND = "''"
  39 const sMONOSTART = "`"
  40 const sMONOEND = "`"
  41 const sSUPERSTART = "^"
  42 const sSUPEREND = "^"
  43 const sSUBSTART = ",,"
  44 const sSUBEND = ",,"
  45 const sDELSTART = "--("
  46 const sDELEND = ")--"
  47 const sFOOTSTART = "<<FootNote("
  48 const sFOOTEND = ")>>"
  49 const sHEADCHAR = "="
  50 const sHORIZLINE = "----"
  51 const sTABLESEP = "||"
  52 const sTABLEHEADSEP = "||"
  53 const sNEWLINE = "<<BR>>"
  54 const sLITERALSTART = "{{{"
  55 const sLITERALEND = "}}}"
  56 const sORDEREDLIST = "1. "
  57 const sUNORDEREDLIST = "* "
  58 const sHYPERSTART = "[["
  59 const sHYPERSEP = "|"
  60 const sHYPEREND = "]]"
  61 const sPICTURESTART = "{{attachment:"
  62 const sPICTUREEND = "}}"
  63 const sTYPE_PNG = ".png"
  64 const sCODESTART = "{{{"
  65 const sCODEEND = "}}}"
  66 const sBLANK = " "
  67 
  68 const sDEFAULTCODE = "oobas"
  69 
  70 private sLineEnd as string
  71 
  72 private s as string
  73 private oVC
  74 private bInCode as boolean
  75 private mCodes
  76 
  77 ' v.1.6.2
  78 Global ist_ueberschrift
  79 Global last_headLevel
  80 Global hsg
  81 
  82 'This routine processes all html files in a directory tree.
  83 sub Folders
  84 dim mTextFile(0)
  85 
  86 mTextFile(0) = createUnoStruct("com.sun.star.beans.PropertyValue")
  87 mTextFile(0).Name = "FilterName"
  88 mTextFile(0).Value = "Text"
  89 
  90 basicLibraries.loadLibrary("Tools")
  91 'ReadDirectories(ByVal AnchorDir As String, bRecursive as Boolean,  bcheckFileType as Boolean, bGetByTitle as Boolean, Optional sFileContent(), Optional sExtension as String)
  92 mFiles = ReadDirectories("/var/www/html/dokuwiki/data/ref", true,  false, false,,"html")
  93 
  94 'sStart = "file:///var/www/html/dokuwiki/data/"
  95 'nStart = len(sStart) + 1
  96 
  97 for i = 0 to uBound(mfiles)
  98 	sFile = mFiles(i)
  99 	if right(sFile,5) = ".html" then
 100 	oSourceDoc = StarDesktop.loadComponentFromURL(sFile, "_blank", 0, Array())
 101 	oText = oSourceDoc.text
 102 
 103 	oDestDoc = StarDesktop.loadComponentFromURL( "private:factory/swriter", "_blank", 0, Array() )
 104 	oDestText = oDestDoc.getText()
 105 '	oCursor = oDestText.createTextCursor()
 106 	oVC = oDestDoc.currentController.viewCursor
 107 	subMoinMoin(oText)
 108 
 109 '	oVC.text.insertString(oVC.text.end, "[[http://api.openoffice.org/docs/common/" & mid(sFile, nStart) & "]]", false)
 110 	oDestDoc.storeAsUrl(left(sFile,len(sFile)-4) & "txt", mTextFile())
 111 	oDestDoc.close(true)
 112 
 113 	oSourceDoc.close(false)
 114 '	kill sFile	'Uncomment this line to remove the original file
 115 	end if
 116 next
 117 end sub
 118 
 119 
 120 'This is the main routine to run on the currently open document
 121 sub MoinMoin
 122 	globalscope.basiclibraries.loadLibrary("Tools")
 123 	oSourceDoc = thisComponent
 124 	oDestDoc= fnMoinMoin(oSourceDoc)
 125 	'oDestDoc.close(false)
 126 	hsg = 0
 127 end sub
 128 
 129 
 130 function fnMoinMoin(oSourceDoc)
 131 	oText = oSourceDoc.text
 132 	'Create a new document
 133 	oNewDoc = StarDesktop.loadComponentFromURL( "private:factory/swriter", "_blank", 0, Array() )
 134 	oNewText = oNewDoc.getText()
 135 	oCursor = oNewText.createTextCursor()
 136 	'oNewText.insertString(oCursor,sMoinMoin , true)
 137 	oVC = oNewDoc.currentController.viewCursor
 138 	mCodes = array("actionscript", "ada", "apache", "asm", "asp", "bash", "caddcl", "cadlisp", "c_mac", "cpp", "csharp", _
 139 	 "css", "delphi", "html4strict", "javascript", "java", "lisp", "lua", "nsis", "objc", "oobas", "pascal", "perl", _
 140 	 "php-brief", "php", "python", "qbasic", "smarty", "sql", "vbnet", "vb", "visualfoxpro", "xml", "c")
 141 
 142 	subMoinMoin(oText)
 143 
 144 	'Copy to clipboard
 145 	'There is a way of doing this via the API but this will do
 146 	oVC.gotoStart(false)
 147 	oVC.gotoEnd(true)
 148 	oFrame = oNewDoc.CurrentController.Frame
 149 	oDispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
 150 	oDispatcher.executeDispatch(oFrame, ".uno:Copy", "", 0, array())
 151 
 152 
 153 	fnMoinMoin = oNewDoc
 154 end function
 155 
 156 
 157 sub subMoinMoin(oText)
 158 	sLineEnd = chr(13)
 159 
 160 	'If not oDoc.supportsService("com.sun.star.text.TextDocument") then
 161 	'	msgBox "Sorry - I can only create MoinMoin documents out of text documents", 16, "Error"
 162 	'	exit function
 163 	'end if
 164 	s = ""
 165 	oEnum1 = oText.createEnumeration
 166 	' loop over all paragraphs
 167 	while oEnum1.hasMoreElements
 168 		oTextElement = oEnum1.nextElement
 169 
 170 		' [ms, detecting graphics attached to paragraph]
 171 		if oTextElement.supportsService("com.sun.star.text.Paragraph") Then
 172 
 173 			en = oTextElement.createContentEnumeration("com.sun.star.text.TextContent")
 174 			while en.hasMoreElements()
 175 				el = en.nextElement()
 176 				if el.supportsService("com.sun.star.text.TextGraphicObject") then
 177 					if InStr(el.GraphicURL, "file:///") > 0 OR InStr(el.GraphicURL, "http://") > 0 then
 178 						subAddString(sPICTURESTART & FileNameoutofPath(el.GraphicURL) & sPICTUREEND)
 179 					else ' embedded picture, no location known
 180 						subAddString(sPICTURESTART & el.getName() & sTYPE_PNG & sPICTUREEND)
 181 					endif
 182 
 183 				endif
 184 			wend
 185 		' [ms, end]
 186 			subParagraph(oTextElement)
 187 		elseif oTextElement.supportsService("com.sun.star.text.TextTable") Then
 188 			subTable(oTextElement)
 189 		end if
 190 	wend
 191 	if bIncode then
 192 		subAddString(sCODEEND & sLineEnd)
 193 	end if
 194 end sub
 195 
 196 
 197 sub subParagraph(oTextElement)
 198     if oTextElement.NumberingIsNumber then
 199 	    'fix for numbered lists/ headings
 200 	    'On Error Resume Next
 201 	    If oTextElement.NumberingRules.NumberingIsOutline = True Then
 202 	        ist_ueberschrift = 1
 203 	      Else
 204 	        ist_ueberschrift = 0
 205 	    End If
 206 	    nHeadLevel = oTextElement.NumberingLevel + 1
 207     else
 208     	nHeadLevel = 0
 209     end if
 210 
 211     'fix for numbered lists/ headings
 212     If last_headLevel <> 0 AND nHeadLevel = 0 Then
 213       'vorher war noch Nummerierung, jetzt normaler Paragraph
 214         subAddString(sLineEnd)
 215         last_headLevel = nHeadLevel
 216       Else
 217         last_headLevel = nHeadLevel
 218     End If
 219 
 220 	bInlist = false
 221 	sCode = oTextElement.paraStyleName
 222 	sCode = fnInCode(sCode)
 223 	if bIncode and sCode  = "" then
 224 		subAddString(sCODEEND & sLineEnd)
 225 		bInCode = false
 226 	end if
 227 	if nHeadLevel >= 1 and nHeadLevel <= 5 AND ist_ueberschrift = 1 then
 228 		sHead = string(nHeadLevel,  sHEADCHAR)
 229 		If hsg = 0 Then
 230 		    subAddString(sHead & sBLANK & oTextElement.string & sBLANK & sHead & sLineEnd)
 231 		  Else
 232 		    subAddString(sLineEnd & sHead & sBLANK & oTextElement.string & sBLANK & sHead & sLineEnd)
 233 		End If
 234 	elseif sCode <> "" then
 235 		if not bInCode then
 236 			'subAddString(sCODESTART & sCode & sCODEEND & sLineEnd) [ms]
 237 			subAddString(sCODESTART & sLineEnd) ' [ms]
 238 			bInCode = true
 239 		end if
 240 		subAddString(oTextElement.string & sLineEnd)
 241 	else
 242 		'[ms, calculate indent, could be based on global and/or document setting]
 243 		static L1Indent as integer
 244 		static IndentLevel as integer
 245 		static LastIndentLevel as integer
 246 		static firstRun as boolean
 247 		if (	(oTextElement.ParaLeftMargin > 0) _
 248 				AND ( InStr(oTextElement.ParaStyleName,"Index") = 0 ) _
 249 				AND ( InStr(oTextElement.ParaStyleName,"Hanging") = 0 ) _
 250 		   ) then
 251 			' the first found left Margin is indent Level 1 and divisor
 252 			' not precise, but how can this be done better?
 253 			' standard values are: 1251, 2501, ...
 254 			if NOT(Left(oTextElement.ParaStyleName, 8) = "Contents") then
 255 				if NOT(firstRun) then
 256 					firstRun = TRUE
 257 					L1Indent = oTextElement.ParaLeftMargin - 1
 258 					'msgbox "Setting L1Indent to " & L1Indent
 259 				end if
 260 				LastIndentLevel = IndentLevel
 261 				IndentLevel = (oTextElement.ParaLeftMargin - 1) / L1Indent
 262 				'msgbox "IndentLevel is " & IndentLevel
 263 			end if
 264 		else
 265 			IndentLevel = 0
 266 		end if
 267 		sINDENT = String(IndentLevel, sBLANK)
 268 		'[ms, end]
 269 
 270 		if oTextElement.NumberingIsNumber then 'if not isEmpty(oTextElement.NumberingLevel) then
 271 		'	xray.xray oTextElement
 272 			bInlist = true
 273 			'subAddString(string((oTextElement.NumberingLevel + 1) * 2, " ")) ' [ms, indentation]
 274 			subAddString(sBLANK & sINDENT) ' [ms, indentation]
 275 			if instr("0123456789", left(oTextElement.string, 1)) > 0 then
 276 				subAddString(sORDEREDLIST)
 277 			else
 278 				subAddString(sUNORDEREDLIST)
 279 			end if
 280 		' [ms, indentation]
 281 		else
 282 			if (oTextElement.ParaLeftMargin > 0) then subAddString(sINDENT)
 283 		' [ms, end]
 284 		end if
 285 		oEnum2 = oTextElement.createEnumeration
 286 		' loop over all text portions
 287 		while oEnum2.hasMoreElements
 288 			oTextPortion = oEnum2.nextElement
 289 			subAddString(fnTextPortion(oTextPortion, false))
 290 		wend
 291 		subAddString(sLineEnd)
 292 		if oTextElement.bottomBorder.OuterLineWidth > 0 then
 293 			subAddString(sHORIZLINE & sLineEnd)
 294 		else
 295 			if not bInList then subAddString(sLineEnd)
 296 		end if
 297 	end if
 298 end sub
 299 
 300 
 301 sub subTable(oTable)
 302 	mCellnames = oTable.getCellNames
 303 
 304 	nMaxCols = 0
 305 	for i = 0 to uBound(mCellNames)
 306 		sCellName = mCellNames(i)
 307 		nCol = 0
 308 		for j = 1 to len(sCellName)
 309 			ch = mid(sCellName, j, 1)
 310 			select case ch
 311 			case "A" to "Z"
 312 				nCol = nCol * 26 + (asc(ch) - asc("A"))
 313 			case "0" to "9"
 314 				'nRow = val(mid(sCellName, j)) - 1
 315 				exit for
 316 			end select
 317 		next
 318 		if nCol > nMaxCols then nMaxCols = nCol
 319 	next
 320 
 321 	nRows = oTable.rows.count - 1
 322 
 323 	if nMaxCols = 0 then
 324 		for i = 0 to nRows
 325 			oCell = oTable.getCellByPosition(0, i)
 326 			oCellEnum = oCell.createEnumeration
 327 			while oCellEnum.hasMoreElements
 328 				subParagraph(oCellEnum.nextElement)
 329 			wend
 330 		next
 331 		exit sub
 332 	end if
 333 
 334 	dim mCells(nRows, nMaxCols)
 335 
 336 	'for i = 0 to nRows
 337 	'	for j = 0 to nmaxCols - 1
 338 	'		mCells(i, j) = ""
 339 	'	next
 340 	'next
 341 
 342 	for i = 0 to uBound(mCellNames)
 343 		sCellName = mCellNames(i)
 344 		nCol = 0
 345 		for j = 1 to len(sCellName)
 346 			ch = mid(sCellName, j, 1)
 347 			select case ch
 348 			case "A" to "Z"
 349 				nCol = nCol * 26 + (asc(ch) - asc("A"))
 350 			case "0" to "9"
 351 				nRow = val(mid(sCellName, j)) - 1
 352 				exit for
 353 			end select
 354 		next
 355 		oCell = oTable.getCellByName(sCellName)
 356 		sCell = " "
 357 		oCellEnum = oCell.createEnumeration
 358 		while oCellEnum.hasMoreElements
 359 			oTextElement = oCellEnum.nextElement
 360 			if sCell <> " " then
 361 				sCell = sCell & sNEWLINE
 362 			end if
 363 
 364 			if oTextElement.ParaStyleName = "Table Heading" then
 365 				sSep = sTABLEHEADSEP
 366 			else
 367 				sSep = sTABLESEP
 368 			end if
 369 
 370 			if oTextElement.NumberingIsNumber then
 371 				if instr("0123456789", left(oTextElement.string, 1)) > 0 then
 372 					sCell = sCell & str(val(oTextElement.string))
 373 				else
 374 					sCell = sCell & "* "
 375 				end if
 376 			end if
 377 
 378 			oPortionEnum =  oTextElement.createEnumeration
 379 			while oPortionEnum.hasMoreElements
 380 				oTextPortion = oPortionEnum.nextElement
 381 				sCell = sCell & fnTextPortion(oTextPortion, true)
 382 			wend
 383 		wend
 384 		sCell =trim(sCell)
 385 		select case oTextElement.paraAdjust
 386 		case com.sun.star.style.ParagraphAdjust.CENTER
 387 			sCell = "  " & sCell & "  "
 388 		case com.sun.star.style.ParagraphAdjust.RIGHT
 389 			sCell = "  " & sCell
 390 		end select
 391 		mCells(nRow, nCol) = sCell
 392 	next
 393 
 394 	for i = 0 to nRows
 395 		sRow = ""
 396 		sRow = sRow & sTableSep
 397 		bHeading = false
 398 		for j = 0 to nmaxCols
 399 			if mCells(i, j) <> "" then
 400 				if j = 0 and instr(mCells(i, j), chr(10)) = 0 then
 401 					bHeading = true
 402 				else
 403 					bHeading = false
 404 				end if
 405 			end if
 406 			sRow = sRow & mCells(i, j) & sTableSep
 407 		next
 408 		if bHeading then
 409 			if i = 0 then
 410 				sRow = string(6, sHEADCHAR) & mCells(i, 0) & string(6, sHEADCHAR) & sLineEnd & sLineEnd
 411 			else
 412 				sRow = string(5, sHEADCHAR) & mCells(i, 0) & string(5, sHEADCHAR) & sLineEnd & sLineEnd
 413 			end if
 414 		else
 415 			sRow = sRow & sLineEnd
 416 		end if
 417 
 418 		subAddString(sRow)
 419 	next
 420 
 421 	subAddString(sLineEnd)
 422 end sub
 423 
 424 
 425 function fnTextPortion(oTextPortion, bInTable as boolean)
 426 
 427 	if not isNull(oTextPortion.footnote) then
 428 		fnTextPortion = sFOOTStart & oTextPortion.footnote.string & sFOOTEND
 429 	' detect and handle automatically inserted table of contents
 430 	' not so nice: returns empty lines into the target doc, but does not matter
 431 	elseif Left(oTextPortion.ParaStyleName, 8) = "Contents" then
 432 		if oTextPortion.ParaStyleName = "Contents Heading" then
 433 			fnTextPortion = "<<TableOfContents>>"
 434 		else
 435 			fnTextPortion = ""
 436 		endif
 437 	elseif oTextPortion.hyperlinkURL <> "" then
 438 		'NB: If the link has separate text portions (i.e. formats inside it) this will repeat the link :(
 439 		fnTextPortion = sHYPERSTART & fnHyperConvert(oTextPortion.hyperlinkURL) & sHYPERSEP & oTextPortion.string & sHYPEREND
 440 	elseif oTextPortion.TextPortionType = "Frame" then
 441 		'The above condition may need to be tightened
 442 		sName = oTextPortion.createContentEnumeration("com.sun.star.text.TextContent").nextElement.name
 443 		if sName <> "" then
 444 			'fnTextPortion = sBLANK & sPICTURESTART & sName & sPICTUREEND & sBLANK [ms, embedded graphics]
 445 			fnTextPortion = sBLANK & sPICTURESTART & sName & sTYPE_PNG & sPICTUREEND & sBLANK
 446 		end if
 447 	else
 448 		sPortion = oTextPortion.string
 449 		if sPortion = "" then
 450 			fnTextPortion = ""
 451 			exit function
 452 		end if
 453 		if bInTable then
 454 			'In case the separators are actually in the text of the table
 455 			mSplits = split(sPortion, sTABLESEP)
 456 			sPortion = join(mSplits, sLITERALSTART & sTABLESEP & sLITERALEND)
 457 			mSplits = split(sPortion, sTABLEHEADSEP)
 458 			sPortion = join(mSplits, sLITERALSTART & sTABLEHEADSEP & sLITERALEND)
 459 		else
 460 			'In the unlikley event of a paragraph starting and finishing with separator characters.
 461 			sFirstChar = left(sPortion, 1)
 462 			if sFirstChar = sTABLESEP or sFirstChar = sTABLEHEADSEP then
 463 				sPortion = sLITERALSTART & sFirstChar & sLITERALEND & mid(sPortion,2)
 464 			end if
 465 		end if
 466 		'Convert smart quotes
 467 		' [ms, fixed char constants]
 468 		mSplits = split(sPortion, chr(8221))
 469 		sPortion = join(mSplits, chr(34))
 470 		mSplits = split(sPortion, chr(8216))
 471 		sPortion = join(mSplits, chr(39))
 472 		mSplits = split(sPortion, chr(8217))
 473 		sPortion = join(mSplits, chr(39))
 474 		'Convert em dashes
 475 		mSplits = split(sPortion, chr(8211))
 476 		sPortion = join(mSplits, chr(45))
 477 		' [ms, end]
 478 		'In case the text holds any of the formatting charaters make sure that they are treated literally
 479 		mSplits = split(sPortion, sBOLDSTART)
 480 		sPortion = join(mSplits, sLITERALSTART & sBOLDSTART & sLITERALEND)
 481 		mSplits = split(sPortion, sUNDERSTART)
 482 		sPortion = join(mSplits, sLITERALSTART & sUNDERSTART & sLITERALEND)
 483 		mSplits = split(sPortion, sITALICSTART)
 484 		sPortion = join(mSplits, sLITERALSTART & sITALICSTART & sLITERALEND)
 485 		mSplits = split(sPortion, sMONOSTART)
 486 		sPortion = join(mSplits, sLITERALSTART & sMONOSTART & sLITERALEND)
 487 		mSplits = split(sPortion, sSUPERSTART)
 488 		sPortion = join(mSplits, sLITERALSTART & sSUPERSTART & sLITERALEND)
 489 		mSplits = split(sPortion, sSUBSTART)
 490 		sPortion = join(mSplits, sLITERALSTART & sSUBSTART & sLITERALEND)
 491 		mSplits = split(sPortion, sDELSTART)
 492 		sPortion = join(mSplits, sLITERALSTART & sDELSTART & sLITERALEND)
 493 		mSplits = split(sPortion, sFOOTSTART)
 494 		sPortion = join(mSplits, sLITERALSTART & sFOOTSTART & sLITERALEND)
 495 		mSplits = split(sPortion, sPICTURESTART)
 496 		sPortion = join(mSplits, sLITERALSTART & sPICTURESTART & sLITERALEND)
 497 		mSplits = split(sPortion, sCODESTART)
 498 		sPortion = join(mSplits, sLITERALSTART & sCODESTART & sLITERALEND)
 499 		mSplits = split(sPortion, sLineEnd)
 500 		sPortion = join(mSplits, sNEWLINE & " ")
 501 
 502 		'This is not very elegant as it will produce **bold**//**bold & italic**//
 503 		'rather than **bold//bold & italic//**
 504 		if oTextPortion.charWeight > 100 then sPortion = sBOLDSTART & sPortion & sBOLDEND
 505 		if oTextPortion.charPosture > 0 then sPortion = sITALICSTART & sPortion & sITALICEND
 506 		if oTextPortion.charUnderline > 0 then sPortion = sUNDERSTART & sPortion & sUNDEREND
 507 		if oTextPortion.charFontPitch = com.sun.star.awt.FontPitch.FIXED then sPortion = sMONOSTART & sPortion & sMONOEND
 508 		if oTextPortion.charEscapement > 0 then sPortion = sSUPERSTART & sPortion & sSUPEREND
 509 		if oTextPortion.charEscapement < 0 then sPortion = sSUBSTART & sPortion & sSUBEND
 510 		if oTextPortion.charStrikeOut > 0 then sPortion = sDELSTART & sPortion & sDELEND
 511 		fnTextPortion = sPortion
 512 	end if
 513 end function
 514 
 515 
 516 function fnHyperConvert(sURL as string) as string
 517 const sINTLINK = "doku.php?id="
 518 
 519 'sIDL = "vnd.sun.star.help://sbasic/text/sbasic/shared/"
 520 'sGuide = "file:///var/www/html/dokuwiki/DevelopersGuide"
 521 'nIDL = len(sIDL)
 522 'nGuide = len(sGuide)
 523 nStartInternalLink = instr(sUrl, sINTLINK)
 524 	if nStartInternalLink > 0 then
 525 		nStartInternalLink = nStartInternalLink + len(sINTLINK)
 526 		fnHyperConvert = mid(sURL, nStartInternalLink)
 527 	'elseif sIDL = left(sURL, nIDL) then
 528 	'	sTemp = mid(sURL, nIDL + 1)
 529 	'	sTemp = left(stemp,(instr(sTemp, ".xhp")-1))
 530 	'	mSplits = split(sTemp, ".html")
 531 	'	sTemp = join(mSplits, "")
 532 	'	mSplits = split(sTemp, "/")
 533 		fnHyperConvert = sTemp	'join(mSplits, ":")
 534 	'elseif left(sURL, nGuide) = sGuide then
 535 	'	sTemp = "http://api.openoffice.org/docs/DevelopersGuide" & mid(sURL, nGuide + 1)
 536 	'	mSplits = split(sTemp, ".xhtml")
 537 	'	fnHyperConvert = join(mSplits, ".htm")
 538 	else
 539 		fnHyperConvert = sURL
 540 	end if
 541 end function
 542 
 543 
 544 function fnInCode(sParaStyleName)
 545 	' [ms, we don't need this]
 546 	'nCode =  instr(1, sParaStyleName, "Code")
 547 
 548 	'if nCode > 0 then
 549 	'	nCode = nCode + 4
 550 	'	for i = 0 to ubound(mCodes)
 551 	'		if instr(nCode, sParaStyleName, mCodes(i)) > 0 then
 552 	'			fnInCode = mCodes(i)
 553 	'			exit for
 554 	'		end if
 555 	'	next
 556 	'elseif sParaStyleName = "Preformatted Text" then
 557 	' [ms, end]
 558 	if sParaStyleName = "Preformatted Text" then
 559 		fnInCode = sDEFAULTCODE
 560 	' [ms, here we could look for programming languages]
 561 	else
 562 		fnInCode = ""
 563 	end if
 564 end function
 565 
 566 
 567 sub subAddString(sAdd as string)
 568     ' v.1.6.2
 569     If hsg = 0 Then
 570       hsg = 1
 571     End If
 572 
 573 	if sAdd = sLineEnd then	'A paragraph can't be > 64k therefore this hack makes sure of some paragraph breaks
 574 		oVC.text.insertControlCharacter(oVC, com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, False)
 575 	else
 576 		oVC.text.insertString(oVC, sAdd , false)
 577 	end if
 578 end sub
moin162.txt

<!> Die Darstellung auf dieser Seite kann je nach der Schriftgröße, die im Browser eingestellt wurde, unerwünschte Zeilenumbrüche enthalten.


KategorieMakro


LizenzBedingungen | AnbieterKennzeichnung | DatenschutzErklärung | Stand: 2013-04-28