LCOV - code coverage report
Current view: top level - forms/source/richtext - richtextunowrapper.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 35 35 100.0 %
Date: 2015-06-13 12:38:46 Functions: 11 11 100.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         109 :         const SvxItemPropertySet* getTextEnginePropertySet()
      45             :         {
      46             :             // Propertymap fuer einen Outliner Text
      47             :             static const SfxItemPropertyMapEntry aTextEnginePropertyMap[] =
      48             :             {
      49         800 :                 SVX_UNOEDIT_CHAR_PROPERTIES,
      50          16 :                 SVX_UNOEDIT_FONT_PROPERTIES,
      51         224 :                 SVX_UNOEDIT_PARA_PROPERTIES,
      52          16 :                 { OUString("TextUserDefinedAttributes"), EE_CHAR_XMLATTRIBS, cppu::UnoType<XNameContainer>::get(), 0, 0 },
      53          16 :                 { OUString("ParaUserDefinedAttributes"), EE_PARA_XMLATTRIBS, cppu::UnoType<XNameContainer>::get(), 0, 0 },
      54             :                 { OUString(), 0, css::uno::Type(), 0, 0 }
      55        1197 :             };
      56         109 :             static SvxItemPropertySet aTextEnginePropertySet( aTextEnginePropertyMap, SdrObject::GetGlobalDrawObjectItemPool() );
      57         109 :             return &aTextEnginePropertySet;
      58             :         }
      59             :     }
      60             : 
      61         109 :     ORichTextUnoWrapper::ORichTextUnoWrapper( EditEngine& _rEngine, IEngineTextChangeListener* _pTextChangeListener )
      62         109 :         :SvxUnoText( getTextEnginePropertySet() )
      63             :     {
      64         109 :         SetEditSource( new RichTextEditSource( _rEngine, _pTextChangeListener ) );
      65         109 :     }
      66             : 
      67             : 
      68         202 :     ORichTextUnoWrapper::~ORichTextUnoWrapper() throw()
      69             :     {
      70         202 :     }
      71             : 
      72         111 :     RichTextEditSource::RichTextEditSource( EditEngine& _rEngine, IEngineTextChangeListener* _pTextChangeListener )
      73             :         :m_rEngine              ( _rEngine                               )
      74         111 :         ,m_pTextForwarder       ( new SvxEditEngineForwarder( _rEngine ) )
      75         222 :         ,m_pTextChangeListener  ( _pTextChangeListener                   )
      76             :     {
      77         111 :     }
      78             : 
      79             : 
      80         309 :     RichTextEditSource::~RichTextEditSource()
      81             :     {
      82         103 :         delete m_pTextForwarder;
      83         206 :     }
      84             : 
      85             : 
      86           2 :     SvxEditSource* RichTextEditSource::Clone() const
      87             :     {
      88           2 :         return new RichTextEditSource( m_rEngine, m_pTextChangeListener );
      89             :     }
      90             : 
      91             : 
      92       13812 :     SvxTextForwarder* RichTextEditSource::GetTextForwarder()
      93             :     {
      94       13812 :         return m_pTextForwarder;
      95             :     }
      96             : 
      97             : 
      98         313 :     void RichTextEditSource::UpdateData()
      99             :     {
     100             :         // this means that the content of the EditEngine changed via the UNO API
     101             :         // to reflect this in the views, we need to update them
     102         313 :         sal_uInt16 viewCount = m_rEngine.GetViewCount();
     103         437 :         for ( sal_uInt16 view = 0; view < viewCount; ++view )
     104             :         {
     105         124 :             EditView* pView = m_rEngine.GetView( view );
     106         124 :             if ( pView )
     107         124 :                 pView->ForceUpdate();
     108             :         }
     109             : 
     110         313 :         if ( m_pTextChangeListener )
     111         313 :             m_pTextChangeListener->potentialTextChange();
     112         313 :     }
     113             : 
     114             : 
     115             : }  // namespace frm
     116             : 
     117             : 
     118             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11