Wikipedista:Vyky/Makra
Vzhled
Makra pro formátování textu Wikipedie v OpenOffice
[editovat | editovat zdroj]Při psaní textu v OpenOffice doporučuji vypnout Automatický formát.
Postup instalace maker
[editovat | editovat zdroj]- V menu OpenOffice vybereme postupně : Nástroje → Makra → Správce maker → OpenOffice.org Basic... - Otevře se okno Makra v OpenOffice.org Basic
- Vybereme Moje makra a stiskneme tlačítko Nový – Otevře se okno pro editaci maker.
- Text makra přidáme za text v okně. (Pozor na stávající makra!!!)
- Uložíme a okno zavřeme. V okně Makra v OpenOffice.org Basic zkontrolujeme, zda přibyla nová makra.
Vytvoření panelu nástrojů
[editovat | editovat zdroj]- V menu OpenOffice postupně volíme: Nástroje → Přizpůsobit
- Stiskneme tlačítko Nový a pojmenujeme panel (např. Wikipedie)
- V okně Přizpůsobit stiskneme tlačítko Přidat, vybereme kategorii Makra OpenOffice.org a rozbalíme do nalezeného příslušného makra.
- Nyní můžeme jedno po druhém přidávat do panelu nástrojů.
- Pokud se panel neobjeví, je třeba jej zapnout v menu : Zobrazit → Panely nástrojů
Jednotlivá makra se chovají čtyřmi různými způsoby :
[editovat | editovat zdroj]- Vklad jednoho nebo více znaků na pozici kurzoru
- Mezera - vkládá "tvrdou mezeru" ( )
- Svislítko - vkládá "svislítko" ( | )
- Vkládá formátovací znaky wiki a umístí kurzor mezi ně pro následné vložení textu
- Komentář - komentář ke zdrojovému textu (<!---->)
- Nowiki - potlačení interpretace wiki kódu (<nowiki></nowiki>)
- Math - matematický vzorec (<math></math>)
- Redirect - (#REDIRECT [[]])
- Kategorie - ([[Kategorie:]])
- Zvýrazněný text doplní o formátovací znaky wiki, pokud není žádný text zvýrazněný vloží aktuální obsah schránky
- Wikilink - vnitřní odkaz ([[ ]])
- Tučně - tučný text (''' '''
- Kurzíva - text kurzívou ('' ''
- Oddíl_1 - nový oddíl (== ==)
- Oddíl_2 - pododdíl (=== ===)
- Oddíl_3 - pod-pododdíl (==== ====)
- Vloží formátovací znaky wiki a pomocný text
- Média - odkaz na mediální soubor ([[Média:Příklad.ogg]])
- Soubor - odkaz na obrázek ([[Soubor:Příklad.jpg]])
- HTTP - externí odkaz ([http://www.example.com Titulek odkazu])
Zdrojový kód
[editovat | editovat zdroj]REM *** VykyWiki01_01 *** REM *WIKILINK - vybraný text změní na odkaz do Wikipedie sub Wikilink rem ---------------------------------------------------------------------- rem define variables dim document as object dim dispatcher as object rem ---------------------------------------------------------------------- rem get access to the document document = ThisComponent.CurrentController.Frame dispatcher = createUnoService("com.sun.star.frame.DispatchHelper") rem ---------------------------------------------------------------------- dim args1(0) as new com.sun.star.beans.PropertyValue args1(0).Name = "Text" args1(0).Value = "[[]]" rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array()) rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:InsertText", "", 0, args1()) rem ---------------------------------------------------------------------- dim args3(1) as new com.sun.star.beans.PropertyValue args3(0).Name = "Count" args3(0).Value = 2 args3(1).Name = "Select" args3(1).Value = false rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:GoLeft", "", 0, args3()) rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:Paste", "", 0, Array()) rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:GoRight", "", 0, args3()) rem ---------------------------------------------------------------------- end sub REM *TUČNĚ - vybraný text změní na "tučně" sub Tucne rem ---------------------------------------------------------------------- rem define variables dim document as object dim dispatcher as object rem ---------------------------------------------------------------------- rem get access to the document document = ThisComponent.CurrentController.Frame dispatcher = createUnoService("com.sun.star.frame.DispatchHelper") rem ---------------------------------------------------------------------- dim args1(0) as new com.sun.star.beans.PropertyValue args1(0).Name = "Text" args1(0).Value = "''''''" rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array()) rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:InsertText", "", 0, args1()) rem ---------------------------------------------------------------------- dim args3(1) as new com.sun.star.beans.PropertyValue args3(0).Name = "Count" args3(0).Value = 3 args3(1).Name = "Select" args3(1).Value = false rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:GoLeft", "", 0, args3()) rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:Paste", "", 0, Array()) rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:GoRight", "", 0, args3()) rem ---------------------------------------------------------------------- end sub REM *KURZÍVOU - vybraný text změní na "kurzívu" sub Kurziva rem ---------------------------------------------------------------------- rem define variables dim document as object dim dispatcher as object rem ---------------------------------------------------------------------- rem get access to the document document = ThisComponent.CurrentController.Frame dispatcher = createUnoService("com.sun.star.frame.DispatchHelper") rem ---------------------------------------------------------------------- dim args1(0) as new com.sun.star.beans.PropertyValue args1(0).Name = "Text" args1(0).Value = "''''" rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array()) rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:InsertText", "", 0, args1()) rem ---------------------------------------------------------------------- dim args3(1) as new com.sun.star.beans.PropertyValue args3(0).Name = "Count" args3(0).Value = 2 args3(1).Name = "Select" args3(1).Value = false rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:GoLeft", "", 0, args3()) rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:Paste", "", 0, Array()) rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:GoRight", "", 0, args3()) rem ---------------------------------------------------------------------- end sub REM *SVISLÍTKO - vloží svislítko sub Svislitko rem ---------------------------------------------------------------------- rem define variables dim document as object dim dispatcher as object rem ---------------------------------------------------------------------- rem get access to the document document = ThisComponent.CurrentController.Frame dispatcher = createUnoService("com.sun.star.frame.DispatchHelper") rem ---------------------------------------------------------------------- dim args1(0) as new com.sun.star.beans.PropertyValue args1(0).Name = "Text" args1(0).Value = "|" rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:InsertText", "", 0, args1()) rem ---------------------------------------------------------------------- end sub REM *TVRDÁ MEZERA - vloží " " sub Mezera rem ---------------------------------------------------------------------- rem define variables dim document as object dim dispatcher as object rem ---------------------------------------------------------------------- rem get access to the document document = ThisComponent.CurrentController.Frame dispatcher = createUnoService("com.sun.star.frame.DispatchHelper") rem ---------------------------------------------------------------------- dim args1(0) as new com.sun.star.beans.PropertyValue args1(0).Name = "Text" args1(0).Value = " " rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:InsertText", "", 0, args1()) rem ---------------------------------------------------------------------- end sub REM *NOVÝ ODDÍL - vybraný text změní na "Nový oddíl" sub Oddil_1 rem ---------------------------------------------------------------------- rem define variables dim document as object dim dispatcher as object rem ---------------------------------------------------------------------- rem get access to the document document = ThisComponent.CurrentController.Frame dispatcher = createUnoService("com.sun.star.frame.DispatchHelper") rem ---------------------------------------------------------------------- dim args1(0) as new com.sun.star.beans.PropertyValue args1(0).Name = "Text" args1(0).Value = "== ==" rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array()) rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:InsertText", "", 0, args1()) rem ---------------------------------------------------------------------- dim args3(1) as new com.sun.star.beans.PropertyValue args3(0).Name = "Count" args3(0).Value = 3 args3(1).Name = "Select" args3(1).Value = false rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:GoLeft", "", 0, args3()) rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:Paste", "", 0, Array()) rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:GoRight", "", 0, args3()) rem ---------------------------------------------------------------------- end sub REM *PODODDÍL - vybraný text změní na "Pododdíl" sub Oddil_2 rem ---------------------------------------------------------------------- rem define variables dim document as object dim dispatcher as object rem ---------------------------------------------------------------------- rem get access to the document document = ThisComponent.CurrentController.Frame dispatcher = createUnoService("com.sun.star.frame.DispatchHelper") rem ---------------------------------------------------------------------- dim args1(0) as new com.sun.star.beans.PropertyValue args1(0).Name = "Text" args1(0).Value = "=== ===" rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array()) rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:InsertText", "", 0, args1()) rem ---------------------------------------------------------------------- dim args3(1) as new com.sun.star.beans.PropertyValue args3(0).Name = "Count" args3(0).Value = 4 args3(1).Name = "Select" args3(1).Value = false rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:GoLeft", "", 0, args3()) rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:Paste", "", 0, Array()) rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:GoRight", "", 0, args3()) rem ---------------------------------------------------------------------- end sub REM *POD-PODODDÍL - vybraný text změní na "Pod-pododdíl" sub Oddil_3 rem ---------------------------------------------------------------------- rem define variables dim document as object dim dispatcher as object rem ---------------------------------------------------------------------- rem get access to the document document = ThisComponent.CurrentController.Frame dispatcher = createUnoService("com.sun.star.frame.DispatchHelper") rem ---------------------------------------------------------------------- dim args1(0) as new com.sun.star.beans.PropertyValue args1(0).Name = "Text" args1(0).Value = "==== ====" rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array()) rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:InsertText", "", 0, args1()) rem ---------------------------------------------------------------------- dim args3(1) as new com.sun.star.beans.PropertyValue args3(0).Name = "Count" args3(0).Value = 5 args3(1).Name = "Select" args3(1).Value = false rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:GoLeft", "", 0, args3()) rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:Paste", "", 0, Array()) rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:GoRight", "", 0, args3()) rem ---------------------------------------------------------------------- end sub REM *KATEGORIE - vybraný text změní na "Kategorii" sub Kategorie rem ---------------------------------------------------------------------- rem define variables dim document as object dim dispatcher as object rem ---------------------------------------------------------------------- rem get access to the document document = ThisComponent.CurrentController.Frame dispatcher = createUnoService("com.sun.star.frame.DispatchHelper") rem ---------------------------------------------------------------------- dim args1(0) as new com.sun.star.beans.PropertyValue args1(0).Name = "Text" args1(0).Value = "[[Kategorie:]]" rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:InsertText", "", 0, args1()) rem ---------------------------------------------------------------------- dim args3(1) as new com.sun.star.beans.PropertyValue args3(0).Name = "Count" args3(0).Value = 2 args3(1).Name = "Select" args3(1).Value = false rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:GoLeft", "", 0, args3()) rem ---------------------------------------------------------------------- end sub REM *SOUBOR - vytvoří šablonu pro "Vložený obrázek" sub Soubor rem ---------------------------------------------------------------------- rem define variables dim document as object dim dispatcher as object rem ---------------------------------------------------------------------- rem get access to the document document = ThisComponent.CurrentController.Frame dispatcher = createUnoService("com.sun.star.frame.DispatchHelper") rem ---------------------------------------------------------------------- dim args1(0) as new com.sun.star.beans.PropertyValue args1(0).Name = "Text" args1(0).Value = "[[Soubor:Příklad.jpg]]" rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:InsertText", "", 0, args1()) rem ---------------------------------------------------------------------- dim args3(1) as new com.sun.star.beans.PropertyValue args3(0).Name = "Count" args3(0).Value = 2 args3(1).Name = "Select" args3(1).Value = false rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:GoLeft", "", 0, args3()) rem ---------------------------------------------------------------------- end sub REM *MÉDIA - vytvoří šablonu pro "Odkaz na mediální soubor" sub Media rem ---------------------------------------------------------------------- rem define variables dim document as object dim dispatcher as object rem ---------------------------------------------------------------------- rem get access to the document document = ThisComponent.CurrentController.Frame dispatcher = createUnoService("com.sun.star.frame.DispatchHelper") rem ---------------------------------------------------------------------- dim args1(0) as new com.sun.star.beans.PropertyValue args1(0).Name = "Text" args1(0).Value = "[[Média:Příklad.ogg]]" rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:InsertText", "", 0, args1()) rem ---------------------------------------------------------------------- dim args3(1) as new com.sun.star.beans.PropertyValue args3(0).Name = "Count" args3(0).Value = 2 args3(1).Name = "Select" args3(1).Value = false rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:GoLeft", "", 0, args3()) rem ---------------------------------------------------------------------- end sub REM *HTTP - vytvoří šablonu "Externího odkazu" sub HTTP rem ---------------------------------------------------------------------- rem define variables dim document as object dim dispatcher as object rem ---------------------------------------------------------------------- rem get access to the document document = ThisComponent.CurrentController.Frame dispatcher = createUnoService("com.sun.star.frame.DispatchHelper") rem ---------------------------------------------------------------------- dim args1(0) as new com.sun.star.beans.PropertyValue args1(0).Name = "Text" args1(0).Value = "[http://www.example.com Titulek odkazu]" rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:InsertText", "", 0, args1()) rem ---------------------------------------------------------------------- dim args3(1) as new com.sun.star.beans.PropertyValue args3(0).Name = "Count" args3(0).Value = 1 args3(1).Name = "Select" args3(1).Value = false rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:GoLeft", "", 0, args3()) rem ---------------------------------------------------------------------- end sub REM *MATH - vytvoří šablonu pro "Matematický vzorec" sub Math rem ---------------------------------------------------------------------- rem define variables dim document as object dim dispatcher as object rem ---------------------------------------------------------------------- rem get access to the document document = ThisComponent.CurrentController.Frame dispatcher = createUnoService("com.sun.star.frame.DispatchHelper") rem ---------------------------------------------------------------------- dim args1(0) as new com.sun.star.beans.PropertyValue args1(0).Name = "Text" args1(0).Value = "<math></math>" rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:InsertText", "", 0, args1()) rem ---------------------------------------------------------------------- dim args3(1) as new com.sun.star.beans.PropertyValue args3(0).Name = "Count" args3(0).Value = 7 args3(1).Name = "Select" args3(1).Value = false rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:GoLeft", "", 0, args3()) rem ---------------------------------------------------------------------- end sub REM *REDIRECT - vytvoří šablonu pro "Redirect" sub Redirect rem ---------------------------------------------------------------------- rem define variables dim document as object dim dispatcher as object rem ---------------------------------------------------------------------- rem get access to the document document = ThisComponent.CurrentController.Frame dispatcher = createUnoService("com.sun.star.frame.DispatchHelper") rem ---------------------------------------------------------------------- dim args1(0) as new com.sun.star.beans.PropertyValue args1(0).Name = "Text" args1(0).Value = "#REDIRECT [[]]" rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:InsertText", "", 0, args1()) rem ---------------------------------------------------------------------- dim args3(1) as new com.sun.star.beans.PropertyValue args3(0).Name = "Count" args3(0).Value = 2 args3(1).Name = "Select" args3(1).Value = false rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:GoLeft", "", 0, args3()) rem ---------------------------------------------------------------------- end sub REM *NOWIKI - ignorovat formátování wiki sub Nowiki rem ---------------------------------------------------------------------- rem define variables dim document as object dim dispatcher as object rem ---------------------------------------------------------------------- rem get access to the document document = ThisComponent.CurrentController.Frame dispatcher = createUnoService("com.sun.star.frame.DispatchHelper") rem ---------------------------------------------------------------------- dim args1(0) as new com.sun.star.beans.PropertyValue args1(0).Name = "Text" args1(0).Value = "" rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:InsertText", "", 0, args1()) rem ---------------------------------------------------------------------- dim args3(1) as new com.sun.star.beans.PropertyValue args3(0).Name = "Count" args3(0).Value = 9 args3(1).Name = "Select" args3(1).Value = false rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:GoLeft", "", 0, args3()) rem ---------------------------------------------------------------------- end sub REM *KOMENTÁŘ - vloží "Komentář ke zdrojovému textu" sub Komentar rem ---------------------------------------------------------------------- rem define variables dim document as object dim dispatcher as object rem ---------------------------------------------------------------------- rem get access to the document document = ThisComponent.CurrentController.Frame dispatcher = createUnoService("com.sun.star.frame.DispatchHelper") rem ---------------------------------------------------------------------- dim args1(0) as new com.sun.star.beans.PropertyValue args1(0).Name = "Text" args1(0).Value = "<!---->" rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:InsertText", "", 0, args1()) rem ---------------------------------------------------------------------- dim args3(1) as new com.sun.star.beans.PropertyValue args3(0).Name = "Count" args3(0).Value = 3 args3(1).Name = "Select" args3(1).Value = false rem ---------------------------------------------------------------------- dispatcher.executeDispatch(document, ".uno:GoLeft", "", 0, args3()) rem ---------------------------------------------------------------------- end sub