[Libreoffice-bugs] [Bug 39694] JAVA UNO API: XTextRange.getString returns correct String only after some delay

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Thu Aug 4 02:23:51 PDT 2011


https://bugs.freedesktop.org/show_bug.cgi?id=39694

Juergen Steinhilber <j.steinhilber at rta.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |critical
           Priority|medium                      |high

--- Comment #6 from Juergen Steinhilber <j.steinhilber at rta.de> 2011-08-04 02:23:51 PDT ---
if you do a refresh before enumerating the placeholdernames are all identified
correctly, but it doesn't solve the real problem


        private ArrayList<XTextRange> testePlatzhalter(){
            if(xTextDocument==null){return null;}

            ArrayList<XTextRange> arrayList = new ArrayList<XTextRange>();
             try {
                    XTextFieldsSupplier xTextFieldsSupplier =
(XTextFieldsSupplier)UnoRuntime.queryInterface(XTextFieldsSupplier.class,
xTextDocument);
                    XEnumerationAccess xEnumerationAccess =
xTextFieldsSupplier.getTextFields();
                    //do a refresh() and all Placeholdernames can be found
while hidden=true
                    XRefreshable refresh = null;
                    refresh =
(XRefreshable)UnoRuntime.queryInterface(XRefreshable.class, xTextDocument);
                    refresh.refresh();
                    //but it doesn't solve the real problem which also occurs 
                    //sporadically when printing or closing documents with
hidden=true 
                    XEnumeration xEnumeration =
xEnumerationAccess.createEnumeration();
                    while(xEnumeration.hasMoreElements()) {
                      Object object = xEnumeration.nextElement();
                      XTextField xTextField =
(XTextField)UnoRuntime.queryInterface(XTextField.class, object);
                      XServiceInfo xInfo =
(XServiceInfo)UnoRuntime.queryInterface(XServiceInfo.class, xTextField);
                      XTextRange range = xTextField.getAnchor();
                      //Placehoders only
                     
if(xInfo.supportsService("com.sun.star.text.TextField.JumpEdit") /* || 
                             
xInfo.supportsService("com.sun.star.text.TextField.User")*/){
                        arrayList.add(range);
                      }
                    }
             }catch(Exception exception) {
                 exception.printStackTrace();
             }
             return arrayList;
      }

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the Libreoffice-bugs mailing list