25#include <rtl/ustrbuf.hxx>
28#include <osl/diagnose.h>
30#include <com/sun/star/beans/PropertyValue.hpp>
41 {
'A',
'B',
'C',
'D',
'E',
'F',
'G',
'H',
'I',
'J',
'K',
'L',
'M',
42 'N',
'O',
'P',
'Q',
'R',
'S',
'T',
'U',
'V',
'W',
'X',
'Y',
'Z',
43 'a',
'b',
'c',
'd',
'e',
'f',
'g',
'h',
'i',
'j',
'k',
'l',
'm',
44 'n',
'o',
'p',
'q',
'r',
's',
't',
'u',
'v',
'w',
'x',
'y',
'z',
45 '0',
'1',
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9',
'+',
'/' };
47OUString encodeBase64(
const sal_Int8* i_pBuffer,
const sal_Int32 i_nBufferLength )
49 OUStringBuffer
aBuf( (i_nBufferLength+1) * 4 / 3 );
50 const sal_Int32 nRemain(i_nBufferLength%3);
51 const sal_Int32 nFullTripleLength( i_nBufferLength - (i_nBufferLength%3));
52 sal_Int32 nBufPos( 0 );
53 for( sal_Int32 i = 0;
i < nFullTripleLength;
i += 3, nBufPos += 4 )
55 const sal_Int32 nBinary = (
static_cast<sal_uInt8>(i_pBuffer[
i + 0]) << 16) +
56 (
static_cast<sal_uInt8>(i_pBuffer[
i + 1]) << 8) +
76 sal_Int32 nBinary( 0 );
77 const sal_Int32 nStart(i_nBufferLength-nRemain);
80 case 1: nBinary =
static_cast<sal_uInt8>(i_pBuffer[nStart + 0]) << 16;
82 case 2: nBinary = (
static_cast<sal_uInt8>(i_pBuffer[nStart + 0]) << 16) +
83 (
static_cast<sal_uInt8>(i_pBuffer[nStart + 1]) << 8);
99 return aBuf.makeStringAndClear();
117 const uno::Sequence<beans::PropertyValue>& rEntry(
m_aImages[
nId] );
120 const beans::PropertyValue* pAry(rEntry.getConstArray());
121 const sal_Int32 nLen(rEntry.getLength());
122 const beans::PropertyValue* pValue(
123 std::find_if(pAry, pAry+nLen,
124 [] (beans::PropertyValue
const&
v) ->
bool {
125 return v.Name ==
"InputSequence";
128 if (pValue == pAry + nLen )
130 SAL_WARN(
"sdext.pdfimport",
"InputSequence not found");
134 uno::Sequence<sal_Int8>
aData;
135 if( !(pValue->Value >>=
aData) )
137 SAL_WARN(
"sdext.pdfimport",
"Wrong data type");
void writeBase64EncodedStream(ImageId nImageId, EmitContext &rContext)
std::vector< css::uno::Sequence< css::beans::PropertyValue > > m_aImages
ImageId addImage(const css::uno::Sequence< css::beans::PropertyValue > &xBitmap)
virtual void write(const OUString &rString)=0
Write PCTEXT as-is to output.
#define SAL_WARN(area, stream)
constexpr OUStringLiteral aData
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
const char aBase64EncodeTable[]