Changeset 58

Show
Ignore:
Timestamp:
04/14/06 10:13:02 (2 years ago)
Author:
jordi
Message:

I've changed the old DocumentIndex? class name to DocumentOutline?, following a little closer the PDF specifications.

Created a new test fixture for the DocumentOutline?, removing this part from the PDFDocument test fixture.

I also removed the Poppler headers from the epdfview.h header, so I don't need to specify the POPPLER_CFLAGS on the test directory.

Location:
trunk
Files:
2 added
11 modified
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/src/DocumentOutline.cxx

    r49 r58  
    2222 
    2323/// 
    24 /// @brief Constructs a new DocumentIndex. 
     24/// @brief Constructs a new DocumentOutline. 
    2525/// 
    26 DocumentIndex::DocumentIndex () 
     26DocumentOutline::DocumentOutline () 
    2727{ 
    2828} 
    2929 
    3030/// 
    31 /// @brief Destroys any dynamically created object of DocumentIndex; 
     31/// @brief Destroys any dynamically allocated memory for DocumentOutline. 
    3232/// 
    33 DocumentIndex::~DocumentIndex () 
     33DocumentOutline::~DocumentOutline () 
    3434{ 
    3535} 
    3636 
    3737/// 
    38 /// @brief Get the number of children for this index. 
     38/// @brief Get the outline's destination page. 
    3939/// 
    40 /// @return The number of children this index has. 
     40/// I'm only using the outlines as a way to go to an specific page, although 
     41/// the PDF Specification says that an outline could open a page from another 
     42/// file, execute an application, etc... I won't use all those features and 
     43/// concentrate only on the pages. 
     44/// 
     45/// @return The destination page number for the outline number or 1 if the 
     46///         outline item has no page number (like the root outline item or 
     47///         other kinds of destinations). 
    4148/// 
    4249gint 
    43 DocumentIndex::getNumChildren () 
     50DocumentOutline::getDestinationPage () 
     51{ 
     52    return 1; 
     53} 
     54 
     55/// 
     56/// @brief The first children of the outline item. 
     57/// 
     58/// @return The pointer to the first children of the outline item, or 
     59///         NULL if the outline has no children. 
     60/// 
     61DocumentOutline * 
     62DocumentOutline::getFirstChild () 
     63{ 
     64    return NULL; 
     65} 
     66 
     67/// 
     68/// @brief Gets the number of children for this outline. 
     69/// 
     70/// @return The number of children this utline has. 
     71/// 
     72gint 
     73DocumentOutline::getNumChildren () 
    4474{ 
    4575    return 0; 
    4676} 
     77 
     78/// 
     79/// @brief Gets the outline's title. 
     80/// 
     81/// @return The title of the outline item or an empty string if the 
     82///         outline item has no title (like the root outline item). 
     83/// 
     84const gchar * 
     85DocumentOutline::getTitle () 
     86{ 
     87    return ""; 
     88} 
  • trunk/src/DocumentOutline.h

    r49 r58  
    1616// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
    1717 
    18 #if !defined (__DOCUMENT_INDEX_H__) 
    19 #define __DOCUMENT_INDEX_H__ 
     18#if !defined (__DOCUMENT_OUTLINE_H__) 
     19#define __DOCUMENT_OUTLINE_H__ 
    2020 
    2121namespace ePDFView 
    2222{ 
    2323    /// 
    24     /// @class DocumentIndex 
    25     /// @brief Stores the document's index name, action and its children. 
     24    /// @class DocumentOutline 
     25    /// @brief Stores the document's outline title, page num. and its children. 
    2626    /// 
    2727    /// Some documents have an index with them. This index can be used to 
     
    2929    /// contents. 
    3030    /// 
    31     /// Each node contains a name, an action an possibly children nodes. The 
    32     /// only node that have an empty name and no action is the top level  
    33     /// DocumentIndex, that is only used as a container for all other 
    34     /// DocumentIndex objects. 
     31    /// Each node contains a title, a destination page an possibly children 
     32    /// nodes. The only node that have an empty name and a 0 page number is the 
     33    /// top level DocumentOutline, that is only used as a container for all  
     34    /// other DocumentOutline objects. 
    3535    /// 
    36     class DocumentIndex 
     36    class DocumentOutline 
    3737    { 
    3838        public: 
    39             DocumentIndex (void); 
    40             ~DocumentIndex (void); 
     39            DocumentOutline (void); 
     40            ~DocumentOutline (void); 
    4141 
     42            gint getDestinationPage (void); 
     43            DocumentOutline *getFirstChild (void); 
    4244            gint getNumChildren (void); 
     45            const gchar *getTitle (void); 
    4346    }; 
    4447} 
    4548 
    46 #endif // !__DOCUMENT_INDEX_H__ 
     49#endif // !__DOCUMENT_OUTLINE_H__ 
  • trunk/src/DocumentPage.cxx

    r49 r58  
    1717 
    1818#include <config.h> 
     19#include <string.h> 
    1920#include "epdfview.h" 
    2021 
  • trunk/src/IDocument.cxx

    r49 r58  
    127127    m_Creator = NULL; 
    128128    m_CurrentPage = 0; 
    129     m_DocumentIndex = new DocumentIndex (); 
     129    m_Outline = new DocumentOutline (); 
    130130    m_FileName = NULL; 
    131131    m_Format = NULL; 
     
    148148IDocument::~IDocument () 
    149149{ 
    150     delete m_DocumentIndex; 
     150    delete m_Outline; 
    151151    g_free (m_Author); 
    152152    g_free (m_CreationDate); 
     
    557557 
    558558/// 
    559 /// @brief Get the document's index. 
    560 /// 
    561 /// @return The top level DocumentIndex for this document. 
    562 /// 
    563 DocumentIndex & 
    564 IDocument::getDocumentIndex () 
    565 { 
    566     g_assert (NULL != m_DocumentIndex && "The document index is NULL."); 
    567      
    568     return *(m_DocumentIndex); 
     559/// @brief Get the document's outline. 
     560/// 
     561/// @return The top level DocumentOutline for this document. 
     562///         The returned object must not be freed, the  
     563///         IDocument class will do it. 
     564/// 
     565DocumentOutline * 
     566IDocument::getOutline () 
     567{ 
     568    return m_Outline; 
    569569} 
    570570 
  • trunk/src/IDocument.h

    r56 r58  
    199199            void setNumPages (gint numPages); 
    200200            gint getCurrentPageNum (void); 
    201             DocumentIndex &getDocumentIndex (void); 
     201            DocumentOutline *getOutline (void); 
    202202 
    203203            void goToFirstPage (void); 
     
    231231            gchar *m_Creator; 
    232232            gint m_CurrentPage; 
    233             DocumentIndex *m_DocumentIndex; 
     233            DocumentOutline *m_Outline; 
    234234            gchar *m_Format; 
    235235            gchar *m_FileName; 
  • trunk/src/MainPter.cxx

    r49 r58  
    1717 
    1818#include <config.h> 
     19#include <stdlib.h> 
    1920#include "epdfview.h" 
    2021 
  • trunk/src/Makefile.am

    r47 r58  
    55 
    66libepdfview_a_SOURCES = \ 
    7     DocumentIndex.cxx   \ 
    8     DocumentIndex.h     \ 
     7    DocumentOutline.cxx \ 
     8    DocumentOutline.h   \ 
    99    DocumentPage.h      \ 
    1010    DocumentPage.cxx    \ 
  • trunk/src/PDFDocument.cxx

    r49 r58  
    1919 
    2020// Poppler headers. 
     21#include <PDFDoc.h> 
     22#include <CairoOutputDev.h> 
    2123#include <ErrorCodes.h> 
    2224#include <GlobalParams.h> 
  • trunk/src/PDFDocument.h

    r49 r58  
    1818#if !defined (__PDF_DOCUMENT_H__) 
    1919#define __PDF_DOCUMENT_H__ 
     20 
     21 
     22/// Forward declarations. 
     23class PDFDoc; 
     24class CairoOutputDev; 
    2025 
    2126namespace ePDFView  
  • trunk/src/epdfview.h

    r23 r58  
    2222#include <glib.h> 
    2323 
    24 // Poppler headers. 
    25 #include <PDFDoc.h> 
    26 #include <CairoOutputDev.h> 
    27  
    28 #include <DocumentIndex.h> 
     24#include <DocumentOutline.h> 
    2925#include <DocumentPage.h> 
    3026#include <IDocument.h> 
  • trunk/tests/MainPterTest.cxx

    r55 r58  
    1616// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
    1717 
    18 #include <glib.h> 
    19 #include <IDocument.h> 
    20 #include <IMainView.h> 
    21 #include <MainPter.h> 
     18#include <epdfview.h> 
    2219#include "DumbDocument.h" 
    2320#include "DumbMainView.h" 
  • trunk/tests/Makefile.am

    r21 r58  
    88 
    99test_epdfview_SOURCES =     \ 
     10    DocumentOutlineTest.cxx \ 
     11    DocumentOutlineTest.h   \ 
    1012    DumbDocument.cxx        \ 
    1113    DumbDocument.h          \ 
     
    2224    -I$(top_srcdir)/src                         \ 
    2325    $(GLIB_CFLAGS)                              \ 
    24     $(POPPLER_CFLAGS)                           \ 
    2526    $(CPPUNIT_CFLAGS) 
    2627 
  • trunk/tests/PDFDocumentTest.cxx

    r22 r58  
    7979    CPPUNIT_ASSERT_EQUAL (0, m_Document->getNumPages ()); 
    8080    CPPUNIT_ASSERT_EQUAL (0, m_Document->getCurrentPageNum ()); 
    81  
    82     DocumentIndex &index = m_Document->getDocumentIndex (); 
    83     CPPUNIT_ASSERT_EQUAL (0, index.getNumChildren ()); 
    8481} 
    8582