diff --git a/generators/ooo/converter.cpp b/generators/ooo/converter.cpp index df14179eb..607edf5a0 100644 --- a/generators/ooo/converter.cpp +++ b/generators/ooo/converter.cpp @@ -128,8 +128,16 @@ QTextDocument* Converter::convert( const QString &fileName ) */ const QString masterLayout = mStyleInformation->masterPageName(); const PageFormatProperty property = mStyleInformation->pageProperty( masterLayout ); - mTextDocument->setPageSize( QSize( qRound( property.width() / 72.0 * Okular::Utils::dpiX() ), - qRound( property.height() / 72.0 * Okular::Utils::dpiY() ) ) ); + + int pageWidth = qRound(property.width() / 72.0 * Okular::Utils::dpiX()); + int pageHeight = qRound(property.height() / 72.0 * Okular::Utils::dpiY()); + + if ( pageWidth == 0 ) + pageWidth = 600; + if ( pageHeight == 0 ) + pageHeight = 800; + + mTextDocument->setPageSize( QSize( pageWidth, pageHeight ) ); QTextFrameFormat frameFormat; frameFormat.setMargin( qRound( property.margin() ) ); diff --git a/generators/ooo/document.cpp b/generators/ooo/document.cpp index bf980a44e..4fe5538fc 100644 --- a/generators/ooo/document.cpp +++ b/generators/ooo/document.cpp @@ -52,7 +52,7 @@ bool Document::open() // we should really get the file names from the manifest, but for now, we only care // if the manifest says the files are encrypted. - + if ( !entries.contains( "content.xml" ) ) { setError( i18n( "Invalid document structure (content.xml is missing)" ) ); return false; @@ -97,9 +97,9 @@ bool Document::open() file = static_cast( imagesDirectory->entry( imagesEntries[ i ] ) ); QString fullPath = QString( "Pictures/%1" ).arg( imagesEntries[ i ] ); if ( mManifest->testIfEncrypted( fullPath ) ) { - mImages.insert( fullPath, mManifest->decryptFile( fullPath, file->data() ) ); + mImages.insert( fullPath, mManifest->decryptFile( fullPath, file->data() ) ); } else { - mImages.insert( fullPath, file->data() ); + mImages.insert( fullPath, file->data() ); } } } diff --git a/generators/ooo/formatproperty.cpp b/generators/ooo/formatproperty.cpp index 8746268dc..f5b730566 100644 --- a/generators/ooo/formatproperty.cpp +++ b/generators/ooo/formatproperty.cpp @@ -288,6 +288,7 @@ void StyleFormatProperty::setTableCellFormat( const TableCellFormatProperty &for } PageFormatProperty::PageFormatProperty() + : mHeight( 0.0 ), mWidth( 0.0 ) { }