LCOV - code coverage report
Current view: top level - sw/source/ui/vba - vbaaddins.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 33 0.0 %
Date: 2012-08-25 Functions: 0 7 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 84 0.0 %

           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                 :            : #include "vbaaddins.hxx"
      29                 :            : #include "vbaaddin.hxx"
      30                 :            : #include <cppuhelper/implbase3.hxx>
      31                 :            : #include <unotools/pathoptions.hxx>
      32                 :            : #include <com/sun/star/lang/XMultiComponentFactory.hpp>
      33                 :            : #include <com/sun/star/ucb/SimpleFileAccess.hpp>
      34                 :            : #include <com/sun/star/ucb/XSimpleFileAccess2.hpp>
      35                 :            : 
      36                 :            : using namespace ::ooo::vba;
      37                 :            : using namespace ::com::sun::star;
      38                 :            : 
      39                 :          0 : uno::Reference< container::XIndexAccess > lcl_getAddinCollection( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext )
      40                 :            : {
      41         [ #  # ]:          0 :     XNamedObjectCollectionHelper< word::XAddin >::XNamedVec maAddins;
      42                 :            : 
      43                 :            :     // first get the autoload addins in the directory STARTUP
      44 [ #  # ][ #  # ]:          0 :     uno::Reference< lang::XMultiComponentFactory > xMCF( xContext->getServiceManager(), uno::UNO_QUERY_THROW );
                 [ #  # ]
      45         [ #  # ]:          0 :     uno::Reference<ucb::XSimpleFileAccess2> xSFA(ucb::SimpleFileAccess::create(xContext));
      46         [ #  # ]:          0 :     SvtPathOptions aPathOpt;
      47                 :            :     // FIXME: temporary the STARTUP path is located in $OO/basic3.1/program/addin
      48 [ #  # ][ #  # ]:          0 :     String aAddinPath = aPathOpt.GetAddinPath();
      49                 :            :     OSL_TRACE("lcl_getAddinCollection: %s", rtl::OUStringToOString( aAddinPath, RTL_TEXTENCODING_UTF8 ).getStr() );
      50 [ #  # ][ #  # ]:          0 :     if( xSFA->isFolder( aAddinPath ) )
         [ #  # ][ #  # ]
      51                 :            :     {
      52 [ #  # ][ #  # ]:          0 :         uno::Sequence< rtl::OUString > sEntries = xSFA->getFolderContents( aAddinPath, sal_False );
                 [ #  # ]
      53                 :          0 :         sal_Int32 nEntry = sEntries.getLength();
      54         [ #  # ]:          0 :         for( sal_Int32 index = 0; index < nEntry; ++index )
      55                 :            :         {
      56         [ #  # ]:          0 :             rtl::OUString sUrl = sEntries[ index ];
      57 [ #  # ][ #  # ]:          0 :             if( !xSFA->isFolder( sUrl ) && sUrl.endsWithIgnoreAsciiCaseAsciiL( ".dot", 4 ) )
         [ #  # ][ #  # ]
                 [ #  # ]
      58                 :            :             {
      59 [ #  # ][ #  # ]:          0 :                 maAddins.push_back( uno::Reference< word::XAddin >( new SwVbaAddin( xParent, xContext, sUrl, sal_True ) ) );
         [ #  # ][ #  # ]
      60                 :            :             }
      61         [ #  # ]:          0 :         }
      62                 :            :     }
      63                 :            : 
      64                 :            :     // TODO: second get the customize addins in the org.openoffice.Office.Writer/GlobalTemplateList
      65                 :            : 
      66 [ #  # ][ #  # ]:          0 :     uno::Reference< container::XIndexAccess > xAddinsAccess( new XNamedObjectCollectionHelper< word::XAddin >( maAddins ) );
                 [ #  # ]
      67 [ #  # ][ #  # ]:          0 :     return xAddinsAccess;
      68                 :            : }
      69                 :            : 
      70         [ #  # ]:          0 : SwVbaAddins::SwVbaAddins( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext ) throw (uno::RuntimeException): SwVbaAddins_BASE( xParent, xContext, lcl_getAddinCollection( xParent,xContext ) )
      71                 :            : {
      72                 :          0 : }
      73                 :            : // XEnumerationAccess
      74                 :            : uno::Type
      75                 :          0 : SwVbaAddins::getElementType() throw (uno::RuntimeException)
      76                 :            : {
      77                 :          0 :     return word::XAddin::static_type(0);
      78                 :            : }
      79                 :            : uno::Reference< container::XEnumeration >
      80                 :          0 : SwVbaAddins::createEnumeration() throw (uno::RuntimeException)
      81                 :            : {
      82         [ #  # ]:          0 :     uno::Reference< container::XEnumerationAccess > xEnumerationAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
      83 [ #  # ][ #  # ]:          0 :     return xEnumerationAccess->createEnumeration();
      84                 :            : }
      85                 :            : 
      86                 :            : uno::Any
      87                 :          0 : SwVbaAddins::createCollectionObject( const css::uno::Any& aSource )
      88                 :            : {
      89                 :          0 :     return aSource;
      90                 :            : }
      91                 :            : 
      92                 :            : rtl::OUString
      93                 :          0 : SwVbaAddins::getServiceImplName()
      94                 :            : {
      95                 :          0 :     return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SwVbaAddins"));
      96                 :            : }
      97                 :            : 
      98                 :            : css::uno::Sequence<rtl::OUString>
      99                 :          0 : SwVbaAddins::getServiceNames()
     100                 :            : {
     101 [ #  # ][ #  # ]:          0 :     static uno::Sequence< rtl::OUString > sNames;
         [ #  # ][ #  # ]
     102         [ #  # ]:          0 :     if ( sNames.getLength() == 0 )
     103                 :            :     {
     104                 :          0 :         sNames.realloc( 1 );
     105         [ #  # ]:          0 :         sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Addins") );
     106                 :            :     }
     107                 :          0 :     return sNames;
     108                 :            : }
     109                 :            : 
     110                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10