LCOV - code coverage report
Current view: top level - forms/source/richtext - richtextunowrapper.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 36 36 100.0 %
Date: 2014-11-03 Functions: 13 13 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         212 :         const SvxItemPropertySet* getTextEnginePropertySet()
      45             :         {
      46             :             // Propertymap fuer einen Outliner Text
      47             :             static const SfxItemPropertyMapEntry aTextEnginePropertyMap[] =
      48             :             {
      49         686 :                 SVX_UNOEDIT_CHAR_PROPERTIES,
      50          14 :                 SVX_UNOEDIT_FONT_PROPERTIES,
      51         196 :                 SVX_UNOEDIT_PARA_PROPERTIES,
      52          14 :                 { OUString("TextUserDefinedAttributes"), EE_CHAR_XMLATTRIBS, cppu::UnoType<XNameContainer>::get(), 0, 0 },
      53          14 :                 { OUString("ParaUserDefinedAttributes"), EE_PARA_XMLATTRIBS, cppu::UnoType<XNameContainer>::get(), 0, 0 },
      54             :                 { OUString(), 0, css::uno::Type(), 0, 0 }
      55        1150 :             };
      56         212 :             static SvxItemPropertySet aTextEnginePropertySet( aTextEnginePropertyMap, SdrObject::GetGlobalDrawObjectItemPool() );
      57         212 :             return &aTextEnginePropertySet;
      58             :         }
      59             :     }
      60             : 
      61         212 :     ORichTextUnoWrapper::ORichTextUnoWrapper( EditEngine& _rEngine, IEngineTextChangeListener* _pTextChangeListener )
      62         212 :         :SvxUnoText( getTextEnginePropertySet() )
      63             :     {
      64         212 :         SetEditSource( new RichTextEditSource( _rEngine, _pTextChangeListener ) );
      65         212 :     }
      66             : 
      67             : 
      68         392 :     ORichTextUnoWrapper::~ORichTextUnoWrapper() throw()
      69             :     {
      70         392 :     }
      71             : 
      72         216 :     RichTextEditSource::RichTextEditSource( EditEngine& _rEngine, IEngineTextChangeListener* _pTextChangeListener )
      73             :         :m_rEngine              ( _rEngine                               )
      74         216 :         ,m_pTextForwarder       ( new SvxEditEngineForwarder( _rEngine ) )
      75         432 :         ,m_pTextChangeListener  ( _pTextChangeListener                   )
      76             :     {
      77         216 :     }
      78             : 
      79             : 
      80         600 :     RichTextEditSource::~RichTextEditSource()
      81             :     {
      82         200 :         delete m_pTextForwarder;
      83         400 :     }
      84             : 
      85             : 
      86           4 :     SvxEditSource* RichTextEditSource::Clone() const
      87             :     {
      88           4 :         return new RichTextEditSource( m_rEngine, m_pTextChangeListener );
      89             :     }
      90             : 
      91             : 
      92       27195 :     SvxTextForwarder* RichTextEditSource::GetTextForwarder()
      93             :     {
      94       27195 :         return m_pTextForwarder;
      95             :     }
      96             : 
      97             : 
      98         616 :     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         616 :         sal_uInt16 viewCount = m_rEngine.GetViewCount();
     103         860 :         for ( sal_uInt16 view = 0; view < viewCount; ++view )
     104             :         {
     105         244 :             EditView* pView = m_rEngine.GetView( view );
     106         244 :             if ( pView )
     107         244 :                 pView->ForceUpdate();
     108             :         }
     109             : 
     110         616 :         if ( m_pTextChangeListener )
     111         616 :             m_pTextChangeListener->potentialTextChange();
     112         616 :     }
     113             : 
     114             : 
     115         192 : }  // namespace frm
     116             : 
     117             : 
     118             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10