bump product version to 6.4.3.1
[LibreOffice.git] / forms / source / richtext / richtextvclcontrol.hxx
blob322856619278aea1c8e42379f388428538ce5661
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 .
19 #ifndef INCLUDED_FORMS_SOURCE_RICHTEXT_RICHTEXTVCLCONTROL_HXX
20 #define INCLUDED_FORMS_SOURCE_RICHTEXT_RICHTEXTVCLCONTROL_HXX
22 #include <vcl/ctrl.hxx>
23 #include <vcl/toolbox.hxx>
24 #include <com/sun/star/awt/FontDescriptor.hpp>
25 #include "rtattributes.hxx"
26 #include "textattributelistener.hxx"
27 #include <memory>
29 class EditView;
30 class EditEngine;
31 class SfxItemSet;
33 namespace frm
36 class RichTextControlImpl;
37 class RichTextEngine;
39 class RichTextControl : public Control, public IMultiAttributeDispatcher
41 private:
42 std::unique_ptr<RichTextControlImpl> m_pImpl;
44 public:
45 RichTextControl(
46 RichTextEngine* _pEngine,
47 vcl::Window* _pParent,
48 WinBits _nStyle,
49 ITextAttributeListener* _pTextAttribListener,
50 ITextSelectionListener* _pSelectionListener
53 virtual ~RichTextControl( ) override;
54 virtual void dispose() override;
56 /* enables the change notifications for a particular attribute
58 If you want to be notified of any changes in the state of an attribute, you need to call enableAttributeNotification.
60 If you provide a dedicated listener for this attribute, this listener is called for every change in the state of
61 the attribute.
63 No matter whether you provide such a dedicated listener, the "global" listener which you specified
64 in the constructor of the control is also called for all changes in the attribute state.
66 If you previously already enabled the notification for this attribute, and specified a different listener,
67 then the previous listener will be replaced with the new listener, provided the latter is not <NULL/>.
69 void enableAttributeNotification( AttributeId _nAttributeId, ITextAttributeListener* _pListener );
71 /** disables the change notifications for a particular attribute
73 If there was a listener dedicated to this attribute, it will not be referenced and used anymore
74 after this method had been called
76 void disableAttributeNotification( AttributeId _nAttributeId );
78 /** determines whether a given slot can be mapped to an aspect of an attribute of the EditEngine
80 E.g. SID_ATTR_PARA_ADJUST_LEFT can, though it's not part of the EditEngine pool, be mapped
81 to the SID_ATTR_PARA_ADJUST slot, which in fact *is* usable with the EditEngine.
83 static bool isMappableSlot( SfxSlotId _nSlotId );
85 // IMultiAttributeDispatcher
86 virtual AttributeState getState( AttributeId _nAttributeId ) const override;
87 virtual void executeAttribute( AttributeId _nAttributeId, const SfxPoolItem* _pArgument ) override;
89 void SetBackgroundColor( );
90 void SetBackgroundColor( const Color& _rColor );
92 void SetReadOnly( bool _bReadOnly );
93 bool IsReadOnly() const;
95 void SetHideInactiveSelection( bool _bHide );
96 bool GetHideInactiveSelection() const;
98 const EditView& getView() const;
99 EditView& getView();
101 // Window overridables
102 virtual void Draw( OutputDevice* _pDev, const Point& _rPos, const Size& _rSize, DrawFlags _nFlags ) override;
104 protected:
105 // Window overridables
106 virtual void Resize() override;
107 virtual void GetFocus() override;
108 virtual void StateChanged( StateChangedType nStateChange ) override;
109 virtual bool PreNotify( NotifyEvent& _rNEvt ) override;
110 virtual bool EventNotify( NotifyEvent& _rNEvt ) override;
112 private:
113 void applyAttributes( const SfxItemSet& _rAttributesToApply );
114 void implInit( RichTextEngine* _pEngine, ITextAttributeListener* _pTextAttribListener, ITextSelectionListener* _pSelectionListener );
115 static WinBits implInitStyle( WinBits nStyle );
117 private:
118 EditEngine& getEngine() const;
122 } // namespace frm
125 #endif // INCLUDED_FORMS_SOURCE_RICHTEXT_RICHTEXTVCLCONTROL_HXX
127 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */