LCOV - code coverage report
Current view: top level - libreoffice/sw/source/ui/vba - vbaheaderfooter.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 33 0.0 %
Date: 2012-12-27 Functions: 0 8 0.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, sal_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)
      37             : {
      38           0 :     return mbHeader;
      39             : }
      40             : 
      41           0 : sal_Bool SAL_CALL SwVbaHeaderFooter::getLinkToPrevious() throw (uno::RuntimeException)
      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)
      48             : {
      49             :     // not support in Writer
      50           0 : }
      51             : 
      52           0 : uno::Reference< word::XRange > SAL_CALL SwVbaHeaderFooter::getRange() throw (uno::RuntimeException)
      53             : {
      54           0 :     rtl::OUString sPropsNameText;
      55           0 :     if( mbHeader )
      56             :     {
      57           0 :         sPropsNameText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HeaderText") );
      58             :     }
      59             :     else
      60             :     {
      61           0 :         sPropsNameText = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FooterText") );
      62             :     }
      63           0 :     if( mnIndex == word::WdHeaderFooterIndex::wdHeaderFooterEvenPages )
      64             :     {
      65           0 :         sPropsNameText = sPropsNameText.concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("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)
      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             : rtl::OUString
      87           0 : SwVbaHeaderFooter::getServiceImplName()
      88             : {
      89           0 :     return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SwVbaHeaderFooter"));
      90             : }
      91             : 
      92             : uno::Sequence< rtl::OUString >
      93           0 : SwVbaHeaderFooter::getServiceNames()
      94             : {
      95           0 :     static uno::Sequence< rtl::OUString > aServiceNames;
      96           0 :     if ( aServiceNames.getLength() == 0 )
      97             :     {
      98           0 :         aServiceNames.realloc( 1 );
      99           0 :         aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Pane" ) );
     100             :     }
     101           0 :     return aServiceNames;
     102             : }
     103             : 
     104             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10