LCOV - code coverage report
Current view: top level - linguistic/source - convdicxml.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 22 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 13 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_LINGUISTIC_SOURCE_CONVDICXML_HXX
      21             : #define INCLUDED_LINGUISTIC_SOURCE_CONVDICXML_HXX
      22             : 
      23             : #include <com/sun/star/linguistic2/XConversionDictionary.hpp>
      24             : #include <com/sun/star/util/XFlushable.hpp>
      25             : #include <com/sun/star/util/MeasureUnit.hpp>
      26             : #include <com/sun/star/lang/XServiceInfo.hpp>
      27             : #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
      28             : #include <comphelper/processfactory.hxx>
      29             : #include <xmloff/xmlexp.hxx>
      30             : #include <xmloff/xmlimp.hxx>
      31             : #include <cppuhelper/implbase3.hxx>
      32             : #include <cppuhelper/interfacecontainer.h>
      33             : #include <rtl/ustring.hxx>
      34             : #include "linguistic/misc.hxx"
      35             : #include "defs.hxx"
      36             : 
      37             : 
      38             : class ConvDic;
      39             : 
      40             : 
      41             : class ConvDicXMLExport : public SvXMLExport
      42             : {
      43             :     ConvDic     &rDic;
      44             :     bool    bSuccess;
      45             : 
      46             : public:
      47           0 :     ConvDicXMLExport( ConvDic &rConvDic,
      48             :         const OUString &rFileName,
      49             :         com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler > &rHandler) :
      50             :         SvXMLExport ( comphelper::getProcessComponentContext(), "com.sun.star.lingu2.ConvDicXMLExport", rFileName,
      51             :                       ::com::sun::star::util::MeasureUnit::CM, rHandler ),
      52             :         rDic        ( rConvDic ),
      53           0 :         bSuccess    ( false )
      54             :     {
      55           0 :     }
      56           0 :     virtual ~ConvDicXMLExport()
      57           0 :     {
      58           0 :     }
      59             : 
      60             :     // SvXMLExport
      61           0 :     void _ExportAutoStyles() SAL_OVERRIDE    {}
      62           0 :     void _ExportMasterStyles() SAL_OVERRIDE  {}
      63             :     void _ExportContent() SAL_OVERRIDE;
      64             :     sal_uInt32 exportDoc( enum ::xmloff::token::XMLTokenEnum eClass ) SAL_OVERRIDE;
      65             : 
      66             :     bool    Export();
      67             : };
      68             : 
      69             : 
      70             : class ConvDicXMLImport : public SvXMLImport
      71             : {
      72             :     ConvDic        *pDic;       // conversion dictionary to be used
      73             :                                 // if != NULL: whole file will be read and
      74             :                                 //   all entries will be added to the dictionary
      75             :                                 // if == NULL: no entries will be added
      76             :                                 //   but the language and conversion type will
      77             :                                 //   still be determined!
      78             : 
      79             :     sal_Int16       nLanguage;          // language of the dictionary
      80             :     sal_Int16       nConversionType;    // conversion type the dictionary is used for
      81             :     bool        bSuccess;
      82             : 
      83             : public:
      84             : 
      85             :     //!!  see comment for pDic member
      86           0 :     explicit ConvDicXMLImport( ConvDic *pConvDic ) :
      87             :         SvXMLImport ( comphelper::getProcessComponentContext(), "com.sun.star.lingu2.ConvDicXMLImport", SvXMLImportFlags::ALL ),
      88           0 :         pDic        ( pConvDic )
      89             :     {
      90           0 :         nLanguage       = LANGUAGE_NONE;
      91           0 :         nConversionType = -1;
      92           0 :         bSuccess        = false;
      93           0 :     }
      94             : 
      95           0 :     virtual ~ConvDicXMLImport() throw ()
      96           0 :     {
      97           0 :     }
      98             : 
      99             :     virtual void SAL_CALL startDocument() throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     100             :     virtual void SAL_CALL endDocument() throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
     101             : 
     102             :     virtual SvXMLImportContext * CreateContext(
     103             :         sal_uInt16 nPrefix, const OUString &rLocalName,
     104             :         const com::sun::star::uno::Reference < com::sun::star::xml::sax::XAttributeList > &rxAttrList ) SAL_OVERRIDE;
     105             : 
     106           0 :     ConvDic *   GetDic()                    { return pDic; }
     107           0 :     sal_Int16       GetLanguage() const         { return nLanguage; }
     108           0 :     sal_Int16   GetConversionType() const   { return nConversionType; }
     109             :     bool    GetSuccess() const          { return bSuccess; }
     110             : 
     111           0 :     void        SetLanguage( sal_Int16 nLang )              { nLanguage = nLang; }
     112           0 :     void        SetConversionType( sal_Int16 nType )    { nConversionType = nType; }
     113             : };
     114             : 
     115             : 
     116             : #endif
     117             : 
     118             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11