summaryrefslogtreecommitdiffstats
path: root/kpdf/core/page.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kpdf/core/page.cpp')
-rw-r--r--kpdf/core/page.cpp39
1 files changed, 31 insertions, 8 deletions
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
@@ -27,10 +27,40 @@ 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 ) )