Class ImpressPage

class ooodev.draw.ImpressPage(owner, component, lo_inst=None)[source]

Bases: DrawPage[_T], Generic[_T]

Represents an Impress page.

class ContainerListener(form_name, cp, lo_inst, subscriber=None)

Bases: Base, XContainerListener

Parameters:
  • args (Any) –

  • kwargs (Any) –

Return type:

Any

__init__(form_name, cp, lo_inst, subscriber=None)
Parameters:
Return type:

None

disposing(event)

Gets called when the broadcaster is about to be disposed.

All listeners and all other objects, which reference the broadcaster should release the reference to the source. No method should be invoked anymore on this object ( including XComponent.removeEventListener() ).

This method is called for every listener registration of derived listener interfaced, not only for registrations at XComponent.

Return type:

None

Parameters:

event (com.sun.star.lang.EventObject) –

elementInserted(event)

Event is invoked when a container has inserted an element.

Return type:

None

Parameters:

event (com.sun.star.container.ContainerEvent) –

elementRemoved(event)

Event is invoked when a container has removed an element.

Return type:

None

Parameters:

event (com.sun.star.container.ContainerEvent) –

elementReplaced(event)

Event is invoked when a container has replaced an element.

Return type:

None

Parameters:

event (com.sun.star.container.ContainerEvent) –

getImplementationId()
getTypes()
is_element_monitored_form(element)
Return type:

bool

Parameters:

element (Any) –

reset()
Return type:

None

property lo_inst: LoInst
Return type:

LoInst

__init__(owner, component, lo_inst=None)[source]

Constructor.

Parameters:
  • lo_inst (LoInst, optional) – Lo instance.

  • owner (_T) –

  • component (XDrawPage) –

Return type:

None

add(shape)

Adds a shape to the collection.

Parameters:

shape (XShape) – The shape to add.

Return type:

None

add_bottom(shape)

Adds a shape to the bottom of the stack.

Parameters:

shape (XShape) – The shape to add.

Return type:

None

add_bullet(bulls_txt, level, text)

Add bullet text to the end of the bullets text area, specifying the nesting of the bullet using a numbering level value (numbering starts at 0).

Parameters:
  • bulls_txt (XText) – Text object

  • level (int) – Bullet Level

  • text (str) – Bullet Text

Raises:

DrawError – If error adding bullet.

Return type:

None

add_connector(shape1, shape2, start_conn=None, end_conn=None)

Add connector

Parameters:
  • shape1 (XShape) – First Shape to add connector to.

  • shape2 (XShape) – Second Shape to add connector to.

  • start_conn (GluePointsKind | None, optional) – Start connector kind. Defaults to right.

  • end_conn (GluePointsKind | None, optional) – End connector kind. Defaults to left.

Raises:

ShapeError – If error occurs.

Returns:

Connector Shape.

Return type:

XShape

Note

Properties for shape can be added or changed by using set_shape_props().

For instance the default value is EndShape=ConnectorType.STANDARD. This could be changed.

Draw.set_shape_props(shape, EndShape=ConnectorType.CURVE)
add_dispatch_shape(shape_dispatch, x, y, width, height, fn)

Adds a shape to a Draw slide via a dispatch command

Parameters:
  • shape_dispatch (ShapeDispatchKind | str) – Dispatch Command

  • x (int, UnitT) – Shape X position in mm units or UnitT.

  • y (int, UnitT) – Shape Y position in mm units or UnitT

  • width (int, UnitT) – Shape width in mm units or UnitT

  • height (int, UnitT) – Shape height in mm units or UnitT

  • fn (DispatchShape) – Function that is responsible for running the dispatch command and returning the shape.

Raises:
Returns:

Shape

Return type:

XShape

See also

DispatchShape

add_event_observers(*args)

Adds observers that gets their trigger method called when this class trigger method is called.

Parameters:

args (EventObserver) – One or more observers to add.

Return type:

None

Note

Observers are removed automatically when they are out of scope.

add_event_property_change(name, cb)

Adds a listener for an event.

Event is invoked when property is changed.

The callback EventArgs.event_data will contain a com.sun.star.beans.PropertyChangeEvent struct.

Parameters:
  • name (str) – Property Name

  • cb (EventArgsCallbackT) – Callback

Return type:

None

add_event_property_change_events_disposing(name, cb)

Adds a listener for an event.

Event is invoked when the property listener is about to be disposed.

The callback EventArgs.event_data will contain a UNO com.sun.star.lang.EventObject struct.

Parameters:
  • name (str) – Property Name

  • cb (EventArgsCallbackT) – Callback

Return type:

None

add_event_vetoable_change(name, cb)

Adds a listener for an event.

Event is invoked when property is changed.

The callback EventArgs.event_data will contain a com.sun.star.beans.PropertyChangeEvent struct.

Parameters:
  • name (str) – Property Name

  • cb (EventArgsCallbackT) – Callback

Return type:

None

add_event_vetoable_change_events_disposing(name, cb)

Adds a listener for an event.

Event is invoked when the property listener is about to be disposed.

The callback EventArgs.event_data will contain a UNO com.sun.star.lang.EventObject struct.

Parameters:
  • name (str) – Property Name

  • cb (EventArgsCallbackT) – Callback

Return type:

None

add_pres_shape(shape_type, x, y, width, height)

Creates a shape from the “com.sun.star.presentation” package:

Parameters:
  • shape_type (PresentationKind) – Kind of presentation package to create.

  • x (int, UnitT) – Shape X position in mm units or UnitT.

  • y (int, UnitT) – Shape Y position in mm units or UnitT.

  • width (int, UnitT) – Shape width in mm units or UnitT.

  • height (int, UnitT) – Shape height in mm units or UnitT.

Raises:

ShapeError – If error occurs.

Returns:

Presentation Shape.

Return type:

XShape

add_shape(shape_type, x, y, width, height)

Adds a shape to a slide.

Parameters:
  • shape_type (DrawingShapeKind | str) – Shape type.

  • x (int, UnitT) – Shape X position in mm units or UnitT.

  • y (int, UnitT) – Shape Y position in mm units or UnitT.

  • width (int, UnitT) – Shape width in mm units or UnitT.

  • height (int, UnitT) – Shape height in mm units or UnitT.

Raises:

ShapeError – If error occurs.

Returns:

Newly added Shape.

Return type:

XShape

Note

If x or y is negative or 0 then the shape position will not be set. If width or height is negative or 0 then the shape size will not be set.

Changed in version 0.17.14: Now does not set size and/or position unless the values are greater than 0.

add_slide_number()

Adds slide number to a slide

Parameters:

slide (XDrawPage) – Slide

Raises:

ShapeError – If error occurs.

Returns:

Slide number shape.

Return type:

DrawShape

add_top(shape)

Adds a shape to the top of the stack.

Parameters:

shape (XShape) – The shape to add.

Return type:

None

apply_styles(*styles, **kwargs)

Applies style to component.

Parameters:
  • obj. (styles expandable list of styles object such as Font to apply to) –

  • kwargs (Any, optional) – Expandable list of key value pairs.

  • styles (StyleT) –

Return type:

None

blank_slide()

Inserts a blank slide

Parameters:

slide (XDrawPage) – Slide

Raises:

DrawError – If error occurs

Return type:

None

bullets_slide(title)

Add text to the slide page by treating it as a bullet page, which has two text shapes: one for the title, the other for a sequence of bullet points; add the title text but return a reference to the bullet text area

Parameters:
  • slide (XDrawPage) – Slide

  • title (str) – Title

Raises:

DrawError – If error setting slide.

Returns:

Text Object

Return type:

DrawText

copy_shape(old_shape)

Copies a shape

Parameters:

old_shape (XShape) – Old Shape

Raises:

ShapeError – If unable to copy shape.

Returns:

Newly Copied shape.

Return type:

DrawShape

copy_shape_contents(old_shape)

Copies a shapes contents from old shape into new shape.

Parameters:

old_shape (XShape) – Old shape

Raises:

ShapeError – If unable to copy shape contents.

Returns:

New shape with contents of old shape copied.

Return type:

DrawShape

draw_bezier_closed(pts, flags)

Draws a bezier curve.

Parameters:
  • pts (Sequence[Point]) – Points

  • flags (Sequence[PolygonFlags]) – Flags

Raises:
  • IndexError – If pts and flags do not have the same number of elements.

  • ShapeError – If unable to create Bezier Shape.

Returns:

Bezier Shape.

Return type:

ClosedBezierShape

draw_bezier_open(pts, flags)

Draws a bezier curve.

Parameters:
  • pts (Sequence[Point]) – Points

  • flags (Sequence[PolygonFlags]) – Flags

Raises:
  • IndexError – If pts and flags do not have the same number of elements.

  • ShapeError – If unable to create Bezier Shape.

Returns:

Bezier Shape.

Return type:

OpenBezierShape

draw_circle(x, y, radius)

Gets a circle

Parameters:
  • x (int, UnitT) – Shape X position in mm units or UnitT.

  • y (int, UnitT) – Shape Y position in mm units or UnitT.

  • radius (int, UnitT) – Shape radius in mm units or UnitT.

Raises:

ShapeError – If error occurs.

Returns:

Circle Shape.

Return type:

EllipseShape

draw_ellipse(x, y, width, height)

Gets an ellipse

Parameters:
  • x (int, UnitT) – Shape X position in mm units or UnitT.

  • y (int, UnitT) – Shape Y position in mm units or UnitT.

  • width (int, UnitT) – Shape width in mm units or UnitT.

  • height (int, UnitT) – Shape height in mm units or UnitT.

Raises:

ShapeError – If error occurs.

Returns:

Ellipse Shape.

Return type:

EllipseShape

draw_formula(formula, x, y, width, height)

Draws a formula

Parameters:
  • slide (XDrawPage) – Slide

  • formula (str) – Formula as string to draw/

  • x (int, UnitT) – Shape X position in mm units or UnitT.

  • y (int, , UnitT) – Shape Y position in mm units or UnitT

  • width (int, , UnitT) – Shape width in mm units or UnitT

  • height (int, , UnitT) – Shape height in mm units or UnitT

Raises:

ShapeError – If error occurs.

Returns:

Formula Shape.

Return type:

XShape

Note

If x or y is negative or 0 then the shape position will not be set. If width or height is negative or 0 then the shape size will not be set.

Changed in version 0.17.14: Now does not set size and/or position unless the values are greater than 0.

draw_image(*args, **kwargs)

Draws an image.

Parameters:
  • fnm (PathOrStr) – Path to image

  • x (int, UnitT) – Shape X position in mm units or UnitT.

  • y (int, UnitT) – Shape Y position in mm units or UnitT.

  • width (int, UnitT) – Shape width in mm units or UnitT.

  • height (int, UnitT) – Shape height in mm units or UnitT.

Raises:

ShapeError – If error occurs.

Returns:

Shape

Return type:

GraphicObjectShape

draw_image_offset(fnm, xoffset, yoffset)

Insert the specified picture onto the slide page in the doc presentation document. Use the supplied (x, y) offsets to locate the top-left of the image.

Parameters:
  • slide (XDrawPage) – Slide

  • fnm (PathOrStr) – Path to image.

  • xoffset (ImageOffset, float) – X Offset with value between 0.0 and 1.0

  • yoffset (ImageOffset, float) – Y Offset with value between 0.0 and 1.0

Returns:

Shape on success, None otherwise.

Return type:

GraphicObjectShape | None

draw_line(x1, y1, x2, y2)

Draws a line.

Parameters:
  • x1 (int, UnitT) – Line start X position in mm units or UnitT.

  • y1 (int, UnitT) – Line start Y position mm units or UnitT.

  • x2 (int, UnitT) – Line end X position mm units or UnitT.

  • y2 (int, UnitT) – Line end Y position mm units or UnitT.

Raises:
  • ValueError – If x values and y values are a point and not a line.

  • ShapeError – If unable to create Line.

Returns:

Line Shape.

Return type:

LineShape

draw_lines(xs, ys)

Draw lines

Parameters:
  • xs (Sequence[Union[int, UnitT]) – Sequence of X positions in mm units or UnitT.

  • ys (Sequence[Union[int, UnitT]) – Sequence of Y positions in mm units or UnitT.

Raises:
  • IndexError – If xs and xy do not have the same number of elements.

  • ShapeError – If any other error occurs.

Returns:

Lines Shape.

Return type:

PolyLineShape

Note

The number of points must be the same for both xs and ys.

draw_media(fnm, x, y, width, height)

Draws media.

Parameters:
  • fnm (PathOrStr) – Path to Media file.

  • x (int, UnitT) – Shape X position in mm units or UnitT.

  • y (int, UnitT) – Shape Y position in mm units or UnitT.

  • width (int, UnitT) – Shape width in mm units or UnitT.

  • height (int, UnitT) – Shape height in mm units or UnitT.

Raises:

ShapeError – If error occurs.

Returns:

Media shape.

Return type:

XShape

Note

If x or y is negative or 0 then the shape position will not be set. If width or height is negative or 0 then the shape size will not be set.

Changed in version 0.17.14: Now does not set size and/or position unless the values are greater than 0.

draw_polar_line(x, y, degrees, distance)

Draw a line from x, y in the direction of degrees, for the specified distance degrees is measured clockwise from x-axis

Parameters:
  • x (int, UnitT) – Shape X position in mm units or UnitT.

  • y (int, UnitT) – Shape Y position in mm units or UnitT.

  • degrees (int) – Direction of degrees

  • distance (int, UnitT) – Distance of line in mm units or UnitT..

Raises:

ShapeError – If unable to create Polar Line Shape.

Returns:

Polar Line Shape.

Return type:

LineShape

draw_polygon(x, y, sides, radius=20)

Gets a polygon.

Parameters:
  • x (int, UnitT) – Shape X position in mm units or UnitT.

  • y (int, UnitT) – Shape Y position in mm units or UnitT.

  • sides (PolySides | int) – Polygon Sides value from 3 to 30.

  • radius (int, optional) – Shape radius in mm units. Defaults to the value of draw.Draw.POLY_RADIUS.

Raises:

ShapeError – If error occurs.

Returns:

Polygon Shape.

Return type:

PolyPolygonShape

draw_rectangle(x, y, width, height)

Gets a rectangle.

Parameters:
  • x (int, UnitT) – Shape X position in mm units or UnitT.

  • y (int, UnitT) – Shape Y position in mm units or UnitT.

  • width (int, UnitT) – Shape width in mm units or UnitT.

  • height (int, UnitT) – Shape height in mm units or UnitT.

Raises:

ShapeError – If error occurs.

Returns:

Rectangle Shape.

Return type:

RectangleShape

Note

If x or y is negative or 0 then the shape position will not be set. If width or height is negative or 0 then the shape size will not be set.

Changed in version 0.17.14: Now does not set size and/or position unless the values are greater than 0.

draw_text(msg, x, y, width, height, font_size=0)

Draws Text.

Parameters:
  • slide (XDrawPage) – Slide.

  • msg (str) – Text to draw.

  • x (int, UnitT) – Shape X position in mm units or UnitT.

  • y (int, UnitT) – Shape Y position in mm units or UnitT.

  • width (int, UnitT) – Shape width in mm units or UnitT.

  • height (int, UnitT) – Shape height in mm units or UnitT.

  • font_size (float, UnitT, optional) – Font size of text in Points or UnitT.

Raises:

ShapeError – If error occurs.

Returns:

Shape

Return type:

TextShape

Note

If x or y is negative or 0 then the shape position will not be set. If width or height is negative or 0 then the shape size will not be set.

Changed in version 0.17.14: Now does not set size and/or position unless the values are greater than 0.

export_page_jpg(fnm='', resolution=96)

Exports page as jpg image.

Parameters:
  • fnm (PathOrStr, optional) – Image file name.

  • resolution (int, optional) – Resolution in dpi. Defaults to 96.

Events:
Return type:

None

Note

On exporting event is Class CancelEventArgsExport. On exported event is Class EventArgsExport. Args event_data is a ExportJpgT dictionary.

Unlike exporting png, exporting jpg does not seem to have a limit on the image size.

Page margins are ignored. Any shape that is outside the page margins will not be included in the image.

export_page_png(fnm='', resolution=96)

Exports page as png image.

Parameters:
  • fnm (PathOrStr, optional) – Image file name.

  • resolution (int, optional) – Resolution in dpi. Defaults to 96.

Events:
Return type:

None

Note

On exporting event is Class CancelEventArgsExport. On exported event is Class EventArgsExport. Args event_data is a ExportPngT dictionary.

Image width or height past 4096 pixels seem to not render the correct size when transparency is set to true (default). For a 8.5 in x 11 in document this is a resolution around 423 DPI. It seems when transparency is set to false, the image size is correct for larger images. Unlike exporting png, exporting jpg does not seem to have a limit on the image size.

Page margins are ignored. Any shape that is outside the page margins will not be included in the image.

find_biggest_zorder()

Finds the shape with the largest z-order.

Raises:

DrawError – If unable to find biggest z-order.

Returns:

Z-Order

Return type:

int

find_shape_at_position(x, y)

Finds a shape at a given position.

Parameters:
  • x (int) – X position.

  • y (int) – Y position.

Raises:
Returns:

Shape if Found; Otherwise, None.

Return type:

ShapeBase[Any] | None

find_shape_at_position_size(x, y, width, height)

Finds a shape at a given position with a given size.

Parameters:
  • x (int) – X position.

  • y (int) – Y position.

  • width (int) – width of the shape.

  • height (int) – height of the shape.

Raises:
Returns:

Shape if Found; Otherwise, None.

Return type:

ShapeBase[Any] | None

find_shape_by_name(shape_name)

Finds a shape by its name.

Parameters:

shape_name (str) – Shape Name.

Raises:
Returns:

Shape.

Return type:

DrawShape

find_shape_by_type(shape_type)

Finds a shape by its type

Parameters:

shape_type (DrawingNameSpaceKind | str) – Shape Type

Raises:
Returns:

Shape

Return type:

DrawShape

find_top_shape()

Gets the top most shape of a slide.

Raises:
Returns:

Top most shape.

Return type:

DrawShape

get_animation_node()

Gets Animation Node

Parameters:

slide (XDrawPage) – Slide

Raises:

DrawPageError – If error occurs.

Returns:

Animation Node

Return type:

XAnimationNode

get_by_index(idx)

Gets the element at the specified index.

Parameters:

idx (int) – The Zero-based index of the element.

Returns:

The element at the specified index.

Return type:

Any

get_chart_shape(x, y, width, height)

Gets a chart shape.

Parameters:
  • x (int, UnitT) – Shape X position in mm units or UnitT.

  • y (int, UnitT) – Shape Y position in mm units or UnitT.

  • width (int, UnitT) – Shape width in mm units or UnitT.

  • height (int, UnitT) – Shape height in mm units or UnitT.

Raises:

ShapeError – If Error occurs.

Returns:

Chart Shape.

Return type:

OLE2Shape

get_count()

Gets the number of elements contained in the container.

Returns:

The number of elements.

Return type:

int

get_custom_properties()

Gets custom properties.

Returns:

custom properties.

Return type:

DotDict

Hint

DotDict is a class that allows you to access dictionary keys as attributes or keys. DotDict can be imported from ooodev.utils.helper.dot_dict.DotDict.

get_custom_property(name, default=<object object>)

Gets a custom property.

Parameters:
  • name (str) – The name of the property.

  • default (Any, optional) – The default value to return if the property does not exist.

Raises:

AttributeError – If the property is not found.

Returns:

The value of the property.

Return type:

Any

get_element_type()

Gets the type of the elements contained in the container.

Returns:

The type of the elements. None means that it is a multi-type container and you cannot determine the exact types with this interface.

Return type:

Any

get_fill_color()

Gets the fill color of a shape.

Parameters:

shape (XShape) – Shape

Raises:

ColorError – If error occurs.

Returns:

Color

Return type:

Color

get_form_container()

Gets form container. The first form in slide is returned if found.

Raises:

DrawError – If error occurs.

Returns:

Form Container on success, None otherwise.

Return type:

IndexContainerComp | None

get_glue_points()

Gets Glue Points

Parameters:

shape (XShape) – Shape

Raises:

DrawError – If error occurs

Returns:

Glue Points.

Return type:

Tuple[GluePoint2, …]

Note

If a glue point can not be accessed then it is ignored.

get_line_color()

Gets the line color of a shape.

Raises:

ColorError – If error occurs.

Returns:

Color

Return type:

Color

get_line_thickness()

Gets line thickness of a shape.

Returns:

Line Thickness on success; Otherwise, 0.

Return type:

int

get_master_page()[source]

Gets master page

Raises:

DrawError – If error occurs.

Returns:

Master Page.

Return type:

ImpressPage

get_name()

Gets the name of the slide.

Raises:

DrawError – If error occurs setting name.

Returns:

Slide name.

Return type:

str

New in version 0.17.13.

get_notes_page()[source]

Gets the notes page of a slide.

Each draw page has a notes page.

Raises:
Returns:

Notes Page.

Return type:

ImpressPage

get_ordered_shapes()

Gets ordered shapes

Returns:

List of Ordered Shapes.

Return type:

List[DrawShape[_T]]

See also

get_shapes()

get_property(name, default=<object object>)

Get property value

Parameters:
  • name (str) – Property Name.

  • default (Any, optional) – Return value if property value is None.

Returns:

Property value or default.

Return type:

Any

get_services()

Gets service names for the instance.

Returns:

service names

Return type:

List[str]

get_shape_text()

Gets the text from inside a shape.

Raises:

DrawError – If error occurs getting shape text.

Returns:

Shape text

Return type:

str

get_shapes()

Gets shapes

Returns:

List of Shapes.

Return type:

List[ShapeBase[_T]]

get_shapes_collection()
Return type:

ShapeCollection

get_size_mm()

Gets size of the given slide page (in mm units)

Raises:

SizeError – If unable to get size.

Returns:

Size struct.

Return type:

Size

get_slide_number()

Gets slide number.

Raises:

DrawError – If error occurs.

Returns:

Slide Number.

Return type:

int

get_slide_title()

Gets slide title if it exist.

Raises:

DrawError – If error occurs.

Returns:

Slide Title on success; Otherwise, None.

Return type:

str | None

goto_page()

Go to page represented by this object.

Raises:

DrawError – If error occurs.

Return type:

None

group(shapes)

Groups shapes.

Parameters:

shapes (ShapeCollection) – Shapes to group.

Returns:

Grouped shapes.

Return type:

GroupShape

has_custom_property(name)

Gets if a custom property exists.

Parameters:

name (str) – The name of the property to check.

Returns:

True if the property exists, otherwise False.

Return type:

bool

has_elements()

Determines whether the container has elements.

Return type:

bool

is_know_shape(shape)

Checks if a shape is known by this factory.

Parameters:

shape (XShape) – UNO object of a shape.

Returns:

True if shape is known; Otherwise, False.

Return type:

bool

move_to_bottom(shape)

Moves a shape to the bottom of the z-order

Parameters:

shape (XShape) – Shape

Raises:
Return type:

None

move_to_top(shape)

Moves a shape to the top of the z-order

Parameters:

shape (XShape) – Shape

Raises:
Return type:

None

qi(atype, raise_err=False)

Generic method that get an interface instance from an object.

Parameters:
  • atype (T) – Interface type to query obj for. Any Uno class that starts with ‘X’ such as XInterface

  • raise_err (bool, optional) – If True then raises MissingInterfaceError if result is None. Default False

Raises:

MissingInterfaceError – If ‘raise_err’ is ‘True’ and result is None

Returns:

instance of interface if supported; Otherwise, None

Return type:

T | None

Note

When raise_err=True return value will never be None.

remove(shape)

Removes a shape from the collection.

Parameters:

shape (XShape) – The shape to remove.

Return type:

None

remove_custom_property(name)

Removes a custom property.

Parameters:

name (str) – The name of the property to remove.

Raises:

AttributeError – If the property is a forbidden key.

Return type:

None

remove_event_observer(observer)

Removes an observer

Parameters:

observer (EventObserver) – One or more observers to add.

Returns:

True if observer has been removed; Otherwise, False.

Return type:

bool

remove_event_property_change(name)

Removes a listener for an event

Parameters:

name (str) – Property Name

Return type:

None

remove_event_property_change_events_disposing(name)

Removes a listener for an event

Parameters:

name (str) – Property Name

Return type:

None

remove_event_vetoable_change(name)

Removes a listener for an event

Parameters:

name (str) – Property Name

Return type:

None

remove_event_vetoable_change_events_disposing(name)

Removes a listener for an event

Parameters:

name (str) – Property Name

Return type:

None

remove_master_page()[source]

Removes this page as a master page.

Raises:

DrawError – If unable to remove master page.

Return type:

None

save_page(fnm, mime_type, filter_data=None)

Saves a Draw page to file.

Parameters:
  • fnm (PathOrStr) – Path to save page as

  • mime_type (str) – Mime Type of page to save as such as image/jpeg or image/png.

  • filter_data (dict, optional) – Filter data. Defaults to None.

Raises:

DrawError – If error occurs.

Return type:

None

Changed in version 0.21.3: Added filter_data parameter.

set_custom_properties(properties)

Sets custom properties.

Parameters:

properties (DotDict) – custom properties to set.

Return type:

None

Hint

DotDict is a class that allows you to access dictionary keys as attributes or keys. DotDict can be imported from ooodev.utils.helper.dot_dict.DotDict.

Return type:

None

Parameters:

properties (DotDict) –

set_custom_property(name, value)

Sets a custom property.

Parameters:
  • name (str) – The name of the property.

  • value (Any) – The value of the property.

Raises:

AttributeError – If the property is a forbidden key.

Sets master footer text.

Parameters:

text (str) – Footer text.

Raises:
Return type:

None

set_master_page(page)[source]

Sets The master page.

Parameters:

page (XDrawPage) – Page to set as master.

Raises:

DrawError – If unable to remove master page.

Return type:

None

set_name(name)

Sets the name of a slide.

Parameters:

name (str) – Name.

Raises:

DrawError – If error occurs setting name.

Return type:

None

set_property(**kwargs)

Set property value

Parameters:

**kwargs (Any) – Variable length Key value pairs used to set properties.

Return type:

None

set_transition(fade_effect, speed, change, duration)

Sets the transition for a slide.

Parameters:
  • slide (XDrawPage) – Slide

  • fade_effect (FadeEffect) – Fade Effect

  • speed (AnimationSpeed) – Animation Speed

  • change (SlideShowKind) – Slide show kind

  • duration (int) – Duration of slide. Only used when change=SlideShowKind.AUTO_CHANGE

Raises:

DrawPageError – If error occurs.

Return type:

None

shape_factory(shape)

Gets a ShapeBase object from a XShape object.

Parameters:

shape (XShape) – UNO object of a shape.

Raises:

ValueError – If shape does not have ShapeType property.

Returns:

Object the inherits from ShapeBase such as RectangleShape or EllipseShape. If ShapeType of shape is not a match then DrawShape[_T] is returned.

Return type:

ShapeBase[_T]

sort(sort_order)

Sort shapes according to given sort order, for perf reason just rearrange and don’t broadcast.

Parameters:
  • comparator (Any) – Desired order of the shapes

  • sort_order (Tuple[int, ...]) –

Return type:

None

subscribe_event(event_name, callback)

Add an event listener to current instance.

Parameters:
  • event_name (str) – Event Name.

  • callback (EventCallback) – Callback of the event listener.

Return type:

None

support_service(*service)

Gets if instance supports a service.

Parameters:

*service (str) – Variable length argument list of UNO namespace strings such as com.sun.star.configuration.GroupAccess

Returns:

True if instance supports any passed in service; Otherwise, False

Return type:

bool

title_only_slide(header)[source]

Creates a slide with only a title.

Parameters:
  • slide (XDrawPage) – Slide.

  • header (str) – Header text.

Raises:

DrawError – If error occurs.

Return type:

None

title_slide(title, sub_title='')[source]

Set a slides title and sub title.

Parameters:
  • title (str) – Title.

  • sub_title (str) – Sub Title.

Raises:

DrawError – If error setting Slide.

Return type:

None

trigger_event(event_name, event_args)

Trigger an event on current instance.

Parameters:
  • event_name (str) – Event Name.

  • event_args (EventArgsT) – Event Args.

Return type:

None

ungroup(shape)

Un-groups the given shape.

Parameters:

shape (XShapeGroup) – The shape to ungroup.

Return type:

None

unsubscribe_event(event_name, callback)

Remove an event listener from current instance.

Parameters:
  • event_name (str) – Event Name.

  • callback (EventCallback) – Callback of the event listener.

Return type:

None

property border_bottom: UnitMM

Gets/Sets the bottom border of the draw page.

Return type:

UnitMM

property border_left: UnitMM

Gets/Sets the left border of the draw page.

Return type:

UnitMM

property border_right: UnitMM

Gets/Sets the right border of the draw page.

Return type:

UnitMM

property border_top: UnitMM

Gets/Sets the top border of the draw page.

Return type:

UnitMM

property component: com.sun.star.drawing.DrawPage

DrawPage Component

Return type:

DrawPage

property event_observer: EventObserver

Gets/Sets The Event Observer for this instance.

Return type:

EventObserver

property extra_data: TheDict

Extra Data Key Value Pair Dictionary.

Properties can be assigned properties and access like a dictionary and with dot notation.

Note

This is a dictionary object that can be used to store key value pairs. Generally speaking this data is not part of the object’s main data structure and is not saved with the object (document).

This property is used to store data that is not part of the object’s main data structure and can be used however the developer sees fit.

Return type:

TheDict

property forms: DrawForms

Gets the forms of the draw page.

Returns:

Forms of the draw page.

Return type:

DrawForms

property height: UnitMM

Gets the height of the draw page.

Return type:

UnitMM

property lo_inst: LoInst

Lo Instance

Return type:

LoInst

property name: str

Gets/Sets the name of the draw page.

Note

Naming for Impress pages seems a little different then Draw pages. Attempting to name a Draw page Slide # where # is a number will fail and Draw will auto name the page. It seems that Slide followed by a space and a number is reserved for Impress.

Return type:

str

property office_doc: OfficeDocumentT

Office Document.

Return type:

OfficeDocumentT

property owner: _T

Component Owner

Return type:

TypeVar(_T, bound= ComponentT)

property width: UnitMM

Gets the width of the draw page.

Return type:

UnitMM