/usr/lib/libreoffice/share/extensions/DmathsAddon/CmathOOo/mCopy2Spip.xba is in libreoffice-dmaths 3.4+dfsg1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 | <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="mCopy2Spip" script:language="StarBasic">' +-------------------------------------------------------------------------+
' | This source file is part of MaXOpenInfo.com and MaXForms.com projects |
' | |
' +-------------------------------------------------------------------------+
' | Copyright © 2003-2004 - Robert DARGAUD - BOBICIEL. All rights reserved. |
' +-------------------------------------------------------------------------+
' | This source file 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 2.1 of the License, or (at your option) any later version. |
' | |
' | This source file 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. |
' | http://www.opensource.org/licenses/lgpl-license.php |
' | |
' | You should have received a copy of the GNU General Public License |
' | along with this source file; if not, write to the Free Software |
' | Foundation Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
' +-------------------------------------------------------------------------+
' | Author: Robert DARGAUD <rdargaud@bobiciel.com> |
' +-------------------------------------------------------------------------+
' | Download new version : www.maxopeninfo.com / www.maxopeninfo.org |
' +-------------------------------------------------------------------------+
' | WikiWiki adaptation Author |
' | |
' | www.spip.net : Robert DARGAUD - BOBICIEL - July 2004 |
' | www.wikipedia.org : ............................................ |
' | www.wikini.net : ............................................ |
' | your WikiWikiWeb : ............................................ |
' | your WikiWikiWeb : ............................................ |
' | your WikiWikiWeb : ............................................ |
' | your WikiWikiWeb : ............................................ |
' | your WikiWikiWeb : ............................................ |
' | |
' +-------------------------------------------------------------------------+
' | AddOn OpenOffice.org / Sun StarOffice |
' +-------------------------------------------------------------------------+
' | History : |
' +-------------------------------------------------------------------------+
' | beta 0.1 : 2004/08/02 |
' | beta 0.2 : 2004/08/09 correction pour OOo 1.1.1 dont le "with" semble |
' | bogué ! (merci à Luc et Stéphane pour ce retour) |
' | beta 0.3 : 2004/08/10 correction de la détection BOLD/ITALIC/UNDERLINE |
' | beta 0.4 : 2004/08/10 support noms de style de paragraphe de la forme |
' | WikiWikiName_xxxxxxx ex: spip_code ==> <code>bla bla</code> |
' | beta 0.5 : 2004/08/10 support de TextFrame (<cadre> </cadre> pour Spip) |
' | beta 0.6 : 2004/09/06 eol pour MS Windows et Linux/Unix (merci Tony) |
' | beta 0.7 : 2004/09/06 modif des débuts et fin de paragraphes suite aux |
' | tests de Tony. |
' | novembre 2005 : code modifé par C. Devalland pour repérer les formules |
' | mathématiques | |
' +-------------------------------------------------------------------------+
REM ***** BASIC *****
option explicit
'*********************************************************************************
private SpipName as string
private SpipUrl as string
' text frame
private TextOnStartOfTextFrame as string
private TextOnEndOfTextFrame as string
' text section
private TextOnStartOfTextSection as string
private TextOnEndOfTextSection as string
' paragraph
private TextOnStartOfNormalParagraph as string
private TextOnEndOfNormalParagraph as string
' quotation paragraph
private TextOnStartOfQuotationParagraph as string
private TextOnEndOfQuotationParagraph as string
' paragraph title
private TextOnStartOfTitle1Paragraph as string
private TextOnEndOfTitle1Paragraph as string
private TextOnStartOfTitle2Paragraph as string
private TextOnEndOfTitle2Paragraph as string
private TextOnStartOfTitle3Paragraph as string
private TextOnEndOfTitle3Paragraph as string
private TextOnStartOfTitle4Paragraph as string
private TextOnEndOfTitle4Paragraph as string
private TextOnStartOfTitle5Paragraph as string
private TextOnEndOfTitle5Paragraph as string
' paragraph bullet list
private TextOnStartOfBulletList1Paragraph as string
private TextOnEndOfBulletList1Paragraph as string
private TextOnStartOfBulletList2Paragraph as string
private TextOnEndOfBulletList2Paragraph as string
private TextOnStartOfBulletList3Paragraph as string
private TextOnEndOfBulletList3Paragraph as string
private TextOnStartOfBulletList4Paragraph as string
private TextOnEndOfBulletList4Paragraph as string
private TextOnStartOfBulletList5Paragraph as string
private TextOnEndOfBulletList5Paragraph as string
' paragraph numbered list
private TextOnStartOfNumberedList1Paragraph as string
private TextOnEndOfNumberedList1Paragraph as string
private TextOnStartOfNumberedList2Paragraph as string
private TextOnEndOfNumberedList2Paragraph as string
private TextOnStartOfNumberedList3Paragraph as string
private TextOnEndOfNumberedList3Paragraph as string
private TextOnStartOfNumberedList4Paragraph as string
private TextOnEndOfNumberedList4Paragraph as string
private TextOnStartOfNumberedList5Paragraph as string
private TextOnEndOfNumberedList5Paragraph as string
' table
private TextOnStartOfTextTable as string
private TextOnEndOfTextTable as string
private TextOnStartOfRow as string
private TextOnEndOfRow as string
private TextOnStartOfCell as string
private TextOnEmptyCell as string
private TextOnEndOfCell as string
' embeded object
private TextOnStartOfTextEmbeddedObject as string
private TextOnEndOfTextEmbeddedObject as string
' ajouté par C. Devalland
' formula object
private TextOnStartOfFormulaEmbeddedObject as string
private TextOnEndOfFormulaEmbeddedObject as string
' text portion
private TextOnStartOfNormalTextPortion as string
private TextOnEndOfNormalTextPortion as string
private TextOnStartOfBoldTextPortion as string
private TextOnEndOfBoldTextPortion as string
private TextOnStartOfItalicTextPortion as string
private TextOnEndOfItalicTextPortion as string
private TextOnStartOfUnderlineTextPortion as string
private TextOnEndOfUnderlineTextPortion as string
' link
private TextFormatOfInternalLinkTextPortion as string
private TextFormatOfExternalLinkTextPortion as string
' text field
private TextOnStartOfTextField as string
private TextOnEndOfTextField as string
' foot note, control character, index, bookmark, redline
private TextOnStartOfFootnote as string
private TextOnEndOfFootnote as string
private TextOnStartOfControlCharacter as string
private TextOnEndOfControlCharacter as string
private TextOnStartOfReferenceMark as string
private TextOnEndOfReferenceMark as string
private TextOnStartOfDocumentIndexMark as string
private TextOnEndOfDocumentIndexMark as string
private TextOnStartOfBookmark as string
private TextOnEndOfBookmark as string
private TextOnStartOfRedline as string
private TextOnEndOfRedline as string
private TextOnStartOfRuby as string
private TextOnEndOfRuby as string
' graphic object (image)
private TextOnStartOfTextGraphicObject as string
private TextOnEndOfTextGraphicObject as string
' drawing shape
private TextOnStartOfTextShape as string
private TextOnEndOfTextShape as string
private TextOnStartOfDrawingShape as string
private TextOnEndOfDrawingShape as string
' form control
private TextOnStartOfFormControl as string
private TextOnEndOfFormControl as string
' -----------------------------
private sSpipText as string
' *********************************************************************************
sub InitSpip
static initOk as boolean
dim eol as string
if initOk then
exit sub
end if
' <en> end of line
' <fr> caractères de fin de ligne en fonction du sytème d'exploitation
' if getGUIType() = 1 then
' eol = chr(13) + chr(10) 'testé sur MS Win2000
' else
eol = chr(10) ' pour Linux et Apple Mac OSX
' end if
' ------------------------------- www.spip.net -------------------------------
SpipName = "spip"
SpipUrl = "http://www.spip.net"
' text frame
TextOnStartOfTextFrame = eol & "<cadre>"
TextOnEndOfTextFrame = "</cadre>" & eol
' text section
TextOnStartOfTextSection = ""
TextOnEndOfTextSection = ""
' paragraph
TextOnStartOfNormalParagraph = eol
TextOnEndOfNormalParagraph = eol
' quotation paragraph
TextOnStartOfQuotationParagraph = eol & "<quote>"
TextOnEndOfQuotationParagraph = "</quote>" & eol
' paragraph title
TextOnStartOfTitle1Paragraph = eol & "{{{"
TextOnEndOfTitle1Paragraph = "}}}" & eol
TextOnStartOfTitle2Paragraph = eol & "{{{"
TextOnEndOfTitle2Paragraph = "}}}" & eol
TextOnStartOfTitle3Paragraph = eol & "{{"
TextOnEndOfTitle3Paragraph = "}}" & eol
TextOnStartOfTitle4Paragraph = eol & "{ {{"
TextOnEndOfTitle4Paragraph = "}} }" & eol & eol
TextOnStartOfTitle5Paragraph = eol & "{ {{"
TextOnEndOfTitle5Paragraph = "}} }" & eol
' paragraph bullet list
TextOnStartOfBulletList1Paragraph = "- "
TextOnEndOfBulletList1Paragraph = eol
TextOnStartOfBulletList2Paragraph = "-* "
TextOnEndOfBulletList2Paragraph = eol
TextOnStartOfBulletList3Paragraph = "-** "
TextOnEndOfBulletList3Paragraph = eol
TextOnStartOfBulletList4Paragraph = "-*** "
TextOnEndOfBulletList4Paragraph = eol
TextOnStartOfBulletList5Paragraph = "-**** "
TextOnEndOfBulletList5Paragraph = eol
' paragraph numbered list
TextOnStartOfNumberedList1Paragraph = "-# "
TextOnEndOfNumberedList1Paragraph = eol
TextOnStartOfNumberedList2Paragraph = "-## "
TextOnEndOfNumberedList2Paragraph = eol
TextOnStartOfNumberedList3Paragraph = "-### "
TextOnEndOfNumberedList3Paragraph = eol
TextOnStartOfNumberedList4Paragraph = "-#### "
TextOnEndOfNumberedList4Paragraph = eol
TextOnStartOfNumberedList5Paragraph = "-##### "
TextOnEndOfNumberedList5Paragraph = eol
' table
TextOnStartOfTextTable = eol
TextOnEndOfTextTable = eol
TextOnStartOfRow = "|"
TextOnEndOfRow = eol
TextOnStartOfCell = ""
TextOnEmptyCell = " "
TextOnEndOfCell = "|"
' embeded object
TextOnStartOfTextEmbeddedObject = ""
TextOnEndOfTextEmbeddedObject = ""
'ajouté par C. Devalland
TextOnStartOfFormulaEmbeddedObject = "<math>"
TextOnEndOfFormulaEmbeddedObject = "</math>"
' text portion
TextOnStartOfNormalTextPortion = ""
TextOnEndOfNormalTextPortion = ""
TextOnStartOfBoldTextPortion = "{{"
TextOnEndOfBoldTextPortion = "}}"
TextOnStartOfItalicTextPortion = "{ "
TextOnEndOfItalicTextPortion = " }"
TextOnStartOfUnderlineTextPortion = ""
TextOnEndOfUnderlineTextPortion = ""
' link
TextFormatOfInternalLinkTextPortion = ""
TextFormatOfExternalLinkTextPortion = "[$string->$url]"
' text field
TextOnStartOfTextField = ""
TextOnEndOfTextField = ""
' foot note, control character, index, bookmark, redline
TextOnStartOfFootnote = ""
TextOnEndOfFootnote = ""
TextOnStartOfControlCharacter = ""
TextOnEndOfControlCharacter = ""
TextOnStartOfReferenceMark = ""
TextOnEndOfReferenceMark = ""
TextOnStartOfDocumentIndexMark = ""
TextOnEndOfDocumentIndexMark = ""
TextOnStartOfBookmark = ""
TextOnEndOfBookmark = ""
TextOnStartOfRedline = ""
TextOnEndOfRedline = ""
TextOnStartOfRuby = ""
TextOnEndOfRuby = ""
' graphic object (image)
TextOnStartOfTextGraphicObject = "" ' RMQ: (définir format ?) <img000|center>
TextOnEndOfTextGraphicObject = ""
' drawing shape
TextOnStartOfTextShape = ""
TextOnEndOfTextShape = ""
TextOnStartOfDrawingShape = ""
TextOnEndOfDrawingShape = ""
' form control
TextOnStartOfFormControl = ""
TextOnEndOfFormControl = ""
initOk = true
end sub
'<fr> l'énumération commence
sub onStartOfEnumeration(oTheComponent as object)
with oTheComponent
InitSpip
end with
end sub
'<fr> l'objet énuméré est un paragraphe
sub onStartOfParagraph(oTheParagraph as object)
dim a
with oTheParagraph
a=-1
if left(.ParaStyleName,7)="Heading" then a=oTheParagraph.NumberingLevel 'ParaChapterNumberingLevel ne marche plus avec OOo3.1
' if not isempty(.Cell) then (ok avec OOo 1.1.2)
if not isempty(oTheParagraph.Cell) then
' dgjlkg
'<fr> l'intérieur d'un tableau
elseif (a >= 0) then
select case .NumberingLevel
case 0
sSpipText = sSpipText & TextOnStartOfTitle1Paragraph
case 1
sSpipText = sSpipText & TextOnStartOfTitle2Paragraph
case 2
sSpipText = sSpipText & TextOnStartOfTitle3Paragraph
case 3
sSpipText = sSpipText & TextOnStartOfTitle4Paragraph
case else
sSpipText = sSpipText & TextOnStartOfTitle5Paragraph
end select
elseif isListParagraph(oTheParagraph) then
if (BulletChar(oTheParagraph) <> "") then
select case .NumberingLevel
case 0
sSpipText = sSpipText & TextOnStartOfBulletList1Paragraph
case 1
sSpipText = sSpipText & TextOnStartOfBulletList2Paragraph
case 2
sSpipText = sSpipText & TextOnStartOfBulletList3Paragraph
case 3
sSpipText = sSpipText & TextOnStartOfBulletList4Paragraph
case else
sSpipText = sSpipText & TextOnStartOfBulletList5Paragraph
end select
else
select case .NumberingLevel
case 0
sSpipText = sSpipText & TextOnStartOfNumberedList1Paragraph
case 1
sSpipText = sSpipText & TextOnStartOfNumberedList2Paragraph
case 2
sSpipText = sSpipText & TextOnStartOfNumberedList3Paragraph
case 3
sSpipText = sSpipText & TextOnStartOfNumberedList4Paragraph
case else
sSpipText = sSpipText & TextOnStartOfNumberedList5Paragraph
end select
end if
' .NumberingStyleName
' print .NumberingStartValue
' print isempty(.NumberingRules)
' print .NumberingStyleName
' print .ParaIsNumberingRestart
' <fr> Style de paragraphe "Citation"
elseif (lcase(oTheParagraph.ParaStyleName) = "quotations") then
sSpipText = sSpipText & TextOnStartOfQuotationParagraph
' <fr> si le style du paragraphe est de la forme : wikiName_xxxxxxxx (exemple : spip_code on génère : <code>contenu du paragraphe</code> )
elseif (left(lcase(oTheParagraph.ParaStyleName), len(SpipName)+1) = (SpipName & "_")) then
sSpipText = sSpipText & TextOnStartOfNormalParagraph & "<" & mid(lcase(oTheParagraph.ParaStyleName), len(SpipName)+2) & ">"
' <fr> paragraphe normal
else
sSpipText = sSpipText & TextOnStartOfNormalParagraph
end if
end with
end sub
sub onEndOfParagraph(oTheParagraph as object)
with oTheParagraph
' RMQ: oTheParagraph.Cell pour remédier à ce qui semble être un bug dans le OOoBasic de la 1.1.1,
' qui semble être corrigé dans la 1.1.2 et qui "rebogue" avec la 2.0 !!!???!!!
' if not isempty(.Cell) then (ok avec OOo 1.1.2)
if not isempty(oTheParagraph.Cell) then
'<fr> l'intérieur d'un tableau
elseif (left(.ParaStyleName,7)="Heading") then '.ParaChapterNumberingLevel>=0 bug
select case .NumberingLevel 'ParaChapterNumberingLevel
case 0
sSpipText = sSpipText & TextOnEndOfTitle1Paragraph
case 1
sSpipText = sSpipText & TextOnEndOfTitle2Paragraph
case 2
sSpipText = sSpipText & TextOnEndOfTitle3Paragraph
case 3
sSpipText = sSpipText & TextOnEndOfTitle4Paragraph
case else
sSpipText = sSpipText & TextOnEndOfTitle5Paragraph
end select
elseif isListParagraph(oTheParagraph) then
if (BulletChar(oTheParagraph) <> "") then
select case .NumberingLevel
case 0
sSpipText = sSpipText & TextOnEndOfBulletList1Paragraph
case 1
sSpipText = sSpipText & TextOnEndOfBulletList2Paragraph
case 2
sSpipText = sSpipText & TextOnEndOfBulletList3Paragraph
case 3
sSpipText = sSpipText & TextOnEndOfBulletList4Paragraph
case else
sSpipText = sSpipText & TextOnEndOfBulletList5Paragraph
end select
else
select case .NumberingLevel
case 0
sSpipText = sSpipText & TextOnEndOfNumberedList1Paragraph
case 1
sSpipText = sSpipText & TextOnEndOfNumberedList2Paragraph
case 2
sSpipText = sSpipText & TextOnEndOfNumberedList3Paragraph
case 3
sSpipText = sSpipText & TextOnEndOfNumberedList4Paragraph
case else
sSpipText = sSpipText & TextOnEndOfNumberedList5Paragraph
end select
end if
' <fr> Style de paragraphe "Citation"
' elseif (lcase(.ParaStyleName) = "quotations") then ' (ok avec OOo 1.1.2)
elseif (lcase(oTheParagraph.ParaStyleName) = "quotations") then
sSpipText = sSpipText & TextOnEndOfQuotationParagraph
' <fr> si le style du paragraphe est de la forme : wikiName_xxxxxxxx (exemple : spip_code on génère : <code>contenu du paragraphe</code> )
elseif (left(lcase(oTheParagraph.ParaStyleName), len(SpipName)+1) = (SpipName & "_")) then
sSpipText = sSpipText & "</" & mid(lcase(oTheParagraph.ParaStyleName), len(SpipName)+2) & ">" & TextOnEndOfNormalParagraph
' <fr> paragraphe normal
else
sSpipText = sSpipText & TextOnEndOfNormalParagraph
end if
end with
end sub
'<fr> l'objet énuméré est un tableau
sub onStartOfTextTable(oTheTextTable as object)
with oTheTextTable
sSpipText = sSpipText & TextOnStartOfTextTable
end with
end sub
sub onEndOfTextTable(oTheTextTable as object)
with oTheTextTable
sSpipText = sSpipText & TextOnEndOfTextTable
end with
end sub
'<fr> l'objet énuméré est une ligne de tableau
sub onStartOfRow(oTheRow as object, iTheIndex as integer)
with oTheRow
sSpipText = sSpipText & TextOnStartOfRow
end with
end sub
sub onEndOfRow(oTheRow as object, iTheIndex as integer)
with oTheRow
sSpipText = sSpipText & TextOnEndOfRow
end with
end sub
'<fr> l'objet énuméré est une cellule de tableau
sub onStartOfCell(oTheCell as object, iTheIndex as integer)
with oTheCell
' Xray.Xray oTheCell
' .CellName;
'<fr> la cellule est vide
' if (.String = "") then
sSpipText = sSpipText & TextOnStartOfCell '& TextOnEmptyCell
'<fr> on désactive l'énumération
' DisableEnumeration
' end if
end with
end sub
sub onEndOfCell(oTheCell as object, iTheIndex as integer)
with oTheCell
sSpipText = sSpipText & TextOnEndOfCell
end with
end sub
'<fr> l'objet énuméré est une section
sub onStartOfTextSection(oTheTextSection as object)
with oTheTextSection
sSpipText = sSpipText & TextOnStartOfTextSection
end with
end sub
sub onEndOfTextSection(oTheTextSection as object)
with oTheTextSection
sSpipText = sSpipText & TextOnEndOfTextSection
end with
end sub
'<fr> l'objet énuméré est un cadre de texte
sub onStartOfTextFrame(oTheTextFrame as object)
with oTheTextFrame
sSpipText = sSpipText & TextOnStartOfTextFrame
end with
end sub
sub onEndOfTextFrame(oTheTextFrame as object)
with oTheTextFrame
sSpipText = sSpipText & TextOnEndOfTextFrame
end with
end sub
'<fr> l'objet énuméré est un objet incrusté (rmq 'embedded' revoir la traduction)
' ajouté par C. Devalland pour tenir compte des formules mathématiques
sub onFormulaEmbeddedObject(oTheTextEmbeddedObject as object)
with oTheTextEmbeddedObject
sSpipText = sSpipText & TextOnStartOfFormulaEmbeddedObject & sFormuleOOo2TeX(oTheTextEmbeddedObject.embeddedobject) & TextOnEndOfFormulaEmbeddedObject
end with
end sub
'<fr> l'objet énuméré est un objet incrusté (rmq 'embedded' revoir la traduction)
sub onStartOfTextEmbeddedObject(oTheTextEmbeddedObject as object)
with oTheTextEmbeddedObject
sSpipText = sSpipText & TextOnStartOfTextEmbeddedObject & TheTextEmbeddedObject.embeddedobject.formula
end with
end sub
sub onEndOfTextEmbeddedObject(oTheTextEmbeddedObject as object)
with oTheTextEmbeddedObject
sSpipText = sSpipText & TextOnEndOfTextEmbeddedObject
end with
end sub
'<fr> l'objet énuméré est une portion de texte
function NormalTextPortion(sTheText as string) as string
NormalTextPortion = TextOnStartOfNormalTextPortion & sTheText & TextOnEndOfNormalTextPortion
end function
function BoldTextPortion(sTheText as string) as string
BoldTextPortion = TextOnStartOfBoldTextPortion & sTheText & TextOnEndOfBoldTextPortion
end function
function UnderlineTextPortion(sTheText as string) as string
UnderlineTextPortion = TextOnStartOfUnderlineTextPortion & sTheText & TextOnEndOfUnderlineTextPortion
end function
function ItalicTextPortion(sTheText as string) as string
ItalicTextPortion = TextOnStartOfItalicTextPortion & sTheText & TextOnEndOfItalicTextPortion
end function
sub onTextPortion(oTheTextPortion as object)
dim s as string
dim isNormalTextPortion as boolean
with oTheTextPortion
'<fr> c'est un lien
if (.HyperLinkURL <> "") then
'.HyperLinkEvents, .HyperLinkName, .HyperLinkTarget
'<fr> RMQ: TextFormatOf... doit être généralisé pour tous les objets
s = TextFormatOfExternalLinkTextPortion
' s = searchAndReplaceInString(s, "$url", .HyperLinkURL) ' (ok avec OOo 1.1.2)
' s = searchAndReplaceInString(s, "$string", .String) ' (ok avec OOo 1.1.2)
s = searchAndReplaceInString(s, "$url", oTheTextPortion.HyperLinkURL)
s = searchAndReplaceInString(s, "$string", oTheTextPortion.String)
sSpipText = sSpipText & s
'<fr> c'est une portion de texte non vide
elseif (.String <> "") then
'<fr> dans un titre
if (left(.ParaStyleName,7)="Heading") then 'ParaChapterNumberingLevel>=0 bug
sSpipText = sSpipText & .String
'<fr> dans un paragraph
else
'détection des retours à la ligne
s = .String
s=searchAndReplaceInString(s, chr(10), chr(10)&"_ ")
'<fr> le texte est enrichi
if (.CharUnderline <> com.sun.star.awt.FontUnderline.NONE) _
or (.CharWeight > com.sun.star.awt.FontWeight.NORMAL) _
or (.CharPosture <> com.sun.star.awt.FontSlant.NONE) then
'NONE, SINGLE, DOUBLE, DOTTED, DONTKNOW, DASH, LONGDASH,
'DASHDOT, DASHDOTDOT, SMALLWAVE, WAVE, DOUBLEWAVE, BOLD,
'BOLDDOTTED, BOLDDASH, BOLDLONGDASH, BOLDDASHDOT,
'BOLDDASHDOTDOT, BOLDWAVE
if (.CharUnderline <> com.sun.star.awt.FontUnderline.NONE) then
s = UnderlineTextPortion(s)
end if
'DONTKNOW, THIN, ULTRALIGHT, LIGHT, SEMILIGHT,
'NORMAL, SEMIBOLD, BOLD, ULTRABOLD, BLACK
'These are really only constants where THIN is 50, NORMAL is 100
' BOLD is 150, and BLACK is 200.
if (.CharWeight > com.sun.star.awt.FontWeight.NORMAL) then
s = BoldTextPortion(s)
end if
'NONE, OBLIQUE, ITALIC, DONTKNOW, REVERSE_OBLIQUE, REVERSE_ITALIC
'<fr> merci Bernard :-)
if (.CharPosture <> com.sun.star.awt.FontSlant.NONE) then
s = ItalicTextPortion(s)
end if
sSpipText = sSpipText & s
'<fr> le texte n'est pas enrichi
else
' sSpipText = sSpipText & NormalTextPortion(.String) ' (ok avec OOo 1.1.2)
' sSpipText = sSpipText & NormalTextPortion(oTheTextPortion.String)
sSpipText = sSpipText & NormalTextPortion(s)
end if
end if
end if
end with
end sub
'<fr> l'objet énuméré est un mot
sub onWord(sTheWord as string)
'<fr> RMQ: à implémenter (prévoir de ne l'activer que lorsque c'est nécessaire)
end sub
'<fr> l'objet énuméré est un champ
sub onTextField(oTheTextField as object, sTheString as string)
with oTheTextField
sSpipText = sSpipText & TextOnStartOfTextField & sTheString & TextOnEndOfTextField
end with
end sub
'<fr> l'objet énuméré est une note de bas de page
sub onFootnote(oTheFootnote as object)
with oTheFootnote
sSpipText = sSpipText & TextOnStartOfFootnote & .String & TextOnEndOfFootnote
end with
end sub
'<fr> l'objet énuméré est un caractere de contrôle
sub onControlCharacter(oTheControlCharacter as object)
with oTheControlCharacter
sSpipText = sSpipText & TextOnStartOfControlCharacter & .String & TextOnEndOfControlCharacter
end with
end sub
'<fr> l'objet énuméré est un signet de référence (rmq: revoir la traduction)
sub onReferenceMark(oTheReferenceMark as object)
with oTheReferenceMark
sSpipText = sSpipText & TextOnStartOfReferenceMark & .String & TextOnEndOfReferenceMark
end with
end sub
'<fr> l'objet énuméré est un signet d'index (rmq: revoir la traduction)
sub onDocumentIndexMark(oTheDocumentIndexMark as object)
with oTheDocumentIndexMark
sSpipText = sSpipText & TextOnStartOfDocumentIndexMark & .String & TextOnEndOfDocumentIndexMark
end with
end sub
'<fr> l'objet énuméré est un signet
sub onBookmark(oTheBookmark as object)
with oTheBookmark
sSpipText = sSpipText & TextOnStartOfBookmark & .String & TextOnEndOfBookmark
end with
end sub
'<fr> l'objet énuméré est un resultat (of the change tracking feature) marque de révision ? (rmq: revoir la traduction)
sub onRedline(oTheRedline as object)
with oTheRedline
sSpipText = sSpipText & TextOnStartOfRedline & .String & TextOnEndOfRedline
end with
end sub
'<fr> l'objet énuméré est un attribut utilisé pour les textes asiatiques
sub onRuby(oTheRuby as object)
with oTheRuby
sSpipText = sSpipText & TextOnStartOfRuby & .String & TextOnEndOfRuby
end with
end sub
'<fr> l'objet énuméré est une image
sub onTextGraphicObject(oTheTextGraphicObject as object)
with oTheTextGraphicObject
'<fr> RMQ: à revoir
sSpipText = sSpipText & TextOnStartOfTextGraphicObject & TextOnEndOfTextGraphicObject
end with
end sub
'<fr> l'objet énuméré est un dessin
sub onTextShape(oTheTextShape as object)
with oTheTextShape
' sSpipText = sSpipText & TextOnStartOfTextShape & ? & TextOnEndOfTextShape
end with
end sub
'<fr> l'objet énuméré est un dessin (sur la page draw)
sub onDrawingShape(oTheDrawingShape as object)
with oTheDrawingShape
' sSpipText = sSpipText & TextOnStartOfDrawingShape & ? & TextOnEndOfDrawingShape
end with
end sub
'<fr> l'objet énuméré est un contrôle de formulaire
sub onFormControl(oTheFormControl as object)
with oTheFormControl
' sSpipText = sSpipText & TextOnStartOfFormControl & ? & TextOnEndOfFormControl
end with
end sub
'<fr> l'énumération est terminée
sub onEndOfEnumeration(oTheComponent as object)
with oTheComponent
'<fr> copie du texte WikiWiki dans le presse-papier
mTextToClipboard.TextToClipboard(sSpipText)
end with
end sub
' *****************************************************************************************
function searchAndReplaceInString(sTheTargetString, sTheSearchString, sTheNewString) as string
dim pos as integer
dim s as string
s = sTheTargetString
pos = -len(sTheNewString)
do
pos = instr(pos + len(sTheNewString) + 1, s, sTheSearchString)
if (pos > 0) then
s = left(s, pos - 1) & sTheNewString & mid(s, pos + len(sTheSearchString))
end if
loop while pos > 0
searchAndReplaceInString = s
end function
function BulletChar(oTheParagraph as object) as string
dim oNumberingRulesForLevel
dim i as integer
BulletChar = ""
if (not isNull(oTheParagraph.NumberingRules) and not isEmpty(oTheParagraph.NumberingRules)) then
oNumberingRulesForLevel = oTheParagraph.NumberingRules.getByIndex(oTheParagraph.NumberingLevel)
'<fr> RMQ: voir s'il n'est pas possible d'utiliser une fonction du genre getByName("BulletChar"), pour éviter cette boucle
for i = lbound(oNumberingRulesForLevel) to ubound(oNumberingRulesForLevel)
with oNumberingRulesForLevel(i)
if (.Name = "BulletChar") then
BulletChar = .Value
exit for
end if
end with
next
end if
end function
function isListParagraph(oTheParagraph as object) as boolean
isListParagraph = not(IsNull(oTheParagraph.NumberingStyleName) or IsEmpty(oTheParagraph.NumberingStyleName) or (len(oTheParagraph.NumberingStyleName) = 0))
end function
rem Procédure principale.
sub Copy2Spip
dim oDoc as object
InitVariablesOOo2TeX
' traiter la selection éventuelle
if ThisComponent.getcurrentcontroller.viewcursor.iscollapsed then
' tout le document est converti
DocumentEnumeration("Writer", ThisComponent, mCopy2Spip)
else
' la selection est convertie
' c'est de la pure bidouille : copie de la selection dans un nouveau document
' puis conversion de ce document et enfin fermeture.
' lorsque ce document est caché, cela ne fonctionne pas...
' en attendant mieux... !
ClipboardCopy( ThisComponent )
oDoc = StarDesktop.loadComponentFromURL( "private:factory/swriter", "_blank", 0,Array( MakePropertyValue( "Hidden", false ) ) )
oDoc.CurrentController.Frame.ContainerWindow.Visible=False
ClipboardPaste( oDoc )
DocumentEnumeration("Writer", oDoc, mCopy2Spip)
oDoc.close( True )
end if
end sub
</script:module>
|