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 .
19 #ifndef INCLUDED_FORMS_SOURCE_RICHTEXT_RICHTEXTMODEL_HXX
20 #define INCLUDED_FORMS_SOURCE_RICHTEXT_RICHTEXTMODEL_HXX
22 #include "FormComponent.hxx"
23 #include "formcontrolfont.hxx"
24 #include "richtextunowrapper.hxx"
25 #include <comphelper/propertycontainerhelper.hxx>
26 #include <comphelper/listenernotification.hxx>
28 #include <com/sun/star/awt/XDevice.hpp>
29 #include <com/sun/star/util/XModifyBroadcaster.hpp>
30 #include <cppuhelper/implbase3.hxx>
31 #include <tools/link.hxx>
44 typedef ::cppu::ImplHelper3
< css::awt::XControlModel
45 , css::lang::XUnoTunnel
46 , css::util::XModifyBroadcaster
47 > ORichTextModel_BASE
;
51 ,public FontControlModel
52 ,public IEngineTextChangeListener
53 ,public ::comphelper::OPropertyContainerHelper
54 ,public ORichTextModel_BASE
57 DECLARE_DEFAULT_LEAF_XTOR( ORichTextModel
);
61 css::uno::Reference
< css::awt::XDevice
>
63 css::uno::Any m_aTabStop
;
64 css::uno::Any m_aBackgroundColor
;
65 css::uno::Any m_aBorderColor
;
66 css::uno::Any m_aVerticalAlignment
;
67 OUString m_sDefaultControl
;
70 OUString m_sLastKnownEngineText
;
71 sal_Int16 m_nLineEndFormat
;
72 sal_Int16 m_nTextWritingMode
;
73 sal_Int16 m_nContextWritingMode
;
76 bool m_bEnableVisible
;
77 bool m_bHardLineBreaks
;
82 bool m_bReallyActAsRichText
; // despite the class name, the RichTextControl later on
83 // will create "ordinary" text peers depending on this property
84 bool m_bHideInactiveSelection
;
87 // <properties_for_awt_edit_compatibility>
88 css::uno::Any m_aAlign
;
89 sal_Int16 m_nEchoChar
;
90 sal_Int16 m_nMaxTextLength
;
92 // </properties_for_awt_edit_compatibility>
94 ::std::unique_ptr
<RichTextEngine
>
96 bool m_bSettingEngineText
;
98 ::comphelper::OInterfaceContainerHelper2
102 static RichTextEngine
* getEditEngine( const css::uno::Reference
< css::awt::XControlModel
>& _rxModel
);
107 DECLARE_UNO3_AGG_DEFAULTS( ORichTextModel
, OControlModel
)
108 virtual css::uno::Any SAL_CALL
queryAggregation( const css::uno::Type
& _rType
) throw (css::uno::RuntimeException
, std::exception
) override
;
111 virtual OUString SAL_CALL
getImplementationName() throw (::css::uno::RuntimeException
, std::exception
) override
;
112 virtual ::css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() throw (::css::uno::RuntimeException
, std::exception
) override
;
115 DECLARE_XPERSISTOBJECT()
118 DECLARE_XTYPEPROVIDER()
121 virtual css::uno::Reference
< css::util::XCloneable
> SAL_CALL
createClone( ) throw (css::uno::RuntimeException
, std::exception
) override
;
124 virtual sal_Int64 SAL_CALL
getSomething( const css::uno::Sequence
< sal_Int8
>& aIdentifier
) throw (css::uno::RuntimeException
, std::exception
) override
;
126 // XModifyBroadcaster
127 virtual void SAL_CALL
addModifyListener( const css::uno::Reference
< css::util::XModifyListener
>& aListener
) throw (css::uno::RuntimeException
, std::exception
) override
;
128 virtual void SAL_CALL
removeModifyListener( const css::uno::Reference
< css::util::XModifyListener
>& aListener
) throw (css::uno::RuntimeException
, std::exception
) override
;
130 // XPropertySet and friends
131 virtual void SAL_CALL
getFastPropertyValue(css::uno::Any
& rValue
, sal_Int32 nHandle
) const override
;
132 virtual sal_Bool SAL_CALL
convertFastPropertyValue(css::uno::Any
& rConvertedValue
, css::uno::Any
& rOldValue
,
133 sal_Int32 nHandle
, const css::uno::Any
& rValue
)
134 throw(css::lang::IllegalArgumentException
) override
;
135 virtual void SAL_CALL
setFastPropertyValue_NoBroadcast(sal_Int32 nHandle
, const css::uno::Any
& rValue
) throw ( css::uno::Exception
, std::exception
) override
;
136 virtual css::uno::Any
getPropertyDefaultByHandle( sal_Int32 nHandle
) const override
;
138 // OControlModel's property handling
139 virtual void describeFixedProperties(
140 css::uno::Sequence
< css::beans::Property
>& /* [out] */ _rProps
142 virtual void describeAggregateProperties(
143 css::uno::Sequence
< css::beans::Property
>& /* [out] */ _rAggregateProps
146 // prevent method hiding
147 using OControlModel::disposing
;
148 using OControlModel::getFastPropertyValue
;
151 virtual void SAL_CALL
disposing() override
;
153 // IEngineTextChangeListener
154 virtual void potentialTextChange( ) override
;
158 void implDoAggregation();
159 void implRegisterProperties();
161 /** propagates a new text to the EditEngine
163 This method needs to lock the global solar mutex, so our own mutex must not
164 be locked when calling.
167 our mutex is not locked
169 void impl_smlock_setEngineText( const OUString
& _rText
);
171 DECL_LINK_TYPED( OnEngineContentModified
, LinkParamNone
*, void );
173 static css::uno::Sequence
< sal_Int8
> getEditEngineTunnelId();
176 ORichTextModel( const ORichTextModel
& ) = delete;
177 ORichTextModel
& operator=( const ORichTextModel
& ) = delete;
184 #endif // INCLUDED_FORMS_SOURCE_RICHTEXT_RICHTEXTMODEL_HXX
186 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */