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 FORMS_SOURCE_RICHTEXT_RICHTEXTMODEL_HXX
20 #define FORMS_SOURCE_RICHTEXT_RICHTEXTMODEL_HXX
22 #include "FormComponent.hxx"
23 #include "frm_module.hxx"
24 #include "formcontrolfont.hxx"
25 #include "richtextunowrapper.hxx"
26 #include <comphelper/propertycontainerhelper.hxx>
27 #include <comphelper/listenernotification.hxx>
29 #include <com/sun/star/awt/XDevice.hpp>
30 #include <com/sun/star/util/XModifyBroadcaster.hpp>
31 #include <cppuhelper/implbase3.hxx>
32 #include <tools/link.hxx>
36 //........................................................................
39 //........................................................................
42 //====================================================================
44 //====================================================================
45 typedef ::cppu::ImplHelper3
< ::com::sun::star::awt::XControlModel
46 , ::com::sun::star::lang::XUnoTunnel
47 , ::com::sun::star::util::XModifyBroadcaster
48 > ORichTextModel_BASE
;
52 ,public FontControlModel
53 ,public IEngineTextChangeListener
54 ,public ::comphelper::OPropertyContainerHelper
55 ,public ORichTextModel_BASE
59 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XDevice
>
61 ::com::sun::star::uno::Any m_aTabStop
;
62 ::com::sun::star::uno::Any m_aBackgroundColor
;
63 ::com::sun::star::uno::Any m_aBorderColor
;
64 ::com::sun::star::uno::Any m_aVerticalAlignment
;
65 OUString m_sDefaultControl
;
68 OUString m_sLastKnownEngineText
;
69 sal_Int16 m_nLineEndFormat
;
70 sal_Int16 m_nTextWritingMode
;
71 sal_Int16 m_nContextWritingMode
;
74 sal_Bool m_bEnableVisible
;
75 sal_Bool m_bHardLineBreaks
;
79 sal_Bool m_bPrintable
;
80 sal_Bool m_bReallyActAsRichText
; // despite the class name, the RichTextControl later on
81 // will create "ordinary" text peers depending on this property
82 sal_Bool m_bHideInactiveSelection
;
85 // <properties_for_awt_edit_compatibility>
86 ::com::sun::star::uno::Any m_aAlign
;
87 sal_Int16 m_nEchoChar
;
88 sal_Int16 m_nMaxTextLength
;
89 sal_Bool m_bMultiLine
;
90 // </properties_for_awt_edit_compatibility>
92 ::std::auto_ptr
<RichTextEngine
>
94 bool m_bSettingEngineText
;
96 ::cppu::OInterfaceContainerHelper
100 static RichTextEngine
* getEditEngine( const ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControlModel
>& _rxModel
);
103 DECLARE_DEFAULT_LEAF_XTOR( ORichTextModel
);
106 DECLARE_UNO3_AGG_DEFAULTS( ORichTextModel
, OControlModel
);
107 virtual ::com::sun::star::uno::Any SAL_CALL
queryAggregation( const ::com::sun::star::uno::Type
& _rType
) throw (::com::sun::star::uno::RuntimeException
);
110 DECLARE_SERVICE_REGISTRATION( ORichTextModel
)
113 DECLARE_XPERSISTOBJECT()
116 DECLARE_XTYPEPROVIDER()
119 DECLARE_XCLONEABLE();
122 virtual sal_Int64 SAL_CALL
getSomething( const ::com::sun::star::uno::Sequence
< sal_Int8
>& aIdentifier
) throw (::com::sun::star::uno::RuntimeException
);
124 // XModifyBroadcaster
125 virtual void SAL_CALL
addModifyListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::util::XModifyListener
>& aListener
) throw (::com::sun::star::uno::RuntimeException
);
126 virtual void SAL_CALL
removeModifyListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::util::XModifyListener
>& aListener
) throw (::com::sun::star::uno::RuntimeException
);
128 // XPropertySet and friends
129 virtual void SAL_CALL
getFastPropertyValue(::com::sun::star::uno::Any
& rValue
, sal_Int32 nHandle
) const;
130 virtual sal_Bool SAL_CALL
convertFastPropertyValue(::com::sun::star::uno::Any
& rConvertedValue
, ::com::sun::star::uno::Any
& rOldValue
,
131 sal_Int32 nHandle
, const ::com::sun::star::uno::Any
& rValue
)
132 throw(::com::sun::star::lang::IllegalArgumentException
);
133 virtual void SAL_CALL
setFastPropertyValue_NoBroadcast(sal_Int32 nHandle
, const ::com::sun::star::uno::Any
& rValue
) throw ( ::com::sun::star::uno::Exception
);
134 virtual ::com::sun::star::uno::Any
getPropertyDefaultByHandle( sal_Int32 nHandle
) const;
136 // OControlModel's property handling
137 virtual void describeFixedProperties(
138 ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::Property
>& /* [out] */ _rProps
140 virtual void describeAggregateProperties(
141 ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::Property
>& /* [out] */ _rAggregateProps
144 // prevent method hiding
145 using OControlModel::disposing
;
146 using OControlModel::getFastPropertyValue
;
149 virtual void SAL_CALL
disposing();
151 // IEngineTextChangeListener
152 virtual void potentialTextChange( );
156 void implDoAggregation();
157 void implRegisterProperties();
159 /** propagates a new text to the EditEngine
161 This method needs to lock the global solar mutex, so our own mutex must not
162 be locked when calling.
165 our mutex is not locked
167 void impl_smlock_setEngineText( const OUString
& _rText
);
169 DECL_LINK( OnEngineContentModified
, void* );
171 static ::com::sun::star::uno::Sequence
< sal_Int8
> getEditEngineTunnelId();
174 ORichTextModel(); // never implemented
175 ORichTextModel( const ORichTextModel
& ); // never implemented
176 ORichTextModel
& operator=( const ORichTextModel
& ); // never implemented
179 //........................................................................
181 //........................................................................
183 #endif // FORMS_SOURCE_RICHTEXT_RICHTEXTMODEL_HXX
185 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */