mirror of
https://invent.kde.org/graphics/okular
synced 2024-10-04 06:59:32 +00:00
Merge remote-tracking branch 'origin/master' into frameworks
Conflicts: core/version.h
This commit is contained in:
commit
49ce3fc4d2
|
@ -1,3 +1,4 @@
|
|||
cmake_minimum_required(VERSION 2.8.9)
|
||||
project(okular)
|
||||
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
|
@ -94,6 +95,7 @@ endif(NOT WIN32)
|
|||
# okularcore
|
||||
|
||||
set(okularcore_SRCS
|
||||
core/qpagesize.cpp # REMOVE On Qt5 port
|
||||
core/action.cpp
|
||||
core/annotations.cpp
|
||||
core/area.cpp
|
||||
|
|
|
@ -22,40 +22,32 @@ else(LIBSPECTRE_INCLUDE_DIR AND LIBSPECTRE_LIBRARY)
|
|||
if(NOT WIN32)
|
||||
# use pkg-config to get the directories and then use these values
|
||||
# in the FIND_PATH() and FIND_LIBRARY() calls
|
||||
INCLUDE(UsePkgConfig)
|
||||
include(FindPkgConfig)
|
||||
|
||||
PKGCONFIG(libspectre _SpectreIncDir _SpectreLinkDir _SpectreLinkFlags _SpectreCflags)
|
||||
|
||||
if(_SpectreLinkFlags)
|
||||
# find again pkg-config, to query it about libspectre version
|
||||
FIND_PROGRAM(PKGCONFIG_EXECUTABLE NAMES pkg-config PATHS /usr/bin/ /usr/local/bin )
|
||||
|
||||
# query pkg-config asking for a libspectre >= LIBSPECTRE_MINIMUM_VERSION
|
||||
EXEC_PROGRAM(${PKGCONFIG_EXECUTABLE} ARGS --atleast-version=${LIBSPECTRE_MINIMUM_VERSION} libspectre RETURN_VALUE _return_VALUE OUTPUT_VARIABLE _pkgconfigDevNull )
|
||||
if(_return_VALUE STREQUAL "0")
|
||||
set(LIBSPECTRE_INTERNAL_FOUND TRUE)
|
||||
endif(_return_VALUE STREQUAL "0")
|
||||
endif(_SpectreLinkFlags)
|
||||
if(LIBSPECTRE_MINIMUM_VERSION})
|
||||
pkg_check_modules(_pc_LIBSPECTRE libspectre>=${LIBSPECTRE_MINIMUM_VERSION})
|
||||
else(LIBSPECTRE_MINIMUM_VERSION})
|
||||
pkg_check_modules(_pc_LIBSPECTRE libspectre)
|
||||
endif(LIBSPECTRE_MINIMUM_VERSION})
|
||||
else(NOT WIN32)
|
||||
# do not use pkg-config on windows
|
||||
find_library(_SpectreLinkFlags NAMES libspectre spectre PATHS ${CMAKE_LIBRARY_PATH})
|
||||
|
||||
find_path(LIBSPECTRE_INCLUDE_DIR spectre.h PATH_SUFFIXES libspectre )
|
||||
|
||||
set(LIBSPECTRE_INTERNAL_FOUND TRUE)
|
||||
set(_pc_LIBSPECTRE_FOUND TRUE)
|
||||
endif(NOT WIN32)
|
||||
|
||||
if (LIBSPECTRE_INTERNAL_FOUND)
|
||||
set(LIBSPECTRE_LIBRARY ${_SpectreLinkFlags})
|
||||
|
||||
# the cflags for libspectre can contain more than one include path
|
||||
separate_arguments(_SpectreCflags)
|
||||
foreach(_includedir ${_SpectreCflags})
|
||||
string(REGEX REPLACE "-I(.+)" "\\1" _includedir "${_includedir}")
|
||||
set(LIBSPECTRE_INCLUDE_DIR ${LIBSPECTRE_INCLUDE_DIR} ${_includedir})
|
||||
endforeach(_includedir)
|
||||
if(_pc_LIBSPECTRE_FOUND)
|
||||
find_library(LIBSPECTRE_LIBRARY
|
||||
NAMES libspectre spectre
|
||||
HINTS ${_pc_LIBSPECTRE_LIBRARY_DIRS} ${CMAKE_LIBRARY_PATH}
|
||||
)
|
||||
|
||||
endif (LIBSPECTRE_INTERNAL_FOUND)
|
||||
find_path(LIBSPECTRE_INCLUDE_DIR spectre.h
|
||||
HINTS ${_pc_LIBSPECTRE_INCLUDE_DIRS}
|
||||
PATH_SUFFIXES libspectre
|
||||
)
|
||||
|
||||
set(LIBSPECTRE_INTERNAL_FOUND TRUE)
|
||||
endif(_pc_LIBSPECTRE_FOUND)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(LibSpectre DEFAULT_MSG LIBSPECTRE_LIBRARY LIBSPECTRE_INTERNAL_FOUND)
|
||||
|
|
|
@ -43,10 +43,10 @@ void DlgPerformance::radioGroup_changed( int which )
|
|||
m_dlg->descLabel->setText( i18n("Keeps used memory as low as possible. Do not reuse anything. (For systems with low memory.)") );
|
||||
break;
|
||||
case 1:
|
||||
m_dlg->descLabel->setText( i18n("A good compromise between memory usage and speed gain. Preload next page and boost searches. (For systems with 256MB of memory, typically.)") );
|
||||
m_dlg->descLabel->setText( i18n("A good compromise between memory usage and speed gain. Preload next page and boost searches. (For systems with 2GB of memory, typically.)") );
|
||||
break;
|
||||
case 2:
|
||||
m_dlg->descLabel->setText( i18n("Keeps everything in memory. Preload next pages. Boost searches. (For systems with more than 512MB of memory.)") );
|
||||
m_dlg->descLabel->setText( i18n("Keeps everything in memory. Preload next pages. Boost searches. (For systems with more than 4GB of memory.)") );
|
||||
break;
|
||||
case 3:
|
||||
// xgettext: no-c-format
|
||||
|
|
|
@ -193,6 +193,11 @@
|
|||
<string>Dissolve</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Fade</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Glitter Down</string>
|
||||
|
|
|
@ -112,6 +112,7 @@
|
|||
<choice name="BoxIn" />
|
||||
<choice name="BoxOut" />
|
||||
<choice name="Dissolve" />
|
||||
<choice name="Fade" />
|
||||
<choice name="GlitterDown" />
|
||||
<choice name="GlitterRight" />
|
||||
<choice name="GlitterRightDown" />
|
||||
|
|
|
@ -87,6 +87,7 @@
|
|||
#include "view_p.h"
|
||||
#include "form.h"
|
||||
#include "utils.h"
|
||||
#include "qpagesize.h" // TODO Convert to <> in Qt5
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
@ -173,88 +174,88 @@ QString DocumentPrivate::namePaperSize(double inchesWidth, double inchesHeight)
|
|||
if (inchesWidth > inchesHeight)
|
||||
qSwap(inchesWidth, inchesHeight);
|
||||
|
||||
// Use QPrinter to find which of the predefined paper sizes
|
||||
// Use QPageSize to find which of the predefined paper sizes
|
||||
// matches best the given paper width and height
|
||||
QPrinter dummyPrinter;
|
||||
QPrinter::PaperSize paperSize = QPrinter::Custom;
|
||||
for (int i = 0; i < (int)QPrinter::NPaperSize; ++i)
|
||||
QPageSize::PageSizeId paperSize = QPageSize::Custom;
|
||||
for (int i = 0; i < (int)QPageSize::NPaperSize; ++i)
|
||||
{
|
||||
const QPrinter::PaperSize ps = (QPrinter::PaperSize)i;
|
||||
dummyPrinter.setPaperSize(ps);
|
||||
const QSizeF definedPaperSize = dummyPrinter.paperSize(QPrinter::Inch);
|
||||
const QPageSize size((QPageSize::PageSizeId)i);
|
||||
const QSizeF definedPaperSize = size.size(QPageSize::Inch);
|
||||
|
||||
if (inchesWidth > definedPaperSize.width() * lowerBoundFactor && inchesWidth < definedPaperSize.width() * upperBoundFactor
|
||||
&& inchesHeight > definedPaperSize.height() * lowerBoundFactor && inchesHeight < definedPaperSize.height() * upperBoundFactor)
|
||||
{
|
||||
paperSize = ps;
|
||||
paperSize = (QPageSize::PageSizeId)i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle all paper sizes defined in QPrinter,
|
||||
// Handle all paper sizes defined in QPageSize,
|
||||
// return string depending if paper's orientation is landscape or portrait
|
||||
// TODO We can probably use QPageSize::name in KF5/Qt5 world
|
||||
switch (paperSize) {
|
||||
case QPrinter::A0:
|
||||
case QPageSize::A0:
|
||||
return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape DIN/ISO A0") : i18nc("paper size", "portrait DIN/ISO A0");
|
||||
case QPrinter::A1:
|
||||
case QPageSize::A1:
|
||||
return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape DIN/ISO A1") : i18nc("paper size", "portrait DIN/ISO A1");
|
||||
case QPrinter::A2:
|
||||
case QPageSize::A2:
|
||||
return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape DIN/ISO A2") : i18nc("paper size", "portrait DIN/ISO A2");
|
||||
case QPrinter::A3:
|
||||
case QPageSize::A3:
|
||||
return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape DIN/ISO A3") : i18nc("paper size", "portrait DIN/ISO A3");
|
||||
case QPrinter::A4:
|
||||
case QPageSize::A4:
|
||||
return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape DIN/ISO A4") : i18nc("paper size", "portrait DIN/ISO A4");
|
||||
case QPrinter::A5:
|
||||
case QPageSize::A5:
|
||||
return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape DIN/ISO A5") : i18nc("paper size", "portrait DIN/ISO A5");
|
||||
case QPrinter::A6:
|
||||
case QPageSize::A6:
|
||||
return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape DIN/ISO A6") : i18nc("paper size", "portrait DIN/ISO A6");
|
||||
case QPrinter::A7:
|
||||
case QPageSize::A7:
|
||||
return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape DIN/ISO A7") : i18nc("paper size", "portrait DIN/ISO A7");
|
||||
case QPrinter::A8:
|
||||
case QPageSize::A8:
|
||||
return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape DIN/ISO A8") : i18nc("paper size", "portrait DIN/ISO A8");
|
||||
case QPrinter::A9:
|
||||
case QPageSize::A9:
|
||||
return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape DIN/ISO A9") : i18nc("paper size", "portrait DIN/ISO A9");
|
||||
case QPrinter::B0:
|
||||
case QPageSize::B0:
|
||||
return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape DIN/ISO B0") : i18nc("paper size", "portrait DIN/ISO B0");
|
||||
case QPrinter::B1:
|
||||
case QPageSize::B1:
|
||||
return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape DIN/ISO B1") : i18nc("paper size", "portrait DIN/ISO B1");
|
||||
case QPrinter::B2:
|
||||
case QPageSize::B2:
|
||||
return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape DIN/ISO B2") : i18nc("paper size", "portrait DIN/ISO B2");
|
||||
case QPrinter::B3:
|
||||
case QPageSize::B3:
|
||||
return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape DIN/ISO B3") : i18nc("paper size", "portrait DIN/ISO B3");
|
||||
case QPrinter::B4:
|
||||
case QPageSize::B4:
|
||||
return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape DIN/ISO B4") : i18nc("paper size", "portrait DIN/ISO B4");
|
||||
case QPrinter::B5:
|
||||
case QPageSize::B5:
|
||||
return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape DIN/ISO B5") : i18nc("paper size", "portrait DIN/ISO B5");
|
||||
case QPrinter::B6:
|
||||
case QPageSize::B6:
|
||||
return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape DIN/ISO B6") : i18nc("paper size", "portrait DIN/ISO B6");
|
||||
case QPrinter::B7:
|
||||
case QPageSize::B7:
|
||||
return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape DIN/ISO B7") : i18nc("paper size", "portrait DIN/ISO B7");
|
||||
case QPrinter::B8:
|
||||
case QPageSize::B8:
|
||||
return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape DIN/ISO B8") : i18nc("paper size", "portrait DIN/ISO B8");
|
||||
case QPrinter::B9:
|
||||
case QPageSize::B9:
|
||||
return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape DIN/ISO B9") : i18nc("paper size", "portrait DIN/ISO B9");
|
||||
case QPrinter::B10:
|
||||
case QPageSize::B10:
|
||||
return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape DIN/ISO B10") : i18nc("paper size", "portrait DIN/ISO B10");
|
||||
case QPrinter::Letter:
|
||||
case QPageSize::Letter:
|
||||
return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape letter") : i18nc("paper size", "portrait letter");
|
||||
case QPrinter::Legal:
|
||||
case QPageSize::Legal:
|
||||
return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape legal") : i18nc("paper size", "portrait legal");
|
||||
case QPrinter::Executive:
|
||||
case QPageSize::Executive:
|
||||
return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape executive") : i18nc("paper size", "portrait executive");
|
||||
case QPrinter::C5E:
|
||||
case QPageSize::C5E:
|
||||
return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape C5E") : i18nc("paper size", "portrait C5E");
|
||||
case QPrinter::Comm10E:
|
||||
case QPageSize::Comm10E:
|
||||
return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape Comm10E") : i18nc("paper size", "portrait Comm10E");
|
||||
case QPrinter::DLE:
|
||||
case QPageSize::DLE:
|
||||
return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape DLE") : i18nc("paper size", "portrait DLE");
|
||||
case QPrinter::Folio:
|
||||
case QPageSize::Folio:
|
||||
return orientation == QPrinter::Landscape ? i18nc("paper size", "landscape folio") : i18nc("paper size", "portrait folio");
|
||||
case QPrinter::Tabloid:
|
||||
case QPrinter::Ledger:
|
||||
case QPageSize::Tabloid:
|
||||
case QPageSize::Ledger:
|
||||
/// Ledger and Tabloid are the same, just rotated by 90 degrees
|
||||
return orientation == QPrinter::Landscape ? i18nc("paper size", "ledger") : i18nc("paper size", "tabloid");
|
||||
case QPrinter::Custom:
|
||||
default: // TODO add new strings on master if we don't merge KF5 first
|
||||
case QPageSize::Custom:
|
||||
return orientation == QPrinter::Landscape ? i18nc("paper size", "unknown landscape paper size") : i18nc("paper size", "unknown portrait paper size");
|
||||
}
|
||||
|
||||
|
@ -1431,7 +1432,7 @@ void DocumentPrivate::sendGeneratorPixmapRequest()
|
|||
|
||||
request = r;
|
||||
}
|
||||
else if ( (long)requestRect.width() * (long)requestRect.height() > 20000000L )
|
||||
else if ( (long)requestRect.width() * (long)requestRect.height() > 200000000L && (SettingsCore::memoryLevel() != SettingsCore::EnumMemoryLevel::Greedy ) )
|
||||
{
|
||||
m_pixmapRequestsStack.pop_back();
|
||||
if ( !m_warnedOutOfMemory )
|
||||
|
@ -3292,6 +3293,7 @@ bool Document::canRemovePageAnnotation( const Annotation * annotation ) const
|
|||
case Annotation::AHighlight:
|
||||
case Annotation::AStamp:
|
||||
case Annotation::AInk:
|
||||
case Annotation::ACaret:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
|
|
904
core/qpagesize.cpp
Normal file
904
core/qpagesize.cpp
Normal file
|
@ -0,0 +1,904 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2014 John Layt <jlayt@kde.org>
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the QtGui module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qpagesize.h"
|
||||
|
||||
#include <QtCore/qcoreapplication.h>
|
||||
#include <QtCore/qdebug.h>
|
||||
#include <QtCore/qpoint.h>
|
||||
#include <QtCore/qrect.h>
|
||||
#include <QtCore/qsize.h>
|
||||
#include <QtCore/qstring.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
// Define the Windows DMPAPER sizes for use in the look-up table
|
||||
// See http://msdn.microsoft.com/en-us/library/windows/desktop/dd319099.aspx
|
||||
|
||||
enum WindowsDmPaper {
|
||||
DMPAPER_NONE = 0, // Not a DMPAPER, use for sizes without a DMPAPER value
|
||||
DMPAPER_LETTER = 1,
|
||||
DMPAPER_LETTERSMALL = 2,
|
||||
DMPAPER_TABLOID = 3,
|
||||
DMPAPER_LEDGER = 4,
|
||||
DMPAPER_LEGAL = 5,
|
||||
DMPAPER_STATEMENT = 6,
|
||||
DMPAPER_EXECUTIVE = 7,
|
||||
DMPAPER_A3 = 8,
|
||||
DMPAPER_A4 = 9,
|
||||
DMPAPER_A4SMALL = 10,
|
||||
DMPAPER_A5 = 11,
|
||||
DMPAPER_B4 = 12,
|
||||
DMPAPER_B5 = 13,
|
||||
DMPAPER_FOLIO = 14,
|
||||
DMPAPER_QUARTO = 15,
|
||||
DMPAPER_10X14 = 16,
|
||||
DMPAPER_11X17 = 17,
|
||||
DMPAPER_NOTE = 18,
|
||||
DMPAPER_ENV_9 = 19,
|
||||
DMPAPER_ENV_10 = 20,
|
||||
DMPAPER_ENV_11 = 21,
|
||||
DMPAPER_ENV_12 = 22,
|
||||
DMPAPER_ENV_14 = 23,
|
||||
DMPAPER_CSHEET = 24,
|
||||
DMPAPER_DSHEET = 25,
|
||||
DMPAPER_ESHEET = 26,
|
||||
DMPAPER_ENV_DL = 27,
|
||||
DMPAPER_ENV_C5 = 28,
|
||||
DMPAPER_ENV_C3 = 29,
|
||||
DMPAPER_ENV_C4 = 30,
|
||||
DMPAPER_ENV_C6 = 31,
|
||||
DMPAPER_ENV_C65 = 32,
|
||||
DMPAPER_ENV_B4 = 33,
|
||||
DMPAPER_ENV_B5 = 34,
|
||||
DMPAPER_ENV_B6 = 35,
|
||||
DMPAPER_ENV_ITALY = 36,
|
||||
DMPAPER_ENV_MONARCH = 37,
|
||||
DMPAPER_ENV_PERSONAL = 38,
|
||||
DMPAPER_FANFOLD_US = 39,
|
||||
DMPAPER_FANFOLD_STD_GERMAN = 40,
|
||||
DMPAPER_FANFOLD_LGL_GERMAN = 41,
|
||||
DMPAPER_ISO_B4 = 42,
|
||||
DMPAPER_JAPANESE_POSTCARD = 43,
|
||||
DMPAPER_9X11 = 44,
|
||||
DMPAPER_10X11 = 45,
|
||||
DMPAPER_15X11 = 46,
|
||||
DMPAPER_ENV_INVITE = 47,
|
||||
DMPAPER_RESERVED_48 = 48,
|
||||
DMPAPER_RESERVED_49 = 49,
|
||||
DMPAPER_LETTER_EXTRA = 50,
|
||||
DMPAPER_LEGAL_EXTRA = 51,
|
||||
DMPAPER_TABLOID_EXTRA = 52,
|
||||
DMPAPER_A4_EXTRA = 53,
|
||||
DMPAPER_LETTER_TRANSVERSE = 54,
|
||||
DMPAPER_A4_TRANSVERSE = 55,
|
||||
DMPAPER_LETTER_EXTRA_TRANSVERSE = 56,
|
||||
DMPAPER_A_PLUS = 57,
|
||||
DMPAPER_B_PLUS = 58,
|
||||
DMPAPER_LETTER_PLUS = 59,
|
||||
DMPAPER_A4_PLUS = 60,
|
||||
DMPAPER_A5_TRANSVERSE = 61,
|
||||
DMPAPER_B5_TRANSVERSE = 62,
|
||||
DMPAPER_A3_EXTRA = 63,
|
||||
DMPAPER_A5_EXTRA = 64,
|
||||
DMPAPER_B5_EXTRA = 65,
|
||||
DMPAPER_A2 = 66,
|
||||
DMPAPER_A3_TRANSVERSE = 67,
|
||||
DMPAPER_A3_EXTRA_TRANSVERSE = 68,
|
||||
DMPAPER_DBL_JAPANESE_POSTCARD = 69,
|
||||
DMPAPER_A6 = 70,
|
||||
DMPAPER_JENV_KAKU2 = 71,
|
||||
DMPAPER_JENV_KAKU3 = 72,
|
||||
DMPAPER_JENV_CHOU3 = 73,
|
||||
DMPAPER_JENV_CHOU4 = 74,
|
||||
DMPAPER_LETTER_ROTATED = 75,
|
||||
DMPAPER_A3_ROTATED = 76,
|
||||
DMPAPER_A4_ROTATED = 77,
|
||||
DMPAPER_A5_ROTATED = 78,
|
||||
DMPAPER_B4_JIS_ROTATED = 79,
|
||||
DMPAPER_B5_JIS_ROTATED = 80,
|
||||
DMPAPER_JAPANESE_POSTCARD_ROTATED = 81,
|
||||
DMPAPER_DBL_JAPANESE_POSTCARD_ROTATED = 82,
|
||||
DMPAPER_A6_ROTATED = 83,
|
||||
DMPAPER_JENV_KAKU2_ROTATED = 84,
|
||||
DMPAPER_JENV_KAKU3_ROTATED = 85,
|
||||
DMPAPER_JENV_CHOU3_ROTATED = 86,
|
||||
DMPAPER_JENV_CHOU4_ROTATED = 87,
|
||||
DMPAPER_B6_JIS = 88,
|
||||
DMPAPER_B6_JIS_ROTATED = 89,
|
||||
DMPAPER_12X11 = 90,
|
||||
DMPAPER_JENV_YOU4 = 91,
|
||||
DMPAPER_JENV_YOU4_ROTATED = 92,
|
||||
DMPAPER_P16K = 93,
|
||||
DMPAPER_P32K = 94,
|
||||
DMPAPER_P32KBIG = 95,
|
||||
DMPAPER_PENV_1 = 96,
|
||||
DMPAPER_PENV_2 = 97,
|
||||
DMPAPER_PENV_3 = 98,
|
||||
DMPAPER_PENV_4 = 99,
|
||||
DMPAPER_PENV_5 = 100,
|
||||
DMPAPER_PENV_6 = 101,
|
||||
DMPAPER_PENV_7 = 102,
|
||||
DMPAPER_PENV_8 = 103,
|
||||
DMPAPER_PENV_9 = 104,
|
||||
DMPAPER_PENV_10 = 105,
|
||||
DMPAPER_P16K_ROTATED = 106,
|
||||
DMPAPER_P32K_ROTATED = 107,
|
||||
DMPAPER_P32KBIG_ROTATED = 108,
|
||||
DMPAPER_PENV_1_ROTATED = 109,
|
||||
DMPAPER_PENV_2_ROTATED = 110,
|
||||
DMPAPER_PENV_3_ROTATED = 111,
|
||||
DMPAPER_PENV_4_ROTATED = 112,
|
||||
DMPAPER_PENV_5_ROTATED = 113,
|
||||
DMPAPER_PENV_6_ROTATED = 114,
|
||||
DMPAPER_PENV_7_ROTATED = 115,
|
||||
DMPAPER_PENV_8_ROTATED = 116,
|
||||
DMPAPER_PENV_9_ROTATED = 117,
|
||||
DMPAPER_PENV_10_ROTATED = 118,
|
||||
DMPAPER_LAST = DMPAPER_PENV_10_ROTATED,
|
||||
DMPAPER_USER = 256
|
||||
};
|
||||
|
||||
// Conversion table for historic page size values that we don't support.
|
||||
// These are deprecated in PPD and strongly discouraged from being used,
|
||||
// so convert them to usable page sizes to support older print devices.
|
||||
// The paper source orientation will be handled in the QPrintMedia class,
|
||||
// we're only concerned about the standard size in QPageSize.
|
||||
// _ROTATED = 90 degrees or QPageLayout::Landscape
|
||||
// _TRANSVERSE = 180 degrees or QPageLayout::ReversePortrait
|
||||
|
||||
static const int qt_windowsConversion[][2] = {
|
||||
{DMPAPER_11X17, DMPAPER_TABLOID}, // = DMPAPER_LEDGER rotated
|
||||
{DMPAPER_A3_EXTRA_TRANSVERSE, DMPAPER_A3_EXTRA},
|
||||
{DMPAPER_A3_ROTATED, DMPAPER_A3},
|
||||
{DMPAPER_A3_TRANSVERSE, DMPAPER_A3},
|
||||
{DMPAPER_A4_ROTATED, DMPAPER_A4},
|
||||
{DMPAPER_A4_TRANSVERSE, DMPAPER_A4},
|
||||
{DMPAPER_A5_ROTATED, DMPAPER_A5},
|
||||
{DMPAPER_A5_TRANSVERSE, DMPAPER_A5},
|
||||
{DMPAPER_A6_ROTATED, DMPAPER_A6},
|
||||
{DMPAPER_B4_JIS_ROTATED, DMPAPER_B4},
|
||||
{DMPAPER_B5_JIS_ROTATED, DMPAPER_B5},
|
||||
{DMPAPER_B5_TRANSVERSE, DMPAPER_B5},
|
||||
{DMPAPER_B6_JIS_ROTATED, DMPAPER_B6_JIS},
|
||||
{DMPAPER_DBL_JAPANESE_POSTCARD_ROTATED, DMPAPER_DBL_JAPANESE_POSTCARD},
|
||||
{DMPAPER_JAPANESE_POSTCARD_ROTATED, DMPAPER_JAPANESE_POSTCARD},
|
||||
{DMPAPER_JENV_CHOU3_ROTATED, DMPAPER_JENV_CHOU3},
|
||||
{DMPAPER_JENV_CHOU4_ROTATED, DMPAPER_JENV_CHOU4},
|
||||
{DMPAPER_JENV_KAKU2_ROTATED, DMPAPER_JENV_KAKU2},
|
||||
{DMPAPER_JENV_KAKU3_ROTATED, DMPAPER_JENV_KAKU3},
|
||||
{DMPAPER_JENV_YOU4_ROTATED, DMPAPER_JENV_YOU4},
|
||||
{DMPAPER_LETTER_EXTRA_TRANSVERSE, DMPAPER_LETTER_EXTRA},
|
||||
{DMPAPER_LETTER_ROTATED, DMPAPER_LETTER},
|
||||
{DMPAPER_LETTER_TRANSVERSE, DMPAPER_LETTER},
|
||||
{DMPAPER_P16K_ROTATED, DMPAPER_P16K},
|
||||
{DMPAPER_P32K_ROTATED, DMPAPER_P32K},
|
||||
{DMPAPER_P32KBIG_ROTATED, DMPAPER_P32KBIG},
|
||||
{DMPAPER_PENV_1_ROTATED, DMPAPER_PENV_1},
|
||||
{DMPAPER_PENV_2_ROTATED, DMPAPER_PENV_2},
|
||||
{DMPAPER_PENV_3_ROTATED, DMPAPER_PENV_3},
|
||||
{DMPAPER_PENV_4_ROTATED, DMPAPER_PENV_4},
|
||||
{DMPAPER_PENV_5_ROTATED, DMPAPER_PENV_5},
|
||||
{DMPAPER_PENV_6_ROTATED, DMPAPER_PENV_6},
|
||||
{DMPAPER_PENV_7_ROTATED, DMPAPER_PENV_7},
|
||||
{DMPAPER_PENV_8_ROTATED, DMPAPER_PENV_8},
|
||||
{DMPAPER_PENV_9_ROTATED, DMPAPER_PENV_9},
|
||||
{DMPAPER_PENV_10_ROTATED, DMPAPER_PENV_10} // Is = DMPAPER_LAST, use as loop terminator
|
||||
};
|
||||
|
||||
static const int windowsConversionCount = int(sizeof(qt_windowsConversion) / sizeof(qt_windowsConversion[0]));
|
||||
|
||||
// Standard sizes data
|
||||
struct StandardPageSize {
|
||||
QPageSize::PageSizeId id;
|
||||
int windowsId; // Windows DMPAPER value
|
||||
QPageSize::Unit definitionUnits; // Standard definition size, e.g. ISO uses mm, ANSI uses inches
|
||||
int widthPoints;
|
||||
int heightPoints;
|
||||
qreal widthMillimeters;
|
||||
qreal heightMillimeters;
|
||||
qreal widthInches;
|
||||
qreal heightInches;
|
||||
const char *mediaOption; // PPD standard mediaOption ID
|
||||
};
|
||||
|
||||
// Standard page sizes taken from the Postscript PPD Standard v4.3
|
||||
// See http://partners.adobe.com/public/developer/en/ps/5003.PPD_Spec_v4.3.pdf
|
||||
// Excludes all Transverse and Rotated sizes
|
||||
// NB! This table needs to be in sync with QPageSize::PageSizeId
|
||||
static const StandardPageSize qt_pageSizes[] = {
|
||||
|
||||
// Existing Qt sizes including ISO, US, ANSI and other standards
|
||||
{QPageSize::A4 , DMPAPER_A4 , QPageSize::Millimeter, 595, 842, 210 , 297 , 8.27, 11.69, "A4"},
|
||||
{QPageSize::B5 , DMPAPER_NONE , QPageSize::Millimeter, 499, 709, 176 , 250 , 6.9 , 9.8 , "ISOB5"},
|
||||
{QPageSize::Letter , DMPAPER_LETTER , QPageSize::Inch , 612, 792, 215.9, 279.4, 8.5 , 11 , "Letter"},
|
||||
{QPageSize::Legal , DMPAPER_LEGAL , QPageSize::Inch , 612, 1008, 215.9, 355.6, 8.5 , 14 , "Legal"},
|
||||
{QPageSize::Executive , DMPAPER_NONE , QPageSize::Inch , 540, 720, 190.5, 254 , 7.5 , 10 , "Executive.7.5x10in"}, // Qt size differs from Postscript / Windows
|
||||
{QPageSize::A0 , DMPAPER_NONE , QPageSize::Millimeter, 2384, 3370, 841 , 1189 , 33.11, 46.81, "A0"},
|
||||
{QPageSize::A1 , DMPAPER_NONE , QPageSize::Millimeter, 1684, 2384, 594 , 841 , 23.39, 33.11, "A1"},
|
||||
{QPageSize::A2 , DMPAPER_A2 , QPageSize::Millimeter, 1191, 1684, 420 , 594 , 16.54, 23.39, "A2"},
|
||||
{QPageSize::A3 , DMPAPER_A3 , QPageSize::Millimeter, 842, 1191, 297 , 420 , 11.69, 16.54, "A3"},
|
||||
{QPageSize::A5 , DMPAPER_A5 , QPageSize::Millimeter, 420, 595, 148 , 210 , 5.83, 8.27, "A5"},
|
||||
{QPageSize::A6 , DMPAPER_A6 , QPageSize::Millimeter, 297, 420, 105 , 148 , 4.13, 5.83, "A6"},
|
||||
{QPageSize::A7 , DMPAPER_NONE , QPageSize::Millimeter, 210, 297, 74 , 105 , 2.91, 4.13, "A7"},
|
||||
{QPageSize::A8 , DMPAPER_NONE , QPageSize::Millimeter, 148, 210, 52 , 74 , 2.05, 2.91, "A8"},
|
||||
{QPageSize::A9 , DMPAPER_NONE , QPageSize::Millimeter, 105, 148, 37 , 52 , 1.46, 2.05, "A9"},
|
||||
{QPageSize::B0 , DMPAPER_NONE , QPageSize::Millimeter, 2835, 4008, 1000 , 1414 , 39.37, 55.67, "ISOB0"},
|
||||
{QPageSize::B1 , DMPAPER_NONE , QPageSize::Millimeter, 2004, 2835, 707 , 1000 , 27.83, 39.37, "ISOB1"},
|
||||
{QPageSize::B10 , DMPAPER_NONE , QPageSize::Millimeter, 88, 125, 31 , 44 , 1.22, 1.73, "ISOB10"},
|
||||
{QPageSize::B2 , DMPAPER_NONE , QPageSize::Millimeter, 1417, 2004, 500 , 707 , 19.68, 27.83, "ISOB2"},
|
||||
{QPageSize::B3 , DMPAPER_NONE , QPageSize::Millimeter, 1001, 1417, 353 , 500 , 13.9 , 19.68, "ISOB3"},
|
||||
{QPageSize::B4 , DMPAPER_ISO_B4 , QPageSize::Millimeter, 709, 1001, 250 , 353 , 9.84, 13.9 , "ISOB4"},
|
||||
{QPageSize::B6 , DMPAPER_NONE , QPageSize::Millimeter, 354, 499, 125 , 176 , 4.92, 6.93, "ISOB6"},
|
||||
{QPageSize::B7 , DMPAPER_NONE , QPageSize::Millimeter, 249, 354, 88 , 125 , 3.46, 4.92, "ISOB7"},
|
||||
{QPageSize::B8 , DMPAPER_NONE , QPageSize::Millimeter, 176, 249, 62 , 88 , 2.44, 3.46, "ISOB8"},
|
||||
{QPageSize::B9 , DMPAPER_NONE , QPageSize::Millimeter, 125, 176, 44 , 62 , 1.73, 2.44, "ISOB9"},
|
||||
{QPageSize::C5E , DMPAPER_ENV_C5 , QPageSize::Millimeter, 459, 649, 162 , 229 , 6.38, 9.02, "EnvC5"},
|
||||
{QPageSize::Comm10E , DMPAPER_ENV_10 , QPageSize::Inch , 297, 684, 104.8, 241.3, 4.12, 9.5 , "Env10"},
|
||||
{QPageSize::DLE , DMPAPER_ENV_DL , QPageSize::Millimeter, 312, 624, 110 , 220 , 4.33, 8.66, "EnvDL"},
|
||||
{QPageSize::Folio , DMPAPER_NONE , QPageSize::Millimeter, 595, 935, 210 , 330 , 8.27, 13 , "Folio"},
|
||||
{QPageSize::Ledger , DMPAPER_LEDGER , QPageSize::Inch , 1224, 792, 431.8, 279.4, 17 , 11 , "Ledger"},
|
||||
{QPageSize::Tabloid , DMPAPER_TABLOID , QPageSize::Inch , 792, 1224, 279.4, 431.8, 11 , 17 , "Tabloid"},
|
||||
{QPageSize::Custom , DMPAPER_USER , QPageSize::Millimeter, -1, -1, -1. , -1 , -1 , -1 , "Custom"}, // Special case to keep in sync with QPageSize::PageSizeId
|
||||
|
||||
// ISO Standard Sizes
|
||||
{QPageSize::A10 , DMPAPER_NONE , QPageSize::Millimeter, 73, 105, 26 , 37 , 1.02, 1.46, "A10"},
|
||||
{QPageSize::A3Extra , DMPAPER_A3_EXTRA , QPageSize::Millimeter, 913, 1262, 322 , 445 , 12.67, 17.52, "A3Extra"},
|
||||
{QPageSize::A4Extra , DMPAPER_A4_EXTRA , QPageSize::Millimeter, 667, 914, 235.5, 322.3, 9.27, 12.69, "A4Extra"},
|
||||
{QPageSize::A4Plus , DMPAPER_A4_PLUS , QPageSize::Millimeter, 595, 936, 210 , 330 , 8.27, 13 , "A4Plus"},
|
||||
{QPageSize::A4Small , DMPAPER_A4SMALL , QPageSize::Millimeter, 595, 842, 210 , 297 , 8.27, 11.69, "A4Small"},
|
||||
{QPageSize::A5Extra , DMPAPER_A5_EXTRA , QPageSize::Millimeter, 492, 668, 174 , 235 , 6.85, 9.25, "A5Extra"},
|
||||
{QPageSize::B5Extra , DMPAPER_B5_EXTRA , QPageSize::Millimeter, 570, 782, 201 , 276 , 7.9 , 10.8 , "ISOB5Extra"},
|
||||
|
||||
// JIS Standard Sizes
|
||||
{QPageSize::JisB0 , DMPAPER_NONE , QPageSize::Millimeter, 2920, 4127, 1030 , 1456 , 40.55, 57.32, "B0"},
|
||||
{QPageSize::JisB1 , DMPAPER_NONE , QPageSize::Millimeter, 2064, 2920, 728 , 1030 , 28.66, 40.55, "B1"},
|
||||
{QPageSize::JisB2 , DMPAPER_NONE , QPageSize::Millimeter, 1460, 2064, 515 , 728 , 20.28, 28.66, "B2"},
|
||||
{QPageSize::JisB3 , DMPAPER_NONE , QPageSize::Millimeter, 1032, 1460, 364 , 515 , 14.33, 20.28, "B3"},
|
||||
{QPageSize::JisB4 , DMPAPER_B4 , QPageSize::Millimeter, 729, 1032, 257 , 364 , 10.12, 14.33, "B4"},
|
||||
{QPageSize::JisB5 , DMPAPER_B5 , QPageSize::Millimeter, 516, 729, 182 , 257 , 7.17, 10.12, "B5"},
|
||||
{QPageSize::JisB6 , DMPAPER_B6_JIS , QPageSize::Millimeter, 363, 516, 128 , 182 , 5.04, 7.17, "B6"},
|
||||
{QPageSize::JisB7 , DMPAPER_NONE , QPageSize::Millimeter, 258, 363, 91 , 128 , 3.58, 5.04, "B7"},
|
||||
{QPageSize::JisB8 , DMPAPER_NONE , QPageSize::Millimeter, 181, 258, 64 , 91 , 2.52, 3.58, "B8"},
|
||||
{QPageSize::JisB9 , DMPAPER_NONE , QPageSize::Millimeter, 127, 181, 45 , 64 , 1.77, 2.52, "B9"},
|
||||
{QPageSize::JisB10 , DMPAPER_NONE , QPageSize::Millimeter, 91, 127, 32 , 45 , 1.26, 1.77, "B10"},
|
||||
|
||||
// ANSI / US Standard sizes
|
||||
{QPageSize::AnsiC , DMPAPER_NONE , QPageSize::Inch , 1224, 1584, 431.8, 558.8, 17 , 22 , "AnsiC"},
|
||||
{QPageSize::AnsiD , DMPAPER_NONE , QPageSize::Inch , 1584, 2448, 558.8, 863.6, 22 , 34 , "AnsiD"},
|
||||
{QPageSize::AnsiE , DMPAPER_NONE , QPageSize::Inch , 2448, 3168, 863.6, 1118 , 34 , 44 , "AnsiE"},
|
||||
{QPageSize::LegalExtra , DMPAPER_LEGAL_EXTRA , QPageSize::Inch , 684, 1080, 241.3, 381 , 9.5 , 15 , "LegalExtra"},
|
||||
{QPageSize::LetterExtra , DMPAPER_LETTER_EXTRA , QPageSize::Inch , 684, 864, 241.3, 304.8, 9.5 , 12 , "LetterExtra"},
|
||||
{QPageSize::LetterPlus , DMPAPER_LETTER_PLUS , QPageSize::Inch , 612, 914, 215.9, 322.3, 8.5 , 12.69, "LetterPlus"},
|
||||
{QPageSize::LetterSmall , DMPAPER_LETTERSMALL , QPageSize::Inch , 612, 792, 215.9, 279.4, 8.5 , 11 , "LetterSmall"},
|
||||
{QPageSize::TabloidExtra , DMPAPER_TABLOID_EXTRA , QPageSize::Inch , 864, 1296, 304.8, 457.2, 12 , 18 , "TabloidExtra"},
|
||||
|
||||
// Architectural sizes
|
||||
{QPageSize::ArchA , DMPAPER_NONE , QPageSize::Inch , 648, 864, 228.6, 304.8, 9 , 12 , "ARCHA"},
|
||||
{QPageSize::ArchB , DMPAPER_NONE , QPageSize::Inch , 864, 1296, 304.8, 457.2, 12 , 18 , "ARCHB"},
|
||||
{QPageSize::ArchC , DMPAPER_CSHEET , QPageSize::Inch , 1296, 1728, 457.2, 609.6, 18 , 24 , "ARCHC"},
|
||||
{QPageSize::ArchD , DMPAPER_DSHEET , QPageSize::Inch , 1728, 2592, 609.6, 914.4, 24 , 36 , "ARCHD"},
|
||||
{QPageSize::ArchE , DMPAPER_ESHEET , QPageSize::Inch , 2592, 3456, 914.4, 1219 , 36 , 48 , "ARCHE"},
|
||||
|
||||
// Inch-based Sizes
|
||||
{QPageSize::Imperial7x9 , DMPAPER_NONE , QPageSize::Inch , 504, 648, 177.8, 228.6, 7 , 9 , "7x9"},
|
||||
{QPageSize::Imperial8x10 , DMPAPER_NONE , QPageSize::Inch , 576, 720, 203.2, 254 , 8 , 10 , "8x10"},
|
||||
{QPageSize::Imperial9x11 , DMPAPER_9X11 , QPageSize::Inch , 648, 792, 228.6, 279.4, 9 , 11 , "9x11"},
|
||||
{QPageSize::Imperial9x12 , DMPAPER_NONE , QPageSize::Inch , 648, 864, 228.6, 304.8, 9 , 12 , "9x12"},
|
||||
{QPageSize::Imperial10x11 , DMPAPER_10X11 , QPageSize::Inch , 720, 792, 254 , 279.4, 10 , 11 , "10x11"},
|
||||
{QPageSize::Imperial10x13 , DMPAPER_NONE , QPageSize::Inch , 720, 936, 254 , 330.2, 10 , 13 , "10x13"},
|
||||
{QPageSize::Imperial10x14 , DMPAPER_10X14 , QPageSize::Inch , 720, 1008, 254 , 355.6, 10 , 14 , "10x14"},
|
||||
{QPageSize::Imperial12x11 , DMPAPER_12X11 , QPageSize::Inch , 864, 792, 304.8, 279.4, 12 , 11 , "12x11"},
|
||||
{QPageSize::Imperial15x11 , DMPAPER_15X11 , QPageSize::Inch , 1080, 792, 381 , 279.4, 15 , 11 , "15x11"},
|
||||
|
||||
// Other Page Sizes
|
||||
{QPageSize::ExecutiveStandard , DMPAPER_EXECUTIVE , QPageSize::Inch , 522, 756, 184.2, 266.7, 7.25, 10.5 , "Executive"}, // Qt size differs from Postscript / Windows
|
||||
{QPageSize::Note , DMPAPER_NOTE , QPageSize::Inch , 612, 792, 215.9, 279.4, 8.5 , 11 , "Note"},
|
||||
{QPageSize::Quarto , DMPAPER_QUARTO , QPageSize::Inch , 610, 780, 215.9, 275.1, 8.5 , 10.83, "Quarto"},
|
||||
{QPageSize::Statement , DMPAPER_STATEMENT , QPageSize::Inch , 396, 612, 139.7, 215.9, 5.5 , 8.5 , "Statement"},
|
||||
{QPageSize::SuperA , DMPAPER_A_PLUS , QPageSize::Millimeter, 643, 1009, 227 , 356 , 8.94, 14 , "SuperA"},
|
||||
{QPageSize::SuperB , DMPAPER_B_PLUS , QPageSize::Millimeter, 864, 1380, 305 , 487 , 12 , 19.17, "SuperB"},
|
||||
{QPageSize::Postcard , DMPAPER_JAPANESE_POSTCARD , QPageSize::Millimeter, 284, 419, 100 , 148 , 3.94, 5.83, "Postcard"},
|
||||
{QPageSize::DoublePostcard , DMPAPER_DBL_JAPANESE_POSTCARD, QPageSize::Millimeter, 567, 419, 200 , 148 , 7.87, 5.83, "DoublePostcard"},
|
||||
{QPageSize::Prc16K , DMPAPER_P16K , QPageSize::Millimeter, 414, 610, 146 , 215 , 5.75, 8.5 , "PRC16K"},
|
||||
{QPageSize::Prc32K , DMPAPER_P32K , QPageSize::Millimeter, 275, 428, 97 , 151 , 3.82, 5.95, "PRC32K"},
|
||||
{QPageSize::Prc32KBig , DMPAPER_P32KBIG , QPageSize::Millimeter, 275, 428, 97 , 151 , 3.82, 5.95, "PRC32KBig"},
|
||||
|
||||
// Fan Fold Sizes
|
||||
{QPageSize::FanFoldUS , DMPAPER_FANFOLD_US , QPageSize::Inch , 1071, 792, 377.8, 279.4, 14.875, 11 , "FanFoldUS"},
|
||||
{QPageSize::FanFoldGerman , DMPAPER_FANFOLD_STD_GERMAN , QPageSize::Inch , 612, 864, 215.9, 304.8, 8.5 , 12 , "FanFoldGerman"},
|
||||
{QPageSize::FanFoldGermanLegal, DMPAPER_FANFOLD_LGL_GERMAN , QPageSize::Inch , 612, 936, 215.9, 330 , 8.5 , 13 , "FanFoldGermanLegal"},
|
||||
|
||||
// ISO Envelopes
|
||||
{QPageSize::EnvelopeB4 , DMPAPER_ENV_B4 , QPageSize::Millimeter, 708, 1001, 250 , 353 , 9.84, 13.9 , "EnvISOB4"},
|
||||
{QPageSize::EnvelopeB5 , DMPAPER_ENV_B5 , QPageSize::Millimeter, 499, 709, 176 , 250 , 6.9 , 9.8 , "EnvISOB5"},
|
||||
{QPageSize::EnvelopeB6 , DMPAPER_ENV_B6 , QPageSize::Millimeter, 499, 354, 176 , 125 , 6.9 , 4.9 , "EnvISOB6"},
|
||||
{QPageSize::EnvelopeC0 , DMPAPER_NONE , QPageSize::Millimeter, 2599, 3676, 917 , 1297 , 36.1 , 51.06, "EnvC0"},
|
||||
{QPageSize::EnvelopeC1 , DMPAPER_NONE , QPageSize::Millimeter, 1837, 2599, 648 , 917 , 25.51, 36.1 , "EnvC1"},
|
||||
{QPageSize::EnvelopeC2 , DMPAPER_NONE , QPageSize::Millimeter, 1298, 1837, 458 , 648 , 18.03, 25.51, "EnvC2"},
|
||||
{QPageSize::EnvelopeC3 , DMPAPER_ENV_C3 , QPageSize::Millimeter, 918, 1296, 324 , 458 , 12.75, 18.03, "EnvC3"},
|
||||
{QPageSize::EnvelopeC4 , DMPAPER_ENV_C4 , QPageSize::Millimeter, 649, 918, 229 , 324 , 9.02, 12.75, "EnvC4"},
|
||||
{QPageSize::EnvelopeC6 , DMPAPER_ENV_C6 , QPageSize::Millimeter, 323, 459, 114 , 162 , 4.49, 6.38, "EnvC6"},
|
||||
{QPageSize::EnvelopeC65 , DMPAPER_ENV_C65 , QPageSize::Millimeter, 324, 648, 114 , 229 , 4.5 , 9 , "EnvC65"},
|
||||
{QPageSize::EnvelopeC7 , DMPAPER_NONE , QPageSize::Millimeter, 230, 323, 81 , 114 , 3.19, 4.49, "EnvC7"},
|
||||
|
||||
// US Envelopes
|
||||
{QPageSize::Envelope9 , DMPAPER_ENV_9 , QPageSize::Inch , 279, 639, 98.4, 225.4, 3.875, 8.875, "Env9"},
|
||||
{QPageSize::Envelope11 , DMPAPER_ENV_11 , QPageSize::Inch , 324, 747, 114.3, 263.5, 4.5 , 10.375, "Env11"},
|
||||
{QPageSize::Envelope12 , DMPAPER_ENV_12 , QPageSize::Inch , 342, 792, 120.7, 279.4, 4.75, 11 , "Env12"},
|
||||
{QPageSize::Envelope14 , DMPAPER_ENV_14 , QPageSize::Inch , 360, 828, 127 , 292.1, 5 , 11.5 , "Env14"},
|
||||
{QPageSize::EnvelopeMonarch , DMPAPER_ENV_MONARCH , QPageSize::Inch , 279, 540, 98.43, 190.5, 3.875, 7.5 , "EnvMonarch"},
|
||||
{QPageSize::EnvelopePersonal , DMPAPER_ENV_PERSONAL , QPageSize::Inch , 261, 468, 92.08, 165.1, 3.625, 6.5 , "EnvPersonal"},
|
||||
|
||||
// Other Envelopes
|
||||
{QPageSize::EnvelopeChou3 , DMPAPER_JENV_CHOU3 , QPageSize::Millimeter, 340, 666, 120 , 235 , 4.72, 9.25, "EnvChou3"},
|
||||
{QPageSize::EnvelopeChou4 , DMPAPER_JENV_CHOU4 , QPageSize::Millimeter, 255, 581, 90 , 205 , 3.54, 8 , "EnvChou4"},
|
||||
{QPageSize::EnvelopeInvite , DMPAPER_ENV_INVITE , QPageSize::Millimeter, 624, 624, 220 , 220 , 8.66, 8.66, "EnvInvite"},
|
||||
{QPageSize::EnvelopeItalian , DMPAPER_ENV_ITALY , QPageSize::Millimeter, 312, 652, 110 , 230 , 4.33, 9 , "EnvItalian"},
|
||||
{QPageSize::EnvelopeKaku2 , DMPAPER_JENV_KAKU2 , QPageSize::Millimeter, 680, 941, 240 , 332 , 9.45, 13 , "EnvKaku2"},
|
||||
{QPageSize::EnvelopeKaku3 , DMPAPER_JENV_KAKU3 , QPageSize::Millimeter, 612, 785, 216 , 277 , 8.5 , 10.9 , "EnvKaku3"},
|
||||
{QPageSize::EnvelopePrc1 , DMPAPER_PENV_1 , QPageSize::Millimeter, 289, 468, 102 , 165 , 4 , 6.5 , "EnvPRC1"},
|
||||
{QPageSize::EnvelopePrc2 , DMPAPER_PENV_2 , QPageSize::Millimeter, 289, 499, 102 , 176 , 4 , 6.9 , "EnvPRC2"},
|
||||
{QPageSize::EnvelopePrc3 , DMPAPER_PENV_3 , QPageSize::Millimeter, 354, 499, 125 , 176 , 4.9 , 6.9 , "EnvPRC3"},
|
||||
{QPageSize::EnvelopePrc4 , DMPAPER_PENV_4 , QPageSize::Millimeter, 312, 590, 110 , 208 , 4.33, 8.2 , "EnvPRC4"},
|
||||
{QPageSize::EnvelopePrc5 , DMPAPER_PENV_5 , QPageSize::Millimeter, 312, 624, 110 , 220 , 4.33, 8.66, "EnvPRC5"},
|
||||
{QPageSize::EnvelopePrc6 , DMPAPER_PENV_6 , QPageSize::Millimeter, 340, 652, 120 , 230 , 4.7 , 9 , "EnvPRC6"},
|
||||
{QPageSize::EnvelopePrc7 , DMPAPER_PENV_7 , QPageSize::Millimeter, 454, 652, 160 , 230 , 6.3 , 9 , "EnvPRC7"},
|
||||
{QPageSize::EnvelopePrc8 , DMPAPER_PENV_8 , QPageSize::Millimeter, 340, 876, 120 , 309 , 4.7 , 12.2 , "EnvPRC8"},
|
||||
{QPageSize::EnvelopePrc9 , DMPAPER_PENV_9 , QPageSize::Millimeter, 649, 918, 229 , 324 , 9 , 12.75, "EnvPRC9"},
|
||||
{QPageSize::EnvelopePrc10 , DMPAPER_PENV_10 , QPageSize::Millimeter, 918, 1298, 324 , 458 , 12.75, 18 , "EnvPRC10"},
|
||||
{QPageSize::EnvelopeYou4 , DMPAPER_JENV_YOU4 , QPageSize::Millimeter, 298, 666, 105 , 235 , 4.13, 9.25, "EnvYou4"}
|
||||
};
|
||||
|
||||
static const int pageSizesCount = int(sizeof(qt_pageSizes) / sizeof(qt_pageSizes[0]));
|
||||
|
||||
// Return key name for PageSize
|
||||
static QString qt_keyForPageSizeId(QPageSize::PageSizeId id)
|
||||
{
|
||||
return QString::fromLatin1(qt_pageSizes[id].mediaOption);
|
||||
}
|
||||
|
||||
// Return key name for custom size
|
||||
static QString qt_keyForCustomSize(const QSizeF &size, QPageSize::Unit units)
|
||||
{
|
||||
// PPD custom format
|
||||
QString key = QString("Custom.%1x%2%3");
|
||||
QString abbrev;
|
||||
switch (units) {
|
||||
case QPageSize::Millimeter:
|
||||
abbrev = QString("mm");
|
||||
break;
|
||||
case QPageSize::Point:
|
||||
break;
|
||||
case QPageSize::Inch:
|
||||
abbrev = QString("in");
|
||||
break;
|
||||
case QPageSize::Pica:
|
||||
abbrev = QString("pc");
|
||||
break;
|
||||
case QPageSize::Didot:
|
||||
abbrev = QString("DD");
|
||||
break;
|
||||
case QPageSize::Cicero:
|
||||
abbrev = QString("CC");
|
||||
break;
|
||||
}
|
||||
// Assumes size is already max 2 decimal places
|
||||
return key.arg(size.width()).arg(size.height()).arg(abbrev);
|
||||
}
|
||||
|
||||
// Multiplier for converting units to points.
|
||||
static qreal qt_pointMultiplier(QPageSize::Unit unit)
|
||||
{
|
||||
switch (unit) {
|
||||
case QPageSize::Millimeter:
|
||||
return 2.83464566929;
|
||||
case QPageSize::Point:
|
||||
return 1.0;
|
||||
case QPageSize::Inch:
|
||||
return 72.0;
|
||||
case QPageSize::Pica:
|
||||
return 12;
|
||||
case QPageSize::Didot:
|
||||
return 1.065826771;
|
||||
case QPageSize::Cicero:
|
||||
return 12.789921252;
|
||||
}
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
// Multiplier for converting pixels to points.
|
||||
Q_GUI_EXPORT qreal qt_pixelMultiplier(int resolution)
|
||||
{
|
||||
return resolution <= 0 ? 1.0 : 72.0 / resolution;
|
||||
}
|
||||
|
||||
static QSizeF qt_definitionSize(QPageSize::PageSizeId pageSizeId)
|
||||
{
|
||||
QPageSize::Unit units = qt_pageSizes[pageSizeId].definitionUnits;
|
||||
if (units == QPageSize::Millimeter)
|
||||
return QSizeF(qt_pageSizes[pageSizeId].widthMillimeters, qt_pageSizes[pageSizeId].heightMillimeters);
|
||||
Q_ASSERT(units == QPageSize::Inch); // We currently only support definitions in mm or inches
|
||||
return QSizeF(qt_pageSizes[pageSizeId].widthInches, qt_pageSizes[pageSizeId].heightInches);
|
||||
}
|
||||
|
||||
static QSizeF qt_convertUnits(const QSizeF &size, QPageSize::Unit fromUnits, QPageSize::Unit toUnits)
|
||||
{
|
||||
if (!size.isValid())
|
||||
return QSizeF();
|
||||
|
||||
// If the units are the same or the size is 0, then don't need to convert
|
||||
if (fromUnits == toUnits || (qFuzzyIsNull(size.width()) && qFuzzyIsNull(size.height())))
|
||||
return size;
|
||||
|
||||
QSizeF newSize = size;
|
||||
// First convert to points
|
||||
if (fromUnits != QPageSize::Point) {
|
||||
const qreal multiplier = qt_pointMultiplier(fromUnits);
|
||||
newSize = newSize * multiplier;
|
||||
}
|
||||
// Then convert from points to required units
|
||||
const qreal multiplier = qt_pointMultiplier(toUnits);
|
||||
// Try force to 2 decimal places for consistency
|
||||
const int width = qRound(newSize.width() * 100 / multiplier);
|
||||
const int height = qRound(newSize.height() * 100 / multiplier);
|
||||
return QSizeF(width / 100.0, height / 100.0);
|
||||
}
|
||||
|
||||
static QSize qt_convertUnitsToPoints(const QSizeF &size, QPageSize::Unit units)
|
||||
{
|
||||
if (!size.isValid())
|
||||
return QSize();
|
||||
return QSizeF(size * qt_pointMultiplier(units)).toSize();
|
||||
}
|
||||
|
||||
static QSize qt_convertPointsToPixels(const QSize &size, int resolution)
|
||||
{
|
||||
if (!size.isValid() || resolution <= 0)
|
||||
return QSize();
|
||||
const qreal multiplier = qt_pixelMultiplier(resolution);
|
||||
return QSize(qRound(size.width() / multiplier), qRound(size.height() / multiplier));
|
||||
}
|
||||
|
||||
static QSizeF qt_convertPointsToUnits(const QSize &size, QPageSize::Unit units)
|
||||
{
|
||||
if (!size.isValid())
|
||||
return QSizeF();
|
||||
const qreal multiplier = qt_pointMultiplier(units);
|
||||
// Try force to 2 decimal places for consistency
|
||||
const int width = qRound(size.width() * 100 / multiplier);
|
||||
const int height = qRound(size.height() * 100 / multiplier);
|
||||
return QSizeF(width / 100.0, height / 100.0);
|
||||
}
|
||||
|
||||
static QSizeF qt_unitSize(QPageSize::PageSizeId pageSizeId, QPageSize::Unit units)
|
||||
{
|
||||
switch (units) {
|
||||
case QPageSize::Millimeter:
|
||||
return QSizeF(qt_pageSizes[pageSizeId].widthMillimeters, qt_pageSizes[pageSizeId].heightMillimeters);
|
||||
case QPageSize::Point:
|
||||
return QSizeF(qt_pageSizes[pageSizeId].widthPoints, qt_pageSizes[pageSizeId].heightPoints);
|
||||
case QPageSize::Inch:
|
||||
return QSizeF(qt_pageSizes[pageSizeId].widthInches, qt_pageSizes[pageSizeId].heightInches);
|
||||
case QPageSize::Pica:
|
||||
case QPageSize::Didot:
|
||||
case QPageSize::Cicero:
|
||||
return qt_convertPointsToUnits(QSize(qt_pageSizes[pageSizeId].widthPoints,
|
||||
qt_pageSizes[pageSizeId].heightPoints), units);
|
||||
}
|
||||
return QSizeF();
|
||||
}
|
||||
|
||||
class QPageSizePrivate : public QSharedData
|
||||
{
|
||||
public:
|
||||
explicit QPageSizePrivate(QPageSize::PageSizeId pageSizeId);
|
||||
~QPageSizePrivate();
|
||||
|
||||
bool operator==(const QPageSizePrivate &other) const;
|
||||
bool isEquivalentTo(const QPageSizePrivate &other) const;
|
||||
|
||||
bool isValid() const;
|
||||
|
||||
QSizeF size(QPageSize::Unit units) const;
|
||||
QSize sizePixels(int resolution) const;
|
||||
|
||||
private:
|
||||
friend class QPageSize;
|
||||
|
||||
void init(QPageSize::PageSizeId id);
|
||||
void init(const QSize &size);
|
||||
void init(const QSizeF &size, QPageSize::Unit units);
|
||||
|
||||
QString m_key;
|
||||
QPageSize::PageSizeId m_id;
|
||||
QSize m_pointSize;
|
||||
int m_windowsId;
|
||||
QSizeF m_size;
|
||||
QPageSize::Unit m_units;
|
||||
};
|
||||
|
||||
QPageSizePrivate::QPageSizePrivate(QPageSize::PageSizeId pageSizeId)
|
||||
: m_id(QPageSize::Custom),
|
||||
m_windowsId(0),
|
||||
m_units(QPageSize::Point)
|
||||
{
|
||||
if (pageSizeId >= QPageSize::PageSizeId(0) && pageSizeId <= QPageSize::LastPageSize)
|
||||
init(pageSizeId);
|
||||
}
|
||||
|
||||
QPageSizePrivate::~QPageSizePrivate()
|
||||
{
|
||||
}
|
||||
|
||||
// Init a standard PageSizeId
|
||||
void QPageSizePrivate::init(QPageSize::PageSizeId id)
|
||||
{
|
||||
m_id = id;
|
||||
m_size = qt_definitionSize(id);
|
||||
m_units = qt_pageSizes[id].definitionUnits;
|
||||
m_key = qt_keyForPageSizeId(id);
|
||||
m_windowsId = qt_pageSizes[id].windowsId;
|
||||
m_pointSize = QSize(qt_pageSizes[id].widthPoints, qt_pageSizes[id].heightPoints);
|
||||
}
|
||||
|
||||
// Init a point size
|
||||
void QPageSizePrivate::init(const QSize &size)
|
||||
{
|
||||
m_id = QPageSize::Custom;
|
||||
m_size = size;
|
||||
m_units = QPageSize::Point;
|
||||
m_key = qt_keyForCustomSize(m_size, m_units);
|
||||
m_windowsId = 0;
|
||||
m_pointSize = size;
|
||||
}
|
||||
|
||||
// Init a unit size
|
||||
void QPageSizePrivate::init(const QSizeF &size, QPageSize::Unit units)
|
||||
{
|
||||
m_id = QPageSize::Custom;
|
||||
m_size = size;
|
||||
m_units = units;
|
||||
m_key = qt_keyForCustomSize(m_size, m_units);
|
||||
m_windowsId = 0;
|
||||
m_pointSize = qt_convertUnitsToPoints(m_size, m_units);
|
||||
}
|
||||
|
||||
bool QPageSizePrivate::operator==(const QPageSizePrivate &other) const
|
||||
{
|
||||
return m_size == other.m_size
|
||||
&& m_units == other.m_units
|
||||
&& m_key == other.m_key;
|
||||
}
|
||||
|
||||
bool QPageSizePrivate::isEquivalentTo(const QPageSizePrivate &other) const
|
||||
{
|
||||
return m_pointSize == other.m_pointSize;
|
||||
}
|
||||
|
||||
bool QPageSizePrivate::isValid() const
|
||||
{
|
||||
return m_pointSize.isValid() && !m_key.isEmpty();
|
||||
}
|
||||
|
||||
QSizeF QPageSizePrivate::size(QPageSize::Unit units) const
|
||||
{
|
||||
// If want units we've stored in, we already have them
|
||||
if (units == m_units)
|
||||
return m_size;
|
||||
|
||||
// If want points we already have them
|
||||
if (units == QPageSize::Point)
|
||||
return QSizeF(m_pointSize.width(), m_pointSize.height());
|
||||
|
||||
// If a custom size do a conversion
|
||||
if (m_id == QPageSize::Custom)
|
||||
return qt_convertUnits(m_size, m_units, units);
|
||||
|
||||
// Otherwise use the standard sizes
|
||||
return qt_unitSize(m_id, units);
|
||||
}
|
||||
|
||||
QSize QPageSizePrivate::sizePixels(int resolution) const
|
||||
{
|
||||
return qt_convertPointsToPixels(m_pointSize, resolution);;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\class QPageSize
|
||||
\inmodule QtGui
|
||||
\since 5.3
|
||||
\brief The QPageSize class describes the size and name of a defined page size
|
||||
|
||||
This class implements support for the set of standard page sizes as defined
|
||||
in the Adobe Postscript PPD Standard v4.3. It defines the standard set of
|
||||
page sizes in points, millimeters and inches and ensures these sizes are
|
||||
consistently used. Other size units can be used but will be calculated
|
||||
results and so may not always be consistent. The defined point sizes are
|
||||
always a integer, all other sizes can be fractions of a unit.
|
||||
|
||||
The defined size is always in width x height order with no implied page
|
||||
orientation. Note that it is possible for page sizes to be defined where the
|
||||
width is greater than the height, such as QPageSize::Ledger, so you cannot
|
||||
rely on comparing the width and height values to determine page orientation.
|
||||
|
||||
For example, A4 is defined by the standard as 210mm x 297mm, 8.27in x 11.69in,
|
||||
or 595pt x 842pt.
|
||||
|
||||
You can also define custom page sizes with custom names in any units you want
|
||||
and this unit size will be preserved and used as the base for all other unit
|
||||
size calculations.
|
||||
|
||||
When creating a QPageSize using a custom QSize you can choose if you want
|
||||
QPageSize to try match the size to a standard page size. By default
|
||||
QPaperSize uses a FuzzyMatch mode where it will match a given page size to
|
||||
a standard page size if it falls within 3 postscript points of a defined
|
||||
standard size. You can override this to request only an exact match but this
|
||||
is not recommended as conversions between units can easily lose 3 points and
|
||||
result in incorrect page sizes.
|
||||
|
||||
A QPageSize instance may also be obtained by querying the supported page sizes
|
||||
for a print device. In this case the localized name returned is that defined
|
||||
by the printer itself. Note that the print device may not support the current
|
||||
default locale language.
|
||||
|
||||
The class also provides convenience methods for converting page size IDs to and from
|
||||
various unit sizes.
|
||||
|
||||
\sa QPagedPaintDevice, QPdfWriter
|
||||
*/
|
||||
|
||||
/*!
|
||||
\enum QPageSize::PageSizeId
|
||||
|
||||
This enum type lists the available page sizes as defined in the Postscript
|
||||
PPD standard. These values are duplicated in QPagedPaintDevice and QPrinter.
|
||||
|
||||
The defined sizes are:
|
||||
|
||||
\value A0 841 x 1189 mm
|
||||
\value A1 594 x 841 mm
|
||||
\value A2 420 x 594 mm
|
||||
\value A3 297 x 420 mm
|
||||
\value A4 210 x 297 mm, 8.26 x 11.69 inches
|
||||
\value A5 148 x 210 mm
|
||||
\value A6 105 x 148 mm
|
||||
\value A7 74 x 105 mm
|
||||
\value A8 52 x 74 mm
|
||||
\value A9 37 x 52 mm
|
||||
\value B0 1000 x 1414 mm
|
||||
\value B1 707 x 1000 mm
|
||||
\value B2 500 x 707 mm
|
||||
\value B3 353 x 500 mm
|
||||
\value B4 250 x 353 mm
|
||||
\value B5 176 x 250 mm, 6.93 x 9.84 inches
|
||||
\value B6 125 x 176 mm
|
||||
\value B7 88 x 125 mm
|
||||
\value B8 62 x 88 mm
|
||||
\value B9 44 x 62 mm
|
||||
\value B10 31 x 44 mm
|
||||
\value C5E 163 x 229 mm
|
||||
\value Comm10E 105 x 241 mm, U.S. Common 10 Envelope
|
||||
\value DLE 110 x 220 mm
|
||||
\value Executive 7.5 x 10 inches, 190.5 x 254 mm
|
||||
\value Folio 210 x 330 mm
|
||||
\value Ledger 431.8 x 279.4 mm
|
||||
\value Legal 8.5 x 14 inches, 215.9 x 355.6 mm
|
||||
\value Letter 8.5 x 11 inches, 215.9 x 279.4 mm
|
||||
\value Tabloid 279.4 x 431.8 mm
|
||||
\value Custom Unknown, or a user defined size.
|
||||
\value A10
|
||||
\value A3Extra
|
||||
\value A4Extra
|
||||
\value A4Plus
|
||||
\value A4Small
|
||||
\value A5Extra
|
||||
\value B5Extra
|
||||
\value JisB0
|
||||
\value JisB1
|
||||
\value JisB2
|
||||
\value JisB3
|
||||
\value JisB4
|
||||
\value JisB5
|
||||
\value JisB6,
|
||||
\value JisB7
|
||||
\value JisB8
|
||||
\value JisB9
|
||||
\value JisB10
|
||||
\value AnsiA = Letter
|
||||
\value AnsiB = Ledger
|
||||
\value AnsiC
|
||||
\value AnsiD
|
||||
\value AnsiE
|
||||
\value LegalExtra
|
||||
\value LetterExtra
|
||||
\value LetterPlus
|
||||
\value LetterSmall
|
||||
\value TabloidExtra
|
||||
\value ArchA
|
||||
\value ArchB
|
||||
\value ArchC
|
||||
\value ArchD
|
||||
\value ArchE
|
||||
\value Imperial7x9
|
||||
\value Imperial8x10
|
||||
\value Imperial9x11
|
||||
\value Imperial9x12
|
||||
\value Imperial10x11
|
||||
\value Imperial10x13
|
||||
\value Imperial10x14
|
||||
\value Imperial12x11
|
||||
\value Imperial15x11
|
||||
\value ExecutiveStandard
|
||||
\value Note
|
||||
\value Quarto
|
||||
\value Statement
|
||||
\value SuperA
|
||||
\value SuperB
|
||||
\value Postcard
|
||||
\value DoublePostcard
|
||||
\value Prc16K
|
||||
\value Prc32K
|
||||
\value Prc32KBig
|
||||
\value FanFoldUS
|
||||
\value FanFoldGerman
|
||||
\value FanFoldGermanLegal
|
||||
\value EnvelopeB4
|
||||
\value EnvelopeB5
|
||||
\value EnvelopeB6
|
||||
\value EnvelopeC0
|
||||
\value EnvelopeC1
|
||||
\value EnvelopeC2
|
||||
\value EnvelopeC3
|
||||
\value EnvelopeC4
|
||||
\value EnvelopeC5 = C5E
|
||||
\value EnvelopeC6
|
||||
\value EnvelopeC65
|
||||
\value EnvelopeC7
|
||||
\value EnvelopeDL = DLE
|
||||
\value Envelope9
|
||||
\value Envelope10 = Comm10E
|
||||
\value Envelope11
|
||||
\value Envelope12
|
||||
\value Envelope14
|
||||
\value EnvelopeMonarch
|
||||
\value EnvelopePersonal
|
||||
\value EnvelopeChou3
|
||||
\value EnvelopeChou4
|
||||
\value EnvelopeInvite
|
||||
\value EnvelopeItalian
|
||||
\value EnvelopeKaku2
|
||||
\value EnvelopeKaku3
|
||||
\value EnvelopePrc1
|
||||
\value EnvelopePrc2
|
||||
\value EnvelopePrc3
|
||||
\value EnvelopePrc4
|
||||
\value EnvelopePrc5
|
||||
\value EnvelopePrc6
|
||||
\value EnvelopePrc7
|
||||
\value EnvelopePrc8
|
||||
\value EnvelopePrc9
|
||||
\value EnvelopePrc10
|
||||
\value EnvelopeYou4
|
||||
\value LastPageSize = EnvelopeYou4
|
||||
\omitvalue NPageSize
|
||||
\omitvalue NPaperSize
|
||||
|
||||
Due to historic reasons QPageSize::Executive is not the same as the standard
|
||||
Postscript and Windows Executive size, use QPageSize::ExecutiveStandard instead.
|
||||
|
||||
The Postscript standard size QPageSize::Folio is different to the Windows
|
||||
DMPAPER_FOLIO size, use the Postscript standard size QPageSize::FanFoldGermanLegal
|
||||
if needed.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\enum QPageSize::Unit
|
||||
|
||||
This enum type is used to specify the measurement unit for page sizes.
|
||||
|
||||
\value Millimeter
|
||||
\value Point 1/72th of an inch
|
||||
\value Inch
|
||||
\value Pica 1/72th of a foot, 1/6th of an inch, 12 Points
|
||||
\value Didot 1/72th of a French inch, 0.375 mm
|
||||
\value Cicero 1/6th of a French inch, 12 Didot, 4.5mm
|
||||
*/
|
||||
|
||||
/*!
|
||||
\enum QPageSize::SizeMatchPolicy
|
||||
|
||||
\value FuzzyMatch Match to a standard page size if within the margin of tolerance.
|
||||
\value FuzzyOrientationMatch Match to a standard page size if within the margin of tolerance regardless of orientation.
|
||||
\value ExactMatch Only match to a standard page size if the sizes match exactly.
|
||||
*/
|
||||
|
||||
/*!
|
||||
Creates a QPageSize of the standard \a pageSize.
|
||||
|
||||
If \a pageSize is QPageSize::Custom then the resulting QPageSize will not
|
||||
be valid. Use the custom size constructor instead.
|
||||
*/
|
||||
|
||||
QPageSize::QPageSize(PageSizeId pageSize)
|
||||
: d(new QPageSizePrivate(pageSize))
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
Destroys the page.
|
||||
*/
|
||||
|
||||
QPageSize::~QPageSize()
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn void QPageSize::swap(QPageSize &other)
|
||||
|
||||
Swaps this QPageSize with \a other. This function is very fast and
|
||||
never fails.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QPageSize &QPageSize::operator=(QPageSize &&other)
|
||||
|
||||
Move-assigns \a other to this QPageSize instance, transferring the
|
||||
ownership of the managed pointer to this instance.
|
||||
*/
|
||||
|
||||
/*!
|
||||
Returns \c true if this page size is valid.
|
||||
|
||||
The page size may be invalid if created with an invalid PageSizeId, or a
|
||||
negative or invalid QSize or QSizeF, or the null constructor.
|
||||
*/
|
||||
|
||||
bool QPageSize::isValid() const
|
||||
{
|
||||
return d && d->isValid();
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the size of the page in the required \a units.
|
||||
|
||||
If the QPageSize is invalid then the QSizeF will be invalid.
|
||||
*/
|
||||
|
||||
QSizeF QPageSize::size(Unit units) const
|
||||
{
|
||||
return isValid() ? d->size(units) : QSize();
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
239
core/qpagesize.h
Normal file
239
core/qpagesize.h
Normal file
|
@ -0,0 +1,239 @@
|
|||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2014 John Layt <jlayt@kde.org>
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the QtGui module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QPAGESIZE_H
|
||||
#define QPAGESIZE_H
|
||||
|
||||
#include <QtCore/qsharedpointer.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#if defined(B0)
|
||||
#undef B0 // Terminal hang-up. We assume that you do not want that.
|
||||
#endif
|
||||
|
||||
class QPageSizePrivate;
|
||||
class QString;
|
||||
class QSize;
|
||||
class QSizeF;
|
||||
class QRectF;
|
||||
class QRect;
|
||||
|
||||
class QPageSize
|
||||
{
|
||||
public:
|
||||
|
||||
// ### Qt6 Re-order and remove duplicates
|
||||
// NOTE: Must keep in sync with QPagedPrintEngine and QPrinter
|
||||
enum PageSizeId {
|
||||
// Existing Qt sizes
|
||||
A4,
|
||||
B5,
|
||||
Letter,
|
||||
Legal,
|
||||
Executive,
|
||||
A0,
|
||||
A1,
|
||||
A2,
|
||||
A3,
|
||||
A5,
|
||||
A6,
|
||||
A7,
|
||||
A8,
|
||||
A9,
|
||||
B0,
|
||||
B1,
|
||||
B10,
|
||||
B2,
|
||||
B3,
|
||||
B4,
|
||||
B6,
|
||||
B7,
|
||||
B8,
|
||||
B9,
|
||||
C5E,
|
||||
Comm10E,
|
||||
DLE,
|
||||
Folio,
|
||||
Ledger,
|
||||
Tabloid,
|
||||
Custom,
|
||||
|
||||
// New values derived from PPD standard
|
||||
A10,
|
||||
A3Extra,
|
||||
A4Extra,
|
||||
A4Plus,
|
||||
A4Small,
|
||||
A5Extra,
|
||||
B5Extra,
|
||||
|
||||
JisB0,
|
||||
JisB1,
|
||||
JisB2,
|
||||
JisB3,
|
||||
JisB4,
|
||||
JisB5,
|
||||
JisB6,
|
||||
JisB7,
|
||||
JisB8,
|
||||
JisB9,
|
||||
JisB10,
|
||||
|
||||
// AnsiA = Letter,
|
||||
// AnsiB = Ledger,
|
||||
AnsiC,
|
||||
AnsiD,
|
||||
AnsiE,
|
||||
LegalExtra,
|
||||
LetterExtra,
|
||||
LetterPlus,
|
||||
LetterSmall,
|
||||
TabloidExtra,
|
||||
|
||||
ArchA,
|
||||
ArchB,
|
||||
ArchC,
|
||||
ArchD,
|
||||
ArchE,
|
||||
|
||||
Imperial7x9,
|
||||
Imperial8x10,
|
||||
Imperial9x11,
|
||||
Imperial9x12,
|
||||
Imperial10x11,
|
||||
Imperial10x13,
|
||||
Imperial10x14,
|
||||
Imperial12x11,
|
||||
Imperial15x11,
|
||||
|
||||
ExecutiveStandard,
|
||||
Note,
|
||||
Quarto,
|
||||
Statement,
|
||||
SuperA,
|
||||
SuperB,
|
||||
Postcard,
|
||||
DoublePostcard,
|
||||
Prc16K,
|
||||
Prc32K,
|
||||
Prc32KBig,
|
||||
|
||||
FanFoldUS,
|
||||
FanFoldGerman,
|
||||
FanFoldGermanLegal,
|
||||
|
||||
EnvelopeB4,
|
||||
EnvelopeB5,
|
||||
EnvelopeB6,
|
||||
EnvelopeC0,
|
||||
EnvelopeC1,
|
||||
EnvelopeC2,
|
||||
EnvelopeC3,
|
||||
EnvelopeC4,
|
||||
// EnvelopeC5 = C5E,
|
||||
EnvelopeC6,
|
||||
EnvelopeC65,
|
||||
EnvelopeC7,
|
||||
// EnvelopeDL = DLE,
|
||||
|
||||
Envelope9,
|
||||
// Envelope10 = Comm10E,
|
||||
Envelope11,
|
||||
Envelope12,
|
||||
Envelope14,
|
||||
EnvelopeMonarch,
|
||||
EnvelopePersonal,
|
||||
|
||||
EnvelopeChou3,
|
||||
EnvelopeChou4,
|
||||
EnvelopeInvite,
|
||||
EnvelopeItalian,
|
||||
EnvelopeKaku2,
|
||||
EnvelopeKaku3,
|
||||
EnvelopePrc1,
|
||||
EnvelopePrc2,
|
||||
EnvelopePrc3,
|
||||
EnvelopePrc4,
|
||||
EnvelopePrc5,
|
||||
EnvelopePrc6,
|
||||
EnvelopePrc7,
|
||||
EnvelopePrc8,
|
||||
EnvelopePrc9,
|
||||
EnvelopePrc10,
|
||||
EnvelopeYou4,
|
||||
|
||||
// Last item, with commonly used synynoms from QPagedPrintEngine / QPrinter
|
||||
LastPageSize = EnvelopeYou4,
|
||||
NPageSize = LastPageSize,
|
||||
NPaperSize = LastPageSize,
|
||||
|
||||
// Convenience overloads for naming consistency
|
||||
AnsiA = Letter,
|
||||
AnsiB = Ledger,
|
||||
EnvelopeC5 = C5E,
|
||||
EnvelopeDL = DLE,
|
||||
Envelope10 = Comm10E
|
||||
};
|
||||
|
||||
// NOTE: Must keep in sync with QPageLayout::Unit and QPrinter::Unit
|
||||
enum Unit {
|
||||
Millimeter,
|
||||
Point,
|
||||
Inch,
|
||||
Pica,
|
||||
Didot,
|
||||
Cicero
|
||||
};
|
||||
|
||||
enum SizeMatchPolicy {
|
||||
FuzzyMatch,
|
||||
FuzzyOrientationMatch,
|
||||
ExactMatch
|
||||
};
|
||||
|
||||
explicit QPageSize(PageSizeId pageSizeId);
|
||||
~QPageSize();
|
||||
|
||||
bool isValid() const;
|
||||
QSizeF size(Unit units) const;
|
||||
|
||||
private:
|
||||
friend class QPageSizePrivate;
|
||||
friend class QPlatformPrintDevice;
|
||||
QSharedDataPointer<QPageSizePrivate> d;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QPAGESIZE_H
|
|
@ -125,7 +125,7 @@ static KJSObject docGetExternal( KJSContext *, void *object )
|
|||
|
||||
const bool isShell = ( widget
|
||||
&& widget->parentWidget()
|
||||
&& widget->parentWidget()->objectName() == QLatin1String( "okular::Shell" ) );
|
||||
&& widget->parentWidget()->objectName().startsWith( QLatin1String( "okular::Shell" ) ) );
|
||||
return KJSBoolean( !isShell );
|
||||
}
|
||||
|
||||
|
|
|
@ -1036,7 +1036,12 @@ Context menu actions like Rename Bookmarks etc.)
|
|||
</menuchoice>
|
||||
</term>
|
||||
<listitem>
|
||||
<para><action>Save</action> the currently open file under a different name using the document backend. With the &PDF; backend (Poppler >= 0.8 required) it is possible to save the document with the changed values of the form fields.<!--Only useful for pdf? what happens with other formats/backends?--> It can be possible (provided that the data were not secured using DRM) to save annotations with &PDF; files (Poppler >= 0.22 required).</para>
|
||||
<para><action>Saves</action> the document under a new name including all the changes (annotations, form contents, &etc;), provided the document backend supports saving changes. With the &PDF; backend it is possible to save the document with the changed values of the form fields.<!--Only useful for pdf? what happens with other formats/backends?--> It can be possible (provided that the data were not secured using DRM) to save annotations with &PDF; files.</para>
|
||||
<note>
|
||||
<para>
|
||||
Note that, due to the way this is implemented, even if there are no changes to the file, the new file need not to be an exact bit-for-bit copy of the original file (⪚ can have a different SHA-1 hash, &etc;).
|
||||
</para>
|
||||
</note>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
@ -1048,9 +1053,7 @@ Context menu actions like Rename Bookmarks etc.)
|
|||
</menuchoice>
|
||||
</term>
|
||||
<listitem>
|
||||
<para><action>Save</action> a copy of the currently open file under a different name
|
||||
without using the current document backend.</para>
|
||||
<!-- does not save the annotations, they are still coupled to the original file-->
|
||||
<para><action>Saves</action> a copy of the original document under a new name (completely bypassing the document backend). The saved document will be a bit-for-bit copy of the original.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
|
|
@ -161,6 +161,7 @@ X-KDE-Keywords[da]=djvu
|
|||
X-KDE-Keywords[de]=djvu
|
||||
X-KDE-Keywords[el]=djvu
|
||||
X-KDE-Keywords[en_GB]=djvu
|
||||
X-KDE-Keywords[eo]=djvu
|
||||
X-KDE-Keywords[es]=djvu
|
||||
X-KDE-Keywords[et]=djvu
|
||||
X-KDE-Keywords[fi]=djvu
|
||||
|
|
|
@ -141,6 +141,7 @@ X-KDE-Keywords[da]=djvu
|
|||
X-KDE-Keywords[de]=djvu
|
||||
X-KDE-Keywords[el]=djvu
|
||||
X-KDE-Keywords[en_GB]=djvu
|
||||
X-KDE-Keywords[eo]=djvu
|
||||
X-KDE-Keywords[es]=djvu
|
||||
X-KDE-Keywords[et]=djvu
|
||||
X-KDE-Keywords[fi]=djvu
|
||||
|
|
|
@ -161,6 +161,7 @@ X-KDE-Keywords[da]=dvi
|
|||
X-KDE-Keywords[de]=dvi
|
||||
X-KDE-Keywords[el]=dvi
|
||||
X-KDE-Keywords[en_GB]=dvi
|
||||
X-KDE-Keywords[eo]=dvi
|
||||
X-KDE-Keywords[es]=dvi
|
||||
X-KDE-Keywords[et]=dvi
|
||||
X-KDE-Keywords[fi]=dvi
|
||||
|
|
|
@ -141,6 +141,7 @@ X-KDE-Keywords[da]=dvi
|
|||
X-KDE-Keywords[de]=dvi
|
||||
X-KDE-Keywords[el]=dvi
|
||||
X-KDE-Keywords[en_GB]=dvi
|
||||
X-KDE-Keywords[eo]=dvi
|
||||
X-KDE-Keywords[es]=dvi
|
||||
X-KDE-Keywords[et]=dvi
|
||||
X-KDE-Keywords[fi]=dvi
|
||||
|
|
|
@ -322,6 +322,7 @@ Okular::Annotation* createAnnotationFromPopplerAnnotation( Poppler::Annotation *
|
|||
case Poppler::Annotation::AGeom:
|
||||
case Poppler::Annotation::AHighlight:
|
||||
case Poppler::Annotation::AInk:
|
||||
case Poppler::Annotation::ACaret:
|
||||
{
|
||||
externallyDrawn = true;
|
||||
/* fallback */
|
||||
|
|
|
@ -67,7 +67,7 @@ Comment[ar]=المنتهى الخلفي PDF لأوكلار
|
|||
Comment[ast]=Motor PDF pa Okular qu'usa Poppler
|
||||
Comment[bg]=Ядро на Okular за PDF, използващо poppler
|
||||
Comment[bs]=Pozadina PDF-a za Okular koristeći Poppler
|
||||
Comment[ca]=Dorsal de PDF per a l'Okular emprant el poppler
|
||||
Comment[ca]=Dorsal de PDF per a l'Okular que empra el «poppler»
|
||||
Comment[ca@valencia]=Dorsal de PDF per a l'Okular emprant el poppler
|
||||
Comment[cs]=Implementace PDF pro Okular používající poppler
|
||||
Comment[da]=PDF-motor til Okular som bruger poppler
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace Okular {
|
|||
* This interface can be used to control some more or less advanced features of a document
|
||||
* viewer.
|
||||
*/
|
||||
class ViewerInterface
|
||||
class OKULARCORE_EXPORT ViewerInterface
|
||||
{
|
||||
public:
|
||||
virtual ~ViewerInterface() {}
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
#ifndef _KDOCUMENTVIEWER_H_
|
||||
#define _KDOCUMENTVIEWER_H_
|
||||
|
||||
#include "okularpart_export.h"
|
||||
|
||||
#include <QtCore/QStringList>
|
||||
|
||||
class QUrl;
|
||||
|
@ -19,7 +21,7 @@ class QUrl;
|
|||
*
|
||||
* This interface describes the basic functions of a document viewer.
|
||||
*/
|
||||
class KDocumentViewer
|
||||
class OKULARPART_EXPORT KDocumentViewer
|
||||
{
|
||||
public:
|
||||
virtual ~KDocumentViewer() {}
|
||||
|
|
4
part.cpp
4
part.cpp
|
@ -224,8 +224,8 @@ static Okular::EmbedMode detectEmbedMode( QWidget *parentWidget, QObject *parent
|
|||
Q_UNUSED( parentWidget );
|
||||
|
||||
if ( parent
|
||||
&& ( parent->objectName() == QLatin1String( "okular::Shell" )
|
||||
|| parent->objectName() == QLatin1String( "okular/okular__Shell" ) ) )
|
||||
&& ( parent->objectName().startsWith( QLatin1String( "okular::Shell" ) )
|
||||
|| parent->objectName().startsWith( QLatin1String( "okular/okular__Shell" ) ) ) )
|
||||
return Okular::NativeShellMode;
|
||||
|
||||
if ( parent
|
||||
|
|
|
@ -33,6 +33,12 @@ MagnifierView::MagnifierView(Okular::Document* document, QWidget* parent)
|
|||
, m_document(document)
|
||||
, m_page(0)
|
||||
{
|
||||
document->addObserver(this);
|
||||
}
|
||||
|
||||
MagnifierView::~MagnifierView()
|
||||
{
|
||||
m_document->removeObserver(this);
|
||||
}
|
||||
|
||||
void MagnifierView::notifySetup(const QVector< Okular::Page* >& pages, int setupFlags)
|
||||
|
|
|
@ -30,6 +30,7 @@ class MagnifierView : public QWidget, public Okular::DocumentObserver
|
|||
|
||||
public:
|
||||
MagnifierView( Okular::Document *document, QWidget *parent = 0 );
|
||||
~MagnifierView();
|
||||
|
||||
void notifySetup( const QVector< Okular::Page * > & pages, int setupFlags );
|
||||
void notifyPageChanged( int page, int flags );
|
||||
|
|
|
@ -101,7 +101,7 @@ void PagePainter::paintCroppedPageOnPainter( QPainter * destPainter, const Okula
|
|||
double pixmapRescaleRatio = pixmap ? scaledWidth / (double)pixmap->width() : -1;
|
||||
long pixmapPixels = pixmap ? (long)pixmap->width() * (long)pixmap->height() : 0;
|
||||
if ( !pixmap || pixmapRescaleRatio > 20.0 || pixmapRescaleRatio < 0.25 ||
|
||||
(scaledWidth != pixmap->width() && pixmapPixels > 6000000L) )
|
||||
(scaledWidth > pixmap->width() && pixmapPixels > 60000000L) )
|
||||
{
|
||||
// draw something on the blank page: the okular icon or a cross (as a fallback)
|
||||
if ( !busyPixmap()->isNull() )
|
||||
|
|
|
@ -345,6 +345,7 @@ PageView::PageView( QWidget *parent, Okular::Document *document )
|
|||
d->mouseModeActionGroup = 0;
|
||||
d->penDown = false;
|
||||
d->aMouseMagnifier = 0;
|
||||
d->aFitWindowToPage = 0;
|
||||
|
||||
switch( Okular::Settings::zoomMode() )
|
||||
{
|
||||
|
@ -411,7 +412,6 @@ PageView::PageView( QWidget *parent, Okular::Document *document )
|
|||
d->magnifierView = new MagnifierView(document, this);
|
||||
d->magnifierView->hide();
|
||||
d->magnifierView->setGeometry(0, 0, 351, 201); // TODO: more dynamic?
|
||||
document->addObserver(d->magnifierView);
|
||||
|
||||
connect(document, SIGNAL(processMovieAction(const Okular::MovieAction*)), this, SLOT(slotProcessMovieAction(const Okular::MovieAction*)));
|
||||
connect(document, SIGNAL(processRenditionAction(const Okular::RenditionAction*)), this, SLOT(slotProcessRenditionAction(const Okular::RenditionAction*)));
|
||||
|
@ -4168,6 +4168,7 @@ void PageView::slotRelayoutPages()
|
|||
const int nCols = overrideCentering ? 1 : viewColumns();
|
||||
const bool singlePageViewMode = Okular::Settings::viewMode() == Okular::Settings::EnumViewMode::Single;
|
||||
|
||||
if ( d->aFitWindowToPage )
|
||||
d->aFitWindowToPage->setEnabled( !continuousView && singlePageViewMode );
|
||||
|
||||
// set all items geometry and resize contents. handle 'continuous' and 'single' modes separately
|
||||
|
|
|
@ -941,7 +941,14 @@ void PresentationWidget::changePage( int newPage )
|
|||
void PresentationWidget::generatePage( bool disableTransition )
|
||||
{
|
||||
if ( m_lastRenderedPixmap.isNull() )
|
||||
{
|
||||
m_lastRenderedPixmap = QPixmap( m_width, m_height );
|
||||
m_previousPagePixmap = QPixmap();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_previousPagePixmap = m_lastRenderedPixmap;
|
||||
}
|
||||
|
||||
// opens the painter over the pixmap
|
||||
QPainter pixmapPainter;
|
||||
|
@ -1343,6 +1350,7 @@ void PresentationWidget::slotNextPage()
|
|||
if ( m_transitionTimer->isActive() )
|
||||
{
|
||||
m_transitionTimer->stop();
|
||||
m_lastRenderedPixmap = m_currentPagePixmap;
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
@ -1369,6 +1377,7 @@ void PresentationWidget::slotPrevPage()
|
|||
if ( m_transitionTimer->isActive() )
|
||||
{
|
||||
m_transitionTimer->stop();
|
||||
m_lastRenderedPixmap = m_currentPagePixmap;
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
@ -1393,6 +1402,26 @@ void PresentationWidget::slotHideOverlay()
|
|||
|
||||
void PresentationWidget::slotTransitionStep()
|
||||
{
|
||||
switch( m_currentTransition.type() )
|
||||
{
|
||||
case Okular::PageTransition::Fade:
|
||||
{
|
||||
QPainter pixmapPainter;
|
||||
m_currentPixmapOpacity += 0.01;
|
||||
m_lastRenderedPixmap = QPixmap( m_lastRenderedPixmap.size() );
|
||||
m_lastRenderedPixmap.fill( Qt::transparent );
|
||||
pixmapPainter.begin( &m_lastRenderedPixmap );
|
||||
pixmapPainter.setCompositionMode( QPainter::CompositionMode_Source );
|
||||
pixmapPainter.setOpacity( 1 - m_currentPixmapOpacity );
|
||||
pixmapPainter.drawPixmap( 0, 0, m_previousPagePixmap );
|
||||
pixmapPainter.setOpacity( m_currentPixmapOpacity );
|
||||
pixmapPainter.drawPixmap( 0, 0, m_currentPagePixmap );
|
||||
update();
|
||||
if( m_currentPixmapOpacity >= 1 )
|
||||
return;
|
||||
} break;
|
||||
default:
|
||||
{
|
||||
if ( m_transitionRects.empty() )
|
||||
{
|
||||
// it's better to fix the transition to cover the whole screen than
|
||||
|
@ -1406,6 +1435,8 @@ void PresentationWidget::slotTransitionStep()
|
|||
update( m_transitionRects.first() );
|
||||
m_transitionRects.pop_front();
|
||||
}
|
||||
} break;
|
||||
}
|
||||
m_transitionTimer->start( m_transitionDelay );
|
||||
}
|
||||
|
||||
|
@ -1544,6 +1575,10 @@ void PresentationWidget::applyNewScreenSize( const QSize & oldSize )
|
|||
requestPixmaps();
|
||||
m_blockNotifications = false;
|
||||
}
|
||||
if ( m_transitionTimer->isActive() )
|
||||
{
|
||||
m_transitionTimer->stop();
|
||||
}
|
||||
generatePage( true /* no transitions */ );
|
||||
}
|
||||
|
||||
|
@ -1748,6 +1783,11 @@ const Okular::PageTransition PresentationWidget::defaultTransition( int type ) c
|
|||
return transition;
|
||||
break;
|
||||
}
|
||||
case Okular::Settings::EnumSlidesTransition::Fade:
|
||||
{
|
||||
return Okular::PageTransition( Okular::PageTransition::Fade );
|
||||
break;
|
||||
}
|
||||
case Okular::Settings::EnumSlidesTransition::Replace:
|
||||
default:
|
||||
return Okular::PageTransition( Okular::PageTransition::Replace );
|
||||
|
@ -1772,6 +1812,8 @@ void PresentationWidget::initTransition( const Okular::PageTransition *transitio
|
|||
const float totalTime = transition->duration();
|
||||
|
||||
m_transitionRects.clear();
|
||||
m_currentTransition = *transition;
|
||||
m_currentPagePixmap = m_lastRenderedPixmap;
|
||||
|
||||
switch( transition->type() )
|
||||
{
|
||||
|
@ -2103,6 +2145,23 @@ void PresentationWidget::initTransition( const Okular::PageTransition *transitio
|
|||
m_transitionDelay = (int)( (m_transitionMul * 1000 * totalTime) / steps );
|
||||
} break;
|
||||
|
||||
case Okular::PageTransition::Fade:
|
||||
{
|
||||
const int steps = 100;
|
||||
QPainter pixmapPainter;
|
||||
m_currentPixmapOpacity = (double) 1 / steps;
|
||||
m_transitionDelay = (int)( totalTime * 1000 ) / steps;
|
||||
m_lastRenderedPixmap = QPixmap( m_lastRenderedPixmap.size() );
|
||||
m_lastRenderedPixmap.fill( Qt::transparent );
|
||||
pixmapPainter.begin( &m_lastRenderedPixmap );
|
||||
pixmapPainter.setCompositionMode( QPainter::CompositionMode_Source );
|
||||
pixmapPainter.setOpacity( 1 - m_currentPixmapOpacity );
|
||||
pixmapPainter.drawPixmap( 0, 0, m_previousPagePixmap );
|
||||
pixmapPainter.setOpacity( m_currentPixmapOpacity );
|
||||
pixmapPainter.drawPixmap( 0, 0, m_currentPagePixmap );
|
||||
pixmapPainter.end();
|
||||
update();
|
||||
} break;
|
||||
// implement missing transitions (a binary raster engine needed here)
|
||||
case Okular::PageTransition::Fly:
|
||||
|
||||
|
@ -2112,8 +2171,6 @@ void PresentationWidget::initTransition( const Okular::PageTransition *transitio
|
|||
|
||||
case Okular::PageTransition::Uncover:
|
||||
|
||||
case Okular::PageTransition::Fade:
|
||||
|
||||
default:
|
||||
update();
|
||||
return;
|
||||
|
|
|
@ -119,6 +119,10 @@ class PresentationWidget : public QWidget, public Okular::DocumentObserver
|
|||
int m_transitionDelay;
|
||||
int m_transitionMul;
|
||||
QList< QRect > m_transitionRects;
|
||||
Okular::PageTransition m_currentTransition;
|
||||
QPixmap m_currentPagePixmap;
|
||||
QPixmap m_previousPagePixmap;
|
||||
double m_currentPixmapOpacity;
|
||||
|
||||
// misc stuff
|
||||
QWidget * m_parentWidget;
|
||||
|
|
Loading…
Reference in a new issue