1*2d785d7eSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*2d785d7eSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*2d785d7eSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*2d785d7eSAndrew Rist * distributed with this work for additional information 6*2d785d7eSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*2d785d7eSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*2d785d7eSAndrew Rist * "License"); you may not use this file except in compliance 9*2d785d7eSAndrew Rist * with the License. You may obtain a copy of the License at 10*2d785d7eSAndrew Rist * 11*2d785d7eSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*2d785d7eSAndrew Rist * 13*2d785d7eSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*2d785d7eSAndrew Rist * software distributed under the License is distributed on an 15*2d785d7eSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*2d785d7eSAndrew Rist * KIND, either express or implied. See the License for the 17*2d785d7eSAndrew Rist * specific language governing permissions and limitations 18*2d785d7eSAndrew Rist * under the License. 19*2d785d7eSAndrew Rist * 20*2d785d7eSAndrew Rist *************************************************************/ 21*2d785d7eSAndrew Rist 22*2d785d7eSAndrew Rist 23cdf0e10cSrcweir #ifndef FORMS_SOURCE_RICHTEXT_RICHTEXTVCLCONTROL_HXX 24cdf0e10cSrcweir #define FORMS_SOURCE_RICHTEXT_RICHTEXTVCLCONTROL_HXX 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include <vcl/dialog.hxx> 27cdf0e10cSrcweir #include <vcl/fixed.hxx> 28cdf0e10cSrcweir #ifndef _SV_BUTTON_HXX 29cdf0e10cSrcweir #include <vcl/button.hxx> 30cdf0e10cSrcweir #endif 31cdf0e10cSrcweir #include <vcl/toolbox.hxx> 32cdf0e10cSrcweir #include <com/sun/star/awt/FontDescriptor.hpp> 33cdf0e10cSrcweir #include "rtattributes.hxx" 34cdf0e10cSrcweir #include "textattributelistener.hxx" 35cdf0e10cSrcweir 36cdf0e10cSrcweir /** === begin UNO includes === **/ 37cdf0e10cSrcweir /** === end UNO includes === **/ 38cdf0e10cSrcweir 39cdf0e10cSrcweir class EditView; 40cdf0e10cSrcweir class EditEngine; 41cdf0e10cSrcweir class SfxItemSet; 42cdf0e10cSrcweir //........................................................................ 43cdf0e10cSrcweir namespace frm 44cdf0e10cSrcweir { 45cdf0e10cSrcweir //........................................................................ 46cdf0e10cSrcweir 47cdf0e10cSrcweir class RichTextControlImpl; 48cdf0e10cSrcweir class RichTextEngine; 49cdf0e10cSrcweir //==================================================================== 50cdf0e10cSrcweir //= RichTextControl 51cdf0e10cSrcweir //==================================================================== 52cdf0e10cSrcweir class RichTextControl : public Control, public IMultiAttributeDispatcher 53cdf0e10cSrcweir { 54cdf0e10cSrcweir private: 55cdf0e10cSrcweir RichTextControlImpl* m_pImpl; 56cdf0e10cSrcweir 57cdf0e10cSrcweir public: 58cdf0e10cSrcweir RichTextControl( 59cdf0e10cSrcweir RichTextEngine* _pEngine, 60cdf0e10cSrcweir Window* _pParent, 61cdf0e10cSrcweir WinBits _nStyle, 62cdf0e10cSrcweir ITextAttributeListener* _pTextAttribListener, 63cdf0e10cSrcweir ITextSelectionListener* _pSelectionListener 64cdf0e10cSrcweir ); 65cdf0e10cSrcweir 66cdf0e10cSrcweir ~RichTextControl( ); 67cdf0e10cSrcweir 68cdf0e10cSrcweir /* enables the change notifications for a particular attribute 69cdf0e10cSrcweir 70cdf0e10cSrcweir If you want to be notified of any changes in the state of an attribute, you need to call enableAttributeNotification. 71cdf0e10cSrcweir 72cdf0e10cSrcweir If you provide a dedicated listener for this attribute, this listener is called for every change in the state of 73cdf0e10cSrcweir the attribute. 74cdf0e10cSrcweir 75cdf0e10cSrcweir No matter whether you provide such a dedicated listener, the "global" listener which you specified 76cdf0e10cSrcweir in the constructor of the control is also called for all changes in the attribute state. 77cdf0e10cSrcweir 78cdf0e10cSrcweir If you previously already enabled the notification for this attribute, and specified a different listener, 79cdf0e10cSrcweir then the previous listener will be replaced with the new listener, provided the latter is not <NULL/>. 80cdf0e10cSrcweir */ 81cdf0e10cSrcweir void enableAttributeNotification( AttributeId _nAttributeId, ITextAttributeListener* _pListener = NULL ); 82cdf0e10cSrcweir 83cdf0e10cSrcweir /** disables the change notifications for a particular attribute 84cdf0e10cSrcweir 85cdf0e10cSrcweir If there was a listener dedicated to this attribute, it will not be referenced and used anymore 86cdf0e10cSrcweir after this method had been called 87cdf0e10cSrcweir */ 88cdf0e10cSrcweir void disableAttributeNotification( AttributeId _nAttributeId ); 89cdf0e10cSrcweir 90cdf0e10cSrcweir /** determines whether a given slot can be mapped to an aspect of an attribute of the EditEngine 91cdf0e10cSrcweir 92cdf0e10cSrcweir E.g. SID_ATTR_PARA_ADJUST_LEFT can, though it's not part of the EditEngine pool, be mapped 93cdf0e10cSrcweir to the SID_ATTR_PARA_ADJUST slot, which in fact *is* usable with the EditEngine. 94cdf0e10cSrcweir */ 95cdf0e10cSrcweir static bool isMappableSlot( SfxSlotId _nSlotId ); 96cdf0e10cSrcweir 97cdf0e10cSrcweir // IMultiAttributeDispatcher 98cdf0e10cSrcweir virtual AttributeState getState( AttributeId _nAttributeId ) const; 99cdf0e10cSrcweir virtual void executeAttribute( AttributeId _nAttributeId, const SfxPoolItem* _pArgument ); 100cdf0e10cSrcweir 101cdf0e10cSrcweir void SetBackgroundColor( ); 102cdf0e10cSrcweir void SetBackgroundColor( const Color& _rColor ); 103cdf0e10cSrcweir 104cdf0e10cSrcweir void SetReadOnly( bool _bReadOnly ); 105cdf0e10cSrcweir bool IsReadOnly() const; 106cdf0e10cSrcweir 107cdf0e10cSrcweir void SetHideInactiveSelection( bool _bHide ); 108cdf0e10cSrcweir bool GetHideInactiveSelection() const; 109cdf0e10cSrcweir 110cdf0e10cSrcweir const EditView& getView() const; 111cdf0e10cSrcweir EditView& getView(); 112cdf0e10cSrcweir 113cdf0e10cSrcweir // Window overridables 114cdf0e10cSrcweir virtual void Draw( OutputDevice* _pDev, const Point& _rPos, const Size& _rSize, sal_uLong _nFlags ); 115cdf0e10cSrcweir 116cdf0e10cSrcweir protected: 117cdf0e10cSrcweir // Window overridables 118cdf0e10cSrcweir virtual void Resize(); 119cdf0e10cSrcweir virtual void GetFocus(); 120cdf0e10cSrcweir virtual void StateChanged( StateChangedType nStateChange ); 121cdf0e10cSrcweir virtual long PreNotify( NotifyEvent& _rNEvt ); 122cdf0e10cSrcweir virtual long Notify( NotifyEvent& _rNEvt ); 123cdf0e10cSrcweir 124cdf0e10cSrcweir private: 125cdf0e10cSrcweir void applyAttributes( const SfxItemSet& _rAttributesToApply ); 126cdf0e10cSrcweir void implInit( RichTextEngine* _pEngine, ITextAttributeListener* _pTextAttribListener, ITextSelectionListener* _pSelectionListener ); 127cdf0e10cSrcweir static WinBits implInitStyle( WinBits nStyle ); 128cdf0e10cSrcweir 129cdf0e10cSrcweir private: 130cdf0e10cSrcweir EditEngine& getEngine() const; 131cdf0e10cSrcweir Window& getViewport() const; 132cdf0e10cSrcweir }; 133cdf0e10cSrcweir 134cdf0e10cSrcweir //........................................................................ 135cdf0e10cSrcweir } // namespace frm 136cdf0e10cSrcweir //........................................................................ 137cdf0e10cSrcweir 138cdf0e10cSrcweir #endif // FORMS_SOURCE_RICHTEXT_RICHTEXTVCLCONTROL_HXX 139cdf0e10cSrcweir 140