LCOV - code coverage report
Current view: top level - sw/source/ui/vba - vbalistformat.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 45 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 2008 by Sun Microsystems, Inc.
       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 "vbalistformat.hxx"
      29                 :            : #include <vbahelper/vbahelper.hxx>
      30                 :            : #include <tools/diagnose_ex.h>
      31                 :            : #include <ooo/vba/word/WdListApplyTo.hpp>
      32                 :            : #include <ooo/vba/word/WdDefaultListBehavior.hpp>
      33                 :            : #include <com/sun/star/container/XEnumerationAccess.hpp>
      34                 :            : #include <com/sun/star/container/XEnumeration.hpp>
      35                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      36                 :            : #include "vbalisttemplate.hxx"
      37                 :            : 
      38                 :            : using namespace ::ooo::vba;
      39                 :            : using namespace ::com::sun::star;
      40                 :            : 
      41                 :          0 : SwVbaListFormat::SwVbaListFormat( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< text::XTextRange >& xTextRange ) throw ( uno::RuntimeException ) : SwVbaListFormat_BASE( rParent, rContext ), mxTextRange( xTextRange )
      42                 :            : {
      43                 :          0 : }
      44                 :            : 
      45                 :          0 : SwVbaListFormat::~SwVbaListFormat()
      46                 :            : {
      47         [ #  # ]:          0 : }
      48                 :            : 
      49                 :          0 : void SAL_CALL SwVbaListFormat::ApplyListTemplate( const css::uno::Reference< word::XListTemplate >& ListTemplate, const css::uno::Any& ContinuePreviousList, const css::uno::Any& ApplyTo, const css::uno::Any& DefaultListBehavior ) throw (css::uno::RuntimeException)
      50                 :            : {
      51                 :          0 :     sal_Bool bContinuePreviousList = sal_True;
      52         [ #  # ]:          0 :     if( ContinuePreviousList.hasValue() )
      53                 :          0 :         ContinuePreviousList >>= bContinuePreviousList;
      54                 :            : 
      55                 :            :     // "applyto" must be current selection
      56                 :          0 :     sal_Int32 bApplyTo = word::WdListApplyTo::wdListApplyToSelection;
      57         [ #  # ]:          0 :     if( ApplyTo.hasValue() )
      58                 :          0 :         ApplyTo >>= bApplyTo;
      59         [ #  # ]:          0 :     if( bApplyTo != word::WdListApplyTo::wdListApplyToSelection )
      60         [ #  # ]:          0 :         throw uno::RuntimeException();
      61                 :            : 
      62                 :            :     // default behaviour must be wdWord8ListBehavior
      63                 :          0 :     sal_Int32 nDefaultListBehavior = word::WdDefaultListBehavior::wdWord8ListBehavior;
      64         [ #  # ]:          0 :     if( DefaultListBehavior.hasValue() )
      65                 :          0 :         DefaultListBehavior >>= nDefaultListBehavior;
      66         [ #  # ]:          0 :     if( nDefaultListBehavior != word::WdDefaultListBehavior::wdWord8ListBehavior )
      67         [ #  # ]:          0 :         throw uno::RuntimeException();
      68                 :            : 
      69 [ #  # ][ #  # ]:          0 :     SwVbaListTemplate* pListTemplate = dynamic_cast< SwVbaListTemplate* >( ListTemplate.get() );
      70                 :            : 
      71         [ #  # ]:          0 :     uno::Reference< container::XEnumerationAccess > xEnumAccess( mxTextRange, uno::UNO_QUERY_THROW );
      72 [ #  # ][ #  # ]:          0 :     uno::Reference< container::XEnumeration > xEnum = xEnumAccess->createEnumeration();
      73                 :          0 :     sal_Bool isFirstElement = sal_True;
      74 [ #  # ][ #  # ]:          0 :     while( xEnum->hasMoreElements() )
                 [ #  # ]
      75                 :            :     {
      76 [ #  # ][ #  # ]:          0 :         uno::Reference< beans::XPropertySet > xProps( xEnum->nextElement(), uno::UNO_QUERY_THROW );
                 [ #  # ]
      77         [ #  # ]:          0 :         if( isFirstElement )
      78                 :            :         {
      79                 :          0 :             sal_Bool isNumberingRestart = !bContinuePreviousList;
      80 [ #  # ][ #  # ]:          0 :             xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaIsNumberingRestart") ), uno::makeAny( isNumberingRestart ) );
         [ #  # ][ #  # ]
      81         [ #  # ]:          0 :             if( isNumberingRestart )
      82                 :            :             {
      83                 :          0 :                 sal_Int16 nStartValue = 1;
      84 [ #  # ][ #  # ]:          0 :                 xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberingStartValue") ), uno::makeAny( nStartValue ) );
         [ #  # ][ #  # ]
      85                 :            :             }
      86                 :          0 :             isFirstElement = sal_False;
      87                 :            :         }
      88                 :            :         else
      89                 :            :         {
      90 [ #  # ][ #  # ]:          0 :             xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaIsNumberingRestart") ), uno::makeAny( sal_False ) );
         [ #  # ][ #  # ]
      91                 :            :         }
      92         [ #  # ]:          0 :         pListTemplate->applyListTemplate( xProps );
      93                 :          0 :     }
      94                 :          0 : }
      95                 :            : 
      96                 :          0 : void SAL_CALL SwVbaListFormat::ConvertNumbersToText(  ) throw (css::uno::RuntimeException)
      97                 :            : {
      98 [ #  # ][ #  # ]:          0 :     throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
      99                 :            : }
     100                 :            : 
     101                 :            : rtl::OUString
     102                 :          0 : SwVbaListFormat::getServiceImplName()
     103                 :            : {
     104                 :          0 :     return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SwVbaListFormat"));
     105                 :            : }
     106                 :            : 
     107                 :            : uno::Sequence< rtl::OUString >
     108                 :          0 : SwVbaListFormat::getServiceNames()
     109                 :            : {
     110 [ #  # ][ #  # ]:          0 :     static uno::Sequence< rtl::OUString > aServiceNames;
         [ #  # ][ #  # ]
     111         [ #  # ]:          0 :     if ( aServiceNames.getLength() == 0 )
     112                 :            :     {
     113                 :          0 :         aServiceNames.realloc( 1 );
     114         [ #  # ]:          0 :         aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.ListFormat" ) );
     115                 :            :     }
     116                 :          0 :     return aServiceNames;
     117                 :            : }
     118                 :            : 
     119                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10