LibreOffice Module forms (master) 1
richtextimplcontrol.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
22#include "richtextengine.hxx"
23#include <sal/log.hxx>
24#include <osl/diagnose.h>
26#include <editeng/editids.hrc>
27#include <editeng/editview.hxx>
28#include <editeng/editstat.hxx>
30
31#include <svl/itempool.hxx>
32#include <svl/itemset.hxx>
33#include <tools/mapunit.hxx>
34#include <vcl/svapp.hxx>
35#include <vcl/settings.hxx>
36#include <vcl/commandevent.hxx>
37
38#define EMPTY_PAPER_SIZE 0x7FFFFFFF
39
40
41namespace frm
42{
43
44 RichTextControlImpl::RichTextControlImpl( Control* _pAntiImpl, RichTextEngine* _pEngine, ITextAttributeListener* _pTextAttrListener, ITextSelectionListener* _pSelectionListener )
45 :m_pAntiImpl ( _pAntiImpl )
46 ,m_pViewport ( nullptr )
47 ,m_pHScroll ( nullptr )
48 ,m_pVScroll ( nullptr )
49 ,m_pEngine ( _pEngine )
50 ,m_pTextAttrListener ( _pTextAttrListener )
51 ,m_pSelectionListener ( _pSelectionListener )
52 ,m_bHasEverBeenShown ( false )
53 {
54 OSL_ENSURE( m_pAntiImpl, "RichTextControlImpl::RichTextControlImpl: invalid window!" );
55 OSL_ENSURE( m_pEngine, "RichTextControlImpl::RichTextControlImpl: invalid edit engine! This will *definitely* crash!" );
56
58 m_pViewport->setAttributeInvalidationHandler( LINK( this, RichTextControlImpl, OnInvalidateAllAttributes ) );
59 m_pViewport->Show();
60
61 // ensure that both the window and the reference device have the same map unit
62 MapMode aRefDeviceMapMode( m_pEngine->GetRefDevice()->GetMapMode() );
63 m_pAntiImpl->SetMapMode( aRefDeviceMapMode );
64 m_pViewport->SetMapMode( aRefDeviceMapMode );
65
68 m_pViewport->setView( *m_pView );
69
71
72 {
73 EVControlBits nViewControlWord = m_pView->GetControlWord();
74 nViewControlWord |= EVControlBits::AUTOSCROLL;
75 m_pView->SetControlWord( nViewControlWord );
76 }
77
78 // ensure that it's initially scrolled to the upper left
79 m_pView->SetVisArea( tools::Rectangle( Point( ), m_pViewport->GetOutDev()->GetOutputSize() ) );
80
82
83 m_pAntiImpl->SetBackground( Wallpaper( m_pAntiImpl->GetSettings().GetStyleSettings().GetFieldColor() ) );
84 }
85
87 {
90 m_pView.reset();
91 m_pViewport.disposeAndClear();
94 }
95
96 void RichTextControlImpl::implUpdateAttribute( const AttributeHandlerPool::const_iterator& _pHandler )
97 {
98 if ( ( _pHandler->first == sal_uInt16(SID_ATTR_CHAR_WEIGHT) )
99 || ( _pHandler->first == sal_uInt16(SID_ATTR_CHAR_POSTURE) )
100 || ( _pHandler->first == sal_uInt16(SID_ATTR_CHAR_FONT) )
101 || ( _pHandler->first == sal_uInt16(SID_ATTR_CHAR_FONTHEIGHT) )
102 )
103 {
104 // these are attributes whose value depends on the current script type.
105 // I.e., in real, there are *three* items in the ItemSet: One for each script
106 // type (Latin, Asian, Complex). However, if we have an observer who is interested
107 // in the state of this attribute, we have to kind of *merge* the three attributes
108 // to only one.
109 // This is useful in case the observer is for instance a toolbox which contains only
110 // an, e.g., "bold" slot, and thus not interested in the particular script type of the
111 // current selection.
112 SvxScriptSetItem aNormalizedSet( static_cast<WhichId>(_pHandler->first), *m_pView->GetAttribs().GetPool() );
113 normalizeScriptDependentAttribute( aNormalizedSet );
114
115 implCheckUpdateCache( _pHandler->first, _pHandler->second->getState( aNormalizedSet.GetItemSet() ) );
116 }
117 else
118 implCheckUpdateCache( _pHandler->first, _pHandler->second->getState( m_pView->GetAttribs() ) );
119 }
120
121
123 {
124 AttributeHandlerPool::const_iterator pHandler = m_aAttributeHandlers.find( _nAttribute );
125 if ( pHandler != m_aAttributeHandlers.end() )
126 implUpdateAttribute( pHandler );
127 }
128
129
131 {
132 for ( AttributeHandlerPool::const_iterator pHandler = m_aAttributeHandlers.begin();
133 pHandler != m_aAttributeHandlers.end();
134 ++pHandler
135 )
136 {
137 implUpdateAttribute( pHandler );
138 }
139
140 // notify changes of the selection, if necessary
142 {
143 ESelection aCurrentSelection = m_pView->GetSelection();
144 if ( aCurrentSelection != m_aLastKnownSelection )
145 {
146 m_aLastKnownSelection = aCurrentSelection;
148 }
149 }
150 }
151
152
154 {
155 StateCache::const_iterator aCachedStatePos = m_aLastKnownStates.find( _nAttributeId );
156 if ( aCachedStatePos == m_aLastKnownStates.end() )
157 {
158 OSL_FAIL( "RichTextControlImpl::getAttributeState: Don't ask for the state of an attribute which I never encountered!" );
160 }
161 return aCachedStatePos->second;
162 }
163
164
165 bool RichTextControlImpl::executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rAttribs, AttributeId _nAttribute, const SfxPoolItem* _pArgument, SvtScriptType _nForScriptType )
166 {
167 // let's see whether we have a handler for this attribute
168 AttributeHandlerPool::const_iterator aHandlerPos = m_aAttributeHandlers.find( _nAttribute );
169 if ( aHandlerPos != m_aAttributeHandlers.end() )
170 {
171 aHandlerPos->second->executeAttribute( _rCurrentAttribs, _rAttribs, _pArgument, _nForScriptType );
172 return true;
173 }
174 return false;
175 }
176
177
179 {
180 AttributeHandlerPool::const_iterator aHandlerPos = m_aAttributeHandlers.find( _nAttributeId );
181 if ( aHandlerPos == m_aAttributeHandlers.end() )
182 {
184 OSL_ENSURE( aHandler.is(), "RichTextControlImpl::enableAttributeNotification: no handler available for this attribute!" );
185 if ( !aHandler.is() )
186 return;
187 SAL_WARN_IF( _nAttributeId != aHandler->getAttributeId(), "forms.richtext", "RichTextControlImpl::enableAttributeNotification: suspicious handler!" );
188
189 aHandlerPos = m_aAttributeHandlers.emplace( _nAttributeId , aHandler ).first;
190 }
191
192 // remember the listener
193 if ( _pListener )
194 m_aAttributeListeners.emplace( _nAttributeId, _pListener );
195
196 // update (and broadcast) the state of this attribute
197 updateAttribute( _nAttributeId );
198 }
199
200
202 {
203 // forget the handler for this attribute
204 AttributeHandlerPool::iterator aHandlerPos = m_aAttributeHandlers.find( _nAttributeId );
205 if ( aHandlerPos != m_aAttributeHandlers.end() )
206 m_aAttributeHandlers.erase( aHandlerPos );
207
208 // as well as the listener
209 AttributeListenerPool::iterator aListenerPos = m_aAttributeListeners.find( _nAttributeId );
210 if ( aListenerPos != m_aAttributeListeners.end() )
211 m_aAttributeListeners.erase( aListenerPos );
212 }
213
214
216 {
217 _rScriptSetItem.GetItemSet().Put( m_pView->GetAttribs(), false );
218 const SfxPoolItem* pNormalizedItem = _rScriptSetItem.GetItemOfScript( getSelectedScriptType() );
219
220 WhichId nNormalizedWhichId = _rScriptSetItem.GetItemSet().GetPool()->GetWhich( _rScriptSetItem.Which() );
221 if ( pNormalizedItem )
222 {
223 _rScriptSetItem.GetItemSet().Put( pNormalizedItem->CloneSetWhich(nNormalizedWhichId) );
224 }
225 else
226 _rScriptSetItem.GetItemSet().InvalidateItem( nNormalizedWhichId );
227 }
228
229
231 {
232 StateCache::iterator aCachePos = m_aLastKnownStates.find( _nAttribute );
233 if ( aCachePos == m_aLastKnownStates.end() )
234 { // nothing known about this attribute, yet
235 m_aLastKnownStates.emplace( _nAttribute, _rState );
236 }
237 else
238 {
239 if ( aCachePos->second == _rState )
240 {
241 // nothing to do
242 return;
243 }
244 aCachePos->second = _rState;
245 }
246
247 // is there a dedicated listener for this particular attribute?
248 AttributeListenerPool::const_iterator aListenerPos = m_aAttributeListeners.find( _nAttribute );
249 if ( aListenerPos != m_aAttributeListeners.end( ) )
250 aListenerPos->second->onAttributeStateChanged( _nAttribute );
251
252 // call our global listener, if there is one
255 }
256
257
259 {
260 SvtScriptType nScript = m_pView->GetSelectedScriptType();
261 if ( nScript == SvtScriptType::NONE )
262 nScript = SvtLanguageOptions::GetScriptTypeOfLanguage( Application::GetSettings().GetLanguageTag().getLanguageType() );
263 return nScript;
264 }
265
266
268 {
269 EditStatusFlags nStatusWord( _rStatus.GetStatusWord() );
270 if ( ( nStatusWord & EditStatusFlags::TEXTWIDTHCHANGED )
271 || ( nStatusWord & EditStatusFlags::TextHeightChanged )
272 )
273 {
274 if ( ( nStatusWord & EditStatusFlags::TextHeightChanged ) && windowHasAutomaticLineBreak() )
276
278 }
279
280 bool bHScroll = bool( nStatusWord & EditStatusFlags::HSCROLL );
281 bool bVScroll = bool( nStatusWord & EditStatusFlags::VSCROLL );
282
283 // In case of *no* automatic line breaks, we also need to check for the *range* here.
284 // Normally, we would do this only after an EditStatusFlags::TEXTWIDTHCHANGED. However, due to a bug
285 // in the EditEngine (I believe so) this is not fired when the engine does not have
286 // the AutoPaperSize bits set.
287 // So in order to be properly notified, we would need the AutoPaperSize. But, with
288 // AutoPaperSize, other things do not work anymore: Either, when we set a MaxAutoPaperSize,
289 // then the view does automatic soft line breaks at the paper end - which we definitely do
290 // want. Or, if we did not set a MaxAutoPaperSize, then the view does not automatically scroll
291 // anymore in horizontal direction.
292 // So this is some kind of lose-lose situation ... :(
293 if ( !windowHasAutomaticLineBreak() && bHScroll )
294 {
296 return;
297 }
298
299 if ( bHScroll && m_pHScroll )
300 m_pHScroll->SetThumbPos( m_pView->GetVisArea().Left() );
301 if ( bVScroll && m_pVScroll )
302 m_pVScroll->SetThumbPos( m_pView->GetVisArea().Top() );
303 }
304
305 IMPL_LINK_NOARG( RichTextControlImpl, OnInvalidateAllAttributes, LinkParamNone*, void )
306 {
307 updateAllAttributes();
308 }
309
310 IMPL_LINK( RichTextControlImpl, OnHScroll, weld::Scrollbar&, rScrollbar, void )
311 {
312 auto nDiff = m_pView->GetVisArea().Left() - rScrollbar.adjustment_get_value();
313 m_pView->Scroll(nDiff, 0, ScrollRangeCheck::PaperWidthTextSize);
314 }
315
316 IMPL_LINK(RichTextControlImpl, OnVScroll, weld::Scrollbar&, rScrollbar, void)
317 {
318 auto nDiff = m_pView->GetVisArea().Top() - rScrollbar.adjustment_get_value();
319 m_pView->Scroll(0, nDiff, ScrollRangeCheck::PaperWidthTextSize);
320 }
321
323 {
324 bool bNeedVScroll = 0 != ( m_pAntiImpl->GetStyle() & WB_VSCROLL );
325 bool bNeedHScroll = 0 != ( m_pAntiImpl->GetStyle() & WB_HSCROLL );
326
327 if ( ( bNeedVScroll == hasVScrollBar() ) && ( bNeedHScroll == hasHScrollBar( ) ) )
328 // nothing to do
329 return;
330
331 // create or delete the scrollbars, as necessary
332 if ( !bNeedVScroll )
333 {
335 }
336 else
337 {
339 m_pVScroll->SetScrollHdl ( LINK( this, RichTextControlImpl, OnVScroll ) );
340 m_pVScroll->Show();
341 }
342
343 if ( !bNeedHScroll )
344 {
346 }
347 else
348 {
350 m_pHScroll->SetScrollHdl ( LINK( this, RichTextControlImpl, OnHScroll ) );
351 m_pHScroll->Show();
352 }
353
354 layoutWindow();
355 }
356
358 {
361
362 layoutWindow();
363 }
364
366 {
367 if ( !m_bHasEverBeenShown )
368 // no need to do anything. Especially, no need to set the paper size on the
369 // EditEngine to anything...
370 return;
371
372 const StyleSettings& rStyleSettings = m_pAntiImpl->GetSettings().GetStyleSettings();
373
374 tools::Long nScrollBarWidth = m_pVScroll ? rStyleSettings.GetScrollBarSize() : 0;
375 tools::Long nScrollBarHeight = m_pHScroll ? rStyleSettings.GetScrollBarSize() : 0;
376
377 if ( m_pAntiImpl->IsZoom() )
378 {
379 nScrollBarWidth = m_pAntiImpl->CalcZoom( nScrollBarWidth );
380 nScrollBarHeight = m_pAntiImpl->CalcZoom( nScrollBarHeight );
381 }
382
383 // the overall size we can use
384 Size aPlaygroundSizePixel( m_pAntiImpl->GetOutputSizePixel() );
385
386 // the size of the viewport - note that the viewport does *not* occupy all the place
387 // which is left when subtracting the scrollbar width/height
388 Size aViewportPlaygroundPixel( aPlaygroundSizePixel );
389 aViewportPlaygroundPixel.setWidth( ::std::max( tools::Long( 10 ), tools::Long( aViewportPlaygroundPixel.Width() - nScrollBarWidth ) ) );
390 aViewportPlaygroundPixel.setHeight( ::std::max( tools::Long( 10 ), tools::Long( aViewportPlaygroundPixel.Height() - nScrollBarHeight ) ) );
391 Size aViewportPlaygroundLogic( m_pViewport->PixelToLogic( aViewportPlaygroundPixel ) );
392
393 const tools::Long nOffset = 2;
394 Size aViewportSizePixel( aViewportPlaygroundPixel.Width() - 2 * nOffset, aViewportPlaygroundPixel.Height() - 2 * nOffset );
395 Size aViewportSizeLogic( m_pViewport->PixelToLogic( aViewportSizePixel ) );
396
397 // position the viewport
398 m_pViewport->SetPosSizePixel( Point( nOffset, nOffset ), aViewportSizePixel );
399 // position the scrollbars
400 if ( m_pVScroll )
401 {
402 m_pVScroll->SetThickness(nScrollBarWidth);
403 m_pVScroll->SetPosSizePixel( Point( aViewportPlaygroundPixel.Width(), 0 ), Size( nScrollBarWidth, aViewportPlaygroundPixel.Height() ) );
404 }
405 if ( m_pHScroll )
406 {
407 m_pHScroll->SetThickness(nScrollBarHeight);
408 m_pHScroll->SetPosSizePixel( Point( 0, aViewportPlaygroundPixel.Height() ), Size( aViewportPlaygroundPixel.Width(), nScrollBarHeight ) );
409 }
410
411 // paper size
413 m_pEngine->SetPaperSize( Size( aViewportSizeLogic.Width(), m_pEngine->GetTextHeight() ) );
414
415 // output area of the view
416 m_pView->SetOutputArea( tools::Rectangle( Point( ), aViewportSizeLogic ) );
417 m_pView->SetVisArea( tools::Rectangle( Point( ), aViewportSizeLogic ) );
418
419 if ( m_pVScroll )
420 {
421 m_pVScroll->SetVisibleSize( aViewportPlaygroundLogic.Height() );
422
423 // the default height of a text line...
425 // ... is the scroll size for the vertical scrollbar
426 m_pVScroll->SetLineSize( nFontHeight );
427 // the viewport width, minus one line, is the page scroll size
428 m_pVScroll->SetPageSize( ::std::max( nFontHeight, aViewportPlaygroundLogic.Height() - nFontHeight ) );
429 }
430
431 // the font width
432 if ( m_pHScroll )
433 {
434 m_pHScroll->SetVisibleSize( aViewportPlaygroundLogic.Width() );
435
437 if ( !nFontWidth )
438 {
439 m_pViewport->GetOutDev()->Push( vcl::PushFlags::FONT );
440 m_pViewport->SetFont( m_pEngine->GetStandardFont(0) );
441 nFontWidth = m_pViewport->GetTextWidth( "x" );
442 m_pViewport->GetOutDev()->Pop();
443 }
444 // ... is the scroll size for the horizontal scrollbar
445 m_pHScroll->SetLineSize( 5 * nFontWidth );
446 // the viewport height, minus one character, is the page scroll size
447 m_pHScroll->SetPageSize( ::std::max( nFontWidth, aViewportPlaygroundLogic.Width() - nFontWidth ) );
448 }
449
450 // update range and position of the scrollbars
452 }
453
454
456 {
457 if ( m_pVScroll )
458 {
459 tools::Long nOverallTextHeight = m_pEngine->GetTextHeight();
460 m_pVScroll->SetRange( Range( 0, nOverallTextHeight ) );
461 m_pVScroll->SetThumbPos( m_pView->GetVisArea().Top() );
462 }
463
464 if ( m_pHScroll )
465 {
466 Size aPaperSize( m_pEngine->GetPaperSize() );
467 tools::Long nOverallTextWidth = ( aPaperSize.Width() == EMPTY_PAPER_SIZE ) ? m_pEngine->CalcTextWidth() : aPaperSize.Width();
468 m_pHScroll->SetRange( Range( 0, nOverallTextWidth ) );
469 m_pHScroll->SetThumbPos( m_pView->GetVisArea().Left() );
470 }
471 }
472
473
475 {
476 if ( !m_bHasEverBeenShown )
477 {
478 m_bHasEverBeenShown = true;
479 layoutWindow();
480 }
481 }
482
483
485 {
488 }
489
490
492 {
493 const Fraction& rZoom = m_pAntiImpl->GetZoom();
494
495 MapMode aMapMode( m_pAntiImpl->GetMapMode() );
496 aMapMode.SetScaleX( rZoom );
497 aMapMode.SetScaleY( rZoom );
498 m_pAntiImpl->SetMapMode( aMapMode );
499
500 m_pViewport->SetZoom( rZoom );
501 m_pViewport->SetMapMode( aMapMode );
502
503 layoutWindow();
504 }
505
506
508 {
509 return ( m_pAntiImpl->GetStyle() & WB_WORDBREAK ) != 0;
510 }
511
512
513 void RichTextControlImpl::SetReadOnly( bool _bReadOnly )
514 {
515 m_pView->SetReadOnly( _bReadOnly );
516 }
517
518
520 {
521 return m_pView->IsReadOnly( );
522 }
523
524
525 namespace
526 {
527 void lcl_inflate( tools::Rectangle& _rRect, tools::Long _nInflateX, tools::Long _nInflateY )
528 {
529 _rRect.AdjustLeft( -_nInflateX );
530 _rRect.AdjustRight(_nInflateX );
531 _rRect.AdjustTop( -_nInflateY );
532 _rRect.AdjustBottom(_nInflateY );
533 }
534 }
535
537 {
538 if ( ( _rEvent.GetCommand() == CommandEventId::Wheel )
539 || ( _rEvent.GetCommand() == CommandEventId::StartAutoScroll )
540 || ( _rEvent.GetCommand() == CommandEventId::AutoScroll )
541 )
542 {
543 m_pAntiImpl->HandleScrollCommand( _rEvent, m_pHScroll, m_pVScroll );
544 return true;
545 }
546 return false;
547 }
548
549
550 void RichTextControlImpl::Draw( OutputDevice* _pDev, const Point& _rPos, const Size& _rSize )
551 {
552 // need to normalize the map mode of the device - every paint operation on any device needs
553 // to use the same map mode
555
556 // enforce our "normalize map mode" on the device
557 MapMode aRefMapMode( m_pEngine->GetRefDevice()->GetMapMode() );
558 MapMode aOriginalMapMode( _pDev->GetMapMode() );
559 MapMode aNormalizedMapMode( aRefMapMode.GetMapUnit(), aRefMapMode.GetOrigin(), aOriginalMapMode.GetScaleX(), aOriginalMapMode.GetScaleY() );
560 _pDev->SetMapMode( aNormalizedMapMode );
561
562 // translate coordinates
563 Point aPos( _rPos );
564 Size aSize( _rSize );
565 if ( aOriginalMapMode.GetMapUnit() == MapUnit::MapPixel )
566 {
567 aPos = _pDev->PixelToLogic( _rPos, aNormalizedMapMode );
568 aSize = _pDev->PixelToLogic( _rSize, aNormalizedMapMode );
569 }
570 else
571 {
572 aPos = OutputDevice::LogicToLogic( _rPos, aOriginalMapMode, aNormalizedMapMode );
573 aSize = OutputDevice::LogicToLogic( _rSize, aOriginalMapMode, aNormalizedMapMode );
574 }
575
576 tools::Rectangle aPlayground( aPos, aSize );
577 Size aOnePixel( _pDev->PixelToLogic( Size( 1, 1 ) ) );
578 aPlayground.AdjustRight( -(aOnePixel.Width()) );
579 aPlayground.AdjustBottom( -(aOnePixel.Height()) );
580
581 // background
582 _pDev->SetLineColor();
583 _pDev->DrawRect( aPlayground );
584
585 // do we need to draw a border?
586 bool bBorder = ( m_pAntiImpl->GetStyle() & WB_BORDER );
587 if ( bBorder )
588 _pDev->SetLineColor( m_pAntiImpl->GetSettings().GetStyleSettings().GetMonoColor() );
589 else
590 _pDev->SetLineColor();
591 _pDev->SetFillColor( m_pAntiImpl->GetBackground().GetColor() );
592 _pDev->DrawRect( aPlayground );
593
594 if ( bBorder )
595 // don't draw the text over the border
596 lcl_inflate( aPlayground, -aOnePixel.Width(), -aOnePixel.Height() );
597
598 // leave a space of two pixels between the "surroundings" of the control
599 // and the content
600 lcl_inflate( aPlayground, -aOnePixel.Width(), -aOnePixel.Height() );
601 lcl_inflate( aPlayground, -aOnePixel.Width(), -aOnePixel.Height() );
602
603 // actually draw the content
604 m_pEngine->Draw(*_pDev, aPlayground, Point(), true);
605
606 _pDev->Pop();
607 }
608
609
611 {
612 SetBackgroundColor( Application::GetSettings().GetStyleSettings().GetFieldColor() );
613 }
614
615
617 {
618 Wallpaper aWallpaper( _rColor );
619 m_pAntiImpl->SetBackground( aWallpaper );
620 m_pViewport->SetBackground( aWallpaper );
621 }
622
623
625 {
626 m_pViewport->SetHideInactiveSelection( _bHide );
627 }
628
629
631 {
632 return m_pViewport->GetHideInactiveSelection( );
633 }
634
635
636} // namespace frm
637
638
639/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static const AllSettings & GetSettings()
CommandEventId GetCommand() const
OutputDevice * GetRefDevice() const
const Size & GetPaperSize() const
EditView * RemoveView(EditView *pEditView)
sal_uInt32 GetTextHeight() const
vcl::Font GetStandardFont(sal_Int32 nPara)
sal_uInt32 CalcTextWidth()
const SfxItemSet & GetEmptyItemSet() const
void Draw(OutputDevice &rOutDev, const tools::Rectangle &rOutRect)
void SetPaperSize(const Size &rSize)
void InsertView(EditView *pEditView, size_t nIndex=EE_APPEND)
EditStatusFlags GetStatusWord() const
void SetScaleY(const Fraction &rScaleY)
const Fraction & GetScaleX() const
MapUnit GetMapUnit() const
const Point & GetOrigin() const
const Fraction & GetScaleY() const
void SetScaleX(const Fraction &rScaleX)
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
void DrawRect(const tools::Rectangle &rRect)
SAL_WARN_UNUSED_RESULT Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
void SetLineColor()
void SetMapMode()
void SetFillColor()
const MapMode & GetMapMode() const
void Push(vcl::PushFlags nFlags=vcl::PushFlags::ALL)
SfxItemPool * GetPool() const
std::unique_ptr< SfxPoolItem > CloneSetWhich(sal_uInt16 nNewWhich) const
constexpr tools::Long Height() const
void setWidth(tools::Long nWidth)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
sal_Int32 GetScrollBarSize() const
const SfxPoolItem * GetItemOfScript(SvtScriptType nScript) const
void disposeAndClear()
static VclPtr< reference_type > Create(Arg &&... arg)
virtual void onAttributeStateChanged(AttributeId _nAttributeId)=0
virtual void onSelectionChanged()=0
void updateAllAttributes()
updates the cache with the state of all attribute values from the given set, notifies the listener if...
VclPtr< RichTextViewPort > m_pViewport
void enableAttributeNotification(AttributeId _nAttributeId, ITextAttributeListener *_pListener)
enables the callback for a particular attribute
virtual void EditEngineStatusChanged(const EditStatus &_rStatus) override
void normalizeScriptDependentAttribute(SvxScriptSetItem &_rScriptSetItem)
normalizes the given item so that the state of script dependent attributes is correct considering the...
void implUpdateAttribute(const AttributeHandlerPool::const_iterator &_pHandler)
ITextSelectionListener * m_pSelectionListener
bool executeAttribute(const SfxItemSet &_rCurrentAttribs, SfxItemSet &_rNewAttribs, AttributeId _nAttribute, const SfxPoolItem *_pArgument, SvtScriptType _nForScriptType)
executes a toggle of the given attribute
void Draw(OutputDevice *_pDev, const Point &_rPos, const Size &_rSize)
draws the control onto a given output device
std::unique_ptr< EditView > m_pView
void updateAttribute(AttributeId _nAttribute)
updates the cache with the state of the attribute given by which id, notifies the listener if the sta...
void layoutWindow()
re-arranges the view and the scrollbars
ITextAttributeListener * m_pTextAttrListener
RichTextControlImpl(Control *_pAntiImpl, RichTextEngine *_pEngine, ITextAttributeListener *_pTextAttrListener, ITextSelectionListener *_pSelectionListener)
void implCheckUpdateCache(AttributeId _nAttribute, const AttributeState &_rState)
void SetReadOnly(bool _bReadOnly)
AttributeListenerPool m_aAttributeListeners
void ensureLineBreakSetting()
ensures that our "automatic line break" setting matches the current WinBits of the window
AttributeHandlerPool m_aAttributeHandlers
void notifyZoomChanged()
to be called when the zoom of our window changed
AttributeState getAttributeState(AttributeId _nAttributeId) const
retrieves the state of the given attribute from the cache
VclPtr< ScrollAdaptor > m_pVScroll
SvtScriptType getSelectedScriptType() const
void SetHideInactiveSelection(bool _bHide)
void ensureScrollbars()
hides or shows our scrollbars, according to the current WinBits of the window
bool HandleCommand(const CommandEvent &_rEvent)
handles command events arrived at the anti-impl control
void notifyInitShow()
to be called when the StateChangedType::InitShow event arrives
void notifyStyleChanged()
to be called when the style of our window changed
void disableAttributeNotification(AttributeId _nAttributeId)
disables the change notifications for a particular attribute
VclPtr< ScrollAdaptor > m_pHScroll
void revokeEngineStatusListener(IEngineStatusListener const *_pListener)
void registerEngineStatusListener(IEngineStatusListener *_pListener)
tools::Long AdjustTop(tools::Long nVertMoveDelta)
tools::Long AdjustRight(tools::Long nHorzMoveDelta)
tools::Long AdjustBottom(tools::Long nVertMoveDelta)
tools::Long AdjustLeft(tools::Long nHorzMoveDelta)
const Size & GetFontSize() const
EditStatusFlags
EVControlBits
SvtScriptType
#define SAL_WARN_IF(condition, area, stream)
SvtScriptType GetScriptTypeOfLanguage(LanguageType nLang)
::rtl::Reference< AttributeHandler > getHandlerFor(AttributeId _nAttributeId, const SfxItemPool &_rEditEnginePool)
ListBox is a bit confusing / different from other form components, so here are a few notes:
Definition: BaseListBox.hxx:25
sal_uInt16 WhichId
the "which id" of an item in an SfxItemSet
@ eIndetermined
IMPL_LINK_NOARG(OButtonControl, OnClick, void *, void)
Definition: Button.cxx:440
IMPL_LINK(OClickableImageBaseModel, OnImageImportDone, Graphic *, i_pGraphic, void)
sal_Int32 AttributeId
the id of an attribute
long Long
#define EMPTY_PAPER_SIZE
WinBits const WB_BORDER
WinBits const WB_WORDBREAK
WinBits const WB_VSCROLL
WinBits const WB_HSCROLL