Changeset 78 for trunk/src/IDocument.cxx

Show
Ignore:
Timestamp:
04/17/06 07:28:50 (3 years ago)
Author:
jordi
Message:

Since version 0.5.0 and up doesn't support the old Xpdf header files and because the CairoOutputDev?.h file is not installed on version 0.5.1, I now use Poppler's glib wrapper for PDF loading.

The glib wrapper needs an URI instead of a filename (why?), so the path to the file must be specified as an absolute path to be able to convert it to an URI (file:///dir1/dir2/file.pdf). This also means that the tests files had to be changed to use absolute paths. I added a function (that I'll change to a common utils source) that transform the filename to an absolute path.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/IDocument.cxx

    r73 r78  
    131131    m_Format = NULL; 
    132132    m_Keywords = NULL; 
    133     m_Linearized = FALSE; 
     133    m_Linearized = NULL; 
    134134    m_ModifiedDate = NULL; 
    135135    m_PageLayout = PageLayoutUnset; 
     
    156156    g_free (m_Format); 
    157157    g_free (m_Keywords); 
     158    g_free (m_Linearized); 
    158159    g_free (m_ModifiedDate); 
    159160    g_free (m_Password); 
     
    182183/// @brief Sets the document's title. 
    183184/// 
    184 /// @param title The title of the document. 
    185 /// 
    186 void 
    187 IDocument::setTitle (const gchar *title) 
     185/// @param title The title of the document. IDocument will free it. 
     186/// 
     187void 
     188IDocument::setTitle (gchar *title) 
    188189{ 
    189190    g_free (m_Title); 
    190     m_Title = g_strdup (title); 
     191    m_Title = title; 
    191192} 
    192193 
     
    210211/// @brief Sets the document's author. 
    211212/// 
    212 /// @param author The name of the document's author. 
    213 /// 
    214 void 
    215 IDocument::setAuthor (const gchar *author) 
     213/// @param author The name of the document's author. IDocument will free it. 
     214/// 
     215void 
     216IDocument::setAuthor (gchar *author) 
    216217{ 
    217218    g_free (m_Author); 
    218     m_Author = g_strdup (author); 
     219    m_Author = author; 
    219220} 
    220221 
     
    238239/// @brief Sets the document's subject. 
    239240/// 
    240 /// @param subject The subject of the document. 
    241 /// 
    242 void 
    243 IDocument::setSubject (const gchar *subject) 
     241/// @param subject The subject of the document. IDocument will free it. 
     242/// 
     243void 
     244IDocument::setSubject (gchar *subject) 
    244245{ 
    245246    g_free (m_Subject); 
    246     m_Subject = g_strdup (subject); 
     247    m_Subject = subject; 
    247248} 
    248249 
     
    266267/// @brief Sets the document's keywords. 
    267268/// 
    268 /// @param keywords A white space separated list of keywords. 
    269 /// 
    270 void 
    271 IDocument::setKeywords (const gchar *keywords) 
     269/// @param keywords A white space separated list of keywords. IDocument will 
     270///                 free it. 
     271/// 
     272void 
     273IDocument::setKeywords (gchar *keywords) 
    272274{ 
    273275    g_free (m_Keywords); 
    274     m_Keywords = g_strdup (keywords); 
     276    m_Keywords = keywords; 
    275277} 
    276278 
     
    295297/// 
    296298/// @param creator The name of the software that created the document. 
    297 /// 
    298 void 
    299 IDocument::setCreator (const gchar *creator) 
     299///                IDocument will free it. 
     300/// 
     301void 
     302IDocument::setCreator (gchar *creator) 
    300303{ 
    301304    g_free (m_Creator); 
    302     m_Creator = g_strdup (creator); 
     305    m_Creator = creator; 
    303306} 
    304307/// 
     
    322325/// 
    323326/// @param producer The name of the software that converted the document. 
    324 /// 
    325 void 
    326 IDocument::setProducer (const gchar *producer) 
     327///                 IDocument will free it. 
     328/// 
     329void 
     330IDocument::setProducer (gchar *producer) 
    327331{ 
    328332    g_free (m_Producer); 
    329     m_Producer = g_strdup (producer); 
     333    m_Producer = producer; 
    330334} 
    331335 
     
    350354/// @brief Sets the document's format. 
    351355/// 
    352 /// @param format Set the format in which the document is. 
    353 /// 
    354 void 
    355 IDocument::setFormat (const gchar *format) 
     356/// @param format Set the format in which the document is. IDocument will free 
     357///               it. 
     358/// 
     359void 
     360IDocument::setFormat (gchar *format) 
    356361{ 
    357362    g_free (m_Format); 
    358     m_Format = g_strdup (format); 
     363    m_Format = format; 
    359364} 
    360365 
     
    369374IDocument::getLinearized () 
    370375{ 
    371     if ( m_Linearized ) 
    372     { 
    373         return "Yes"; 
    374     } 
    375     return "No"; 
     376    if ( NULL == m_Linearized ) 
     377    { 
     378        return "No"; 
     379    } 
     380    return m_Linearized; 
    376381} 
    377382 
     
    379384/// @brief Sets if the document is linearised. 
    380385/// 
    381 /// @param linearized Set to TRUE if the document is linearized.  
    382 ///                   FALSE otherwise. 
    383 /// 
    384 void 
    385 IDocument::setLinearized (gboolean linearized) 
    386 { 
     386/// @param linearized Set to "Yes" if the document is linearized. "No" 
     387///                   otherwise. IDocument will free it. 
     388/// 
     389void 
     390IDocument::setLinearized (gchar *linearized) 
     391{ 
     392    g_free (m_Linearized); 
    387393    m_Linearized = linearized; 
    388394} 
     
    408414/// 
    409415/// @param date The date and time the document was created in format 
    410 ///             'Y-M-D H:M:s'. 
    411 /// 
    412 void 
    413 IDocument::setCreationDate (const gchar *date) 
     416///             'Y-M-D H:M:s'. IDocument will free it. 
     417/// 
     418void 
     419IDocument::setCreationDate (gchar *date) 
    414420{ 
    415421    g_free (m_CreationDate); 
    416     m_CreationDate = g_strdup (date); 
     422    m_CreationDate = date; 
    417423} 
    418424 
     
    437443/// 
    438444/// @param date The date and time the document was modified in format  
    439 ///             'Y-M-D H:M:s'. 
    440 /// 
    441 void 
    442 IDocument::setModifiedDate (const gchar *date) 
     445///             'Y-M-D H:M:s'. IDocument will free it. 
     446/// 
     447void 
     448IDocument::setModifiedDate (gchar *date) 
    443449{ 
    444450    g_free (m_ModifiedDate); 
    445     m_ModifiedDate = g_strdup (date); 
    446      
     451    m_ModifiedDate = date; 
    447452} 
    448453