update dev300-m58
[ooovba.git] / forms / source / richtext / richtextunowrapper.cxx
blobcfe1d3e281fdb70ca50580408bbe5461cde27674
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: richtextunowrapper.cxx,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_forms.hxx"
33 #include "richtextunowrapper.hxx"
35 /** === begin UNO includes === **/
36 #include <com/sun/star/container/XNameContainer.hpp>
37 /** === end UNO includes === **/
38 #include <svx/unofored.hxx>
39 #include <svx/editview.hxx>
40 #include <svx/unoipset.hxx>
42 //........................................................................
43 namespace frm
45 //........................................................................
47 using namespace ::com::sun::star::uno;
48 using namespace ::com::sun::star::lang;
49 using namespace ::com::sun::star::beans;
50 using namespace ::com::sun::star::container;
52 //====================================================================
53 namespace
55 const SvxItemPropertySet* getTextEnginePropertySet()
57 // Propertymap fuer einen Outliner Text
58 static const SfxItemPropertyMapEntry aTextEnginePropertyMap[] =
60 SVX_UNOEDIT_CHAR_PROPERTIES,
61 SVX_UNOEDIT_FONT_PROPERTIES,
62 SVX_UNOEDIT_PARA_PROPERTIES,
63 { MAP_CHAR_LEN("TextUserDefinedAttributes"), EE_CHAR_XMLATTRIBS, &::getCppuType( static_cast< const Reference< XNameContainer >* >( NULL ) ), 0, 0 },
64 { MAP_CHAR_LEN("ParaUserDefinedAttributes"), EE_PARA_XMLATTRIBS, &::getCppuType( static_cast< const Reference< XNameContainer >* >( NULL ) ), 0, 0 },
65 { NULL, 0, 0, NULL, 0, 0 }
67 static SvxItemPropertySet aTextEnginePropertySet( aTextEnginePropertyMap );
68 return &aTextEnginePropertySet;
72 //====================================================================
73 //= ORichTextUnoWrapper
74 //====================================================================
75 //--------------------------------------------------------------------
76 ORichTextUnoWrapper::ORichTextUnoWrapper( EditEngine& _rEngine, IEngineTextChangeListener* _pTextChangeListener )
77 :SvxUnoText( getTextEnginePropertySet() )
79 SetEditSource( new RichTextEditSource( _rEngine, _pTextChangeListener ) );
82 //--------------------------------------------------------------------
83 ORichTextUnoWrapper::~ORichTextUnoWrapper() throw()
87 //====================================================================
88 //= RichTextEditSource
89 //====================================================================
90 //--------------------------------------------------------------------
91 RichTextEditSource::RichTextEditSource( EditEngine& _rEngine, IEngineTextChangeListener* _pTextChangeListener )
92 :m_rEngine ( _rEngine )
93 ,m_pTextForwarder ( new SvxEditEngineForwarder( _rEngine ) )
94 ,m_pTextChangeListener ( _pTextChangeListener )
98 //--------------------------------------------------------------------
99 RichTextEditSource::~RichTextEditSource()
101 delete m_pTextForwarder;
104 //--------------------------------------------------------------------
105 SvxEditSource* RichTextEditSource::Clone() const
107 return new RichTextEditSource( m_rEngine, m_pTextChangeListener );
110 //--------------------------------------------------------------------
111 SvxTextForwarder* RichTextEditSource::GetTextForwarder()
113 return m_pTextForwarder;
116 //--------------------------------------------------------------------
117 void RichTextEditSource::UpdateData()
119 // this means that the content of the EditEngine changed via the UNO API
120 // to reflect this in the views, we need to update them
121 USHORT viewCount = m_rEngine.GetViewCount();
122 for ( USHORT view = 0; view < viewCount; ++view )
124 EditView* pView = m_rEngine.GetView( view );
125 if ( pView )
126 pView->ForceUpdate();
129 if ( m_pTextChangeListener )
130 m_pTextChangeListener->potentialTextChange();
133 //........................................................................
134 } // namespace frm
135 //........................................................................