Seite 1 von 1

Wörterbuch editieren

Verfasst: Do, 22.07.2010 13:53
von biwepa
Hallo Experten,

Gibt es eine Möglichkeit mehrere Wörterbücher zusammenzuführen. Bin auf der Suche nach einem möglichst einfachen (wenn geht deutschsprachigen) Editor, mit dem ein Wörtertuch (*.dic) in der Form bearbeitet werden kann, dass Inhalte gelöscht bzw. kopiert werden können. Der Editor sollte wenn möglich freeware sein. Habe es mit "notepad++" versucht und bin möglicherweise auch nur an "Unwissenheit" gescheitert.

Danke für eure Hilfe!

Re: Wörterbuch editieren

Verfasst: Do, 22.07.2010 16:20
von lorbass
Eine eigene Funktion oder Programm für diesen Zweck kenne ich nicht. Aber vielleicht hilft dir der OOo-Wiki-Artikel WörterbuchAusWortlisteErzeugen weiter. Darin ein Makro unseres Mitstreiters Winfried Rohr aka komma4 und Links auf seine Web-Site. Einige nützliche Info findests du auch im Thread Eigenes Wörterbuch erstellen.

Gruß
lorbass

Re: Wörterbuch editieren

Verfasst: Fr, 23.07.2010 10:14
von biwepa
Gibt es auch ein Makro, um aus einem beliebigen Wörterbuch die Inhalte in ein Dokument zu exportieren?

Re: Wörterbuch editieren

Verfasst: Fr, 23.07.2010 13:18
von komma4
Nicht das ich wüsste.

Habe heute mittag mal ein kleines [8)] Makro geschrieben, um da was auszugeben.

Code: Alles auswählen

Private oDok
Private oDokText
Private oTextCursor


' ==================================================================
Sub dumpDictionary
' ==================================================================

sMakroName = "dumpDic"
sMakroVersion = "1.0.0"
sMakroTitel = _
 sMakroName & "-" & sMakroVersion

' service
oWBListe = _
 createUnoService ("com.sun.star.linguistic2.DictionaryList")

If oWBListe.getCount() = 0 Then
  MsgBox _
  "Keine Wörterbücher gefunden; beende Makro" ,_
  ,_
  sMakroTitel
  Exit Sub
End If

' ------------------------------------------------------------------
' Neues Writer Dokument zur Ausgabe der Inhalte 
oDok = _
 StarDesktop.loadComponentFromURL( _
 "private:factory/swriter", "_blank", 0, Array() ) 

' Textobjekt des zu erstellenden Dokuments
oDokText = oDok.getText()
' Textcursor
oTextCursor = oDokText.createTextCursor()


aWBB() = oWBListe.getDictionaries() 
For iWB = LBound( aWBB ) To UBound( aWBB ) 
   oWB = oWBListe.getDictionaryByName( aWBB( iWB ).Name )
   dumpDic_WB( oWB ) 
Next iWB


End Sub

' ------------------------------------------------------------------

Sub dumpDic_WB( WB as Object ) 

oTextCursor.ParaStyleName = "Heading 1" 
oTextCursor.SetString( "Wörterbuch: " & WB.Name )
oTextCursor.CollapseToEnd()
		
oDokText.insertControlCharacter( _
 oTextCursor,com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, FALSE )

oTextCursor.ParaStyleName = "Heading 2" 
oTextCursor.SetString( "Information zu Wörterbuch: " & WB.Name )
oTextCursor.CollapseToEnd()
		
oDokText.insertControlCharacter( _
 oTextCursor,com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, FALSE )


  
If ( WB.isActive() ) Then
 sStatus = "Aktiv"
Else
 sStatus = "nicht aktiviert"
End If

oDokText.insertString( oTextCursor, "Status: " & sStatus , FALSE )
oDokText.insertControlCharacter( _
 oTextCursor,com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, FALSE )


oDokText.insertString( oTextCursor, "Sprache: " & WB.Language, FALSE )
oDokText.insertControlCharacter( _
 oTextCursor,com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, FALSE )

' nur bei persönlichen WB      
'If WB.DictionaryType = com.sun.star.linguistic2.POSITIVE Then
' sTyp = "Positiv-Liste" 
'Else
' sTyp = "Negativ-Liste"
'End If

'oDokText.insertString( oTextCursor, "Wörterbuchtyp: " & sTyp, FALSE )
'oDokText.insertControlCharacter( _
' oTextCursor,com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, FALSE )


oDokText.insertString( oTextCursor, "Anzahl Einträge: " & WB.Count, FALSE )
oDokText.insertControlCharacter( _
 oTextCursor,com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, FALSE )

If WB.hasLocation() Then
 oDokText.insertString( oTextCursor, "Speicherort: " & WB.Location, FALSE )
 oDokText.insertControlCharacter( _
  oTextCursor,com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, FALSE )
Else
 oDokText.insertString( oTextCursor, "Dieses Wörterbuch wird intern gespeichert", FALSE )
 oDokText.insertControlCharacter( _
  oTextCursor,com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, FALSE )
End If



' Ausgabe der Einträge
dumpDic_Entries( WB )

End Sub
' ------------------------------------------------------------------
Sub dumpDic_Entries( WB )

If WB.Count = 0 Then 
 Exit Sub
End If


oTextCursor.ParaStyleName = "Heading 2" 
oTextCursor.SetString( "Inhalt von: " & WB.Name )
oTextCursor.CollapseToEnd()
		
oDokText.insertControlCharacter( _
 oTextCursor,com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, FALSE )

aEintraege = WB.getEntries()
For iWBE = LBound( aEintraege ) To UBound( aEintraege )
 oEintrag = aEintraege( iWBE )  
 oDokText.insertString( oTextCursor, aEintraege( iWBE ).DictionaryWord, FALSE )
 oDokText.insertControlCharacter( _
  oTextCursor,com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK, FALSE )
Next iWBE

End Sub
' ------------------------------------------------------------------

Sollte -für den Anfang- mal reichen.

Viel Spass...bei Fragen: fragen!