LCOV - code coverage report
Current view: top level - editeng/source/misc - SvXMLAutoCorrectExport.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 41 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 4 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 <SvXMLAutoCorrectExport.hxx>
      21             : 
      22             : #include <com/sun/star/util/MeasureUnit.hpp>
      23             : #include <xmloff/xmltoken.hxx>
      24             : 
      25             : using namespace ::com::sun::star::uno;
      26             : using namespace ::com::sun::star;
      27             : using namespace ::xmloff::token;
      28             : 
      29           0 : SvXMLAutoCorrectExport::SvXMLAutoCorrectExport(
      30             :     const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext,
      31             :     const SvxAutocorrWordList *  pNewAutocorr_List,
      32             :     const OUString &rFileName,
      33             :     com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler> &rHandler)
      34             : :   SvXMLExport( xContext, "", rFileName, util::MeasureUnit::CM, rHandler ),
      35           0 :     pAutocorr_List( pNewAutocorr_List )
      36             : {
      37           0 :     _GetNamespaceMap().Add( GetXMLToken ( XML_NP_BLOCK_LIST),
      38           0 :                             GetXMLToken ( XML_N_BLOCK_LIST ),
      39           0 :                             XML_NAMESPACE_BLOCKLIST );
      40           0 : }
      41             : 
      42           0 : sal_uInt32 SvXMLAutoCorrectExport::exportDoc(enum XMLTokenEnum /*eClass*/)
      43             : {
      44           0 :     GetDocHandler()->startDocument();
      45             : 
      46           0 :     addChaffWhenEncryptedStorage();
      47             : 
      48             :     AddAttribute ( XML_NAMESPACE_NONE,
      49           0 :                    _GetNamespaceMap().GetAttrNameByKey ( XML_NAMESPACE_BLOCKLIST ),
      50           0 :                    _GetNamespaceMap().GetNameByKey ( XML_NAMESPACE_BLOCKLIST ) );
      51             :     {
      52           0 :         SvXMLElementExport aRoot (*this, XML_NAMESPACE_BLOCKLIST, XML_BLOCK_LIST, true, true);
      53           0 :         SvxAutocorrWordList::Content aContent = pAutocorr_List->getSortedContent();
      54           0 :         for( SvxAutocorrWordList::Content::iterator it = aContent.begin();
      55           0 :              it != aContent.end(); ++it )
      56             :         {
      57           0 :             const SvxAutocorrWord* p = *it;
      58             : 
      59             :             AddAttribute( XML_NAMESPACE_BLOCKLIST,
      60             :                           XML_ABBREVIATED_NAME,
      61           0 :                           OUString(p->GetShort()));
      62             :             AddAttribute( XML_NAMESPACE_BLOCKLIST,
      63             :                           XML_NAME,
      64           0 :                           OUString(p->IsTextOnly() ? p->GetLong() : p->GetShort()));
      65             : 
      66           0 :             SvXMLElementExport aBlock( *this, XML_NAMESPACE_BLOCKLIST, XML_BLOCK, true, true);
      67           0 :         }
      68             :     }
      69           0 :     GetDocHandler()->endDocument();
      70           0 :     return 0;
      71             : }
      72             : 
      73           0 : SvXMLExceptionListExport::SvXMLExceptionListExport(
      74             :     const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext,
      75             :     const SvStringsISortDtor &rNewList,
      76             :     const OUString &rFileName,
      77             :     com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler> &rHandler)
      78             : :   SvXMLExport( xContext, "", rFileName, util::MeasureUnit::CM, rHandler ),
      79           0 :     rList( rNewList )
      80             : {
      81           0 :     _GetNamespaceMap().Add( GetXMLToken ( XML_NP_BLOCK_LIST ),
      82           0 :                             GetXMLToken ( XML_N_BLOCK_LIST ),
      83           0 :                             XML_NAMESPACE_BLOCKLIST );
      84           0 : }
      85             : 
      86           0 : sal_uInt32 SvXMLExceptionListExport::exportDoc(enum XMLTokenEnum /*eClass*/)
      87             : {
      88           0 :     GetDocHandler()->startDocument();
      89             : 
      90           0 :     addChaffWhenEncryptedStorage();
      91             : 
      92             :     AddAttribute ( XML_NAMESPACE_NONE,
      93           0 :                    _GetNamespaceMap().GetAttrNameByKey ( XML_NAMESPACE_BLOCKLIST ),
      94           0 :                    _GetNamespaceMap().GetNameByKey ( XML_NAMESPACE_BLOCKLIST ) );
      95             :     {
      96           0 :         SvXMLElementExport aRoot (*this, XML_NAMESPACE_BLOCKLIST, XML_BLOCK_LIST, true, true);
      97           0 :         sal_uInt16 nBlocks= rList.size();
      98           0 :         for ( sal_uInt16 i = 0; i < nBlocks; i++)
      99             :         {
     100             :             AddAttribute( XML_NAMESPACE_BLOCKLIST,
     101             :                           XML_ABBREVIATED_NAME,
     102           0 :                           rList[i] );
     103           0 :             SvXMLElementExport aBlock( *this, XML_NAMESPACE_BLOCKLIST, XML_BLOCK, true, true);
     104           0 :         }
     105             :     }
     106           0 :     GetDocHandler()->endDocument();
     107           0 :     return 0;
     108             : }
     109             : 
     110             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11