InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IHyperlinkFacade.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Jianlan Song
6 //
7 // $Author$
8 //
9 // $DateTime$
10 //
11 // $Revision$
12 //
13 // $Change$
14 //
15 // Copyright 1997-2010 Adobe Systems Incorporated. All rights reserved.
16 //
17 // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
18 // with the terms of the Adobe license agreement accompanying it. If you have received
19 // this file from a source other than Adobe, then your use, modification, or
20 // distribution of it requires the prior written permission of Adobe.
21 //
22 //
23 // Note:
24 //
25 //========================================================================================
26 
27 
28 #include "Utils.h"
29 
30 // ----- Interfaces -----
31 #include "IHyperlinkAppearanceData.h"
32 #include "IPDFHyperlinks.h"
33 
34 // ----- ID.h files -----
35 #include "HyperlinkID.h"
36 
37 class XRefBuildingBlock;
38 
52 {
53  HyperlinkChanges() :
54  changeDestination(kFalse), newDestination(kInvalidUIDRef),
55  changeSource(kFalse), newSource(kInvalidUIDRef),
56  changeName(kFalse), newName(),
57  changeVisibility(kFalse), visible(kFalse),
58  changeBorderWidth(kFalse), borderLineWidth(1),
59  changeBorderColor(kFalse), borderColor(kInvalidUID),
60  changeHilight(kFalse), hilight(IHyperlinkAppearanceData::kNoHyperlinkHilight),
61  changeOutline(kFalse), outlineStyle(IHyperlinkAppearanceData::kHyperlinkSolidOutline),
62  changeHyperlinkAltText(kFalse), hyperlinkAltText(PMString(""))
63  {}
64 
65  bool16 changeDestination;
66  UIDRef newDestination;
67 
68  bool16 changeSource;
69  UIDRef newSource;
70 
71  bool16 changeName;
72  PMString newName;
73 
74  bool16 changeVisibility;
75  bool16 visible;
76 
77  bool16 changeBorderWidth;
78  int32 borderLineWidth;
79 
80  bool16 changeBorderColor;
81  UID borderColor;
82 
83  bool16 changeHilight;
84  IHyperlinkAppearanceData::HyperlinkHilight hilight;
85 
86  bool16 changeOutline;
87  IHyperlinkAppearanceData::HyperlinkOutlineLineStyle outlineStyle;
88 
89  bool16 changeHyperlinkAltText;
90  PMString hyperlinkAltText;
91 };
92 
93 namespace Facade
94 {
131  {
132  public:
133  enum { kDefaultIID = IID_IHYPERLINKFACADE };
134 
135 
154  virtual ErrorCode CreateHyperlink
155  (
156  UIDRef hyperlinkSource,
157  UIDRef hyperlinkDestination,
158  UIDRef* newHyperlink = nil,
159  const PMString& hyperlinkName = "",
160  bool16 visible = kTrue,
161  bool16 defaultAppearance = kTrue,
162  bool16 visibleRectangle = kFalse,
163  int32 borderLineWidth = 1,
164  UID borderColor = kInvalidUID,
165  IHyperlinkAppearanceData::HyperlinkHilight hilight = IHyperlinkAppearanceData::kNoHyperlinkHilight,
166  IHyperlinkAppearanceData::HyperlinkOutlineLineStyle outlineStyle = IHyperlinkAppearanceData::kHyperlinkSolidOutline,
167  const PMString& altText = ""
168  ) = 0;
169 
182  virtual ErrorCode DeleteHyperlinks
183  (
184  UIDList hyperlinks
185  ) = 0;
186 
194  virtual ErrorCode RenameHyperlink
195  (
196  UIDRef hyperlink,
197  const PMString& newName
198  ) = 0;
199 
207  virtual ErrorCode ChangeSourceForHyperlink
208  (
209  UIDRef hyperlink,
210  UIDRef newSource
211  ) = 0;
212 
220  virtual ErrorCode ChangeDestinationForHyperlink
221  (
222  UIDRef hyperlink,
223  UIDRef newDestination
224  ) = 0;
225 
232  virtual ErrorCode ChangeHyperlinkToDefaultAppearance
233  (
234  UIDRef hyperlink
235  ) = 0;
236 
255  virtual ErrorCode ChangeHyperlinkAppearance
256  (
257  UIDRef hyperlink,
258  bool16 changeVisible ,
259  bool16 visible,
260  bool16 changeWidth ,
261  int32 borderLineWidth,
262  bool16 changeBorderColor,
263  UID borderColor,
264  bool16 changeHilight,
265  IHyperlinkAppearanceData::HyperlinkHilight hilight,
266  bool16 changeOutlineStyle,
267  IHyperlinkAppearanceData::HyperlinkOutlineLineStyle outlineStyle
268  ) = 0;
269 
277  virtual ErrorCode ChangeHyperlinkVisibility
278  (
279  UIDRef hyperlink,
280  bool16 visible
281  ) = 0;
282 
290  virtual ErrorCode ChangeHyperlinkBorderWidth
291  (
292  UIDRef hyperlink,
293  int32 borderLineWidth
294  ) = 0;
295 
303  virtual ErrorCode ChangeHyperlinkBorderColor
304  (
305  UIDRef hyperlink,
306  UID borderColor
307  ) = 0;
308 
316  virtual ErrorCode ChangeHyperlinkHilight
317  (
318  UIDRef hyperlink,
319  IHyperlinkAppearanceData::HyperlinkHilight hilight
320  ) = 0;
321 
329  virtual ErrorCode ChangeHyperlinkOutlineStyle
330  (
331  UIDRef hyperlink,
332  IHyperlinkAppearanceData::HyperlinkOutlineLineStyle outlineStyle
333  ) = 0;
334 
335 
344  virtual ErrorCode ChangeHyperlink
345  (
346  UIDRef hyperlink,
347  const HyperlinkChanges &changes
348  ) = 0;
349 
357  virtual ErrorCode UpdateHyperlinkDestinationInfo
358  (
359  UIDList hyperlinks,
360  bool16 openClosedDoc = kTrue
361  ) = 0;
362 
363 
370  virtual ErrorCode DeleteHyperlinkSource
371  (
372  UIDList sources
373  ) = 0;
374 
389  virtual ErrorCode CreateHyperlinkTextSource
390  (
391  UIDRef story,
392  TextIndex startIndex,
393  int32 length,
394  UIDRef* newSource = nil,
395  const PMString& hyperlinkName = "",
396  UID charStyle = kInvalidUID,
397  bool16 visible = kTrue
398  ) = 0;
399 
413  virtual ErrorCode CreateXRefTextSource
414  (
415  UIDRef story,
416  TextIndex startIndex,
417  int32 length,
418  UID xrefFormat,
419  UIDRef* newSource = nil,
420  const PMString& hyperlinkName = "",
421  bool16 visible = kTrue
422  ) = 0;
423 
431  virtual ErrorCode RenameTextSource
432  (
433  UIDRef source,
434  const PMString& hyperlinkName
435  ) = 0;
436 
444  virtual ErrorCode ChangeTextSourceCharacterStyle
445  (
446  UIDRef source,
447  UID charStyle
448  ) = 0;
449 
456  virtual ErrorCode ConvertXRefToHyperlink
457  (
458  UIDRef source
459  ) = 0;
460 
468  virtual ErrorCode ChangeFormatForXRef
469  (
470  UIDRef source,
471  UID xrefFormat
472  ) = 0;
473 
481  virtual ErrorCode ConvertHyperlinkToXRef
482  (
483  UIDRef source,
484  UID xrefFormat
485  ) = 0;
486 
505  virtual ErrorCode ChangeTextSource
506  (
507  UIDRef source,
508  bool16 changeStory,
509  UIDRef story,
510  bool16 changeRange = kFalse,
511  TextIndex startIndex = -1,
512  int32 length = -1,
513  bool16 changeName = kFalse,
514  const PMString& hyperlinkName = "",
515  bool16 changeCharStyle = kFalse,
516  UID charStyle = kInvalidUID,
517  bool16 changeXRefInfo = kFalse,
518  bool16 isXRef = kFalse,
519  UID xrefFormat = kInvalidUID
520  ) = 0;
521 
528  virtual ErrorCode UpdateXRefSource
529  (
530  UIDList xrefs
531  ) = 0;
532 
539  virtual ErrorCode UpdateXRefSrcsForBook
540  (
541  const IDFile& bookFile
542  ) = 0;
543 
544 
555  virtual ErrorCode CreateHyperlinkPageItemSource
556  (
557  UIDRef pageItem,
558  UIDRef* newSource = nil,
559  const PMString& name = "",
560  bool16 visible = kTrue
561  ) = 0;
562 
570  virtual ErrorCode RenameHyperlinkPageItemSource
571  (
572  UIDRef source,
573  const PMString& name
574  ) = 0;
575 
583  virtual ErrorCode ChangeHyperlinkPageItemSource
584  (
585  UIDRef source,
586  UIDRef pageItem
587  ) = 0;
588 
597  virtual ErrorCode ChangeHyperlinkPageItemSource
598  (
599  UIDRef source,
600  UIDRef pageItem,
601  const PMString& name
602  ) = 0;
603 
604 
611  virtual ErrorCode DeleteHyperlinkDestination
612  (
613  UIDList destinations
614  ) = 0;
615 
632  virtual ErrorCode CreateHyperlinkTextDestination
633  (
634  UIDRef story,
635  TextIndex position,
636  UIDRef* newDest = nil,
637  const PMString& name = "",
638  bool16 visible = kTrue,
639  bool16 useExistingAnchor = kFalse,
640  int32 uniqueKey = 0
641  ) = 0;
642 
661  virtual ErrorCode CreateParagraphDestination
662  (
663  UIDRef story,
664  TextIndex position,
665  UIDRef* newDest = nil,
666  bool16* newDestCreated = nil,
667  const PMString& name = "",
668  int32 uniqueKey = 0
669  ) = 0;
670 
678  virtual ErrorCode RenameHyperlinkTextDestination
679  (
680  UIDRef destination,
681  const PMString& name
682  ) = 0;
683 
697  virtual ErrorCode ChangeHyperlinkTextDestination
698  (
699  UIDRef destination,
700  bool16 changeStory,
701  UIDRef story,
702  bool16 changePosition,
703  TextIndex position,
704  bool16 changeName = kFalse,
705  const PMString& name = ""
706  ) = 0;
707 
708 
724  virtual ErrorCode CreateHyperlinkPageDestination
725  (
726  UIDRef page,
727  UIDRef* newDest,
728  const PMString& name,
729  bool16 visible,
730  PMReal zoomFact = 1.0,
732  PMRect zoomRectangle = kEmptyRect,
733  int32 uniqueKey = 0
734  ) = 0;
735 
751  (
752  UIDRef page,
753  UIDRef* newDest,
754  bool16 visible,
755  PMReal zoomFact = 1.0,
757  PMRect zoomRectangle = kEmptyRect,
758  int32 uniqueKey = 0
759  ) = 0;
760 
768  virtual ErrorCode RenameHyperlinkPageDestination
769  (
770  UIDRef destination,
771  const PMString& name
772  ) = 0;
773 
781  (
782  UIDRef destination
783  ) = 0;
784 
798  virtual ErrorCode ChangeZoomForHyperlinkPageDestination
799  (
800  UIDRef destination,
801  bool16 changeZoomFact,
802  PMReal zoomFact,
803  bool16 changeFitType = kFalse,
804  int32 pdfFitType = -1,
805  bool16 changeRect = kFalse,
806  PMRect zoomRectangle = kEmptyRect
807  ) = 0;
808 
826  virtual ErrorCode ChangeHyperlinkPageDestination
827  (
828  UIDRef destination,
829  bool16 changePage,
830  UIDRef page,
831  bool16 changeName = kFalse,
832  const PMString& name = "",
833  bool16 changeZoomFact = kFalse,
834  PMReal zoomFact = -1,
835  bool16 changeFitType = kFalse,
836  int32 pdfFitType = -1,
837  bool16 changeRect = kFalse,
838  PMRect zoomRectangle = kEmptyRect
839  ) = 0;
840 
857  (
858  UIDRef destination,
859  bool16 changePage,
860  UIDRef page,
861  bool16 changeZoomFact = kFalse,
862  PMReal zoomFact = -1,
863  bool16 changeFitType = kFalse,
864  int32 pdfFitType = -1,
865  bool16 changeRect = kFalse,
866  PMRect zoomRectangle = kEmptyRect
867  ) = 0;
868 
869 
885  virtual ErrorCode CreateHyperlinkExternPageDestination
886  (
887  IDataBase* db,
888  const PMString& filePath,
889  int32 pageIndex,
890  UIDRef* newDest = nil,
891  PMReal zoomFact = 1.0,
893  PMRect zoomRectangle = kEmptyRect,
894  int32 uniqueKey = 0
895  ) = 0;
896 
905  (
906  UIDRef destination,
907  int32 pageIndex
908  ) = 0;
909 
923  virtual ErrorCode ChangeZoomForHyperlinkExternPageDest
924  (
925  UIDRef destination,
926  bool16 changeZoomFact,
927  PMReal zoomFact,
928  bool16 changeFitType = kFalse,
929  int32 pdfFitType = -1,
930  bool16 changeRect = kFalse,
931  PMRect zoomRectangle = kEmptyRect
932  ) = 0;
933 
951  virtual ErrorCode ChangeHyperlinkExternPageDestination
952  (
953  UIDRef destination,
954  bool16 changeFile,
955  const PMString& filePath,
956  bool16 changePageIndex,
957  int32 pageIndex,
958  bool16 changeZoomFact = kFalse,
959  PMReal zoomFact = -1,
960  bool16 changeFitType = kFalse,
961  int32 pdfFitType = -1,
962  bool16 changeRect = kFalse,
963  PMRect zoomRectangle = kEmptyRect
964  ) = 0;
965 
966 
980  virtual ErrorCode CreateHyperlinkURLDestination
981  (
982  IDataBase* db,
983  const PMString& urlString,
984  UIDRef* newDest = nil,
985  const PMString& name = "",
986  bool16 visible = kTrue,
987  int32 uniqueKey = 0
988  ) = 0;
989 
997  virtual ErrorCode ChangeHyperlinkURLDestinationName
998  (
999  UIDRef destination,
1000  const PMString& name
1001  ) = 0;
1002 
1010  virtual ErrorCode ChangeHyperlinkURLDestinationURL
1011  (
1012  UIDRef destination,
1013  const PMString& urlString
1014  ) = 0;
1015 
1024  virtual ErrorCode ChangeHyperlinkURLDestination
1025  (
1026  UIDRef destination,
1027  const PMString& urlString,
1028  const PMString& name
1029  ) = 0;
1030 
1031 
1042  virtual ErrorCode CreateXRefFormat
1043  (
1044  IDataBase* db,
1045  UIDRef* newFormat = nil,
1046  const K2Vector<XRefBuildingBlock>* buildingBlocks = nil,
1047  const PMString& name = "",
1048  UID charStyle = kInvalidUID
1049  ) = 0;
1050 
1057  virtual ErrorCode DeleteXRefFormat
1058  (
1059  UIDList formats
1060  ) = 0;
1061 
1069  virtual ErrorCode ChangeXRefFormatName
1070  (
1071  UIDRef format,
1072  const PMString& name
1073  ) = 0;
1074 
1082  virtual ErrorCode ChangeXRefFormatCharacterStyle
1083  (
1084  UIDRef format,
1085  UID charStyle
1086  ) = 0;
1087 
1096  virtual ErrorCode ChangeXRefFormatBuildingBlocks
1097  (
1098  UIDRef format,
1099  const K2Vector<XRefBuildingBlock>* buildingBlocks
1100  ) = 0;
1101 
1110  virtual ErrorCode ChangeXRefFormat
1111  (
1112  UIDRef format,
1113  const PMString& name,
1114  const K2Vector<XRefBuildingBlock>* buildingBlocks,
1115  UID charStyle
1116  ) = 0;
1117 
1125  virtual ErrorCode LoadXRefFormats
1126  (
1127  IDataBase* db,
1128  const IDFile& sourceFile
1129  ) = 0;
1130 
1138  virtual ErrorCode LoadXRefFormatsFromCloudID(IDataBase* db, const std::string & assetRef) =0;
1139  };
1140 }
1141