LCOV - code coverage report
Current view: top level - sw/source/ui/vba - vbadocument.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 3 246 1.2 %
Date: 2012-08-25 Functions: 2 51 3.9 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 2 654 0.3 %

           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 "vbadocument.hxx"
      29                 :            : #include "vbarange.hxx"
      30                 :            : #include "vbarangehelper.hxx"
      31                 :            : #include "vbadocumentproperties.hxx"
      32                 :            : #include "vbabookmarks.hxx"
      33                 :            : #include "vbavariables.hxx"
      34                 :            : #include <com/sun/star/text/XBookmarksSupplier.hpp>
      35                 :            : #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
      36                 :            : #include <com/sun/star/document/XDocumentInfoSupplier.hpp>
      37                 :            : #include <com/sun/star/document/XDocumentProperties.hpp>
      38                 :            : #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
      39                 :            : #include <com/sun/star/drawing/XControlShape.hpp>
      40                 :            : #include <com/sun/star/form/XFormsSupplier.hpp>
      41                 :            : #include <com/sun/star/document/XRedlinesSupplier.hpp>
      42                 :            : #include <ooo/vba/XControlProvider.hpp>
      43                 :            : #include <ooo/vba/word/WdProtectionType.hpp>
      44                 :            : 
      45                 :            : #include <vbahelper/helperdecl.hxx>
      46                 :            : #include <wordvbahelper.hxx>
      47                 :            : #include <docsh.hxx>
      48                 :            : #include "vbatemplate.hxx"
      49                 :            : #include "vbaparagraph.hxx"
      50                 :            : #include "vbastyles.hxx"
      51                 :            : #include "vbatables.hxx"
      52                 :            : #include "vbafield.hxx"
      53                 :            : #include "vbapagesetup.hxx"
      54                 :            : #include "vbasections.hxx"
      55                 :            : #include "vbatablesofcontents.hxx"
      56                 :            : #include <vbahelper/vbashapes.hxx>
      57                 :            : #include <vbahelper/vbahelper.hxx>
      58                 :            : #include "vbarevisions.hxx"
      59                 :            : #include "vbaframes.hxx"
      60                 :            : #include "vbaformfields.hxx"
      61                 :            : #include <osl/file.hxx>
      62                 :            : #include <tools/urlobj.hxx>
      63                 :            : 
      64                 :            : using namespace ::ooo::vba;
      65                 :            : using namespace ::com::sun::star;
      66                 :            : 
      67                 :          0 : SwVbaDocument::SwVbaDocument( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, uno::Reference< frame::XModel > xModel ): SwVbaDocument_BASE( xParent, xContext, xModel )
      68                 :            : {
      69         [ #  # ]:          0 :     Initialize();
      70                 :          0 : }
      71                 :          0 : SwVbaDocument::SwVbaDocument( uno::Sequence< uno::Any > const& aArgs, uno::Reference< uno::XComponentContext >const& xContext ) : SwVbaDocument_BASE( aArgs, xContext )
      72                 :            : {
      73         [ #  # ]:          0 :     Initialize();
      74                 :          0 : }
      75                 :            : 
      76                 :          0 : SwVbaDocument::~SwVbaDocument()
      77                 :            : {
      78         [ #  # ]:          0 : }
      79                 :            : 
      80                 :          0 : void SwVbaDocument::Initialize()
      81                 :            : {
      82         [ #  # ]:          0 :     mxTextDocument.set( getModel(), uno::UNO_QUERY_THROW );
      83                 :          0 : }
      84                 :            : 
      85                 :            : uno::Reference< word::XRange > SAL_CALL
      86                 :          0 : SwVbaDocument::getContent() throw ( uno::RuntimeException )
      87                 :            : {
      88 [ #  # ][ #  # ]:          0 :     uno::Reference< text::XTextRange > xStart = mxTextDocument->getText()->getStart();
         [ #  # ][ #  # ]
      89                 :          0 :     uno::Reference< text::XTextRange > xEnd;
      90 [ #  # ][ #  # ]:          0 :     return uno::Reference< word::XRange >( new SwVbaRange( this, mxContext, mxTextDocument, xStart, xEnd, sal_True ) );
         [ #  # ][ #  # ]
      91                 :            : }
      92                 :            : 
      93                 :            : uno::Reference< word::XRange > SAL_CALL
      94                 :          0 : SwVbaDocument::Range( const uno::Any& rStart, const uno::Any& rEnd ) throw ( uno::RuntimeException )
      95                 :            : {
      96 [ #  # ][ #  # ]:          0 :     if( !rStart.hasValue() && !rEnd.hasValue() )
                 [ #  # ]
      97         [ #  # ]:          0 :         return getContent();
      98                 :            : 
      99                 :          0 :     sal_Int32 nStart = 0;
     100                 :          0 :     sal_Int32 nEnd = 0;
     101                 :          0 :     rStart >>= nStart;
     102                 :          0 :     rEnd >>= nEnd;
     103                 :          0 :     nStart--;
     104                 :          0 :     nEnd--;
     105                 :            : 
     106                 :          0 :     uno::Reference< text::XTextRange > xStart;
     107                 :          0 :     uno::Reference< text::XTextRange > xEnd;
     108 [ #  # ][ #  # ]:          0 :     if( nStart != -1 || nEnd != -1 )
     109                 :            :     {
     110         [ #  # ]:          0 :         if( nStart == -1 )
     111 [ #  # ][ #  # ]:          0 :             xStart = mxTextDocument->getText()->getStart();
         [ #  # ][ #  # ]
                 [ #  # ]
     112                 :            :         else
     113 [ #  # ][ #  # ]:          0 :             xStart = SwVbaRangeHelper::getRangeByPosition( mxTextDocument->getText(), nStart );
         [ #  # ][ #  # ]
     114                 :            : 
     115         [ #  # ]:          0 :         if( nEnd == -1 )
     116 [ #  # ][ #  # ]:          0 :             xEnd = mxTextDocument->getText()->getEnd();
         [ #  # ][ #  # ]
                 [ #  # ]
     117                 :            :         else
     118 [ #  # ][ #  # ]:          0 :             xEnd = SwVbaRangeHelper::getRangeByPosition( mxTextDocument->getText(), nEnd );
         [ #  # ][ #  # ]
     119                 :            :     }
     120                 :            : 
     121 [ #  # ][ #  # ]:          0 :     if( !xStart.is() && !xEnd.is() )
                 [ #  # ]
     122                 :            :     {
     123                 :            :         try
     124                 :            :         {
     125                 :            :             // FIXME
     126 [ #  # ][ #  # ]:          0 :             xStart = mxTextDocument->getText()->getStart();
         [ #  # ][ #  # ]
                 [ #  # ]
     127 [ #  # ][ #  # ]:          0 :             xEnd = mxTextDocument->getText()->getEnd();
         [ #  # ][ #  # ]
                 [ #  # ]
     128                 :            :         }
     129   [ #  #  #  # ]:          0 :         catch(const uno::Exception&)
     130                 :            :         {
     131         [ #  # ]:          0 :             DebugHelper::exception(SbERR_METHOD_FAILED, rtl::OUString());
     132                 :            :         }
     133                 :            :     }
     134 [ #  # ][ #  # ]:          0 :     return uno::Reference< word::XRange >( new SwVbaRange( this, mxContext, mxTextDocument, xStart, xEnd ) );
         [ #  # ][ #  # ]
     135                 :            : }
     136                 :            : 
     137                 :            : uno::Any SAL_CALL
     138                 :          0 : SwVbaDocument::BuiltInDocumentProperties( const uno::Any& index ) throw (uno::RuntimeException)
     139                 :            : {
     140 [ #  # ][ #  # ]:          0 :     uno::Reference< XCollection > xCol( new SwVbaBuiltinDocumentProperties( mxParent, mxContext, getModel() ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     141         [ #  # ]:          0 :     if ( index.hasValue() )
     142 [ #  # ][ #  # ]:          0 :         return xCol->Item( index, uno::Any() );
     143         [ #  # ]:          0 :     return uno::makeAny( xCol );
     144                 :            : }
     145                 :            : 
     146                 :            : uno::Any SAL_CALL
     147                 :          0 : SwVbaDocument::CustomDocumentProperties( const uno::Any& index ) throw (uno::RuntimeException)
     148                 :            : {
     149 [ #  # ][ #  # ]:          0 :     uno::Reference< XCollection > xCol( new SwVbaCustomDocumentProperties( mxParent, mxContext, getModel() ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     150         [ #  # ]:          0 :     if ( index.hasValue() )
     151 [ #  # ][ #  # ]:          0 :         return xCol->Item( index, uno::Any() );
     152         [ #  # ]:          0 :     return uno::makeAny( xCol );
     153                 :            : }
     154                 :            : 
     155                 :            : uno::Any SAL_CALL
     156                 :          0 : SwVbaDocument::Bookmarks( const uno::Any& rIndex ) throw ( uno::RuntimeException )
     157                 :            : {
     158 [ #  # ][ #  # ]:          0 :     uno::Reference< text::XBookmarksSupplier > xBookmarksSupplier( getModel(),uno::UNO_QUERY_THROW );
     159 [ #  # ][ #  # ]:          0 :     uno::Reference<container::XIndexAccess > xBookmarks( xBookmarksSupplier->getBookmarks(), uno::UNO_QUERY_THROW );
                 [ #  # ]
     160 [ #  # ][ #  # ]:          0 :     uno::Reference< XCollection > xBookmarksVba( new SwVbaBookmarks( this, mxContext, xBookmarks, getModel() ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     161         [ #  # ]:          0 :     if (  rIndex.getValueTypeClass() == uno::TypeClass_VOID )
     162         [ #  # ]:          0 :         return uno::makeAny( xBookmarksVba );
     163                 :            : 
     164 [ #  # ][ #  # ]:          0 :     return uno::Any( xBookmarksVba->Item( rIndex, uno::Any() ) );
     165                 :            : }
     166                 :            : 
     167                 :            : uno::Any SAL_CALL
     168                 :          0 : SwVbaDocument::Variables( const uno::Any& rIndex ) throw ( uno::RuntimeException )
     169                 :            : {
     170 [ #  # ][ #  # ]:          0 :     uno::Reference< document::XDocumentPropertiesSupplier > xDocumentPropertiesSupplier( getModel(),uno::UNO_QUERY_THROW );
     171 [ #  # ][ #  # ]:          0 :     uno::Reference< document::XDocumentProperties > xDocumentProperties =  xDocumentPropertiesSupplier->getDocumentProperties();
     172 [ #  # ][ #  # ]:          0 :     uno::Reference< beans::XPropertyAccess > xUserDefined( xDocumentProperties->getUserDefinedProperties(), uno::UNO_QUERY_THROW );
                 [ #  # ]
     173                 :            : 
     174 [ #  # ][ #  # ]:          0 :     uno::Reference< XCollection > xVariables( new SwVbaVariables( this, mxContext, xUserDefined ) );
         [ #  # ][ #  # ]
     175         [ #  # ]:          0 :     if (  rIndex.getValueTypeClass() == uno::TypeClass_VOID )
     176         [ #  # ]:          0 :         return uno::makeAny( xVariables );
     177                 :            : 
     178 [ #  # ][ #  # ]:          0 :     return uno::Any( xVariables->Item( rIndex, uno::Any() ) );
     179                 :            : }
     180                 :            : 
     181                 :            : uno::Any SAL_CALL
     182                 :          0 : SwVbaDocument::Paragraphs( const uno::Any& index ) throw (uno::RuntimeException)
     183                 :            : {
     184 [ #  # ][ #  # ]:          0 :     uno::Reference< XCollection > xCol( new SwVbaParagraphs( mxParent, mxContext, mxTextDocument ) );
         [ #  # ][ #  # ]
     185         [ #  # ]:          0 :     if ( index.hasValue() )
     186 [ #  # ][ #  # ]:          0 :         return xCol->Item( index, uno::Any() );
     187         [ #  # ]:          0 :     return uno::makeAny( xCol );
     188                 :            : }
     189                 :            : 
     190                 :            : uno::Any SAL_CALL
     191                 :          0 : SwVbaDocument::Styles( const uno::Any& index ) throw (uno::RuntimeException)
     192                 :            : {
     193 [ #  # ][ #  # ]:          0 :     uno::Reference< XCollection > xCol( new SwVbaStyles( mxParent, mxContext, getModel() ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     194         [ #  # ]:          0 :     if ( index.hasValue() )
     195 [ #  # ][ #  # ]:          0 :         return xCol->Item( index, uno::Any() );
     196         [ #  # ]:          0 :     return uno::makeAny( xCol );
     197                 :            : }
     198                 :            : 
     199                 :            : uno::Any SAL_CALL
     200                 :          0 : SwVbaDocument::Fields( const uno::Any& index ) throw (uno::RuntimeException)
     201                 :            : {
     202 [ #  # ][ #  # ]:          0 :     uno::Reference< XCollection > xCol( new SwVbaFields( mxParent, mxContext, getModel() ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     203         [ #  # ]:          0 :     if ( index.hasValue() )
     204 [ #  # ][ #  # ]:          0 :         return xCol->Item( index, uno::Any() );
     205         [ #  # ]:          0 :     return uno::makeAny( xCol );
     206                 :            : }
     207                 :            : 
     208                 :            : uno::Any SAL_CALL
     209                 :          0 : SwVbaDocument::Shapes( const uno::Any& index ) throw (uno::RuntimeException)
     210                 :            : {
     211 [ #  # ][ #  # ]:          0 :     uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( getModel(), uno::UNO_QUERY_THROW );
     212 [ #  # ][ #  # ]:          0 :     uno::Reference< container::XIndexAccess > xIndexAccess( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
                 [ #  # ]
     213         [ #  # ]:          0 :     uno::Reference< frame::XModel > xModel( mxTextDocument, uno::UNO_QUERY_THROW );
     214 [ #  # ][ #  # ]:          0 :     uno::Reference< XCollection > xCol( new ScVbaShapes( this, mxContext, xIndexAccess, xModel ) );
         [ #  # ][ #  # ]
     215                 :            : 
     216         [ #  # ]:          0 :     if ( index.hasValue() )
     217 [ #  # ][ #  # ]:          0 :         return xCol->Item( index, uno::Any() );
     218         [ #  # ]:          0 :     return uno::makeAny( xCol );
     219                 :            : }
     220                 :            : 
     221                 :            : uno::Any SAL_CALL
     222                 :          0 : SwVbaDocument::Sections( const uno::Any& index ) throw (uno::RuntimeException)
     223                 :            : {
     224 [ #  # ][ #  # ]:          0 :     uno::Reference< XCollection > xCol( new SwVbaSections( mxParent, mxContext, getModel() ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     225         [ #  # ]:          0 :     if ( index.hasValue() )
     226 [ #  # ][ #  # ]:          0 :         return xCol->Item( index, uno::Any() );
     227         [ #  # ]:          0 :     return uno::makeAny( xCol );
     228                 :            : }
     229                 :            : 
     230                 :            : uno::Any SAL_CALL
     231                 :          0 : SwVbaDocument::TablesOfContents( const uno::Any& index ) throw (uno::RuntimeException)
     232                 :            : {
     233 [ #  # ][ #  # ]:          0 :     uno::Reference< XCollection > xCol( new SwVbaTablesOfContents( this, mxContext, mxTextDocument ) );
         [ #  # ][ #  # ]
     234         [ #  # ]:          0 :     if ( index.hasValue() )
     235 [ #  # ][ #  # ]:          0 :         return xCol->Item( index, uno::Any() );
     236         [ #  # ]:          0 :     return uno::makeAny( xCol );
     237                 :            : }
     238                 :            : 
     239                 :            : uno::Any SAL_CALL
     240                 :          0 : SwVbaDocument::FormFields( const uno::Any& /*index*/ ) throw (uno::RuntimeException)
     241                 :            : {
     242                 :          0 :     uno::Reference< XCollection > xCol;
     243         [ #  # ]:          0 :     return uno::makeAny( xCol );
     244                 :            : }
     245                 :            : 
     246                 :            : uno::Any SAL_CALL
     247                 :          0 : SwVbaDocument::PageSetup( ) throw (uno::RuntimeException)
     248                 :            : {
     249 [ #  # ][ #  # ]:          0 :     uno::Reference< beans::XPropertySet > xPageProps( word::getCurrentPageStyle( mxModel ), uno::UNO_QUERY_THROW );
     250 [ #  # ][ #  # ]:          0 :     return uno::makeAny( uno::Reference< word::XPageSetup >( new SwVbaPageSetup( this, mxContext, mxModel, xPageProps ) ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     251                 :            : }
     252                 :            : 
     253                 :            : rtl::OUString
     254                 :          0 : SwVbaDocument::getServiceImplName()
     255                 :            : {
     256                 :          0 :     return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SwVbaDocument"));
     257                 :            : }
     258                 :            : 
     259                 :            : uno::Any SAL_CALL
     260                 :          0 : SwVbaDocument::getAttachedTemplate() throw (uno::RuntimeException)
     261                 :            : {
     262                 :          0 :     uno::Reference< word::XTemplate > xTemplate;
     263 [ #  # ][ #  # ]:          0 :     uno::Reference< document::XDocumentInfoSupplier > xDocInfoSupp( getModel(), uno::UNO_QUERY_THROW );
     264 [ #  # ][ #  # ]:          0 :     uno::Reference< document::XDocumentPropertiesSupplier > xDocPropSupp( xDocInfoSupp->getDocumentInfo(), uno::UNO_QUERY_THROW );
                 [ #  # ]
     265 [ #  # ][ #  # ]:          0 :     uno::Reference< document::XDocumentProperties > xDocProps( xDocPropSupp->getDocumentProperties(), uno::UNO_QUERY_THROW );
                 [ #  # ]
     266 [ #  # ][ #  # ]:          0 :     rtl::OUString sTemplateUrl = xDocProps->getTemplateURL();
     267                 :            : 
     268 [ #  # ][ #  # ]:          0 :     xTemplate = new SwVbaTemplate( this, mxContext, getModel(), sTemplateUrl );
         [ #  # ][ #  # ]
                 [ #  # ]
     269         [ #  # ]:          0 :     return uno::makeAny( xTemplate );
     270                 :            : }
     271                 :            : 
     272                 :            : void SAL_CALL
     273                 :          0 : SwVbaDocument::setAttachedTemplate( const css::uno::Any& _attachedtemplate ) throw (uno::RuntimeException)
     274                 :            : {
     275                 :          0 :     rtl::OUString sTemplate;
     276         [ #  # ]:          0 :     if( !( _attachedtemplate >>= sTemplate ) )
     277                 :            :     {
     278         [ #  # ]:          0 :         throw uno::RuntimeException();
     279                 :            :     }
     280                 :          0 :     rtl::OUString aURL;
     281         [ #  # ]:          0 :     INetURLObject aObj;
     282         [ #  # ]:          0 :     aObj.SetURL( sTemplate );
     283                 :          0 :     bool bIsURL = aObj.GetProtocol() != INET_PROT_NOT_VALID;
     284         [ #  # ]:          0 :     if ( bIsURL )
     285                 :          0 :         aURL = sTemplate;
     286                 :            :     else
     287         [ #  # ]:          0 :         osl::FileBase::getFileURLFromSystemPath( sTemplate, aURL );
     288                 :            : 
     289                 :          0 :     uno::Reference< word::XTemplate > xTemplate;
     290 [ #  # ][ #  # ]:          0 :     uno::Reference< document::XDocumentInfoSupplier > xDocInfoSupp( getModel(), uno::UNO_QUERY_THROW );
     291 [ #  # ][ #  # ]:          0 :     uno::Reference< document::XDocumentPropertiesSupplier > xDocPropSupp( xDocInfoSupp->getDocumentInfo(), uno::UNO_QUERY_THROW );
                 [ #  # ]
     292 [ #  # ][ #  # ]:          0 :     uno::Reference< document::XDocumentProperties > xDocProps( xDocPropSupp->getDocumentProperties(), uno::UNO_QUERY_THROW );
                 [ #  # ]
     293 [ #  # ][ #  # ]:          0 :     xDocProps->setTemplateURL( aURL );
                 [ #  # ]
     294                 :          0 : }
     295                 :            : 
     296                 :            : uno::Any SAL_CALL
     297                 :          0 : SwVbaDocument::Tables( const css::uno::Any& aIndex ) throw (uno::RuntimeException)
     298                 :            : {
     299         [ #  # ]:          0 :     uno::Reference< frame::XModel > xModel( mxTextDocument, uno::UNO_QUERY_THROW );
     300 [ #  # ][ #  # ]:          0 :     uno::Reference< XCollection > xColl( new SwVbaTables( mxParent, mxContext, xModel ) );
         [ #  # ][ #  # ]
     301                 :            : 
     302         [ #  # ]:          0 :     if ( aIndex.hasValue() )
     303 [ #  # ][ #  # ]:          0 :         return xColl->Item( aIndex, uno::Any() );
     304         [ #  # ]:          0 :     return uno::makeAny( xColl );
     305                 :            : }
     306                 :            : 
     307                 :          0 : void SAL_CALL SwVbaDocument::Activate() throw (uno::RuntimeException)
     308                 :            : {
     309                 :          0 :     VbaDocumentBase::Activate();
     310                 :          0 : }
     311                 :            : 
     312                 :          0 : ::sal_Int32 SAL_CALL SwVbaDocument::getProtectionType() throw (css::uno::RuntimeException)
     313                 :            : {
     314                 :            :     //TODO
     315                 :          0 :     return word::WdProtectionType::wdNoProtection;
     316                 :            : }
     317                 :            : 
     318                 :          0 : void SAL_CALL SwVbaDocument::setProtectionType( ::sal_Int32 /*_protectiontype*/ ) throw (css::uno::RuntimeException)
     319                 :            : {
     320                 :            :     //TODO
     321                 :          0 : }
     322                 :            : 
     323                 :          0 : ::sal_Bool SAL_CALL SwVbaDocument::getUpdateStylesOnOpen() throw (css::uno::RuntimeException)
     324                 :            : {
     325                 :            :     //TODO
     326                 :          0 :     return sal_False;
     327                 :            : }
     328                 :            : 
     329                 :          0 : void SAL_CALL SwVbaDocument::setUpdateStylesOnOpen( ::sal_Bool /*_updatestylesonopen*/ ) throw (uno::RuntimeException)
     330                 :            : {
     331                 :            :     //TODO
     332                 :          0 : }
     333                 :            : 
     334                 :          0 : ::sal_Bool SAL_CALL SwVbaDocument::getAutoHyphenation() throw (uno::RuntimeException)
     335                 :            : {
     336                 :            :     // check this property only in default paragraph style
     337                 :          0 :     sal_Bool IsAutoHyphenation = sal_False;
     338 [ #  # ][ #  # ]:          0 :     uno::Reference< beans::XPropertySet > xParaProps( word::getDefaultParagraphStyle( getModel() ), uno::UNO_QUERY_THROW );
                 [ #  # ]
     339 [ #  # ][ #  # ]:          0 :     xParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaIsHyphenation")) ) >>= IsAutoHyphenation;
                 [ #  # ]
     340                 :          0 :     return IsAutoHyphenation;
     341                 :            : }
     342                 :            : 
     343                 :          0 : void SAL_CALL SwVbaDocument::setAutoHyphenation( ::sal_Bool _autohyphenation ) throw (uno::RuntimeException)
     344                 :            : {
     345                 :            :     //TODO
     346 [ #  # ][ #  # ]:          0 :     uno::Reference< beans::XPropertySet > xParaProps( word::getDefaultParagraphStyle( getModel() ), uno::UNO_QUERY_THROW );
                 [ #  # ]
     347 [ #  # ][ #  # ]:          0 :     xParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaIsHyphenation")), uno::makeAny( _autohyphenation ) );
         [ #  # ][ #  # ]
     348                 :          0 : }
     349                 :            : 
     350                 :          0 : ::sal_Int32 SAL_CALL SwVbaDocument::getHyphenationZone() throw (uno::RuntimeException)
     351                 :            : {
     352                 :            :     //TODO
     353                 :          0 :     return 0;
     354                 :            : }
     355                 :            : 
     356                 :          0 : void SAL_CALL SwVbaDocument::setHyphenationZone( ::sal_Int32 /*_hyphenationzone*/ ) throw (uno::RuntimeException)
     357                 :            : {
     358                 :            :     //TODO
     359                 :          0 : }
     360                 :            : 
     361                 :          0 : ::sal_Int32 SAL_CALL SwVbaDocument::getConsecutiveHyphensLimit() throw (uno::RuntimeException)
     362                 :            : {
     363                 :            :     //TODO
     364                 :          0 :     sal_Int16 nHyphensLimit = 0;
     365 [ #  # ][ #  # ]:          0 :     uno::Reference< beans::XPropertySet > xParaProps( word::getDefaultParagraphStyle( getModel() ), uno::UNO_QUERY_THROW );
                 [ #  # ]
     366 [ #  # ][ #  # ]:          0 :     xParaProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaHyphenationMaxHyphens")) ) >>= nHyphensLimit;
                 [ #  # ]
     367                 :          0 :     return nHyphensLimit;
     368                 :            : }
     369                 :            : 
     370                 :          0 : void SAL_CALL SwVbaDocument::setConsecutiveHyphensLimit( ::sal_Int32 _consecutivehyphenslimit ) throw (uno::RuntimeException)
     371                 :            : {
     372                 :          0 :     sal_Int16 nHyphensLimit = static_cast< sal_Int16 >( _consecutivehyphenslimit );
     373 [ #  # ][ #  # ]:          0 :     uno::Reference< beans::XPropertySet > xParaProps( word::getDefaultParagraphStyle( getModel() ), uno::UNO_QUERY_THROW );
                 [ #  # ]
     374 [ #  # ][ #  # ]:          0 :     xParaProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ParaHyphenationMaxHyphens")), uno::makeAny( nHyphensLimit ) );
         [ #  # ][ #  # ]
     375                 :          0 : }
     376                 :            : 
     377                 :          0 : void SAL_CALL SwVbaDocument::Protect( ::sal_Int32 /*Type*/, const uno::Any& /*NOReset*/, const uno::Any& /*Password*/, const uno::Any& /*UseIRM*/, const uno::Any& /*EnforceStyleLock*/ ) throw (uno::RuntimeException)
     378                 :            : {
     379                 :            :     // Seems not support in Writer
     380                 :            :     // VbaDocumentBase::Protect( Password );
     381                 :          0 : }
     382                 :            : 
     383                 :          0 : void SAL_CALL SwVbaDocument::PrintOut( const uno::Any& /*Background*/, const uno::Any& /*Append*/, const uno::Any& /*Range*/, const uno::Any& /*OutputFileName*/, const uno::Any& /*From*/, const uno::Any& /*To*/, const uno::Any& /*Item*/, const uno::Any& /*Copies*/, const uno::Any& /*Pages*/, const uno::Any& /*PageType*/, const uno::Any& /*PrintToFile*/, const uno::Any& /*Collate*/, const uno::Any& /*FileName*/, const uno::Any& /*ActivePrinterMacGX*/, const uno::Any& /*ManualDuplexPrint*/, const uno::Any& /*PrintZoomColumn*/, const uno::Any& /*PrintZoomRow*/, const uno::Any& /*PrintZoomPaperWidth*/, const uno::Any& /*PrintZoomPaperHeight*/ ) throw (uno::RuntimeException)
     384                 :            : {
     385                 :            :     //TODO
     386                 :          0 : }
     387                 :            : 
     388                 :          0 : void SAL_CALL SwVbaDocument::PrintPreview(  ) throw (uno::RuntimeException)
     389                 :            : {
     390         [ #  # ]:          0 :     rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:PrintPreview"));
     391         [ #  # ]:          0 :     dispatchRequests( mxModel,url );
     392                 :          0 : }
     393                 :            : 
     394                 :          0 : void SAL_CALL SwVbaDocument::ClosePrintPreview(  ) throw (uno::RuntimeException)
     395                 :            : {
     396         [ #  # ]:          0 :     rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ClosePreview"));
     397         [ #  # ]:          0 :     dispatchRequests( mxModel,url );
     398                 :          0 : }
     399                 :            : 
     400                 :            : uno::Any SAL_CALL
     401                 :          0 : SwVbaDocument::Revisions( const uno::Any& index ) throw (uno::RuntimeException)
     402                 :            : {
     403         [ #  # ]:          0 :     uno::Reference< document::XRedlinesSupplier > xRedlinesSupp( mxTextDocument, uno::UNO_QUERY_THROW );
     404 [ #  # ][ #  # ]:          0 :     uno::Reference< container::XIndexAccess > xRedlines( xRedlinesSupp->getRedlines(), uno::UNO_QUERY_THROW );
                 [ #  # ]
     405 [ #  # ][ #  # ]:          0 :     uno::Reference< XCollection > xCol( new SwVbaRevisions( this, mxContext, getModel(), xRedlines ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     406         [ #  # ]:          0 :     if ( index.hasValue() )
     407 [ #  # ][ #  # ]:          0 :         return xCol->Item( index, uno::Any() );
     408         [ #  # ]:          0 :     return uno::makeAny( xCol );
     409                 :            : }
     410                 :            : 
     411                 :            : uno::Any SAL_CALL
     412                 :          0 : SwVbaDocument::Frames( const uno::Any& index ) throw (uno::RuntimeException)
     413                 :            : {
     414         [ #  # ]:          0 :     uno::Reference< text::XTextFramesSupplier > xTextFramesSupp( mxTextDocument, uno::UNO_QUERY_THROW );
     415 [ #  # ][ #  # ]:          0 :     uno::Reference< container::XIndexAccess > xFrames( xTextFramesSupp->getTextFrames(), uno::UNO_QUERY_THROW );
                 [ #  # ]
     416 [ #  # ][ #  # ]:          0 :     uno::Reference< XCollection > xCol( new SwVbaFrames( this, mxContext, xFrames, getModel() ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     417         [ #  # ]:          0 :     if ( index.hasValue() )
     418 [ #  # ][ #  # ]:          0 :         return xCol->Item( index, uno::Any() );
     419         [ #  # ]:          0 :     return uno::makeAny( xCol );
     420                 :            : }
     421                 :            : 
     422                 :            : uno::Any
     423                 :          0 : SwVbaDocument::getControlShape( const ::rtl::OUString& sName )
     424                 :            : {
     425         [ #  # ]:          0 :     uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( mxTextDocument, uno::UNO_QUERY_THROW );
     426 [ #  # ][ #  # ]:          0 :     uno::Reference< container::XIndexAccess > xIndexAccess( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
                 [ #  # ]
     427                 :            : 
     428 [ #  # ][ #  # ]:          0 :     sal_Int32 nCount = xIndexAccess->getCount();
     429         [ #  # ]:          0 :     for( int index = 0; index < nCount; index++ )
     430                 :            :     {
     431 [ #  # ][ #  # ]:          0 :         uno::Any aUnoObj =  xIndexAccess->getByIndex( index );
     432                 :            :         // It seems there are some drawing objects that can not query into Control shapes?
     433         [ #  # ]:          0 :         uno::Reference< drawing::XControlShape > xControlShape( aUnoObj, uno::UNO_QUERY );
     434         [ #  # ]:          0 :         if( xControlShape.is() )
     435                 :            :         {
     436 [ #  # ][ #  # ]:          0 :              uno::Reference< container::XNamed > xNamed( xControlShape->getControl(), uno::UNO_QUERY_THROW );
                 [ #  # ]
     437 [ #  # ][ #  # ]:          0 :             if( sName.equals( xNamed->getName() ))
                 [ #  # ]
     438                 :            :             {
     439                 :          0 :                 return aUnoObj;
     440         [ #  # ]:          0 :             }
     441                 :            :         }
     442 [ #  # ][ #  # ]:          0 :     }
     443                 :          0 :     return uno::Any();
     444                 :            : }
     445                 :            : 
     446                 :            : uno::Reference< beans::XIntrospectionAccess > SAL_CALL
     447                 :          0 : SwVbaDocument::getIntrospection(  ) throw (uno::RuntimeException)
     448                 :            : {
     449                 :          0 :     return uno::Reference< beans::XIntrospectionAccess >();
     450                 :            : }
     451                 :            : 
     452                 :            : uno::Any SAL_CALL
     453                 :          0 : SwVbaDocument::invoke( const ::rtl::OUString& aFunctionName, const uno::Sequence< uno::Any >& /*aParams*/, uno::Sequence< ::sal_Int16 >& /*aOutParamIndex*/, uno::Sequence< uno::Any >& /*aOutParam*/ ) throw (lang::IllegalArgumentException, script::CannotConvertException, reflection::InvocationTargetException, uno::RuntimeException)
     454                 :            : {
     455                 :            :     OSL_TRACE("** SwVbaDocument::invoke( %s ), will barf",
     456                 :            :         rtl::OUStringToOString( aFunctionName, RTL_TEXTENCODING_UTF8 ).getStr() );
     457                 :            : 
     458         [ #  # ]:          0 :     throw uno::RuntimeException(); // unsupported operation
     459                 :            : }
     460                 :            : 
     461                 :            : void SAL_CALL
     462                 :          0 : SwVbaDocument::setValue( const ::rtl::OUString& /*aPropertyName*/, const uno::Any& /*aValue*/ ) throw (beans::UnknownPropertyException, script::CannotConvertException, reflection::InvocationTargetException, uno::RuntimeException)
     463                 :            : {
     464         [ #  # ]:          0 :     throw uno::RuntimeException(); // unsupported operation
     465                 :            : }
     466                 :            : uno::Any SAL_CALL
     467                 :          0 : SwVbaDocument::getValue( const ::rtl::OUString& aPropertyName ) throw (beans::UnknownPropertyException, uno::RuntimeException)
     468                 :            : {
     469 [ #  # ][ #  # ]:          0 :     uno::Reference< drawing::XControlShape > xControlShape( getControlShape( aPropertyName ), uno::UNO_QUERY_THROW );
     470                 :            : 
     471 [ #  # ][ #  # ]:          0 :     uno::Reference<lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager(), uno::UNO_QUERY_THROW );
                 [ #  # ]
     472 [ #  # ][ #  # ]:          0 :     uno::Reference< XControlProvider > xControlProvider( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.ControlProvider" ) ), mxContext ), uno::UNO_QUERY_THROW );
         [ #  # ][ #  # ]
     473 [ #  # ][ #  # ]:          0 :     uno::Reference< msforms::XControl > xControl( xControlProvider->createControl(  xControlShape, getModel() ) );
                 [ #  # ]
     474         [ #  # ]:          0 :     return uno::makeAny( xControl );
     475                 :            : }
     476                 :            : 
     477                 :            : ::sal_Bool SAL_CALL
     478                 :          0 : SwVbaDocument::hasMethod( const ::rtl::OUString& /*aName*/ ) throw (uno::RuntimeException)
     479                 :            : {
     480                 :          0 :     return sal_False;
     481                 :            : }
     482                 :            : 
     483                 :            : ::sal_Bool SAL_CALL
     484                 :          0 : SwVbaDocument::hasProperty( const ::rtl::OUString& aName ) throw (uno::RuntimeException)
     485                 :            : {
     486         [ #  # ]:          0 :     uno::Reference< container::XNameAccess > xFormControls( getFormControls() );
     487         [ #  # ]:          0 :     if ( xFormControls.is() )
     488 [ #  # ][ #  # ]:          0 :         return xFormControls->hasByName( aName );
     489                 :          0 :     return sal_False;
     490                 :            : }
     491                 :            : 
     492                 :            : uno::Reference< container::XNameAccess >
     493                 :          0 : SwVbaDocument::getFormControls()
     494                 :            : {
     495                 :          0 :     uno::Reference< container::XNameAccess > xFormControls;
     496                 :            :     try
     497                 :            :     {
     498         [ #  # ]:          0 :         uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier( mxTextDocument, uno::UNO_QUERY_THROW );
     499 [ #  # ][ #  # ]:          0 :         uno::Reference< form::XFormsSupplier >  xFormSupplier( xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW );
                 [ #  # ]
     500 [ #  # ][ #  # ]:          0 :             uno::Reference< container::XIndexAccess > xIndexAccess( xFormSupplier->getForms(), uno::UNO_QUERY_THROW );
                 [ #  # ]
     501                 :            :         // get the www-standard container ( maybe we should access the
     502                 :            :         // 'www-standard' by name rather than index, this seems an
     503                 :            :         // implementation detail
     504 [ #  # ][ #  # ]:          0 :         xFormControls.set( xIndexAccess->getByIndex(0), uno::UNO_QUERY_THROW );
         [ #  # ][ #  # ]
     505                 :            :     }
     506         [ #  # ]:          0 :     catch(const uno::Exception&)
     507                 :            :     {
     508                 :            :     }
     509                 :          0 :     return xFormControls;
     510                 :            : }
     511                 :            : 
     512                 :            : uno::Sequence< rtl::OUString >
     513                 :          0 : SwVbaDocument::getServiceNames()
     514                 :            : {
     515 [ #  # ][ #  # ]:          0 :     static uno::Sequence< rtl::OUString > aServiceNames;
         [ #  # ][ #  # ]
     516         [ #  # ]:          0 :     if ( aServiceNames.getLength() == 0 )
     517                 :            :     {
     518                 :          0 :         aServiceNames.realloc( 1 );
     519         [ #  # ]:          0 :         aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.word.Document" ) );
     520                 :            :     }
     521                 :          0 :     return aServiceNames;
     522                 :            : }
     523                 :            : 
     524                 :            : namespace document
     525                 :            : {
     526                 :            : namespace sdecl = comphelper::service_decl;
     527                 :          3 : sdecl::vba_service_class_<SwVbaDocument, sdecl::with_args<true> > serviceImpl;
     528                 :          3 : extern sdecl::ServiceDecl const serviceDecl(
     529                 :            :     serviceImpl,
     530                 :            :     "SwVbaDocument",
     531                 :            :     "ooo.vba.word.Document" );
     532 [ +  - ][ +  - ]:          9 : }
     533                 :            : 
     534                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10