LCOV - code coverage report
Current view: top level - libreoffice/forms/source/richtext - richtextunowrapper.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 24 35 68.6 %
Date: 2012-12-27 Functions: 8 10 80.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 "richtextunowrapper.hxx"
      21             : 
      22             : #include <com/sun/star/lang/Locale.hpp>
      23             : #include <com/sun/star/container/XNameContainer.hpp>
      24             : #include <editeng/unofored.hxx>
      25             : #include <editeng/editview.hxx>
      26             : #include <editeng/unoipset.hxx>
      27             : #include <svx/svdpool.hxx>
      28             : #include <svx/svdobj.hxx>
      29             : #include <editeng/unoprnms.hxx>
      30             : 
      31             : //........................................................................
      32             : namespace frm
      33             : {
      34             : //........................................................................
      35             : 
      36             :     using namespace ::com::sun::star::uno;
      37             :     using namespace ::com::sun::star::lang;
      38             :     using namespace ::com::sun::star::beans;
      39             :     using namespace ::com::sun::star::container;
      40             : 
      41             :     //====================================================================
      42             :     namespace
      43             :     {
      44           2 :         const SvxItemPropertySet* getTextEnginePropertySet()
      45             :         {
      46             :             // Propertymap fuer einen Outliner Text
      47             :             static const SfxItemPropertyMapEntry aTextEnginePropertyMap[] =
      48             :             {
      49          46 :                 SVX_UNOEDIT_CHAR_PROPERTIES,
      50           1 :                 SVX_UNOEDIT_FONT_PROPERTIES,
      51          14 :                 SVX_UNOEDIT_PARA_PROPERTIES,
      52           1 :                 { MAP_CHAR_LEN("TextUserDefinedAttributes"), EE_CHAR_XMLATTRIBS, &::getCppuType( static_cast< const Reference< XNameContainer >* >( NULL ) ), 0, 0 },
      53           1 :                 { MAP_CHAR_LEN("ParaUserDefinedAttributes"), EE_PARA_XMLATTRIBS, &::getCppuType( static_cast< const Reference< XNameContainer >* >( NULL ) ), 0, 0 },
      54             :                 { NULL, 0, 0, NULL, 0, 0 }
      55          65 :             };
      56           2 :             static SvxItemPropertySet aTextEnginePropertySet( aTextEnginePropertyMap, SdrObject::GetGlobalDrawObjectItemPool() );
      57           2 :             return &aTextEnginePropertySet;
      58             :         }
      59             :     }
      60             : 
      61             :     //====================================================================
      62             :     //= ORichTextUnoWrapper
      63             :     //====================================================================
      64             :     //--------------------------------------------------------------------
      65           2 :     ORichTextUnoWrapper::ORichTextUnoWrapper( EditEngine& _rEngine, IEngineTextChangeListener* _pTextChangeListener )
      66           2 :         :SvxUnoText( getTextEnginePropertySet() )
      67             :     {
      68           2 :         SetEditSource( new RichTextEditSource( _rEngine, _pTextChangeListener ) );
      69           2 :     }
      70             : 
      71             :     //--------------------------------------------------------------------
      72           2 :     ORichTextUnoWrapper::~ORichTextUnoWrapper() throw()
      73             :     {
      74           2 :     }
      75             : 
      76             :     //====================================================================
      77             :     //= RichTextEditSource
      78             :     //====================================================================
      79             :     //--------------------------------------------------------------------
      80           2 :     RichTextEditSource::RichTextEditSource( EditEngine& _rEngine, IEngineTextChangeListener* _pTextChangeListener )
      81             :         :m_rEngine              ( _rEngine                               )
      82           2 :         ,m_pTextForwarder       ( new SvxEditEngineForwarder( _rEngine ) )
      83           4 :         ,m_pTextChangeListener  ( _pTextChangeListener                   )
      84             :     {
      85           2 :     }
      86             : 
      87             :     //--------------------------------------------------------------------
      88           3 :     RichTextEditSource::~RichTextEditSource()
      89             :     {
      90           1 :         delete m_pTextForwarder;
      91           2 :     }
      92             : 
      93             :     //--------------------------------------------------------------------
      94           0 :     SvxEditSource* RichTextEditSource::Clone() const
      95             :     {
      96           0 :         return new RichTextEditSource( m_rEngine, m_pTextChangeListener );
      97             :     }
      98             : 
      99             :     //--------------------------------------------------------------------
     100         366 :     SvxTextForwarder* RichTextEditSource::GetTextForwarder()
     101             :     {
     102         366 :         return m_pTextForwarder;
     103             :     }
     104             : 
     105             :     //--------------------------------------------------------------------
     106           0 :     void RichTextEditSource::UpdateData()
     107             :     {
     108             :         // this means that the content of the EditEngine changed via the UNO API
     109             :         // to reflect this in the views, we need to update them
     110           0 :         sal_uInt16 viewCount = m_rEngine.GetViewCount();
     111           0 :         for ( sal_uInt16 view = 0; view < viewCount; ++view )
     112             :         {
     113           0 :             EditView* pView = m_rEngine.GetView( view );
     114           0 :             if ( pView )
     115           0 :                 pView->ForceUpdate();
     116             :         }
     117             : 
     118           0 :         if ( m_pTextChangeListener )
     119           0 :             m_pTextChangeListener->potentialTextChange();
     120           0 :     }
     121             : 
     122             : //........................................................................
     123             : }  // namespace frm
     124             : //........................................................................
     125             : 
     126             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10