1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
21 #include <FormComponent.hxx>
22 #include <formcontrolfont.hxx>
23 #include "richtextunowrapper.hxx"
24 #include <comphelper/interfacecontainer3.hxx>
25 #include <comphelper/propertycontainerhelper.hxx>
27 #include <com/sun/star/awt/XDevice.hpp>
28 #include <com/sun/star/util/XModifyBroadcaster.hpp>
29 #include <cppuhelper/implbase3.hxx>
30 #include <tools/link.hxx>
43 typedef ::cppu::ImplHelper3
< css::awt::XControlModel
44 , css::lang::XUnoTunnel
45 , css::util::XModifyBroadcaster
46 > ORichTextModel_BASE
;
50 ,public FontControlModel
51 ,public IEngineTextChangeListener
52 ,public ::comphelper::OPropertyContainerHelper
53 ,public ORichTextModel_BASE
57 const css::uno::Reference
< css::uno::XComponentContext
>& _rxFactory
60 const ORichTextModel
* _pOriginal
,
61 const css::uno::Reference
< css::uno::XComponentContext
>& _rxFactory
63 virtual ~ORichTextModel() override
;
67 css::uno::Reference
< css::awt::XDevice
>
69 css::uno::Any m_aTabStop
;
70 css::uno::Any m_aBackgroundColor
;
71 css::uno::Any m_aBorderColor
;
72 css::uno::Any m_aVerticalAlignment
;
73 OUString m_sDefaultControl
;
76 OUString m_sLastKnownEngineText
;
77 sal_Int16 m_nLineEndFormat
;
78 sal_Int16 m_nTextWritingMode
;
79 sal_Int16 m_nContextWritingMode
;
82 bool m_bEnableVisible
;
83 bool m_bHardLineBreaks
;
88 bool m_bReallyActAsRichText
; // despite the class name, the RichTextControl later on
89 // will create "ordinary" text peers depending on this property
90 bool m_bHideInactiveSelection
;
93 // <properties_for_awt_edit_compatibility>
94 css::uno::Any m_aAlign
;
95 sal_Int16 m_nEchoChar
;
96 sal_Int16 m_nMaxTextLength
;
98 // </properties_for_awt_edit_compatibility>
100 ::std::unique_ptr
<RichTextEngine
>
102 bool m_bSettingEngineText
;
104 ::comphelper::OInterfaceContainerHelper3
<css::util::XModifyListener
>
108 static RichTextEngine
* getEditEngine( const css::uno::Reference
< css::awt::XControlModel
>& _rxModel
);
111 DECLARE_UNO3_AGG_DEFAULTS( ORichTextModel
, OControlModel
)
112 virtual css::uno::Any SAL_CALL
queryAggregation( const css::uno::Type
& _rType
) override
;
115 virtual OUString SAL_CALL
getImplementationName() override
;
116 virtual ::css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
119 virtual OUString SAL_CALL
getServiceName() override
;
122 DECLARE_XTYPEPROVIDER()
125 virtual css::uno::Reference
< css::util::XCloneable
> SAL_CALL
createClone( ) override
;
128 virtual sal_Int64 SAL_CALL
getSomething( const css::uno::Sequence
< sal_Int8
>& aIdentifier
) override
;
129 static const css::uno::Sequence
<sal_Int8
> & getUnoTunnelId();
131 // XModifyBroadcaster
132 virtual void SAL_CALL
addModifyListener( const css::uno::Reference
< css::util::XModifyListener
>& aListener
) override
;
133 virtual void SAL_CALL
removeModifyListener( const css::uno::Reference
< css::util::XModifyListener
>& aListener
) override
;
135 // XPropertySet and friends
136 virtual void SAL_CALL
getFastPropertyValue(css::uno::Any
& rValue
, sal_Int32 nHandle
) const override
;
137 virtual sal_Bool SAL_CALL
convertFastPropertyValue(css::uno::Any
& rConvertedValue
, css::uno::Any
& rOldValue
,
138 sal_Int32 nHandle
, const css::uno::Any
& rValue
) override
;
139 virtual void SAL_CALL
setFastPropertyValue_NoBroadcast(sal_Int32 nHandle
, const css::uno::Any
& rValue
) override
;
140 virtual css::uno::Any
getPropertyDefaultByHandle( sal_Int32 nHandle
) const override
;
142 // OControlModel's property handling
143 virtual void describeFixedProperties(
144 css::uno::Sequence
< css::beans::Property
>& /* [out] */ _rProps
146 virtual void describeAggregateProperties(
147 css::uno::Sequence
< css::beans::Property
>& /* [out] */ _rAggregateProps
150 // prevent method hiding
151 using OControlModel::disposing
;
152 using OControlModel::getFastPropertyValue
;
155 virtual void SAL_CALL
disposing() override
;
157 // IEngineTextChangeListener
158 virtual void potentialTextChange( ) override
;
162 void implDoAggregation();
163 void implRegisterProperties();
165 /** propagates a new text to the EditEngine
167 This method needs to lock the global solar mutex, so our own mutex must not
168 be locked when calling.
171 our mutex is not locked
173 void impl_smlock_setEngineText( const OUString
& _rText
);
175 DECL_LINK( OnEngineContentModified
, LinkParamNone
*, void );
178 ORichTextModel( const ORichTextModel
& ) = delete;
179 ORichTextModel
& operator=( const ORichTextModel
& ) = delete;
186 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */