LCOV - code coverage report
Current view: top level - editeng/source/misc - SvXMLAutoCorrectImport.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 66 0.0 %
Date: 2014-11-03 Functions: 0 22 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             : #include <SvXMLAutoCorrectImport.hxx>
      21             : #include <SvXMLAutoCorrectTokenHandler.hxx>
      22             : 
      23             : using namespace ::css;
      24             : using namespace ::css::xml::sax;
      25             : 
      26           0 : SvXMLAutoCorrectImport::SvXMLAutoCorrectImport(
      27             :     const uno::Reference< uno::XComponentContext > xContext,
      28             :     SvxAutocorrWordList *pNewAutocorr_List,
      29             :     SvxAutoCorrect &rNewAutoCorrect,
      30             :     const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& rNewStorage)
      31             : :   SvXMLImport( xContext, "" ),
      32             :     pAutocorr_List (pNewAutocorr_List),
      33             :     rAutoCorrect ( rNewAutoCorrect ),
      34           0 :     xStorage ( rNewStorage )
      35             : {
      36           0 : }
      37             : 
      38           0 : SvXMLAutoCorrectImport::~SvXMLAutoCorrectImport ( void ) throw ()
      39             : {
      40           0 : }
      41             : 
      42           0 : SvXMLImportContext *SvXMLAutoCorrectImport::CreateFastContext( sal_Int32 Element,
      43             :         const uno::Reference< xml::sax::XFastAttributeList > & xAttrList )
      44             : {
      45           0 :     if( Element == SvXMLAutoCorrectToken::BLOCKLIST )
      46           0 :         return new SvXMLWordListContext( *this, Element, xAttrList );
      47             :     else
      48           0 :         return SvXMLImport::CreateFastContext( Element, xAttrList );
      49             : }
      50             : 
      51           0 : SvXMLWordListContext::SvXMLWordListContext(
      52             :    SvXMLAutoCorrectImport& rImport,
      53             :    sal_Int32 /*Element*/,
      54             :    const com::sun::star::uno::Reference<
      55             :    com::sun::star::xml::sax::XFastAttributeList > & /*xAttrList*/ ) :
      56             :    SvXMLImportContext ( rImport ),
      57           0 :    rLocalRef(rImport)
      58             : {
      59           0 : }
      60             : 
      61           0 : com::sun::star::uno::Reference<XFastContextHandler> SAL_CALL SvXMLWordListContext::createFastChildContext(
      62             :     sal_Int32 Element, const uno::Reference< xml::sax::XFastAttributeList > & xAttrList )
      63             : throw (css::uno::RuntimeException, css::xml::sax::SAXException, std::exception)
      64             : {
      65           0 :     if ( Element == SvXMLAutoCorrectToken::BLOCK )
      66           0 :         return new SvXMLWordContext (rLocalRef, Element, xAttrList);
      67             :     else
      68           0 :         return new SvXMLImportContext( rLocalRef );
      69             : }
      70             : 
      71           0 : SvXMLWordListContext::~SvXMLWordListContext ( void )
      72             : {
      73           0 : }
      74             : 
      75           0 : SvXMLWordContext::SvXMLWordContext(
      76             :    SvXMLAutoCorrectImport& rImport,
      77             :    sal_Int32 /*Element*/,
      78             :    const com::sun::star::uno::Reference<
      79             :    com::sun::star::xml::sax::XFastAttributeList > & xAttrList ) :
      80             :    SvXMLImportContext ( rImport ),
      81           0 :    rLocalRef(rImport)
      82             : {
      83           0 :     OUString sWrong, sRight;
      84           0 :     if ( xAttrList.is() && xAttrList->hasAttribute( SvXMLAutoCorrectToken::ABBREVIATED_NAME ) )
      85           0 :         sWrong = xAttrList->getValue( SvXMLAutoCorrectToken::ABBREVIATED_NAME );
      86             : 
      87           0 :     if ( xAttrList.is() && xAttrList->hasAttribute( SvXMLAutoCorrectToken::NAME ) )
      88           0 :         sRight = xAttrList->getValue( SvXMLAutoCorrectToken::NAME );
      89             : 
      90           0 :    if ( sWrong.isEmpty() || sRight.isEmpty())
      91           0 :         return;
      92             : 
      93           0 :     bool bOnlyTxt = sRight != sWrong;
      94           0 :     if( !bOnlyTxt )
      95             :     {
      96           0 :         const OUString sLongSave( sRight );
      97           0 :         if( !rLocalRef.rAutoCorrect.GetLongText( rLocalRef.xStorage, sWrong, sRight ) &&
      98           0 :             !sLongSave.isEmpty() )
      99             :         {
     100           0 :             sRight = sLongSave;
     101           0 :             bOnlyTxt = true;
     102           0 :         }
     103             :     }
     104           0 :     rLocalRef.pAutocorr_List->LoadEntry( sWrong, sRight, bOnlyTxt );
     105             : }
     106             : 
     107           0 : SvXMLWordContext::~SvXMLWordContext ( void )
     108             : {
     109           0 : }
     110             : 
     111           0 : SvXMLExceptionListImport::SvXMLExceptionListImport(
     112             :     const uno::Reference< uno::XComponentContext > xContext,
     113             :     SvStringsISortDtor & rNewList )
     114             : :   SvXMLImport( xContext, "" ),
     115           0 :     rList (rNewList)
     116             : {
     117           0 : }
     118             : 
     119           0 : SvXMLExceptionListImport::~SvXMLExceptionListImport ( void ) throw ()
     120             : {
     121           0 : }
     122             : 
     123           0 : SvXMLImportContext *SvXMLExceptionListImport::CreateFastContext(sal_Int32 Element,
     124             :     const uno::Reference< xml::sax::XFastAttributeList > & xAttrList )
     125             : {
     126           0 :     if( Element == SvXMLAutoCorrectToken::BLOCKLIST )
     127           0 :         return new SvXMLExceptionListContext( *this, Element, xAttrList );
     128             :     else
     129           0 :         return SvXMLImport::CreateFastContext( Element, xAttrList );
     130             : }
     131             : 
     132           0 : SvXMLExceptionListContext::SvXMLExceptionListContext(
     133             :    SvXMLExceptionListImport& rImport,
     134             :    sal_Int32 /*Element*/,
     135             :    const com::sun::star::uno::Reference<
     136             :    com::sun::star::xml::sax::XFastAttributeList > & /* xAttrList */ ) :
     137             :    SvXMLImportContext ( rImport ),
     138           0 :    rLocalRef(rImport)
     139             : {
     140           0 : }
     141             : 
     142           0 : com::sun::star::uno::Reference<xml::sax::XFastContextHandler> SAL_CALL SvXMLExceptionListContext::createFastChildContext(
     143             :     sal_Int32 Element, const uno::Reference< xml::sax::XFastAttributeList > & xAttrList )
     144             :     throw (css::uno::RuntimeException, css::xml::sax::SAXException, std::exception)
     145             : {
     146           0 :     if ( Element == SvXMLAutoCorrectToken::BLOCK )
     147           0 :         return new SvXMLExceptionContext (rLocalRef, Element, xAttrList);
     148             :     else
     149           0 :         return new SvXMLImportContext( rLocalRef );
     150             : }
     151             : 
     152           0 : SvXMLExceptionListContext::~SvXMLExceptionListContext ( void )
     153             : {
     154           0 : }
     155             : 
     156           0 : SvXMLExceptionContext::SvXMLExceptionContext(
     157             :    SvXMLExceptionListImport& rImport,
     158             :    sal_Int32 /*Element*/,
     159             :    const com::sun::star::uno::Reference<
     160             :    com::sun::star::xml::sax::XFastAttributeList > & xAttrList ) :
     161             :    SvXMLImportContext ( rImport ),
     162           0 :    rLocalRef(rImport)
     163             : {
     164           0 :     OUString sWord;
     165           0 :     if( xAttrList.is() && xAttrList->hasAttribute( SvXMLAutoCorrectToken::ABBREVIATED_NAME ) )
     166           0 :         sWord = xAttrList->getValue( SvXMLAutoCorrectToken::ABBREVIATED_NAME );
     167             : 
     168           0 :     if (sWord.isEmpty())
     169           0 :         return;
     170             : 
     171           0 :     rLocalRef.rList.insert( sWord );
     172             : }
     173             : 
     174           0 : SvXMLExceptionContext::~SvXMLExceptionContext ( void )
     175             : {
     176           0 : }
     177             : 
     178             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10