12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994 |
- 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 PolygonParam polygonParamDef;
- public PolygonParam PolygonParamDef
- {
- get
- {
- PolygonParam Param = new PolygonParam();
- if (polygonParamDef.CopyTo(Param))
- {
- return Param;
- }
- return null;
- }
- private set
- {
- value.CopyTo(polygonParamDef);
- }
- }
- 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;
- }
- else
- {
- PolygonParamDef = annotParam as PolygonParam;
- 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;
- 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);
- }
- }
- }
|