PDF: add support for named destinations.

Landing patchset 7 from https://codereview.appspot.com/7374052 for dml@google.com
Review URL: https://codereview.chromium.org/12533009

git-svn-id: http://skia.googlecode.com/svn/trunk@8034 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/pdf/SkPDFDevice.h b/include/pdf/SkPDFDevice.h
index a13d617..90379f9 100644
--- a/include/pdf/SkPDFDevice.h
+++ b/include/pdf/SkPDFDevice.h
@@ -17,6 +17,7 @@
 #include "SkRect.h"
 #include "SkRefCnt.h"
 #include "SkStream.h"
+#include "SkTDArray.h"
 #include "SkTScopedPtr.h"
 
 class SkPDFArray;
@@ -33,6 +34,7 @@
 // Private classes.
 struct ContentEntry;
 struct GraphicStateEntry;
+struct NamedDestination;
 
 /** \class SkPDFDevice
 
@@ -142,6 +144,12 @@
      */
     SK_API const SkTDArray<SkPDFFont*>& getFontResources() const;
 
+    /** Add our named destinations to the supplied dictionary.
+     *  @param dict  Dictionary to add destinations to.
+     *  @param page  The PDF object representing the page for this device.
+     */
+    void appendDestinations(SkPDFDict* dict, SkPDFObject* page);
+
     /** Returns a copy of the media box for this device. The caller is required
      *  to unref() this when it is finished.
      */
@@ -191,6 +199,7 @@
     SkRegion fExistingClipRegion;
     SkPDFArray* fAnnotations;
     SkPDFDict* fResourceDict;
+    SkTDArray<NamedDestination*> fNamedDestinations;
 
     SkTDArray<SkPDFGraphicState*> fGraphicStateResources;
     SkTDArray<SkPDFObject*> fXObjectResources;
@@ -273,8 +282,17 @@
      */
     void copyContentEntriesToData(ContentEntry* entry, SkWStream* data) const;
 
-    bool handleAnnotations(const SkRect& r, const SkMatrix& matrix,
-                           const SkPaint& paint);
+    bool handleRectAnnotation(const SkRect& r, const SkMatrix& matrix,
+                              const SkPaint& paint);
+    bool handlePointAnnotation(const SkPoint* points, size_t count,
+                               const SkMatrix& matrix, const SkPaint& paint);
+    SkPDFDict* createLinkAnnotation(const SkRect& r, const SkMatrix& matrix);
+    void handleLinkToURL(SkData* urlData, const SkRect& r,
+                         const SkMatrix& matrix);
+    void handleLinkToNamedDest(SkData* nameData, const SkRect& r,
+                               const SkMatrix& matrix);
+    void defineNamedDestination(SkData* nameData, const SkPoint& point,
+                                const SkMatrix& matrix);
 
     typedef SkDevice INHERITED;
 };