Branch data 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 : 204 : const SvxItemPropertySet* getTextEnginePropertySet()
45 : : {
46 : : // Propertymap fuer einen Outliner Text
47 : : static const SfxItemPropertyMapEntry aTextEnginePropertyMap[] =
48 : : {
49 [ + - ][ + - ]: 10 : SVX_UNOEDIT_CHAR_PROPERTIES,
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
50 [ + - ]: 10 : SVX_UNOEDIT_FONT_PROPERTIES,
51 [ + - ][ + - ]: 10 : SVX_UNOEDIT_PARA_PROPERTIES,
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
52 [ + - ]: 10 : { MAP_CHAR_LEN("TextUserDefinedAttributes"), EE_CHAR_XMLATTRIBS, &::getCppuType( static_cast< const Reference< XNameContainer >* >( NULL ) ), 0, 0 },
53 [ + - ]: 10 : { MAP_CHAR_LEN("ParaUserDefinedAttributes"), EE_PARA_XMLATTRIBS, &::getCppuType( static_cast< const Reference< XNameContainer >* >( NULL ) ), 0, 0 },
54 : : { NULL, 0, 0, NULL, 0, 0 }
55 [ + + ][ + - ]: 214 : };
[ # # ]
56 [ + + ][ + - ]: 204 : static SvxItemPropertySet aTextEnginePropertySet( aTextEnginePropertyMap, SdrObject::GetGlobalDrawObjectItemPool() );
[ + - ][ + - ]
[ # # ]
57 : 204 : return &aTextEnginePropertySet;
58 : : }
59 : : }
60 : :
61 : : //====================================================================
62 : : //= ORichTextUnoWrapper
63 : : //====================================================================
64 : : //--------------------------------------------------------------------
65 : 204 : ORichTextUnoWrapper::ORichTextUnoWrapper( EditEngine& _rEngine, IEngineTextChangeListener* _pTextChangeListener )
66 : 204 : :SvxUnoText( getTextEnginePropertySet() )
67 : : {
68 [ + - ][ + - ]: 204 : SetEditSource( new RichTextEditSource( _rEngine, _pTextChangeListener ) );
69 : 204 : }
70 : :
71 : : //--------------------------------------------------------------------
72 : 185 : ORichTextUnoWrapper::~ORichTextUnoWrapper() throw()
73 : : {
74 [ - + ]: 370 : }
75 : :
76 : : //====================================================================
77 : : //= RichTextEditSource
78 : : //====================================================================
79 : : //--------------------------------------------------------------------
80 : 208 : RichTextEditSource::RichTextEditSource( EditEngine& _rEngine, IEngineTextChangeListener* _pTextChangeListener )
81 : : :m_rEngine ( _rEngine )
82 [ + - ]: 208 : ,m_pTextForwarder ( new SvxEditEngineForwarder( _rEngine ) )
83 [ + - ]: 208 : ,m_pTextChangeListener ( _pTextChangeListener )
84 : : {
85 : 208 : }
86 : :
87 : : //--------------------------------------------------------------------
88 : 189 : RichTextEditSource::~RichTextEditSource()
89 : : {
90 [ + - ][ + - ]: 189 : delete m_pTextForwarder;
91 [ - + ]: 378 : }
92 : :
93 : : //--------------------------------------------------------------------
94 : 4 : SvxEditSource* RichTextEditSource::Clone() const
95 : : {
96 [ + - ]: 4 : return new RichTextEditSource( m_rEngine, m_pTextChangeListener );
97 : : }
98 : :
99 : : //--------------------------------------------------------------------
100 : 25781 : SvxTextForwarder* RichTextEditSource::GetTextForwarder()
101 : : {
102 : 25781 : return m_pTextForwarder;
103 : : }
104 : :
105 : : //--------------------------------------------------------------------
106 : 582 : 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 : 582 : sal_uInt16 viewCount = m_rEngine.GetViewCount();
111 [ + + ]: 814 : for ( sal_uInt16 view = 0; view < viewCount; ++view )
112 : : {
113 : 232 : EditView* pView = m_rEngine.GetView( view );
114 [ + - ]: 232 : if ( pView )
115 : 232 : pView->ForceUpdate();
116 : : }
117 : :
118 [ + - ]: 582 : if ( m_pTextChangeListener )
119 : 582 : m_pTextChangeListener->potentialTextChange();
120 : 582 : }
121 : :
122 : : //........................................................................
123 : : } // namespace frm
124 : : //........................................................................
125 : :
126 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|