MyScript Interactive Ink SDK  4.0.0
Public Member Functions | List of all members
myscript::iink::Editor Class Referenceabstract

#include <Editor.h>

Public Member Functions

virtual ~Editor ()=default
 
virtual void addListener (std::shared_ptr< IEditorListener > listener) noexcept=0
 
virtual void removeListener (std::shared_ptr< IEditorListener > listener) noexcept=0
 
virtual void setGestureHandler (std::shared_ptr< IGestureHandler > handler)=0
 
virtual void removeGestureHandler ()=0
 
virtual void setFontMetricsProvider (std::shared_ptr< myscript::iink::text::IFontMetricsProvider > fontMetricsProvider) noexcept=0
 
virtual std::shared_ptr< Engine > getEngine () noexcept=0
 
virtual std::shared_ptr< Renderer > getRenderer () noexcept=0
 
virtual std::shared_ptr< PlaceholderController > getPlaceholderController ()=0
 
virtual std::shared_ptr< ToolController > getToolController () noexcept=0
 
virtual std::shared_ptr< MathSolverController > getMathSolverController ()=0
 
virtual std::shared_ptr< ContentPart > getPart () noexcept=0
 
virtual void setPart (std::shared_ptr< ContentPart > part)=0
 
virtual void clear ()=0
 
virtual bool canUndo () noexcept=0
 
virtual void undo ()=0
 
virtual bool canRedo () noexcept=0
 
virtual void redo ()=0
 
virtual int getUndoStackIndex ()=0
 
virtual int getPossibleUndoCount ()=0
 
virtual int getPossibleRedoCount ()=0
 
virtual String getUndoRedoIdAt (int stackIndex)=0
 
virtual String pointerDown (float x, float y, int64_t t, float f, PointerType pointerType, int pointerId)=0
 
virtual String pointerDown (float x, float y, int64_t t, float f, float tilt, float orientation, PointerType pointerType, int pointerId)=0
 
virtual void pointerMove (float x, float y, int64_t t, float f, PointerType pointerType, int pointerId)=0
 
virtual void pointerMove (float x, float y, int64_t t, float f, float tilt, float orientation, PointerType pointerType, int pointerId)=0
 
virtual void pointerUp (float x, float y, int64_t t, float f, PointerType pointerType, int pointerId)=0
 
virtual void pointerUp (float x, float y, int64_t t, float f, float tilt, float orientation, PointerType pointerType, int pointerId)=0
 
virtual void pointerCancel (int pointerId)=0
 
virtual void pointerEvents (const std::vector< PointerEvent > &events, bool processGestures=true)=0
 
virtual void setViewSize (int width, int height)=0
 
virtual int getViewWidth ()=0
 
virtual int getViewHeight ()=0
 
virtual void clampViewOffset (graphics::Point &viewOffset)=0
 
virtual void setTheme (const String &styleSheet)=0
 
virtual String getTheme () const noexcept=0
 
virtual std::shared_ptr< ContentBlock > getRootBlock ()=0
 
virtual std::shared_ptr< ContentBlock > getBlockById (const String &id)=0
 
virtual bool isEmpty (std::shared_ptr< ContentSelection > selection)=0
 
virtual std::vector< String > getSupportedAddBlockTypes () noexcept=0
 
virtual std::vector< MimeType > getSupportedAddBlockDataMimeTypes (const String &type) noexcept=0
 
virtual std::shared_ptr< ContentBlock > addBlock (float x, float y, const String &type)=0
 
virtual std::shared_ptr< ContentBlock > addBlock (float x, float y, const String &type, MimeType mimeType, const String &data)=0
 
virtual std::shared_ptr< ContentBlock > addImage (float x, float y, const String &inputFile, MimeType mimeType)=0
 
virtual void erase (std::shared_ptr< ContentSelection > selection)=0
 
virtual std::shared_ptr< ContentBlock > hitBlock (float x, float y)=0
 
virtual std::vector< ConversionState > getSupportedTargetConversionStates (std::shared_ptr< ContentSelection > selection)=0
 
virtual void convert (std::shared_ptr< ContentSelection > selection, ConversionState targetState)=0
 
virtual std::vector< MimeType > getSupportedExportMimeTypes (std::shared_ptr< ContentSelection > selection)=0
 
virtual String export_ (std::shared_ptr< ContentSelection > selection, MimeType mimeType, std::shared_ptr< ParameterSet > overrideConfiguration=nullptr)=0
 
virtual void export_ (std::shared_ptr< ContentSelection > selection, const String &outputFile, std::shared_ptr< IImagePainter > imagePainter, std::shared_ptr< ParameterSet > overrideConfiguration=nullptr)=0
 
virtual void export_ (std::shared_ptr< ContentSelection > selection, const String &outputFile, MimeType mimeType, std::shared_ptr< IImagePainter > imagePainter, std::shared_ptr< ParameterSet > overrideConfiguration=nullptr)=0
 
virtual std::vector< MimeType > getSupportedImportMimeTypes (std::shared_ptr< ContentSelection > selection)=0
 
virtual void import_ (MimeType mimeType, const String &data, std::shared_ptr< ContentSelection > selection=nullptr, std::shared_ptr< ParameterSet > overrideConfiguration=nullptr)=0
 
virtual void copy (std::shared_ptr< ContentSelection > selection)=0
 
virtual void paste (float x, float y)=0
 
virtual bool isIdle () noexcept=0
 
virtual void waitForIdle () noexcept=0
 
virtual bool isScrollAllowed () noexcept=0
 
virtual std::shared_ptr< Configuration > getConfiguration () noexcept=0
 
virtual void drawStroke (const std::vector< PointerEvent > &events, std::shared_ptr< graphics::ICanvas > canvas)=0
 
virtual bool hasSelection ()=0
 
virtual std::shared_ptr< ContentSelection > getSelection ()=0
 
virtual void setSelection (std::shared_ptr< ContentSelection > selection)=0
 
virtual std::shared_ptr< ContentSelection > hitSelection (float x, float y)=0
 
virtual std::vector< String > getIntersectingBlocks (std::shared_ptr< ContentSelection > selection)=0
 
virtual std::vector< String > getIncludedBlocks (std::shared_ptr< ContentSelection > selection)=0
 
virtual std::underlying_type< TransformError >::type getTransformStatus (std::shared_ptr< ContentSelection > selection, const myscript::iink::graphics::Transform &transform)=0
 
virtual void transform (std::shared_ptr< ContentSelection > selection, const myscript::iink::graphics::Transform &transform)=0
 
virtual void applyStyle (std::shared_ptr< ContentSelection > selection, const String &style)=0
 
virtual std::vector< TextFormat > getSupportedTextFormats (std::shared_ptr< ContentSelection > selection)=0
 
virtual void setTextFormat (std::shared_ptr< ContentSelection > selection, TextFormat format)=0
 
virtual ContentSelectionMode getSelectionMode ()=0
 
virtual void setSelectionMode (ContentSelectionMode mode)=0
 
virtual std::vector< ContentSelectionMode > getAvailableSelectionModes ()=0
 
virtual void setSelectionType (std::shared_ptr< ContentSelection > selection, const String &type, bool forceSingleBlock)=0
 
virtual std::vector< String > getAvailableSelectionTypes (std::shared_ptr< ContentSelection > selection)=0
 
virtual IndentationLevels getIndentationLevels (std::shared_ptr< ContentSelection > selection)=0
 
virtual void indent (std::shared_ptr< ContentSelection > selection, int offset)=0
 
virtual myscript::iink::graphics::Rectangle getBox (std::shared_ptr< ContentSelection > selection)=0
 
virtual std::underlying_type< ConversionState >::type getConversionState (std::shared_ptr< ContentSelection > selection)=0
 

Detailed Description

The Editor is the entry point to modify a part. An editor is associated with a single part.

See also
ContentPart.

Constructor & Destructor Documentation

◆ ~Editor()

virtual myscript::iink::Editor::~Editor ( )
virtualdefault

Member Function Documentation

◆ addListener()

virtual void myscript::iink::Editor::addListener ( std::shared_ptr< IEditorListener >  listener)
pure virtualnoexcept

Adds the specified listener to this editor.

Parameters
listenerthe listener to be added.

◆ removeListener()

virtual void myscript::iink::Editor::removeListener ( std::shared_ptr< IEditorListener >  listener)
pure virtualnoexcept

Removes the specified listener from this editor.

Parameters
listenerthe listener to be removed.

◆ setGestureHandler()

virtual void myscript::iink::Editor::setGestureHandler ( std::shared_ptr< IGestureHandler >  handler)
pure virtual

Registers the specified gesture handler to this editor.

Parameters
handlerthe gesture handler to be used.
Since
2.1

◆ removeGestureHandler()

virtual void myscript::iink::Editor::removeGestureHandler ( )
pure virtual

Removes the gesture handler from this editor, if any.

Since
2.1

◆ setFontMetricsProvider()

virtual void myscript::iink::Editor::setFontMetricsProvider ( std::shared_ptr< myscript::iink::text::IFontMetricsProvider >  fontMetricsProvider)
pure virtualnoexcept

Sets a font metrics provider to this editor.

Parameters
fontMetricsProvidera IFontMetricsProvider.

◆ getEngine()

virtual std::shared_ptr<Engine> myscript::iink::Editor::getEngine ( )
pure virtualnoexcept

Returns the Engine to which this editor is attached.

Returns
the engine.

◆ getRenderer()

virtual std::shared_ptr<Renderer> myscript::iink::Editor::getRenderer ( )
pure virtualnoexcept

Returns the Renderer associated with this editor.

Returns
the renderer.

◆ getPlaceholderController()

virtual std::shared_ptr<PlaceholderController> myscript::iink::Editor::getPlaceholderController ( )
pure virtual

Returns the PlaceholderController attached to this editor.

Returns
the placeholder controller.
Since
3.2

◆ getToolController()

virtual std::shared_ptr<ToolController> myscript::iink::Editor::getToolController ( )
pure virtualnoexcept

Returns the ToolController associated with this editor.

Returns
the tool controller.
Since
2.0

◆ getMathSolverController()

virtual std::shared_ptr<MathSolverController> myscript::iink::Editor::getMathSolverController ( )
pure virtual

Returns the MathSolverController associated with this editor.

Returns
the math solver controller.
Since
4.0

◆ getPart()

virtual std::shared_ptr<ContentPart> myscript::iink::Editor::getPart ( )
pure virtualnoexcept

Returns the part managed by this editor.

Returns
the part.

◆ setPart()

virtual void myscript::iink::Editor::setPart ( std::shared_ptr< ContentPart >  part)
pure virtual

Sets the part managed by this editor.

Parameters
partthe part.
Exceptions
std::runtime_errorwhen no IFontMetricProvider has been set, via setFontMetricsProvider().
std::runtime_errorwhen part is already bound.
std::runtime_errorwhen this editor cannot be configured.

◆ clear()

virtual void myscript::iink::Editor::clear ( )
pure virtual

Removes all content from the part.

Exceptions
pointer_sequence_errorwhen a sequence of pointer events is ongoing.

◆ canUndo()

virtual bool myscript::iink::Editor::canUndo ( )
pure virtualnoexcept

Tells whether undo can be performed on the part or not

Returns
true if undo can be performed, otherwise false.

◆ undo()

virtual void myscript::iink::Editor::undo ( )
pure virtual

Undo the last action on part.

Exceptions
std::runtime_errorwhen undo operations failed.

◆ canRedo()

virtual bool myscript::iink::Editor::canRedo ( )
pure virtualnoexcept

Tells whether redo can be performed on the part or not

Returns
true if redo can be performed, otherwise false.

◆ redo()

virtual void myscript::iink::Editor::redo ( )
pure virtual

Redo the last action reverted by undo on part.

Exceptions
std::runtime_errorwhen redo operations failed.

◆ getUndoStackIndex()

virtual int myscript::iink::Editor::getUndoStackIndex ( )
pure virtual

Returns the number of operations performed on the part, since content part was opened.

Note
the undo stack is partially purged from time to time to control memory consumption. The number of possible undo operations at a given time is provided by getPossibleUndoCount(), while the total number of operations since content part was opened is provided by getUndoStackIndex().
Returns
the number of operations performed on the part.
Exceptions
std::runtime_errorwhen editor is not associated with a part.
Since
1.1

◆ getPossibleUndoCount()

virtual int myscript::iink::Editor::getPossibleUndoCount ( )
pure virtual

Returns the number of operations that can be undone (<= getUndoStackIndex()).

Returns
the number of operations that can be undone.
Exceptions
std::runtime_errorwhen editor is not associated with a part.
Since
1.1

◆ getPossibleRedoCount()

virtual int myscript::iink::Editor::getPossibleRedoCount ( )
pure virtual

Returns the number of operations that can be redone.

Returns
the number of operations that can be redone.
Exceptions
std::runtime_errorwhen editor is not associated with a part.
Since
1.2

◆ getUndoRedoIdAt()

virtual String myscript::iink::Editor::getUndoRedoIdAt ( int  stackIndex)
pure virtual

Returns the id of an undo or redo action, based on its position in the stack index. Valid stack index values range from (current stack index - possible undo count) to (current stack index + possible redo count - 1).

Parameters
stackIndexthe index in the stack of the undo/redo action to retrieve.
Returns
the id of the undo/redo operation at the specific index in the undo/redo stack.
Exceptions
std::runtime_errorwhen editor is not associated with a part.
std::runtime_errorwhen stackIndex is invalid.
Since
1.2

◆ pointerDown() [1/2]

virtual String myscript::iink::Editor::pointerDown ( float  x,
float  y,
int64_t  t,
float  f,
PointerType  pointerType,
int  pointerId 
)
pure virtual

Registers a pointer down event.

Parameters
xpointer event x coordinate (view coordinates in pixel).
ypointer event y coordinate (view coordinates in pixel).
tpointer event timestamp, in ms since Unix EPOCH.
fnormalized pressure, in [0,1].
pointerTypethe type of input.
pointerIdthe id of the pointer.
Returns
the render item identifier of the starting stroke if any, otherwise an empty string.
Exceptions
std::invalid_argumentwhen pointerType is invalid.
std::invalid_argumentwhen x or y is not a number.
std::invalid_argumentwhen t exceeds year 9999.
std::invalid_argumentwhen f is not a number or is negative.
pointer_sequence_errorwhen pointerDown() has already been called.
std::runtime_errorin "Text Document" parts, when no view size is set.

◆ pointerDown() [2/2]

virtual String myscript::iink::Editor::pointerDown ( float  x,
float  y,
int64_t  t,
float  f,
float  tilt,
float  orientation,
PointerType  pointerType,
int  pointerId 
)
pure virtual

Registers a pointer down event.

Parameters
xpointer event x coordinate (view coordinates in pixel).
ypointer event y coordinate (view coordinates in pixel).
tpointer event timestamp, in ms since Unix EPOCH.
fnormalized pressure, in [0,1].
tiltthe tilt in radians. 0 is perpendicular, Pi/2 if flat on screen.
orientationthe orientation in radians. 0 is pointing up, -Pi/2 is left, Pi/2 is right, +/-Pi is down.
pointerTypethe type of input.
pointerIdthe id of the pointer.
Returns
the render item identifier of the starting stroke if any, otherwise an empty string.
Exceptions
std::invalid_argumentwhen pointerType is invalid.
std::invalid_argumentwhen x or y is not a number.
std::invalid_argumentwhen t exceeds year 9999.
std::invalid_argumentwhen f is not a number or is negative.
std::invalid_argumentwhen tilt is not a number or is outside [0, Pi/2].
std::invalid_argumentwhen orientation is not a number or is outside [-Pi, Pi].
pointer_sequence_errorwhen pointerDown() has already been called.
std::runtime_errorin "Text Document" parts, when no view size is set.
Since
4.0

◆ pointerMove() [1/2]

virtual void myscript::iink::Editor::pointerMove ( float  x,
float  y,
int64_t  t,
float  f,
PointerType  pointerType,
int  pointerId 
)
pure virtual

Registers a pointer move event.

Parameters
xpointer event x coordinate (view coordinates in pixel).
ypointer event y coordinate (view coordinates in pixel).
tpointer event timestamp, in ms since Unix EPOCH.
fnormalized pressure, in [0,1].
pointerTypethe type of input.
pointerIdthe id of the pointer.
Exceptions
std::invalid_argumentwhen pointerType is invalid.
std::invalid_argumentwhen x or y is not a number.
std::invalid_argumentwhen t exceeds year 9999.
std::invalid_argumentwhen f is not a number or is negative.
std::invalid_argumentwhen stroke has too many points.
pointer_sequence_errorwhen pointerDown() has not been called before.

◆ pointerMove() [2/2]

virtual void myscript::iink::Editor::pointerMove ( float  x,
float  y,
int64_t  t,
float  f,
float  tilt,
float  orientation,
PointerType  pointerType,
int  pointerId 
)
pure virtual

Registers a pointer move event.

Parameters
xpointer event x coordinate (view coordinates in pixel).
ypointer event y coordinate (view coordinates in pixel).
tpointer event timestamp, in ms since Unix EPOCH.
fnormalized pressure, in [0,1].
tiltthe tilt in radians. 0 is perpendicular, Pi/2 if flat on screen.
orientationthe orientation in radians. 0 is pointing up, -Pi/2 is left, Pi/2 is right, +/-Pi is down.
pointerTypethe type of input.
pointerIdthe id of the pointer.
Exceptions
std::invalid_argumentwhen pointerType is invalid.
std::invalid_argumentwhen x or y is not a number.
std::invalid_argumentwhen t exceeds year 9999.
std::invalid_argumentwhen f is not a number or is negative.
std::invalid_argumentwhen tilt is not a number or is outside [0, Pi/2].
std::invalid_argumentwhen orientation is not a number or is outside [-Pi, Pi].
std::invalid_argumentwhen stroke has too many points.
pointer_sequence_errorwhen pointerDown() has not been called before.
Since
4.0

◆ pointerUp() [1/2]

virtual void myscript::iink::Editor::pointerUp ( float  x,
float  y,
int64_t  t,
float  f,
PointerType  pointerType,
int  pointerId 
)
pure virtual

Registers a pointer up event.

Parameters
xpointer event x coordinate (view coordinates in pixel).
ypointer event y coordinate (view coordinates in pixel).
tpointer event timestamp, in ms since Unix EPOCH.
fnormalized pressure, in [0,1].
pointerTypethe type of input.
pointerIdthe id of the pointer.
Exceptions
std::invalid_argumentwhen pointerType is invalid.
std::invalid_argumentwhen x or y is not a number.
std::invalid_argumentwhen t exceeds year 9999.
std::invalid_argumentwhen f is not a number or is negative.
pointer_sequence_errorwhen pointerDown() has not been called before.

◆ pointerUp() [2/2]

virtual void myscript::iink::Editor::pointerUp ( float  x,
float  y,
int64_t  t,
float  f,
float  tilt,
float  orientation,
PointerType  pointerType,
int  pointerId 
)
pure virtual

Registers a pointer up event.

Parameters
xpointer event x coordinate (view coordinates in pixel).
ypointer event y coordinate (view coordinates in pixel).
tpointer event timestamp, in ms since Unix EPOCH.
fnormalized pressure, in [0,1].
tiltthe tilt in radians. 0 is perpendicular, Pi/2 if flat on screen.
orientationthe orientation in radians. 0 is pointing up, -Pi/2 is left, Pi/2 is right, +/-Pi is down.
pointerTypethe type of input.
pointerIdthe id of the pointer.
Exceptions
std::invalid_argumentwhen pointerType is invalid.
std::invalid_argumentwhen x or y is not a number.
std::invalid_argumentwhen t exceeds year 9999.
std::invalid_argumentwhen f is not a number or is negative.
std::invalid_argumentwhen tilt is not a number or is outside [0, Pi/2].
std::invalid_argumentwhen orientation is not a number or is outside [-Pi, Pi].
pointer_sequence_errorwhen pointerDown() has not been called before.
Since
4.0

◆ pointerCancel()

virtual void myscript::iink::Editor::pointerCancel ( int  pointerId)
pure virtual

Cancels an ongoing pointer trace.

Parameters
pointerIdthe id of the pointer.

◆ pointerEvents()

virtual void myscript::iink::Editor::pointerEvents ( const std::vector< PointerEvent > &  events,
bool  processGestures = true 
)
pure virtual

Sends a series of pointer events.

Note
this method can be used to perform batch recognition by representing the sequence of digital ink strokes as a series of pointer events and sending them with the gesture processing disabled.
Parameters
eventsthe list of events (view coordinates in pixel).
processGesturestells whether to process gestures or not.
Exceptions
std::invalid_argumentwhen a pointer event contains incorrect data.
std::invalid_argumentwhen a stroke has too many points.
std::invalid_argumentwhen events contain more than 20 strokes and processGestures is true.
pointer_sequence_errorwhen event sequence is not allowed.

◆ setViewSize()

virtual void myscript::iink::Editor::setViewSize ( int  width,
int  height 
)
pure virtual

Sets the size of the view.

Parameters
widththe view width (view coordinates in pixel).
heightthe view height (view coordinates in pixel).
Exceptions
std::invalid_argumentwhen width or height is negative.
pointer_sequence_errorwhen a sequence of pointer events is ongoing.

◆ getViewWidth()

virtual int myscript::iink::Editor::getViewWidth ( )
pure virtual

Gets the width of the view.

Returns
the view width (view coordinates in pixel).
Since
1.3

◆ getViewHeight()

virtual int myscript::iink::Editor::getViewHeight ( )
pure virtual

Gets the height of the view.

Returns
the view height (view coordinates in pixel).
Since
1.3

◆ clampViewOffset()

virtual void myscript::iink::Editor::clampViewOffset ( graphics::Point &  viewOffset)
pure virtual

Clamps the supplied view offset to the area that ensures standard scrolling behavior. For "Text" and "Text Document" it allows scrolling one screen outside of the view box downward. For other part types it allows scrolling one screen outside of the view box in each direction.

Parameters
viewOffsetthe view offset to clamp (document coordinates in mm).

◆ setTheme()

virtual void myscript::iink::Editor::setTheme ( const String &  styleSheet)
pure virtual

Changes the rendering theme style sheet, from a buffer containing CSS styling information.

Parameters
styleSheetthe style sheet, in CSS format.
Exceptions
std::invalid_argumentwhen styleSheet is invalid.
pointer_sequence_errorwhen a sequence of pointer events is ongoing.

◆ getTheme()

virtual String myscript::iink::Editor::getTheme ( ) const
pure virtualnoexcept

Returns the rendering theme style sheet, in CSS format.

Returns
the style sheet, in CSS format.

◆ getRootBlock()

virtual std::shared_ptr<ContentBlock> myscript::iink::Editor::getRootBlock ( )
pure virtual

Returns the content block at the root of the current part.

Returns
the root content block.

◆ getBlockById()

virtual std::shared_ptr<ContentBlock> myscript::iink::Editor::getBlockById ( const String &  id)
pure virtual

Returns the content block associated with a given id.

Parameters
idthe identifier of the block.
Returns
the content block associated with id or nullptr if there is no such block in the current part.

◆ isEmpty()

virtual bool myscript::iink::Editor::isEmpty ( std::shared_ptr< ContentSelection >  selection)
pure virtual

Checks whether a content selection is empty.

Parameters
selectionthe content selection to check, nullptr means check the full part.
Returns
true if selection is empty or invalid or editor is not associated with a part, otherwise false.
Since
2.0

◆ getSupportedAddBlockTypes()

virtual std::vector<String> myscript::iink::Editor::getSupportedAddBlockTypes ( )
pure virtualnoexcept

Returns the types of blocks that can be added to the part.

Note
to add a Placeholder block, please use the Editor's PlaceholderController.
Returns
an array of the supported new content block types.

◆ getSupportedAddBlockDataMimeTypes()

virtual std::vector<MimeType> myscript::iink::Editor::getSupportedAddBlockDataMimeTypes ( const String &  type)
pure virtualnoexcept

Returns the supported formats for adding a new block with data.

Parameters
typethe type of the new block.
Returns
an array of the supported mime types.

◆ addBlock() [1/2]

virtual std::shared_ptr<ContentBlock> myscript::iink::Editor::addBlock ( float  x,
float  y,
const String &  type 
)
pure virtual

Adds a new block to the part.

Parameters
xthe approximate x position of the new block (view coordinates in pixel).
ythe approximate y position of the new block (view coordinates in pixel).
typethe type of the new block.
Returns
block the newly added block.
Exceptions
std::runtime_errorwhen type is not supported by current part type.
std::runtime_errorwhen editor is not associated with a part.
std::runtime_errorwhen a block already exists at this position, and is not a "Container" block.
std::runtime_errorwhen empty space around position is too small for a new block.
pointer_sequence_errorwhen a sequence of pointer events is ongoing.

◆ addBlock() [2/2]

virtual std::shared_ptr<ContentBlock> myscript::iink::Editor::addBlock ( float  x,
float  y,
const String &  type,
MimeType  mimeType,
const String &  data 
)
pure virtual

Adds a new block to the part and fills it with data.

Parameters
xthe approximate x position of the new block (view coordinates in pixel).
ythe approximate y position of the new block (view coordinates in pixel).
typethe type of the new block.
mimeTypethe mime type that specifies the format of data.
datathe data to put in the new block.
Returns
block the newly added block.
Exceptions
std::runtime_errorwhen editor is not associated with a part.
std::runtime_errorwhen type is not supported by current part type.
std::runtime_errorwhen a block already exists at this position, and is not a "Container" block.
std::runtime_errorwhen the specified mime type is not supported by target block.
std::runtime_errorwhen empty space around position is too small for a new block.
std::runtime_errorwhen the content of data could not be added to the new block.
pointer_sequence_errorwhen a sequence of pointer events is ongoing.

◆ addImage()

virtual std::shared_ptr<ContentBlock> myscript::iink::Editor::addImage ( float  x,
float  y,
const String &  inputFile,
MimeType  mimeType 
)
pure virtual

Adds a new image to the part.

Note
in a "Text Document" part, this method creates a new "Drawing" block in which the image will be added.
Parameters
xthe approximate x position of the new image (view coordinates in pixel).
ythe approximate y position of the new image (view coordinates in pixel).
inputFilethe image file to add.
mimeTypethe mime type that specifies the format of inputFile.
Returns
the block associated with the newly added image. In a ContentPart of type "Text Document", this will be a block of type "Drawing".
Exceptions
std::invalid_argumentwhen inputFile does not exist.
std::invalid_argumentwhen mimeType is not an image type.
std::runtime_errorwhen editor is not associated with a part.
std::runtime_errorwhen a block already exists at this position, and is not a "Container" block.
std::runtime_errorwhen empty space around position is too small for a new block.
std::runtime_errorwhen an I/O operation fails.
pointer_sequence_errorwhen a sequence of pointer events is ongoing.

◆ erase()

virtual void myscript::iink::Editor::erase ( std::shared_ptr< ContentSelection >  selection)
pure virtual

Erases a content selection from the part.

Parameters
selectionthe content selection to erase.
Exceptions
std::invalid_argumentwhen selection is nullptr.
std::runtime_errorwhen editor is not associated with a part.
std::runtime_errorwhen selection is not valid.
pointer_sequence_errorwhen a sequence of pointer events is ongoing.
Since
2.0

◆ hitBlock()

virtual std::shared_ptr<ContentBlock> myscript::iink::Editor::hitBlock ( float  x,
float  y 
)
pure virtual

Returns the block at the given position, or nullptr if there is no block at that position.

Parameters
xthe hit position x coordinate (view coordinates in pixel).
ythe hit position y coordinate (view coordinates in pixel).
Returns
the block below hit position, or nullptr if no block was found.

◆ getSupportedTargetConversionStates()

virtual std::vector<ConversionState> myscript::iink::Editor::getSupportedTargetConversionStates ( std::shared_ptr< ContentSelection >  selection)
pure virtual

Returns the supported target conversion states for the specified selection.

Parameters
selectionthe content selection for which the supported target conversion states are requested, nullptr means full part.
Returns
an array of the supported target conversion states.
Since
2.0

◆ convert()

virtual void myscript::iink::Editor::convert ( std::shared_ptr< ContentSelection >  selection,
ConversionState  targetState 
)
pure virtual

Converts the specified content selection to digital form.

Parameters
selectionthe content selection to convert, nullptr means convert full part. For a ContentSelection, the intersecting blocks will be fully converted.
targetStatethe target conversion state for the content selection.
Exceptions
std::runtime_errorwhen editor is not associated with a part.
std::runtime_errorwhen selection is not valid.
std::invalid_argumentwhen the target conversion state is not reachable from the current state of the specified content selection.
pointer_sequence_errorwhen a sequence of pointer events is ongoing.
Since
2.0

◆ getSupportedExportMimeTypes()

virtual std::vector<MimeType> myscript::iink::Editor::getSupportedExportMimeTypes ( std::shared_ptr< ContentSelection >  selection)
pure virtual

Returns the supported export formats for specified content selection.

Parameters
selectionthe content selection to request, nullptr means full part.
Returns
an array of the supported mime types.
Since
2.0

◆ export_() [1/3]

virtual String myscript::iink::Editor::export_ ( std::shared_ptr< ContentSelection >  selection,
MimeType  mimeType,
std::shared_ptr< ParameterSet >  overrideConfiguration = nullptr 
)
pure virtual

Exports the specified content selection.

Note
the method is named export_ because the C++ standard defines export as a keyword.
Parameters
selectionthe content selection to export, nullptr means export full part.
mimeTypethe mime type that specifies the output format.
overrideConfigurationthe extra configuration used when exporting.
Returns
the exported content.
Exceptions
std::runtime_errorwhen editor is not associated with a part.
std::runtime_errorwhen the specified mime type is not supported.
std::runtime_errorwhen an I/O operation fails.
std::runtime_errorwhen there are some ongoing operations on the part that prevent export, see isIdle().
std::invalid_argumentwhen overrideConfiguration is invalid.
Since
2.0

◆ export_() [2/3]

virtual void myscript::iink::Editor::export_ ( std::shared_ptr< ContentSelection >  selection,
const String &  outputFile,
std::shared_ptr< IImagePainter >  imagePainter,
std::shared_ptr< ParameterSet >  overrideConfiguration = nullptr 
)
pure virtual

Exports the specified content selection.

Note
the method is named export_ because the C++ standard defines export as a keyword.
Parameters
selectionthe content selection to export, nullptr means export full part.
outputFilethe file to export to.
imagePainteran image painter that is required for some output formats. If you know that the specified output format does not require it you can leave it null.
overrideConfigurationthe extra configuration used when exporting.
Exceptions
std::runtime_errorwhen editor is not associated with a part.
std::invalid_argumentwhen outputFile is invalid.
std::runtime_errorwhen the mime type cannot be determined from the output file name.
std::runtime_errorwhen imagePainter does not create the expected file.
std::runtime_errorwhen an I/O operation fails.
std::runtime_errorwhen there are some ongoing operations on the part that prevent export, see isIdle().
std::invalid_argumentwhen overrideConfiguration is invalid.
Since
2.0

◆ export_() [3/3]

virtual void myscript::iink::Editor::export_ ( std::shared_ptr< ContentSelection >  selection,
const String &  outputFile,
MimeType  mimeType,
std::shared_ptr< IImagePainter >  imagePainter,
std::shared_ptr< ParameterSet >  overrideConfiguration = nullptr 
)
pure virtual

Exports the specified content selection.

Note
the method is named export_ because the C++ standard defines export as a keyword.
Parameters
selectionthe content selection to export, nullptr means export full part.
outputFilethe file to export to.
mimeTypethe mime type that specifies the output format.
imagePainteran image painter that is required for some output formats. If you know that the specified output format does not require it you can leave it null.
overrideConfigurationthe extra configuration used when exporting.
Exceptions
std::runtime_errorwhen editor is not associated with a part.
std::invalid_argumentwhen outputFile is invalid.
std::runtime_errorwhen the specified mime type is not supported.
std::runtime_errorwhen imagePainter saveImage() fails.
std::runtime_errorwhen an I/O operation fails.
std::runtime_errorwhen there are some ongoing operations on the part that prevent export, see isIdle().
std::invalid_argumentwhen overrideConfiguration is invalid.
Since
2.0

◆ getSupportedImportMimeTypes()

virtual std::vector<MimeType> myscript::iink::Editor::getSupportedImportMimeTypes ( std::shared_ptr< ContentSelection >  selection)
pure virtual

Returns the supported import formats for specified content selection.

Parameters
selectionthe content selection to request, nullptr means full part.
Returns
an array of the supported mime types.
Since
2.0

◆ import_()

virtual void myscript::iink::Editor::import_ ( MimeType  mimeType,
const String &  data,
std::shared_ptr< ContentSelection >  selection = nullptr,
std::shared_ptr< ParameterSet >  overrideConfiguration = nullptr 
)
pure virtual

Imports data into the part or a content selection.

Parameters
mimeTypethe mime type that specifies the format of data.
datathe data to import.
selectionthe target content selection, or nullptr to let editor detect the target.
overrideConfigurationthe extra configuration used when importing.
Exceptions
std::runtime_errorwhen editor is not associated with a part.
std::runtime_errorwhen the specified mime type is not supported.
std::runtime_errorwhen data could not be imported.
std::invalid_argumentwhen overrideConfiguration is invalid.
pointer_sequence_errorwhen a sequence of pointer events is ongoing.
Since
2.0

◆ copy()

virtual void myscript::iink::Editor::copy ( std::shared_ptr< ContentSelection >  selection)
pure virtual

Copies a content selection to the internal clipboard.

Parameters
selectionthe content selection to copy, nullptr means full part.
Exceptions
std::runtime_errorwhen editor is not associated with a part.
std::runtime_errorwhen selection is not valid.
std::runtime_errorwhen selection cannot be copied.
pointer_sequence_errorwhen a sequence of pointer events is ongoing.
Since
2.0

◆ paste()

virtual void myscript::iink::Editor::paste ( float  x,
float  y 
)
pure virtual

Pastes the content of the internal clipboard at a given position. Internal clipboard is filled by calling copy(). If internal clipboard is empty, this does nothing.

Note
following limitation applies: the part managed by this editor must be a "Text Document" and clipboard must contain a single block, that is not a "Container", from a "Text Document".
Parameters
xthe target pasted block x coordinate (view coordinates in pixel).
ythe target pasted block y coordinate (view coordinates in pixel).
Exceptions
std::runtime_errorwhen editor is not associated with a part.
std::runtime_errorwhen content of the clipboard cannot be pasted on the part.
pointer_sequence_errorwhen a sequence of pointer events is ongoing.

◆ isIdle()

virtual bool myscript::iink::Editor::isIdle ( )
pure virtualnoexcept

Checks whether part modification operations are over.

Returns
true if no operation is ongoing on the part, otherwise false.

◆ waitForIdle()

virtual void myscript::iink::Editor::waitForIdle ( )
pure virtualnoexcept

Waits until part modification operations are over.

◆ isScrollAllowed()

virtual bool myscript::iink::Editor::isScrollAllowed ( )
pure virtualnoexcept

Checks whether scrolling on the part is allowed at this time.

Note
this applies for example when the editor is resizing or moving an object.
Returns
true if scrolling is allowed, otherwise false.

◆ getConfiguration()

virtual std::shared_ptr<Configuration> myscript::iink::Editor::getConfiguration ( )
pure virtualnoexcept

Returns the configuration associated with this editor.

Returns
the editor configuration.

◆ drawStroke()

virtual void myscript::iink::Editor::drawStroke ( const std::vector< PointerEvent > &  events,
std::shared_ptr< graphics::ICanvas >  canvas 
)
pure virtual

Draws pointer events, with current editor style settings, on the given canvas.

Parameters
eventsthe list of events (view coordinates in pixel).
canvasthe canvas on which editor should send the drawing commands.
Exceptions
std::runtime_errorwhen editor is not associated with a part.
std::invalid_argumentwhen canvas is nullptr.
std::invalid_argumentwhen renderer configuration is invalid.
std::invalid_argumentwhen a pointer event contains incorrect data.
std::invalid_argumentwhen a stroke has too many points.
pointer_sequence_errorwhen events sequence is invalid.
Since
1.5.1

◆ hasSelection()

virtual bool myscript::iink::Editor::hasSelection ( )
pure virtual

Tells if this editor has an active content selection.

Returns
true if the editor has an active content selection, otherwise false.
Exceptions
std::runtime_errorwhen editor is not associated with a part.
Since
2.0

◆ getSelection()

virtual std::shared_ptr<ContentSelection> myscript::iink::Editor::getSelection ( )
pure virtual

Returns the content selection associated with this editor.

Note
this content selection is empty if the editor has nothing selected.
Returns
the current content selection.
Exceptions
std::runtime_errorwhen editor is not associated with a part.
Since
2.0

◆ setSelection()

virtual void myscript::iink::Editor::setSelection ( std::shared_ptr< ContentSelection >  selection)
pure virtual

Sets the specified content selection as the active content selection in this editor.

Note
it unsets the active content selection if the specified content selection is empty or nullptr.
Parameters
selectionthe content selection to set as active.
Exceptions
std::runtime_errorwhen editor is not associated with a part.
std::runtime_errorwhen selection is not valid.
pointer_sequence_errorwhen a sequence of pointer events is ongoing.
Since
2.0

◆ hitSelection()

virtual std::shared_ptr<ContentSelection> myscript::iink::Editor::hitSelection ( float  x,
float  y 
)
pure virtual

Returns the active content selection at the given position, or nullptr if there is no active content selection at that position.

Parameters
xthe hit position x coordinate (view coordinates in pixel).
ythe hit position y coordinate (view coordinates in pixel).
Returns
the content selection below the hit position (i.e. the active content selection), otherwise nullptr.
Since
2.0

◆ getIntersectingBlocks()

virtual std::vector<String> myscript::iink::Editor::getIntersectingBlocks ( std::shared_ptr< ContentSelection >  selection)
pure virtual

Returns the content block ids intersecting with the specified content selection.

Parameters
selectionthe content selection on which to get the intersecting block ids.
Returns
a vector that contains all the content block ids intersecting with the content selection.
Exceptions
std::invalid_argumentwhen selection is nullptr.
std::runtime_errorwhen editor is not associated with a part.
std::runtime_errorwhen selection is not valid.
Since
2.0

◆ getIncludedBlocks()

virtual std::vector<String> myscript::iink::Editor::getIncludedBlocks ( std::shared_ptr< ContentSelection >  selection)
pure virtual

Returns the content block ids included in the specified content selection.

Parameters
selectionthe content selection on which to get the included block ids.
Returns
a vector that contains all the content block ids included in the content selection.
Exceptions
std::invalid_argumentwhen selection is nullptr.
std::runtime_errorwhen editor is not associated with a part.
std::runtime_errorwhen selection is not valid.
Since
2.0

◆ getTransformStatus()

virtual std::underlying_type<TransformError>::type myscript::iink::Editor::getTransformStatus ( std::shared_ptr< ContentSelection >  selection,
const myscript::iink::graphics::Transform &  transform 
)
pure virtual

Checks if a transformation is allowed on a content selection.

Parameters
selectionthe content selection on which to check the transformation.
transformthe transformation to check.
Returns
an error code from enum TransformError.
Exceptions
std::runtime_errorwhen editor is not associated with a part.
std::runtime_errorwhen selection is not valid.
Since
2.0

◆ transform()

virtual void myscript::iink::Editor::transform ( std::shared_ptr< ContentSelection >  selection,
const myscript::iink::graphics::Transform &  transform 
)
pure virtual

Transforms a selection.

Parameters
selectionthe content selection on which to apply the transformation.
transformthe transformation to apply.
Exceptions
std::invalid_argumentwhen selection is nullptr.
std::runtime_errorwhen selection is not valid.
std::invalid_argumentwhen transform is not valid for this operation.
std::runtime_errorwhen editor is not associated with a part.
std::runtime_errorwhen the transform is not allowed on the content selection.
pointer_sequence_errorwhen a sequence of pointer events is ongoing.
Since
2.0

◆ applyStyle()

virtual void myscript::iink::Editor::applyStyle ( std::shared_ptr< ContentSelection >  selection,
const String &  style 
)
pure virtual

Applies CSS style properties to a content selection.

Parameters
selectionthe content selection on which to apply the style.
stylethe CSS style properties to apply.
Exceptions
std::invalid_argumentwhen selection is nullptr.
std::runtime_errorwhen editor is not associated with a part.
std::runtime_errorwhen selection is not valid.
pointer_sequence_errorwhen a sequence of pointer events is ongoing.
Since
2.0

◆ getSupportedTextFormats()

virtual std::vector<TextFormat> myscript::iink::Editor::getSupportedTextFormats ( std::shared_ptr< ContentSelection >  selection)
pure virtual

Returns the supported text formats for specified content selection.

Parameters
selectionthe content selection to request, nullptr means full part.
Returns
an array of the supported text formats.
Exceptions
std::runtime_errorwhen selection is not valid.
Since
2.0

◆ setTextFormat()

virtual void myscript::iink::Editor::setTextFormat ( std::shared_ptr< ContentSelection >  selection,
TextFormat  format 
)
pure virtual

Applies Format to all text blocks in selection.

Parameters
selectionthe content selection on which to apply the format.
formatthe text format value.
Exceptions
std::runtime_errorwhen editor is not associated with a part.
std::runtime_errorwhen selection is not valid.
pointer_sequence_errorwhen a sequence of pointer events is ongoing.
Since
2.0

◆ getSelectionMode()

virtual ContentSelectionMode myscript::iink::Editor::getSelectionMode ( )
pure virtual

Returns the selection mode of the active content selection associated with this editor.

Returns
the selection mode of the current content selection.
Exceptions
std::runtime_errorwhen editor is not associated with a part.
Since
2.0

◆ setSelectionMode()

virtual void myscript::iink::Editor::setSelectionMode ( ContentSelectionMode  mode)
pure virtual

Sets the specified selection mode to the active content selection associated with this editor.

Parameters
modethe selection mode to set on the active content selection.
Exceptions
std::invalid_argumentwhen the mode is not supported.
std::runtime_errorwhen editor is not associated with a part.
std::runtime_errorwhen editor has no active selection.
pointer_sequence_errorwhen a sequence of pointer events is ongoing.
Since
2.0

◆ getAvailableSelectionModes()

virtual std::vector<ContentSelectionMode> myscript::iink::Editor::getAvailableSelectionModes ( )
pure virtual

Returns the available selection modes for the active content selection associated with this editor.

Returns
a vector that contains all the available selection modes.
Exceptions
std::runtime_errorwhen editor is not associated with a part.
Since
2.0

◆ setSelectionType()

virtual void myscript::iink::Editor::setSelectionType ( std::shared_ptr< ContentSelection >  selection,
const String &  type,
bool  forceSingleBlock 
)
pure virtual

Sets a selection to the specified type.

Parameters
selectionthe content selection on which to set the type.
typethe content type to set. See getAvailableSelectionTypes().
forceSingleBlocktrue to force converting the selection to a single block, false otherwise.
Exceptions
std::invalid_argumentwhen the type is not supported.
std::runtime_errorwhen editor is not associated with a part.
std::runtime_errorwhen selection is not valid.
std::runtime_errorwhen selection is not compatible with the type.
pointer_sequence_errorwhen a sequence of pointer events is ongoing.
Since
2.0.1

◆ getAvailableSelectionTypes()

virtual std::vector<String> myscript::iink::Editor::getAvailableSelectionTypes ( std::shared_ptr< ContentSelection >  selection)
pure virtual

Returns the available types for a selection.

Parameters
selectionthe content selection on which to get the types.
Returns
a vector that contains all the available selection types.
Exceptions
std::runtime_errorwhen editor is not associated with a part.
std::runtime_errorwhen selection is not valid.
Since
2.0.1

◆ getIndentationLevels()

virtual IndentationLevels myscript::iink::Editor::getIndentationLevels ( std::shared_ptr< ContentSelection >  selection)
pure virtual
Warning
This is a Beta API.

Returns the indentation levels of a selection.

Parameters
selectionthe content selection on which to get indentation levels, nullptr means full part.
Returns
the indentation levels of the selection.
Exceptions
std::runtime_errorwhen editor is not associated with a part.
std::runtime_errorwhen selection is not valid.
std::runtime_errorwhen selection is empty.
Since
2.1

◆ indent()

virtual void myscript::iink::Editor::indent ( std::shared_ptr< ContentSelection >  selection,
int  offset 
)
pure virtual
Warning
This is a Beta API.

Indents/de-indents a selection by the specified offset.

Note
resulting indentation levels will be clamped to [0, max_indentation[. See getIndentationLevels().
Parameters
selectionthe content selection to indent/de-indent.
offsetthe number of levels to indent/de-indent the selection.
Exceptions
std::runtime_errorwhen editor is not associated with a part.
std::runtime_errorwhen selection is not valid.
std::runtime_errorwhen selection is empty.
std::runtime_errorwhen selection is not indentable.
pointer_sequence_errorwhen a sequence of pointer events is ongoing.
Since
2.1

◆ getBox()

virtual myscript::iink::graphics::Rectangle myscript::iink::Editor::getBox ( std::shared_ptr< ContentSelection >  selection)
pure virtual

Returns the bounding box of the given selection.

Parameters
selectionthe content selection for which the box is requested.
Returns
the box (document coordinates in mm).
Exceptions
std::runtime_errorwhen editor is not associated with a part.
std::runtime_errorwhen selection is not valid.
Since
3.0

◆ getConversionState()

virtual std::underlying_type<ConversionState>::type myscript::iink::Editor::getConversionState ( std::shared_ptr< ContentSelection >  selection)
pure virtual

Returns the current conversion state of the given selection as a bitwise or combination of ConversionState values.

Parameters
selectionthe content selection for which the conversion state is requested.
Returns
the conversion state combination.
Exceptions
std::runtime_errorwhen editor is not associated with a part.
std::runtime_errorwhen selection is not valid.
Since
3.0

The documentation for this class was generated from the following file: