Issue 31212

Summary: Searching the CharEscapement attribute does not work from Basic
Product: App Dev Reporter: andrew
Component: apiAssignee: AOO issues mailing list <issues>
Status: CONFIRMED --- QA Contact:
Severity: Trivial    
Priority: P3 CC: issues
Version: 3.3.0 or older (OOo)   
Target Milestone: ---   
Hardware: All   
OS: Linux, all   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---
Attachments:
Description Flags
the linked document none

Description andrew 2004-07-08 03:07:01 UTC
I created a Writer document and then set some text to have a CharEscapement of
25 (this means that I set it to be superscript). I then ran the following code
to verify that the CharEscapement is indeed 25. I verified this in version 1.1.1
and 1.1.2.


Sub blech
dim mainEnum, para, paraEnum, inpara
  Dim mainDoc
   mainDoc = ThisComponent
   mainEnum = mainDoc.Text.createEnumeration
   
   While mainEnum.hasMoreElements
      para = mainEnum.nextElement
      If para.supportsService("com.sun.star.text.Paragraph") Then
         paraEnum = para.createEnumeration
         While paraEnum.hasMoreElements
            inpara = paraEnum.nextElement
            if inpara.CharEscapement=25 then
            inpara.String="<#>" & inpara.string & "<$>"
            end if
         Wend
      End If
   Wend 
End Sub

I am able to search for the super script text from the GUI, but I am not able to
search for the text from Basic. Note that I can find a CharEscapement of 0, but
not 25.

Sub ReplaceFormatting()
  Dim oDocument As Object
  Dim oReplace As Object
  Dim SrchAttributes(0) as new com.sun.star.beans.PropertyValue
  Dim ReplAttributes(0) as new com.sun.star.beans.PropertyValue

  oDocument = ThisComponent
  oReplace = oDocument.createReplaceDescriptor
   
  oReplace.SearchString = ".*"           'Regular expression. Match any text
  oReplace.ReplaceString = "<#>&<$>"     'Note the & places the found text back
  oReplace.SearchRegularExpression=True  'Use regular expressions
  oReplace.searchStyles=True             'We want to search styles
  oReplace.searchAll=True                'Do the entire document

  REM This is the attribute to find
  SrchAttributes(0).Name = "CharEscapement"
  SrchAttributes(0).Value = 25

  REM This is the attribute to replace it with
  ReplAttributes(0).Name = "CharEscapement"
  ReplAttributes(0).Value = 0

  REM Set the attributes in the replace descriptor
  oReplace.SetSearchAttributes(SrchAttributes())
  'oReplace.SetReplaceAttributes(ReplAttributes())

  REM Now do the work!
  oDocument.replaceAll(oReplace)
End Sub
Comment 1 andrew 2004-07-08 03:11:51 UTC
Hmmm, I thought that I could add a document to demonstrate the problem but I can
not <grumble grumble>.... Well, after you no longer require the document at the
following link, please let me know so that I can remove it.

http://www.pitonyak.org/Bad_Search.sxw

Andrew Pitonyak
andrew@pitonyak.org
Comment 2 stephan.wunderlich 2004-07-08 17:05:22 UTC
Created attachment 16320 [details]
the linked document
Comment 3 stephan.wunderlich 2004-07-08 17:09:08 UTC
SW->pitonyak: I've attached your document so you can remove it from your server :-)

SW->TL: eventho the used calls aren't documented ( css.util.XReplaceDescriptor
just has the methods set/getReplaceString and css.util.XSearchDescriptor just
has the methods set/getSearchString ) they seem to be available and so should
also work ;-) ... the idl-documentation should also be adopted when you work on
this issue methinks.