1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "t602filter.hxx"
21 #include <strings.hrc>
23 #include <cppuhelper/factory.hxx>
24 #include <cppuhelper/supportsservice.hxx>
25 #include <com/sun/star/awt/Toolkit.hpp>
26 #include <com/sun/star/beans/XPropertySet.hpp>
27 #include <com/sun/star/container/XNameContainer.hpp>
28 #include <com/sun/star/awt/UnoControlDialog.hpp>
29 #include <com/sun/star/awt/XControl.hpp>
30 #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
31 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
32 #include <comphelper/processfactory.hxx>
33 #include <osl/diagnose.h>
34 #include <rtl/ref.hxx>
35 #include <rtl/character.hxx>
36 #include <unotools/streamwrap.hxx>
39 using namespace ::cppu
;
40 using namespace ::com::sun::star
;
41 using namespace ::com::sun::star::uno
;
42 using namespace ::com::sun::star::lang
;
43 using namespace ::com::sun::star::container
;
44 using namespace ::com::sun::star::beans
;
45 using namespace ::com::sun::star::awt
;
46 using namespace ::com::sun::star::xml::sax
;
47 using namespace ::com::sun::star::document
;
48 using com::sun::star::io::XInputStream
;
50 namespace T602ImportFilter
{
52 unsigned char const kam2lat
[129] =
53 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
54 "\xAC\x81\x82\xD4\x84\xD2\x9B\x9F\xD8\xB7\x91\xD6\x96\x92\x8E\xB5" // 8
55 "\x90\xA7\xA6\x93\x94\xE0\x85\xE9\xEC\x99\x9A\xE6\x95\xED\xFC\x9C" // 9
56 "\xA0\xA1\xA2\xA3\xE5\xD5\xDE\xE2\xE7\xFD\xEA\xE8\xCE\xF5\xAE\xAF" // A
57 "\x80\x80\x83\xB3\xB4\xE1\x87\x88\x89\x8A\x8B\x8C\x8F\x97\x8D\xBF" // B
58 "\xC0\xC1\xC2\xC3\xC4\xC5\xCF\x98\x9D\x9E\xA4\xA5\xA8\xA9\x86\xF3" // C
59 "\xCD\xB1\xB2\xB6\xB8\xB9\xBA\xBB\xF7\xD9\xDA\xDB\xDC\xF8\xF9\xDF" // D
60 "\xD0\xD1\xD3\xD7\xAA\xAB\xDD\xB0\xE3\xE4\xEB\xEE\xEF\xF0\xF2\xF4" // E
61 "\xBC\xBD\xBE\xC6\xC7\xC8\xF6\xC9\xCA\xFA\xFB\xCB\xF1\xCC\xFE\xFF"; // F
63 unsigned char const koi2lat
[129] =
64 // 0 1 2 3 4 5 6 7 8 9 A B C D E F
65 "\x80\x83\x86\xF5\xE1\x87\x88\x89\x8A\x8B\x8C\x8F\x97\xCF\xCF\x98" // 8
66 "\x9D\x9E\xA4\xA5\xA8\xA9\xDB\xDC\xDF\xB1\xB2\xB6\xB8\xB9\xBA\xBB" // 9
67 "\xBC\xBD\xBE\xC6\xC7\xC8\xF6\xC9\xCA\xCB\xCC\xCD\xCE\xAD\xAE\xAF" // A
68 "\xD0\xD1\xD3\xD7\xAA\xAB\xDD\xB0\xE3\xE4\xEB\xEE\xEF\xF0\xF2\xF4" // B
69 "\xDA\xA0\xC0\x9F\xD4\xD8\xEA\xC4\x81\xA1\x85\x92\x96\x94\xE5\xA2" // C
70 "\x93\x84\xFD\xE7\x9C\xA3\xC3\x82\xF7\xEC\xA7\xC2\xF3\xF8\xF9\xC5" // D
71 "\xBF\xB5\xD9\xAC\xD2\xB7\xE8\xB3\x9A\xD6\xDE\x91\x95\x99\xD5\xE0" // E
72 "\xE2\x8E\xFC\xE6\x9B\xE9\xB4\x90\xFA\xED\xA6\xC1\xF1\xFB\xFE\xFF"; // F
74 unsigned char const lat2UNC
[257] =
77 "\x00\xe7\x00\xfc\x00\xe9\x00\xf9\x00\xe4\x01\x6f\x00\xe8\x00\xa3" // 8
78 "\x00\xc6\x00\xd8\x00\xc5\x00\xe6\x00\xf8\x00\xc4\x00\xc4\x00\xe5"
79 "\x00\xc9\x01\x39\x00\xf4\x00\xf4\x00\xf6\x01\x3d\x01\x3e\x00\x20" // 9
80 "\x00\xf2\x00\xd6\x00\xdc\x01\x64\x01\x65\x00\xec\x20\xa7\x01\x0d"
81 "\x00\xe1\x00\xed\x00\xf3\x00\xfa\x00\xa1\x00\xd1\x01\x7d\x01\x7e" // A
82 "\x00\xbf\x00\xf1\x22\x11\x03\xc3\x01\x0c\x00\xa7\x00\xbb\x00\xab"
83 "\x25\x91\x25\x92\x25\x93\x25\x02\x25\x24\x00\xc1\x00\xc2\x01\x1a" // B
84 "\x00\x20\x00\x20\x00\x20\x00\x20\x22\x61\x00\xb1\x22\x65\x25\x10"
85 "\x25\x14\x25\x34\x25\x2c\x25\x1c\x25\x00\x25\x3c\x22\x64\x23\x20" // C
86 "\x23\x21\x22\x48\x00\xba\x22\x1a\x00\xb2\x00\xbd\x00\xbc\x00\xa4"
87 "\x03\xb1\x03\xb2\x01\x0e\x03\x93\x01\x0f\x01\x47\x00\xcd\x03\xc0" // D
88 "\x01\x1b\x25\x18\x25\x0c\x25\x88\x25\x84\x00\xb5\x01\x6e\x25\x80"
89 "\x00\xd3\x00\xdf\x00\xd4\x03\xa6\x03\x98\x01\x48\x01\x60\x01\x61" // E
90 "\x01\x54\x00\xda\x01\x55\x03\xa9\x00\xfd\x00\xdd\x03\xb4\x22\x1e"
91 "\x00\xf8\x02\xdd\x03\xb5\x02\xc7\x22\x29\x00\xa7\x00\xf7\x00\xe0" // F
92 "\x00\xb4\x00\xb0\x00\xc0\x02\xc6\x01\x58\x01\x59\x00\x20\x00\x20";
94 unsigned char const rus2UNC
[257] =
97 "\x04\x11\x00\xfc\x00\xe9\x04\x12\x00\xe4\x01\x6f\x04\x13\x04\x14" // 8
98 "\x04\x01\x04\x16\x04\x17\x04\x18\x04\x19\x00\xc4\x00\xc4\x04\x1a"
99 "\x00\xc9\x01\x39\x01\x3a\x00\xf4\x00\xf6\x01\x3d\x01\x3e\x00\x20" // 9
100 "\x04\x1c\x00\xd6\x00\xdc\x01\x64\x01\x65\x04\x1d\x04\x1f\x01\x0a"
101 "\x00\xe1\x00\xed\x00\xf3\x00\xfa\x04\x20\x04\x22\x01\x7d\x01\x7e" // A
102 "\x04\x23\x04\x24\x04\x43\x04\x44\x01\x0c\x00\xa7\x04\x3b\x04\x3c"
103 "\x04\x47\x04\x26\x04\x27\x25\x02\x25\x24\x00\xc1\x04\x28\x01\x1a" // B
104 "\x04\x29\x04\x2a\x04\x2b\x04\x2c\x04\x2d\x04\x2e\x04\x2f\x25\x10"
105 "\x25\x14\x25\x34\x25\x2c\x25\x1c\x25\x00\x25\x3c\x04\x31\x04\x32" // C
106 "\x04\x33\x04\x51\x04\x36\x04\x37\x04\x38\x04\x39\x04\x3a\x04\x1b"
107 "\x04\x3d\x04\x3f\x01\x0e\x04\x40\x01\x0f\x01\x47\x00\xcd\x04\x42" // D
108 "\x01\x1b\x25\x18\x25\x0c\x25\x88\x25\x84\x04\x46\x01\x6e\x25\x80"
109 "\x00\xd3\x00\xdf\x00\xd4\x04\x48\x04\x49\x01\x48\x01\x60\x01\x61" // E
110 "\x01\x54\x00\xda\x01\x55\x04\x4a\x00\xfd\x00\xdd\x04\x4b\x04\x4c"
111 "\x04\x4d\x02\xdd\x04\x4e\x02\xc7\x04\x4f\x00\xa7\x04\x34\x00\xe0" // F
112 "\x00\xb4\x00\xb0\x00\xc0\x02\xc6\x01\x58\x01\x59\x00\x20\x00\x20";
114 #define Start_(_nam) \
115 if (mxHandler.is()) \
117 mxHandler->startElement(_nam, xAttrList); \
119 mpAttrList->Clear(); \
123 if (mxHandler.is()) \
125 mxHandler->endElement(_nam); \
128 static inistruct ini
;
130 T602ImportFilter::T602ImportFilter(css::uno::Reference
<css::uno::XComponentContext
> x
)
131 : mxContext(std::move(x
))
136 T602ImportFilter::T602ImportFilter(css::uno::Reference
<css::io::XInputStream
> xInputStream
)
137 : mxInputStream(std::move(xInputStream
))
143 T602ImportFilter::~T602ImportFilter()
147 // XExtendedTypeDetection
148 OUString
T602ImportFilter::detect( Sequence
<PropertyValue
>& Descriptor
)
150 sal_Int32 nLength
= Descriptor
.getLength();
151 const PropertyValue
* pValue
= Descriptor
.getConstArray();
152 for ( sal_Int32 i
= 0 ; i
< nLength
; i
++)
154 if ( pValue
[i
].Name
== "InputStream" )
155 pValue
[i
].Value
>>= mxInputStream
;
158 if (!mxInputStream
.is())
161 css::uno::Sequence
< sal_Int8
> aData
;
162 const size_t numBytes
= 4;
163 size_t numBytesRead
= mxInputStream
->readSomeBytes (aData
, numBytes
);
165 if ((numBytesRead
!= numBytes
) || (aData
[0] != '@') ||
166 (aData
[1] != 'C') || (aData
[2] != 'T') || (aData
[3] != ' '))
169 return u
"writer_T602_Document"_ustr
;
173 sal_Bool SAL_CALL
T602ImportFilter::filter( const Sequence
< css::beans::PropertyValue
>& aDescriptor
)
175 return importImpl ( aDescriptor
);
179 void SAL_CALL
T602ImportFilter::setTargetDocument( const Reference
< css::lang::XComponent
>& xDoc
)
185 void SAL_CALL
T602ImportFilter::initialize( const Sequence
< Any
>& /*aArguments*/ )
191 void T602ImportFilter::inschr(unsigned char ch
)
193 Reference
< XAttributeList
> xAttrList ( mpAttrList
);
195 if(!ini
.showcomm
&&pst
.comment
) return;
203 if(pst
.wasspace
> 0) {
204 if(ini
.reformatpars
) {
207 pst
.wasfdash
= false;
210 mpAttrList
->AddAttribute(u
"text:c"_ustr
,OUString::number(pst
.wasspace
));
211 Start_(u
"text:s"_ustr
);
212 End_(u
"text:s"_ustr
);
221 bool T602ImportFilter::importImpl( const Sequence
< css::beans::PropertyValue
>& aDescriptor
)
225 sal_Int32 nLength
= aDescriptor
.getLength();
226 const PropertyValue
* pValue
= aDescriptor
.getConstArray();
227 for ( sal_Int32 i
= 0 ; i
< nLength
; i
++)
229 if ( pValue
[i
].Name
== "InputStream" )
230 pValue
[i
].Value
>>= mxInputStream
;
233 if ( !mxInputStream
.is() )
239 // An XML import service: what we push sax messages to...
240 mxHandler
.set( mxContext
->getServiceManager()->createInstanceWithContext( u
"com.sun.star.comp.Writer.XMLImporter"_ustr
, mxContext
), UNO_QUERY
);
242 // The XImporter sets up an empty target document for XDocumentHandler to write to...
243 Reference
< XImporter
> xImporter(mxHandler
, UNO_QUERY
);
244 xImporter
->setTargetDocument(mxDoc
);
246 auto const fs
= OUString(OUString::number(inistruct::fontsize
) + "pt");
247 auto const fs2
= OUString(OUString::number(2*inistruct::fontsize
) + "pt");
249 mpAttrList
= new comphelper::AttributeList
;
251 Reference
< XAttributeList
> xAttrList ( mpAttrList
);
253 mxHandler
->startDocument();
255 mpAttrList
->AddAttribute(u
"xmlns:office"_ustr
, u
"http://openoffice.org/2000/office"_ustr
);
256 mpAttrList
->AddAttribute(u
"xmlns:style"_ustr
, u
"http://openoffice.org/2000/style"_ustr
);
257 mpAttrList
->AddAttribute(u
"xmlns:text"_ustr
, u
"http://openoffice.org/2000/text"_ustr
);
258 mpAttrList
->AddAttribute(u
"xmlns:table"_ustr
, u
"http://openoffice.org/2000/table"_ustr
);
259 mpAttrList
->AddAttribute(u
"xmlns:draw"_ustr
, u
"http://openoffice.org/2000/draw"_ustr
);
260 mpAttrList
->AddAttribute(u
"xmlns:fo"_ustr
, u
"http://www.w3.org/1999/XSL/Format"_ustr
);
261 mpAttrList
->AddAttribute(u
"xmlns:xlink"_ustr
, u
"http://www.w3.org/1999/xlink"_ustr
);
262 mpAttrList
->AddAttribute(u
"xmlns:number"_ustr
, u
"http://openoffice.org/2000/datastyle"_ustr
);
263 mpAttrList
->AddAttribute(u
"xmlns:svg"_ustr
, u
"http://www.w3.org/2000/svg"_ustr
);
264 mpAttrList
->AddAttribute(u
"xmlns:chart"_ustr
, u
"http://openoffice.org/2000/chart"_ustr
);
265 mpAttrList
->AddAttribute(u
"xmlns:dr3d"_ustr
, u
"http://openoffice.org/2000/dr3d"_ustr
);
266 mpAttrList
->AddAttribute(u
"xmlns:math"_ustr
, u
"http://www.w3.org/1998/Math/MathML"_ustr
);
267 mpAttrList
->AddAttribute(u
"xmlns:form"_ustr
, u
"http://openoffice.org/2000/form"_ustr
);
268 mpAttrList
->AddAttribute(u
"xmlns:script"_ustr
, u
"http://openoffice.org/2000/script"_ustr
);
269 mpAttrList
->AddAttribute(u
"office:class"_ustr
, u
"text"_ustr
);
270 mpAttrList
->AddAttribute(u
"office:version"_ustr
, u
"1.0"_ustr
);
271 Start_(u
"office:document-content"_ustr
);
273 Start_(u
"office:font-decls"_ustr
);
274 mpAttrList
->AddAttribute(u
"style:name"_ustr
,u
"Courier New"_ustr
);
275 mpAttrList
->AddAttribute(u
"fo:font-family"_ustr
,u
"Courier New"_ustr
);
276 mpAttrList
->AddAttribute(u
"style:font-pitch"_ustr
,u
"fixed"_ustr
);
277 Start_(u
"style:font-decl"_ustr
);
278 End_(u
"style:font-decl"_ustr
);
279 End_(u
"office:font-decls"_ustr
);
281 Start_(u
"office:automatic-styles"_ustr
);
284 mpAttrList
->AddAttribute(u
"style:name"_ustr
,u
"P1"_ustr
);
285 mpAttrList
->AddAttribute(u
"style:family"_ustr
,u
"paragraph"_ustr
);
286 mpAttrList
->AddAttribute(u
"style:parent-style-name"_ustr
,u
"Standard"_ustr
);
287 Start_(u
"style:style"_ustr
);
288 mpAttrList
->AddAttribute(u
"style:font-name"_ustr
,u
"Courier New"_ustr
);
289 mpAttrList
->AddAttribute(u
"fo:font-size"_ustr
,fs
);
290 Start_(u
"style:properties"_ustr
);
291 End_(u
"style:properties"_ustr
);
292 End_(u
"style:style"_ustr
);
294 // Standardni text - konec stranky
295 mpAttrList
->AddAttribute(u
"style:name"_ustr
,u
"P2"_ustr
);
296 mpAttrList
->AddAttribute(u
"style:family"_ustr
,u
"paragraph"_ustr
);
297 mpAttrList
->AddAttribute(u
"style:parent-style-name"_ustr
,u
"Standard"_ustr
);
298 Start_(u
"style:style"_ustr
);
299 mpAttrList
->AddAttribute(u
"style:font-name"_ustr
,u
"Courier New"_ustr
);
300 mpAttrList
->AddAttribute(u
"fo:font-size"_ustr
,fs
);
301 mpAttrList
->AddAttribute(u
"fo:break-before"_ustr
,u
"page"_ustr
);
302 Start_(u
"style:properties"_ustr
);
303 End_(u
"style:properties"_ustr
);
304 End_(u
"style:style"_ustr
);
307 mpAttrList
->AddAttribute(u
"style:name"_ustr
,u
"T1"_ustr
);
308 mpAttrList
->AddAttribute(u
"style:family"_ustr
,u
"text"_ustr
);
309 Start_(u
"style:style"_ustr
);
310 Start_(u
"style:properties"_ustr
);
311 End_(u
"style:properties"_ustr
);
312 End_(u
"style:style"_ustr
);
315 mpAttrList
->AddAttribute(u
"style:name"_ustr
,u
"T2"_ustr
);
316 mpAttrList
->AddAttribute(u
"style:family"_ustr
,u
"text"_ustr
);
317 Start_(u
"style:style"_ustr
);
318 mpAttrList
->AddAttribute(u
"fo:font-weight"_ustr
,u
"bold"_ustr
);
319 Start_(u
"style:properties"_ustr
);
320 End_(u
"style:properties"_ustr
);
321 End_(u
"style:style"_ustr
);
324 mpAttrList
->AddAttribute(u
"style:name"_ustr
,u
"T3"_ustr
);
325 mpAttrList
->AddAttribute(u
"style:family"_ustr
,u
"text"_ustr
);
326 Start_(u
"style:style"_ustr
);
327 mpAttrList
->AddAttribute(u
"fo:font-style"_ustr
,u
"italic"_ustr
);
328 Start_(u
"style:properties"_ustr
);
329 End_(u
"style:properties"_ustr
);
330 End_(u
"style:style"_ustr
);
333 mpAttrList
->AddAttribute(u
"style:name"_ustr
,u
"T4"_ustr
);
334 mpAttrList
->AddAttribute(u
"style:family"_ustr
,u
"text"_ustr
);
335 Start_(u
"style:style"_ustr
);
336 mpAttrList
->AddAttribute(u
"fo:font-weight"_ustr
,u
"bold"_ustr
);
337 mpAttrList
->AddAttribute(u
"style:text-scale"_ustr
,u
"200%"_ustr
);
338 Start_(u
"style:properties"_ustr
);
339 End_(u
"style:properties"_ustr
);
340 End_(u
"style:style"_ustr
);
343 mpAttrList
->AddAttribute(u
"style:name"_ustr
,u
"T5"_ustr
);
344 mpAttrList
->AddAttribute(u
"style:family"_ustr
,u
"text"_ustr
);
345 Start_(u
"style:style"_ustr
);
346 mpAttrList
->AddAttribute(u
"fo:font-size"_ustr
,fs2
);
347 mpAttrList
->AddAttribute(u
"fo:font-weight"_ustr
,u
"bold"_ustr
);
348 mpAttrList
->AddAttribute(u
"style:text-scale"_ustr
,u
"50%"_ustr
);
349 Start_(u
"style:properties"_ustr
);
350 End_(u
"style:properties"_ustr
);
351 End_(u
"style:style"_ustr
);
354 mpAttrList
->AddAttribute(u
"style:name"_ustr
,u
"T6"_ustr
);
355 mpAttrList
->AddAttribute(u
"style:family"_ustr
,u
"text"_ustr
);
356 Start_(u
"style:style"_ustr
);
357 mpAttrList
->AddAttribute(u
"fo:font-size"_ustr
,fs2
);
358 mpAttrList
->AddAttribute(u
"fo:font-weight"_ustr
,u
"bold"_ustr
);
359 Start_(u
"style:properties"_ustr
);
360 End_(u
"style:properties"_ustr
);
361 End_(u
"style:style"_ustr
);
364 mpAttrList
->AddAttribute(u
"style:name"_ustr
,u
"T7"_ustr
);
365 mpAttrList
->AddAttribute(u
"style:family"_ustr
,u
"text"_ustr
);
366 Start_(u
"style:style"_ustr
);
367 mpAttrList
->AddAttribute(u
"style:text-underline"_ustr
,u
"single"_ustr
);
368 Start_(u
"style:properties"_ustr
);
369 End_(u
"style:properties"_ustr
);
370 End_(u
"style:style"_ustr
);
372 // T8 Podtrzena tucny text
373 mpAttrList
->AddAttribute(u
"style:name"_ustr
,u
"T8"_ustr
);
374 mpAttrList
->AddAttribute(u
"style:family"_ustr
,u
"text"_ustr
);
375 Start_(u
"style:style"_ustr
);
376 mpAttrList
->AddAttribute(u
"fo:font-weight"_ustr
,u
"bold"_ustr
);
377 mpAttrList
->AddAttribute(u
"style:text-underline"_ustr
,u
"single"_ustr
);
378 Start_(u
"style:properties"_ustr
);
379 End_(u
"style:properties"_ustr
);
380 End_(u
"style:style"_ustr
);
382 // T9 Podtrzena kurziva
383 mpAttrList
->AddAttribute(u
"style:name"_ustr
,u
"T9"_ustr
);
384 mpAttrList
->AddAttribute(u
"style:family"_ustr
,u
"text"_ustr
);
385 Start_(u
"style:style"_ustr
);
386 mpAttrList
->AddAttribute(u
"fo:font-style"_ustr
,u
"italic"_ustr
);
387 mpAttrList
->AddAttribute(u
"style:text-underline"_ustr
,u
"single"_ustr
);
388 Start_(u
"style:properties"_ustr
);
389 End_(u
"style:properties"_ustr
);
390 End_(u
"style:style"_ustr
);
393 mpAttrList
->AddAttribute(u
"style:name"_ustr
,u
"T10"_ustr
);
394 mpAttrList
->AddAttribute(u
"style:family"_ustr
,u
"text"_ustr
);
395 Start_(u
"style:style"_ustr
);
396 mpAttrList
->AddAttribute(u
"style:text-position"_ustr
,u
"27% 100%"_ustr
);
397 Start_(u
"style:properties"_ustr
);
398 End_(u
"style:properties"_ustr
);
399 End_(u
"style:style"_ustr
);
402 mpAttrList
->AddAttribute(u
"style:name"_ustr
,u
"T11"_ustr
);
403 mpAttrList
->AddAttribute(u
"style:family"_ustr
,u
"text"_ustr
);
404 Start_(u
"style:style"_ustr
);
405 mpAttrList
->AddAttribute(u
"style:text-position"_ustr
,u
"-27% 100%"_ustr
);
406 Start_(u
"style:properties"_ustr
);
407 End_(u
"style:properties"_ustr
);
408 End_(u
"style:style"_ustr
);
410 End_(u
"office:automatic-styles"_ustr
);
412 Start_(u
"office:styles"_ustr
);
413 End_(u
"office:styles"_ustr
);
415 Start_(u
"office:body"_ustr
);
419 End_(u
"office:body"_ustr
);
420 End_(u
"office:document-content"_ustr
);
422 mxHandler
->endDocument();
427 void T602ImportFilter::test()
433 void T602ImportFilter::Reset602()
447 ini
.showcomm
= false;
448 ini
.forcecode
= false;
451 ini
.reformatpars
= false;
453 fst
.nowfnt
= fst
.oldfnt
= standard
;
454 fst
.uline
= fst
.olduline
= false;
459 pst
.ccafterln
= false;
460 pst
.willbeeop
= false;
462 pst
.wasfdash
= false;
465 void T602ImportFilter::inschrdef(unsigned char ch
)
473 case KOI
: ch
= koi2lat
[ch
-128]; break;
474 case KAM
: ch
= kam2lat
[ch
-128]; break;
475 default : ch
= kam2lat
[ch
-128];
479 xch
= (rus2UNC
[(ch
-128)*2] << 8) + rus2UNC
[(ch
-128)*2+1];
481 xch
= (lat2UNC
[(ch
-128)*2] << 8) + lat2UNC
[(ch
-128)*2+1];
487 mxHandler
->characters(OUString(xch
));
490 void T602ImportFilter::wrtfnt()
492 Reference
< XAttributeList
> xAttrList ( mpAttrList
);
496 case standard
: style
= fst
.uline
? "T7" : "T1"; break;
497 case fat
: style
= fst
.uline
? "T8" : "T2"; break;
498 case cursive
: style
= fst
.uline
? "T9" : "T3"; break;
499 case bold
: style
= "T4"; break;
500 case tall
: style
= "T5"; break;
501 case big
: style
= "T6"; break;
502 case lindex
: style
= "T11";break;
503 case hindex
: style
= "T10";break;
504 default : style
= "T1"; break;
507 End_(u
"text:span"_ustr
);
509 mpAttrList
->AddAttribute(
510 u
"text:style-name"_ustr
, OUString::createFromAscii(style
));
511 Start_(u
"text:span"_ustr
);
514 void T602ImportFilter::setfnt(fonts fnt
,bool mustwrite
)
516 if (fnt
== fst
.oldfnt
&& fnt
== fst
.nowfnt
&& !mustwrite
)
517 fst
.nowfnt
= standard
;
518 else if (fnt
!= chngul
)
521 if (mustwrite
&& (fst
.oldfnt
!= fst
.nowfnt
|| fst
.olduline
!= fst
.uline
))
524 fst
.oldfnt
= fst
.nowfnt
;
525 fst
.olduline
= fst
.uline
;
529 unsigned char T602ImportFilter::Readchar602()
531 static Sequence
< sal_Int8
> aData
;
533 return (mxInputStream
->readBytes(aData
, 1) > 0) ?
534 reinterpret_cast<unsigned char const *>(aData
.getConstArray())[0] : 0;
537 void T602ImportFilter::par602(bool endofpage
)
540 Reference
< XAttributeList
> xAttrList ( mpAttrList
);
542 if(!endofpage
|| !pst
.waspar
) {
543 if(ini
.showcomm
||!pst
.comment
) {
544 if(pst
.waspar
||ini
.reformatpars
) {
545 End_(u
"text:span"_ustr
);
546 End_(u
"text:p"_ustr
);
548 mpAttrList
->AddAttribute(u
"text:style-name"_ustr
, u
"P1"_ustr
);
549 Start_(u
"text:p"_ustr
);
550 Start_(u
"text:span"_ustr
);
553 Start_(u
"text:line-break"_ustr
);
554 End_(u
"text:line-break"_ustr
);
564 switch(format602
.lh
) {
565 case 3: pst
.pars
+= 4; break;
566 case 4: pst
.pars
+= 3; break;
567 case 6: pst
.pars
+= 2; break;
568 default: pst
.pars
+=2; break;
570 endp
= format602
.pl
-format602
.mt
-format602
.mb
;
571 if(!(((pst
.pars
+1)/2) >= endp
|| endofpage
)) return;
574 if(!ini
.reformatpars
) {
575 End_(u
"text:span"_ustr
);
576 End_(u
"text:p"_ustr
);
578 mpAttrList
->AddAttribute(u
"text:style-name"_ustr
, u
"P2"_ustr
);
579 Start_(u
"text:p"_ustr
);
580 Start_(u
"text:span"_ustr
);
585 sal_Int16
T602ImportFilter::readnum(unsigned char *ch
, bool show
)
587 unsigned char buff
[21];
590 while((i
<20) && *ch
&& (*ch
!='\n') && (*ch
!=','))
593 if(show
) inschr(*ch
);
598 // mba: cast from unsigned char via int to sal_Int16 seems to be safe
599 return static_cast<sal_Int16
>(atoi(reinterpret_cast<char const *>(buff
)));
602 unsigned char T602ImportFilter::Setformat602(const char *cmd
)
608 if (cmd
[0]=='M' && cmd
[1]=='T') format602
.mt
= readnum(&ch
,false);
609 else if (cmd
[0]=='M' && cmd
[1]=='B') format602
.mb
= readnum(&ch
,false);
610 // else if (cmd[0]=='T' && cmd[1]=='B') {}
611 // else if (cmd[0]=='H' && cmd[1]=='E') {}
612 // else if (cmd[0]=='F' && cmd[1]=='O') {}
613 else if (cmd
[0]=='C' && cmd
[1]=='T') {
614 format602
.ct
= readnum(&ch
,false);
616 switch(format602
.ct
) {
617 case 0: ini
.xcode
= KAM
; break;
618 case 1: ini
.xcode
= L2
; break;
619 case 2: ini
.xcode
= KOI
; break;
620 default: ini
.xcode
= KAM
; break;
623 else if (cmd
[0]=='P' && cmd
[1]=='N') format602
.pn
= readnum(&ch
,false);
624 else if (cmd
[0]=='L' && cmd
[1]=='H') format602
.lh
= readnum(&ch
,false);
625 // else if(cmd[0]=='S' && cmd[1]=='T') {} //styl
626 else if (cmd
[0]=='L' && cmd
[1]=='M') format602
.lm
= readnum(&ch
,false);
627 else if (cmd
[0]=='R' && cmd
[1]=='M') format602
.rm
= readnum(&ch
,false);
628 else if (cmd
[0]=='P' && cmd
[1]=='L') format602
.pl
= readnum(&ch
,false);
629 else if (cmd
[0]=='P' && cmd
[1]=='A') { if(pst
.pars
) par602(true); }
630 else if (cmd
[0]=='C' && cmd
[1]=='P') {
631 sal_Int16 i
= readnum(&ch
,false);
632 if ((i
+pst
.pars
/2) > (format602
.pl
-format602
.mt
-format602
.mb
))
633 if(pst
.pars
) par602(true);
635 while (ch
&& (ch
!= '\n')) ch
= Readchar602();
639 tnode
T602ImportFilter::PointCmd602(unsigned char *ch
)
643 // warning: uChar -> char
644 pcmd
[0] = static_cast<char>(rtl::toAsciiUpperCase(*ch
)); inschr(*ch
);
646 if (!*ch
) return tnode::EEND
;
647 if (*ch
=='\n') return tnode::EOL
;
648 if (!rtl::isAsciiAlpha(*ch
)) return (*ch
<32) ? tnode::SETCH
: tnode::WRITE
;
650 // warning: uChar -> char
651 pcmd
[1] = static_cast<char>(rtl::toAsciiUpperCase(*ch
)); inschr(*ch
);
653 if (pcmd
[0]=='P' && pcmd
[1]=='A') { if (pst
.pars
) pst
.willbeeop
= true; }
654 else if (pcmd
[0]=='C' && pcmd
[1]=='P') { if (pst
.pars
) pst
.willbeeop
= true; }
655 else if (pcmd
[0]=='P' && pcmd
[1]=='I') {
656 while (*ch
&& (*ch
!= '\n') && (*ch
!= ','))
657 { *ch
= Readchar602(); inschr(*ch
); }
658 if (!*ch
) return tnode::EEND
;
659 if (*ch
=='\n') return tnode::EOL
;
660 if (*ch
==',') { *ch
= Readchar602(); inschr(*ch
); }
661 pst
.pars
+= (readnum(ch
,true)*2);
662 if (!*ch
) return tnode::EEND
;
663 if (*ch
=='\n') return tnode::EOL
;
665 // else if(pcmd[0]=='K'&&pcmd[1]=='P') {}
666 // else if(pcmd[0]=='H'&&pcmd[1]=='E') {}
667 // else if(pcmd[0]=='F'&&pcmd[1]=='O') {}
669 return tnode::READCH
;
673 void T602ImportFilter::Read602()
676 char cmd602
[3] = {0};
678 Reference
< XAttributeList
> xAttrList ( mpAttrList
);
680 if (node
==tnode::QUIT
) return;
683 mpAttrList
->AddAttribute(u
"text:style-name"_ustr
, u
"P1"_ustr
);
684 Start_(u
"text:p"_ustr
);
686 mpAttrList
->AddAttribute(u
"text:style-name"_ustr
, u
"T1"_ustr
);
687 Start_(u
"text:span"_ustr
);
689 if (node
==tnode::START
) { node
= tnode::EOL
; }
691 while (node
!= tnode::EEND
) {
695 if (ch
== 0) node
= tnode::EEND
;
696 else if (ch
== '\n') {
697 if(!pst
.willbeeop
) par602(false);
699 } else if (ch
< 32) node
= tnode::SETCH
;
700 else node
= tnode::WRITE
;
705 if (pst
.willbeeop
) par602(true);
706 pst
.willbeeop
= false;
707 if(ch
== 0) node
= tnode::EEND
;
708 else if (ch
== '@') node
= tnode::EXPCMD
;
709 else if (ch
== '\n') { par602(false); node
= tnode::EOL
; }
710 else if (ch
< 32) {pst
.ccafterln
= true; node
= tnode::SETCH
; break;}
711 else node
= tnode::WRITE
;
712 if (ch
== '.') { pst
.comment
= true; node
= tnode::POCMD
; }
713 pst
.ccafterln
= false;
716 case tnode::POCMD
: inschr('.');
718 if(ch
== 0) node
= tnode::EEND
;
719 else if(rtl::isAsciiAlpha(ch
)) node
= PointCmd602(&ch
);
720 else if(ch
<32) node
=tnode::SETCH
;
721 else node
= tnode::WRITE
;
724 case tnode::EXPCMD
: ch
= Readchar602();
725 if(ch
== 0) {inschr('@'); node
= tnode::EEND
; }
726 else if(rtl::isAsciiUpperCase(ch
)) {
731 if(rtl::isAsciiUpperCase(ch
))
732 node
= tnode::SETCMD
; //nedodelano
736 mxHandler
->characters(OUString::createFromAscii(cmd602
));
737 node
= tnode::READCH
;
741 if(ch
<32) node
= tnode::SETCH
;
742 else node
= tnode::WRITE
;}
746 ch
= Setformat602(cmd602
);
747 if(ch
== 0) node
= tnode::EEND
;
748 else if(ch
== '\n') node
= tnode::EOL
;
749 else node
= tnode::READCH
;
753 // warning: potentially uninitialized
755 case '\t' : Start_(u
"text:tab-stop"_ustr
);
756 End_(u
"text:tab-stop"_ustr
);
758 case 0x03 : break; //condensed
759 case 0x01 : break; //elite
760 case 0x11 : break; //uzv1
761 case 0x12 : break; //uzv2
762 case 0x15 : break; //uzv3
763 case 0x17 : break; //uzv4
764 case 0x18 : break; //uzv5
765 case 0x19 : break; //uzv6
766 case 0x13 : fst
.uline
= !fst
.uline
;break;
767 case 0x02 : setfnt(fat
,false); break;
768 case 0x04 : setfnt(cursive
,false); break;
769 case 0x0f : setfnt(bold
,false); break;
770 case 0x10 : setfnt(tall
,false); break;
771 case 0x1d : setfnt(big
,false); break;
772 case 0x14 : setfnt(hindex
,false); break;
773 case 0x16 : setfnt(lindex
,false); break;
776 if(pst
.ccafterln
) node
= tnode::EOL
;
777 else node
= tnode::READCH
;
785 if(ini
.reformatpars
) inschr(' ');
786 else par602(false); //formatovaci radek
789 inschr(0x8d);//inschr(' ');
790 if(ch
== 0) node
= tnode::EEND
;
791 else if(ch
< 32) node
= tnode::SETCH
;
792 else node
= tnode::WRITE
;
796 if (ini
.showcomm
||!pst
.comment
) inschr(' ');
797 node
= tnode::READCH
;
802 if(ini
.showcomm
||!pst
.comment
) { //formatovaci pomlcka
803 if(!ini
.reformatpars
)
813 if(ch
== 0) node
= tnode::EEND
;
814 else if(ch
== '\n') {
815 if(!pst
.willbeeop
) par602(false);
817 else if(ch
< 32) node
= tnode::SETCH
;
818 else node
= tnode::WRITE
;
823 node
= tnode::READCH
;
831 End_(u
"text:span"_ustr
);
832 End_(u
"text:p"_ustr
);
837 OUString SAL_CALL
T602ImportFilter::getImplementationName( )
839 return u
"com.sun.star.comp.Writer.T602ImportFilter"_ustr
;
842 sal_Bool SAL_CALL
T602ImportFilter::supportsService( const OUString
& rServiceName
)
844 return cppu::supportsService( this, rServiceName
);
847 Sequence
< OUString
> SAL_CALL
T602ImportFilter::getSupportedServiceNames( )
849 return { u
"com.sun.star.document.ImportFilter"_ustr
, u
"com.sun.star.document.ExtendedTypeDetection"_ustr
};
852 T602ImportFilterDialog::T602ImportFilterDialog()
856 T602ImportFilterDialog::~T602ImportFilterDialog()
860 bool T602ImportFilterDialog::OptionsDlg()
863 #define propInt_(_prop,_nam,_val) \
864 any <<= static_cast<sal_Int32>(_val);\
865 _prop->setPropertyValue(_nam, any);
866 #define propShort_(_prop,_nam,_val) \
867 any <<= static_cast<sal_Int16>(_val);\
868 _prop->setPropertyValue(_nam, any);
869 #define propBool_(_prop,_nam,_val) \
871 _prop->setPropertyValue(_nam, any);
872 #define propString_(_prop,_nam,_val) \
874 _prop->setPropertyValue(_nam, any);
875 #define propStringFromResId_(_prop,_nam,_val) \
876 any <<= FilterResId(_val);\
877 _prop->setPropertyValue(_nam, any);
878 #define propGet_(_prop,_nam) \
879 _prop->getPropertyValue(_nam);
880 #define Inst_(_path)\
881 xMultiServiceFactory->createInstance(_path);
882 #define Insert_(_cont,_nam,_obj) \
884 _cont->insertByName( _nam, any );
886 Reference
< XComponentContext
> rComponentContext
= ::comphelper::getProcessComponentContext();
887 Reference
< XMultiComponentFactory
> rServiceManager
= rComponentContext
->getServiceManager();
888 Reference
< XInterface
> rInstance
= rServiceManager
->createInstanceWithContext(u
"com.sun.star.awt.UnoControlDialogModel"_ustr
, rComponentContext
);
890 Reference
<XMultiServiceFactory
> xMultiServiceFactory (rInstance
,UNO_QUERY
);
892 Reference
< XPropertySet
> xPSetDialog( rInstance
, UNO_QUERY
);
893 propInt_(xPSetDialog
,u
"PositionX"_ustr
,100);
894 propInt_(xPSetDialog
,u
"PositionY"_ustr
,100);
895 propInt_(xPSetDialog
,u
"Width"_ustr
,130);
896 propInt_(xPSetDialog
,u
"Height"_ustr
,90);
897 propStringFromResId_(xPSetDialog
,u
"Title"_ustr
, T602FILTER_STR_IMPORT_DIALOG_TITLE
);
899 static constexpr OUString T602DLG_OK_BUTTON
= u
"ok_button"_ustr
;
900 static constexpr OUString T602DLG_CANCEL_BUTTON
= u
"cancel_button"_ustr
;
901 static constexpr OUString T602DLG_CODE_LB
= u
"code_lb"_ustr
;
902 static constexpr OUString T602DLG_AZBUKA_CB
= u
"azbuka_cb"_ustr
;
903 static constexpr OUString T602DLG_COMMENT_CB
= u
"comment_cb"_ustr
;
904 static constexpr OUString T602DLG_REFORMAT_CB
= u
"reformat_cb"_ustr
;
905 static constexpr OUString T602DLG_CODE_TXT
= u
"code_txt"_ustr
;
907 Reference
< XInterface
> TextModel
= Inst_(u
"com.sun.star.awt.UnoControlFixedTextModel"_ustr
);
908 Reference
< XPropertySet
> xPSetText( TextModel
, UNO_QUERY
);
909 propInt_(xPSetText
,u
"PositionX"_ustr
,10);
910 propInt_(xPSetText
,u
"PositionY"_ustr
,8);
911 propInt_(xPSetText
,u
"Width"_ustr
,30);
912 propInt_(xPSetText
,u
"Height"_ustr
,14);
913 propString_(xPSetText
,u
"Name"_ustr
,T602DLG_CODE_TXT
);
914 propStringFromResId_(xPSetText
,u
"Label"_ustr
,T602FILTER_STR_ENCODING_LABEL
);
916 Reference
< XInterface
> ListBoxModel
= Inst_(u
"com.sun.star.awt.UnoControlListBoxModel"_ustr
);
917 Reference
< XPropertySet
> xPSetCodeLB( ListBoxModel
, UNO_QUERY
);
918 propInt_(xPSetCodeLB
,u
"PositionX"_ustr
,40);
919 propInt_(xPSetCodeLB
,u
"PositionY"_ustr
,5);
920 propInt_(xPSetCodeLB
,u
"Width"_ustr
,85);
921 propInt_(xPSetCodeLB
,u
"Height"_ustr
,14);
922 propString_(xPSetCodeLB
,u
"Name"_ustr
,T602DLG_CODE_LB
);
923 propShort_(xPSetCodeLB
,u
"TabIndex"_ustr
,1);
924 propBool_(xPSetCodeLB
,u
"Dropdown"_ustr
,true);
925 propBool_(xPSetCodeLB
,u
"MultiSelection"_ustr
,false);
927 Sequence
< OUString
> ous
929 FilterResId(T602FILTER_STR_ENCODING_AUTO
),
930 FilterResId(T602FILTER_STR_ENCODING_CP852
),
931 FilterResId(T602FILTER_STR_ENCODING_CP895
),
932 FilterResId(T602FILTER_STR_ENCODING_KOI8CS2
)
935 xPSetCodeLB
->setPropertyValue(u
"StringItemList"_ustr
, any
);
937 Sequence
< sal_Int16
> shr
{ static_cast<sal_Int16
>(ini
.forcecode
? ini
.xcode
+ 1 : 0) };
939 xPSetCodeLB
->setPropertyValue(u
"SelectedItems"_ustr
, any
);
941 Reference
< XInterface
> AzbCheckBoxModel
= Inst_(u
"com.sun.star.awt.UnoControlCheckBoxModel"_ustr
);
942 Reference
< XPropertySet
> xPSetAzbukaCB( AzbCheckBoxModel
, UNO_QUERY
);
943 propInt_(xPSetAzbukaCB
,u
"PositionX"_ustr
,10);
944 propInt_(xPSetAzbukaCB
,u
"PositionY"_ustr
,25);
945 propInt_(xPSetAzbukaCB
,u
"Width"_ustr
,100);
946 propInt_(xPSetAzbukaCB
,u
"Height"_ustr
,14);
947 propString_(xPSetAzbukaCB
,u
"Name"_ustr
,T602DLG_AZBUKA_CB
);
948 propShort_(xPSetAzbukaCB
,u
"TabIndex"_ustr
,2);
949 propStringFromResId_(xPSetAzbukaCB
,u
"Label"_ustr
,T602FILTER_STR_CYRILLIC_MODE
);
950 propShort_(xPSetAzbukaCB
,u
"State"_ustr
,ini
.ruscode
);
952 Reference
< XInterface
> RefCheckBoxModel
= Inst_(u
"com.sun.star.awt.UnoControlCheckBoxModel"_ustr
);
953 Reference
< XPropertySet
> xPSetRefCB( RefCheckBoxModel
, UNO_QUERY
);
954 propInt_(xPSetRefCB
,u
"PositionX"_ustr
,10);
955 propInt_(xPSetRefCB
,u
"PositionY"_ustr
,40);
956 propInt_(xPSetRefCB
,u
"Width"_ustr
,100);
957 propInt_(xPSetRefCB
,u
"Height"_ustr
,14);
958 propString_(xPSetRefCB
,u
"Name"_ustr
,T602DLG_REFORMAT_CB
);
959 propShort_(xPSetRefCB
,u
"TabIndex"_ustr
,3);
960 propStringFromResId_(xPSetRefCB
,u
"Label"_ustr
,T602FILTER_STR_REFORMAT_TEXT
);
961 propShort_(xPSetRefCB
,u
"State"_ustr
,ini
.reformatpars
);
963 Reference
< XInterface
> CommCheckBoxModel
= Inst_(u
"com.sun.star.awt.UnoControlCheckBoxModel"_ustr
);
964 Reference
< XPropertySet
> xPSetCommCB( CommCheckBoxModel
, UNO_QUERY
);
965 propInt_(xPSetCommCB
,u
"PositionX"_ustr
,10);
966 propInt_(xPSetCommCB
,u
"PositionY"_ustr
,55);
967 propInt_(xPSetCommCB
,u
"Width"_ustr
,100);
968 propInt_(xPSetCommCB
,u
"Height"_ustr
,14);
969 propString_(xPSetCommCB
,u
"Name"_ustr
,T602DLG_COMMENT_CB
);
970 propShort_(xPSetCommCB
,u
"TabIndex"_ustr
,4);
971 propStringFromResId_(xPSetCommCB
,u
"Label"_ustr
,T602FILTER_STR_DOT_COMMANDS
);
972 propShort_(xPSetCommCB
,u
"State"_ustr
,ini
.showcomm
);
974 Reference
< XInterface
> CancelButtonModel
= Inst_(u
"com.sun.star.awt.UnoControlButtonModel"_ustr
);
975 Reference
< XPropertySet
> xPSetCancelButton( CancelButtonModel
, UNO_QUERY
);
976 propInt_(xPSetCancelButton
,u
"PositionX"_ustr
,10);
977 propInt_(xPSetCancelButton
,u
"PositionY"_ustr
,70);
978 propInt_(xPSetCancelButton
,u
"Width"_ustr
,50);
979 propInt_(xPSetCancelButton
,u
"Height"_ustr
,14);
980 propString_(xPSetCancelButton
,u
"Name"_ustr
,T602DLG_CANCEL_BUTTON
);
981 propShort_(xPSetCancelButton
,u
"TabIndex"_ustr
,5);
982 propShort_(xPSetCancelButton
,u
"PushButtonType"_ustr
,2);
983 propStringFromResId_(xPSetCancelButton
,u
"Label"_ustr
,T602FILTER_STR_CANCEL_BUTTON
);
985 Reference
< XInterface
> OkButtonModel
= Inst_(u
"com.sun.star.awt.UnoControlButtonModel"_ustr
);
986 Reference
< XPropertySet
> xPSetOkButton( OkButtonModel
, UNO_QUERY
);
987 propInt_(xPSetOkButton
,u
"PositionX"_ustr
,70);
988 propInt_(xPSetOkButton
,u
"PositionY"_ustr
,70);
989 propInt_(xPSetOkButton
,u
"Width"_ustr
,50);
990 propInt_(xPSetOkButton
,u
"Height"_ustr
,14);
991 propString_(xPSetOkButton
,u
"Name"_ustr
,T602DLG_OK_BUTTON
);
992 propShort_(xPSetOkButton
,u
"TabIndex"_ustr
,0);
993 propShort_(xPSetOkButton
,u
"PushButtonType"_ustr
,1);
994 propStringFromResId_(xPSetOkButton
,u
"Label"_ustr
,T602FILTER_STR_OK_BUTTON
);
995 propBool_(xPSetOkButton
,u
"DefaultButton"_ustr
,true);
997 Reference
< XNameContainer
> xNameCont (rInstance
,UNO_QUERY
);
999 Insert_(xNameCont
, T602DLG_OK_BUTTON
, OkButtonModel
);
1000 Insert_(xNameCont
, T602DLG_CANCEL_BUTTON
, CancelButtonModel
);
1001 Insert_(xNameCont
, T602DLG_AZBUKA_CB
, AzbCheckBoxModel
);
1002 Insert_(xNameCont
, T602DLG_REFORMAT_CB
, RefCheckBoxModel
);
1003 Insert_(xNameCont
, T602DLG_COMMENT_CB
, CommCheckBoxModel
);
1004 Insert_(xNameCont
, T602DLG_CODE_LB
, ListBoxModel
);
1005 Insert_(xNameCont
, T602DLG_CODE_TXT
, TextModel
);
1007 Reference
< XUnoControlDialog
> dialog
= UnoControlDialog::create(rComponentContext
);
1009 Reference
< XControlModel
> xControlModel (rInstance
,UNO_QUERY
);
1011 dialog
->setModel( xControlModel
);
1013 Reference
< XToolkit
> xToolkit
= Toolkit::create( rComponentContext
);
1015 dialog
->setVisible( false );
1016 dialog
->createPeer( xToolkit
, nullptr );
1018 bool ret
= ( dialog
->execute() != 0 );
1023 any
= propGet_(xPSetAzbukaCB
, u
"State"_ustr
); any
>>= tt
; ini
.ruscode
= tt
;
1024 any
= propGet_(xPSetRefCB
, u
"State"_ustr
); any
>>= tt
; ini
.reformatpars
= tt
;
1025 any
= propGet_(xPSetCommCB
, u
"State"_ustr
); any
>>= tt
; ini
.showcomm
= tt
;
1027 any
= propGet_(xPSetCodeLB
, u
"SelectedItems"_ustr
); any
>>= shr
;
1030 ini
.xcode
= static_cast<tcode
>(shr
[0]-1);
1031 ini
.forcecode
= true;
1033 ini
.forcecode
= false;
1037 Reference
<XControl
>(dialog
)->dispose();
1042 void SAL_CALL
T602ImportFilterDialog::setTitle( const OUString
& )
1046 sal_Int16 SAL_CALL
T602ImportFilterDialog::execute()
1049 return css::ui::dialogs::ExecutableDialogResults::OK
;
1051 return css::ui::dialogs::ExecutableDialogResults::CANCEL
;
1054 uno::Sequence
<beans::PropertyValue
> SAL_CALL
T602ImportFilterDialog::getPropertyValues()
1056 return uno::Sequence
<beans::PropertyValue
>();
1059 void SAL_CALL
T602ImportFilterDialog::setPropertyValues( const uno::Sequence
<beans::PropertyValue
>& )
1065 OUString SAL_CALL
T602ImportFilterDialog::getImplementationName( )
1067 return u
"com.sun.star.comp.Writer.T602ImportFilterDialog"_ustr
;
1070 sal_Bool SAL_CALL
T602ImportFilterDialog::supportsService( const OUString
& rServiceName
)
1072 return cppu::supportsService( this, rServiceName
);
1075 Sequence
< OUString
> SAL_CALL
T602ImportFilterDialog::getSupportedServiceNames( )
1077 return { u
"com.sun.star.ui.dialogs.FilterOptionsDialog"_ustr
};
1082 extern "C" SAL_DLLPUBLIC_EXPORT
css::uno::XInterface
*
1083 filter_T602ImportFilterDialog_get_implementation(
1084 css::uno::XComponentContext
* , css::uno::Sequence
<css::uno::Any
> const&)
1086 return cppu::acquire(new T602ImportFilter::T602ImportFilterDialog());
1089 extern "C" SAL_DLLPUBLIC_EXPORT
css::uno::XInterface
*
1090 filter_T602ImportFilter_get_implementation(
1091 css::uno::XComponentContext
* context
, css::uno::Sequence
<css::uno::Any
> const&)
1093 return cppu::acquire(new T602ImportFilter::T602ImportFilter(context
));
1096 extern "C" SAL_DLLPUBLIC_EXPORT
bool TestImport602(SvStream
&rStream
)
1098 css::uno::Reference
<io::XInputStream
> xStream(new utl::OSeekableInputStreamWrapper(rStream
));
1099 rtl::Reference
<T602ImportFilter::T602ImportFilter
> aImport(
1100 new T602ImportFilter::T602ImportFilter(xStream
));
1105 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */