Class DrawDocPartial

class ooodev.draw.partial.draw_doc_partial.DrawDocPartial(owner, component, lo_inst=None)[source]
__init__(owner, component, lo_inst=None)[source]
Parameters:
  • owner (_T) –

  • component (XComponent) –

  • lo_inst (LoInst | None) –

Return type:

None

add_layer(lm, layer_name)[source]

Adds a layer

Parameters:
  • lm (XLayerManager) – Layer Manager

  • layer_name (str) – Layer Name

Raises:

DrawError – If error occurs.

Returns:

Newly added layer.

Return type:

XLayer

add_slide()[source]

Add a slide to the end of the document.

Raises:
Returns:

The slide that was inserted at the end of the document.

Return type:

DrawPage

build_play_list(custom_name, *slide_idxs)[source]

Build a named play list container of slides from doc. The name of the play list is custom_name.

Parameters:
  • custom_name (str) – Name for play list

  • slide_idxs (int) – One or more index’s of existing slides to add to play list.

Raises:

DrawError – If error occurs.

Returns:

Name Container.

Return type:

NameContainerComp

close_doc(deliver_ownership=False)[source]

Closes text document.

Parameters:

deliver_ownership (bool) – True delegates the ownership of this closing object to anyone which throw the CloseVetoException. Default False.

Returns:

False if DOC_CLOSING event is canceled, Other

Return type:

bool

Events:

Note

Event args event_data is a dictionary containing text_doc.

Attention

Lo.close method is called along with any of its events.

combine_shape(shapes, combine_op)[source]

Combines one or more shapes using a dispatch command.

If the owner of this instance is an instance of EventsPartial then the owner will be added as an observer to the dispatch events, for the duration of this method.

Parameters:
  • doc (XComponent) – Document

  • shapes (XShapes) – Shapes to combine

  • combine_op (ShapeCompKind) – Combine Operation.

Raises:

ShapeError – If error occurs.

Returns:

New combined shape.

Return type:

DrawShape

delete_slide(idx)[source]

Deletes a slide

Parameters:

idx (int) – Index

Returns:

True on success; Otherwise, False

Return type:

bool

duplicate(idx)[source]

Duplicates a slide

Parameters:

idx (int) – Index of slide to duplicate.

Raises:

DrawError If unable to create duplicate.

Returns:

Duplicated slide.

Return type:

DrawPage

find_master_page(style)[source]

Finds master page

Parameters:

style (str) – Style of master page

Raises:
Returns:

Master page as Draw Page if found.

Return type:

DrawPage

find_slide_idx_by_name(name)[source]

Gets a slides index by its name

Parameters:

name (str) – Slide Name

Returns:

Zero based index if found; Otherwise -1

Return type:

int

get_controller()[source]

Gets controller from document.

Returns:

Controller.

Return type:

XController

get_handout_master_page()[source]

Gets handout master page

Raises:
Returns:

Draw Page

Return type:

DrawPage

get_layer(layer_name)[source]

Gets layer from layer name

Parameters:

layer_name (str) – Layer Name

Raises:
  • NameError – If layer_name does not exist.

  • DrawError – If unable to get layer

Returns:

Found Layer

Return type:

XLayer

get_layer_manager()[source]

Gets Layer manager for document.

Parameters:

doc (XComponent) – Document

Raises:

DrawError – If error occurs.

Returns:

Layer Manager

Return type:

XLayerManager

get_master_page(idx)[source]

Gets master page by index

Parameters:

idx (int) – Index of master page

Raises:
Returns:

Master page as Draw Page.

Return type:

MasterDrawPage

get_master_page_count()[source]

Gets master page count

Raises:

DrawError – If error occurs.

Returns:

Master Page Count.

Return type:

int

get_notes_page_by_index(idx)[source]

Gets notes page by index.

Each draw page has a notes page.

Parameters:

idx (int) – Index

Raises:

DrawPageError – If error occurs.

Returns:

Notes Page.

Return type:

DrawPage

See also

get_notes_page()

get_ordered_shapes()[source]

Gets ordered shapes

Returns:

List of Ordered Shapes.

Return type:

List[ShapeBase[_T]]

See also

get_shapes()

Note

The Shapes returned from this method will have various properties and methods injected into them based on the UNO services they support.

get_play_list()[source]

Gets Play list

Raises:

DrawError – If error occurs.

Returns:

Name Container

Return type:

NameContainerComp

get_shape_factory()[source]

Gets a shape factory that can be used to convert XShape to ShapeBase objects.

Returns:

Shape Factory

Return type:

ShapeFactory

get_shapes()[source]

Gets shapes

Parameters:

doc (XComponent) – Document

Raises:

DrawError – If error occurs.

Returns:

List of Shapes.

Return type:

List[ShapeBase[_T]]

Note

The Shapes returned from this method will have various properties and methods injected into them based on the UNO services they support.

get_shapes_text()[source]

Gets the text from inside all the document shapes

Returns:

Shapes text.

Return type:

str

get_slide()[source]
get_slide(*, idx: int)
get_slide(*, slides: com.sun.star.drawing.XDrawPages)
get_slide(*, slides: com.sun.star.drawing.XDrawPages, idx: int)
get_slide(**kwargs)

Gets slide

Parameters:
  • slides (XDrawPages) – Draw Pages

  • idx (int) – Index of slide. Default 0

Raises:
  • IndexError – If idx is out of bounds

  • DrawError – If any other error occurs.

Returns:

Slide as Draw Page.

Return type:

DrawPage

get_slide_number(xdraw_view)[source]

Gets slide number.

Parameters:

xdraw_view (XDrawView) – Draw View.

Raises:

DrawError – If error occurs.

Returns:

Slide Number.

Return type:

int

get_slide_size()[source]

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

Raises:

SizeError – If unable to get size.

Returns:

Size struct.

Return type:

Size

get_slides()[source]

Gets the draw pages of a document.

Raises:
Returns:

Draw Pages.

Return type:

DrawPages

get_slides_count()[source]

Gets the slides count.

Returns:

Number of slides.

Return type:

int

get_slides_list()[source]

Gets all the slides as a list of XDrawPage

Returns:

List of pages

Return type:

List[DrawPage[_T]]

get_viewed_page()[source]

Gets viewed page

Raises:

DrawPageError – If error occurs.

Returns:

Draw Page

Return type:

DrawPage

goto_page(page)[source]

Go to page.

Parameters:

page (XDrawPage) – Page.

Raises:

DrawError – If error occurs.

Return type:

None

insert_master_page(idx)[source]

Inserts a master page

Parameters:

idx (int) – Index used to insert page

Raises:

DrawPageError – If unable to insert master page.

Returns:

The newly inserted draw page.

Return type:

MasterDrawPage

insert_slide(idx)[source]

Inserts a slide at the given position in the document

Parameters:

idx (int) – Index, can be a negative value to insert from the end of the document. For example, -1 will insert at the end of the document.

Raises:
Returns:

New slide that was inserted.

Return type:

DrawPage

set_visible(visible=True)[source]

Set window visibility.

Parameters:

visible (bool, optional) – If True window is set visible; Otherwise, window is set invisible. Default True

Return type:

None

zoom(type=ZoomKind.ENTIRE_PAGE)[source]

Zooms document to a specific view.

Parameters:

type (ZoomKind, optional) – Type of Zoom to set. Defaults to ZoomKind.ZOOM_100_PERCENT.

Return type:

None

zoom_value(value=100)[source]

Sets the zoom level of the Document

Parameters:

value (int, optional) – Value to set zoom. e.g. 160 set zoom to 160%. Default 100.

Return type:

None