Ordering

From Apache OpenOffice Wiki
< Documentation‎ | DevGuide
Revision as of 14:27, 20 December 2020 by DiGro (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search



The property ZOrder of the com.sun.star.drawing.Shape service defines the order a shape is drawn. That is, if there are many shapes on a page, the shape that has the lowest ZOrder value is drawn first, and the shape that has the highest ZOrder is drawn last. By using this property it is possible to bring an object to the back or front of a page. It is also possible to switch the order of two shapes as demonstrated in the following example:

  XPropertySet xPropSet1 = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, xShape1);
  XPropertySet xPropSet2 = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, xShape2);
  // get current positions
  int nOrderOfShape1 = ((Integer)xPropSet1.getPropertyValue("ZOrder")).intValue();
  int nOrderOfShape2 = ((Integer)xPropSet2.getPropertyValue("ZOrder")).intValue();
  // set new positions
  xPropSet1.setPropertyValue("ZOrder", new Integer(nOrderOfShape2));
  xPropSet2.setPropertyValue("ZOrder", new Integer(nOrderOfShape1));
Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages