LCOV - code coverage report
Current view: top level - filter/source/t602 - t602filter.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 30 688 4.4 %
Date: 2012-08-25 Functions: 9 48 18.8 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 19 1735 1.1 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            :  /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include "t602filter.hxx"
      30                 :            : #include "t602filter.hrc"
      31                 :            : 
      32                 :            : #include <ctype.h>
      33                 :            : #include <stdio.h>
      34                 :            : 
      35                 :            : #include <cppuhelper/factory.hxx>
      36                 :            : #include <cppuhelper/bootstrap.hxx>
      37                 :            : #include <com/sun/star/bridge/XUnoUrlResolver.hpp>
      38                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      39                 :            : #include <com/sun/star/ucb/XSimpleFileAccess.hpp>
      40                 :            : #include <com/sun/star/text/XTextDocument.hpp>
      41                 :            : #include <com/sun/star/container/XNameContainer.hpp>
      42                 :            : #include <com/sun/star/awt/XControl.hpp>
      43                 :            : #include <com/sun/star/awt/XDialog.hpp>
      44                 :            : #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
      45                 :            : 
      46                 :            : using namespace ::rtl;
      47                 :            : using namespace ::cppu;
      48                 :            : using namespace ::osl;
      49                 :            : using namespace ::com::sun::star;
      50                 :            : using namespace ::com::sun::star::uno;
      51                 :            : using namespace ::com::sun::star::lang;
      52                 :            : using namespace ::com::sun::star::registry;
      53                 :            : using namespace ::com::sun::star::container;
      54                 :            : using namespace ::com::sun::star::beans;
      55                 :            : using namespace ::com::sun::star::awt;
      56                 :            : using namespace ::com::sun::star::xml::sax;
      57                 :            : using namespace ::com::sun::star::document;
      58                 :            : using com::sun::star::io::XInputStream;
      59                 :            : 
      60                 :            : namespace T602ImportFilter {
      61                 :            : 
      62                 :            :     unsigned char kam2lat[129] =
      63                 :            :         //    0   1   2   3   4   5   6   7   8   9   A   B   C   D   E   F
      64                 :            :         "\xAC\x81\x82\xD4\x84\xD2\x9B\x9F\xD8\xB7\x91\xD6\x96\x92\x8E\xB5"  // 8
      65                 :            :         "\x90\xA7\xA6\x93\x94\xE0\x85\xE9\xEC\x99\x9A\xE6\x95\xED\xFC\x9C"  // 9
      66                 :            :         "\xA0\xA1\xA2\xA3\xE5\xD5\xDE\xE2\xE7\xFD\xEA\xE8\xCE\xF5\xAE\xAF"  // A
      67                 :            :         "\x80\x80\x83\xB3\xB4\xE1\x87\x88\x89\x8A\x8B\x8C\x8F\x97\x8D\xBF"  // B
      68                 :            :         "\xC0\xC1\xC2\xC3\xC4\xC5\xCF\x98\x9D\x9E\xA4\xA5\xA8\xA9\x86\xF3"  // C
      69                 :            :         "\xCD\xB1\xB2\xB6\xB8\xB9\xBA\xBB\xF7\xD9\xDA\xDB\xDC\xF8\xF9\xDF"  // D
      70                 :            :         "\xD0\xD1\xD3\xD7\xAA\xAB\xDD\xB0\xE3\xE4\xEB\xEE\xEF\xF0\xF2\xF4"  // E
      71                 :            :         "\xBC\xBD\xBE\xC6\xC7\xC8\xF6\xC9\xCA\xFA\xFB\xCB\xF1\xCC\xFE\xFF"; // F
      72                 :            : 
      73                 :            :     unsigned char koi2lat[129] =
      74                 :            :         //    0   1   2   3   4   5   6   7   8   9   A   B   C   D   E   F
      75                 :            :         "\x80\x83\x86\xF5\xE1\x87\x88\x89\x8A\x8B\x8C\x8F\x97\xCF\xCF\x98"  // 8
      76                 :            :         "\x9D\x9E\xA4\xA5\xA8\xA9\xDB\xDC\xDF\xB1\xB2\xB6\xB8\xB9\xBA\xBB"  // 9
      77                 :            :         "\xBC\xBD\xBE\xC6\xC7\xC8\xF6\xC9\xCA\xCB\xCC\xCD\xCE\xAD\xAE\xAF"  // A
      78                 :            :         "\xD0\xD1\xD3\xD7\xAA\xAB\xDD\xB0\xE3\xE4\xEB\xEE\xEF\xF0\xF2\xF4"  // B
      79                 :            :         "\xDA\xA0\xC0\x9F\xD4\xD8\xEA\xC4\x81\xA1\x85\x92\x96\x94\xE5\xA2"  // C
      80                 :            :         "\x93\x84\xFD\xE7\x9C\xA3\xC3\x82\xF7\xEC\xA7\xC2\xF3\xF8\xF9\xC5"  // D
      81                 :            :         "\xBF\xB5\xD9\xAC\xD2\xB7\xE8\xB3\x9A\xD6\xDE\x91\x95\x99\xD5\xE0"  // E
      82                 :            :         "\xE2\x8E\xFC\xE6\x9B\xE9\xB4\x90\xFA\xED\xA6\xC1\xF1\xFB\xFE\xFF"; // F
      83                 :            : 
      84                 :            :     unsigned char lat2UNC[257] =
      85                 :            :         //    0       1       2       3       4       5       6       7
      86                 :            :         //    8       9       A       B       C       D       E       F
      87                 :            :         "\x00\xe7\x00\xfc\x00\xe9\x00\xf9\x00\xe4\x01\x6f\x00\xe8\x00\xa3"  // 8
      88                 :            :         "\x00\xc6\x00\xd8\x00\xc5\x00\xe6\x00\xf8\x00\xc4\x00\xc4\x00\xe5"
      89                 :            :         "\x00\xc9\x01\x39\x00\xf4\x00\xf4\x00\xf6\x01\x3d\x01\x3e\x00\x20"  // 9
      90                 :            :         "\x00\xf2\x00\xd6\x00\xdc\x01\x64\x01\x65\x00\xec\x20\xa7\x01\x0d"
      91                 :            :         "\x00\xe1\x00\xed\x00\xf3\x00\xfa\x00\xa1\x00\xd1\x01\x7d\x01\x7e"  // A
      92                 :            :         "\x00\xbf\x00\xf1\x22\x11\x03\xc3\x01\x0c\x00\xa7\x00\xbb\x00\xab"
      93                 :            :         "\x25\x91\x25\x92\x25\x93\x25\x02\x25\x24\x00\xc1\x00\xc2\x01\x1a"  // B
      94                 :            :         "\x00\x20\x00\x20\x00\x20\x00\x20\x22\x61\x00\xb1\x22\x65\x25\x10"
      95                 :            :         "\x25\x14\x25\x34\x25\x2c\x25\x1c\x25\x00\x25\x3c\x22\x64\x23\x20"  // C
      96                 :            :         "\x23\x21\x22\x48\x00\xba\x22\x1a\x00\xb2\x00\xbd\x00\xbc\x00\xa4"
      97                 :            :         "\x03\xb1\x03\xb2\x01\x0e\x03\x93\x01\x0f\x01\x47\x00\xcd\x03\xc0"  // D
      98                 :            :         "\x01\x1b\x25\x18\x25\x0c\x25\x88\x25\x84\x00\xb5\x01\x6e\x25\x80"
      99                 :            :         "\x00\xd3\x00\xdf\x00\xd4\x03\xa6\x03\x98\x01\x48\x01\x60\x01\x61"  // E
     100                 :            :         "\x01\x54\x00\xda\x01\x55\x03\xa9\x00\xfd\x00\xdd\x03\xb4\x22\x1e"
     101                 :            :         "\x00\xf8\x02\xdd\x03\xb5\x02\xc7\x22\x29\x00\xa7\x00\xf7\x00\xe0"  // F
     102                 :            :         "\x00\xb4\x00\xb0\x00\xc0\x02\xc6\x01\x58\x01\x59\x00\x20\x00\x20";
     103                 :            : 
     104                 :            :     unsigned char rus2UNC[257] =
     105                 :            :         //    0       1       2       3       4       5       6       7
     106                 :            :         //    8       9       A       B       C       D       E       F
     107                 :            :         "\x04\x11\x00\xfc\x00\xe9\x04\x12\x00\xe4\x01\x6f\x04\x13\x04\x14"  // 8
     108                 :            :         "\x04\x01\x04\x16\x04\x17\x04\x18\x04\x19\x00\xc4\x00\xc4\x04\x1a"
     109                 :            :         "\x00\xc9\x01\x39\x01\x3a\x00\xf4\x00\xf6\x01\x3d\x01\x3e\x00\x20"  // 9
     110                 :            :         "\x04\x1c\x00\xd6\x00\xdc\x01\x64\x01\x65\x04\x1d\x04\x1f\x01\x0a"
     111                 :            :         "\x00\xe1\x00\xed\x00\xf3\x00\xfa\x04\x20\x04\x22\x01\x7d\x01\x7e"  // A
     112                 :            :         "\x04\x23\x04\x24\x04\x43\x04\x44\x01\x0c\x00\xa7\x04\x3b\x04\x3c"
     113                 :            :         "\x04\x47\x04\x26\x04\x27\x25\x02\x25\x24\x00\xc1\x04\x28\x01\x1a"  // B
     114                 :            :         "\x04\x29\x04\x2a\x04\x2b\x04\x2c\x04\x2d\x04\x2e\x04\x2f\x25\x10"
     115                 :            :         "\x25\x14\x25\x34\x25\x2c\x25\x1c\x25\x00\x25\x3c\x04\x31\x04\x32"  // C
     116                 :            :         "\x04\x33\x04\x51\x04\x36\x04\x37\x04\x38\x04\x39\x04\x3a\x04\x1b"
     117                 :            :         "\x04\x3d\x04\x3f\x01\x0e\x04\x40\x01\x0f\x01\x47\x00\xcd\x04\x42"  // D
     118                 :            :         "\x01\x1b\x25\x18\x25\x0c\x25\x88\x25\x84\x04\x46\x01\x6e\x25\x80"
     119                 :            :         "\x00\xd3\x00\xdf\x00\xd4\x04\x48\x04\x49\x01\x48\x01\x60\x01\x61"  // E
     120                 :            :         "\x01\x54\x00\xda\x01\x55\x04\x4a\x00\xfd\x00\xdd\x04\x4b\x04\x4c"
     121                 :            :         "\x04\x4d\x02\xdd\x04\x4e\x02\xc7\x04\x4f\x00\xa7\x04\x34\x00\xe0"  // F
     122                 :            :         "\x00\xb4\x00\xb0\x00\xc0\x02\xc6\x01\x58\x01\x59\x00\x20\x00\x20";
     123                 :            : 
     124                 :            : #define _AddAtt(_nam, _val) \
     125                 :            :     mpAttrList->AddAttribute(OUString::createFromAscii( _nam ),\
     126                 :            :     OUString::createFromAscii( _val ) );
     127                 :            : 
     128                 :            : #define _Start(_nam) \
     129                 :            :     mxHandler->startElement(OUString::createFromAscii(_nam), mAttrList);\
     130                 :            :     mpAttrList->Clear();
     131                 :            : 
     132                 :            : #define _End(_nam) \
     133                 :            :     mxHandler->endElement(OUString::createFromAscii(_nam));
     134                 :            : 
     135                 :            : #define _Chars(_ch) \
     136                 :            :     mxHandler->characters(OUString::createFromAscii((sal_Char *) _ch) );
     137                 :            : 
     138                 :          6 : inistruct ini;
     139                 :            : 
     140                 :         10 : T602ImportFilter::T602ImportFilter(const ::com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory > &r ) :
     141                 :         10 :     mxMSF( r ) {}
     142                 :            : 
     143                 :         10 : T602ImportFilter::~T602ImportFilter()
     144                 :            : {
     145         [ -  + ]:         20 : }
     146                 :            : 
     147                 :            : // XExtendedTypeDetection
     148                 :         10 : ::rtl::OUString T602ImportFilter::detect( Sequence<PropertyValue>& Descriptor)
     149                 :            :     throw(RuntimeException)
     150                 :            : {
     151                 :            :     // checks for filter or type name would be necessary in case we want to use the filter also for "602" files
     152                 :            :     // without the magic bytes at the beginning; I leave the code as comment in case of
     153                 :            :     // ::rtl::OUString aFilterName, aTypeName;
     154                 :         10 :     sal_Int32 nLength = Descriptor.getLength();
     155                 :         10 :     const PropertyValue * pValue = Descriptor.getConstArray();
     156         [ +  + ]:         80 :     for ( sal_Int32 i = 0 ; i < nLength; i++)
     157                 :            :     {
     158         [ +  + ]:         70 :         if ( pValue[i].Name == "InputStream" )
     159         [ +  - ]:         10 :             pValue[i].Value >>= mxInputStream;
     160                 :            : /*        else if ( pValue[i].Name == "FilterName" )
     161                 :            :             pValue[i].Value >>= aFilterName;
     162                 :            :         else if ( pValue[i].Name == "TypeName" )
     163                 :            :             pValue[i].Value >>= aTypeName; */
     164                 :            :     }
     165                 :            : 
     166         [ -  + ]:         10 :     if (!mxInputStream.is())
     167                 :          0 :         return ::rtl::OUString();
     168                 :            : 
     169                 :            : /*    if ( aFilterName == "T602Document" || aTypeName == "writer_T602_Document" )
     170                 :            :         // preselection by type (extension) or filter name: no reason to check type
     171                 :            :         return rtl::OUString(  "writer_T602_Document"  ); */
     172                 :            : 
     173         [ +  - ]:         10 :     ::com::sun::star::uno::Sequence< sal_Int8 > aData;
     174                 :         10 :     size_t numBytes = 4;
     175                 :         10 :     size_t numBytesRead = 0;
     176                 :            : 
     177 [ +  - ][ +  - ]:         10 :     numBytesRead = mxInputStream->readSomeBytes (aData, numBytes);
     178                 :            : 
     179 [ +  - ][ +  - ]:         10 :     if ((numBytesRead != numBytes) || (aData[0] != '@') ||
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
                 [ +  - ]
     180 [ #  # ][ #  # ]:          0 :         (aData[1] != 'C') || (aData[2] != 'T') || (aData[3] != ' '))
                 [ #  # ]
     181                 :         10 :         return ::rtl::OUString();
     182                 :            : 
     183         [ +  - ]:         10 :     return rtl::OUString(  "writer_T602_Document"  );
     184                 :            : }
     185                 :            : 
     186                 :            : // XFilter
     187                 :          0 : sal_Bool SAL_CALL T602ImportFilter::filter( const Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
     188                 :            :     throw (RuntimeException)
     189                 :            : {
     190                 :          0 :     return importImpl ( aDescriptor );
     191                 :            : }
     192                 :            : 
     193                 :            : // XImporter
     194                 :          0 : void SAL_CALL T602ImportFilter::setTargetDocument( const Reference< ::com::sun::star::lang::XComponent >& xDoc )
     195                 :            :     throw (::com::sun::star::lang::IllegalArgumentException, RuntimeException)
     196                 :            : {
     197                 :          0 :     mxDoc = xDoc;
     198                 :          0 : }
     199                 :            : 
     200                 :            : // XInitialization
     201                 :          0 : void SAL_CALL T602ImportFilter::initialize( const Sequence< Any >& aArguments )
     202                 :            :     throw (Exception, RuntimeException)
     203                 :            : {
     204         [ #  # ]:          0 :     Sequence < PropertyValue > aAnySeq;
     205                 :          0 :     sal_Int32 nLength = aArguments.getLength();
     206 [ #  # ][ #  # ]:          0 :     if ( nLength && ( aArguments[0] >>= aAnySeq ) )
         [ #  # ][ #  # ]
     207                 :            :     {
     208                 :          0 :         const PropertyValue * pValue = aAnySeq.getConstArray();
     209                 :          0 :         nLength = aAnySeq.getLength();
     210         [ #  # ]:          0 :         for ( sal_Int32 i = 0 ; i < nLength; i++)
     211                 :            :         {
     212         [ #  # ]:          0 :             if ( pValue[i].Name == "Type" )
     213                 :            :             {
     214                 :          0 :                 pValue[i].Value >>= msFilterName;
     215                 :          0 :                 break;
     216                 :            :             }
     217                 :            :         }
     218         [ #  # ]:          0 :     }
     219                 :          0 : }
     220                 :            : 
     221                 :            : // Other functions
     222                 :            : 
     223                 :          0 : void T602ImportFilter::inschr(unsigned char ch)
     224                 :            : {
     225 [ #  # ][ #  # ]:          0 :     Reference < XAttributeList > mAttrList ( mpAttrList );
     226                 :            : 
     227 [ #  # ][ #  # ]:          0 :     if(!ini.showcomm&&pst.comment) return;
     228                 :            : 
     229         [ #  # ]:          0 :     if(ch==' ') {
     230         [ #  # ]:          0 :         setfnt(chngul,true);
     231                 :          0 :         pst.wasspace++;
     232                 :            :         return;
     233                 :            :     }
     234                 :            : 
     235         [ #  # ]:          0 :     if(pst.wasspace > 0) {
     236         [ #  # ]:          0 :         if(ini.reformatpars) {
     237         [ #  # ]:          0 :             if(!pst.wasfdash)
     238         [ #  # ]:          0 :                 inschrdef(' ');
     239                 :          0 :             pst.wasfdash = false;
     240                 :            :         } else {
     241                 :            :             char s[20];
     242                 :          0 :             sprintf(s,"%i",pst.wasspace);
     243         [ #  # ]:          0 :             _AddAtt("text:c",s);
     244 [ #  # ][ #  # ]:          0 :             _Start("text:s");
                 [ #  # ]
     245 [ #  # ][ #  # ]:          0 :             _End("text:s");
     246                 :            :         }
     247                 :            :     }
     248                 :            : 
     249                 :          0 :     pst.wasspace = 0;
     250         [ #  # ]:          0 :     setfnt(chngul,true);
     251 [ #  # ][ #  # ]:          0 :     inschrdef(ch);
     252                 :            : }
     253                 :            : 
     254                 :          0 : sal_Bool SAL_CALL T602ImportFilter::importImpl( const Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
     255                 :            :     throw (RuntimeException)
     256                 :            : {
     257                 :          0 :     Reset602();
     258                 :            : 
     259                 :          0 :     sal_Int32 nLength = aDescriptor.getLength();
     260                 :          0 :     const PropertyValue * pValue = aDescriptor.getConstArray();
     261         [ #  # ]:          0 :     for ( sal_Int32 i = 0 ; i < nLength; i++)
     262                 :            :     {
     263         [ #  # ]:          0 :         if ( pValue[i].Name == "InputStream" )
     264         [ #  # ]:          0 :             pValue[i].Value >>= mxInputStream;
     265                 :            :     }
     266                 :            : 
     267         [ #  # ]:          0 :     if ( !mxInputStream.is() )
     268                 :            :     {
     269                 :            :         OSL_ASSERT( 0 );
     270                 :          0 :         return sal_False;
     271                 :            :     }
     272                 :            : 
     273                 :            :     // An XML import service: what we push sax messages to..
     274                 :          0 :     OUString sXMLImportService (  "com.sun.star.comp.Writer.XMLImporter"  );
     275                 :            : 
     276 [ #  # ][ #  # ]:          0 :     mxHandler = Reference< XDocumentHandler >( mxMSF->createInstance( sXMLImportService ), UNO_QUERY );
         [ #  # ][ #  # ]
     277                 :            : 
     278                 :            :     // The XImporter sets up an empty target document for XDocumentHandler to write to..
     279         [ #  # ]:          0 :     Reference < XImporter > xImporter(mxHandler, UNO_QUERY);
     280 [ #  # ][ #  # ]:          0 :     xImporter->setTargetDocument(mxDoc);
     281                 :            : 
     282                 :            :     char fs[32], fs2[32];
     283                 :          0 :     sprintf(fs, "%ipt", ini.fontsize);
     284                 :          0 :     sprintf(fs2,"%ipt", 2*ini.fontsize);
     285                 :            : 
     286         [ #  # ]:          0 :     mpAttrList = new SvXMLAttributeList;
     287                 :            : 
     288 [ #  # ][ #  # ]:          0 :     Reference < XAttributeList > mAttrList ( mpAttrList );
     289                 :            : 
     290 [ #  # ][ #  # ]:          0 :     mxHandler->startDocument();
     291                 :            : 
     292         [ #  # ]:          0 :     _AddAtt("xmlns:office", "http://openoffice.org/2000/office");
     293         [ #  # ]:          0 :     _AddAtt("xmlns:style", "http://openoffice.org/2000/style");
     294         [ #  # ]:          0 :     _AddAtt("xmlns:text", "http://openoffice.org/2000/text");
     295         [ #  # ]:          0 :     _AddAtt("xmlns:table", "http://openoffice.org/2000/table");
     296         [ #  # ]:          0 :     _AddAtt("xmlns:draw", "http://openoffice.org/2000/draw");
     297         [ #  # ]:          0 :     _AddAtt("xmlns:fo", "http://www.w3.org/1999/XSL/Format");
     298         [ #  # ]:          0 :     _AddAtt("xmlns:xlink", "http://www.w3.org/1999/xlink");
     299         [ #  # ]:          0 :     _AddAtt("xmlns:number", "http://openoffice.org/2000/datastyle");
     300         [ #  # ]:          0 :     _AddAtt("xmlns:svg", "http://www.w3.org/2000/svg");
     301         [ #  # ]:          0 :     _AddAtt("xmlns:chart", "http://openoffice.org/2000/chart");
     302         [ #  # ]:          0 :     _AddAtt("xmlns:dr3d", "http://openoffice.org/2000/dr3d");
     303         [ #  # ]:          0 :     _AddAtt("xmlns:math", "http://www.w3.org/1998/Math/MathML");
     304         [ #  # ]:          0 :     _AddAtt("xmlns:form", "http://openoffice.org/2000/form");
     305         [ #  # ]:          0 :     _AddAtt("xmlns:script", "http://openoffice.org/2000/script");
     306         [ #  # ]:          0 :     _AddAtt("office:class", "text");
     307         [ #  # ]:          0 :     _AddAtt("office:version", "1.0");
     308 [ #  # ][ #  # ]:          0 :     _Start("office:document-content");
                 [ #  # ]
     309                 :            : 
     310 [ #  # ][ #  # ]:          0 :     _Start("office:font-decls");
                 [ #  # ]
     311         [ #  # ]:          0 :     _AddAtt("style:name","Courier New");
     312         [ #  # ]:          0 :     _AddAtt("fo:font-family","Courier New");
     313         [ #  # ]:          0 :     _AddAtt("style:font-pitch","fixed");
     314 [ #  # ][ #  # ]:          0 :     _Start("style:font-decl");
                 [ #  # ]
     315 [ #  # ][ #  # ]:          0 :     _End("style:font-decl");
     316 [ #  # ][ #  # ]:          0 :     _End("office:font-decls");
     317                 :            : 
     318 [ #  # ][ #  # ]:          0 :     _Start("office:automatic-styles");
                 [ #  # ]
     319                 :            : 
     320                 :            :     // Standardni text
     321         [ #  # ]:          0 :     _AddAtt("style:name","P1");
     322         [ #  # ]:          0 :     _AddAtt("style:family","paragraph");
     323         [ #  # ]:          0 :     _AddAtt("style:parent-style-name","Standard");
     324 [ #  # ][ #  # ]:          0 :     _Start("style:style");
                 [ #  # ]
     325         [ #  # ]:          0 :     _AddAtt("style:font-name","Courier New");
     326         [ #  # ]:          0 :     _AddAtt("fo:font-size",fs);
     327 [ #  # ][ #  # ]:          0 :     _Start("style:properties");
                 [ #  # ]
     328 [ #  # ][ #  # ]:          0 :     _End("style:properties");
     329 [ #  # ][ #  # ]:          0 :     _End("style:style");
     330                 :            : 
     331                 :            :     // Standardni text - konec stranky
     332         [ #  # ]:          0 :     _AddAtt("style:name","P2");
     333         [ #  # ]:          0 :     _AddAtt("style:family","paragraph");
     334         [ #  # ]:          0 :     _AddAtt("style:parent-style-name","Standard");
     335 [ #  # ][ #  # ]:          0 :     _Start("style:style");
                 [ #  # ]
     336         [ #  # ]:          0 :     _AddAtt("style:font-name","Courier New");
     337         [ #  # ]:          0 :     _AddAtt("fo:font-size",fs);
     338         [ #  # ]:          0 :     _AddAtt("fo:break-before","page");
     339 [ #  # ][ #  # ]:          0 :     _Start("style:properties");
                 [ #  # ]
     340 [ #  # ][ #  # ]:          0 :     _End("style:properties");
     341 [ #  # ][ #  # ]:          0 :     _End("style:style");
     342                 :            : 
     343                 :            :     // T1 Normalni text
     344         [ #  # ]:          0 :     _AddAtt("style:name","T1");
     345         [ #  # ]:          0 :     _AddAtt("style:family","text");
     346 [ #  # ][ #  # ]:          0 :     _Start("style:style");
                 [ #  # ]
     347 [ #  # ][ #  # ]:          0 :     _Start("style:properties");
                 [ #  # ]
     348 [ #  # ][ #  # ]:          0 :     _End("style:properties");
     349 [ #  # ][ #  # ]:          0 :     _End("style:style");
     350                 :            : 
     351                 :            :     // T2 Tucny text
     352         [ #  # ]:          0 :     _AddAtt("style:name","T2");
     353         [ #  # ]:          0 :     _AddAtt("style:family","text");
     354 [ #  # ][ #  # ]:          0 :     _Start("style:style");
                 [ #  # ]
     355         [ #  # ]:          0 :     _AddAtt("fo:font-weight","bold");
     356 [ #  # ][ #  # ]:          0 :     _Start("style:properties");
                 [ #  # ]
     357 [ #  # ][ #  # ]:          0 :     _End("style:properties");
     358 [ #  # ][ #  # ]:          0 :     _End("style:style");
     359                 :            : 
     360                 :            :     // T3 Kurziva
     361         [ #  # ]:          0 :     _AddAtt("style:name","T3");
     362         [ #  # ]:          0 :     _AddAtt("style:family","text");
     363 [ #  # ][ #  # ]:          0 :     _Start("style:style");
                 [ #  # ]
     364         [ #  # ]:          0 :     _AddAtt("fo:font-style","italic");
     365 [ #  # ][ #  # ]:          0 :     _Start("style:properties");
                 [ #  # ]
     366 [ #  # ][ #  # ]:          0 :     _End("style:properties");
     367 [ #  # ][ #  # ]:          0 :     _End("style:style");
     368                 :            : 
     369                 :            :     // T4 Siroky text
     370         [ #  # ]:          0 :     _AddAtt("style:name","T4");
     371         [ #  # ]:          0 :     _AddAtt("style:family","text");
     372 [ #  # ][ #  # ]:          0 :     _Start("style:style");
                 [ #  # ]
     373         [ #  # ]:          0 :     _AddAtt("fo:font-weight","bold");
     374         [ #  # ]:          0 :     _AddAtt("style:text-scale","200%");
     375 [ #  # ][ #  # ]:          0 :     _Start("style:properties");
                 [ #  # ]
     376 [ #  # ][ #  # ]:          0 :     _End("style:properties");
     377 [ #  # ][ #  # ]:          0 :     _End("style:style");
     378                 :            : 
     379                 :            :     // T5 Vysoky text
     380         [ #  # ]:          0 :     _AddAtt("style:name","T5");
     381         [ #  # ]:          0 :     _AddAtt("style:family","text");
     382 [ #  # ][ #  # ]:          0 :     _Start("style:style");
                 [ #  # ]
     383         [ #  # ]:          0 :     _AddAtt("fo:font-size",fs2);
     384         [ #  # ]:          0 :     _AddAtt("fo:font-weight","bold");
     385         [ #  # ]:          0 :     _AddAtt("style:text-scale","50%");
     386 [ #  # ][ #  # ]:          0 :     _Start("style:properties");
                 [ #  # ]
     387 [ #  # ][ #  # ]:          0 :     _End("style:properties");
     388 [ #  # ][ #  # ]:          0 :     _End("style:style");
     389                 :            : 
     390                 :            :     // T6 Velky text
     391         [ #  # ]:          0 :     _AddAtt("style:name","T6");
     392         [ #  # ]:          0 :     _AddAtt("style:family","text");
     393 [ #  # ][ #  # ]:          0 :     _Start("style:style");
                 [ #  # ]
     394         [ #  # ]:          0 :     _AddAtt("fo:font-size",fs2);
     395         [ #  # ]:          0 :     _AddAtt("fo:font-weight","bold");
     396 [ #  # ][ #  # ]:          0 :     _Start("style:properties");
                 [ #  # ]
     397 [ #  # ][ #  # ]:          0 :     _End("style:properties");
     398 [ #  # ][ #  # ]:          0 :     _End("style:style");
     399                 :            : 
     400                 :            :     // T7 Podtrzeny text
     401         [ #  # ]:          0 :     _AddAtt("style:name","T7");
     402         [ #  # ]:          0 :     _AddAtt("style:family","text");
     403 [ #  # ][ #  # ]:          0 :     _Start("style:style");
                 [ #  # ]
     404         [ #  # ]:          0 :     _AddAtt("style:text-underline","single");
     405 [ #  # ][ #  # ]:          0 :     _Start("style:properties");
                 [ #  # ]
     406 [ #  # ][ #  # ]:          0 :     _End("style:properties");
     407 [ #  # ][ #  # ]:          0 :     _End("style:style");
     408                 :            : 
     409                 :            :     // T8 Podtrzena tucny text
     410         [ #  # ]:          0 :     _AddAtt("style:name","T8");
     411         [ #  # ]:          0 :     _AddAtt("style:family","text");
     412 [ #  # ][ #  # ]:          0 :     _Start("style:style");
                 [ #  # ]
     413         [ #  # ]:          0 :     _AddAtt("fo:font-weight","bold");
     414         [ #  # ]:          0 :     _AddAtt("style:text-underline","single");
     415 [ #  # ][ #  # ]:          0 :     _Start("style:properties");
                 [ #  # ]
     416 [ #  # ][ #  # ]:          0 :     _End("style:properties");
     417 [ #  # ][ #  # ]:          0 :     _End("style:style");
     418                 :            : 
     419                 :            :     // T9 Podtrzena kurziva
     420         [ #  # ]:          0 :     _AddAtt("style:name","T9");
     421         [ #  # ]:          0 :     _AddAtt("style:family","text");
     422 [ #  # ][ #  # ]:          0 :     _Start("style:style");
                 [ #  # ]
     423         [ #  # ]:          0 :     _AddAtt("fo:font-style","italic");
     424         [ #  # ]:          0 :     _AddAtt("style:text-underline","single");
     425 [ #  # ][ #  # ]:          0 :     _Start("style:properties");
                 [ #  # ]
     426 [ #  # ][ #  # ]:          0 :     _End("style:properties");
     427 [ #  # ][ #  # ]:          0 :     _End("style:style");
     428                 :            : 
     429                 :            :     // T10 Horni index
     430         [ #  # ]:          0 :     _AddAtt("style:name","T10");
     431         [ #  # ]:          0 :     _AddAtt("style:family","text");
     432 [ #  # ][ #  # ]:          0 :     _Start("style:style");
                 [ #  # ]
     433         [ #  # ]:          0 :     _AddAtt("style:text-position","27% 100%");
     434 [ #  # ][ #  # ]:          0 :     _Start("style:properties");
                 [ #  # ]
     435 [ #  # ][ #  # ]:          0 :     _End("style:properties");
     436 [ #  # ][ #  # ]:          0 :     _End("style:style");
     437                 :            : 
     438                 :            :     // T11 Dolni index
     439         [ #  # ]:          0 :     _AddAtt("style:name","T11");
     440         [ #  # ]:          0 :     _AddAtt("style:family","text");
     441 [ #  # ][ #  # ]:          0 :     _Start("style:style");
                 [ #  # ]
     442         [ #  # ]:          0 :     _AddAtt("style:text-position","-27% 100%");
     443 [ #  # ][ #  # ]:          0 :     _Start("style:properties");
                 [ #  # ]
     444 [ #  # ][ #  # ]:          0 :     _End("style:properties");
     445 [ #  # ][ #  # ]:          0 :     _End("style:style");
     446                 :            : 
     447 [ #  # ][ #  # ]:          0 :     _End("office:automatic-styles");
     448                 :            : 
     449 [ #  # ][ #  # ]:          0 :     _Start("office:styles");
                 [ #  # ]
     450 [ #  # ][ #  # ]:          0 :     _End("office:styles");
     451                 :            : 
     452 [ #  # ][ #  # ]:          0 :     _Start("office:body");
                 [ #  # ]
     453                 :            : 
     454         [ #  # ]:          0 :     Read602();
     455                 :            : 
     456 [ #  # ][ #  # ]:          0 :     _End("office:body");
     457 [ #  # ][ #  # ]:          0 :     _End("office:document-content");
     458                 :            : 
     459 [ #  # ][ #  # ]:          0 :     mxHandler->endDocument();
     460                 :            : 
     461                 :          0 :     return sal_True;
     462                 :            : }
     463                 :            : 
     464                 :          0 : void T602ImportFilter::Reset602()
     465                 :            : {
     466                 :          0 :     node = START;
     467                 :            : 
     468                 :          0 :     format602.mt = 0;
     469                 :          0 :     format602.mb = 0;
     470                 :          0 :     format602.tb = 0;
     471                 :          0 :     format602.ct = 0;
     472                 :          0 :     format602.pn = 1;
     473                 :          0 :     format602.lh = 1;
     474                 :          0 :     format602.lm = 6;
     475                 :          0 :     format602.rm = 60;
     476                 :          0 :     format602.pl = 60;
     477                 :            : 
     478                 :          0 :     ini.showcomm    = false;
     479                 :          0 :     ini.forcecode   = false;
     480                 :          0 :     ini.xcode    = KAM;
     481                 :          0 :     ini.ruscode    = false;
     482                 :          0 :     ini.reformatpars= false;
     483                 :          0 :     ini.fontsize    = 10;
     484                 :            : 
     485                 :          0 :     fst.nowfnt    = fst.oldfnt    = standard;
     486                 :          0 :     fst.uline    = fst.olduline    = false;
     487                 :            : 
     488                 :          0 :     pst.pars    = 0;
     489                 :          0 :     pst.comment    = false;
     490                 :          0 :     pst.wasspace    = 0;
     491                 :          0 :     pst.ccafterln    = false;
     492                 :          0 :     pst.willbeeop    = false;
     493                 :          0 :     pst.waspar    = false;
     494                 :          0 :     pst.wasfdash    = false;
     495                 :          0 : }
     496                 :            : 
     497                 :          0 : void T602ImportFilter::inschrdef(unsigned char ch)
     498                 :            : {
     499                 :            :     static sal_Unicode xch[2];
     500                 :            : 
     501                 :          0 :     xch[1] = 0;
     502                 :            : 
     503         [ #  # ]:          0 :     if(ch > 127) {
     504                 :            : 
     505   [ #  #  #  # ]:          0 :         switch(ini.xcode) {
     506                 :          0 :             case L2 : break;
     507                 :          0 :             case KOI: ch = koi2lat[ch-128]; break;
     508                 :          0 :             case KAM: ch = kam2lat[ch-128]; break;
     509                 :          0 :             default : ch = kam2lat[ch-128];
     510                 :            :         }
     511                 :            : 
     512         [ #  # ]:          0 :         if(ini.ruscode)
     513                 :          0 :             xch[0] = (rus2UNC[(ch-128)*2] << 8) + rus2UNC[(ch-128)*2+1];
     514                 :            :         else
     515                 :          0 :             xch[0] = (lat2UNC[(ch-128)*2] << 8) + lat2UNC[(ch-128)*2+1];
     516                 :            :     } else
     517                 :          0 :         xch[0] = ch;
     518                 :            : 
     519                 :          0 :     pst.waspar = false;
     520         [ #  # ]:          0 :     mxHandler->characters(OUString(xch));
     521                 :          0 : }
     522                 :            : 
     523                 :          0 : void T602ImportFilter::wrtfnt()
     524                 :            : {
     525 [ #  # ][ #  # ]:          0 :     Reference < XAttributeList > mAttrList ( mpAttrList );
     526                 :          0 :     const sal_Char *style = "P1";
     527                 :            : 
     528   [ #  #  #  #  :          0 :     switch(fst.nowfnt) {
             #  #  #  #  
                      # ]
     529         [ #  # ]:          0 :         case standard : style = (char*)(fst.uline ? "T7" : "T1"); break;
     530         [ #  # ]:          0 :         case fat      : style = (char*)(fst.uline ? "T8" : "T2"); break;
     531         [ #  # ]:          0 :         case cursive  : style = (char*)(fst.uline ? "T9" : "T3"); break;
     532                 :          0 :         case bold     : style = "T4"; break;
     533                 :          0 :         case tall     : style = "T5"; break;
     534                 :          0 :         case big      : style = "T6"; break;
     535                 :          0 :         case lindex   : style = "T11";break;
     536                 :          0 :         case hindex   : style = "T10";break;
     537                 :          0 :         default       : style = "T1"; break;
     538                 :            :     }
     539                 :            : 
     540 [ #  # ][ #  # ]:          0 :     _End("text:span");
     541         [ #  # ]:          0 :     _AddAtt("text:style-name", style);
     542 [ #  # ][ #  # ]:          0 :     _Start("text:span");
                 [ #  # ]
     543                 :          0 : }
     544                 :            : 
     545                 :          0 : void T602ImportFilter::setfnt(fonts fnt,bool mustwrite)
     546                 :            : {
     547 [ #  # ][ #  # ]:          0 :     if( fnt == fst.oldfnt &&
                 [ #  # ]
     548                 :            :         fnt == fst.nowfnt &&
     549                 :          0 :         !mustwrite )
     550                 :          0 :         fst.nowfnt = standard;
     551                 :            :     else
     552         [ #  # ]:          0 :         if (fnt != chngul) fst.nowfnt = fnt;
     553                 :            : 
     554         [ #  # ]:          0 :         if(mustwrite)
     555 [ #  # ][ #  # ]:          0 :             if(fst.oldfnt != fst.nowfnt || fst.olduline != fst.uline) {
     556                 :          0 :                 wrtfnt();
     557                 :          0 :                 fst.oldfnt = fst.nowfnt;
     558                 :          0 :                 fst.olduline = fst.uline;
     559                 :            :             }
     560                 :          0 : }
     561                 :            : 
     562                 :          0 : unsigned char T602ImportFilter::Readchar602()
     563                 :            : {
     564 [ #  # ][ #  # ]:          0 :     static Sequence< sal_Int8 > aData;
         [ #  # ][ #  # ]
     565                 :            : 
     566                 :          0 :     return (mxInputStream->readBytes(aData, 1) > 0) ?
     567         [ #  # ]:          0 :         ((unsigned char *) aData.getConstArray())[0] : 0;
     568                 :            : }
     569                 :            : 
     570                 :          0 : void T602ImportFilter::par602(bool endofpage)
     571                 :            : {
     572                 :            :     sal_Int16 endp;
     573 [ #  # ][ #  # ]:          0 :     Reference < XAttributeList > mAttrList ( mpAttrList );
     574                 :            : 
     575 [ #  # ][ #  # ]:          0 :     if(!endofpage || !pst.waspar) {
     576 [ #  # ][ #  # ]:          0 :         if(ini.showcomm||!pst.comment) {
     577 [ #  # ][ #  # ]:          0 :             if(pst.waspar||ini.reformatpars) {
     578 [ #  # ][ #  # ]:          0 :                 _End("text:span");
     579 [ #  # ][ #  # ]:          0 :                 _End("text:p");
     580         [ #  # ]:          0 :                 _AddAtt("text:style-name", "P1");
     581 [ #  # ][ #  # ]:          0 :                 _Start("text:p");
                 [ #  # ]
     582 [ #  # ][ #  # ]:          0 :                 _Start("text:span");
                 [ #  # ]
     583         [ #  # ]:          0 :                 wrtfnt();
     584                 :            :             } else {
     585 [ #  # ][ #  # ]:          0 :                 _Start("text:line-break");
                 [ #  # ]
     586 [ #  # ][ #  # ]:          0 :                 _End("text:line-break");
     587                 :            :             }
     588                 :            :         }
     589                 :            : 
     590                 :          0 :         pst.waspar = true;
     591                 :            :     }
     592                 :            : 
     593         [ #  # ]:          0 :     if(!pst.comment) {
     594   [ #  #  #  # ]:          0 :         switch(format602.lh) {
     595                 :          0 :             case 3: pst.pars += 4; break;
     596                 :          0 :             case 4: pst.pars += 3; break;
     597                 :          0 :             case 6: pst.pars += 2; break;
     598                 :          0 :             default: pst.pars +=2; break;
     599                 :            :         }
     600                 :          0 :         endp = format602.pl-format602.mt-format602.mb;
     601 [ #  # ][ #  # ]:          0 :         if(((pst.pars+1)/2) >= endp || endofpage) {
     602                 :          0 :             pst.pars = 0;
     603         [ #  # ]:          0 :             if(!ini.reformatpars) {
     604 [ #  # ][ #  # ]:          0 :                 _End("text:span");
     605 [ #  # ][ #  # ]:          0 :                 _End("text:p");
     606         [ #  # ]:          0 :                 _AddAtt("text:style-name", "P2");
     607 [ #  # ][ #  # ]:          0 :                 _Start("text:p");
                 [ #  # ]
     608 [ #  # ][ #  # ]:          0 :                 _Start("text:span");
                 [ #  # ]
     609         [ #  # ]:          0 :                 wrtfnt();
     610                 :            :             }
     611                 :            :         }
     612                 :          0 :     }
     613                 :          0 : }
     614                 :            : 
     615                 :          0 : sal_Int16 T602ImportFilter::readnum(unsigned char *ch, bool show)
     616                 :            : {
     617                 :            :     unsigned char buff[21];
     618                 :          0 :     sal_Int16 i=0;
     619                 :            : 
     620 [ #  # ][ #  # ]:          0 :     while((i<20) && *ch && (*ch!='\n') && (*ch!=','))
         [ #  # ][ #  # ]
                 [ #  # ]
     621                 :            :     {
     622         [ #  # ]:          0 :         *ch = Readchar602();
     623 [ #  # ][ #  # ]:          0 :         if(show) inschr(*ch);
     624                 :          0 :         buff[i++] = *ch;
     625                 :            :     }
     626                 :          0 :     buff[i]='\0';
     627                 :            : 
     628                 :            :     // mba: cast from unsigned char via int to sal_Int16 seems to be safe
     629                 :          0 :     return (sal_Int16) atoi((char *)buff);
     630                 :            : }
     631                 :            : 
     632                 :          0 : unsigned char T602ImportFilter::Setformat602(char *cmd)
     633                 :            : {
     634                 :            :     unsigned char ch;
     635                 :            :     sal_Int16 i;
     636                 :            : 
     637         [ #  # ]:          0 :     ch = Readchar602();
     638                 :            : 
     639 [ #  # ][ #  # ]:          0 :          if (cmd[0]=='M' && cmd[1]=='T') format602.mt = readnum(&ch,false);
                 [ #  # ]
     640 [ #  # ][ #  # ]:          0 :     else if (cmd[0]=='M' && cmd[1]=='B') format602.mb = readnum(&ch,false);
                 [ #  # ]
     641                 :            :     // else if (cmd[0]=='T' && cmd[1]=='B') {}
     642                 :            :     // else if (cmd[0]=='H' && cmd[1]=='E') {}
     643                 :            :     // else if (cmd[0]=='F' && cmd[1]=='O') {}
     644 [ #  # ][ #  # ]:          0 :     else if (cmd[0]=='C' && cmd[1]=='T') {
     645         [ #  # ]:          0 :         format602.ct = readnum(&ch,false);
     646         [ #  # ]:          0 :         if (!ini.forcecode)
     647   [ #  #  #  # ]:          0 :             switch(format602.ct) {
     648                 :          0 :                 case 0:  ini.xcode = KAM; break;
     649                 :          0 :                 case 1:  ini.xcode = L2;  break;
     650                 :          0 :                 case 2:  ini.xcode = KOI; break;
     651                 :          0 :                 default: ini.xcode = KAM; break;
     652                 :            :             }
     653                 :            :         }
     654 [ #  # ][ #  # ]:          0 :     else if (cmd[0]=='P' && cmd[1]=='N')  format602.pn = readnum(&ch,false);
                 [ #  # ]
     655 [ #  # ][ #  # ]:          0 :     else if (cmd[0]=='L' && cmd[1]=='H')  format602.lh = readnum(&ch,false);
                 [ #  # ]
     656                 :            :     // else if(cmd[0]=='S' && cmd[1]=='T') {} //styl
     657 [ #  # ][ #  # ]:          0 :     else if (cmd[0]=='L' && cmd[1]=='M')  format602.lm = readnum(&ch,false);
                 [ #  # ]
     658 [ #  # ][ #  # ]:          0 :     else if (cmd[0]=='R' && cmd[1]=='M')  format602.rm = readnum(&ch,false);
                 [ #  # ]
     659 [ #  # ][ #  # ]:          0 :     else if (cmd[0]=='P' && cmd[1]=='L')  format602.pl = readnum(&ch,false);
                 [ #  # ]
     660 [ #  # ][ #  # ]:          0 :     else if (cmd[0]=='P' && cmd[1]=='A') { if(pst.pars) par602(true); }
         [ #  # ][ #  # ]
     661 [ #  # ][ #  # ]:          0 :     else if (cmd[0]=='C' && cmd[1]=='P') {
     662         [ #  # ]:          0 :         i = readnum(&ch,false);
     663         [ #  # ]:          0 :         if ((i+pst.pars/2) > (format602.pl-format602.mt-format602.mb))
     664 [ #  # ][ #  # ]:          0 :             if(pst.pars) par602(true);
     665                 :            :     }
     666 [ #  # ][ #  # ]:          0 :     while (ch && (ch != '\n')) ch = Readchar602();
         [ #  # ][ #  # ]
     667                 :          0 :     return ch;
     668                 :            : }
     669                 :            : 
     670                 :          0 : tnode T602ImportFilter::PointCmd602(unsigned char *ch)
     671                 :            : {
     672                 :            :     char pcmd[2];
     673                 :            : 
     674                 :            :     // warning: uChar -> char
     675         [ #  # ]:          0 :     pcmd[0] = (char) toupper(*ch); inschr(*ch);
     676         [ #  # ]:          0 :     *ch = Readchar602();
     677         [ #  # ]:          0 :     if (!*ch) return EEND;
     678         [ #  # ]:          0 :     if (*ch=='\n') return EOL;
     679 [ #  # ][ #  # ]:          0 :     if (!isalpha(*ch)) return (*ch<32) ? SETCH : WRITE;
     680                 :            : 
     681                 :            :     // warning: uChar -> char
     682         [ #  # ]:          0 :     pcmd[1] = (char) toupper(*ch); inschr(*ch);
     683                 :            : 
     684 [ #  # ][ #  # ]:          0 :          if (pcmd[0]=='P' && pcmd[1]=='A') { if (pst.pars) pst.willbeeop = true; }
                 [ #  # ]
     685 [ #  # ][ #  # ]:          0 :     else if (pcmd[0]=='C' && pcmd[1]=='P') { if (pst.pars) pst.willbeeop = true; }
                 [ #  # ]
     686 [ #  # ][ #  # ]:          0 :     else if (pcmd[0]=='P' && pcmd[1]=='I') {
     687 [ #  # ][ #  # ]:          0 :         while (*ch && (*ch != '\n') && (*ch != ','))
         [ #  # ][ #  # ]
     688 [ #  # ][ #  # ]:          0 :             { *ch = Readchar602(); inschr(*ch); }
     689         [ #  # ]:          0 :         if (!*ch) return EEND;
     690         [ #  # ]:          0 :         if (*ch=='\n') return EOL;
     691 [ #  # ][ #  # ]:          0 :         if (*ch==',') { *ch = Readchar602(); inschr(*ch); }
                 [ #  # ]
     692         [ #  # ]:          0 :         pst.pars += (readnum(ch,true)*2);
     693         [ #  # ]:          0 :         if (!*ch) return EEND;
     694         [ #  # ]:          0 :         if (*ch=='\n') return EOL;
     695                 :            :     }
     696                 :            :     // else if(pcmd[0]=='K'&&pcmd[1]=='P') {}
     697                 :            :     // else if(pcmd[0]=='H'&&pcmd[1]=='E') {}
     698                 :            :     // else if(pcmd[0]=='F'&&pcmd[1]=='O') {}
     699                 :            : 
     700                 :          0 :     return READCH;
     701                 :            : }
     702                 :            : 
     703                 :            : 
     704                 :          0 : void T602ImportFilter::Read602()
     705                 :            : {
     706                 :          0 :     unsigned char ch=0;
     707                 :            :     char cmd602[3];
     708                 :            : 
     709 [ #  # ][ #  # ]:          0 :     Reference < XAttributeList > mAttrList ( mpAttrList );
     710                 :            : 
     711         [ #  # ]:          0 :     if (node==QUIT) return;
     712                 :            : 
     713         [ #  # ]:          0 :     _AddAtt("text:style-name", "P1");
     714 [ #  # ][ #  # ]:          0 :     _Start("text:p");
                 [ #  # ]
     715         [ #  # ]:          0 :     _AddAtt("text:style-name", "T1");
     716 [ #  # ][ #  # ]:          0 :     _Start("text:span");
                 [ #  # ]
     717                 :            : 
     718         [ #  # ]:          0 :     if (node==START) { node = EOL; }
     719                 :            : 
     720         [ #  # ]:          0 :     while (node != EEND) {
     721   [ #  #  #  #  :          0 :         switch (node) {
             #  #  #  # ]
     722                 :            :         case READCH:
     723         [ #  # ]:          0 :             ch = Readchar602();
     724         [ #  # ]:          0 :             if (ch == 0) node = EEND;
     725         [ #  # ]:          0 :             else if (ch == '\n') {
     726 [ #  # ][ #  # ]:          0 :                 if(!pst.willbeeop) par602(false);
     727                 :          0 :                 node = EOL;
     728         [ #  # ]:          0 :             } else if (ch < 32) node = SETCH;
     729                 :          0 :             else node = WRITE;
     730                 :          0 :             break;
     731                 :            :         case EOL:
     732         [ #  # ]:          0 :             ch = Readchar602();
     733                 :          0 :             pst.comment = false;
     734 [ #  # ][ #  # ]:          0 :             if (pst.willbeeop) par602(true);
     735                 :          0 :             pst.willbeeop = false;
     736         [ #  # ]:          0 :             if(ch == 0) node = EEND;
     737         [ #  # ]:          0 :             else if (ch == '@') node = EXPCMD;
     738 [ #  # ][ #  # ]:          0 :             else if (ch == '\n') { par602(false); node = EOL; }
     739         [ #  # ]:          0 :             else if (ch < 32) {pst.ccafterln = true; node = SETCH; break;}
     740                 :          0 :             else node = WRITE;
     741         [ #  # ]:          0 :             if (ch == '.') { pst.comment = true; node = POCMD; }
     742                 :          0 :             pst.ccafterln = false;
     743                 :          0 :             break;
     744                 :            : 
     745         [ #  # ]:          0 :         case POCMD: inschr('.');
     746         [ #  # ]:          0 :             ch = Readchar602();
     747         [ #  # ]:          0 :             if(ch == 0) node = EEND;
     748 [ #  # ][ #  # ]:          0 :             else if(isalpha(ch)) node = PointCmd602(&ch);
     749         [ #  # ]:          0 :             else if(ch <32) node=SETCH;
     750                 :          0 :             else node = WRITE;
     751                 :          0 :             break;
     752                 :            : 
     753         [ #  # ]:          0 :         case EXPCMD: ch = Readchar602();
     754 [ #  # ][ #  # ]:          0 :             if(ch == 0) {inschr('@'); node = EEND; }
     755         [ #  # ]:          0 :             else if(isupper(ch)) {
     756                 :          0 :                 cmd602[0] = ch;
     757         [ #  # ]:          0 :                 ch = Readchar602();
     758                 :          0 :                 cmd602[1] = ch;
     759                 :          0 :                 cmd602[2] = '\0';
     760         [ #  # ]:          0 :                 if(isupper(ch)) node = SETCMD;   //nedodelano
     761 [ #  # ][ #  # ]:          0 :                 else { inschr('@'); _Chars(cmd602); node = READCH; }
                 [ #  # ]
     762                 :            :             } else {
     763         [ #  # ]:          0 :                 inschr('@');
     764         [ #  # ]:          0 :                 if(ch<32) node = SETCH;
     765                 :          0 :                 else node = WRITE;}
     766                 :          0 :             break;
     767                 :            : 
     768                 :            :         case SETCMD:
     769         [ #  # ]:          0 :             ch = Setformat602(cmd602);
     770         [ #  # ]:          0 :             if(ch == 0) node = EEND;
     771         [ #  # ]:          0 :             else if(ch == '\n') node = EOL;
     772                 :          0 :             else node = READCH;
     773                 :          0 :             break;
     774                 :            : 
     775                 :            :         case SETCH :
     776                 :            :             // warning: potentially uninitialized
     777   [ #  #  #  #  :          0 :             switch(ch) {
          #  #  #  #  #  
          #  #  #  #  #  
             #  #  #  # ]
     778 [ #  # ][ #  # ]:          0 :             case '\t' : _Start("text:tab-stop");
                 [ #  # ]
     779 [ #  # ][ #  # ]:          0 :                     _End("text:tab-stop");
     780                 :          0 :                     break;
     781                 :          0 :             case 0x03 : break; //condensed
     782                 :          0 :             case 0x01 : break; //elite
     783                 :          0 :             case 0x11 : break; //uzv1
     784                 :          0 :             case 0x12 : break; //uzv2
     785                 :          0 :             case 0x15 : break; //uzv3
     786                 :          0 :             case 0x17 : break; //uzv4
     787                 :          0 :             case 0x18 : break; //uzv5
     788                 :          0 :             case 0x19 : break; //uzv6
     789                 :          0 :             case 0x13 : fst.uline = !fst.uline;break;
     790         [ #  # ]:          0 :             case 0x02 : setfnt(fat,false);     break;
     791         [ #  # ]:          0 :             case 0x04 : setfnt(cursive,false); break;
     792         [ #  # ]:          0 :             case 0x0f : setfnt(bold,false);    break;
     793         [ #  # ]:          0 :             case 0x10 : setfnt(tall,false);    break;
     794         [ #  # ]:          0 :             case 0x1d : setfnt(big,false);     break;
     795         [ #  # ]:          0 :             case 0x14 : setfnt(hindex,false);  break;
     796         [ #  # ]:          0 :             case 0x16 : setfnt(lindex,false);  break;
     797                 :          0 :             default   : break;
     798                 :            :             }
     799         [ #  # ]:          0 :             if(pst.ccafterln) node = EOL;
     800                 :          0 :             else node = READCH;
     801                 :          0 :             break;
     802                 :            : 
     803                 :            :         case WRITE :
     804   [ #  #  #  # ]:          0 :             switch(ch) {
     805                 :            :             case 0x8d:
     806         [ #  # ]:          0 :                 ch = Readchar602();
     807         [ #  # ]:          0 :                 if( ch == 0x0a) {
     808 [ #  # ][ #  # ]:          0 :                     if(ini.reformatpars) inschr(' ');
     809         [ #  # ]:          0 :                     else par602(false); //formatovaci radek
     810                 :          0 :                     node = EOL;
     811                 :            :                 } else {
     812         [ #  # ]:          0 :                     inschr(0x8d);//inschr(' ');
     813         [ #  # ]:          0 :                     if(ch == 0) node = EEND;
     814         [ #  # ]:          0 :                     else if(ch == '\n') {
     815 [ #  # ][ #  # ]:          0 :                         if(!pst.willbeeop) par602(false);
     816                 :          0 :                         node = EOL; }
     817         [ #  # ]:          0 :                     else if(ch < 32) node = SETCH;
     818                 :          0 :                     else node = WRITE;
     819                 :            :                 }
     820                 :          0 :                 break;
     821                 :            :             case 0xfe:
     822 [ #  # ][ #  # ]:          0 :                 if (ini.showcomm||!pst.comment) inschr(' ');
                 [ #  # ]
     823                 :          0 :                 node = READCH;
     824                 :          0 :                 break;
     825                 :            :             case 0xad:
     826         [ #  # ]:          0 :                 ch = Readchar602();
     827         [ #  # ]:          0 :                 if( ch==0x8d ) {
     828 [ #  # ][ #  # ]:          0 :                     if(ini.showcomm||!pst.comment) { //formatovaci pomlcka
     829         [ #  # ]:          0 :                         if(!ini.reformatpars)
     830         [ #  # ]:          0 :                             inschr('-');
     831                 :            :                         else {
     832                 :          0 :                             pst.wasspace--;
     833                 :          0 :                             pst.wasfdash = true;
     834                 :            :                         }
     835                 :            :                     }
     836                 :          0 :                     node=WRITE;
     837                 :            :                 } else {
     838         [ #  # ]:          0 :                     inschr(0xad);
     839         [ #  # ]:          0 :                     if(ch == 0) node = EEND;
     840         [ #  # ]:          0 :                     else if(ch == '\n') {
     841 [ #  # ][ #  # ]:          0 :                         if(!pst.willbeeop) par602(false);
     842                 :          0 :                         node = EOL; }
     843         [ #  # ]:          0 :                     else if(ch < 32) node = SETCH;
     844                 :          0 :                     else node = WRITE;
     845                 :            :                 }
     846                 :          0 :                 break;
     847                 :            :             default:
     848         [ #  # ]:          0 :                 inschr(ch);
     849                 :          0 :                 node = READCH;
     850                 :          0 :                 break;
     851                 :            :             }
     852                 :          0 :             break;
     853                 :          0 :         default: break;
     854                 :            :         }
     855                 :            :     }
     856                 :            : 
     857 [ #  # ][ #  # ]:          0 :     _End("text:span");
     858 [ #  # ][ #  # ]:          0 :     _End("text:p");
     859         [ #  # ]:          0 :     node = QUIT;
     860                 :            : }
     861                 :            : 
     862                 :            : // XServiceInfo
     863                 :          0 : OUString SAL_CALL T602ImportFilter::getImplementationName(  )
     864                 :            :     throw (RuntimeException)
     865                 :            : {
     866                 :          0 :     return T602ImportFilter_getImplementationName();
     867                 :            : }
     868                 :            : 
     869                 :          0 : sal_Bool SAL_CALL T602ImportFilter::supportsService( const OUString& rServiceName )
     870                 :            :     throw (RuntimeException)
     871                 :            : {
     872                 :          0 :     return T602ImportFilter_supportsService( rServiceName );
     873                 :            : }
     874                 :            : 
     875                 :          0 : Sequence< OUString > SAL_CALL T602ImportFilter::getSupportedServiceNames(  )
     876                 :            :     throw (RuntimeException)
     877                 :            : {
     878                 :          0 :     return T602ImportFilter_getSupportedServiceNames();
     879                 :            : }
     880                 :            : 
     881                 :            : #define IMPLEMENTATION_NAME "com.sun.star.comp.Writer.T602ImportFilter"
     882                 :            : 
     883                 :          6 : OUString T602ImportFilter_getImplementationName ()
     884                 :            :     throw (RuntimeException)
     885                 :            : {
     886                 :          6 :     return OUString (  IMPLEMENTATION_NAME  );
     887                 :            : }
     888                 :            : 
     889                 :            : #define SERVICE_NAME1 "com.sun.star.document.ImportFilter"
     890                 :            : #define SERVICE_NAME2 "com.sun.star.document.ExtendedTypeDetection"
     891                 :          0 : sal_Bool SAL_CALL T602ImportFilter_supportsService( const OUString& ServiceName )
     892                 :            :     throw (RuntimeException)
     893                 :            : {
     894 [ #  # ][ #  # ]:          0 :     return ( ServiceName == SERVICE_NAME1 || ServiceName == SERVICE_NAME2 );
     895                 :            : }
     896                 :            : 
     897                 :          6 : Sequence< OUString > SAL_CALL T602ImportFilter_getSupportedServiceNames(  )
     898                 :            :     throw (RuntimeException)
     899                 :            : {
     900                 :          6 :     Sequence < OUString > aRet(2);
     901         [ +  - ]:          6 :     OUString* pArray = aRet.getArray();
     902                 :          6 :     pArray[0] =  OUString (  SERVICE_NAME1  );
     903                 :          6 :     pArray[1] =  OUString (  SERVICE_NAME2  );
     904                 :          6 :     return aRet;
     905                 :            : }
     906                 :            : #undef SERVICE_NAME2
     907                 :            : #undef SERVICE_NAME1
     908                 :            : #undef IMPLEMENTATION_NAME
     909                 :            : 
     910                 :         10 : Reference< XInterface > SAL_CALL T602ImportFilter_createInstance( const Reference< XMultiServiceFactory > & rSMgr)
     911                 :            :     throw( Exception )
     912                 :            : {
     913         [ +  - ]:         10 :     return (cppu::OWeakObject*) new T602ImportFilter( rSMgr );
     914                 :            : }
     915                 :            : 
     916                 :          0 : T602ImportFilterDialog::T602ImportFilterDialog(const ::com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory > &r ) :
     917                 :          0 :     mxMSF( r ), mpResMgr( NULL ) {}
     918                 :            : 
     919                 :          0 : T602ImportFilterDialog::~T602ImportFilterDialog()
     920                 :            : {
     921         [ #  # ]:          0 :     if (mpResMgr)
     922 [ #  # ][ #  # ]:          0 :         delete mpResMgr;
     923         [ #  # ]:          0 : }
     924                 :            : 
     925                 :            : // XLocalizable
     926                 :            : 
     927                 :          0 : void SAL_CALL T602ImportFilterDialog::setLocale( const Locale& eLocale )
     928                 :            :     throw(::com::sun::star::uno::RuntimeException)
     929                 :            : {
     930                 :          0 :     meLocale = eLocale;
     931                 :          0 :     initLocale();
     932                 :          0 : }
     933                 :            : 
     934                 :          0 : Locale SAL_CALL T602ImportFilterDialog::getLocale()
     935                 :            :     throw(::com::sun::star::uno::RuntimeException)
     936                 :            : {
     937                 :          0 :     return meLocale;
     938                 :            : }
     939                 :            : 
     940                 :          0 : sal_Bool T602ImportFilterDialog::OptionsDlg()
     941                 :            : {
     942                 :          0 :     sal_Bool ret = sal_False;
     943                 :            : 
     944                 :          0 :     Any any;
     945                 :            : #define _propInt(_prop,_nam,_val) \
     946                 :            :     any <<= (sal_Int32)_val;\
     947                 :            :     _prop->setPropertyValue(OUString::createFromAscii(_nam), any);
     948                 :            : #define _propShort(_prop,_nam,_val) \
     949                 :            :     any <<= (sal_Int16)_val;\
     950                 :            :     _prop->setPropertyValue(OUString::createFromAscii(_nam), any);
     951                 :            : #define _propBool(_prop,_nam,_val) \
     952                 :            :     any <<= (sal_Bool)_val;\
     953                 :            :     _prop->setPropertyValue(OUString::createFromAscii(_nam), any);
     954                 :            : #define _propString(_prop,_nam,_val) \
     955                 :            :     any <<= OUString::createFromAscii(_val);\
     956                 :            :     _prop->setPropertyValue(OUString::createFromAscii(_nam), any);
     957                 :            : #define _propStringFromResId(_prop,_nam,_val) \
     958                 :            :     any <<= getResStr(_val);\
     959                 :            :     _prop->setPropertyValue(OUString::createFromAscii(_nam), any);
     960                 :            : #define _propGet(_prop,_nam) \
     961                 :            :     _prop->getPropertyValue(OUString::createFromAscii(_nam));
     962                 :            : #define _InstCtx(_path,_ctx)\
     963                 :            :     rServiceManager->createInstanceWithContext(\
     964                 :            :     OUString::createFromAscii(_path),_ctx);
     965                 :            : #define _Inst(_path)\
     966                 :            :     xMultiServiceFactory->createInstance(OUString::createFromAscii(_path) );
     967                 :            : #define _Insert(_cont,_nam,_obj) \
     968                 :            :     any <<= _obj;\
     969                 :            :     _cont->insertByName( OUString::createFromAscii(_nam), any );
     970                 :            : 
     971         [ #  # ]:          0 :     Reference < XComponentContext > rComponentContext = defaultBootstrap_InitialComponentContext();
     972 [ #  # ][ #  # ]:          0 :     Reference < XMultiComponentFactory > rServiceManager = rComponentContext->getServiceManager();
     973 [ #  # ][ #  # ]:          0 :     Reference < XInterface > rInstance = _InstCtx("com.sun.star.awt.UnoControlDialogModel", rComponentContext );
     974                 :            : 
     975         [ #  # ]:          0 :     Reference <XMultiServiceFactory> xMultiServiceFactory (rInstance,UNO_QUERY);
     976                 :            : 
     977         [ #  # ]:          0 :     Reference < XPropertySet > xPSetDialog( rInstance, UNO_QUERY );
     978 [ #  # ][ #  # ]:          0 :     _propInt(xPSetDialog,"PositionX",100);
                 [ #  # ]
     979 [ #  # ][ #  # ]:          0 :     _propInt(xPSetDialog,"PositionY",100);
                 [ #  # ]
     980 [ #  # ][ #  # ]:          0 :     _propInt(xPSetDialog,"Width",130);
                 [ #  # ]
     981 [ #  # ][ #  # ]:          0 :     _propInt(xPSetDialog,"Height",90);
                 [ #  # ]
     982 [ #  # ][ #  # ]:          0 :     _propStringFromResId(xPSetDialog,"Title", T602FILTER_STR_IMPORT_DIALOG_TITLE);
         [ #  # ][ #  # ]
     983                 :            : 
     984                 :            : #define T602DLG_OK_BUTTON    "ok_button"
     985                 :            : #define T602DLG_CANCEL_BUTTON    "cancel_button"
     986                 :            : #define T602DLG_CODE_LB        "code_lb"
     987                 :            : #define T602DLG_AZBUKA_CB    "azbuka_cb"
     988                 :            : #define T602DLG_COMMENT_CB    "comment_cb"
     989                 :            : #define T602DLG_REFORMAT_CB    "reformat_cb"
     990                 :            : #define T602DLG_CODE_TXT    "code_txt"
     991                 :            : 
     992 [ #  # ][ #  # ]:          0 :     Reference < XInterface > TextModel = _Inst("com.sun.star.awt.UnoControlFixedTextModel");
     993         [ #  # ]:          0 :     Reference < XPropertySet > xPSetText( TextModel, UNO_QUERY );
     994 [ #  # ][ #  # ]:          0 :     _propInt(xPSetText,"PositionX",10);
                 [ #  # ]
     995 [ #  # ][ #  # ]:          0 :     _propInt(xPSetText,"PositionY",8);
                 [ #  # ]
     996 [ #  # ][ #  # ]:          0 :     _propInt(xPSetText,"Width",30);
                 [ #  # ]
     997 [ #  # ][ #  # ]:          0 :     _propInt(xPSetText,"Height",14);
                 [ #  # ]
     998 [ #  # ][ #  # ]:          0 :     _propString(xPSetText,"Name",T602DLG_CODE_TXT);
                 [ #  # ]
     999 [ #  # ][ #  # ]:          0 :     _propStringFromResId(xPSetText,"Label",T602FILTER_STR_ENCODING_LABEL);
         [ #  # ][ #  # ]
    1000                 :            : 
    1001 [ #  # ][ #  # ]:          0 :     Reference < XInterface > ListBoxModel = _Inst("com.sun.star.awt.UnoControlListBoxModel");
    1002         [ #  # ]:          0 :     Reference < XPropertySet > xPSetCodeLB( ListBoxModel, UNO_QUERY );
    1003 [ #  # ][ #  # ]:          0 :     _propInt(xPSetCodeLB,"PositionX",40);
                 [ #  # ]
    1004 [ #  # ][ #  # ]:          0 :     _propInt(xPSetCodeLB,"PositionY",5);
                 [ #  # ]
    1005 [ #  # ][ #  # ]:          0 :     _propInt(xPSetCodeLB,"Width",85);
                 [ #  # ]
    1006 [ #  # ][ #  # ]:          0 :     _propInt(xPSetCodeLB,"Height",14);
                 [ #  # ]
    1007 [ #  # ][ #  # ]:          0 :     _propString(xPSetCodeLB,"Name",T602DLG_CODE_LB);
                 [ #  # ]
    1008 [ #  # ][ #  # ]:          0 :     _propShort(xPSetCodeLB,"TabIndex",1);
                 [ #  # ]
    1009 [ #  # ][ #  # ]:          0 :     _propBool(xPSetCodeLB,"Dropdown",true);
                 [ #  # ]
    1010 [ #  # ][ #  # ]:          0 :     _propBool(xPSetCodeLB,"MultiSelection",false);
                 [ #  # ]
    1011                 :            : 
    1012         [ #  # ]:          0 :     Sequence< OUString > ous(4);
    1013 [ #  # ][ #  # ]:          0 :     ous[0] = getResStr(T602FILTER_STR_ENCODING_AUTO);
    1014 [ #  # ][ #  # ]:          0 :     ous[1] = getResStr(T602FILTER_STR_ENCODING_CP852);
    1015 [ #  # ][ #  # ]:          0 :     ous[2] = getResStr(T602FILTER_STR_ENCODING_CP895);
    1016 [ #  # ][ #  # ]:          0 :     ous[3] = getResStr(T602FILTER_STR_ENCODING_KOI8CS2);
    1017         [ #  # ]:          0 :     any <<= ous;
    1018 [ #  # ][ #  # ]:          0 :     xPSetCodeLB->setPropertyValue(OUString(  "StringItemList" ), any);
    1019                 :            : 
    1020         [ #  # ]:          0 :     Sequence < sal_Int16 > shr(1);
    1021 [ #  # ][ #  # ]:          0 :     shr[0] = ini.forcecode ? ((sal_Int16) ini.xcode) + 1 : 0;
    1022         [ #  # ]:          0 :     any <<= shr;
    1023 [ #  # ][ #  # ]:          0 :     xPSetCodeLB->setPropertyValue(OUString(  "SelectedItems" ), any);
    1024                 :            : 
    1025 [ #  # ][ #  # ]:          0 :     Reference < XInterface > AzbCheckBoxModel = _Inst("com.sun.star.awt.UnoControlCheckBoxModel");
    1026         [ #  # ]:          0 :     Reference < XPropertySet > xPSetAzbukaCB( AzbCheckBoxModel, UNO_QUERY );
    1027 [ #  # ][ #  # ]:          0 :     _propInt(xPSetAzbukaCB,"PositionX",10);
                 [ #  # ]
    1028 [ #  # ][ #  # ]:          0 :     _propInt(xPSetAzbukaCB,"PositionY",25);
                 [ #  # ]
    1029 [ #  # ][ #  # ]:          0 :     _propInt(xPSetAzbukaCB,"Width",100);
                 [ #  # ]
    1030 [ #  # ][ #  # ]:          0 :     _propInt(xPSetAzbukaCB,"Height",14);
                 [ #  # ]
    1031 [ #  # ][ #  # ]:          0 :     _propString(xPSetAzbukaCB,"Name",T602DLG_AZBUKA_CB);
                 [ #  # ]
    1032 [ #  # ][ #  # ]:          0 :     _propShort(xPSetAzbukaCB,"TabIndex",2);
                 [ #  # ]
    1033 [ #  # ][ #  # ]:          0 :     _propStringFromResId(xPSetAzbukaCB,"Label",T602FILTER_STR_CYRILLIC_MODE);
         [ #  # ][ #  # ]
    1034 [ #  # ][ #  # ]:          0 :     _propShort(xPSetAzbukaCB,"State",ini.ruscode);
                 [ #  # ]
    1035                 :            : 
    1036 [ #  # ][ #  # ]:          0 :     Reference < XInterface > RefCheckBoxModel = _Inst("com.sun.star.awt.UnoControlCheckBoxModel");
    1037         [ #  # ]:          0 :     Reference < XPropertySet > xPSetRefCB( RefCheckBoxModel, UNO_QUERY );
    1038 [ #  # ][ #  # ]:          0 :     _propInt(xPSetRefCB,"PositionX",10);
                 [ #  # ]
    1039 [ #  # ][ #  # ]:          0 :     _propInt(xPSetRefCB,"PositionY",40);
                 [ #  # ]
    1040 [ #  # ][ #  # ]:          0 :     _propInt(xPSetRefCB,"Width",100);
                 [ #  # ]
    1041 [ #  # ][ #  # ]:          0 :     _propInt(xPSetRefCB,"Height",14);
                 [ #  # ]
    1042 [ #  # ][ #  # ]:          0 :     _propString(xPSetRefCB,"Name",T602DLG_REFORMAT_CB);
                 [ #  # ]
    1043 [ #  # ][ #  # ]:          0 :     _propShort(xPSetRefCB,"TabIndex",3);
                 [ #  # ]
    1044 [ #  # ][ #  # ]:          0 :     _propStringFromResId(xPSetRefCB,"Label",T602FILTER_STR_REFORMAT_TEXT);
         [ #  # ][ #  # ]
    1045 [ #  # ][ #  # ]:          0 :     _propShort(xPSetRefCB,"State",ini.reformatpars);
                 [ #  # ]
    1046                 :            : 
    1047 [ #  # ][ #  # ]:          0 :     Reference < XInterface > CommCheckBoxModel = _Inst("com.sun.star.awt.UnoControlCheckBoxModel");
    1048         [ #  # ]:          0 :     Reference < XPropertySet > xPSetCommCB( CommCheckBoxModel, UNO_QUERY );
    1049 [ #  # ][ #  # ]:          0 :     _propInt(xPSetCommCB,"PositionX",10);
                 [ #  # ]
    1050 [ #  # ][ #  # ]:          0 :     _propInt(xPSetCommCB,"PositionY",55);
                 [ #  # ]
    1051 [ #  # ][ #  # ]:          0 :     _propInt(xPSetCommCB,"Width",100);
                 [ #  # ]
    1052 [ #  # ][ #  # ]:          0 :     _propInt(xPSetCommCB,"Height",14);
                 [ #  # ]
    1053 [ #  # ][ #  # ]:          0 :     _propString(xPSetCommCB,"Name",T602DLG_COMMENT_CB);
                 [ #  # ]
    1054 [ #  # ][ #  # ]:          0 :     _propShort(xPSetCommCB,"TabIndex",4);
                 [ #  # ]
    1055 [ #  # ][ #  # ]:          0 :     _propStringFromResId(xPSetCommCB,"Label",T602FILTER_STR_DOT_COMMANDS);
         [ #  # ][ #  # ]
    1056 [ #  # ][ #  # ]:          0 :     _propShort(xPSetCommCB,"State",ini.showcomm);
                 [ #  # ]
    1057                 :            : 
    1058 [ #  # ][ #  # ]:          0 :     Reference < XInterface > CancelButtonModel = _Inst("com.sun.star.awt.UnoControlButtonModel");
    1059         [ #  # ]:          0 :     Reference < XPropertySet > xPSetCancelButton( CancelButtonModel, UNO_QUERY );
    1060 [ #  # ][ #  # ]:          0 :     _propInt(xPSetCancelButton,"PositionX",10);
                 [ #  # ]
    1061 [ #  # ][ #  # ]:          0 :     _propInt(xPSetCancelButton,"PositionY",70);
                 [ #  # ]
    1062 [ #  # ][ #  # ]:          0 :     _propInt(xPSetCancelButton,"Width",50);
                 [ #  # ]
    1063 [ #  # ][ #  # ]:          0 :     _propInt(xPSetCancelButton,"Height",14);
                 [ #  # ]
    1064 [ #  # ][ #  # ]:          0 :     _propString(xPSetCancelButton,"Name",T602DLG_CANCEL_BUTTON);
                 [ #  # ]
    1065 [ #  # ][ #  # ]:          0 :     _propShort(xPSetCancelButton,"TabIndex",5);
                 [ #  # ]
    1066 [ #  # ][ #  # ]:          0 :     _propShort(xPSetCancelButton,"PushButtonType",2);
                 [ #  # ]
    1067 [ #  # ][ #  # ]:          0 :     _propStringFromResId(xPSetCancelButton,"Label",T602FILTER_STR_CANCEL_BUTTON);
         [ #  # ][ #  # ]
    1068                 :            : 
    1069 [ #  # ][ #  # ]:          0 :     Reference < XInterface > OkButtonModel = _Inst("com.sun.star.awt.UnoControlButtonModel");
    1070         [ #  # ]:          0 :     Reference < XPropertySet > xPSetOkButton( OkButtonModel, UNO_QUERY );
    1071 [ #  # ][ #  # ]:          0 :     _propInt(xPSetOkButton,"PositionX",70);
                 [ #  # ]
    1072 [ #  # ][ #  # ]:          0 :     _propInt(xPSetOkButton,"PositionY",70);
                 [ #  # ]
    1073 [ #  # ][ #  # ]:          0 :     _propInt(xPSetOkButton,"Width",50);
                 [ #  # ]
    1074 [ #  # ][ #  # ]:          0 :     _propInt(xPSetOkButton,"Height",14);
                 [ #  # ]
    1075 [ #  # ][ #  # ]:          0 :     _propString(xPSetOkButton,"Name",T602DLG_OK_BUTTON);
                 [ #  # ]
    1076 [ #  # ][ #  # ]:          0 :     _propShort(xPSetOkButton,"TabIndex",0);
                 [ #  # ]
    1077 [ #  # ][ #  # ]:          0 :     _propShort(xPSetOkButton,"PushButtonType",1);
                 [ #  # ]
    1078 [ #  # ][ #  # ]:          0 :     _propStringFromResId(xPSetOkButton,"Label",T602FILTER_STR_OK_BUTTON);
         [ #  # ][ #  # ]
    1079 [ #  # ][ #  # ]:          0 :     _propBool(xPSetOkButton,"DefaultButton",true);
                 [ #  # ]
    1080                 :            : 
    1081         [ #  # ]:          0 :     Reference < XNameContainer > xNameCont (rInstance,UNO_QUERY);
    1082                 :            : 
    1083 [ #  # ][ #  # ]:          0 :     _Insert(xNameCont, T602DLG_OK_BUTTON, OkButtonModel);
                 [ #  # ]
    1084 [ #  # ][ #  # ]:          0 :     _Insert(xNameCont, T602DLG_CANCEL_BUTTON, CancelButtonModel);
                 [ #  # ]
    1085 [ #  # ][ #  # ]:          0 :     _Insert(xNameCont, T602DLG_AZBUKA_CB, AzbCheckBoxModel);
                 [ #  # ]
    1086 [ #  # ][ #  # ]:          0 :     _Insert(xNameCont, T602DLG_REFORMAT_CB, RefCheckBoxModel);
                 [ #  # ]
    1087 [ #  # ][ #  # ]:          0 :     _Insert(xNameCont, T602DLG_COMMENT_CB, CommCheckBoxModel);
                 [ #  # ]
    1088 [ #  # ][ #  # ]:          0 :     _Insert(xNameCont, T602DLG_CODE_LB, ListBoxModel);
                 [ #  # ]
    1089 [ #  # ][ #  # ]:          0 :     _Insert(xNameCont, T602DLG_CODE_TXT, TextModel);
                 [ #  # ]
    1090                 :            : 
    1091 [ #  # ][ #  # ]:          0 :     Reference< XInterface > dialog = _InstCtx("com.sun.star.awt.UnoControlDialog",rComponentContext);
    1092                 :            : 
    1093         [ #  # ]:          0 :     Reference < XControl > xControl (dialog,UNO_QUERY);
    1094         [ #  # ]:          0 :     Reference < XControlModel > xControlModel (rInstance,UNO_QUERY);
    1095                 :            : 
    1096         [ #  # ]:          0 :     if(!xControl.is())
    1097                 :          0 :         return sal_False;
    1098                 :            : 
    1099 [ #  # ][ #  # ]:          0 :     xControl->setModel( xControlModel );
    1100                 :            : 
    1101 [ #  # ][ #  # ]:          0 :     Reference< XInterface > toolkit = _InstCtx("com.sun.star.awt.ExtToolkit", rComponentContext);
    1102                 :            : 
    1103         [ #  # ]:          0 :     Reference < XToolkit > xToolkit (toolkit,UNO_QUERY);
    1104         [ #  # ]:          0 :     Reference < XWindow > xWindow (xControl,UNO_QUERY);
    1105                 :            : 
    1106         [ #  # ]:          0 :     if(!xWindow.is())
    1107                 :          0 :         return sal_False;
    1108                 :            : 
    1109 [ #  # ][ #  # ]:          0 :     xWindow->setVisible( false );
    1110 [ #  # ][ #  # ]:          0 :     xControl->createPeer( xToolkit, NULL );
                 [ #  # ]
    1111                 :            : 
    1112         [ #  # ]:          0 :     Reference < XDialog > xDialog (dialog,UNO_QUERY);
    1113                 :            : 
    1114         [ #  # ]:          0 :     if(!xDialog.is())
    1115                 :          0 :         return sal_False;
    1116                 :            : 
    1117 [ #  # ][ #  # ]:          0 :     ret = ( xDialog->execute() != 0 );
    1118         [ #  # ]:          0 :     if ( ret ) {
    1119                 :            : 
    1120                 :          0 :         sal_Int16 tt = 0;
    1121                 :            : 
    1122 [ #  # ][ #  # ]:          0 :         any = _propGet(xPSetAzbukaCB, "State"); any >>= tt; ini.ruscode      = tt;
    1123 [ #  # ][ #  # ]:          0 :         any = _propGet(xPSetRefCB,    "State"); any >>= tt; ini.reformatpars = tt;
    1124 [ #  # ][ #  # ]:          0 :         any = _propGet(xPSetCommCB,   "State"); any >>= tt; ini.showcomm     = tt;
    1125                 :            : 
    1126 [ #  # ][ #  # ]:          0 :         any = _propGet(xPSetCodeLB,   "SelectedItems"); any >>= shr;
                 [ #  # ]
    1127                 :            : 
    1128 [ #  # ][ #  # ]:          0 :         if( shr[0] > 0 ) {
    1129         [ #  # ]:          0 :             ini.xcode = (tcode)(shr[0]-1);
    1130                 :          0 :             ini.forcecode = true;
    1131                 :            :         } else {
    1132                 :          0 :             ini.forcecode = false;
    1133                 :            :         }
    1134                 :            :     }
    1135                 :            : 
    1136         [ #  # ]:          0 :     Reference < XComponent > xComponent (dialog,UNO_QUERY);
    1137                 :            : 
    1138 [ #  # ][ #  # ]:          0 :     xComponent->dispose();
    1139                 :            : 
    1140 [ #  # ][ #  # ]:          0 :     return ret;
    1141                 :            : }
    1142                 :            : 
    1143                 :          0 : void T602ImportFilterDialog::initLocale()
    1144                 :            : {
    1145                 :          0 :     rtl::OString aModName( "t602filter" );
    1146                 :          0 :     aModName += rtl::OString::valueOf( sal_Int32( SUPD ) );
    1147                 :            : 
    1148         [ #  # ]:          0 :     mpResMgr = ResMgr::CreateResMgr( aModName.getStr(), meLocale );
    1149                 :          0 : }
    1150                 :            : 
    1151                 :          0 : ResMgr* T602ImportFilterDialog::getResMgr()
    1152                 :            : {
    1153         [ #  # ]:          0 :     if( !mpResMgr )
    1154                 :          0 :         initLocale();
    1155                 :          0 :     return mpResMgr;
    1156                 :            : }
    1157                 :            : 
    1158                 :          0 : void SAL_CALL T602ImportFilterDialog::setTitle( const ::rtl::OUString& )
    1159                 :            :             throw (::com::sun::star::uno::RuntimeException)
    1160                 :            : {
    1161                 :          0 : }
    1162                 :            : 
    1163                 :          0 : sal_Int16 SAL_CALL T602ImportFilterDialog::execute()
    1164                 :            :             throw (::com::sun::star::uno::RuntimeException)
    1165                 :            : {
    1166         [ #  # ]:          0 :     if (OptionsDlg())
    1167                 :          0 :         return com::sun::star::ui::dialogs::ExecutableDialogResults::OK;
    1168                 :            :     else
    1169                 :          0 :         return com::sun::star::ui::dialogs::ExecutableDialogResults::CANCEL;
    1170                 :            : }
    1171                 :            : 
    1172                 :          0 : rtl::OUString T602ImportFilterDialog::getResStr( sal_Int16 resid )
    1173                 :            : {
    1174 [ #  # ][ #  # ]:          0 :     rtl::OUString sStr = String( ResId( resid, *getResMgr() ) );
                 [ #  # ]
    1175                 :          0 :     return sStr;
    1176                 :            : }
    1177                 :            : 
    1178                 :          0 : uno::Sequence<beans::PropertyValue> SAL_CALL T602ImportFilterDialog::getPropertyValues() throw(uno::RuntimeException)
    1179                 :            : {
    1180                 :          0 :     return uno::Sequence<beans::PropertyValue>();
    1181                 :            : }
    1182                 :            : 
    1183                 :          0 : void SAL_CALL T602ImportFilterDialog::setPropertyValues( const uno::Sequence<beans::PropertyValue>& )
    1184                 :            :                     throw(beans::UnknownPropertyException, beans::PropertyVetoException,
    1185                 :            :                             lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
    1186                 :            : {
    1187                 :          0 : }
    1188                 :            : 
    1189                 :            : 
    1190                 :            : // XServiceInfo
    1191                 :          0 : OUString SAL_CALL T602ImportFilterDialog::getImplementationName(  )
    1192                 :            :     throw (RuntimeException)
    1193                 :            : {
    1194                 :          0 :     return T602ImportFilterDialog_getImplementationName();
    1195                 :            : }
    1196                 :            : 
    1197                 :          0 : sal_Bool SAL_CALL T602ImportFilterDialog::supportsService( const OUString& rServiceName )
    1198                 :            :     throw (RuntimeException)
    1199                 :            : {
    1200                 :          0 :     return T602ImportFilterDialog_supportsService( rServiceName );
    1201                 :            : }
    1202                 :            : 
    1203                 :          0 : Sequence< OUString > SAL_CALL T602ImportFilterDialog::getSupportedServiceNames(  )
    1204                 :            :     throw (RuntimeException)
    1205                 :            : {
    1206                 :          0 :     return T602ImportFilterDialog_getSupportedServiceNames();
    1207                 :            : }
    1208                 :            : 
    1209                 :            : #define IMPLEMENTATION_NAME "com.sun.star.comp.Writer.T602ImportFilterDialog"
    1210                 :            : 
    1211                 :          0 : OUString T602ImportFilterDialog_getImplementationName ()
    1212                 :            :     throw (RuntimeException)
    1213                 :            : {
    1214                 :          0 :     return OUString (  IMPLEMENTATION_NAME  );
    1215                 :            : }
    1216                 :            : 
    1217                 :            : #define SERVICE_NAME "com.sun.star.ui.dialogs.FilterOptionsDialog"
    1218                 :          0 : sal_Bool SAL_CALL T602ImportFilterDialog_supportsService( const OUString& ServiceName )
    1219                 :            :     throw (RuntimeException)
    1220                 :            : {
    1221                 :          0 :     return ServiceName == SERVICE_NAME;
    1222                 :            : }
    1223                 :            : 
    1224                 :          0 : Sequence< OUString > SAL_CALL T602ImportFilterDialog_getSupportedServiceNames(  )
    1225                 :            :     throw (RuntimeException)
    1226                 :            : {
    1227                 :          0 :     Sequence < OUString > aRet(1);
    1228         [ #  # ]:          0 :     OUString* pArray = aRet.getArray();
    1229                 :          0 :     pArray[0] =  OUString (  SERVICE_NAME  );
    1230                 :          0 :     return aRet;
    1231                 :            : }
    1232                 :            : #undef SERVICE_NAME
    1233                 :            : 
    1234                 :          0 : Reference< XInterface > SAL_CALL T602ImportFilterDialog_createInstance( const Reference< XMultiServiceFactory > & rSMgr)
    1235                 :            :     throw( Exception )
    1236                 :            : {
    1237         [ #  # ]:          0 :     return (cppu::OWeakObject*) new T602ImportFilterDialog( rSMgr );
    1238                 :            : }
    1239                 :            : 
    1240 [ +  - ][ +  - ]:         18 : }
    1241                 :            : 
    1242                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10