Difference between revisions of "Documentation/DevGuide/Drawings/Ordering"

From Apache OpenOffice Wiki
Jump to: navigation, search
m (Robot: Changing Category:Drawing Documents and Presentation Documents)
m
 
(2 intermediate revisions by 2 users not shown)
Line 7: Line 7:
 
|NextPage=Documentation/DevGuide/Drawings/Grouping, Combining and Binding
 
|NextPage=Documentation/DevGuide/Drawings/Grouping, Combining and Binding
 
}}
 
}}
{{DISPLAYTITLE:Ordering}}
+
{{Documentation/DevGuideLanguages|Documentation/DevGuide/Drawings/{{SUBPAGENAME}}}}
 +
{{DISPLAYTITLE:Ordering}}
 
The property <code>ZOrder</code> of the <idl>com.sun.star.drawing.Shape</idl> service defines the order a shape is drawn. That is, if there are many shapes on a page, the shape that has the lowest <code>ZOrder</code> value is drawn first, and the shape that has the highest <code>ZOrder</code> 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:  
 
The property <code>ZOrder</code> of the <idl>com.sun.star.drawing.Shape</idl> service defines the order a shape is drawn. That is, if there are many shapes on a page, the shape that has the lowest <code>ZOrder</code> value is drawn first, and the shape that has the highest <code>ZOrder</code> 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:  
 
<!--[SOURCE:Drawing/ChangeOrderDemo.java]-->
 
<!--[SOURCE:Drawing/ChangeOrderDemo.java]-->
 
+
<syntaxhighlight lang="java">
 
   XPropertySet xPropSet1 = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, xShape1);
 
   XPropertySet xPropSet1 = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, xShape1);
 
   XPropertySet xPropSet2 = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, xShape2);
 
   XPropertySet xPropSet2 = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, xShape2);
Line 19: Line 20:
 
   xPropSet1.setPropertyValue("ZOrder", new Integer(nOrderOfShape2));
 
   xPropSet1.setPropertyValue("ZOrder", new Integer(nOrderOfShape2));
 
   xPropSet2.setPropertyValue("ZOrder", new Integer(nOrderOfShape1));
 
   xPropSet2.setPropertyValue("ZOrder", new Integer(nOrderOfShape1));
 
+
</syntaxhighlight>
 
{{PDL1}}
 
{{PDL1}}
  
 
[[Category:Documentation/Developer's Guide/Drawing Documents and Presentation Documents]]
 
[[Category:Documentation/Developer's Guide/Drawing Documents and Presentation Documents]]

Latest revision as of 14:27, 20 December 2020



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