tdf#130857 qt weld: Support mail merge "Server Auth" dialog
[LibreOffice.git] / forms / source / richtext / richtextunowrapper.cxx
blobc47f2089910e547540c7cd803e7b104c719ce0d2
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::container;
40 namespace
42 const SvxItemPropertySet* getTextEnginePropertySet()
44 // property map for an outliner text
45 static const SfxItemPropertyMapEntry aTextEnginePropertyMap[] =
47 SVX_UNOEDIT_CHAR_PROPERTIES,
48 SVX_UNOEDIT_FONT_PROPERTIES,
49 SVX_UNOEDIT_PARA_PROPERTIES,
50 { u"TextUserDefinedAttributes"_ustr, EE_CHAR_XMLATTRIBS, cppu::UnoType<XNameContainer>::get(), 0, 0 },
51 { u"ParaUserDefinedAttributes"_ustr, EE_PARA_XMLATTRIBS, cppu::UnoType<XNameContainer>::get(), 0, 0 },
53 static SvxItemPropertySet aTextEnginePropertySet( aTextEnginePropertyMap, SdrObject::GetGlobalDrawObjectItemPool() );
54 return &aTextEnginePropertySet;
58 ORichTextUnoWrapper::ORichTextUnoWrapper( EditEngine& _rEngine, IEngineTextChangeListener* _pTextChangeListener )
59 :SvxUnoText( getTextEnginePropertySet() )
61 SetEditSource( new RichTextEditSource( _rEngine, _pTextChangeListener ) );
65 ORichTextUnoWrapper::~ORichTextUnoWrapper() noexcept
69 RichTextEditSource::RichTextEditSource( EditEngine& _rEngine, IEngineTextChangeListener* _pTextChangeListener )
70 :m_rEngine ( _rEngine )
71 ,m_pTextForwarder ( new SvxEditEngineForwarder( _rEngine ) )
72 ,m_pTextChangeListener ( _pTextChangeListener )
77 RichTextEditSource::~RichTextEditSource()
82 std::unique_ptr<SvxEditSource> RichTextEditSource::Clone() const
84 return std::unique_ptr<SvxEditSource>(new RichTextEditSource( m_rEngine, m_pTextChangeListener ));
88 SvxTextForwarder* RichTextEditSource::GetTextForwarder()
90 return m_pTextForwarder.get();
94 void RichTextEditSource::UpdateData()
96 // this means that the content of the EditEngine changed via the UNO API
97 // to reflect this in the views, we need to update them
98 sal_uInt16 viewCount = m_rEngine.GetViewCount();
99 for ( sal_uInt16 view = 0; view < viewCount; ++view )
101 EditView* pView = m_rEngine.GetView( view );
102 if ( pView )
103 pView->ForceLayoutCalculation();
106 if ( m_pTextChangeListener )
107 m_pTextChangeListener->potentialTextChange();
111 } // namespace frm
114 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */