LibreOffice Module sdext (master) 1
filterdet.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20
21#include "filterdet.hxx"
22#include "inc/pdfihelper.hxx"
23#include "inc/pdfparse.hxx"
24
25#include <osl/file.h>
26#include <osl/thread.h>
27#include <rtl/digest.h>
28#include <sal/log.hxx>
29#include <com/sun/star/io/IOException.hpp>
30#include <com/sun/star/io/XInputStream.hpp>
31#include <com/sun/star/io/XStream.hpp>
32#include <com/sun/star/io/XSeekable.hpp>
33#include <com/sun/star/io/TempFile.hpp>
34#include <com/sun/star/task/XInteractionHandler.hpp>
36#include <comphelper/hash.hxx>
39#include <memory>
40#include <utility>
41#include <string.h>
42
43using namespace com::sun::star;
44
45namespace pdfi
46{
47
48// TODO(T3): locking/thread safety
49
50namespace {
51
52class FileEmitContext : public pdfparse::EmitContext
53{
54private:
55 oslFileHandle m_aReadHandle;
56 unsigned int m_nReadLen;
57 uno::Reference< io::XStream > m_xContextStream;
58 uno::Reference< io::XSeekable > m_xSeek;
59 uno::Reference< io::XOutputStream > m_xOut;
60
61public:
62 FileEmitContext( const OUString& rOrigFile,
63 const uno::Reference< uno::XComponentContext >& xContext,
64 const pdfparse::PDFContainer* pTop );
65 virtual ~FileEmitContext() override;
66
67 virtual bool write( const void* pBuf, unsigned int nLen ) override;
68 virtual unsigned int getCurPos() override;
69 virtual bool copyOrigBytes( unsigned int nOrigOffset, unsigned int nLen ) override;
70 virtual unsigned int readOrigBytes( unsigned int nOrigOffset, unsigned int nLen, void* pBuf ) override;
71
72 const uno::Reference< io::XStream >& getContextStream() const { return m_xContextStream; }
73};
74
75}
76
77FileEmitContext::FileEmitContext( const OUString& rOrigFile,
78 const uno::Reference< uno::XComponentContext >& xContext,
79 const pdfparse::PDFContainer* pTop ) :
80 pdfparse::EmitContext( pTop ),
81 m_aReadHandle(nullptr),
82 m_nReadLen(0)
83{
84 m_xContextStream.set( io::TempFile::create(xContext), uno::UNO_QUERY_THROW );
85 m_xOut = m_xContextStream->getOutputStream();
86 m_xSeek.set(m_xOut, uno::UNO_QUERY_THROW );
87
88 if( osl_openFile( rOrigFile.pData,
90 osl_File_OpenFlag_Read ) == osl_File_E_None )
91 {
92 oslFileError aErr = osl_setFilePos( m_aReadHandle, osl_Pos_End, 0 );
93 if( aErr == osl_File_E_None )
94 {
95 sal_uInt64 nFileSize = 0;
96 if( (aErr=osl_getFilePos( m_aReadHandle,
97 &nFileSize )) == osl_File_E_None )
98 {
99 m_nReadLen = static_cast<unsigned int>(nFileSize);
100 }
101 }
102 if( aErr != osl_File_E_None )
103 {
104 osl_closeFile( m_aReadHandle );
105 m_aReadHandle = nullptr;
106 }
107 }
108 m_bDeflate = true;
109}
110
111FileEmitContext::~FileEmitContext()
112{
113 if( m_aReadHandle )
114 osl_closeFile( m_aReadHandle );
115}
116
117bool FileEmitContext::write( const void* pBuf, unsigned int nLen )
118{
119 if( ! m_xOut.is() )
120 return false;
121
122 uno::Sequence< sal_Int8 > aSeq( nLen );
123 memcpy( aSeq.getArray(), pBuf, nLen );
124 m_xOut->writeBytes( aSeq );
125 return true;
126}
127
128unsigned int FileEmitContext::getCurPos()
129{
130 unsigned int nPos = 0;
131 if( m_xSeek.is() )
132 {
133 nPos = static_cast<unsigned int>( m_xSeek->getPosition() );
134 }
135 return nPos;
136}
137
138bool FileEmitContext::copyOrigBytes( unsigned int nOrigOffset, unsigned int nLen )
139{
140 if( nOrigOffset + nLen > m_nReadLen )
141 return false;
142
143 if( osl_setFilePos( m_aReadHandle, osl_Pos_Absolut, nOrigOffset ) != osl_File_E_None )
144 return false;
145
146 uno::Sequence< sal_Int8 > aSeq( nLen );
147
148 sal_uInt64 nBytesRead = 0;
149 if( osl_readFile( m_aReadHandle,
150 aSeq.getArray(),
151 nLen,
152 &nBytesRead ) != osl_File_E_None
153 || nBytesRead != static_cast<sal_uInt64>(nLen) )
154 {
155 return false;
156 }
157
158 m_xOut->writeBytes( aSeq );
159 return true;
160}
161
162unsigned int FileEmitContext::readOrigBytes( unsigned int nOrigOffset, unsigned int nLen, void* pBuf )
163{
164 if( nOrigOffset + nLen > m_nReadLen )
165 return 0;
166
167 if( osl_setFilePos( m_aReadHandle,
168 osl_Pos_Absolut,
169 nOrigOffset ) != osl_File_E_None )
170 {
171 return 0;
172 }
173
174 sal_uInt64 nBytesRead = 0;
175 if( osl_readFile( m_aReadHandle,
176 pBuf,
177 nLen,
178 &nBytesRead ) != osl_File_E_None )
179 {
180 return 0;
181 }
182 return static_cast<unsigned int>(nBytesRead);
183}
184
185
186PDFDetector::PDFDetector( uno::Reference< uno::XComponentContext > xContext) :
188 m_xContext(std::move( xContext ))
189{}
190
191// XExtendedFilterDetection
192OUString SAL_CALL PDFDetector::detect( uno::Sequence< beans::PropertyValue >& rFilterData )
193{
194 osl::MutexGuard const guard( m_aMutex );
195 bool bSuccess = false;
196
197 // get the InputStream carrying the PDF content
198 uno::Reference< io::XInputStream > xInput;
199 uno::Reference< io::XStream > xEmbedStream;
200 OUString aOutFilterName, aOutTypeName;
201 OUString aURL;
202 OUString aPwd;
203 const beans::PropertyValue* pAttribs = rFilterData.getConstArray();
204 sal_Int32 nAttribs = rFilterData.getLength();
205 sal_Int32 nFilterNamePos = -1;
206 sal_Int32 nPwdPos = -1;
207 for( sal_Int32 i = 0; i < nAttribs; i++ )
208 {
209 OUString aVal( "<no string>" );
210 pAttribs[i].Value >>= aVal;
211 SAL_INFO( "sdext.pdfimport", "doDetection: Attrib: " + pAttribs[i].Name + " = " + aVal);
212
213 if ( pAttribs[i].Name == "InputStream" )
214 pAttribs[i].Value >>= xInput;
215 else if ( pAttribs[i].Name == "URL" )
216 pAttribs[i].Value >>= aURL;
217 else if ( pAttribs[i].Name == "FilterName" )
218 nFilterNamePos = i;
219 else if ( pAttribs[i].Name == "Password" )
220 {
221 nPwdPos = i;
222 pAttribs[i].Value >>= aPwd;
223 }
224 }
225 if( xInput.is() )
226 {
227 oslFileHandle aFile = nullptr;
228 try {
229 uno::Reference< io::XSeekable > xSeek( xInput, uno::UNO_QUERY );
230 if( xSeek.is() )
231 xSeek->seek( 0 );
232 // read the first 1024 byte (see PDF reference implementation note 12)
233 const sal_Int32 nHeaderSize = 1024;
234 uno::Sequence< sal_Int8 > aBuf( nHeaderSize );
235 sal_uInt64 nBytes = xInput->readBytes( aBuf, nHeaderSize );
236 if( nBytes > 5 )
237 {
238 const sal_Int8* pBytes = aBuf.getConstArray();
239 for( sal_uInt64 i = 0; i < nBytes-5; i++ )
240 {
241 if( pBytes[i] == '%' &&
242 pBytes[i+1] == 'P' &&
243 pBytes[i+2] == 'D' &&
244 pBytes[i+3] == 'F' &&
245 pBytes[i+4] == '-' )
246 {
247 bSuccess = true;
248 break;
249 }
250 }
251 }
252
253 // check for hybrid PDF
254 if( bSuccess &&
255 ( aURL.isEmpty() || !comphelper::isFileUrl(aURL) )
256 )
257 {
258 sal_uInt64 nWritten = 0;
259 if( osl_createTempFile( nullptr, &aFile, &aURL.pData ) != osl_File_E_None )
260 {
261 bSuccess = false;
262 }
263 else
264 {
265 SAL_INFO( "sdext.pdfimport", "created temp file " + aURL );
266
267 osl_writeFile( aFile, aBuf.getConstArray(), nBytes, &nWritten );
268
269 SAL_WARN_IF( nWritten != nBytes, "sdext.pdfimport", "writing of header bytes failed" );
270
271 if( nWritten == nBytes )
272 {
273 const sal_uInt32 nBufSize = 4096;
274 aBuf = uno::Sequence<sal_Int8>(nBufSize);
275 // copy the bytes
276 do
277 {
278 nBytes = xInput->readBytes( aBuf, nBufSize );
279 if( nBytes > 0 )
280 {
281 osl_writeFile( aFile, aBuf.getConstArray(), nBytes, &nWritten );
282 if( nWritten != nBytes )
283 {
284 bSuccess = false;
285 break;
286 }
287 }
288 } while( nBytes == nBufSize );
289 }
290 }
291 osl_closeFile( aFile );
292 }
293 } catch (const css::io::IOException &) {
294 TOOLS_WARN_EXCEPTION("sdext.pdfimport", "caught");
295 return OUString();
296 }
297 OUString aEmbedMimetype;
298 xEmbedStream = getAdditionalStream( aURL, aEmbedMimetype, aPwd, m_xContext, rFilterData, false );
299 if( aFile )
300 osl_removeFile( aURL.pData );
301 if( !aEmbedMimetype.isEmpty() )
302 {
303 if( aEmbedMimetype == "application/vnd.oasis.opendocument.text"
304 || aEmbedMimetype == "application/vnd.oasis.opendocument.text-master" )
305 aOutFilterName = "writer_pdf_addstream_import";
306 else if ( aEmbedMimetype == "application/vnd.oasis.opendocument.presentation" )
307 aOutFilterName = "impress_pdf_addstream_import";
308 else if( aEmbedMimetype == "application/vnd.oasis.opendocument.graphics"
309 || aEmbedMimetype == "application/vnd.oasis.opendocument.drawing" )
310 aOutFilterName = "draw_pdf_addstream_import";
311 else if ( aEmbedMimetype == "application/vnd.oasis.opendocument.spreadsheet" )
312 aOutFilterName = "calc_pdf_addstream_import";
313 }
314 }
315
316 if( bSuccess )
317 {
318 if( !aOutFilterName.isEmpty() )
319 {
320 if( nFilterNamePos == -1 )
321 {
322 nFilterNamePos = nAttribs;
323 rFilterData.realloc( ++nAttribs );
324 rFilterData.getArray()[ nFilterNamePos ].Name = "FilterName";
325 }
326 auto pFilterData = rFilterData.getArray();
327 aOutTypeName = "pdf_Portable_Document_Format";
328
329 pFilterData[nFilterNamePos].Value <<= aOutFilterName;
330 if( xEmbedStream.is() )
331 {
332 rFilterData.realloc( ++nAttribs );
333 pFilterData = rFilterData.getArray();
334 pFilterData[nAttribs-1].Name = "EmbeddedSubstream";
335 pFilterData[nAttribs-1].Value <<= xEmbedStream;
336 }
337 if( !aPwd.isEmpty() )
338 {
339 if( nPwdPos == -1 )
340 {
341 nPwdPos = nAttribs;
342 rFilterData.realloc( ++nAttribs );
343 pFilterData = rFilterData.getArray();
344 pFilterData[ nPwdPos ].Name = "Password";
345 }
346 pFilterData[ nPwdPos ].Value <<= aPwd;
347 }
348 }
349 else
350 {
351 css::beans::PropertyValue* pFilterData;
352 if( nFilterNamePos == -1 )
353 {
354 nFilterNamePos = nAttribs;
355 rFilterData.realloc( ++nAttribs );
356 pFilterData = rFilterData.getArray();
357 pFilterData[ nFilterNamePos ].Name = "FilterName";
358 }
359 else
360 pFilterData = rFilterData.getArray();
361
362 const sal_Int32 nDocumentType = 0; //const sal_Int32 nDocumentType = queryDocumentTypeDialog(m_xContext,aURL);
363 if( nDocumentType < 0 )
364 {
365 return OUString();
366 }
367 else switch( nDocumentType )
368 {
369 case 0:
370 pFilterData[nFilterNamePos].Value <<= OUString( "draw_pdf_import" );
371 break;
372
373 case 1:
374 pFilterData[nFilterNamePos].Value <<= OUString( "impress_pdf_import" );
375 break;
376
377 case 2:
378 pFilterData[nFilterNamePos].Value <<= OUString( "writer_pdf_import" );
379 break;
380
381 default:
382 assert(!"Unexpected case");
383 }
384
385 aOutTypeName = "pdf_Portable_Document_Format";
386 }
387 }
388
389 return aOutTypeName;
390}
391
393{
394 return "org.libreoffice.comp.documents.PDFDetector";
395}
396
397sal_Bool PDFDetector::supportsService(OUString const & ServiceName)
398{
400}
401
402css::uno::Sequence<OUString> PDFDetector::getSupportedServiceNames()
403{
404 return {"com.sun.star.document.ImportFilter"};
405}
406
407bool checkDocChecksum( const OUString& rInPDFFileURL,
408 sal_uInt32 nBytes,
409 const OUString& rChkSum )
410{
411 if( rChkSum.getLength() != 2* RTL_DIGEST_LENGTH_MD5 )
412 {
413 SAL_INFO(
414 "sdext.pdfimport",
415 "checksum of length " << rChkSum.getLength() << ", expected "
416 << 2*RTL_DIGEST_LENGTH_MD5);
417 return false;
418 }
419
420 // prepare checksum to test
421 sal_uInt8 nTestChecksum[ RTL_DIGEST_LENGTH_MD5 ];
422 const sal_Unicode* pChar = rChkSum.getStr();
423 for(sal_uInt8 & rn : nTestChecksum)
424 {
425 sal_uInt8 nByte = sal_uInt8( ( (*pChar >= '0' && *pChar <= '9') ? *pChar - '0' :
426 ( (*pChar >= 'A' && *pChar <= 'F') ? *pChar - 'A' + 10 :
427 ( (*pChar >= 'a' && *pChar <= 'f') ? *pChar - 'a' + 10 :
428 0 ) ) ) );
429 nByte <<= 4;
430 pChar++;
431 nByte |= ( (*pChar >= '0' && *pChar <= '9') ? *pChar - '0' :
432 ( (*pChar >= 'A' && *pChar <= 'F') ? *pChar - 'A' + 10 :
433 ( (*pChar >= 'a' && *pChar <= 'f') ? *pChar - 'a' + 10 :
434 0 ) ) );
435 pChar++;
436 rn = nByte;
437 }
438
439 // open file and calculate actual checksum up to index nBytes
440 ::std::vector<unsigned char> nChecksum;
441 ::comphelper::Hash aDigest(::comphelper::HashType::MD5);
442 oslFileHandle aRead = nullptr;
443 if( osl_openFile(rInPDFFileURL.pData,
444 &aRead,
445 osl_File_OpenFlag_Read ) == osl_File_E_None )
446 {
447 sal_uInt8 aBuf[4096];
448 sal_uInt32 nCur = 0;
449 sal_uInt64 nBytesRead = 0;
450 while( nCur < nBytes )
451 {
452 sal_uInt32 nPass = std::min<sal_uInt32>(nBytes - nCur, sizeof( aBuf ));
453 if( osl_readFile( aRead, aBuf, nPass, &nBytesRead) != osl_File_E_None
454 || nBytesRead == 0 )
455 {
456 break;
457 }
458 nPass = static_cast<sal_uInt32>(nBytesRead);
459 nCur += nPass;
460 aDigest.update(aBuf, nPass);
461 }
462
463 nChecksum = aDigest.finalize();
464 osl_closeFile( aRead );
465 }
466
467 // compare the contents
468 return nChecksum.size() == RTL_DIGEST_LENGTH_MD5
469 && (0 == memcmp(nChecksum.data(), nTestChecksum, nChecksum.size()));
470}
471
472uno::Reference< io::XStream > getAdditionalStream( const OUString& rInPDFFileURL,
473 OUString& rOutMimetype,
474 OUString& io_rPwd,
475 const uno::Reference<uno::XComponentContext>& xContext,
476 const uno::Sequence<beans::PropertyValue>& rFilterData,
477 bool bMayUseUI )
478{
479 uno::Reference< io::XStream > xEmbed;
480 OString aPDFFile;
481 OUString aSysUPath;
482 if( osl_getSystemPathFromFileURL( rInPDFFileURL.pData, &aSysUPath.pData ) != osl_File_E_None )
483 return xEmbed;
484 aPDFFile = OUStringToOString( aSysUPath, osl_getThreadTextEncoding() );
485
486 std::unique_ptr<pdfparse::PDFEntry> pEntry( pdfparse::PDFReader::read( aPDFFile.getStr() ));
487 if( pEntry )
488 {
489 pdfparse::PDFFile* pPDFFile = dynamic_cast<pdfparse::PDFFile*>(pEntry.get());
490 if( pPDFFile )
491 {
492 unsigned int nElements = pPDFFile->m_aSubElements.size();
493 while( nElements-- > 0 )
494 {
495 pdfparse::PDFTrailer* pTrailer = dynamic_cast<pdfparse::PDFTrailer*>(pPDFFile->m_aSubElements[nElements].get());
496 if( pTrailer && pTrailer->m_pDict )
497 {
498 // search document checksum entry
499 auto chk = pTrailer->m_pDict->m_aMap.find( "DocChecksum" );
500 if( chk == pTrailer->m_pDict->m_aMap.end() )
501 {
502 SAL_INFO( "sdext.pdfimport", "no DocChecksum entry" );
503 continue;
504 }
505 pdfparse::PDFName* pChkSumName = dynamic_cast<pdfparse::PDFName*>(chk->second);
506 if( pChkSumName == nullptr )
507 {
508 SAL_INFO( "sdext.pdfimport", "no name for DocChecksum entry" );
509 continue;
510 }
511
512 // search for AdditionalStreams entry
513 auto add_stream = pTrailer->m_pDict->m_aMap.find( "AdditionalStreams" );
514 if( add_stream == pTrailer->m_pDict->m_aMap.end() )
515 {
516 SAL_INFO( "sdext.pdfimport", "no AdditionalStreams entry" );
517 continue;
518 }
519 pdfparse::PDFArray* pStreams = dynamic_cast<pdfparse::PDFArray*>(add_stream->second);
520 if( ! pStreams || pStreams->m_aSubElements.size() < 2 )
521 {
522 SAL_INFO( "sdext.pdfimport", "AdditionalStreams array too small" );
523 continue;
524 }
525
526 // check checksum
527 OUString aChkSum = pChkSumName->getFilteredName();
528 if( ! checkDocChecksum( rInPDFFileURL, pTrailer->m_nOffset, aChkSum ) )
529 continue;
530
531 // extract addstream and mimetype
532 pdfparse::PDFName* pMimeType = dynamic_cast<pdfparse::PDFName*>(pStreams->m_aSubElements[0].get());
533 pdfparse::PDFObjectRef* pStreamRef = dynamic_cast<pdfparse::PDFObjectRef*>(pStreams->m_aSubElements[1].get());
534
535 SAL_WARN_IF( !pMimeType, "sdext.pdfimport", "error: no mimetype element" );
536 SAL_WARN_IF( !pStreamRef, "sdext.pdfimport", "error: no stream ref element" );
537
538 if( pMimeType && pStreamRef )
539 {
540 pdfparse::PDFObject* pObject = pPDFFile->findObject( pStreamRef->m_nNumber, pStreamRef->m_nGeneration );
541 SAL_WARN_IF( !pObject, "sdext.pdfimport", "object not found" );
542 if( pObject )
543 {
544 if( pPDFFile->isEncrypted() )
545 {
546 bool bAuthenticated = false;
547 if( !io_rPwd.isEmpty() )
548 {
549 OString aIsoPwd = OUStringToOString( io_rPwd,
550 RTL_TEXTENCODING_ISO_8859_1 );
551 bAuthenticated = pPDFFile->setupDecryptionData( aIsoPwd.getStr() );
552 }
553 if( ! bAuthenticated )
554 {
555 uno::Reference< task::XInteractionHandler > xIntHdl;
556 for( const beans::PropertyValue& rAttrib : rFilterData )
557 {
558 if ( rAttrib.Name == "InteractionHandler" )
559 rAttrib.Value >>= xIntHdl;
560 }
561 if( ! bMayUseUI || ! xIntHdl.is() )
562 {
563 rOutMimetype = pMimeType->getFilteredName();
564 xEmbed.clear();
565 break;
566 }
567
568 OUString aDocName( rInPDFFileURL.copy( rInPDFFileURL.lastIndexOf( '/' )+1 ) );
569
570 bool bEntered = false;
571 do
572 {
573 bEntered = getPassword( xIntHdl, io_rPwd, ! bEntered, aDocName );
574 OString aIsoPwd = OUStringToOString( io_rPwd,
575 RTL_TEXTENCODING_ISO_8859_1 );
576 bAuthenticated = pPDFFile->setupDecryptionData( aIsoPwd.getStr() );
577 } while( bEntered && ! bAuthenticated );
578 }
579
580 if( ! bAuthenticated )
581 continue;
582 }
583 rOutMimetype = pMimeType->getFilteredName();
584 FileEmitContext aContext( rInPDFFileURL,
585 xContext,
586 pPDFFile );
587 aContext.m_bDecrypt = pPDFFile->isEncrypted();
588 pObject->writeStream( aContext, pPDFFile );
589 xEmbed = aContext.getContextStream();
590 break; // success
591 }
592 }
593 }
594 }
595 }
596 }
597
598 return xEmbed;
599}
600
601
602extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
604 css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&)
605{
606 return cppu::acquire(new PDFDetector(context));
607}
608
609}
610
611/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::vector< unsigned char > finalize()
void update(const unsigned char *pInput, size_t length)
mutable::osl::Mutex m_aMutex
OUString SAL_CALL getImplementationName() override
Definition: filterdet.cxx:392
virtual OUString SAL_CALL detect(css::uno::Sequence< css::beans::PropertyValue > &io_rDescriptor) override
Definition: filterdet.cxx:192
css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: filterdet.cxx:402
sal_Bool SAL_CALL supportsService(OUString const &ServiceName) override
Definition: filterdet.cxx:397
css::uno::Reference< css::uno::XComponentContext > m_xContext
Definition: filterdet.hxx:42
sal_Int32 nElements
#define TOOLS_WARN_EXCEPTION(area, stream)
URL aURL
EmbeddedObjectRef * pObject
unsigned int m_nReadLen
Definition: filterdet.cxx:56
uno::Reference< io::XStream > m_xContextStream
Definition: filterdet.cxx:57
uno::Reference< io::XOutputStream > m_xOut
Definition: filterdet.cxx:59
oslFileHandle m_aReadHandle
Definition: filterdet.cxx:55
uno::Reference< io::XSeekable > m_xSeek
Definition: filterdet.cxx:58
std::mutex m_aMutex
sal_uInt16 nPos
Sequence< sal_Int8 > aSeq
#define SAL_WARN_IF(condition, area, stream)
#define SAL_INFO(area, stream)
aBuf
COMPHELPER_DLLPUBLIC bool isFileUrl(OUString const &url)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
int i
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * sdext_PDFDetector_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
Definition: filterdet.cxx:603
bool checkDocChecksum(const OUString &rInPDFFileURL, sal_uInt32 nBytes, const OUString &rChkSum)
Definition: filterdet.cxx:407
uno::Reference< io::XStream > getAdditionalStream(const OUString &rInPDFFileURL, OUString &rOutMimetype, OUString &io_rPwd, const uno::Reference< uno::XComponentContext > &xContext, const uno::Sequence< beans::PropertyValue > &rFilterData, bool bMayUseUI)
Definition: filterdet.cxx:472
::cppu::WeakComponentImplHelper< css::document::XExtendedFilterDetection, css::lang::XServiceInfo > PDFDetectorBase
Definition: filterdet.hxx:35
bool getPassword(const css::uno::Reference< css::task::XInteractionHandler > &xHandler, OUString &rOutPwd, bool bFirstTry, const OUString &rDocName)
retrieve password from user
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
PDFObject * findObject(unsigned int nNumber, unsigned int nGeneration) const
Definition: pdfentries.cxx:475
std::vector< std::unique_ptr< PDFEntry > > m_aSubElements
Definition: pdfparse.hxx:162
bool setupDecryptionData(const OString &rPwd) const
bool isEncrypted() const
OUString getFilteredName() const
Definition: pdfentries.cxx:157
unsigned int m_nNumber
Definition: pdfparse.hxx:140
unsigned int m_nGeneration
Definition: pdfparse.hxx:141
static std::unique_ptr< PDFEntry > read(const char *pFileName)
Definition: pdfparse.cxx:609
OUString Name
unsigned char sal_uInt8
unsigned char sal_Bool
sal_uInt16 sal_Unicode
signed char sal_Int8
const uno::Reference< uno::XComponentContext > m_xContext
Definition: wrapper.cxx:144
const char * pChar