Issue 31212 - Searching the CharEscapement attribute does not work from Basic
Summary: Searching the CharEscapement attribute does not work from Basic
Status: CONFIRMED
Alias: None
Product: App Dev
Classification: Unclassified
Component: api (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: All Linux, all
: P3 Trivial
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-07-08 03:07 UTC by andrew
Modified: 2013-02-24 21:07 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
the linked document (7.71 KB, application/vnd.sun.xml.writer)
2004-07-08 17:05 UTC, stephan.wunderlich
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
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.