Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / forms / source / richtext / richtextunowrapper.cxx
blobd6ab326d1d1b7cf04c66660f71a5a6d890246a87
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "richtextunowrapper.hxx"
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>
32 namespace frm
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;
42 namespace
44 const SvxItemPropertySet* getTextEnginePropertySet()
46 // Propertymap fuer einen Outliner Text
47 static const SfxItemPropertyMapEntry aTextEnginePropertyMap[] =
49 SVX_UNOEDIT_CHAR_PROPERTIES,
50 SVX_UNOEDIT_FONT_PROPERTIES,
51 SVX_UNOEDIT_PARA_PROPERTIES,
52 { OUString("TextUserDefinedAttributes"), EE_CHAR_XMLATTRIBS, cppu::UnoType<XNameContainer>::get(), 0, 0 },
53 { OUString("ParaUserDefinedAttributes"), EE_PARA_XMLATTRIBS, cppu::UnoType<XNameContainer>::get(), 0, 0 },
54 { OUString(), 0, css::uno::Type(), 0, 0 }
56 static SvxItemPropertySet aTextEnginePropertySet( aTextEnginePropertyMap, SdrObject::GetGlobalDrawObjectItemPool() );
57 return &aTextEnginePropertySet;
61 ORichTextUnoWrapper::ORichTextUnoWrapper( EditEngine& _rEngine, IEngineTextChangeListener* _pTextChangeListener )
62 :SvxUnoText( getTextEnginePropertySet() )
64 SetEditSource( new RichTextEditSource( _rEngine, _pTextChangeListener ) );
68 ORichTextUnoWrapper::~ORichTextUnoWrapper() throw()
72 RichTextEditSource::RichTextEditSource( EditEngine& _rEngine, IEngineTextChangeListener* _pTextChangeListener )
73 :m_rEngine ( _rEngine )
74 ,m_pTextForwarder ( new SvxEditEngineForwarder( _rEngine ) )
75 ,m_pTextChangeListener ( _pTextChangeListener )
80 RichTextEditSource::~RichTextEditSource()
82 delete m_pTextForwarder;
86 SvxEditSource* RichTextEditSource::Clone() const
88 return new RichTextEditSource( m_rEngine, m_pTextChangeListener );
92 SvxTextForwarder* RichTextEditSource::GetTextForwarder()
94 return m_pTextForwarder;
98 void RichTextEditSource::UpdateData()
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 sal_uInt16 viewCount = m_rEngine.GetViewCount();
103 for ( sal_uInt16 view = 0; view < viewCount; ++view )
105 EditView* pView = m_rEngine.GetView( view );
106 if ( pView )
107 pView->ForceUpdate();
110 if ( m_pTextChangeListener )
111 m_pTextChangeListener->potentialTextChange();
115 } // namespace frm
118 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */