add flags to selectively choose the page parts to serialize

svn path=/trunk/KDE/kdegraphics/okular/; revision=884438
This commit is contained in:
Pino Toscano 2008-11-14 23:38:02 +00:00
parent 3462b4f53a
commit a5252a9115
2 changed files with 15 additions and 4 deletions

View file

@ -770,7 +770,7 @@ void PagePrivate::restoreLocalContents( const QDomNode & pageNode )
}
}
void PagePrivate::saveLocalContents( QDomNode & parentNode, QDomDocument & document ) const
void PagePrivate::saveLocalContents( QDomNode & parentNode, QDomDocument & document, PageItems what ) const
{
// only add a node if there is some stuff to write into
if ( m_page->m_annotations.isEmpty() && formfields.isEmpty() )
@ -794,7 +794,7 @@ void PagePrivate::saveLocalContents( QDomNode & parentNode, QDomDocument & docum
#endif
// add annotations info if has got any
if ( !m_page->m_annotations.isEmpty() )
if ( ( what & AnnotationPageItems ) && !m_page->m_annotations.isEmpty() )
{
// create the annotationList
QDomElement annotListElement = document.createElement( "annotationList" );
@ -822,7 +822,7 @@ void PagePrivate::saveLocalContents( QDomNode & parentNode, QDomDocument & docum
}
// add forms info if has got any
if ( !formfields.isEmpty() )
if ( ( what & FormFieldPageItems ) && !formfields.isEmpty() )
{
// create the formList
QDomElement formListElement = document.createElement( "forms" );

View file

@ -37,6 +37,15 @@ class PageTransition;
class RotationJob;
class TextPage;
enum PageItem
{
None = 0,
AnnotationPageItems = 0x01,
FormFieldPageItems = 0x02,
AllPageItems = 0xff
};
Q_DECLARE_FLAGS(PageItems, PageItem)
class PagePrivate
{
public:
@ -54,7 +63,7 @@ class PagePrivate
/**
* Saves the local contents (e.g. annotations) of the page.
*/
void saveLocalContents( QDomNode & parentNode, QDomDocument & document ) const;
void saveLocalContents( QDomNode & parentNode, QDomDocument & document, PageItems what = AllPageItems ) const;
/**
* Modifies an existing annotation by replacing it with a new @p annotation.
@ -126,4 +135,6 @@ class PagePrivate
}
Q_DECLARE_OPERATORS_FOR_FLAGS(Okular::PageItems)
#endif