26#include <com/sun/star/awt/Toolkit.hpp>
27#include <com/sun/star/beans/XPropertySet.hpp>
28#include <com/sun/star/container/XNameContainer.hpp>
29#include <com/sun/star/awt/UnoControlDialog.hpp>
30#include <com/sun/star/awt/XControl.hpp>
31#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
32#include <com/sun/star/lang/XMultiServiceFactory.hpp>
33#include <osl/diagnose.h>
35#include <rtl/character.hxx>
39using namespace ::
cppu;
50using com::sun::star::io::XInputStream;
56 "\xAC\x81\x82\xD4\x84\xD2\x9B\x9F\xD8\xB7\x91\xD6\x96\x92\x8E\xB5"
57 "\x90\xA7\xA6\x93\x94\xE0\x85\xE9\xEC\x99\x9A\xE6\x95\xED\xFC\x9C"
58 "\xA0\xA1\xA2\xA3\xE5\xD5\xDE\xE2\xE7\xFD\xEA\xE8\xCE\xF5\xAE\xAF"
59 "\x80\x80\x83\xB3\xB4\xE1\x87\x88\x89\x8A\x8B\x8C\x8F\x97\x8D\xBF"
60 "\xC0\xC1\xC2\xC3\xC4\xC5\xCF\x98\x9D\x9E\xA4\xA5\xA8\xA9\x86\xF3"
61 "\xCD\xB1\xB2\xB6\xB8\xB9\xBA\xBB\xF7\xD9\xDA\xDB\xDC\xF8\xF9\xDF"
62 "\xD0\xD1\xD3\xD7\xAA\xAB\xDD\xB0\xE3\xE4\xEB\xEE\xEF\xF0\xF2\xF4"
63 "\xBC\xBD\xBE\xC6\xC7\xC8\xF6\xC9\xCA\xFA\xFB\xCB\xF1\xCC\xFE\xFF";
67 "\x80\x83\x86\xF5\xE1\x87\x88\x89\x8A\x8B\x8C\x8F\x97\xCF\xCF\x98"
68 "\x9D\x9E\xA4\xA5\xA8\xA9\xDB\xDC\xDF\xB1\xB2\xB6\xB8\xB9\xBA\xBB"
69 "\xBC\xBD\xBE\xC6\xC7\xC8\xF6\xC9\xCA\xCB\xCC\xCD\xCE\xAD\xAE\xAF"
70 "\xD0\xD1\xD3\xD7\xAA\xAB\xDD\xB0\xE3\xE4\xEB\xEE\xEF\xF0\xF2\xF4"
71 "\xDA\xA0\xC0\x9F\xD4\xD8\xEA\xC4\x81\xA1\x85\x92\x96\x94\xE5\xA2"
72 "\x93\x84\xFD\xE7\x9C\xA3\xC3\x82\xF7\xEC\xA7\xC2\xF3\xF8\xF9\xC5"
73 "\xBF\xB5\xD9\xAC\xD2\xB7\xE8\xB3\x9A\xD6\xDE\x91\x95\x99\xD5\xE0"
74 "\xE2\x8E\xFC\xE6\x9B\xE9\xB4\x90\xFA\xED\xA6\xC1\xF1\xFB\xFE\xFF";
79 "\x00\xe7\x00\xfc\x00\xe9\x00\xf9\x00\xe4\x01\x6f\x00\xe8\x00\xa3"
80 "\x00\xc6\x00\xd8\x00\xc5\x00\xe6\x00\xf8\x00\xc4\x00\xc4\x00\xe5"
81 "\x00\xc9\x01\x39\x00\xf4\x00\xf4\x00\xf6\x01\x3d\x01\x3e\x00\x20"
82 "\x00\xf2\x00\xd6\x00\xdc\x01\x64\x01\x65\x00\xec\x20\xa7\x01\x0d"
83 "\x00\xe1\x00\xed\x00\xf3\x00\xfa\x00\xa1\x00\xd1\x01\x7d\x01\x7e"
84 "\x00\xbf\x00\xf1\x22\x11\x03\xc3\x01\x0c\x00\xa7\x00\xbb\x00\xab"
85 "\x25\x91\x25\x92\x25\x93\x25\x02\x25\x24\x00\xc1\x00\xc2\x01\x1a"
86 "\x00\x20\x00\x20\x00\x20\x00\x20\x22\x61\x00\xb1\x22\x65\x25\x10"
87 "\x25\x14\x25\x34\x25\x2c\x25\x1c\x25\x00\x25\x3c\x22\x64\x23\x20"
88 "\x23\x21\x22\x48\x00\xba\x22\x1a\x00\xb2\x00\xbd\x00\xbc\x00\xa4"
89 "\x03\xb1\x03\xb2\x01\x0e\x03\x93\x01\x0f\x01\x47\x00\xcd\x03\xc0"
90 "\x01\x1b\x25\x18\x25\x0c\x25\x88\x25\x84\x00\xb5\x01\x6e\x25\x80"
91 "\x00\xd3\x00\xdf\x00\xd4\x03\xa6\x03\x98\x01\x48\x01\x60\x01\x61"
92 "\x01\x54\x00\xda\x01\x55\x03\xa9\x00\xfd\x00\xdd\x03\xb4\x22\x1e"
93 "\x00\xf8\x02\xdd\x03\xb5\x02\xc7\x22\x29\x00\xa7\x00\xf7\x00\xe0"
94 "\x00\xb4\x00\xb0\x00\xc0\x02\xc6\x01\x58\x01\x59\x00\x20\x00\x20";
99 "\x04\x11\x00\xfc\x00\xe9\x04\x12\x00\xe4\x01\x6f\x04\x13\x04\x14"
100 "\x04\x01\x04\x16\x04\x17\x04\x18\x04\x19\x00\xc4\x00\xc4\x04\x1a"
101 "\x00\xc9\x01\x39\x01\x3a\x00\xf4\x00\xf6\x01\x3d\x01\x3e\x00\x20"
102 "\x04\x1c\x00\xd6\x00\xdc\x01\x64\x01\x65\x04\x1d\x04\x1f\x01\x0a"
103 "\x00\xe1\x00\xed\x00\xf3\x00\xfa\x04\x20\x04\x22\x01\x7d\x01\x7e"
104 "\x04\x23\x04\x24\x04\x43\x04\x44\x01\x0c\x00\xa7\x04\x3b\x04\x3c"
105 "\x04\x47\x04\x26\x04\x27\x25\x02\x25\x24\x00\xc1\x04\x28\x01\x1a"
106 "\x04\x29\x04\x2a\x04\x2b\x04\x2c\x04\x2d\x04\x2e\x04\x2f\x25\x10"
107 "\x25\x14\x25\x34\x25\x2c\x25\x1c\x25\x00\x25\x3c\x04\x31\x04\x32"
108 "\x04\x33\x04\x51\x04\x36\x04\x37\x04\x38\x04\x39\x04\x3a\x04\x1b"
109 "\x04\x3d\x04\x3f\x01\x0e\x04\x40\x01\x0f\x01\x47\x00\xcd\x04\x42"
110 "\x01\x1b\x25\x18\x25\x0c\x25\x88\x25\x84\x04\x46\x01\x6e\x25\x80"
111 "\x00\xd3\x00\xdf\x00\xd4\x04\x48\x04\x49\x01\x48\x01\x60\x01\x61"
112 "\x01\x54\x00\xda\x01\x55\x04\x4a\x00\xfd\x00\xdd\x04\x4b\x04\x4c"
113 "\x04\x4d\x02\xdd\x04\x4e\x02\xc7\x04\x4f\x00\xa7\x04\x34\x00\xe0"
114 "\x00\xb4\x00\xb0\x00\xc0\x02\xc6\x01\x58\x01\x59\x00\x20\x00\x20";
116#define Start_(_nam) \
117 if (mxHandler.is()) \
119 mxHandler->startElement(_nam, xAttrList); \
121 mpAttrList->Clear(); \
125 if (mxHandler.is()) \
127 mxHandler->endElement(_nam); \
139 : mxInputStream(
std::move(xInputStream))
145T602ImportFilter::~T602ImportFilter()
150OUString T602ImportFilter::detect( Sequence<PropertyValue>& Descriptor)
152 sal_Int32
nLength = Descriptor.getLength();
153 const PropertyValue * pValue = Descriptor.getConstArray();
156 if ( pValue[
i].
Name ==
"InputStream" )
157 pValue[
i].Value >>= mxInputStream;
160 if (!mxInputStream.is())
163 css::uno::Sequence< sal_Int8 >
aData;
164 const size_t numBytes = 4;
165 size_t numBytesRead = mxInputStream->readSomeBytes (
aData, numBytes);
167 if ((numBytesRead != numBytes) || (
aData[0] !=
'@') ||
171 return "writer_T602_Document";
175sal_Bool SAL_CALL T602ImportFilter::filter(
const Sequence< css::beans::PropertyValue >& aDescriptor )
177 return importImpl ( aDescriptor );
181void SAL_CALL T602ImportFilter::setTargetDocument(
const Reference< css::lang::XComponent >& xDoc )
187void SAL_CALL T602ImportFilter::initialize(
const Sequence< Any >& )
193void T602ImportFilter::inschr(
unsigned char ch)
195 Reference < XAttributeList > xAttrList ( mpAttrList );
205 if(pst.wasspace > 0) {
209 pst.wasfdash =
false;
212 mpAttrList->AddAttribute(
"text:c",OUString::number(pst.wasspace));
223bool T602ImportFilter::importImpl(
const Sequence< css::beans::PropertyValue >& aDescriptor )
227 sal_Int32
nLength = aDescriptor.getLength();
228 const PropertyValue * pValue = aDescriptor.getConstArray();
231 if ( pValue[
i].
Name ==
"InputStream" )
232 pValue[
i].Value >>= mxInputStream;
235 if ( !mxInputStream.is() )
242 mxHandler.set(
mxContext->getServiceManager()->createInstanceWithContext(
"com.sun.star.comp.Writer.XMLImporter",
mxContext ), UNO_QUERY );
245 Reference < XImporter > xImporter(
mxHandler, UNO_QUERY);
246 xImporter->setTargetDocument(mxDoc);
253 Reference < XAttributeList > xAttrList ( mpAttrList );
257 mpAttrList->AddAttribute(
"xmlns:office",
"http://openoffice.org/2000/office");
258 mpAttrList->AddAttribute(
"xmlns:style",
"http://openoffice.org/2000/style");
259 mpAttrList->AddAttribute(
"xmlns:text",
"http://openoffice.org/2000/text");
260 mpAttrList->AddAttribute(
"xmlns:table",
"http://openoffice.org/2000/table");
261 mpAttrList->AddAttribute(
"xmlns:draw",
"http://openoffice.org/2000/draw");
262 mpAttrList->AddAttribute(
"xmlns:fo",
"http://www.w3.org/1999/XSL/Format");
263 mpAttrList->AddAttribute(
"xmlns:xlink",
"http://www.w3.org/1999/xlink");
264 mpAttrList->AddAttribute(
"xmlns:number",
"http://openoffice.org/2000/datastyle");
265 mpAttrList->AddAttribute(
"xmlns:svg",
"http://www.w3.org/2000/svg");
266 mpAttrList->AddAttribute(
"xmlns:chart",
"http://openoffice.org/2000/chart");
267 mpAttrList->AddAttribute(
"xmlns:dr3d",
"http://openoffice.org/2000/dr3d");
268 mpAttrList->AddAttribute(
"xmlns:math",
"http://www.w3.org/1998/Math/MathML");
269 mpAttrList->AddAttribute(
"xmlns:form",
"http://openoffice.org/2000/form");
270 mpAttrList->AddAttribute(
"xmlns:script",
"http://openoffice.org/2000/script");
271 mpAttrList->AddAttribute(
"office:class",
"text");
272 mpAttrList->AddAttribute(
"office:version",
"1.0");
273 Start_(
"office:document-content");
275 Start_(
"office:font-decls");
276 mpAttrList->AddAttribute(
"style:name",
"Courier New");
277 mpAttrList->AddAttribute(
"fo:font-family",
"Courier New");
278 mpAttrList->AddAttribute(
"style:font-pitch",
"fixed");
279 Start_(
"style:font-decl");
280 End_(
"style:font-decl");
281 End_(
"office:font-decls");
283 Start_(
"office:automatic-styles");
286 mpAttrList->AddAttribute(
"style:name",
"P1");
287 mpAttrList->AddAttribute(
"style:family",
"paragraph");
288 mpAttrList->AddAttribute(
"style:parent-style-name",
"Standard");
290 mpAttrList->AddAttribute(
"style:font-name",
"Courier New");
291 mpAttrList->AddAttribute(
"fo:font-size",
fs);
292 Start_(
"style:properties");
293 End_(
"style:properties");
297 mpAttrList->AddAttribute(
"style:name",
"P2");
298 mpAttrList->AddAttribute(
"style:family",
"paragraph");
299 mpAttrList->AddAttribute(
"style:parent-style-name",
"Standard");
301 mpAttrList->AddAttribute(
"style:font-name",
"Courier New");
302 mpAttrList->AddAttribute(
"fo:font-size",
fs);
303 mpAttrList->AddAttribute(
"fo:break-before",
"page");
304 Start_(
"style:properties");
305 End_(
"style:properties");
309 mpAttrList->AddAttribute(
"style:name",
"T1");
310 mpAttrList->AddAttribute(
"style:family",
"text");
312 Start_(
"style:properties");
313 End_(
"style:properties");
317 mpAttrList->AddAttribute(
"style:name",
"T2");
318 mpAttrList->AddAttribute(
"style:family",
"text");
320 mpAttrList->AddAttribute(
"fo:font-weight",
"bold");
321 Start_(
"style:properties");
322 End_(
"style:properties");
326 mpAttrList->AddAttribute(
"style:name",
"T3");
327 mpAttrList->AddAttribute(
"style:family",
"text");
329 mpAttrList->AddAttribute(
"fo:font-style",
"italic");
330 Start_(
"style:properties");
331 End_(
"style:properties");
335 mpAttrList->AddAttribute(
"style:name",
"T4");
336 mpAttrList->AddAttribute(
"style:family",
"text");
338 mpAttrList->AddAttribute(
"fo:font-weight",
"bold");
339 mpAttrList->AddAttribute(
"style:text-scale",
"200%");
340 Start_(
"style:properties");
341 End_(
"style:properties");
345 mpAttrList->AddAttribute(
"style:name",
"T5");
346 mpAttrList->AddAttribute(
"style:family",
"text");
348 mpAttrList->AddAttribute(
"fo:font-size",fs2);
349 mpAttrList->AddAttribute(
"fo:font-weight",
"bold");
350 mpAttrList->AddAttribute(
"style:text-scale",
"50%");
351 Start_(
"style:properties");
352 End_(
"style:properties");
356 mpAttrList->AddAttribute(
"style:name",
"T6");
357 mpAttrList->AddAttribute(
"style:family",
"text");
359 mpAttrList->AddAttribute(
"fo:font-size",fs2);
360 mpAttrList->AddAttribute(
"fo:font-weight",
"bold");
361 Start_(
"style:properties");
362 End_(
"style:properties");
366 mpAttrList->AddAttribute(
"style:name",
"T7");
367 mpAttrList->AddAttribute(
"style:family",
"text");
369 mpAttrList->AddAttribute(
"style:text-underline",
"single");
370 Start_(
"style:properties");
371 End_(
"style:properties");
375 mpAttrList->AddAttribute(
"style:name",
"T8");
376 mpAttrList->AddAttribute(
"style:family",
"text");
378 mpAttrList->AddAttribute(
"fo:font-weight",
"bold");
379 mpAttrList->AddAttribute(
"style:text-underline",
"single");
380 Start_(
"style:properties");
381 End_(
"style:properties");
385 mpAttrList->AddAttribute(
"style:name",
"T9");
386 mpAttrList->AddAttribute(
"style:family",
"text");
388 mpAttrList->AddAttribute(
"fo:font-style",
"italic");
389 mpAttrList->AddAttribute(
"style:text-underline",
"single");
390 Start_(
"style:properties");
391 End_(
"style:properties");
395 mpAttrList->AddAttribute(
"style:name",
"T10");
396 mpAttrList->AddAttribute(
"style:family",
"text");
398 mpAttrList->AddAttribute(
"style:text-position",
"27% 100%");
399 Start_(
"style:properties");
400 End_(
"style:properties");
404 mpAttrList->AddAttribute(
"style:name",
"T11");
405 mpAttrList->AddAttribute(
"style:family",
"text");
407 mpAttrList->AddAttribute(
"style:text-position",
"-27% 100%");
408 Start_(
"style:properties");
409 End_(
"style:properties");
412 End_(
"office:automatic-styles");
415 End_(
"office:styles");
422 End_(
"office:document-content");
429void T602ImportFilter::test()
435void T602ImportFilter::Reset602()
456 fst.uline = fst.olduline =
false;
461 pst.ccafterln =
false;
462 pst.willbeeop =
false;
464 pst.wasfdash =
false;
467void T602ImportFilter::inschrdef(
unsigned char ch)
492void T602ImportFilter::wrtfnt()
494 Reference < XAttributeList > xAttrList ( mpAttrList );
498 case standard : style = fst.uline ?
"T7" :
"T1";
break;
499 case fat : style = fst.uline ?
"T8" :
"T2";
break;
500 case cursive : style = fst.uline ?
"T9" :
"T3";
break;
501 case bold : style =
"T4";
break;
502 case tall : style =
"T5";
break;
503 case big : style =
"T6";
break;
504 case lindex : style =
"T11";
break;
505 case hindex : style =
"T10";
break;
506 default : style =
"T1";
break;
511 mpAttrList->AddAttribute(
512 "text:style-name", OUString::createFromAscii(style));
516void T602ImportFilter::setfnt(
fonts fnt,
bool mustwrite)
518 if (fnt == fst.oldfnt && fnt == fst.nowfnt && !mustwrite)
523 if (mustwrite && (fst.oldfnt != fst.nowfnt || fst.olduline != fst.uline))
526 fst.oldfnt = fst.nowfnt;
527 fst.olduline = fst.uline;
531unsigned char T602ImportFilter::Readchar602()
535 return (mxInputStream->readBytes(
aData, 1) > 0) ?
536 reinterpret_cast<unsigned char const *
>(
aData.getConstArray())[0] : 0;
539void T602ImportFilter::par602(
bool endofpage)
542 Reference < XAttributeList > xAttrList ( mpAttrList );
544 if(!endofpage || !pst.waspar) {
550 mpAttrList->AddAttribute(
"text:style-name",
"P1");
555 Start_(
"text:line-break");
556 End_(
"text:line-break");
566 switch(format602.lh) {
567 case 3: pst.pars += 4;
break;
568 case 4: pst.pars += 3;
break;
569 case 6: pst.pars += 2;
break;
570 default: pst.pars +=2;
break;
572 endp = format602.pl-format602.mt-format602.mb;
573 if(!(((pst.pars+1)/2) >= endp || endofpage))
return;
580 mpAttrList->AddAttribute(
"text:style-name",
"P2");
587sal_Int16 T602ImportFilter::readnum(
unsigned char *ch,
bool show)
589 unsigned char buff[21];
592 while((
i<20) && *
ch && (*
ch!=
'\n') && (*
ch!=
','))
595 if(show) inschr(*
ch);
601 return static_cast<sal_Int16
>(atoi(
reinterpret_cast<char const *
>(buff)));
604unsigned char T602ImportFilter::Setformat602(
const char *cmd)
610 if (cmd[0]==
'M' && cmd[1]==
'T') format602.mt = readnum(&
ch,
false);
611 else if (cmd[0]==
'M' && cmd[1]==
'B') format602.mb = readnum(&
ch,
false);
615 else if (cmd[0]==
'C' && cmd[1]==
'T') {
616 format602.ct = readnum(&
ch,
false);
618 switch(format602.ct) {
625 else if (cmd[0]==
'P' && cmd[1]==
'N') format602.pn = readnum(&
ch,
false);
626 else if (cmd[0]==
'L' && cmd[1]==
'H') format602.lh = readnum(&
ch,
false);
628 else if (cmd[0]==
'L' && cmd[1]==
'M') format602.lm = readnum(&
ch,
false);
629 else if (cmd[0]==
'R' && cmd[1]==
'M') format602.rm = readnum(&
ch,
false);
630 else if (cmd[0]==
'P' && cmd[1]==
'L') format602.pl = readnum(&
ch,
false);
631 else if (cmd[0]==
'P' && cmd[1]==
'A') {
if(pst.pars) par602(
true); }
632 else if (cmd[0]==
'C' && cmd[1]==
'P') {
633 sal_Int16
i = readnum(&
ch,
false);
634 if ((
i+pst.pars/2) > (format602.pl-format602.mt-format602.mb))
635 if(pst.pars) par602(
true);
637 while (
ch && (
ch !=
'\n'))
ch = Readchar602();
641tnode T602ImportFilter::PointCmd602(
unsigned char *ch)
646 pcmd[0] =
static_cast<char>(rtl::toAsciiUpperCase(*
ch)); inschr(*
ch);
653 pcmd[1] =
static_cast<char>(rtl::toAsciiUpperCase(*
ch)); inschr(*
ch);
655 if (pcmd[0]==
'P' && pcmd[1]==
'A') {
if (pst.pars) pst.willbeeop =
true; }
656 else if (pcmd[0]==
'C' && pcmd[1]==
'P') {
if (pst.pars) pst.willbeeop =
true; }
657 else if (pcmd[0]==
'P' && pcmd[1]==
'I') {
658 while (*
ch && (*
ch !=
'\n') && (*
ch !=
','))
659 { *
ch = Readchar602(); inschr(*
ch); }
662 if (*
ch==
',') { *
ch = Readchar602(); inschr(*
ch); }
663 pst.pars += (readnum(
ch,
true)*2);
675void T602ImportFilter::Read602()
678 char cmd602[3] = {0};
680 Reference < XAttributeList > xAttrList ( mpAttrList );
685 mpAttrList->AddAttribute(
"text:style-name",
"P1");
688 mpAttrList->AddAttribute(
"text:style-name",
"T1");
698 else if (
ch ==
'\n') {
699 if(!pst.willbeeop) par602(
false);
707 if (pst.willbeeop) par602(
true);
708 pst.willbeeop =
false;
711 else if (
ch ==
'\n') { par602(
false); node =
tnode::EOL; }
712 else if (
ch < 32) {pst.ccafterln =
true; node =
tnode::SETCH;
break;}
715 pst.ccafterln =
false;
721 else if(rtl::isAsciiAlpha(
ch)) node = PointCmd602(&
ch);
728 else if(rtl::isAsciiUpperCase(
ch)) {
733 if(rtl::isAsciiUpperCase(
ch))
738 mxHandler->characters(OUString::createFromAscii(cmd602));
748 ch = Setformat602(cmd602);
757 case '\t' :
Start_(
"text:tab-stop");
758 End_(
"text:tab-stop");
768 case 0x13 : fst.uline = !fst.uline;
break;
769 case 0x02 : setfnt(
fat,
false);
break;
770 case 0x04 : setfnt(
cursive,
false);
break;
771 case 0x0f : setfnt(
bold,
false);
break;
772 case 0x10 : setfnt(
tall,
false);
break;
773 case 0x1d : setfnt(
big,
false);
break;
774 case 0x14 : setfnt(
hindex,
false);
break;
775 case 0x16 : setfnt(
lindex,
false);
break;
816 else if(
ch ==
'\n') {
817 if(!pst.willbeeop) par602(
false);
839OUString SAL_CALL T602ImportFilter::getImplementationName( )
841 return "com.sun.star.comp.Writer.T602ImportFilter";
844sal_Bool SAL_CALL T602ImportFilter::supportsService(
const OUString& rServiceName )
849Sequence< OUString > SAL_CALL T602ImportFilter::getSupportedServiceNames( )
851 return {
"com.sun.star.document.ImportFilter",
"com.sun.star.document.ExtendedTypeDetection" };
865#define propInt_(_prop,_nam,_val) \
866 any <<= static_cast<sal_Int32>(_val);\
867 _prop->setPropertyValue(_nam, any);
868#define propShort_(_prop,_nam,_val) \
869 any <<= static_cast<sal_Int16>(_val);\
870 _prop->setPropertyValue(_nam, any);
871#define propBool_(_prop,_nam,_val) \
873 _prop->setPropertyValue(_nam, any);
874#define propString_(_prop,_nam,_val) \
875 any <<= OUString(_val);\
876 _prop->setPropertyValue(_nam, any);
877#define propStringFromResId_(_prop,_nam,_val) \
878 any <<= FilterResId(_val);\
879 _prop->setPropertyValue(_nam, any);
880#define propGet_(_prop,_nam) \
881 _prop->getPropertyValue(_nam);
883 xMultiServiceFactory->createInstance(_path);
884#define Insert_(_cont,_nam,_obj) \
886 _cont->insertByName( _nam, any );
889 Reference < XMultiComponentFactory > rServiceManager = rComponentContext->getServiceManager();
890 Reference < XInterface > rInstance = rServiceManager->createInstanceWithContext(
"com.sun.star.awt.UnoControlDialogModel", rComponentContext );
892 Reference <XMultiServiceFactory> xMultiServiceFactory (rInstance,UNO_QUERY);
894 Reference < XPropertySet > xPSetDialog( rInstance, UNO_QUERY );
895 propInt_(xPSetDialog,
"PositionX",100);
896 propInt_(xPSetDialog,
"PositionY",100);
901 static constexpr OUStringLiteral T602DLG_OK_BUTTON =
u"ok_button";
902 static constexpr OUStringLiteral T602DLG_CANCEL_BUTTON =
u"cancel_button";
903 static constexpr OUStringLiteral T602DLG_CODE_LB =
u"code_lb";
904 static constexpr OUStringLiteral T602DLG_AZBUKA_CB =
u"azbuka_cb";
905 static constexpr OUStringLiteral T602DLG_COMMENT_CB =
u"comment_cb";
906 static constexpr OUStringLiteral T602DLG_REFORMAT_CB =
u"reformat_cb";
907 static constexpr OUStringLiteral T602DLG_CODE_TXT =
u"code_txt";
909 Reference < XInterface > TextModel =
Inst_(
"com.sun.star.awt.UnoControlFixedTextModel");
910 Reference < XPropertySet > xPSetText( TextModel, UNO_QUERY );
918 Reference < XInterface > ListBoxModel =
Inst_(
"com.sun.star.awt.UnoControlListBoxModel");
919 Reference < XPropertySet > xPSetCodeLB( ListBoxModel, UNO_QUERY );
920 propInt_(xPSetCodeLB,
"PositionX",40);
921 propInt_(xPSetCodeLB,
"PositionY",5);
927 propBool_(xPSetCodeLB,
"MultiSelection",
false);
929 Sequence< OUString > ous
931 FilterResId(T602FILTER_STR_ENCODING_AUTO),
932 FilterResId(T602FILTER_STR_ENCODING_CP852),
933 FilterResId(T602FILTER_STR_ENCODING_CP895),
934 FilterResId(T602FILTER_STR_ENCODING_KOI8CS2)
937 xPSetCodeLB->setPropertyValue(
"StringItemList",
any);
941 xPSetCodeLB->setPropertyValue(
"SelectedItems",
any);
943 Reference < XInterface > AzbCheckBoxModel =
Inst_(
"com.sun.star.awt.UnoControlCheckBoxModel");
944 Reference < XPropertySet > xPSetAzbukaCB( AzbCheckBoxModel, UNO_QUERY );
945 propInt_(xPSetAzbukaCB,
"PositionX",10);
946 propInt_(xPSetAzbukaCB,
"PositionY",25);
947 propInt_(xPSetAzbukaCB,
"Width",100);
948 propInt_(xPSetAzbukaCB,
"Height",14);
949 propString_(xPSetAzbukaCB,
"Name",T602DLG_AZBUKA_CB);
954 Reference < XInterface > RefCheckBoxModel =
Inst_(
"com.sun.star.awt.UnoControlCheckBoxModel");
955 Reference < XPropertySet > xPSetRefCB( RefCheckBoxModel, UNO_QUERY );
956 propInt_(xPSetRefCB,
"PositionX",10);
957 propInt_(xPSetRefCB,
"PositionY",40);
960 propString_(xPSetRefCB,
"Name",T602DLG_REFORMAT_CB);
965 Reference < XInterface > CommCheckBoxModel =
Inst_(
"com.sun.star.awt.UnoControlCheckBoxModel");
966 Reference < XPropertySet > xPSetCommCB( CommCheckBoxModel, UNO_QUERY );
967 propInt_(xPSetCommCB,
"PositionX",10);
968 propInt_(xPSetCommCB,
"PositionY",55);
971 propString_(xPSetCommCB,
"Name",T602DLG_COMMENT_CB);
976 Reference < XInterface > CancelButtonModel =
Inst_(
"com.sun.star.awt.UnoControlButtonModel");
977 Reference < XPropertySet > xPSetCancelButton( CancelButtonModel, UNO_QUERY );
978 propInt_(xPSetCancelButton,
"PositionX",10);
979 propInt_(xPSetCancelButton,
"PositionY",70);
980 propInt_(xPSetCancelButton,
"Width",50);
981 propInt_(xPSetCancelButton,
"Height",14);
982 propString_(xPSetCancelButton,
"Name",T602DLG_CANCEL_BUTTON);
984 propShort_(xPSetCancelButton,
"PushButtonType",2);
987 Reference < XInterface > OkButtonModel =
Inst_(
"com.sun.star.awt.UnoControlButtonModel");
988 Reference < XPropertySet > xPSetOkButton( OkButtonModel, UNO_QUERY );
989 propInt_(xPSetOkButton,
"PositionX",70);
990 propInt_(xPSetOkButton,
"PositionY",70);
992 propInt_(xPSetOkButton,
"Height",14);
993 propString_(xPSetOkButton,
"Name",T602DLG_OK_BUTTON);
997 propBool_(xPSetOkButton,
"DefaultButton",
true);
999 Reference < XNameContainer > xNameCont (rInstance,UNO_QUERY);
1001 Insert_(xNameCont, T602DLG_OK_BUTTON, OkButtonModel);
1002 Insert_(xNameCont, T602DLG_CANCEL_BUTTON, CancelButtonModel);
1003 Insert_(xNameCont, T602DLG_AZBUKA_CB, AzbCheckBoxModel);
1004 Insert_(xNameCont, T602DLG_REFORMAT_CB, RefCheckBoxModel);
1005 Insert_(xNameCont, T602DLG_COMMENT_CB, CommCheckBoxModel);
1006 Insert_(xNameCont, T602DLG_CODE_LB, ListBoxModel);
1007 Insert_(xNameCont, T602DLG_CODE_TXT, TextModel);
1009 Reference< XUnoControlDialog > dialog = UnoControlDialog::create(rComponentContext);
1011 Reference < XControlModel > xControlModel (rInstance,UNO_QUERY);
1013 dialog->setModel( xControlModel );
1015 Reference < XToolkit > xToolkit = Toolkit::create( rComponentContext );
1017 dialog->setVisible(
false );
1018 dialog->createPeer( xToolkit,
nullptr );
1020 bool ret = ( dialog->execute() != 0 );
1039 Reference<XControl>(dialog)->dispose();
1051 return css::ui::dialogs::ExecutableDialogResults::OK;
1053 return css::ui::dialogs::ExecutableDialogResults::CANCEL;
1058 return uno::Sequence<beans::PropertyValue>();
1069 return "com.sun.star.comp.Writer.T602ImportFilterDialog";
1079 return {
"com.sun.star.ui.dialogs.FilterOptionsDialog" };
1084extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
1086 css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any>
const&)
1091extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
1093 css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any>
const&)
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual void SAL_CALL setPropertyValues(const css::uno::Sequence< css::beans::PropertyValue > &aProps) override
virtual OUString SAL_CALL getImplementationName() override
virtual ~T602ImportFilterDialog() override
virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getPropertyValues() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual void SAL_CALL setTitle(const OUString &aTitle) override
virtual sal_Int16 SAL_CALL execute() override
constexpr OUStringLiteral aData
unsigned char const kam2lat[129]
unsigned char const rus2UNC[257]
unsigned char const lat2UNC[257]
unsigned char const koi2lat[129]
Shape IDs per cluster in DGG atom.
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
CPPUHELPER_DLLPUBLIC css::uno::Reference< css::uno::XComponentContext > SAL_CALL defaultBootstrap_InitialComponentContext()
static const sal_Int16 fontsize
#define propBool_(_prop, _nam, _val)
#define Insert_(_cont, _nam, _obj)
#define propGet_(_prop, _nam)
#define propStringFromResId_(_prop, _nam, _val)
#define propShort_(_prop, _nam, _val)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * filter_T602ImportFilterDialog_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
#define propString_(_prop, _nam, _val)
#define propInt_(_prop, _nam, _val)
SAL_DLLPUBLIC_EXPORT bool TestImport602(SvStream &rStream)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * filter_T602ImportFilter_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
rtl::Reference< FragmentHandler > mxHandler