LCOV - code coverage report
Current view: top level - sc/source/filter/excel - expop2.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 49 2.0 %
Date: 2012-08-25 Functions: 2 9 22.2 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 2 106 1.9 %

           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 <unotools/fltrcfg.hxx>
      30                 :            : 
      31                 :            : #include <sfx2/objsh.hxx>
      32                 :            : #include <sfx2/docinf.hxx>
      33                 :            : #include <filter/msfilter/svxmsbas.hxx>
      34                 :            : 
      35                 :            : #include "scerrors.hxx"
      36                 :            : #include "scextopt.hxx"
      37                 :            : 
      38                 :            : #include "root.hxx"
      39                 :            : #include "excdoc.hxx"
      40                 :            : #include "exp_op.hxx"
      41                 :            : 
      42                 :            : #include "xcl97esc.hxx"
      43                 :            : 
      44                 :            : #include "document.hxx"
      45                 :            : #include "rangenam.hxx"
      46                 :            : #include "filtopt.hxx"
      47                 :            : #include "xltools.hxx"
      48                 :            : #include "xelink.hxx"
      49                 :            : 
      50                 :            : #include <com/sun/star/document/XDocumentProperties.hpp>
      51                 :            : #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
      52                 :            : 
      53                 :            : 
      54                 :          0 : ExportBiff5::ExportBiff5( XclExpRootData& rExpData, SvStream& rStrm ):
      55                 :            :     ExportTyp( rStrm, &rExpData.mrDoc, rExpData.meTextEnc ),
      56         [ #  # ]:          0 :     XclExpRoot( rExpData )
      57                 :            : {
      58                 :            :     // nur Teil der Root-Daten gebraucht
      59         [ #  # ]:          0 :     pExcRoot = &GetOldRoot();
      60                 :          0 :     pExcRoot->pER = this;   // ExcRoot -> XclExpRoot
      61                 :          0 :     pExcRoot->eDateiTyp = Biff5;
      62 [ #  # ][ #  # ]:          0 :     pExcDoc = new ExcDocument( *this );
      63                 :          0 : }
      64                 :            : 
      65                 :            : 
      66         [ #  # ]:          0 : ExportBiff5::~ExportBiff5()
      67                 :            : {
      68 [ #  # ][ #  # ]:          0 :     delete pExcDoc;
      69         [ #  # ]:          0 : }
      70                 :            : 
      71                 :            : 
      72                 :          0 : FltError ExportBiff5::Write()
      73                 :            : {
      74         [ #  # ]:          0 :     SfxObjectShell* pDocShell = GetDocShell();
      75                 :            :     OSL_ENSURE( pDocShell, "ExportBiff5::Write - no document shell" );
      76                 :            : 
      77         [ #  # ]:          0 :     SotStorageRef xRootStrg = GetRootStorage();
      78                 :            :     OSL_ENSURE( xRootStrg.Is(), "ExportBiff5::Write - no root storage" );
      79                 :            : 
      80                 :          0 :     bool bWriteBasicCode = false;
      81                 :          0 :     bool bWriteBasicStrg = false;
      82         [ #  # ]:          0 :     if( GetBiff() == EXC_BIFF8 )
      83                 :            :     {
      84         [ #  # ]:          0 :         const SvtFilterOptions& rFilterOpt = SvtFilterOptions::Get();
      85         [ #  # ]:          0 :         bWriteBasicCode = rFilterOpt.IsLoadExcelBasicCode();
      86         [ #  # ]:          0 :         bWriteBasicStrg = rFilterOpt.IsLoadExcelBasicStorage();
      87                 :            :     }
      88                 :            : 
      89 [ #  # ][ #  # ]:          0 :     if( pDocShell && xRootStrg.Is() && bWriteBasicStrg )
         [ #  # ][ #  # ]
      90                 :            :     {
      91         [ #  # ]:          0 :         SvxImportMSVBasic aBasicImport( *pDocShell, *xRootStrg, bWriteBasicCode, bWriteBasicStrg );
      92 [ #  # ][ #  # ]:          0 :         sal_uLong nErr = aBasicImport.SaveOrDelMSVBAStorage( sal_True, EXC_STORAGE_VBA_PROJECT );
                 [ #  # ]
      93         [ #  # ]:          0 :         if( nErr != ERRCODE_NONE )
      94 [ #  # ][ #  # ]:          0 :             pDocShell->SetError( nErr, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
                 [ #  # ]
      95                 :            :     }
      96                 :            : 
      97         [ #  # ]:          0 :     pExcDoc->ReadDoc();         // ScDoc -> ExcDoc
      98         [ #  # ]:          0 :     pExcDoc->Write( aOut );     // wechstreamen
      99                 :            : 
     100 [ #  # ][ #  # ]:          0 :     if( pDocShell && xRootStrg.Is() )
                 [ #  # ]
     101                 :            :     {
     102                 :            :         // #i88642# update doc info (revision etc)
     103         [ #  # ]:          0 :         pDocShell->UpdateDocInfoForSave();
     104                 :            : 
     105                 :            :         using namespace ::com::sun::star;
     106                 :            :         uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
     107 [ #  # ][ #  # ]:          0 :                 pDocShell->GetModel(), uno::UNO_QUERY_THROW);
     108                 :            :         uno::Reference<document::XDocumentProperties> xDocProps
     109 [ #  # ][ #  # ]:          0 :                 = xDPS->getDocumentProperties();
     110 [ #  # ][ #  # ]:          0 :         if ( SvtFilterOptions::Get().IsEnableCalcPreview() )
                 [ #  # ]
     111                 :            :         {
     112                 :            :             ::boost::shared_ptr<GDIMetaFile> pMetaFile =
     113         [ #  # ]:          0 :                 pDocShell->GetPreviewMetaFile (false);
     114                 :            :             uno::Sequence<sal_uInt8> metaFile(
     115         [ #  # ]:          0 :                 sfx2::convertMetaFile(pMetaFile.get()));
     116 [ #  # ][ #  # ]:          0 :             sfx2::SaveOlePropertySet(xDocProps, xRootStrg, &metaFile);
                 [ #  # ]
     117                 :            :         }
     118                 :            :         else
     119         [ #  # ]:          0 :             sfx2::SaveOlePropertySet(xDocProps, xRootStrg );
     120                 :            :     }
     121                 :            : 
     122         [ #  # ]:          0 :     const XclExpAddressConverter& rAddrConv = GetAddressConverter();
     123         [ #  # ]:          0 :     if( rAddrConv.IsRowTruncated() )
     124                 :          0 :         return SCWARN_EXPORT_MAXROW;
     125         [ #  # ]:          0 :     if( rAddrConv.IsColTruncated() )
     126                 :          0 :         return SCWARN_EXPORT_MAXCOL;
     127         [ #  # ]:          0 :     if( rAddrConv.IsTabTruncated() )
     128                 :          0 :         return SCWARN_EXPORT_MAXTAB;
     129                 :            : 
     130         [ #  # ]:          0 :     return eERR_OK;
     131                 :            : }
     132                 :            : 
     133                 :            : 
     134                 :            : 
     135                 :          0 : ExportBiff8::ExportBiff8( XclExpRootData& rExpData, SvStream& rStrm ) :
     136                 :          0 :     ExportBiff5( rExpData, rStrm )
     137                 :            : {
     138                 :          0 :     pExcRoot->eDateiTyp = Biff8;
     139                 :          0 : }
     140                 :            : 
     141                 :            : 
     142                 :          0 : ExportBiff8::~ExportBiff8()
     143                 :            : {
     144 [ +  - ][ +  - ]:         24 : }
                 [ #  # ]
     145                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10