LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/forms/source/richtext - specialdispatchers.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 66 0.0 %
Date: 2013-07-09 Functions: 0 12 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             : 
      20             : #include "specialdispatchers.hxx"
      21             : #include <editeng/editeng.hxx>
      22             : #include <editeng/editview.hxx>
      23             : #include <svx/svxids.hrc>
      24             : #include <editeng/scriptspaceitem.hxx>
      25             : 
      26             : //........................................................................
      27             : namespace frm
      28             : {
      29             : //........................................................................
      30             : 
      31             :     using namespace ::com::sun::star::uno;
      32             :     using namespace ::com::sun::star::lang;
      33             :     using namespace ::com::sun::star::util;
      34             :     using namespace ::com::sun::star::frame;
      35             :     using namespace ::com::sun::star::beans;
      36             : 
      37             :     //====================================================================
      38             :     //= OSelectAllDispatcher
      39             :     //====================================================================
      40             :     //--------------------------------------------------------------------
      41           0 :     OSelectAllDispatcher::OSelectAllDispatcher( EditView& _rView, const URL&  _rURL )
      42           0 :         :ORichTextFeatureDispatcher( _rView, _rURL )
      43             :     {
      44           0 :     }
      45             : 
      46             :     //--------------------------------------------------------------------
      47           0 :     OSelectAllDispatcher::~OSelectAllDispatcher( )
      48             :     {
      49           0 :         if ( !isDisposed() )
      50             :         {
      51           0 :             acquire();
      52           0 :             dispose();
      53             :         }
      54           0 :     }
      55             : 
      56             :     //--------------------------------------------------------------------
      57           0 :     void SAL_CALL OSelectAllDispatcher::dispatch( const URL& _rURL, const Sequence< PropertyValue >& /*_rArguments*/ ) throw (RuntimeException)
      58             :     {
      59           0 :         ::osl::MutexGuard aGuard( m_aMutex );
      60             :         OSL_ENSURE( _rURL.Complete == getFeatureURL().Complete, "OSelectAllDispatcher::dispatch: invalid URL!" );
      61             :         (void)_rURL;
      62             : 
      63           0 :         checkDisposed();
      64             : 
      65           0 :         EditEngine* pEngine = getEditView() ? getEditView()->GetEditEngine() : NULL;
      66             :         OSL_ENSURE( pEngine, "OSelectAllDispatcher::dispatch: no edit engine - but not yet disposed?" );
      67           0 :         if ( !pEngine )
      68           0 :             return;
      69             : 
      70           0 :         sal_Int32 nParagraphs = pEngine->GetParagraphCount();
      71           0 :         if ( nParagraphs )
      72             :         {
      73           0 :             sal_Int32 nLastParaNumber = nParagraphs - 1;
      74           0 :             xub_StrLen nParaLen = pEngine->GetTextLen( nLastParaNumber );
      75           0 :             getEditView()->SetSelection( ESelection( 0, 0, nLastParaNumber, nParaLen ) );
      76           0 :         }
      77             :     }
      78             : 
      79             :     //--------------------------------------------------------------------
      80           0 :     FeatureStateEvent OSelectAllDispatcher::buildStatusEvent() const
      81             :     {
      82           0 :         FeatureStateEvent aEvent( ORichTextFeatureDispatcher::buildStatusEvent() );
      83           0 :         aEvent.IsEnabled = sal_True;
      84           0 :         return aEvent;
      85             :     }
      86             : 
      87             :     //====================================================================
      88             :     //= OParagraphDirectionDispatcher
      89             :     //====================================================================
      90             :     //--------------------------------------------------------------------
      91           0 :     OParagraphDirectionDispatcher::OParagraphDirectionDispatcher( EditView& _rView, AttributeId _nAttributeId, const URL& _rURL,
      92             :             IMultiAttributeDispatcher* _pMasterDispatcher )
      93           0 :         :OAttributeDispatcher( _rView, _nAttributeId, _rURL, _pMasterDispatcher )
      94             :     {
      95           0 :     }
      96             : 
      97             :     //--------------------------------------------------------------------
      98           0 :     FeatureStateEvent OParagraphDirectionDispatcher::buildStatusEvent() const
      99             :     {
     100           0 :         FeatureStateEvent aEvent( OAttributeDispatcher::buildStatusEvent() );
     101             : 
     102           0 :         EditEngine* pEngine = getEditView() ? getEditView()->GetEditEngine() : NULL;
     103             :         OSL_ENSURE( pEngine, "OParagraphDirectionDispatcher::dispatch: no edit engine - but not yet disposed?" );
     104           0 :         if ( pEngine && pEngine->IsVertical() )
     105           0 :             aEvent.IsEnabled = sal_False;
     106             : 
     107           0 :         return aEvent;
     108             :     }
     109             : 
     110             :     //====================================================================
     111             :     //= OTextDirectionDispatcher
     112             :     //====================================================================
     113             :     //--------------------------------------------------------------------
     114           0 :     OTextDirectionDispatcher::OTextDirectionDispatcher( EditView& _rView, const URL& _rURL )
     115           0 :         :ORichTextFeatureDispatcher( _rView, _rURL )
     116             :     {
     117           0 :     }
     118             : 
     119             :     //--------------------------------------------------------------------
     120           0 :     void SAL_CALL OTextDirectionDispatcher::dispatch( const URL& _rURL, const Sequence< PropertyValue >& /*_rArguments*/ ) throw (RuntimeException)
     121             :     {
     122           0 :         ::osl::MutexGuard aGuard( m_aMutex );
     123             :         OSL_ENSURE( _rURL.Complete == getFeatureURL().Complete, "OTextDirectionDispatcher::dispatch: invalid URL!" );
     124             :         (void)_rURL;
     125             : 
     126           0 :         checkDisposed();
     127             : 
     128           0 :         EditEngine* pEngine = getEditView() ? getEditView()->GetEditEngine() : NULL;
     129             :         OSL_ENSURE( pEngine, "OTextDirectionDispatcher::dispatch: no edit engine - but not yet disposed?" );
     130           0 :         if ( !pEngine )
     131           0 :             return;
     132             : 
     133           0 :         pEngine->SetVertical( !pEngine->IsVertical() );
     134             :     }
     135             : 
     136             :     //--------------------------------------------------------------------
     137           0 :     FeatureStateEvent OTextDirectionDispatcher::buildStatusEvent() const
     138             :     {
     139           0 :         FeatureStateEvent aEvent( ORichTextFeatureDispatcher::buildStatusEvent() );
     140             : 
     141           0 :         EditEngine* pEngine = getEditView() ? getEditView()->GetEditEngine() : NULL;
     142             :         OSL_ENSURE( pEngine, "OTextDirectionDispatcher::dispatch: no edit engine - but not yet disposed?" );
     143             : 
     144           0 :         aEvent.IsEnabled = sal_True;
     145           0 :         aEvent.State <<= (sal_Bool)( pEngine && pEngine->IsVertical() );
     146             : 
     147           0 :         return aEvent;
     148             :     }
     149             : 
     150             :     //====================================================================
     151             :     //= OAsianFontLayoutDispatcher
     152             :     //====================================================================
     153             :     //--------------------------------------------------------------------
     154           0 :     OAsianFontLayoutDispatcher::OAsianFontLayoutDispatcher( EditView& _rView, AttributeId _nAttributeId, const URL& _rURL, IMultiAttributeDispatcher* _pMasterDispatcher )
     155           0 :         :OParametrizedAttributeDispatcher( _rView, _nAttributeId, _rURL, _pMasterDispatcher )
     156             :     {
     157           0 :     }
     158             : 
     159             :     //--------------------------------------------------------------------
     160           0 :     const SfxPoolItem* OAsianFontLayoutDispatcher::convertDispatchArgsToItem( const Sequence< PropertyValue >& _rArguments )
     161             :     {
     162             :         // look for the "Enable" parameter
     163           0 :         const PropertyValue* pLookup = _rArguments.getConstArray();
     164           0 :         const PropertyValue* pLookupEnd = _rArguments.getConstArray() + _rArguments.getLength();
     165           0 :         while ( pLookup != pLookupEnd )
     166             :         {
     167           0 :             if ( pLookup->Name == "Enable" )
     168           0 :                 break;
     169           0 :             ++pLookup;
     170             :         }
     171           0 :         if ( pLookup != pLookupEnd )
     172             :         {
     173           0 :             sal_Bool bEnable = sal_True;
     174           0 :             OSL_VERIFY( pLookup->Value >>= bEnable );
     175           0 :             if ( m_nAttributeId == SID_ATTR_PARA_SCRIPTSPACE )
     176           0 :                 return new SvxScriptSpaceItem( bEnable, (WhichId)m_nAttributeId );
     177           0 :             return new SfxBoolItem( (WhichId)m_nAttributeId, bEnable );
     178             :         }
     179             : 
     180             :         OSL_FAIL( "OAsianFontLayoutDispatcher::convertDispatchArgsToItem: did not find the one and only argument!" );
     181           0 :         return NULL;
     182             :     }
     183             : 
     184             : //........................................................................
     185             : }   // namespace frm
     186             : //........................................................................
     187             : 
     188             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10