29#include <osl/diagnose.h>
43#include <rtl/character.hxx>
44#include <rtl/ustrbuf.hxx>
52double WTI(
double x) {
return x / 1800.; }
53double WTMM(
double x) {
return x / 1800. * 25.4; }
54int WTSM(
double x) {
return x / 1800. * 2540; }
56constexpr OUStringLiteral sBeginOfDoc(
u"[\uBB38\uC11C\uC758 \uCC98\uC74C]");
107 return hwpreader->importHStream(std::move(
stream));
126 mxList->addAttribute(
"xmlns:office",
"CDATA",
"http://openoffice.org/2000/office");
127 mxList->addAttribute(
"xmlns:style",
"CDATA",
"http://openoffice.org/2000/style");
128 mxList->addAttribute(
"xmlns:text",
"CDATA",
"http://openoffice.org/2000/text");
129 mxList->addAttribute(
"xmlns:table",
"CDATA",
"http://openoffice.org/2000/table");
130 mxList->addAttribute(
"xmlns:draw",
"CDATA",
"http://openoffice.org/2000/drawing");
131 mxList->addAttribute(
"xmlns:fo",
"CDATA",
"http://www.w3.org/1999/XSL/Format");
132 mxList->addAttribute(
"xmlns:xlink",
"CDATA",
"http://www.w3.org/1999/xlink");
133 mxList->addAttribute(
"xmlns:dc",
"CDATA",
"http://purl.org/dc/elements/1.1/");
134 mxList->addAttribute(
"xmlns:meta",
"CDATA",
"http://openoffice.org/2000/meta");
135 mxList->addAttribute(
"xmlns:number",
"CDATA",
"http://openoffice.org/2000/datastyle");
136 mxList->addAttribute(
"xmlns:svg",
"CDATA",
"http://www.w3.org/2000/svg");
137 mxList->addAttribute(
"xmlns:chart",
"CDATA",
"http://openoffice.org/2000/chart");
138 mxList->addAttribute(
"xmlns:dr3d",
"CDATA",
"http://openoffice.org/2000/dr3d");
139 mxList->addAttribute(
"xmlns:math",
"CDATA",
"http://www.w3.org/1998/Math/MathML");
140 mxList->addAttribute(
"xmlns:form",
"CDATA",
"http://openoffice.org/2000/form");
141 mxList->addAttribute(
"xmlns:script",
"CDATA",
"http://openoffice.org/2000/script");
152 endEl(
"office:document");
164 Reference< XInputStream > xInputStream(
169 sal_Int32 nRead, nTotal = 0;
172 nRead = xInputStream->readBytes(
aBuffer, 32768);
175 stream->addData(
reinterpret_cast<const byte *
>(
aBuffer.getConstArray()), nRead );
179 if( nTotal == 0 )
return false;
194 endEl(
"office:body");
204 startEl(
"text:sequence-decls");
209 endEl(
"text:sequence-decl");
214 endEl(
"text:sequence-decl");
219 endEl(
"text:sequence-decl");
224 endEl(
"text:sequence-decl");
225 endEl(
"text:sequence-decls");
255 startEl(
"meta:initial-creator");
257 endEl(
"meta:initial-creator");
265 if( rtl::isAsciiDigit( pDate[0] ) && rtl::isAsciiDigit( pDate[1] ) &&
266 rtl::isAsciiDigit( pDate[2] ) && rtl::isAsciiDigit( pDate[3] ))
268 year = (pDate[0]-0x30) * 1000 + (pDate[1]-0x30) * 100 +
269 (pDate[2]-0x30) * 10 + (pDate[3]-0x30);
274 if( rtl::isAsciiDigit( pDate[6] ))
276 if( rtl::isAsciiDigit( pDate[7] ) )
277 month = (pDate[6] - 0x30) * 10 + (pDate[6+ ++gab]-0x30);
279 month = (pDate[6] - 0x30);
284 if( rtl::isAsciiDigit( pDate[9 + gab] ) )
286 if( rtl::isAsciiDigit( pDate[10 + gab])) {
287 day = ( pDate[9 + gab] - 0x30 ) * 10 + (pDate[9+ gab + 1]-0x30);
290 day = (pDate[9+gab]-0x30);
295 if( rtl::isAsciiDigit( pDate[17 + gab] ) )
297 if( rtl::isAsciiDigit( pDate[18 + gab])) {
298 hour = ( pDate[17 + gab] - 0x30 ) * 10 + (pDate[17+ gab + 1]-0x30);
301 hour = (pDate[17+gab]-0x30);
306 if( rtl::isAsciiDigit( pDate[20 + gab] ) )
308 if( rtl::isAsciiDigit( pDate[21 + gab])) {
309 minute = ( pDate[20 + gab] - 0x30 ) * 10 + (pDate[20+ gab + 1]-0x30);
312 minute = (pDate[20+gab]-0x30);
320 chars( OUString::createFromAscii(
d->buf));
321 endEl(
"meta:creation-date");
331 endEl(
"meta:keyword");
337 endEl(
"meta:keyword");
343 endEl(
"meta:keyword");
349 endEl(
"meta:keyword");
355 endEl(
"meta:keyword");
357 endEl(
"meta:keywords");
359 endEl(
"office:meta");
372 {
"Line Arrow",
false },
407 hdo = hdo->
next.get();
430 endEl(
"draw:stroke-dash");
451 mxList->addAttribute(
"svg:d",
sXML_CDATA,
"m0 2108v17 17l12 42 30 34 38 21 43 4 29-8 30-21 25-26 13-34 343-1532 339 1520 13 42 29 34 39 21 42 4 42-12 34-30 21-42v-39-12l-4 4-440-1998-9-42-25-39-38-25-43-8-42 8-38 25-26 39-8 42z");
460 endEl(
"draw:marker");
477 mxList->addAttribute(
"svg:d",
sXML_CDATA,
"m0 2108v17 17l12 42 30 34 38 21 43 4 29-8 30-21 25-26 13-34 343-1532 339 1520 13 42 29 34 39 21 42 4 42-12 34-30 21-42v-39-12l-4 4-440-1998-9-42-25-39-38-25-43-8-42 8-38 25-26 39-8 42z");
486 endEl(
"draw:marker");
492 if( prop->
flag >> 18 & 0x01 )
514 endEl(
"office:binary-data");
516 endEl(
"draw:fill-image");
519 else if( prop->
flag >> 16 & 0x01 )
545 int default_color = 0xffffff;
579 auto normangle = prop->
angle % 360;
580 int angle = 1800 - normangle * 10;
585 endEl(
"draw:gradient");
620 hdo = hdo->
next.get();
652 for(
i = 1 ;
i < 40 ;
i++)
655 OUString::number( WTI(1000 *
i)) +
"inch");
658 endEl(
"style:tab-stop");
660 endEl(
"style:tab-stops");
661 endEl(
"style:properties");
663 endEl(
"style:style");
665 for (
int ii = 0; ii < hwpstyle.
Num(); ii++)
667 unsigned char *stylename =
reinterpret_cast<unsigned char *
>(hwpstyle.
GetName(ii));
681 endEl(
"style:properties");
683 endEl(
"style:style");
693 endEl(
"style:style");
704 endEl(
"style:style");
718 mxList->addAttribute(
"style:border-line-width-bottom",
sXML_CDATA,
"0.02cm 0.035cm 0.002cm");
720 mxList->addAttribute(
"fo:border-bottom",
sXML_CDATA,
"0.039cm double #808080");
726 endEl(
"style:properties");
727 endEl(
"style:style");
736 startEl(
"text:footnotes-configuration");
738 endEl(
"text:footnotes-configuration");
740 endEl(
"office:styles");
753 startEl(
"office:automatic-styles");
772 bool bIsLeft =
false, bIsMiddle =
false, bIsRight =
false;
795 for(
i = 1;
i <= 3 ;
i++ )
797 if(
i == 1 && !bIsLeft )
799 if(
i == 2 && !bIsMiddle )
801 if(
i == 3 && !bIsRight )
816 endEl(
"style:properties");
817 endEl(
"style:style");
841 endEl(
"style:properties");
842 endEl(
"style:style");
850 endEl(
"office:automatic-styles");
860 header_odd =
nullptr;
861 header_even =
nullptr;
863 footer_odd =
nullptr;
864 footer_even =
nullptr;
882 startEl(
"office:master-styles");
886 std::vector<PageSetting> aSet(nMax + 1);
958 PageSetting *pPrevSet =
nullptr;
959 PageSetting *pPage =
nullptr;
963 SAL_WARN(
"filter.hwp",
"too many pages: " << nMax <<
" clip to " << 512);
967 for(
i = 1;
i <= nMax ;
i++ )
976 mxList->addAttribute(
"style:next-style-name",
sXML_CDATA,
"p" + OUString::number(
i + 1));
977 mxList->addAttribute(
"draw:style-name",
sXML_CDATA,
"master" + OUString::number(
i));
983 if( !aSet[
i].pagenumber ){
984 if( pPrevSet && pPrevSet->pagenumber )
985 aSet[
i].pagenumber = pPrevSet->pagenumber;
987 if( aSet[
i].pagenumber )
989 if( aSet[
i].pagenumber->where == 7 && aSet[
i].header )
991 aSet[
i].header_even = aSet[
i].header;
992 aSet[
i].header_odd = aSet[
i].header;
993 aSet[
i].header =
nullptr;
995 if( aSet[
i].pagenumber->where == 8 && aSet[
i].footer )
997 aSet[
i].footer_even = aSet[
i].footer;
998 aSet[
i].footer_odd = aSet[
i].footer;
999 aSet[
i].footer =
nullptr;
1003 if( !aSet[
i].header_even && pPrevSet && pPrevSet->header_even )
1005 aSet[
i].header_even = pPrevSet->header_even;
1007 if( !aSet[
i].header_odd && pPrevSet && pPrevSet->header_odd )
1009 aSet[
i].header_odd = pPrevSet->header_odd;
1011 if( !aSet[
i].footer_even && pPrevSet && pPrevSet->footer_even )
1013 aSet[
i].footer_even = pPrevSet->footer_even;
1015 if( !aSet[
i].footer_odd && pPrevSet && pPrevSet->footer_odd )
1017 aSet[
i].footer_odd = pPrevSet->footer_odd;
1021 pPrevSet = &aSet[
i];
1034 endEl(
"style:header");
1041 endEl(
"style:footer");
1043 endEl(
"style:master-page");
1051 if( pPage->pagenumber && pPage->pagenumber->where < 4 )
1053 d->bInHeader =
true;
1054 d->pPn = pPage->pagenumber;
1056 if (!pPage->header->plist.empty())
1057 parsePara(pPage->header->plist.front().get());
1058 d->bInHeader =
false;
1060 endEl(
"style:header");
1062 if( pPage->header_even )
1065 if( pPage->pagenumber && ( pPage->pagenumber->where < 4
1066 || pPage->pagenumber->where == 7 ) )
1068 d->bInHeader =
true;
1069 d->pPn = pPage->pagenumber;
1072 if (!pPage->header_even->plist.empty())
1073 parsePara(pPage->header_even->plist.front().get());
1074 d->bInHeader =
false;
1077 endEl(
"style:header");
1080 else if (pPage->header_odd)
1086 if( pPage->pagenumber && ( pPage->pagenumber->where < 4 ||
1087 pPage->pagenumber->where == 7 ) )
1089 d->pPn = pPage->pagenumber;
1096 endEl(
"style:header");
1098 if( pPage->header_odd )
1101 if( pPage->pagenumber && ( pPage->pagenumber->where < 4
1102 || pPage->pagenumber->where == 7 ) )
1104 d->bInHeader =
true;
1106 d->pPn = pPage->pagenumber;
1108 if (!pPage->header_odd->plist.empty())
1109 parsePara(pPage->header_odd->plist.front().get());
1110 d->bInHeader =
false;
1113 endEl(
"style:header-left");
1116 else if (pPage->header_even)
1122 if( pPage->pagenumber && ( pPage->pagenumber->where < 4 ||
1123 pPage->pagenumber->where == 7 ) )
1125 d->pPn = pPage->pagenumber;
1132 endEl(
"style:header-left");
1134 if( !pPage->header && !pPage->header_even && !pPage->header_odd )
1140 if( pPage->pagenumber && (pPage->pagenumber->where < 4 ||
1141 pPage->pagenumber->where == 7 ) )
1143 d->pPn = pPage->pagenumber;
1148 endEl(
"style:header");
1154 if( pPage->pagenumber && pPage->pagenumber->where >= 4
1155 && pPage->pagenumber->where != 7 )
1157 d->bInHeader =
true;
1158 d->pPn = pPage->pagenumber;
1160 if (!pPage->footer->plist.empty())
1161 parsePara(pPage->footer->plist.front().get());
1162 d->bInHeader =
false;
1164 endEl(
"style:footer");
1166 if( pPage->footer_even )
1169 if( pPage->pagenumber && pPage->pagenumber->where >= 4
1170 && pPage->pagenumber->where != 7 )
1172 d->bInHeader =
true;
1173 d->pPn = pPage->pagenumber;
1176 if (!pPage->footer_even->plist.empty())
1177 parsePara(pPage->footer_even->plist.front().get());
1178 d->bInHeader =
false;
1181 endEl(
"style:footer");
1184 else if (pPage->footer_odd)
1190 if( pPage->pagenumber && pPage->pagenumber->where >= 4
1191 && pPage->pagenumber->where != 7 )
1193 d->pPn = pPage->pagenumber;
1200 endEl(
"style:footer");
1202 if( pPage->footer_odd )
1205 if( pPage->pagenumber && pPage->pagenumber->where >= 4
1206 && pPage->pagenumber->where != 7 )
1208 d->bInHeader =
true;
1209 d->pPn = pPage->pagenumber;
1212 if (!pPage->footer_odd->plist.empty())
1213 parsePara(pPage->footer_odd->plist.front().get());
1214 d->bInHeader =
false;
1217 endEl(
"style:footer-left");
1220 else if (pPage->footer_even)
1226 if( pPage->pagenumber && pPage->pagenumber->where >= 4
1227 && pPage->pagenumber->where != 7 )
1229 d->pPn = pPage->pagenumber;
1236 endEl(
"style:footer-left");
1238 if( !pPage->footer && !pPage->footer_even && !pPage->footer_odd )
1244 if( pPage->pagenumber && pPage->pagenumber->where >= 4
1245 && pPage->pagenumber->where != 7 )
1247 d->pPn = pPage->pagenumber;
1252 endEl(
"style:footer");
1255 endEl(
"style:master-page");
1257 endEl(
"office:master-styles");
1273 mxList->addAttribute(
"style:font-size-asian",
sXML_CDATA, OUString::number(cshape->
size / 25) +
"pt");
1276 reinterpret_cast<unsigned char const *
>(hwpfont.
GetFontName(0, cshape->
font))).c_str());
1277 double fRatio = 1.0;
1281 OUString(
d->buf,
size, RTL_TEXTENCODING_EUC_KR));
1283 OUString(
d->buf,
size, RTL_TEXTENCODING_EUC_KR));
1286 OUString::number(
static_cast<int>(cshape->
ratio * fRatio)) +
"%");
1288 double sspace = (cshape->
size / 25) * cshape->
space / 100.;
1293 OUString::number(sspace) +
"pt");
1295 if (cshape->
color[1] != 0)
1298 if (cshape->
shade != 0)
1301 if (cshape->
attr & 0x01)
1310 if (cshape->
attr >> 1 & 0x01)
1319 if (cshape->
attr >> 2 & 0x01)
1321 if (cshape->
attr >> 3 & 0x01)
1323 if (cshape->
attr >> 4 & 0x01)
1325 if (cshape->
attr >> 5 & 0x01)
1327 if (cshape->
attr >> 6 & 0x01)
1357 (WTI(pshape->
indent)) +
"inch");
1361 const char* align =
nullptr;
1382 mxList->addAttribute(
"fo:text-align",
sXML_CDATA, OUString::createFromAscii(align));
1386 if( pshape->
shade > 0 )
1418 unsigned char tf = 0;
1422 if( tab_margin < 0 )
1456 endEl(
"style:tab-stop");
1460 if( !--nscount )
break;
1463 endEl(
"style:tab-stops");
1465 endEl(
"style:properties");
1466 endEl(
"style:style");
1481 SAL_WARN(
"filter.hwp",
"too many pages: " << pmCount <<
" clip to " << 512);
1485 for(
int i = 0 ;
i < pmCount ;
i++ ){
1491 switch( hwpinfo.
paper.paper_kind )
1494 if( hwpinfo.
paper.paper_direction )
1506 if( hwpinfo.
paper.paper_direction )
1518 if( hwpinfo.
paper.paper_direction )
1530 if( hwpinfo.
paper.paper_direction )
1542 if( hwpinfo.
paper.paper_direction )
1554 if( hwpinfo.
paper.paper_direction )
1569 if( hwpinfo.
paper.paper_direction )
1572 OUString::number(WTI(hwpinfo.
paper.paper_height)) +
"inch");
1574 OUString::number(WTI(hwpinfo.
paper.paper_width)) +
"inch");
1579 OUString::number(WTI(hwpinfo.
paper.paper_width)) +
"inch");
1581 OUString::number(WTI(hwpinfo.
paper.paper_height)) +
"inch");
1588 OUString::createFromAscii(hwpinfo.
paper.paper_direction ?
"landscape" :
"portrait"));
1594 OUString::number(WTI(hwpinfo.
paper.left_margin - hwpinfo.
bordermargin[0] + hwpinfo.
paper.gutter_length)) +
"inch");
1596 OUString::number(WTI(hwpinfo.
paper.right_margin - hwpinfo.
bordermargin[1])) +
"inch");
1598 OUString::number(WTI(hwpinfo.
paper.top_margin - hwpinfo.
bordermargin[2])) +
"inch");
1600 OUString::number(WTI(hwpinfo.
paper.bottom_margin - hwpinfo.
bordermargin[3])) +
"inch");
1604 OUString::number(WTI(hwpinfo.
paper.left_margin + hwpinfo.
paper.gutter_length)) +
"inch");
1606 OUString::number(WTI(hwpinfo.
paper.right_margin)) +
"inch");
1608 OUString::number(WTI(hwpinfo.
paper.top_margin)) +
"inch");
1610 OUString::number(WTI(hwpinfo.
paper.bottom_margin)) +
"inch");
1625 mxList->addAttribute(
"style:border-line-width",
sXML_CDATA,
"0.002cm 0.035cm 0.002cm");
1631 OUString::number(WTI(hwpinfo.
bordermargin[0])) +
"inch");
1633 OUString::number(WTI(hwpinfo.
bordermargin[1])) +
"inch");
1635 OUString::number(WTI(hwpinfo.
bordermargin[2])) +
"inch");
1637 OUString::number(WTI(hwpinfo.
bordermargin[3])) +
"inch");
1674 startEl(
"style:background-image");
1677 startEl(
"office:binary-data");
1680 endEl(
"office:binary-data");
1682 endEl(
"style:background-image");
1687 endEl(
"style:properties");
1690 startEl(
"style:header-style");
1692 OUString::number(WTI(hwpinfo.
paper.header_length)) +
"inch");
1697 endEl(
"style:properties");
1698 endEl(
"style:header-style");
1701 startEl(
"style:footer-style");
1703 OUString::number(WTI(hwpinfo.
paper.footer_length)) +
"inch");
1707 endEl(
"style:properties");
1708 endEl(
"style:footer-style");
1711 startEl(
"style:page-layout-properties");
1714 OUString::number(WTI(hwpinfo.
splinetext)) +
"inch");
1716 OUString::number(WTI(hwpinfo.
splinefn)) +
"inch");
1719 endEl(
"style:properties");
1729 startEl(
"style:footnote-sep");
1731 endEl(
"style:footnote-sep");
1733 endEl(
"style:page-layout-properties");
1735 endEl(
"style:page-master");
1741 if( !coldef )
return;
1767 endEl(
"style:column-sep");
1769 double spacing = WTI(coldef->
spacing)/ 2. ;
1770 for(
int ii = 0 ; ii < coldef->
ncols ; ii++)
1776 OUString::number( spacing) +
"inch");
1777 if( ii == ( coldef->
ncols -1) )
1781 OUString::number( spacing) +
"inch");
1784 endEl(
"style:column");
1786 endEl(
"style:columns");
1798 endEl(
"style:properties");
1799 endEl(
"style:style");
1813 OUString::number(
WTMM(hbox->
box_xs)) +
"mm");
1818 endEl(
"style:properties");
1819 endEl(
"style:style");
1826 "Table" + OUString::number(hbox->
style.
boxnum) +
"."
1827 + OUStringChar(
static_cast<char>(
'A'+
i)));
1835 endEl(
"style:properties");
1836 endEl(
"style:style");
1844 "Table" + OUString::number(hbox->
style.
boxnum) +
".row" + OUString::number(
i + 1));
1852 endEl(
"style:properties");
1853 endEl(
"style:style");
1857 for (
auto const& tcell : tbl->
cells)
1861 "Table" + OUString::number(hbox->
style.
boxnum) +
"."
1862 + OUStringChar(
char(
'A'+ tcell->nColumnIndex))
1863 + OUString::number(tcell->nRowIndex +1));
1867 Cell *cl = tcell->pCell;
1884 mxList->addAttribute(
"style:border-line-width",
sXML_CDATA,
"0.002cm 0.035cm 0.002cm");
1895 mxList->addAttribute(
"fo:border-left",
sXML_CDATA,
"0.002cm solid #000000");
1898 mxList->addAttribute(
"fo:border-left",
sXML_CDATA,
"0.035cm solid #000000");
1901 mxList->addAttribute(
"style:border-line-width-left",
sXML_CDATA,
"0.002cm 0.035cm 0.002cm");
1902 mxList->addAttribute(
"fo:border-left",
sXML_CDATA,
"0.039cm double #000000");
1909 mxList->addAttribute(
"fo:border-right",
sXML_CDATA,
"0.002cm solid #000000");
1912 mxList->addAttribute(
"fo:border-right",
sXML_CDATA,
"0.035cm solid #000000");
1915 mxList->addAttribute(
"style:border-line-width-right",
sXML_CDATA,
"0.002cm 0.035cm 0.002cm");
1916 mxList->addAttribute(
"fo:border-right",
sXML_CDATA,
"0.039cm double #000000");
1929 mxList->addAttribute(
"style:border-line-width-top",
sXML_CDATA,
"0.002cm 0.035cm 0.002cm");
1930 mxList->addAttribute(
"fo:border-top",
sXML_CDATA,
"0.039cm double #000000");
1937 mxList->addAttribute(
"fo:border-bottom",
sXML_CDATA,
"0.002cm solid #000000");
1940 mxList->addAttribute(
"fo:border-bottom",
sXML_CDATA,
"0.035cm solid #000000");
1943 mxList->addAttribute(
"style:border-line-width-bottom",
sXML_CDATA,
"0.002cm 0.035cm 0.002cm");
1944 mxList->addAttribute(
"fo:border-bottom",
sXML_CDATA,
"0.039cm double #000000");
1951 sal::static_int_cast<uchar>(cl->
shade)));
1955 endEl(
"style:properties");
1957 endEl(
"style:style");
2058 mxList->addAttribute(
"draw:textarea-horizontal-align",
sXML_CDATA,
"center");
2067 "fillimage" + OUString::number(hdo->
index));
2101 if(
color < 0xffffff )
2108 else if(
color <= 0xffffff )
2126 endEl(
"style:properties");
2127 endEl(
"style:style");
2129 if( hdo->
type == 0 )
2133 hdo = hdo->
next.get();
2173 switch (-(fstyle->
xpos))
2186 switch (-(fstyle->
ypos))
2212 endEl(
"style:properties");
2213 endEl(
"style:style");
2239 char *cell =
static_cast<char *
>(fstyle->
cell);
2240 mxList->addAttribute(
"draw:luminance",
sXML_CDATA, OUString::number(cell[0]) +
"%");
2241 mxList->addAttribute(
"draw:contrast",
sXML_CDATA, OUString::number(cell[1]) +
"%");
2244 else if( cell[2] == 1 )
2246 else if( cell[2] == 2 )
2249 else if (fstyle->
cell)
2269 mxList->addAttribute(
"style:border-line-width",
sXML_CDATA,
"0.002cm 0.035cm 0.002cm");
2280 mxList->addAttribute(
"fo:border-left",
sXML_CDATA,
"0.002cm solid #000000");
2283 mxList->addAttribute(
"fo:border-left",
sXML_CDATA,
"0.035cm solid #000000");
2286 mxList->addAttribute(
"style:border-line-width-left",
sXML_CDATA,
"0.002cm 0.035cm 0.002cm");
2287 mxList->addAttribute(
"fo:border-left",
sXML_CDATA,
"0.039cm double #000000");
2294 mxList->addAttribute(
"fo:border-right",
sXML_CDATA,
"0.002cm solid #000000");
2297 mxList->addAttribute(
"fo:border-right",
sXML_CDATA,
"0.035cm solid #000000");
2300 mxList->addAttribute(
"style:border-line-width-right",
sXML_CDATA,
"0.002cm 0.035cm 0.002cm");
2301 mxList->addAttribute(
"fo:border-right",
sXML_CDATA,
"0.039cm double #000000");
2314 mxList->addAttribute(
"style:border-line-width-top",
sXML_CDATA,
"0.002cm 0.035cm 0.002cm");
2315 mxList->addAttribute(
"fo:border-top",
sXML_CDATA,
"0.039cm double #000000");
2322 mxList->addAttribute(
"fo:border-bottom",
sXML_CDATA,
"0.002cm solid #000000");
2325 mxList->addAttribute(
"fo:border-bottom",
sXML_CDATA,
"0.035cm solid #000000");
2328 mxList->addAttribute(
"style:border-line-width-bottom",
sXML_CDATA,
"0.002cm 0.035cm 0.002cm");
2329 mxList->addAttribute(
"fo:border-bottom",
sXML_CDATA,
"0.039cm double #000000");
2333 if(cell->
shade != 0)
2335 sal::static_int_cast<uchar>(cell->
color),
2336 sal::static_int_cast<uchar>(cell->
shade)));
2340 endEl(
"style:properties");
2341 endEl(
"style:style");
2387 OUString::number(
WTMM(fstyle->
margin[0][0]) ) +
"mm");
2389 OUString::number(
WTMM(fstyle->
margin[0][1])) +
"mm");
2391 OUString::number(
WTMM(fstyle->
margin[0][2])) +
"mm");
2393 OUString::number(
WTMM(fstyle->
margin[0][3])) +
"mm");
2420 switch (-(fstyle->
xpos))
2433 switch (-(fstyle->
ypos))
2477 mxList->addAttribute(
"style:border-line-width",
sXML_CDATA,
"0.002cm 0.035cm 0.002cm");
2488 mxList->addAttribute(
"fo:border-left",
sXML_CDATA,
"0.002cm solid #000000");
2491 mxList->addAttribute(
"fo:border-left",
sXML_CDATA,
"0.035cm solid #000000");
2494 mxList->addAttribute(
"style:border-line-width-left",
sXML_CDATA,
"0.002cm 0.035cm 0.002cm");
2495 mxList->addAttribute(
"fo:border-left",
sXML_CDATA,
"0.039cm double #000000");
2502 mxList->addAttribute(
"fo:border-right",
sXML_CDATA,
"0.002cm solid #000000");
2505 mxList->addAttribute(
"fo:border-right",
sXML_CDATA,
"0.035cm solid #000000");
2508 mxList->addAttribute(
"style:border-line-width-right",
sXML_CDATA,
"0.002cm 0.035cm 0.002cm");
2509 mxList->addAttribute(
"fo:border-right",
sXML_CDATA,
"0.039cm double #000000");
2522 mxList->addAttribute(
"style:border-line-width-top",
sXML_CDATA,
"0.002cm 0.035cm 0.002cm");
2523 mxList->addAttribute(
"fo:border-top",
sXML_CDATA,
"0.039cm double #000000");
2530 mxList->addAttribute(
"fo:border-bottom",
sXML_CDATA,
"0.002cm solid #000000");
2533 mxList->addAttribute(
"fo:border-bottom",
sXML_CDATA,
"0.035cm solid #000000");
2536 mxList->addAttribute(
"style:border-line-width-bottom",
sXML_CDATA,
"0.002cm 0.035cm 0.002cm");
2537 mxList->addAttribute(
"fo:border-bottom",
sXML_CDATA,
"0.039cm double #000000");
2548 OUString::number(
WTMM(fstyle->
margin[1][0])) +
"mm");
2550 OUString::number(
WTMM(fstyle->
margin[1][1])) +
"mm");
2552 OUString::number(
WTMM(fstyle->
margin[1][2])) +
"mm");
2554 OUString::number(
WTMM(fstyle->
margin[1][3])) +
"mm");
2556 if(cell->
shade != 0)
2559 sal::static_int_cast<uchar>(cell->
color),
2560 sal::static_int_cast<uchar>(cell->
shade)));
2562 else if( fstyle->
boxtype ==
'E' )
2566 else if( fstyle->
boxtype ==
'L' )
2568 mxList->addAttribute(
"style:border-line-width-bottom",
sXML_CDATA,
"0.02mm 0.35mm 0.02mm");
2569 mxList->addAttribute(
"fo:border-bottom",
sXML_CDATA,
"0.039cm double #808080");
2574 OUString clip =
"rect(" +
2575 OUString::number(
WTMM(-fstyle->
margin[1][0]) ) +
"mm " +
2576 OUString::number(
WTMM(-fstyle->
margin[1][1]) ) +
"mm " +
2577 OUString::number(
WTMM(-fstyle->
margin[1][2]) ) +
"mm " +
2578 OUString::number(
WTMM(-fstyle->
margin[1][3]) ) +
"mm)";
2582 char *cell =
static_cast<char *
>(fstyle->
cell);
2583 mxList->addAttribute(
"draw:luminance",
sXML_CDATA, OUString::number(cell[0]) +
"%");
2584 mxList->addAttribute(
"draw:contrast",
sXML_CDATA, OUString::number(cell[1]) +
"%");
2587 else if( cell[2] == 1 )
2589 else if( cell[2] == 2 )
2595 endEl(
"style:properties");
2596 endEl(
"style:style");
2602 return "T" + OUString::number(
index);
2608 return "P" + OUString::number(
index);
2627 unsigned char firstspace = 0;
2635 if(
d->bFirstPara &&
d->bInBody )
2640 endEl(
"text:bookmark");
2641 d->bFirstPara =
false;
2646 d->bInHeader =
false;
2653 for (
const auto& box : para->
hhstr)
2658 if (box->hh ==
CH_SPACE && !firstspace)
2678 for(
int j = 0 ; j < res; j++ )
2680 str.push_back(dest[j]);
2695 int curr = para->
cshape->index;
2696 unsigned char firstspace = 0;
2705 if(
d->bFirstPara &&
d->bInBody )
2711 endEl(
"text:bookmark");
2712 d->bFirstPara =
false;
2717 d->bInHeader =
false;
2725 for (
const auto& box : para->
hhstr)
2740 if (box->hh ==
CH_SPACE && !firstspace)
2762 for(
int j = 0 ; j < res; j++ )
2764 str.push_back(dest[j]);
2780 unsigned char firstspace = 0;
2781 bool pstart = bParaStart;
2782 bool tstart =
false;
2783 bool infield =
false;
2785 const auto STARTP = [
this, para, &pstart]()
2787 mxList->addAttribute(
"text:style-name",
"CDATA",
2793 const auto STARTT = [
this, para, &tstart](
int pos)
2801 const auto ENDP = [
this, &pstart]()
2806 const auto ENDT = [
this, &tstart]()
2812 if(
d->bFirstPara &&
d->bInBody )
2820 endEl(
"text:bookmark");
2821 d->bFirstPara =
false;
2829 d->bInHeader =
false;
2833 for (
const auto& box : para->
hhstr)
2842 if( !pstart ){ STARTP(); }
2843 if( !tstart ){ STARTT(
n);}
2846 if( tstart ){ ENDT();}
2847 if( !pstart ){ STARTP(); }
2848 if( pstart ){ ENDP(); }
2851 else if (box->hh ==
CH_SPACE && !firstspace)
2853 if( !pstart ) {STARTP(); }
2854 if( !tstart ) {STARTT(
n);}
2865 if( !pstart ) {STARTP(); }
2866 if( !tstart ) {STARTT(
n);}
2875 for(
int j = 0 ; j < res; j++ )
2877 str.push_back(dest[j]);
2885 if( !pstart ) {STARTP(); }
2886 if( !tstart ) {STARTT(
n);}
2889 if( hbox->
type[0] == 4 && hbox->
type[1] == 0 )
2891 d->pField = hbox->
str3.get();
2901 if( hbox->
type[0] == 4 && hbox->
type[1] == 0 )
2904 d->pField =
nullptr;
2915 if( !pstart ) {STARTP(); }
2916 if( !tstart ) {STARTT(
n);}
2923 if( !pstart ) {STARTP(); }
2924 if( !tstart ) {STARTT(
n);}
2929 if( !pstart ) {STARTP(); }
2932 if( !tstart ) {STARTT(
n);}
2944 if( !pstart ) {STARTP(); }
2945 if( !tstart ) {STARTT(
n);}
2950 if( !pstart ) {STARTP(); }
2953 if( !tstart ) {STARTT(
n);}
2956 if( tstart ) {ENDT();}
2977 if( !pstart ) {STARTP(); }
2978 if( !tstart ) {STARTT(
n);}
2983 if( !pstart ) {STARTP(); }
2986 if( !tstart ) {STARTT(
n);}
2989 if( tstart ) {ENDT();}
2998 if( !pstart ) {STARTP();}
2999 if( !tstart ) {STARTT(
n);}
3002 if( tstart ) {ENDT();}
3003 if( pstart ) {ENDP();}
3009 if( !pstart ) {STARTP();}
3010 if( !tstart ) {STARTT(
n);}
3015 if( !pstart ) {STARTP();}
3016 if( !tstart ) {STARTT(
n);}
3021 if( !pstart ) {STARTP();}
3022 if( !tstart ) {STARTT(
n);}
3031 if( !pstart ) {STARTP();}
3032 if( !tstart ) {STARTT(
n);}
3041 if( !pstart ) {STARTP();}
3042 if( !tstart ) {STARTT(
n);}
3046 if( !pstart ) {STARTP();}
3047 if( !tstart ) {STARTT(
n);}
3051 if( !pstart ) {STARTP();}
3052 if( !tstart ) {STARTT(
n);}
3058 str.push_back(0x0020);
3070 if( hbox->
type[0] == 4 && hbox->
type[1] == 0 )
3078 endEl(
"text:placeholder");
3081 else if( hbox->
type[0] == 3 && hbox->
type[1] == 0 )
3084 if (uStr3 ==
"title")
3088 endEl(
"text:title");
3090 else if (uStr3 ==
"subject")
3094 endEl(
"text:subject");
3096 else if (uStr3 ==
"author")
3100 endEl(
"text:author-name");
3102 else if (uStr3 ==
"keywords")
3106 endEl(
"text:keywords");
3110 else if( hbox->
type[0] == 3 && hbox->
type[1] == 1 )
3113 if (uStr3 ==
"User")
3115 startEl(
"text:sender-lastname");
3117 endEl(
"text:sender-lastname");
3119 else if (uStr3 ==
"Company")
3121 startEl(
"text:sender-company");
3123 endEl(
"text:sender-company");
3125 else if (uStr3 ==
"Position")
3129 endEl(
"text:sender-title");
3131 else if (uStr3 ==
"Division")
3133 startEl(
"text:sender-position");
3135 endEl(
"text:sender-position");
3137 else if (uStr3 ==
"Fax")
3141 endEl(
"text:sender-fax");
3143 else if (uStr3 ==
"Pager")
3145 startEl(
"text:phone-private");
3147 endEl(
"text:phone-private");
3149 else if (uStr3 ==
"E-mail")
3153 endEl(
"text:sender-email");
3155 else if (uStr3 ==
"Zipcode(office)")
3157 startEl(
"text:sender-postal-code");
3159 endEl(
"text:sender-postal-code");
3161 else if (uStr3 ==
"Phone(office)")
3163 startEl(
"text:sender-phone-work");
3165 endEl(
"text:sender-phone-work");
3167 else if (uStr3 ==
"Address(office)")
3169 startEl(
"text:sender-street");
3171 endEl(
"text:sender-street");
3175 else if( hbox->
type[0] == 3 && hbox->
type[1] == 2 )
3179 startEl(
"text:creation-date");
3182 endEl(
"text:creation-date");
3193 if (hbox->
type == 0)
3198 endEl(
"text:bookmark");
3200 else if (hbox->
type == 1)
3203 startEl(
"text:bookmark-start");
3205 endEl(
"text:bookmark-start");
3207 else if (hbox->
type == 2)
3212 endEl(
"text:bookmark-end");
3227 bool add_zero =
false;
3233 for( ; *fmt ; fmt++ )
3235 if( zero_check == 1 )
3252 endEl(
"number:year");
3257 endEl(
"number:year");
3264 endEl(
"number:month");
3270 endEl(
"number:month");
3277 endEl(
"number:month");
3284 endEl(
"number:day");
3291 endEl(
"number:day");
3297 endEl(
"number:text");
3302 endEl(
"number:text");
3307 endEl(
"number:text");
3312 endEl(
"number:text");
3322 endEl(
"number:hours");
3330 endEl(
"number:minutes");
3337 startEl(
"number:day-of-week");
3339 endEl(
"number:day-of-week");
3346 endEl(
"number:am-pm");
3356 endEl(
"number:text");
3361 endEl(
"number:date-style");
3367 mxList->addAttribute(
"style:data-style-name",
sXML_CDATA,
"N" + OUString::number(hbox->
key));
3379 endEl(
"text:tab-stop");
3396 "Table" + OUString::number(hbox->
style.
boxnum) +
"."
3397 + OUStringChar(
static_cast<char>(
'A'+
i)));
3398 startEl(
"table:table-column");
3400 endEl(
"table:table-column");
3405 for (
auto const& tcell : tbl->
cells)
3407 if( tcell->nRowIndex > j )
3411 endEl(
"table:table-row");
3417 "Table" + OUString::number(hbox->
style.
boxnum) +
".row"
3418 + OUString::number(tcell->nRowIndex + 1));
3421 j = tcell->nRowIndex;
3426 "Table" + OUString::number(hbox->
style.
boxnum) +
"."
3427 + OUStringChar(
char(
'A'+ tcell->nColumnIndex))
3428 + OUString::number(tcell->nRowIndex +1));
3429 if( tcell->nColumnSpan > 1 )
3430 mxList->addAttribute(
"table:number-columns-spanned",
sXML_CDATA, OUString::number(tcell->nColumnSpan));
3431 if( tcell->nRowSpan > 1 )
3432 mxList->addAttribute(
"table:number-rows-spanned",
sXML_CDATA, OUString::number(tcell->nRowSpan));
3434 if( tcell->pCell->protect )
3441 endEl(
"table:table-cell");
3443 endEl(
"table:table-row");
3444 endEl(
"table:table");
3531 OUString::number(
WTMM( hbox->
pgx +
x )) +
"mm");
3533 OUString::number(
WTMM( hbox->
pgy +
y )) +
"mm");
3541 OUString::number(
WTMM( hbox->
box_xs )) +
"mm");
3547 OUString::number(
WTMM(hbox->
box_ys )) +
"mm");
3562 else if (!hbox->
plists[0].empty())
3571 endEl(
"draw:text-box");
3580 endEl(
"draw:text-box");
3588 endEl(
"draw:object");
3605 pPar = hbox->
plists[0].empty() ? nullptr : hbox->
plists[0].front().get();
3608 for (
const auto& box : pPar->
hhstr)
3613 if (l >=
sizeof(mybuf)-7)
3616 for(
int j = 0 ; j < res; j++ ){
3621 mybuf[l++] = sal::static_int_cast<char>(c);
3624 mybuf[l++] = sal::static_int_cast<char>((c >> 8) & 0xff);
3625 mybuf[l++] = sal::static_int_cast<char>(c & 0xff);
3629 if (l >=
sizeof(mybuf)-7)
3632 pPar = pPar->
Next();
3650 if( !hypert )
return;
3656 reinterpret_cast<uchar const *
>(urltowin(
reinterpret_cast<char *
>(hypert->
filename)).c_str())).c_str());
3658 reinterpret_cast<uchar const *
>(
urltounix(
reinterpret_cast<char *
>(hypert->
filename)).c_str())).c_str());
3661 if (!tmp.empty() && strcmp(tmp.c_str(),
"[HTML]")) {
3662 ::std::string tmp3(tmp2);
3663 tmp3.push_back(
'#');
3666 OUString(tmp3.c_str(), tmp3.size()+1, RTL_TEXTENCODING_EUC_KR));
3670 OUString(tmp2.c_str(), tmp2.size()+1, RTL_TEXTENCODING_EUC_KR));
3681 OUString(tmp.c_str(), tmp.size()+1, RTL_TEXTENCODING_EUC_KR));
3722 OUString::number(hbox->
pgno + 1));
3751 if( hbox->
follow[4] != 0 )
3756 if( hbox->
follow[4] != 0 )
3785 OUString::number(hbox->
pgno + 1));
3827 startEl(
"office:binary-data");
3841 wchar_t pathname[200];
3845 STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_TRANSACTED,
nullptr, 0, &srcsto);
3850 rc = OleLoad(srcsto, IID_IUnknown,
nullptr,
reinterpret_cast<LPVOID*
>(&pObj));
3866 endEl(
"office:binary-data");
3869 endEl(
"draw:object-ole");
3871 endEl(
"draw:image");
3883 endEl(
"draw:text-box");
3900 bool bIsRotate =
false;
3922 a = hwpinfo.
paper.left_margin;
3923 b = hwpinfo.
paper.top_margin + hwpinfo.
paper.header_length;
3937 double x = hbox->
pgx;
3938 double y = hbox->
pgy;
3952 for(
i = 0 ;
i < 3 ;
i++ ){
3962 double rotate = atan2(
pt[1].getY() -
pt[0].getY(),
pt[1].getX() -
pt[0].getX());
3964 for(
i = 0 ;
i < 3 ;
i++){
3970 if (r_pt[2].getY() == r_pt[1].getY())
3973 skewX = atan((r_pt[2].getX() - r_pt[1].getX()) / (r_pt[2].getY() - r_pt[1].getY()));
3974 if( skewX >= M_PI_2 )
3976 if( skewX <= -M_PI_2 )
3980 if( skewX != 0.0 &&
rotate != 0.0 ){
3981 trans =
"skewX (" + OUString::number(skewX)
3982 +
") rotate (" + OUString::number(
rotate)
3983 +
") translate (" + OUString::number(
WTMM(
x +
a + drawobj->
offset2.
x + pal.
pt[0].
x)) +
"mm "
3984 + OUString::number(
WTMM(
y + b + drawobj->
offset2.
y + pal.
pt[0].
y)) +
"mm)";
3987 else if( skewX != 0.0 ){
3988 trans =
"skewX (" + OUString::number(skewX)
3989 +
") translate (" + OUString::number(
WTMM(
x +
a + drawobj->
offset2.
x + pal.
pt[0].
x)) +
"mm "
3990 + OUString::number(
WTMM(
y + b + drawobj->
offset2.
y + pal.
pt[0].
y)) +
"mm)";
3993 else if(
rotate != 0.0 ){
3994 trans =
"rotate (" + OUString::number(
rotate)
3995 +
") translate (" + OUString::number(
WTMM(
x +
a + drawobj->
offset2.
x + pal.
pt[0].
x)) +
"mm "
3996 + OUString::number(
WTMM(
y + b + drawobj->
offset2.
y + pal.
pt[0].
y)) +
"mm)";
4000 drawobj->
extent.
w =
static_cast<int>(std::hypot(
pt[1].getX() -
pt[0].getX(),
pt[1].getY() -
pt[0].getY()));
4001 drawobj->
extent.
h =
static_cast<int>(std::hypot(
pt[2].getX() -
pt[1].getX(),
pt[2].getY() -
pt[1].getY()));
4005 switch (drawobj->
type)
4027 OUString::number (
WTMM(
y + b + drawobj->
offset2.
y )) +
"mm");
4032 OUString::number (
WTMM(
y + b + drawobj->
offset2.
y)) +
"mm");
4047 OUString::number (
WTMM(
y + b + drawobj->
offset2.
y)) +
"mm");
4050 OUString::number (
WTMM( drawobj->
extent.
w )) +
"mm");
4052 OUString::number (
WTMM( drawobj->
extent.
h )) +
"mm");
4058 OUString::number (
WTMM(
value/10 )) +
"mm");
4065 OUString::number (
WTMM(
value / 2)) +
"mm");
4078 pPara = pPara->
Next();
4091 OUString::number (
WTMM(
y + b + drawobj->
offset2.
y)) +
"mm");
4095 OUString::number (
WTMM( drawobj->
extent.
w )) +
"mm");
4097 OUString::number (
WTMM( drawobj->
extent.
h )) +
"mm");
4115 mxList->addAttribute(
"draw:start-angle",
sXML_CDATA, OUString::number(start_angle ));
4116 mxList->addAttribute(
"draw:end-angle",
sXML_CDATA, OUString::number(end_angle));
4130 pPara = pPara->
Next();
4133 endEl(
"draw:ellipse");
4144 if( ( flip == 0 || flip == 2 ) && drawobj->
type ==
HWPDO_ARC)
4150 if( ( flip == 0 || flip == 1 ) && drawobj->
type ==
HWPDO_ARC)
4155 OUString::number (
WTMM(
y + b + drawobj->
offset2.
y)) +
"mm");
4159 OUString::number (
WTMM( drawobj->
extent.
w * 2)) +
"mm");
4161 OUString::number (
WTMM( drawobj->
extent.
h * 2)) +
"mm");
4169 double start_angle, end_angle;
4172 start_angle = atan2(pal.
pt[0].
y - pal.
pt[1].
y,pal.
pt[1].
x - pal.
pt[0].
x );
4173 end_angle = atan2(pal.
pt[2].
y - pal.
pt[1].
y, pal.
pt[1].
x - pal.
pt[2].
x);
4175 if( ( start_angle > end_angle ) && (start_angle - end_angle < M_PI ))
4176 std::swap( start_angle, end_angle );
4214 pPara = pPara->
Next();
4217 endEl(
"draw:ellipse");
4223 bool bIsNatural =
true;
4232 OUString::number (
WTMM(
y + b + drawobj->
offset2.
y)) +
"mm");
4235 OUString::number (
WTMM( drawobj->
extent.
w )) +
"mm");
4237 OUString::number (
WTMM( drawobj->
extent.
h )) +
"mm");
4240 "0 0 " + OUString::number(WTSM(drawobj->
extent.
w)) +
" "
4241 + OUString::number(WTSM(drawobj->
extent.
h)));
4243 OUStringBuffer oustr;
4247 (::std::numeric_limits<int>::max() /
sizeof(
double))))
4252 std::unique_ptr<double[]> xarr(
new double[
n+1] );
4253 std::unique_ptr<double[]> yarr(
new double[
n+1] );
4254 std::unique_ptr<double[]> tarr(
new double[
n+1] );
4256 std::unique_ptr<double[]> xb;
4257 std::unique_ptr<double[]> yb;
4259 std::unique_ptr<double[]> carr;
4260 std::unique_ptr<double[]> darr;
4263 for(
i = 0 ;
i <
n ;
i++ ){
4288 "M" + OUString::number(WTSM(xarr[0])) +
" "
4289 + OUString::number(WTSM(yarr[0])) +
"C"
4290 + OUString::number(WTSM(xarr[0] + xb[0]/3)) +
" "
4291 + OUString::number(WTSM(yarr[0] + yb[0]/3)));
4293 for(
i = 1 ;
i <
n ;
i++ ){
4296 " " + OUString::number(WTSM(xarr[
i] - xb[
i]/3)) +
" "
4297 + OUString::number(WTSM(yarr[
i] - yb[
i]/3)) +
" "
4298 + OUString::number(WTSM(xarr[
i])) +
" "
4299 + OUString::number(WTSM(yarr[
i])) +
"z");
4303 " " + OUString::number(WTSM(xarr[
i] - xb[
i]/3)) +
" "
4304 + OUString::number(WTSM(yarr[
i] - yb[
i]/3)) +
" "
4305 + OUString::number(WTSM(xarr[
i])) +
" "
4306 + OUString::number(WTSM(yarr[
i])) +
" "
4307 + OUString::number(WTSM(xarr[
i] + xb[
i]/3)) +
" "
4308 + OUString::number(WTSM(yarr[
i] + yb[
i]/3)));
4324 pPara = pPara->
Next();
4333 bool bIsPolygon =
false;
4338 OUString::number (
WTMM(
y + b + drawobj->
offset2.
y)) +
"mm");
4341 OUString::number (
WTMM( drawobj->
extent.
w )) +
"mm");
4343 OUString::number (
WTMM( drawobj->
extent.
h )) +
"mm");
4345 mxList->addAttribute(
"svg:viewBox",
sXML_CDATA,
"0 0 " + OUString::number(WTSM(drawobj->
extent.
w)) +
" " + OUString::number(WTSM(drawobj->
extent.
h)));
4347 OUStringBuffer oustr;
4352 OUString::number(WTSM(drawobj->
u.
freeform.
pt[0].
x)) +
","
4353 + OUString::number(WTSM(drawobj->
u.
freeform.
pt[0].
y)));
4358 " " + OUString::number(WTSM(drawobj->
u.
freeform.
pt[
i].
x)) +
","
4367 mxList->addAttribute(
"draw:points",
sXML_CDATA, oustr.makeStringAndClear());
4388 pPara = pPara->
Next();
4391 endEl(
"draw:polygon");
4406 pPara = pPara->
Next();
4409 endEl(
"draw:polyline");
4419 OUString::number (
WTMM(
y + b + drawobj->
offset2.
y)) +
"mm");
4422 OUString::number (
WTMM( drawobj->
extent.
w )) +
"mm");
4424 OUString::number (
WTMM( drawobj->
extent.
h )) +
"mm");
4430 OUString::number (
WTMM(
value/10 )) +
"mm");
4437 OUString::number (
WTMM(
value / 2)) +
"mm");
4448 pPara = pPara->
Next();
4451 endEl(
"draw:text-box");
4456 drawobj = drawobj->
next.get();
4485 for (
const auto& box : para->
hhstr)
4491 for(
int j = 0 ; j < res ; j++ )
4493 str.push_back(dest[j]);
4496 para = para->
Next();
4499 endEl(
"text:hidden-text");
4514 startEl(
"text:endnote-citation");
4517 endEl(
"text:endnote-citation");
4519 if (!hbox->
plist.empty())
4521 endEl(
"text:endnote-body");
4522 endEl(
"text:endnote");
4530 startEl(
"text:footnote-citation");
4533 endEl(
"text:footnote-citation");
4534 startEl(
"text:footnote-body");
4535 if (!hbox->
plist.empty())
4537 endEl(
"text:footnote-body");
4538 endEl(
"text:footnote");
4553 endEl(
"text:page-number");
4566 endEl(
"text:sequence");
4574 endEl(
"text:sequence");
4586 else if( hbox->
where == 2 || hbox->
where == 5 )
4588 else if( hbox->
where == 3 || hbox->
where == 6 )
4592 if(
d->nPnPos == 1 )
4594 else if(
d->nPnPos == 3 )
4610 if( hbox->
shape > 2 )
4612 if( hbox->
shape % 3 == 0 )
4614 else if( hbox->
shape % 3 == 1 )
4622 endEl(
"text:page-number");
4623 if( hbox->
shape > 2 )
4626 endEl(
"draw:text-box");
4643 if( hbox->
kind == 1 )
4650 bool bParaStart =
false;
4662 if(
d->bFirstPara &&
d->bInBody )
4668 endEl(
"text:bookmark");
4669 d->bFirstPara =
false;
4674 d->bInHeader =
false;
4692 para = para->
Next();
4721constexpr OUStringLiteral IMPLEMENTATION_NAME =
u"com.sun.comp.hwpimport.HwpImportFilter";
4722constexpr OUStringLiteral SERVICE_NAME1 =
u"com.sun.star.document.ImportFilter";
4723constexpr OUStringLiteral SERVICE_NAME2 =
u"com.sun.star.document.ExtendedTypeDetection";
4725class HwpImportFilter :
public WeakImplHelper< XFilter, XImporter, XServiceInfo, XExtendedFilterDetection >
4728 explicit HwpImportFilter(
const Reference< XComponentContext >& );
4732 virtual sal_Bool SAL_CALL
filter(
const Sequence< PropertyValue >& aDescriptor )
override;
4733 virtual void SAL_CALL cancel()
override;
4736 virtual void SAL_CALL setTargetDocument(
const Reference< XComponent >& xDoc)
override;
4744 virtual OUString SAL_CALL detect( css::uno::Sequence< css::beans::PropertyValue >& rDescriptor )
override;
4747 Reference< XFilter > rFilter;
4748 Reference< XImporter > rImporter;
4752HwpImportFilter::HwpImportFilter(
const Reference< XComponentContext >& rxContext)
4755 Reference< XDocumentHandler > xHandler( rxContext->getServiceManager()->createInstanceWithContext(
WRITER_IMPORTER_NAME, rxContext ), UNO_QUERY );
4758 p->setDocumentHandler( xHandler );
4760 Reference< XImporter > xImporter( xHandler, UNO_QUERY );
4761 rImporter = xImporter;
4764 catch( Exception & )
4771sal_Bool HwpImportFilter::filter(
const Sequence< PropertyValue >& aDescriptor )
4774 return rFilter->filter( aDescriptor );
4777void HwpImportFilter::cancel()
4782void HwpImportFilter::setTargetDocument(
const Reference< XComponent >& xDoc )
4785 rImporter->setTargetDocument( xDoc );
4788OUString HwpImportFilter::getImplementationName()
4790 return IMPLEMENTATION_NAME;
4793sal_Bool HwpImportFilter::supportsService(
const OUString& ServiceName )
4799OUString HwpImportFilter::detect( css::uno::Sequence< css::beans::PropertyValue >& rDescriptor )
4804 aDescriptor.addInputStream();
4806 Reference< XInputStream > xInputStream(
4809 if (xInputStream.is())
4814 nLen == xInputStream->readBytes(aData, nLen) &&
4818 sTypeName =
"writer_MIZI_Hwp_97";
4825Sequence< OUString> HwpImportFilter::getSupportedServiceNames()
4827 return { SERVICE_NAME1, SERVICE_NAME2 };
4832extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
4834 css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any>
const&)
4836 return cppu::acquire(
new HwpImportFilter(context));
constexpr sal_Int8 header[]
EmPicture * GetEmPictureByName(char *name)
ParaShape * getParaShape(int)
HyperText * GetHyperText()
int ReadHwpFile(std::unique_ptr< HStream >)
Reads all information of hwp file from stream.
EmPicture * GetEmPicture(Picture *pic)
int getParaShapeCount() const
FBoxStyle * getFBoxStyle(int)
HWPFont & GetHWPFont(void)
HWPInfo & GetHWPInfo(void)
HeaderFooter * getHeaderFooter(int)
HWPPara * GetFirstPara(void)
int getHeaderFooterCount() const
int getTableCount() const
ColumnDef * GetColumnDef(int)
int getPageNumberCount() const
int getCharShapeCount() const
ShowPageNum * getPageNumber(int)
int getMaxSettedPage() const
int getColumnCount() const
DateCode * getDateCode(int)
std::unique_ptr< OlePicture > oledata
HWPStyle & GetHWPStyle(void)
int getDateFormatCount() const
int GetPageMasterNum(int page)
int getFBoxStyleCount() const
CharShape * getCharShape(int)
The HWPFont class has the font list for the document when it's saved.
const char * GetFontName(int lang, int id)
HWPInfo class는 HWPFile에 대한 정보를 담고 있는 클래스이다.
hunit bordermargin[4]
Information about page layout.
short beginfnnum
Information about footnote.
HWPSummary summary
Summary of document.
PaperInfo paper
Paper Information.
It represents the paragraph.
std::vector< std::unique_ptr< HBox > > hhstr
Box object list.
CharShape * GetCharShape(int pos)
Returns the character style of paragraph.
ParaShape & GetParaShape(void)
Returns the style of paragraph.
unsigned char contain_cshape
If the value is 0, all character of paragraph have same style given cshape.
HWPPara * Next(void)
Returns next paragraph.
uint ctrlflag
Checks the special characters in the paragraph.
std::shared_ptr< CharShape > cshape
Using for global style object like "Standard".
CharShape * GetCharShape(int n) const
ParaShape * GetParaShape(int n) const
char * GetName(int n) const
This class implements the external Parser interface.
static OUString getTStyleName(int)
bool importHStream(std::unique_ptr< HStream > stream)
void makeFormula(TxtBox *hbox)
It must be converted into MathML.
virtual sal_Bool SAL_CALL filter(const Sequence< PropertyValue > &aDescriptor) override
parseStream does Parser-startup initializations
void parseParaShape(ParaShape const *)
Create the properties that correspond to the real Paragraph.
void makeColumns(ColumnDef const *)
void makeOutline(Outline const *hbox)
void make_text_p1(HWPPara *para, bool bParaStart)
void makeTStyle(CharShape const *)
void makePictureDRAW(HWPDrawingObject *drawobj, const Picture *hbox)
void makeTable(TxtBox *hbox)
void makeCaptionStyle(FBoxStyle *)
void makeAutoStyles()
parse automatic styles from hwpfile Define a style that is automatically reflected.
void makeBookmark(Bookmark const *hbox)
Completed In LibreOffice, refer bookmarks as reference, but hwp doesn't have the sort of feature.
virtual ~HwpReader() override
void make_text_p0(HWPPara *para, bool bParaStart)
If no special characters in the paragraph and all characters use the same CharShape.
void parsePara(HWPPara *para)
void make_text_p3(HWPPara *para, bool bParaStart)
Special characters are in the paragraph and characters use different CharShapes.
void makeTextDecls()
make text decls
void startEl(const OUString &el)
Reference< XDocumentHandler > m_rxDocumentHandler
void makeDateFormat(DateCode *hbox)
void makeHidden(Hidden *hbox)
Input-comment-hidden description: shows a hidden explanation to the users.
void makeAutoNum(AutoNum const *hbox)
page/footnote/endnote/picture/table/formula number
void makeDrawStyle(HWPDrawingObject *, FBoxStyle *)
void makeFootnote(Footnote *hbox)
Converts footnote to text:footnote, endnote to text:endnote.
void endEl(const OUString &el)
void makeBody()
make office:body
void makePicture(Picture *hbox)
Read the platform information.
void makePageStyle()
Create a style for the page.
void makeFStyle(FBoxStyle *)
Create a style for the Floating objects.
void chars(const OUString &s)
static OUString getPStyleName(int)
rtl::Reference< AttributeListImpl > mxList
void makeMeta()
make office:meta Completed
void makeTableStyle(Table *)
void parseCharShape(CharShape const *)
Create the properties for text styles.
void makeFieldCode(hchar_string const &rStr, FieldCode const *hbox)
void makeHyperText(TxtBox *hbox)
Read the platform information.
std::unique_ptr< HwpReaderPrivate > d
void makeChars(hchar_string &rStr)
void makeDrawMiscStyle(HWPDrawingObject *)
void makeMailMerge(MailMerge *hbox)
mail merge operation using hwp addressbook and hwp data form.
void makeTextBox(TxtBox *hbox)
Parses the text boxes and tables.
void makePStyle(ParaShape const *)
Make the style of the Paragraph.
void makeDateCode(DateCode *hbox)
Number and format of title.
OUString GetUnicode() const
unsigned short kind
kind of numbering format
std::size_t ReadBytes(void *pData, std::size_t nSize)
void PeriodicSpline(int N, const double *x, const double *a, std::unique_ptr< double[]> &b, std::unique_ptr< double[]> &c, std::unique_ptr< double[]> &d)
void NaturalSpline(int N, const double *x, const double *a, std::unique_ptr< double[]> &b, std::unique_ptr< double[]> &c, std::unique_ptr< double[]> &d)
const hchar defaultform[]
Reference< XOutputStream > stream
#define HWPDO_FLAG_DRAW_PIE
#define HWPDO_FLAG_ROTATION
#define HWPDO_FLAG_AS_TEXTBOX
int getRepFamilyName(const char *orig, char *buf, double &ratio)
int hcharconv(hchar ch, hchar *dest, int codeType)
Transfer combination-code for internal using of hwp to ascii.
OUString hcolor2str(uchar color, uchar shade, bool bIsChar)
hwp의 경로를 windows형태로 바꾼다.
OUString base64_encode_string(const uchar *buf, unsigned int len)
OUString hstr2OUString(hchar const *hstr)
OUString rgb2str(unsigned char red, unsigned char green, unsigned char blue)
::std::string hstr2ksstr(hchar const *hstr)
Convert 'Hangul and Computer' strings to the completion code(KSC5601-87)
double calcAngle(double x1, double y1, double x2, double y2)
hchar_string kstr2hstr(uchar const *src)
한글을 포함할 수 있는 char형스트링을 한컴스트링으로 변환한다.
::std::string urltounix(const char *src)
hwp의 경로를 unix형태로 바꾼다.
int detect_hwp_version(const char *str)
::std::basic_string< hchar > hchar_string
char16_t hchar
size of hunit is 4 since hwp96 version
OUString fromHcharStringToOUString(hchar_string const &s)
SAL_DLLPUBLIC_EXPORT bool TestImportHWP(SvStream &rStream)
constexpr OUStringLiteral sXML_CDATA
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * hwpfilter_HwpImportFilter_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
static struct @17 ArrowShape[]
constexpr OUStringLiteral WRITER_IMPORTER_NAME
#define SAL_WARN(area, stream)
def rotate(shapename, deg)
constexpr OUStringLiteral aData
constexpr double rad2deg(double v)
css::uno::Sequence< OUString > getSupportedServiceNames()
OUString getImplementationName()
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
std::enable_if< std::is_signed< T >::value, bool >::type checked_add(T a, T b, T &result)
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
int sprintf(char(&s)[N], char const *format, T &&... arguments)
Input current index of page,comment,table and picture.
hchar id[BMK_COMMENT_LEN+1]
A cell has four properties to specify the position for itself in hwp.
unsigned char linetype[4]
int index
Index of character style.
std::unique_ptr< int[]> data
Class for current date and time with specified format.
short date[6]
year/month/week/day/hour/minute
std::vector< uchar > data
Style for floating object.
short ypos
Vertical alignment.
unsigned char boxtype
Type of floating object : line, txtbox, image, table, equalizer and button.
short margin[3][4]
Every margin of border [0-2][] : out/in/cell margin [][0-3] : left/right/top/bottom.
unsigned char txtflow
Kind of wrap.
short boxnum
Index of floating object.
short xpos
Horizontal alignment.
unsigned char anchor_type
Anchor type : paragraph , page, char.
short pgx
Physical x,y position.
unsigned short location_info
std::unique_ptr< hchar[]> str2
std::unique_ptr< hchar[]> str3
std::unique_ptr< DateCode > m_pDate
All properties for drawing object.
unsigned int pattern_color
char szPatternFile[260+1]
Common header for drawing object.
ZZPoint offset2
offset from origin of drawing object
std::unique_ptr< struct HWPDrawingObject > next
int type
type of drawing object
std::unique_ptr< struct HWPDrawingObject > child
This exists for container object.
HWPDOArc arc
extended from hwpw96
union HWPDrawingObject::@0 u
unsigned short subject[56]
unsigned short keyword[2][56]
unsigned short etc[3][56]
unsigned short author[56]
std::vector< std::unique_ptr< HWPPara > > plist
Generates the mailing list automatically using address book and mail body format.
static hchar_string GetString()
std::shared_ptr< CharShape > cshape
unsigned char arrange_type
int index
Index of paragraph style.
There are four kinds of image.
uchar pictype
Type of this object It is one of external/ole/embedded/drawing picture.
std::vector< unsigned char > follow
It's for the Drawing object.
std::vector< std::unique_ptr< HWPPara > > caption
short cap_pos
Position of caption.
std::unique_ptr< int[]> data
Input page index in footer or header.
unsigned int m_nPageNumber
unsigned short where
Location of page number to be inserted.
unsigned short shape
Shape of page number to be inserted.
unsigned char dot_continue
std::vector< std::unique_ptr< TCell > > cells
The TxtBox class saves object properties about table, textbox, equalizer or button.
std::vector< std::unique_ptr< HWPPara > > caption
Caption.
std::vector< std::unique_ptr< HWPPara > > plist_t
Paragraph list.
short cap_pos
caption position
short type
The value of type indicates as the below: zero is table, one is textbox, two is equalizer and three i...
std::unique_ptr< char[]> aBuffer