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