Class Tool
Inheritance
System.Object
Windows.UI.Xaml.DependencyObject
Windows.UI.Xaml.UIElement
Windows.UI.Xaml.FrameworkElement
Windows.UI.Xaml.Controls.Panel
Windows.UI.Xaml.Controls.Canvas
Tool
Implements
Windows.UI.Composition.IAnimationObject
Windows.UI.Composition.IVisualElement
Assembly: pdftron.PDF.Tools.dll
public class Tool : Canvas, IDependencyObject, IDependencyObject2, IUIElement, IUIElement2, IUIElement3, IUIElement4, IUIElement5, IUIElement7, IUIElement8, IUIElement9, IUIElement10, IUIElementOverrides, IUIElementOverrides7, IUIElementOverrides8, IUIElementOverrides9, IAnimationObject, IVisualElement, IFrameworkElement, IFrameworkElement2, IFrameworkElement3, IFrameworkElement4, IFrameworkElement6, IFrameworkElement7, IFrameworkElementProtected7, IFrameworkElementOverrides, IFrameworkElementOverrides2, IPanel, IPanel2, ICanvas
Fields
Declaration
protected const int ArrowScrollDistance = null
Field Value
Type |
Description |
System.Int32 |
|
Declaration
protected double CumulativeRotation
Field Value
Type |
Description |
System.Double |
|
DEFAULT_TEXT_SELECTION_COLOR
Declaration
protected static readonly SolidColorBrush DEFAULT_TEXT_SELECTION_COLOR
Field Value
Type |
Description |
Windows.UI.Xaml.Media.SolidColorBrush |
|
mAllowTextSelectionOptions
Declaration
protected bool mAllowTextSelectionOptions
Field Value
Type |
Description |
System.Boolean |
|
Declaration
Field Value
Declaration
protected Rect mAnnotBBox
Field Value
Type |
Description |
pdftron.PDF.Rect |
|
mAnnotPageNum
Declaration
protected int mAnnotPageNum
Field Value
Type |
Description |
System.Int32 |
|
Declaration
protected ContextMenuControl mContextMenu
Field Value
Declaration
protected CoreApplicationView mCurrentView
Field Value
Type |
Description |
Windows.ApplicationModel.Core.CoreApplicationView |
|
Declaration
protected List<IAnnot> mGroupAnnotations
Field Value
Type |
Description |
List<IAnnot> |
|
Declaration
protected bool mIsAltDown
Field Value
Type |
Description |
System.Boolean |
|
Declaration
protected bool mIsContinuousMode
Field Value
Type |
Description |
System.Boolean |
|
Declaration
protected bool mIsCtrlDown
Field Value
Type |
Description |
System.Boolean |
|
Declaration
protected bool mIsInSnappedView
Field Value
Type |
Description |
System.Boolean |
|
Declaration
protected bool mIsModifierKeyDown
Field Value
Type |
Description |
System.Boolean |
|
Declaration
protected bool mIsShiftDown
Field Value
Type |
Description |
System.Boolean |
|
Declaration
protected bool mIsUsingMouse
Field Value
Type |
Description |
System.Boolean |
|
Declaration
protected bool mJustSwitchedFromAnotherTool
Field Value
Type |
Description |
System.Boolean |
|
Declaration
protected ToolType mNextToolMode
Field Value
mPage
Declaration
Field Value
Type |
Description |
pdftron.PDF.Page |
|
mPagesOnScreen
Declaration
protected IList<int> mPagesOnScreen
Field Value
Type |
Description |
IList<System.Int32> |
|
Declaration
protected PDFViewCtrl mPDFView
Field Value
Type |
Description |
PDFViewCtrl |
|
Declaration
protected Rect mRectToKeepOnScreenWhileManipulating
Field Value
Declaration
protected List<Rect> mSelectedAreasForHitTest
Field Value
Type |
Description |
List<pdftron.PDF.Rect> |
|
Declaration
protected Dictionary<int, Tool.SelectionDrawing> mSelectionCanvases
Field Value
mSelectionEndPage
Declaration
protected int mSelectionEndPage
Field Value
Type |
Description |
System.Int32 |
|
Declaration
protected Dictionary<int, Rect> mSelectionRectangles
Field Value
Type |
Description |
Dictionary<System.Int32, pdftron.PDF.Rect> |
|
mSelectionStartPage
Declaration
protected int mSelectionStartPage
Field Value
Type |
Description |
System.Int32 |
|
mTextSelectFirstPointX
Declaration
protected double mTextSelectFirstPointX
Field Value
Type |
Description |
System.Double |
|
mTextSelectFirstPointY
Declaration
protected double mTextSelectFirstPointY
Field Value
Type |
Description |
System.Double |
|
mTextSelectFirstQuadHeight
Declaration
protected double mTextSelectFirstQuadHeight
Field Value
Type |
Description |
System.Double |
|
mTextSelectionBrush
Declaration
protected SolidColorBrush mTextSelectionBrush
Field Value
Type |
Description |
Windows.UI.Xaml.Media.SolidColorBrush |
|
mTextSelectLastPointX
Declaration
protected double mTextSelectLastPointX
Field Value
Type |
Description |
System.Double |
|
mTextSelectLastPointY
Declaration
protected double mTextSelectLastPointY
Field Value
Type |
Description |
System.Double |
|
mTextSelectLastQuadHeight
Declaration
protected double mTextSelectLastQuadHeight
Field Value
Type |
Description |
System.Double |
|
Declaration
protected ToolType mToolMode
Field Value
Declaration
protected bool mWasFormFillTool
Field Value
Type |
Description |
System.Boolean |
|
PageUpDownScrollDistanceMargin
Declaration
protected const int PageUpDownScrollDistanceMargin = null
Field Value
Type |
Description |
System.Int32 |
|
Properties
AnnotationPageNumber
Declaration
public int AnnotationPageNumber { get; }
Property Value
Type |
Description |
System.Int32 |
|
Declaration
public bool JustSwitchedFromAnotherTool { set; }
Property Value
Type |
Description |
System.Boolean |
|
Declaration
protected bool mIsShowingCommandMenu { get; }
Property Value
Type |
Description |
System.Boolean |
|
Declaration
public ToolType NextToolMode { get; }
Property Value
Declaration
public ToolType ToolMode { get; }
Property Value
Methods
Build the bounding box for the annotation (mAnnotBBox)
The rectangle is in page space.
Declaration
protected void BuildAnnotBBox()
BuildPageBoundBoxOnClient(Int32)
Computes and returns a rectangle with the bounding box of the page indicated by page_num
Declaration
protected Rect BuildPageBoundBoxOnClient(int page_num)
Parameters
Type |
Name |
Description |
System.Int32 |
page_num |
The page number (One-based) of the page whose bounding box is requested.
|
Returns
Type |
Description |
pdftron.PDF.Rect |
Success - A Rect containing the page bounding box
Null - Page number is invalid
|
Declaration
public bool CanExectueAction(IAnnot annot)
Parameters
Type |
Name |
Description |
IAnnot |
annot |
|
Returns
Type |
Description |
System.Boolean |
|
Check whether an annotation is part of a group annotation, proceed to select the group instead.
Declaration
public static KeyValuePair<ToolType, List<IAnnot>> CanSelectGroupAnnotation(PDFViewCtrl pdfViewCtrl, IAnnot annotation, int pageNumber)
Parameters
Type |
Name |
Description |
PDFViewCtrl |
pdfViewCtrl |
PDFViewCtrl object which contains the current document.
|
IAnnot |
annotation |
The annotation.
|
System.Int32 |
pageNumber |
Page number of page that contains the annotations.
|
Returns
Type |
Description |
KeyValuePair<ToolType, List<IAnnot>> |
Null if no such group found, otherwise returns the KeyValuePair of ToolType and the annotation group that can then be used to select the group.
|
CopySelectedTextToClipBoard()
Declaration
protected void CopySelectedTextToClipBoard()
Creates a new tool, but first makes sure the ToolManager knows it's from inside the tools code.
Declaration
protected void CreateNewTool(ToolType newToolMode)
Parameters
Type |
Name |
Description |
ToolType |
newToolMode |
|
DeselectAllText()
Helper function to deselct all text.
Declaration
protected void DeselectAllText()
DetachAllTextSelection()
Declaration
protected void DetachAllTextSelection()
Detaches the SelectionDrawing from its parent canvas.
Declaration
protected void DetachSelectionDrawing(Tool.SelectionDrawing sd)
Parameters
DisallowTextSelection()
Call this Function when a tool is created to clear text selection and suppress any context menu options related to it.
Declaration
protected void DisallowTextSelection()
This functions draws the current text selection to the screen.
To only include text selection where it is visible, we draw all quads for a
specific page on one canvas in page space. This canvas can then be positioned,
rotated, scaled, and added or removed based on the state of the viewer.
Declaration
protected virtual void DrawSelection(bool reposition = false)
Parameters
Type |
Name |
Description |
System.Boolean |
reposition |
If true, everything will be repositoned. Set to true after zoom or changing view
mode when every canvas has to be positioned
|
Will either return to pan or create a new tool of the same type, depending on the flag mReturnToPanModeWhenFinished
Declaration
protected void EndCurrentTool(ToolType nextToolMode)
Parameters
Type |
Name |
Description |
ToolType |
nextToolMode |
|
Execute action, "URI" action is handled differerntly from others
Declaration
public void ExecuteAction(ActionParameter action_param)
Parameters
Type |
Name |
Description |
ActionParameter |
action_param |
|
Declaration
protected void GetAuthorFromDialog()
Returns the length of the line ending for the open arrow based on the stroke thickness, assuming a scale factor of 1.
Declaration
protected double GetLineEndingLength(double strokThickenss)
Parameters
Type |
Name |
Description |
System.Double |
strokThickenss |
The stroke thickenss for the arrow to draw.
|
Returns
Type |
Description |
System.Double |
The required length for the arrow head
|
GetPageCoordinates(PointerPoint, Int32)
Declaration
protected Point GetPageCoordinates(PointerPoint pp, int pageNumber)
Parameters
Type |
Name |
Description |
Windows.UI.Input.PointerPoint |
pp |
|
System.Int32 |
pageNumber |
|
Returns
Type |
Description |
pdftron.PDF.Point |
|
GetPageDifference(IList<Int32>, IList<Int32>)
Returns a list of all integers in pageList1 that are not in pageList2
Declaration
protected List<int> GetPageDifference(IList<int> pageList1, IList<int> pageList2)
Parameters
Type |
Name |
Description |
IList<System.Int32> |
pageList1 |
|
IList<System.Int32> |
pageList2 |
|
Returns
Type |
Description |
List<System.Int32> |
|
Declaration
protected bool HasPermission(IAnnot annotation, int kind)
Parameters
Type |
Name |
Description |
IAnnot |
annotation |
|
System.Int32 |
kind |
|
Returns
Type |
Description |
System.Boolean |
|
Figures out if the point is inside one of the rectangles representing our selection
Declaration
protected bool IsPointInSelection(Point p)
Parameters
Type |
Name |
Description |
Windows.Foundation.Point |
p |
The point we're looking for in PDFViewCtrl space
|
Returns
Type |
Description |
System.Boolean |
True if the point is inside one of the rectangles
|
Figures out if the point is inside one of the rectangles representing our selection
Declaration
protected bool IsPointInSelection(Point p, bool inflate)
Parameters
Type |
Name |
Description |
Windows.Foundation.Point |
p |
The point we're looking for in PDFViewCtrl space
|
System.Boolean |
inflate |
If the rectangles should be inflated for more lenient hit testing
|
Returns
Type |
Description |
System.Boolean |
True if the point is inside one of the [inflated] rectangles
|
Declaration
protected bool IsPointInsideAnnot(double viewCtrlX, double viewCtrlY)
Parameters
Type |
Name |
Description |
System.Double |
viewCtrlX |
|
System.Double |
viewCtrlY |
|
Returns
Type |
Description |
System.Boolean |
|
Creates a one time TranslateAnimation with parameters that matches the virtual keyboard
Declaration
public static Storyboard KeyboardTranslate(FrameworkElement _target, Double _fY, Double _tY, TimeSpan _duration)
Parameters
Type |
Name |
Description |
Windows.UI.Xaml.FrameworkElement |
_target |
FrameworkElement to animate
|
Double |
_fY |
|
Double |
_tY |
Ending Y offset of animation.
|
TimeSpan |
_duration |
Duration of the animation
|
Returns
Type |
Description |
Windows.UI.Xaml.Media.Animation.Storyboard |
Completed Storyboard
|
Declaration
public bool KeyDownHandler(object sender, KeyRoutedEventArgs e)
Parameters
Type |
Name |
Description |
System.Object |
sender |
|
Windows.UI.Xaml.Input.KeyRoutedEventArgs |
e |
|
Returns
Type |
Description |
System.Boolean |
|
Declaration
public bool KeyUpHandler(object sender, KeyRoutedEventArgs e)
Parameters
Type |
Name |
Description |
System.Object |
sender |
|
Windows.UI.Xaml.Input.KeyRoutedEventArgs |
e |
|
Returns
Type |
Description |
System.Boolean |
|
Declaration
protected void LaunchBrowser(string uristring)
Parameters
Type |
Name |
Description |
System.String |
uristring |
|
PageDownScroll()
Declaration
protected void PageDownScroll()
PageUpScroll()
Declaration
protected void PageUpScroll()
SelectAllText()
Helper function to select all text.
Declaration
protected void SelectAllText()
Finds an annotation (if available) that is in screen space (x, y)
And sets mAnnot, mAnnotBBox, and mAnnotPageNum accordingly
Declaration
protected void SelectAnnot(int sc_x, int sc_y, double distanceThreshold = null, double minimumLineWeight = null)
Parameters
Type |
Name |
Description |
System.Int32 |
sc_x |
|
System.Int32 |
sc_y |
|
System.Double |
distanceThreshold |
|
System.Double |
minimumLineWeight |
|
SelectTextAtPoint(Point, Double)
Tries to select text at the point
point is in screen coordinates
Declaration
protected bool SelectTextAtPoint(Point point, double expansion = null)
Parameters
Type |
Name |
Description |
Windows.Foundation.Point |
point |
The point where you want to check for text
|
System.Double |
expansion |
How much you want to expand that point, to be more "generous"
|
Returns
Type |
Description |
System.Boolean |
|
Declaration
public void SetAuthor(Annots.IMarkup markup)
Parameters
Type |
Name |
Description |
Annots.IMarkup |
markup |
|
Events
PageChanged
Declaration
public event Tool.PageChangedDelegate PageChanged
Event Type
Implements
Windows.UI.Composition.IAnimationObject
Windows.UI.Composition.IVisualElement
Extension Methods