1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972 |
- using ComPDFKit.Measure;
- using ComPDFKit.PDFAnnotation;
- using ComPDFKitViewer.Helper;
- using System;
- using System.Collections.Generic;
- using System.Globalization;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Documents;
- using System.Windows.Media;
- namespace ComPDFKit.Tool.SettingParam
- {
- public class DefaultSettingParam
- {
- public bool IsShowLink = false;
- public bool IsShowWidget = false;
- #region Measure
- public bool IsOpenMeasure = false;
- public bool IsCreateSquarePolygonMeasure = false;
- private LineMeasureParam lineMeasureParamDef;
- public LineMeasureParam LineMeasureParamDef
- {
- get
- {
- LineMeasureParam Param = new LineMeasureParam();
- if (lineMeasureParamDef.CopyTo(Param))
- {
- return Param;
- }
- return null;
- }
- private set
- {
- value.CopyTo(lineMeasureParamDef);
- }
- }
- private PolyLineMeasureParam polyLineMeasureParamDef;
- public PolyLineMeasureParam PolyLineMeasureParamDef
- {
- get
- {
- PolyLineMeasureParam Param = new PolyLineMeasureParam();
- if (polyLineMeasureParamDef.CopyTo(Param))
- {
- return Param;
- }
- return null;
- }
- private set
- {
- value.CopyTo(polyLineMeasureParamDef);
- }
- }
- private PolygonMeasureParam polygonMeasureParamDef;
- public PolygonMeasureParam PolygonMeasureParamDef
- {
- get
- {
- PolygonMeasureParam Param = new PolygonMeasureParam();
- if (polygonMeasureParamDef.CopyTo(Param))
- {
- return Param;
- }
- return null;
- }
- private set
- {
- value.CopyTo(polygonMeasureParamDef);
- }
- }
- private void InitLineMeasure()
- {
- lineMeasureParamDef = new LineMeasureParam();
- lineMeasureParamDef.measureInfo = new CPDFMeasureInfo
- {
- Unit = CPDFMeasure.CPDF_CM,
- Precision = CPDFMeasure.PRECISION_VALUE_TWO,
- RulerBase = 1,
- RulerBaseUnit = CPDFMeasure.CPDF_CM,
- RulerTranslate = 1,
- RulerTranslateUnit = CPDFMeasure.CPDF_CM,
- CaptionType = CPDFCaptionType.CPDF_CAPTION_LENGTH,
- };
- }
- private void InitPolyLineMeasure()
- {
- polyLineMeasureParamDef = new PolyLineMeasureParam();
- polyLineMeasureParamDef.measureInfo = new CPDFMeasureInfo
- {
- Unit = CPDFMeasure.CPDF_CM,
- Precision = CPDFMeasure.PRECISION_VALUE_TWO,
- RulerBase = 1,
- RulerBaseUnit = CPDFMeasure.CPDF_CM,
- RulerTranslate = 1,
- RulerTranslateUnit = CPDFMeasure.CPDF_CM,
- CaptionType = CPDFCaptionType.CPDF_CAPTION_LENGTH,
- };
- }
- private void InitPolygonMeasure()
- {
- polygonMeasureParamDef = new PolygonMeasureParam();
- polygonMeasureParamDef.measureInfo = new CPDFMeasureInfo
- {
- Unit = CPDFMeasure.CPDF_CM,
- Precision = CPDFMeasure.PRECISION_VALUE_TWO,
- RulerBase = 1,
- RulerBaseUnit = CPDFMeasure.CPDF_CM,
- RulerTranslate = 1,
- RulerTranslateUnit = CPDFMeasure.CPDF_CM,
- CaptionType = CPDFCaptionType.CPDF_CAPTION_LENGTH | CPDFCaptionType.CPDF_CAPTION_AREA,
- };
- }
- #endregion
- #region Annot
- private CircleParam circleParamDef;
- public CircleParam CircleParamDef
- {
- get
- {
- CircleParam Param = new CircleParam();
- if (circleParamDef.CopyTo(Param))
- {
- return Param;
- }
- return null;
- }
- private set
- {
- value.CopyTo(circleParamDef);
- }
- }
- private FreeTextParam freeTextParamDef;
- public FreeTextParam FreeTextParamDef
- {
- get
- {
- FreeTextParam Param = new FreeTextParam();
- if (freeTextParamDef.CopyTo(Param))
- {
- return Param;
- }
- return null;
- }
- private set
- {
- value.CopyTo(freeTextParamDef);
- }
- }
- private HighlightParam highlightParamDef;
- public HighlightParam HighlightParamDef
- {
- get
- {
- HighlightParam Param = new HighlightParam();
- if (highlightParamDef.CopyTo(Param))
- {
- return Param;
- }
- return null;
- }
- private set
- {
- value.CopyTo(highlightParamDef);
- }
- }
- private InkParam inkParamDef;
- public InkParam InkParamDef
- {
- get
- {
- InkParam Param = new InkParam();
- if (inkParamDef.CopyTo(Param))
- {
- return Param;
- }
- return null;
- }
- private set
- {
- value.CopyTo(inkParamDef);
- }
- }
- private LineParam lineParamDef;
- public LineParam LineParamDef
- {
- get
- {
- LineParam Param = new LineParam();
- if (lineParamDef.CopyTo(Param))
- {
- return Param;
- }
- return null;
- }
- private set
- {
- value.CopyTo(lineParamDef);
- }
- }
- private LinkParam linkParamDef;
- public LinkParam LinkParamDef
- {
- get
- {
- LinkParam Param = new LinkParam();
- if (linkParamDef.CopyTo(Param))
- {
- return Param;
- }
- return null;
- }
- private set
- {
- value.CopyTo(linkParamDef);
- }
- }
- private RedactParam redactParamDef;
- public RedactParam RedactParamDef
- {
- get
- {
- RedactParam Param = new RedactParam();
- if (redactParamDef.CopyTo(Param))
- {
- return Param;
- }
- return null;
- }
- private set
- {
- value.CopyTo(redactParamDef);
- }
- }
- private SquareParam squareParamDef;
- public SquareParam SquareParamDef
- {
- get
- {
- SquareParam Param = new SquareParam();
- if (squareParamDef.CopyTo(Param))
- {
- return Param;
- }
- return null;
- }
- private set
- {
- value.CopyTo(squareParamDef);
- }
- }
- private SquigglyParam squigglyParamDef;
- public SquigglyParam SquigglyParamDef
- {
- get
- {
- SquigglyParam Param = new SquigglyParam();
- if (squigglyParamDef.CopyTo(Param))
- {
- return Param;
- }
- return null;
- }
- private set
- {
- value.CopyTo(squigglyParamDef);
- }
- }
- private StampParam stampParamDef;
- public StampParam StampParamDef
- {
- get
- {
- StampParam Param = new StampParam();
- if (stampParamDef.CopyTo(Param))
- {
- return Param;
- }
- return null;
- }
- private set
- {
- value.CopyTo(stampParamDef);
- }
- }
- private StickyNoteParam stickyNoteParamDef;
- public StickyNoteParam StickyNoteParamDef
- {
- get
- {
- StickyNoteParam Param = new StickyNoteParam();
- if (stickyNoteParamDef.CopyTo(Param))
- {
- return Param;
- }
- return null;
- }
- private set
- {
- value.CopyTo(stickyNoteParamDef);
- }
- }
- private StrikeoutParam strikeoutParamDef;
- public StrikeoutParam StrikeoutParamDef
- {
- get
- {
- StrikeoutParam Param = new StrikeoutParam();
- if (strikeoutParamDef.CopyTo(Param))
- {
- return Param;
- }
- return null;
- }
- private set
- {
- value.CopyTo(strikeoutParamDef);
- }
- }
- private UnderlineParam underlineParamDef;
- public UnderlineParam UnderlineParamDef
- {
- get
- {
- UnderlineParam Param = new UnderlineParam();
- if (underlineParamDef.CopyTo(Param))
- {
- return Param;
- }
- return null;
- }
- private set
- {
- value.CopyTo(underlineParamDef);
- }
- }
- private SoundParam soundParamDef;
- public SoundParam SoundParamDef
- {
- get
- {
- SoundParam Param = new SoundParam();
- if (soundParamDef.CopyTo(Param))
- {
- return Param;
- }
- return null;
- }
- private set
- {
- value.CopyTo(soundParamDef);
- }
- }
- private void InitUnderline()
- {
- underlineParamDef = new UnderlineParam();
- }
- private void InitStrikeout()
- {
- strikeoutParamDef = new StrikeoutParam();
- }
- private void InitStamp()
- {
- stampParamDef = new StampParam();
- }
- private void InitSquiggly()
- {
- squigglyParamDef = new SquigglyParam();
- }
- private void InitSquare()
- {
- squareParamDef = new SquareParam();
- }
- private void InitRedact()
- {
- redactParamDef = new RedactParam();
- }
- private void InitLink()
- {
- linkParamDef = new LinkParam();
- }
- private void InitLine()
- {
- lineParamDef = new LineParam();
- }
- private void InitInk()
- {
- inkParamDef = new InkParam();
- }
- private void Inithighlight()
- {
- highlightParamDef = new HighlightParam();
- }
- private void InitFreeText()
- {
- freeTextParamDef = new FreeTextParam();
- freeTextParamDef.Alignment = C_TEXT_ALIGNMENT.ALIGNMENT_LEFT;
- freeTextParamDef.Transparency = 255;
- byte[] lineColor = { 255, 0, 0 };
- freeTextParamDef.LineColor = lineColor;
- freeTextParamDef.LineWidth = 1;
- freeTextParamDef.FontName = "Arial";
- byte[] fontColor = { 255, 0, 0 };
- freeTextParamDef.FontColor = fontColor;
- freeTextParamDef.FontSize = 14;
- }
- private void InitCircle()
- {
- circleParamDef = new CircleParam();
- }
- private void InitStickyNote()
- {
- stickyNoteParamDef = new StickyNoteParam();
- stickyNoteParamDef.Transparency = 255;
- stickyNoteParamDef.StickyNoteColor = new byte[3] { 255, 0, 0 };
- }
- private void InitSound()
- {
- soundParamDef = new SoundParam();
- }
- #endregion
- #region Widget
- private CheckBoxParam checkBoxParamDef;
- public CheckBoxParam CheckBoxParamDef
- {
- get
- {
- CheckBoxParam Param = new CheckBoxParam();
- if (checkBoxParamDef.CopyTo(Param))
- {
- return Param;
- }
- return null;
- }
- private set
- {
- value.CopyTo(checkBoxParamDef);
- }
- }
- private ComboBoxParam comboBoxParamDef;
- public ComboBoxParam ComboBoxParamDef
- {
- get
- {
- ComboBoxParam Param = new ComboBoxParam();
- if (comboBoxParamDef.CopyTo(Param))
- {
- return Param;
- }
- return null;
- }
- private set
- {
- value.CopyTo(comboBoxParamDef);
- }
- }
- private ListBoxParam listBoxParamDef;
- public ListBoxParam ListBoxParamDef
- {
- get
- {
- ListBoxParam Param = new ListBoxParam();
- if (listBoxParamDef.CopyTo(Param))
- {
- return Param;
- }
- return null;
- }
- private set
- {
- value.CopyTo(listBoxParamDef);
- }
- }
- private PushButtonParam pushButtonParamDef;
- public PushButtonParam PushButtonParamDef
- {
- get
- {
- PushButtonParam Param = new PushButtonParam();
- if (pushButtonParamDef.CopyTo(Param))
- {
- return Param;
- }
- return null;
- }
- private set
- {
- value.CopyTo(pushButtonParamDef);
- }
- }
- private RadioButtonParam radioButtonParamDef;
- public RadioButtonParam RadioButtonParamDef
- {
- get
- {
- RadioButtonParam Param = new RadioButtonParam();
- if (radioButtonParamDef.CopyTo(Param))
- {
- return Param;
- }
- return null;
- }
- private set
- {
- value.CopyTo(radioButtonParamDef);
- }
- }
- private SignatureParam signatureParamDef;
- public SignatureParam SignatureParamDef
- {
- get
- {
- SignatureParam Param = new SignatureParam();
- if (signatureParamDef.CopyTo(Param))
- {
- return Param;
- }
- return null;
- }
- private set
- {
- value.CopyTo(signatureParamDef);
- }
- }
- private TextBoxParam textBoxParamDef;
- public TextBoxParam TextBoxParamDef
- {
- get
- {
- TextBoxParam Param = new TextBoxParam();
- if (textBoxParamDef.CopyTo(Param))
- {
- return Param;
- }
- return null;
- }
- private set
- {
- value.CopyTo(textBoxParamDef);
- }
- }
- private void InitCheckBox()
- {
- checkBoxParamDef = new CheckBoxParam();
- }
- private void InitComboBox()
- {
- comboBoxParamDef = new ComboBoxParam();
- }
- private void InitListBox()
- {
- listBoxParamDef = new ListBoxParam();
- }
- private void InitPushButton()
- {
- pushButtonParamDef = new PushButtonParam();
- }
- private void InitRadioButton()
- {
- radioButtonParamDef = new RadioButtonParam();
- }
- private void InitSignature()
- {
- signatureParamDef = new SignatureParam();
- }
- private void InitTextBox()
- {
- textBoxParamDef = new TextBoxParam();
- }
- #endregion
- #region PDFEdit
- private ImageEditParam imageEditParamDef;
- public ImageEditParam ImageEditParamDef
- {
- get
- {
- ImageEditParam Param = new ImageEditParam();
- if (imageEditParamDef.CopyTo(Param))
- {
- return Param;
- }
- return null;
- }
- private set
- {
- value.CopyTo(imageEditParamDef);
- }
- }
- private TextEditParam textEditParamDef;
- public TextEditParam TextEditParamDef
- {
- get
- {
- TextEditParam Param = new TextEditParam();
- if (textEditParamDef.CopyTo(Param))
- {
- return Param;
- }
- return null;
- }
- private set
- {
- value.CopyTo(textEditParamDef);
- }
- }
- private void InitTextEdit()
- {
- textEditParamDef = new TextEditParam();
- }
- private void InitImageEdit()
- {
- imageEditParamDef = new ImageEditParam();
- }
- #endregion
- public DefaultSettingParam()
- {
- #region Measure
- InitLineMeasure();
- InitPolyLineMeasure();
- InitPolygonMeasure();
- #endregion
- #region Annot
- InitUnderline();
- InitStrikeout();
- InitStamp();
- InitSquiggly();
- InitSquare();
- InitRedact();
- InitLink();
- InitLine();
- InitInk();
- Inithighlight();
- InitFreeText();
- InitCircle();
- InitStickyNote();
- InitSound();
- #endregion
- #region Widget
- InitCheckBox();
- InitComboBox();
- InitListBox();
- InitPushButton();
- InitRadioButton();
- InitSignature();
- InitTextBox();
- #endregion
- #region PDFEdit
- InitTextEdit();
- InitImageEdit();
- #endregion
- }
- public bool SetAnnotParam(AnnotParam annotParam)
- {
- bool IsOK = false;
- if (annotParam == null)
- {
- return IsOK;
- }
- switch (annotParam.CurrentType)
- {
- case C_ANNOTATION_TYPE.C_ANNOTATION_NONE:
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_UNKOWN:
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_TEXT:
- if (annotParam is StickyNoteParam)
- {
- StickyNoteParamDef = annotParam as StickyNoteParam;
- IsOK = true;
- }
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_LINK:
- if (annotParam is LinkParam)
- {
- LinkParamDef = annotParam as LinkParam;
- IsOK = true;
- }
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_FREETEXT:
- if (annotParam is FreeTextParam)
- {
- FreeTextParamDef = annotParam as FreeTextParam;
- IsOK = true;
- }
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_LINE:
- if (annotParam is LineParam)
- {
- LineParamDef = annotParam as LineParam;
- IsOK = true;
- }
- else if (annotParam is LineMeasureParam)
- {
- LineMeasureParamDef = annotParam as LineMeasureParam;
- IsOK = true;
- }
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_SQUARE:
- if (annotParam is SquareParam)
- {
- SquareParamDef = annotParam as SquareParam;
- IsOK = true;
- }
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_CIRCLE:
- if (annotParam is CircleParam)
- {
- CircleParamDef = annotParam as CircleParam;
- IsOK = true;
- }
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_POLYGON:
- if (annotParam is PolygonMeasureParam)
- {
- PolygonMeasureParamDef = annotParam as PolygonMeasureParam;
- IsOK = true;
- }
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_POLYLINE:
- if (annotParam is PolyLineMeasureParam)
- {
- PolyLineMeasureParamDef = annotParam as PolyLineMeasureParam;
- IsOK = true;
- }
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_HIGHLIGHT:
- if (annotParam is HighlightParam)
- {
- HighlightParamDef = annotParam as HighlightParam;
- IsOK = true;
- }
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_UNDERLINE:
- if (annotParam is UnderlineParam)
- {
- UnderlineParamDef = annotParam as UnderlineParam;
- IsOK = true;
- }
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_SQUIGGLY:
- if (annotParam is SquigglyParam)
- {
- SquigglyParamDef = annotParam as SquigglyParam;
- IsOK = true;
- }
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_STRIKEOUT:
- if (annotParam is StrikeoutParam)
- {
- StrikeoutParamDef = annotParam as StrikeoutParam;
- IsOK = true;
- }
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_STAMP:
- if (annotParam is StampParam)
- {
- StampParamDef = annotParam as StampParam;
- IsOK = true;
- }
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_CARET:
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_INK:
- if (annotParam is InkParam)
- {
- InkParamDef = annotParam as InkParam;
- IsOK = true;
- }
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_POPUP:
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_FILEATTACHMENT:
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_SOUND:
- if (annotParam is SoundParam)
- {
- SoundParamDef = annotParam as SoundParam;
- IsOK = true;
- }
- break;
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_MOVIE:
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_WIDGET:
- if (annotParam is WidgetParm)
- {
- IsOK = SetWidgetParam(annotParam as WidgetParm);
- }
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_SCREEN:
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_PRINTERMARK:
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_TRAPNET:
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_WATERMARK:
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_3D:
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_RICHMEDIA:
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_REDACT:
- if (annotParam is RedactParam)
- {
- RedactParamDef = annotParam as RedactParam;
- IsOK = true;
- }
- break;
- case C_ANNOTATION_TYPE.C_ANNOTATION_INTERCHANGE:
- break;
- default:
- break;
- }
- return IsOK;
- }
- private bool SetWidgetParam(WidgetParm formParm)
- {
- bool IsOK = false;
- if (formParm == null)
- {
- return IsOK;
- }
- switch (formParm.WidgetType)
- {
- case PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_NONE:
- break;
- case PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_PUSHBUTTON:
- if (formParm is PushButtonParam)
- {
- PushButtonParamDef = formParm as PushButtonParam;
- IsOK = true;
- }
- break;
- case PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_CHECKBOX:
- if (formParm is CheckBoxParam)
- {
- CheckBoxParamDef = formParm as CheckBoxParam;
- IsOK = true;
- }
- break;
- case PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_RADIOBUTTON:
- if (formParm is RadioButtonParam)
- {
- RadioButtonParamDef = formParm as RadioButtonParam;
- IsOK = true;
- }
- break;
- case PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_TEXTFIELD:
- if (formParm is TextBoxParam)
- {
- TextBoxParamDef = formParm as TextBoxParam;
- IsOK = true;
- }
- break;
- case PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_COMBOBOX:
- if (formParm is ComboBoxParam)
- {
- ComboBoxParamDef = formParm as ComboBoxParam;
- IsOK = true;
- }
- break;
- case PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_LISTBOX:
- if (formParm is ListBoxParam)
- {
- ListBoxParamDef = formParm as ListBoxParam;
- IsOK = true;
- }
- break;
- case PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_SIGNATUREFIELDS:
- if (formParm is SignatureParam)
- {
- SignatureParamDef = formParm as SignatureParam;
- IsOK = true;
- }
- break;
- case PDFAnnotation.Form.C_WIDGET_TYPE.WIDGET_UNKNOWN:
- break;
- default:
- break;
- }
- return IsOK;
- }
- public bool SetPDFEditParamm(PDFEditParam editParam)
- {
- switch (editParam.EditType)
- {
- case PDFPage.CPDFEditType.EditText:
- if (editParam is TextEditParam)
- {
- TextEditParamDef = editParam as TextEditParam;
- return true;
- }
- break;
- default:
- break;
- }
- return false;
- }
- }
- public class DefaultDrawParam
- {
- #region ShowAnnot
- private SolidColorBrush showLinkBrush;
- public SolidColorBrush ShowLinkBrush
- {
- get { return showLinkBrush.Clone(); }
- set { showLinkBrush = value; }
- }
- private Pen showLinkePen;
- public Pen ShowLinkePen
- {
- get { return showLinkePen.Clone(); }
- set { showLinkePen = value; }
- }
- #endregion
- #region AnnotSelectedRect
- private SolidColorBrush annotMoveBrush;
- public SolidColorBrush AnnotMoveBrush
- {
- get { return annotMoveBrush.Clone(); }
- set { annotMoveBrush = value; }
- }
- private Pen annotMovePen;
- public Pen AnnotMovePen
- {
- get { return annotMovePen.Clone(); }
- set { annotMovePen = value; }
- }
- private SolidColorBrush annotRectFillBrush;
- public SolidColorBrush AnnotRectFillBrush
- {
- get { return annotRectFillBrush.Clone(); }
- set { annotRectFillBrush = value; }
- }
- private Pen annotRectLinePen;
- public Pen AnnotRectLinePen
- {
- get { return annotRectLinePen.Clone(); }
- set { annotRectLinePen = value; }
- }
- private Pen annotRectHoverPen;
- public Pen AnnotRectHoverPen
- {
- get { return annotRectHoverPen.Clone(); }
- set { annotRectHoverPen = value; }
- }
- private Pen annotPointPen;
- public Pen AnnotPointPen
- {
- get { return annotPointPen.Clone(); }
- set { annotPointPen = value; }
- }
- private SolidColorBrush annotPointBorderBrush;
- public SolidColorBrush AnnotPointBorderBrush
- {
- get { return annotPointBorderBrush.Clone(); }
- set { annotPointBorderBrush = value; }
- }
- #endregion
- #region PDFEdit
- private SolidColorBrush caretBrush;
- public SolidColorBrush CaretBrush
- {
- get { return caretBrush.Clone(); }
- set { caretBrush = value; }
- }
- private Pen caretPen;
- public Pen CaretPen
- {
- get { return caretPen.Clone(); }
- set { caretPen = value; }
- }
- private SolidColorBrush pDFEditMoveBrush;
- public SolidColorBrush PDFEditMoveBrush
- {
- get { return pDFEditMoveBrush.Clone(); }
- set { pDFEditMoveBrush = value; }
- }
- private Pen pDFEditMovePen;
- public Pen PDFEditMovePen
- {
- get { return pDFEditMovePen.Clone(); }
- set { pDFEditMovePen = value; }
- }
- private Pen pDFEditMoveRectPen;
- public Pen PDFEditMoveRectPen
- {
- get { return pDFEditMoveRectPen.Clone(); }
- set { pDFEditMoveRectPen = value; }
- }
- #region Not selected state
- private SolidColorBrush pDFEditRectFillBrush;
- public SolidColorBrush PDFEditRectFillBrush
- {
- get { return pDFEditRectFillBrush.Clone(); }
- set { pDFEditRectFillBrush = value; }
- }
- private Pen pDFEditRectLinePen;
- public Pen PDFEditRectLinePen
- {
- get { return pDFEditRectLinePen.Clone(); }
- set { pDFEditRectLinePen = value; }
- }
- private Pen pDFEditPointPen;
- public Pen PDFEditPointPen
- {
- get { return pDFEditPointPen.Clone(); }
- set { pDFEditPointPen = value; }
- }
- private SolidColorBrush pDFEditPointBorderBrush;
- public SolidColorBrush PDFEditPointBorderBrush
- {
- get { return pDFEditPointBorderBrush.Clone(); }
- set { pDFEditPointBorderBrush = value; }
- }
- #endregion
- #region Selected state
- private SolidColorBrush sPDFEditRectFillBrush;
- public SolidColorBrush SPDFEditRectFillBrush
- {
- get { return sPDFEditRectFillBrush.Clone(); }
- set { sPDFEditRectFillBrush = value; }
- }
- private Pen sPDFEditRectLinePen;
- public Pen SPDFEditRectLinePen
- {
- get { return sPDFEditRectLinePen.Clone(); }
- set { sPDFEditRectLinePen = value; }
- }
- private Pen sPDFEditPointPen;
- public Pen SPDFEditPointPen
- {
- get { return sPDFEditPointPen.Clone(); }
- set { sPDFEditPointPen = value; }
- }
- private SolidColorBrush sPDFEditPointBorderBrush;
- public SolidColorBrush SPDFEditPointBorderBrush
- {
- get { return sPDFEditPointBorderBrush.Clone(); }
- set { sPDFEditPointBorderBrush = value; }
- }
- private SolidColorBrush sPDFEditCropBorderBrush;
- public SolidColorBrush SPDFEditCropBorderBrush
- {
- get { return sPDFEditCropBorderBrush.Clone(); }
- set { sPDFEditCropBorderBrush = value; }
- }
- #endregion
- #region Hover state
- private SolidColorBrush pDFEditRectFillHoverBrush;
- public SolidColorBrush PDFEditRectFillHoverBrush
- {
- get { return pDFEditRectFillHoverBrush.Clone(); }
- set { pDFEditRectFillHoverBrush = value; }
- }
- private Pen pDFEditRectLineHoverPen;
- public Pen PDFEditRectLineHoverPen
- {
- get { return pDFEditRectLineHoverPen.Clone(); }
- set { pDFEditRectLineHoverPen = value; }
- }
- private Pen pDFEditPointHoverPen;
- public Pen PDFEditPointHoverPen
- {
- get { return pDFEditPointHoverPen.Clone(); }
- set { pDFEditPointHoverPen = value; }
- }
- private SolidColorBrush pDFEditPointBorderHoverBrush;
- public SolidColorBrush PDFEditPointBorderHoverBrush
- {
- get { return pDFEditPointBorderHoverBrush.Clone(); }
- set { pDFEditPointBorderHoverBrush = value; }
- }
- #endregion
- #endregion
- #region AnnotEdit
- private SolidColorBrush editControlLineBrush;
- public SolidColorBrush EditControlLineBrush
- {
- get { return editControlLineBrush.Clone(); }
- set { editControlLineBrush = value; }
- }
- private Pen editControlLinePen;
- public Pen EditControlLinePen
- {
- get { return editControlLinePen.Clone(); }
- set { editControlLinePen = value; }
- }
- private Pen editLinePen;
- public Pen EditLinePen
- {
- get { return editLinePen.Clone(); }
- set { editLinePen = value; }
- }
- #endregion
- #region AnnotCreate
- private Pen redactPen;
- public Pen RedactPen
- {
- get { return redactPen.Clone(); }
- set { redactPen = value; }
- }
- private Pen linkPen;
- public Pen LinkPen
- {
- get { return linkPen.Clone(); }
- set { linkPen = value; }
- }
- private SolidColorBrush linkBrush;
- public SolidColorBrush LinkBrush
- {
- get { return linkBrush.Clone(); }
- set { linkBrush = value; }
- }
- #endregion
- #region WidgetCreate
- private Pen createWidgetPen;
- public Pen CreateWidgetPen
- {
- get { return createWidgetPen.Clone(); }
- set { createWidgetPen = value; }
- }
- #endregion
- #region PDFViewer
- private Pen viewerImagePen;
- public Pen ViewerImagePen
- {
- get { return viewerImagePen.Clone(); }
- set { viewerImagePen = value; }
- }
- private Brush viewerImageBackgroundBrush;
- public Brush ViewerImageBackgroundBrush
- {
- get { return viewerImageBackgroundBrush.Clone(); }
- set { viewerImageBackgroundBrush = value; }
- }
- #endregion
- #region PDFEditMultiSelected
- private SolidColorBrush pDFEditMultiMoveBrush;
- public SolidColorBrush PDFEditMultiMoveBrush
- {
- get { return pDFEditMultiMoveBrush.Clone(); }
- set { pDFEditMultiMoveBrush = value; }
- }
- private Pen pDFEditMultiMovePen;
- public Pen PDFEditMultiMovePen
- {
- get { return pDFEditMultiMovePen.Clone(); }
- set { pDFEditMultiMovePen = value; }
- }
- private Pen pDFEditMultiMoveRectPen;
- public Pen PDFEditMultiMoveRectPen
- {
- get { return pDFEditMultiMoveRectPen.Clone(); }
- set { pDFEditMultiMoveRectPen = value; }
- }
- #region Not selected state
- private SolidColorBrush pDFEditMultiRectFillBrush;
- public SolidColorBrush PDFEditMultiRectFillBrush
- {
- get { return pDFEditMultiRectFillBrush.Clone(); }
- set { pDFEditMultiRectFillBrush = value; }
- }
- private Pen pDFEditMultiRectLinePen;
- public Pen PDFEditMultiRectLinePen
- {
- get { return pDFEditMultiRectLinePen.Clone(); }
- set { pDFEditMultiRectLinePen = value; }
- }
- private Pen pDFEditMultiPointPen;
- public Pen PDFEditMultiPointPen
- {
- get { return pDFEditMultiPointPen.Clone(); }
- set { pDFEditMultiPointPen = value; }
- }
- private SolidColorBrush pDFEditMultiPointBorderBrush;
- public SolidColorBrush PDFEditMultiPointBorderBrush
- {
- get { return pDFEditMultiPointBorderBrush.Clone(); }
- set { pDFEditMultiPointBorderBrush = value; }
- }
- #endregion
- #region Selected state
- private SolidColorBrush sPDFEditMultiRectFillBrush;
- public SolidColorBrush SPDFEditMultiRectFillBrush
- {
- get { return sPDFEditMultiRectFillBrush.Clone(); }
- set { sPDFEditMultiRectFillBrush = value; }
- }
- private Pen sPDFEditMultiRectLinePen;
- public Pen SPDFEditMultiRectLinePen
- {
- get { return sPDFEditMultiRectLinePen.Clone(); }
- set { sPDFEditMultiRectLinePen = value; }
- }
- private Pen sPDFEditMultiPointPen;
- public Pen SPDFEditMultiPointPen
- {
- get { return sPDFEditMultiPointPen.Clone(); }
- set { sPDFEditMultiPointPen = value; }
- }
- private SolidColorBrush sPDFEditMultiPointBorderBrush;
- public SolidColorBrush SPDFEditMultiPointBorderBrush
- {
- get { return sPDFEditMultiPointBorderBrush.Clone(); }
- set { sPDFEditMultiPointBorderBrush = value; }
- }
- private SolidColorBrush sPDFEditMultiCropBorderBrush;
- public SolidColorBrush SPDFEditMultiCropBorderBrush
- {
- get { return sPDFEditMultiCropBorderBrush.Clone(); }
- set { sPDFEditMultiCropBorderBrush = value; }
- }
- #endregion
- #region Hover state
- private SolidColorBrush pDFEditMultiRectFillHoverBrush;
- public SolidColorBrush PDFEditMultiRectFillHoverBrush
- {
- get { return pDFEditMultiRectFillHoverBrush.Clone(); }
- set { pDFEditMultiRectFillHoverBrush = value; }
- }
- private Pen pDFEditMultiRectLineHoverPen;
- public Pen PDFEditMultiRectLineHoverPen
- {
- get { return pDFEditMultiRectLineHoverPen.Clone(); }
- set { pDFEditMultiRectLineHoverPen = value; }
- }
- private Pen pDFEditMultiPointHoverPen;
- public Pen PDFEditMultiPointHoverPen
- {
- get { return pDFEditMultiPointHoverPen.Clone(); }
- set { pDFEditMultiPointHoverPen = value; }
- }
- private SolidColorBrush pDFEditMultiPointBorderHoverBrush;
- public SolidColorBrush PDFEditMultiPointBorderHoverBrush
- {
- get { return pDFEditMultiPointBorderHoverBrush.Clone(); }
- set { pDFEditMultiPointBorderHoverBrush = value; }
- }
- #endregion
- #endregion
- #region PageSelected
- private SolidColorBrush pageSelectedBgPen;
- public SolidColorBrush PageSelectedBgPen
- {
- get { return pageSelectedBgPen.Clone(); }
- set { pageSelectedBgPen = value; }
- }
- private SolidColorBrush pageSelectedBgBrush;
- public SolidColorBrush PageSelectedBgBrush
- {
- get { return pageSelectedBgBrush.Clone(); }
- set { pageSelectedBgBrush = value; }
- }
- private SolidColorBrush pageSelectedMoveBrush;
- public SolidColorBrush PageSelectedMoveBrush
- {
- get { return pageSelectedMoveBrush.Clone(); }
- set { pageSelectedMoveBrush = value; }
- }
- private Pen pageSelectedMovePen;
- public Pen PageSelectedMovePen
- {
- get { return pageSelectedMovePen.Clone(); }
- set { pageSelectedMovePen = value; }
- }
- #region Not selected state
- private SolidColorBrush pageSelectedRectFillBrush;
- public SolidColorBrush PageSelectedRectFillBrush
- {
- get { return pageSelectedRectFillBrush.Clone(); }
- set { pageSelectedRectFillBrush = value; }
- }
- private Pen pageSelectedRectLinePen;
- public Pen PageSelectedRectLinePen
- {
- get { return pageSelectedRectLinePen.Clone(); }
- set { pageSelectedRectLinePen = value; }
- }
- private Pen pageSelectedPointPen;
- public Pen PageSelectedPointPen
- {
- get { return pageSelectedPointPen.Clone(); }
- set { pageSelectedPointPen = value; }
- }
- private SolidColorBrush pageSelectedPointBorderBrush;
- public SolidColorBrush PageSelectedPointBorderBrush
- {
- get { return pageSelectedPointBorderBrush.Clone(); }
- set { pageSelectedPointBorderBrush = value; }
- }
- #endregion
- #region Selected state
- private SolidColorBrush sPageSelectedRectFillBrush;
- public SolidColorBrush SPageSelectedRectFillBrush
- {
- get { return sPageSelectedRectFillBrush.Clone(); }
- set { sPageSelectedRectFillBrush = value; }
- }
- private Pen sPageSelectedRectLinePen;
- public Pen SPageSelectedRectLinePen
- {
- get { return sPageSelectedRectLinePen.Clone(); }
- set { sPageSelectedRectLinePen = value; }
- }
- private Pen sPageSelectedPointPen;
- public Pen SPageSelectedPointPen
- {
- get { return sPageSelectedPointPen.Clone(); }
- set { sPageSelectedPointPen = value; }
- }
- private SolidColorBrush sPageSelectedPointBorderBrush;
- public SolidColorBrush SPageSelectedPointBorderBrush
- {
- get { return sPageSelectedPointBorderBrush.Clone(); }
- set { sPageSelectedPointBorderBrush = value; }
- }
- private SolidColorBrush sPageSelectedCropBorderBrush;
- public SolidColorBrush SPageSelectedCropBorderBrush
- {
- get { return sPageSelectedCropBorderBrush.Clone(); }
- set { sPageSelectedCropBorderBrush = value; }
- }
- #endregion
- #region Horver state
- private SolidColorBrush pageSelectedRectFillHoverBrush;
- public SolidColorBrush PageSelectedRectFillHoverBrush
- {
- get { return pageSelectedRectFillHoverBrush.Clone(); }
- set { pageSelectedRectFillHoverBrush = value; }
- }
- private Pen pageSelectedRectLineHoverPen;
- public Pen PageSelectedRectLineHoverPen
- {
- get { return pageSelectedRectLineHoverPen.Clone(); }
- set { pageSelectedRectLineHoverPen = value; }
- }
- private Pen pageSelectedPointHoverPen;
- public Pen PageSelectedPointHoverPen
- {
- get { return pageSelectedPointHoverPen.Clone(); }
- set { pageSelectedPointHoverPen = value; }
- }
- private SolidColorBrush pageSelectedPointBorderHoverBrush;
- public SolidColorBrush PageSelectedPointBorderHoverBrush
- {
- get { return pageSelectedPointBorderHoverBrush.Clone(); }
- set { pageSelectedPointBorderHoverBrush = value; }
- }
- #endregion
- #endregion
- public DefaultDrawParam()
- {
- //ShowAnnot
- ShowLinkBrush = new SolidColorBrush(Color.FromRgb(0x78, 0xB4, 0xDB));
- ShowLinkePen = null;
- // AnnotSelectedRect
- AnnotMoveBrush = new SolidColorBrush(Color.FromArgb(0x46, 0x46, 0x82, 0xB4));
- AnnotMovePen = new Pen(new SolidColorBrush(Color.FromRgb(0x00, 0xFF, 0x00)), 2);
- AnnotRectFillBrush = new SolidColorBrush(Color.FromArgb(0x01, 0x00, 0x00, 0x00));
- AnnotRectLinePen = new Pen(new SolidColorBrush(Color.FromRgb(71, 126, 222)), 2);
- AnnotRectHoverPen = new Pen(Brushes.Orange, 2) { DashStyle = DashStyles.Dash };
- AnnotPointPen = new Pen(new SolidColorBrush(Color.FromRgb(71, 126, 222)), 2);
- AnnotPointBorderBrush = Brushes.White;
- //PDFEdit
- CaretBrush = new SolidColorBrush(Color.FromArgb(0x46, 0x46, 0x82, 0xB4));
- CaretPen = new Pen(Brushes.Black, 1);
- PDFEditMovePen = new Pen(new SolidColorBrush(Color.FromRgb(0x00, 0xFF, 0x00)), 2);
- PDFEditMoveRectPen = new Pen(new SolidColorBrush(Color.FromRgb(0x00, 0xFF, 0x00)), 2);
- PDFEditMoveBrush = new SolidColorBrush(Color.FromArgb(0x46, 0x46, 0x82, 0xB4));
- PDFEditRectFillHoverBrush = new SolidColorBrush(Color.FromArgb(0x01, 0x00, 0x00, 0x00));
- PDFEditRectLineHoverPen = new Pen(Brushes.Orange, 2) { DashStyle = DashStyles.Dash };
- PDFEditPointHoverPen = new Pen(new SolidColorBrush(Color.FromRgb(71, 126, 222)), 2);
- PDFEditPointBorderHoverBrush = Brushes.White;
- PDFEditRectFillBrush = new SolidColorBrush(Color.FromArgb(0x01, 0x00, 0x00, 0x00));
- PDFEditRectLinePen = new Pen(new SolidColorBrush(Color.FromRgb(71, 126, 222)), 2) { DashStyle = DashStyles.Dash };
- PDFEditPointPen = new Pen(new SolidColorBrush(Color.FromRgb(71, 126, 222)), 2);
- PDFEditPointBorderBrush = Brushes.White;
- SPDFEditRectFillBrush = new SolidColorBrush(Color.FromArgb(0x01, 0x00, 0x00, 0x00));
- SPDFEditRectLinePen = new Pen(new SolidColorBrush(Color.FromRgb(71, 126, 222)), 2);
- SPDFEditPointPen = new Pen(new SolidColorBrush(Color.FromRgb(71, 126, 222)), 2);
- SPDFEditPointBorderBrush = Brushes.White;
- SPDFEditCropBorderBrush = new SolidColorBrush(Color.FromRgb(71, 126, 222));
- //AnnotEdit
- EditControlLineBrush = new SolidColorBrush(Color.FromRgb(0x78, 0xB4, 0xDB));
- EditControlLinePen = new Pen(new SolidColorBrush(Color.FromRgb(0x78, 0xB4, 0xDB)), 1);
- EditLinePen = new Pen(new SolidColorBrush(Color.FromRgb(0x78, 0xB4, 0xDB)), 1);
- //AnnotCreate
- RedactPen = new Pen(Brushes.Red, 1);
- LinkPen = new Pen(new SolidColorBrush(Color.FromRgb(71, 126, 222)), 1);
- LinkBrush = new SolidColorBrush(Color.FromRgb(0xCC, 0xDD, 0xEA));
- //WidgetCreate
- CreateWidgetPen = new Pen(new SolidColorBrush(Color.FromRgb(0x00, 0xFF, 0x00)), 2);
- //PDFViewer
- ViewerImagePen = new Pen(new SolidColorBrush(Color.FromRgb(0x46, 0x82, 0xB4)), 1);
- ViewerImageBackgroundBrush = new SolidColorBrush(Color.FromArgb(0x46, 0x46, 0x82, 0xB4));
- //PDFEditMultiSelected
- PDFEditMultiMoveRectPen = new Pen(new SolidColorBrush(Color.FromRgb(0x00, 0xFF, 0x00)), 2);
- PDFEditMultiMovePen = new Pen(new SolidColorBrush(Color.FromRgb(0x00, 0xFF, 0x00)), 2);
- PDFEditMultiMoveBrush = new SolidColorBrush(Color.FromArgb(0x46, 0x46, 0x82, 0xB4));
- PDFEditMultiRectFillHoverBrush = new SolidColorBrush(Color.FromArgb(0x01, 0x00, 0x00, 0x00));
- PDFEditMultiRectLineHoverPen = new Pen(Brushes.Orange, 2) { DashStyle = DashStyles.Dash };
- PDFEditMultiPointHoverPen = new Pen(new SolidColorBrush(Color.FromRgb(71, 126, 222)), 2);
- PDFEditMultiPointBorderHoverBrush = Brushes.White;
- PDFEditMultiRectFillBrush = new SolidColorBrush(Color.FromArgb(0x01, 0x00, 0x00, 0x00));
- PDFEditMultiRectLinePen = new Pen(new SolidColorBrush(Color.FromRgb(71, 126, 222)), 2) { DashStyle = DashStyles.Solid };
- PDFEditMultiPointPen = new Pen(new SolidColorBrush(Color.FromRgb(71, 126, 222)), 2);
- PDFEditMultiPointBorderBrush = Brushes.White;
- SPDFEditMultiRectFillBrush = new SolidColorBrush(Color.FromArgb(0x01, 0x00, 0x00, 0x00));
- SPDFEditMultiRectLinePen = new Pen(new SolidColorBrush(Color.FromRgb(71, 126, 222)), 2);
- SPDFEditMultiPointPen = new Pen(new SolidColorBrush(Color.FromRgb(71, 126, 222)), 2);
- SPDFEditMultiPointBorderBrush = Brushes.White;
- SPDFEditMultiCropBorderBrush = new SolidColorBrush(Color.FromRgb(71, 126, 222));
- //PageSelected
- PageSelectedBgPen = null;
- PageSelectedBgBrush = new SolidColorBrush(Color.FromArgb(0x99, 0x00, 0x00, 0x00));
- PageSelectedMovePen = new Pen(new SolidColorBrush(Color.FromRgb(0x00, 0xFF, 0x00)), 2);
- PageSelectedMoveBrush = new SolidColorBrush(Color.FromArgb(0x46, 0x46, 0x82, 0xB4));
- PageSelectedRectFillHoverBrush = new SolidColorBrush(Color.FromArgb(0x01, 0x00, 0x00, 0x00));
- PageSelectedRectLineHoverPen = new Pen(Brushes.Orange, 2) { DashStyle = DashStyles.Dash };
- PageSelectedPointHoverPen = new Pen(new SolidColorBrush(Color.FromRgb(71, 126, 222)), 2);
- PageSelectedPointBorderHoverBrush = Brushes.White;
- PageSelectedRectFillBrush = new SolidColorBrush(Color.FromArgb(0x01, 0x00, 0x00, 0x00));
- PageSelectedRectLinePen = new Pen(new SolidColorBrush(Color.FromRgb(71, 126, 222)), 2) { DashStyle = DashStyles.Dash };
- PageSelectedPointPen = new Pen(new SolidColorBrush(Color.FromRgb(71, 126, 222)), 2);
- PageSelectedPointBorderBrush = Brushes.White;
- SPageSelectedRectFillBrush = new SolidColorBrush(Color.FromArgb(0x01, 0x00, 0x00, 0x00));
- SPageSelectedRectLinePen = new Pen(new SolidColorBrush(Color.FromRgb(71, 126, 222)), 2);
- SPageSelectedPointPen = new Pen(new SolidColorBrush(Color.FromRgb(71, 126, 222)), 2);
- SPageSelectedPointBorderBrush = Brushes.White;
- SPageSelectedCropBorderBrush = new SolidColorBrush(Color.FromRgb(71, 126, 222));
- }
- }
- public class MeasureSetting
- {
- public double RulerBase { get; set; } = 1;
- public string RulerBaseUnit { get; set; } = CPDFMeasure.CPDF_CM;
- public double RulerTranslate { get; set; } = 1;
- public string RulerTranslateUnit { get; set; } = CPDFMeasure.CPDF_CM;
- public double Precision { get; set; } = 0.01;
- public double MoveDetectionLength { get; set; } = 10;
- public bool IsShowArea { get; set; } = true;
- public bool IsShowLength { get; set; } = true;
- /// <summary>
- /// Return inch
- /// </summary>
- internal static double GetPointLength(Point startPoint, Point endPoint, double zoom)
- {
- if (zoom > 0)
- {
- return (endPoint - startPoint).Length / zoom / 96D;
- }
- return 0;
- }
- internal double GetMeasureRatio(string baseUnit)
- {
- if (baseUnit == CPDFMeasure.CPDF_PT)
- {
- return 1 / 72;
- }
- if (baseUnit == CPDFMeasure.CPDF_IN)
- {
- return 1;
- }
- if (baseUnit == CPDFMeasure.CPDF_MM)
- {
- return 1 / 25.4;
- }
- if (baseUnit == CPDFMeasure.CPDF_CM)
- {
- return 1 / 2.54;
- }
- if (baseUnit == CPDFMeasure.CPDF_M)
- {
- return 1 / 0.0254;
- }
- if (baseUnit == CPDFMeasure.CPDFO_KM)
- {
- return 1 / 0.0254 / 1000;
- }
- if (baseUnit == CPDFMeasure.CPDF_FT)
- {
- return 12;
- }
- if (baseUnit == CPDFMeasure.CPDF_YD)
- {
- return 36;
- }
- if (baseUnit == CPDFMeasure.CPDF_MI)
- {
- return 63360;
- }
- return 0;
- }
- internal double GetMeasureAreaRatio()
- {
- if (RulerBaseUnit == CPDFMeasure.CPDF_PT)
- {
- return CPDFMeasure.pt;
- }
- if (RulerBaseUnit == CPDFMeasure.CPDF_IN)
- {
- return CPDFMeasure.pt_in;
- }
- if (RulerBaseUnit == CPDFMeasure.CPDF_MM)
- {
- return CPDFMeasure.pt_mm;
- }
- if (RulerBaseUnit == CPDFMeasure.CPDF_CM)
- {
- return CPDFMeasure.pt_cm;
- }
- if (RulerBaseUnit == CPDFMeasure.CPDF_M)
- {
- return CPDFMeasure.pt_m;
- }
- if (RulerBaseUnit == CPDFMeasure.CPDFO_KM)
- {
- return CPDFMeasure.pt_km;
- }
- if (RulerBaseUnit == CPDFMeasure.CPDF_FT)
- {
- return CPDFMeasure.pt_ft;
- }
- if (RulerBaseUnit == CPDFMeasure.CPDF_YD)
- {
- return CPDFMeasure.pt_yd;
- }
- if (RulerBaseUnit == CPDFMeasure.CPDF_MI)
- {
- return CPDFMeasure.pt_mi;
- }
- return 0;
- }
- public int GetMeasureSavePrecision()
- {
- if (Precision == 1)
- {
- return CPDFMeasure.PRECISION_VALUE_ZERO;
- }
- if (Precision == 0.1)
- {
- return CPDFMeasure.PRECISION_VALUE_ONE;
- }
- if (Precision == 0.01)
- {
- return CPDFMeasure.PRECISION_VALUE_TWO;
- }
- if (Precision == 0.001)
- {
- return CPDFMeasure.PRECISION_VALUE_THREE;
- }
- if (Precision == 0.0001)
- {
- return CPDFMeasure.PRECISION_VALUE_FOUR;
- }
- return 0;
- }
- internal double GetMeasureShowPrecision(int precision)
- {
- if (precision == CPDFMeasure.PRECISION_VALUE_ZERO)
- {
- return 1;
- }
- if (CPDFMeasure.PRECISION_VALUE_ONE == precision)
- {
- return 0.1;
- }
- if (CPDFMeasure.PRECISION_VALUE_TWO == precision)
- {
- return 0.01;
- }
- if (CPDFMeasure.PRECISION_VALUE_THREE == precision)
- {
- return 0.001;
- }
- if (CPDFMeasure.PRECISION_VALUE_FOUR == precision)
- {
- return 0.0001;
- }
- return 0;
- }
- internal double GetMeasureLength(Point startPoint, Point endPoint, double zoom)
- {
- try
- {
- double inch = GetPointLength(startPoint, endPoint, zoom);
- double ratio = GetMeasureRatio(RulerBaseUnit);
- double rate = RulerTranslate / RulerBase;
- return inch * rate / ratio;
- }
- catch (Exception ex)
- {
- }
- return 0;
- }
- public double GetMeasurePDFLength(double lenght)
- {
- try
- {
- double inch = lenght / 72D;
- double ratio = GetMeasureRatio(RulerBaseUnit);
- double rate = RulerTranslate / RulerBase;
- return inch * rate / ratio;
- }
- catch (Exception ex)
- {
- }
- return 0;
- }
- public double GetMeasurePDFArea(double area)
- {
- try
- {
- double inch = area;
- double ratio = GetMeasureAreaRatio();
- double rate = RulerTranslate / RulerBase;
- return inch * ratio * ratio * rate * rate;
- }
- catch (Exception ex)
- {
- }
- return 0;
- }
- public string GetPrecisionData(double number)
- {
- NumberFormatInfo formatInfo = new NumberFormatInfo();
- formatInfo.NumberDecimalDigits = 2;
- if (Precision == 1)
- {
- formatInfo.NumberDecimalDigits = 0;
- }
- if (Precision == 0.1)
- {
- formatInfo.NumberDecimalDigits = 1;
- }
- if (Precision == 0.01)
- {
- formatInfo.NumberDecimalDigits = 2;
- }
- if (Precision == 0.001)
- {
- formatInfo.NumberDecimalDigits = 3;
- }
- if (Precision == 0.0001)
- {
- formatInfo.NumberDecimalDigits = 4;
- }
- if (Precision == 0.00001)
- {
- formatInfo.NumberDecimalDigits = 5;
- }
- return number.ToString("N", formatInfo);
- }
- internal double ComputePolygonArea(List<Point> points)
- {
- int point_num = points.Count;
- if (point_num < 3)
- return 0.0;
- double s = points[0].Y * (points[point_num - 1].X - points[1].X);
- for (int i = 1; i < point_num; ++i)
- s += points[i].Y * (points[i - 1].X - points[(i + 1) % point_num].X);
- return Math.Abs(s / 2.0);
- }
- }
- }
|