mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-16 16:50:06 +02:00
1323 lines
45 KiB
Plaintext
1323 lines
45 KiB
Plaintext
From 18ff6e4d04f0eb198dad55441672c89d53ed9d95 Mon Sep 17 00:00:00 2001
|
|
From: Gerasim Troeglazov <3dEyes@gmail.com>
|
|
Date: Thu, 3 May 2018 21:03:11 +1000
|
|
Subject: Fix build for Haiku
|
|
|
|
|
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
index 788235e..1ef8100 100644
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -386,7 +386,7 @@ IF(WANT_CPP11)
|
|
ENDIF(WANT_CPP11)
|
|
|
|
#PLUGINS
|
|
-IF(WIN32)
|
|
+IF(WIN32 OR HAIKU)
|
|
SET(PLUGINDIR "plugins")
|
|
ELSE(WIN32)
|
|
IF (APPLEBUNDLE)
|
|
diff --git a/scribus/third_party/pgf/PGFplatform.h b/scribus/third_party/pgf/PGFplatform.h
|
|
index 5598df2..73e5cd4 100644
|
|
--- a/scribus/third_party/pgf/PGFplatform.h
|
|
+++ b/scribus/third_party/pgf/PGFplatform.h
|
|
@@ -338,6 +338,12 @@ inline OSError SetFPos(HANDLE hFile, int posMode, INT64 posOff) {
|
|
#define __POSIX__
|
|
#endif // __sun
|
|
|
|
+//-------------------------------------------------------------------------------
|
|
+// HAIKU
|
|
+//-------------------------------------------------------------------------------
|
|
+#ifdef __HAIKU__
|
|
+#define __POSIX__
|
|
+#endif // __sun
|
|
|
|
//-------------------------------------------------------------------------------
|
|
// *BSD
|
|
@@ -528,7 +534,7 @@ __inline OSError FileWrite(HANDLE hFile, int *count, void *buffPtr) {
|
|
}
|
|
|
|
__inline OSError GetFPos(HANDLE hFile, UINT64 *pos) {
|
|
- #ifdef __APPLE__
|
|
+ #if defined(__APPLE__) || defined(__HAIKU__)
|
|
off_t ret;
|
|
if ((ret = lseek(hFile, 0, SEEK_CUR)) == -1) {
|
|
return errno;
|
|
@@ -548,7 +554,7 @@ __inline OSError GetFPos(HANDLE hFile, UINT64 *pos) {
|
|
}
|
|
|
|
__inline OSError SetFPos(HANDLE hFile, int posMode, INT64 posOff) {
|
|
- #ifdef __APPLE__
|
|
+ #if defined(__APPLE__) || defined(__HAIKU__)
|
|
if ((lseek(hFile, (off_t)posOff, posMode)) == -1) {
|
|
return errno;
|
|
} else {
|
|
diff --git a/scribus/ui/printdialog.cpp b/scribus/ui/printdialog.cpp
|
|
index 3fea6d0..a6238d6 100644
|
|
--- a/scribus/ui/printdialog.cpp
|
|
+++ b/scribus/ui/printdialog.cpp
|
|
@@ -24,7 +24,7 @@ for which a new license (GPL+exception) is in place.
|
|
#if defined(_WIN32)
|
|
#include <windows.h>
|
|
#include <winspool.h>
|
|
-#else
|
|
+#elif !defined(__HAIKU__)
|
|
#include <cups/cups.h>
|
|
#endif
|
|
#include "util_printer.h"
|
|
diff --git a/scribus/util_debug.cpp b/scribus/util_debug.cpp
|
|
index 04d07b0..1b636c7 100644
|
|
--- a/scribus/util_debug.cpp
|
|
+++ b/scribus/util_debug.cpp
|
|
@@ -51,7 +51,7 @@ void tDebug(QString message)
|
|
*/
|
|
void printBacktrace ( int nFrames )
|
|
{
|
|
-#if !defined(_WIN32) && !defined(Q_OS_MAC) && !defined(Q_OS_OPENBSD) && !defined(Q_OS_FREEBSD)
|
|
+#if !defined(_WIN32) && !defined(Q_OS_MAC) && !defined(Q_OS_OPENBSD) && !defined(Q_OS_FREEBSD) && !defined(Q_OS_HAIKU)
|
|
void ** trace = new void*[nFrames + 1];
|
|
char **messages = ( char ** ) NULL;
|
|
int i, trace_size = 0;
|
|
--
|
|
2.16.4
|
|
|
|
|
|
From 6e675d9ee89a1971f51953a50e85a51ba9caad0c Mon Sep 17 00:00:00 2001
|
|
From: Gerasim Troeglazov <3dEyes@gmail.com>
|
|
Date: Fri, 4 May 2018 21:51:22 +1000
|
|
Subject: Add support new versions of poppler. Backport pdf import plugin from
|
|
1.5.3 and 1.5.4 scribus.
|
|
|
|
|
|
diff --git a/scribus/plugins/import/pdf/CMakeLists.txt b/scribus/plugins/import/pdf/CMakeLists.txt
|
|
index d529d70..85760d9 100644
|
|
--- a/scribus/plugins/import/pdf/CMakeLists.txt
|
|
+++ b/scribus/plugins/import/pdf/CMakeLists.txt
|
|
@@ -1,50 +1,50 @@
|
|
-INCLUDE_DIRECTORIES(
|
|
+include_directories(
|
|
${CMAKE_SOURCE_DIR}
|
|
${CMAKE_SOURCE_DIR}/scribus
|
|
${POPPLER_INCLUDE_DIR}
|
|
+ ${POPPLER_CPP_INCLUDE_DIR}
|
|
)
|
|
|
|
-
|
|
-SET(IMPORTPDF_PLUGIN_UI_SRC
|
|
+set(IMPORTPDF_PLUGIN_UI_SRC
|
|
pdfimportoptions.ui
|
|
)
|
|
|
|
-SET(IMPORTPDF_PLUGIN_MOC_CLASSES
|
|
+set(IMPORTPDF_PLUGIN_MOC_CLASSES
|
|
importpdf.h
|
|
importpdfplugin.h
|
|
pdfimportoptions.h
|
|
)
|
|
|
|
-SET(IMPORTPDF_PLUGIN_SOURCES
|
|
+set(IMPORTPDF_PLUGIN_SOURCES
|
|
importpdf.cpp
|
|
importpdfplugin.cpp
|
|
pdfimportoptions.cpp
|
|
slaoutput.cpp
|
|
)
|
|
|
|
-IF(HAVE_POPPLER)
|
|
- IF(HAVE_LCMS1)
|
|
- ADD_DEFINITIONS(-DUSE_CMS)
|
|
- ENDIF(HAVE_LCMS1)
|
|
- ADD_DEFINITIONS(-DHAVE_FREETYPE_H)
|
|
-ENDIF(HAVE_POPPLER)
|
|
+if(HAVE_POPPLER)
|
|
+ if(HAVE_LCMS1)
|
|
+ add_definitions(-DUSE_CMS)
|
|
+ endif()
|
|
+ add_definitions(-DHAVE_FREETYPE_H)
|
|
+endif()
|
|
|
|
-SET(SCRIBUS_IMPORTPDF_PLUGIN "importpdf")
|
|
+set(SCRIBUS_IMPORTPDF_PLUGIN "importpdf")
|
|
|
|
QT5_WRAP_UI(IMPORTPDF_PLUGIN_UI_SOURCES ${IMPORTPDF_PLUGIN_UI_SRC} )
|
|
QT5_WRAP_CPP(IMPORTPDF_PLUGIN_MOC_SOURCES ${IMPORTPDF_PLUGIN_MOC_CLASSES})
|
|
|
|
-ADD_LIBRARY(${SCRIBUS_IMPORTPDF_PLUGIN} MODULE ${IMPORTPDF_PLUGIN_SOURCES} ${IMPORTPDF_PLUGIN_MOC_SOURCES} ${IMPORTPDF_PLUGIN_UI_SOURCES})
|
|
+add_library(${SCRIBUS_IMPORTPDF_PLUGIN} MODULE ${IMPORTPDF_PLUGIN_SOURCES} ${IMPORTPDF_PLUGIN_MOC_SOURCES} ${IMPORTPDF_PLUGIN_UI_SOURCES})
|
|
|
|
-LINK_DIRECTORIES( /usr/local/lib )
|
|
-TARGET_LINK_LIBRARIES(${SCRIBUS_IMPORTPDF_PLUGIN} ${PLUGIN_LIBRARIES} ${POPPLER_LIBRARY})
|
|
+link_directories( /usr/local/lib )
|
|
+target_link_libraries(${SCRIBUS_IMPORTPDF_PLUGIN} ${PLUGIN_LIBRARIES} ${POPPLER_LIBRARY})
|
|
|
|
-INSTALL(TARGETS ${SCRIBUS_IMPORTPDF_PLUGIN}
|
|
+install(TARGETS ${SCRIBUS_IMPORTPDF_PLUGIN}
|
|
LIBRARY
|
|
DESTINATION ${PLUGINDIR}
|
|
PERMISSIONS ${PLUGIN_PERMISSIONS}
|
|
)
|
|
|
|
-ADD_DEPENDENCIES(${SCRIBUS_IMPORTPDF_PLUGIN} ${EXE_NAME})
|
|
+add_dependencies(${SCRIBUS_IMPORTPDF_PLUGIN} ${EXE_NAME})
|
|
|
|
-# SET_TARGET_PROPERTIES(${SCRIBUS_FONTPREVIEW_PLUGIN} PROPERTIES VERSION "0.0.0")
|
|
+# set_target_properties(${SCRIBUS_FONTPREVIEW_PLUGIN} PROPERTIES VERSION "0.0.0")
|
|
diff --git a/scribus/plugins/import/pdf/importpdf.cpp b/scribus/plugins/import/pdf/importpdf.cpp
|
|
index 05e46ae..c180286 100644
|
|
--- a/scribus/plugins/import/pdf/importpdf.cpp
|
|
+++ b/scribus/plugins/import/pdf/importpdf.cpp
|
|
@@ -22,6 +22,7 @@ for which a new license (GPL+exception) is in place.
|
|
#include <poppler/PageTransition.h>
|
|
#include <poppler/ViewerPreferences.h>
|
|
#include <poppler/poppler-config.h>
|
|
+#include <poppler/cpp/poppler-version.h>
|
|
#include <poppler/SplashOutputDev.h>
|
|
#include <poppler/splash/SplashBitmap.h>
|
|
|
|
@@ -59,6 +60,12 @@ for which a new license (GPL+exception) is in place.
|
|
#include "ui/multiprogressdialog.h"
|
|
#include "ui/propertiespalette.h"
|
|
|
|
+#define POPPLER_VERSION_ENCODE(major, minor, micro) ( \
|
|
+ ((major) * 10000) \
|
|
+ + ((minor) * 100) \
|
|
+ + ((micro) * 1))
|
|
+#define POPPLER_ENCODED_VERSION POPPLER_VERSION_ENCODE(POPPLER_VERSION_MAJOR, POPPLER_VERSION_MINOR, POPPLER_VERSION_MICRO)
|
|
+
|
|
PdfPlug::PdfPlug(ScribusDoc* doc, int flags)
|
|
{
|
|
tmpSele = new Selection(this, false);
|
|
@@ -75,7 +82,11 @@ QImage PdfPlug::readThumbnail(QString fName)
|
|
globalParams = new GlobalParams();
|
|
if (globalParams)
|
|
{
|
|
+#if defined(Q_OS_WIN32) && POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 62, 0)
|
|
+ GooString *fname = new GooString(pdfFile.toUtf8().data());
|
|
+#else
|
|
GooString *fname = new GooString(QFile::encodeName(pdfFile).data());
|
|
+#endif
|
|
globalParams->setErrQuiet(gTrue);
|
|
PDFDoc *pdfDoc = new PDFDoc(fname, NULL, NULL, NULL);
|
|
if (pdfDoc)
|
|
@@ -145,7 +156,7 @@ QImage PdfPlug::readThumbnail(QString fName)
|
|
/* Old Code to be backed up
|
|
QString tmp, cmd1, cmd2;
|
|
QString pdfFile = QDir::toNativeSeparators(fName);
|
|
- QString tmpFile = QDir::toNativeSeparators(ScPaths::getTempFileDir() + "sc.png");
|
|
+ QString tmpFile = QDir::toNativeSeparators(ScPaths::tempFileDir() + "sc.png");
|
|
int ret = -1;
|
|
tmp.setNum(1);
|
|
QStringList args;
|
|
@@ -190,7 +201,7 @@ bool PdfPlug::import(QString fNameIn, const TransactionSettings& trSettings, int
|
|
baseFile = QDir::cleanPath(QDir::toNativeSeparators(fi.absolutePath()+"/"));
|
|
if ( showProgress )
|
|
{
|
|
- ScribusMainWindow* mw=(m_Doc==0) ? ScCore->primaryMainWindow() : m_Doc->scMW();
|
|
+ ScribusMainWindow* mw = (m_Doc==0) ? ScCore->primaryMainWindow() : m_Doc->scMW();
|
|
progressDialog = new MultiProgressDialog( tr("Importing: %1").arg(fi.fileName()), CommonStrings::tr_Cancel, mw );
|
|
QStringList barNames, barTexts;
|
|
barNames << "GI";
|
|
@@ -370,7 +381,7 @@ PdfPlug::~PdfPlug()
|
|
delete tmpSele;
|
|
}
|
|
|
|
-bool PdfPlug::convert(QString fn)
|
|
+bool PdfPlug::convert(const QString& fn)
|
|
{
|
|
bool firstPg = true;
|
|
int currentLayer = m_Doc->activeLayer();
|
|
@@ -394,7 +405,11 @@ bool PdfPlug::convert(QString fn)
|
|
GooString *userPW = NULL;
|
|
if (globalParams)
|
|
{
|
|
+#if defined(Q_OS_WIN32) && POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 62, 0)
|
|
+ GooString *fname = new GooString(fn.toUtf8().data());
|
|
+#else
|
|
GooString *fname = new GooString(QFile::encodeName(fn).data());
|
|
+#endif
|
|
globalParams->setErrQuiet(gTrue);
|
|
GBool hasOcg = gFalse;
|
|
QList<OptionalContentGroup*> ocgGroups;
|
|
@@ -409,12 +424,16 @@ bool PdfPlug::convert(QString fn)
|
|
if (progressDialog)
|
|
progressDialog->hide();
|
|
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
|
|
- ScribusMainWindow* mw = (m_Doc==0) ? ScCore->primaryMainWindow() : m_Doc->scMW();
|
|
+ ScribusMainWindow* mw = m_Doc->scMW();
|
|
bool ok;
|
|
QString text = QInputDialog::getText(mw, tr("Open PDF-File"), tr("Password"), QLineEdit::Normal, "", &ok);
|
|
if (ok && !text.isEmpty())
|
|
{
|
|
+#if defined(Q_OS_WIN32) && POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 62, 0)
|
|
+ fname = new GooString(fn.toUtf8().data());
|
|
+#else
|
|
fname = new GooString(QFile::encodeName(fn).data());
|
|
+#endif
|
|
userPW = new GooString(text.toLocal8Bit().data());
|
|
pdfDoc = new PDFDoc(fname, userPW, userPW, NULL);
|
|
qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
|
|
@@ -507,12 +526,20 @@ bool PdfPlug::convert(QString fn)
|
|
{
|
|
for (int i = 0; i < order->getLength (); ++i)
|
|
{
|
|
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 58, 0)
|
|
+ Object orderItem = order->get(i);
|
|
+#else
|
|
Object orderItem;
|
|
order->get(i, &orderItem);
|
|
+#endif
|
|
if (orderItem.isDict())
|
|
{
|
|
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 58, 0)
|
|
+ Object ref = order->getNF(i);
|
|
+#else
|
|
Object ref;
|
|
order->getNF(i, &ref);
|
|
+#endif
|
|
if (ref.isRef())
|
|
{
|
|
OptionalContentGroup *oc = ocg->findOcgByRef(ref.getRef());
|
|
@@ -523,7 +550,9 @@ bool PdfPlug::convert(QString fn)
|
|
ocgNames.append(ocgName);
|
|
}
|
|
}
|
|
+#if POPPLER_ENCODED_VERSION < POPPLER_VERSION_ENCODE(0, 58, 0)
|
|
ref.free();
|
|
+#endif
|
|
}
|
|
else
|
|
{
|
|
@@ -597,39 +626,71 @@ bool PdfPlug::convert(QString fn)
|
|
dev->layersSetByOCG = true;
|
|
}
|
|
#endif
|
|
+
|
|
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 58, 0)
|
|
+ Object info = pdfDoc->getDocInfo();
|
|
+ if (info.isDict())
|
|
+ {
|
|
+ Object obj;
|
|
+ Dict *infoDict = info.getDict();
|
|
+ obj = infoDict->lookup((char*) "Title");
|
|
+ if (obj.isString())
|
|
+ {
|
|
+ m_Doc->documentInfo().setTitle(UnicodeParsedString(obj.getString()));
|
|
+ }
|
|
+ obj = infoDict->lookup((char*) "Author");
|
|
+ if (obj.isString())
|
|
+ {
|
|
+ m_Doc->documentInfo().setAuthor(UnicodeParsedString(obj.getString()));
|
|
+ }
|
|
+ obj = infoDict->lookup((char*) "Subject");
|
|
+ if (obj.isString())
|
|
+ {
|
|
+ m_Doc->documentInfo().setSubject(UnicodeParsedString(obj.getString()));
|
|
+ }
|
|
+ obj = infoDict->lookup((char*) "Keywords");
|
|
+ if (obj.isString())
|
|
+ {
|
|
+ // s1 = obj.getString();
|
|
+ m_Doc->documentInfo().setKeywords(UnicodeParsedString(obj.getString()));
|
|
+ }
|
|
+ }
|
|
+ info = Object();
|
|
+#else
|
|
Object info;
|
|
pdfDoc->getDocInfo(&info);
|
|
if (info.isDict())
|
|
{
|
|
Object obj;
|
|
- // GooString *s1;
|
|
+ // GooString *s1;
|
|
Dict *infoDict = info.getDict();
|
|
- if (infoDict->lookup((char*)"Title", &obj )->isString())
|
|
+ if (infoDict->lookup((char*)"Title", &obj)->isString())
|
|
{
|
|
- // s1 = obj.getString();
|
|
+ // s1 = obj.getString();
|
|
m_Doc->documentInfo().setTitle(UnicodeParsedString(obj.getString()));
|
|
obj.free();
|
|
}
|
|
- if (infoDict->lookup((char*)"Author", &obj )->isString())
|
|
+ if (infoDict->lookup((char*)"Author", &obj)->isString())
|
|
{
|
|
- // s1 = obj.getString();
|
|
+ // s1 = obj.getString();
|
|
m_Doc->documentInfo().setAuthor(UnicodeParsedString(obj.getString()));
|
|
obj.free();
|
|
}
|
|
- if (infoDict->lookup((char*)"Subject", &obj )->isString())
|
|
+ if (infoDict->lookup((char*)"Subject", &obj)->isString())
|
|
{
|
|
- // s1 = obj.getString();
|
|
+ // s1 = obj.getString();
|
|
m_Doc->documentInfo().setSubject(UnicodeParsedString(obj.getString()));
|
|
obj.free();
|
|
}
|
|
- if (infoDict->lookup((char*)"Keywords", &obj )->isString())
|
|
+ if (infoDict->lookup((char*)"Keywords", &obj)->isString())
|
|
{
|
|
- // s1 = obj.getString();
|
|
+ // s1 = obj.getString();
|
|
m_Doc->documentInfo().setKeywords(UnicodeParsedString(obj.getString()));
|
|
obj.free();
|
|
}
|
|
}
|
|
info.free();
|
|
+#endif
|
|
if (cropped)
|
|
{
|
|
QRectF crBox = getCBox(contentRect, pageNs[0]);
|
|
@@ -667,6 +728,7 @@ bool PdfPlug::convert(QString fn)
|
|
firstPg = false;
|
|
else
|
|
m_Doc->addPage(ap);
|
|
+ QRectF mdBox = getCBox(0, pp);
|
|
QRectF crBox = getCBox(contentRect, pp);
|
|
if (cropped)
|
|
{
|
|
@@ -725,7 +787,7 @@ bool PdfPlug::convert(QString fn)
|
|
// currentLayer = m_Doc->activeLayer();
|
|
oc->setState(OptionalContentGroup::On);
|
|
if (cropped)
|
|
- pdfDoc->displayPageSlice(dev, pp, hDPI, vDPI, rotate, useMediaBox, crop, printing, crBox.x(), mediaRect.bottom() - crBox.bottom(), crBox.width(), crBox.height(), NULL, NULL, dev->annotations_callback, dev);
|
|
+ pdfDoc->displayPageSlice(dev, pp, hDPI, vDPI, rotate, useMediaBox, crop, printing, crBox.x() - mdBox.x(), mdBox.bottom() - crBox.bottom(), crBox.width(), crBox.height(), NULL, NULL, dev->annotations_callback, dev);
|
|
else
|
|
pdfDoc->displayPage(dev, pp, hDPI, vDPI, rotate, useMediaBox, crop, printing, NULL, NULL, dev->annotations_callback, dev);
|
|
oc->setState(OptionalContentGroup::Off);
|
|
@@ -740,13 +802,18 @@ bool PdfPlug::convert(QString fn)
|
|
else
|
|
{
|
|
if (cropped)
|
|
- pdfDoc->displayPageSlice(dev, pp, hDPI, vDPI, rotate, useMediaBox, crop, printing, crBox.x(), mediaRect.bottom() - crBox.bottom(), crBox.width(), crBox.height(), NULL, NULL, dev->annotations_callback, dev);
|
|
+ pdfDoc->displayPageSlice(dev, pp, hDPI, vDPI, rotate, useMediaBox, crop, printing, crBox.x() - mdBox.x(), mdBox.bottom() - crBox.bottom(), crBox.width(), crBox.height(), NULL, NULL, dev->annotations_callback, dev);
|
|
else
|
|
pdfDoc->displayPage(dev, pp, hDPI, vDPI, rotate, useMediaBox, crop, printing, NULL, NULL, dev->annotations_callback, dev);
|
|
}
|
|
PDFPresentationData ef;
|
|
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 58, 0)
|
|
+ Object trans = pdfDoc->getPage(pp)->getTrans();
|
|
+ Object *transi = &trans;
|
|
+#else
|
|
Object trans;
|
|
Object *transi = pdfDoc->getPage(pp)->getTrans(&trans);
|
|
+#endif
|
|
if (transi->isDict())
|
|
{
|
|
m_Doc->pdfOptions().PresentMode = true;
|
|
@@ -792,32 +859,51 @@ bool PdfPlug::convert(QString fn)
|
|
delete pgTrans;
|
|
}
|
|
m_Doc->currentPage()->PresentVals = ef;
|
|
+#if POPPLER_ENCODED_VERSION < POPPLER_VERSION_ENCODE(0, 58, 0)
|
|
trans.free();
|
|
transi->free();
|
|
+#endif
|
|
}
|
|
int numjs = pdfDoc->getCatalog()->numJS();
|
|
if (numjs > 0)
|
|
{
|
|
NameTree *jsNameTreeP = new NameTree();
|
|
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 58, 0)
|
|
+ Object catDict = pdfDoc->getXRef()->getCatalog();
|
|
+#else
|
|
Object catDict;
|
|
pdfDoc->getXRef()->getCatalog(&catDict);
|
|
+#endif
|
|
if (catDict.isDict())
|
|
{
|
|
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 58, 0)
|
|
+ Object names = catDict.dictLookup("Names");
|
|
+#else
|
|
Object names;
|
|
catDict.dictLookup("Names", &names);
|
|
+#endif
|
|
if (names.isDict())
|
|
{
|
|
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 58, 0)
|
|
+ Object obj = names.dictLookup("JavaScript");
|
|
+ jsNameTreeP->init(pdfDoc->getXRef(), &obj);
|
|
+#else
|
|
Object obj;
|
|
names.dictLookup("JavaScript", &obj);
|
|
jsNameTreeP->init(pdfDoc->getXRef(), &obj);
|
|
obj.free();
|
|
+#endif
|
|
}
|
|
for (int a = 0; a < numjs; a++)
|
|
{
|
|
m_Doc->JavaScripts.insert(UnicodeParsedString(jsNameTreeP->getName(a)), UnicodeParsedString(pdfDoc->getCatalog()->getJS(a)));
|
|
}
|
|
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 58, 0)
|
|
+ names = catDict.dictLookup("OpenAction");
|
|
+#else
|
|
names.free();
|
|
catDict.dictLookup("OpenAction", &names);
|
|
+#endif
|
|
if (names.isDict())
|
|
{
|
|
LinkAction *linkAction = NULL;
|
|
@@ -838,9 +924,13 @@ bool PdfPlug::convert(QString fn)
|
|
}
|
|
}
|
|
}
|
|
+#if POPPLER_ENCODED_VERSION < POPPLER_VERSION_ENCODE(0, 58, 0)
|
|
names.free();
|
|
+#endif
|
|
}
|
|
+#if POPPLER_ENCODED_VERSION < POPPLER_VERSION_ENCODE(0, 58, 0)
|
|
catDict.free();
|
|
+#endif
|
|
delete jsNameTreeP;
|
|
}
|
|
m_Doc->pdfOptions().Version = (PDFOptions::PDFVersion)qMin(15, qMax(13, pdfDoc->getPDFMajorVersion() * 10 + pdfDoc->getPDFMinorVersion()));
|
|
@@ -918,6 +1008,7 @@ QImage PdfPlug::readPreview(int pgNum, int width, int height, int box)
|
|
{
|
|
if (!m_pdfDoc)
|
|
return QImage();
|
|
+
|
|
double h = m_pdfDoc->getPageMediaHeight(pgNum);
|
|
double w = m_pdfDoc->getPageMediaWidth(pgNum);
|
|
double scale = qMin(height / h, width / w);
|
|
@@ -958,6 +1049,8 @@ QImage PdfPlug::readPreview(int pgNum, int width, int height, int box)
|
|
if (box > Media_Box)
|
|
{
|
|
QRectF cRect = getCBox(box, pgNum);
|
|
+ QRectF mediaRect = getCBox(0, pgNum);
|
|
+ cRect.moveTo(cRect.x() - mediaRect.x(), cRect.y() - mediaRect.y());
|
|
QPainter pp;
|
|
pp.begin(&image);
|
|
pp.setBrush(Qt::NoBrush);
|
|
diff --git a/scribus/plugins/import/pdf/importpdf.h b/scribus/plugins/import/pdf/importpdf.h
|
|
index 725a5f7..c8c5efc 100644
|
|
--- a/scribus/plugins/import/pdf/importpdf.h
|
|
+++ b/scribus/plugins/import/pdf/importpdf.h
|
|
@@ -79,7 +79,7 @@ public:
|
|
};
|
|
|
|
private:
|
|
- bool convert(QString fn);
|
|
+ bool convert(const QString& fn);
|
|
QRectF getCBox(int box, int pgNum);
|
|
QString UnicodeParsedString(GooString *s1);
|
|
|
|
diff --git a/scribus/plugins/import/pdf/importpdfplugin.cpp b/scribus/plugins/import/pdf/importpdfplugin.cpp
|
|
index 5777286..ca204d4 100644
|
|
--- a/scribus/plugins/import/pdf/importpdfplugin.cpp
|
|
+++ b/scribus/plugins/import/pdf/importpdfplugin.cpp
|
|
@@ -87,7 +87,7 @@ const ScActionPlugin::AboutData* ImportPdfPlugin::getAboutData() const
|
|
AboutData* about = new AboutData;
|
|
about->authors = "Franz Schmid <franz@scribus.info>";
|
|
about->shortDescription = tr("Imports PDF Files");
|
|
- about->description = tr("Imports most PDF files into the current document,\nconverting their vector data into Scribus objects.");
|
|
+ about->description = tr("Imports most PDF files into the current document, converting their vector data into Scribus objects.");
|
|
about->license = "GPL";
|
|
Q_CHECK_PTR(about);
|
|
return about;
|
|
diff --git a/scribus/plugins/import/pdf/slaoutput.cpp b/scribus/plugins/import/pdf/slaoutput.cpp
|
|
index e9cf029..df36b4c 100644
|
|
--- a/scribus/plugins/import/pdf/slaoutput.cpp
|
|
+++ b/scribus/plugins/import/pdf/slaoutput.cpp
|
|
@@ -6,6 +6,7 @@ for which a new license (GPL+exception) is in place.
|
|
*/
|
|
|
|
#include "slaoutput.h"
|
|
+#include <poppler/cpp/poppler-version.h>
|
|
#include <poppler/GlobalParams.h>
|
|
#include <poppler/poppler-config.h>
|
|
#include <poppler/FileSpec.h>
|
|
@@ -19,11 +20,49 @@ for which a new license (GPL+exception) is in place.
|
|
#include "util_math.h"
|
|
#include <tiffio.h>
|
|
|
|
+#define POPPLER_VERSION_ENCODE(major, minor, micro) ( \
|
|
+ ((major) * 10000) \
|
|
+ + ((minor) * 100) \
|
|
+ + ((micro) * 1))
|
|
+#define POPPLER_ENCODED_VERSION POPPLER_VERSION_ENCODE(POPPLER_VERSION_MAJOR, POPPLER_VERSION_MINOR, POPPLER_VERSION_MICRO)
|
|
+
|
|
LinkSubmitForm::LinkSubmitForm(Object *actionObj)
|
|
{
|
|
Object obj1, obj2, obj3;
|
|
fileName = NULL;
|
|
m_flags = 0;
|
|
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 58, 0)
|
|
+ if (actionObj->isDict())
|
|
+ {
|
|
+ obj1 = actionObj->dictLookup("F");
|
|
+ if (!obj1.isNull())
|
|
+ {
|
|
+ if (obj1.isDict())
|
|
+ {
|
|
+ obj3 = obj1.dictLookup("FS");
|
|
+ if (!obj3.isNull())
|
|
+ {
|
|
+ if (obj3.isName())
|
|
+ {
|
|
+ char *name = obj3.getName();
|
|
+ if (!strcmp(name, "URL"))
|
|
+ {
|
|
+ obj2 = obj1.dictLookup("F");
|
|
+ if (!obj2.isNull())
|
|
+ fileName = obj2.getString()->copy();
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ obj1 = actionObj->dictLookup("Flags");
|
|
+ if (!obj1.isNull())
|
|
+ {
|
|
+ if (obj1.isNum())
|
|
+ m_flags = obj1.getInt();
|
|
+ }
|
|
+ }
|
|
+#else
|
|
if (actionObj->isDict())
|
|
{
|
|
if (!actionObj->dictLookup("F", &obj1)->isNull())
|
|
@@ -54,6 +93,7 @@ LinkSubmitForm::LinkSubmitForm(Object *actionObj)
|
|
}
|
|
obj1.free();
|
|
}
|
|
+#endif
|
|
}
|
|
|
|
LinkSubmitForm::~LinkSubmitForm()
|
|
@@ -66,11 +106,25 @@ LinkImportData::LinkImportData(Object *actionObj)
|
|
{
|
|
Object obj1, obj3;
|
|
fileName = NULL;
|
|
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 58, 0)
|
|
+ if (actionObj->isDict())
|
|
+ {
|
|
+ obj1 = actionObj->dictLookup("F");
|
|
+ if (!obj1.isNull())
|
|
+ {
|
|
+ obj3 = getFileSpecNameForPlatform(&obj1);
|
|
+ if (!obj3.isNull())
|
|
+ {
|
|
+ fileName = obj3.getString()->copy();
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+#else
|
|
if (actionObj->isDict())
|
|
{
|
|
if (!actionObj->dictLookup("F", &obj1)->isNull())
|
|
{
|
|
- if (getFileSpecNameForPlatform (&obj1, &obj3))
|
|
+ if (getFileSpecNameForPlatform(&obj1, &obj3))
|
|
{
|
|
fileName = obj3.getString()->copy();
|
|
obj3.free();
|
|
@@ -78,6 +132,7 @@ LinkImportData::LinkImportData(Object *actionObj)
|
|
}
|
|
obj1.free();
|
|
}
|
|
+#endif
|
|
}
|
|
|
|
LinkImportData::~LinkImportData()
|
|
@@ -174,15 +229,26 @@ QString AnoOutputDev::getColor(GfxColorSpace *color_space, GfxColor *color, int
|
|
else if (color_space->getMode() == csSeparation)
|
|
{
|
|
GfxCMYK cmyk;
|
|
- color_space->getCMYK(color, &cmyk);
|
|
- int Cc = qRound(colToDbl(cmyk.c) * 255);
|
|
- int Mc = qRound(colToDbl(cmyk.m) * 255);
|
|
- int Yc = qRound(colToDbl(cmyk.y) * 255);
|
|
- int Kc = qRound(colToDbl(cmyk.k) * 255);
|
|
+ QString name = QString(((GfxSeparationColorSpace*)color_space)->getName()->getCString());
|
|
+ int Cc, Mc, Yc, Kc;
|
|
+ bool isRegistrationColor = (name == "All");
|
|
+ if (!isRegistrationColor)
|
|
+ {
|
|
+ color_space->getCMYK(color, &cmyk);
|
|
+ Cc = qRound(colToDbl(cmyk.c) * 255);
|
|
+ Mc = qRound(colToDbl(cmyk.m) * 255);
|
|
+ Yc = qRound(colToDbl(cmyk.y) * 255);
|
|
+ Kc = qRound(colToDbl(cmyk.k) * 255);
|
|
+ }
|
|
+ else
|
|
+ {
|
|
+ Cc = Mc = Yc = Kc = 255;
|
|
+ tmp.setRegistrationColor(true);
|
|
+ name = "Registration";
|
|
+ }
|
|
tmp.setColor(Cc, Mc, Yc, Kc);
|
|
tmp.setSpotColor(true);
|
|
- QString nam = QString(((GfxSeparationColorSpace*)color_space)->getName()->getCString());
|
|
- fNam = m_doc->PageColors.tryAddColor(nam, tmp);
|
|
+ fNam = m_doc->PageColors.tryAddColor(name, tmp);
|
|
*shade = qRound(colToDbl(color->c[0]) * 100);
|
|
}
|
|
else
|
|
@@ -245,6 +311,27 @@ LinkAction* SlaOutputDev::SC_getAction(AnnotWidget *ano)
|
|
Object obj;
|
|
Ref refa = ano->getRef();
|
|
Object additionalActions;
|
|
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 58, 0)
|
|
+ obj = xref->fetch(refa.num, refa.gen);
|
|
+ if (obj.isDict())
|
|
+ {
|
|
+ Dict* adic = obj.getDict();
|
|
+ additionalActions = adic->lookupNF("A");
|
|
+ Object additionalActionsObject = additionalActions.fetch(pdfDoc->getXRef());
|
|
+ if (additionalActionsObject.isDict())
|
|
+ {
|
|
+ Object actionObject = additionalActionsObject.dictLookup("S");
|
|
+ if (actionObject.isName("ImportData"))
|
|
+ {
|
|
+ linkAction = new LinkImportData(&additionalActionsObject);
|
|
+ }
|
|
+ else if (actionObject.isName("SubmitForm"))
|
|
+ {
|
|
+ linkAction = new LinkSubmitForm(&additionalActionsObject);
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+#else
|
|
Object *act = xref->fetch(refa.num, refa.gen, &obj);
|
|
if (act)
|
|
{
|
|
@@ -272,6 +359,7 @@ LinkAction* SlaOutputDev::SC_getAction(AnnotWidget *ano)
|
|
}
|
|
}
|
|
obj.free();
|
|
+#endif
|
|
return linkAction;
|
|
}
|
|
|
|
@@ -282,6 +370,22 @@ LinkAction* SlaOutputDev::SC_getAdditionalAction(const char *key, AnnotWidget *a
|
|
Object obj;
|
|
Ref refa = ano->getRef();
|
|
Object additionalActions;
|
|
+
|
|
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 58, 0)
|
|
+ obj = xref->fetch(refa.num, refa.gen);
|
|
+ if (obj.isDict())
|
|
+ {
|
|
+ Dict* adic = obj.getDict();
|
|
+ additionalActions = adic->lookupNF("AA");
|
|
+ Object additionalActionsObject = additionalActions.fetch(pdfDoc->getXRef());
|
|
+ if (additionalActionsObject.isDict())
|
|
+ {
|
|
+ Object actionObject = additionalActionsObject.dictLookup(key);
|
|
+ if (actionObject.isDict())
|
|
+ linkAction = LinkAction::parseAction(&actionObject, pdfDoc->getCatalog()->getBaseURI());
|
|
+ }
|
|
+ }
|
|
+#else
|
|
Object *act = xref->fetch(refa.num, refa.gen, &obj);
|
|
if (act)
|
|
{
|
|
@@ -302,6 +406,7 @@ LinkAction* SlaOutputDev::SC_getAdditionalAction(const char *key, AnnotWidget *a
|
|
}
|
|
}
|
|
obj.free();
|
|
+#endif
|
|
return linkAction;
|
|
}
|
|
|
|
@@ -509,13 +614,13 @@ bool SlaOutputDev::handleLinkAnnot(Annot* annota, double xCoor, double yCoor, do
|
|
ite->AutoName = false;
|
|
if (act->getKind() == actionGoTo)
|
|
{
|
|
- ite->annotation().setZiel(pagNum - 1);
|
|
+ ite->annotation().setZiel((pagNum > 0) ? (pagNum - 1) : (m_actPage - 1));
|
|
ite->annotation().setAction(QString("%1 %2").arg(xco).arg(yco));
|
|
ite->annotation().setActionType(2);
|
|
}
|
|
else if (act->getKind() == actionGoToR)
|
|
{
|
|
- ite->annotation().setZiel(pagNum - 1);
|
|
+ ite->annotation().setZiel((pagNum > 0) ? (pagNum - 1) : (m_actPage - 1));
|
|
ite->annotation().setExtern(fileName);
|
|
ite->annotation().setAction(QString("%1 %2").arg(xco).arg(yco));
|
|
ite->annotation().setActionType(9);
|
|
@@ -827,6 +932,33 @@ bool SlaOutputDev::handleWidgetAnnot(Annot* annota, double xCoor, double yCoor,
|
|
{
|
|
Object obj1;
|
|
Ref refa = annota->getRef();
|
|
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 58, 0)
|
|
+ obj1 = xref->fetch(refa.num, refa.gen);
|
|
+ if (obj1.isDict())
|
|
+ {
|
|
+ Dict* dict = obj1.getDict();
|
|
+ Object obj2 = dict->lookup("Kids");
|
|
+ //childs
|
|
+ if (obj2.isArray())
|
|
+ {
|
|
+ // Load children
|
|
+ QList<int> radList;
|
|
+ for (int i = 0; i < obj2.arrayGetLength(); i++)
|
|
+ {
|
|
+ Object childRef = obj2.arrayGetNF(i);
|
|
+ if (!childRef.isRef())
|
|
+ continue;
|
|
+ Object childObj = obj2.arrayGet(i);
|
|
+ if (!childObj.isDict())
|
|
+ continue;
|
|
+ const Ref ref = childRef.getRef();
|
|
+ radList.append(ref.num);
|
|
+ }
|
|
+ QString tmTxt = UnicodeParsedString(annota->getName());
|
|
+ m_radioMap.insert(tmTxt, radList);
|
|
+ }
|
|
+ }
|
|
+#else
|
|
Object *act = xref->fetch(refa.num, refa.gen, &obj1);
|
|
if (act && act->isDict())
|
|
{
|
|
@@ -862,6 +994,7 @@ bool SlaOutputDev::handleWidgetAnnot(Annot* annota, double xCoor, double yCoor,
|
|
obj2.free();
|
|
}
|
|
obj1.free();
|
|
+#endif
|
|
}
|
|
return retVal;
|
|
}
|
|
@@ -935,7 +1068,7 @@ void SlaOutputDev::handleActions(PageItem* ite, AnnotWidget *ano)
|
|
pagNum = dst->getPageNum();
|
|
xco = dst->getLeft();
|
|
yco = dst->getTop();
|
|
- ite->annotation().setZiel(pagNum - 1);
|
|
+ ite->annotation().setZiel((pagNum > 0) ? (pagNum - 1) : (m_actPage - 1));
|
|
ite->annotation().setAction(QString("%1 %2").arg(xco).arg(yco));
|
|
ite->annotation().setActionType(2);
|
|
}
|
|
@@ -959,7 +1092,7 @@ void SlaOutputDev::handleActions(PageItem* ite, AnnotWidget *ano)
|
|
pagNum = dstn->getPageNum();
|
|
xco = dstn->getLeft();
|
|
yco = dstn->getTop();
|
|
- ite->annotation().setZiel(pagNum - 1);
|
|
+ ite->annotation().setZiel((pagNum > 0) ? (pagNum - 1) : (m_actPage - 1));
|
|
ite->annotation().setAction(QString("%1 %2").arg(xco).arg(yco));
|
|
ite->annotation().setActionType(2);
|
|
}
|
|
@@ -982,7 +1115,7 @@ void SlaOutputDev::handleActions(PageItem* ite, AnnotWidget *ano)
|
|
pagNum = dst->getPageNum();
|
|
xco = dst->getLeft();
|
|
yco = dst->getTop();
|
|
- ite->annotation().setZiel(pagNum - 1);
|
|
+ ite->annotation().setZiel((pagNum > 0) ? (pagNum - 1) : (m_actPage - 1));
|
|
ite->annotation().setExtern(fileName);
|
|
ite->annotation().setAction(QString("%1 %2").arg(xco).arg(yco));
|
|
ite->annotation().setActionType(9);
|
|
@@ -1001,7 +1134,7 @@ void SlaOutputDev::handleActions(PageItem* ite, AnnotWidget *ano)
|
|
pagNum = dstn->getPageNum();
|
|
xco = dstn->getLeft();
|
|
yco = dstn->getTop();
|
|
- ite->annotation().setZiel(pagNum - 1);
|
|
+ ite->annotation().setZiel((pagNum > 0) ? (pagNum - 1) : (m_actPage - 1));
|
|
ite->annotation().setExtern(fileName);
|
|
ite->annotation().setAction(QString("%1 %2").arg(xco).arg(yco));
|
|
ite->annotation().setActionType(9);
|
|
@@ -2499,6 +2632,7 @@ void SlaOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str
|
|
mskStr->reset();
|
|
Guchar *mdest = 0;
|
|
unsigned char * mbuffer = new unsigned char[maskWidth * maskHeight];
|
|
+ memset(mbuffer, 0, maskWidth * maskHeight);
|
|
for (int y = 0; y < maskHeight; y++)
|
|
{
|
|
mdest = (Guchar *)(mbuffer + y * maskWidth);
|
|
@@ -2576,6 +2710,8 @@ void SlaOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str
|
|
tempFile->close();
|
|
ite->isInlineImage = true;
|
|
ite->isTempFile = true;
|
|
+ ite->AspectRatio = false;
|
|
+ ite->ScaleType = false;
|
|
res.save(fileName, "PNG");
|
|
m_doc->loadPict(fileName, ite);
|
|
// ite->setImageScalingMode(false, false);
|
|
@@ -2640,6 +2776,7 @@ void SlaOutputDev::drawMaskedImage(GfxState *state, Object *ref, Stream *str, i
|
|
Guchar *mdest = 0;
|
|
int invert_bit = maskInvert ? 1 : 0;
|
|
unsigned char * mbuffer = new unsigned char[maskWidth * maskHeight];
|
|
+ memset(mbuffer, 0, maskWidth * maskHeight);
|
|
for (int y = 0; y < maskHeight; y++)
|
|
{
|
|
mdest = (Guchar *)(mbuffer + y * maskWidth);
|
|
@@ -2723,6 +2860,8 @@ void SlaOutputDev::drawMaskedImage(GfxState *state, Object *ref, Stream *str, i
|
|
tempFile->close();
|
|
ite->isInlineImage = true;
|
|
ite->isTempFile = true;
|
|
+ ite->AspectRatio = false;
|
|
+ ite->ScaleType = false;
|
|
res.save(fileName, "PNG");
|
|
m_doc->loadPict(fileName, ite);
|
|
// ite->setImageScalingMode(false, false);
|
|
@@ -2990,6 +3129,23 @@ void SlaOutputDev::beginMarkedContent(char *name, Object *dictRef)
|
|
}
|
|
else
|
|
{
|
|
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 58, 0)
|
|
+ dictObj = dictRef->fetch(xref);
|
|
+ if (!dictObj.isDict())
|
|
+ return;
|
|
+ dict = dictObj.getDict();
|
|
+ dictType = dict->lookup("Type");
|
|
+ if (dictType.isName("OCG"))
|
|
+ {
|
|
+ oc = contentConfig->findOcgByRef(dictRef->getRef());
|
|
+ if (oc)
|
|
+ {
|
|
+ // qDebug() << "Begin OCG Content with Name " << UnicodeParsedString(oc->getName());
|
|
+ m_doc->setActiveLayer(UnicodeParsedString(oc->getName()));
|
|
+ mSte.ocgName = UnicodeParsedString(oc->getName());
|
|
+ }
|
|
+ }
|
|
+#else
|
|
dictRef->fetch(xref, &dictObj);
|
|
if (!dictObj.isDict())
|
|
{
|
|
@@ -3010,6 +3166,7 @@ void SlaOutputDev::beginMarkedContent(char *name, Object *dictRef)
|
|
}
|
|
dictType.free();
|
|
dictObj.free();
|
|
+#endif
|
|
}
|
|
}
|
|
m_mcStack.push(mSte);
|
|
@@ -3029,14 +3186,20 @@ void SlaOutputDev::beginMarkedContent(char *name, Dict *properties)
|
|
{
|
|
if (layersSetByOCG)
|
|
return;
|
|
- Object obj;
|
|
QString lName = QString("Layer_%1").arg(layerNum + 1);
|
|
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 58, 0)
|
|
+ Object obj = properties->lookup((char*) "Title");
|
|
+ if (obj.isString())
|
|
+ lName = QString(obj.getString()->getCString());
|
|
+#else
|
|
+ Object obj;
|
|
if (properties->lookup((char*)"Title", &obj))
|
|
{
|
|
if (obj.isString())
|
|
lName = QString(obj.getString()->getCString());
|
|
obj.free();
|
|
}
|
|
+#endif
|
|
for (ScLayers::iterator it = m_doc->Layers.begin(); it != m_doc->Layers.end(); ++it)
|
|
{
|
|
if (it->Name == lName)
|
|
@@ -3049,6 +3212,29 @@ void SlaOutputDev::beginMarkedContent(char *name, Dict *properties)
|
|
if (!firstLayer)
|
|
currentLayer = m_doc->addLayer(lName, true);
|
|
firstLayer = false;
|
|
+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(0, 58, 0)
|
|
+ obj = properties->lookup((char*) "Visible");
|
|
+ if (obj.isBool())
|
|
+ m_doc->setLayerVisible(currentLayer, obj.getBool());
|
|
+ obj = properties->lookup((char*) "Editable");
|
|
+ if (obj.isBool())
|
|
+ m_doc->setLayerLocked(currentLayer, !obj.getBool());
|
|
+ obj = properties->lookup((char*) "Printed");
|
|
+ if (obj.isBool())
|
|
+ m_doc->setLayerPrintable(currentLayer, obj.getBool());
|
|
+ obj = properties->lookup((char*)"Color");
|
|
+ if (obj.isArray())
|
|
+ {
|
|
+ Object obj1;
|
|
+ obj1 = obj.arrayGet(0);
|
|
+ int r = obj1.getNum() / 256;
|
|
+ obj1 = obj.arrayGet(1);
|
|
+ int g = obj1.getNum() / 256;
|
|
+ obj1 = obj.arrayGet(2);
|
|
+ int b = obj1.getNum() / 256;
|
|
+ m_doc->setLayerMarker(currentLayer, QColor(r, g, b));
|
|
+ }
|
|
+#else
|
|
if (properties->lookup((char*)"Visible", &obj))
|
|
{
|
|
if (obj.isBool())
|
|
@@ -3085,6 +3271,7 @@ void SlaOutputDev::beginMarkedContent(char *name, Dict *properties)
|
|
}
|
|
obj.free();
|
|
}
|
|
+#endif
|
|
}
|
|
}
|
|
}
|
|
@@ -3137,12 +3324,12 @@ void SlaOutputDev::updateFont(GfxState *state)
|
|
Object refObj, strObj;
|
|
GooString *fileName;
|
|
char *tmpBuf;
|
|
- int tmpBufLen;
|
|
+ int tmpBufLen = 0;
|
|
int *codeToGID;
|
|
double *textMat;
|
|
double m11, m12, m21, m22, fontSize;
|
|
SplashCoord mat[4];
|
|
- int n;
|
|
+ int n = 0;
|
|
int faceIndex = 0;
|
|
SplashCoord matrix[6];
|
|
|
|
@@ -3806,15 +3993,27 @@ QString SlaOutputDev::getColor(GfxColorSpace *color_space, GfxColor *color, int
|
|
else if (color_space->getMode() == csSeparation)
|
|
{
|
|
GfxCMYK cmyk;
|
|
- color_space->getCMYK(color, &cmyk);
|
|
- int Cc = qRound(colToDbl(cmyk.c) * 255);
|
|
- int Mc = qRound(colToDbl(cmyk.m) * 255);
|
|
- int Yc = qRound(colToDbl(cmyk.y) * 255);
|
|
- int Kc = qRound(colToDbl(cmyk.k) * 255);
|
|
+ QString name = QString(((GfxSeparationColorSpace*)color_space)->getName()->getCString());
|
|
+ int Cc, Mc, Yc, Kc;
|
|
+ bool isRegistrationColor = (name == "All");
|
|
+ if (!isRegistrationColor)
|
|
+ {
|
|
+ color_space->getCMYK(color, &cmyk);
|
|
+ Cc = qRound(colToDbl(cmyk.c) * 255);
|
|
+ Mc = qRound(colToDbl(cmyk.m) * 255);
|
|
+ Yc = qRound(colToDbl(cmyk.y) * 255);
|
|
+ Kc = qRound(colToDbl(cmyk.k) * 255);
|
|
+ }
|
|
+ else
|
|
+ {
|
|
+ Cc = Mc = Yc = Kc = 255;
|
|
+ tmp.setRegistrationColor(true);
|
|
+ name = "Registration";
|
|
+ }
|
|
tmp.setColor(Cc, Mc, Yc, Kc);
|
|
tmp.setSpotColor(true);
|
|
- QString nam = QString(((GfxSeparationColorSpace*)color_space)->getName()->getCString());
|
|
- fNam = m_doc->PageColors.tryAddColor(nam, tmp);
|
|
+
|
|
+ fNam = m_doc->PageColors.tryAddColor(name, tmp);
|
|
*shade = qRound(colToDbl(color->c[0]) * 100);
|
|
}
|
|
else
|
|
--
|
|
2.16.4
|
|
|
|
|
|
From 6a016193dec1443802adf67d27bccbe7bf098dc5 Mon Sep 17 00:00:00 2001
|
|
From: Gerasim Troeglazov <3dEyes@gmail.com>
|
|
Date: Fri, 4 May 2018 23:19:34 +1000
|
|
Subject: Fix hunspell detection
|
|
|
|
|
|
diff --git a/cmake/modules/FindHUNSPELL.cmake b/cmake/modules/FindHUNSPELL.cmake
|
|
index ecd4776..034c46a 100644
|
|
--- a/cmake/modules/FindHUNSPELL.cmake
|
|
+++ b/cmake/modules/FindHUNSPELL.cmake
|
|
@@ -9,7 +9,7 @@
|
|
#Based on examples at http://www.vtk.org/Wiki/CMake:How_To_Find_Libraries
|
|
|
|
FIND_PATH(HUNSPELL_INCLUDE_DIR hunspell/hunspell.hxx )
|
|
-FIND_LIBRARY(HUNSPELL_LIBRARIES NAMES hunspell-1.3 hunspell-1.2 PATHS /opt/local/lib /usr/local/lib /usr/lib )
|
|
+FIND_LIBRARY(HUNSPELL_LIBRARIES NAMES hunspell-1.6 hunspell-1.3 hunspell-1.2 PATHS /opt/local/lib /usr/local/lib /usr/lib )
|
|
|
|
INCLUDE(FindPackageHandleStandardArgs)
|
|
# handle the QUIETLY and REQUIRED arguments and set HUNSPELL_FOUND to TRUE
|
|
--
|
|
2.16.4
|
|
|
|
|
|
From 6af5c6598b91bcfe449c1c7b785fd1ce2f6787ff Mon Sep 17 00:00:00 2001
|
|
From: Gerasim Troeglazov <3dEyes@gmail.com.org>
|
|
Date: Wed, 30 May 2018 19:15:11 +1000
|
|
Subject: Disable python and scriptplugin
|
|
|
|
|
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
index 1ef8100..a361806 100644
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -710,7 +710,7 @@ ENDIF(TIFF_FOUND)
|
|
|
|
#<< PYTHON
|
|
#SET(PythonLibs_FIND_VERSION 2)
|
|
-FIND_PACKAGE(PythonLibs 2 REQUIRED)
|
|
+FIND_PACKAGE(PythonLibs 2)
|
|
IF (PYTHON_LIBRARY)
|
|
MESSAGE("Python Library Found OK")
|
|
SET(HAVE_PYTHON 1)
|
|
diff --git a/scribus/CMakeLists.txt b/scribus/CMakeLists.txt
|
|
index 718b6ee..64e10b3 100644
|
|
--- a/scribus/CMakeLists.txt
|
|
+++ b/scribus/CMakeLists.txt
|
|
@@ -1216,7 +1216,7 @@ TARGET_LINK_LIBRARIES(${EXE_NAME}
|
|
${FREETYPE_LIBRARIES}
|
|
${FONTCONFIG_LIBRARIES}
|
|
${LIBXML2_LIBRARIES}
|
|
- ${PYTHON_LIBRARIES}
|
|
+# ${PYTHON_LIBRARIES}
|
|
${TIFF_LIBRARIES}
|
|
${JPEG_LIBRARIES}
|
|
${ZLIB_LIBRARIES}
|
|
diff --git a/scribus/plugins/CMakeLists.txt b/scribus/plugins/CMakeLists.txt
|
|
index 733acc1..3e3d444 100644
|
|
--- a/scribus/plugins/CMakeLists.txt
|
|
+++ b/scribus/plugins/CMakeLists.txt
|
|
@@ -11,12 +11,12 @@ IF(NOT WANT_SCRIPTER2)
|
|
#scripter1
|
|
IF(NOT WIN32)
|
|
MESSAGE(STATUS "Building with Scripter 1")
|
|
- ADD_SUBDIRECTORY(scriptplugin)
|
|
+# ADD_SUBDIRECTORY(scriptplugin)
|
|
ENDIF(NOT WIN32)
|
|
ELSE(NOT WANT_SCRIPTER2)
|
|
#scripter2
|
|
MESSAGE(STATUS "Building with Scripter 2")
|
|
- ADD_SUBDIRECTORY(scripter)
|
|
+# ADD_SUBDIRECTORY(scripter)
|
|
ENDIF(NOT WANT_SCRIPTER2)
|
|
ADD_SUBDIRECTORY(short-words)
|
|
ADD_SUBDIRECTORY(tools)
|
|
--
|
|
2.16.4
|
|
|
|
|
|
From b4676051b924fed87336cce6042f81f3c0696063 Mon Sep 17 00:00:00 2001
|
|
From: Gerasim Troeglazov <3dEyes@gmail.com>
|
|
Date: Wed, 30 May 2018 20:07:35 +1000
|
|
Subject: Fix build with Qt 5.11 (missing headers)
|
|
|
|
|
|
diff --git a/scribus/plugins/tools/2geomtools/meshdistortion/meshdistortiondialog.cpp b/scribus/plugins/tools/2geomtools/meshdistortion/meshdistortiondialog.cpp
|
|
index 3f0d916..3ea32dc 100644
|
|
--- a/scribus/plugins/tools/2geomtools/meshdistortion/meshdistortiondialog.cpp
|
|
+++ b/scribus/plugins/tools/2geomtools/meshdistortion/meshdistortiondialog.cpp
|
|
@@ -26,17 +26,20 @@ for which a new license (GPL+exception) is in place.
|
|
|
|
#include "meshdistortiondialog.h"
|
|
|
|
-#include <QPainterPath>
|
|
#include <QGraphicsItem>
|
|
+#include <QGraphicsSceneHoverEvent>
|
|
+#include <QGraphicsSceneMouseEvent>
|
|
+#include <QPainterPath>
|
|
+#include <QStyleOptionGraphicsItem>
|
|
|
|
#include "commonstrings.h"
|
|
#include "fpointarray.h"
|
|
+#include "iconmanager.h"
|
|
#include "pageitem.h"
|
|
#include "pageitem_group.h"
|
|
#include "sccolorengine.h"
|
|
#include "scpattern.h"
|
|
#include "selection.h"
|
|
-#include "iconmanager.h"
|
|
#include "util_math.h"
|
|
|
|
NodeItem::NodeItem(QRectF geom, uint num, MeshDistortionDialog *parent) : QGraphicsEllipseItem(geom)
|
|
diff --git a/scribus/plugins/tools/2geomtools/meshdistortion/meshdistortiondialog.h b/scribus/plugins/tools/2geomtools/meshdistortion/meshdistortiondialog.h
|
|
index 7ea05f8..2baa96b 100644
|
|
--- a/scribus/plugins/tools/2geomtools/meshdistortion/meshdistortiondialog.h
|
|
+++ b/scribus/plugins/tools/2geomtools/meshdistortion/meshdistortiondialog.h
|
|
@@ -31,13 +31,11 @@ for which a new license (GPL+exception) is in place.
|
|
#include <QList>
|
|
#include <QGraphicsEllipseItem>
|
|
#include <QGraphicsPathItem>
|
|
-#include <QGraphicsSceneMouseEvent>
|
|
-#include <QGraphicsSceneHoverEvent>
|
|
+
|
|
#include "ui_meshdistortiondialog.h"
|
|
#include "pluginapi.h"
|
|
#include "scribusdoc.h"
|
|
|
|
-
|
|
#if defined(_MSC_VER) && !defined(_USE_MATH_DEFINES)
|
|
#define _USE_MATH_DEFINES
|
|
#endif
|
|
@@ -54,14 +52,19 @@ for which a new license (GPL+exception) is in place.
|
|
#include "third_party/lib2geom/transforms.h"
|
|
#include "third_party/lib2geom/scribushelper.h"
|
|
#include <vector>
|
|
+
|
|
//using namespace Geom;
|
|
class MeshDistortionDialog;
|
|
+class QGraphicsSceneHoverEvent;
|
|
+class QGraphicsSceneMouseEvent;
|
|
+class QStyleOptionGraphicsItem;
|
|
|
|
class PLUGIN_API NodeItem : public QGraphicsEllipseItem
|
|
{
|
|
public:
|
|
NodeItem(QRectF geom, uint num, MeshDistortionDialog *parent);
|
|
~NodeItem() {};
|
|
+
|
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *item, QWidget *widget);
|
|
uint handle;
|
|
bool mouseMoving;
|
|
@@ -84,6 +87,7 @@ class PLUGIN_API MeshDistortionDialog : public QDialog, Ui::MeshDistortionDialog
|
|
public:
|
|
MeshDistortionDialog(QWidget* parent, ScribusDoc *doc);
|
|
~MeshDistortionDialog() {};
|
|
+
|
|
void addItemsToScene(Selection* itemSelection, ScribusDoc *doc, QGraphicsPathItem* parentItem, PageItem* parent);
|
|
void adjustHandles();
|
|
void updateMesh(bool gridOnly);
|
|
diff --git a/scribus/plugins/tools/lenseffects/lensdialog.cpp b/scribus/plugins/tools/lenseffects/lensdialog.cpp
|
|
index cfabc40..f5d6981 100644
|
|
--- a/scribus/plugins/tools/lenseffects/lensdialog.cpp
|
|
+++ b/scribus/plugins/tools/lenseffects/lensdialog.cpp
|
|
@@ -25,14 +25,20 @@ for which a new license (GPL+exception) is in place.
|
|
***************************************************************************/
|
|
|
|
#include "lensdialog.h"
|
|
+
|
|
#include <cmath>
|
|
+
|
|
+#include <QGraphicsSceneHoverEvent>
|
|
+#include <QGraphicsSceneMouseEvent>
|
|
#include <QRadialGradient>
|
|
+#include <QStyleOptionGraphicsItem>
|
|
+
|
|
+#include "commonstrings.h"
|
|
#include "iconmanager.h"
|
|
-#include "selection.h"
|
|
+#include "pageitem_group.h"
|
|
#include "sccolorengine.h"
|
|
#include "scpattern.h"
|
|
-#include "commonstrings.h"
|
|
-#include "pageitem_group.h"
|
|
+#include "selection.h"
|
|
|
|
LensItem::LensItem(QRectF geom, LensDialog *parent) : QGraphicsRectItem(geom)
|
|
{
|
|
diff --git a/scribus/plugins/tools/lenseffects/lensdialog.h b/scribus/plugins/tools/lenseffects/lensdialog.h
|
|
index 4352ec2..213e53b 100644
|
|
--- a/scribus/plugins/tools/lenseffects/lensdialog.h
|
|
+++ b/scribus/plugins/tools/lenseffects/lensdialog.h
|
|
@@ -33,19 +33,22 @@ for which a new license (GPL+exception) is in place.
|
|
#include <QGraphicsItem>
|
|
#include <QGraphicsRectItem>
|
|
#include <QGraphicsPathItem>
|
|
-#include <QGraphicsSceneMouseEvent>
|
|
-#include <QGraphicsSceneHoverEvent>
|
|
+
|
|
#include "ui_lensdialogbase.h"
|
|
#include "pluginapi.h"
|
|
#include "scribusdoc.h"
|
|
|
|
class LensDialog;
|
|
+class QGraphicsSceneHoverEvent;
|
|
+class QGraphicsSceneMouseEvent;
|
|
+class QStyleOptionGraphicsItem;
|
|
|
|
class PLUGIN_API LensItem : public QGraphicsRectItem
|
|
{
|
|
public:
|
|
LensItem(QRectF geom, LensDialog *parent);
|
|
~LensItem() {};
|
|
+
|
|
void setStrength(double s);
|
|
void updateEffect();
|
|
QPainterPath lensDeform(const QPainterPath &source, const QPointF &offset, double m_radius, double s);
|
|
@@ -54,6 +57,7 @@ public:
|
|
double scaling;
|
|
int handle;
|
|
QPointF mousePoint;
|
|
+
|
|
protected:
|
|
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
|
|
void mousePressEvent(QGraphicsSceneMouseEvent *event);
|
|
@@ -72,6 +76,7 @@ class PLUGIN_API LensDialog : public QDialog, Ui::LensDialogBase
|
|
public:
|
|
LensDialog(QWidget* parent, ScribusDoc *doc);
|
|
~LensDialog() {};
|
|
+
|
|
void addItemsToScene(Selection* itemSelection, ScribusDoc *doc, QGraphicsPathItem* parentItem, PageItem* parent);
|
|
void lensSelected(LensItem *item);
|
|
void setLensPositionValues(QPointF p);
|
|
diff --git a/scribus/sclistboxpixmap.h b/scribus/sclistboxpixmap.h
|
|
index 044d45a..789bf04 100644
|
|
--- a/scribus/sclistboxpixmap.h
|
|
+++ b/scribus/sclistboxpixmap.h
|
|
@@ -9,10 +9,13 @@ for which a new license (GPL+exception) is in place.
|
|
|
|
#include <memory>
|
|
|
|
+#include <QAbstractItemDelegate>
|
|
#include <QApplication>
|
|
#include <QDebug>
|
|
#include <QPainter>
|
|
#include <QPixmap>
|
|
+#include <QScopedPointer>
|
|
+#include <QStyleOptionViewItem>
|
|
#include <QVariant>
|
|
|
|
#include "scguardedptr.h"
|
|
--
|
|
2.16.4
|
|
|
|
|
|
From 55dad3289a6ffc4c2979b3553255e26e2bc20cc1 Mon Sep 17 00:00:00 2001
|
|
From: Gerasim Troeglazov <3dEyes@gmail.com>
|
|
Date: Wed, 30 May 2018 20:44:58 +1000
|
|
Subject: Add paths for Haiku
|
|
|
|
|
|
diff --git a/scribus/scpaths.cpp b/scribus/scpaths.cpp
|
|
index 9aa902c..7a0b19e 100644
|
|
--- a/scribus/scpaths.cpp
|
|
+++ b/scribus/scpaths.cpp
|
|
@@ -258,6 +258,8 @@ QStringList ScPaths::spellDirs() const
|
|
QString linuxHunspellPath("/usr/share/hunspell/");
|
|
QString linuxMyspellPath("/usr/share/myspell/");
|
|
QString windowsLOPath("LibreOffice 3.5/share/extensions");
|
|
+ QString haikuSystemHunspellPath("/system/data/hunspell/");
|
|
+ QString haikuUserHunspellPath("/boot/home/config/non-packaged/data/hunspell/");
|
|
QDir d;
|
|
QStringList spellDirs;
|
|
spellDirs.append(getUserDictDir(ScPaths::Spell, false));
|
|
@@ -309,6 +311,13 @@ QStringList ScPaths::spellDirs() const
|
|
d.setPath(linuxLocalPath);
|
|
if (d.exists())
|
|
spellDirs.append(linuxLocalPath);
|
|
+#elif defined(Q_OS_HAIKU)
|
|
+ d.setPath(haikuSystemHunspellPath);
|
|
+ if (d.exists())
|
|
+ spellDirs.append(haikuSystemHunspellPath);
|
|
+ d.setPath(haikuUserHunspellPath);
|
|
+ if (d.exists())
|
|
+ spellDirs.append(haikuUserHunspellPath);
|
|
#endif
|
|
return spellDirs;
|
|
}
|
|
@@ -325,6 +334,9 @@ QStringList ScPaths::hyphDirs() const
|
|
QString linuxMyspellPath("/usr/share/myspell/");
|
|
QString linuxHyphen1Path("/usr/share/hyphen/");
|
|
QString windowsLOPath("LibreOffice 3.5/share/extensions");
|
|
+ QString haikuSystemHyphenPath("/system/data/hyphen/");
|
|
+ QString haikuSystemHunspellPath("/system/data/hunspell/");
|
|
+ QString haikuUserHunspellPath("/boot/home/config/non-packaged/data/hunspell/");
|
|
QDir d;
|
|
QStringList hyphDirs;
|
|
hyphDirs.append(getUserDictDir(ScPaths::Hyph, false));
|
|
@@ -379,6 +391,16 @@ QStringList ScPaths::hyphDirs() const
|
|
d.setPath(linuxLocalPath);
|
|
if (d.exists())
|
|
hyphDirs.append(linuxLocalPath);
|
|
+#elif defined(Q_OS_HAIKU)
|
|
+ d.setPath(haikuSystemHyphenPath);
|
|
+ if (d.exists())
|
|
+ hyphDirs.append(haikuSystemHyphenPath);
|
|
+ d.setPath(haikuSystemHunspellPath);
|
|
+ if (d.exists())
|
|
+ hyphDirs.append(haikuSystemHunspellPath);
|
|
+ d.setPath(haikuUserHunspellPath);
|
|
+ if (d.exists())
|
|
+ hyphDirs.append(haikuUserHunspellPath);
|
|
#endif
|
|
return hyphDirs;
|
|
}
|
|
@@ -393,6 +415,9 @@ QStringList ScPaths::getSystemFontDirs(void)
|
|
fontDirs.append("/System/Library/Fonts/");
|
|
#elif defined(_WIN32)
|
|
fontDirs.append( getSpecialDir(CSIDL_FONTS) );
|
|
+#elif defined(Q_OS_HAIKU)
|
|
+ fontDirs.append("/system/data/fonts/ttfonts");
|
|
+ fontDirs.append("/boot/home/config/non-packaged/data/fonts");
|
|
#endif
|
|
return fontDirs;
|
|
}
|
|
--
|
|
2.16.4
|
|
|