]>
Commit | Line | Data |
---|---|---|
ec97da6f JB |
1 | --- libreoffice-7.2.6.2/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx.orig 2022-03-03 14:25:45.000000000 +0100 |
2 | +++ libreoffice-7.2.6.2/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx 2022-04-19 20:30:14.031282962 +0200 | |
3 | @@ -115,6 +115,21 @@ int main(int argc, char **argv) | |
4 | } | |
5 | ||
6 | // PDFDoc takes over ownership for all strings below | |
7 | +#if POPPLER_CHECK_VERSION(22, 3, 0) | |
8 | + auto pFileName = std::make_unique<GooString>(argv[1]); | |
9 | + auto pErrFileName = std::make_unique<GooString>(argv[2]); | |
10 | + | |
11 | + // check for password string(s) | |
12 | + std::optional<GooString> pOwnerPasswordStr, pUserPasswordStr; | |
13 | + if( aPwBuf[0] != 0 ) | |
14 | + pOwnerPasswordStr = GooString(aPwBuf); | |
15 | + else if( ownerPassword[0] != '\001' ) | |
16 | + pOwnerPasswordStr = GooString(ownerPassword); | |
17 | + if( aPwBuf[0] != 0 ) | |
18 | + pUserPasswordStr = GooString(aPwBuf); | |
19 | + else if( userPassword[0] != '\001' ) | |
20 | + pUserPasswordStr = GooString(userPassword); | |
21 | +#else | |
22 | GooString* pFileName = new GooString(argv[1]); | |
23 | GooString* pErrFileName = new GooString(argv[2]); | |
24 | ||
25 | @@ -129,6 +144,7 @@ int main(int argc, char **argv) | |
26 | : (userPassword[0] != '\001' | |
27 | ? new GooString(userPassword) | |
28 | : nullptr ) ); | |
29 | +#endif | |
30 | if( outputFile[0] != '\001' ) | |
31 | g_binary_out = fopen(outputFile,"wb"); | |
32 | ||
33 | @@ -138,6 +154,15 @@ int main(int argc, char **argv) | |
34 | _setmode( _fileno( g_binary_out ), _O_BINARY ); | |
35 | #endif | |
36 | ||
37 | +#if POPPLER_CHECK_VERSION(22, 3, 0) | |
38 | + PDFDoc aDoc( std::move(pFileName), | |
39 | + pOwnerPasswordStr, | |
40 | + pUserPasswordStr ); | |
41 | + | |
42 | + PDFDoc aErrDoc( std::move(pErrFileName), | |
43 | + pOwnerPasswordStr, | |
44 | + pUserPasswordStr ); | |
45 | +#else | |
46 | PDFDoc aDoc( pFileName, | |
47 | pOwnerPasswordStr, | |
48 | pUserPasswordStr ); | |
49 | @@ -145,6 +170,7 @@ int main(int argc, char **argv) | |
50 | PDFDoc aErrDoc( pErrFileName, | |
51 | pOwnerPasswordStr, | |
52 | pUserPasswordStr ); | |
53 | +#endif | |
54 | ||
55 | // Check various permissions for aDoc. | |
56 | PDFDoc &rDoc = aDoc.isOk()? aDoc: aErrDoc; | |
57 | --- libreoffice-7.2.6.2/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx.orig 2022-03-03 14:25:45.000000000 +0100 | |
58 | +++ libreoffice-7.2.6.2/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx 2022-04-19 19:53:39.226719292 +0200 | |
59 | @@ -147,8 +147,13 @@ namespace pdfi | |
60 | std::unique_ptr<UnicodeMap> m_pUtf8Map; | |
61 | bool m_bSkipImages; | |
62 | ||
63 | +#if POPPLER_CHECK_VERSION(22, 4, 0) | |
64 | + int parseFont( long long nNewId, std::shared_ptr<GfxFont> pFont, GfxState* state ) const; | |
65 | + void writeFontFile( std::shared_ptr<GfxFont> gfxFont ) const; | |
66 | +#else | |
67 | int parseFont( long long nNewId, GfxFont* pFont, GfxState* state ) const; | |
68 | void writeFontFile( GfxFont* gfxFont ) const; | |
69 | +#endif | |
70 | #if POPPLER_CHECK_VERSION(0, 83, 0) | |
71 | static void printPath( const GfxPath* pPath ); | |
72 | #else | |
73 | --- libreoffice-7.2.6.2/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx.orig 2022-03-03 14:25:45.000000000 +0100 | |
74 | +++ libreoffice-7.2.6.2/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx 2022-04-19 19:58:44.165967063 +0200 | |
75 | @@ -427,7 +427,11 @@ static void writeMaskLF( OutputBuffer& | |
76 | bool bInvert ) { writeMask_(o_rOutputBuf,str,width,height,bInvert); } | |
77 | ||
78 | ||
79 | +#if POPPLER_CHECK_VERSION(22, 4, 0) | |
80 | +int PDFOutDev::parseFont( long long nNewId, std::shared_ptr<GfxFont> gfxFont, GfxState* state ) const | |
81 | +#else | |
82 | int PDFOutDev::parseFont( long long nNewId, GfxFont* gfxFont, GfxState* state ) const | |
83 | +#endif | |
84 | { | |
85 | FontAttributes aNewFont; | |
86 | int nSize = 0; | |
87 | @@ -461,23 +465,49 @@ int PDFOutDev::parseFont( long long nNew | |
88 | { | |
89 | // TODO(P3): Unfortunately, need to read stream twice, since | |
90 | // we must write byte count to stdout before | |
91 | +#if POPPLER_CHECK_VERSION(22, 4, 0) | |
92 | + auto buf = gfxFont->readEmbFontFile( m_pDoc->getXRef() ); | |
93 | + if( buf ) | |
94 | + { | |
95 | + aNewFont.isEmbedded = true; | |
96 | + nSize = buf->size(); | |
97 | + } | |
98 | +#else | |
99 | char* pBuf = gfxFont->readEmbFontFile( m_pDoc->getXRef(), &nSize ); | |
100 | if( pBuf ) | |
101 | { | |
102 | aNewFont.isEmbedded = true; | |
103 | gfree(pBuf); | |
104 | } | |
105 | +#endif | |
106 | } | |
107 | ||
108 | m_aFontMap[ nNewId ] = aNewFont; | |
109 | return nSize; | |
110 | } | |
111 | ||
112 | +#if POPPLER_CHECK_VERSION(22, 4, 0) | |
113 | +void PDFOutDev::writeFontFile( std::shared_ptr<GfxFont> gfxFont ) const | |
114 | +#else | |
115 | void PDFOutDev::writeFontFile( GfxFont* gfxFont ) const | |
116 | +#endif | |
117 | { | |
118 | if( gfxFont->getType() != fontTrueType && gfxFont->getType() != fontType1 ) | |
119 | return; | |
120 | ||
121 | +#if POPPLER_CHECK_VERSION(22, 4, 0) | |
122 | + auto buf = gfxFont->readEmbFontFile( m_pDoc->getXRef() ); | |
123 | + if( !buf ) | |
124 | + return; | |
125 | + | |
126 | + // ---sync point--- see SYNC STREAMS above | |
127 | + fflush(stdout); | |
128 | + | |
129 | + if( fwrite(buf->data(), 1, buf->size(), g_binary_out) != buf->size() ) | |
130 | + exit(1); // error | |
131 | + // ---sync point--- see SYNC STREAMS above | |
132 | + fflush(g_binary_out); | |
133 | +#else | |
134 | int nSize = 0; | |
135 | char* pBuf = gfxFont->readEmbFontFile( m_pDoc->getXRef(), &nSize ); | |
136 | if( !pBuf ) | |
137 | @@ -494,6 +524,7 @@ void PDFOutDev::writeFontFile( GfxFont* | |
138 | // ---sync point--- see SYNC STREAMS above | |
139 | fflush(g_binary_out); | |
140 | gfree(pBuf); | |
141 | +#endif | |
142 | } | |
143 | ||
144 | #if POPPLER_CHECK_VERSION(0, 83, 0) | |
145 | @@ -747,7 +778,11 @@ void PDFOutDev::updateFont(GfxState *sta | |
146 | { | |
147 | assert(state); | |
148 | ||
149 | +#if POPPLER_CHECK_VERSION(22, 4, 0) | |
150 | + auto gfxFont = state->getFont(); | |
151 | +#else | |
152 | GfxFont *gfxFont = state->getFont(); | |
153 | +#endif | |
154 | if( !gfxFont ) | |
155 | return; | |
156 |