LCOV - code coverage report
Current view: top level - sw/source/core/sw3io - swacorr.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 6 28 21.4 %
Date: 2014-11-03 Functions: 5 12 41.7 %
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 <swacorr.hxx>
      21             : #include <swblocks.hxx>
      22             : #include "SwXMLTextBlocks.hxx"
      23             : #include <swerror.h>
      24             : #include <docsh.hxx>
      25             : #include <editsh.hxx>
      26             : #include <sot/storage.hxx>
      27             : 
      28             : using namespace ::com::sun::star;
      29             : 
      30           0 : TYPEINIT1( SwAutoCorrect, SvxAutoCorrect );
      31             : 
      32             : 
      33             : /**
      34             :  * Returns the replacement text
      35             :  *
      36             :  * Only for the SWG format, all others can be extracted from the word list
      37             :  *
      38             :  * @param rShort - the stream name (encrypted)
      39             :  */
      40           0 : bool SwAutoCorrect::GetLongText( const uno::Reference < embed::XStorage >& rStg,
      41             :                                  const OUString& rShort, OUString& rLong )
      42             : {
      43           0 :     sal_uLong nRet = 0;
      44           0 :     if (rStg.is())
      45             :     {
      46             :         // mba: relative URLs don't make sense here
      47           0 :         SwXMLTextBlocks aBlk( rStg, OUString() );
      48           0 :         nRet = aBlk.GetText( rShort, rLong );
      49             :     }
      50             :     else {
      51             :        OSL_ENSURE( rStg.is(), "Someone passed SwAutoCorrect::GetLongText a dud storage!");
      52             :     }
      53           0 :     return !IsError( nRet ) && !rLong.isEmpty();
      54             : }
      55             : 
      56             :     //  - Text mit Attributierung (kann nur der SWG - SWG-Format!)
      57             :     //      rShort ist der Stream-Name - gecryptet!
      58             : /**
      59             :  * Text with attributes
      60             :  *
      61             :  * Only for SWG format
      62             :  *
      63             :  * @param rShort - the stream name (encrypted)
      64             :  */
      65           0 : bool SwAutoCorrect::PutText( const uno::Reference < embed::XStorage >&  rStg,
      66             :                                  const OUString& rFileName, const OUString& rShort,
      67             :                                  SfxObjectShell& rObjSh, OUString& rLong )
      68             : {
      69           0 :     if( !rObjSh.IsA( TYPE(SwDocShell) ) )
      70           0 :         return false;
      71             : 
      72           0 :     SwDocShell& rDShell = (SwDocShell&)rObjSh;
      73           0 :     sal_uLong nRet = 0;
      74             : 
      75             :     // mba: relative URLs don't make sense here
      76           0 :     SwXMLTextBlocks aBlk( rStg, rFileName );
      77           0 :     SwDoc* pDoc = aBlk.GetDoc();
      78             : 
      79           0 :     nRet = aBlk.BeginPutDoc( rShort, rShort );
      80           0 :     if( !IsError( nRet ) )
      81             :     {
      82           0 :         ((SwEditShell*)rDShell.GetWrtShell())->_CopySelToDoc( pDoc );
      83           0 :         nRet = aBlk.PutDoc();
      84           0 :         aBlk.AddName ( rShort, rShort, false );
      85           0 :         if( !IsError( nRet ) )
      86           0 :             nRet = aBlk.GetText( rShort, rLong );
      87             :     }
      88           0 :     return !IsError( nRet );
      89             : }
      90             : 
      91          90 : SwAutoCorrect::SwAutoCorrect( const SvxAutoCorrect& rACorr )
      92          90 :     : SvxAutoCorrect( rACorr )
      93             : {
      94          90 :     SwEditShell::SetAutoFmtFlags(&GetSwFlags());
      95          90 : }
      96             : 
      97         176 : SwAutoCorrect::~SwAutoCorrect()
      98             : {
      99         446 : }
     100             : 
     101             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10