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:
DrawPageMissingError – If unable to get pages.
DrawPageError – If any other error occurs.
- Returns:
The slide that was inserted at the end of the document.
- Return type:
- 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:
- 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 containingtext_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:
- 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:
- find_master_page(style)[source]
Finds master page
- Parameters:
style (str) – Style of master page
- Raises:
DrawPageMissingError – If unable to match
style
.DrawPageError – if any other error occurs.
- Returns:
Master page as Draw Page if found.
- Return type:
- 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:
DrawError – If unable to get hand-out master page.
DrawPageMissingError – If Draw Page is
None
.
- Returns:
Draw Page
- Return type:
- 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:
DrawPageMissingError – If unable to get master page.
DrawPageError – If any other error occurs.
- Returns:
Master page as Draw Page.
- Return type:
- 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:
See also
- get_ordered_shapes()[source]
Gets ordered shapes
- Returns:
List of Ordered Shapes.
- Return type:
List[ShapeBase[_T]]
See also
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:
- get_shape_factory()[source]
Gets a shape factory that can be used to convert
XShape
toShapeBase
objects.- Returns:
Shape Factory
- Return type:
- 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
See also
- 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
- 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_slides()[source]
Gets the draw pages of a document.
- Raises:
DrawPageMissingError – If there are no draw pages.
DrawPageError – If any other error occurs.
- Returns:
Draw Pages.
- Return type:
- 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:
- 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:
- 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:
DrawPageMissingError – If unable to get pages.
DrawPageError – If any other error occurs.
- Returns:
New slide that was inserted.
- Return type:
- set_visible(visible=True)[source]
Set window visibility.
- Parameters:
visible (bool, optional) – If
True
window is set visible; Otherwise, window is set invisible. DefaultTrue
- Return type:
None