tdf#162826: Move pdf pwdinteract
Move sdext's pwdinteract that provides getPassword() into vcl/source/pdf so it can also be used for the PDFium based import. Change-Id: Iab0f6fd0814986622624cdb2c523f1c60caddcc2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185470 Reviewed-by: David Gilbert <freedesktop@treblig.org> Tested-by: Jenkins
This commit is contained in:
committed by
David Gilbert
parent
894fccf8c5
commit
32534b76ea
@@ -0,0 +1,24 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vcl/dllapi.h>
|
||||
#include <com/sun/star/task/InteractionHandler.hpp>
|
||||
|
||||
namespace vcl::pdf
|
||||
{
|
||||
/** retrieve password from user
|
||||
*/
|
||||
bool VCL_DLLPUBLIC getPassword(const css::uno::Reference<css::task::XInteractionHandler>& xHandler,
|
||||
OUString& rOutPwd, bool bFirstTry, const OUString& rDocName);
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
@@ -55,7 +55,6 @@ $(eval $(call gb_Library_add_defs,pdfimport, \
|
||||
$(eval $(call gb_Library_add_exception_objects,pdfimport,\
|
||||
sdext/source/pdfimport/filterdet \
|
||||
sdext/source/pdfimport/misc/pdfihelper \
|
||||
sdext/source/pdfimport/misc/pwdinteract \
|
||||
sdext/source/pdfimport/odf/odfemitter \
|
||||
sdext/source/pdfimport/pdfiadaptor \
|
||||
sdext/source/pdfimport/pdfparse/pdfentries \
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
|
||||
#include "filterdet.hxx"
|
||||
#include "inc/pdfihelper.hxx"
|
||||
#include "inc/pdfparse.hxx"
|
||||
|
||||
#include <osl/file.h>
|
||||
@@ -38,6 +37,7 @@
|
||||
#include <comphelper/diagnose_ex.hxx>
|
||||
#include <tools/stream.hxx>
|
||||
#include <vcl/filter/PDFiumLibrary.hxx>
|
||||
#include <vcl/pdf/pwdinteract.hxx>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <string.h>
|
||||
@@ -366,7 +366,7 @@ uno::Reference<io::XStream> getEmbeddedFile(const OUString& rInPDFFileURL,
|
||||
if (bMayUseUI && xIntHdl.is())
|
||||
{
|
||||
OUString aDocName(rInPDFFileURL.copy(rInPDFFileURL.lastIndexOf('/') + 1));
|
||||
bAgain = getPassword(xIntHdl, io_rPwd, !bAgain, aDocName);
|
||||
bAgain = vcl::pdf::getPassword(xIntHdl, io_rPwd, !bAgain, aDocName);
|
||||
SAL_INFO("sdext.pdfimport", "getEmbeddedFile pdfium Pass result: " << bAgain);
|
||||
continue;
|
||||
}
|
||||
@@ -812,7 +812,7 @@ uno::Reference< io::XStream > getAdditionalStream( const OUString&
|
||||
bool bEntered = false;
|
||||
do
|
||||
{
|
||||
bEntered = getPassword( xIntHdl, io_rPwd, ! bEntered, aDocName );
|
||||
bEntered = vcl::pdf::getPassword( xIntHdl, io_rPwd, ! bEntered, aDocName );
|
||||
OString aIsoPwd = OUStringToOString( io_rPwd,
|
||||
RTL_TEXTENCODING_ISO_8859_1 );
|
||||
bAuthenticated = pPDFFile->setupDecryptionData( aIsoPwd );
|
||||
|
||||
@@ -214,15 +214,6 @@ namespace pdfi
|
||||
return seed;
|
||||
}
|
||||
};
|
||||
|
||||
/** retrieve password from user
|
||||
*/
|
||||
bool getPassword( const css::uno::Reference<
|
||||
css::task::XInteractionHandler >& xHandler,
|
||||
OUString& rOutPwd,
|
||||
bool bFirstTry,
|
||||
const OUString& rDocName
|
||||
);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include <config_folders.h>
|
||||
|
||||
#include <contentsink.hxx>
|
||||
#include <pdfihelper.hxx>
|
||||
#include <wrapper.hxx>
|
||||
|
||||
#include <o3tl/string_view.hxx>
|
||||
@@ -54,6 +53,7 @@
|
||||
|
||||
#include <vcl/metric.hxx>
|
||||
#include <vcl/font.hxx>
|
||||
#include <vcl/pdf/pwdinteract.hxx>
|
||||
#include <vcl/virdev.hxx>
|
||||
|
||||
#include <cstddef>
|
||||
@@ -1137,7 +1137,7 @@ bool xpdf_ImportFromFile(const OUString& rURL,
|
||||
// already got one (e.g. if the hybrid detect prompted for one)
|
||||
if (!bPasswordOnEntry)
|
||||
{
|
||||
bEntered = getPassword(xIHdl, aPwd, !bEntered, aDocName);
|
||||
bEntered = vcl::pdf::getPassword(xIHdl, aPwd, !bEntered, aDocName);
|
||||
if (!bEntered)
|
||||
{
|
||||
// User cancelled password input
|
||||
|
||||
@@ -9977,7 +9977,6 @@ sdext/source/pdfimport/inc/treevisitorfactory.hxx
|
||||
sdext/source/pdfimport/inc/wrapper.hxx
|
||||
sdext/source/pdfimport/inc/xmlemitter.hxx
|
||||
sdext/source/pdfimport/misc/pdfihelper.cxx
|
||||
sdext/source/pdfimport/misc/pwdinteract.cxx
|
||||
sdext/source/pdfimport/odf/odfemitter.cxx
|
||||
sdext/source/pdfimport/pdfiadaptor.cxx
|
||||
sdext/source/pdfimport/pdfiadaptor.hxx
|
||||
@@ -14768,6 +14767,7 @@ vcl/source/outdev/textline.cxx
|
||||
vcl/source/outdev/transparent.cxx
|
||||
vcl/source/outdev/vclreferencebase.cxx
|
||||
vcl/source/outdev/wallpaper.cxx
|
||||
vcl/source/pdf/pwdinteract.cxx
|
||||
vcl/source/text/ImplLayoutRuns.cxx
|
||||
vcl/source/text/textlayout.cxx
|
||||
vcl/source/toolkit/group.cxx
|
||||
|
||||
@@ -566,6 +566,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
|
||||
vcl/source/pdf/PDFEncryptor \
|
||||
vcl/source/pdf/PDFEncryptorR6 \
|
||||
vcl/source/pdf/PdfConfig \
|
||||
vcl/source/pdf/pwdinteract \
|
||||
vcl/source/pdf/ResourceDict \
|
||||
vcl/source/pdf/Matrix3 \
|
||||
vcl/source/pdf/XmpMetadata \
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include <cassert>
|
||||
#include <mutex>
|
||||
|
||||
#include <pdfihelper.hxx>
|
||||
#include <vcl/pdf/pwdinteract.hxx>
|
||||
|
||||
#include <com/sun/star/task/ErrorCodeRequest.hpp>
|
||||
#include <com/sun/star/task/XInteractionHandler.hpp>
|
||||
@@ -117,7 +117,7 @@ void PDFPasswordRequest::select()
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace pdfi
|
||||
namespace vcl::pdf
|
||||
{
|
||||
|
||||
bool getPassword( const uno::Reference< task::XInteractionHandler >& xHandler,
|
||||
Reference in New Issue
Block a user