To comment on the following update, log in, then open the issue:
http://www.openoffice.org/issues/show_bug.cgi?id=75496
                 Issue #|75496
                 Summary|performance penalty after 21st conversion to formula o
                        |bject via macro
               Component|Formula editor
                 Version|OOo 2.1
                Platform|All
                     URL|
              OS/Version|All
                  Status|UNCONFIRMED
       Status whiteboard|
                Keywords|
              Resolution|
              Issue type|DEFECT
                Priority|P3
            Subcomponent|code
             Assigned to|mru
             Reported by|hgkamath





------- Additional comments from [EMAIL PROTECTED] Sun Mar 18 03:37:07 +0000 
2007 -------
This bug describes a performance penalty that is incurred 
after using a macro to convert some text into a formula after 
20 times. 

Add the below procedure to your standard macros
* Start Openoffice writer
* Goto Tools->Macros->Organize-Macros->OpenofficeBasic
* Goto My Macros->Standard->Module1
* Click Edit
* Copy paste the below Procedure to this module

Assign a shortcut to this procedure
(don't remember exact sequence here but you get the idea)
* Goto Tools->Customize->Keyboard
* Navigate to Category(Openoffice.org macros), user->standard->module1
* Select Function Convert_to_Formula_Object
* Click into Keys, and press control-G
* click modify to set Ctrl-G to this action
* Click ok to exit 

* Now the attached document in Openoffice writer.
* Goto the end of the paragraph 
* Press Control-G 20 times (give a slight pause (fraction of a second, this
   is acceptable) for the macro to do its job)
  Notice the marked text getting converted to formula
* At the 21st pressing, There is a longer pause than usual.
  Sometimes this pause can be very **painful** to wait.
  In this particular case of issue reproduction it seems trivial.

* If you click on the left undo down-arrow,
  you can see twenty "Changestyle: Objects#" entries
****>>>>
 Basically, the software was applying for some strange reason, a changestyle
 for all twenty previously created objects, and hence the additional delay.
****>>>>

The delay increases for further formula objects created this way.


sub Convert_to_Formula_Object
rem ----------------------------------------------------------------------
rem Description This procedure converts a length of text between 
rem two delimiters into a formula object
rem Author: Ganapathi Kamath (2007)
rem define variables
dim oDoc as object
dim oText as object
dim oTextCursor as object
dim oViewCursor as object
dim TEObj as object
dim ostring1 as string
dim ostring2 as string
rem ----------------------------------------------------------------------
        oDoc = ThisComponent
        oText = oDoc.Text
        oDescriptor = oDoc.createSearchDescriptor()
        oViewCursor = oDoc.getCurrentController().getViewCursor()
        oTextCursor = oText.createTextCursorByRange(oViewCursor.getStart())
        oDescriptor.SearchRegularExpression = true
        oDescriptor.SearchBackwards = true
        oDescriptor.SearchString="\$fm(.*)fm\$"
        oTextCursor = oDoc.FindNext(oTextCursor.getStart,oDescriptor)
        ostring1=oTextCursor.getString()
        TEObj = oDoc.createInstance("com.sun.star.text.TextEmbeddedObject")
        TEObj.setPropertyValue("CLSID", "078B7ABA-54FC-457F-8551-6147e776a997")
        TEObj.setPropertyValue("AnchorType",
com.sun.star.text.TextContentAnchorType.AS_CHARACTER)
        ostring2=Mid$(ostring1,4,len(ostring1)-6)
        xText = oDoc.getText()
        xText.insertTextContent(oTextCursor, TEObj, true )
        
        math = TEObj.getEmbeddedObject()
        math.setPropertyValue("Formula", ostring2)
end sub



extra comments:
You may have to first figure out if this is a Math problem or a Writer problem.
I can't ascertain that.

Sometimes I think this performance penalty becomes so bad that one has to wait 
for a minute or more before one can resume editing.  I also believe, though
cannot confirm, that this may be related to other problems like sudden crashes,
through race conditions, which I am unable to arrive a definitive 
reproduction sequence.

Seen in Openoffice 2.1 (release) on WinXP

---------------------------------------------------------------------
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to