LibreOffice Module toolkit (master) 1
vclxwindow.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
20
21#include <stdarg.h>
22#include <memory>
23#include <com/sun/star/awt/WindowEvent.hpp>
24#include <com/sun/star/awt/KeyEvent.hpp>
25#include <com/sun/star/awt/MouseEvent.hpp>
26#include <com/sun/star/awt/MouseWheelBehavior.hpp>
27#include <com/sun/star/awt/Style.hpp>
28#include <com/sun/star/awt/DockingEvent.hpp>
29#include <com/sun/star/awt/EndDockingEvent.hpp>
30#include <com/sun/star/awt/EndPopupModeEvent.hpp>
31#include <com/sun/star/awt/XWindowListener2.hpp>
32#include <com/sun/star/style/VerticalAlignment.hpp>
33#include <com/sun/star/lang/DisposedException.hpp>
34#include <com/sun/star/text/WritingMode2.hpp>
36#include <awt/vclxpointer.hxx>
40#include <helper/property.hxx>
41#include <rtl/math.hxx>
42#include <sal/log.hxx>
43#include <utility>
45#include <vcl/svapp.hxx>
46#include <vcl/window.hxx>
47#include <tools/color.hxx>
48#include <tools/fract.hxx>
49#include <tools/debug.hxx>
50#include <vcl/event.hxx>
51#include <vcl/dockwin.hxx>
53#include <vcl/tabpage.hxx>
54#include <vcl/ctrl.hxx>
55#include <vcl/settings.hxx>
56#include <vcl/commandevent.hxx>
60#include "stylesettings.hxx"
61#include <tools/urlobj.hxx>
62
65
66using namespace ::com::sun::star;
67
68using ::com::sun::star::uno::Reference;
69using ::com::sun::star::uno::UNO_QUERY;
70using ::com::sun::star::lang::EventObject;
71using ::com::sun::star::awt::XWindowListener2;
72using ::com::sun::star::awt::XDockableWindowListener;
73using ::com::sun::star::awt::XDevice;
74using ::com::sun::star::awt::XStyleSettings;
75using ::com::sun::star::lang::DisposedException;
76using ::com::sun::star::style::VerticalAlignment;
77using ::com::sun::star::style::VerticalAlignment_TOP;
78using ::com::sun::star::style::VerticalAlignment_MIDDLE;
79using ::com::sun::star::style::VerticalAlignment_BOTTOM;
80
81namespace WritingMode2 = ::com::sun::star::text::WritingMode2;
82
83
84//= VCLXWindowImpl
85
87{
88private:
89 typedef ::std::vector< VCLXWindow::Callback > CallbackArray;
90
91private:
95 bool mbDrawingOntoParent; // no bit mask, is passed around by reference
98
102 EventListenerMultiplexer maEventListeners;
103 FocusListenerMultiplexer maFocusListeners;
104 WindowListenerMultiplexer maWindowListeners;
105 KeyListenerMultiplexer maKeyListeners;
106 MouseListenerMultiplexer maMouseListeners;
107 MouseMotionListenerMultiplexer maMouseMotionListeners;
108 PaintListenerMultiplexer maPaintListeners;
109 VclContainerListenerMultiplexer maContainerListeners;
110 TopWindowListenerMultiplexer maTopWindowListeners;
111
114
115public:
116 bool mbDisposing : 1;
117 bool mbDesignMode : 1;
120
122 sal_Int16 mnWritingMode;
124
125 std::unique_ptr<UnoPropertyArrayHelper>
127
128 css::uno::Reference< css::accessibility::XAccessibleContext >
130 css::uno::Reference< css::awt::XGraphics >
132 css::uno::Reference< css::awt::XStyleSettings >
134
135public:
137
138public:
144 VCLXWindowImpl( VCLXWindow& _rAntiImpl, bool _bWithDefaultProps );
145
146 VCLXWindowImpl( const VCLXWindowImpl& ) = delete;
147 const VCLXWindowImpl& operator=(const VCLXWindowImpl&) = delete;
148
151 void setEnableVisible( bool bEnableVisible ) { mbEnableVisible = bEnableVisible; }
152 bool isEnableVisible() const { return mbEnableVisible; }
155 void setDirectVisible( bool bDirectVisible ) { mbDirectVisible = bDirectVisible; }
156 bool isDirectVisible() const { return mbDirectVisible; }
157
160 void callBackAsync( const VCLXWindow::Callback& i_callback );
161
164 void disposing();
165
167 {
168 return maAccFactory;
169 }
170
171 Reference< XStyleSettings > getStyleSettings();
172
177 EventListenerMultiplexer& getEventListeners() { return maEventListeners; }
178 FocusListenerMultiplexer& getFocusListeners() { return maFocusListeners; }
179 WindowListenerMultiplexer& getWindowListeners() { return maWindowListeners; }
180 KeyListenerMultiplexer& getKeyListeners() { return maKeyListeners; }
181 MouseListenerMultiplexer& getMouseListeners() { return maMouseListeners; }
182 MouseMotionListenerMultiplexer& getMouseMotionListeners() { return maMouseMotionListeners; }
183 PaintListenerMultiplexer& getPaintListeners() { return maPaintListeners; }
184 VclContainerListenerMultiplexer& getContainerListeners() { return maContainerListeners; }
185 TopWindowListenerMultiplexer& getTopWindowListeners() { return maTopWindowListeners; }
186
187private:
188 DECL_LINK( OnProcessCallbacks, void*, void );
189};
190
191
192VCLXWindowImpl::VCLXWindowImpl( VCLXWindow& _rAntiImpl, bool _bWithDefaultProps )
193 :mrAntiImpl( _rAntiImpl )
194 ,mbDisposed( false )
195 ,mbDrawingOntoParent( false )
196 ,mbEnableVisible(true)
197 ,mbDirectVisible(true)
198 ,maWindow2Listeners( maListenerContainerMutex )
199 ,maDockableWindowListeners( maListenerContainerMutex )
200 ,maEventListeners( _rAntiImpl )
201 ,maFocusListeners( _rAntiImpl )
202 ,maWindowListeners( _rAntiImpl )
203 ,maKeyListeners( _rAntiImpl )
204 ,maMouseListeners( _rAntiImpl )
205 ,maMouseMotionListeners( _rAntiImpl )
206 ,maPaintListeners( _rAntiImpl )
207 ,maContainerListeners( _rAntiImpl )
208 ,maTopWindowListeners( _rAntiImpl )
209 ,mnCallbackEventId( nullptr )
210 ,mbDisposing( false )
211 ,mbDesignMode( false )
212 ,mbSynthesizingVCLEvent( false )
213 ,mbWithDefaultProps( _bWithDefaultProps )
214 ,mnListenerLockLevel( 0 )
215 ,mnWritingMode( WritingMode2::CONTEXT )
216 ,mnContextWritingMode( WritingMode2::CONTEXT )
217{
218}
219
221{
222 SolarMutexGuard aGuard;
223
224 assert(!mbDisposed);
225
226 mbDisposed = true;
227
228 if ( mnCallbackEventId )
229 {
231 mnCallbackEventId = nullptr;
232 // we acquired our VCLXWindow once before posting the event, release this one ref now
233 mrAntiImpl.release();
234 }
235 maCallbackEvents.clear();
236
237 css::lang::EventObject aEvent;
238 aEvent.Source = mrAntiImpl;
239
241 maEventListeners.disposeAndClear( aEvent );
242 maFocusListeners.disposeAndClear( aEvent );
243 maWindowListeners.disposeAndClear( aEvent );
244 maKeyListeners.disposeAndClear( aEvent );
245 maMouseListeners.disposeAndClear( aEvent );
246 maMouseMotionListeners.disposeAndClear( aEvent );
247 maPaintListeners.disposeAndClear( aEvent );
248 maContainerListeners.disposeAndClear( aEvent );
249 maTopWindowListeners.disposeAndClear( aEvent );
251
252 ::toolkit::WindowStyleSettings* pStyleSettings = static_cast< ::toolkit::WindowStyleSettings* >( mxWindowStyleSettings.get() );
253 if ( pStyleSettings != nullptr )
254 pStyleSettings->dispose();
255 mxWindowStyleSettings.clear();
256}
257
258
260{
262 maCallbackEvents.push_back( i_callback );
263 if ( !mnCallbackEventId )
264 {
265 // ensure our VCLXWindow is not destroyed while the event is underway
266 mrAntiImpl.acquire();
267 mnCallbackEventId = Application::PostUserEvent( LINK( this, VCLXWindowImpl, OnProcessCallbacks ) );
268 }
269}
270
271
272IMPL_LINK_NOARG(VCLXWindowImpl, OnProcessCallbacks, void*, void)
273{
274 const Reference< uno::XInterface > xKeepAlive( mrAntiImpl );
275
276 SAL_INFO("toolkit.controls", "OnProcessCallbacks grabbing solarmutex");
277
278 // work on a copy of the callback array
279 CallbackArray aCallbacksCopy;
280 {
281 SolarMutexGuard aGuard;
282 aCallbacksCopy.swap(maCallbackEvents);
283
284 // we acquired our VCLXWindow once before posting the event, release this one ref now
285 mrAntiImpl.release();
286
287 assert( mnCallbackEventId && "should not be possible to call us if the event was removed");
288
289 mnCallbackEventId = nullptr;
290 }
291
292 {
293 SAL_INFO("toolkit.controls", "OnProcessCallbacks relinquished solarmutex");
294 SolarMutexReleaser aReleaseSolar;
295 for (const auto& rCallback : aCallbacksCopy)
296 {
297 rCallback();
298 }
299 }
300}
301
302Reference< XStyleSettings > VCLXWindowImpl::getStyleSettings()
303{
304 SolarMutexGuard aGuard;
305 if ( mbDisposed )
306 throw DisposedException( OUString(), mrAntiImpl );
307 if ( !mxWindowStyleSettings.is() )
308 mxWindowStyleSettings = new ::toolkit::WindowStyleSettings( maListenerContainerMutex, mrAntiImpl );
310}
311
312
313// Uses an out-parameter instead of return value, due to the object reference
314
315static void ImplInitWindowEvent( css::awt::WindowEvent& rEvent, vcl::Window const * pWindow )
316{
317 Point aPos = pWindow->GetPosPixel();
318 Size aSz = pWindow->GetSizePixel();
319
320 rEvent.X = aPos.X();
321 rEvent.Y = aPos.Y();
322
323 rEvent.Width = aSz.Width();
324 rEvent.Height = aSz.Height();
325
326 pWindow->GetBorder( rEvent.LeftInset, rEvent.TopInset, rEvent.RightInset, rEvent.BottomInset );
327}
328
329VCLXWindow::VCLXWindow( bool _bWithDefaultProps )
330{
331 mpImpl.reset( new VCLXWindowImpl( *this, _bWithDefaultProps ) );
332}
333
335{
336 assert(mpImpl->mbDisposing && "forgot to call dispose()");
337}
338
339
341{
342 if (mpImpl->mbDisposing)
343 return;
344 mpImpl->callBackAsync( i_callback );
345}
346
347
349{
350 return mpImpl->getAccessibleFactory().getFactory();
351}
352
354{
355 assert(!mpImpl->mbDisposing || !pWindow);
356
357 if ( GetWindow() )
358 {
359 GetWindow()->RemoveEventListener( LINK( this, VCLXWindow, WindowEventListener ) );
360// GetWindow()->DbgAssertNoEventListeners();
361 }
362
363 SetOutputDevice( pWindow ? pWindow->GetOutDev() : nullptr );
364
365 if ( GetWindow() )
366 {
367 GetWindow()->AddEventListener( LINK( this, VCLXWindow, WindowEventListener ) );
368 bool bDirectVisible = pWindow && pWindow->IsVisible();
369 mpImpl->setDirectVisible( bDirectVisible );
370 }
371}
372
374{
375 ++mpImpl->mnListenerLockLevel;
376}
377
379{
380 DBG_ASSERT( mpImpl->mnListenerLockLevel, "VCLXWindow::resumeVclEventListening: not suspended!" );
381 --mpImpl->mnListenerLockLevel;
382}
383
385{
386 if ( mpImpl->getContainerListeners().getLength() )
387 {
388 awt::VclContainerEvent aEvent;
389 aEvent.Source = *this;
390 aEvent.Child = static_cast< XWindow* >( _rWindow.GetWindowPeer() );
391 mpImpl->getContainerListeners().windowRemoved( aEvent );
392 }
393}
394
395IMPL_LINK( VCLXWindow, WindowEventListener, VclWindowEvent&, rEvent, void )
396{
397 if ( mpImpl->mbDisposing || mpImpl->mnListenerLockLevel )
398 return;
399
400 DBG_ASSERT( rEvent.GetWindow() && GetWindow(), "Window???" );
401 ProcessWindowEvent( rEvent );
402}
403
404namespace
405{
406 struct CallWindow2Listener
407 {
408 CallWindow2Listener( ::comphelper::OInterfaceContainerHelper3<css::awt::XWindowListener2>& i_rWindow2Listeners, const bool i_bEnabled, EventObject i_Event )
409 :m_rWindow2Listeners( i_rWindow2Listeners )
410 ,m_bEnabled( i_bEnabled )
411 ,m_aEvent(std::move( i_Event ))
412 {
413 }
414
415 void operator()()
416 {
417 m_rWindow2Listeners.notifyEach( m_bEnabled ? &XWindowListener2::windowEnabled : &XWindowListener2::windowDisabled, m_aEvent );
418 }
419
421 const bool m_bEnabled;
422 const EventObject m_aEvent;
423 };
424}
425
426void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
427{
428 if (mpImpl->mbDisposing)
429 return;
430 css::uno::Reference< css::uno::XInterface > xThis( static_cast<cppu::OWeakObject*>(this) );
431
432 switch ( rVclWindowEvent.GetId() )
433 {
434 case VclEventId::WindowEnabled:
435 case VclEventId::WindowDisabled:
436 {
437 Callback aCallback = CallWindow2Listener(
438 mpImpl->getWindow2Listeners(),
439 ( VclEventId::WindowEnabled == rVclWindowEvent.GetId() ),
440 EventObject( *this )
441 );
443 }
444 break;
445
446 case VclEventId::WindowPaint:
447 {
448 if ( mpImpl->getPaintListeners().getLength() )
449 {
450 css::awt::PaintEvent aEvent;
451 aEvent.Source = static_cast<cppu::OWeakObject*>(this);
452 aEvent.UpdateRect = AWTRectangle( *static_cast<tools::Rectangle*>(rVclWindowEvent.GetData()) );
453 aEvent.Count = 0;
454 mpImpl->getPaintListeners().windowPaint( aEvent );
455 }
456 }
457 break;
458 case VclEventId::WindowMove:
459 {
460 if ( mpImpl->getWindowListeners().getLength() )
461 {
462 css::awt::WindowEvent aEvent;
463 aEvent.Source = static_cast<cppu::OWeakObject*>(this);
464 ImplInitWindowEvent( aEvent, rVclWindowEvent.GetWindow() );
465 mpImpl->getWindowListeners().windowMoved( aEvent );
466 }
467 }
468 break;
469 case VclEventId::WindowResize:
470 {
471 if ( mpImpl->getWindowListeners().getLength() )
472 {
473 css::awt::WindowEvent aEvent;
474 aEvent.Source = static_cast<cppu::OWeakObject*>(this);
475 ImplInitWindowEvent( aEvent, rVclWindowEvent.GetWindow() );
476 mpImpl->getWindowListeners().windowResized( aEvent );
477 }
478 }
479 break;
480 case VclEventId::WindowShow:
481 {
482 if ( mpImpl->getWindowListeners().getLength() )
483 {
484 css::awt::WindowEvent aEvent;
485 aEvent.Source = static_cast<cppu::OWeakObject*>(this);
486 ImplInitWindowEvent( aEvent, rVclWindowEvent.GetWindow() );
487 mpImpl->getWindowListeners().windowShown( aEvent );
488 }
489
490 // For TopWindows this means opened...
491 if ( mpImpl->getTopWindowListeners().getLength() )
492 {
493 css::lang::EventObject aEvent;
494 aEvent.Source = static_cast<cppu::OWeakObject*>(this);
495 mpImpl->getTopWindowListeners().windowOpened( aEvent );
496 }
497 }
498 break;
499 case VclEventId::WindowHide:
500 {
501 if ( mpImpl->getWindowListeners().getLength() )
502 {
503 css::awt::WindowEvent aEvent;
504 aEvent.Source = static_cast<cppu::OWeakObject*>(this);
505 ImplInitWindowEvent( aEvent, rVclWindowEvent.GetWindow() );
506 mpImpl->getWindowListeners().windowHidden( aEvent );
507 }
508
509 // For TopWindows this means closed...
510 if ( mpImpl->getTopWindowListeners().getLength() )
511 {
512 css::lang::EventObject aEvent;
513 aEvent.Source = static_cast<cppu::OWeakObject*>(this);
514 mpImpl->getTopWindowListeners().windowClosed( aEvent );
515 }
516 }
517 break;
518 case VclEventId::WindowActivate:
519 case VclEventId::WindowDeactivate:
520 {
521 if (!mpImpl->getTopWindowListeners().getLength())
522 return;
523
524 // Suppress events which are unlikely to be interesting to our listeners.
525 vcl::Window* pWin = static_cast<vcl::Window*>(rVclWindowEvent.GetData());
526 bool bSuppress = false;
527
528 while (pWin)
529 {
530 // Either the event came from the same window, from its
531 // child, or from a child of its border window (e.g.
532 // menubar or notebookbar).
533 if (pWin->GetWindow(GetWindowType::Client) == GetWindow())
534 return;
535
536 if (pWin->IsMenuFloatingWindow())
537 bSuppress = true;
538
539 if (pWin->GetType() == WindowType::FLOATINGWINDOW &&
540 static_cast<FloatingWindow*>(pWin)->IsInPopupMode())
541 bSuppress = true;
542
543 // Otherwise, don't suppress if the event came from a different frame.
544 if (!bSuppress && pWin->GetWindow(GetWindowType::Frame) == pWin)
545 break;
546
547 pWin = pWin->GetWindow(GetWindowType::RealParent);
548 }
549
550 css::lang::EventObject aEvent;
551 aEvent.Source = static_cast<cppu::OWeakObject*>(this);
552 if (rVclWindowEvent.GetId() == VclEventId::WindowActivate)
553 mpImpl->getTopWindowListeners().windowActivated( aEvent );
554 else
555 mpImpl->getTopWindowListeners().windowDeactivated( aEvent );
556 }
557 break;
558 case VclEventId::WindowClose:
559 {
560 if ( mpImpl->getDockableWindowListeners().getLength() )
561 {
562 css::lang::EventObject aEvent;
563 aEvent.Source = static_cast<cppu::OWeakObject*>(this);
564 mpImpl->getDockableWindowListeners().notifyEach( &XDockableWindowListener::closed, aEvent );
565 }
566 if ( mpImpl->getTopWindowListeners().getLength() )
567 {
568 css::lang::EventObject aEvent;
569 aEvent.Source = static_cast<cppu::OWeakObject*>(this);
570 mpImpl->getTopWindowListeners().windowClosing( aEvent );
571 }
572 }
573 break;
574 case VclEventId::ControlGetFocus:
575 case VclEventId::WindowGetFocus:
576 {
577 if ( ( rVclWindowEvent.GetWindow()->IsCompoundControl()
578 && rVclWindowEvent.GetId() == VclEventId::ControlGetFocus
579 )
580 || ( !rVclWindowEvent.GetWindow()->IsCompoundControl()
581 && rVclWindowEvent.GetId() == VclEventId::WindowGetFocus
582 )
583 )
584 {
585 if ( mpImpl->getFocusListeners().getLength() )
586 {
587 css::awt::FocusEvent aEvent;
588 aEvent.Source = static_cast<cppu::OWeakObject*>(this);
589 aEvent.FocusFlags = static_cast<sal_Int16>(rVclWindowEvent.GetWindow()->GetGetFocusFlags());
590 aEvent.Temporary = false;
591 mpImpl->getFocusListeners().focusGained( aEvent );
592 }
593 }
594 }
595 break;
596 case VclEventId::ControlLoseFocus:
597 case VclEventId::WindowLoseFocus:
598 {
599 if ( ( rVclWindowEvent.GetWindow()->IsCompoundControl()
600 && rVclWindowEvent.GetId() == VclEventId::ControlLoseFocus
601 )
602 || ( !rVclWindowEvent.GetWindow()->IsCompoundControl()
603 && rVclWindowEvent.GetId() == VclEventId::WindowLoseFocus
604 )
605 )
606 {
607 if ( mpImpl->getFocusListeners().getLength() )
608 {
609 css::awt::FocusEvent aEvent;
610 aEvent.Source = static_cast<cppu::OWeakObject*>(this);
611 aEvent.FocusFlags = static_cast<sal_Int16>(rVclWindowEvent.GetWindow()->GetGetFocusFlags());
612 aEvent.Temporary = false;
613
615 if ( pNext )
616 {
617 // Don't care about internals if this control is compound
618 vcl::Window* pNextC = pNext;
619 while ( pNextC && !pNextC->IsCompoundControl() )
620 pNextC = pNextC->GetParent();
621 if ( pNextC )
622 pNext = pNextC;
623
624 pNext->GetComponentInterface();
625 aEvent.NextFocus = static_cast<cppu::OWeakObject*>(pNext->GetWindowPeer());
626 }
627 mpImpl->getFocusListeners().focusLost( aEvent );
628 }
629 }
630 }
631 break;
632 case VclEventId::WindowMinimize:
633 {
634 if ( mpImpl->getTopWindowListeners().getLength() )
635 {
636 css::lang::EventObject aEvent;
637 aEvent.Source = static_cast<cppu::OWeakObject*>(this);
638 mpImpl->getTopWindowListeners().windowMinimized( aEvent );
639 }
640 }
641 break;
642 case VclEventId::WindowNormalize:
643 {
644 if ( mpImpl->getTopWindowListeners().getLength() )
645 {
646 css::lang::EventObject aEvent;
647 aEvent.Source = static_cast<cppu::OWeakObject*>(this);
648 mpImpl->getTopWindowListeners().windowNormalized( aEvent );
649 }
650 }
651 break;
652 case VclEventId::WindowKeyInput:
653 {
654 if ( mpImpl->getKeyListeners().getLength() )
655 {
656 css::awt::KeyEvent aEvent( VCLUnoHelper::createKeyEvent(
657 *static_cast<KeyEvent*>(rVclWindowEvent.GetData()), *this
658 ) );
659 mpImpl->getKeyListeners().keyPressed( aEvent );
660 }
661 }
662 break;
663 case VclEventId::WindowKeyUp:
664 {
665 if ( mpImpl->getKeyListeners().getLength() )
666 {
667 css::awt::KeyEvent aEvent( VCLUnoHelper::createKeyEvent(
668 *static_cast<KeyEvent*>(rVclWindowEvent.GetData()), *this
669 ) );
670 mpImpl->getKeyListeners().keyReleased( aEvent );
671 }
672 }
673 break;
674 case VclEventId::WindowCommand:
675 {
676 CommandEvent* pCmdEvt = static_cast<CommandEvent*>(rVclWindowEvent.GetData());
677 if ( mpImpl->getMouseListeners().getLength() && ( pCmdEvt->GetCommand() == CommandEventId::ContextMenu ) )
678 {
679 // CommandEventId::ContextMenu: send as mousePressed with PopupTrigger = true ...
680 Point aWhere = static_cast< CommandEvent* >( rVclWindowEvent.GetData() )->GetMousePosPixel();
681 if ( !pCmdEvt->IsMouseEvent() )
682 { // for keyboard events, we set the coordinates to -1,-1. This is a slight HACK, but the current API
683 // handles a context menu command as special case of a mouse event, which is simply wrong.
684 // Without extending the API, we would not have another chance to notify listeners of a
685 // keyboard-triggered context menu request
686 aWhere = Point( -1, -1 );
687 }
688
689 MouseEvent aMEvt( aWhere, 1, MouseEventModifiers::SIMPLECLICK, MOUSE_LEFT, 0 );
690 awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( aMEvt, *this ) );
691 aEvent.PopupTrigger = true;
692
693 Callback aCallback = [ this, aEvent ]()
694 { this->mpImpl->getMouseListeners().mousePressed( aEvent ); };
695
697 }
698 }
699 break;
700 case VclEventId::WindowMouseMove:
701 {
702 MouseEvent* pMouseEvt = static_cast<MouseEvent*>(rVclWindowEvent.GetData());
703 if ( mpImpl->getMouseListeners().getLength() && ( pMouseEvt->IsEnterWindow() || pMouseEvt->IsLeaveWindow() ) )
704 {
705 awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( *pMouseEvt, *this ) );
706 bool const isEnter(pMouseEvt->IsEnterWindow());
707 Callback aCallback = [ this, isEnter, aEvent ]()
708 { MouseListenerMultiplexer& rMouseListeners = this->mpImpl->getMouseListeners();
709 isEnter
710 ? rMouseListeners.mouseEntered(aEvent)
711 : rMouseListeners.mouseExited(aEvent); };
712
714 }
715
716 if ( mpImpl->getMouseMotionListeners().getLength() && !pMouseEvt->IsEnterWindow() && !pMouseEvt->IsLeaveWindow() )
717 {
718 awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( *pMouseEvt, *this ) );
719 aEvent.ClickCount = 0;
720 if ( pMouseEvt->GetMode() & MouseEventModifiers::SIMPLEMOVE )
721 mpImpl->getMouseMotionListeners().mouseMoved( aEvent );
722 else
723 mpImpl->getMouseMotionListeners().mouseDragged( aEvent );
724 }
725 }
726 break;
727 case VclEventId::WindowMouseButtonDown:
728 {
729 if ( mpImpl->getMouseListeners().getLength() )
730 {
731 awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( *static_cast<MouseEvent*>(rVclWindowEvent.GetData()), *this ) );
732 Callback aCallback = [ this, aEvent ]()
733 { this->mpImpl->getMouseListeners().mousePressed( aEvent ); };
735 }
736 }
737 break;
738 case VclEventId::WindowMouseButtonUp:
739 {
740 if ( mpImpl->getMouseListeners().getLength() )
741 {
742 awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( *static_cast<MouseEvent*>(rVclWindowEvent.GetData()), *this ) );
743
744 Callback aCallback = [ this, aEvent ]()
745 { this->mpImpl->getMouseListeners().mouseReleased( aEvent ); };
747 }
748 }
749 break;
750 case VclEventId::WindowStartDocking:
751 {
752 if ( mpImpl->getDockableWindowListeners().getLength() )
753 {
754 DockingData *pData = static_cast<DockingData*>(rVclWindowEvent.GetData());
755
756 if( pData )
757 {
758 css::awt::DockingEvent aEvent;
759 aEvent.Source = static_cast<cppu::OWeakObject*>(this);
760 aEvent.TrackingRectangle = AWTRectangle( pData->maTrackRect );
761 aEvent.MousePos.X = pData->maMousePos.X();
762 aEvent.MousePos.Y = pData->maMousePos.Y();
763 aEvent.bLiveMode = false;
764 aEvent.bInteractive = true;
765
766 mpImpl->getDockableWindowListeners().notifyEach( &XDockableWindowListener::startDocking, aEvent );
767 }
768 }
769 }
770 break;
771 case VclEventId::WindowDocking:
772 {
773 if ( mpImpl->getDockableWindowListeners().getLength() )
774 {
775 DockingData *pData = static_cast<DockingData*>(rVclWindowEvent.GetData());
776
777 if( pData )
778 {
779 css::awt::DockingEvent aEvent;
780 aEvent.Source = static_cast<cppu::OWeakObject*>(this);
781 aEvent.TrackingRectangle = AWTRectangle( pData->maTrackRect );
782 aEvent.MousePos.X = pData->maMousePos.X();
783 aEvent.MousePos.Y = pData->maMousePos.Y();
784 aEvent.bLiveMode = false;
785 aEvent.bInteractive = true;
786
787 Reference< XDockableWindowListener > xFirstListener;
788 ::comphelper::OInterfaceIteratorHelper3 aIter( mpImpl->getDockableWindowListeners() );
789 while ( aIter.hasMoreElements() && !xFirstListener.is() )
790 {
791 xFirstListener = aIter.next();
792 }
793
794 css::awt::DockingData aDockingData =
795 xFirstListener->docking( aEvent );
796 pData->maTrackRect = VCLRectangle( aDockingData.TrackingRectangle );
797 pData->mbFloating = aDockingData.bFloating;
798 }
799 }
800 }
801 break;
802 case VclEventId::WindowEndDocking:
803 {
804 if ( mpImpl->getDockableWindowListeners().getLength() )
805 {
806 EndDockingData *pData = static_cast<EndDockingData*>(rVclWindowEvent.GetData());
807
808 if( pData )
809 {
810 css::awt::EndDockingEvent aEvent;
811 aEvent.Source = static_cast<cppu::OWeakObject*>(this);
812 aEvent.WindowRectangle = AWTRectangle( pData->maWindowRect );
813 aEvent.bFloating = pData->mbFloating;
814 aEvent.bCancelled = pData->mbCancelled;
815 mpImpl->getDockableWindowListeners().notifyEach( &XDockableWindowListener::endDocking, aEvent );
816 }
817 }
818 }
819 break;
820 case VclEventId::WindowPrepareToggleFloating:
821 {
822 if ( mpImpl->getDockableWindowListeners().getLength() )
823 {
824 sal_Bool *p_bFloating = static_cast<sal_Bool*>(rVclWindowEvent.GetData());
825
826 css::lang::EventObject aEvent;
827 aEvent.Source = static_cast<cppu::OWeakObject*>(this);
828
829 Reference< XDockableWindowListener > xFirstListener;
830 ::comphelper::OInterfaceIteratorHelper3 aIter( mpImpl->getDockableWindowListeners() );
831 while ( aIter.hasMoreElements() && !xFirstListener.is() )
832 {
833 xFirstListener = aIter.next();
834 }
835
836 *p_bFloating = xFirstListener->prepareToggleFloatingMode( aEvent );
837 }
838 }
839 break;
840 case VclEventId::WindowToggleFloating:
841 {
842 if ( mpImpl->getDockableWindowListeners().getLength() )
843 {
844 css::lang::EventObject aEvent;
845 aEvent.Source = static_cast<cppu::OWeakObject*>(this);
846 mpImpl->getDockableWindowListeners().notifyEach( &XDockableWindowListener::toggleFloatingMode, aEvent );
847 }
848 }
849 break;
850 case VclEventId::WindowEndPopupMode:
851 {
852 if ( mpImpl->getDockableWindowListeners().getLength() )
853 {
854 EndPopupModeData *pData = static_cast<EndPopupModeData*>(rVclWindowEvent.GetData());
855
856 if( pData )
857 {
858 css::awt::EndPopupModeEvent aEvent;
859 aEvent.Source = static_cast<cppu::OWeakObject*>(this);
860 aEvent.FloatingPosition.X = pData->maFloatingPos.X();
861 aEvent.FloatingPosition.Y = pData->maFloatingPos.Y();
862 aEvent.bTearoff = pData->mbTearoff;
863 mpImpl->getDockableWindowListeners().notifyEach( &XDockableWindowListener::endPopupMode, aEvent );
864 }
865 }
866 }
867 break;
868 default: break;
869 }
870}
871
872uno::Reference< accessibility::XAccessibleContext > VCLXWindow::CreateAccessibleContext()
873{
874 SolarMutexGuard aGuard;
875 if (mpImpl->mbDisposing)
876 return nullptr;
878}
879
881{
882 mpImpl->mbSynthesizingVCLEvent = _b;
883}
884
886{
887 return mpImpl->mbSynthesizingVCLEvent;
888}
889
891{
892 Size aSz = rOutSz;
893
894 VclPtr<vcl::Window> pWindow = GetWindow();
895 if ( pWindow )
896 {
897 sal_Int32 nLeft, nTop, nRight, nBottom;
898 pWindow->GetBorder( nLeft, nTop, nRight, nBottom );
899 aSz.AdjustWidth(nLeft+nRight );
900 aSz.AdjustHeight(nTop+nBottom );
901 }
902 return aSz;
903}
904
905
906// css::lang::Component
908{
909 SolarMutexGuard aGuard;
910
911 if ( mpImpl->mbDisposing )
912 return;
913
914 mpImpl->mbDisposing = true;
915
916 mpImpl->mxViewGraphics = nullptr;
917
918 mpImpl->disposing();
919
920 if ( VclPtr<vcl::Window> pWindow = GetWindow() )
921 {
922 pWindow->RemoveEventListener( LINK( this, VCLXWindow, WindowEventListener ) );
923 pWindow->SetWindowPeer( nullptr, nullptr );
924 pWindow->SetAccessible( nullptr );
925
926 SetOutputDevice( nullptr );
927 pWindow.disposeAndClear();
928 }
929
930 // #i14103# dispose the accessible context after the window has been destroyed,
931 // otherwise the old value in the child event fired in VCLXAccessibleComponent::ProcessWindowEvent()
932 // for VclEventId::WindowChildDestroyed contains a reference to an already disposed accessible object
933 try
934 {
935 css::uno::Reference< css::lang::XComponent > xComponent( mpImpl->mxAccessibleContext, css::uno::UNO_QUERY );
936 if ( xComponent.is() )
937 xComponent->dispose();
938 }
939 catch ( const css::uno::Exception& )
940 {
941 OSL_FAIL( "VCLXWindow::dispose: could not dispose the accessible context!" );
942 }
943 mpImpl->mxAccessibleContext.clear();
944}
945
946void VCLXWindow::addEventListener( const css::uno::Reference< css::lang::XEventListener >& rxListener )
947{
948 SolarMutexGuard aGuard;
949 if (mpImpl->mbDisposing) // called during dispose by accessibility stuff
950 return;
951 mpImpl->getEventListeners().addInterface( rxListener );
952}
953
954void VCLXWindow::removeEventListener( const css::uno::Reference< css::lang::XEventListener >& rxListener )
955{
956 SolarMutexGuard aGuard;
957 if (mpImpl->mbDisposing)
958 return;
959 mpImpl->getEventListeners().removeInterface( rxListener );
960}
961
962
963// css::awt::XWindow
964void VCLXWindow::setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags )
965{
966 SolarMutexGuard aGuard;
967 comphelper::ProfileZone aZone("setPosSize");
968
969 if ( GetWindow() )
970 {
971 if( vcl::Window::GetDockingManager()->IsDockable( GetWindow() ) )
973 else
974 GetWindow()->setPosSizePixel( X, Y, Width, Height, static_cast<PosSizeFlags>(Flags) );
975 }
976}
977
978css::awt::Rectangle VCLXWindow::getPosSize( )
979{
980 SolarMutexGuard aGuard;
981
982 css::awt::Rectangle aBounds;
983 if ( GetWindow() )
984 {
985 if( vcl::Window::GetDockingManager()->IsDockable( GetWindow() ) )
986 aBounds = AWTRectangle( vcl::Window::GetDockingManager()->GetPosSizePixel( GetWindow() ) );
987 else
988 aBounds = AWTRectangle( tools::Rectangle( GetWindow()->GetPosPixel(), GetWindow()->GetSizePixel() ) );
989 }
990
991 return aBounds;
992}
993
995{
996 SolarMutexGuard aGuard;
997
998 VclPtr<vcl::Window> pWindow = GetWindow();
999 if ( pWindow )
1000 {
1001 mpImpl->setDirectVisible( bVisible );
1002 pWindow->Show( bVisible && mpImpl->isEnableVisible() );
1003 }
1004}
1005
1007{
1008 SolarMutexGuard aGuard;
1009
1010 VclPtr<vcl::Window> pWindow = GetWindow();
1011 if ( pWindow )
1012 {
1013 pWindow->Enable( bEnable, false ); // #95824# without children!
1014 pWindow->EnableInput( bEnable );
1015 }
1016}
1017
1019{
1020 SolarMutexGuard aGuard;
1021
1022 if ( GetWindow() )
1023 GetWindow()->GrabFocus();
1024}
1025
1026void VCLXWindow::addWindowListener( const css::uno::Reference< css::awt::XWindowListener >& rxListener )
1027{
1028 SolarMutexGuard aGuard;
1029 if (mpImpl->mbDisposing)
1030 return;
1031
1032 mpImpl->getWindowListeners().addInterface( rxListener );
1033
1034 Reference< XWindowListener2 > xListener2( rxListener, UNO_QUERY );
1035 if ( xListener2.is() )
1036 mpImpl->getWindow2Listeners().addInterface( xListener2 );
1037
1038 // #100119# Get all resize events, even if height or width 0, or invisible
1039 if ( GetWindow() )
1041}
1042
1043void VCLXWindow::removeWindowListener( const css::uno::Reference< css::awt::XWindowListener >& rxListener )
1044{
1045 SolarMutexGuard aGuard;
1046
1047 if (mpImpl->mbDisposing)
1048 return;
1049
1050 Reference< XWindowListener2 > xListener2( rxListener, UNO_QUERY );
1051 if ( xListener2.is() )
1052 mpImpl->getWindow2Listeners().removeInterface( xListener2 );
1053
1054 mpImpl->getWindowListeners().removeInterface( rxListener );
1055}
1056
1057void VCLXWindow::addFocusListener( const css::uno::Reference< css::awt::XFocusListener >& rxListener )
1058{
1059 SolarMutexGuard aGuard;
1060 if (mpImpl->mbDisposing)
1061 return;
1062 mpImpl->getFocusListeners().addInterface( rxListener );
1063}
1064
1065void VCLXWindow::removeFocusListener( const css::uno::Reference< css::awt::XFocusListener >& rxListener )
1066{
1067 SolarMutexGuard aGuard;
1068 if (mpImpl->mbDisposing)
1069 return;
1070 mpImpl->getFocusListeners().removeInterface( rxListener );
1071}
1072
1073void VCLXWindow::addKeyListener( const css::uno::Reference< css::awt::XKeyListener >& rxListener )
1074{
1075 SolarMutexGuard aGuard;
1076 if (mpImpl->mbDisposing)
1077 return;
1078 mpImpl->getKeyListeners().addInterface( rxListener );
1079}
1080
1081void VCLXWindow::removeKeyListener( const css::uno::Reference< css::awt::XKeyListener >& rxListener )
1082{
1083 SolarMutexGuard aGuard;
1084 if (mpImpl->mbDisposing)
1085 return;
1086 mpImpl->getKeyListeners().removeInterface( rxListener );
1087}
1088
1089void VCLXWindow::addMouseListener( const css::uno::Reference< css::awt::XMouseListener >& rxListener )
1090{
1091 SolarMutexGuard aGuard;
1092 if (mpImpl->mbDisposing)
1093 return;
1094 mpImpl->getMouseListeners().addInterface( rxListener );
1095}
1096
1097void VCLXWindow::removeMouseListener( const css::uno::Reference< css::awt::XMouseListener >& rxListener )
1098{
1099 SolarMutexGuard aGuard;
1100 if (mpImpl->mbDisposing)
1101 return;
1102 mpImpl->getMouseListeners().removeInterface( rxListener );
1103}
1104
1105void VCLXWindow::addMouseMotionListener( const css::uno::Reference< css::awt::XMouseMotionListener >& rxListener )
1106{
1107 SolarMutexGuard aGuard;
1108 if (mpImpl->mbDisposing)
1109 return;
1110 mpImpl->getMouseMotionListeners().addInterface( rxListener );
1111}
1112
1113void VCLXWindow::removeMouseMotionListener( const css::uno::Reference< css::awt::XMouseMotionListener >& rxListener )
1114{
1115 SolarMutexGuard aGuard;
1116 if (mpImpl->mbDisposing)
1117 return;
1118 mpImpl->getMouseMotionListeners().removeInterface( rxListener );
1119}
1120
1121void VCLXWindow::addPaintListener( const css::uno::Reference< css::awt::XPaintListener >& rxListener )
1122{
1123 SolarMutexGuard aGuard;
1124 if (mpImpl->mbDisposing)
1125 return;
1126 mpImpl->getPaintListeners().addInterface( rxListener );
1127}
1128
1129void VCLXWindow::removePaintListener( const css::uno::Reference< css::awt::XPaintListener >& rxListener )
1130{
1131 SolarMutexGuard aGuard;
1132 if (mpImpl->mbDisposing)
1133 return;
1134 mpImpl->getPaintListeners().removeInterface( rxListener );
1135}
1136
1137// css::awt::XWindowPeer
1138css::uno::Reference< css::awt::XToolkit > VCLXWindow::getToolkit( )
1139{
1140 // no guard. nothing to guard here.
1141 // 82463 - 12/21/00 - fs
1143}
1144
1145void VCLXWindow::setPointer( const css::uno::Reference< css::awt::XPointer >& rxPointer )
1146{
1147 SolarMutexGuard aGuard;
1148
1149 VCLXPointer* pPointer = dynamic_cast<VCLXPointer*>( rxPointer.get() );
1150 if ( pPointer && GetWindow() )
1151 GetWindow()->SetPointer( pPointer->GetPointer() );
1152}
1153
1154void VCLXWindow::setBackground( sal_Int32 nColor )
1155{
1156 SolarMutexGuard aGuard;
1157
1158 if ( !GetWindow() )
1159 return;
1160
1161 Color aColor(ColorTransparency, nColor);
1162 GetWindow()->SetBackground( aColor );
1163 GetWindow()->SetControlBackground( aColor );
1164
1165 WindowType eWinType = GetWindow()->GetType();
1166 if ( ( eWinType == WindowType::WINDOW ) ||
1167 ( eWinType == WindowType::WORKWINDOW ) ||
1168 ( eWinType == WindowType::FLOATINGWINDOW ) )
1169 {
1170 GetWindow()->Invalidate();
1171 }
1172}
1173
1174void VCLXWindow::invalidate( sal_Int16 nInvalidateFlags )
1175{
1176 SolarMutexGuard aGuard;
1177
1178 if ( GetWindow() )
1179 GetWindow()->Invalidate( static_cast<InvalidateFlags>(nInvalidateFlags) );
1180}
1181
1182void VCLXWindow::invalidateRect( const css::awt::Rectangle& rRect, sal_Int16 nInvalidateFlags )
1183{
1184 SolarMutexGuard aGuard;
1185
1186 if ( GetWindow() )
1187 GetWindow()->Invalidate( VCLRectangle(rRect), static_cast<InvalidateFlags>(nInvalidateFlags) );
1188}
1189
1190
1191// css::awt::XVclWindowPeer
1192sal_Bool VCLXWindow::isChild( const css::uno::Reference< css::awt::XWindowPeer >& rxPeer )
1193{
1194 SolarMutexGuard aGuard;
1195
1196 bool bIsChild = false;
1197 VclPtr<vcl::Window> pWindow = GetWindow();
1198 if ( pWindow )
1199 {
1200 VclPtr<vcl::Window> pPeerWindow = VCLUnoHelper::GetWindow( rxPeer );
1201 bIsChild = pPeerWindow && pWindow->IsChild( pPeerWindow );
1202 }
1203
1204 return bIsChild;
1205}
1206
1208{
1209 SolarMutexGuard aGuard;
1210
1211 mpImpl->mbDesignMode = bOn;
1212}
1213
1215{
1216 SolarMutexGuard aGuard;
1217 return mpImpl->mbDesignMode;
1218}
1219
1221{
1222 SolarMutexGuard aGuard;
1223
1224 if ( GetWindow() )
1225 GetWindow()->EnableClipSiblings( bClip );
1226}
1227
1228void VCLXWindow::setForeground( sal_Int32 nColor )
1229{
1230 SolarMutexGuard aGuard;
1231
1232 if ( GetWindow() )
1233 {
1235 }
1236}
1237
1238void VCLXWindow::setControlFont( const css::awt::FontDescriptor& rFont )
1239{
1240 SolarMutexGuard aGuard;
1241
1242 if ( GetWindow() )
1243 GetWindow()->SetControlFont( VCLUnoHelper::CreateFont( rFont, GetWindow()->GetControlFont() ) );
1244}
1245
1246void VCLXWindow::getStyles( sal_Int16 nType, css::awt::FontDescriptor& Font, sal_Int32& ForegroundColor, sal_Int32& BackgroundColor )
1247{
1248 SolarMutexGuard aGuard;
1249
1250 if ( !GetWindow() )
1251 return;
1252
1253 const StyleSettings& rStyleSettings = GetWindow()->GetSettings().GetStyleSettings();
1254
1255 switch ( nType )
1256 {
1257 case css::awt::Style::FRAME:
1258 {
1260 ForegroundColor = sal_Int32(rStyleSettings.GetWindowTextColor());
1261 BackgroundColor = sal_Int32(rStyleSettings.GetWindowColor());
1262 }
1263 break;
1264 case css::awt::Style::DIALOG:
1265 {
1267 ForegroundColor = sal_Int32(rStyleSettings.GetDialogTextColor());
1268 BackgroundColor = sal_Int32(rStyleSettings.GetDialogColor());
1269 }
1270 break;
1271 default: OSL_FAIL( "VCLWindow::getStyles() - unknown Type" );
1272 }
1273}
1274
1275namespace toolkit
1276{
1277 static void setColorSettings( vcl::Window* _pWindow, const css::uno::Any& _rValue,
1278 void (StyleSettings::*pSetter)( const Color& ), const Color& (StyleSettings::*pGetter)( ) const )
1279 {
1280 sal_Int32 nColor = 0;
1281 if ( !( _rValue >>= nColor ) )
1282 nColor = sal_Int32((Application::GetSettings().GetStyleSettings().*pGetter)());
1283
1284 AllSettings aSettings = _pWindow->GetSettings();
1285 StyleSettings aStyleSettings = aSettings.GetStyleSettings();
1286
1287 (aStyleSettings.*pSetter)( Color( ColorTransparency, nColor ) );
1288
1289 aSettings.SetStyleSettings( aStyleSettings );
1290 _pWindow->SetSettings( aSettings, true );
1291 }
1292}
1293
1294// Terminated by BASEPROPERTY_NOTFOUND (or 0)
1295void VCLXWindow::PushPropertyIds( std::vector< sal_uInt16 > &rIds,
1296 int nFirstId, ...)
1297{
1298 va_list pVarArgs;
1299 va_start( pVarArgs, nFirstId );
1300
1301 for ( int nId = nFirstId; nId != BASEPROPERTY_NOTFOUND;
1302 nId = va_arg( pVarArgs, int ) )
1303 rIds.push_back( static_cast<sal_uInt16>(nId) );
1304
1305 va_end( pVarArgs );
1306}
1307
1308void VCLXWindow::ImplGetPropertyIds( std::vector< sal_uInt16 > &rIds, bool bWithDefaults )
1309{
1310 // These are common across ~all VCLXWindow derived classes
1311 if( bWithDefaults )
1312 PushPropertyIds( rIds,
1324 BASEPROPERTY_ENABLEVISIBLE, // for visibility
1326 0);
1327
1328 // lovely hack from:
1329 // void UnoControlModel::ImplRegisterProperty( sal_uInt16 nPropId )
1330 if( std::find(rIds.begin(), rIds.end(), BASEPROPERTY_FONTDESCRIPTOR) != rIds.end() )
1331 {
1332 // some properties are not included in the FontDescriptor, but every time
1333 // when we have a FontDescriptor we want to have these properties too.
1334 // => Easier to register the here, instead everywhere where I register the FontDescriptor...
1335
1336 rIds.push_back( BASEPROPERTY_TEXTCOLOR );
1337 rIds.push_back( BASEPROPERTY_TEXTLINECOLOR );
1338 rIds.push_back( BASEPROPERTY_FONTRELIEF );
1339 rIds.push_back( BASEPROPERTY_FONTEMPHASISMARK );
1340 }
1341}
1342
1343void VCLXWindow::GetPropertyIds( std::vector< sal_uInt16 >& _out_rIds )
1344{
1345 return ImplGetPropertyIds( _out_rIds, mpImpl->mbWithDefaultProps );
1346}
1347
1349{
1350 return mpImpl->getContainerListeners();
1351}
1352
1354{
1355 return mpImpl->getTopWindowListeners();
1356}
1357
1358namespace
1359{
1360 void lcl_updateWritingMode( vcl::Window& _rWindow, const sal_Int16 _nWritingMode, const sal_Int16 _nContextWritingMode )
1361 {
1362 bool bEnableRTL = false;
1363 switch ( _nWritingMode )
1364 {
1365 case WritingMode2::LR_TB: bEnableRTL = false; break;
1366 case WritingMode2::RL_TB: bEnableRTL = true; break;
1367 case WritingMode2::CONTEXT:
1368 {
1369 // consult our ContextWritingMode. If it has an explicit RTL/LTR value, then use
1370 // it. If it doesn't (but is CONTEXT itself), then just ask the parent window of our
1371 // own window for its RTL mode
1372 switch ( _nContextWritingMode )
1373 {
1374 case WritingMode2::LR_TB: bEnableRTL = false; break;
1375 case WritingMode2::RL_TB: bEnableRTL = true; break;
1376 case WritingMode2::CONTEXT:
1377 {
1378 const vcl::Window* pParent = _rWindow.GetParent();
1379 OSL_ENSURE( pParent, "lcl_updateWritingMode: cannot determine context's writing mode!" );
1380 if ( pParent )
1381 bEnableRTL = pParent->IsRTLEnabled();
1382 }
1383 break;
1384 }
1385 }
1386 break;
1387 default:
1388 OSL_FAIL( "lcl_updateWritingMode: unsupported WritingMode!" );
1389 } // switch ( nWritingMode )
1390
1391 _rWindow.EnableRTL( bEnableRTL );
1392 }
1393}
1394
1395void VCLXWindow::setProperty( const OUString& PropertyName, const css::uno::Any& Value )
1396{
1397 SolarMutexGuard aGuard;
1398
1399 VclPtr<vcl::Window> pWindow = GetWindow();
1400 if ( !pWindow )
1401 return;
1402
1403 bool bVoid = Value.getValueType().getTypeClass() == css::uno::TypeClass_VOID;
1404
1405 WindowType eWinType = pWindow->GetType();
1406 sal_uInt16 nPropType = GetPropertyId( PropertyName );
1407 switch ( nPropType )
1408 {
1410 {
1411 Control* pControl = dynamic_cast< Control* >( pWindow.get() );
1412 OSL_ENSURE( pControl, "VCLXWindow::setProperty( RefDevice ): need a Control for this!" );
1413 if ( !pControl )
1414 break;
1415 Reference< XDevice > xDevice( Value, UNO_QUERY );
1416 OutputDevice* pDevice = VCLUnoHelper::GetOutputDevice( xDevice );
1417 pControl->SetReferenceDevice( pDevice );
1418 }
1419 break;
1420
1422 {
1423 OSL_VERIFY( Value >>= mpImpl->mnContextWritingMode );
1424 if ( mpImpl->mnWritingMode == WritingMode2::CONTEXT )
1425 lcl_updateWritingMode( *pWindow, mpImpl->mnWritingMode, mpImpl->mnContextWritingMode );
1426 }
1427 break;
1428
1430 {
1431 bool bProperType = ( Value >>= mpImpl->mnWritingMode );
1432 OSL_ENSURE( bProperType, "VCLXWindow::setProperty( 'WritingMode' ): illegal value type!" );
1433 if ( bProperType )
1434 lcl_updateWritingMode( *pWindow, mpImpl->mnWritingMode, mpImpl->mnContextWritingMode );
1435 }
1436 break;
1437
1439 {
1440 sal_uInt16 nWheelBehavior( css::awt::MouseWheelBehavior::SCROLL_FOCUS_ONLY );
1441 OSL_VERIFY( Value >>= nWheelBehavior );
1442
1443 AllSettings aSettings = pWindow->GetSettings();
1444 MouseSettings aMouseSettings = aSettings.GetMouseSettings();
1445
1446 MouseWheelBehaviour nVclBehavior( MouseWheelBehaviour::FocusOnly );
1447 switch ( nWheelBehavior )
1448 {
1449 case css::awt::MouseWheelBehavior::SCROLL_DISABLED: nVclBehavior = MouseWheelBehaviour::Disable; break;
1450 case css::awt::MouseWheelBehavior::SCROLL_FOCUS_ONLY: nVclBehavior = MouseWheelBehaviour::FocusOnly; break;
1451 case css::awt::MouseWheelBehavior::SCROLL_ALWAYS: nVclBehavior = MouseWheelBehaviour::ALWAYS; break;
1452 default:
1453 OSL_FAIL( "VCLXWindow::setProperty( 'MouseWheelBehavior' ): illegal property value!" );
1454 }
1455
1456 aMouseSettings.SetWheelBehavior( nVclBehavior );
1457 aSettings.SetMouseSettings( aMouseSettings );
1458 pWindow->SetSettings( aSettings, true );
1459 }
1460 break;
1461
1463 {
1464 bool bEnable( true );
1465 OSL_VERIFY( Value >>= bEnable );
1466 pWindow->EnableNativeWidget( bEnable );
1467 }
1468 break;
1469
1471 {
1472 // set parent handle
1474 }
1475 break;
1476
1478 {
1479 bool b = bool();
1480 if ( Value >>= b )
1481 setEnable( b );
1482 }
1483 break;
1485 {
1486 bool b = false;
1487 if ( Value >>= b )
1488 {
1489 if( b != mpImpl->isEnableVisible() )
1490 {
1491 mpImpl->setEnableVisible( b );
1492 pWindow->Show( b && mpImpl->isDirectVisible() );
1493 }
1494 }
1495 }
1496 break;
1497 case BASEPROPERTY_TEXT:
1498 case BASEPROPERTY_LABEL:
1499 case BASEPROPERTY_TITLE:
1500 {
1501 OUString aText;
1502 if ( Value >>= aText )
1503 {
1504 switch (eWinType)
1505 {
1506 case WindowType::OKBUTTON:
1507 case WindowType::CANCELBUTTON:
1508 case WindowType::HELPBUTTON:
1509 // Standard Button: overwrite only if not empty.
1510 if (!aText.isEmpty())
1511 pWindow->SetText( aText );
1512 break;
1513
1514 default:
1515 pWindow->SetText( aText );
1516 break;
1517 }
1518 }
1519 }
1520 break;
1522 {
1523 OUString aText;
1524 if ( Value >>= aText )
1525 pWindow->SetAccessibleName( aText );
1526 }
1527 break;
1529 {
1530 OUString aURL;
1531 if ( Value >>= aURL )
1532 {
1533 INetURLObject aHelpURL( aURL );
1534 if ( aHelpURL.GetProtocol() == INetProtocol::Hid )
1535 pWindow->SetHelpId( aHelpURL.GetURLPath() );
1536 else
1537 pWindow->SetHelpId( aURL );
1538 }
1539 }
1540 break;
1542 {
1543 OUString aHelpText;
1544 if ( Value >>= aHelpText )
1545 {
1546 pWindow->SetQuickHelpText( aHelpText );
1547 }
1548 }
1549 break;
1551 {
1552 if ( bVoid )
1553 pWindow->SetControlFont( vcl::Font() );
1554 else
1555 {
1556 css::awt::FontDescriptor aFont;
1557 if ( Value >>= aFont )
1558 pWindow->SetControlFont( VCLUnoHelper::CreateFont( aFont, pWindow->GetControlFont() ) );
1559 }
1560 }
1561 break;
1563 {
1564 sal_Int16 n = sal_Int16();
1565 if ( Value >>= n )
1566 {
1567 vcl::Font aFont = pWindow->GetControlFont();
1568 aFont.SetRelief( static_cast<FontRelief>(n) );
1569 pWindow->SetControlFont( aFont );
1570 }
1571 }
1572 break;
1574 {
1575 sal_Int16 n = sal_Int16();
1576 if ( Value >>= n )
1577 {
1578 vcl::Font aFont = pWindow->GetControlFont();
1579 aFont.SetEmphasisMark( static_cast<FontEmphasisMark>(n) );
1580 pWindow->SetControlFont( aFont );
1581 }
1582 }
1583 break;
1585 if ( bVoid )
1586 {
1587 switch ( eWinType )
1588 {
1589 // set dialog color for default
1590 case WindowType::DIALOG:
1591 case WindowType::MESSBOX:
1592 case WindowType::INFOBOX:
1593 case WindowType::WARNINGBOX:
1594 case WindowType::ERRORBOX:
1595 case WindowType::QUERYBOX:
1596 case WindowType::TABPAGE:
1597 {
1598 Color aColor = pWindow->GetSettings().GetStyleSettings().GetDialogColor();
1599 pWindow->SetBackground( aColor );
1600 pWindow->SetControlBackground( aColor );
1601 break;
1602 }
1603
1604 case WindowType::FIXEDTEXT:
1605 case WindowType::CHECKBOX:
1606 case WindowType::RADIOBUTTON:
1607 case WindowType::GROUPBOX:
1608 case WindowType::FIXEDLINE:
1609 {
1610 // support transparency only for special controls
1611 pWindow->SetBackground();
1612 pWindow->SetControlBackground();
1613 pWindow->SetPaintTransparent( true );
1614 break;
1615 }
1616
1617 default:
1618 {
1619 // default code which enables transparency for
1620 // compound controls. It's not real transparency
1621 // as most of these controls repaint their client
1622 // area completely new.
1623 if ( pWindow->IsCompoundControl() )
1624 pWindow->SetBackground();
1625 pWindow->SetControlBackground();
1626 break;
1627 }
1628 }
1629 }
1630 else
1631 {
1632 Color aColor;
1633 if ( Value >>= aColor )
1634 {
1635 pWindow->SetControlBackground( aColor );
1636 pWindow->SetBackground( aColor );
1637 switch ( eWinType )
1638 {
1639 // reset paint transparent mode
1640 case WindowType::FIXEDTEXT:
1641 case WindowType::CHECKBOX:
1642 case WindowType::RADIOBUTTON:
1643 case WindowType::GROUPBOX:
1644 case WindowType::FIXEDLINE:
1645 pWindow->SetPaintTransparent( false );
1646 break;
1647 default:
1648 break;
1649 }
1650 pWindow->Invalidate(); // Invalidate if control does not respond to it
1651 }
1652 }
1653 break;
1655 if ( bVoid )
1656 {
1657 pWindow->SetControlForeground();
1658 }
1659 else
1660 {
1661 Color nColor ;
1662 if ( Value >>= nColor )
1663 {
1664 pWindow->SetTextColor( nColor );
1665 pWindow->SetControlForeground( nColor );
1666 }
1667 }
1668 break;
1670 if ( bVoid )
1671 {
1672 pWindow->SetTextLineColor();
1673 }
1674 else
1675 {
1676 Color nColor;
1677 if ( Value >>= nColor )
1678 pWindow->SetTextLineColor( nColor );
1679 }
1680 break;
1682 if ( bVoid )
1683 pWindow->GetOutDev()->SetFillColor();
1684 else
1685 {
1686 Color nColor;
1687 if ( Value >>= nColor )
1688 pWindow->GetOutDev()->SetFillColor( nColor );
1689 }
1690 break;
1692 if ( bVoid )
1693 pWindow->GetOutDev()->SetLineColor();
1694 else
1695 {
1696 Color nColor;
1697 if ( Value >>= nColor )
1698 pWindow->GetOutDev()->SetLineColor( nColor );
1699 }
1700 break;
1702 {
1703 Color nColor = 0;
1704 if ( bVoid )
1705 {
1707 }
1708 else
1709 {
1710 if (!(Value >>= nColor))
1711 break;
1712 }
1713
1714 AllSettings aSettings(pWindow->GetSettings());
1715 StyleSettings aStyle(aSettings.GetStyleSettings());
1716 aStyle.SetHighlightColor(nColor);
1717 aSettings.SetStyleSettings(aStyle);
1718 pWindow->SetSettings(aSettings);
1719 }
1720 break;
1722 {
1723 Color nColor = 0;
1724 if (bVoid)
1725 {
1727 }
1728 else
1729 {
1730 if (!(Value >>= nColor))
1731 break;
1732 }
1733
1734 AllSettings aSettings(pWindow->GetSettings());
1735 StyleSettings aStyle(aSettings.GetStyleSettings());
1736 aStyle.SetHighlightTextColor(nColor);
1737 aSettings.SetStyleSettings(aStyle);
1738 pWindow->SetSettings(aSettings);
1739 }
1740 break;
1742 {
1743 WinBits nStyle = pWindow->GetStyle();
1744 sal_uInt16 nTmp = 0;
1745 Value >>= nTmp;
1746 // clear any dodgy bits passed in, can come from dodgy extensions
1748 WindowBorderStyle nBorder = static_cast<WindowBorderStyle>(nTmp);
1749 if ( !bool(nBorder) )
1750 {
1751 pWindow->SetStyle( nStyle & ~WB_BORDER );
1752 }
1753 else
1754 {
1755 pWindow->SetStyle( nStyle | WB_BORDER );
1756 pWindow->SetBorderStyle( nBorder );
1757 }
1758 }
1759 break;
1761 {
1762 WinBits nStyle = pWindow->GetStyle() & ~WB_TABSTOP;
1763 if ( !bVoid )
1764 {
1765 bool bTab = false;
1766 Value >>= bTab;
1767 if ( bTab )
1768 nStyle |= WB_TABSTOP;
1769 else
1770 nStyle |= WB_NOTABSTOP;
1771 }
1772 pWindow->SetStyle( nStyle );
1773 }
1774 break;
1776 {
1777 VerticalAlignment eAlign = css::style::VerticalAlignment::VerticalAlignment_MAKE_FIXED_SIZE;
1778 WinBits nStyle = pWindow->GetStyle();
1779 nStyle &= ~(WB_TOP|WB_VCENTER|WB_BOTTOM);
1780 if ( !bVoid )
1781 Value >>= eAlign;
1782 switch ( eAlign )
1783 {
1784 case VerticalAlignment_TOP:
1785 nStyle |= WB_TOP;
1786 break;
1787 case VerticalAlignment_MIDDLE:
1788 nStyle |= WB_VCENTER;
1789 break;
1790 case VerticalAlignment_BOTTOM:
1791 nStyle |= WB_BOTTOM;
1792 break;
1793 default: ; // for warning free code, MAKE_FIXED_SIZE
1794 }
1795 pWindow->SetStyle( nStyle );
1796 }
1797 break;
1798 case BASEPROPERTY_ALIGN:
1799 {
1800 sal_Int16 nAlign = PROPERTY_ALIGN_LEFT;
1801 switch ( eWinType )
1802 {
1803 case WindowType::COMBOBOX:
1804 case WindowType::PUSHBUTTON:
1805 case WindowType::OKBUTTON:
1806 case WindowType::CANCELBUTTON:
1807 case WindowType::HELPBUTTON:
1808 nAlign = PROPERTY_ALIGN_CENTER;
1809 [[fallthrough]];
1810 case WindowType::FIXEDTEXT:
1811 case WindowType::EDIT:
1812 case WindowType::MULTILINEEDIT:
1813 case WindowType::CHECKBOX:
1814 case WindowType::RADIOBUTTON:
1815 case WindowType::LISTBOX:
1816 {
1817 WinBits nStyle = pWindow->GetStyle();
1818 nStyle &= ~(WB_LEFT|WB_CENTER|WB_RIGHT);
1819 if ( !bVoid )
1820 Value >>= nAlign;
1821 if ( nAlign == PROPERTY_ALIGN_LEFT )
1822 nStyle |= WB_LEFT;
1823 else if ( nAlign == PROPERTY_ALIGN_CENTER )
1824 nStyle |= WB_CENTER;
1825 else
1826 nStyle |= WB_RIGHT;
1827 pWindow->SetStyle( nStyle );
1828 }
1829 break;
1830 default: break;
1831 }
1832 }
1833 break;
1835 {
1836 if ( ( eWinType == WindowType::FIXEDTEXT )
1837 || ( eWinType == WindowType::CHECKBOX )
1838 || ( eWinType == WindowType::RADIOBUTTON )
1839 || ( eWinType == WindowType::PUSHBUTTON )
1840 || ( eWinType == WindowType::OKBUTTON )
1841 || ( eWinType == WindowType::CANCELBUTTON )
1842 || ( eWinType == WindowType::HELPBUTTON )
1843 )
1844 {
1845 WinBits nStyle = pWindow->GetStyle();
1846 bool bMulti = false;
1847 Value >>= bMulti;
1848 if ( bMulti )
1849 nStyle |= WB_WORDBREAK;
1850 else
1851 nStyle &= ~WB_WORDBREAK;
1852 pWindow->SetStyle( nStyle );
1853 }
1854 }
1855 break;
1857 {
1858 if ( eWinType == WindowType::FIXEDLINE)
1859 {
1860 sal_Int32 nOrientation = 0;
1861 if ( Value >>= nOrientation )
1862 {
1863 WinBits nStyle = pWindow->GetStyle();
1864 nStyle &= ~(WB_HORZ|WB_VERT);
1865 if ( nOrientation == 0 )
1866 nStyle |= WB_HORZ;
1867 else
1868 nStyle |= WB_VERT;
1869
1870 pWindow->SetStyle( nStyle );
1871 }
1872 }
1873 }
1874 break;
1876 {
1877 bool bAutoMnemonics = false;
1878 Value >>= bAutoMnemonics;
1879 AllSettings aSettings = pWindow->GetSettings();
1880 StyleSettings aStyleSettings = aSettings.GetStyleSettings();
1881 if ( aStyleSettings.GetAutoMnemonic() != bAutoMnemonics )
1882 {
1883 aStyleSettings.SetAutoMnemonic( bAutoMnemonics );
1884 aSettings.SetStyleSettings( aStyleSettings );
1885 pWindow->SetSettings( aSettings );
1886 }
1887 }
1888 break;
1890 {
1891 bool bMouseTransparent = false;
1892 Value >>= bMouseTransparent;
1893 pWindow->SetMouseTransparent( bMouseTransparent );
1894 }
1895 break;
1897 {
1898 bool bPaintTransparent = false;
1899 Value >>= bPaintTransparent;
1900 pWindow->SetPaintTransparent( bPaintTransparent );
1901// pWindow->SetBackground();
1902 }
1903 break;
1904
1906 {
1907 bool bRepeat( false );
1908 Value >>= bRepeat;
1909
1910 WinBits nStyle = pWindow->GetStyle();
1911 if ( bRepeat )
1912 nStyle |= WB_REPEAT;
1913 else
1914 nStyle &= ~WB_REPEAT;
1915 pWindow->SetStyle( nStyle );
1916 }
1917 break;
1918
1920 {
1921 sal_Int32 nRepeatDelay = 0;
1922 if ( Value >>= nRepeatDelay )
1923 {
1924 AllSettings aSettings = pWindow->GetSettings();
1925 MouseSettings aMouseSettings = aSettings.GetMouseSettings();
1926
1927 aMouseSettings.SetButtonRepeat( nRepeatDelay );
1928 aSettings.SetMouseSettings( aMouseSettings );
1929
1930 pWindow->SetSettings( aSettings, true );
1931 }
1932 }
1933 break;
1934
1937 break;
1938
1941 break;
1942 }
1943}
1944
1945css::uno::Any VCLXWindow::getProperty( const OUString& PropertyName )
1946{
1947 SolarMutexGuard aGuard;
1948
1949 css::uno::Any aProp;
1950 if ( GetWindow() )
1951 {
1952 if (PropertyName == "ParentIs100thmm")
1953 {
1954 bool bParentIs100thmm = false;
1955 VclPtr<vcl::Window> pWindow = GetWindow();
1956 if (pWindow)
1957 {
1958 pWindow = pWindow->GetParent();
1959 if(pWindow && MapUnit::Map100thMM == pWindow->GetMapMode().GetMapUnit())
1960 {
1961 bParentIs100thmm = true;
1962 }
1963 }
1964 aProp <<= bParentIs100thmm;
1965 return aProp;
1966 }
1967 WindowType eWinType = GetWindow()->GetType();
1968 sal_uInt16 nPropType = GetPropertyId( PropertyName );
1969 switch ( nPropType )
1970 {
1972 {
1973 VclPtr<Control> pControl = GetAsDynamic<Control >();
1974 OSL_ENSURE( pControl, "VCLXWindow::setProperty( RefDevice ): need a Control for this!" );
1975 if ( !pControl )
1976 break;
1977
1979 pDevice->SetOutputDevice( pControl->GetReferenceDevice() );
1980 aProp <<= Reference< XDevice >( pDevice );
1981 }
1982 break;
1983
1985 aProp <<= mpImpl->mnContextWritingMode;
1986 break;
1987
1989 aProp <<= mpImpl->mnWritingMode;
1990 break;
1991
1993 {
1995 sal_uInt16 nBehavior = css::awt::MouseWheelBehavior::SCROLL_FOCUS_ONLY;
1996 switch ( nVclBehavior )
1997 {
1998 case MouseWheelBehaviour::Disable: nBehavior = css::awt::MouseWheelBehavior::SCROLL_DISABLED; break;
1999 case MouseWheelBehaviour::FocusOnly: nBehavior = css::awt::MouseWheelBehavior::SCROLL_FOCUS_ONLY; break;
2000 case MouseWheelBehaviour::ALWAYS: nBehavior = css::awt::MouseWheelBehavior::SCROLL_ALWAYS; break;
2001 default:
2002 OSL_FAIL( "VCLXWindow::getProperty( 'MouseWheelBehavior' ): illegal VCL value!" );
2003 }
2004 aProp <<= nBehavior;
2005 }
2006 break;
2007
2009 aProp <<= GetWindow()->IsNativeWidgetEnabled();
2010 break;
2011
2013 aProp <<= GetWindow()->IsEnabled();
2014 break;
2015
2017 aProp <<= mpImpl->isEnableVisible();
2018 break;
2019
2022 break;
2023
2024 case BASEPROPERTY_TEXT:
2025 case BASEPROPERTY_LABEL:
2026 case BASEPROPERTY_TITLE:
2027 {
2028 OUString aText = GetWindow()->GetText();
2029 aProp <<= aText;
2030 }
2031 break;
2033 {
2034 OUString aText = GetWindow()->GetAccessibleName();
2035 aProp <<= aText;
2036 }
2037 break;
2039 {
2040 OUString aText = GetWindow()->GetQuickHelpText();
2041 aProp <<= aText;
2042 }
2043 break;
2045 aProp <<= GetWindow()->GetHelpId();
2046 break;
2048 {
2049 vcl::Font aFont = GetWindow()->GetControlFont();
2050 css::awt::FontDescriptor aFD = VCLUnoHelper::CreateFontDescriptor( aFont );
2051 aProp <<= aFD;
2052 }
2053 break;
2055 aProp <<= GetWindow()->GetControlBackground();
2056 break;
2058 aProp <<= GetWindow()->GetBackgroundColor();
2059 break;
2061 aProp <<= static_cast<sal_Int16>(GetWindow()->GetControlFont().GetRelief());
2062 break;
2064 aProp <<= static_cast<sal_Int16>(GetWindow()->GetControlFont().GetEmphasisMark());
2065 break;
2067 aProp <<= GetWindow()->GetControlForeground();
2068 break;
2070 aProp <<= GetWindow()->GetTextLineColor();
2071 break;
2073 aProp <<= GetWindow()->GetOutDev()->GetFillColor();
2074 break;
2076 aProp <<= GetWindow()->GetOutDev()->GetLineColor();
2077 break;
2080 break;
2083 break;
2085 {
2086 WindowBorderStyle nBorder = WindowBorderStyle::NONE;
2087 if ( GetWindow()->GetStyle() & WB_BORDER )
2089 aProp <<= static_cast<sal_uInt16>(nBorder);
2090 }
2091 break;
2093 aProp <<= ( GetWindow()->GetStyle() & WB_TABSTOP ) != 0;
2094 break;
2096 {
2097 WinBits nStyle = GetWindow()->GetStyle();
2098 if ( nStyle & WB_TOP )
2099 aProp <<= VerticalAlignment_TOP;
2100 else if ( nStyle & WB_VCENTER )
2101 aProp <<= VerticalAlignment_MIDDLE;
2102 else if ( nStyle & WB_BOTTOM )
2103 aProp <<= VerticalAlignment_BOTTOM;
2104 }
2105 break;
2106 case BASEPROPERTY_ALIGN:
2107 {
2108 switch ( eWinType )
2109 {
2110 case WindowType::FIXEDTEXT:
2111 case WindowType::EDIT:
2112 case WindowType::MULTILINEEDIT:
2113 case WindowType::CHECKBOX:
2114 case WindowType::RADIOBUTTON:
2115 case WindowType::LISTBOX:
2116 case WindowType::COMBOBOX:
2117 case WindowType::PUSHBUTTON:
2118 case WindowType::OKBUTTON:
2119 case WindowType::CANCELBUTTON:
2120 case WindowType::HELPBUTTON:
2121 {
2122 WinBits nStyle = GetWindow()->GetStyle();
2123 if ( nStyle & WB_LEFT )
2124 aProp <<= sal_Int16(PROPERTY_ALIGN_LEFT);
2125 else if ( nStyle & WB_CENTER )
2126 aProp <<= sal_Int16(PROPERTY_ALIGN_CENTER);
2127 else if ( nStyle & WB_RIGHT )
2128 aProp <<= sal_Int16(PROPERTY_ALIGN_RIGHT);
2129 }
2130 break;
2131 default: break;
2132 }
2133 }
2134 break;
2136 {
2137 if ( ( eWinType == WindowType::FIXEDTEXT )
2138 || ( eWinType == WindowType::CHECKBOX )
2139 || ( eWinType == WindowType::RADIOBUTTON )
2140 || ( eWinType == WindowType::PUSHBUTTON )
2141 || ( eWinType == WindowType::OKBUTTON )
2142 || ( eWinType == WindowType::CANCELBUTTON )
2143 || ( eWinType == WindowType::HELPBUTTON )
2144 )
2145 aProp <<= ( GetWindow()->GetStyle() & WB_WORDBREAK ) != 0;
2146 }
2147 break;
2149 {
2150 bool bAutoMnemonics = GetWindow()->GetSettings().GetStyleSettings().GetAutoMnemonic();
2151 aProp <<= bAutoMnemonics;
2152 }
2153 break;
2155 {
2156 bool bMouseTransparent = GetWindow()->IsMouseTransparent();
2157 aProp <<= bMouseTransparent;
2158 }
2159 break;
2161 {
2162 bool bPaintTransparent = GetWindow()->IsPaintTransparent();
2163 aProp <<= bPaintTransparent;
2164 }
2165 break;
2166
2168 aProp <<= ( 0 != ( GetWindow()->GetStyle() & WB_REPEAT ) );
2169 break;
2170
2172 {
2173 sal_Int32 nButtonRepeat = GetWindow()->GetSettings().GetMouseSettings().GetButtonRepeat();
2174 aProp <<= nButtonRepeat;
2175 }
2176 break;
2177
2180 break;
2181
2184 break;
2185 }
2186 }
2187 return aProp;
2188}
2189
2190
2191// css::awt::XLayoutConstrains
2193{
2194 SolarMutexGuard aGuard;
2195
2196 // Use this method only for those components which can be created through
2197 // css::awt::Toolkit , but do not have an interface
2198
2199 Size aSz;
2200 if ( GetWindow() )
2201 {
2202 WindowType nWinType = GetWindow()->GetType();
2203 switch ( nWinType )
2204 {
2205 case WindowType::CONTROL:
2206 aSz.setWidth( GetWindow()->GetTextWidth( GetWindow()->GetText() )+2*12 );
2207 aSz.setHeight( GetWindow()->GetTextHeight()+2*6 );
2208 break;
2209
2210 case WindowType::PATTERNBOX:
2211 case WindowType::NUMERICBOX:
2212 case WindowType::METRICBOX:
2213 case WindowType::CURRENCYBOX:
2214 case WindowType::DATEBOX:
2215 case WindowType::TIMEBOX:
2216 case WindowType::LONGCURRENCYBOX:
2217 aSz.setWidth( GetWindow()->GetTextWidth( GetWindow()->GetText() )+2*2 );
2218 aSz.setHeight( GetWindow()->GetTextHeight()+2*2 );
2219 break;
2220 case WindowType::SCROLLBARBOX:
2222 default:
2223 aSz = GetWindow()->get_preferred_size();
2224 }
2225 }
2226
2227 return css::awt::Size( aSz.Width(), aSz.Height() );
2228}
2229
2231{
2232 return getMinimumSize();
2233}
2234
2235css::awt::Size VCLXWindow::calcAdjustedSize( const css::awt::Size& rNewSize )
2236{
2237 SolarMutexGuard aGuard;
2238
2239 css::awt::Size aNewSize( rNewSize );
2240 css::awt::Size aMinSize = getMinimumSize();
2241
2242 if ( aNewSize.Width < aMinSize.Width )
2243 aNewSize.Width = aMinSize.Width;
2244 if ( aNewSize.Height < aMinSize.Height )
2245 aNewSize.Height = aMinSize.Height;
2246
2247 return aNewSize;
2248}
2249
2250
2251// css::awt::XView
2252sal_Bool VCLXWindow::setGraphics( const css::uno::Reference< css::awt::XGraphics >& rxDevice )
2253{
2254 SolarMutexGuard aGuard;
2255
2256 if ( VCLUnoHelper::GetOutputDevice( rxDevice ) )
2257 mpImpl->mxViewGraphics = rxDevice;
2258 else
2259 mpImpl->mxViewGraphics = nullptr;
2260
2261 return mpImpl->mxViewGraphics.is();
2262}
2263
2264css::uno::Reference< css::awt::XGraphics > VCLXWindow::getGraphics( )
2265{
2266 SolarMutexGuard aGuard;
2267
2268 return mpImpl->mxViewGraphics;
2269}
2270
2271css::awt::Size VCLXWindow::getSize( )
2272{
2273 SolarMutexGuard aGuard;
2274
2275 Size aSz;
2276 if ( GetWindow() )
2277 aSz = GetWindow()->GetSizePixel();
2278 return css::awt::Size( aSz.Width(), aSz.Height() );
2279}
2280
2281void VCLXWindow::draw( sal_Int32 nX, sal_Int32 nY )
2282{
2283 SolarMutexGuard aGuard;
2284
2285 VclPtr<vcl::Window> pWindow = GetWindow();
2286 if ( !pWindow )
2287 return;
2288
2289 if ( !(isDesignMode() || mpImpl->isEnableVisible()) )
2290 return;
2291
2292 OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( mpImpl->mxViewGraphics );
2293 if (!pDev)
2294 pDev = pWindow->GetParent()->GetOutDev();
2295 TabPage* pTabPage = dynamic_cast< TabPage* >( pWindow.get() );
2296 if ( pTabPage )
2297 {
2298 Point aPos( nX, nY );
2299 aPos = pDev->PixelToLogic( aPos );
2300 pTabPage->Draw( pDev, aPos, SystemTextColorFlags::NONE );
2301 return;
2302 }
2303
2304 Point aPos( nX, nY );
2305
2306 if ( pWindow->GetParent() && !pWindow->IsSystemWindow() && ( pWindow->GetParent()->GetOutDev() == pDev ) )
2307 {
2308 // #i40647# don't draw here if this is a recursive call
2309 // sometimes this is called recursively, because the Update call on the parent
2310 // (strangely) triggers another paint. Prevent a stack overflow here
2311 // Yes, this is only fixing symptoms for the moment...
2312 // #i40647# / 2005-01-18 / frank.schoenheit@sun.com
2313 if ( !mpImpl->getDrawingOntoParent_ref() )
2314 {
2315 ::comphelper::FlagGuard aDrawingflagGuard( mpImpl->getDrawingOntoParent_ref() );
2316
2317 bool bWasVisible = pWindow->IsVisible();
2318 Point aOldPos( pWindow->GetPosPixel() );
2319
2320 if ( bWasVisible && aOldPos == aPos )
2321 {
2322 pWindow->PaintImmediately();
2323 return;
2324 }
2325
2326 pWindow->SetPosPixel( aPos );
2327
2328 // Update parent first to avoid painting the parent upon the update
2329 // of this window, as it may otherwise cause the parent
2330 // to hide this window again
2331 if( pWindow->GetParent() )
2332 pWindow->GetParent()->PaintImmediately();
2333
2334 pWindow->Show();
2335 pWindow->PaintImmediately();
2336 pWindow->SetParentUpdateMode( false );
2337 pWindow->Hide();
2338 pWindow->SetParentUpdateMode( true );
2339
2340 pWindow->SetPosPixel( aOldPos );
2341 if ( bWasVisible )
2342 pWindow->Show();
2343 }
2344 }
2345 else if ( pDev )
2346 {
2347 Point aP = pDev->PixelToLogic( aPos );
2348
2349 vcl::PDFExtOutDevData* pPDFExport = dynamic_cast<vcl::PDFExtOutDevData*>(pDev->GetExtOutDevData());
2350 bool bDrawSimple = ( pDev->GetOutDevType() == OUTDEV_PRINTER )
2351 || ( pDev->GetOutDevViewType() == OutDevViewType::PrintPreview )
2352 || ( pPDFExport != nullptr );
2353 if ( bDrawSimple )
2354 {
2355 pWindow->Draw( pDev, aP, SystemTextColorFlags::NoControls );
2356 }
2357 else
2358 {
2359 bool bOldNW =pWindow->IsNativeWidgetEnabled();
2360 if( bOldNW )
2361 pWindow->EnableNativeWidget(false);
2362 pWindow->PaintToDevice( pDev, aP );
2363 if( bOldNW )
2364 pWindow->EnableNativeWidget();
2365 }
2366 }
2367}
2368
2369void VCLXWindow::setZoom( float fZoomX, float /*fZoomY*/ )
2370{
2371 SolarMutexGuard aGuard;
2372
2373 if ( GetWindow() )
2374 {
2375 // Fraction::Fraction takes a double, but we have a float only.
2376 // The implicit conversion from float to double can result in a precision loss, i.e. 1.2 is converted to
2377 // 1.200000000047something. To prevent this, we convert explicitly to double, and round it.
2378 double nZoom( fZoomX );
2379 Fraction aZoom(::rtl::math::round(nZoom, 4));
2380 aZoom.ReduceInaccurate(10); // to avoid runovers and BigInt mapping
2381 GetWindow()->SetZoom(aZoom);
2382 }
2383}
2384
2385// css::lang::XEventListener
2386void SAL_CALL VCLXWindow::disposing( const css::lang::EventObject& _rSource )
2387{
2388 SolarMutexGuard aGuard;
2389
2390 if (mpImpl->mbDisposing)
2391 return;
2392
2393 // check if it comes from our AccessibleContext
2394 uno::Reference< uno::XInterface > aAC( mpImpl->mxAccessibleContext, uno::UNO_QUERY );
2395 uno::Reference< uno::XInterface > xSource( _rSource.Source, uno::UNO_QUERY );
2396
2397 if ( aAC.get() == xSource.get() )
2398 { // yep, it does
2399 mpImpl->mxAccessibleContext.clear();
2400 }
2401}
2402
2403// css::accessibility::XAccessible
2404css::uno::Reference< css::accessibility::XAccessibleContext > VCLXWindow::getAccessibleContext( )
2405{
2406 SolarMutexGuard aGuard;
2407
2408 // already disposed
2409 if (mpImpl->mbDisposing)
2410 return uno::Reference< accessibility::XAccessibleContext >();
2411
2412 if ( !mpImpl->mxAccessibleContext.is() && GetWindow() )
2413 {
2414 mpImpl->mxAccessibleContext = CreateAccessibleContext();
2415
2416 // add as event listener to this component
2417 // in case somebody disposes it, we do not want to have a (though weak) reference to a dead
2418 // object
2419 uno::Reference< lang::XComponent > xComp( mpImpl->mxAccessibleContext, uno::UNO_QUERY );
2420 if ( xComp.is() )
2421 xComp->addEventListener( this );
2422 }
2423
2424 return mpImpl->mxAccessibleContext;
2425}
2426
2427// css::awt::XDockable
2428void SAL_CALL VCLXWindow::addDockableWindowListener( const css::uno::Reference< css::awt::XDockableWindowListener >& xListener )
2429{
2430 SolarMutexGuard aGuard;
2431
2432 if (!mpImpl->mbDisposing && xListener.is() )
2433 mpImpl->getDockableWindowListeners().addInterface( xListener );
2434
2435}
2436
2437void SAL_CALL VCLXWindow::removeDockableWindowListener( const css::uno::Reference< css::awt::XDockableWindowListener >& xListener )
2438{
2439 SolarMutexGuard aGuard;
2440
2441 if (!mpImpl->mbDisposing)
2442 mpImpl->getDockableWindowListeners().removeInterface( xListener );
2443}
2444
2445void SAL_CALL VCLXWindow::enableDocking( sal_Bool bEnable )
2446{
2447 SolarMutexGuard aGuard;
2448
2449 VclPtr<vcl::Window> pWindow = GetWindow();
2450 if ( pWindow )
2451 pWindow->EnableDocking( bEnable );
2452}
2453
2455{
2456 SolarMutexGuard aGuard;
2457
2458 VclPtr<vcl::Window> pWindow = GetWindow();
2459 if( pWindow )
2460 return vcl::Window::GetDockingManager()->IsFloating( pWindow );
2461 else
2462 return false;
2463}
2464
2465void SAL_CALL VCLXWindow::setFloatingMode( sal_Bool bFloating )
2466{
2467 SolarMutexGuard aGuard;
2468
2469 VclPtr<vcl::Window> pWindow = GetWindow();
2470 if( pWindow )
2471 vcl::Window::GetDockingManager()->SetFloatingMode( pWindow, bFloating );
2472}
2473
2475{
2476 SolarMutexGuard aGuard;
2477
2478 VclPtr<vcl::Window> pWindow = GetWindow();
2479 if( pWindow )
2480 return vcl::Window::GetDockingManager()->IsLocked( pWindow );
2481 else
2482 return false;
2483}
2484
2485void SAL_CALL VCLXWindow::lock( )
2486{
2487 SolarMutexGuard aGuard;
2488
2489 VclPtr<vcl::Window> pWindow = GetWindow();
2490 if( pWindow && !vcl::Window::GetDockingManager()->IsFloating( pWindow ) )
2492}
2493
2494void SAL_CALL VCLXWindow::unlock( )
2495{
2496 SolarMutexGuard aGuard;
2497
2498 VclPtr<vcl::Window> pWindow = GetWindow();
2499 if( pWindow && !vcl::Window::GetDockingManager()->IsFloating( pWindow ) )
2501}
2502
2503void SAL_CALL VCLXWindow::startPopupMode( const css::awt::Rectangle& )
2504{
2505 // deprecated
2506}
2507
2509{
2510 // deprecated
2511 return false;
2512}
2513
2514
2515// css::awt::XWindow2
2516
2517void SAL_CALL VCLXWindow::setOutputSize( const css::awt::Size& aSize )
2518{
2519 SolarMutexGuard aGuard;
2520 if( VclPtr<vcl::Window> pWindow = GetWindow() )
2521 pWindow->SetOutputSizePixel( VCLSize( aSize ) );
2522}
2523
2524css::awt::Size SAL_CALL VCLXWindow::getOutputSize( )
2525{
2526 SolarMutexGuard aGuard;
2527 if( VclPtr<vcl::Window> pWindow = GetWindow() )
2528 return AWTSize( pWindow->GetOutputSizePixel() );
2529 else
2530 return css::awt::Size();
2531}
2532
2534{
2535 SolarMutexGuard aGuard;
2536 if( GetWindow() )
2537 return GetWindow()->IsVisible();
2538 else
2539 return false;
2540}
2541
2543{
2544 SolarMutexGuard aGuard;
2545 if( GetWindow() )
2546 return GetWindow()->IsActive();
2547 else
2548 return false;
2549
2550}
2551
2553{
2554 SolarMutexGuard aGuard;
2555 if( GetWindow() )
2556 return GetWindow()->IsEnabled();
2557 else
2558 return false;
2559}
2560
2562{
2563 SolarMutexGuard aGuard;
2564 if( GetWindow() )
2565 return GetWindow()->HasFocus();
2566 else
2567 return false;
2568}
2569
2570// css::beans::XPropertySetInfo
2571
2574{
2575 SolarMutexGuard aGuard;
2576 if ( mpImpl->mpPropHelper == nullptr )
2577 {
2578 std::vector< sal_uInt16 > aIDs;
2579 GetPropertyIds( aIDs );
2580 mpImpl->mpPropHelper.reset( new UnoPropertyArrayHelper( aIDs ) );
2581 }
2582 return mpImpl->mpPropHelper.get();
2583}
2584
2585css::uno::Sequence< css::beans::Property > SAL_CALL
2587{
2588 return GetPropHelper()->getProperties();
2589}
2590css::beans::Property SAL_CALL
2591VCLXWindow::getPropertyByName( const OUString& rName )
2592{
2593 return GetPropHelper()->getPropertyByName( rName );
2594}
2595
2596sal_Bool SAL_CALL
2597VCLXWindow::hasPropertyByName( const OUString& rName )
2598{
2599 return GetPropHelper()->hasPropertyByName( rName );
2600}
2601
2602Reference< XStyleSettings > SAL_CALL VCLXWindow::getStyleSettings()
2603{
2604 return mpImpl->getStyleSettings();
2605}
2606
2608{
2609 return mpImpl->mbDisposing;
2610}
2611
2612/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
AnyEventRef aEvent
const MouseSettings & GetMouseSettings() const
void SetMouseSettings(const MouseSettings &rSet)
const StyleSettings & GetStyleSettings() const
void SetStyleSettings(const StyleSettings &rSet)
static css::uno::Reference< css::awt::XToolkit > GetVCLToolkit()
static const AllSettings & GetSettings()
static ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
static void RemoveUserEvent(ImplSVEvent *nUserEvent)
static vcl::Window * GetFocusWindow()
CommandEventId GetCommand() const
bool IsMouseEvent() const
void SetReferenceDevice(OutputDevice *_referenceDevice)
void Lock(const vcl::Window *pWin)
bool IsFloating(const vcl::Window *pWin)
void Unlock(const vcl::Window *pWin)
void SetFloatingMode(const vcl::Window *pWin, bool bFloating)
void SetPosSizePixel(vcl::Window const *pWin, tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, PosSizeFlags nFlags)
bool IsLocked(const vcl::Window *pWin)
void ReduceInaccurate(unsigned nSignificantBits)
OUString GetURLPath(DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
INetProtocol GetProtocol() const
bool IsEnterWindow() const
MouseEventModifiers GetMode() const
bool IsLeaveWindow() const
sal_Int32 GetButtonRepeat() const
void SetWheelBehavior(MouseWheelBehaviour nBehavior)
MouseWheelBehaviour GetWheelBehavior() const
void SetButtonRepeat(sal_Int32 nRepeat)
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
vcl::ExtOutDevData * GetExtOutDevData() const
OutDevViewType GetOutDevViewType() const
const Color & GetLineColor() const
OutDevType GetOutDevType() const
const Color & GetFillColor() const
constexpr tools::Long Y() const
constexpr tools::Long X() const
constexpr tools::Long Height() const
tools::Long AdjustHeight(tools::Long n)
void setWidth(tools::Long nWidth)
tools::Long AdjustWidth(tools::Long n)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
const Color & GetMonoColor() const
const Color & GetWindowColor() const
const Color & GetDialogTextColor() const
bool GetHighContrastMode() const
void SetHighlightTextColor(const Color &rColor)
const Color & GetWindowTextColor() const
void SetAutoMnemonic(bool bAutoMnemonic)
void SetHighlightColor(const Color &rColor)
void SetMonoColor(const Color &rColor)
const Color & GetDialogColor() const
void SetButtonTextColor(const Color &rColor)
const Color & GetHighlightColor() const
const vcl::Font & GetAppFont() const
bool GetAutoMnemonic() const
const Color & GetHighlightTextColor() const
const Color & GetButtonTextColor() const
virtual void Draw(OutputDevice *pDev, const Point &rPos, SystemTextColorFlags nFlags) override
sal_Bool SAL_CALL hasPropertyByName(const OUString &rPropertyName) override
css::uno::Sequence< css::beans::Property > SAL_CALL getProperties() override
css::beans::Property SAL_CALL getPropertyByName(const OUString &rPropertyName) override
static css::awt::FontDescriptor CreateFontDescriptor(const vcl::Font &rFont)
convert Font to css::awt::FontDescriptor
static css::awt::KeyEvent createKeyEvent(const ::KeyEvent &_rVclEvent, const css::uno::Reference< css::uno::XInterface > &_rxContext)
static OutputDevice * GetOutputDevice(const css::uno::Reference< css::awt::XDevice > &rxDevice)
static css::awt::MouseEvent createMouseEvent(const ::MouseEvent &_rVclEvent, const css::uno::Reference< css::uno::XInterface > &_rxContext)
static vcl::Font CreateFont(const css::awt::FontDescriptor &rDescr, const vcl::Font &rInitFont)
static vcl::Window * GetWindow(const css::uno::Reference< css::awt::XWindow > &rxWindow)
A UNO wrapper for the VCL OutputDevice.
Definition: vclxdevice.hxx:37
PointerStyle GetPointer() const
Definition: vclxpointer.hxx:44
static css::awt::Size implGetMinimumSize(vcl::Window const *p)
sal_Int16 mnWritingMode
Definition: vclxwindow.cxx:122
bool mbEnableVisible
Definition: vclxwindow.cxx:96
CallbackArray maCallbackEvents
Definition: vclxwindow.cxx:112
bool isDirectVisible() const
Definition: vclxwindow.cxx:156
bool mbWithDefaultProps
Definition: vclxwindow.cxx:119
PaintListenerMultiplexer maPaintListeners
Definition: vclxwindow.cxx:108
TopWindowListenerMultiplexer maTopWindowListeners
Definition: vclxwindow.cxx:110
::toolkit::AccessibilityClient & getAccessibleFactory()
Definition: vclxwindow.cxx:166
::std::vector< VCLXWindow::Callback > CallbackArray
Definition: vclxwindow.cxx:89
WindowListenerMultiplexer & getWindowListeners()
Definition: vclxwindow.cxx:179
::osl::Mutex maListenerContainerMutex
Definition: vclxwindow.cxx:99
::comphelper::OInterfaceContainerHelper3< XDockableWindowListener > maDockableWindowListeners
Definition: vclxwindow.cxx:101
bool mbDirectVisible
Definition: vclxwindow.cxx:97
VCLXWindowImpl(VCLXWindow &_rAntiImpl, bool _bWithDefaultProps)
ctor
Definition: vclxwindow.cxx:192
::comphelper::OInterfaceContainerHelper3< XDockableWindowListener > & getDockableWindowListeners()
Definition: vclxwindow.cxx:176
FocusListenerMultiplexer & getFocusListeners()
Definition: vclxwindow.cxx:178
WindowListenerMultiplexer maWindowListeners
Definition: vclxwindow.cxx:104
Reference< XStyleSettings > getStyleSettings()
Definition: vclxwindow.cxx:302
const VCLXWindowImpl & operator=(const VCLXWindowImpl &)=delete
css::uno::Reference< css::awt::XGraphics > mxViewGraphics
Definition: vclxwindow.cxx:131
PaintListenerMultiplexer & getPaintListeners()
Definition: vclxwindow.cxx:183
TopWindowListenerMultiplexer & getTopWindowListeners()
Definition: vclxwindow.cxx:185
bool isEnableVisible() const
Definition: vclxwindow.cxx:152
::comphelper::OInterfaceContainerHelper3< css::awt::XWindowListener2 > maWindow2Listeners
Definition: vclxwindow.cxx:100
KeyListenerMultiplexer & getKeyListeners()
Definition: vclxwindow.cxx:180
EventListenerMultiplexer maEventListeners
Definition: vclxwindow.cxx:102
bool mbDrawingOntoParent
Definition: vclxwindow.cxx:95
MouseListenerMultiplexer maMouseListeners
Definition: vclxwindow.cxx:106
css::uno::Reference< css::awt::XStyleSettings > mxWindowStyleSettings
Definition: vclxwindow.cxx:133
MouseMotionListenerMultiplexer maMouseMotionListeners
Definition: vclxwindow.cxx:107
void disposing()
notifies the object that its VCLXWindow is being disposed
Definition: vclxwindow.cxx:220
void setEnableVisible(bool bEnableVisible)
synchronously mbEnableVisible
Definition: vclxwindow.cxx:151
css::uno::Reference< css::accessibility::XAccessibleContext > mxAccessibleContext
Definition: vclxwindow.cxx:129
std::unique_ptr< UnoPropertyArrayHelper > mpPropHelper
Definition: vclxwindow.cxx:126
KeyListenerMultiplexer maKeyListeners
Definition: vclxwindow.cxx:105
sal_Int16 mnContextWritingMode
Definition: vclxwindow.cxx:123
bool & getDrawingOntoParent_ref()
Definition: vclxwindow.cxx:136
MouseMotionListenerMultiplexer & getMouseMotionListeners()
Definition: vclxwindow.cxx:182
EventListenerMultiplexer & getEventListeners()
Definition: vclxwindow.cxx:177
MouseListenerMultiplexer & getMouseListeners()
Definition: vclxwindow.cxx:181
bool mbSynthesizingVCLEvent
Definition: vclxwindow.cxx:118
void callBackAsync(const VCLXWindow::Callback &i_callback)
impl-version of VCLXWindow::ImplExecuteAsyncWithoutSolarLock
Definition: vclxwindow.cxx:259
VCLXWindow & mrAntiImpl
Definition: vclxwindow.cxx:92
ImplSVEvent * mnCallbackEventId
Definition: vclxwindow.cxx:113
FocusListenerMultiplexer maFocusListeners
Definition: vclxwindow.cxx:103
sal_uLong mnListenerLockLevel
Definition: vclxwindow.cxx:121
void setDirectVisible(bool bDirectVisible)
synchronously mbDirectVisible;
Definition: vclxwindow.cxx:155
::comphelper::OInterfaceContainerHelper3< css::awt::XWindowListener2 > & getWindow2Listeners()
returns the container of registered XWindowListener2 listeners
Definition: vclxwindow.cxx:175
::toolkit::AccessibilityClient maAccFactory
Definition: vclxwindow.cxx:93
VclContainerListenerMultiplexer maContainerListeners
Definition: vclxwindow.cxx:109
VclContainerListenerMultiplexer & getContainerListeners()
Definition: vclxwindow.cxx:184
DECL_LINK(OnProcessCallbacks, void *, void)
VCLXWindowImpl(const VCLXWindowImpl &)=delete
void SAL_CALL addWindowListener(const css::uno::Reference< css::awt::XWindowListener > &rrxListener) override
void SAL_CALL removePaintListener(const css::uno::Reference< css::awt::XPaintListener > &rrxListener) override
void SAL_CALL setControlFont(const css::awt::FontDescriptor &aFont) override
virtual ~VCLXWindow() override
Definition: vclxwindow.cxx:334
void SAL_CALL setFocus() override
void suspendVclEventListening()
Definition: vclxwindow.cxx:373
void SAL_CALL setVisible(sal_Bool Visible) override
Definition: vclxwindow.cxx:994
css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext() override
UnoPropertyArrayHelper * GetPropHelper()
bool IsSynthesizingVCLEvent() const
Definition: vclxwindow.cxx:885
std::unique_ptr< VCLXWindowImpl > mpImpl
Definition: vclxwindow.hxx:76
ListenerMultiplexerBase< css::awt::XTopWindowListener > & GetTopWindowListeners()
css::awt::Size SAL_CALL getMinimumSize() override
virtual css::uno::Reference< css::accessibility::XAccessibleContext > CreateAccessibleContext()
Definition: vclxwindow.cxx:872
sal_Bool SAL_CALL isFloating() override
vcl::Window * GetWindow() const
Definition: vclxwindow.hxx:131
css::uno::Reference< css::awt::XToolkit > SAL_CALL getToolkit() override
void SAL_CALL addMouseListener(const css::uno::Reference< css::awt::XMouseListener > &rrxListener) override
virtual void ProcessWindowEvent(const VclWindowEvent &rVclWindowEvent)
Definition: vclxwindow.cxx:426
void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &rxListener) override
Definition: vclxwindow.cxx:954
void SAL_CALL setOutputSize(const css::awt::Size &aSize) override
void SAL_CALL setPosSize(sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags) override
Definition: vclxwindow.cxx:964
void SAL_CALL setPointer(const css::uno::Reference< css::awt::XPointer > &Pointer) override
bool IsDisposed() const
sal_Bool SAL_CALL hasPropertyByName(const OUString &Name) override
virtual void GetPropertyIds(std::vector< sal_uInt16 > &aIds)
void SAL_CALL invalidate(sal_Int16 Flags) override
ListenerMultiplexerBase< css::awt::XVclContainerListener > & GetContainerListeners()
void SAL_CALL removeMouseMotionListener(const css::uno::Reference< css::awt::XMouseMotionListener > &rrxListener) override
css::awt::Size SAL_CALL getSize() override
void SAL_CALL addKeyListener(const css::uno::Reference< css::awt::XKeyListener > &rrxListener) override
virtual void SetWindow(const VclPtr< vcl::Window > &pWindow)
Definition: vclxwindow.cxx:353
void SAL_CALL lock() override
void SAL_CALL addPaintListener(const css::uno::Reference< css::awt::XPaintListener > &rrxListener) override
void SAL_CALL addMouseMotionListener(const css::uno::Reference< css::awt::XMouseMotionListener > &rrxListener) override
void SAL_CALL startPopupMode(const css::awt::Rectangle &WindowRect) override
void SAL_CALL getStyles(sal_Int16 nType, css::awt::FontDescriptor &Font, sal_Int32 &ForegroundColor, sal_Int32 &BackgroundColor) override
void SAL_CALL setEnable(sal_Bool Enable) override
sal_Bool SAL_CALL isEnabled() override
Size ImplCalcWindowSize(const Size &rOutSz) const
Definition: vclxwindow.cxx:890
static void ImplGetPropertyIds(std::vector< sal_uInt16 > &aIds, bool bWithDefaults=false)
void SAL_CALL setDesignMode(sal_Bool bOn) override
void SAL_CALL invalidateRect(const css::awt::Rectangle &Rect, sal_Int16 Flags) override
css::awt::Rectangle SAL_CALL getPosSize() override
Definition: vclxwindow.cxx:978
sal_Bool SAL_CALL isVisible() override
virtual css::uno::Reference< css::awt::XStyleSettings > SAL_CALL getStyleSettings() override
void SAL_CALL removeKeyListener(const css::uno::Reference< css::awt::XKeyListener > &rrxListener) override
css::uno::Reference< css::awt::XGraphics > SAL_CALL getGraphics() override
css::awt::Size SAL_CALL getPreferredSize() override
void SAL_CALL setFloatingMode(sal_Bool bFloating) override
css::uno::Any SAL_CALL getProperty(const OUString &PropertyName) override
sal_Bool SAL_CALL isInPopupMode() override
void SAL_CALL unlock() override
void SAL_CALL enableDocking(sal_Bool bEnable) override
void SAL_CALL addDockableWindowListener(const css::uno::Reference< css::awt::XDockableWindowListener > &xListener) override
static void PushPropertyIds(std::vector< sal_uInt16 > &aIds, int nFirstId,...)
void SetSynthesizingVCLEvent(bool b)
Definition: vclxwindow.cxx:880
void SAL_CALL addFocusListener(const css::uno::Reference< css::awt::XFocusListener > &rrxListener) override
void SetSystemParent_Impl(const css::uno::Any &rHandle)
helper method to set a window handle into a SystemParentData struct
Definition: vclxwindow1.cxx:36
void resumeVclEventListening()
Definition: vclxwindow.cxx:378
void SAL_CALL setProperty(const OUString &PropertyName, const css::uno::Any &Value) override
sal_Bool SAL_CALL isLocked() override
sal_Bool SAL_CALL setGraphics(const css::uno::Reference< css::awt::XGraphics > &aDevice) override
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
::toolkit::IAccessibleFactory & getAccessibleFactory()
Definition: vclxwindow.cxx:348
css::beans::Property SAL_CALL getPropertyByName(const OUString &aName) override
void ImplExecuteAsyncWithoutSolarLock(const Callback &i_callback)
executes the given callback asynchronously
Definition: vclxwindow.cxx:340
void SAL_CALL setBackground(sal_Int32 Color) override
css::uno::Sequence< css::beans::Property > SAL_CALL getProperties() override
VCLXWindow(bool bWithDefaultProps=false)
Definition: vclxwindow.cxx:329
::std::function< void()> Callback
Definition: vclxwindow.hxx:106
void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &rxListener) override
Definition: vclxwindow.cxx:946
void SAL_CALL draw(sal_Int32 nX, sal_Int32 nY) override
void SAL_CALL removeDockableWindowListener(const css::uno::Reference< css::awt::XDockableWindowListener > &xListener) override
sal_Bool SAL_CALL hasFocus() override
css::awt::Size SAL_CALL calcAdjustedSize(const css::awt::Size &aNewSize) override
void SAL_CALL removeMouseListener(const css::uno::Reference< css::awt::XMouseListener > &rrxListener) override
sal_Bool SAL_CALL isDesignMode() override
css::awt::Size SAL_CALL getOutputSize() override
void SAL_CALL enableClipSiblings(sal_Bool bClip) override
void SAL_CALL removeWindowListener(const css::uno::Reference< css::awt::XWindowListener > &rrxListener) override
void SAL_CALL setZoom(float fZoomX, float fZoomY) override
void SAL_CALL setForeground(sal_Int32 Color) override
void SAL_CALL removeFocusListener(const css::uno::Reference< css::awt::XFocusListener > &rrxListener) override
sal_Bool SAL_CALL isChild(const css::uno::Reference< css::awt::XWindowPeer > &Peer) override
void SAL_CALL dispose() override
Definition: vclxwindow.cxx:907
void notifyWindowRemoved(vcl::Window const &_rWindow)
Definition: vclxwindow.cxx:384
sal_Bool SAL_CALL isActive() override
reference_type * get() const
VclEventId GetId() const
void * GetData() const
vcl::Window * GetWindow() const
void disposeAndClear(const css::lang::EventObject &rEvt)
css::uno::Reference< ListenerT > const & next()
a client for the accessibility implementations which have been outsourced from the main toolkit libra...
virtual css::uno::Reference< css::accessibility::XAccessibleContext > createAccessibleContext(VCLXButton *_pXWindow)=0
creates an accessible context for a button window
void SetRelief(FontRelief)
void SetEmphasisMark(FontEmphasisMark)
bool IsNativeWidgetEnabled() const
vcl::Window * GetParent() const
GetFocusFlags GetGetFocusFlags() const
void RemoveEventListener(const Link< VclWindowEvent &, void > &rEventListener)
void SetControlForeground()
void SetControlFont()
bool IsPaintTransparent() const
WindowType GetType() const
VCLXWindow * GetWindowPeer() const
static DockingManager * GetDockingManager()
void GetBorder(sal_Int32 &rLeftBorder, sal_Int32 &rTopBorder, sal_Int32 &rRightBorder, sal_Int32 &rBottomBorder) const
Size get_preferred_size() const
vcl::Window * GetWindow(GetWindowType nType) const
const Color & GetControlForeground() const
void GrabFocus()
bool IsCompoundControl() const
void SetControlBackground()
const Color & GetTextLineColor() const
bool HasFocus() const
virtual Point GetPosPixel() const
virtual void EnableRTL(bool bEnable=true)
WinBits GetStyle() const
const AllSettings & GetSettings() const
const OUString & GetHelpId() const
vcl::Font GetControlFont() const
::OutputDevice const * GetOutDev() const
virtual void setPosSizePixel(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, PosSizeFlags nFlags=PosSizeFlags::All)
Color GetBackgroundColor() const
void SetSettings(const AllSettings &rSettings)
void AddEventListener(const Link< VclWindowEvent &, void > &rEventListener)
void SetZoom(const Fraction &rZoom)
virtual css::uno::Reference< css::awt::XVclWindowPeer > GetComponentInterface(bool bCreate=true)
bool IsRTLEnabled() const
virtual Size GetSizePixel() const
WindowBorderStyle GetBorderStyle() const
const Color & GetControlBackground() const
virtual void SetPointer(PointerStyle)
void EnableAllResize()
OUString GetAccessibleName() const
void EnableClipSiblings(bool bClipSiblings=true)
bool IsVisible() const
void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
virtual OUString GetText() const
bool IsMenuFloatingWindow() const
const OUString & GetQuickHelpText() const
bool IsActive() const
bool IsEnabled() const
bool IsMouseTransparent() const
void SetBackground()
ColorTransparency
css::awt::Size AWTSize(const Size &rVCLSize)
Definition: convert.hxx:29
css::awt::Rectangle AWTRectangle(const ::tools::Rectangle &rVCLRect)
Definition: convert.hxx:49
inline ::tools::Rectangle VCLRectangle(const css::awt::Rectangle &rAWTRect)
Definition: convert.hxx:54
inline ::Size VCLSize(const css::awt::Size &rAWTSize)
Definition: convert.hxx:34
#define DBG_ASSERT(sCon, aError)
#define DBG_TESTSOLARMUTEX()
URL aURL
#define MOUSE_LEFT
FontRelief
FontEmphasisMark
sal_Int64 n
#define SAL_INFO(area, stream)
std::unique_ptr< sal_Int32[]> pData
Flags
tools::Long const nBorder
Value
static void setColorSettings(vcl::Window *_pWindow, const css::uno::Any &_rValue, void(StyleSettings::*pSetter)(const Color &), const Color &(StyleSettings::*pGetter)() const)
sal_Int16 nId
OUTDEV_PRINTER
#define Y
sal_uInt16 GetPropertyId(const OUString &rPropertyName)
Definition: property.cxx:278
#define BASEPROPERTY_MULTILINE
Definition: property.hxx:43
#define BASEPROPERTY_PLUGINPARENT
Definition: property.hxx:126
#define BASEPROPERTY_TEXTLINECOLOR
Definition: property.hxx:118
#define BASEPROPERTY_ACCESSIBLENAME
Definition: property.hxx:125
#define BASEPROPERTY_BORDER
Definition: property.hxx:39
#define BASEPROPERTY_PAINTTRANSPARENT
Definition: property.hxx:153
#define BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR
Definition: property.hxx:149
#define BASEPROPERTY_FILLCOLOR
Definition: property.hxx:36
#define BASEPROPERTY_NATIVE_WIDGET_LOOK
Definition: property.hxx:147
#define BASEPROPERTY_ORIENTATION
Definition: property.hxx:115
#define BASEPROPERTY_CONTEXT_WRITING_MODE
Definition: property.hxx:174
#define BASEPROPERTY_HIGHLIGHT_COLOR
Definition: property.hxx:205
#define BASEPROPERTY_TEXT
Definition: property.hxx:34
#define BASEPROPERTY_MOUSETRANSPARENT
Definition: property.hxx:124
#define BASEPROPERTY_TITLE
Definition: property.hxx:102
#define BASEPROPERTY_ALIGN
Definition: property.hxx:40
#define BASEPROPERTY_HELPURL
Definition: property.hxx:91
#define BASEPROPERTY_REPEAT
Definition: property.hxx:134
#define BASEPROPERTY_SYMBOL_COLOR
Definition: property.hxx:129
#define BASEPROPERTY_HIGHCONTRASTMODE
Definition: property.hxx:183
#define BASEPROPERTY_BACKGROUNDCOLOR
Definition: property.hxx:35
#define BASEPROPERTY_LINECOLOR
Definition: property.hxx:38
#define BASEPROPERTY_TABSTOP
Definition: property.hxx:47
#define BASEPROPERTY_FONTRELIEF
Definition: property.hxx:116
#define BASEPROPERTY_ENABLED
Definition: property.hxx:77
#define BASEPROPERTY_DEFAULTCONTROL
Definition: property.hxx:52
#define BASEPROPERTY_VERTICALALIGN
Definition: property.hxx:148
#define BASEPROPERTY_WRITING_MODE
Definition: property.hxx:173
#define BASEPROPERTY_AUTOMNEMONICS
Definition: property.hxx:123
#define BASEPROPERTY_HIGHLIGHT_TEXT_COLOR
Definition: property.hxx:206
#define BASEPROPERTY_LABEL
Definition: property.hxx:53
#define BASEPROPERTY_BORDERCOLOR
Definition: property.hxx:145
#define BASEPROPERTY_FONTDESCRIPTOR
Definition: property.hxx:41
#define PROPERTY_ALIGN_CENTER
Definition: property.hxx:231
#define BASEPROPERTY_DISPLAYBACKGROUNDCOLOR
Definition: property.hxx:122
#define BASEPROPERTY_ENABLEVISIBLE
Definition: property.hxx:180
#define BASEPROPERTY_HELPTEXT
Definition: property.hxx:106
#define BASEPROPERTY_REFERENCE_DEVICE
Definition: property.hxx:181
#define BASEPROPERTY_NOTFOUND
Definition: property.hxx:32
#define BASEPROPERTY_FONTEMPHASISMARK
Definition: property.hxx:117
#define BASEPROPERTY_REPEAT_DELAY
Definition: property.hxx:128
#define BASEPROPERTY_TEXTCOLOR
Definition: property.hxx:37
#define PROPERTY_ALIGN_LEFT
Definition: property.hxx:230
#define BASEPROPERTY_PRINTABLE
Definition: property.hxx:78
#define PROPERTY_ALIGN_RIGHT
Definition: property.hxx:232
QPRO_FUNC_TYPE nType
MouseWheelBehaviour
sal_uIntPtr sal_uLong
bool bVisible
unsigned char sal_Bool
WindowBorderStyle
IMPL_LINK_NOARG(VCLXWindowImpl, OnProcessCallbacks, void *, void)
Definition: vclxwindow.cxx:272
IMPL_LINK(VCLXWindow, WindowEventListener, VclWindowEvent &, rEvent, void)
Definition: vclxwindow.cxx:395
static void ImplInitWindowEvent(css::awt::WindowEvent &rEvent, vcl::Window const *pWindow)
Definition: vclxwindow.cxx:315
PosSizeFlags
InvalidateFlags
sal_Int64 WinBits
WinBits const WB_TOP
WinBits const WB_VCENTER
WinBits const WB_VERT
WinBits const WB_CENTER
WindowType
WinBits const WB_NOTABSTOP
WinBits const WB_REPEAT
WinBits const WB_HORZ
WinBits const WB_RIGHT
WinBits const WB_BORDER
WinBits const WB_WORDBREAK
WinBits const WB_TABSTOP
WinBits const WB_BOTTOM
WinBits const WB_LEFT