From a5252a911568ab2afdbc8f4afb5eb28e07e4028f Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Fri, 14 Nov 2008 23:38:02 +0000 Subject: [PATCH] add flags to selectively choose the page parts to serialize svn path=/trunk/KDE/kdegraphics/okular/; revision=884438 --- core/page.cpp | 6 +++--- core/page_p.h | 13 ++++++++++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/core/page.cpp b/core/page.cpp index c2e17fbe9..816eaa8f4 100644 --- a/core/page.cpp +++ b/core/page.cpp @@ -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" ); diff --git a/core/page_p.h b/core/page_p.h index 04709c283..3fe47f289 100644 --- a/core/page_p.h +++ b/core/page_p.h @@ -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