Update ooo320-m1
[ooovba.git] / forms / source / richtext / richtextvclcontrol.hxx
blobad7fbd2169c036e331cba4a714d35af2cbaf291e
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: richtextvclcontrol.hxx,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef FORMS_SOURCE_RICHTEXT_RICHTEXTVCLCONTROL_HXX
31 #define FORMS_SOURCE_RICHTEXT_RICHTEXTVCLCONTROL_HXX
33 #include <vcl/dialog.hxx>
34 #include <vcl/fixed.hxx>
35 #ifndef _SV_BUTTON_HXX
36 #include <vcl/button.hxx>
37 #endif
38 #include <vcl/toolbox.hxx>
39 #include <com/sun/star/awt/FontDescriptor.hpp>
40 #include "rtattributes.hxx"
41 #include "textattributelistener.hxx"
43 /** === begin UNO includes === **/
44 /** === end UNO includes === **/
46 class EditView;
47 class EditEngine;
48 class SfxItemSet;
49 //........................................................................
50 namespace frm
52 //........................................................................
54 class RichTextControlImpl;
55 class RichTextEngine;
56 //====================================================================
57 //= RichTextControl
58 //====================================================================
59 class RichTextControl : public Control, public IMultiAttributeDispatcher
61 private:
62 RichTextControlImpl* m_pImpl;
64 public:
65 RichTextControl(
66 RichTextEngine* _pEngine,
67 Window* _pParent,
68 WinBits _nStyle,
69 ITextAttributeListener* _pTextAttribListener,
70 ITextSelectionListener* _pSelectionListener
73 ~RichTextControl( );
75 /* enables the change notifications for a particular attribute
77 If you want to be notified of any changes in the state of an attribute, you need to call enableAttributeNotification.
79 If you provide a dedicated listener for this attribute, this listener is called for every change in the state of
80 the attribute.
82 No matter whether you provide such a dedicated listener, the "global" listener which you specified
83 in the constructor of the control is also called for all changes in the attribute state.
85 If you previously already enabled the notification for this attribute, and specified a different listener,
86 then the previous listener will be replaced with the new listener, provided the latter is not <NULL/>.
88 void enableAttributeNotification( AttributeId _nAttributeId, ITextAttributeListener* _pListener = NULL );
90 /** disables the change notifications for a particular attribute
92 If there was a listener dedicated to this attribute, it will not be referenced and used anymore
93 after this method had been called
95 void disableAttributeNotification( AttributeId _nAttributeId );
97 /** determines whether a given slot can be mapped to an aspect of an attribute of the EditEngine
99 E.g. SID_ATTR_PARA_ADJUST_LEFT can, though it's not part of the EditEngine pool, be mapped
100 to the SID_ATTR_PARA_ADJUST slot, which in fact *is* usable with the EditEngine.
102 static bool isMappableSlot( SfxSlotId _nSlotId );
104 // IMultiAttributeDispatcher
105 virtual AttributeState getState( AttributeId _nAttributeId ) const;
106 virtual void executeAttribute( AttributeId _nAttributeId, const SfxPoolItem* _pArgument );
108 void SetBackgroundColor( );
109 void SetBackgroundColor( const Color& _rColor );
111 void SetReadOnly( bool _bReadOnly );
112 bool IsReadOnly() const;
114 void SetHideInactiveSelection( bool _bHide );
115 bool GetHideInactiveSelection() const;
117 const EditView& getView() const;
118 EditView& getView();
120 protected:
121 // Window overridables
122 virtual void Resize();
123 virtual void GetFocus();
124 virtual void StateChanged( StateChangedType nStateChange );
125 virtual long PreNotify( NotifyEvent& _rNEvt );
126 virtual void Draw( OutputDevice* _pDev, const Point& _rPos, const Size& _rSize, ULONG _nFlags );
127 virtual long Notify( NotifyEvent& _rNEvt );
129 private:
130 void applyAttributes( const SfxItemSet& _rAttributesToApply );
131 void implInit( RichTextEngine* _pEngine, ITextAttributeListener* _pTextAttribListener, ITextSelectionListener* _pSelectionListener );
132 static WinBits implInitStyle( WinBits nStyle );
134 private:
135 EditEngine& getEngine() const;
136 Window& getViewport() const;
139 //........................................................................
140 } // namespace frm
141 //........................................................................
143 #endif // FORMS_SOURCE_RICHTEXT_RICHTEXTVCLCONTROL_HXX