Standard |
Module1 |
Autotext |
Basic |
Autotext|MemoFormat (Control) |
27 |
SUB Autotext(oEvent AS OBJECT) DIM arText() DIM stText AS STRING DIM oSelection AS NEW com.sun.star.awt.Selection DIM oField AS OBJECT DIM oAutotexts AS OBJECT DIM oRange AS OBJECT DIM oCursor AS OBJECT oField = oEvent.Source IF oField.text <> "" THEN arText = Split(oField.text) stText = arText(Ubound(arText)) oAutotexts = createunoservice("com.sun.star.text.AutoTextContainer") oRange = oAutotexts.getByName("standard") IF oRange.hasByName(stText) THEN oAutotext = oRange.getByName(stText) oCursor = oField.Model.createTextCursor() oCursor.gotoEnd(true) oCursor.goLeft(len(stText),true) oField.Model.insertString(oCursor,oAutotext.String,true) oSelection.Min = len(oField.Text) oSelection.Max = len(oField.Text) oField.setFocus oField.Selection = oSelection END IF END IF END SUB |
Standard |
Module1 |
ContentRead |
Basic |
Search_mark (Form) |
41 |
Sub ContentRead(oEvent AS OBJECT) DIM inMemo AS INTEGER DIM oField AS OBJECT DIM stSearchtext AS STRING DIM oCursor AS OBJECT DIM inSearch AS INTEGER DIM inSearchOld AS INTEGER DIM inLen AS INTEGER oForm = oEvent.Source inMemo = oForm.findColumn("memo") oField = oForm.getByName("MemoFormat") oField.Text = oForm.getString(inMemo) Wait 5 stSearchtext = oForm.Parent.getByname("FormFilter").getByName("Search").Text oCursor = oField.createTextCursor() oCursor.gotoStart(true) oCursor.gotoEnd(true) oCursor.CharHeight = 10 oCursor.CharFontName = "Arial, Helvetica, Tahoma" oCursor.CharColor = RGB(0,0,0) oCursor.CharWeight = 100.000000 oCursor.gotoStart(false) IF oField.Text <> "" AND stSearchtext <> "" THEN IF inStr(oField.Text, stSearchtext) THEN inSearch = 1 inSearchOld = 0 inLen = Len(stSearchtext) DO WHILE inStr(inSearch, oField.Text, stSearchtext) > 0 inSearch = inStr(inSearch, oField.Text, stSearchtext) - 1 oCursor.goRight(inSearch-inSearchOld,false) oCursor.goRight(inLen,true) oCursor.CharColor = RGB(102,102,255) oCursor.CharWeight = 110.000000 oCursor.goLeft(inLen,false) inSearchOld = inSearch inSearch = inSearch + 2 LOOP END IF END IF End Sub |
Standard |
Module1 |
ContentReadWithoutSearch |
Basic |
Spelling_afterwards (Form) Spelling_directly (Form) |
20 |
Sub ContentReadWithoutSearch(oEvent AS OBJECT) DIM inMemo AS INTEGER DIM oField AS OBJECT DIM stSearchtext AS STRING DIM oCursor AS OBJECT oForm = oEvent.Source inMemo = oForm.findColumn("memo") oField = oForm.getByName("MemoFormat") oField.Text = oForm.getString(inMemo) Wait 5 oCursor = oField.createTextCursor() oCursor.gotoStart(true) oCursor.gotoEnd(true) oCursor.CharHeight = 10 oCursor.CharFontName = "Arial, Helvetica, Tahoma" oCursor.CharColor = RGB(0,0,0) oCursor.CharWeight = 100.000000 oCursor.gotoStart(false) End Sub |
Standard |
Module1 |
ContentWrite |
Basic |
Search_mark (Form) Spelling_afterwards (Form) Spelling_directly (Form) |
22 |
Sub ContentWrite(oEvent AS OBJECT) DIM oForm AS OBJECT DIM inMemo AS INTEGER DIM loID AS LONG DIM oField AS OBJECT DIM stMemo AS STRING oForm = oEvent.Source IF InStr(oForm.ImplementationName, "ODatabaseForm") THEN IF NOT oForm.isBeforeFirst() AND NOT oForm.isAfterLast() THEN inMemo = oForm.findColumn("memo") loID = oForm.findColumn("ID") oField = oForm.getByName("MemoFormat") stMemo = oField.Text IF stMemo <> "" THEN oForm.updateString(inMemo,stMemo) END IF IF stMemo <> "" AND oForm.getString(loID) <> "" THEN oForm.UpdateRow() END IF END IF END IF End Sub |
Standard |
Module1 |
MarkWrongWordsDirect |
Basic |
Spelling_directly|MemoFormat (Control) |
47 |
SUB MarkWrongWordsDirect(oEvent AS OBJECT) GlobalScope.BasicLibraries.LoadLibrary("Tools") DIM aProp() AS NEW com.sun.star.beans.PropertyValue DIM oLinuSvcMgr AS OBJECT DIM oSpellChk AS OBJECT DIM oField AS OBJECT DIM arText() DIM stWord AS STRING DIM inlenWord AS INTEGER DIM ink AS INTEGER DIM i AS INTEGER DIM oCursor AS OBJECT DIM stText AS STRING oLinguSvcMgr = createUnoService("com.sun.star.linguistic2.LinguServiceManager") IF NOT IsNull(oLinguSvcMgr) THEN oSpellChk = oLinguSvcMgr.getSpellChecker() END IF oField = oEvent.Source.Model ink = 0 IF oEvent.KeyCode = 1280 OR oEvent.KeyCode = 1284 THEN stText = Join(Split(oField.Text,CHR(10))," ") stText = Join(Split(stText,CHR(13))," ") arText = Split(RTrim(stText)," ") FOR i = LBound(arText) TO UBound(arText) stWord = arText(i) inlenWord = len(stWord) stWord = Trim(RTrimStr(RTrimStr(RTrimStr(RTrimStr(RTrimStr(RTrimStr(stWord,","),"."),"?"),"!"),"."),")")) stWord = LTrimChar(stWord,"(") IF stWord <> "" THEN oCursor = oField.createTextCursor() oCursor.gotoStart(false) oCursor.goRight(ink,false) oCursor.goRight(inLenWord,true) IF NOT oSpellChk.isValid(stWord, "en", aProp()) THEN oCursor.CharUnderline = 9 oCursor.CharUnderlineHasColor = True oCursor.CharUnderlineColor = RGB(255,51,51) ELSE oCursor.CharUnderline = 0 END IF END IF ink = ink + inLenWord + 1 NEXT END IF END SUB |
Standard |
Module1 |
MarkWrongWordsWaveLine |
Basic |
Spelling_afterwards|MemoFormat (Control) |
37 |
SUB MarkWrongWordsWaveLine(oEvent AS OBJECT) DIM aProp() AS NEW com.sun.star.beans.PropertyValue DIM n AS INTEGER DIM oField AS OBJECT DIM oCursor AS OBJECT DIM aText() DIM oLinguSvcMgr AS OBJECT DIM oSpellChk AS OBJECT DIM i AS INTEGER oField = oEvent.Source oCursor = oField.Model.createTextCursor() IF oField.text <> "" THEN aText = Split(oField.text) oLinguSvcMgr = createUnoService("com.sun.star.linguistic2.LinguServiceManager") IF NOT IsNull(oLinguSvcMgr) THEN oSpellChk = oLinguSvcMgr.getSpellChecker() END IF FOR i = LBound(aText) TO UBound(aText) oCursor.gotoEnd(true) IF NOT oSpellChk.isValid(aText(i), "en", aProp()) THEN oCursor.CharUnderline = 9 oCursor.CharUnderlineHasColor = True oCursor.CharUnderlineColor = RGB(255,51,51) END IF oField.Model.insertString(oCursor,aText(i),true) IF i < UBound(aText) THEN oCursor.gotoEnd(true) oCursor.CharUnderline = 0 oField.Model.insertString(oCursor," ",true) END IF NEXT END IF END SUB |