This file is indexed.

/usr/include/podofo/doc/PdfDestination.h is in libpodofo-dev 0.9.4-6.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
/***************************************************************************
 *   Copyright (C) 2006 by Dominik Seichter                                *
 *   domseichter@web.de                                                    *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU Library General Public License as       *
 *   published by the Free Software Foundation; either version 2 of the    *
 *   License, or (at your option) any later version.                       *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU Library General Public     *
 *   License along with this program; if not, write to the                 *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 *                                                                         *
 *   In addition, as a special exception, the copyright holders give       *
 *   permission to link the code of portions of this program with the      *
 *   OpenSSL library under certain conditions as described in each         *
 *   individual source file, and distribute linked combinations            *
 *   including the two.                                                    *
 *   You must obey the GNU General Public License in all respects          *
 *   for all of the code used other than OpenSSL.  If you modify           *
 *   file(s) with this exception, you may extend this exception to your    *
 *   version of the file(s), but you are not obligated to do so.  If you   *
 *   do not wish to do so, delete this exception statement from your       *
 *   version.  If you delete this exception statement from all source      *
 *   files in the program, then also delete it here.                       *
 ***************************************************************************/

#ifndef _PDF_DESTINATION_H_
#define _PDF_DESTINATION_H_

#include "podofo/base/PdfDefines.h"

#include "podofo/base/PdfArray.h"
#include "podofo/base/PdfRect.h"
#include "podofo/base/PdfReference.h"

namespace PoDoFo {

class PdfAction;
class PdfPage;
class PdfRect;

enum EPdfDestinationFit {
    ePdfDestinationFit_Fit,
    ePdfDestinationFit_FitH,
    ePdfDestinationFit_FitV,
    ePdfDestinationFit_FitB,
    ePdfDestinationFit_FitBH,
    ePdfDestinationFit_FitBV,

    ePdfDestinationFit_Unknown = 0xFF
};

/** Destination type, as per 12.3.2.2 of the Pdf spec.
 *
 *  (see table 151 in the pdf spec)
 */
enum EPdfDestinationType {
  ePdfDestinationType_XYZ,
  ePdfDestinationType_Fit,
  ePdfDestinationType_FitH,
  ePdfDestinationType_FitV,
  ePdfDestinationType_FitR,
  ePdfDestinationType_FitB,
  ePdfDestinationType_FitBH,
  ePdfDestinationType_FitBV,
  
  ePdfDestinationType_Unknown = 0xFF
};

/** A destination in a PDF file.
 *  A destination can either be a page or an action.
 *
 *  \see PdfOutlineItem \see PdfAnnotation \see PdfDocument
 */
class PODOFO_DOC_API PdfDestination {
 public:

    /** Create an empty destination - points to nowhere
     */
    PdfDestination( PdfVecObjects* pParent );

    /** Create a new PdfDestination from an existing PdfObject (such as loaded from a doc)
     *  \param pObject the object to construct from 
     *  \param pDocument a PDF document owning this destination, needed to resolve pages
     */
    PdfDestination( PdfObject* pObject, PdfDocument* pDocument );

    /** Create a new PdfDestination from an existing PdfObject (such as loaded from a doc)
     *  \param pObject the object to construct from 
     *  \param pVecObjects a PdfVecObjects owning this destination, needed to resolve pages
     */
    PdfDestination( PdfObject* pObject, PdfVecObjects* pVecObjects );

    /** Create a new PdfDestination with a page as destination
     *  \param pPage a page which is the destination 
     *  \param eFit fit mode for the page. Must be ePdfDestinationFit_Fit or ePdfDestinationFit_FitB
     */
    PdfDestination( const PdfPage* pPage, EPdfDestinationFit eFit = ePdfDestinationFit_Fit );

    /** Create a destination to a page with its contents magnified to fit into the given rectangle
     *  \param pPage a page which is the destination 
     *  \param rRect magnify the page so that the contents of the rectangle are visible
     */
    PdfDestination( const PdfPage* pPage, const PdfRect & rRect );

    /** Create a new destination to a page with specified left 
     *  and top coordinates and a zoom factor.
     *  \param pPage a page which is the destination 
     *  \param dLeft left coordinate
     *  \param dTop  top coordinate
     *  \param dZoom zoom factor in the viewer
     */
    PdfDestination( const PdfPage* pPage, double dLeft, double dTop, double dZoom );

    /** Create a new destination to a page.
     *  \param pPage a page which is the destination 
     *  \param eFit fit mode for the Page. Allowed values are ePdfDestinationFit_FitH,
     *              ePdfDestinationFit_FitV, ePdfDestinationFit_FitBH, ePdfDestinationFit_FitBV
     *  \param dValue value which is a required argument for the selected fit mode
     */
    PdfDestination( const PdfPage* pPage, EPdfDestinationFit eFit, double dValue );
    
    /** Copy an existing PdfDestination
     *  \param rhs copy this PdfDestination
     */
    PdfDestination( const PdfDestination & rhs );

    /** Copy an existing PdfDestination
     *  \param rhs copy this PdfDestination
     *  \returns this object
     */
    const PdfDestination & operator=( const PdfDestination & rhs );

    /** Get the page that this destination points to
     *  Requires that this PdfDestination was somehow
     *  created by or from a PdfDocument. Won't work otherwise.
     *  \param pDoc a PDF document owning this destination, needed to resolve pages
     * 
     *  \returns the referenced PdfPage
     */
    PdfPage* GetPage( PdfDocument* pDoc ); 

    /** Get the page that this destination points to
     *  Requires that this PdfDestination was somehow
     *  created by or from a PdfDocument. Won't work otherwise.
     *  \param pVecObjects a PdfVecObjects owning this destination, needed to resolve pages
     * 
     *  \returns the referenced PdfPage
     */
    PdfPage* GetPage( PdfVecObjects* pVecObjects );
    
    /** Get the destination fit type
     *
     *  \returns the fit type
     */
    inline EPdfDestinationType GetType() const;
    
    /** Get the destination zoom 
     *  Destination must be of type XYZ
     *  otherwise exception is thrown.
     *
     *  \returns the zoom
     */
    inline double GetZoom() const;
    
    /** Get the destination rect 
     *  Destination must be of type FirR
     *  otherwise exception is thrown
     *
     *  \returns the destination rect
     */
    inline PdfRect GetRect() const;
     
    /** Get the destination Top position
     *  Destination must be of type XYZ, FitH, FitR, FitBH
     *  otherwise exception is thrown.
     * 
     * \returns the Top position
     */
    inline double GetTop() const; 
    
    /** Get the destination Left position 
     *  Destination must be of type XYZ, FitV or FitR
     *  otherwise exception is thrown.
     * 
     * \returns the Left position
     */
    inline double GetLeft() const;
    
    /** Get the destination Value 
     *  Destination must be of type FitH, FitV
     *  or FitBH, otherwise exception is thrown 
     * 
     *  \returns the destination Value
     */
    inline double GetDValue() const;
    
    /** Get access to the internal object
     *
     *  \returns the internal PdfObject
     */
    inline PdfObject* GetObject();
    
    /** Get access to the internal object
     *  This is an overloaded member function.
     *
     *  \returns the internal PdfObject
     */
    inline const PdfObject* GetObject() const;

    /** Get access to the internal array
     *  \returns the internal PdfArray
     */
    inline PdfArray &GetArray();
    
    /** Get access to the internal array
     *  This is an overloaded member function.
     *
     *  \returns the internal PdfArray
     */
    inline const PdfArray &GetArray() const;

    
    /** Adds this destination to an dictionary.
     *  This method handles the all the complexities of making sure it's added correctly
     *
     *  If this destination is empty. Nothing will be added.
     *
     *  \param dictionary the destination will be added to this dictionary
     */
    void AddToDictionary( PdfDictionary & dictionary ) const;

 private:
    /** Initialize a new PdfDestination from an existing PdfObject (such as loaded from a doc)
     *  and a document.
     *
     *  \param pObject the object to construct from 
     *  \param pDoc a PDF document owning this destination, needed to resolve pages
     */
    void Init( PdfObject* pObject, PdfDocument* pDocument );

 private:
    static const long  s_lNumDestinations;
    static const char* s_names[];

    PdfArray	m_array;
    PdfObject*	m_pObject;

    /** Create an empty destination - NOT ALLOWED
     */
    PdfDestination();
    
};

// -----------------------------------------------------
// 
// -----------------------------------------------------
inline PdfObject* PdfDestination::GetObject()
{
    return m_pObject;
}

// -----------------------------------------------------
// 
// -----------------------------------------------------
inline const PdfObject* PdfDestination::GetObject() const
{
    return m_pObject;
}

// -----------------------------------------------------
// 
// -----------------------------------------------------
inline PdfArray &PdfDestination::GetArray()
{
    return m_array;
}

// -----------------------------------------------------
// 
// -----------------------------------------------------
inline const PdfArray &PdfDestination::GetArray() const
{
    return m_array;
}

// -----------------------------------------------------
// 
// -----------------------------------------------------
inline EPdfDestinationType PdfDestination::GetType() const 
{
    if ( !m_array.size() ) 
        return ePdfDestinationType_Unknown;  
    
    PdfName tp = m_array[1].GetName();
    
    if ( tp == PdfName("XYZ") ) return ePdfDestinationType_XYZ;
    if ( tp == PdfName("Fit") ) return ePdfDestinationType_Fit;
    if ( tp == PdfName("FitH") ) return ePdfDestinationType_FitH;
    if ( tp == PdfName("FitV") ) return ePdfDestinationType_FitV;   
    if ( tp == PdfName("FitR") ) return ePdfDestinationType_FitR; 
    if ( tp == PdfName("FitB") ) return ePdfDestinationType_FitB; 
    if ( tp == PdfName("FitBH") ) return ePdfDestinationType_FitBH; 
    if ( tp == PdfName("FitBV") ) return ePdfDestinationType_FitBV; 
    
    return ePdfDestinationType_Unknown; 
}

// -----------------------------------------------------
// 
// -----------------------------------------------------
inline double PdfDestination::GetDValue() const 
{
    EPdfDestinationType tp = GetType();
    
    if ( tp != ePdfDestinationType_FitH
         && tp != ePdfDestinationType_FitV
         && tp != ePdfDestinationType_FitBH )
    {
        PODOFO_RAISE_ERROR( ePdfError_WrongDestinationType );
    }
    
    return m_array[2].GetReal();
}

// -----------------------------------------------------
// 
// -----------------------------------------------------
inline double PdfDestination::GetLeft() const
{
    EPdfDestinationType tp = GetType();
    
    if ( tp != ePdfDestinationType_FitV
         && tp != ePdfDestinationType_XYZ
         && tp != ePdfDestinationType_FitR )
    {
        PODOFO_RAISE_ERROR( ePdfError_WrongDestinationType );
    }
    
    return m_array[2].GetReal();
}

// -----------------------------------------------------
// 
// -----------------------------------------------------
inline PdfRect PdfDestination::GetRect() const
{
    if ( GetType() != ePdfDestinationType_FitR )
    {
        PODOFO_RAISE_ERROR( ePdfError_WrongDestinationType );
    }
    
    return PdfRect(m_array[2].GetReal(), m_array[3].GetReal(),
                   m_array[4].GetReal(), m_array[5].GetReal());
}

// -----------------------------------------------------
// 
// -----------------------------------------------------
inline double PdfDestination::GetTop() const
{
    EPdfDestinationType tp = GetType();
    
    switch (tp) 
    { 
        case ePdfDestinationType_XYZ:
            return m_array[3].GetReal();
        case ePdfDestinationType_FitH:
        case ePdfDestinationType_FitBH:
            return m_array[2].GetReal();
        case ePdfDestinationType_FitR:
            return m_array[5].GetReal();
        case ePdfDestinationType_Fit:
        case ePdfDestinationType_FitV:
        case ePdfDestinationType_FitB:
        case ePdfDestinationType_FitBV:
        case ePdfDestinationType_Unknown:
        default:
        {
            PODOFO_RAISE_ERROR( ePdfError_WrongDestinationType );
        }
    };
}

// -----------------------------------------------------
// 
// -----------------------------------------------------
inline double PdfDestination::GetZoom() const
{
    if ( GetType() != ePdfDestinationType_XYZ )
    {
        PODOFO_RAISE_ERROR( ePdfError_WrongDestinationType );
    }
  
    return m_array[4].GetReal();
}

};




#endif // _PDF_DESTINATION_H_