LCOV - code coverage report
Current view: top level - sw/source/ui/vba - vbaheaderfooter.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 34 2.9 %
Date: 2014-11-03 Functions: 2 10 20.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             : #include "vbaheaderfooter.hxx"
      20             : #include <vbahelper/vbahelper.hxx>
      21             : #include <tools/diagnose_ex.h>
      22             : #include <ooo/vba/word/WdHeaderFooterIndex.hpp>
      23             : #include <com/sun/star/text/XText.hpp>
      24             : #include <com/sun/star/text/XTextDocument.hpp>
      25             : #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
      26             : #include "vbarange.hxx"
      27             : #include <vbahelper/vbashapes.hxx>
      28             : 
      29             : using namespace ::ooo::vba;
      30             : using namespace ::com::sun::star;
      31             : 
      32           0 : SwVbaHeaderFooter::SwVbaHeaderFooter( const uno::Reference< ooo::vba::XHelperInterface >& rParent, const uno::Reference< uno::XComponentContext >& rContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< beans::XPropertySet >& rProps, bool isHeader, sal_Int32 index ) throw ( uno::RuntimeException ) : SwVbaHeaderFooter_BASE( rParent, rContext ), mxModel( xModel ), mxPageStyleProps( rProps ), mbHeader( isHeader ), mnIndex( index )
      33             : {
      34           0 : }
      35             : 
      36           0 : sal_Bool SAL_CALL SwVbaHeaderFooter::getIsHeader() throw (uno::RuntimeException, std::exception)
      37             : {
      38           0 :     return mbHeader;
      39             : }
      40             : 
      41           0 : sal_Bool SAL_CALL SwVbaHeaderFooter::getLinkToPrevious() throw (uno::RuntimeException, std::exception)
      42             : {
      43             :     // seems always false
      44           0 :     return sal_False;
      45             : }
      46             : 
      47           0 : void SAL_CALL SwVbaHeaderFooter::setLinkToPrevious( sal_Bool /*_linktoprevious*/ ) throw (uno::RuntimeException, std::exception)
      48             : {
      49             :     // not support in Writer
      50           0 : }
      51             : 
      52           0 : uno::Reference< word::XRange > SAL_CALL SwVbaHeaderFooter::getRange() throw (uno::RuntimeException, std::exception)
      53             : {
      54           0 :     OUString sPropsNameText;
      55           0 :     if( mbHeader )
      56             :     {
      57           0 :         sPropsNameText = "HeaderText";
      58             :     }
      59             :     else
      60             :     {
      61           0 :         sPropsNameText = "FooterText";
      62             :     }
      63           0 :     if( mnIndex == word::WdHeaderFooterIndex::wdHeaderFooterEvenPages )
      64             :     {
      65           0 :         sPropsNameText = sPropsNameText.concat( OUString("Left") );
      66             :     }
      67             : 
      68           0 :     uno::Reference< text::XText > xText( mxPageStyleProps->getPropertyValue( sPropsNameText ), uno::UNO_QUERY_THROW );
      69           0 :     uno::Reference< text::XTextDocument > xDocument( mxModel, uno::UNO_QUERY_THROW );
      70           0 :     return uno::Reference< word::XRange >( new SwVbaRange( this, mxContext, xDocument, xText->getStart(), xText->getEnd(), xText ) );
      71             : }
      72             : 
      73             : uno::Any SAL_CALL
      74           0 : SwVbaHeaderFooter::Shapes( const uno::Any& index ) throw (uno::RuntimeException, std::exception)
      75             : {
      76             :     // #FIXME: only get the shapes in the current header/footer
      77           0 :     uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( mxModel, uno::UNO_QUERY_THROW );
      78             :     //uno::Reference< drawing::XShapes > xShapes( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
      79           0 :     uno::Reference< container::XIndexAccess > xIndexAccess( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
      80           0 :     uno::Reference< XCollection > xCol( new ScVbaShapes( this, mxContext, xIndexAccess, mxModel ) );
      81           0 :     if ( index.hasValue() )
      82           0 :         return xCol->Item( index, uno::Any() );
      83           0 :     return uno::makeAny( xCol );
      84             : }
      85             : 
      86             : OUString
      87           0 : SwVbaHeaderFooter::getServiceImplName()
      88             : {
      89           0 :     return OUString("SwVbaHeaderFooter");
      90             : }
      91             : 
      92             : uno::Sequence< OUString >
      93           0 : SwVbaHeaderFooter::getServiceNames()
      94             : {
      95           0 :     static uno::Sequence< OUString > aServiceNames;
      96           0 :     if ( aServiceNames.getLength() == 0 )
      97             :     {
      98           0 :         aServiceNames.realloc( 1 );
      99           0 :         aServiceNames[ 0 ] = "ooo.vba.word.Pane";
     100             :     }
     101           0 :     return aServiceNames;
     102           6 : }
     103             : 
     104             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10