incubator-ooo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lou ql <>
Subject [HELP]usage of XIndexReplace.replaceByIndex()?
Date Mon, 27 Aug 2012 08:47:29 GMT
I'm using UNO API to set graphic bullet for a piece of text in SD, the
graphic is from gallery "Bullets".

There are 62 gif graphics in gallery "Bullets", and I set them as the
bullet graphic one by one. Most work fine, but the last 3 gif graphics
fails: the value of GraphicURL is after
"replaceByIndex", but not the value I set.

Then I tried use only the last 4 gif graphics as parameters then run again,
all work...

 setGraphicBullets(String inputUniqueID){
       Object numberingrules =
        XIndexReplace xReplace = (XIndexReplace) UnoRuntime.queryInterface(
                 XIndexReplace.class, numberingrules);

        PropertyValue[] props = new PropertyValue[3];
        props[0] = new PropertyValue();
        props[0].Name = "NumberingType";
        props[0].Value = new Short(NumberingType.BITMAP );

        props[1] = new PropertyValue();
        props[1].Name = "GraphicURL";
        props[1].Value = ""+inputUniqueID;

        props[2] = new PropertyValue();
        props[2].Name = "GraphicSize";
        props[2].Value = new Size(500,500);

//        set numberingType
        xReplace.replaceByIndex(0, props);
*//failure: for the last 3 gifs, after this, I tried to get the GraphicURL
value, it's*

        m_xtextProps.setPropertyValue("NumberingRules", numberingrules);
      //set numbering level to 0
        m_xtextProps.setPropertyValue("NumberingLevel", new

the parameter "inputUniqueID" is the uniqueID of the gallery items in
"Bullets" theme:
String[] getUniqueID()
        Object ogalleryThemeProvider =
        XGalleryThemeProvider xgalleryThemeProvider =

        //get the "Bullets" theme
        Object bulletTheme = xgalleryThemeProvider.getByName("Bullets");
        XGalleryTheme xbulletTheme =
(XGalleryTheme)UnoRuntime.queryInterface(XGalleryTheme.class, bulletTheme);

        //get the items in "Bullets" theme one by one, set as parameter
        int count = xbulletTheme.getCount();
        String[] uniqueID = new String[count];
        for(int i=0; i<count;i++)
//            if(i<58) continue;

            Object galleryItem = xbulletTheme.getByIndex(i);
            XGalleryItem xGalleryItem =
(XGalleryItem)UnoRuntime.queryInterface(XGalleryItem.class, galleryItem);
            XPropertySet galleryItemPro = (XPropertySet)
UnoRuntime.queryInterface(XPropertySet.class, xGalleryItem);
            String URL = (String)galleryItemPro.getPropertyValue("URL");
            Object graphic = galleryItemPro.getPropertyValue("Graphic");

            XGraphic xgraphic =
(XGraphic)UnoRuntime.queryInterface(XGraphic.class, graphic);

            Object graphicObj =
            XGraphicObject xgraphicObj =
(XGraphicObject)UnoRuntime.queryInterface(XGraphicObject.class, graphicObj);

            uniqueID[i] = xgraphicObj.getUniqueID();
       return uniqueID;
Lou QingLe

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message