To comment on the following update, log in, then open the issue: http://www.openoffice.org/issues/show_bug.cgi?id=98931 Issue #|98931 Summary|macros does not works properly as in 2.4 Component|Word processor Version|OOo 3.0 Platform|All URL| OS/Version|Windows XP Status|UNCONFIRMED Status whiteboard| Keywords| Resolution| Issue type|DEFECT Priority|P3 Subcomponent|programming Assigned to|writerneedsconfirm Reported by|l_allemano
------- Additional comments from l_allem...@openoffice.org Thu Feb 5 17:34:42 +0000 2009 ------- I make intensive use of macros that inspect the text and in presence of keywords transform the paragraph in Annotation in OO writer 2.4 calling the macro "Trasform_Selected_Text_To_Annotation" will replace the selected text with a Annotation which contains the selected text . in OO writer 3.0 the same macro cuts the text and inserts a Annotation with no text at all , without raise errors or exceptions. ******************************************************* REM ***** BASIC ***** rem define variables dim document as object dim dispatcher as object Sub Trasform_Selected_Text_To_Annotation() Dim oDisp , octl Dim NoArg() Dim nome as String dim textOfAnnotation As String document = ThisComponent.CurrentController.Frame ''' create the DispatcherService dispatcher = createUnoService("com.sun.star.frame.DispatchHelper") ''' Set source doc/currentController/frame/sheet/range. octl = ThisComponent.getCurrentController() '''''copy the current selection to the clipboard. dispatcher.executeDispatch(octl, ".uno:Cut", "", 0, NoArg()) textOfAnnotation = getClipBoard() insertAnnotation(textOfAnnotation) End Sub sub insertAnnotation (textOfAnnotation) dim args2(2) as new com.sun.star.beans.PropertyValue args2(0).Name = "Text" args2(0).Value = textOfAnnotation args2(1).Name = "Author" args2(1).Value = "test" args2(2).Name = "Date" args2(2).Value = "" dispatcher.executeDispatch (document, ".uno:InsertAnnotation", "", 0, args2()) end sub Function getClipBoard() as String Dim oClip, oClipContents, oTypes Dim oConverter, convertedString$ Dim i%, iPlainLoc% iPlainLoc = -1 Dim s$ : s$ = "com.sun.star.datatransfer.clipboard.SystemClipboard" oClip = createUnoService(s$) oConverter = createUnoService("com.sun.star.script.Converter") 'Print "Clipboard name = " & oClip.getName() 'Print "Implemantation name = " & oClip.getImplementationName() oClipContents = oClip.getContents() oTypes = oClipContents.getTransferDataFlavors() Dim msg$, iLoc%, outS msg = "" iLoc = -1 For i=LBound(oTypes) To UBound(oTypes) If oTypes(i).MimeType = "text/plain;charset=utf-16" Then iPlainLoc = i Exit For End If 'msg = msg & "Mime type = " & x(ii).MimeType & " normal = " & _ ' x(ii).HumanPresentableName & Chr$(10) Next If (iPlainLoc >= 0) Then convertedString = oConverter.convertToSimpleType( _ oClipContents.getTransferData(oTypes(iPlainLoc)), _ com.sun.star.uno.TypeClass.STRING) End If getClipBoard = convertedString End Function --------------------------------------------------------------------- Please do not reply to this automatically generated notification from Issue Tracker. Please log onto the website and enter your comments. http://qa.openoffice.org/issue_handling/project_issues.html#notification --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@sw.openoffice.org For additional commands, e-mail: issues-h...@sw.openoffice.org --------------------------------------------------------------------- To unsubscribe, e-mail: allbugs-unsubscr...@openoffice.org For additional commands, e-mail: allbugs-h...@openoffice.org