LibreOffice Module forms (master) 1
richtextunowrapper.cxx
Go to the documentation of this file.
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
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
32namespace 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 const SvxItemPropertySet* getTextEnginePropertySet()
45 {
46 // property map for an outliner text
47 static const SfxItemPropertyMapEntry aTextEnginePropertyMap[] =
48 {
52 { u"TextUserDefinedAttributes", EE_CHAR_XMLATTRIBS, cppu::UnoType<XNameContainer>::get(), 0, 0 },
53 { u"ParaUserDefinedAttributes", EE_PARA_XMLATTRIBS, cppu::UnoType<XNameContainer>::get(), 0, 0 },
54 };
55 static SvxItemPropertySet aTextEnginePropertySet( aTextEnginePropertyMap, SdrObject::GetGlobalDrawObjectItemPool() );
56 return &aTextEnginePropertySet;
57 }
58 }
59
61 :SvxUnoText( getTextEnginePropertySet() )
62 {
63 SetEditSource( new RichTextEditSource( _rEngine, _pTextChangeListener ) );
64 }
65
66
68 {
69 }
70
72 :m_rEngine ( _rEngine )
73 ,m_pTextForwarder ( new SvxEditEngineForwarder( _rEngine ) )
74 ,m_pTextChangeListener ( _pTextChangeListener )
75 {
76 }
77
78
80 {
81 }
82
83
84 std::unique_ptr<SvxEditSource> RichTextEditSource::Clone() const
85 {
86 return std::unique_ptr<SvxEditSource>(new RichTextEditSource( m_rEngine, m_pTextChangeListener ));
87 }
88
89
91 {
92 return m_pTextForwarder.get();
93 }
94
95
97 {
98 // this means that the content of the EditEngine changed via the UNO API
99 // to reflect this in the views, we need to update them
100 sal_uInt16 viewCount = m_rEngine.GetViewCount();
101 for ( sal_uInt16 view = 0; view < viewCount; ++view )
102 {
103 EditView* pView = m_rEngine.GetView( view );
104 if ( pView )
105 pView->ForceLayoutCalculation();
106 }
107
110 }
111
112
113} // namespace frm
114
115
116/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
EditView * GetView(size_t nIndex=0) const
size_t GetViewCount() const
void ForceLayoutCalculation()
static SdrItemPool & GetGlobalDrawObjectItemPool()
css::uno::Type const & get()
virtual void potentialTextChange()=0
ORichTextUnoWrapper(EditEngine &_rEngine, IEngineTextChangeListener *_pTextChangeListener)
virtual ~ORichTextUnoWrapper() noexcept override
std::unique_ptr< SvxTextForwarder > m_pTextForwarder
virtual ~RichTextEditSource() override
virtual void UpdateData() override
RichTextEditSource(EditEngine &_rEngine, IEngineTextChangeListener *_pTextChangeListener)
virtual std::unique_ptr< SvxEditSource > Clone() const override
IEngineTextChangeListener * m_pTextChangeListener
virtual SvxTextForwarder * GetTextForwarder() override
float u
constexpr TypedWhichId< SvXMLAttrContainerItem > EE_PARA_XMLATTRIBS(EE_PARA_START+1)
constexpr TypedWhichId< SvXMLAttrContainerItem > EE_CHAR_XMLATTRIBS(EE_CHAR_START+28)
ListBox is a bit confusing / different from other form components, so here are a few notes:
Definition: BaseListBox.hxx:25
#define SVX_UNOEDIT_CHAR_PROPERTIES
#define SVX_UNOEDIT_PARA_PROPERTIES
#define SVX_UNOEDIT_FONT_PROPERTIES