23#if OSL_DEBUG_LEVEL > 0
27 #include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
29#include <editeng/editeng.hxx>
31#include <editeng/editids.hrc>
32#include <svx/svxids.hrc>
33#include <osl/diagnose.h>
41 :
Control( _pParent, implInitStyle( _nStyle ) )
43 implInit( _pEngine, _pTextAttribListener, _pSelectionListener );
66 return m_pImpl->getAttributeState( _nAttributeId );
73 if ( !
m_pImpl->executeAttribute(
getView().GetAttribs(), aToApplyAttributes, _nAttributeId, _pArgument,
m_pImpl->getSelectedScriptType() ) )
75 OSL_FAIL(
"RichTextControl::executeAttribute: cannot handle the given attribute!" );
100 m_pImpl->updateAllAttributes();
108 m_pImpl->enableAttributeNotification( _nAttributeId, _pListener );
114 m_pImpl->disableAttributeNotification( _nAttributeId );
122 case SID_ATTR_PARA_ADJUST_LEFT:
123 case SID_ATTR_PARA_ADJUST_CENTER:
124 case SID_ATTR_PARA_ADJUST_RIGHT:
125 case SID_ATTR_PARA_ADJUST_BLOCK:
126 case SID_SET_SUPER_SCRIPT:
127 case SID_SET_SUB_SCRIPT:
128 case SID_ATTR_PARA_LINESPACE_10:
129 case SID_ATTR_PARA_LINESPACE_15:
130 case SID_ATTR_PARA_LINESPACE_20:
131 case SID_ATTR_PARA_LEFT_TO_RIGHT:
132 case SID_ATTR_PARA_RIGHT_TO_LEFT:
133 case SID_TEXTDIRECTION_TOP_TO_BOTTOM:
134 case SID_TEXTDIRECTION_LEFT_TO_RIGHT:
135 case SID_ATTR_CHAR_LATIN_FONT:
136 case SID_ATTR_CHAR_LATIN_FONTHEIGHT:
137 case SID_ATTR_CHAR_LATIN_LANGUAGE:
138 case SID_ATTR_CHAR_LATIN_POSTURE:
139 case SID_ATTR_CHAR_LATIN_WEIGHT:
169 if ( _nStateChange == StateChangedType::Style )
174 else if ( _nStateChange == StateChangedType::Zoom )
178 else if ( _nStateChange == StateChangedType::InitShow )
190 if ( NotifyEventType::KEYINPUT == _rNEvt.
GetType() )
192 const ::KeyEvent* pKeyEvent = _rNEvt.
GetKeyEvent();
195 bool bShift = pKeyEvent->GetKeyCode().IsShift();
196 bool bCtrl = pKeyEvent->GetKeyCode().IsMod1();
197 bool bAlt = pKeyEvent->GetKeyCode().IsMod2();
198 if ( (
KEY_TAB == nCode ) && bCtrl && !bAlt )
203 ::KeyEvent aNewEvent( pKeyEvent->GetCharCode(), aNewCode );
208#if OSL_DEBUG_LEVEL > 0
219 const char* pDescription;
220 const char* pExtension;
222 }
const aExportFormats[] =
224 {
"OASIS OpenDocument (*.xml)",
"*.xml", EETextFormat::Xml },
225 {
"HyperText Markup Language (*.html)",
"*.html", EETextFormat::Html },
226 {
"Rich Text format (*.rtf)",
"*.rtf", EETextFormat::Rtf },
227 {
"Text (*.txt)",
"*.txt", EETextFormat::Text }
230 ::sfx2::FileDialogHelper aFP( bLoad ? css::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE : css::ui::dialogs::TemplateDescription::FILESAVE_AUTOEXTENSION, FileDialogFlags::NONE,
GetFrameWeld() );
232 for (
auto & aExportFormat : aExportFormats)
235 OUString::createFromAscii( aExportFormat.pDescription ),
236 OUString::createFromAscii( aExportFormat.pExtension ) );
241 OUString sFileName = aFP.
GetPath();
243 sFileName, ( bLoad ? StreamMode::READ : StreamMode::WRITE | StreamMode::TRUNC ) | StreamMode::SHARE_DENYALL
249 for (
auto & aExportFormat : aExportFormats)
251 if ( sFilter.equalsAscii( aExportFormat.pDescription ) )
253 eFormat = aExportFormat.eFormat;
260 aURL.removeSegment();
281 if ( _rNEvt.
GetType() == NotifyEventType::COMMAND )
284 bDone =
m_pImpl->HandleCommand( rEvent );
314 m_pImpl->SetReadOnly( _bReadOnly );
326 m_pImpl->SetBackgroundColor( );
332 m_pImpl->SetBackgroundColor( _rColor );
338 m_pImpl->SetHideInactiveSelection( _bHide );
344 return m_pImpl->GetHideInactiveSelection( );
virtual bool EventNotify(NotifyEvent &rNEvt) override
virtual void StateChanged(StateChangedType nStateChange) override
virtual void dispose() override
bool SetUpdateLayout(bool bUpdate, bool bRestoring=false)
ErrCode Read(SvStream &rInput, const OUString &rBaseURL, EETextFormat, SvKeyValueIterator *pHTTPHeaderAttrs=nullptr)
void Write(SvStream &rOutput, EETextFormat)
void HideCursor(bool bDeactivate=false)
void ShowCursor(bool bGotoCursor=true, bool bForceVisCursor=true, bool bActivate=false)
void SetAttribs(const SfxItemSet &rSet)
const vcl::KeyCode & GetKeyCode() const
const KeyEvent * GetKeyEvent() const
vcl::Window * GetWindow() const
const CommandEvent * GetCommandEvent() const
NotifyEventType GetType() const
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
virtual void GetFocus() override
virtual void Draw(OutputDevice *_pDev, const Point &_rPos, SystemTextColorFlags _nFlags) override
RichTextControl(RichTextEngine *_pEngine, vcl::Window *_pParent, WinBits _nStyle, ITextAttributeListener *_pTextAttribListener, ITextSelectionListener *_pSelectionListener)
virtual ~RichTextControl() override
virtual void StateChanged(StateChangedType nStateChange) override
void enableAttributeNotification(AttributeId _nAttributeId, ITextAttributeListener *_pListener)
std::unique_ptr< RichTextControlImpl > m_pImpl
void SetHideInactiveSelection(bool _bHide)
void applyAttributes(const SfxItemSet &_rAttributesToApply)
const EditView & getView() const
virtual void executeAttribute(AttributeId _nAttributeId, const SfxPoolItem *_pArgument) override
virtual void Resize() override
EditEngine & getEngine() const
void SetBackgroundColor()
void disableAttributeNotification(AttributeId _nAttributeId)
disables the change notifications for a particular attribute
virtual bool EventNotify(NotifyEvent &_rNEvt) override
void SetReadOnly(bool _bReadOnly)
virtual bool PreNotify(NotifyEvent &_rNEvt) override
static bool isMappableSlot(SfxSlotId _nSlotId)
determines whether a given slot can be mapped to an aspect of an attribute of the EditEngine
static WinBits implInitStyle(WinBits nStyle)
bool GetHideInactiveSelection() const
void implInit(RichTextEngine *_pEngine, ITextAttributeListener *_pTextAttribListener, ITextSelectionListener *_pSelectionListener)
virtual void dispose() override
virtual AttributeState getState(AttributeId _nAttributeId) const override
void AddFilter(const OUString &rFilterName, const OUString &rExtension)
OUString GetCurrentFilter() const
static std::unique_ptr< SvStream > CreateStream(const OUString &rFileName, StreamMode eOpenMode, css::uno::Reference< css::awt::XWindow > xParentWin=nullptr)
sal_uInt16 GetCode() const
void SetStyle(WinBits nStyle)
bool HasChildPathFocus(bool bSystemWindow=false) const
virtual void KeyInput(const KeyEvent &rKEvt)
virtual bool PreNotify(NotifyEvent &rNEvt)
virtual Size GetSizePixel() const
bool IsWindowOrChild(const vcl::Window *pWindow, bool bSystemWindow=false) const
void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
weld::Window * GetFrameWeld() const
void SetCompoundControl(bool bCompound)
constexpr sal_uInt16 KEY_TAB
constexpr sal_uInt16 KEY_F12
constexpr sal_uInt16 KEY_F11
ListBox is a bit confusing / different from other form components, so here are a few notes:
sal_uInt16 SfxSlotId
a SFX slot id
sal_Int32 AttributeId
the id of an attribute
WinBits const WB_NOTABSTOP