summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sdext/Package_pdfimport_xpdfimport.mk2
-rw-r--r--sdext/source/pdfimport/dialogs/xpdfimport_err.pdfbin21204 -> 0 bytes
-rw-r--r--sdext/source/pdfimport/wrapper/wrapper.cxx17
-rw-r--r--sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx21
4 files changed, 9 insertions, 31 deletions
diff --git a/sdext/Package_pdfimport_xpdfimport.mk b/sdext/Package_pdfimport_xpdfimport.mk
index 9f08e05f4773..c1c82814aa77 100644
--- a/sdext/Package_pdfimport_xpdfimport.mk
+++ b/sdext/Package_pdfimport_xpdfimport.mk
@@ -9,6 +9,4 @@
$(eval $(call gb_Package_Package,sdext_pdfimport_pdf,$(SRCDIR)/sdext))
-$(eval $(call gb_Package_add_file,sdext_pdfimport_pdf,$(LIBO_SHARE_FOLDER)/xpdfimport/xpdfimport_err.pdf,source/pdfimport/dialogs/xpdfimport_err.pdf))
-
# vim: set noet sw=4 ts=4:
diff --git a/sdext/source/pdfimport/dialogs/xpdfimport_err.pdf b/sdext/source/pdfimport/dialogs/xpdfimport_err.pdf
deleted file mode 100644
index dc0f9292c680..000000000000
--- a/sdext/source/pdfimport/dialogs/xpdfimport_err.pdf
+++ /dev/null
Binary files differ
diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx b/sdext/source/pdfimport/wrapper/wrapper.cxx
index d99103b9867a..6a17d295eae1 100644
--- a/sdext/source/pdfimport/wrapper/wrapper.cxx
+++ b/sdext/source/pdfimport/wrapper/wrapper.cxx
@@ -1079,24 +1079,12 @@ bool xpdf_ImportFromFile(const OUString& rURL,
OUString converterURL("$BRAND_BASE_DIR/" LIBO_BIN_FOLDER "/xpdfimport");
rtl::Bootstrap::expandMacros(converterURL); //TODO: detect failure
- // Determine pathname of xpdfimport_err.pdf:
- OUString errPathname("$BRAND_BASE_DIR/" LIBO_SHARE_FOLDER "/xpdfimport/xpdfimport_err.pdf");
- rtl::Bootstrap::expandMacros(errPathname); //TODO: detect failure
- if (osl::FileBase::getSystemPathFromFileURL(errPathname, errPathname)
- != osl::FileBase::E_None)
- {
- SAL_WARN(
- "sdext.pdfimport",
- "getSystemPathFromFileURL(" << errPathname << ") failed");
- return false;
- }
-
// spawn separate process to keep LGPL/GPL code apart.
OUString aOptFlag("-o");
- rtl_uString* args[] = { aSysUPath.pData, errPathname.pData,
+ rtl_uString* args[] = { aSysUPath.pData,
aOptFlag.pData, rFilterOptions.pData };
- sal_Int32 nArgs = rFilterOptions.isEmpty() ? 2 : 4;
+ sal_Int32 nArgs = rFilterOptions.isEmpty() ? std::size(args) - 2 : std::size(args);
oslProcess aProcess;
oslFileHandle pIn = nullptr;
@@ -1206,6 +1194,7 @@ bool xpdf_ImportFromFile(const OUString& rURL,
"sdext.pdfimport",
"getProcessInfo of " << converterURL
<< " failed with exit code " << info.Code);
+ // TODO: use xIHdl and/or exceptions to inform the user; see poppler/ErrorCodes.h
bRet = false;
}
}
diff --git a/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx b/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx
index 383f6810b2a2..ebed120708cc 100644
--- a/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx
+++ b/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx
@@ -152,7 +152,6 @@ int main(int argc, char **argv)
// PDFDoc takes over ownership for all strings below
GooString* pFileName = new GooString(myStringToStdString(argv[1]));
- GooString* pErrFileName = new GooString(myStringToStdString(argv[2]));
// check for password string(s)
GooString* pOwnerPasswordStr( aPwBuf[0] != 0
@@ -182,30 +181,22 @@ int main(int argc, char **argv)
PDFDoc aDoc( std::make_unique<GooString>(pFileName),
std::optional<GooString>(pOwnerPasswordStr),
std::optional<GooString>(pUserPasswordStr) );
-
- PDFDoc aErrDoc( std::make_unique<GooString>(pErrFileName),
- std::optional<GooString>(pOwnerPasswordStr),
- std::optional<GooString>(pUserPasswordStr) );
#else
PDFDoc aDoc( pFileName,
pOwnerPasswordStr,
pUserPasswordStr );
-
- PDFDoc aErrDoc( pErrFileName,
- pOwnerPasswordStr,
- pUserPasswordStr );
#endif
- // Check various permissions for aDoc.
- PDFDoc &rDoc = aDoc.isOk()? aDoc: aErrDoc;
+ if (!aDoc.isOk())
+ return aDoc.getErrorCode();
- pdfi::PDFOutDev aOutDev(&rDoc);
+ pdfi::PDFOutDev aOutDev(&aDoc);
if (options == TO_STRING_VIEW("SkipImages")) {
aOutDev.setSkipImages(true);
}
// tell the receiver early - needed for proper progress calculation
- const int nPages = rDoc.isOk()? rDoc.getNumPages(): 0;
+ const int nPages = aDoc.getNumPages();
pdfi::PDFOutDev::setPageNum(nPages);
// virtual resolution of the PDF OutputDev in dpi
@@ -214,12 +205,12 @@ int main(int argc, char **argv)
// do the conversion
for (int i = 1; i <= nPages; ++i)
{
- rDoc.displayPage(&aOutDev,
+ aDoc.displayPage(&aOutDev,
i,
PDFI_OUTDEV_RESOLUTION,
PDFI_OUTDEV_RESOLUTION,
0, true, true, true);
- rDoc.processLinks(&aOutDev, i);
+ aDoc.processLinks(&aOutDev, i);
}
return 0;