From 9116c29739aa3e15eb5e052d335b1f76700f6b32 Mon Sep 17 00:00:00 2001 From: tpearson Date: Mon, 14 Dec 2009 08:57:48 +0000 Subject: * kpdf page rotate options * kdvi options dialog enhancements * djvu plugin for kviewshell git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegraphics@1062216 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kpdf/core/page.cpp | 39 +++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) (limited to 'kpdf/core/page.cpp') diff --git a/kpdf/core/page.cpp b/kpdf/core/page.cpp index e6a847a8..70bc71bc 100644 --- a/kpdf/core/page.cpp +++ b/kpdf/core/page.cpp @@ -26,11 +26,41 @@ KPDFPage::KPDFPage( uint page, float w, float h, int r ) : m_number( page ), m_rotation( r ), m_width( w ), m_height( h ), m_bookmarked( false ), m_text( 0 ), m_transition( 0 ) +{ + setRotation( r ); +} + +KPDFPage::~KPDFPage() +{ + deletePixmapsAndRects(); + deleteHighlights(); + delete m_text; + delete m_transition; +} + +void KPDFPage::rotate90degrees() + { + float w = m_width; + m_width = m_height; + m_height = w; + + // avoid Division-By-Zero problems in the program + + if ( m_width <= 0 ) + m_width = 1; + if ( m_height <= 0 ) + m_height = 1; + + deletePixmapsAndRects(); + } + +void KPDFPage::setRotation( int r ) { // if landscape swap width <-> height (rotate 90deg CCW) if ( r == 90 || r == 270 ) { - m_width = h; + float w = m_width; + m_width = m_height; m_height = w; } // avoid Division-By-Zero problems in the program @@ -38,17 +68,10 @@ KPDFPage::KPDFPage( uint page, float w, float h, int r ) m_width = 1; if ( m_height <= 0 ) m_height = 1; -} -KPDFPage::~KPDFPage() -{ deletePixmapsAndRects(); - deleteHighlights(); - delete m_text; - delete m_transition; } - bool KPDFPage::hasPixmap( int id, int width, int height ) const { if ( !m_pixmaps.contains( id ) ) -- cgit v1.2.1