Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <i18npool/mslangid.hxx>
30 : :
31 : : #include "tools/time.hxx"
32 : : #include "tools/debug.hxx"
33 : : #include "tools/rc.h"
34 : :
35 : : #include "unotools/fontcfg.hxx"
36 : : #include "unotools/confignode.hxx"
37 : :
38 : : #include "vcl/unohelp.hxx"
39 : : #include "vcl/salgtype.hxx"
40 : : #include "vcl/event.hxx"
41 : : #include "vcl/help.hxx"
42 : : #include "vcl/cursor.hxx"
43 : : #include "vcl/svapp.hxx"
44 : : #include "vcl/window.hxx"
45 : : #include "vcl/syswin.hxx"
46 : : #include "vcl/syschild.hxx"
47 : : #include "vcl/dockwin.hxx"
48 : : #include "vcl/menu.hxx"
49 : : #include "vcl/wrkwin.hxx"
50 : : #include "vcl/wall.hxx"
51 : : #include "vcl/gradient.hxx"
52 : : #include "vcl/salctype.hxx"
53 : : #include "vcl/button.hxx"
54 : : #include "vcl/taskpanelist.hxx"
55 : : #include "vcl/dialog.hxx"
56 : : #include "vcl/unowrap.hxx"
57 : : #include "vcl/gdimtf.hxx"
58 : : #include "vcl/pdfextoutdevdata.hxx"
59 : : #include "vcl/lazydelete.hxx"
60 : : #include "vcl/virdev.hxx"
61 : :
62 : : // declare system types in sysdata.hxx
63 : : #include "svsys.h"
64 : : #include "vcl/sysdata.hxx"
65 : :
66 : : #include "salframe.hxx"
67 : : #include "salobj.hxx"
68 : : #include "salinst.hxx"
69 : : #include "salgdi.hxx"
70 : : #include "svdata.hxx"
71 : : #include "dbggui.hxx"
72 : : #include "outfont.hxx"
73 : : #include "window.h"
74 : : #include "toolbox.h"
75 : : #include "outdev.h"
76 : : #include "region.h"
77 : : #include "brdwin.hxx"
78 : : #include "helpwin.hxx"
79 : : #include "sallayout.hxx"
80 : : #include "dndlcon.hxx"
81 : : #include "dndevdis.hxx"
82 : :
83 : : #include "com/sun/star/awt/XWindowPeer.hpp"
84 : : #include "com/sun/star/rendering/XCanvas.hpp"
85 : : #include "com/sun/star/rendering/XSpriteCanvas.hpp"
86 : : #include "com/sun/star/awt/XWindow.hpp"
87 : : #include "comphelper/processfactory.hxx"
88 : : #include "com/sun/star/datatransfer/dnd/XDragSource.hpp"
89 : : #include "com/sun/star/datatransfer/dnd/XDropTarget.hpp"
90 : : #include "com/sun/star/datatransfer/clipboard/XClipboard.hpp"
91 : : #include "com/sun/star/awt/XTopWindow.hpp"
92 : : #include "com/sun/star/awt/XDisplayConnection.hpp"
93 : : #include "com/sun/star/lang/XInitialization.hpp"
94 : : #include "com/sun/star/lang/XComponent.hpp"
95 : : #include "com/sun/star/lang/XServiceName.hpp"
96 : : #include "com/sun/star/accessibility/XAccessible.hpp"
97 : : #include "com/sun/star/accessibility/AccessibleRole.hpp"
98 : :
99 : : #include <sal/macros.h>
100 : : #include <rtl/strbuf.hxx>
101 : :
102 : : #include <set>
103 : : #include <typeinfo>
104 : :
105 : : using namespace ::com::sun::star::uno;
106 : : using namespace ::com::sun::star::lang;
107 : : using namespace ::com::sun::star::datatransfer::clipboard;
108 : : using namespace ::com::sun::star::datatransfer::dnd;
109 : : using namespace ::com::sun::star;
110 : : using namespace com::sun;
111 : :
112 : : using ::rtl::OUString;
113 : :
114 : : using ::com::sun::star::awt::XTopWindow;
115 : :
116 : : // =======================================================================
117 : :
118 : : DBG_NAME( Window )
119 : :
120 : : // =======================================================================
121 : :
122 : : #define IMPL_PAINT_PAINT ((sal_uInt16)0x0001)
123 : : #define IMPL_PAINT_PAINTALL ((sal_uInt16)0x0002)
124 : : #define IMPL_PAINT_PAINTALLCHILDREN ((sal_uInt16)0x0004)
125 : : #define IMPL_PAINT_PAINTCHILDREN ((sal_uInt16)0x0008)
126 : : #define IMPL_PAINT_ERASE ((sal_uInt16)0x0010)
127 : : #define IMPL_PAINT_CHECKRTL ((sal_uInt16)0x0020)
128 : :
129 : : // -----------------------------------------------------------------------
130 : :
131 : : struct ImplCalcToTopData
132 : : {
133 : : ImplCalcToTopData* mpNext;
134 : : Window* mpWindow;
135 : : Region* mpInvalidateRegion;
136 : : };
137 : :
138 : 13443 : ImplAccessibleInfos::ImplAccessibleInfos()
139 : : {
140 : 13443 : nAccessibleRole = 0xFFFF;
141 : 13443 : pAccessibleName = NULL;
142 : 13443 : pAccessibleDescription = NULL;
143 : 13443 : pLabeledByWindow = NULL;
144 : 13443 : pLabelForWindow = NULL;
145 : 13443 : pMemberOfWindow = NULL;
146 : 13443 : }
147 : :
148 : 13406 : ImplAccessibleInfos::~ImplAccessibleInfos()
149 : : {
150 [ + + ]: 13406 : delete pAccessibleName;
151 [ + + ]: 13406 : delete pAccessibleDescription;
152 : 13406 : }
153 : :
154 : : // -----------------------------------------------------------------------
155 : :
156 [ + - ][ + - ]: 124176 : WindowImpl::WindowImpl()
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ]
157 : : {
158 : 124176 : }
159 : :
160 [ + - ][ + - ]: 120493 : WindowImpl::~WindowImpl()
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
161 : : {
162 : 120493 : }
163 : :
164 : :
165 : : // -----------------------------------------------------------------------
166 : :
167 : : // helper method to allow inline constructor even for pWindow!=NULL case
168 : 4807315 : void ImplDelData::AttachToWindow( const Window* pWindow )
169 : : {
170 [ + - ]: 4807315 : if( pWindow )
171 : 4807315 : const_cast<Window*>(pWindow)->ImplAddDel( this );
172 : 4807315 : }
173 : :
174 : : // -----------------------------------------------------------------------
175 : :
176 : : // define dtor for ImplDelData
177 : 6611886 : ImplDelData::~ImplDelData()
178 : : {
179 : : // #112873# auto remove of ImplDelData
180 : : // due to this code actively calling ImplRemoveDel() is not mandatory anymore
181 [ + - ][ + + ]: 6611886 : if( !mbDel && mpWindow )
182 : : {
183 : : // the window still exists but we were not removed
184 : 4807315 : const_cast<Window*>(mpWindow)->ImplRemoveDel( this );
185 : 4807315 : mpWindow = NULL;
186 : : }
187 [ - + ]: 6611886 : }
188 : :
189 : : // -----------------------------------------------------------------------
190 : :
191 : : #ifdef DBG_UTIL
192 : : const char* ImplDbgCheckWindow( const void* pObj )
193 : : {
194 : : DBG_TESTSOLARMUTEX();
195 : :
196 : : const Window* pWindow = (Window*)pObj;
197 : :
198 : : if ( (pWindow->GetType() < WINDOW_FIRST) || (pWindow->GetType() > WINDOW_LAST) )
199 : : return "Window data overwrite";
200 : :
201 : : // check window-chain
202 : : Window* pChild = pWindow->mpWindowImpl->mpFirstChild;
203 : : while ( pChild )
204 : : {
205 : : if ( pChild->mpWindowImpl->mpParent != pWindow )
206 : : return "Child-Window-Parent wrong";
207 : : pChild = pChild->mpWindowImpl->mpNext;
208 : : }
209 : :
210 : : return NULL;
211 : : }
212 : : #endif
213 : :
214 : : // =======================================================================
215 : :
216 : 127 : void Window::ImplInitAppFontData( Window* pWindow )
217 : : {
218 : 127 : ImplSVData* pSVData = ImplGetSVData();
219 : 127 : long nTextHeight = pWindow->GetTextHeight();
220 [ + - ][ + - ]: 127 : long nTextWidth = pWindow->GetTextWidth(rtl::OUString("aemnnxEM"));
[ + - ]
221 : 127 : long nSymHeight = nTextHeight*4;
222 : : // Make the basis wider if the font is too narrow
223 : : // such that the dialog looks symmetrical and does not become too narrow.
224 : : // Add some extra space when the dialog has the same width,
225 : : // as a little more space is better.
226 [ - + ]: 127 : if ( nSymHeight > nTextWidth )
227 : 0 : nTextWidth = nSymHeight;
228 [ - + ]: 127 : else if ( nSymHeight+5 > nTextWidth )
229 : 0 : nTextWidth = nSymHeight+5;
230 : 127 : pSVData->maGDIData.mnAppFontX = nTextWidth * 10 / 8;
231 : 127 : pSVData->maGDIData.mnAppFontY = nTextHeight * 10;
232 : :
233 : : // FIXME: this is currently only on aqua, check with other
234 : : // platforms
235 [ - + ]: 127 : if( pSVData->maNWFData.mbNoFocusRects )
236 : : {
237 : : // try to find out whether there is a large correction
238 : : // of control sizes, if yes, make app font scalings larger
239 : : // so dialog positioning is not completely off
240 : 0 : ImplControlValue aControlValue;
241 [ # # ]: 0 : Rectangle aCtrlRegion( Point(), Size( nTextWidth < 10 ? 10 : nTextWidth, nTextHeight < 10 ? 10 : nTextHeight ) );
242 : 0 : Rectangle aBoundingRgn( aCtrlRegion );
243 : 0 : Rectangle aContentRgn( aCtrlRegion );
244 [ # # ]: 0 : if( pWindow->GetNativeControlRegion( CTRL_EDITBOX, PART_ENTIRE_CONTROL, aCtrlRegion,
245 : : CTRL_STATE_ENABLED, aControlValue, rtl::OUString(),
246 [ # # ]: 0 : aBoundingRgn, aContentRgn ) )
247 : : {
248 : : // comment: the magical +6 is for the extra border in bordered
249 : : // (which is the standard) edit fields
250 [ # # ][ # # ]: 0 : if( aContentRgn.GetHeight() - nTextHeight > (nTextHeight+4)/4 )
251 [ # # ]: 0 : pSVData->maGDIData.mnAppFontY = (aContentRgn.GetHeight()-4) * 10;
252 [ # # ]: 0 : }
253 : : }
254 : :
255 : :
256 : 127 : pSVData->maGDIData.mnRealAppFontX = pSVData->maGDIData.mnAppFontX;
257 [ + - ]: 127 : if ( pSVData->maAppData.mnDialogScaleX )
258 : 127 : pSVData->maGDIData.mnAppFontX += (pSVData->maGDIData.mnAppFontX*pSVData->maAppData.mnDialogScaleX)/100;
259 : 127 : }
260 : :
261 : : // -----------------------------------------------------------------------
262 : :
263 : 367 : bool Window::ImplCheckUIFont( const Font& rFont )
264 : : {
265 [ + - ][ + + ]: 367 : if( ImplGetSVData()->maGDIData.mbNativeFontConfig )
266 : 182 : return true;
267 : :
268 : : // create a text string using the localized text of important buttons
269 [ + - ]: 185 : String aTestText;
270 : : static const StandardButtonType aTestButtons[] =
271 : : {
272 : : BUTTON_OK, BUTTON_CANCEL, BUTTON_CLOSE, BUTTON_ABORT,
273 : : BUTTON_YES, BUTTON_NO, BUTTON_MORE, BUTTON_IGNORE,
274 : : BUTTON_RETRY, BUTTON_HELP
275 : : };
276 : :
277 : 185 : const int nTestButtonCount = SAL_N_ELEMENTS(aTestButtons);
278 [ + + ]: 2035 : for( int n = 0; n < nTestButtonCount; ++n )
279 : : {
280 [ + - ]: 1850 : String aButtonStr = Button::GetStandardText( aTestButtons[n] );
281 : : // #i115432# ignore mnemonic+accelerator part of each string
282 : : // TODO: use a string filtering method when it becomes available
283 : 1850 : const int nLen = aButtonStr.Len();
284 : 1850 : bool bInside = false;
285 [ + + ]: 11285 : for( int i = 0; i < nLen; ++i ) {
286 : 9435 : const sal_Unicode c = aButtonStr.GetChar( i );
287 [ - + ]: 9435 : if( (c == '('))
288 : 0 : bInside = true;
289 [ - + ]: 9435 : if( (c == ')'))
290 : 0 : bInside = false;
291 [ + + ][ + - ]: 9435 : if( (c == '~')
[ + - ][ + - ]
[ + + ][ - + ]
292 : : || (c == '(') || (c == ')')
293 : : || ((c >= 'A') && (c <= 'Z') && bInside) )
294 [ + - ]: 1665 : aButtonStr.SetChar( i, ' ' );
295 : : }
296 : : // append sanitized button text to test string
297 [ + - ]: 1850 : aTestText.Append( aButtonStr );
298 [ + - ]: 1850 : }
299 : :
300 [ + - ]: 185 : const int nFirstChar = HasGlyphs( rFont, aTestText );
301 : 185 : const bool bUIFontOk = (nFirstChar >= aTestText.Len());
302 [ + - ]: 367 : return bUIFontOk;
303 : : }
304 : :
305 : : // -----------------------------------------------------------------------
306 : :
307 : 367 : void Window::ImplUpdateGlobalSettings( AllSettings& rSettings, sal_Bool bCallHdl )
308 : : {
309 [ + - ]: 367 : StyleSettings aTmpSt( rSettings.GetStyleSettings() );
310 [ + - ]: 367 : aTmpSt.SetHighContrastMode( sal_False );
311 [ + - ]: 367 : rSettings.SetStyleSettings( aTmpSt );
312 [ + - ][ + - ]: 367 : ImplGetFrame()->UpdateSettings( rSettings );
313 : : // reset default border width for layouters
314 [ + - ]: 367 : ImplGetSVData()->maAppData.mnDefaultLayoutBorder = -1;
315 : :
316 : : // Verify availability of the configured UI font, otherwise choose "Andale Sans UI"
317 [ + - ]: 367 : String aUserInterfaceFont;
318 : 367 : bool bUseSystemFont = rSettings.GetStyleSettings().GetUseSystemUIFonts();
319 : :
320 : : // check whether system UI font can display a typical UI text
321 [ + - ]: 367 : if( bUseSystemFont )
322 [ + - ]: 367 : bUseSystemFont = ImplCheckUIFont( rSettings.GetStyleSettings().GetAppFont() );
323 : :
324 [ - + ]: 367 : if ( !bUseSystemFont )
325 : : {
326 [ # # ]: 0 : ImplInitFontList();
327 [ # # ][ # # ]: 0 : String aConfigFont = utl::DefaultFontConfiguration::get().getUserInterfaceFont( rSettings.GetUILocale() );
[ # # ][ # # ]
328 : 0 : xub_StrLen nIndex = 0;
329 [ # # ]: 0 : while( nIndex != STRING_NOTFOUND )
330 : : {
331 [ # # ]: 0 : String aName( aConfigFont.GetToken( 0, ';', nIndex ) );
332 [ # # ][ # # ]: 0 : if ( aName.Len() && mpWindowImpl->mpFrameData->mpFontList->FindFontFamily( aName ) )
[ # # ][ # # ]
333 : : {
334 [ # # ]: 0 : aUserInterfaceFont = aConfigFont;
335 : : break;
336 : : }
337 [ # # ][ # # ]: 0 : }
338 : :
339 [ # # ]: 0 : if ( ! aUserInterfaceFont.Len() )
340 : : {
341 [ # # ]: 0 : String aFallbackFont ("Andale Sans UI" );
342 [ # # ][ # # ]: 0 : if ( mpWindowImpl->mpFrameData->mpFontList->FindFontFamily( aFallbackFont ) )
343 [ # # ][ # # ]: 0 : aUserInterfaceFont = aFallbackFont;
344 [ # # ]: 0 : }
345 : : }
346 : :
347 [ - + ][ # # ]: 367 : if ( !bUseSystemFont && aUserInterfaceFont.Len() )
[ - + ]
348 : : {
349 [ # # ]: 0 : StyleSettings aStyleSettings = rSettings.GetStyleSettings();
350 [ # # ]: 0 : Font aFont = aStyleSettings.GetAppFont();
351 [ # # ][ # # ]: 0 : aFont.SetName( aUserInterfaceFont );
352 [ # # ]: 0 : aStyleSettings.SetAppFont( aFont );
353 [ # # ]: 0 : aFont = aStyleSettings.GetHelpFont();
354 [ # # ][ # # ]: 0 : aFont.SetName( aUserInterfaceFont );
355 [ # # ]: 0 : aStyleSettings.SetHelpFont( aFont );
356 [ # # ]: 0 : aFont = aStyleSettings.GetTitleFont();
357 [ # # ][ # # ]: 0 : aFont.SetName( aUserInterfaceFont );
358 [ # # ]: 0 : aStyleSettings.SetTitleFont( aFont );
359 [ # # ]: 0 : aFont = aStyleSettings.GetFloatTitleFont();
360 [ # # ][ # # ]: 0 : aFont.SetName( aUserInterfaceFont );
361 [ # # ]: 0 : aStyleSettings.SetFloatTitleFont( aFont );
362 [ # # ]: 0 : aFont = aStyleSettings.GetMenuFont();
363 [ # # ][ # # ]: 0 : aFont.SetName( aUserInterfaceFont );
364 [ # # ]: 0 : aStyleSettings.SetMenuFont( aFont );
365 [ # # ]: 0 : aFont = aStyleSettings.GetToolFont();
366 [ # # ][ # # ]: 0 : aFont.SetName( aUserInterfaceFont );
367 [ # # ]: 0 : aStyleSettings.SetToolFont( aFont );
368 [ # # ]: 0 : aFont = aStyleSettings.GetLabelFont();
369 [ # # ][ # # ]: 0 : aFont.SetName( aUserInterfaceFont );
370 [ # # ]: 0 : aStyleSettings.SetLabelFont( aFont );
371 [ # # ]: 0 : aFont = aStyleSettings.GetInfoFont();
372 [ # # ][ # # ]: 0 : aFont.SetName( aUserInterfaceFont );
373 [ # # ]: 0 : aStyleSettings.SetInfoFont( aFont );
374 [ # # ]: 0 : aFont = aStyleSettings.GetRadioCheckFont();
375 [ # # ][ # # ]: 0 : aFont.SetName( aUserInterfaceFont );
376 [ # # ]: 0 : aStyleSettings.SetRadioCheckFont( aFont );
377 [ # # ]: 0 : aFont = aStyleSettings.GetPushButtonFont();
378 [ # # ][ # # ]: 0 : aFont.SetName( aUserInterfaceFont );
379 [ # # ]: 0 : aStyleSettings.SetPushButtonFont( aFont );
380 [ # # ]: 0 : aFont = aStyleSettings.GetFieldFont();
381 [ # # ][ # # ]: 0 : aFont.SetName( aUserInterfaceFont );
382 [ # # ]: 0 : aStyleSettings.SetFieldFont( aFont );
383 [ # # ]: 0 : aFont = aStyleSettings.GetIconFont();
384 [ # # ][ # # ]: 0 : aFont.SetName( aUserInterfaceFont );
385 [ # # ]: 0 : aStyleSettings.SetIconFont( aFont );
386 [ # # ]: 0 : aFont = aStyleSettings.GetGroupFont();
387 [ # # ][ # # ]: 0 : aFont.SetName( aUserInterfaceFont );
388 [ # # ]: 0 : aStyleSettings.SetGroupFont( aFont );
389 [ # # ][ # # ]: 0 : rSettings.SetStyleSettings( aStyleSettings );
[ # # ]
390 : : }
391 : :
392 [ + - ]: 367 : StyleSettings aStyleSettings = rSettings.GetStyleSettings();
393 : : // #97047: Force all fonts except Menu and Help to a fixed height
394 : : // to avoid UI scaling due to large fonts
395 : : // - but allow bigger fonts on bigger screens (i16682, i21238)
396 : : // dialogs were designed to fit 800x600 with an 8pt font, so scale accordingly
397 : 367 : int maxFontheight = 9; // #107886#: 9 is default for some asian systems, so always allow if requested
398 [ + - ][ + - ]: 367 : if( GetDesktopRectPixel().getHeight() > 600 )
399 [ + - ]: 367 : maxFontheight = (int) ((( 8.0 * (double) GetDesktopRectPixel().getHeight()) / 600.0) + 1.5);
400 : :
401 [ + - ]: 367 : Font aFont = aStyleSettings.GetMenuFont();
402 [ + - ]: 367 : int defFontheight = aFont.GetHeight();
403 [ - + ]: 367 : if( defFontheight > maxFontheight )
404 : 0 : defFontheight = maxFontheight;
405 : :
406 : : // if the UI is korean, chinese or another locale
407 : : // where the system font size is kown to be often too small to
408 : : // generate readable fonts enforce a minimum font size of 9 points
409 [ + - ][ + - ]: 367 : bool bBrokenLangFontHeight = MsLangId::isCJK(Application::GetSettings().GetUILanguage());
[ + - ]
410 [ - + ]: 367 : if (bBrokenLangFontHeight)
411 : 0 : defFontheight = Max(9, defFontheight);
412 : :
413 : : // i22098, toolfont will be scaled differently to avoid bloated rulers and status bars for big fonts
414 : 367 : int toolfontheight = defFontheight;
415 [ - + ]: 367 : if( toolfontheight > 9 )
416 : 0 : toolfontheight = (defFontheight+8) / 2;
417 : :
418 [ + - ]: 367 : aFont = aStyleSettings.GetAppFont();
419 [ + - ]: 367 : aFont.SetHeight( defFontheight );
420 [ + - ]: 367 : aStyleSettings.SetAppFont( aFont );
421 [ + - ]: 367 : aFont = aStyleSettings.GetTitleFont();
422 [ + - ]: 367 : aFont.SetHeight( defFontheight );
423 [ + - ]: 367 : aStyleSettings.SetTitleFont( aFont );
424 [ + - ]: 367 : aFont = aStyleSettings.GetFloatTitleFont();
425 [ + - ]: 367 : aFont.SetHeight( defFontheight );
426 [ + - ]: 367 : aStyleSettings.SetFloatTitleFont( aFont );
427 : : // keep menu and help font size from system unless in broken locale size
428 [ - + ]: 367 : if( bBrokenLangFontHeight )
429 : : {
430 [ # # ]: 0 : aFont = aStyleSettings.GetMenuFont();
431 [ # # ][ # # ]: 0 : if( aFont.GetHeight() < defFontheight )
432 : : {
433 [ # # ]: 0 : aFont.SetHeight( defFontheight );
434 [ # # ]: 0 : aStyleSettings.SetMenuFont( aFont );
435 : : }
436 [ # # ]: 0 : aFont = aStyleSettings.GetHelpFont();
437 [ # # ][ # # ]: 0 : if( aFont.GetHeight() < defFontheight )
438 : : {
439 [ # # ]: 0 : aFont.SetHeight( defFontheight );
440 [ # # ]: 0 : aStyleSettings.SetHelpFont( aFont );
441 : : }
442 : : }
443 : :
444 : : // use different height for toolfont
445 [ + - ]: 367 : aFont = aStyleSettings.GetToolFont();
446 [ + - ]: 367 : aFont.SetHeight( toolfontheight );
447 [ + - ]: 367 : aStyleSettings.SetToolFont( aFont );
448 : :
449 [ + - ]: 367 : aFont = aStyleSettings.GetLabelFont();
450 [ + - ]: 367 : aFont.SetHeight( defFontheight );
451 [ + - ]: 367 : aStyleSettings.SetLabelFont( aFont );
452 [ + - ]: 367 : aFont = aStyleSettings.GetInfoFont();
453 [ + - ]: 367 : aFont.SetHeight( defFontheight );
454 [ + - ]: 367 : aStyleSettings.SetInfoFont( aFont );
455 [ + - ]: 367 : aFont = aStyleSettings.GetRadioCheckFont();
456 [ + - ]: 367 : aFont.SetHeight( defFontheight );
457 [ + - ]: 367 : aStyleSettings.SetRadioCheckFont( aFont );
458 [ + - ]: 367 : aFont = aStyleSettings.GetPushButtonFont();
459 [ + - ]: 367 : aFont.SetHeight( defFontheight );
460 [ + - ]: 367 : aStyleSettings.SetPushButtonFont( aFont );
461 [ + - ]: 367 : aFont = aStyleSettings.GetFieldFont();
462 [ + - ]: 367 : aFont.SetHeight( defFontheight );
463 [ + - ]: 367 : aStyleSettings.SetFieldFont( aFont );
464 [ + - ]: 367 : aFont = aStyleSettings.GetIconFont();
465 [ + - ]: 367 : aFont.SetHeight( defFontheight );
466 [ + - ]: 367 : aStyleSettings.SetIconFont( aFont );
467 [ + - ]: 367 : aFont = aStyleSettings.GetGroupFont();
468 [ + - ]: 367 : aFont.SetHeight( defFontheight );
469 [ + - ]: 367 : aStyleSettings.SetGroupFont( aFont );
470 : :
471 : : // set workspace gradient to black in dark themes
472 [ + - ][ - + ]: 367 : if( aStyleSettings.GetWindowColor().IsDark() )
473 [ # # ][ # # ]: 0 : aStyleSettings.SetWorkspaceGradient( Wallpaper( Color( COL_BLACK ) ) );
[ # # ]
474 : : else
475 : : {
476 [ + - ]: 367 : Gradient aGrad( GradientStyle_LINEAR, DEFAULT_WORKSPACE_GRADIENT_START_COLOR, DEFAULT_WORKSPACE_GRADIENT_END_COLOR );
477 [ + - ][ + - ]: 367 : aStyleSettings.SetWorkspaceGradient( Wallpaper( aGrad ) );
[ + - ][ + - ]
478 : : }
479 : :
480 [ + - ]: 367 : rSettings.SetStyleSettings( aStyleSettings );
481 : :
482 : : // auto detect HC mode; if the system already set it to "yes"
483 : : // (see above) then accept that
484 [ + - ]: 367 : if( !rSettings.GetStyleSettings().GetHighContrastMode() )
485 : : {
486 : 367 : sal_Bool bTmp = sal_False, bAutoHCMode = sal_True;
487 : : utl::OConfigurationNode aNode = utl::OConfigurationTreeRoot::tryCreateWithServiceFactory(
488 : : vcl::unohelper::GetMultiServiceFactory(),
489 [ + - ][ + - ]: 367 : OUString("org.openoffice.Office.Common/Accessibility") ); // note: case sensitive !
[ + - ][ + - ]
490 [ + - ]: 367 : if ( aNode.isValid() )
491 : : {
492 : 367 : ::com::sun::star::uno::Any aValue = aNode.getNodeValue( OUString("AutoDetectSystemHC") );
493 [ + - ]: 367 : if( aValue >>= bTmp )
494 : 367 : bAutoHCMode = bTmp;
495 : : }
496 [ + - ]: 367 : if( bAutoHCMode )
497 : : {
498 [ + - ][ + - ]: 734 : if( rSettings.GetStyleSettings().GetFaceColor().IsDark()
[ - + ][ - + ]
499 [ + - ]: 367 : || rSettings.GetStyleSettings().GetWindowColor().IsDark() )
500 : : {
501 [ # # ]: 0 : aStyleSettings = rSettings.GetStyleSettings();
502 [ # # ]: 0 : aStyleSettings.SetHighContrastMode( sal_True );
503 [ # # ]: 0 : aStyleSettings.SetSymbolsStyle( STYLE_SYMBOLS_HICONTRAST );
504 [ # # ]: 0 : rSettings.SetStyleSettings( aStyleSettings );
505 : : }
506 [ + - ]: 367 : }
507 : : }
508 : :
509 [ + + ][ + - ]: 367 : static const char* pEnvHC = getenv( "SAL_FORCE_HC" );
510 [ - + ][ # # ]: 367 : if( pEnvHC && *pEnvHC )
511 : : {
512 [ # # ]: 0 : aStyleSettings.SetHighContrastMode( sal_True );
513 [ # # ]: 0 : aStyleSettings.SetSymbolsStyle( STYLE_SYMBOLS_HICONTRAST );
514 [ # # ]: 0 : rSettings.SetStyleSettings( aStyleSettings );
515 : : }
516 : :
517 : : #if defined(DBG_UTIL)
518 : : // If needed, set AppFont to bold, in order to check
519 : : // if there is enough space available for texts on other systems
520 : : if ( DbgIsBoldAppFont() )
521 : : {
522 : : aStyleSettings = rSettings.GetStyleSettings();
523 : : aFont = aStyleSettings.GetAppFont();
524 : : aFont.SetWeight( WEIGHT_BOLD );
525 : : aStyleSettings.SetAppFont( aFont );
526 : : aFont = aStyleSettings.GetGroupFont();
527 : : aFont.SetWeight( WEIGHT_BOLD );
528 : : aStyleSettings.SetGroupFont( aFont );
529 : : aFont = aStyleSettings.GetLabelFont();
530 : : aFont.SetWeight( WEIGHT_BOLD );
531 : : aStyleSettings.SetLabelFont( aFont );
532 : : aFont = aStyleSettings.GetRadioCheckFont();
533 : : aFont.SetWeight( WEIGHT_BOLD );
534 : : aStyleSettings.SetRadioCheckFont( aFont );
535 : : aFont = aStyleSettings.GetPushButtonFont();
536 : : aFont.SetWeight( WEIGHT_BOLD );
537 : : aStyleSettings.SetPushButtonFont( aFont );
538 : : aFont = aStyleSettings.GetFieldFont();
539 : : aFont.SetWeight( WEIGHT_BOLD );
540 : : aStyleSettings.SetFieldFont( aFont );
541 : : aFont = aStyleSettings.GetIconFont();
542 : : aFont.SetWeight( WEIGHT_BOLD );
543 : : aStyleSettings.SetIconFont( aFont );
544 : : rSettings.SetStyleSettings( aStyleSettings );
545 : : }
546 : : #endif
547 : :
548 [ + + ]: 367 : if ( bCallHdl )
549 [ + - ][ + - ]: 367 : GetpApp()->SystemSettingsChanging( rSettings, this );
[ + - ][ + - ]
[ + - ][ + - ]
550 : 367 : }
551 : :
552 : : // -----------------------------------------------------------------------
553 : :
554 : 0 : MouseEvent ImplTranslateMouseEvent( const MouseEvent& rE, Window* pSource, Window* pDest )
555 : : {
556 [ # # ]: 0 : Point aPos = pSource->OutputToScreenPixel( rE.GetPosPixel() );
557 [ # # ]: 0 : aPos = pDest->ScreenToOutputPixel( aPos );
558 [ # # ]: 0 : return MouseEvent( aPos, rE.GetClicks(), rE.GetMode(), rE.GetButtons(), rE.GetModifier() );
559 : : }
560 : :
561 : : // -----------------------------------------------------------------------
562 : :
563 : 0 : CommandEvent ImplTranslateCommandEvent( const CommandEvent& rCEvt, Window* pSource, Window* pDest )
564 : : {
565 [ # # ]: 0 : if ( !rCEvt.IsMouseEvent() )
566 : 0 : return rCEvt;
567 : :
568 [ # # ]: 0 : Point aPos = pSource->OutputToScreenPixel( rCEvt.GetMousePosPixel() );
569 [ # # ]: 0 : aPos = pDest->ScreenToOutputPixel( aPos );
570 [ # # ]: 0 : return CommandEvent( aPos, rCEvt.GetCommand(), rCEvt.IsMouseEvent(), rCEvt.GetData() );
571 : : }
572 : :
573 : : // =======================================================================
574 : :
575 : 124176 : void Window::ImplInitWindowData( WindowType nType )
576 : : {
577 [ + - ]: 124176 : mpWindowImpl = new WindowImpl;
578 : :
579 : 124176 : meOutDevType = OUTDEV_WINDOW;
580 : :
581 [ + - ]: 124176 : mpWindowImpl->maZoom = Fraction( 1, 1 );
582 [ + - ]: 124176 : mpWindowImpl->maWinRegion = Region( REGION_NULL );
583 [ + - ]: 124176 : mpWindowImpl->maWinClipRegion = Region( REGION_NULL );
584 : 124176 : mpWindowImpl->mpWinData = NULL; // Extra Window Data, that we dont need for all windows
585 : 124176 : mpWindowImpl->mpOverlapData = NULL; // Overlap Data
586 : 124176 : mpWindowImpl->mpFrameData = NULL; // Frame Data
587 : 124176 : mpWindowImpl->mpFrame = NULL; // Pointer to frame window
588 : 124176 : mpWindowImpl->mpSysObj = NULL;
589 : 124176 : mpWindowImpl->mpFrameWindow = NULL; // window to top level parent (same as frame window)
590 : 124176 : mpWindowImpl->mpOverlapWindow = NULL; // first overlap parent
591 : 124176 : mpWindowImpl->mpBorderWindow = NULL; // Border-Window
592 : 124176 : mpWindowImpl->mpClientWindow = NULL; // Client-Window of a FrameWindow
593 : 124176 : mpWindowImpl->mpParent = NULL; // parent (inkl. BorderWindow)
594 : 124176 : mpWindowImpl->mpRealParent = NULL; // real parent (exkl. BorderWindow)
595 : 124176 : mpWindowImpl->mpFirstChild = NULL; // first child window
596 : 124176 : mpWindowImpl->mpLastChild = NULL; // last child window
597 : 124176 : mpWindowImpl->mpFirstOverlap = NULL; // first overlap window (only set in overlap windows)
598 : 124176 : mpWindowImpl->mpLastOverlap = NULL; // last overlap window (only set in overlap windows)
599 : 124176 : mpWindowImpl->mpPrev = NULL; // prev window
600 : 124176 : mpWindowImpl->mpNext = NULL; // next window
601 : 124176 : mpWindowImpl->mpNextOverlap = NULL; // next overlap window of frame
602 : 124176 : mpWindowImpl->mpLastFocusWindow = NULL; // window for focus restore
603 : 124176 : mpWindowImpl->mpDlgCtrlDownWindow = NULL; // window for dialog control
604 : 124176 : mpWindowImpl->mpFirstDel = NULL; // Dtor notification list
605 : 124176 : mpWindowImpl->mpUserData = NULL; // user data
606 : 124176 : mpWindowImpl->mpExtImpl = NULL; // extended implementation data
607 : 124176 : mpWindowImpl->mpCursor = NULL; // cursor
608 : 124176 : mpWindowImpl->mpControlFont = NULL; // font propertie
609 : 124176 : mpWindowImpl->mpVCLXWindow = NULL;
610 : 124176 : mpWindowImpl->mpAccessibleInfos = NULL;
611 : 124176 : mpWindowImpl->maControlForeground = Color( COL_TRANSPARENT ); // no foreground set
612 : 124176 : mpWindowImpl->maControlBackground = Color( COL_TRANSPARENT ); // no background set
613 : 124176 : mpWindowImpl->mnLeftBorder = 0; // left border
614 : 124176 : mpWindowImpl->mnTopBorder = 0; // top border
615 : 124176 : mpWindowImpl->mnRightBorder = 0; // right border
616 : 124176 : mpWindowImpl->mnBottomBorder = 0; // bottom border
617 : 124176 : mpWindowImpl->mnX = 0; // X-Position to Parent
618 : 124176 : mpWindowImpl->mnY = 0; // Y-Position to Parent
619 : 124176 : mpWindowImpl->mnAbsScreenX = 0; // absolute X-position on screen, used for RTL window positioning
620 : 124176 : mpWindowImpl->mpChildClipRegion = NULL; // Child-Clip-Region when ClipChildren
621 : 124176 : mpWindowImpl->mpPaintRegion = NULL; // Paint-ClipRegion
622 : 124176 : mpWindowImpl->mnStyle = 0; // style (init in ImplInitWindow)
623 : 124176 : mpWindowImpl->mnPrevStyle = 0; // prevstyle (set in SetStyle)
624 : 124176 : mpWindowImpl->mnExtendedStyle = 0; // extended style (init in ImplInitWindow)
625 : 124176 : mpWindowImpl->mnPrevExtendedStyle = 0; // prevstyle (set in SetExtendedStyle)
626 : 124176 : mpWindowImpl->mnType = nType; // type
627 : 124176 : mpWindowImpl->mnGetFocusFlags = 0; // Flags fuer GetFocus()-Aufruf
628 : 124176 : mpWindowImpl->mnWaitCount = 0; // Wait-Count (>1 == Warte-MousePointer)
629 : 124176 : mpWindowImpl->mnPaintFlags = 0; // Flags for ImplCallPaint
630 : 124176 : mpWindowImpl->mnParentClipMode = 0; // Flags for Parent-ClipChildren-Mode
631 : 124176 : mpWindowImpl->mnActivateMode = 0; // Will be converted in System/Overlap-Windows
632 : 124176 : mpWindowImpl->mnDlgCtrlFlags = 0; // DialogControl-Flags
633 : 124176 : mpWindowImpl->mnLockCount = 0; // LockCount
634 : 124176 : mpWindowImpl->meAlwaysInputMode = AlwaysInputNone; // neither AlwaysEnableInput nor AlwaysDisableInput called
635 : 124176 : mpWindowImpl->mbFrame = sal_False; // sal_True: Window is a frame window
636 : 124176 : mpWindowImpl->mbBorderWin = sal_False; // sal_True: Window is a border window
637 : 124176 : mpWindowImpl->mbOverlapWin = sal_False; // sal_True: Window is a overlap window
638 : 124176 : mpWindowImpl->mbSysWin = sal_False; // sal_True: SystemWindow is the base class
639 : 124176 : mpWindowImpl->mbDialog = sal_False; // sal_True: Dialog is the base class
640 : 124176 : mpWindowImpl->mbDockWin = sal_False; // sal_True: DockingWindow is the base class
641 : 124176 : mpWindowImpl->mbFloatWin = sal_False; // sal_True: FloatingWindow is the base class
642 : 124176 : mpWindowImpl->mbPushButton = sal_False; // sal_True: PushButton is the base class
643 : 124176 : mpWindowImpl->mbToolBox = sal_False; // sal_True: ToolBox is the base class
644 : 124176 : mpWindowImpl->mbMenuFloatingWindow= sal_False; // sal_True: MenuFloatingWindow is the base class
645 : 124176 : mpWindowImpl->mbToolbarFloatingWindow= sal_False; // sal_True: ImplPopupFloatWin is the base class, used for subtoolbars
646 : 124176 : mpWindowImpl->mbSplitter = sal_False; // sal_True: Splitter is the base class
647 : 124176 : mpWindowImpl->mbVisible = sal_False; // sal_True: Show( sal_True ) called
648 : 124176 : mpWindowImpl->mbOverlapVisible = sal_False; // sal_True: Hide called for visible window from ImplHideAllOverlapWindow()
649 : 124176 : mpWindowImpl->mbDisabled = sal_False; // sal_True: Enable( sal_False ) called
650 : 124176 : mpWindowImpl->mbInputDisabled = sal_False; // sal_True: EnableInput( sal_False ) called
651 : 124176 : mpWindowImpl->mbDropDisabled = sal_False; // sal_True: Drop is enabled
652 : 124176 : mpWindowImpl->mbNoUpdate = sal_False; // sal_True: SetUpdateMode( sal_False ) called
653 : 124176 : mpWindowImpl->mbNoParentUpdate = sal_False; // sal_True: SetParentUpdateMode( sal_False ) called
654 : 124176 : mpWindowImpl->mbActive = sal_False; // sal_True: Window Active
655 : 124176 : mpWindowImpl->mbParentActive = sal_False; // sal_True: OverlapActive from Parent
656 : 124176 : mpWindowImpl->mbReallyVisible = sal_False; // sal_True: this and all parents to an overlaped window are visible
657 : 124176 : mpWindowImpl->mbReallyShown = sal_False; // sal_True: this and all parents to an overlaped window are shown
658 : 124176 : mpWindowImpl->mbInInitShow = sal_False; // sal_True: we are in InitShow
659 : 124176 : mpWindowImpl->mbChildNotify = sal_False; // sal_True: ChildNotify
660 : 124176 : mpWindowImpl->mbChildPtrOverwrite = sal_False; // sal_True: PointerStyle overwrites Child-Pointer
661 : 124176 : mpWindowImpl->mbNoPtrVisible = sal_False; // sal_True: ShowPointer( sal_False ) called
662 : 124176 : mpWindowImpl->mbMouseMove = sal_False; // sal_True: BaseMouseMove called
663 : 124176 : mpWindowImpl->mbPaintFrame = sal_False; // sal_True: Paint is visible, but not painted
664 : 124176 : mpWindowImpl->mbInPaint = sal_False; // sal_True: Inside PaintHdl
665 : 124176 : mpWindowImpl->mbMouseButtonDown = sal_False; // sal_True: BaseMouseButtonDown called
666 : 124176 : mpWindowImpl->mbMouseButtonUp = sal_False; // sal_True: BaseMouseButtonUp called
667 : 124176 : mpWindowImpl->mbKeyInput = sal_False; // sal_True: BaseKeyInput called
668 : 124176 : mpWindowImpl->mbKeyUp = sal_False; // sal_True: BaseKeyUp called
669 : 124176 : mpWindowImpl->mbCommand = sal_False; // sal_True: BaseCommand called
670 : 124176 : mpWindowImpl->mbDefPos = sal_True; // sal_True: Position is not Set
671 : 124176 : mpWindowImpl->mbDefSize = sal_True; // sal_True: Size is not Set
672 : 124176 : mpWindowImpl->mbCallMove = sal_True; // sal_True: Move must be called by Show
673 : 124176 : mpWindowImpl->mbCallResize = sal_True; // sal_True: Resize must be called by Show
674 : 124176 : mpWindowImpl->mbWaitSystemResize = sal_True; // sal_True: Wait for System-Resize
675 : 124176 : mpWindowImpl->mbInitWinClipRegion = sal_True; // sal_True: Calc Window Clip Region
676 : 124176 : mpWindowImpl->mbInitChildRegion = sal_False; // sal_True: InitChildClipRegion
677 : 124176 : mpWindowImpl->mbWinRegion = sal_False; // sal_True: Window Region
678 : 124176 : mpWindowImpl->mbClipChildren = sal_False; // sal_True: Child-window should be clipped
679 : 124176 : mpWindowImpl->mbClipSiblings = sal_False; // sal_True: Adjacent Child-window should be clipped
680 : 124176 : mpWindowImpl->mbChildTransparent = sal_False; // sal_True: Child-windows are allowed to switch to transparent (incl. Parent-CLIPCHILDREN)
681 : 124176 : mpWindowImpl->mbPaintTransparent = sal_False; // sal_True: Paints should be executed on the Parent
682 : 124176 : mpWindowImpl->mbMouseTransparent = sal_False; // sal_True: Window is transparent for Mouse
683 : 124176 : mpWindowImpl->mbDlgCtrlStart = sal_False; // sal_True: From here on own Dialog-Control
684 : 124176 : mpWindowImpl->mbFocusVisible = sal_False; // sal_True: Focus Visible
685 : 124176 : mpWindowImpl->mbUseNativeFocus = sal_False;
686 : 124176 : mpWindowImpl->mbNativeFocusVisible= sal_False; // sal_True: native Focus Visible
687 : 124176 : mpWindowImpl->mbInShowFocus = sal_False; // prevent recursion
688 : 124176 : mpWindowImpl->mbInHideFocus = sal_False; // prevent recursion
689 : 124176 : mpWindowImpl->mbTrackVisible = sal_False; // sal_True: Tracking Visible
690 : 124176 : mpWindowImpl->mbControlForeground = sal_False; // sal_True: Foreground-Property set
691 : 124176 : mpWindowImpl->mbControlBackground = sal_False; // sal_True: Background-Property set
692 : 124176 : mpWindowImpl->mbAlwaysOnTop = sal_False; // sal_True: always visible for all others windows
693 : 124176 : mpWindowImpl->mbCompoundControl = sal_False; // sal_True: Composite Control => Listener...
694 : 124176 : mpWindowImpl->mbCompoundControlHasFocus = sal_False; // sal_True: Composite Control has focus somewhere
695 : 124176 : mpWindowImpl->mbPaintDisabled = sal_False; // sal_True: Paint should not be executed
696 : 124176 : mpWindowImpl->mbAllResize = sal_False; // sal_True: Also sent ResizeEvents with 0,0
697 : 124176 : mpWindowImpl->mbInDtor = sal_False; // sal_True: We're still in Window-Dtor
698 : 124176 : mpWindowImpl->mbExtTextInput = sal_False; // sal_True: ExtTextInput-Mode is active
699 : 124176 : mpWindowImpl->mbInFocusHdl = sal_False; // sal_True: Within GetFocus-Handler
700 : 124176 : mpWindowImpl->mbCreatedWithToolkit = sal_False;
701 : 124176 : mpWindowImpl->mbSuppressAccessibilityEvents = sal_False; // sal_True: do not send any accessibility events
702 : 124176 : mpWindowImpl->mbDrawSelectionBackground = sal_False; // sal_True: draws transparent window background to indicate (toolbox) selection
703 : 124176 : mpWindowImpl->mbIsInTaskPaneList = sal_False; // sal_True: window was added to the taskpanelist in the topmost system window
704 : 124176 : mpWindowImpl->mnNativeBackground = 0; // initialize later, depends on type
705 : 124176 : mpWindowImpl->mbCallHandlersDuringInputDisabled = sal_False; // sal_True: call event handlers even if input is disabled
706 : 124176 : mpWindowImpl->mbDisableAccessibleLabelForRelation = sal_False; // sal_True: do not set LabelFor relation on accessible objects
707 : 124176 : mpWindowImpl->mbDisableAccessibleLabeledByRelation = sal_False; // sal_True: do not set LabeledBy relation on accessible objects
708 : 124176 : mpWindowImpl->mbHelpTextDynamic = sal_False; // sal_True: append help id in HELP_DEBUG case
709 : 124176 : mpWindowImpl->mbFakeFocusSet = sal_False; // sal_True: pretend as if the window has focus.
710 : :
711 : 124176 : mbEnableRTL = Application::GetSettings().GetLayoutRTL(); // sal_True: this outdev will be mirrored if RTL window layout (UI mirroring) is globally active
712 : 124176 : }
713 : :
714 : : // -----------------------------------------------------------------------
715 : :
716 : 124176 : void Window::ImplInit( Window* pParent, WinBits nStyle, SystemParentData* pSystemParentData )
717 : : {
718 : : DBG_ASSERT( mpWindowImpl->mbFrame || pParent, "Window::Window(): pParent == NULL" );
719 : :
720 : 124176 : ImplSVData* pSVData = ImplGetSVData();
721 : 124176 : Window* pRealParent = pParent;
722 : :
723 : : // 3D-Look vererben
724 [ + - ][ + + ]: 124176 : if ( !mpWindowImpl->mbOverlapWin && pParent && (pParent->GetStyle() & WB_3DLOOK) )
[ + + ][ + + ]
725 : 58532 : nStyle |= WB_3DLOOK;
726 : :
727 : : // create border window if necessary
728 [ + + ][ + + ]: 124176 : if ( !mpWindowImpl->mbFrame && !mpWindowImpl->mbBorderWin && !mpWindowImpl->mpBorderWindow
[ + - ][ + + ]
729 : : && (nStyle & (WB_BORDER | WB_SYSTEMCHILDWINDOW) ) )
730 : : {
731 : 6786 : sal_uInt16 nBorderTypeStyle = 0;
732 [ - + ]: 6786 : if( (nStyle & WB_SYSTEMCHILDWINDOW) )
733 : : {
734 : : // handle WB_SYSTEMCHILDWINDOW
735 : : // these should be analogous to a top level frame; meaning they
736 : : // should have a border window with style BORDERWINDOW_STYLE_FRAME
737 : : // which controls their size
738 : 0 : nBorderTypeStyle |= BORDERWINDOW_STYLE_FRAME;
739 : 0 : nStyle |= WB_BORDER;
740 : : }
741 [ + - ]: 6786 : ImplBorderWindow* pBorderWin = new ImplBorderWindow( pParent, nStyle & (WB_BORDER | WB_DIALOGCONTROL | WB_NODIALOGCONTROL | WB_NEEDSFOCUS), nBorderTypeStyle );
742 : 6786 : ((Window*)pBorderWin)->mpWindowImpl->mpClientWindow = this;
743 : 6786 : pBorderWin->GetBorder( mpWindowImpl->mnLeftBorder, mpWindowImpl->mnTopBorder, mpWindowImpl->mnRightBorder, mpWindowImpl->mnBottomBorder );
744 : 6786 : mpWindowImpl->mpBorderWindow = pBorderWin;
745 : 6786 : pParent = mpWindowImpl->mpBorderWindow;
746 : : }
747 [ + + ][ - + ]: 117390 : else if( !mpWindowImpl->mbFrame && ! pParent )
748 : : {
749 : 0 : mpWindowImpl->mbOverlapWin = sal_True;
750 : 0 : mpWindowImpl->mbFrame = sal_True;
751 : : }
752 : :
753 : : // insert window in list
754 : 124176 : ImplInsertWindow( pParent );
755 : 124176 : mpWindowImpl->mnStyle = nStyle;
756 : :
757 : : // Overlap-Window-Data
758 [ + + ]: 124176 : if ( mpWindowImpl->mbOverlapWin )
759 : : {
760 : 5988 : mpWindowImpl->mpOverlapData = new ImplOverlapData;
761 : 5988 : mpWindowImpl->mpOverlapData->mpSaveBackDev = NULL;
762 : 5988 : mpWindowImpl->mpOverlapData->mpSaveBackRgn = NULL;
763 : 5988 : mpWindowImpl->mpOverlapData->mpNextBackWin = NULL;
764 : 5988 : mpWindowImpl->mpOverlapData->mnSaveBackSize = 0;
765 : 5988 : mpWindowImpl->mpOverlapData->mbSaveBack = sal_False;
766 : 5988 : mpWindowImpl->mpOverlapData->mnTopLevel = 1;
767 : : }
768 : :
769 [ + + ][ + + ]: 124176 : if( pParent && ! mpWindowImpl->mbFrame )
770 : 118188 : mbEnableRTL = pParent->mbEnableRTL;
771 : :
772 : : // test for frame creation
773 [ + + ]: 124176 : if ( mpWindowImpl->mbFrame )
774 : : {
775 : : // create frame
776 : 5988 : sal_uLong nFrameStyle = 0;
777 : :
778 [ + + ]: 5988 : if ( nStyle & WB_MOVEABLE )
779 : 1913 : nFrameStyle |= SAL_FRAME_STYLE_MOVEABLE;
780 [ + + ]: 5988 : if ( nStyle & WB_SIZEABLE )
781 : 1877 : nFrameStyle |= SAL_FRAME_STYLE_SIZEABLE;
782 [ + + ]: 5988 : if ( nStyle & WB_CLOSEABLE )
783 : 5735 : nFrameStyle |= SAL_FRAME_STYLE_CLOSEABLE;
784 [ - + ]: 5988 : if ( nStyle & WB_APP )
785 : 0 : nFrameStyle |= SAL_FRAME_STYLE_DEFAULT;
786 : : // check for undecorated floating window
787 [ + + ]: 12229 : if( // 1. floating windows that are not moveable/sizeable (only closeable allowed)
[ + - + - ]
[ + + ]
[ + - + + ]
[ - + ][ # # ]
[ + + ]
788 : 5988 : ( !(nFrameStyle & ~SAL_FRAME_STYLE_CLOSEABLE) &&
789 : 4075 : ( mpWindowImpl->mbFloatWin || ((GetType() == WINDOW_BORDERWINDOW) && ((ImplBorderWindow*)this)->mbFloatWindow) || (nStyle & WB_SYSTEMFLOATWIN) ) ) ||
790 : : // 2. borderwindows of floaters with ownerdraw decoration
791 : 2166 : ( ((GetType() == WINDOW_BORDERWINDOW) && ((ImplBorderWindow*)this)->mbFloatWindow && (nStyle & WB_OWNERDRAWDECORATION) ) ) )
792 : : {
793 : 3822 : nFrameStyle = SAL_FRAME_STYLE_FLOAT;
794 [ - + ]: 3822 : if( nStyle & WB_OWNERDRAWDECORATION )
795 : 0 : nFrameStyle |= (SAL_FRAME_STYLE_OWNERDRAWDECORATION | SAL_FRAME_STYLE_NOSHADOW);
796 [ - + ]: 3822 : if( nStyle & WB_NEEDSFOCUS )
797 : 0 : nFrameStyle |= SAL_FRAME_STYLE_FLOAT_FOCUSABLE;
798 : : }
799 [ + + ]: 2166 : else if( mpWindowImpl->mbFloatWin )
800 : 34 : nFrameStyle |= SAL_FRAME_STYLE_TOOLWINDOW;
801 : :
802 [ - + ]: 5988 : if( nStyle & WB_INTROWIN )
803 : 0 : nFrameStyle |= SAL_FRAME_STYLE_INTRO;
804 [ - + ]: 5988 : if( nStyle & WB_TOOLTIPWIN )
805 : 0 : nFrameStyle |= SAL_FRAME_STYLE_TOOLTIP;
806 : :
807 [ + + ]: 5988 : if( nStyle & WB_NOSHADOW )
808 : 3806 : nFrameStyle |= SAL_FRAME_STYLE_NOSHADOW;
809 : :
810 [ - + ]: 5988 : if( nStyle & WB_SYSTEMCHILDWINDOW )
811 : 0 : nFrameStyle |= SAL_FRAME_STYLE_SYSTEMCHILD;
812 : :
813 [ + + ]: 5988 : switch (mpWindowImpl->mnType)
814 : : {
815 : : case WINDOW_DIALOG:
816 : : case WINDOW_TABDIALOG:
817 : : case WINDOW_MODALDIALOG:
818 : : case WINDOW_MODELESSDIALOG:
819 : : case WINDOW_MESSBOX:
820 : : case WINDOW_INFOBOX:
821 : : case WINDOW_WARNINGBOX:
822 : : case WINDOW_ERRORBOX:
823 : : case WINDOW_QUERYBOX:
824 : 2 : nFrameStyle |= SAL_FRAME_STYLE_DIALOG;
825 : : default:
826 : 5988 : break;
827 : : }
828 : :
829 : 5988 : SalFrame* pParentFrame = NULL;
830 [ + + ]: 5988 : if ( pParent )
831 : 3858 : pParentFrame = pParent->mpWindowImpl->mpFrame;
832 : : SalFrame* pFrame;
833 [ - + ]: 5988 : if ( pSystemParentData )
834 : 0 : pFrame = pSVData->mpDefInst->CreateChildFrame( pSystemParentData, nFrameStyle | SAL_FRAME_STYLE_PLUG );
835 : : else
836 : 5988 : pFrame = pSVData->mpDefInst->CreateFrame( pParentFrame, nFrameStyle );
837 [ - + ]: 5988 : if ( !pFrame )
838 : : {
839 : : // do not abort but throw an exception, may be the current thread terminates anyway (plugin-scenario)
840 : : throw ::com::sun::star::uno::RuntimeException(
841 : : OUString( "Could not create system window!" ),
842 [ # # ]: 0 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >() );
843 : : //GetpApp()->Exception( EXC_SYSOBJNOTCREATED );
844 : : }
845 : :
846 : 5988 : pFrame->SetCallback( this, ImplWindowFrameProc );
847 : :
848 : : // set window frame data
849 [ + - ]: 5988 : mpWindowImpl->mpFrameData = new ImplFrameData;
850 : 5988 : mpWindowImpl->mpFrame = pFrame;
851 : 5988 : mpWindowImpl->mpFrameWindow = this;
852 : 5988 : mpWindowImpl->mpOverlapWindow = this;
853 : :
854 : : // set frame data
855 : 5988 : mpWindowImpl->mpFrameData->mpNextFrame = pSVData->maWinData.mpFirstFrame;
856 : 5988 : pSVData->maWinData.mpFirstFrame = this;
857 : 5988 : mpWindowImpl->mpFrameData->mpFirstOverlap = NULL;
858 : 5988 : mpWindowImpl->mpFrameData->mpFocusWin = NULL;
859 : 5988 : mpWindowImpl->mpFrameData->mpMouseMoveWin = NULL;
860 : 5988 : mpWindowImpl->mpFrameData->mpMouseDownWin = NULL;
861 : 5988 : mpWindowImpl->mpFrameData->mpFirstBackWin = NULL;
862 : 5988 : mpWindowImpl->mpFrameData->mpFontList = pSVData->maGDIData.mpScreenFontList;
863 : 5988 : mpWindowImpl->mpFrameData->mpFontCache = pSVData->maGDIData.mpScreenFontCache;
864 : 5988 : mpWindowImpl->mpFrameData->mnAllSaveBackSize = 0;
865 : 5988 : mpWindowImpl->mpFrameData->mnFocusId = 0;
866 : 5988 : mpWindowImpl->mpFrameData->mnMouseMoveId = 0;
867 : 5988 : mpWindowImpl->mpFrameData->mnLastMouseX = -1;
868 : 5988 : mpWindowImpl->mpFrameData->mnLastMouseY = -1;
869 : 5988 : mpWindowImpl->mpFrameData->mnBeforeLastMouseX = -1;
870 : 5988 : mpWindowImpl->mpFrameData->mnBeforeLastMouseY = -1;
871 : 5988 : mpWindowImpl->mpFrameData->mnFirstMouseX = -1;
872 : 5988 : mpWindowImpl->mpFrameData->mnFirstMouseY = -1;
873 : 5988 : mpWindowImpl->mpFrameData->mnLastMouseWinX = -1;
874 : 5988 : mpWindowImpl->mpFrameData->mnLastMouseWinY = -1;
875 : 5988 : mpWindowImpl->mpFrameData->mnModalMode = 0;
876 : 5988 : mpWindowImpl->mpFrameData->mnMouseDownTime = 0;
877 : 5988 : mpWindowImpl->mpFrameData->mnClickCount = 0;
878 : 5988 : mpWindowImpl->mpFrameData->mnFirstMouseCode = 0;
879 : 5988 : mpWindowImpl->mpFrameData->mnMouseCode = 0;
880 : 5988 : mpWindowImpl->mpFrameData->mnMouseMode = 0;
881 : 5988 : mpWindowImpl->mpFrameData->meMapUnit = MAP_PIXEL;
882 : 5988 : mpWindowImpl->mpFrameData->mbHasFocus = sal_False;
883 : 5988 : mpWindowImpl->mpFrameData->mbInMouseMove = sal_False;
884 : 5988 : mpWindowImpl->mpFrameData->mbMouseIn = sal_False;
885 : 5988 : mpWindowImpl->mpFrameData->mbStartDragCalled = sal_False;
886 : 5988 : mpWindowImpl->mpFrameData->mbNeedSysWindow = sal_False;
887 : 5988 : mpWindowImpl->mpFrameData->mbMinimized = sal_False;
888 : 5988 : mpWindowImpl->mpFrameData->mbStartFocusState = sal_False;
889 : 5988 : mpWindowImpl->mpFrameData->mbInSysObjFocusHdl = sal_False;
890 : 5988 : mpWindowImpl->mpFrameData->mbInSysObjToTopHdl = sal_False;
891 : 5988 : mpWindowImpl->mpFrameData->mbSysObjFocus = sal_False;
892 : 5988 : mpWindowImpl->mpFrameData->maPaintTimer.SetTimeout( 30 );
893 : 5988 : mpWindowImpl->mpFrameData->maPaintTimer.SetTimeoutHdl( LINK( this, Window, ImplHandlePaintHdl ) );
894 : 5988 : mpWindowImpl->mpFrameData->maResizeTimer.SetTimeout( 50 );
895 : 5988 : mpWindowImpl->mpFrameData->maResizeTimer.SetTimeoutHdl( LINK( this, Window, ImplHandleResizeTimerHdl ) );
896 : 5988 : mpWindowImpl->mpFrameData->mbInternalDragGestureRecognizer = sal_False;
897 : :
898 [ + + ][ + + ]: 5988 : if ( pRealParent && IsTopWindow() )
[ + + ]
899 : : {
900 : 34 : ImplWinData* pParentWinData = pRealParent->ImplGetWinData();
901 [ + - ]: 34 : pParentWinData->maTopWindowChildren.push_back( this );
902 : : }
903 : : }
904 : :
905 : : // init data
906 : 124176 : mpWindowImpl->mpRealParent = pRealParent;
907 : :
908 : : // #99318: make sure fontcache and list is available before call to SetSettings
909 : 124176 : mpFontList = mpWindowImpl->mpFrameData->mpFontList;
910 : 124176 : mpFontCache = mpWindowImpl->mpFrameData->mpFontCache;
911 : :
912 [ + + ]: 124176 : if ( mpWindowImpl->mbFrame )
913 : : {
914 [ + + ]: 5988 : if ( pParent )
915 : : {
916 : 3858 : mpWindowImpl->mpFrameData->mnDPIX = pParent->mpWindowImpl->mpFrameData->mnDPIX;
917 : 3858 : mpWindowImpl->mpFrameData->mnDPIY = pParent->mpWindowImpl->mpFrameData->mnDPIY;
918 : : }
919 : : else
920 : : {
921 [ + - ]: 2130 : if ( ImplGetGraphics() )
922 : : {
923 : 2130 : mpGraphics->GetResolution( mpWindowImpl->mpFrameData->mnDPIX, mpWindowImpl->mpFrameData->mnDPIY );
924 : : }
925 : : }
926 : :
927 : : // add ownerdraw decorated frame windows to list in the top-most frame window
928 : : // so they can be hidden on lose focus
929 [ - + ]: 5988 : if( nStyle & WB_OWNERDRAWDECORATION )
930 [ # # ][ # # ]: 0 : ImplGetOwnerDrawList().push_back( this );
931 : :
932 : : // delay settings initialization until first "real" frame
933 : : // this relies on the IntroWindow not needing any system settings
934 [ + + ][ + + ]: 5988 : if ( !pSVData->maAppData.mbSettingsInit &&
935 : 272 : ! (nStyle & (WB_INTROWIN|WB_DEFAULTWIN))
936 : : )
937 : : {
938 : : // side effect: ImplUpdateGlobalSettings does an ImplGetFrame()->UpdateSettings
939 : 51 : ImplUpdateGlobalSettings( *pSVData->maAppData.mpSettings );
940 : 51 : OutputDevice::SetSettings( *pSVData->maAppData.mpSettings );
941 : 51 : pSVData->maAppData.mbSettingsInit = sal_True;
942 : : }
943 : :
944 : : // If we create a Window with default size, query this
945 : : // size directly, because we want resize all Controls to
946 : : // the correct size before we display the window
947 [ + + ]: 5988 : if ( nStyle & (WB_MOVEABLE | WB_SIZEABLE | WB_APP) )
948 : 1913 : mpWindowImpl->mpFrame->GetClientSize( mnOutWidth, mnOutHeight );
949 : : }
950 : : else
951 : : {
952 [ + - ]: 118188 : if ( pParent )
953 : : {
954 [ + - ]: 118188 : if ( !ImplIsOverlapWindow() )
955 : : {
956 : 118188 : mpWindowImpl->mbDisabled = pParent->mpWindowImpl->mbDisabled;
957 : 118188 : mpWindowImpl->mbInputDisabled = pParent->mpWindowImpl->mbInputDisabled;
958 : 118188 : mpWindowImpl->meAlwaysInputMode = pParent->mpWindowImpl->meAlwaysInputMode;
959 : : }
960 : :
961 : 118188 : OutputDevice::SetSettings( pParent->GetSettings() );
962 : : }
963 : :
964 : : }
965 : :
966 : 124176 : const StyleSettings& rStyleSettings = maSettings.GetStyleSettings();
967 : 124176 : sal_uInt16 nScreenZoom = rStyleSettings.GetScreenZoom();
968 : 124176 : mnDPIX = (mpWindowImpl->mpFrameData->mnDPIX*nScreenZoom)/100;
969 : 124176 : mnDPIY = (mpWindowImpl->mpFrameData->mnDPIY*nScreenZoom)/100;
970 : 124176 : maFont = rStyleSettings.GetAppFont();
971 : 124176 : ImplPointToLogic( maFont );
972 : :
973 [ + + ]: 124176 : if ( nStyle & WB_3DLOOK )
974 : : {
975 : 82475 : SetTextColor( rStyleSettings.GetButtonTextColor() );
976 [ + - ]: 82475 : SetBackground( Wallpaper( rStyleSettings.GetFaceColor() ) );
977 : : }
978 : : else
979 : : {
980 : 41701 : SetTextColor( rStyleSettings.GetWindowTextColor() );
981 [ + - ]: 41701 : SetBackground( Wallpaper( rStyleSettings.GetWindowColor() ) );
982 : : }
983 : :
984 : 124176 : ImplUpdatePos();
985 : :
986 : : // calculate app font res (except for the Intro Window or the default window)
987 [ + + ][ + + ]: 124176 : if ( mpWindowImpl->mbFrame && !pSVData->maGDIData.mnAppFontX && ! (nStyle & (WB_INTROWIN|WB_DEFAULTWIN)) )
[ + + ]
988 : 127 : ImplInitAppFontData( this );
989 : :
990 [ + + ][ + + ]: 124176 : if ( GetAccessibleParentWindow() && GetParent() != Application::GetDefDialogParent() )
[ + + ]
991 : 116722 : GetAccessibleParentWindow()->ImplCallEventListeners( VCLEVENT_WINDOW_CHILDCREATED, this );
992 : 124176 : }
993 : :
994 : : // -----------------------------------------------------------------------
995 : :
996 : 18564 : void Window::ImplSetFrameParent( const Window* pParent )
997 : : {
998 : 18564 : Window* pFrameWindow = ImplGetSVData()->maWinData.mpFirstFrame;
999 [ + + ]: 113981 : while( pFrameWindow )
1000 : : {
1001 : : // search all frames that are children of this window
1002 : : // and reparent them
1003 [ + + ]: 95417 : if( ImplIsRealParentPath( pFrameWindow ) )
1004 : : {
1005 : : DBG_ASSERT( mpWindowImpl->mpFrame != pFrameWindow->mpWindowImpl->mpFrame, "SetFrameParent to own" );
1006 : : DBG_ASSERT( mpWindowImpl->mpFrame, "no frame" );
1007 [ + - ]: 4179 : SalFrame* pParentFrame = pParent ? pParent->mpWindowImpl->mpFrame : NULL;
1008 : 4179 : pFrameWindow->mpWindowImpl->mpFrame->SetParent( pParentFrame );
1009 : : }
1010 : 95417 : pFrameWindow = pFrameWindow->mpWindowImpl->mpFrameData->mpNextFrame;
1011 : : }
1012 : 18564 : }
1013 : :
1014 : : // -----------------------------------------------------------------------
1015 : :
1016 : 137134 : void Window::ImplInsertWindow( Window* pParent )
1017 : : {
1018 : 137134 : mpWindowImpl->mpParent = pParent;
1019 : 137134 : mpWindowImpl->mpRealParent = pParent;
1020 : :
1021 [ + + ][ + + ]: 137134 : if ( pParent && !mpWindowImpl->mbFrame )
1022 : : {
1023 : : // search frame window and set window frame data
1024 : 131130 : Window* pFrameParent = pParent->mpWindowImpl->mpFrameWindow;
1025 : 131130 : mpWindowImpl->mpFrameData = pFrameParent->mpWindowImpl->mpFrameData;
1026 : 131130 : mpWindowImpl->mpFrame = pFrameParent->mpWindowImpl->mpFrame;
1027 : 131130 : mpWindowImpl->mpFrameWindow = pFrameParent;
1028 : 131130 : mpWindowImpl->mbFrame = sal_False;
1029 : :
1030 : : // search overlap window and insert window in list
1031 [ - + ]: 131130 : if ( ImplIsOverlapWindow() )
1032 : : {
1033 : 0 : Window* pFirstOverlapParent = pParent;
1034 [ # # ]: 0 : while ( !pFirstOverlapParent->ImplIsOverlapWindow() )
1035 : 0 : pFirstOverlapParent = pFirstOverlapParent->ImplGetParent();
1036 : 0 : mpWindowImpl->mpOverlapWindow = pFirstOverlapParent;
1037 : :
1038 : 0 : mpWindowImpl->mpNextOverlap = mpWindowImpl->mpFrameData->mpFirstOverlap;
1039 : 0 : mpWindowImpl->mpFrameData->mpFirstOverlap = this;
1040 : :
1041 : : // Overlap-Windows are by default the uppermost
1042 : 0 : mpWindowImpl->mpNext = pFirstOverlapParent->mpWindowImpl->mpFirstOverlap;
1043 : 0 : pFirstOverlapParent->mpWindowImpl->mpFirstOverlap = this;
1044 [ # # ]: 0 : if ( !pFirstOverlapParent->mpWindowImpl->mpLastOverlap )
1045 : 0 : pFirstOverlapParent->mpWindowImpl->mpLastOverlap = this;
1046 : : else
1047 : 0 : mpWindowImpl->mpNext->mpWindowImpl->mpPrev = this;
1048 : : }
1049 : : else
1050 : : {
1051 [ + + ]: 131130 : if ( pParent->ImplIsOverlapWindow() )
1052 : 8037 : mpWindowImpl->mpOverlapWindow = pParent;
1053 : : else
1054 : 123093 : mpWindowImpl->mpOverlapWindow = pParent->mpWindowImpl->mpOverlapWindow;
1055 : 131130 : mpWindowImpl->mpPrev = pParent->mpWindowImpl->mpLastChild;
1056 : 131130 : pParent->mpWindowImpl->mpLastChild = this;
1057 [ + + ]: 131130 : if ( !pParent->mpWindowImpl->mpFirstChild )
1058 : 44802 : pParent->mpWindowImpl->mpFirstChild = this;
1059 : : else
1060 : 86328 : mpWindowImpl->mpPrev->mpWindowImpl->mpNext = this;
1061 : : }
1062 : : }
1063 : 137134 : }
1064 : :
1065 : : // -----------------------------------------------------------------------
1066 : :
1067 : 133451 : void Window::ImplRemoveWindow( sal_Bool bRemoveFrameData )
1068 : : {
1069 : : // remove window from the lists
1070 [ + + ]: 133451 : if ( !mpWindowImpl->mbFrame )
1071 : : {
1072 [ - + ]: 127633 : if ( ImplIsOverlapWindow() )
1073 : : {
1074 [ # # ]: 0 : if ( mpWindowImpl->mpFrameData->mpFirstOverlap == this )
1075 : 0 : mpWindowImpl->mpFrameData->mpFirstOverlap = mpWindowImpl->mpNextOverlap;
1076 : : else
1077 : : {
1078 : 0 : Window* pTempWin = mpWindowImpl->mpFrameData->mpFirstOverlap;
1079 [ # # ]: 0 : while ( pTempWin->mpWindowImpl->mpNextOverlap != this )
1080 : 0 : pTempWin = pTempWin->mpWindowImpl->mpNextOverlap;
1081 : 0 : pTempWin->mpWindowImpl->mpNextOverlap = mpWindowImpl->mpNextOverlap;
1082 : : }
1083 : :
1084 [ # # ]: 0 : if ( mpWindowImpl->mpPrev )
1085 : 0 : mpWindowImpl->mpPrev->mpWindowImpl->mpNext = mpWindowImpl->mpNext;
1086 : : else
1087 : 0 : mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpFirstOverlap = mpWindowImpl->mpNext;
1088 [ # # ]: 0 : if ( mpWindowImpl->mpNext )
1089 : 0 : mpWindowImpl->mpNext->mpWindowImpl->mpPrev = mpWindowImpl->mpPrev;
1090 : : else
1091 : 0 : mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpLastOverlap = mpWindowImpl->mpPrev;
1092 : : }
1093 : : else
1094 : : {
1095 [ + + ]: 127633 : if ( mpWindowImpl->mpPrev )
1096 : 57088 : mpWindowImpl->mpPrev->mpWindowImpl->mpNext = mpWindowImpl->mpNext;
1097 : : else
1098 : 70545 : mpWindowImpl->mpParent->mpWindowImpl->mpFirstChild = mpWindowImpl->mpNext;
1099 [ + + ]: 127633 : if ( mpWindowImpl->mpNext )
1100 : 54643 : mpWindowImpl->mpNext->mpWindowImpl->mpPrev = mpWindowImpl->mpPrev;
1101 : : else
1102 : 72990 : mpWindowImpl->mpParent->mpWindowImpl->mpLastChild = mpWindowImpl->mpPrev;
1103 : : }
1104 : :
1105 : 127633 : mpWindowImpl->mpPrev = NULL;
1106 : 127633 : mpWindowImpl->mpNext = NULL;
1107 : : }
1108 : :
1109 [ + + ]: 133451 : if ( bRemoveFrameData )
1110 : : {
1111 : : // release the graphic
1112 : 129109 : ImplReleaseGraphics();
1113 : : }
1114 : 133451 : }
1115 : :
1116 : : // -----------------------------------------------------------------------
1117 : :
1118 : 147946 : void Window::ImplCallResize()
1119 : : {
1120 : 147946 : mpWindowImpl->mbCallResize = sal_False;
1121 : :
1122 [ + + ]: 147946 : if( GetBackground().IsGradient() )
1123 : 18091 : Invalidate();
1124 : :
1125 : 147946 : Resize();
1126 : :
1127 : : // #88419# Most classes don't call the base class in Resize() and Move(),
1128 : : // => Call ImpleResize/Move instead of Resize/Move directly...
1129 : 147946 : ImplCallEventListeners( VCLEVENT_WINDOW_RESIZE );
1130 : :
1131 : 147946 : ImplExtResize();
1132 : 147946 : }
1133 : :
1134 : : // -----------------------------------------------------------------------
1135 : :
1136 : 171284 : void Window::ImplCallMove()
1137 : : {
1138 : 171284 : mpWindowImpl->mbCallMove = sal_False;
1139 : :
1140 [ + + ]: 171284 : if( mpWindowImpl->mbFrame )
1141 : : {
1142 : : // update frame position
1143 : 1787 : SalFrame *pParentFrame = NULL;
1144 [ + - ]: 1787 : Window *pParent = ImplGetParent();
1145 [ + + ]: 1787 : while( pParent )
1146 : : {
1147 [ + - ]: 56 : if( pParent->mpWindowImpl->mpFrame != mpWindowImpl->mpFrame )
1148 : : {
1149 : 56 : pParentFrame = pParent->mpWindowImpl->mpFrame;
1150 : 56 : break;
1151 : : }
1152 [ # # ]: 0 : pParent = pParent->GetParent();
1153 : : }
1154 : :
1155 [ + - ]: 1787 : SalFrameGeometry g = mpWindowImpl->mpFrame->GetGeometry();
1156 : 1787 : mpWindowImpl->maPos = Point( g.nX, g.nY );
1157 [ + + ]: 1787 : if( pParentFrame )
1158 : : {
1159 [ + - ]: 56 : g = pParentFrame->GetGeometry();
1160 : 56 : mpWindowImpl->maPos -= Point( g.nX, g.nY );
1161 : : }
1162 : : // the client window and and all its subclients have the same position as the borderframe
1163 : : // this is important for floating toolbars where the borderwindow is a floating window
1164 : : // which has another borderwindow (ie the system floating window)
1165 : 1787 : Window *pClientWin = mpWindowImpl->mpClientWindow;
1166 [ + + ]: 3538 : while( pClientWin )
1167 : : {
1168 : 1751 : pClientWin->mpWindowImpl->maPos = mpWindowImpl->maPos;
1169 : 1751 : pClientWin = pClientWin->mpWindowImpl->mpClientWindow;
1170 : : }
1171 : : }
1172 : :
1173 : 171284 : Move();
1174 : :
1175 : 171284 : ImplCallEventListeners( VCLEVENT_WINDOW_MOVE );
1176 : 171284 : }
1177 : :
1178 : : // -----------------------------------------------------------------------
1179 : :
1180 : 5925 : static rtl::OString ImplAutoHelpID( ResMgr* pResMgr )
1181 : : {
1182 : 5925 : rtl::OString aRet;
1183 : :
1184 [ + - ][ + - ]: 5925 : if( pResMgr && Application::IsAutoHelpIdEnabled() )
[ + - ][ + - ]
1185 [ + - ]: 5925 : aRet = pResMgr->GetAutoHelpId();
1186 : :
1187 : 5925 : return aRet;
1188 : : }
1189 : :
1190 : : // -----------------------------------------------------------------------
1191 : :
1192 : 5925 : WinBits Window::ImplInitRes( const ResId& rResId )
1193 : : {
1194 : 5925 : GetRes( rResId );
1195 : :
1196 : 5925 : char* pRes = (char*)GetClassRes();
1197 : 5925 : pRes += 8;
1198 : 5925 : sal_uInt32 nStyle = (sal_uInt32)GetLongRes( (void*)pRes );
1199 : 5925 : rResId.SetWinBits( nStyle );
1200 : 5925 : return nStyle;
1201 : : }
1202 : :
1203 : : // -----------------------------------------------------------------------
1204 : :
1205 : 5925 : void Window::ImplLoadRes( const ResId& rResId )
1206 : : {
1207 [ + - ]: 5925 : sal_uLong nObjMask = ReadLongRes();
1208 : :
1209 : : // we need to calculate auto helpids before the resource gets closed
1210 : : // if the resource only contains flags, it will be closed before we try to read a help id
1211 : : // so we always create an auto help id that might be overwritten later
1212 : : // HelpId
1213 [ + - ]: 5925 : rtl::OString aHelpId = ImplAutoHelpID( rResId.GetResMgr() );
1214 : :
1215 : : // ResourceStyle
1216 [ + - ]: 5925 : sal_uLong nRSStyle = ReadLongRes();
1217 : : // WinBits
1218 [ + - ]: 5925 : ReadLongRes();
1219 : :
1220 [ + + ]: 5925 : if( nObjMask & WINDOW_HELPID )
1221 [ + - ]: 3083 : aHelpId = ReadByteStringRes();
1222 : :
1223 [ + - ]: 5925 : SetHelpId( aHelpId );
1224 : :
1225 : 5925 : sal_Bool bPos = sal_False;
1226 : 5925 : sal_Bool bSize = sal_False;
1227 : 5925 : Point aPos;
1228 : 5925 : Size aSize;
1229 : :
1230 [ + + ]: 5925 : if ( nObjMask & (WINDOW_XYMAPMODE | WINDOW_X | WINDOW_Y) )
1231 : : {
1232 : : // use size as per resource
1233 : 767 : MapUnit ePosMap = MAP_PIXEL;
1234 : :
1235 : 767 : bPos = sal_True;
1236 : :
1237 [ + - ]: 767 : if ( nObjMask & WINDOW_XYMAPMODE )
1238 [ + - ]: 767 : ePosMap = (MapUnit)ReadLongRes();
1239 [ + - ]: 767 : if ( nObjMask & WINDOW_X )
1240 [ + - ][ + - ]: 767 : aPos.X() = ImplLogicUnitToPixelX( ReadLongRes(), ePosMap );
1241 [ + - ]: 767 : if ( nObjMask & WINDOW_Y )
1242 [ + - ][ + - ]: 767 : aPos.Y() = ImplLogicUnitToPixelY( ReadLongRes(), ePosMap );
1243 : : }
1244 : :
1245 [ + + ]: 5925 : if ( nObjMask & (WINDOW_WHMAPMODE | WINDOW_WIDTH | WINDOW_HEIGHT) )
1246 : : {
1247 : : // use size as per resource
1248 : 1969 : MapUnit eSizeMap = MAP_PIXEL;
1249 : :
1250 : 1969 : bSize = sal_True;
1251 : :
1252 [ + - ]: 1969 : if ( nObjMask & WINDOW_WHMAPMODE )
1253 [ + - ]: 1969 : eSizeMap = (MapUnit)ReadLongRes();
1254 [ + - ]: 1969 : if ( nObjMask & WINDOW_WIDTH )
1255 [ + - ][ + - ]: 1969 : aSize.Width() = ImplLogicUnitToPixelX( ReadLongRes(), eSizeMap );
1256 [ + - ]: 1969 : if ( nObjMask & WINDOW_HEIGHT )
1257 [ + - ][ + - ]: 1969 : aSize.Height() = ImplLogicUnitToPixelY( ReadLongRes(), eSizeMap );
1258 : : }
1259 : :
1260 : : // looks bad due to optimisation
1261 [ + + ]: 5925 : if ( nRSStyle & RSWND_CLIENTSIZE )
1262 : : {
1263 [ + + ]: 241 : if ( bPos )
1264 [ + - ]: 154 : SetPosPixel( aPos );
1265 [ + + ]: 241 : if ( bSize )
1266 [ + - ]: 239 : SetOutputSizePixel( aSize );
1267 : : }
1268 [ + + ][ + - ]: 5684 : else if ( bPos && bSize )
1269 [ + - ]: 613 : SetPosSizePixel( aPos, aSize );
1270 [ - + ]: 5071 : else if ( bPos )
1271 [ # # ]: 0 : SetPosPixel( aPos );
1272 [ + + ]: 5071 : else if ( bSize )
1273 [ + - ]: 1117 : SetSizePixel( aSize );
1274 : :
1275 [ - + ]: 5925 : if ( nRSStyle & RSWND_DISABLED )
1276 [ # # ]: 0 : Enable( sal_False );
1277 : :
1278 [ + + ]: 5925 : if ( nObjMask & WINDOW_TEXT )
1279 [ + - ][ + - ]: 497 : SetText( ReadStringRes() );
[ + - ][ + - ]
1280 [ - + ]: 5925 : if ( nObjMask & WINDOW_HELPTEXT )
1281 : : {
1282 [ # # ][ # # ]: 0 : SetHelpText( ReadStringRes() );
[ # # ][ # # ]
1283 : 0 : mpWindowImpl->mbHelpTextDynamic = sal_True;
1284 : : }
1285 [ - + ]: 5925 : if ( nObjMask & WINDOW_QUICKTEXT )
1286 [ # # ][ # # ]: 0 : SetQuickHelpText( ReadStringRes() );
[ # # ][ # # ]
1287 [ - + ]: 5925 : if ( nObjMask & WINDOW_EXTRALONG )
1288 : : {
1289 [ # # ]: 0 : sal_uIntPtr nRes = ReadLongRes();
1290 [ # # ]: 0 : SetData( (void*)nRes );
1291 : : }
1292 [ - + ]: 5925 : if ( nObjMask & WINDOW_UNIQUEID )
1293 [ # # ][ # # ]: 0 : SetUniqueId( ReadByteStringRes() );
1294 : :
1295 [ - + ]: 5925 : if ( nObjMask & WINDOW_BORDER_STYLE )
1296 : : {
1297 [ # # ]: 0 : sal_uInt16 nBorderStyle = (sal_uInt16)ReadLongRes();
1298 [ # # ]: 0 : SetBorderStyle( nBorderStyle );
1299 : 5925 : }
1300 : 5925 : }
1301 : :
1302 : : // -----------------------------------------------------------------------
1303 : :
1304 : 1132705 : ImplWinData* Window::ImplGetWinData() const
1305 : : {
1306 [ + + ]: 1132705 : if ( !mpWindowImpl->mpWinData )
1307 : : {
1308 [ + + ][ + - ]: 122525 : static const char* pNoNWF = getenv( "SAL_NO_NWF" );
1309 : :
1310 [ + - ]: 122525 : ((Window*)this)->mpWindowImpl->mpWinData = new ImplWinData;
1311 : 122525 : mpWindowImpl->mpWinData->mpExtOldText = NULL;
1312 : 122525 : mpWindowImpl->mpWinData->mpExtOldAttrAry = NULL;
1313 : 122525 : mpWindowImpl->mpWinData->mpCursorRect = 0;
1314 : 122525 : mpWindowImpl->mpWinData->mnCursorExtWidth = 0;
1315 : 122525 : mpWindowImpl->mpWinData->mpFocusRect = NULL;
1316 : 122525 : mpWindowImpl->mpWinData->mpTrackRect = NULL;
1317 : 122525 : mpWindowImpl->mpWinData->mnTrackFlags = 0;
1318 : 122525 : mpWindowImpl->mpWinData->mnIsTopWindow = (sal_uInt16) ~0; // not initialized yet, 0/1 will indicate TopWindow (see IsTopWindow())
1319 : 122525 : mpWindowImpl->mpWinData->mbMouseOver = sal_False;
1320 [ - + ][ # # ]: 122525 : mpWindowImpl->mpWinData->mbEnableNativeWidget = (pNoNWF && *pNoNWF) ? sal_False : sal_True; // sal_True: try to draw this control with native theme API
1321 : : }
1322 : :
1323 : 1132705 : return mpWindowImpl->mpWinData;
1324 : : }
1325 : :
1326 : : // -----------------------------------------------------------------------
1327 : :
1328 : 399 : SalGraphics* Window::ImplGetFrameGraphics() const
1329 : : {
1330 [ + - ]: 399 : if ( mpWindowImpl->mpFrameWindow->mpGraphics )
1331 : 399 : mpWindowImpl->mpFrameWindow->mbInitClipRegion = sal_True;
1332 : : else
1333 : 0 : mpWindowImpl->mpFrameWindow->ImplGetGraphics();
1334 : 399 : mpWindowImpl->mpFrameWindow->mpGraphics->ResetClipRegion();
1335 : 399 : return mpWindowImpl->mpFrameWindow->mpGraphics;
1336 : : }
1337 : :
1338 : : // -----------------------------------------------------------------------
1339 : :
1340 : 0 : Window* Window::ImplFindWindow( const Point& rFramePos )
1341 : : {
1342 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
1343 : :
1344 : : Window* pTempWindow;
1345 : : Window* pFindWindow;
1346 : :
1347 : : // first check all overlapping windows
1348 : 0 : pTempWindow = mpWindowImpl->mpFirstOverlap;
1349 [ # # ]: 0 : while ( pTempWindow )
1350 : : {
1351 : 0 : pFindWindow = pTempWindow->ImplFindWindow( rFramePos );
1352 [ # # ]: 0 : if ( pFindWindow )
1353 : 0 : return pFindWindow;
1354 : 0 : pTempWindow = pTempWindow->mpWindowImpl->mpNext;
1355 : : }
1356 : :
1357 : : // then we check our window
1358 [ # # ]: 0 : if ( !mpWindowImpl->mbVisible )
1359 : 0 : return NULL;
1360 : :
1361 : 0 : sal_uInt16 nHitTest = ImplHitTest( rFramePos );
1362 [ # # ]: 0 : if ( nHitTest & WINDOW_HITTEST_INSIDE )
1363 : : {
1364 : : // and then we check all child windows
1365 : 0 : pTempWindow = mpWindowImpl->mpFirstChild;
1366 [ # # ]: 0 : while ( pTempWindow )
1367 : : {
1368 : 0 : pFindWindow = pTempWindow->ImplFindWindow( rFramePos );
1369 [ # # ]: 0 : if ( pFindWindow )
1370 : 0 : return pFindWindow;
1371 : 0 : pTempWindow = pTempWindow->mpWindowImpl->mpNext;
1372 : : }
1373 : :
1374 [ # # ]: 0 : if ( nHitTest & WINDOW_HITTEST_TRANSPARENT )
1375 : 0 : return NULL;
1376 : : else
1377 : 0 : return this;
1378 : : }
1379 : :
1380 : 0 : return NULL;
1381 : : }
1382 : :
1383 : : // -----------------------------------------------------------------------
1384 : :
1385 : 0 : sal_uInt16 Window::ImplHitTest( const Point& rFramePos )
1386 : : {
1387 : 0 : Point aFramePos( rFramePos );
1388 [ # # ][ # # ]: 0 : if( ImplIsAntiparallel() )
1389 : : {
1390 : : // - RTL - re-mirror frame pos at this window
1391 [ # # ]: 0 : ImplReMirror( aFramePos );
1392 : : }
1393 [ # # ]: 0 : Rectangle aRect( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) );
1394 [ # # ][ # # ]: 0 : if ( !aRect.IsInside( aFramePos ) )
1395 : 0 : return 0;
1396 [ # # ]: 0 : if ( mpWindowImpl->mbWinRegion )
1397 : : {
1398 : 0 : Point aTempPos = aFramePos;
1399 : 0 : aTempPos.X() -= mnOutOffX;
1400 : 0 : aTempPos.Y() -= mnOutOffY;
1401 [ # # ][ # # ]: 0 : if ( !mpWindowImpl->maWinRegion.IsInside( aTempPos ) )
1402 : 0 : return 0;
1403 : : }
1404 : :
1405 : 0 : sal_uInt16 nHitTest = WINDOW_HITTEST_INSIDE;
1406 [ # # ]: 0 : if ( mpWindowImpl->mbMouseTransparent )
1407 : 0 : nHitTest |= WINDOW_HITTEST_TRANSPARENT;
1408 : 0 : return nHitTest;
1409 : : }
1410 : :
1411 : : // -----------------------------------------------------------------------
1412 : :
1413 : 212474 : sal_Bool Window::ImplIsRealParentPath( const Window* pWindow ) const
1414 : : {
1415 : 212474 : pWindow = pWindow->GetParent();
1416 [ + + ]: 806288 : while ( pWindow )
1417 : : {
1418 [ + + ]: 599740 : if ( pWindow == this )
1419 : 5926 : return sal_True;
1420 : 593814 : pWindow = pWindow->GetParent();
1421 : : }
1422 : :
1423 : 212474 : return sal_False;
1424 : : }
1425 : :
1426 : : // -----------------------------------------------------------------------
1427 : :
1428 : 532787 : sal_Bool Window::ImplIsChild( const Window* pWindow, sal_Bool bSystemWindow ) const
1429 : : {
1430 [ + + ]: 439679 : do
1431 : : {
1432 [ + + ][ + + ]: 532787 : if ( !bSystemWindow && pWindow->ImplIsOverlapWindow() )
[ + + ]
1433 : 69575 : break;
1434 : :
1435 : 463212 : pWindow = pWindow->ImplGetParent();
1436 : :
1437 [ + + ]: 463212 : if ( pWindow == this )
1438 : 23533 : return sal_True;
1439 : : }
1440 : : while ( pWindow );
1441 : :
1442 : 113290 : return sal_False;
1443 : : }
1444 : :
1445 : : // -----------------------------------------------------------------------
1446 : :
1447 : 52127 : sal_Bool Window::ImplIsWindowOrChild( const Window* pWindow, sal_Bool bSystemWindow ) const
1448 : : {
1449 [ + + ]: 52127 : if ( this == pWindow )
1450 : 1203 : return sal_True;
1451 : 52127 : return ImplIsChild( pWindow, bSystemWindow );
1452 : : }
1453 : :
1454 : : // -----------------------------------------------------------------------
1455 : :
1456 : 15164 : int Window::ImplTestMousePointerSet()
1457 : : {
1458 : : // as soon as mouse is captured, switch mouse-pointer
1459 [ + - ][ - + ]: 15164 : if ( IsMouseCaptured() )
1460 : 0 : return sal_True;
1461 : :
1462 : : // if the mouse is over the window, switch it
1463 [ + - ]: 15164 : Rectangle aClientRect( Point( 0, 0 ), GetOutputSizePixel() );
1464 [ + - ][ + - ]: 15164 : if ( aClientRect.IsInside( GetPointerPosPixel() ) )
[ - + ]
1465 : 0 : return sal_True;
1466 : :
1467 : 15164 : return sal_False;
1468 : : }
1469 : :
1470 : : // -----------------------------------------------------------------------
1471 : :
1472 : 0 : PointerStyle Window::ImplGetMousePointer() const
1473 : : {
1474 : : PointerStyle ePointerStyle;
1475 : 0 : sal_Bool bWait = sal_False;
1476 : :
1477 [ # # ][ # # ]: 0 : if ( IsEnabled() && IsInputEnabled() && ! IsInModalMode() )
[ # # ][ # # ]
1478 : 0 : ePointerStyle = GetPointer().GetStyle();
1479 : : else
1480 : 0 : ePointerStyle = POINTER_ARROW;
1481 : :
1482 : 0 : const Window* pWindow = this;
1483 [ # # ]: 0 : do
1484 : : {
1485 : : // when the pointer is not visible stop the search, as
1486 : : // this status should not be overwritten
1487 [ # # ]: 0 : if ( pWindow->mpWindowImpl->mbNoPtrVisible )
1488 : 0 : return POINTER_NULL;
1489 : :
1490 [ # # ]: 0 : if ( !bWait )
1491 : : {
1492 [ # # ]: 0 : if ( pWindow->mpWindowImpl->mnWaitCount )
1493 : : {
1494 : 0 : ePointerStyle = POINTER_WAIT;
1495 : 0 : bWait = sal_True;
1496 : : }
1497 : : else
1498 : : {
1499 [ # # ]: 0 : if ( pWindow->mpWindowImpl->mbChildPtrOverwrite )
1500 : 0 : ePointerStyle = pWindow->GetPointer().GetStyle();
1501 : : }
1502 : : }
1503 : :
1504 [ # # ]: 0 : if ( pWindow->ImplIsOverlapWindow() )
1505 : 0 : break;
1506 : :
1507 : 0 : pWindow = pWindow->ImplGetParent();
1508 : : }
1509 : : while ( pWindow );
1510 : :
1511 : 0 : return ePointerStyle;
1512 : : }
1513 : :
1514 : : // -----------------------------------------------------------------------
1515 : :
1516 : 61669 : void Window::ImplResetReallyVisible()
1517 : : {
1518 : 61669 : sal_Bool bBecameReallyInvisible = mpWindowImpl->mbReallyVisible;
1519 : :
1520 : 61669 : mbDevOutput = sal_False;
1521 : 61669 : mpWindowImpl->mbReallyVisible = sal_False;
1522 : 61669 : mpWindowImpl->mbReallyShown = sal_False;
1523 : :
1524 : : // the SHOW/HIDE events serve as indicators to send child creation/destroy events to the access bridge.
1525 : : // For this, the data member of the event must not be NULL.
1526 : : // Previously, we did this in Window::Show, but there some events got lost in certain situations.
1527 [ + - ][ + + ]: 61669 : if( bBecameReallyInvisible && ImplIsAccessibleCandidate() )
[ + + ]
1528 : 55837 : ImplCallEventListeners( VCLEVENT_WINDOW_HIDE, this );
1529 : : // TODO. It's kind of a hack that we're re-using the VCLEVENT_WINDOW_HIDE. Normally, we should
1530 : : // introduce another event which explicitly triggers the Accessibility implementations.
1531 : :
1532 : 61669 : Window* pWindow = mpWindowImpl->mpFirstOverlap;
1533 [ - + ]: 61669 : while ( pWindow )
1534 : : {
1535 [ # # ]: 0 : if ( pWindow->mpWindowImpl->mbReallyVisible )
1536 : 0 : pWindow->ImplResetReallyVisible();
1537 : 0 : pWindow = pWindow->mpWindowImpl->mpNext;
1538 : : }
1539 : :
1540 : 61669 : pWindow = mpWindowImpl->mpFirstChild;
1541 [ + + ]: 91570 : while ( pWindow )
1542 : : {
1543 [ + + ]: 29901 : if ( pWindow->mpWindowImpl->mbReallyVisible )
1544 : 17966 : pWindow->ImplResetReallyVisible();
1545 : 29901 : pWindow = pWindow->mpWindowImpl->mpNext;
1546 : : }
1547 : 61669 : }
1548 : :
1549 : : // -----------------------------------------------------------------------
1550 : :
1551 : 81961 : void Window::ImplSetReallyVisible()
1552 : : {
1553 : : // #i43594# it is possible that INITSHOW was never send, because the visibility state changed between
1554 : : // ImplCallInitShow() and ImplSetReallyVisible() when called from Show()
1555 : : // mbReallyShown is a useful indicator
1556 [ + + ]: 81961 : if( !mpWindowImpl->mbReallyShown )
1557 : 1336 : ImplCallInitShow();
1558 : :
1559 : 81961 : sal_Bool bBecameReallyVisible = !mpWindowImpl->mbReallyVisible;
1560 : :
1561 : 81961 : mbDevOutput = sal_True;
1562 : 81961 : mpWindowImpl->mbReallyVisible = sal_True;
1563 : 81961 : mpWindowImpl->mbReallyShown = sal_True;
1564 : :
1565 : : // the SHOW/HIDE events serve as indicators to send child creation/destroy events to the access bridge.
1566 : : // For this, the data member of the event must not be NULL.
1567 : : // Previously, we did this in Window::Show, but there some events got lost in certain situations. Now
1568 : : // we're doing it when the visibility really changes
1569 [ + + ][ + + ]: 81961 : if( bBecameReallyVisible && ImplIsAccessibleCandidate() )
[ + + ]
1570 : 57807 : ImplCallEventListeners( VCLEVENT_WINDOW_SHOW, this );
1571 : : // TODO. It's kind of a hack that we're re-using the VCLEVENT_WINDOW_SHOW. Normally, we should
1572 : : // introduce another event which explicitly triggers the Accessibility implementations.
1573 : :
1574 : 81961 : Window* pWindow = mpWindowImpl->mpFirstOverlap;
1575 [ - + ]: 81961 : while ( pWindow )
1576 : : {
1577 [ # # ]: 0 : if ( pWindow->mpWindowImpl->mbVisible )
1578 : 0 : pWindow->ImplSetReallyVisible();
1579 : 0 : pWindow = pWindow->mpWindowImpl->mpNext;
1580 : : }
1581 : :
1582 : 81961 : pWindow = mpWindowImpl->mpFirstChild;
1583 [ + + ]: 173064 : while ( pWindow )
1584 : : {
1585 [ + + ]: 91103 : if ( pWindow->mpWindowImpl->mbVisible )
1586 : 65808 : pWindow->ImplSetReallyVisible();
1587 : 91103 : pWindow = pWindow->mpWindowImpl->mpNext;
1588 : : }
1589 : 81961 : }
1590 : :
1591 : : // -----------------------------------------------------------------------
1592 : :
1593 : 64589 : void Window::ImplCallInitShow()
1594 : : {
1595 : 64589 : mpWindowImpl->mbReallyShown = sal_True;
1596 : 64589 : mpWindowImpl->mbInInitShow = sal_True;
1597 : 64589 : StateChanged( STATE_CHANGE_INITSHOW );
1598 : 64589 : mpWindowImpl->mbInInitShow = sal_False;
1599 : :
1600 : 64589 : Window* pWindow = mpWindowImpl->mpFirstOverlap;
1601 [ - + ]: 64589 : while ( pWindow )
1602 : : {
1603 [ # # ]: 0 : if ( pWindow->mpWindowImpl->mbVisible )
1604 : 0 : pWindow->ImplCallInitShow();
1605 : 0 : pWindow = pWindow->mpWindowImpl->mpNext;
1606 : : }
1607 : :
1608 : 64589 : pWindow = mpWindowImpl->mpFirstChild;
1609 [ + + ]: 145361 : while ( pWindow )
1610 : : {
1611 [ + + ]: 80772 : if ( pWindow->mpWindowImpl->mbVisible )
1612 : 47100 : pWindow->ImplCallInitShow();
1613 : 80772 : pWindow = pWindow->mpWindowImpl->mpNext;
1614 : : }
1615 : 64589 : }
1616 : :
1617 : : // -----------------------------------------------------------------------
1618 : :
1619 : 13937860 : void Window::ImplAddDel( ImplDelData* pDel ) // TODO: make "const" when incompatiblity ok
1620 : : {
1621 : : DBG_ASSERT( !pDel->mpWindow, "Window::ImplAddDel(): cannot add ImplDelData twice !" );
1622 [ + - ]: 13937860 : if( !pDel->mpWindow )
1623 : : {
1624 : 13937860 : pDel->mpWindow = this; // #112873# store ref to this window, so pDel can remove itself
1625 : 13937860 : pDel->mpNext = mpWindowImpl->mpFirstDel;
1626 : 13937860 : mpWindowImpl->mpFirstDel = pDel;
1627 : : }
1628 : 13937860 : }
1629 : :
1630 : : // -----------------------------------------------------------------------
1631 : :
1632 : 13937856 : void Window::ImplRemoveDel( ImplDelData* pDel ) // TODO: make "const" when incompatiblity ok
1633 : : {
1634 : 13937856 : pDel->mpWindow = NULL; // #112873# pDel is not associated with a Window anymore
1635 [ + - ]: 13937856 : if ( mpWindowImpl->mpFirstDel == pDel )
1636 : 13937856 : mpWindowImpl->mpFirstDel = pDel->mpNext;
1637 : : else
1638 : : {
1639 : 0 : ImplDelData* pData = mpWindowImpl->mpFirstDel;
1640 [ # # ]: 0 : while ( pData->mpNext != pDel )
1641 : 0 : pData = pData->mpNext;
1642 : 0 : pData->mpNext = pDel->mpNext;
1643 : : }
1644 : 13937856 : }
1645 : :
1646 : : // -----------------------------------------------------------------------
1647 : :
1648 : 42422 : void Window::ImplInitResolutionSettings()
1649 : : {
1650 : : // recalculate AppFont-resolution and DPI-resolution
1651 [ + + ]: 42422 : if ( mpWindowImpl->mbFrame )
1652 : : {
1653 : 334 : const StyleSettings& rStyleSettings = maSettings.GetStyleSettings();
1654 : 334 : sal_uInt16 nScreenZoom = rStyleSettings.GetScreenZoom();
1655 : 334 : mnDPIX = (mpWindowImpl->mpFrameData->mnDPIX*nScreenZoom)/100;
1656 : 334 : mnDPIY = (mpWindowImpl->mpFrameData->mnDPIY*nScreenZoom)/100;
1657 : 334 : SetPointFont( rStyleSettings.GetAppFont() );
1658 : : }
1659 [ + - ]: 42088 : else if ( mpWindowImpl->mpParent )
1660 : : {
1661 : 42088 : mnDPIX = mpWindowImpl->mpParent->mnDPIX;
1662 : 42088 : mnDPIY = mpWindowImpl->mpParent->mnDPIY;
1663 : : }
1664 : :
1665 : : // update the recalculated values for logical units
1666 : : // and also tools belonging to the values
1667 [ + + ]: 42422 : if ( IsMapMode() )
1668 : : {
1669 [ + - ]: 35623 : MapMode aMapMode = GetMapMode();
1670 [ + - ]: 35623 : SetMapMode();
1671 [ + - ][ + - ]: 35623 : SetMapMode( aMapMode );
1672 : : }
1673 : 42422 : }
1674 : :
1675 : : // -----------------------------------------------------------------------
1676 : :
1677 : 180397 : void Window::ImplPointToLogic( Font& rFont ) const
1678 : : {
1679 [ + - ]: 180397 : Size aSize = rFont.GetSize();
1680 : 180397 : sal_uInt16 nScreenFontZoom = maSettings.GetStyleSettings().GetScreenFontZoom();
1681 : :
1682 [ + + ]: 180397 : if ( aSize.Width() )
1683 : : {
1684 : 7005 : aSize.Width() *= mpWindowImpl->mpFrameData->mnDPIX;
1685 : 7005 : aSize.Width() += 72/2;
1686 : 7005 : aSize.Width() /= 72;
1687 : 7005 : aSize.Width() *= nScreenFontZoom;
1688 : 7005 : aSize.Width() /= 100;
1689 : : }
1690 : 180397 : aSize.Height() *= mpWindowImpl->mpFrameData->mnDPIY;
1691 : 180397 : aSize.Height() += 72/2;
1692 : 180397 : aSize.Height() /= 72;
1693 : 180397 : aSize.Height() *= nScreenFontZoom;
1694 : 180397 : aSize.Height() /= 100;
1695 : :
1696 [ - + ]: 180397 : if ( IsMapModeEnabled() )
1697 [ # # ]: 0 : aSize = PixelToLogic( aSize );
1698 : :
1699 [ + - ]: 180397 : rFont.SetSize( aSize );
1700 : 180397 : }
1701 : :
1702 : : // -----------------------------------------------------------------------
1703 : :
1704 : 0 : void Window::ImplLogicToPoint( Font& rFont ) const
1705 : : {
1706 [ # # ]: 0 : Size aSize = rFont.GetSize();
1707 : 0 : sal_uInt16 nScreenFontZoom = maSettings.GetStyleSettings().GetScreenFontZoom();
1708 : :
1709 [ # # ]: 0 : if ( IsMapModeEnabled() )
1710 [ # # ]: 0 : aSize = LogicToPixel( aSize );
1711 : :
1712 [ # # ]: 0 : if ( aSize.Width() )
1713 : : {
1714 : 0 : aSize.Width() *= 100;
1715 : 0 : aSize.Width() /= nScreenFontZoom;
1716 : 0 : aSize.Width() *= 72;
1717 : 0 : aSize.Width() += mpWindowImpl->mpFrameData->mnDPIX/2;
1718 : 0 : aSize.Width() /= mpWindowImpl->mpFrameData->mnDPIX;
1719 : : }
1720 : 0 : aSize.Height() *= 100;
1721 : 0 : aSize.Height() /= nScreenFontZoom;
1722 : 0 : aSize.Height() *= 72;
1723 : 0 : aSize.Height() += mpWindowImpl->mpFrameData->mnDPIY/2;
1724 : 0 : aSize.Height() /= mpWindowImpl->mpFrameData->mnDPIY;
1725 : :
1726 [ # # ]: 0 : rFont.SetSize( aSize );
1727 : 0 : }
1728 : :
1729 : : // -----------------------------------------------------------------------
1730 : :
1731 : 0 : sal_Bool Window::ImplSysObjClip( const Region* pOldRegion )
1732 : : {
1733 : 0 : sal_Bool bUpdate = sal_True;
1734 : :
1735 [ # # ]: 0 : if ( mpWindowImpl->mpSysObj )
1736 : : {
1737 : 0 : bool bVisibleState = mpWindowImpl->mbReallyVisible;
1738 : :
1739 [ # # ]: 0 : if ( bVisibleState )
1740 : : {
1741 : 0 : Region* pWinChildClipRegion = ImplGetWinChildClipRegion();
1742 : :
1743 [ # # ]: 0 : if ( !pWinChildClipRegion->IsEmpty() )
1744 : : {
1745 [ # # ]: 0 : if ( pOldRegion )
1746 : : {
1747 [ # # ]: 0 : Region aNewRegion = *pWinChildClipRegion;
1748 [ # # ]: 0 : pWinChildClipRegion->Intersect( *pOldRegion );
1749 [ # # ][ # # ]: 0 : bUpdate = aNewRegion == *pWinChildClipRegion;
1750 : : }
1751 : :
1752 [ # # ]: 0 : if ( mpWindowImpl->mpFrameData->mpFirstBackWin )
1753 [ # # ]: 0 : ImplInvalidateAllOverlapBackgrounds();
1754 : :
1755 [ # # ]: 0 : Region aRegion = *pWinChildClipRegion;
1756 [ # # ]: 0 : Rectangle aWinRect( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) );
1757 [ # # ]: 0 : Region aWinRectRegion( aWinRect );
1758 [ # # ]: 0 : sal_uInt16 nClipFlags = mpWindowImpl->mpSysObj->GetClipRegionType();
1759 : :
1760 [ # # ][ # # ]: 0 : if ( aRegion == aWinRectRegion )
1761 [ # # ]: 0 : mpWindowImpl->mpSysObj->ResetClipRegion();
1762 : : else
1763 : : {
1764 [ # # ]: 0 : if ( nClipFlags & SAL_OBJECT_CLIP_EXCLUDERECTS )
1765 : : {
1766 [ # # ]: 0 : aWinRectRegion.Exclude( aRegion );
1767 [ # # ]: 0 : aRegion = aWinRectRegion;
1768 : : }
1769 [ # # ]: 0 : if ( !(nClipFlags & SAL_OBJECT_CLIP_ABSOLUTE) )
1770 [ # # ]: 0 : aRegion.Move( -mnOutOffX, -mnOutOffY );
1771 : :
1772 : : // ClipRegion setzen/updaten
1773 : : long nX;
1774 : : long nY;
1775 : : long nWidth;
1776 : : long nHeight;
1777 : : sal_uLong nRectCount;
1778 : : ImplRegionInfo aInfo;
1779 : : sal_Bool bRegionRect;
1780 : :
1781 [ # # ]: 0 : nRectCount = aRegion.GetRectCount();
1782 [ # # ]: 0 : mpWindowImpl->mpSysObj->BeginSetClipRegion( nRectCount );
1783 [ # # ]: 0 : bRegionRect = aRegion.ImplGetFirstRect( aInfo, nX, nY, nWidth, nHeight );
1784 [ # # ]: 0 : while ( bRegionRect )
1785 : : {
1786 [ # # ]: 0 : mpWindowImpl->mpSysObj->UnionClipRegion( nX, nY, nWidth, nHeight );
1787 [ # # ]: 0 : bRegionRect = aRegion.ImplGetNextRect( aInfo, nX, nY, nWidth, nHeight );
1788 : : }
1789 [ # # ]: 0 : mpWindowImpl->mpSysObj->EndSetClipRegion();
1790 [ # # ][ # # ]: 0 : }
1791 : : }
1792 : : else
1793 : 0 : bVisibleState = sal_False;
1794 : : }
1795 : :
1796 : : // Visible-Status updaten
1797 : 0 : mpWindowImpl->mpSysObj->Show( bVisibleState );
1798 : : }
1799 : :
1800 : 0 : return bUpdate;
1801 : : }
1802 : :
1803 : : // -----------------------------------------------------------------------
1804 : :
1805 : 0 : void Window::ImplUpdateSysObjChildrenClip()
1806 : : {
1807 [ # # ][ # # ]: 0 : if ( mpWindowImpl->mpSysObj && mpWindowImpl->mbInitWinClipRegion )
1808 : 0 : ImplSysObjClip( NULL );
1809 : :
1810 : 0 : Window* pWindow = mpWindowImpl->mpFirstChild;
1811 [ # # ]: 0 : while ( pWindow )
1812 : : {
1813 : 0 : pWindow->ImplUpdateSysObjChildrenClip();
1814 : 0 : pWindow = pWindow->mpWindowImpl->mpNext;
1815 : : }
1816 : 0 : }
1817 : :
1818 : : // -----------------------------------------------------------------------
1819 : :
1820 : 0 : void Window::ImplUpdateSysObjOverlapsClip()
1821 : : {
1822 : 0 : ImplUpdateSysObjChildrenClip();
1823 : :
1824 : 0 : Window* pWindow = mpWindowImpl->mpFirstOverlap;
1825 [ # # ]: 0 : while ( pWindow )
1826 : : {
1827 : 0 : pWindow->ImplUpdateSysObjOverlapsClip();
1828 : 0 : pWindow = pWindow->mpWindowImpl->mpNext;
1829 : : }
1830 : 0 : }
1831 : :
1832 : : // -----------------------------------------------------------------------
1833 : :
1834 : 0 : void Window::ImplUpdateSysObjClip()
1835 : : {
1836 [ # # ]: 0 : if ( !ImplIsOverlapWindow() )
1837 : : {
1838 : 0 : ImplUpdateSysObjChildrenClip();
1839 : :
1840 : : // siblings should recalculate their clip region
1841 [ # # ]: 0 : if ( mpWindowImpl->mbClipSiblings )
1842 : : {
1843 : 0 : Window* pWindow = mpWindowImpl->mpNext;
1844 [ # # ]: 0 : while ( pWindow )
1845 : : {
1846 : 0 : pWindow->ImplUpdateSysObjChildrenClip();
1847 : 0 : pWindow = pWindow->mpWindowImpl->mpNext;
1848 : : }
1849 : : }
1850 : : }
1851 : : else
1852 : 0 : mpWindowImpl->mpFrameWindow->ImplUpdateSysObjOverlapsClip();
1853 : 0 : }
1854 : :
1855 : : // -----------------------------------------------------------------------
1856 : :
1857 : 418455 : sal_Bool Window::ImplSetClipFlagChildren( sal_Bool bSysObjOnlySmaller )
1858 : : {
1859 : 418455 : sal_Bool bUpdate = sal_True;
1860 [ - + ]: 418455 : if ( mpWindowImpl->mpSysObj )
1861 : : {
1862 : 0 : Region* pOldRegion = NULL;
1863 [ # # ][ # # ]: 0 : if ( bSysObjOnlySmaller && !mpWindowImpl->mbInitWinClipRegion )
1864 [ # # ]: 0 : pOldRegion = new Region( mpWindowImpl->maWinClipRegion );
1865 : :
1866 : 0 : mbInitClipRegion = sal_True;
1867 : 0 : mpWindowImpl->mbInitWinClipRegion = sal_True;
1868 : :
1869 : 0 : Window* pWindow = mpWindowImpl->mpFirstChild;
1870 [ # # ]: 0 : while ( pWindow )
1871 : : {
1872 [ # # ]: 0 : if ( !pWindow->ImplSetClipFlagChildren( bSysObjOnlySmaller ) )
1873 : 0 : bUpdate = sal_False;
1874 : 0 : pWindow = pWindow->mpWindowImpl->mpNext;
1875 : : }
1876 : :
1877 [ # # ]: 0 : if ( !ImplSysObjClip( pOldRegion ) )
1878 : : {
1879 : 0 : mbInitClipRegion = sal_True;
1880 : 0 : mpWindowImpl->mbInitWinClipRegion = sal_True;
1881 : 0 : bUpdate = sal_False;
1882 : : }
1883 : :
1884 [ # # ]: 0 : delete pOldRegion;
1885 : : }
1886 : : else
1887 : : {
1888 : 418455 : mbInitClipRegion = sal_True;
1889 : 418455 : mpWindowImpl->mbInitWinClipRegion = sal_True;
1890 : :
1891 : 418455 : Window* pWindow = mpWindowImpl->mpFirstChild;
1892 [ + + ]: 743022 : while ( pWindow )
1893 : : {
1894 [ - + ]: 324567 : if ( !pWindow->ImplSetClipFlagChildren( bSysObjOnlySmaller ) )
1895 : 0 : bUpdate = sal_False;
1896 : 324567 : pWindow = pWindow->mpWindowImpl->mpNext;
1897 : : }
1898 : : }
1899 : 418455 : return bUpdate;
1900 : : }
1901 : :
1902 : : // -----------------------------------------------------------------------
1903 : :
1904 : 3656 : sal_Bool Window::ImplSetClipFlagOverlapWindows( sal_Bool bSysObjOnlySmaller )
1905 : : {
1906 : 3656 : sal_Bool bUpdate = ImplSetClipFlagChildren( bSysObjOnlySmaller );
1907 : :
1908 : 3656 : Window* pWindow = mpWindowImpl->mpFirstOverlap;
1909 [ - + ]: 3656 : while ( pWindow )
1910 : : {
1911 [ # # ]: 0 : if ( !pWindow->ImplSetClipFlagOverlapWindows( bSysObjOnlySmaller ) )
1912 : 0 : bUpdate = sal_False;
1913 : 0 : pWindow = pWindow->mpWindowImpl->mpNext;
1914 : : }
1915 : :
1916 : 3656 : return bUpdate;
1917 : : }
1918 : :
1919 : : // -----------------------------------------------------------------------
1920 : :
1921 : 93888 : sal_Bool Window::ImplSetClipFlag( sal_Bool bSysObjOnlySmaller )
1922 : : {
1923 [ + + ]: 93888 : if ( !ImplIsOverlapWindow() )
1924 : : {
1925 : 90232 : sal_Bool bUpdate = ImplSetClipFlagChildren( bSysObjOnlySmaller );
1926 : :
1927 : 90232 : Window* pParent = ImplGetParent();
1928 [ - + ][ + + ]: 180464 : if ( pParent &&
[ + - + + ]
1929 : 90232 : ((pParent->GetStyle() & WB_CLIPCHILDREN) || (mpWindowImpl->mnParentClipMode & PARENTCLIPMODE_CLIP)) )
1930 : : {
1931 : 61851 : pParent->mbInitClipRegion = sal_True;
1932 : 61851 : pParent->mpWindowImpl->mbInitChildRegion = sal_True;
1933 : : }
1934 : :
1935 : : // siblings should recalculate their clip region
1936 [ - + ]: 90232 : if ( mpWindowImpl->mbClipSiblings )
1937 : : {
1938 : 0 : Window* pWindow = mpWindowImpl->mpNext;
1939 [ # # ]: 0 : while ( pWindow )
1940 : : {
1941 [ # # ]: 0 : if ( !pWindow->ImplSetClipFlagChildren( bSysObjOnlySmaller ) )
1942 : 0 : bUpdate = sal_False;
1943 : 0 : pWindow = pWindow->mpWindowImpl->mpNext;
1944 : : }
1945 : : }
1946 : :
1947 : 90232 : return bUpdate;
1948 : : }
1949 : : else
1950 : 93888 : return mpWindowImpl->mpFrameWindow->ImplSetClipFlagOverlapWindows( bSysObjOnlySmaller );
1951 : : }
1952 : :
1953 : : // -----------------------------------------------------------------------
1954 : :
1955 : 198703 : void Window::ImplIntersectWindowClipRegion( Region& rRegion )
1956 : : {
1957 [ + + ]: 198703 : if ( mpWindowImpl->mbInitWinClipRegion )
1958 : 30519 : ImplInitWinClipRegion();
1959 : :
1960 : 198703 : rRegion.Intersect( mpWindowImpl->maWinClipRegion );
1961 : 198703 : }
1962 : :
1963 : : // -----------------------------------------------------------------------
1964 : :
1965 : 41 : void Window::ImplIntersectWindowRegion( Region& rRegion )
1966 : : {
1967 : : rRegion.Intersect( Rectangle( Point( mnOutOffX, mnOutOffY ),
1968 [ + - ][ + - ]: 41 : Size( mnOutWidth, mnOutHeight ) ) );
1969 [ - + ]: 41 : if ( mpWindowImpl->mbWinRegion )
1970 [ # # ]: 0 : rRegion.Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) );
1971 : 41 : }
1972 : :
1973 : : // -----------------------------------------------------------------------
1974 : :
1975 : 79562 : void Window::ImplExcludeWindowRegion( Region& rRegion )
1976 : : {
1977 [ - + ]: 79562 : if ( mpWindowImpl->mbWinRegion )
1978 : : {
1979 : 0 : Point aPoint( mnOutOffX, mnOutOffY );
1980 : : Region aRegion( Rectangle( aPoint,
1981 [ # # ][ # # ]: 0 : Size( mnOutWidth, mnOutHeight ) ) );
1982 [ # # ][ # # ]: 0 : aRegion.Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) );
[ # # ]
1983 [ # # ][ # # ]: 0 : rRegion.Exclude( aRegion );
1984 : : }
1985 : : else
1986 : : {
1987 : 79562 : Point aPoint( mnOutOffX, mnOutOffY );
1988 : : rRegion.Exclude( Rectangle( aPoint,
1989 [ + - ][ + - ]: 79562 : Size( mnOutWidth, mnOutHeight ) ) );
1990 : : }
1991 : 79562 : }
1992 : :
1993 : : // -----------------------------------------------------------------------
1994 : :
1995 : 3047 : void Window::ImplExcludeOverlapWindows( Region& rRegion )
1996 : : {
1997 : 3047 : Window* pWindow = mpWindowImpl->mpFirstOverlap;
1998 [ - + ]: 3047 : while ( pWindow )
1999 : : {
2000 [ # # ]: 0 : if ( pWindow->mpWindowImpl->mbReallyVisible )
2001 : : {
2002 : 0 : pWindow->ImplExcludeWindowRegion( rRegion );
2003 : 0 : pWindow->ImplExcludeOverlapWindows( rRegion );
2004 : : }
2005 : :
2006 : 0 : pWindow = pWindow->mpWindowImpl->mpNext;
2007 : : }
2008 : 3047 : }
2009 : :
2010 : : // -----------------------------------------------------------------------
2011 : :
2012 : 0 : void Window::ImplExcludeOverlapWindows2( Region& rRegion )
2013 : : {
2014 [ # # ]: 0 : if ( mpWindowImpl->mbReallyVisible )
2015 : 0 : ImplExcludeWindowRegion( rRegion );
2016 : :
2017 : 0 : ImplExcludeOverlapWindows( rRegion );
2018 : 0 : }
2019 : :
2020 : : // -----------------------------------------------------------------------
2021 : :
2022 : 201793 : void Window::ImplClipBoundaries( Region& rRegion, sal_Bool bThis, sal_Bool bOverlaps )
2023 : : {
2024 [ + + ]: 201793 : if ( bThis )
2025 : 59864 : ImplIntersectWindowClipRegion( rRegion );
2026 [ + + ]: 141929 : else if ( ImplIsOverlapWindow() )
2027 : : {
2028 : : // clip to frame if required
2029 [ - + ]: 3090 : if ( !mpWindowImpl->mbFrame )
2030 [ # # ][ # # ]: 0 : rRegion.Intersect( Rectangle( Point( 0, 0 ), Size( mpWindowImpl->mpFrameWindow->mnOutWidth, mpWindowImpl->mpFrameWindow->mnOutHeight ) ) );
2031 : :
2032 [ + - ][ + + ]: 3090 : if ( bOverlaps && !rRegion.IsEmpty() )
[ + + ]
2033 : : {
2034 : : // Clip Overlap Siblings
2035 : 3047 : Window* pStartOverlapWindow = this;
2036 [ - + ]: 3047 : while ( !pStartOverlapWindow->mpWindowImpl->mbFrame )
2037 : : {
2038 : 0 : Window* pOverlapWindow = pStartOverlapWindow->mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpFirstOverlap;
2039 [ # # ][ # # ]: 0 : while ( pOverlapWindow && (pOverlapWindow != pStartOverlapWindow) )
[ # # ]
2040 : : {
2041 : 0 : pOverlapWindow->ImplExcludeOverlapWindows2( rRegion );
2042 : 0 : pOverlapWindow = pOverlapWindow->mpWindowImpl->mpNext;
2043 : : }
2044 : 0 : pStartOverlapWindow = pStartOverlapWindow->mpWindowImpl->mpOverlapWindow;
2045 : : }
2046 : :
2047 : : // Clip Child Overlap Windows
2048 : 3047 : ImplExcludeOverlapWindows( rRegion );
2049 : : }
2050 : : }
2051 : : else
2052 : 138839 : ImplGetParent()->ImplIntersectWindowClipRegion( rRegion );
2053 : 201793 : }
2054 : :
2055 : : // -----------------------------------------------------------------------
2056 : :
2057 : 42899 : sal_Bool Window::ImplClipChildren( Region& rRegion )
2058 : : {
2059 : 42899 : sal_Bool bOtherClip = sal_False;
2060 : 42899 : Window* pWindow = mpWindowImpl->mpFirstChild;
2061 [ + + ]: 135131 : while ( pWindow )
2062 : : {
2063 [ + + ]: 92232 : if ( pWindow->mpWindowImpl->mbReallyVisible )
2064 : : {
2065 : : // read-out ParentClipMode-Flags
2066 : 45811 : sal_uInt16 nClipMode = pWindow->GetParentClipMode();
2067 [ + - + - ]: 91577 : if ( !(nClipMode & PARENTCLIPMODE_NOCLIP) &&
[ + + ][ + + ]
2068 : 45766 : ((nClipMode & PARENTCLIPMODE_CLIP) || (GetStyle() & WB_CLIPCHILDREN)) )
2069 : 45766 : pWindow->ImplExcludeWindowRegion( rRegion );
2070 : : else
2071 : 45 : bOtherClip = sal_True;
2072 : : }
2073 : :
2074 : 92232 : pWindow = pWindow->mpWindowImpl->mpNext;
2075 : : }
2076 : :
2077 : 42899 : return bOtherClip;
2078 : : }
2079 : :
2080 : : // -----------------------------------------------------------------------
2081 : :
2082 : 327 : void Window::ImplClipAllChildren( Region& rRegion )
2083 : : {
2084 : 327 : Window* pWindow = mpWindowImpl->mpFirstChild;
2085 [ + + ]: 654 : while ( pWindow )
2086 : : {
2087 [ + + ]: 327 : if ( pWindow->mpWindowImpl->mbReallyVisible )
2088 : 205 : pWindow->ImplExcludeWindowRegion( rRegion );
2089 : 327 : pWindow = pWindow->mpWindowImpl->mpNext;
2090 : : }
2091 : 327 : }
2092 : :
2093 : : // -----------------------------------------------------------------------
2094 : :
2095 : 0 : void Window::ImplClipSiblings( Region& rRegion )
2096 : : {
2097 : 0 : Window* pWindow = ImplGetParent()->mpWindowImpl->mpFirstChild;
2098 [ # # ]: 0 : while ( pWindow )
2099 : : {
2100 [ # # ]: 0 : if ( pWindow == this )
2101 : 0 : break;
2102 : :
2103 [ # # ]: 0 : if ( pWindow->mpWindowImpl->mbReallyVisible )
2104 : 0 : pWindow->ImplExcludeWindowRegion( rRegion );
2105 : :
2106 : 0 : pWindow = pWindow->mpWindowImpl->mpNext;
2107 : : }
2108 : 0 : }
2109 : :
2110 : : // -----------------------------------------------------------------------
2111 : :
2112 : 107561 : void Window::ImplInitWinClipRegion()
2113 : : {
2114 : : // Build Window Region
2115 : : mpWindowImpl->maWinClipRegion = Rectangle( Point( mnOutOffX, mnOutOffY ),
2116 [ + - ][ + - ]: 107561 : Size( mnOutWidth, mnOutHeight ) );
2117 [ - + ]: 107561 : if ( mpWindowImpl->mbWinRegion )
2118 [ # # ]: 0 : mpWindowImpl->maWinClipRegion.Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) );
2119 : :
2120 : : // ClipSiblings
2121 [ - + ][ # # ]: 107561 : if ( mpWindowImpl->mbClipSiblings && !ImplIsOverlapWindow() )
[ - + ]
2122 : 0 : ImplClipSiblings( mpWindowImpl->maWinClipRegion );
2123 : :
2124 : : // Clip Parent Boundaries
2125 : 107561 : ImplClipBoundaries( mpWindowImpl->maWinClipRegion, sal_False, sal_True );
2126 : :
2127 : : // Clip Children
2128 [ - + ][ + + ]: 107561 : if ( (GetStyle() & WB_CLIPCHILDREN) || mpWindowImpl->mbClipChildren )
[ + + ]
2129 : 28570 : mpWindowImpl->mbInitChildRegion = sal_True;
2130 : :
2131 : 107561 : mpWindowImpl->mbInitWinClipRegion = sal_False;
2132 : 107561 : }
2133 : :
2134 : : // -----------------------------------------------------------------------
2135 : :
2136 : 19669 : void Window::ImplInitWinChildClipRegion()
2137 : : {
2138 [ + + ]: 19669 : if ( !mpWindowImpl->mpFirstChild )
2139 : : {
2140 [ + + ]: 8844 : if ( mpWindowImpl->mpChildClipRegion )
2141 : : {
2142 [ + - ]: 46 : delete mpWindowImpl->mpChildClipRegion;
2143 : 46 : mpWindowImpl->mpChildClipRegion = NULL;
2144 : : }
2145 : : }
2146 : : else
2147 : : {
2148 [ + + ]: 10825 : if ( !mpWindowImpl->mpChildClipRegion )
2149 [ + - ]: 7534 : mpWindowImpl->mpChildClipRegion = new Region( mpWindowImpl->maWinClipRegion );
2150 : : else
2151 : 3291 : *mpWindowImpl->mpChildClipRegion = mpWindowImpl->maWinClipRegion;
2152 : :
2153 : 10825 : ImplClipChildren( *mpWindowImpl->mpChildClipRegion );
2154 : : }
2155 : :
2156 : 19669 : mpWindowImpl->mbInitChildRegion = sal_False;
2157 : 19669 : }
2158 : :
2159 : : // -----------------------------------------------------------------------
2160 : :
2161 : 135853 : Region* Window::ImplGetWinChildClipRegion()
2162 : : {
2163 [ + + ]: 135853 : if ( mpWindowImpl->mbInitWinClipRegion )
2164 : 60224 : ImplInitWinClipRegion();
2165 [ + + ]: 135853 : if ( mpWindowImpl->mbInitChildRegion )
2166 : 19669 : ImplInitWinChildClipRegion();
2167 [ + + ]: 135853 : if ( mpWindowImpl->mpChildClipRegion )
2168 : 12637 : return mpWindowImpl->mpChildClipRegion;
2169 : : else
2170 : 135853 : return &mpWindowImpl->maWinClipRegion;
2171 : : }
2172 : :
2173 : : // -----------------------------------------------------------------------
2174 : :
2175 : 403 : void Window::ImplIntersectAndUnionOverlapWindows( const Region& rInterRegion, Region& rRegion )
2176 : : {
2177 : 403 : Window* pWindow = mpWindowImpl->mpFirstOverlap;
2178 [ - + ]: 403 : while ( pWindow )
2179 : : {
2180 [ # # ]: 0 : if ( pWindow->mpWindowImpl->mbReallyVisible )
2181 : : {
2182 [ # # ]: 0 : Region aTempRegion( rInterRegion );
2183 [ # # ]: 0 : pWindow->ImplIntersectWindowRegion( aTempRegion );
2184 [ # # ]: 0 : rRegion.Union( aTempRegion );
2185 [ # # ][ # # ]: 0 : pWindow->ImplIntersectAndUnionOverlapWindows( rInterRegion, rRegion );
2186 : : }
2187 : :
2188 : 0 : pWindow = pWindow->mpWindowImpl->mpNext;
2189 : : }
2190 : 403 : }
2191 : :
2192 : : // -----------------------------------------------------------------------
2193 : :
2194 : 0 : void Window::ImplIntersectAndUnionOverlapWindows2( const Region& rInterRegion, Region& rRegion )
2195 : : {
2196 [ # # ]: 0 : if ( mpWindowImpl->mbReallyVisible )
2197 : : {
2198 [ # # ]: 0 : Region aTempRegion( rInterRegion );
2199 [ # # ]: 0 : ImplIntersectWindowRegion( aTempRegion );
2200 [ # # ][ # # ]: 0 : rRegion.Union( aTempRegion );
2201 : : }
2202 : :
2203 : 0 : ImplIntersectAndUnionOverlapWindows( rInterRegion, rRegion );
2204 : 0 : }
2205 : :
2206 : : // -----------------------------------------------------------------------
2207 : :
2208 : 403 : void Window::ImplCalcOverlapRegionOverlaps( const Region& rInterRegion, Region& rRegion )
2209 : : {
2210 : : // Clip Overlap Siblings
2211 : : Window* pStartOverlapWindow;
2212 [ + - ]: 403 : if ( !ImplIsOverlapWindow() )
2213 : 403 : pStartOverlapWindow = mpWindowImpl->mpOverlapWindow;
2214 : : else
2215 : 0 : pStartOverlapWindow = this;
2216 [ - + ]: 403 : while ( !pStartOverlapWindow->mpWindowImpl->mbFrame )
2217 : : {
2218 : 0 : Window* pOverlapWindow = pStartOverlapWindow->mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpFirstOverlap;
2219 [ # # ][ # # ]: 0 : while ( pOverlapWindow && (pOverlapWindow != pStartOverlapWindow) )
[ # # ]
2220 : : {
2221 : 0 : pOverlapWindow->ImplIntersectAndUnionOverlapWindows2( rInterRegion, rRegion );
2222 : 0 : pOverlapWindow = pOverlapWindow->mpWindowImpl->mpNext;
2223 : : }
2224 : 0 : pStartOverlapWindow = pStartOverlapWindow->mpWindowImpl->mpOverlapWindow;
2225 : : }
2226 : :
2227 : : // Clip Child Overlap Windows
2228 [ + - ]: 403 : if ( !ImplIsOverlapWindow() )
2229 : 403 : mpWindowImpl->mpOverlapWindow->ImplIntersectAndUnionOverlapWindows( rInterRegion, rRegion );
2230 : : else
2231 : 0 : ImplIntersectAndUnionOverlapWindows( rInterRegion, rRegion );
2232 : 403 : }
2233 : :
2234 : : // -----------------------------------------------------------------------
2235 : :
2236 : 403 : void Window::ImplCalcOverlapRegion( const Rectangle& rSourceRect, Region& rRegion,
2237 : : sal_Bool bChildren, sal_Bool bParent, sal_Bool bSiblings )
2238 : : {
2239 [ + - ]: 403 : Region aRegion( rSourceRect );
2240 [ - + ]: 403 : if ( mpWindowImpl->mbWinRegion )
2241 [ # # ][ # # ]: 0 : rRegion.Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) );
[ # # ]
2242 [ + - ]: 403 : Region aTempRegion;
2243 : : Window* pWindow;
2244 : :
2245 [ + - ]: 403 : ImplCalcOverlapRegionOverlaps( aRegion, rRegion );
2246 : :
2247 : : // Parent-Boundaries
2248 [ + - ]: 403 : if ( bParent )
2249 : : {
2250 : 403 : pWindow = this;
2251 [ + - ][ + - ]: 403 : if ( !ImplIsOverlapWindow() )
2252 : : {
2253 [ + - ]: 403 : pWindow = ImplGetParent();
2254 [ + - ]: 2057 : do
2255 : : {
2256 [ + - ]: 2057 : aTempRegion = aRegion;
2257 [ + - ]: 2057 : pWindow->ImplExcludeWindowRegion( aTempRegion );
2258 [ + - ]: 2057 : rRegion.Union( aTempRegion );
2259 [ + - ][ + + ]: 2057 : if ( pWindow->ImplIsOverlapWindow() )
2260 : 403 : break;
2261 [ + - ]: 1654 : pWindow = pWindow->ImplGetParent();
2262 : : }
2263 : : while ( pWindow );
2264 : : }
2265 [ - + ]: 403 : if ( !pWindow->mpWindowImpl->mbFrame )
2266 : : {
2267 [ # # ]: 0 : aTempRegion = aRegion;
2268 [ # # ][ # # ]: 0 : aTempRegion.Exclude( Rectangle( Point( 0, 0 ), Size( mpWindowImpl->mpFrameWindow->mnOutWidth, mpWindowImpl->mpFrameWindow->mnOutHeight ) ) );
2269 [ # # ]: 0 : rRegion.Union( aTempRegion );
2270 : : }
2271 : : }
2272 : :
2273 : : // Siblings
2274 [ + + ][ + - ]: 403 : if ( bSiblings && !ImplIsOverlapWindow() )
[ + - ][ + + ]
2275 : : {
2276 : 29 : pWindow = mpWindowImpl->mpParent->mpWindowImpl->mpFirstChild;
2277 [ + + ]: 88 : do
2278 : : {
2279 [ + + ][ + + ]: 88 : if ( pWindow->mpWindowImpl->mbReallyVisible && (pWindow != this) )
2280 : : {
2281 [ + - ]: 29 : aTempRegion = aRegion;
2282 [ + - ]: 29 : pWindow->ImplIntersectWindowRegion( aTempRegion );
2283 [ + - ]: 29 : rRegion.Union( aTempRegion );
2284 : : }
2285 : 88 : pWindow = pWindow->mpWindowImpl->mpNext;
2286 : : }
2287 : : while ( pWindow );
2288 : : }
2289 : :
2290 [ + + ]: 403 : if ( bChildren )
2291 : : {
2292 : 369 : pWindow = mpWindowImpl->mpFirstChild;
2293 [ + + ]: 402 : while ( pWindow )
2294 : : {
2295 [ + + ]: 33 : if ( pWindow->mpWindowImpl->mbReallyVisible )
2296 : : {
2297 [ + - ]: 12 : aTempRegion = aRegion;
2298 [ + - ]: 12 : pWindow->ImplIntersectWindowRegion( aTempRegion );
2299 [ + - ]: 12 : rRegion.Union( aTempRegion );
2300 : : }
2301 : 33 : pWindow = pWindow->mpWindowImpl->mpNext;
2302 : : }
2303 [ + - ][ + - ]: 403 : }
2304 : 403 : }
2305 : :
2306 : : // -----------------------------------------------------------------------
2307 : :
2308 : 473274 : void Window::ImplCallPaint( const Region* pRegion, sal_uInt16 nPaintFlags )
2309 : : {
2310 : : // call PrePaint. PrePaint may add to the invalidate region as well as
2311 : : // other parameters used below.
2312 [ + - ]: 473274 : PrePaint();
2313 : :
2314 : 473274 : mpWindowImpl->mbPaintFrame = sal_False;
2315 : :
2316 [ + + ]: 473274 : if ( nPaintFlags & IMPL_PAINT_PAINTALLCHILDREN )
2317 : 93177 : mpWindowImpl->mnPaintFlags |= IMPL_PAINT_PAINT | IMPL_PAINT_PAINTALLCHILDREN | (nPaintFlags & IMPL_PAINT_PAINTALL);
2318 [ + + ]: 473274 : if ( nPaintFlags & IMPL_PAINT_PAINTCHILDREN )
2319 : 465754 : mpWindowImpl->mnPaintFlags |= IMPL_PAINT_PAINTCHILDREN;
2320 [ + + ]: 473274 : if ( nPaintFlags & IMPL_PAINT_ERASE )
2321 : 95595 : mpWindowImpl->mnPaintFlags |= IMPL_PAINT_ERASE;
2322 [ + + ]: 473274 : if ( nPaintFlags & IMPL_PAINT_CHECKRTL )
2323 : 44844 : mpWindowImpl->mnPaintFlags |= IMPL_PAINT_CHECKRTL;
2324 [ + + ]: 473274 : if ( !mpWindowImpl->mpFirstChild )
2325 : 277183 : mpWindowImpl->mnPaintFlags &= ~IMPL_PAINT_PAINTALLCHILDREN;
2326 : :
2327 [ + + ]: 473274 : if ( mpWindowImpl->mbPaintDisabled )
2328 : : {
2329 [ + + ]: 1723 : if ( mpWindowImpl->mnPaintFlags & IMPL_PAINT_PAINTALL )
2330 [ + - ]: 1710 : Invalidate( INVALIDATE_NOCHILDREN | INVALIDATE_NOERASE | INVALIDATE_NOTRANSPARENT | INVALIDATE_NOCLIPCHILDREN );
2331 [ + + ]: 13 : else if ( pRegion )
2332 [ + - ]: 2 : Invalidate( *pRegion, INVALIDATE_NOCHILDREN | INVALIDATE_NOERASE | INVALIDATE_NOTRANSPARENT | INVALIDATE_NOCLIPCHILDREN );
2333 : 473274 : return;
2334 : : }
2335 : :
2336 : 471551 : nPaintFlags = mpWindowImpl->mnPaintFlags & ~(IMPL_PAINT_PAINT);
2337 : :
2338 : 471551 : Region* pChildRegion = NULL;
2339 [ + - ]: 471551 : Rectangle aSelectionRect;
2340 [ + + ]: 471551 : if ( mpWindowImpl->mnPaintFlags & IMPL_PAINT_PAINT )
2341 : : {
2342 [ + - ]: 109969 : Region* pWinChildClipRegion = ImplGetWinChildClipRegion();
2343 [ + + ]: 109969 : if ( mpWindowImpl->mnPaintFlags & IMPL_PAINT_PAINTALL )
2344 [ + - ]: 53513 : mpWindowImpl->maInvalidateRegion = *pWinChildClipRegion;
2345 : : else
2346 : : {
2347 [ + + ]: 56456 : if ( pRegion )
2348 [ + - ]: 42980 : mpWindowImpl->maInvalidateRegion.Union( *pRegion );
2349 : :
2350 [ + + ][ - + ]: 56456 : if( mpWindowImpl->mpWinData && mpWindowImpl->mbTrackVisible )
2351 : : /* #98602# need to repaint all children within the
2352 : : * tracking rectangle, so the following invert
2353 : : * operation takes places without traces of the previous
2354 : : * one.
2355 : : */
2356 [ # # ]: 0 : mpWindowImpl->maInvalidateRegion.Union( *mpWindowImpl->mpWinData->mpTrackRect );
2357 : :
2358 [ + + ]: 56456 : if ( mpWindowImpl->mnPaintFlags & IMPL_PAINT_PAINTALLCHILDREN )
2359 [ + - ][ + - ]: 22525 : pChildRegion = new Region( mpWindowImpl->maInvalidateRegion );
2360 [ + - ]: 56456 : mpWindowImpl->maInvalidateRegion.Intersect( *pWinChildClipRegion );
2361 : : }
2362 : 109969 : mpWindowImpl->mnPaintFlags = 0;
2363 [ + - ][ + + ]: 109969 : if ( !mpWindowImpl->maInvalidateRegion.IsEmpty() )
2364 : : {
2365 : 80227 : bool bRestoreCursor = false;
2366 [ + + ]: 80227 : if ( mpWindowImpl->mpCursor )
2367 [ + - ]: 16394 : bRestoreCursor = mpWindowImpl->mpCursor->ImplSuspend();
2368 : :
2369 : 80227 : mbInitClipRegion = sal_True;
2370 : 80227 : mpWindowImpl->mbInPaint = sal_True;
2371 : :
2372 : : // restore Paint-Region
2373 [ + - ]: 80227 : Region aPaintRegion( mpWindowImpl->maInvalidateRegion );
2374 [ + - ]: 80227 : Rectangle aPaintRect = aPaintRegion.GetBoundRect();
2375 : :
2376 : : // - RTL - re-mirror paint rect and region at this window
2377 [ + - ][ + + ]: 80227 : if( ImplIsAntiparallel() )
2378 : : {
2379 [ + - ]: 8 : ImplReMirror( aPaintRect );
2380 [ + - ]: 8 : ImplReMirror( aPaintRegion );
2381 : : }
2382 [ + - ]: 80227 : aPaintRect = ImplDevicePixelToLogic( aPaintRect);
2383 : 80227 : mpWindowImpl->mpPaintRegion = &aPaintRegion;
2384 [ + - ]: 80227 : mpWindowImpl->maInvalidateRegion.SetEmpty();
2385 : :
2386 [ + + ][ + + ]: 80227 : if ( (nPaintFlags & IMPL_PAINT_ERASE) && IsBackground() )
[ + + ]
2387 : : {
2388 [ - + ]: 40080 : if ( IsClipRegion() )
2389 : : {
2390 [ # # ]: 0 : Region aOldRegion = GetClipRegion();
2391 [ # # ]: 0 : SetClipRegion();
2392 [ # # ]: 0 : Erase();
2393 [ # # ][ # # ]: 0 : SetClipRegion( aOldRegion );
2394 : : }
2395 : : else
2396 [ + - ]: 40080 : Erase();
2397 : : }
2398 : :
2399 : : // #98943# trigger drawing of toolbox selection after all childern are painted
2400 [ - + ]: 80227 : if( mpWindowImpl->mbDrawSelectionBackground )
2401 : 0 : aSelectionRect = aPaintRect;
2402 : :
2403 [ + - ]: 80227 : Paint( aPaintRect );
2404 : :
2405 [ + + ]: 80227 : if ( mpWindowImpl->mpWinData )
2406 : : {
2407 [ + + ]: 58819 : if ( mpWindowImpl->mbFocusVisible )
2408 [ + - ]: 54 : ImplInvertFocus( *(mpWindowImpl->mpWinData->mpFocusRect) );
2409 : : }
2410 : 80227 : mpWindowImpl->mbInPaint = sal_False;
2411 : 80227 : mbInitClipRegion = sal_True;
2412 : 80227 : mpWindowImpl->mpPaintRegion = NULL;
2413 [ + + ]: 80227 : if ( mpWindowImpl->mpCursor )
2414 [ + - ][ + - ]: 80227 : mpWindowImpl->mpCursor->ImplResume( bRestoreCursor );
2415 : : }
2416 : : }
2417 : : else
2418 : 361582 : mpWindowImpl->mnPaintFlags = 0;
2419 : :
2420 [ + + ]: 471551 : if ( nPaintFlags & (IMPL_PAINT_PAINTALLCHILDREN | IMPL_PAINT_PAINTCHILDREN) )
2421 : : {
2422 : : // Paint from the bottom child window and frontward.
2423 : 466185 : Window* pTempWindow = mpWindowImpl->mpLastChild;
2424 [ + + ]: 1122950 : while ( pTempWindow )
2425 : : {
2426 [ + + ]: 656765 : if ( pTempWindow->mpWindowImpl->mbVisible )
2427 [ + - ]: 455273 : pTempWindow->ImplCallPaint( pChildRegion, nPaintFlags );
2428 : 656765 : pTempWindow = pTempWindow->mpWindowImpl->mpPrev;
2429 : : }
2430 : : }
2431 : :
2432 [ + + ][ - + ]: 471551 : if ( mpWindowImpl->mpWinData && mpWindowImpl->mbTrackVisible && (mpWindowImpl->mpWinData->mnTrackFlags & SHOWTRACK_WINDOW) )
[ # # ]
2433 : : /* #98602# need to invert the tracking rect AFTER
2434 : : * the children have painted
2435 : : */
2436 [ # # ]: 0 : InvertTracking( *(mpWindowImpl->mpWinData->mpTrackRect), mpWindowImpl->mpWinData->mnTrackFlags );
2437 : :
2438 : : // #98943# draw toolbox selection
2439 [ + - ][ - + ]: 471551 : if( !aSelectionRect.IsEmpty() )
2440 [ # # ]: 0 : DrawSelectionBackground( aSelectionRect, 3, sal_False, sal_True, sal_False );
2441 : :
2442 [ + + ][ + - ]: 473274 : delete pChildRegion;
2443 : : }
2444 : :
2445 : : // -----------------------------------------------------------------------
2446 : :
2447 : 13028 : void Window::ImplCallOverlapPaint()
2448 : : {
2449 : : // emit overlapping windows first
2450 : 13028 : Window* pTempWindow = mpWindowImpl->mpFirstOverlap;
2451 [ - + ]: 13028 : while ( pTempWindow )
2452 : : {
2453 [ # # ]: 0 : if ( pTempWindow->mpWindowImpl->mbReallyVisible )
2454 : 0 : pTempWindow->ImplCallOverlapPaint();
2455 : 0 : pTempWindow = pTempWindow->mpWindowImpl->mpNext;
2456 : : }
2457 : :
2458 : : // only then ourself
2459 [ + + ]: 13028 : if ( mpWindowImpl->mnPaintFlags & (IMPL_PAINT_PAINT | IMPL_PAINT_PAINTCHILDREN) )
2460 : : {
2461 : : // - RTL - notify ImplCallPaint to check for re-mirroring (CHECKRTL)
2462 : : // because we were called from the Sal layer
2463 : 12608 : ImplCallPaint( NULL, mpWindowImpl->mnPaintFlags /*| IMPL_PAINT_CHECKRTL */);
2464 : : }
2465 : 13028 : }
2466 : :
2467 : : // -----------------------------------------------------------------------
2468 : :
2469 : 177173 : void Window::ImplPostPaint()
2470 : : {
2471 [ + + ]: 177173 : if ( !mpWindowImpl->mpFrameData->maPaintTimer.IsActive() )
2472 : 14739 : mpWindowImpl->mpFrameData->maPaintTimer.Start();
2473 : 177173 : }
2474 : :
2475 : : // -----------------------------------------------------------------------
2476 : :
2477 : 13075 : IMPL_LINK_NOARG(Window, ImplHandlePaintHdl)
2478 : : {
2479 : : // save paint events until resizing is done
2480 [ + - ][ - + ]: 13075 : if( mpWindowImpl->mbFrame && mpWindowImpl->mpFrameData->maResizeTimer.IsActive() )
[ - + ]
2481 : 0 : mpWindowImpl->mpFrameData->maPaintTimer.Start();
2482 [ + + ]: 13075 : else if ( mpWindowImpl->mbReallyVisible )
2483 : 13028 : ImplCallOverlapPaint();
2484 : 13075 : return 0;
2485 : : }
2486 : :
2487 : : // -----------------------------------------------------------------------
2488 : :
2489 : 1741 : IMPL_LINK_NOARG(Window, ImplHandleResizeTimerHdl)
2490 : : {
2491 [ + + ]: 1741 : if( mpWindowImpl->mbReallyVisible )
2492 : : {
2493 : 93 : ImplCallResize();
2494 [ + - ]: 93 : if( mpWindowImpl->mpFrameData->maPaintTimer.IsActive() )
2495 : : {
2496 : 93 : mpWindowImpl->mpFrameData->maPaintTimer.Stop();
2497 : 93 : mpWindowImpl->mpFrameData->maPaintTimer.GetTimeoutHdl().Call( NULL );
2498 : : }
2499 : : }
2500 : :
2501 : 1741 : return 0;
2502 : : }
2503 : :
2504 : : // -----------------------------------------------------------------------
2505 : :
2506 : 177173 : void Window::ImplInvalidateFrameRegion( const Region* pRegion, sal_uInt16 nFlags )
2507 : : {
2508 : : // set PAINTCHILDREN for all parent windows till the first OverlapWindow
2509 [ + + ]: 177173 : if ( !ImplIsOverlapWindow() )
2510 : : {
2511 : 173927 : Window* pTempWindow = this;
2512 [ + + ]: 173927 : sal_uInt16 nTranspPaint = IsPaintTransparent() ? IMPL_PAINT_PAINT : 0;
2513 [ + + ]: 248669 : do
2514 : : {
2515 : 248669 : pTempWindow = pTempWindow->ImplGetParent();
2516 [ + + ]: 248669 : if ( pTempWindow->mpWindowImpl->mnPaintFlags & IMPL_PAINT_PAINTCHILDREN )
2517 : 159700 : break;
2518 : 88969 : pTempWindow->mpWindowImpl->mnPaintFlags |= IMPL_PAINT_PAINTCHILDREN | nTranspPaint;
2519 [ + + ]: 88969 : if( ! pTempWindow->IsPaintTransparent() )
2520 : 88953 : nTranspPaint = 0;
2521 : : }
2522 : 88969 : while ( !pTempWindow->ImplIsOverlapWindow() );
2523 : : }
2524 : :
2525 : : // set Paint-Flags
2526 : 177173 : mpWindowImpl->mnPaintFlags |= IMPL_PAINT_PAINT;
2527 [ + + ]: 177173 : if ( nFlags & INVALIDATE_CHILDREN )
2528 : 140861 : mpWindowImpl->mnPaintFlags |= IMPL_PAINT_PAINTALLCHILDREN;
2529 [ + + ]: 177173 : if ( !(nFlags & INVALIDATE_NOERASE) )
2530 : 154484 : mpWindowImpl->mnPaintFlags |= IMPL_PAINT_ERASE;
2531 [ + + ]: 177173 : if ( !pRegion )
2532 : 65730 : mpWindowImpl->mnPaintFlags |= IMPL_PAINT_PAINTALL;
2533 : :
2534 : : // if not everything has to be redrawn, add the region to it
2535 [ + + ]: 177173 : if ( !(mpWindowImpl->mnPaintFlags & IMPL_PAINT_PAINTALL) )
2536 : 98566 : mpWindowImpl->maInvalidateRegion.Union( *pRegion );
2537 : :
2538 : : // Handle transparent windows correctly: invalidate must be done on the first opaque parent
2539 [ + + ][ + + ]: 179832 : if( ((IsPaintTransparent() && !(nFlags & INVALIDATE_NOTRANSPARENT)) || (nFlags & INVALIDATE_TRANSPARENT) )
[ - + + - ]
[ + + ]
2540 : 2659 : && ImplGetParent() )
2541 : : {
2542 : 2659 : Window *pParent = ImplGetParent();
2543 [ + - ][ + + ]: 2909 : while( pParent && pParent->IsPaintTransparent() )
[ + + ]
2544 : 250 : pParent = pParent->ImplGetParent();
2545 [ + - ]: 2659 : if( pParent )
2546 : : {
2547 : : Region *pChildRegion;
2548 [ + + ]: 2659 : if ( mpWindowImpl->mnPaintFlags & IMPL_PAINT_PAINTALL )
2549 : : // invalidate the whole child window region in the parent
2550 : 772 : pChildRegion = ImplGetWinChildClipRegion();
2551 : : else
2552 : : // invalidate the same region in the parent that has to be repainted in the child
2553 : 1887 : pChildRegion = &mpWindowImpl->maInvalidateRegion;
2554 : :
2555 : 2659 : nFlags |= INVALIDATE_CHILDREN; // paint should also be done on all children
2556 : 2659 : nFlags &= ~INVALIDATE_NOERASE; // parent should paint and erase to create proper background
2557 : 2659 : pParent->ImplInvalidateFrameRegion( pChildRegion, nFlags );
2558 : : }
2559 : : }
2560 : 177173 : ImplPostPaint();
2561 : 177173 : }
2562 : :
2563 : : // -----------------------------------------------------------------------
2564 : :
2565 : 2306 : void Window::ImplInvalidateOverlapFrameRegion( const Region& rRegion )
2566 : : {
2567 [ + - ]: 2306 : Region aRegion = rRegion;
2568 : :
2569 [ + - ]: 2306 : ImplClipBoundaries( aRegion, sal_True, sal_True );
2570 [ + - ][ + + ]: 2306 : if ( !aRegion.IsEmpty() )
2571 [ + - ]: 1702 : ImplInvalidateFrameRegion( &aRegion, INVALIDATE_CHILDREN );
2572 : :
2573 : : // now we invalidate the overlapping windows
2574 : 2306 : Window* pTempWindow = mpWindowImpl->mpFirstOverlap;
2575 [ - + ]: 2306 : while ( pTempWindow )
2576 : : {
2577 [ # # ][ # # ]: 0 : if ( pTempWindow->IsVisible() )
2578 [ # # ]: 0 : pTempWindow->ImplInvalidateOverlapFrameRegion( rRegion );
2579 : :
2580 : 0 : pTempWindow = pTempWindow->mpWindowImpl->mpNext;
2581 [ + - ]: 2306 : }
2582 : 2306 : }
2583 : :
2584 : : // -----------------------------------------------------------------------
2585 : :
2586 : 50335 : void Window::ImplInvalidateParentFrameRegion( Region& rRegion )
2587 : : {
2588 [ - + ]: 50335 : if ( mpWindowImpl->mbOverlapWin )
2589 : 0 : mpWindowImpl->mpFrameWindow->ImplInvalidateOverlapFrameRegion( rRegion );
2590 : : else
2591 : : {
2592 [ + - ]: 50335 : if( ImplGetParent() )
2593 : 50335 : ImplGetParent()->ImplInvalidateFrameRegion( &rRegion, INVALIDATE_CHILDREN );
2594 : : }
2595 : 50335 : }
2596 : :
2597 : : // -----------------------------------------------------------------------
2598 : :
2599 : 97200 : void Window::ImplInvalidate( const Region* pRegion, sal_uInt16 nFlags )
2600 : : {
2601 : :
2602 : : // reset background storage
2603 [ - + ]: 97200 : if ( mpWindowImpl->mpFrameData->mpFirstBackWin )
2604 : 0 : ImplInvalidateAllOverlapBackgrounds();
2605 : :
2606 : : // check what has to be redrawn
2607 : 97200 : sal_Bool bInvalidateAll = !pRegion;
2608 : :
2609 : : // take Transparent-Invalidate into account
2610 : 97200 : Window* pOpaqueWindow = this;
2611 [ + + ][ + + ]: 97200 : if ( (mpWindowImpl->mbPaintTransparent && !(nFlags & INVALIDATE_NOTRANSPARENT)) || (nFlags & INVALIDATE_TRANSPARENT) )
[ - + ]
2612 : : {
2613 : 3743 : Window* pTempWindow = pOpaqueWindow->ImplGetParent();
2614 [ + - ]: 3901 : while ( pTempWindow )
2615 : : {
2616 [ + + ]: 3901 : if ( !pTempWindow->IsPaintTransparent() )
2617 : : {
2618 : 3743 : pOpaqueWindow = pTempWindow;
2619 : 3743 : nFlags |= INVALIDATE_CHILDREN;
2620 : 3743 : bInvalidateAll = sal_False;
2621 : 3743 : break;
2622 : : }
2623 : :
2624 [ - + ]: 158 : if ( pTempWindow->ImplIsOverlapWindow() )
2625 : 0 : break;
2626 : :
2627 : 158 : pTempWindow = pTempWindow->ImplGetParent();
2628 : : }
2629 : : }
2630 : :
2631 : : // assemble region
2632 : 97200 : sal_uInt16 nOrgFlags = nFlags;
2633 [ + + ]: 97200 : if ( !(nFlags & (INVALIDATE_CHILDREN | INVALIDATE_NOCHILDREN)) )
2634 : : {
2635 [ + + ]: 78504 : if ( GetStyle() & WB_CLIPCHILDREN )
2636 : 35519 : nFlags |= INVALIDATE_NOCHILDREN;
2637 : : else
2638 : 42985 : nFlags |= INVALIDATE_CHILDREN;
2639 : : }
2640 [ + + ][ + + ]: 97200 : if ( (nFlags & INVALIDATE_NOCHILDREN) && mpWindowImpl->mpFirstChild )
2641 : 14407 : bInvalidateAll = sal_False;
2642 [ + + ]: 97200 : if ( bInvalidateAll )
2643 : 39642 : ImplInvalidateFrameRegion( NULL, nFlags );
2644 : : else
2645 : : {
2646 [ + - ]: 57558 : Rectangle aRect( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) );
2647 [ + - ]: 57558 : Region aRegion( aRect );
2648 [ + + ]: 57558 : if ( pRegion )
2649 : : {
2650 : : // --- RTL --- remirror region before intersecting it
2651 [ + - ][ + + ]: 52067 : if ( ImplIsAntiparallel() )
2652 : : {
2653 [ + - ]: 4 : Region aRgn( *pRegion );
2654 [ + - ]: 4 : ImplReMirror( aRgn );
2655 [ + - ][ + - ]: 4 : aRegion.Intersect( aRgn );
2656 : : }
2657 : : else
2658 [ + - ]: 52063 : aRegion.Intersect( *pRegion );
2659 : : }
2660 [ + - ]: 57558 : ImplClipBoundaries( aRegion, sal_True, sal_True );
2661 [ + + ]: 57558 : if ( nFlags & INVALIDATE_NOCHILDREN )
2662 : : {
2663 : 31717 : nFlags &= ~INVALIDATE_CHILDREN;
2664 [ + + ]: 31717 : if ( !(nFlags & INVALIDATE_NOCLIPCHILDREN) )
2665 : : {
2666 [ + + ]: 31663 : if ( nOrgFlags & INVALIDATE_NOCHILDREN )
2667 [ + - ]: 327 : ImplClipAllChildren( aRegion );
2668 : : else
2669 : : {
2670 [ + - ][ + + ]: 31336 : if ( ImplClipChildren( aRegion ) )
2671 : 12 : nFlags |= INVALIDATE_CHILDREN;
2672 : : }
2673 : : }
2674 : : }
2675 [ + - ][ + + ]: 57558 : if ( !aRegion.IsEmpty() )
2676 [ + - ][ + - ]: 57558 : ImplInvalidateFrameRegion( &aRegion, nFlags ); // transparency is handled here, pOpaqueWindow not required
2677 : : }
2678 : :
2679 [ - + ]: 97200 : if ( nFlags & INVALIDATE_UPDATE )
2680 : 0 : pOpaqueWindow->Update(); // start painting at the opaque parent
2681 : 97200 : }
2682 : :
2683 : : // -----------------------------------------------------------------------
2684 : :
2685 : 403 : void Window::ImplMoveInvalidateRegion( const Rectangle& rRect,
2686 : : long nHorzScroll, long nVertScroll,
2687 : : sal_Bool bChildren )
2688 : : {
2689 [ + + ]: 403 : if ( (mpWindowImpl->mnPaintFlags & (IMPL_PAINT_PAINT | IMPL_PAINT_PAINTALL)) == IMPL_PAINT_PAINT )
2690 : : {
2691 [ + - ]: 2 : Region aTempRegion = mpWindowImpl->maInvalidateRegion;
2692 [ + - ]: 2 : aTempRegion.Intersect( rRect );
2693 [ + - ]: 2 : aTempRegion.Move( nHorzScroll, nVertScroll );
2694 [ + - ][ + - ]: 2 : mpWindowImpl->maInvalidateRegion.Union( aTempRegion );
2695 : : }
2696 : :
2697 [ + + ][ - + ]: 403 : if ( bChildren && (mpWindowImpl->mnPaintFlags & IMPL_PAINT_PAINTCHILDREN) )
2698 : : {
2699 : 0 : Window* pWindow = mpWindowImpl->mpFirstChild;
2700 [ # # ]: 0 : while ( pWindow )
2701 : : {
2702 : 0 : pWindow->ImplMoveInvalidateRegion( rRect, nHorzScroll, nVertScroll, sal_True );
2703 : 0 : pWindow = pWindow->mpWindowImpl->mpNext;
2704 : : }
2705 : : }
2706 : 403 : }
2707 : :
2708 : : // -----------------------------------------------------------------------
2709 : :
2710 : 403 : void Window::ImplMoveAllInvalidateRegions( const Rectangle& rRect,
2711 : : long nHorzScroll, long nVertScroll,
2712 : : sal_Bool bChildren )
2713 : : {
2714 : : // also shift Paint-Region when paints need processing
2715 : 403 : ImplMoveInvalidateRegion( rRect, nHorzScroll, nVertScroll, bChildren );
2716 : : // Paint-Region should be shifted, as drawn by the parents
2717 [ + - ]: 403 : if ( !ImplIsOverlapWindow() )
2718 : : {
2719 [ + - ]: 403 : Region aPaintAllRegion;
2720 : 403 : Window* pPaintAllWindow = this;
2721 [ + + ]: 2057 : do
2722 : : {
2723 [ + - ]: 2057 : pPaintAllWindow = pPaintAllWindow->ImplGetParent();
2724 [ - + ]: 2057 : if ( pPaintAllWindow->mpWindowImpl->mnPaintFlags & IMPL_PAINT_PAINTALLCHILDREN )
2725 : : {
2726 [ # # ]: 0 : if ( pPaintAllWindow->mpWindowImpl->mnPaintFlags & IMPL_PAINT_PAINTALL )
2727 : : {
2728 [ # # ]: 0 : aPaintAllRegion.SetEmpty();
2729 : 0 : break;
2730 : : }
2731 : : else
2732 [ # # ]: 0 : aPaintAllRegion.Union( pPaintAllWindow->mpWindowImpl->maInvalidateRegion );
2733 : : }
2734 : : }
2735 [ + - ]: 2057 : while ( !pPaintAllWindow->ImplIsOverlapWindow() );
2736 [ + - ][ - + ]: 403 : if ( !aPaintAllRegion.IsEmpty() )
2737 : : {
2738 [ # # ]: 0 : aPaintAllRegion.Move( nHorzScroll, nVertScroll );
2739 : 0 : sal_uInt16 nPaintFlags = 0;
2740 [ # # ]: 0 : if ( bChildren )
2741 : 0 : mpWindowImpl->mnPaintFlags |= INVALIDATE_CHILDREN;
2742 [ # # ]: 0 : ImplInvalidateFrameRegion( &aPaintAllRegion, nPaintFlags );
2743 [ + - ]: 403 : }
2744 : : }
2745 : 403 : }
2746 : :
2747 : : // -----------------------------------------------------------------------
2748 : :
2749 : 60 : void Window::ImplValidateFrameRegion( const Region* pRegion, sal_uInt16 nFlags )
2750 : : {
2751 [ + - ]: 60 : if ( !pRegion )
2752 : 60 : mpWindowImpl->maInvalidateRegion.SetEmpty();
2753 : : else
2754 : : {
2755 : : // when all child windows have to be drawn we need to invalidate them before doing so
2756 [ # # ][ # # ]: 0 : if ( (mpWindowImpl->mnPaintFlags & IMPL_PAINT_PAINTALLCHILDREN) && mpWindowImpl->mpFirstChild )
2757 : : {
2758 [ # # ]: 0 : Region aChildRegion = mpWindowImpl->maInvalidateRegion;
2759 [ # # ]: 0 : if ( mpWindowImpl->mnPaintFlags & IMPL_PAINT_PAINTALL )
2760 : : {
2761 [ # # ]: 0 : Rectangle aRect( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) );
2762 [ # # ]: 0 : aChildRegion = aRect;
2763 : : }
2764 : 0 : Window* pChild = mpWindowImpl->mpFirstChild;
2765 [ # # ]: 0 : while ( pChild )
2766 : : {
2767 [ # # ]: 0 : pChild->Invalidate( aChildRegion, INVALIDATE_CHILDREN | INVALIDATE_NOTRANSPARENT );
2768 : 0 : pChild = pChild->mpWindowImpl->mpNext;
2769 [ # # ]: 0 : }
2770 : : }
2771 [ # # ]: 0 : if ( mpWindowImpl->mnPaintFlags & IMPL_PAINT_PAINTALL )
2772 : : {
2773 [ # # ]: 0 : Rectangle aRect( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) );
2774 [ # # ]: 0 : mpWindowImpl->maInvalidateRegion = aRect;
2775 : : }
2776 : 0 : mpWindowImpl->maInvalidateRegion.Exclude( *pRegion );
2777 : : }
2778 : 60 : mpWindowImpl->mnPaintFlags &= ~IMPL_PAINT_PAINTALL;
2779 : :
2780 [ - + ]: 60 : if ( nFlags & VALIDATE_CHILDREN )
2781 : : {
2782 : 0 : Window* pChild = mpWindowImpl->mpFirstChild;
2783 [ # # ]: 0 : while ( pChild )
2784 : : {
2785 : 0 : pChild->ImplValidateFrameRegion( pRegion, nFlags );
2786 : 0 : pChild = pChild->mpWindowImpl->mpNext;
2787 : : }
2788 : : }
2789 : 60 : }
2790 : :
2791 : : // -----------------------------------------------------------------------
2792 : :
2793 : 60 : void Window::ImplValidate( const Region* pRegion, sal_uInt16 nFlags )
2794 : : {
2795 : : // assemble region
2796 : 60 : sal_Bool bValidateAll = !pRegion;
2797 : 60 : sal_uInt16 nOrgFlags = nFlags;
2798 [ + - ]: 60 : if ( !(nFlags & (VALIDATE_CHILDREN | VALIDATE_NOCHILDREN)) )
2799 : : {
2800 [ + - ]: 60 : if ( GetStyle() & WB_CLIPCHILDREN )
2801 : 60 : nFlags |= VALIDATE_NOCHILDREN;
2802 : : else
2803 : 0 : nFlags |= VALIDATE_CHILDREN;
2804 : : }
2805 [ + - ][ - + ]: 60 : if ( (nFlags & VALIDATE_NOCHILDREN) && mpWindowImpl->mpFirstChild )
2806 : 0 : bValidateAll = sal_False;
2807 [ + - ]: 60 : if ( bValidateAll )
2808 : 60 : ImplValidateFrameRegion( NULL, nFlags );
2809 : : else
2810 : : {
2811 [ # # ]: 0 : Rectangle aRect( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) );
2812 [ # # ]: 0 : Region aRegion( aRect );
2813 [ # # ]: 0 : if ( pRegion )
2814 [ # # ]: 0 : aRegion.Intersect( *pRegion );
2815 [ # # ]: 0 : ImplClipBoundaries( aRegion, sal_True, sal_True );
2816 [ # # ]: 0 : if ( nFlags & VALIDATE_NOCHILDREN )
2817 : : {
2818 : 0 : nFlags &= ~VALIDATE_CHILDREN;
2819 [ # # ]: 0 : if ( nOrgFlags & VALIDATE_NOCHILDREN )
2820 [ # # ]: 0 : ImplClipAllChildren( aRegion );
2821 : : else
2822 : : {
2823 [ # # ][ # # ]: 0 : if ( ImplClipChildren( aRegion ) )
2824 : 0 : nFlags |= VALIDATE_CHILDREN;
2825 : : }
2826 : : }
2827 [ # # ][ # # ]: 0 : if ( !aRegion.IsEmpty() )
2828 [ # # ][ # # ]: 0 : ImplValidateFrameRegion( &aRegion, nFlags );
2829 : : }
2830 : 60 : }
2831 : :
2832 : : // -----------------------------------------------------------------------
2833 : :
2834 : 2364 : void Window::ImplScroll( const Rectangle& rRect,
2835 : : long nHorzScroll, long nVertScroll, sal_uInt16 nFlags )
2836 : : {
2837 [ + + ]: 2364 : if ( !IsDeviceOutputNecessary() )
2838 : : return;
2839 : :
2840 [ + - ]: 635 : nHorzScroll = ImplLogicWidthToDevicePixel( nHorzScroll );
2841 [ + - ]: 635 : nVertScroll = ImplLogicHeightToDevicePixel( nVertScroll );
2842 : :
2843 [ + + ][ + + ]: 635 : if ( !nHorzScroll && !nVertScroll )
2844 : : return;
2845 : :
2846 : : // restore background storage
2847 [ - + ]: 374 : if ( mpWindowImpl->mpFrameData->mpFirstBackWin )
2848 [ # # ]: 0 : ImplInvalidateAllOverlapBackgrounds();
2849 : :
2850 [ + + ]: 374 : if ( mpWindowImpl->mpCursor )
2851 [ + - ]: 359 : mpWindowImpl->mpCursor->ImplSuspend();
2852 : :
2853 : 374 : sal_uInt16 nOrgFlags = nFlags;
2854 [ + + ]: 374 : if ( !(nFlags & (SCROLL_CHILDREN | SCROLL_NOCHILDREN)) )
2855 : : {
2856 [ + - ][ + - ]: 11 : if ( GetStyle() & WB_CLIPCHILDREN )
2857 : 11 : nFlags |= SCROLL_NOCHILDREN;
2858 : : else
2859 : 0 : nFlags |= SCROLL_CHILDREN;
2860 : : }
2861 : :
2862 [ + - ]: 374 : Region aInvalidateRegion;
2863 : 374 : sal_Bool bScrollChildren = (nFlags & SCROLL_CHILDREN) != 0;
2864 : 374 : sal_Bool bErase = (nFlags & SCROLL_NOERASE) == 0;
2865 : :
2866 [ + + ]: 374 : if ( !mpWindowImpl->mpFirstChild )
2867 : 358 : bScrollChildren = sal_False;
2868 : :
2869 : : // --- RTL --- check if this window requires special action
2870 [ + - ]: 374 : sal_Bool bReMirror = ( ImplIsAntiparallel() );
2871 : :
2872 : 374 : Rectangle aRectMirror( rRect );
2873 [ - + ]: 374 : if( bReMirror )
2874 : : {
2875 : : // --- RTL --- make sure the invalidate region of this window is
2876 : : // computed in the same coordinate space as the one from the overlap windows
2877 [ # # ]: 0 : ImplReMirror( aRectMirror );
2878 : : }
2879 : :
2880 : : // adapt paint areas
2881 [ + - ]: 374 : ImplMoveAllInvalidateRegions( aRectMirror, nHorzScroll, nVertScroll, bScrollChildren );
2882 : :
2883 [ + - ]: 374 : if ( !(nFlags & SCROLL_NOINVALIDATE) )
2884 : : {
2885 [ + - ]: 374 : ImplCalcOverlapRegion( aRectMirror, aInvalidateRegion, !bScrollChildren, sal_True, sal_False );
2886 : :
2887 : : // --- RTL ---
2888 : : // if the scrolling on the device is performed in the opposite direction
2889 : : // then move the overlaps in that direction to compute the invalidate region
2890 : : // on the correct side, i.e., revert nHorzScroll
2891 : :
2892 [ + - ][ - + ]: 374 : if ( !aInvalidateRegion.IsEmpty() )
2893 : : {
2894 [ # # ][ # # ]: 0 : aInvalidateRegion.Move( bReMirror ? -nHorzScroll : nHorzScroll, nVertScroll );
2895 : 0 : bErase = sal_True;
2896 : : }
2897 [ + - ]: 374 : if ( !(nFlags & SCROLL_NOWINDOWINVALIDATE) )
2898 : : {
2899 : 374 : Rectangle aDestRect( aRectMirror );
2900 [ - + ][ + - ]: 374 : aDestRect.Move( bReMirror ? -nHorzScroll : nHorzScroll, nVertScroll );
2901 [ + - ]: 374 : Region aWinInvalidateRegion( aRectMirror );
2902 [ + - ]: 374 : aWinInvalidateRegion.Exclude( aDestRect );
2903 : :
2904 [ + - ][ + - ]: 374 : aInvalidateRegion.Union( aWinInvalidateRegion );
2905 : : }
2906 : : }
2907 : :
2908 : 374 : Point aPoint( mnOutOffX, mnOutOffY );
2909 [ + - ][ + - ]: 374 : Region aRegion( Rectangle( aPoint, Size( mnOutWidth, mnOutHeight ) ) );
2910 [ - + ]: 374 : if ( nFlags & SCROLL_CLIP )
2911 [ # # ]: 0 : aRegion.Intersect( rRect );
2912 [ - + ]: 374 : if ( mpWindowImpl->mbWinRegion )
2913 [ # # ][ # # ]: 0 : aRegion.Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) );
[ # # ]
2914 : :
2915 [ + - ]: 374 : aRegion.Exclude( aInvalidateRegion );
2916 : :
2917 [ + - ]: 374 : ImplClipBoundaries( aRegion, sal_False, sal_True );
2918 [ + + ]: 374 : if ( !bScrollChildren )
2919 : : {
2920 [ - + ]: 369 : if ( nOrgFlags & SCROLL_NOCHILDREN )
2921 [ # # ]: 0 : ImplClipAllChildren( aRegion );
2922 : : else
2923 [ + - ]: 369 : ImplClipChildren( aRegion );
2924 : : }
2925 [ - + ][ # # ]: 374 : if ( mbClipRegion && (nFlags & SCROLL_USECLIPREGION) )
2926 [ # # ]: 0 : aRegion.Intersect( maRegion );
2927 [ + - ][ + + ]: 374 : if ( !aRegion.IsEmpty() )
2928 : : {
2929 [ - + ]: 370 : if ( mpWindowImpl->mpWinData )
2930 : : {
2931 [ # # ]: 0 : if ( mpWindowImpl->mbFocusVisible )
2932 [ # # ]: 0 : ImplInvertFocus( *(mpWindowImpl->mpWinData->mpFocusRect) );
2933 [ # # ][ # # ]: 0 : if ( mpWindowImpl->mbTrackVisible && (mpWindowImpl->mpWinData->mnTrackFlags & SHOWTRACK_WINDOW) )
2934 [ # # ]: 0 : InvertTracking( *(mpWindowImpl->mpWinData->mpTrackRect), mpWindowImpl->mpWinData->mnTrackFlags );
2935 : : }
2936 : :
2937 [ + - ]: 370 : SalGraphics* pGraphics = ImplGetFrameGraphics();
2938 [ + - ]: 370 : if ( pGraphics )
2939 : : {
2940 [ - + ]: 370 : if( bReMirror )
2941 : : {
2942 : : // --- RTL --- frame coordinates require re-mirroring
2943 [ # # ]: 0 : ImplReMirror( aRegion );
2944 : : }
2945 : :
2946 [ + - ]: 370 : ImplSelectClipRegion( aRegion, pGraphics );
2947 : 370 : pGraphics->CopyArea( rRect.Left()+nHorzScroll, rRect.Top()+nVertScroll,
2948 : : rRect.Left(), rRect.Top(),
2949 : : rRect.GetWidth(), rRect.GetHeight(),
2950 [ + - ][ + - ]: 740 : SAL_COPYAREA_WINDOWINVALIDATE, this );
[ + - ]
2951 : : }
2952 : :
2953 [ - + ]: 370 : if ( mpWindowImpl->mpWinData )
2954 : : {
2955 [ # # ]: 0 : if ( mpWindowImpl->mbFocusVisible )
2956 [ # # ]: 0 : ImplInvertFocus( *(mpWindowImpl->mpWinData->mpFocusRect) );
2957 [ # # ][ # # ]: 0 : if ( mpWindowImpl->mbTrackVisible && (mpWindowImpl->mpWinData->mnTrackFlags & SHOWTRACK_WINDOW) )
2958 [ # # ]: 0 : InvertTracking( *(mpWindowImpl->mpWinData->mpTrackRect), mpWindowImpl->mpWinData->mnTrackFlags );
2959 : : }
2960 : : }
2961 : :
2962 [ + - ][ + - ]: 374 : if ( !aInvalidateRegion.IsEmpty() )
2963 : : {
2964 : : // --- RTL --- the invalidate region for this windows is already computed in frame coordinates
2965 : : // so it has to be re-mirrored before calling the Paint-handler
2966 : 374 : mpWindowImpl->mnPaintFlags |= IMPL_PAINT_CHECKRTL;
2967 : :
2968 : 374 : sal_uInt16 nPaintFlags = INVALIDATE_CHILDREN;
2969 [ - + ]: 374 : if ( !bErase )
2970 : 0 : nPaintFlags |= INVALIDATE_NOERASE;
2971 [ + + ]: 374 : if ( !bScrollChildren )
2972 : : {
2973 [ - + ]: 369 : if ( nOrgFlags & SCROLL_NOCHILDREN )
2974 [ # # ]: 0 : ImplClipAllChildren( aInvalidateRegion );
2975 : : else
2976 [ + - ]: 369 : ImplClipChildren( aInvalidateRegion );
2977 : : }
2978 [ + - ]: 374 : ImplInvalidateFrameRegion( &aInvalidateRegion, nPaintFlags );
2979 : : }
2980 : :
2981 [ + + ]: 374 : if ( bScrollChildren )
2982 : : {
2983 : 5 : Window* pWindow = mpWindowImpl->mpFirstChild;
2984 [ + + ]: 17 : while ( pWindow )
2985 : : {
2986 [ + - ]: 12 : Point aPos = pWindow->GetPosPixel();
2987 : 12 : aPos += Point( nHorzScroll, nVertScroll );
2988 [ + - ]: 12 : pWindow->SetPosPixel( aPos );
2989 : :
2990 : 12 : pWindow = pWindow->mpWindowImpl->mpNext;
2991 : : }
2992 : : }
2993 : :
2994 [ - + ]: 374 : if ( nFlags & SCROLL_UPDATE )
2995 [ # # ]: 0 : Update();
2996 : :
2997 [ + + ]: 374 : if ( mpWindowImpl->mpCursor )
2998 [ + - ][ + - ]: 2364 : mpWindowImpl->mpCursor->ImplResume();
[ + - ]
2999 : : }
3000 : :
3001 : : // -----------------------------------------------------------------------
3002 : :
3003 : 0 : void Window::ImplUpdateAll( sal_Bool bOverlapWindows )
3004 : : {
3005 [ # # ]: 0 : if ( !mpWindowImpl->mbReallyVisible )
3006 : 0 : return;
3007 : :
3008 : 0 : sal_Bool bFlush = sal_False;
3009 [ # # ]: 0 : if ( mpWindowImpl->mpFrameWindow->mpWindowImpl->mbPaintFrame )
3010 : : {
3011 : 0 : Point aPoint( 0, 0 );
3012 [ # # ][ # # ]: 0 : Region aRegion( Rectangle( aPoint, Size( mnOutWidth, mnOutHeight ) ) );
3013 [ # # ]: 0 : ImplInvalidateOverlapFrameRegion( aRegion );
3014 [ # # ][ # # ]: 0 : if ( mpWindowImpl->mbFrame || (mpWindowImpl->mpBorderWindow && mpWindowImpl->mpBorderWindow->mpWindowImpl->mbFrame) )
[ # # ]
3015 [ # # ]: 0 : bFlush = sal_True;
3016 : : }
3017 : :
3018 : : // an update changes the OverlapWindow, such that for later paints
3019 : : // not too much has to be drawn, if ALLCHILDREN etc. is set
3020 : 0 : Window* pWindow = ImplGetFirstOverlapWindow();
3021 [ # # ]: 0 : if ( bOverlapWindows )
3022 : 0 : pWindow->ImplCallOverlapPaint();
3023 : : else
3024 : : {
3025 [ # # ]: 0 : if ( pWindow->mpWindowImpl->mnPaintFlags & (IMPL_PAINT_PAINT | IMPL_PAINT_PAINTCHILDREN) )
3026 : 0 : pWindow->ImplCallPaint( NULL, pWindow->mpWindowImpl->mnPaintFlags );
3027 : : }
3028 : :
3029 [ # # ]: 0 : if ( bFlush )
3030 : 0 : Flush();
3031 : : }
3032 : :
3033 : : // -----------------------------------------------------------------------
3034 : :
3035 : 33255 : void Window::ImplUpdateWindowPtr( Window* pWindow )
3036 : : {
3037 [ + + ]: 33255 : if ( mpWindowImpl->mpFrameWindow != pWindow->mpWindowImpl->mpFrameWindow )
3038 : : {
3039 : : // release graphic
3040 : 17155 : ImplReleaseGraphics();
3041 : : }
3042 : :
3043 : 33255 : mpWindowImpl->mpFrameData = pWindow->mpWindowImpl->mpFrameData;
3044 : 33255 : mpWindowImpl->mpFrame = pWindow->mpWindowImpl->mpFrame;
3045 : 33255 : mpWindowImpl->mpFrameWindow = pWindow->mpWindowImpl->mpFrameWindow;
3046 [ + + ]: 33255 : if ( pWindow->ImplIsOverlapWindow() )
3047 : 16 : mpWindowImpl->mpOverlapWindow = pWindow;
3048 : : else
3049 : 33239 : mpWindowImpl->mpOverlapWindow = pWindow->mpWindowImpl->mpOverlapWindow;
3050 : :
3051 : 33255 : Window* pChild = mpWindowImpl->mpFirstChild;
3052 [ + + ]: 55625 : while ( pChild )
3053 : : {
3054 : 22370 : pChild->ImplUpdateWindowPtr( pWindow );
3055 : 22370 : pChild = pChild->mpWindowImpl->mpNext;
3056 : : }
3057 : 33255 : }
3058 : :
3059 : : // -----------------------------------------------------------------------
3060 : :
3061 : 12958 : void Window::ImplUpdateWindowPtr()
3062 : : {
3063 : 12958 : Window* pChild = mpWindowImpl->mpFirstChild;
3064 [ + + ]: 23843 : while ( pChild )
3065 : : {
3066 : 10885 : pChild->ImplUpdateWindowPtr( this );
3067 : 10885 : pChild = pChild->mpWindowImpl->mpNext;
3068 : : }
3069 : 12958 : }
3070 : :
3071 : : // -----------------------------------------------------------------------
3072 : :
3073 : 0 : void Window::ImplUpdateOverlapWindowPtr( sal_Bool bNewFrame )
3074 : : {
3075 : 0 : sal_Bool bVisible = IsVisible();
3076 : 0 : Show( false );
3077 : 0 : ImplRemoveWindow( bNewFrame );
3078 : 0 : Window* pRealParent = mpWindowImpl->mpRealParent;
3079 : 0 : ImplInsertWindow( ImplGetParent() );
3080 : 0 : mpWindowImpl->mpRealParent = pRealParent;
3081 : 0 : ImplUpdateWindowPtr();
3082 [ # # ]: 0 : if ( ImplUpdatePos() )
3083 : 0 : ImplUpdateSysObjPos();
3084 : :
3085 [ # # ]: 0 : if ( bNewFrame )
3086 : : {
3087 : 0 : Window* pOverlapWindow = mpWindowImpl->mpFirstOverlap;
3088 [ # # ]: 0 : while ( pOverlapWindow )
3089 : : {
3090 : 0 : Window* pNextOverlapWindow = pOverlapWindow->mpWindowImpl->mpNext;
3091 : 0 : pOverlapWindow->ImplUpdateOverlapWindowPtr( bNewFrame );
3092 : 0 : pOverlapWindow = pNextOverlapWindow;
3093 : : }
3094 : : }
3095 : :
3096 [ # # ]: 0 : if ( bVisible )
3097 : 0 : Show( true );
3098 : 0 : }
3099 : :
3100 : : // -----------------------------------------------------------------------
3101 : :
3102 : 811346 : sal_Bool Window::ImplUpdatePos()
3103 : : {
3104 : 811346 : sal_Bool bSysChild = sal_False;
3105 : :
3106 [ + + ]: 811346 : if ( ImplIsOverlapWindow() )
3107 : : {
3108 : 6004 : mnOutOffX = mpWindowImpl->mnX;
3109 : 6004 : mnOutOffY = mpWindowImpl->mnY;
3110 : : }
3111 : : else
3112 : : {
3113 : 805342 : Window* pParent = ImplGetParent();
3114 : :
3115 : 805342 : mnOutOffX = mpWindowImpl->mnX + pParent->mnOutOffX;
3116 : 805342 : mnOutOffY = mpWindowImpl->mnY + pParent->mnOutOffY;
3117 : : }
3118 : :
3119 : 811346 : Window* pChild = mpWindowImpl->mpFirstChild;
3120 [ + + ]: 1333298 : while ( pChild )
3121 : : {
3122 [ - + ]: 521952 : if ( pChild->ImplUpdatePos() )
3123 : 0 : bSysChild = sal_True;
3124 : 521952 : pChild = pChild->mpWindowImpl->mpNext;
3125 : : }
3126 : :
3127 [ - + ]: 811346 : if ( mpWindowImpl->mpSysObj )
3128 : 0 : bSysChild = sal_True;
3129 : :
3130 : 811346 : return bSysChild;
3131 : : }
3132 : :
3133 : : // -----------------------------------------------------------------------
3134 : :
3135 : 0 : void Window::ImplUpdateSysObjPos()
3136 : : {
3137 [ # # ]: 0 : if ( mpWindowImpl->mpSysObj )
3138 : 0 : mpWindowImpl->mpSysObj->SetPosSize( mnOutOffX, mnOutOffY, mnOutWidth, mnOutHeight );
3139 : :
3140 : 0 : Window* pChild = mpWindowImpl->mpFirstChild;
3141 [ # # ]: 0 : while ( pChild )
3142 : : {
3143 : 0 : pChild->ImplUpdateSysObjPos();
3144 : 0 : pChild = pChild->mpWindowImpl->mpNext;
3145 : : }
3146 : 0 : }
3147 : : // -----------------------------------------------------------------------
3148 : :
3149 : 300991 : void Window::ImplPosSizeWindow( long nX, long nY,
3150 : : long nWidth, long nHeight, sal_uInt16 nFlags )
3151 : : {
3152 : 300991 : sal_Bool bNewPos = sal_False;
3153 : 300991 : sal_Bool bNewSize = sal_False;
3154 : 300991 : sal_Bool bCopyBits = sal_False;
3155 : 300991 : long nOldOutOffX = mnOutOffX;
3156 : 300991 : long nOldOutOffY = mnOutOffY;
3157 : 300991 : long nOldOutWidth = mnOutWidth;
3158 : 300991 : long nOldOutHeight = mnOutHeight;
3159 : 300991 : Region* pOverlapRegion = NULL;
3160 : 300991 : Region* pOldRegion = NULL;
3161 : :
3162 [ + + ]: 300991 : if ( IsReallyVisible() )
3163 : : {
3164 [ - + ]: 70827 : if ( mpWindowImpl->mpFrameData->mpFirstBackWin )
3165 [ # # ]: 0 : ImplInvalidateAllOverlapBackgrounds();
3166 : :
3167 : : Rectangle aOldWinRect( Point( nOldOutOffX, nOldOutOffY ),
3168 [ + - ]: 70827 : Size( nOldOutWidth, nOldOutHeight ) );
3169 [ + - ][ + - ]: 70827 : pOldRegion = new Region( aOldWinRect );
3170 [ - + ]: 70827 : if ( mpWindowImpl->mbWinRegion )
3171 [ # # ][ # # ]: 0 : pOldRegion->Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) );
[ # # ]
3172 : :
3173 [ + + ][ + + ]: 113174 : if ( mnOutWidth && mnOutHeight && !mpWindowImpl->mbPaintTransparent &&
[ + + ][ + + ]
[ + + ][ + + ]
[ + + ]
3174 [ + - ]: 21334 : !mpWindowImpl->mbInitWinClipRegion && !mpWindowImpl->maWinClipRegion.IsEmpty() &&
3175 [ + - ]: 21013 : !HasPaintEvent() )
3176 : 70827 : bCopyBits = sal_True;
3177 : : }
3178 : :
3179 : 300991 : sal_Bool bnXRecycled = sal_False; // avoid duplicate mirroring in RTL case
3180 [ + + ]: 300991 : if ( nFlags & WINDOW_POSSIZE_WIDTH )
3181 : : {
3182 [ + + ]: 274720 : if(!( nFlags & WINDOW_POSSIZE_X ))
3183 : : {
3184 : 72786 : nX = mpWindowImpl->mnX;
3185 : 72786 : nFlags |= WINDOW_POSSIZE_X;
3186 : 72786 : bnXRecycled = sal_True; // we're using a mnX which was already mirrored in RTL case
3187 : : }
3188 : :
3189 [ + + ]: 274720 : if ( nWidth < 0 )
3190 : 7114 : nWidth = 0;
3191 [ + + ]: 274720 : if ( nWidth != mnOutWidth )
3192 : : {
3193 : 108725 : mnOutWidth = nWidth;
3194 : 108725 : bNewSize = sal_True;
3195 : 108725 : bCopyBits = sal_False;
3196 : : }
3197 : : }
3198 [ + + ]: 300991 : if ( nFlags & WINDOW_POSSIZE_HEIGHT )
3199 : : {
3200 [ + + ]: 276431 : if ( nHeight < 0 )
3201 : 3429 : nHeight = 0;
3202 [ + + ]: 276431 : if ( nHeight != mnOutHeight )
3203 : : {
3204 : 117594 : mnOutHeight = nHeight;
3205 : 117594 : bNewSize = sal_True;
3206 : 117594 : bCopyBits = sal_False;
3207 : : }
3208 : : }
3209 : :
3210 [ + + ]: 300991 : if ( nFlags & WINDOW_POSSIZE_X )
3211 : : {
3212 : 299278 : long nOrgX = nX;
3213 : : // --- RTL --- (compare the screen coordinates)
3214 : 299278 : Point aPtDev( Point( nX+mnOutOffX, 0 ) );
3215 [ - + ][ + - ]: 299278 : if( ImplHasMirroredGraphics() )
3216 : : {
3217 [ # # ]: 0 : mpGraphics->mirror( aPtDev.X(), this );
3218 : :
3219 : : // #106948# always mirror our pos if our parent is not mirroring, even
3220 : : // if we are also not mirroring
3221 : : // --- RTL --- check if parent is in different coordinates
3222 [ # # ][ # # ]: 0 : if( !bnXRecycled && mpWindowImpl->mpParent && !mpWindowImpl->mpParent->mpWindowImpl->mbFrame && mpWindowImpl->mpParent->ImplIsAntiparallel() )
[ # # ][ # # ]
[ # # ][ # # ]
3223 : : {
3224 : : // --- RTL --- (re-mirror at parent window)
3225 : 0 : nX = mpWindowImpl->mpParent->mnOutWidth - mnOutWidth - nX;
3226 : : }
3227 : : /* #i99166# An LTR window in RTL UI that gets sized only would be
3228 : : expected to not moved its upper left point
3229 : : */
3230 [ # # ]: 0 : if( bnXRecycled )
3231 : : {
3232 [ # # ][ # # ]: 0 : if( ImplIsAntiparallel() )
3233 : : {
3234 : 0 : aPtDev.X() = mpWindowImpl->mnAbsScreenX;
3235 : 0 : nOrgX = mpWindowImpl->maPos.X();
3236 : : }
3237 : : }
3238 : : }
3239 [ + + ][ + - ]: 299278 : else if( !bnXRecycled && mpWindowImpl->mpParent && !mpWindowImpl->mpParent->mpWindowImpl->mbFrame && mpWindowImpl->mpParent->ImplIsAntiparallel() )
[ + + ][ + - ]
[ + + ][ + + ]
3240 : : {
3241 : : // mirrored window in LTR UI
3242 : : {
3243 : : // --- RTL --- (re-mirror at parent window)
3244 : 1145 : nX = mpWindowImpl->mpParent->mnOutWidth - mnOutWidth - nX;
3245 : : }
3246 : : }
3247 : :
3248 : : // check maPos as well, as it could have been changed for client windows (ImplCallMove())
3249 [ + + ][ + + ]: 299278 : if ( mpWindowImpl->mnAbsScreenX != aPtDev.X() || nX != mpWindowImpl->mnX || nOrgX != mpWindowImpl->maPos.X() )
[ + + ][ + + ]
3250 : : {
3251 [ + + ][ + - ]: 127484 : if ( bCopyBits && !pOverlapRegion )
3252 : : {
3253 [ + - ][ + - ]: 29 : pOverlapRegion = new Region();
3254 : : ImplCalcOverlapRegion( Rectangle( Point( mnOutOffX, mnOutOffY ),
3255 : : Size( mnOutWidth, mnOutHeight ) ),
3256 [ + - ][ + - ]: 29 : *pOverlapRegion, sal_False, sal_True, sal_True );
3257 : : }
3258 : 127484 : mpWindowImpl->mnX = nX;
3259 : 127484 : mpWindowImpl->maPos.X() = nOrgX;
3260 : 127484 : mpWindowImpl->mnAbsScreenX = aPtDev.X(); // --- RTL --- (store real screen pos)
3261 : 299278 : bNewPos = sal_True;
3262 : : }
3263 : : }
3264 [ + + ]: 300991 : if ( nFlags & WINDOW_POSSIZE_Y )
3265 : : {
3266 : : // check maPos as well, as it could have been changed for client windows (ImplCallMove())
3267 [ + + ][ + + ]: 226492 : if ( nY != mpWindowImpl->mnY || nY != mpWindowImpl->maPos.Y() )
[ + + ]
3268 : : {
3269 [ - + ][ # # ]: 82287 : if ( bCopyBits && !pOverlapRegion )
3270 : : {
3271 [ # # ]: 0 : pOverlapRegion = new Region();
3272 : : ImplCalcOverlapRegion( Rectangle( Point( mnOutOffX, mnOutOffY ),
3273 : : Size( mnOutWidth, mnOutHeight ) ),
3274 [ # # ][ # # ]: 0 : *pOverlapRegion, sal_False, sal_True, sal_True );
3275 : : }
3276 : 82287 : mpWindowImpl->mnY = nY;
3277 : 82287 : mpWindowImpl->maPos.Y() = nY;
3278 : 82287 : bNewPos = sal_True;
3279 : : }
3280 : : }
3281 : :
3282 [ + + ][ + + ]: 300991 : if ( bNewPos || bNewSize )
3283 : : {
3284 : 200512 : sal_Bool bUpdateSysObjPos = sal_False;
3285 [ + + ]: 200512 : if ( bNewPos )
3286 : 152260 : bUpdateSysObjPos = ImplUpdatePos();
3287 : :
3288 : : // the borderwindow always specifies the position for its client window
3289 [ + + ]: 200512 : if ( mpWindowImpl->mpBorderWindow )
3290 : 38804 : mpWindowImpl->maPos = mpWindowImpl->mpBorderWindow->mpWindowImpl->maPos;
3291 : :
3292 [ + + ]: 200512 : if ( mpWindowImpl->mpClientWindow )
3293 : : {
3294 : : mpWindowImpl->mpClientWindow->ImplPosSizeWindow( mpWindowImpl->mpClientWindow->mpWindowImpl->mnLeftBorder,
3295 : : mpWindowImpl->mpClientWindow->mpWindowImpl->mnTopBorder,
3296 : : mnOutWidth-mpWindowImpl->mpClientWindow->mpWindowImpl->mnLeftBorder-mpWindowImpl->mpClientWindow->mpWindowImpl->mnRightBorder,
3297 : : mnOutHeight-mpWindowImpl->mpClientWindow->mpWindowImpl->mnTopBorder-mpWindowImpl->mpClientWindow->mpWindowImpl->mnBottomBorder,
3298 : : WINDOW_POSSIZE_X | WINDOW_POSSIZE_Y |
3299 : 16674 : WINDOW_POSSIZE_WIDTH | WINDOW_POSSIZE_HEIGHT );
3300 : : // Wenn wir ein ClientWindow haben, dann hat dieses fuer die
3301 : : // Applikation auch die Position des FloatingWindows
3302 : 16674 : mpWindowImpl->mpClientWindow->mpWindowImpl->maPos = mpWindowImpl->maPos;
3303 [ + + ]: 16674 : if ( bNewPos )
3304 : : {
3305 [ + + ]: 9229 : if ( mpWindowImpl->mpClientWindow->IsVisible() )
3306 : : {
3307 : 3936 : mpWindowImpl->mpClientWindow->ImplCallMove();
3308 : : }
3309 : : else
3310 : : {
3311 : 5293 : mpWindowImpl->mpClientWindow->mpWindowImpl->mbCallMove = sal_True;
3312 : : }
3313 : : }
3314 : : }
3315 : :
3316 : : // Move()/Resize() will be called only for Show(), such that
3317 : : // at least one is called before Show()
3318 [ + + ]: 200512 : if ( IsVisible() )
3319 : : {
3320 [ + + ]: 106875 : if ( bNewPos )
3321 : : {
3322 : 92264 : ImplCallMove();
3323 : : }
3324 [ + + ]: 106875 : if ( bNewSize )
3325 : : {
3326 : 69442 : ImplCallResize();
3327 : : }
3328 : : }
3329 : : else
3330 : : {
3331 [ + + ]: 93637 : if ( bNewPos )
3332 : 59996 : mpWindowImpl->mbCallMove = sal_True;
3333 [ + + ]: 93637 : if ( bNewSize )
3334 : 76274 : mpWindowImpl->mbCallResize = sal_True;
3335 : : }
3336 : :
3337 : 200512 : sal_Bool bUpdateSysObjClip = sal_False;
3338 [ + + ]: 200512 : if ( IsReallyVisible() )
3339 : : {
3340 [ + + ][ + - ]: 33933 : if ( bNewPos || bNewSize )
3341 : : {
3342 : : // reset background storage
3343 [ - + ][ # # ]: 33933 : if ( mpWindowImpl->mpOverlapData && mpWindowImpl->mpOverlapData->mpSaveBackDev )
3344 : 0 : ImplDeleteOverlapBackground();
3345 [ - + ]: 33933 : if ( mpWindowImpl->mpFrameData->mpFirstBackWin )
3346 : 0 : ImplInvalidateAllOverlapBackgrounds();
3347 : : // set Clip-Flag
3348 : 33933 : bUpdateSysObjClip = !ImplSetClipFlag( sal_True );
3349 : : }
3350 : :
3351 : : // invalidate window content ?
3352 [ + + ][ + + ]: 33933 : if ( bNewPos || (mnOutWidth > nOldOutWidth) || (mnOutHeight > nOldOutHeight) )
[ + + ]
3353 : : {
3354 [ + + ]: 28043 : if ( bNewPos )
3355 : : {
3356 : 26117 : sal_Bool bInvalidate = sal_False;
3357 : 26117 : sal_Bool bParentPaint = sal_True;
3358 [ + - ]: 26117 : if ( !ImplIsOverlapWindow() )
3359 : 26117 : bParentPaint = mpWindowImpl->mpParent->IsPaintEnabled();
3360 [ + + ][ + - ]: 26117 : if ( bCopyBits && bParentPaint && !HasPaintEvent() )
[ + - ][ + + ]
3361 : : {
3362 : 29 : Point aPoint( mnOutOffX, mnOutOffY );
3363 : : Region aRegion( Rectangle( aPoint,
3364 [ + - ][ + - ]: 29 : Size( mnOutWidth, mnOutHeight ) ) );
3365 [ - + ]: 29 : if ( mpWindowImpl->mbWinRegion )
3366 [ # # ][ # # ]: 0 : aRegion.Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) );
[ # # ]
3367 [ + - ]: 29 : ImplClipBoundaries( aRegion, sal_False, sal_True );
3368 [ + - ][ + + ]: 29 : if ( !pOverlapRegion->IsEmpty() )
3369 : : {
3370 [ + - ]: 3 : pOverlapRegion->Move( mnOutOffX-nOldOutOffX, mnOutOffY-nOldOutOffY );
3371 [ + - ]: 3 : aRegion.Exclude( *pOverlapRegion );
3372 : : }
3373 [ + - ][ + - ]: 29 : if ( !aRegion.IsEmpty() )
3374 : : {
3375 : : // adapt Paint areas
3376 : : ImplMoveAllInvalidateRegions( Rectangle( Point( nOldOutOffX, nOldOutOffY ),
3377 : : Size( nOldOutWidth, nOldOutHeight ) ),
3378 : : mnOutOffX-nOldOutOffX, mnOutOffY-nOldOutOffY,
3379 [ + - ][ + - ]: 29 : sal_True );
3380 [ + - ]: 29 : SalGraphics* pGraphics = ImplGetFrameGraphics();
3381 [ + - ]: 29 : if ( pGraphics )
3382 : : {
3383 [ + - ]: 29 : const bool bSelectClipRegion = ImplSelectClipRegion( aRegion, pGraphics );
3384 [ + - ]: 29 : if ( bSelectClipRegion )
3385 : : {
3386 : : pGraphics->CopyArea( mnOutOffX, mnOutOffY,
3387 : : nOldOutOffX, nOldOutOffY,
3388 : : nOldOutWidth, nOldOutHeight,
3389 [ + - ]: 29 : SAL_COPYAREA_WINDOWINVALIDATE, this );
3390 : : }
3391 : : else
3392 : 0 : bInvalidate = sal_True;
3393 : : }
3394 : : else
3395 : 0 : bInvalidate = sal_True;
3396 [ + - ]: 29 : if ( !bInvalidate )
3397 : : {
3398 [ + - ][ + + ]: 29 : if ( !pOverlapRegion->IsEmpty() )
3399 [ + - ]: 3 : ImplInvalidateFrameRegion( pOverlapRegion, INVALIDATE_CHILDREN );
3400 : : }
3401 : : }
3402 : : else
3403 [ + - ]: 29 : bInvalidate = sal_True;
3404 : : }
3405 : : else
3406 : 26088 : bInvalidate = sal_True;
3407 [ + + ]: 26117 : if ( bInvalidate )
3408 : 26088 : ImplInvalidateFrameRegion( NULL, INVALIDATE_CHILDREN );
3409 : : }
3410 : : else
3411 : : {
3412 : 1926 : Point aPoint( mnOutOffX, mnOutOffY );
3413 : : Region aRegion( Rectangle( aPoint,
3414 [ + - ][ + - ]: 1926 : Size( mnOutWidth, mnOutHeight ) ) );
3415 [ + - ]: 1926 : aRegion.Exclude( *pOldRegion );
3416 [ - + ]: 1926 : if ( mpWindowImpl->mbWinRegion )
3417 [ # # ][ # # ]: 0 : aRegion.Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) );
[ # # ]
3418 [ + - ]: 1926 : ImplClipBoundaries( aRegion, sal_False, sal_True );
3419 [ + - ][ + + ]: 1926 : if ( !aRegion.IsEmpty() )
3420 [ + - ][ + - ]: 1926 : ImplInvalidateFrameRegion( &aRegion, INVALIDATE_CHILDREN );
3421 : : }
3422 : : }
3423 : :
3424 : : // invalidate Parent or Overlaps
3425 [ + + ][ + + ]: 33933 : if ( bNewPos ||
[ + + ]
3426 : : (mnOutWidth < nOldOutWidth) || (mnOutHeight < nOldOutHeight) )
3427 : : {
3428 [ + - ]: 32039 : Region aRegion( *pOldRegion );
3429 [ + + ]: 32039 : if ( !mpWindowImpl->mbPaintTransparent )
3430 [ + - ]: 31534 : ImplExcludeWindowRegion( aRegion );
3431 [ + - ]: 32039 : ImplClipBoundaries( aRegion, sal_False, sal_True );
3432 [ + - ][ + + ]: 32039 : if ( !aRegion.IsEmpty() && !mpWindowImpl->mpBorderWindow )
[ + + ][ + + ]
3433 [ + - ][ + - ]: 32039 : ImplInvalidateParentFrameRegion( aRegion );
3434 : : }
3435 : : }
3436 : :
3437 : : // adapt system objects
3438 [ - + ]: 200512 : if ( bUpdateSysObjClip )
3439 : 0 : ImplUpdateSysObjClip();
3440 [ - + ]: 200512 : if ( bUpdateSysObjPos )
3441 : 0 : ImplUpdateSysObjPos();
3442 [ + + ][ - + ]: 200512 : if ( bNewSize && mpWindowImpl->mpSysObj )
3443 : 0 : mpWindowImpl->mpSysObj->SetPosSize( mnOutOffX, mnOutOffY, mnOutWidth, mnOutHeight );
3444 : : }
3445 : :
3446 [ + + ]: 300991 : delete pOverlapRegion;
3447 [ + + ]: 300991 : delete pOldRegion;
3448 : 300991 : }
3449 : :
3450 : : // -----------------------------------------------------------------------
3451 : :
3452 : 3329 : void Window::ImplToBottomChild()
3453 : : {
3454 [ + - ][ + + ]: 3329 : if ( !ImplIsOverlapWindow() && !mpWindowImpl->mbReallyVisible && (mpWindowImpl->mpParent->mpWindowImpl->mpLastChild != this) )
[ + - ][ + + ]
3455 : : {
3456 : : // put the window to the end of the list
3457 [ - + ]: 1286 : if ( mpWindowImpl->mpPrev )
3458 : 0 : mpWindowImpl->mpPrev->mpWindowImpl->mpNext = mpWindowImpl->mpNext;
3459 : : else
3460 : 1286 : mpWindowImpl->mpParent->mpWindowImpl->mpFirstChild = mpWindowImpl->mpNext;
3461 : 1286 : mpWindowImpl->mpNext->mpWindowImpl->mpPrev = mpWindowImpl->mpPrev;
3462 : 1286 : mpWindowImpl->mpPrev = mpWindowImpl->mpParent->mpWindowImpl->mpLastChild;
3463 : 1286 : mpWindowImpl->mpParent->mpWindowImpl->mpLastChild = this;
3464 : 1286 : mpWindowImpl->mpPrev->mpWindowImpl->mpNext = this;
3465 : 1286 : mpWindowImpl->mpNext = NULL;
3466 : : }
3467 : 3329 : }
3468 : :
3469 : : // -----------------------------------------------------------------------
3470 : :
3471 : 3234 : void Window::ImplCalcToTop( ImplCalcToTopData* pPrevData )
3472 : : {
3473 : : DBG_ASSERT( ImplIsOverlapWindow(), "Window::ImplCalcToTop(): Is not a OverlapWindow" );
3474 : :
3475 [ - + ]: 3234 : if ( !mpWindowImpl->mbFrame )
3476 : : {
3477 [ # # ]: 0 : if ( IsReallyVisible() )
3478 : : {
3479 : : // calculate region, where the window overlaps with other windows
3480 : 0 : Point aPoint( mnOutOffX, mnOutOffY );
3481 : : Region aRegion( Rectangle( aPoint,
3482 [ # # ][ # # ]: 0 : Size( mnOutWidth, mnOutHeight ) ) );
3483 [ # # ]: 0 : Region aInvalidateRegion;
3484 [ # # ]: 0 : ImplCalcOverlapRegionOverlaps( aRegion, aInvalidateRegion );
3485 : :
3486 [ # # ][ # # ]: 0 : if ( !aInvalidateRegion.IsEmpty() )
3487 : : {
3488 [ # # ]: 0 : ImplCalcToTopData* pData = new ImplCalcToTopData;
3489 : 0 : pPrevData->mpNext = pData;
3490 : 0 : pData->mpNext = NULL;
3491 : 0 : pData->mpWindow = this;
3492 [ # # ][ # # ]: 0 : pData->mpInvalidateRegion = new Region( aInvalidateRegion );
3493 [ # # ][ # # ]: 0 : }
3494 : : }
3495 : : }
3496 : 3234 : }
3497 : :
3498 : : // -----------------------------------------------------------------------
3499 : :
3500 : 3234 : void Window::ImplToTop( sal_uInt16 nFlags )
3501 : : {
3502 : : DBG_ASSERT( ImplIsOverlapWindow(), "Window::ImplToTop(): Is not a OverlapWindow" );
3503 : :
3504 [ + - ]: 3234 : if ( mpWindowImpl->mbFrame )
3505 : : {
3506 : : // on a mouse click in the external window, it is the latter's
3507 : : // responsibility to assure our frame is put in front
3508 [ + + ][ + - ]: 3234 : if ( !mpWindowImpl->mpFrameData->mbHasFocus &&
[ + - ][ + - ]
3509 : 1773 : !mpWindowImpl->mpFrameData->mbSysObjFocus &&
3510 : 1773 : !mpWindowImpl->mpFrameData->mbInSysObjFocusHdl &&
3511 : 1773 : !mpWindowImpl->mpFrameData->mbInSysObjToTopHdl )
3512 : : {
3513 : : // do not bring floating windows on the client to top
3514 [ + + ][ + - ]: 1773 : if( !ImplGetClientWindow() || !(ImplGetClientWindow()->GetStyle() & WB_SYSTEMFLOATWIN) )
[ + - ]
3515 : : {
3516 : 1773 : sal_uInt16 nSysFlags = 0;
3517 [ + + ]: 1773 : if ( nFlags & TOTOP_RESTOREWHENMIN )
3518 : 74 : nSysFlags |= SAL_FRAME_TOTOP_RESTOREWHENMIN;
3519 [ + + ]: 1773 : if ( nFlags & TOTOP_FOREGROUNDTASK )
3520 : 564 : nSysFlags |= SAL_FRAME_TOTOP_FOREGROUNDTASK;
3521 [ - + ]: 1773 : if ( nFlags & TOTOP_GRABFOCUSONLY )
3522 : 0 : nSysFlags |= SAL_FRAME_TOTOP_GRABFOCUS_ONLY;
3523 : 1773 : mpWindowImpl->mpFrame->ToTop( nSysFlags );
3524 : : }
3525 : : }
3526 : : }
3527 : : else
3528 : : {
3529 [ # # ]: 0 : if ( mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpFirstOverlap != this )
3530 : : {
3531 : : // remove window from the list
3532 : 0 : mpWindowImpl->mpPrev->mpWindowImpl->mpNext = mpWindowImpl->mpNext;
3533 [ # # ]: 0 : if ( mpWindowImpl->mpNext )
3534 : 0 : mpWindowImpl->mpNext->mpWindowImpl->mpPrev = mpWindowImpl->mpPrev;
3535 : : else
3536 : 0 : mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpLastOverlap = mpWindowImpl->mpPrev;
3537 : :
3538 : : // take AlwaysOnTop into account
3539 : 0 : sal_Bool bOnTop = IsAlwaysOnTopEnabled();
3540 : 0 : Window* pNextWin = mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpFirstOverlap;
3541 [ # # ]: 0 : if ( !bOnTop )
3542 : : {
3543 [ # # ]: 0 : while ( pNextWin )
3544 : : {
3545 [ # # ]: 0 : if ( !pNextWin->IsAlwaysOnTopEnabled() )
3546 : 0 : break;
3547 : 0 : pNextWin = pNextWin->mpWindowImpl->mpNext;
3548 : : }
3549 : : }
3550 : :
3551 : : // check TopLevel
3552 : 0 : sal_uInt8 nTopLevel = mpWindowImpl->mpOverlapData->mnTopLevel;
3553 [ # # ]: 0 : while ( pNextWin )
3554 : : {
3555 [ # # ][ # # ]: 0 : if ( (bOnTop != pNextWin->IsAlwaysOnTopEnabled()) ||
[ # # ]
3556 : : (nTopLevel <= pNextWin->mpWindowImpl->mpOverlapData->mnTopLevel) )
3557 : 0 : break;
3558 : 0 : pNextWin = pNextWin->mpWindowImpl->mpNext;
3559 : : }
3560 : :
3561 : : // add the window to the list again
3562 : 0 : mpWindowImpl->mpNext = pNextWin;
3563 [ # # ]: 0 : if ( pNextWin )
3564 : : {
3565 : 0 : mpWindowImpl->mpPrev = pNextWin->mpWindowImpl->mpPrev;
3566 : 0 : pNextWin->mpWindowImpl->mpPrev = this;
3567 : : }
3568 : : else
3569 : : {
3570 : 0 : mpWindowImpl->mpPrev = mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpLastOverlap;
3571 : 0 : mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpLastOverlap = this;
3572 : : }
3573 [ # # ]: 0 : if ( mpWindowImpl->mpPrev )
3574 : 0 : mpWindowImpl->mpPrev->mpWindowImpl->mpNext = this;
3575 : : else
3576 : 0 : mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpFirstOverlap = this;
3577 : :
3578 : : // recalculate ClipRegion of this and all overlapping windows
3579 [ # # ]: 0 : if ( IsReallyVisible() )
3580 : : {
3581 : : // reset background storage
3582 [ # # ]: 0 : if ( mpWindowImpl->mpFrameData->mpFirstBackWin )
3583 : 0 : ImplInvalidateAllOverlapBackgrounds();
3584 : 0 : mpWindowImpl->mpOverlapWindow->ImplSetClipFlagOverlapWindows();
3585 : : }
3586 : : }
3587 : : }
3588 : 3234 : }
3589 : :
3590 : : // -----------------------------------------------------------------------
3591 : :
3592 : 3234 : void Window::ImplStartToTop( sal_uInt16 nFlags )
3593 : : {
3594 : : ImplCalcToTopData aStartData;
3595 : : ImplCalcToTopData* pCurData;
3596 : : ImplCalcToTopData* pNextData;
3597 : : Window* pOverlapWindow;
3598 [ + - ][ + + ]: 3234 : if ( ImplIsOverlapWindow() )
3599 : 1733 : pOverlapWindow = this;
3600 : : else
3601 : 1501 : pOverlapWindow = mpWindowImpl->mpOverlapWindow;
3602 : :
3603 : : // first calculate paint areas
3604 : 3234 : Window* pTempOverlapWindow = pOverlapWindow;
3605 : 3234 : aStartData.mpNext = NULL;
3606 : 3234 : pCurData = &aStartData;
3607 [ - + ]: 3234 : do
3608 : : {
3609 [ + - ]: 3234 : pTempOverlapWindow->ImplCalcToTop( pCurData );
3610 [ - + ]: 3234 : if ( pCurData->mpNext )
3611 : 0 : pCurData = pCurData->mpNext;
3612 : 3234 : pTempOverlapWindow = pTempOverlapWindow->mpWindowImpl->mpOverlapWindow;
3613 : : }
3614 : 3234 : while ( !pTempOverlapWindow->mpWindowImpl->mbFrame );
3615 : : // next calculate the paint areas of the ChildOverlap windows
3616 : 3234 : pTempOverlapWindow = mpWindowImpl->mpFirstOverlap;
3617 [ - + ]: 3234 : while ( pTempOverlapWindow )
3618 : : {
3619 [ # # ]: 0 : pTempOverlapWindow->ImplCalcToTop( pCurData );
3620 [ # # ]: 0 : if ( pCurData->mpNext )
3621 : 0 : pCurData = pCurData->mpNext;
3622 : 0 : pTempOverlapWindow = pTempOverlapWindow->mpWindowImpl->mpNext;
3623 : : }
3624 : :
3625 : : // and next change the windows list
3626 : 3234 : pTempOverlapWindow = pOverlapWindow;
3627 [ - + ]: 3234 : do
3628 : : {
3629 [ + - ]: 3234 : pTempOverlapWindow->ImplToTop( nFlags );
3630 : 3234 : pTempOverlapWindow = pTempOverlapWindow->mpWindowImpl->mpOverlapWindow;
3631 : : }
3632 : 3234 : while ( !pTempOverlapWindow->mpWindowImpl->mbFrame );
3633 : : // as last step invalidate the invalid areas
3634 : 3234 : pCurData = aStartData.mpNext;
3635 [ - + ]: 3234 : while ( pCurData )
3636 : : {
3637 [ # # ]: 0 : pCurData->mpWindow->ImplInvalidateFrameRegion( pCurData->mpInvalidateRegion, INVALIDATE_CHILDREN );
3638 : 0 : pNextData = pCurData->mpNext;
3639 [ # # ][ # # ]: 0 : delete pCurData->mpInvalidateRegion;
3640 : 0 : delete pCurData;
3641 : 0 : pCurData = pNextData;
3642 : : }
3643 : 3234 : }
3644 : :
3645 : : // -----------------------------------------------------------------------
3646 : :
3647 : 3234 : void Window::ImplFocusToTop( sal_uInt16 nFlags, sal_Bool bReallyVisible )
3648 : : {
3649 : : // do we need to fetch the focus?
3650 [ + - ]: 3234 : if ( !(nFlags & TOTOP_NOGRABFOCUS) )
3651 : : {
3652 : : // first window with GrabFocus-Activate gets the focus
3653 : 3234 : Window* pFocusWindow = this;
3654 [ + + ]: 4735 : while ( !pFocusWindow->ImplIsOverlapWindow() )
3655 : : {
3656 : : // if the window has no BorderWindow, we
3657 : : // should always find the belonging BorderWindow
3658 [ - + ]: 1501 : if ( !pFocusWindow->mpWindowImpl->mpBorderWindow )
3659 : : {
3660 [ # # ]: 0 : if ( pFocusWindow->mpWindowImpl->mnActivateMode & ACTIVATE_MODE_GRABFOCUS )
3661 : 0 : break;
3662 : : }
3663 : 1501 : pFocusWindow = pFocusWindow->ImplGetParent();
3664 : : }
3665 [ + - + + ]: 6468 : if ( (pFocusWindow->mpWindowImpl->mnActivateMode & ACTIVATE_MODE_GRABFOCUS) &&
[ + + ]
3666 : 3234 : !pFocusWindow->HasChildPathFocus( sal_True ) )
3667 : 1792 : pFocusWindow->GrabFocus();
3668 : : }
3669 : :
3670 [ + + ]: 3234 : if ( bReallyVisible )
3671 : 1485 : ImplGenerateMouseMove();
3672 : 3234 : }
3673 : :
3674 : : // -----------------------------------------------------------------------
3675 : :
3676 : 82051 : void Window::ImplShowAllOverlaps()
3677 : : {
3678 : 82051 : Window* pOverlapWindow = mpWindowImpl->mpFirstOverlap;
3679 [ - + ]: 82051 : while ( pOverlapWindow )
3680 : : {
3681 [ # # ]: 0 : if ( pOverlapWindow->mpWindowImpl->mbOverlapVisible )
3682 : : {
3683 : 0 : pOverlapWindow->Show( true, SHOW_NOACTIVATE );
3684 : 0 : pOverlapWindow->mpWindowImpl->mbOverlapVisible = sal_False;
3685 : : }
3686 : :
3687 : 0 : pOverlapWindow = pOverlapWindow->mpWindowImpl->mpNext;
3688 : : }
3689 : 82051 : }
3690 : :
3691 : : // -----------------------------------------------------------------------
3692 : :
3693 : 79971 : void Window::ImplHideAllOverlaps()
3694 : : {
3695 : 79971 : Window* pOverlapWindow = mpWindowImpl->mpFirstOverlap;
3696 [ - + ]: 79971 : while ( pOverlapWindow )
3697 : : {
3698 [ # # ]: 0 : if ( pOverlapWindow->IsVisible() )
3699 : : {
3700 : 0 : pOverlapWindow->mpWindowImpl->mbOverlapVisible = sal_True;
3701 : 0 : pOverlapWindow->Show( false );
3702 : : }
3703 : :
3704 : 0 : pOverlapWindow = pOverlapWindow->mpWindowImpl->mpNext;
3705 : : }
3706 : 79971 : }
3707 : :
3708 : : // -----------------------------------------------------------------------
3709 : :
3710 : 6478 : void Window::ImplCallMouseMove( sal_uInt16 nMouseCode, sal_Bool bModChanged )
3711 : : {
3712 [ - + ][ # # ]: 6478 : if ( mpWindowImpl->mpFrameData->mbMouseIn && mpWindowImpl->mpFrameWindow->mpWindowImpl->mbReallyVisible )
3713 : : {
3714 : 0 : sal_uLong nTime = Time::GetSystemTicks();
3715 : 0 : long nX = mpWindowImpl->mpFrameData->mnLastMouseX;
3716 : 0 : long nY = mpWindowImpl->mpFrameData->mnLastMouseY;
3717 : 0 : sal_uInt16 nCode = nMouseCode;
3718 : 0 : sal_uInt16 nMode = mpWindowImpl->mpFrameData->mnMouseMode;
3719 : : sal_Bool bLeave;
3720 : : // check for MouseLeave
3721 [ # # ][ # # ]: 0 : if ( ((nX < 0) || (nY < 0) ||
[ # # # # ]
[ # # ][ # # ]
3722 : : (nX >= mpWindowImpl->mpFrameWindow->mnOutWidth) ||
3723 : : (nY >= mpWindowImpl->mpFrameWindow->mnOutHeight)) &&
3724 : 0 : !ImplGetSVData()->maWinData.mpCaptureWin )
3725 : 0 : bLeave = sal_True;
3726 : : else
3727 : 0 : bLeave = sal_False;
3728 : 0 : nMode |= MOUSE_SYNTHETIC;
3729 [ # # ]: 0 : if ( bModChanged )
3730 : 0 : nMode |= MOUSE_MODIFIERCHANGED;
3731 : 0 : ImplHandleMouseEvent( mpWindowImpl->mpFrameWindow, EVENT_MOUSEMOVE, bLeave, nX, nY, nTime, nCode, nMode );
3732 : : }
3733 : 6478 : }
3734 : :
3735 : : // -----------------------------------------------------------------------
3736 : :
3737 : 162469 : void Window::ImplGenerateMouseMove()
3738 : : {
3739 [ + + ]: 162469 : if ( !mpWindowImpl->mpFrameData->mnMouseMoveId )
3740 [ + - ]: 8109 : Application::PostUserEvent( mpWindowImpl->mpFrameData->mnMouseMoveId, LINK( mpWindowImpl->mpFrameWindow, Window, ImplGenerateMouseMoveHdl ) );
3741 : 162469 : }
3742 : :
3743 : : // -----------------------------------------------------------------------
3744 : :
3745 : 6478 : IMPL_LINK_NOARG(Window, ImplGenerateMouseMoveHdl)
3746 : : {
3747 : 6478 : mpWindowImpl->mpFrameData->mnMouseMoveId = 0;
3748 : 6478 : Window* pCaptureWin = ImplGetSVData()->maWinData.mpCaptureWin;
3749 [ # # ][ # # ]: 6478 : if( ! pCaptureWin ||
[ - + ]
3750 : : (pCaptureWin->mpWindowImpl && pCaptureWin->mpWindowImpl->mpFrame == mpWindowImpl->mpFrame)
3751 : : )
3752 : : {
3753 : 6478 : ImplCallMouseMove( mpWindowImpl->mpFrameData->mnMouseCode );
3754 : : }
3755 : 6478 : return 0;
3756 : : }
3757 : :
3758 : : // -----------------------------------------------------------------------
3759 : :
3760 : 138 : void Window::ImplInvertFocus( const Rectangle& rRect )
3761 : : {
3762 : 138 : InvertTracking( rRect, SHOWTRACK_SMALL | SHOWTRACK_WINDOW );
3763 : 138 : }
3764 : :
3765 : : // -----------------------------------------------------------------------
3766 : :
3767 : 26 : void Window::ImplCallFocusChangeActivate( Window* pNewOverlapWindow,
3768 : : Window* pOldOverlapWindow )
3769 : : {
3770 : 26 : ImplSVData* pSVData = ImplGetSVData();
3771 : : Window* pNewRealWindow;
3772 : : Window* pOldRealWindow;
3773 : : Window* pLastRealWindow;
3774 : 26 : sal_Bool bCallActivate = sal_True;
3775 : 26 : sal_Bool bCallDeactivate = sal_True;
3776 : :
3777 : 26 : pOldRealWindow = pOldOverlapWindow->ImplGetWindow();
3778 : 26 : pNewRealWindow = pNewOverlapWindow->ImplGetWindow();
3779 [ + - ]: 26 : if ( (pOldRealWindow->GetType() != WINDOW_FLOATINGWINDOW) ||
[ - + # # ]
3780 : 0 : pOldRealWindow->GetActivateMode() )
3781 : : {
3782 [ - + # # ]: 26 : if ( (pNewRealWindow->GetType() == WINDOW_FLOATINGWINDOW) &&
[ - + ]
3783 : 0 : !pNewRealWindow->GetActivateMode() )
3784 : : {
3785 : 0 : pSVData->maWinData.mpLastDeacWin = pOldOverlapWindow;
3786 : 0 : bCallDeactivate = sal_False;
3787 : : }
3788 : : }
3789 [ # # # # ]: 0 : else if ( (pNewRealWindow->GetType() != WINDOW_FLOATINGWINDOW) ||
[ # # ]
3790 : 0 : pNewRealWindow->GetActivateMode() )
3791 : : {
3792 [ # # ]: 0 : if ( pSVData->maWinData.mpLastDeacWin )
3793 : : {
3794 [ # # ]: 0 : if ( pSVData->maWinData.mpLastDeacWin == pNewOverlapWindow )
3795 : 0 : bCallActivate = sal_False;
3796 : : else
3797 : : {
3798 : 0 : pLastRealWindow = pSVData->maWinData.mpLastDeacWin->ImplGetWindow();
3799 : 0 : pSVData->maWinData.mpLastDeacWin->mpWindowImpl->mbActive = sal_False;
3800 : 0 : pSVData->maWinData.mpLastDeacWin->Deactivate();
3801 [ # # ]: 0 : if ( pLastRealWindow != pSVData->maWinData.mpLastDeacWin )
3802 : : {
3803 : 0 : pLastRealWindow->mpWindowImpl->mbActive = sal_True;
3804 : 0 : pLastRealWindow->Activate();
3805 : : }
3806 : : }
3807 : 0 : pSVData->maWinData.mpLastDeacWin = NULL;
3808 : : }
3809 : : }
3810 : :
3811 [ + - ]: 26 : if ( bCallDeactivate )
3812 : : {
3813 [ + + ]: 26 : if( pOldOverlapWindow->mpWindowImpl->mbActive )
3814 : : {
3815 : 25 : pOldOverlapWindow->mpWindowImpl->mbActive = sal_False;
3816 : 25 : pOldOverlapWindow->Deactivate();
3817 : : }
3818 [ + - ]: 26 : if ( pOldRealWindow != pOldOverlapWindow )
3819 : : {
3820 [ + + ]: 26 : if( pOldRealWindow->mpWindowImpl->mbActive )
3821 : : {
3822 : 25 : pOldRealWindow->mpWindowImpl->mbActive = sal_False;
3823 : 25 : pOldRealWindow->Deactivate();
3824 : : }
3825 : : }
3826 : : }
3827 [ + - ][ + - ]: 26 : if ( bCallActivate && ! pNewOverlapWindow->mpWindowImpl->mbActive )
3828 : : {
3829 [ + - ]: 26 : if( ! pNewOverlapWindow->mpWindowImpl->mbActive )
3830 : : {
3831 : 26 : pNewOverlapWindow->mpWindowImpl->mbActive = sal_True;
3832 : 26 : pNewOverlapWindow->Activate();
3833 : : }
3834 [ + - ]: 26 : if ( pNewRealWindow != pNewOverlapWindow )
3835 : : {
3836 [ + - ]: 26 : if( ! pNewRealWindow->mpWindowImpl->mbActive )
3837 : : {
3838 : 26 : pNewRealWindow->mpWindowImpl->mbActive = sal_True;
3839 : 26 : pNewRealWindow->Activate();
3840 : : }
3841 : : }
3842 : : }
3843 : 26 : }
3844 : :
3845 : 10642 : static bool IsWindowFocused(const WindowImpl& rWinImpl)
3846 : : {
3847 [ - + ]: 10642 : if (rWinImpl.mpSysObj)
3848 : 0 : return true;
3849 : :
3850 [ + + ]: 10642 : if (rWinImpl.mpFrameData->mbHasFocus)
3851 : 8795 : return true;
3852 : :
3853 [ - + ]: 1847 : if (rWinImpl.mbFakeFocusSet)
3854 : 0 : return true;
3855 : :
3856 : 10642 : return false;
3857 : : }
3858 : :
3859 : : // -----------------------------------------------------------------------
3860 : 15204 : void Window::ImplGrabFocus( sal_uInt16 nFlags )
3861 : : {
3862 : : // #143570# no focus for destructing windows
3863 [ + + ]: 15204 : if( mpWindowImpl->mbInDtor )
3864 : : return;
3865 : :
3866 : : // some event listeners do really bad stuff
3867 : : // => prepare for the worst
3868 [ + - ]: 13818 : ImplDelData aDogTag( this );
3869 : :
3870 : : // Currently the client window should always get the focus
3871 : : // Should the border window at some point be focusable
3872 : : // we need to change all GrabFocus() instances in VCL,
3873 : : // e.g. in ToTop()
3874 : :
3875 [ + + ]: 13818 : if ( mpWindowImpl->mpClientWindow )
3876 : : {
3877 : : // For a lack of design we need a little hack here to
3878 : : // ensure that dialogs on close pass the focus back to
3879 : : // the correct window
3880 [ + + ][ + - ]: 7570 : if ( mpWindowImpl->mpLastFocusWindow && (mpWindowImpl->mpLastFocusWindow != this) &&
[ + - ][ + - ]
[ + + ][ + - ]
[ + + ]
3881 : 1466 : !(mpWindowImpl->mnDlgCtrlFlags & WINDOW_DLGCTRL_WANTFOCUS) &&
3882 [ + - ]: 1466 : mpWindowImpl->mpLastFocusWindow->IsEnabled() &&
3883 [ + - ]: 1466 : mpWindowImpl->mpLastFocusWindow->IsInputEnabled() &&
3884 [ + - ]: 1464 : ! mpWindowImpl->mpLastFocusWindow->IsInModalMode()
3885 : : )
3886 [ + - ]: 1464 : mpWindowImpl->mpLastFocusWindow->GrabFocus();
3887 : : else
3888 [ + - ]: 3174 : mpWindowImpl->mpClientWindow->GrabFocus();
3889 : : return;
3890 : : }
3891 [ + + ]: 10644 : else if ( mpWindowImpl->mbFrame )
3892 : : {
3893 : : // For a lack of design we need a little hack here to
3894 : : // ensure that dialogs on close pass the focus back to
3895 : : // the correct window
3896 [ + + ][ - + ]: 6 : if ( mpWindowImpl->mpLastFocusWindow && (mpWindowImpl->mpLastFocusWindow != this) &&
[ # # ][ # # ]
[ # # ][ # # ]
[ - + ]
3897 : 0 : !(mpWindowImpl->mnDlgCtrlFlags & WINDOW_DLGCTRL_WANTFOCUS) &&
3898 [ # # ]: 0 : mpWindowImpl->mpLastFocusWindow->IsEnabled() &&
3899 [ # # ]: 0 : mpWindowImpl->mpLastFocusWindow->IsInputEnabled() &&
3900 [ # # ]: 0 : ! mpWindowImpl->mpLastFocusWindow->IsInModalMode()
3901 : : )
3902 : : {
3903 [ # # ]: 0 : mpWindowImpl->mpLastFocusWindow->GrabFocus();
3904 : : return;
3905 : : }
3906 : : }
3907 : :
3908 : : // If the Window is disabled, then we don't change the focus
3909 [ + - ][ + - ]: 10644 : if ( !IsEnabled() || !IsInputEnabled() || IsInModalMode() )
[ + - ][ + + ]
[ + - ][ - + ]
[ + + ]
3910 : : return;
3911 : :
3912 : : // we only need to set the focus if it is not already set
3913 : : // note: if some other frame is waiting for an asynchrounous focus event
3914 : : // we also have to post an asynchronous focus event for this frame
3915 : : // which is done using ToTop
3916 [ + - ]: 10642 : ImplSVData* pSVData = ImplGetSVData();
3917 : :
3918 : 10642 : sal_Bool bAsyncFocusWaiting = sal_False;
3919 : 10642 : Window *pFrame = pSVData->maWinData.mpFirstFrame;
3920 [ + + ]: 61365 : while( pFrame )
3921 : : {
3922 [ + + ][ + + ]: 50726 : if( pFrame != mpWindowImpl->mpFrameWindow && pFrame->mpWindowImpl->mpFrameData->mnFocusId )
3923 : : {
3924 : 3 : bAsyncFocusWaiting = sal_True;
3925 : 3 : break;
3926 : : }
3927 : 50723 : pFrame = pFrame->mpWindowImpl->mpFrameData->mpNextFrame;
3928 : : }
3929 : :
3930 : 10642 : bool bHasFocus = IsWindowFocused(*mpWindowImpl);
3931 : :
3932 : 10642 : sal_Bool bMustNotGrabFocus = sal_False;
3933 : : // #100242#, check parent hierarchy if some floater prohibits grab focus
3934 : :
3935 : 10642 : Window *pParent = this;
3936 [ + + ]: 49634 : while( pParent )
3937 : : {
3938 : : // #102158#, ignore grabfocus only if the floating parent grabs keyboard focus by itself (GrabsFocus())
3939 : : // otherwise we cannot set the focus in a floating toolbox
3940 [ - + ][ # # ]: 38992 : if( ( (pParent->mpWindowImpl->mbFloatWin && ((FloatingWindow*)pParent)->GrabsFocus()) || ( pParent->GetStyle() & WB_SYSTEMFLOATWIN ) ) && !( pParent->GetStyle() & WB_MOVEABLE ) )
[ + - ][ - + ]
[ # # ][ # # ]
[ - + ]
3941 : : {
3942 : 0 : bMustNotGrabFocus = sal_True;
3943 : 0 : break;
3944 : : }
3945 : 38992 : pParent = pParent->mpWindowImpl->mpParent;
3946 : : }
3947 : :
3948 : :
3949 [ + + ][ - + ]: 10642 : if ( ( pSVData->maWinData.mpFocusWin != this && ! mpWindowImpl->mbInDtor ) || ( bAsyncFocusWaiting && !bHasFocus && !bMustNotGrabFocus ) )
[ - + ][ # # ]
[ # # ]
3950 : : {
3951 : : // EndExtTextInput if it is not the same window
3952 [ - + ][ # # ]: 10543 : if ( pSVData->maWinData.mpExtTextInputWin &&
3953 : : (pSVData->maWinData.mpExtTextInputWin != this) )
3954 [ # # ]: 0 : pSVData->maWinData.mpExtTextInputWin->EndExtTextInput( EXTTEXTINPUT_END_COMPLETE );
3955 : :
3956 : : // mark this windows as the last FocusWindow
3957 [ + - ]: 10543 : Window* pOverlapWindow = ImplGetFirstOverlapWindow();
3958 : 10543 : pOverlapWindow->mpWindowImpl->mpLastFocusWindow = this;
3959 : 10543 : mpWindowImpl->mpFrameData->mpFocusWin = this;
3960 : :
3961 [ + + ]: 10543 : if( !bHasFocus )
3962 : : {
3963 : : // menu windows never get the system focus
3964 : : // the application will keep the focus
3965 [ + - ]: 1847 : if( bMustNotGrabFocus )
3966 : : return;
3967 : : else
3968 : : {
3969 : : // here we already switch focus as ToTop()
3970 : : // should not give focus to another window
3971 : : //DBG_WARNING( "Window::GrabFocus() - Frame doesn't have the focus" );
3972 [ + - ]: 1847 : mpWindowImpl->mpFrame->ToTop( SAL_FRAME_TOTOP_GRABFOCUS | SAL_FRAME_TOTOP_GRABFOCUS_ONLY );
3973 : : return;
3974 : : }
3975 : : }
3976 : :
3977 : 8696 : Window* pOldFocusWindow = pSVData->maWinData.mpFocusWin;
3978 [ + - ]: 8696 : ImplDelData aOldFocusDel( pOldFocusWindow );
3979 : :
3980 : 8696 : pSVData->maWinData.mpFocusWin = this;
3981 : :
3982 [ + + ]: 8696 : if ( pOldFocusWindow )
3983 : : {
3984 : : // Cursor hiden
3985 [ + + ]: 7138 : if ( pOldFocusWindow->mpWindowImpl->mpCursor )
3986 [ + - ]: 1026 : pOldFocusWindow->mpWindowImpl->mpCursor->ImplHide();
3987 : : }
3988 : :
3989 : : // !!!!! due to old SV-Office Activate/Deactivate handling
3990 : : // !!!!! first as before
3991 [ + + ]: 8696 : if ( pOldFocusWindow )
3992 : : {
3993 : : // remember Focus
3994 [ + - ]: 7138 : Window* pOldOverlapWindow = pOldFocusWindow->ImplGetFirstOverlapWindow();
3995 [ + - ]: 7138 : Window* pNewOverlapWindow = ImplGetFirstOverlapWindow();
3996 [ - + ]: 7138 : if ( pOldOverlapWindow != pNewOverlapWindow )
3997 [ # # ]: 0 : ImplCallFocusChangeActivate( pNewOverlapWindow, pOldOverlapWindow );
3998 : : }
3999 : : else
4000 : : {
4001 [ + - ]: 1558 : Window* pNewOverlapWindow = ImplGetFirstOverlapWindow();
4002 [ + - ]: 1558 : Window* pNewRealWindow = pNewOverlapWindow->ImplGetWindow();
4003 : 1558 : pNewOverlapWindow->mpWindowImpl->mbActive = sal_True;
4004 [ + - ]: 1558 : pNewOverlapWindow->Activate();
4005 [ + + ]: 1558 : if ( pNewRealWindow != pNewOverlapWindow )
4006 : : {
4007 : 1556 : pNewRealWindow->mpWindowImpl->mbActive = sal_True;
4008 [ + - ]: 1556 : pNewRealWindow->Activate();
4009 : : }
4010 : : }
4011 : :
4012 : : // call Get- and LoseFocus
4013 [ + + ][ + - ]: 8696 : if ( pOldFocusWindow && ! aOldFocusDel.IsDead() )
[ + + ]
4014 : : {
4015 [ + - ][ - + ]: 7138 : if ( pOldFocusWindow->IsTracking() &&
[ # # ][ - + ]
4016 : : (pSVData->maWinData.mnTrackFlags & STARTTRACK_FOCUSCANCEL) )
4017 [ # # ]: 0 : pOldFocusWindow->EndTracking( ENDTRACK_CANCEL | ENDTRACK_FOCUS );
4018 [ + - ]: 7138 : NotifyEvent aNEvt( EVENT_LOSEFOCUS, pOldFocusWindow );
4019 [ + - ][ + - ]: 7138 : if ( !ImplCallPreNotify( aNEvt ) )
4020 [ + - ]: 7138 : pOldFocusWindow->LoseFocus();
4021 [ + - ]: 7138 : pOldFocusWindow->ImplCallDeactivateListeners( this );
4022 : : }
4023 : :
4024 [ + - ]: 8696 : if ( pSVData->maWinData.mpFocusWin == this )
4025 : : {
4026 [ - + ]: 8696 : if ( mpWindowImpl->mpSysObj )
4027 : : {
4028 : 0 : mpWindowImpl->mpFrameData->mpFocusWin = this;
4029 [ # # ]: 0 : if ( !mpWindowImpl->mpFrameData->mbInSysObjFocusHdl )
4030 [ # # ]: 0 : mpWindowImpl->mpSysObj->GrabFocus();
4031 : : }
4032 : :
4033 [ + - ]: 8696 : if ( pSVData->maWinData.mpFocusWin == this )
4034 : : {
4035 [ + + ]: 8696 : if ( mpWindowImpl->mpCursor )
4036 [ + - ]: 1145 : mpWindowImpl->mpCursor->ImplShow();
4037 : 8696 : mpWindowImpl->mbInFocusHdl = sal_True;
4038 : 8696 : mpWindowImpl->mnGetFocusFlags = nFlags;
4039 : : // if we're changing focus due to closing a popup floating window
4040 : : // notify the new focus window so it can restore the inner focus
4041 : : // eg, toolboxes can select their recent active item
4042 [ + + + - ]: 22972 : if( pOldFocusWindow &&
[ - + ][ - + ]
4043 : 7138 : ! aOldFocusDel.IsDead() &&
4044 [ + - ]: 7138 : ( pOldFocusWindow->GetDialogControlFlags() & WINDOW_DLGCTRL_FLOATWIN_POPUPMODEEND_CANCEL ) )
4045 : 0 : mpWindowImpl->mnGetFocusFlags |= GETFOCUS_FLOATWIN_POPUPMODEEND_CANCEL;
4046 [ + - ]: 8696 : NotifyEvent aNEvt( EVENT_GETFOCUS, this );
4047 [ + - ][ + - ]: 8696 : if ( !ImplCallPreNotify( aNEvt ) && !aDogTag.IsDead() )
[ + - ][ + - ]
4048 [ + - ]: 8696 : GetFocus();
4049 [ + - ]: 8696 : if( !aDogTag.IsDead() )
4050 [ + + ][ + - ]: 8696 : ImplCallActivateListeners( (pOldFocusWindow && ! aOldFocusDel.IsDead()) ? pOldFocusWindow : NULL );
[ + - ]
4051 [ + - ]: 8696 : if( !aDogTag.IsDead() )
4052 : : {
4053 : 8696 : mpWindowImpl->mnGetFocusFlags = 0;
4054 : 8696 : mpWindowImpl->mbInFocusHdl = sal_False;
4055 : : }
4056 : : }
4057 : : }
4058 : :
4059 [ + - ][ + - ]: 8696 : GetpApp()->FocusChanged();
4060 [ + - ][ + - ]: 10642 : ImplNewInputContext();
4061 [ + - ][ + + ]: 15204 : }
4062 : : }
4063 : :
4064 : : // -----------------------------------------------------------------------
4065 : :
4066 : 10799 : void Window::ImplNewInputContext()
4067 : : {
4068 [ + - ]: 10799 : ImplSVData* pSVData = ImplGetSVData();
4069 : 10799 : Window* pFocusWin = pSVData->maWinData.mpFocusWin;
4070 [ + - ]: 10799 : if ( !pFocusWin )
4071 : : return;
4072 : :
4073 : : // Is InputContext changed?
4074 [ + - ]: 10799 : const InputContext& rInputContext = pFocusWin->GetInputContext();
4075 [ + - ][ + + ]: 10799 : if ( rInputContext == pFocusWin->mpWindowImpl->mpFrameData->maOldInputContext )
4076 : : return;
4077 : :
4078 [ + - ]: 3326 : pFocusWin->mpWindowImpl->mpFrameData->maOldInputContext = rInputContext;
4079 : :
4080 : : SalInputContext aNewContext;
4081 : 3326 : const Font& rFont = rInputContext.GetFont();
4082 [ + - ]: 3326 : const XubString& rFontName = rFont.GetName();
4083 : 3326 : ImplFontEntry* pFontEntry = NULL;
4084 : 3326 : aNewContext.mpFont = NULL;
4085 [ + + ]: 3326 : if ( rFontName.Len() )
4086 : : {
4087 [ + - ][ + - ]: 808 : Size aSize = pFocusWin->ImplLogicToDevicePixel( rFont.GetSize() );
4088 [ + + ]: 808 : if ( !aSize.Height() )
4089 : : {
4090 : : // only set default sizes if the font height in logical
4091 : : // coordinates equals 0
4092 [ + - ][ - + ]: 765 : if ( rFont.GetSize().Height() )
4093 : 0 : aSize.Height() = 1;
4094 : : else
4095 : 765 : aSize.Height() = (12*pFocusWin->mnDPIY)/72;
4096 : : }
4097 : : // TODO: No display device uses ImplDirectFontSubstitution thingy, right? => remove it
4098 : 808 : ImplDirectFontSubstitution* pFontSubst = NULL;
4099 : : //if( pFocusWin->mpOutDevData )
4100 : : // pFontSubst = &pFocusWin->mpOutDevData->maDevFontSubst;
4101 : : pFontEntry = pFocusWin->mpFontCache->GetFontEntry( pFocusWin->mpFontList,
4102 [ + - ]: 808 : rFont, aSize, static_cast<float>(aSize.Height()), pFontSubst );
4103 [ + - ]: 808 : if ( pFontEntry )
4104 : 808 : aNewContext.mpFont = &pFontEntry->maFontSelData;
4105 : : }
4106 [ + - ]: 3326 : aNewContext.meLanguage = rFont.GetLanguage();
4107 : 3326 : aNewContext.mnOptions = rInputContext.GetOptions();
4108 [ + - ][ + - ]: 3326 : pFocusWin->ImplGetFrame()->SetInputContext( &aNewContext );
4109 : :
4110 [ + + ]: 3326 : if ( pFontEntry )
4111 [ + - ]: 10799 : pFocusWin->mpFontCache->Release( pFontEntry );
4112 : : }
4113 : :
4114 : : // -----------------------------------------------------------------------
4115 : :
4116 : 110926 : Window::Window( WindowType nType )
4117 : : {
4118 : : DBG_CTOR( Window, ImplDbgCheckWindow );
4119 : :
4120 [ + - ]: 110926 : ImplInitWindowData( nType );
4121 : 110926 : }
4122 : :
4123 : : // -----------------------------------------------------------------------
4124 : :
4125 : 13248 : Window::Window( Window* pParent, WinBits nStyle )
4126 : : {
4127 : : DBG_CTOR( Window, ImplDbgCheckWindow );
4128 : :
4129 [ + - ]: 13248 : ImplInitWindowData( WINDOW_WINDOW );
4130 [ + - ]: 13248 : ImplInit( pParent, nStyle, NULL );
4131 : 13248 : }
4132 : :
4133 : : // -----------------------------------------------------------------------
4134 : :
4135 : 2 : Window::Window( Window* pParent, const ResId& rResId )
4136 : : {
4137 : : DBG_CTOR( Window, ImplDbgCheckWindow );
4138 : :
4139 [ + - ]: 2 : ImplInitWindowData( WINDOW_WINDOW );
4140 : 2 : rResId.SetRT( RSC_WINDOW );
4141 [ + - ]: 2 : WinBits nStyle = ImplInitRes( rResId );
4142 [ + - ]: 2 : ImplInit( pParent, nStyle, NULL );
4143 [ + - ]: 2 : ImplLoadRes( rResId );
4144 : :
4145 [ + - ]: 2 : if ( !(nStyle & WB_HIDE) )
4146 [ + - ]: 2 : Show();
4147 : 2 : }
4148 : :
4149 : : // -----------------------------------------------------------------------
4150 : : #if OSL_DEBUG_LEVEL > 0
4151 : : namespace
4152 : : {
4153 : : rtl::OString lcl_createWindowInfo(const Window& i_rWindow)
4154 : : {
4155 : : // skip border windows, they don't carry information which helps diagnosing the problem
4156 : : const Window* pWindow( &i_rWindow );
4157 : : while ( pWindow && ( pWindow->GetType() == WINDOW_BORDERWINDOW ) )
4158 : : pWindow = pWindow->GetWindow( WINDOW_FIRSTCHILD );
4159 : : if ( !pWindow )
4160 : : pWindow = &i_rWindow;
4161 : :
4162 : : rtl::OStringBuffer aErrorString;
4163 : : aErrorString.append(char(13));
4164 : : aErrorString.append(typeid( *pWindow ).name());
4165 : : aErrorString.append(" (window text: '");
4166 : : aErrorString.append(rtl::OUStringToOString(pWindow->GetText(), RTL_TEXTENCODING_UTF8));
4167 : : aErrorString.append("')");
4168 : : return aErrorString.makeStringAndClear();
4169 : : }
4170 : : }
4171 : : #endif
4172 : : // -----------------------------------------------------------------------
4173 : :
4174 : 120493 : Window::~Window()
4175 : : {
4176 [ + - ]: 120493 : ImplFreeExtWindowImpl();
4177 : :
4178 [ + - ]: 120493 : vcl::LazyDeletor<Window>::Undelete( this );
4179 : :
4180 : : DBG_DTOR( Window, ImplDbgCheckWindow );
4181 : : DBG_ASSERT( !mpWindowImpl->mbInDtor, "~Window - already in DTOR!" );
4182 : :
4183 : :
4184 : : // remove Key and Mouse events issued by Application::PostKey/MouseEvent
4185 [ + - ]: 120493 : Application::RemoveMouseAndKeyEvents( this );
4186 : :
4187 : : // Dispose of the canvas implementation (which, currently, has an
4188 : : // own wrapper window as a child to this one.
4189 [ + - ]: 120493 : uno::Reference< rendering::XCanvas > xCanvas( mpWindowImpl->mxCanvas );
4190 [ - + ]: 120493 : if( xCanvas.is() )
4191 : : {
4192 : : uno::Reference < lang::XComponent > xCanvasComponent( xCanvas,
4193 [ # # ]: 0 : uno::UNO_QUERY );
4194 [ # # ]: 0 : if( xCanvasComponent.is() )
4195 [ # # ][ # # ]: 0 : xCanvasComponent->dispose();
4196 : : }
4197 : :
4198 : 120493 : mpWindowImpl->mbInDtor = sal_True;
4199 : :
4200 [ + - ]: 120493 : ImplCallEventListeners( VCLEVENT_OBJECT_DYING );
4201 : :
4202 : : // do not send child events for frames that were registered as native frames
4203 [ + + ][ + + ]: 120493 : if( !ImplIsAccessibleNativeFrame() && mpWindowImpl->mbReallyVisible )
[ + + ]
4204 [ + - ][ + - ]: 32961 : if ( ImplIsAccessibleCandidate() && GetAccessibleParentWindow() )
[ + + ][ + + ]
4205 [ + - ][ + - ]: 32957 : GetAccessibleParentWindow()->ImplCallEventListeners( VCLEVENT_WINDOW_CHILDDESTROYED, this );
4206 : :
4207 : : // remove associated data structures from dockingmanager
4208 [ + - ][ + - ]: 120493 : ImplGetDockingManager()->RemoveWindow( this );
4209 : :
4210 : :
4211 : : // remove ownerdraw decorated windows from list in the top-most frame window
4212 [ + - ][ + + ]: 120493 : if( (GetStyle() & WB_OWNERDRAWDECORATION) && mpWindowImpl->mbFrame )
[ - + ][ - + ]
4213 : : {
4214 [ # # ]: 0 : ::std::vector< Window* >& rList = ImplGetOwnerDrawList();
4215 : 0 : ::std::vector< Window* >::iterator p;
4216 [ # # ]: 0 : p = ::std::find( rList.begin(), rList.end(), this );
4217 [ # # ][ # # ]: 0 : if( p != rList.end() )
4218 [ # # ]: 0 : rList.erase( p );
4219 : : }
4220 : :
4221 : : // shutdown drag and drop
4222 [ + - ]: 120493 : ::com::sun::star::uno::Reference < ::com::sun::star::lang::XComponent > xDnDComponent( mpWindowImpl->mxDNDListenerContainer, ::com::sun::star::uno::UNO_QUERY );
4223 : :
4224 [ + + ]: 120493 : if( xDnDComponent.is() )
4225 [ + - ][ + - ]: 15731 : xDnDComponent->dispose();
4226 : :
4227 [ + + ][ + - ]: 120493 : if( mpWindowImpl->mbFrame && mpWindowImpl->mpFrameData )
4228 : : {
4229 : : try
4230 : : {
4231 : : // deregister drop target listener
4232 [ + + ]: 5802 : if( mpWindowImpl->mpFrameData->mxDropTargetListener.is() )
4233 : : {
4234 : : uno::Reference< XDragGestureRecognizer > xDragGestureRecognizer =
4235 [ + - ]: 2033 : uno::Reference< XDragGestureRecognizer > (mpWindowImpl->mpFrameData->mxDragSource, UNO_QUERY);
4236 [ - + ]: 2033 : if( xDragGestureRecognizer.is() )
4237 : : {
4238 [ # # ]: 0 : xDragGestureRecognizer->removeDragGestureListener(
4239 [ # # ][ # # ]: 0 : uno::Reference< XDragGestureListener > (mpWindowImpl->mpFrameData->mxDropTargetListener, UNO_QUERY));
4240 : : }
4241 : :
4242 [ + - ][ + - ]: 2033 : mpWindowImpl->mpFrameData->mxDropTarget->removeDropTargetListener( mpWindowImpl->mpFrameData->mxDropTargetListener );
4243 : 2033 : mpWindowImpl->mpFrameData->mxDropTargetListener.clear();
4244 : : }
4245 : :
4246 : : // shutdown drag and drop for this frame window
4247 [ + - ]: 5802 : uno::Reference< XComponent > xComponent( mpWindowImpl->mpFrameData->mxDropTarget, UNO_QUERY );
4248 : :
4249 : : // DNDEventDispatcher does not hold a reference of the DropTarget,
4250 : : // so it's ok if it does not support XComponent
4251 [ + + ]: 5802 : if( xComponent.is() )
4252 [ + - ][ + - ]: 5802 : xComponent->dispose();
[ # # ]
4253 : : }
4254 [ # # ]: 0 : catch (const Exception&)
4255 : : {
4256 : : // can be safely ignored here.
4257 : : }
4258 : : }
4259 : :
4260 [ + - ]: 120493 : UnoWrapperBase* pWrapper = Application::GetUnoWrapper( sal_False );
4261 [ + + ]: 120493 : if ( pWrapper )
4262 [ + - ]: 120305 : pWrapper->WindowDestroyed( this );
4263 : :
4264 : : // MT: Must be called after WindowDestroyed!
4265 : : // Otherwise, if the accessible is a VCLXWindow, it will try to destroy this window again!
4266 : : // But accessibility implementations from applications need this dispose.
4267 [ + + ]: 120493 : if ( mpWindowImpl->mxAccessible.is() )
4268 : : {
4269 [ + - ]: 579 : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent> xC( mpWindowImpl->mxAccessible, ::com::sun::star::uno::UNO_QUERY );
4270 [ + + ]: 579 : if ( xC.is() )
4271 [ + - ][ + - ]: 579 : xC->dispose();
4272 : : }
4273 : :
4274 [ + - ]: 120493 : ImplSVData* pSVData = ImplGetSVData();
4275 : :
4276 [ - + ][ # # ]: 120493 : if ( pSVData->maHelpData.mpHelpWin && (pSVData->maHelpData.mpHelpWin->GetParent() == this) )
[ # # ][ - + ]
4277 [ # # ]: 0 : ImplDestroyHelpWindow( true );
4278 : :
4279 : : DBG_ASSERT( pSVData->maWinData.mpTrackWin != this,
4280 : : "Window::~Window(): Window is in TrackingMode" );
4281 : : DBG_ASSERT( pSVData->maWinData.mpCaptureWin != this,
4282 : : "Window::~Window(): Window has the mouse captured" );
4283 : : // #103442# DefModalDialogParent is now determined on-the-fly, so this pointer is unimportant now
4284 : : //DBG_ASSERT( pSVData->maWinData.mpDefDialogParent != this,
4285 : : // "Window::~Window(): Window is DefModalDialogParent" );
4286 : :
4287 : : // due to old compatibility
4288 [ - + ]: 120493 : if ( pSVData->maWinData.mpTrackWin == this )
4289 [ # # ]: 0 : EndTracking();
4290 [ - + ]: 120493 : if ( pSVData->maWinData.mpCaptureWin == this )
4291 [ # # ]: 0 : ReleaseMouse();
4292 [ - + ]: 120493 : if ( pSVData->maWinData.mpDefDialogParent == this )
4293 : 0 : pSVData->maWinData.mpDefDialogParent = NULL;
4294 : :
4295 : : #if OSL_DEBUG_LEVEL > 0
4296 : : if ( sal_True ) // always perform these tests in non-pro versions
4297 : : {
4298 : : rtl::OStringBuffer aErrorStr;
4299 : : sal_Bool bError = sal_False;
4300 : : Window* pTempWin = mpWindowImpl->mpFrameData->mpFirstOverlap;
4301 : : while ( pTempWin )
4302 : : {
4303 : : if ( ImplIsRealParentPath( pTempWin ) )
4304 : : {
4305 : : bError = sal_True;
4306 : : aErrorStr.append(lcl_createWindowInfo(*pTempWin));
4307 : : }
4308 : : pTempWin = pTempWin->mpWindowImpl->mpNextOverlap;
4309 : : }
4310 : : if ( bError )
4311 : : {
4312 : : rtl::OStringBuffer aTempStr;
4313 : : aTempStr.append(RTL_CONSTASCII_STRINGPARAM("Window ("));
4314 : : aTempStr.append(rtl::OUStringToOString(GetText(),
4315 : : RTL_TEXTENCODING_UTF8));
4316 : : aTempStr.append(RTL_CONSTASCII_STRINGPARAM(
4317 : : ") with living SystemWindow(s) destroyed: "));
4318 : : aTempStr.append(aErrorStr.toString());
4319 : : OSL_FAIL(aTempStr.getStr());
4320 : : // abort in non-pro version, this must be fixed!
4321 : : GetpApp()->Abort(rtl::OStringToOUString(
4322 : : aTempStr.makeStringAndClear(), RTL_TEXTENCODING_UTF8));
4323 : : }
4324 : :
4325 : : bError = sal_False;
4326 : : pTempWin = pSVData->maWinData.mpFirstFrame;
4327 : : while ( pTempWin )
4328 : : {
4329 : : if ( ImplIsRealParentPath( pTempWin ) )
4330 : : {
4331 : : bError = sal_True;
4332 : : aErrorStr.append(lcl_createWindowInfo(*pTempWin));
4333 : : }
4334 : : pTempWin = pTempWin->mpWindowImpl->mpFrameData->mpNextFrame;
4335 : : }
4336 : : if ( bError )
4337 : : {
4338 : : rtl::OStringBuffer aTempStr( "Window (" );
4339 : : aTempStr.append(rtl::OUStringToOString(GetText(), RTL_TEXTENCODING_UTF8));
4340 : : aTempStr.append(") with living SystemWindow(s) destroyed: ");
4341 : : aTempStr.append(aErrorStr.toString());
4342 : : OSL_FAIL( aTempStr.getStr() );
4343 : : GetpApp()->Abort(rtl::OStringToOUString(aTempStr.makeStringAndClear(), RTL_TEXTENCODING_UTF8)); // abort in non-pro version, this must be fixed!
4344 : : }
4345 : :
4346 : : if ( mpWindowImpl->mpFirstChild )
4347 : : {
4348 : : rtl::OStringBuffer aTempStr("Window (");
4349 : : aTempStr.append(rtl::OUStringToOString(GetText(), RTL_TEXTENCODING_UTF8));
4350 : : aTempStr.append(") with living Child(s) destroyed: ");
4351 : : pTempWin = mpWindowImpl->mpFirstChild;
4352 : : while ( pTempWin )
4353 : : {
4354 : : aTempStr.append(lcl_createWindowInfo(*pTempWin));
4355 : : pTempWin = pTempWin->mpWindowImpl->mpNext;
4356 : : }
4357 : : OSL_FAIL( aTempStr.getStr() );
4358 : : GetpApp()->Abort(rtl::OStringToOUString(aTempStr.makeStringAndClear(), RTL_TEXTENCODING_UTF8)); // abort in non-pro version, this must be fixed!
4359 : : }
4360 : :
4361 : : if ( mpWindowImpl->mpFirstOverlap )
4362 : : {
4363 : : rtl::OStringBuffer aTempStr("Window (");
4364 : : aTempStr.append(rtl::OUStringToOString(GetText(), RTL_TEXTENCODING_UTF8));
4365 : : aTempStr.append(") with living SystemWindow(s) destroyed: ");
4366 : : pTempWin = mpWindowImpl->mpFirstOverlap;
4367 : : while ( pTempWin )
4368 : : {
4369 : : aTempStr.append(lcl_createWindowInfo(*pTempWin));
4370 : : pTempWin = pTempWin->mpWindowImpl->mpNext;
4371 : : }
4372 : : OSL_FAIL( aTempStr.getStr() );
4373 : : GetpApp()->Abort(rtl::OStringToOUString(aTempStr.makeStringAndClear(), RTL_TEXTENCODING_UTF8)); // abort in non-pro version, this must be fixed!
4374 : : }
4375 : :
4376 : : Window* pMyParent = this;
4377 : : SystemWindow* pMySysWin = NULL;
4378 : :
4379 : : while ( pMyParent )
4380 : : {
4381 : : if ( pMyParent->IsSystemWindow() )
4382 : : pMySysWin = (SystemWindow*)pMyParent;
4383 : : pMyParent = pMyParent->GetParent();
4384 : : }
4385 : : if ( pMySysWin && pMySysWin->ImplIsInTaskPaneList( this ) )
4386 : : {
4387 : : rtl::OStringBuffer aTempStr("Window (");
4388 : : aTempStr.append(rtl::OUStringToOString(GetText(), RTL_TEXTENCODING_UTF8));
4389 : : aTempStr.append(") still in TaskPanelList!");
4390 : : OSL_FAIL( aTempStr.getStr() );
4391 : : GetpApp()->Abort(rtl::OStringToOUString(aTempStr.makeStringAndClear(), RTL_TEXTENCODING_UTF8)); // abort in non-pro version, this must be fixed!
4392 : : }
4393 : : }
4394 : : #endif
4395 : :
4396 [ - + ]: 120493 : if( mpWindowImpl->mbIsInTaskPaneList )
4397 : : {
4398 : 0 : Window* pMyParent = this;
4399 : 0 : SystemWindow* pMySysWin = NULL;
4400 : :
4401 [ # # ]: 0 : while ( pMyParent )
4402 : : {
4403 [ # # ][ # # ]: 0 : if ( pMyParent->IsSystemWindow() )
4404 : 0 : pMySysWin = (SystemWindow*)pMyParent;
4405 [ # # ]: 0 : pMyParent = pMyParent->GetParent();
4406 : : }
4407 [ # # ][ # # ]: 0 : if ( pMySysWin && pMySysWin->ImplIsInTaskPaneList( this ) )
[ # # ][ # # ]
4408 : : {
4409 [ # # ][ # # ]: 0 : pMySysWin->GetTaskPaneList()->RemoveWindow( this );
4410 : : }
4411 : : else
4412 : : {
4413 : 0 : rtl::OStringBuffer aTempStr("Window (");
4414 [ # # ][ # # ]: 0 : aTempStr.append(rtl::OUStringToOString(GetText(), RTL_TEXTENCODING_UTF8));
[ # # ][ # # ]
[ # # ]
4415 [ # # ]: 0 : aTempStr.append(") not found in TaskPanelList!");
4416 : 0 : OSL_FAIL( aTempStr.getStr() );
4417 : : }
4418 : : }
4419 : :
4420 : : // hide window in order to trigger the Paint-Handling
4421 [ + - ]: 120493 : Hide();
4422 : :
4423 : : // announce the window is to be destroyed
4424 : : {
4425 [ + - ]: 120493 : NotifyEvent aNEvt( EVENT_DESTROY, this );
4426 [ + - ]: 120493 : Notify( aNEvt );
4427 : : }
4428 : :
4429 : : // EndExtTextInputMode
4430 [ - + ]: 120493 : if ( pSVData->maWinData.mpExtTextInputWin == this )
4431 : : {
4432 [ # # ]: 0 : EndExtTextInput( EXTTEXTINPUT_END_COMPLETE );
4433 [ # # ]: 0 : if ( pSVData->maWinData.mpExtTextInputWin == this )
4434 : 0 : pSVData->maWinData.mpExtTextInputWin = NULL;
4435 : : }
4436 : :
4437 : : // check if the focus window is our child
4438 : 120493 : sal_Bool bHasFocussedChild = sal_False;
4439 [ + + ][ + - ]: 120493 : if( pSVData->maWinData.mpFocusWin && ImplIsRealParentPath( pSVData->maWinData.mpFocusWin ) )
[ - + ][ - + ]
4440 : : {
4441 : : // #122232#, this must not happen and is an application bug ! but we try some cleanup to hopefully avoid crashes, see below
4442 : 0 : bHasFocussedChild = sal_True;
4443 : : #if OSL_DEBUG_LEVEL > 0
4444 : : rtl::OStringBuffer aTempStr("Window (");
4445 : : aTempStr.append(rtl::OUStringToOString(GetText(),
4446 : : RTL_TEXTENCODING_UTF8)).
4447 : : append(") with focussed child window destroyed ! THIS WILL LEAD TO CRASHES AND MUST BE FIXED !");
4448 : : OSL_FAIL( aTempStr.getStr() );
4449 : : GetpApp()->Abort(rtl::OStringToOUString(aTempStr.makeStringAndClear(), RTL_TEXTENCODING_UTF8 )); // abort in non-pro version, this must be fixed!
4450 : : #endif
4451 : : }
4452 : :
4453 : : // if we get focus pass focus to another window
4454 [ + - ]: 120493 : Window* pOverlapWindow = ImplGetFirstOverlapWindow();
4455 [ + + ][ - + ]: 120493 : if ( pSVData->maWinData.mpFocusWin == this
4456 : : || bHasFocussedChild ) // #122232#, see above, try some cleanup
4457 : : {
4458 [ + + ]: 4191 : if ( mpWindowImpl->mbFrame )
4459 : : {
4460 : 2 : pSVData->maWinData.mpFocusWin = NULL;
4461 : 2 : pOverlapWindow->mpWindowImpl->mpLastFocusWindow = NULL;
4462 [ + - ][ + - ]: 2 : GetpApp()->FocusChanged();
4463 : : }
4464 : : else
4465 : : {
4466 [ + - ]: 4189 : Window* pParent = GetParent();
4467 : 4189 : Window* pBorderWindow = mpWindowImpl->mpBorderWindow;
4468 : : // when windows overlap, give focus to the parent
4469 : : // of the next FrameWindow
4470 [ + + ]: 4189 : if ( pBorderWindow )
4471 : : {
4472 [ + - ][ + + ]: 2756 : if ( pBorderWindow->ImplIsOverlapWindow() )
4473 : 1382 : pParent = pBorderWindow->mpWindowImpl->mpOverlapWindow;
4474 : : }
4475 [ + - ][ - + ]: 1433 : else if ( ImplIsOverlapWindow() )
4476 : 0 : pParent = mpWindowImpl->mpOverlapWindow;
4477 : :
4478 [ + - ][ + - ]: 4189 : if ( pParent && pParent->IsEnabled() && pParent->IsInputEnabled() && ! pParent->IsInModalMode() )
[ + - ][ + - ]
[ + + ][ + - ]
[ + - ][ + + ]
4479 [ + - ]: 4187 : pParent->GrabFocus();
4480 : : else
4481 [ + - ]: 2 : mpWindowImpl->mpFrameWindow->GrabFocus();
4482 : :
4483 : : // If the focus was set back to 'this' set it to nothing
4484 [ + + ]: 4189 : if ( pSVData->maWinData.mpFocusWin == this )
4485 : : {
4486 : 1410 : pSVData->maWinData.mpFocusWin = NULL;
4487 : 1410 : pOverlapWindow->mpWindowImpl->mpLastFocusWindow = NULL;
4488 [ + - ][ + - ]: 1410 : GetpApp()->FocusChanged();
4489 : : }
4490 : : }
4491 : : }
4492 : :
4493 : :
4494 [ + + ]: 120493 : if ( pOverlapWindow->mpWindowImpl->mpLastFocusWindow == this )
4495 : 246 : pOverlapWindow->mpWindowImpl->mpLastFocusWindow = NULL;
4496 : :
4497 : : // reset hint for DefModalDialogParent
4498 [ + + ]: 120493 : if( pSVData->maWinData.mpActiveApplicationFrame == this )
4499 : 1418 : pSVData->maWinData.mpActiveApplicationFrame = NULL;
4500 : :
4501 : : // reset marked windows
4502 [ + + ]: 120493 : if ( mpWindowImpl->mpFrameData->mpFocusWin == this )
4503 : 1658 : mpWindowImpl->mpFrameData->mpFocusWin = NULL;
4504 [ - + ]: 120493 : if ( mpWindowImpl->mpFrameData->mpMouseMoveWin == this )
4505 : 0 : mpWindowImpl->mpFrameData->mpMouseMoveWin = NULL;
4506 [ - + ]: 120493 : if ( mpWindowImpl->mpFrameData->mpMouseDownWin == this )
4507 : 0 : mpWindowImpl->mpFrameData->mpMouseDownWin = NULL;
4508 : :
4509 : : // reset Deactivate-Window
4510 [ - + ]: 120493 : if ( pSVData->maWinData.mpLastDeacWin == this )
4511 : 0 : pSVData->maWinData.mpLastDeacWin = NULL;
4512 : :
4513 [ + + ]: 120493 : if ( mpWindowImpl->mbFrame )
4514 : : {
4515 [ + + ]: 5802 : if ( mpWindowImpl->mpFrameData->mnFocusId )
4516 [ + - ]: 7 : Application::RemoveUserEvent( mpWindowImpl->mpFrameData->mnFocusId );
4517 [ + + ]: 5802 : if ( mpWindowImpl->mpFrameData->mnMouseMoveId )
4518 [ + - ]: 1627 : Application::RemoveUserEvent( mpWindowImpl->mpFrameData->mnMouseMoveId );
4519 : : }
4520 : :
4521 : : // release Graphic
4522 [ + - ]: 120493 : ImplReleaseGraphics();
4523 : :
4524 : : // if appropriate announce the window has been deleted
4525 : 120493 : ImplDelData* pDelData = mpWindowImpl->mpFirstDel;
4526 [ + + ]: 120497 : while ( pDelData )
4527 : : {
4528 : 4 : pDelData->mbDel = sal_True;
4529 : 4 : pDelData->mpWindow = NULL; // #112873# pDel is not associated with a Window anymore
4530 : 4 : pDelData = pDelData->mpNext;
4531 : : }
4532 : :
4533 : : // remove window from the lists
4534 [ + - ]: 120493 : ImplRemoveWindow( sal_True );
4535 : :
4536 : : // de-register as "top window child" at our parent, if necessary
4537 [ + + ]: 120493 : if ( mpWindowImpl->mbFrame )
4538 : : {
4539 [ + + ][ + + ]: 5802 : sal_Bool bIsTopWindow = mpWindowImpl->mpWinData && ( mpWindowImpl->mpWinData->mnIsTopWindow == 1 );
4540 [ + + ][ + + ]: 5802 : if ( mpWindowImpl->mpRealParent && bIsTopWindow )
4541 : : {
4542 [ + - ]: 34 : ImplWinData* pParentWinData = mpWindowImpl->mpRealParent->ImplGetWinData();
4543 : :
4544 : : ::std::list< Window* >::iterator myPos = ::std::find( pParentWinData->maTopWindowChildren.begin(),
4545 [ + - ]: 34 : pParentWinData->maTopWindowChildren.end(), this );
4546 : : DBG_ASSERT( myPos != pParentWinData->maTopWindowChildren.end(), "Window::~Window: inconsistency in top window chain!" );
4547 [ + - ][ + - ]: 34 : if ( myPos != pParentWinData->maTopWindowChildren.end() )
4548 [ + - ]: 34 : pParentWinData->maTopWindowChildren.erase( myPos );
4549 : : }
4550 : : }
4551 : :
4552 : : // delete extra window data
4553 [ + + ]: 120493 : if ( mpWindowImpl->mpWinData )
4554 : : {
4555 [ - + ]: 120305 : if ( mpWindowImpl->mpWinData->mpExtOldText )
4556 [ # # ][ # # ]: 0 : delete mpWindowImpl->mpWinData->mpExtOldText;
4557 [ - + ]: 120305 : if ( mpWindowImpl->mpWinData->mpExtOldAttrAry )
4558 : 0 : delete mpWindowImpl->mpWinData->mpExtOldAttrAry;
4559 [ - + ]: 120305 : if ( mpWindowImpl->mpWinData->mpCursorRect )
4560 : 0 : delete mpWindowImpl->mpWinData->mpCursorRect;
4561 [ + + ]: 120305 : if ( mpWindowImpl->mpWinData->mpFocusRect )
4562 : 42 : delete mpWindowImpl->mpWinData->mpFocusRect;
4563 [ - + ]: 120305 : if ( mpWindowImpl->mpWinData->mpTrackRect )
4564 : 0 : delete mpWindowImpl->mpWinData->mpTrackRect;
4565 : :
4566 [ + - ]: 120305 : delete mpWindowImpl->mpWinData;
4567 : : }
4568 : :
4569 : :
4570 : : // delete Overlap-Window data
4571 [ + + ]: 120493 : if ( mpWindowImpl->mpOverlapData )
4572 : : {
4573 : 5802 : delete mpWindowImpl->mpOverlapData;
4574 : : }
4575 : :
4576 : : // delete BorderWindow or Frame if required
4577 [ + + ]: 120493 : if ( mpWindowImpl->mpBorderWindow )
4578 [ + - ][ + - ]: 12450 : delete mpWindowImpl->mpBorderWindow;
4579 [ + + ]: 108043 : else if ( mpWindowImpl->mbFrame )
4580 : : {
4581 [ + + ]: 5802 : if ( pSVData->maWinData.mpFirstFrame == this )
4582 : 3186 : pSVData->maWinData.mpFirstFrame = mpWindowImpl->mpFrameData->mpNextFrame;
4583 : : else
4584 : : {
4585 : 2616 : Window* pSysWin = pSVData->maWinData.mpFirstFrame;
4586 [ + + ]: 4745 : while ( pSysWin->mpWindowImpl->mpFrameData->mpNextFrame != this )
4587 : 2129 : pSysWin = pSysWin->mpWindowImpl->mpFrameData->mpNextFrame;
4588 : 2616 : pSysWin->mpWindowImpl->mpFrameData->mpNextFrame = mpWindowImpl->mpFrameData->mpNextFrame;
4589 : : }
4590 : 5802 : mpWindowImpl->mpFrame->SetCallback( NULL, NULL );
4591 [ + - ]: 5802 : pSVData->mpDefInst->DestroyFrame( mpWindowImpl->mpFrame );
4592 [ + - ][ + - ]: 5802 : delete mpWindowImpl->mpFrameData;
4593 : : }
4594 : :
4595 [ + + ]: 120493 : if ( mpWindowImpl->mpChildClipRegion )
4596 [ + - ][ + - ]: 7127 : delete mpWindowImpl->mpChildClipRegion;
4597 : :
4598 [ + + ][ + - ]: 120493 : delete mpWindowImpl->mpAccessibleInfos;
4599 [ + + ][ + - ]: 120493 : delete mpWindowImpl->mpControlFont;
4600 : :
4601 : : // should be the last statements
4602 [ + - ][ + - ]: 120493 : delete mpWindowImpl; mpWindowImpl = NULL;
4603 [ - + ]: 120493 : }
4604 : :
4605 : : // -----------------------------------------------------------------------
4606 : 3543 : void Window::doLazyDelete()
4607 : : {
4608 [ - + ]: 3543 : SystemWindow* pSysWin = dynamic_cast<SystemWindow*>(this);
4609 [ - + ]: 3543 : DockingWindow* pDockWin = dynamic_cast<DockingWindow*>(this);
4610 [ + + ][ + - ]: 3543 : if( pSysWin || ( pDockWin && pDockWin->IsFloatingMode() ) )
[ - + ][ + + ]
4611 : : {
4612 : 16 : Show( false );
4613 : 16 : SetParent( ImplGetDefaultWindow() );
4614 : : }
4615 : 3543 : vcl::LazyDeletor<Window>::Delete( this );
4616 : 3543 : }
4617 : :
4618 : 0 : sal_uInt16 Window::GetIndicatorState() const
4619 : : {
4620 : 0 : return mpWindowImpl->mpFrame->GetIndicatorState().mnState;
4621 : : }
4622 : :
4623 : 0 : void Window::SimulateKeyPress( sal_uInt16 nKeyCode ) const
4624 : : {
4625 : 0 : mpWindowImpl->mpFrame->SimulateKeyPress(nKeyCode);
4626 : 0 : }
4627 : :
4628 : : // -----------------------------------------------------------------------
4629 : :
4630 : 0 : void Window::MouseMove( const MouseEvent& rMEvt )
4631 : : {
4632 : : { // Parentheses, as in this handler the window can be destroyed
4633 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
4634 : : }
4635 : :
4636 [ # # ]: 0 : NotifyEvent aNEvt( EVENT_MOUSEMOVE, this, &rMEvt );
4637 [ # # ][ # # ]: 0 : if ( !Notify( aNEvt ) )
4638 : 0 : mpWindowImpl->mbMouseMove = sal_True;
4639 : 0 : }
4640 : :
4641 : : // -----------------------------------------------------------------------
4642 : :
4643 : 0 : void Window::MouseButtonDown( const MouseEvent& rMEvt )
4644 : : {
4645 : : { // Parentheses, as in this handler the window can be destroyed
4646 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
4647 : : }
4648 : :
4649 [ # # ]: 0 : NotifyEvent aNEvt( EVENT_MOUSEBUTTONDOWN, this, &rMEvt );
4650 [ # # ][ # # ]: 0 : if ( !Notify( aNEvt ) )
4651 : 0 : mpWindowImpl->mbMouseButtonDown = sal_True;
4652 : 0 : }
4653 : :
4654 : : // -----------------------------------------------------------------------
4655 : :
4656 : 0 : void Window::MouseButtonUp( const MouseEvent& rMEvt )
4657 : : {
4658 : : { // Parentheses, as in this handler the window can be destroyed
4659 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
4660 : : }
4661 : :
4662 [ # # ]: 0 : NotifyEvent aNEvt( EVENT_MOUSEBUTTONUP, this, &rMEvt );
4663 [ # # ][ # # ]: 0 : if ( !Notify( aNEvt ) )
4664 : 0 : mpWindowImpl->mbMouseButtonUp = sal_True;
4665 : 0 : }
4666 : :
4667 : : // -----------------------------------------------------------------------
4668 : :
4669 : 0 : void Window::KeyInput( const KeyEvent& rKEvt )
4670 : : {
4671 : : { // Parentheses, as in this handler the window can be destroyed
4672 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
4673 : : }
4674 : :
4675 [ # # ]: 0 : NotifyEvent aNEvt( EVENT_KEYINPUT, this, &rKEvt );
4676 [ # # ][ # # ]: 0 : if ( !Notify( aNEvt ) )
4677 : 0 : mpWindowImpl->mbKeyInput = sal_True;
4678 : 0 : }
4679 : :
4680 : : // -----------------------------------------------------------------------
4681 : :
4682 : 0 : void Window::KeyUp( const KeyEvent& rKEvt )
4683 : : {
4684 : : { // Parentheses, as in this handler the window can be destroyed
4685 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
4686 : : }
4687 : :
4688 [ # # ]: 0 : NotifyEvent aNEvt( EVENT_KEYUP, this, &rKEvt );
4689 [ # # ][ # # ]: 0 : if ( !Notify( aNEvt ) )
4690 : 0 : mpWindowImpl->mbKeyUp = sal_True;
4691 : 0 : }
4692 : :
4693 : : // -----------------------------------------------------------------------
4694 : :
4695 : 456104 : void Window::PrePaint()
4696 : : {
4697 : 456104 : }
4698 : :
4699 : : // -----------------------------------------------------------------------
4700 : :
4701 : 6790 : void Window::Paint( const Rectangle& rRect )
4702 : : {
4703 : : { // Parentheses, as in this handler the window can be destroyed
4704 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
4705 : : }
4706 : :
4707 : 6790 : ImplCallEventListeners( VCLEVENT_WINDOW_PAINT, (void*)&rRect );
4708 : 6790 : }
4709 : :
4710 : : // -----------------------------------------------------------------------
4711 : :
4712 : 0 : void Window::PostPaint()
4713 : : {
4714 : 0 : }
4715 : :
4716 : : // -----------------------------------------------------------------------
4717 : :
4718 : 0 : void Window::Draw( OutputDevice*, const Point&, const Size&, sal_uLong )
4719 : : {
4720 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
4721 : 0 : }
4722 : :
4723 : : // -----------------------------------------------------------------------
4724 : :
4725 : 170872 : void Window::Move()
4726 : : {
4727 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
4728 : 170872 : }
4729 : :
4730 : : // -----------------------------------------------------------------------
4731 : :
4732 : 107667 : void Window::Resize()
4733 : : {
4734 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
4735 : 107667 : }
4736 : :
4737 : : // -----------------------------------------------------------------------
4738 : :
4739 : 7022 : void Window::Activate()
4740 : : {
4741 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
4742 : 7022 : }
4743 : :
4744 : : // -----------------------------------------------------------------------
4745 : :
4746 : 2466 : void Window::Deactivate()
4747 : : {
4748 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
4749 : 2466 : }
4750 : :
4751 : : // -----------------------------------------------------------------------
4752 : :
4753 : 5786 : void Window::GetFocus()
4754 : : {
4755 : : { // Parentheses, as in this handler the window can be destroyed
4756 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
4757 : : }
4758 : :
4759 [ + - ][ + + ]: 5786 : if ( HasFocus() && mpWindowImpl->mpLastFocusWindow && !(mpWindowImpl->mnDlgCtrlFlags & WINDOW_DLGCTRL_WANTFOCUS) )
[ + + ][ + - ]
[ + + ]
4760 : : {
4761 [ + - ]: 2 : ImplDelData aDogtag( this );
4762 [ + - ]: 2 : mpWindowImpl->mpLastFocusWindow->GrabFocus();
4763 [ - + ]: 2 : if( aDogtag.IsDead() )
4764 [ + - ][ + - ]: 5788 : return;
4765 : : }
4766 : :
4767 [ + - ]: 5786 : NotifyEvent aNEvt( EVENT_GETFOCUS, this );
4768 [ + - ]: 5786 : Notify( aNEvt );
4769 : : }
4770 : :
4771 : : // -----------------------------------------------------------------------
4772 : :
4773 : 7245 : void Window::LoseFocus()
4774 : : {
4775 : : { // Parentheses, as in this handler the window can be destroyed
4776 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
4777 : : }
4778 : :
4779 [ + - ]: 7245 : NotifyEvent aNEvt( EVENT_LOSEFOCUS, this );
4780 [ + - ]: 7245 : Notify( aNEvt );
4781 : 7245 : }
4782 : :
4783 : : // -----------------------------------------------------------------------
4784 : :
4785 : 0 : void Window::RequestHelp( const HelpEvent& rHEvt )
4786 : : {
4787 : : { // Parentheses, as in this handler the window can be destroyed
4788 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
4789 : : }
4790 : :
4791 : : // if Balloon-Help is requested, show the balloon
4792 : : // with help text set
4793 [ # # ]: 0 : if ( rHEvt.GetMode() & HELPMODE_BALLOON )
4794 : : {
4795 : 0 : const XubString* pStr = &(GetHelpText());
4796 [ # # ]: 0 : if ( !pStr->Len() )
4797 : 0 : pStr = &(GetQuickHelpText());
4798 [ # # ][ # # ]: 0 : if ( !pStr->Len() && ImplGetParent() && !ImplIsOverlapWindow() )
[ # # ][ # # ]
4799 : 0 : ImplGetParent()->RequestHelp( rHEvt );
4800 : : else
4801 : 0 : Help::ShowBalloon( this, rHEvt.GetMousePosPixel(), *pStr );
4802 : : }
4803 [ # # ]: 0 : else if ( rHEvt.GetMode() & HELPMODE_QUICK )
4804 : : {
4805 : 0 : const XubString* pStr = &(GetQuickHelpText());
4806 [ # # ][ # # ]: 0 : if ( !pStr->Len() && ImplGetParent() && !ImplIsOverlapWindow() )
[ # # ][ # # ]
4807 : 0 : ImplGetParent()->RequestHelp( rHEvt );
4808 : : else
4809 : : {
4810 [ # # ]: 0 : Point aPos = GetPosPixel();
4811 [ # # ][ # # ]: 0 : if ( ImplGetParent() && !ImplIsOverlapWindow() )
[ # # ][ # # ]
[ # # ]
4812 [ # # ][ # # ]: 0 : aPos = ImplGetParent()->OutputToScreenPixel( aPos );
4813 [ # # ][ # # ]: 0 : Rectangle aRect( aPos, GetSizePixel() );
4814 [ # # ]: 0 : String aHelpText;
4815 [ # # ]: 0 : if ( pStr->Len() )
4816 [ # # ][ # # ]: 0 : aHelpText = GetHelpText();
4817 [ # # ][ # # ]: 0 : Help::ShowQuickHelp( this, aRect, *pStr, aHelpText, QUICKHELP_CTRLTEXT );
4818 : : }
4819 : : }
4820 : : else
4821 : : {
4822 [ # # ][ # # ]: 0 : String aStrHelpId( rtl::OStringToOUString( GetHelpId(), RTL_TEXTENCODING_UTF8 ) );
[ # # ]
4823 [ # # ][ # # ]: 0 : if ( aStrHelpId.Len() == 0 && ImplGetParent() )
[ # # ][ # # ]
4824 [ # # ][ # # ]: 0 : ImplGetParent()->RequestHelp( rHEvt );
4825 : : else
4826 : : {
4827 [ # # ]: 0 : Help* pHelp = Application::GetHelp();
4828 [ # # ]: 0 : if ( pHelp )
4829 : : {
4830 [ # # ]: 0 : if( aStrHelpId.Len() > 0 )
4831 [ # # ]: 0 : pHelp->Start( aStrHelpId, this );
4832 : : else
4833 [ # # ][ # # ]: 0 : pHelp->Start( rtl::OUString( OOO_HELP_INDEX ), this );
[ # # ]
4834 : : }
4835 [ # # ]: 0 : }
4836 : : }
4837 : 0 : }
4838 : :
4839 : : // -----------------------------------------------------------------------
4840 : :
4841 : 0 : void Window::Command( const CommandEvent& rCEvt )
4842 : : {
4843 : : { // Parentheses, as in this handler the window can be destroyed
4844 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
4845 : : }
4846 : :
4847 [ # # ]: 0 : ImplCallEventListeners( VCLEVENT_WINDOW_COMMAND, (void*)&rCEvt );
4848 : :
4849 [ # # ]: 0 : NotifyEvent aNEvt( EVENT_COMMAND, this, &rCEvt );
4850 [ # # ][ # # ]: 0 : if ( !Notify( aNEvt ) )
4851 : 0 : mpWindowImpl->mbCommand = sal_True;
4852 : 0 : }
4853 : :
4854 : : // -----------------------------------------------------------------------
4855 : :
4856 : 0 : void Window::Tracking( const TrackingEvent& rTEvt )
4857 : : {
4858 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
4859 : :
4860 : 0 : ImplDockingWindowWrapper *pWrapper = ImplGetDockingManager()->GetDockingWindowWrapper( this );
4861 [ # # ]: 0 : if( pWrapper )
4862 : 0 : pWrapper->Tracking( rTEvt );
4863 : 0 : }
4864 : :
4865 : : // -----------------------------------------------------------------------
4866 : :
4867 : 0 : void Window::UserEvent( sal_uLong, void* )
4868 : : {
4869 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
4870 : 0 : }
4871 : :
4872 : : // -----------------------------------------------------------------------
4873 : :
4874 : 773853 : void Window::StateChanged( StateChangedType )
4875 : : {
4876 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
4877 : 773853 : }
4878 : :
4879 : : // -----------------------------------------------------------------------
4880 : :
4881 : 2815 : void Window::DataChanged( const DataChangedEvent& )
4882 : : {
4883 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
4884 : 2815 : }
4885 : :
4886 : : // -----------------------------------------------------------------------
4887 : :
4888 : 0 : void Window::ImplNotifyKeyMouseCommandEventListeners( NotifyEvent& rNEvt )
4889 : : {
4890 [ # # ]: 0 : if( rNEvt.GetType() == EVENT_COMMAND )
4891 : : {
4892 [ # # ]: 0 : const CommandEvent* pCEvt = rNEvt.GetCommandEvent();
4893 [ # # ]: 0 : if ( pCEvt->GetCommand() != COMMAND_CONTEXTMENU )
4894 : : // non context menu events are not to be notified up the chain
4895 : : // so we return immediately
4896 : : return;
4897 : :
4898 [ # # ][ # # ]: 0 : if ( mpWindowImpl->mbCompoundControl || ( rNEvt.GetWindow() == this ) )
[ # # ]
4899 : : {
4900 [ # # ]: 0 : if ( rNEvt.GetWindow() == this )
4901 : : // not interested in: The event listeners are already called in ::Command,
4902 : : // and calling them here a second time doesn't make sense
4903 : : ;
4904 : : else
4905 : : {
4906 [ # # ]: 0 : CommandEvent aCommandEvent = ImplTranslateCommandEvent( *pCEvt, rNEvt.GetWindow(), this );
4907 [ # # ]: 0 : ImplCallEventListeners( VCLEVENT_WINDOW_COMMAND, &aCommandEvent );
4908 : : }
4909 : : }
4910 : : }
4911 : :
4912 : : // #82968# notify event listeners for mouse and key events seperately and
4913 : : // not in PreNotify ( as for focus listeners )
4914 : : // this allows for procesing those events internally first and pass it to
4915 : : // the toolkit later
4916 : :
4917 [ # # ]: 0 : ImplDelData aDelData;
4918 : 0 : ImplAddDel( &aDelData );
4919 : :
4920 [ # # ]: 0 : if( rNEvt.GetType() == EVENT_MOUSEMOVE )
4921 : : {
4922 [ # # ][ # # ]: 0 : if ( mpWindowImpl->mbCompoundControl || ( rNEvt.GetWindow() == this ) )
[ # # ]
4923 : : {
4924 [ # # ]: 0 : if ( rNEvt.GetWindow() == this )
4925 [ # # ][ # # ]: 0 : ImplCallEventListeners( VCLEVENT_WINDOW_MOUSEMOVE, (void*)rNEvt.GetMouseEvent() );
4926 : : else
4927 : : {
4928 [ # # ][ # # ]: 0 : MouseEvent aMouseEvent = ImplTranslateMouseEvent( *rNEvt.GetMouseEvent(), rNEvt.GetWindow(), this );
4929 [ # # ]: 0 : ImplCallEventListeners( VCLEVENT_WINDOW_MOUSEMOVE, &aMouseEvent );
4930 : : }
4931 : : }
4932 : : }
4933 [ # # ]: 0 : else if( rNEvt.GetType() == EVENT_MOUSEBUTTONUP )
4934 : : {
4935 [ # # ][ # # ]: 0 : if ( mpWindowImpl->mbCompoundControl || ( rNEvt.GetWindow() == this ) )
[ # # ]
4936 : : {
4937 [ # # ]: 0 : if ( rNEvt.GetWindow() == this )
4938 [ # # ][ # # ]: 0 : ImplCallEventListeners( VCLEVENT_WINDOW_MOUSEBUTTONUP, (void*)rNEvt.GetMouseEvent() );
4939 : : else
4940 : : {
4941 [ # # ][ # # ]: 0 : MouseEvent aMouseEvent = ImplTranslateMouseEvent( *rNEvt.GetMouseEvent(), rNEvt.GetWindow(), this );
4942 [ # # ]: 0 : ImplCallEventListeners( VCLEVENT_WINDOW_MOUSEBUTTONUP, &aMouseEvent );
4943 : : }
4944 : : }
4945 : : }
4946 [ # # ]: 0 : else if( rNEvt.GetType() == EVENT_MOUSEBUTTONDOWN )
4947 : : {
4948 [ # # ][ # # ]: 0 : if ( mpWindowImpl->mbCompoundControl || ( rNEvt.GetWindow() == this ) )
[ # # ]
4949 : : {
4950 [ # # ]: 0 : if ( rNEvt.GetWindow() == this )
4951 [ # # ][ # # ]: 0 : ImplCallEventListeners( VCLEVENT_WINDOW_MOUSEBUTTONDOWN, (void*)rNEvt.GetMouseEvent() );
4952 : : else
4953 : : {
4954 [ # # ][ # # ]: 0 : MouseEvent aMouseEvent = ImplTranslateMouseEvent( *rNEvt.GetMouseEvent(), rNEvt.GetWindow(), this );
4955 [ # # ]: 0 : ImplCallEventListeners( VCLEVENT_WINDOW_MOUSEBUTTONDOWN, &aMouseEvent );
4956 : : }
4957 : : }
4958 : : }
4959 [ # # ]: 0 : else if( rNEvt.GetType() == EVENT_KEYINPUT )
4960 : : {
4961 [ # # ][ # # ]: 0 : if ( mpWindowImpl->mbCompoundControl || ( rNEvt.GetWindow() == this ) )
[ # # ]
4962 [ # # ][ # # ]: 0 : ImplCallEventListeners( VCLEVENT_WINDOW_KEYINPUT, (void*)rNEvt.GetKeyEvent() );
4963 : : }
4964 [ # # ]: 0 : else if( rNEvt.GetType() == EVENT_KEYUP )
4965 : : {
4966 [ # # ][ # # ]: 0 : if ( mpWindowImpl->mbCompoundControl || ( rNEvt.GetWindow() == this ) )
[ # # ]
4967 [ # # ][ # # ]: 0 : ImplCallEventListeners( VCLEVENT_WINDOW_KEYUP, (void*)rNEvt.GetKeyEvent() );
4968 : : }
4969 : :
4970 [ # # ]: 0 : if ( aDelData.IsDead() )
4971 : : return;
4972 : 0 : ImplRemoveDel( &aDelData );
4973 : :
4974 : : // #106721# check if we're part of a compound control and notify
4975 [ # # ]: 0 : Window *pParent = ImplGetParent();
4976 [ # # ]: 0 : while( pParent )
4977 : : {
4978 [ # # ][ # # ]: 0 : if( pParent->IsCompoundControl() )
4979 : : {
4980 [ # # ]: 0 : pParent->ImplNotifyKeyMouseCommandEventListeners( rNEvt );
4981 : 0 : break;
4982 : : }
4983 [ # # ]: 0 : pParent = pParent->ImplGetParent();
4984 [ # # ][ # # ]: 0 : }
4985 : : }
4986 : :
4987 : : // -----------------------------------------------------------------------
4988 : :
4989 : 64913 : long Window::PreNotify( NotifyEvent& rNEvt )
4990 : : {
4991 : : { // Parentheses, as in this handler the window can be destroyed
4992 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
4993 : : }
4994 : :
4995 : 64913 : long bDone = sal_False;
4996 [ + + ][ + + ]: 64913 : if ( mpWindowImpl->mpParent && !ImplIsOverlapWindow() )
[ + + ]
4997 : 48936 : bDone = mpWindowImpl->mpParent->PreNotify( rNEvt );
4998 : :
4999 [ + - ]: 64913 : if ( !bDone )
5000 : : {
5001 [ + + ]: 64913 : if( rNEvt.GetType() == EVENT_GETFOCUS )
5002 : : {
5003 : 34053 : sal_Bool bCompoundFocusChanged = sal_False;
5004 [ + + ][ + + ]: 34053 : if ( mpWindowImpl->mbCompoundControl && !mpWindowImpl->mbCompoundControlHasFocus && HasChildPathFocus() )
[ + - ][ + + ]
5005 : : {
5006 : 4 : mpWindowImpl->mbCompoundControlHasFocus = sal_True;
5007 : 4 : bCompoundFocusChanged = sal_True;
5008 : : }
5009 : :
5010 [ + + ][ + + ]: 34053 : if ( bCompoundFocusChanged || ( rNEvt.GetWindow() == this ) )
[ + + ]
5011 : 8700 : ImplCallEventListeners( VCLEVENT_WINDOW_GETFOCUS );
5012 : : }
5013 [ + - ]: 30860 : else if( rNEvt.GetType() == EVENT_LOSEFOCUS )
5014 : : {
5015 : 30860 : sal_Bool bCompoundFocusChanged = sal_False;
5016 [ + + ][ + - ]: 30860 : if ( mpWindowImpl->mbCompoundControl && mpWindowImpl->mbCompoundControlHasFocus && !HasChildPathFocus() )
[ + + ][ + + ]
5017 : : {
5018 : 4 : mpWindowImpl->mbCompoundControlHasFocus = sal_False ;
5019 : 4 : bCompoundFocusChanged = sal_True;
5020 : : }
5021 : :
5022 [ + + ][ + + ]: 30860 : if ( bCompoundFocusChanged || ( rNEvt.GetWindow() == this ) )
[ + + ]
5023 : 7281 : ImplCallEventListeners( VCLEVENT_WINDOW_LOSEFOCUS );
5024 : : }
5025 : :
5026 : : // #82968# mouse and key events will be notified after processing ( in ImplNotifyKeyMouseCommandEventListeners() )!
5027 : : // see also ImplHandleMouseEvent(), ImplHandleKey()
5028 : :
5029 : : }
5030 : :
5031 : 64913 : return bDone;
5032 : : }
5033 : :
5034 : : // -----------------------------------------------------------------------
5035 : :
5036 : 434531 : long Window::Notify( NotifyEvent& rNEvt )
5037 : : {
5038 : : { // Parentheses, as in this handler the window can be destroyed
5039 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
5040 : : }
5041 : :
5042 : 434531 : long nRet = sal_False;
5043 : :
5044 : : // check for docking window
5045 : : // but do nothing if window is docked and locked
5046 : 434531 : ImplDockingWindowWrapper *pWrapper = ImplGetDockingManager()->GetDockingWindowWrapper( this );
5047 [ + - ][ + - ]: 434531 : if( pWrapper && !( !pWrapper->IsFloatingMode() && pWrapper->IsLocked() ) )
[ + + ][ + + ]
5048 : : {
5049 [ - + ]: 14280 : if ( rNEvt.GetType() == EVENT_MOUSEBUTTONDOWN )
5050 : : {
5051 : 0 : const MouseEvent* pMEvt = rNEvt.GetMouseEvent();
5052 [ # # ]: 0 : sal_Bool bHit = pWrapper->GetDragArea().IsInside( pMEvt->GetPosPixel() );
5053 [ # # ]: 0 : if ( pMEvt->IsLeft() )
5054 : : {
5055 [ # # ][ # # ]: 0 : if ( pMEvt->IsMod1() && (pMEvt->GetClicks() == 2) )
[ # # ]
5056 : : {
5057 : : // ctrl double click toggles floating mode
5058 : 0 : pWrapper->SetFloatingMode( !pWrapper->IsFloatingMode() );
5059 : 0 : return sal_True;
5060 : : }
5061 [ # # ][ # # ]: 0 : else if ( pMEvt->GetClicks() == 1 && bHit)
[ # # ]
5062 : : {
5063 : : // allow start docking during mouse move
5064 : 0 : pWrapper->ImplEnableStartDocking();
5065 : 0 : return sal_True;
5066 : : }
5067 : : }
5068 : : }
5069 [ - + ]: 14280 : else if ( rNEvt.GetType() == EVENT_MOUSEMOVE )
5070 : : {
5071 : 0 : const MouseEvent* pMEvt = rNEvt.GetMouseEvent();
5072 [ # # ]: 0 : sal_Bool bHit = pWrapper->GetDragArea().IsInside( pMEvt->GetPosPixel() );
5073 [ # # ]: 0 : if ( pMEvt->IsLeft() )
5074 : : {
5075 : : // check if a single click initiated this sequence ( ImplStartDockingEnabled() )
5076 : : // check if window is docked and
5077 [ # # ]: 0 : if( pWrapper->ImplStartDockingEnabled() && !pWrapper->IsFloatingMode() &&
[ # # # # ]
[ # # ][ # # ]
5078 : 0 : !pWrapper->IsDocking() && bHit )
5079 : : {
5080 : 0 : Point aPos = pMEvt->GetPosPixel();
5081 : 0 : Window* pWindow = rNEvt.GetWindow();
5082 [ # # ]: 0 : if ( pWindow != this )
5083 : : {
5084 [ # # ]: 0 : aPos = pWindow->OutputToScreenPixel( aPos );
5085 [ # # ]: 0 : aPos = ScreenToOutputPixel( aPos );
5086 : : }
5087 [ # # ]: 0 : pWrapper->ImplStartDocking( aPos );
5088 : : }
5089 : 0 : return sal_True;
5090 : : }
5091 : : }
5092 [ - + ]: 14280 : else if( rNEvt.GetType() == EVENT_KEYINPUT )
5093 : : {
5094 : 0 : const KeyCode& rKey = rNEvt.GetKeyEvent()->GetKeyCode();
5095 [ # # # # : 0 : if( rKey.GetCode() == KEY_F10 && rKey.GetModifier() &&
# # ][ # # ]
[ # # ]
5096 : 0 : rKey.IsShift() && rKey.IsMod1() )
5097 : : {
5098 : 0 : pWrapper->SetFloatingMode( !pWrapper->IsFloatingMode() );
5099 : : /* At this point the floating toolbar frame does not have the
5100 : : * input focus since these frames don't get the focus per default
5101 : : * To enable keyboard handling of this toolbar set the input focus
5102 : : * to the frame. This needs to be done with ToTop since GrabFocus
5103 : : * would not notice any change since "this" already has the focus.
5104 : : */
5105 [ # # ]: 0 : if( pWrapper->IsFloatingMode() )
5106 : 0 : ToTop( TOTOP_GRABFOCUSONLY );
5107 : 0 : return sal_True;
5108 : : }
5109 : : }
5110 : : }
5111 : :
5112 : : // manage the dialogs
5113 [ + + ]: 434531 : if ( (GetStyle() & (WB_DIALOGCONTROL | WB_NODIALOGCONTROL)) == WB_DIALOGCONTROL )
5114 : : {
5115 : : // if the parent also has dialog control activated, the parent takes over control
5116 [ + - ][ - + ]: 84439 : if ( (rNEvt.GetType() == EVENT_KEYINPUT) || (rNEvt.GetType() == EVENT_KEYUP) )
[ - + ]
5117 : : {
5118 [ # # # # ]: 0 : if ( ImplIsOverlapWindow() ||
[ # # ]
5119 : 0 : ((ImplGetParent()->GetStyle() & (WB_DIALOGCONTROL | WB_NODIALOGCONTROL)) != WB_DIALOGCONTROL) )
5120 : : {
5121 : 0 : nRet = ImplDlgCtrl( *rNEvt.GetKeyEvent(), rNEvt.GetType() == EVENT_KEYINPUT );
5122 : : }
5123 : : }
5124 [ + + ][ + + ]: 84439 : else if ( (rNEvt.GetType() == EVENT_GETFOCUS) || (rNEvt.GetType() == EVENT_LOSEFOCUS) )
[ + + ]
5125 : : {
5126 : 4008 : ImplDlgCtrlFocusChanged( rNEvt.GetWindow(), rNEvt.GetType() == EVENT_GETFOCUS );
5127 [ + + + + ]: 5516 : if ( (rNEvt.GetWindow() == this) && (rNEvt.GetType() == EVENT_GETFOCUS) &&
[ + + ][ + + ]
[ + + ]
5128 : 1508 : !(GetStyle() & WB_TABSTOP) && !(mpWindowImpl->mnDlgCtrlFlags & WINDOW_DLGCTRL_WANTFOCUS) )
5129 : : {
5130 : 144 : sal_uInt16 n = 0;
5131 : 144 : Window* pFirstChild = ImplGetDlgWindow( n, DLGWINDOW_FIRST );
5132 [ + + ]: 144 : if ( pFirstChild )
5133 : 34 : pFirstChild->ImplControlFocus();
5134 : : }
5135 : : }
5136 : : }
5137 : :
5138 [ + - ]: 434531 : if ( !nRet )
5139 : : {
5140 [ + + ][ + + ]: 434531 : if ( mpWindowImpl->mpParent && !ImplIsOverlapWindow() )
[ + + ]
5141 : 341931 : nRet = mpWindowImpl->mpParent->Notify( rNEvt );
5142 : : }
5143 : :
5144 : 434531 : return nRet;
5145 : : }
5146 : :
5147 : : // -----------------------------------------------------------------------
5148 : :
5149 : 1607218 : void Window::ImplCallEventListeners( sal_uLong nEvent, void* pData )
5150 : : {
5151 : : // The implementation was moved to CallEventListeners(),
5152 : : // because derived classes in svtools must be able to
5153 : : // call the event listeners and ImplCallEventListeners()
5154 : : // is not exported.
5155 : : // TODO: replace ImplCallEventListeners() by CallEventListeners() in vcl
5156 : :
5157 : 1607218 : CallEventListeners( nEvent, pData );
5158 : 1607218 : }
5159 : :
5160 : : // -----------------------------------------------------------------------
5161 : :
5162 : 1776587 : void Window::CallEventListeners( sal_uLong nEvent, void* pData )
5163 : : {
5164 : 1776587 : VclWindowEvent aEvent( this, nEvent, pData );
5165 : :
5166 [ + - ]: 1776587 : ImplDelData aDelData;
5167 : 1776587 : ImplAddDel( &aDelData );
5168 : :
5169 [ + - ][ + - ]: 1776587 : ImplGetSVData()->mpApp->ImplCallEventListeners( &aEvent );
5170 : :
5171 [ - + ]: 1776587 : if ( aDelData.IsDead() )
5172 : : return;
5173 : :
5174 [ + - ]: 1776587 : mpWindowImpl->maEventListeners.Call( &aEvent );
5175 : :
5176 [ - + ]: 1776587 : if ( aDelData.IsDead() )
5177 : : return;
5178 : :
5179 : 1776587 : ImplRemoveDel( &aDelData );
5180 : :
5181 : 1776587 : Window* pWindow = this;
5182 [ + + ]: 9129216 : while ( pWindow )
5183 : : {
5184 : 7352629 : pWindow->ImplAddDel( &aDelData );
5185 : :
5186 [ + - ]: 7352629 : pWindow->mpWindowImpl->maChildEventListeners.Call( &aEvent );
5187 : :
5188 [ - + ]: 7352629 : if ( aDelData.IsDead() )
5189 : : return;
5190 : :
5191 : 7352629 : pWindow->ImplRemoveDel( &aDelData );
5192 : :
5193 [ + - ]: 7352629 : pWindow = pWindow->GetParent();
5194 [ + - ][ - + ]: 1776587 : }
[ + - ]
5195 : : }
5196 : :
5197 : 0 : void Window::FireVclEvent( VclSimpleEvent* pEvent )
5198 : : {
5199 : 0 : ImplGetSVData()->mpApp->ImplCallEventListeners(pEvent);
5200 : 0 : }
5201 : :
5202 : : // -----------------------------------------------------------------------
5203 : :
5204 : 46783 : void Window::AddEventListener( const Link& rEventListener )
5205 : : {
5206 : 46783 : mpWindowImpl->maEventListeners.addListener( rEventListener );
5207 : 46783 : }
5208 : :
5209 : : // -----------------------------------------------------------------------
5210 : :
5211 : 65945 : void Window::RemoveEventListener( const Link& rEventListener )
5212 : : {
5213 : 65945 : mpWindowImpl->maEventListeners.removeListener( rEventListener );
5214 : 65945 : }
5215 : :
5216 : : // -----------------------------------------------------------------------
5217 : :
5218 : 3579 : void Window::AddChildEventListener( const Link& rEventListener )
5219 : : {
5220 : 3579 : mpWindowImpl->maChildEventListeners.addListener( rEventListener );
5221 : 3579 : }
5222 : :
5223 : : // -----------------------------------------------------------------------
5224 : :
5225 : 3417 : void Window::RemoveChildEventListener( const Link& rEventListener )
5226 : : {
5227 : 3417 : mpWindowImpl->maChildEventListeners.removeListener( rEventListener );
5228 : 3417 : }
5229 : :
5230 : : // -----------------------------------------------------------------------
5231 : :
5232 : 26 : sal_uLong Window::PostUserEvent( const Link& rLink, void* pCaller )
5233 : : {
5234 : : sal_uLong nEventId;
5235 [ + - ]: 26 : PostUserEvent( nEventId, rLink, pCaller );
5236 : 26 : return nEventId;
5237 : : }
5238 : :
5239 : : // -----------------------------------------------------------------------
5240 : :
5241 : 0 : sal_Bool Window::PostUserEvent( sal_uLong& rEventId, sal_uLong nEvent, void* pEventData )
5242 : : {
5243 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
5244 : :
5245 [ # # ]: 0 : ImplSVEvent* pSVEvent = new ImplSVEvent;
5246 : 0 : pSVEvent->mnEvent = nEvent;
5247 : 0 : pSVEvent->mpData = pEventData;
5248 : 0 : pSVEvent->mpLink = NULL;
5249 : 0 : pSVEvent->mpWindow = this;
5250 : 0 : pSVEvent->mbCall = sal_True;
5251 : 0 : ImplAddDel( &(pSVEvent->maDelData) );
5252 : 0 : rEventId = (sal_uLong)pSVEvent;
5253 [ # # ]: 0 : if ( mpWindowImpl->mpFrame->PostEvent( pSVEvent ) )
5254 : 0 : return sal_True;
5255 : : else
5256 : : {
5257 : 0 : rEventId = 0;
5258 : 0 : ImplRemoveDel( &(pSVEvent->maDelData) );
5259 [ # # ]: 0 : delete pSVEvent;
5260 : 0 : return sal_False;
5261 : : }
5262 : : }
5263 : :
5264 : : // -----------------------------------------------------------------------
5265 : :
5266 : 26 : sal_Bool Window::PostUserEvent( sal_uLong& rEventId, const Link& rLink, void* pCaller )
5267 : : {
5268 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
5269 : :
5270 [ + - ]: 26 : ImplSVEvent* pSVEvent = new ImplSVEvent;
5271 : 26 : pSVEvent->mnEvent = 0;
5272 : 26 : pSVEvent->mpData = pCaller;
5273 : 26 : pSVEvent->mpLink = new Link( rLink );
5274 : 26 : pSVEvent->mpWindow = this;
5275 : 26 : pSVEvent->mbCall = sal_True;
5276 : 26 : ImplAddDel( &(pSVEvent->maDelData) );
5277 : 26 : rEventId = (sal_uLong)pSVEvent;
5278 [ + - ]: 26 : if ( mpWindowImpl->mpFrame->PostEvent( pSVEvent ) )
5279 : 26 : return sal_True;
5280 : : else
5281 : : {
5282 : 0 : rEventId = 0;
5283 : 0 : ImplRemoveDel( &(pSVEvent->maDelData) );
5284 [ # # ]: 0 : delete pSVEvent;
5285 : 26 : return sal_False;
5286 : : }
5287 : : }
5288 : :
5289 : : // -----------------------------------------------------------------------
5290 : :
5291 : 0 : void Window::RemoveUserEvent( sal_uLong nUserEvent )
5292 : : {
5293 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
5294 : :
5295 : 0 : ImplSVEvent* pSVEvent = (ImplSVEvent*)nUserEvent;
5296 : :
5297 : : DBG_ASSERT( pSVEvent->mpWindow == this,
5298 : : "Window::RemoveUserEvent(): Event doesn't send to this window or is already removed" );
5299 : : DBG_ASSERT( pSVEvent->mbCall,
5300 : : "Window::RemoveUserEvent(): Event is already removed" );
5301 : :
5302 [ # # ]: 0 : if ( pSVEvent->mpWindow )
5303 : : {
5304 : 0 : pSVEvent->mpWindow->ImplRemoveDel( &(pSVEvent->maDelData) );
5305 : 0 : pSVEvent->mpWindow = NULL;
5306 : : }
5307 : :
5308 : 0 : pSVEvent->mbCall = sal_False;
5309 : 0 : }
5310 : :
5311 : : // -----------------------------------------------------------------------
5312 : :
5313 : 0 : sal_Bool Window::IsLocked( sal_Bool bChildren ) const
5314 : : {
5315 [ # # ]: 0 : if ( mpWindowImpl->mnLockCount != 0 )
5316 : 0 : return sal_True;
5317 : :
5318 [ # # ][ # # ]: 0 : if ( bChildren || mpWindowImpl->mbChildNotify )
5319 : : {
5320 : 0 : Window* pChild = mpWindowImpl->mpFirstChild;
5321 [ # # ]: 0 : while ( pChild )
5322 : : {
5323 [ # # ]: 0 : if ( pChild->IsLocked( sal_True ) )
5324 : 0 : return sal_True;
5325 : 0 : pChild = pChild->mpWindowImpl->mpNext;
5326 : : }
5327 : : }
5328 : :
5329 : 0 : return sal_False;
5330 : : }
5331 : :
5332 : : // -----------------------------------------------------------------------
5333 : :
5334 : 77885 : void Window::SetStyle( WinBits nStyle )
5335 : : {
5336 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
5337 : :
5338 [ + + ]: 77885 : if ( mpWindowImpl->mnStyle != nStyle )
5339 : : {
5340 : 27996 : mpWindowImpl->mnPrevStyle = mpWindowImpl->mnStyle;
5341 : 27996 : mpWindowImpl->mnStyle = nStyle;
5342 : 27996 : StateChanged( STATE_CHANGE_STYLE );
5343 : : }
5344 : 77885 : }
5345 : :
5346 : : // -----------------------------------------------------------------------
5347 : :
5348 : 40873 : void Window::SetExtendedStyle( WinBits nExtendedStyle )
5349 : : {
5350 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
5351 : :
5352 [ + + ]: 40873 : if ( mpWindowImpl->mnExtendedStyle != nExtendedStyle )
5353 : : {
5354 : 3548 : Window* pWindow = ImplGetBorderWindow();
5355 [ - + ]: 3548 : if( ! pWindow )
5356 : 0 : pWindow = this;
5357 [ + - ]: 3548 : if( pWindow->mpWindowImpl->mbFrame )
5358 : : {
5359 : 3548 : SalExtStyle nExt = 0;
5360 [ + + ]: 3548 : if( (nExtendedStyle & WB_EXT_DOCUMENT) )
5361 : 1743 : nExt |= SAL_FRAME_EXT_STYLE_DOCUMENT;
5362 [ + + ]: 3548 : if( (nExtendedStyle & WB_EXT_DOCMODIFIED) )
5363 : 961 : nExt |= SAL_FRAME_EXT_STYLE_DOCMODIFIED;
5364 : :
5365 : 3548 : pWindow->ImplGetFrame()->SetExtendedFrameStyle( nExt );
5366 : : }
5367 : 3548 : mpWindowImpl->mnPrevExtendedStyle = mpWindowImpl->mnExtendedStyle;
5368 : 3548 : mpWindowImpl->mnExtendedStyle = nExtendedStyle;
5369 : 3548 : StateChanged( STATE_CHANGE_EXTENDEDSTYLE );
5370 : : }
5371 : 40873 : }
5372 : :
5373 : : // -----------------------------------------------------------------------
5374 : :
5375 : 2064 : SystemWindow* Window::GetSystemWindow() const
5376 : : {
5377 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
5378 : :
5379 : 2064 : const Window* pWin = this;
5380 [ + - ][ + + ]: 5968 : while ( pWin && !pWin->IsSystemWindow() )
[ + + ]
5381 : 3904 : pWin = pWin->GetParent();
5382 : 2064 : return (SystemWindow*)pWin;
5383 : : }
5384 : :
5385 : : // -----------------------------------------------------------------------
5386 : :
5387 : 2392 : void Window::SetBorderStyle( sal_uInt16 nBorderStyle )
5388 : : {
5389 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
5390 : :
5391 [ + + ]: 2392 : if ( mpWindowImpl->mpBorderWindow )
5392 : : {
5393 [ - + ][ # # ]: 2304 : if( nBorderStyle == WINDOW_BORDER_REMOVEBORDER &&
[ # # ]
5394 : 0 : ! mpWindowImpl->mpBorderWindow->mpWindowImpl->mbFrame &&
5395 : : mpWindowImpl->mpBorderWindow->mpWindowImpl->mpParent
5396 : : )
5397 : : {
5398 : : // this is a little awkward: some controls (e.g. svtools ProgressBar)
5399 : : // cannot avoid getting constructed with WB_BORDER but want to disable
5400 : : // borders in case of NWF drawing. So they need a method to remove their border window
5401 : 0 : Window* pBorderWin = mpWindowImpl->mpBorderWindow;
5402 : : // remove us as border window's client
5403 : 0 : pBorderWin->mpWindowImpl->mpClientWindow = NULL;
5404 : 0 : mpWindowImpl->mpBorderWindow = NULL;
5405 : 0 : mpWindowImpl->mpRealParent = pBorderWin->mpWindowImpl->mpParent;
5406 : : // reparent us above the border window
5407 [ # # ]: 0 : SetParent( pBorderWin->mpWindowImpl->mpParent );
5408 : : // set us to the position and size of our previous border
5409 [ # # ]: 0 : Point aBorderPos( pBorderWin->GetPosPixel() );
5410 [ # # ]: 0 : Size aBorderSize( pBorderWin->GetSizePixel() );
5411 [ # # ]: 0 : SetPosSizePixel( aBorderPos.X(), aBorderPos.Y(), aBorderSize.Width(), aBorderSize.Height() );
5412 : : // release border window
5413 [ # # ][ # # ]: 0 : delete pBorderWin;
5414 : :
5415 : : // set new style bits
5416 [ # # ][ # # ]: 0 : SetStyle( GetStyle() & (~WB_BORDER) );
5417 : : }
5418 : : else
5419 : : {
5420 [ + - ]: 2304 : if ( mpWindowImpl->mpBorderWindow->GetType() == WINDOW_BORDERWINDOW )
5421 : 2304 : ((ImplBorderWindow*)mpWindowImpl->mpBorderWindow)->SetBorderStyle( nBorderStyle );
5422 : : else
5423 : 2304 : mpWindowImpl->mpBorderWindow->SetBorderStyle( nBorderStyle );
5424 : : }
5425 : : }
5426 : 2392 : }
5427 : :
5428 : : // -----------------------------------------------------------------------
5429 : :
5430 : 16 : sal_uInt16 Window::GetBorderStyle() const
5431 : : {
5432 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
5433 : :
5434 [ + - ]: 16 : if ( mpWindowImpl->mpBorderWindow )
5435 : : {
5436 [ + - ]: 16 : if ( mpWindowImpl->mpBorderWindow->GetType() == WINDOW_BORDERWINDOW )
5437 : 16 : return ((ImplBorderWindow*)mpWindowImpl->mpBorderWindow)->GetBorderStyle();
5438 : : else
5439 : 0 : return mpWindowImpl->mpBorderWindow->GetBorderStyle();
5440 : : }
5441 : :
5442 : 16 : return 0;
5443 : : }
5444 : :
5445 : : // -----------------------------------------------------------------------
5446 : :
5447 : 0 : long Window::CalcTitleWidth() const
5448 : : {
5449 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
5450 : :
5451 [ # # ]: 0 : if ( mpWindowImpl->mpBorderWindow )
5452 : : {
5453 [ # # ]: 0 : if ( mpWindowImpl->mpBorderWindow->GetType() == WINDOW_BORDERWINDOW )
5454 : 0 : return ((ImplBorderWindow*)mpWindowImpl->mpBorderWindow)->CalcTitleWidth();
5455 : : else
5456 : 0 : return mpWindowImpl->mpBorderWindow->CalcTitleWidth();
5457 : : }
5458 [ # # ][ # # ]: 0 : else if ( mpWindowImpl->mbFrame && (mpWindowImpl->mnStyle & WB_MOVEABLE) )
5459 : : {
5460 : : // we guess the width for frame windows as we do not know the
5461 : : // border of external dialogs
5462 : 0 : const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
5463 [ # # ]: 0 : Font aFont = GetFont();
5464 [ # # ]: 0 : ((Window*)this)->SetPointFont( rStyleSettings.GetTitleFont() );
5465 [ # # ][ # # ]: 0 : long nTitleWidth = GetTextWidth( GetText() );
[ # # ]
5466 [ # # ]: 0 : ((Window*)this)->SetFont( aFont );
5467 : 0 : nTitleWidth += rStyleSettings.GetTitleHeight() * 3;
5468 : 0 : nTitleWidth += rStyleSettings.GetBorderSize() * 2;
5469 : 0 : nTitleWidth += 10;
5470 [ # # ]: 0 : return nTitleWidth;
5471 : : }
5472 : :
5473 : 0 : return 0;
5474 : : }
5475 : :
5476 : : // -----------------------------------------------------------------------
5477 : :
5478 : 0 : void Window::EnableClipSiblings( sal_Bool bClipSiblings )
5479 : : {
5480 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
5481 : :
5482 [ # # ]: 0 : if ( mpWindowImpl->mpBorderWindow )
5483 : 0 : mpWindowImpl->mpBorderWindow->EnableClipSiblings( bClipSiblings );
5484 : :
5485 : 0 : mpWindowImpl->mbClipSiblings = bClipSiblings;
5486 : 0 : }
5487 : :
5488 : : // -----------------------------------------------------------------------
5489 : :
5490 : 322 : void Window::SetMouseTransparent( sal_Bool bTransparent )
5491 : : {
5492 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
5493 : :
5494 [ + + ]: 322 : if ( mpWindowImpl->mpBorderWindow )
5495 : 42 : mpWindowImpl->mpBorderWindow->SetMouseTransparent( bTransparent );
5496 : :
5497 [ - + ]: 322 : if( mpWindowImpl->mpSysObj )
5498 : 0 : mpWindowImpl->mpSysObj->SetMouseTransparent( bTransparent );
5499 : :
5500 : 322 : mpWindowImpl->mbMouseTransparent = bTransparent;
5501 : 322 : }
5502 : :
5503 : : // -----------------------------------------------------------------------
5504 : :
5505 : 31484 : void Window::SetPaintTransparent( sal_Bool bTransparent )
5506 : : {
5507 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
5508 : :
5509 : : // transparency is not useful for frames as the background would have to be provided by a different frame
5510 [ + + ][ - + ]: 31484 : if( bTransparent && mpWindowImpl->mbFrame )
5511 : 31484 : return;
5512 : :
5513 [ + + ]: 31484 : if ( mpWindowImpl->mpBorderWindow )
5514 : 184 : mpWindowImpl->mpBorderWindow->SetPaintTransparent( bTransparent );
5515 : :
5516 : 31484 : mpWindowImpl->mbPaintTransparent = bTransparent;
5517 : : }
5518 : :
5519 : : // -----------------------------------------------------------------------
5520 : :
5521 : 6757 : void Window::SetInputContext( const InputContext& rInputContext )
5522 : : {
5523 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
5524 : :
5525 : 6757 : mpWindowImpl->maInputContext = rInputContext;
5526 [ + + ][ + + ]: 6757 : if ( !mpWindowImpl->mbInFocusHdl && HasFocus() )
[ + + ]
5527 : 2103 : ImplNewInputContext();
5528 : 6757 : }
5529 : :
5530 : : // -----------------------------------------------------------------------
5531 : :
5532 : 0 : void Window::EndExtTextInput( sal_uInt16 nFlags )
5533 : : {
5534 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
5535 : :
5536 [ # # ]: 0 : if ( mpWindowImpl->mbExtTextInput )
5537 : 0 : ImplGetFrame()->EndExtTextInput( nFlags );
5538 : 0 : }
5539 : :
5540 : : // -----------------------------------------------------------------------
5541 : :
5542 : 0 : void Window::SetCursorRect( const Rectangle* pRect, long nExtTextInputWidth )
5543 : : {
5544 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
5545 : :
5546 : 0 : ImplWinData* pWinData = ImplGetWinData();
5547 [ # # ]: 0 : if ( pWinData->mpCursorRect )
5548 : : {
5549 [ # # ]: 0 : if ( pRect )
5550 : 0 : *pWinData->mpCursorRect = *pRect;
5551 : : else
5552 : : {
5553 : 0 : delete pWinData->mpCursorRect;
5554 : 0 : pWinData->mpCursorRect = NULL;
5555 : : }
5556 : : }
5557 : : else
5558 : : {
5559 [ # # ]: 0 : if ( pRect )
5560 : 0 : pWinData->mpCursorRect = new Rectangle( *pRect );
5561 : : }
5562 : :
5563 : 0 : pWinData->mnCursorExtWidth = nExtTextInputWidth;
5564 : :
5565 : 0 : }
5566 : :
5567 : : // -----------------------------------------------------------------------
5568 : :
5569 : 0 : const Rectangle* Window::GetCursorRect() const
5570 : : {
5571 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
5572 : :
5573 : 0 : ImplWinData* pWinData = ImplGetWinData();
5574 : 0 : return pWinData->mpCursorRect;
5575 : : }
5576 : :
5577 : : // -----------------------------------------------------------------------
5578 : :
5579 : 0 : long Window::GetCursorExtTextInputWidth() const
5580 : : {
5581 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
5582 : :
5583 : 0 : ImplWinData* pWinData = ImplGetWinData();
5584 : 0 : return pWinData->mnCursorExtWidth;
5585 : : }
5586 : :
5587 : : // -----------------------------------------------------------------------
5588 : 36468 : void Window::SetSettings( const AllSettings& rSettings )
5589 : : {
5590 : 36468 : SetSettings( rSettings, sal_False );
5591 : 36468 : }
5592 : :
5593 : 41538 : void Window::SetSettings( const AllSettings& rSettings, sal_Bool bChild )
5594 : : {
5595 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
5596 : :
5597 [ + + ]: 41538 : if ( mpWindowImpl->mpBorderWindow )
5598 : : {
5599 [ + - ]: 1267 : mpWindowImpl->mpBorderWindow->SetSettings( rSettings, sal_False );
5600 [ + - ][ + - ]: 1267 : if ( (mpWindowImpl->mpBorderWindow->GetType() == WINDOW_BORDERWINDOW) &&
[ - + ][ - + ]
5601 : : ((ImplBorderWindow*)mpWindowImpl->mpBorderWindow)->mpMenuBarWindow )
5602 [ # # ]: 0 : ((ImplBorderWindow*)mpWindowImpl->mpBorderWindow)->mpMenuBarWindow->SetSettings( rSettings, sal_True );
5603 : : }
5604 : :
5605 [ + - ]: 41538 : AllSettings aOldSettings = maSettings;
5606 [ + - ]: 41538 : OutputDevice::SetSettings( rSettings );
5607 [ + - ]: 41538 : sal_uLong nChangeFlags = aOldSettings.GetChangeFlags( rSettings );
5608 : :
5609 : : // recalculate AppFont-resolution and DPI-resolution
5610 [ + - ]: 41538 : ImplInitResolutionSettings();
5611 : :
5612 [ + + ]: 41538 : if ( nChangeFlags )
5613 : : {
5614 [ + - ]: 2662 : DataChangedEvent aDCEvt( DATACHANGED_SETTINGS, &aOldSettings, nChangeFlags );
5615 [ + - ]: 2662 : DataChanged( aDCEvt );
5616 : : }
5617 : :
5618 [ + + ][ - + ]: 41538 : if ( bChild || mpWindowImpl->mbChildNotify )
5619 : : {
5620 : 3803 : Window* pChild = mpWindowImpl->mpFirstChild;
5621 [ + + ]: 6283 : while ( pChild )
5622 : : {
5623 [ + - ]: 2480 : pChild->SetSettings( rSettings, bChild );
5624 : 2480 : pChild = pChild->mpWindowImpl->mpNext;
5625 : : }
5626 [ + - ]: 41538 : }
5627 : 41538 : }
5628 : :
5629 : : // -----------------------------------------------------------------------
5630 : :
5631 : 884 : void Window::UpdateSettings( const AllSettings& rSettings, sal_Bool bChild )
5632 : : {
5633 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
5634 : :
5635 [ + + ]: 884 : if ( mpWindowImpl->mpBorderWindow )
5636 : : {
5637 [ + - ]: 340 : mpWindowImpl->mpBorderWindow->UpdateSettings( rSettings, sal_False );
5638 [ + - ][ + - ]: 340 : if ( (mpWindowImpl->mpBorderWindow->GetType() == WINDOW_BORDERWINDOW) &&
[ + + ][ + + ]
5639 : : ((ImplBorderWindow*)mpWindowImpl->mpBorderWindow)->mpMenuBarWindow )
5640 [ + - ]: 6 : ((ImplBorderWindow*)mpWindowImpl->mpBorderWindow)->mpMenuBarWindow->UpdateSettings( rSettings, sal_True );
5641 : : }
5642 : :
5643 [ + - ]: 884 : AllSettings aOldSettings = maSettings;
5644 [ + - ]: 884 : sal_uLong nChangeFlags = maSettings.Update( maSettings.GetWindowUpdate(), rSettings );
5645 : 884 : nChangeFlags |= SETTINGS_IN_UPDATE_SETTINGS; // Set this flag so the receiver of the data changed
5646 : : // event can distinguish between the changing of global
5647 : : // setting and a local change ( with SetSettings )
5648 : :
5649 : : // recalculate AppFont-resolution and DPI-resolution
5650 [ + - ]: 884 : ImplInitResolutionSettings();
5651 : :
5652 : : /* #i73785#
5653 : : * do not overwrite a WheelBehavior with false
5654 : : * this looks kind of a hack, but WheelBehavior
5655 : : * is always a local change, not a system property,
5656 : : * so we can spare all our users the hassle of reacting on
5657 : : * this in their respective DataChanged.
5658 : : */
5659 [ + - ]: 884 : MouseSettings aSet( maSettings.GetMouseSettings() );
5660 [ + - ]: 884 : aSet.SetWheelBehavior( aOldSettings.GetMouseSettings().GetWheelBehavior() );
5661 [ + - ]: 884 : maSettings.SetMouseSettings( aSet );
5662 : :
5663 [ + + ][ + + ]: 884 : if( (nChangeFlags & SETTINGS_STYLE) && IsBackground() )
[ + + ]
5664 : : {
5665 [ + - ]: 158 : Wallpaper aWallpaper = GetBackground();
5666 [ + - ][ + - ]: 158 : if( !aWallpaper.IsBitmap() && !aWallpaper.IsGradient() )
[ + - ][ + - ]
[ + - ]
5667 : : {
5668 [ - + ]: 158 : if ( mpWindowImpl->mnStyle & WB_3DLOOK )
5669 [ # # ][ # # ]: 0 : SetBackground( Wallpaper( rSettings.GetStyleSettings().GetFaceColor() ) );
[ # # ]
5670 : : else
5671 [ + - ][ + - ]: 158 : SetBackground( Wallpaper( rSettings.GetStyleSettings().GetWindowColor() ) );
[ + - ]
5672 [ + - ]: 158 : }
5673 : : }
5674 : :
5675 [ + - ]: 884 : if ( nChangeFlags )
5676 : : {
5677 [ + - ]: 884 : DataChangedEvent aDCEvt( DATACHANGED_SETTINGS, &aOldSettings, nChangeFlags );
5678 [ + - ]: 884 : DataChanged( aDCEvt );
5679 : : // notify data change handler
5680 [ + - ]: 884 : ImplCallEventListeners( VCLEVENT_WINDOW_DATACHANGED, &aDCEvt);
5681 : : }
5682 : :
5683 [ + + ][ - + ]: 884 : if ( bChild || mpWindowImpl->mbChildNotify )
5684 : : {
5685 : 544 : Window* pChild = mpWindowImpl->mpFirstChild;
5686 [ + + ]: 748 : while ( pChild )
5687 : : {
5688 [ + - ]: 204 : pChild->UpdateSettings( rSettings, bChild );
5689 : 204 : pChild = pChild->mpWindowImpl->mpNext;
5690 : : }
5691 [ + - ][ + - ]: 884 : }
5692 : 884 : }
5693 : :
5694 : : // -----------------------------------------------------------------------
5695 : :
5696 : 0 : void Window::NotifyAllChildren( DataChangedEvent& rDCEvt )
5697 : : {
5698 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
5699 : :
5700 : 0 : DataChanged( rDCEvt );
5701 : :
5702 : 0 : Window* pChild = mpWindowImpl->mpFirstChild;
5703 [ # # ]: 0 : while ( pChild )
5704 : : {
5705 : 0 : pChild->NotifyAllChildren( rDCEvt );
5706 : 0 : pChild = pChild->mpWindowImpl->mpNext;
5707 : : }
5708 : 0 : }
5709 : :
5710 : : // -----------------------------------------------------------------------
5711 : :
5712 : 56221 : void Window::SetPointFont( const Font& rFont )
5713 : : {
5714 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
5715 : :
5716 [ + - ]: 56221 : Font aFont = rFont;
5717 [ + - ]: 56221 : ImplPointToLogic( aFont );
5718 [ + - ][ + - ]: 56221 : SetFont( aFont );
5719 : 56221 : }
5720 : :
5721 : : // -----------------------------------------------------------------------
5722 : :
5723 : 0 : Font Window::GetPointFont() const
5724 : : {
5725 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
5726 : :
5727 : 0 : Font aFont = GetFont();
5728 [ # # ]: 0 : ImplLogicToPoint( aFont );
5729 : 0 : return aFont;
5730 : : }
5731 : :
5732 : : // -----------------------------------------------------------------------
5733 : :
5734 : 30710 : void Window::SetParentClipMode( sal_uInt16 nMode )
5735 : : {
5736 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
5737 : :
5738 [ + + ]: 30710 : if ( mpWindowImpl->mpBorderWindow )
5739 : 150 : mpWindowImpl->mpBorderWindow->SetParentClipMode( nMode );
5740 : : else
5741 : : {
5742 [ + - ]: 30560 : if ( !ImplIsOverlapWindow() )
5743 : : {
5744 : 30560 : mpWindowImpl->mnParentClipMode = nMode;
5745 [ - + ]: 30560 : if ( nMode & PARENTCLIPMODE_CLIP )
5746 : 0 : mpWindowImpl->mpParent->mpWindowImpl->mbClipChildren = sal_True;
5747 : : }
5748 : : }
5749 : 30710 : }
5750 : :
5751 : : // -----------------------------------------------------------------------
5752 : :
5753 : 52554 : sal_uInt16 Window::GetParentClipMode() const
5754 : : {
5755 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
5756 : :
5757 [ + + ]: 52554 : if ( mpWindowImpl->mpBorderWindow )
5758 : 2087 : return mpWindowImpl->mpBorderWindow->GetParentClipMode();
5759 : : else
5760 : 52554 : return mpWindowImpl->mnParentClipMode;
5761 : : }
5762 : :
5763 : : // -----------------------------------------------------------------------
5764 : :
5765 : 0 : void Window::SetWindowRegionPixel()
5766 : : {
5767 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
5768 : :
5769 [ # # ]: 0 : if ( mpWindowImpl->mpBorderWindow )
5770 : 0 : mpWindowImpl->mpBorderWindow->SetWindowRegionPixel();
5771 [ # # ]: 0 : else if( mpWindowImpl->mbFrame )
5772 : : {
5773 [ # # ]: 0 : mpWindowImpl->maWinRegion = Region( REGION_NULL);
5774 : 0 : mpWindowImpl->mbWinRegion = sal_False;
5775 : 0 : mpWindowImpl->mpFrame->ResetClipRegion();
5776 : : }
5777 : : else
5778 : : {
5779 [ # # ]: 0 : if ( mpWindowImpl->mbWinRegion )
5780 : : {
5781 [ # # ]: 0 : mpWindowImpl->maWinRegion = Region( REGION_NULL );
5782 : 0 : mpWindowImpl->mbWinRegion = sal_False;
5783 : 0 : ImplSetClipFlag();
5784 : :
5785 [ # # ]: 0 : if ( IsReallyVisible() )
5786 : : {
5787 : : // restore background storage
5788 [ # # ][ # # ]: 0 : if ( mpWindowImpl->mpOverlapData && mpWindowImpl->mpOverlapData->mpSaveBackDev )
5789 [ # # ]: 0 : ImplDeleteOverlapBackground();
5790 [ # # ]: 0 : if ( mpWindowImpl->mpFrameData->mpFirstBackWin )
5791 [ # # ]: 0 : ImplInvalidateAllOverlapBackgrounds();
5792 [ # # ]: 0 : Rectangle aRect( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) );
5793 [ # # ]: 0 : Region aRegion( aRect );
5794 [ # # ][ # # ]: 0 : ImplInvalidateParentFrameRegion( aRegion );
5795 : : }
5796 : : }
5797 : : }
5798 : 0 : }
5799 : :
5800 : : // -----------------------------------------------------------------------
5801 : :
5802 : 0 : void Window::SetWindowRegionPixel( const Region& rRegion )
5803 : : {
5804 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
5805 : :
5806 [ # # ]: 0 : if ( mpWindowImpl->mpBorderWindow )
5807 : 0 : mpWindowImpl->mpBorderWindow->SetWindowRegionPixel( rRegion );
5808 [ # # ]: 0 : else if( mpWindowImpl->mbFrame )
5809 : : {
5810 [ # # ]: 0 : if( rRegion.GetType() != REGION_NULL )
5811 : : {
5812 : 0 : mpWindowImpl->maWinRegion = rRegion;
5813 : 0 : mpWindowImpl->mbWinRegion = ! rRegion.IsEmpty();
5814 [ # # ]: 0 : if( mpWindowImpl->mbWinRegion )
5815 : : {
5816 : : // set/update ClipRegion
5817 : : long nX;
5818 : : long nY;
5819 : : long nWidth;
5820 : : long nHeight;
5821 : : sal_uLong nRectCount;
5822 : : ImplRegionInfo aInfo;
5823 : : sal_Bool bRegionRect;
5824 : :
5825 [ # # ]: 0 : nRectCount = mpWindowImpl->maWinRegion.GetRectCount();
5826 [ # # ]: 0 : mpWindowImpl->mpFrame->BeginSetClipRegion( nRectCount );
5827 [ # # ]: 0 : bRegionRect = mpWindowImpl->maWinRegion.ImplGetFirstRect( aInfo, nX, nY, nWidth, nHeight );
5828 [ # # ]: 0 : while ( bRegionRect )
5829 : : {
5830 [ # # ]: 0 : mpWindowImpl->mpFrame->UnionClipRegion( nX, nY, nWidth, nHeight );
5831 [ # # ]: 0 : bRegionRect = mpWindowImpl->maWinRegion.ImplGetNextRect( aInfo, nX, nY, nWidth, nHeight );
5832 : : }
5833 [ # # ]: 0 : mpWindowImpl->mpFrame->EndSetClipRegion();
5834 : : }
5835 : : else
5836 : 0 : SetWindowRegionPixel();
5837 : : }
5838 : : else
5839 : 0 : SetWindowRegionPixel();
5840 : : }
5841 : : else
5842 : : {
5843 [ # # ]: 0 : if ( rRegion.GetType() == REGION_NULL )
5844 : : {
5845 [ # # ]: 0 : if ( mpWindowImpl->mbWinRegion )
5846 : : {
5847 [ # # ]: 0 : mpWindowImpl->maWinRegion = Region( REGION_NULL );
5848 : 0 : mpWindowImpl->mbWinRegion = sal_False;
5849 : 0 : ImplSetClipFlag();
5850 : : }
5851 : : }
5852 : : else
5853 : : {
5854 : 0 : mpWindowImpl->maWinRegion = rRegion;
5855 : 0 : mpWindowImpl->mbWinRegion = sal_True;
5856 : 0 : ImplSetClipFlag();
5857 : : }
5858 : :
5859 [ # # ]: 0 : if ( IsReallyVisible() )
5860 : : {
5861 : : // restore background storage
5862 [ # # ][ # # ]: 0 : if ( mpWindowImpl->mpOverlapData && mpWindowImpl->mpOverlapData->mpSaveBackDev )
5863 [ # # ]: 0 : ImplDeleteOverlapBackground();
5864 [ # # ]: 0 : if ( mpWindowImpl->mpFrameData->mpFirstBackWin )
5865 [ # # ]: 0 : ImplInvalidateAllOverlapBackgrounds();
5866 [ # # ]: 0 : Rectangle aRect( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) );
5867 [ # # ]: 0 : Region aRegion( aRect );
5868 [ # # ][ # # ]: 0 : ImplInvalidateParentFrameRegion( aRegion );
5869 : : }
5870 : : }
5871 : 0 : }
5872 : :
5873 : : // -----------------------------------------------------------------------
5874 : :
5875 : 0 : const Region& Window::GetWindowRegionPixel() const
5876 : : {
5877 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
5878 : :
5879 [ # # ]: 0 : if ( mpWindowImpl->mpBorderWindow )
5880 : 0 : return mpWindowImpl->mpBorderWindow->GetWindowRegionPixel();
5881 : : else
5882 : 0 : return mpWindowImpl->maWinRegion;
5883 : : }
5884 : :
5885 : : // -----------------------------------------------------------------------
5886 : :
5887 : 0 : sal_Bool Window::IsWindowRegionPixel() const
5888 : : {
5889 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
5890 : :
5891 [ # # ]: 0 : if ( mpWindowImpl->mpBorderWindow )
5892 : 0 : return mpWindowImpl->mpBorderWindow->IsWindowRegionPixel();
5893 : : else
5894 : 0 : return mpWindowImpl->mbWinRegion;
5895 : : }
5896 : :
5897 : : // -----------------------------------------------------------------------
5898 : :
5899 : 362 : Region Window::GetWindowClipRegionPixel( sal_uInt16 nFlags ) const
5900 : : {
5901 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
5902 : :
5903 : 362 : Region aWinClipRegion;
5904 : :
5905 [ + - ]: 362 : if ( nFlags & WINDOW_GETCLIPREGION_NOCHILDREN )
5906 : : {
5907 [ - + ]: 362 : if ( mpWindowImpl->mbInitWinClipRegion )
5908 [ # # ]: 0 : ((Window*)this)->ImplInitWinClipRegion();
5909 [ + - ]: 362 : aWinClipRegion = mpWindowImpl->maWinClipRegion;
5910 : : }
5911 : : else
5912 : : {
5913 [ # # ]: 0 : Region* pWinChildClipRegion = ((Window*)this)->ImplGetWinChildClipRegion();
5914 [ # # ]: 0 : aWinClipRegion = *pWinChildClipRegion;
5915 : : // --- RTL --- remirror clip region before passing it to somebody
5916 [ # # ][ # # ]: 0 : if( ImplIsAntiparallel() )
5917 [ # # ]: 0 : ImplReMirror( aWinClipRegion );
5918 : : }
5919 : :
5920 [ + - ]: 362 : if ( nFlags & WINDOW_GETCLIPREGION_NULL )
5921 : : {
5922 [ + - ]: 362 : Rectangle aWinRect( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) );
5923 [ + - ]: 362 : Region aWinRegion( aWinRect );
5924 : :
5925 [ + - ][ + - ]: 362 : if ( aWinRegion == aWinClipRegion )
5926 [ + - ][ + - ]: 362 : aWinClipRegion.SetNull();
5927 : : }
5928 : :
5929 [ + - ]: 362 : aWinClipRegion.Move( -mnOutOffX, -mnOutOffY );
5930 : :
5931 : 362 : return aWinClipRegion;
5932 : : }
5933 : :
5934 : : // -----------------------------------------------------------------------
5935 : :
5936 : 165557 : Region Window::GetPaintRegion() const
5937 : : {
5938 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
5939 : :
5940 [ + + ]: 165557 : if ( mpWindowImpl->mpPaintRegion )
5941 : : {
5942 [ + - ]: 165549 : Region aRegion = *mpWindowImpl->mpPaintRegion;
5943 [ + - ]: 165549 : aRegion.Move( -mnOutOffX, -mnOutOffY );
5944 [ + - ][ + - ]: 165549 : return PixelToLogic( aRegion );
5945 : : }
5946 : : else
5947 : : {
5948 [ + - ]: 8 : Region aPaintRegion( REGION_NULL );
5949 [ + - ][ + - ]: 165557 : return aPaintRegion;
5950 : : }
5951 : : }
5952 : :
5953 : : // -----------------------------------------------------------------------
5954 : :
5955 : 0 : void Window::ExpandPaintClipRegion( const Region& rRegion )
5956 : : {
5957 [ # # ]: 0 : if( mpWindowImpl->mpPaintRegion )
5958 : : {
5959 [ # # ]: 0 : Region aPixRegion = LogicToPixel( rRegion );
5960 [ # # ]: 0 : Region aDevPixRegion = ImplPixelToDevicePixel( aPixRegion );
5961 : :
5962 [ # # ][ # # ]: 0 : Region aWinChildRegion = *ImplGetWinChildClipRegion();
5963 : : // --- RTL -- only this region is in frame coordinates, so re-mirror it
5964 [ # # ][ # # ]: 0 : if( ImplIsAntiparallel() )
5965 [ # # ]: 0 : ImplReMirror( aWinChildRegion );
5966 [ # # ]: 0 : aDevPixRegion.Intersect( aWinChildRegion );
5967 [ # # ][ # # ]: 0 : if( ! aDevPixRegion.IsEmpty() )
5968 : : {
5969 [ # # ]: 0 : mpWindowImpl->mpPaintRegion->Union( aDevPixRegion );
5970 : 0 : mbInitClipRegion = sal_True;
5971 [ # # ][ # # ]: 0 : }
[ # # ]
5972 : : }
5973 : 0 : }
5974 : :
5975 : : // -----------------------------------------------------------------------
5976 : :
5977 : 22265 : static SystemWindow *ImplGetLastSystemWindow( Window *pWin )
5978 : : {
5979 : : // get the most top-level system window, the one that contains the taskpanelist
5980 : 22265 : SystemWindow *pSysWin = NULL;
5981 [ - + ]: 22265 : if( !pWin )
5982 : 0 : return pSysWin;
5983 : 22265 : Window *pMyParent = pWin;
5984 [ + + ]: 112796 : while ( pMyParent )
5985 : : {
5986 [ + + ]: 90531 : if ( pMyParent->IsSystemWindow() )
5987 : 22249 : pSysWin = (SystemWindow*)pMyParent;
5988 : 90531 : pMyParent = pMyParent->GetParent();
5989 : : }
5990 : 22265 : return pSysWin;
5991 : : }
5992 : :
5993 : 18564 : void Window::SetParent( Window* pNewParent )
5994 : : {
5995 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
5996 : : DBG_ASSERT( pNewParent, "Window::SetParent(): pParent == NULL" );
5997 : : DBG_ASSERT( pNewParent != this, "someone tried to reparent a window to itself" );
5998 : :
5999 [ - + ]: 18564 : if( pNewParent == this )
6000 : 0 : return;
6001 : :
6002 : : // check if the taskpanelist would change and move the window pointer accordingly
6003 : 18564 : SystemWindow *pSysWin = ImplGetLastSystemWindow(this);
6004 : 18564 : SystemWindow *pNewSysWin = NULL;
6005 : 18564 : sal_Bool bChangeTaskPaneList = sal_False;
6006 [ + + ][ + + ]: 18564 : if( pSysWin && pSysWin->ImplIsInTaskPaneList( this ) )
[ + + ]
6007 : : {
6008 : 3701 : pNewSysWin = ImplGetLastSystemWindow( pNewParent );
6009 [ - + ][ + - ]: 3701 : if( pNewSysWin && pNewSysWin != pSysWin )
6010 : : {
6011 : 0 : bChangeTaskPaneList = sal_True;
6012 : 0 : pSysWin->GetTaskPaneList()->RemoveWindow( this );
6013 : : }
6014 : : }
6015 : : // remove ownerdraw decorated windows from list in the top-most frame window
6016 [ - + ][ # # ]: 18564 : if( (GetStyle() & WB_OWNERDRAWDECORATION) && mpWindowImpl->mbFrame )
[ - + ]
6017 : : {
6018 [ # # ]: 0 : ::std::vector< Window* >& rList = ImplGetOwnerDrawList();
6019 : 0 : ::std::vector< Window* >::iterator p;
6020 [ # # ]: 0 : p = ::std::find( rList.begin(), rList.end(), this );
6021 [ # # ][ # # ]: 0 : if( p != rList.end() )
6022 [ # # ]: 0 : rList.erase( p );
6023 : : }
6024 : :
6025 : 18564 : ImplSetFrameParent( pNewParent );
6026 : :
6027 [ + + ]: 18564 : if ( mpWindowImpl->mpBorderWindow )
6028 : : {
6029 : 5576 : mpWindowImpl->mpRealParent = pNewParent;
6030 : 5576 : mpWindowImpl->mpBorderWindow->SetParent( pNewParent );
6031 : 5576 : return;
6032 : : }
6033 : :
6034 [ + + ]: 12988 : if ( mpWindowImpl->mpParent == pNewParent )
6035 : 30 : return;
6036 : :
6037 [ + + ]: 12958 : if ( mpWindowImpl->mbFrame )
6038 : 16 : mpWindowImpl->mpFrame->SetParent( pNewParent->mpWindowImpl->mpFrame );
6039 : :
6040 : 12958 : sal_Bool bVisible = IsVisible();
6041 : 12958 : Show( false, SHOW_NOFOCUSCHANGE );
6042 : :
6043 : : // check if the overlap window changes
6044 : : Window* pOldOverlapWindow;
6045 : 12958 : Window* pNewOverlapWindow = NULL;
6046 [ + + ]: 12958 : if ( ImplIsOverlapWindow() )
6047 : 16 : pOldOverlapWindow = NULL;
6048 : : else
6049 : : {
6050 : 12942 : pNewOverlapWindow = pNewParent->ImplGetFirstOverlapWindow();
6051 [ + + ]: 12942 : if ( mpWindowImpl->mpOverlapWindow != pNewOverlapWindow )
6052 : 8600 : pOldOverlapWindow = mpWindowImpl->mpOverlapWindow;
6053 : : else
6054 : 4342 : pOldOverlapWindow = NULL;
6055 : : }
6056 : :
6057 : : // convert windows in the hierarchy
6058 : 12958 : sal_Bool bFocusOverlapWin = HasChildPathFocus( sal_True );
6059 : 12958 : sal_Bool bFocusWin = HasChildPathFocus();
6060 : 12958 : sal_Bool bNewFrame = pNewParent->mpWindowImpl->mpFrameWindow != mpWindowImpl->mpFrameWindow;
6061 [ + + ]: 12958 : if ( bNewFrame )
6062 : : {
6063 [ + + ]: 8616 : if ( mpWindowImpl->mpFrameData->mpFocusWin )
6064 : : {
6065 [ + + ]: 4573 : if ( IsWindowOrChild( mpWindowImpl->mpFrameData->mpFocusWin ) )
6066 : 26 : mpWindowImpl->mpFrameData->mpFocusWin = NULL;
6067 : : }
6068 [ - + ]: 8616 : if ( mpWindowImpl->mpFrameData->mpMouseMoveWin )
6069 : : {
6070 [ # # ]: 0 : if ( IsWindowOrChild( mpWindowImpl->mpFrameData->mpMouseMoveWin ) )
6071 : 0 : mpWindowImpl->mpFrameData->mpMouseMoveWin = NULL;
6072 : : }
6073 [ - + ]: 8616 : if ( mpWindowImpl->mpFrameData->mpMouseDownWin )
6074 : : {
6075 [ # # ]: 0 : if ( IsWindowOrChild( mpWindowImpl->mpFrameData->mpMouseDownWin ) )
6076 : 0 : mpWindowImpl->mpFrameData->mpMouseDownWin = NULL;
6077 : : }
6078 : : }
6079 : 12958 : ImplRemoveWindow( bNewFrame );
6080 : 12958 : ImplInsertWindow( pNewParent );
6081 [ - + ]: 12958 : if ( mpWindowImpl->mnParentClipMode & PARENTCLIPMODE_CLIP )
6082 : 0 : pNewParent->mpWindowImpl->mbClipChildren = sal_True;
6083 : 12958 : ImplUpdateWindowPtr();
6084 [ - + ]: 12958 : if ( ImplUpdatePos() )
6085 : 0 : ImplUpdateSysObjPos();
6086 : :
6087 : : // If the Overlap-Window has changed, we need to test whether
6088 : : // OverlapWindows that had the Child window as their parent
6089 : : // need to be put into the window hierarchy.
6090 [ + + ]: 12958 : if ( ImplIsOverlapWindow() )
6091 : : {
6092 [ + - ]: 16 : if ( bNewFrame )
6093 : : {
6094 : 16 : Window* pOverlapWindow = mpWindowImpl->mpFirstOverlap;
6095 [ - + ]: 16 : while ( pOverlapWindow )
6096 : : {
6097 : 0 : Window* pNextOverlapWindow = pOverlapWindow->mpWindowImpl->mpNext;
6098 : 0 : pOverlapWindow->ImplUpdateOverlapWindowPtr( bNewFrame );
6099 : 0 : pOverlapWindow = pNextOverlapWindow;
6100 : : }
6101 : : }
6102 : : }
6103 [ + + ]: 12942 : else if ( pOldOverlapWindow )
6104 : : {
6105 : : // reset Focus-Save
6106 [ + + ]: 13147 : if ( bFocusWin ||
[ + + - + ]
[ + + ]
6107 : : (pOldOverlapWindow->mpWindowImpl->mpLastFocusWindow &&
6108 : 4547 : IsWindowOrChild( pOldOverlapWindow->mpWindowImpl->mpLastFocusWindow )) )
6109 : 26 : pOldOverlapWindow->mpWindowImpl->mpLastFocusWindow = NULL;
6110 : :
6111 : 8600 : Window* pOverlapWindow = pOldOverlapWindow->mpWindowImpl->mpFirstOverlap;
6112 [ - + ]: 8600 : while ( pOverlapWindow )
6113 : : {
6114 : 0 : Window* pNextOverlapWindow = pOverlapWindow->mpWindowImpl->mpNext;
6115 [ # # ]: 0 : if ( ImplIsRealParentPath( pOverlapWindow->ImplGetWindow() ) )
6116 : 0 : pOverlapWindow->ImplUpdateOverlapWindowPtr( bNewFrame );
6117 : 0 : pOverlapWindow = pNextOverlapWindow;
6118 : : }
6119 : :
6120 : : // update activate-status at next overlap window
6121 [ + + ]: 8600 : if ( HasChildPathFocus( sal_True ) )
6122 : 26 : ImplCallFocusChangeActivate( pNewOverlapWindow, pOldOverlapWindow );
6123 : : }
6124 : :
6125 : : // also convert Activate-Status
6126 [ + + ]: 12958 : if ( bNewFrame )
6127 : : {
6128 [ + + + + ]: 14184 : if ( (GetType() == WINDOW_BORDERWINDOW) &&
[ + + ]
6129 : 5568 : (ImplGetWindow()->GetType() == WINDOW_FLOATINGWINDOW) )
6130 : 16 : ((ImplBorderWindow*)this)->SetDisplayActive( mpWindowImpl->mpFrameData->mbHasFocus );
6131 : : }
6132 : :
6133 : : // when required give focus to new frame if
6134 : : // FocusWindow is changed with SetParent()
6135 [ + + ]: 12958 : if ( bFocusOverlapWin )
6136 : : {
6137 : 59 : mpWindowImpl->mpFrameData->mpFocusWin = Application::GetFocusWindow();
6138 [ + + ]: 59 : if ( !mpWindowImpl->mpFrameData->mbHasFocus )
6139 : : {
6140 : 26 : mpWindowImpl->mpFrame->ToTop( 0 );
6141 : : }
6142 : : }
6143 : :
6144 : : // Assure DragSource and DropTarget members are created
6145 [ + + ]: 12958 : if ( bNewFrame )
6146 : : {
6147 : 8616 : GetDropTarget();
6148 : : }
6149 : :
6150 [ - + ]: 12958 : if( bChangeTaskPaneList )
6151 : 0 : pNewSysWin->GetTaskPaneList()->AddWindow( this );
6152 : :
6153 [ - + ][ # # ]: 12958 : if( (GetStyle() & WB_OWNERDRAWDECORATION) && mpWindowImpl->mbFrame )
[ - + ]
6154 [ # # ][ # # ]: 0 : ImplGetOwnerDrawList().push_back( this );
6155 : :
6156 [ + + ]: 12958 : if ( bVisible )
6157 : 18564 : Show( true, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE );
6158 : : }
6159 : :
6160 : : // -----------------------------------------------------------------------
6161 : :
6162 : 365054 : void Window::Show( sal_Bool bVisible, sal_uInt16 nFlags )
6163 : : {
6164 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
6165 : :
6166 [ + + ]: 365054 : if ( mpWindowImpl->mbVisible == bVisible )
6167 : : return;
6168 : :
6169 [ + - ]: 162022 : ImplDelData aDogTag( this );
6170 : :
6171 : 162022 : sal_Bool bRealVisibilityChanged = sal_False;
6172 : 162022 : mpWindowImpl->mbVisible = (bVisible != 0);
6173 : :
6174 [ + + ]: 162022 : if ( !bVisible )
6175 : : {
6176 [ + - ]: 79971 : ImplHideAllOverlaps();
6177 [ - + ]: 79971 : if( aDogTag.IsDead() )
6178 : : return;
6179 : :
6180 [ + + ]: 79971 : if ( mpWindowImpl->mpBorderWindow )
6181 : : {
6182 : 10699 : bool bOldUpdate = mpWindowImpl->mpBorderWindow->mpWindowImpl->mbNoParentUpdate;
6183 [ - + ]: 10699 : if ( mpWindowImpl->mbNoParentUpdate )
6184 : 0 : mpWindowImpl->mpBorderWindow->mpWindowImpl->mbNoParentUpdate = sal_True;
6185 [ + - ]: 10699 : mpWindowImpl->mpBorderWindow->Show( false, nFlags );
6186 : 10699 : mpWindowImpl->mpBorderWindow->mpWindowImpl->mbNoParentUpdate = bOldUpdate;
6187 : : }
6188 [ + + ]: 69272 : else if ( mpWindowImpl->mbFrame )
6189 : : {
6190 : 1734 : mpWindowImpl->mbSuppressAccessibilityEvents = sal_True;
6191 [ + - ]: 1734 : mpWindowImpl->mpFrame->Show( sal_False, sal_False );
6192 : : }
6193 : :
6194 [ + - ]: 79971 : StateChanged( STATE_CHANGE_VISIBLE );
6195 : :
6196 [ + + ]: 79971 : if ( mpWindowImpl->mbReallyVisible )
6197 : : {
6198 [ + - ]: 43703 : Region aInvRegion( REGION_EMPTY );
6199 : 43703 : sal_Bool bSaveBack = sal_False;
6200 : :
6201 [ + - ][ + + ]: 43703 : if ( ImplIsOverlapWindow() && !mpWindowImpl->mbFrame )
[ - + ][ - + ]
6202 : : {
6203 [ # # ][ # # ]: 0 : if ( ImplRestoreOverlapBackground( aInvRegion ) )
6204 : 0 : bSaveBack = sal_True;
6205 : : }
6206 : :
6207 [ + - ]: 43703 : if ( !bSaveBack )
6208 : : {
6209 [ + + ]: 43703 : if ( mpWindowImpl->mbInitWinClipRegion )
6210 [ + - ]: 16818 : ImplInitWinClipRegion();
6211 [ + - ]: 43703 : aInvRegion = mpWindowImpl->maWinClipRegion;
6212 : : }
6213 : :
6214 [ - + ]: 43703 : if( aDogTag.IsDead() )
6215 : : return;
6216 : :
6217 : 43703 : bRealVisibilityChanged = mpWindowImpl->mbReallyVisible;
6218 [ + - ]: 43703 : ImplResetReallyVisible();
6219 [ + - ]: 43703 : ImplSetClipFlag();
6220 : :
6221 [ + - ][ + + ]: 43703 : if ( ImplIsOverlapWindow() && !mpWindowImpl->mbFrame )
[ - + ][ - + ]
6222 : : {
6223 : : // convert focus
6224 [ # # ][ # # ]: 0 : if ( !(nFlags & SHOW_NOFOCUSCHANGE) && HasChildPathFocus() )
[ # # ][ # # ]
6225 : : {
6226 [ # # ][ # # ]: 0 : if ( mpWindowImpl->mpOverlapWindow->IsEnabled() &&
[ # # ][ # # ]
[ # # ]
6227 [ # # ]: 0 : mpWindowImpl->mpOverlapWindow->IsInputEnabled() &&
6228 [ # # ]: 0 : ! mpWindowImpl->mpOverlapWindow->IsInModalMode()
6229 : : )
6230 [ # # ]: 0 : mpWindowImpl->mpOverlapWindow->GrabFocus();
6231 : : }
6232 : : }
6233 : :
6234 [ + + ]: 43703 : if ( !mpWindowImpl->mbFrame )
6235 : : {
6236 [ + + ][ + + ]: 41969 : if( mpWindowImpl->mpWinData && mpWindowImpl->mpWinData->mbEnableNativeWidget )
6237 : : {
6238 : : /*
6239 : : * #i48371# native theming: some themes draw outside the control
6240 : : * area we tell them to (bad thing, but we cannot do much about it ).
6241 : : * On hiding these controls they get invalidated with their window rectangle
6242 : : * which leads to the parts outside the control area being left and not
6243 : : * invalidated. Workaround: invalidate an area on the parent, too
6244 : : */
6245 : 39250 : const int workaround_border = 5;
6246 [ + - ]: 39250 : Rectangle aBounds( aInvRegion.GetBoundRect() );
6247 : 39250 : aBounds.Left() -= workaround_border;
6248 : 39250 : aBounds.Top() -= workaround_border;
6249 : 39250 : aBounds.Right() += workaround_border;
6250 : 39250 : aBounds.Bottom() += workaround_border;
6251 [ + - ]: 39250 : aInvRegion = aBounds;
6252 : : }
6253 [ + + ][ + - ]: 41969 : if ( !mpWindowImpl->mbNoParentUpdate && !(nFlags & SHOW_NOPARENTUPDATE) )
6254 : : {
6255 [ + - ][ + + ]: 41921 : if ( !aInvRegion.IsEmpty() )
6256 [ + - ]: 41677 : ImplInvalidateParentFrameRegion( aInvRegion );
6257 : : }
6258 [ + - ]: 43703 : ImplGenerateMouseMove();
6259 [ + - ][ + - ]: 43703 : }
6260 : : }
6261 : : }
6262 : : else
6263 : : {
6264 : : // inherit native widget flag for form controls
6265 : : // required here, because frames never show up in the child hierarchy - which should be fixed....
6266 : : // eg, the drop down of a combobox which is a system floating window
6267 [ + + ][ + - ]: 82059 : if( mpWindowImpl->mbFrame && GetParent() && GetParent()->IsCompoundControl() &&
[ + + ][ + - ]
[ + - ][ + + ]
[ - + ][ - + ]
6268 [ + - ][ + - ]: 8 : GetParent()->IsNativeWidgetEnabled() != IsNativeWidgetEnabled() )
[ + - ]
6269 [ # # ][ # # ]: 0 : EnableNativeWidget( GetParent()->IsNativeWidgetEnabled() );
[ # # ]
6270 : :
6271 [ + + ]: 82051 : if ( mpWindowImpl->mbCallMove )
6272 : : {
6273 [ + - ]: 75084 : ImplCallMove();
6274 : : }
6275 [ + + ]: 82051 : if ( mpWindowImpl->mbCallResize )
6276 : : {
6277 [ + - ]: 74150 : ImplCallResize();
6278 : : }
6279 : :
6280 [ + - ]: 82051 : StateChanged( STATE_CHANGE_VISIBLE );
6281 : :
6282 : : Window* pTestParent;
6283 [ + - ][ + + ]: 82051 : if ( ImplIsOverlapWindow() )
6284 : 1825 : pTestParent = mpWindowImpl->mpOverlapWindow;
6285 : : else
6286 [ + - ]: 80226 : pTestParent = ImplGetParent();
6287 [ + + ][ + + ]: 82051 : if ( mpWindowImpl->mbFrame || pTestParent->mpWindowImpl->mbReallyVisible )
6288 : : {
6289 : : // if a window becomes visible, send all child windows a StateChange,
6290 : : // such that these can initialise themselves
6291 [ + - ]: 16153 : ImplCallInitShow();
6292 : :
6293 : : // If it is a SystemWindow it automatically pops up on top of
6294 : : // all other windows if needed.
6295 [ + - ][ + + ]: 16153 : if ( ImplIsOverlapWindow() && !(nFlags & SHOW_NOACTIVATE) )
[ + + ][ + + ]
6296 : : {
6297 [ + + ][ + - ]: 1733 : ImplStartToTop(( nFlags & SHOW_FOREGROUNDTASK ) ? TOTOP_FOREGROUNDTASK : 0 );
6298 [ + - ]: 1733 : ImplFocusToTop( 0, sal_False );
6299 : : }
6300 : :
6301 : : // save background
6302 [ + + ][ - + ]: 16153 : if ( mpWindowImpl->mpOverlapData && mpWindowImpl->mpOverlapData->mbSaveBack )
6303 [ # # ]: 0 : ImplSaveOverlapBackground();
6304 : : // adjust mpWindowImpl->mbReallyVisible
6305 : 16153 : bRealVisibilityChanged = !mpWindowImpl->mbReallyVisible;
6306 [ + - ]: 16153 : ImplSetReallyVisible();
6307 : :
6308 : : // assure clip rectangles will be recalculated
6309 [ + - ]: 16153 : ImplSetClipFlag();
6310 : :
6311 [ + + ]: 16153 : if ( !mpWindowImpl->mbFrame )
6312 : : {
6313 : 14328 : sal_uInt16 nInvalidateFlags = INVALIDATE_CHILDREN;
6314 [ + - ][ + + ]: 14328 : if( ! IsPaintTransparent() )
6315 : 11124 : nInvalidateFlags |= INVALIDATE_NOTRANSPARENT;
6316 [ + - ]: 14328 : ImplInvalidate( NULL, nInvalidateFlags );
6317 [ + - ]: 14328 : ImplGenerateMouseMove();
6318 : : }
6319 : : }
6320 : :
6321 [ + + ]: 82051 : if ( mpWindowImpl->mpBorderWindow )
6322 [ + - ]: 10892 : mpWindowImpl->mpBorderWindow->Show( true, nFlags );
6323 [ + + ]: 71159 : else if ( mpWindowImpl->mbFrame )
6324 : : {
6325 : : // #106431#, hide SplashScreen
6326 [ + - ]: 1825 : ImplSVData* pSVData = ImplGetSVData();
6327 [ + - ]: 1825 : if ( !pSVData->mpIntroWindow )
6328 : : {
6329 : : // The right way would be just to call this (not even in the 'if')
6330 [ + - ][ + - ]: 1825 : GetpApp()->InitFinished();
6331 : : }
6332 [ # # ][ # # ]: 0 : else if ( !ImplIsWindowOrChild( pSVData->mpIntroWindow ) )
6333 : : {
6334 : : // ... but the VCL splash is broken, and it needs this
6335 : : // (for ./soffice slot:5500)
6336 [ # # ]: 0 : pSVData->mpIntroWindow->Hide();
6337 : : }
6338 : :
6339 : : //DBG_ASSERT( !mpWindowImpl->mbSuppressAccessibilityEvents, "Window::Show() - Frame reactivated");
6340 : 1825 : mpWindowImpl->mbSuppressAccessibilityEvents = sal_False;
6341 : :
6342 : 1825 : mpWindowImpl->mbPaintFrame = sal_True;
6343 [ + + ]: 1825 : sal_Bool bNoActivate = (nFlags & (SHOW_NOACTIVATE|SHOW_NOFOCUSCHANGE)) ? sal_True : sal_False;
6344 [ + - ]: 1825 : mpWindowImpl->mpFrame->Show( sal_True, bNoActivate );
6345 [ - + ]: 1825 : if( aDogTag.IsDead() )
6346 : : return;
6347 : :
6348 : : // Query the correct size of the window, if we are waiting for
6349 : : // a system resize
6350 [ + + ]: 1825 : if ( mpWindowImpl->mbWaitSystemResize )
6351 : : {
6352 : : long nOutWidth;
6353 : : long nOutHeight;
6354 [ + - ]: 93 : mpWindowImpl->mpFrame->GetClientSize( nOutWidth, nOutHeight );
6355 [ + - ]: 93 : ImplHandleResize( this, nOutWidth, nOutHeight );
6356 : : }
6357 : : }
6358 : :
6359 [ - + ]: 82051 : if( aDogTag.IsDead() )
6360 : : return;
6361 : :
6362 : : #if OSL_DEBUG_LEVEL > 0
6363 : : if ( IsDialog() || (GetType() == WINDOW_TABPAGE) || (GetType() == WINDOW_DOCKINGWINDOW) )
6364 : : {
6365 : : DBG_DIALOGTEST( this );
6366 : : }
6367 : : #endif
6368 : :
6369 [ + - ]: 82051 : ImplShowAllOverlaps();
6370 : : }
6371 : :
6372 [ - + ]: 162022 : if( aDogTag.IsDead() )
6373 : : return;
6374 : : // invalidate all saved backgrounds
6375 [ - + ]: 162022 : if ( mpWindowImpl->mpFrameData->mpFirstBackWin )
6376 [ # # ]: 0 : ImplInvalidateAllOverlapBackgrounds();
6377 : :
6378 : : // the SHOW/HIDE events also serve as indicators to send child creation/destroy events to the access bridge
6379 : : // However, the access bridge only uses this event if the data member is not NULL (it's kind of a hack that
6380 : : // we re-use the SHOW/HIDE events this way, with this particular semantics).
6381 : : // Since #104887#, the notifications for the access bridge are done in Impl(Set|Reset)ReallyVisible. Here, we
6382 : : // now only notify with a NULL data pointer, for all other clients except the access bridge.
6383 [ + + ]: 162022 : if ( !bRealVisibilityChanged )
6384 [ + + ][ + - ]: 102166 : ImplCallEventListeners( mpWindowImpl->mbVisible ? VCLEVENT_WINDOW_SHOW : VCLEVENT_WINDOW_HIDE, NULL );
6385 [ - + ]: 162022 : if( aDogTag.IsDead() )
6386 [ + - ][ + - ]: 365054 : return;
6387 : :
6388 : : // #107575#, if a floating windows is shown that grabs the focus, we have to notify the toolkit about it
6389 : : // ImplGrabFocus() is not called in this case
6390 : : // Because this might lead to problems the task will be shifted to 6.y
6391 : : // Note: top-level context menus are registered at the access bridge after being shown,
6392 : : // so this will probably not help here....
6393 : : /*
6394 : : if( mpWindowImpl->mbFloatWin && ((FloatingWindow*) this )->GrabsFocus() )
6395 : : {
6396 : : ImplSVData* pSVData = ImplGetSVData();
6397 : : if( !mpWindowImpl->mbVisible )
6398 : : {
6399 : : ImplCallEventListeners( VCLEVENT_WINDOW_LOSEFOCUS );
6400 : : if( pSVData->maWinData.mpFocusWin )
6401 : : pSVData->maWinData.mpFocusWin->ImplCallEventListeners( VCLEVENT_WINDOW_GETFOCUS );
6402 : : }
6403 : : else
6404 : : {
6405 : : if( pSVData->maWinData.mpFocusWin )
6406 : : pSVData->maWinData.mpFocusWin->ImplCallEventListeners( VCLEVENT_WINDOW_LOSEFOCUS );
6407 : : ImplCallEventListeners( VCLEVENT_WINDOW_GETFOCUS );
6408 : : }
6409 : : }
6410 : : */
6411 : : }
6412 : :
6413 : : // -----------------------------------------------------------------------
6414 : :
6415 : 422367 : Size Window::GetSizePixel() const
6416 : : {
6417 : : // #i43257# trigger pending resize handler to assure correct window sizes
6418 [ + + ]: 422367 : if( mpWindowImpl->mpFrameData->maResizeTimer.IsActive() )
6419 : : {
6420 [ + - ]: 1740 : ImplDelData aDogtag( this );
6421 [ + - ]: 1740 : mpWindowImpl->mpFrameData->maResizeTimer.Stop();
6422 [ + - ]: 1740 : mpWindowImpl->mpFrameData->maResizeTimer.GetTimeoutHdl().Call( NULL );
6423 [ - + ]: 1740 : if( aDogtag.IsDead() )
6424 [ + - ][ + - ]: 1740 : return Size(0,0);
6425 : : }
6426 : :
6427 : : return Size( mnOutWidth+mpWindowImpl->mnLeftBorder+mpWindowImpl->mnRightBorder,
6428 : 422367 : mnOutHeight+mpWindowImpl->mnTopBorder+mpWindowImpl->mnBottomBorder );
6429 : : }
6430 : :
6431 : 70385 : void Window::GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder,
6432 : : sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const
6433 : : {
6434 : 70385 : rLeftBorder = mpWindowImpl->mnLeftBorder;
6435 : 70385 : rTopBorder = mpWindowImpl->mnTopBorder;
6436 : 70385 : rRightBorder = mpWindowImpl->mnRightBorder;
6437 : 70385 : rBottomBorder = mpWindowImpl->mnBottomBorder;
6438 : 70385 : }
6439 : :
6440 : :
6441 : : // -----------------------------------------------------------------------
6442 : :
6443 : 51664 : void Window::Enable( bool bEnable, bool bChild )
6444 : : {
6445 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
6446 : :
6447 [ + + ]: 51664 : if ( !bEnable )
6448 : : {
6449 : : // the tracking mode will be stopped or the capture will be stolen
6450 : : // when a window is disabled,
6451 [ - + ]: 14660 : if ( IsTracking() )
6452 : 0 : EndTracking( ENDTRACK_CANCEL );
6453 [ - + ]: 14660 : if ( IsMouseCaptured() )
6454 : 0 : ReleaseMouse();
6455 : : // try to pass focus to the next control
6456 : : // if the window has focus and is contained in the dialog control
6457 : : // mpWindowImpl->mbDisabled should only be set after a call of ImplDlgCtrlNextWindow().
6458 : : // Otherwise ImplDlgCtrlNextWindow() should be used
6459 [ + + ]: 14660 : if ( HasFocus() )
6460 : 110 : ImplDlgCtrlNextWindow();
6461 : : }
6462 : :
6463 [ + + ]: 51664 : if ( mpWindowImpl->mpBorderWindow )
6464 : : {
6465 : 8236 : mpWindowImpl->mpBorderWindow->Enable( bEnable, sal_False );
6466 [ + + ][ + + ]: 8236 : if ( (mpWindowImpl->mpBorderWindow->GetType() == WINDOW_BORDERWINDOW) &&
[ + - ]
6467 : : ((ImplBorderWindow*)mpWindowImpl->mpBorderWindow)->mpMenuBarWindow )
6468 : 342 : ((ImplBorderWindow*)mpWindowImpl->mpBorderWindow)->mpMenuBarWindow->Enable( bEnable, sal_True );
6469 : : }
6470 : :
6471 : : // #i56102# restore app focus win in case the
6472 : : // window was disabled when the frame focus changed
6473 : 51664 : ImplSVData* pSVData = ImplGetSVData();
6474 [ + + ][ + + ]: 51664 : if( bEnable &&
[ + + ][ + + ]
6475 : : pSVData->maWinData.mpFocusWin == NULL &&
6476 : : mpWindowImpl->mpFrameData->mbHasFocus &&
6477 : : mpWindowImpl->mpFrameData->mpFocusWin == this )
6478 : 1 : pSVData->maWinData.mpFocusWin = this;
6479 : :
6480 [ + + ]: 51664 : if ( mpWindowImpl->mbDisabled != !bEnable )
6481 : : {
6482 : 19471 : mpWindowImpl->mbDisabled = !bEnable;
6483 [ - + ]: 19471 : if ( mpWindowImpl->mpSysObj )
6484 [ # # ][ # # ]: 0 : mpWindowImpl->mpSysObj->Enable( bEnable && !mpWindowImpl->mbInputDisabled );
6485 : 19471 : StateChanged( STATE_CHANGE_ENABLE );
6486 : :
6487 [ + + ]: 19471 : ImplCallEventListeners( bEnable ? VCLEVENT_WINDOW_ENABLED : VCLEVENT_WINDOW_DISABLED );
6488 : : }
6489 : :
6490 [ + + ][ - + ]: 51664 : if ( bChild || mpWindowImpl->mbChildNotify )
6491 : : {
6492 : 42464 : Window* pChild = mpWindowImpl->mpFirstChild;
6493 [ + + ]: 70350 : while ( pChild )
6494 : : {
6495 : 27886 : pChild->Enable( bEnable, bChild );
6496 : 27886 : pChild = pChild->mpWindowImpl->mpNext;
6497 : : }
6498 : : }
6499 : :
6500 [ + + ]: 51664 : if ( IsReallyVisible() )
6501 : 34819 : ImplGenerateMouseMove();
6502 : 51664 : }
6503 : :
6504 : : // -----------------------------------------------------------------------
6505 : :
6506 : 36 : void Window::SetCallHandlersOnInputDisabled( bool bCall )
6507 : : {
6508 [ + - ]: 36 : mpWindowImpl->mbCallHandlersDuringInputDisabled = bCall ? sal_True : sal_False;
6509 : :
6510 : 36 : Window* pChild = mpWindowImpl->mpFirstChild;
6511 [ - + ]: 36 : while ( pChild )
6512 : : {
6513 : 0 : pChild->SetCallHandlersOnInputDisabled( bCall );
6514 : 0 : pChild = pChild->mpWindowImpl->mpNext;
6515 : : }
6516 : 36 : }
6517 : :
6518 : : // -----------------------------------------------------------------------
6519 : :
6520 : 0 : bool Window::IsCallHandlersOnInputDisabled() const
6521 : : {
6522 : 0 : return mpWindowImpl->mbCallHandlersDuringInputDisabled ? true : false;
6523 : : }
6524 : :
6525 : : // -----------------------------------------------------------------------
6526 : :
6527 : 11134 : void Window::EnableInput( sal_Bool bEnable, sal_Bool bChild )
6528 : : {
6529 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
6530 : :
6531 : 11134 : sal_Bool bNotify = (bEnable != mpWindowImpl->mbInputDisabled);
6532 [ + + ]: 11134 : if ( mpWindowImpl->mpBorderWindow )
6533 : : {
6534 : 1210 : mpWindowImpl->mpBorderWindow->EnableInput( bEnable, sal_False );
6535 [ + + ][ + + ]: 1210 : if ( (mpWindowImpl->mpBorderWindow->GetType() == WINDOW_BORDERWINDOW) &&
[ + - ]
6536 : : ((ImplBorderWindow*)mpWindowImpl->mpBorderWindow)->mpMenuBarWindow )
6537 : 4 : ((ImplBorderWindow*)mpWindowImpl->mpBorderWindow)->mpMenuBarWindow->EnableInput( bEnable, sal_True );
6538 : : }
6539 : :
6540 [ + + ][ - + ]: 11134 : if ( (! bEnable && mpWindowImpl->meAlwaysInputMode != AlwaysInputEnabled) ||
[ + - ][ + + ]
6541 : : ( bEnable && mpWindowImpl->meAlwaysInputMode != AlwaysInputDisabled) )
6542 : : {
6543 : : // automatically stop the tracking mode or steal capture
6544 : : // if the window is disabled
6545 [ + + ]: 11116 : if ( !bEnable )
6546 : : {
6547 [ - + ]: 4846 : if ( IsTracking() )
6548 : 0 : EndTracking( ENDTRACK_CANCEL );
6549 [ - + ]: 4846 : if ( IsMouseCaptured() )
6550 : 0 : ReleaseMouse();
6551 : : }
6552 : :
6553 [ + + ]: 11116 : if ( mpWindowImpl->mbInputDisabled != !bEnable )
6554 : : {
6555 : 8976 : mpWindowImpl->mbInputDisabled = !bEnable;
6556 [ - + ]: 8976 : if ( mpWindowImpl->mpSysObj )
6557 [ # # ][ # # ]: 0 : mpWindowImpl->mpSysObj->Enable( !mpWindowImpl->mbDisabled && bEnable );
6558 : : }
6559 : : }
6560 : :
6561 : : // #i56102# restore app focus win in case the
6562 : : // window was disabled when the frame focus changed
6563 : 11134 : ImplSVData* pSVData = ImplGetSVData();
6564 [ + + ][ + + ]: 11134 : if( bEnable &&
[ - + ][ + + ]
6565 : : pSVData->maWinData.mpFocusWin == NULL &&
6566 : : mpWindowImpl->mpFrameData->mbHasFocus &&
6567 : : mpWindowImpl->mpFrameData->mpFocusWin == this )
6568 : 0 : pSVData->maWinData.mpFocusWin = this;
6569 : :
6570 [ + + ][ - + ]: 11134 : if ( bChild || mpWindowImpl->mbChildNotify )
6571 : : {
6572 : 9888 : Window* pChild = mpWindowImpl->mpFirstChild;
6573 [ + + ]: 18464 : while ( pChild )
6574 : : {
6575 : 8576 : pChild->EnableInput( bEnable, bChild );
6576 : 8576 : pChild = pChild->mpWindowImpl->mpNext;
6577 : : }
6578 : : }
6579 : :
6580 [ + + ]: 11134 : if ( IsReallyVisible() )
6581 : 4752 : ImplGenerateMouseMove();
6582 : :
6583 : : // #104827# notify parent
6584 [ + + ]: 11134 : if ( bNotify )
6585 : : {
6586 [ + + ][ + - ]: 2140 : NotifyEvent aNEvt( bEnable ? EVENT_INPUTENABLE : EVENT_INPUTDISABLE, this );
6587 [ + - ]: 2140 : Notify( aNEvt );
6588 : : }
6589 : 11134 : }
6590 : :
6591 : : // -----------------------------------------------------------------------
6592 : :
6593 : 0 : void Window::EnableInput( sal_Bool bEnable, sal_Bool bChild, sal_Bool bSysWin,
6594 : : const Window* pExcludeWindow )
6595 : : {
6596 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
6597 : :
6598 : 0 : EnableInput( bEnable, bChild );
6599 [ # # ]: 0 : if ( bSysWin )
6600 : : {
6601 : : // pExculeWindow is the first Overlap-Frame --> if this
6602 : : // shouldn't be the case, than this must be changed in dialog.cxx
6603 [ # # ]: 0 : if( pExcludeWindow )
6604 : 0 : pExcludeWindow = pExcludeWindow->ImplGetFirstOverlapWindow();
6605 : 0 : Window* pSysWin = mpWindowImpl->mpFrameWindow->mpWindowImpl->mpFrameData->mpFirstOverlap;
6606 [ # # ]: 0 : while ( pSysWin )
6607 : : {
6608 : : // Is Window in the path from this window
6609 [ # # ]: 0 : if ( ImplGetFirstOverlapWindow()->ImplIsWindowOrChild( pSysWin, sal_True ) )
6610 : : {
6611 : : // Is Window not in the exclude window path or not the
6612 : : // exclude window, than change the status
6613 [ # # ][ # # ]: 0 : if ( !pExcludeWindow || !pExcludeWindow->ImplIsWindowOrChild( pSysWin, sal_True ) )
[ # # ]
6614 : 0 : pSysWin->EnableInput( bEnable, bChild );
6615 : : }
6616 : 0 : pSysWin = pSysWin->mpWindowImpl->mpNextOverlap;
6617 : : }
6618 : :
6619 : : // enable/disable floating system windows as well
6620 : 0 : Window* pFrameWin = ImplGetSVData()->maWinData.mpFirstFrame;
6621 [ # # ]: 0 : while ( pFrameWin )
6622 : : {
6623 [ # # ]: 0 : if( pFrameWin->ImplIsFloatingWindow() )
6624 : : {
6625 : : // Is Window in the path from this window
6626 [ # # ]: 0 : if ( ImplGetFirstOverlapWindow()->ImplIsWindowOrChild( pFrameWin, sal_True ) )
6627 : : {
6628 : : // Is Window not in the exclude window path or not the
6629 : : // exclude window, than change the status
6630 [ # # ][ # # ]: 0 : if ( !pExcludeWindow || !pExcludeWindow->ImplIsWindowOrChild( pFrameWin, sal_True ) )
[ # # ]
6631 : 0 : pFrameWin->EnableInput( bEnable, bChild );
6632 : : }
6633 : : }
6634 : 0 : pFrameWin = pFrameWin->mpWindowImpl->mpFrameData->mpNextFrame;
6635 : : }
6636 : :
6637 : : // the same for ownerdraw floating windows
6638 [ # # ]: 0 : if( mpWindowImpl->mbFrame )
6639 : : {
6640 : 0 : ::std::vector< Window* >& rList = mpWindowImpl->mpFrameData->maOwnerDrawList;
6641 : 0 : ::std::vector< Window* >::iterator p = rList.begin();
6642 [ # # ][ # # ]: 0 : while( p != rList.end() )
6643 : : {
6644 : : // Is Window in the path from this window
6645 [ # # ][ # # ]: 0 : if ( ImplGetFirstOverlapWindow()->ImplIsWindowOrChild( (*p), sal_True ) )
[ # # ][ # # ]
6646 : : {
6647 : : // Is Window not in the exclude window path or not the
6648 : : // exclude window, than change the status
6649 [ # # ][ # # ]: 0 : if ( !pExcludeWindow || !pExcludeWindow->ImplIsWindowOrChild( (*p), sal_True ) )
[ # # ][ # # ]
[ # # ]
6650 [ # # ][ # # ]: 0 : (*p)->EnableInput( bEnable, bChild );
6651 : : }
6652 [ # # ]: 0 : ++p;
6653 : : }
6654 : : }
6655 : : }
6656 : 0 : }
6657 : :
6658 : : // -----------------------------------------------------------------------
6659 : :
6660 : 0 : void Window::AlwaysEnableInput( sal_Bool bAlways, sal_Bool bChild )
6661 : : {
6662 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
6663 : :
6664 [ # # ]: 0 : if ( mpWindowImpl->mpBorderWindow )
6665 : 0 : mpWindowImpl->mpBorderWindow->AlwaysEnableInput( bAlways, sal_False );
6666 : :
6667 [ # # ][ # # ]: 0 : if( bAlways && mpWindowImpl->meAlwaysInputMode != AlwaysInputEnabled )
6668 : : {
6669 : 0 : mpWindowImpl->meAlwaysInputMode = AlwaysInputEnabled;
6670 : :
6671 [ # # ]: 0 : if ( bAlways )
6672 : 0 : EnableInput( sal_True, sal_False );
6673 : : }
6674 [ # # ][ # # ]: 0 : else if( ! bAlways && mpWindowImpl->meAlwaysInputMode == AlwaysInputEnabled )
6675 : : {
6676 : 0 : mpWindowImpl->meAlwaysInputMode = AlwaysInputNone;
6677 : : }
6678 : :
6679 [ # # ][ # # ]: 0 : if ( bChild || mpWindowImpl->mbChildNotify )
6680 : : {
6681 : 0 : Window* pChild = mpWindowImpl->mpFirstChild;
6682 [ # # ]: 0 : while ( pChild )
6683 : : {
6684 : 0 : pChild->AlwaysEnableInput( bAlways, bChild );
6685 : 0 : pChild = pChild->mpWindowImpl->mpNext;
6686 : : }
6687 : : }
6688 : 0 : }
6689 : :
6690 : : // -----------------------------------------------------------------------
6691 : :
6692 : 36 : void Window::AlwaysDisableInput( sal_Bool bAlways, sal_Bool bChild )
6693 : : {
6694 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
6695 : :
6696 [ - + ]: 36 : if ( mpWindowImpl->mpBorderWindow )
6697 : 0 : mpWindowImpl->mpBorderWindow->AlwaysDisableInput( bAlways, sal_False );
6698 : :
6699 [ + - ][ + - ]: 36 : if( bAlways && mpWindowImpl->meAlwaysInputMode != AlwaysInputDisabled )
6700 : : {
6701 : 36 : mpWindowImpl->meAlwaysInputMode = AlwaysInputDisabled;
6702 : :
6703 [ + - ]: 72 : if ( bAlways )
6704 : 36 : EnableInput( sal_False, sal_False );
6705 : : }
6706 [ # # ][ # # ]: 0 : else if( ! bAlways && mpWindowImpl->meAlwaysInputMode == AlwaysInputDisabled )
6707 : : {
6708 : 0 : mpWindowImpl->meAlwaysInputMode = AlwaysInputNone;
6709 : : }
6710 : :
6711 [ - + ][ # # ]: 36 : if ( bChild || mpWindowImpl->mbChildNotify )
6712 : : {
6713 : 36 : Window* pChild = mpWindowImpl->mpFirstChild;
6714 [ - + ]: 36 : while ( pChild )
6715 : : {
6716 : 0 : pChild->AlwaysDisableInput( bAlways, bChild );
6717 : 0 : pChild = pChild->mpWindowImpl->mpNext;
6718 : : }
6719 : : }
6720 : 36 : }
6721 : :
6722 : : // -----------------------------------------------------------------------
6723 : :
6724 : 11940 : void Window::SetActivateMode( sal_uInt16 nMode )
6725 : : {
6726 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
6727 : :
6728 [ + + ]: 11940 : if ( mpWindowImpl->mpBorderWindow )
6729 : 5952 : mpWindowImpl->mpBorderWindow->SetActivateMode( nMode );
6730 : :
6731 [ + + ]: 11940 : if ( mpWindowImpl->mnActivateMode != nMode )
6732 : : {
6733 : 5986 : mpWindowImpl->mnActivateMode = nMode;
6734 : :
6735 : : // possibly trigger Decativate/Activate
6736 [ + + ]: 5986 : if ( mpWindowImpl->mnActivateMode )
6737 : : {
6738 [ + - ]: 4260 : if ( (mpWindowImpl->mbActive || (GetType() == WINDOW_BORDERWINDOW)) &&
[ + - + - ]
[ + - ]
6739 : 2130 : !HasChildPathFocus( sal_True ) )
6740 : : {
6741 : 2130 : mpWindowImpl->mbActive = sal_False;
6742 : 2130 : Deactivate();
6743 : : }
6744 : : }
6745 : : else
6746 : : {
6747 [ - + ][ # # ]: 3856 : if ( !mpWindowImpl->mbActive || (GetType() == WINDOW_BORDERWINDOW) )
[ + - ]
6748 : : {
6749 : 3856 : mpWindowImpl->mbActive = sal_True;
6750 : 3856 : Activate();
6751 : : }
6752 : : }
6753 : : }
6754 : 11940 : }
6755 : :
6756 : : // -----------------------------------------------------------------------
6757 : :
6758 : 1501 : void Window::ToTop( sal_uInt16 nFlags )
6759 : : {
6760 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
6761 : :
6762 : 1501 : ImplStartToTop( nFlags );
6763 : 1501 : ImplFocusToTop( nFlags, IsReallyVisible() );
6764 : 1501 : }
6765 : :
6766 : : // -----------------------------------------------------------------------
6767 : :
6768 : 166 : void Window::SetZOrder( Window* pRefWindow, sal_uInt16 nFlags )
6769 : : {
6770 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
6771 : :
6772 [ + + ]: 166 : if ( mpWindowImpl->mpBorderWindow )
6773 : : {
6774 : 2 : mpWindowImpl->mpBorderWindow->SetZOrder( pRefWindow, nFlags );
6775 : 2 : return;
6776 : : }
6777 : :
6778 [ + + ]: 164 : if ( nFlags & WINDOW_ZORDER_FIRST )
6779 : : {
6780 [ - + ]: 78 : if ( ImplIsOverlapWindow() )
6781 : 0 : pRefWindow = mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpFirstOverlap;
6782 : : else
6783 : 78 : pRefWindow = mpWindowImpl->mpParent->mpWindowImpl->mpFirstChild;
6784 : 78 : nFlags |= WINDOW_ZORDER_BEFOR;
6785 : : }
6786 [ - + ]: 86 : else if ( nFlags & WINDOW_ZORDER_LAST )
6787 : : {
6788 [ # # ]: 0 : if ( ImplIsOverlapWindow() )
6789 : 0 : pRefWindow = mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpLastOverlap;
6790 : : else
6791 : 0 : pRefWindow = mpWindowImpl->mpParent->mpWindowImpl->mpLastChild;
6792 : 0 : nFlags |= WINDOW_ZORDER_BEHIND;
6793 : : }
6794 : :
6795 [ + + ]: 166 : while ( pRefWindow->mpWindowImpl->mpBorderWindow )
6796 : 2 : pRefWindow = pRefWindow->mpWindowImpl->mpBorderWindow;
6797 [ + - ][ - + ]: 164 : if ( (pRefWindow == this) || mpWindowImpl->mbFrame )
6798 : 0 : return;
6799 : :
6800 : : DBG_ASSERT( pRefWindow->mpWindowImpl->mpParent == mpWindowImpl->mpParent, "Window::SetZOrder() - pRefWindow has other parent" );
6801 [ + + ]: 164 : if ( nFlags & WINDOW_ZORDER_BEFOR )
6802 : : {
6803 [ - + ]: 78 : if ( pRefWindow->mpWindowImpl->mpPrev == this )
6804 : 0 : return;
6805 : :
6806 [ - + ]: 78 : if ( ImplIsOverlapWindow() )
6807 : : {
6808 [ # # ]: 0 : if ( mpWindowImpl->mpPrev )
6809 : 0 : mpWindowImpl->mpPrev->mpWindowImpl->mpNext = mpWindowImpl->mpNext;
6810 : : else
6811 : 0 : mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpFirstOverlap = mpWindowImpl->mpNext;
6812 [ # # ]: 0 : if ( mpWindowImpl->mpNext )
6813 : 0 : mpWindowImpl->mpNext->mpWindowImpl->mpPrev = mpWindowImpl->mpPrev;
6814 : : else
6815 : 0 : mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpLastOverlap = mpWindowImpl->mpPrev;
6816 [ # # ]: 0 : if ( !pRefWindow->mpWindowImpl->mpPrev )
6817 : 0 : mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpFirstOverlap = this;
6818 : : }
6819 : : else
6820 : : {
6821 [ + - ]: 78 : if ( mpWindowImpl->mpPrev )
6822 : 78 : mpWindowImpl->mpPrev->mpWindowImpl->mpNext = mpWindowImpl->mpNext;
6823 : : else
6824 : 0 : mpWindowImpl->mpParent->mpWindowImpl->mpFirstChild = mpWindowImpl->mpNext;
6825 [ - + ]: 78 : if ( mpWindowImpl->mpNext )
6826 : 0 : mpWindowImpl->mpNext->mpWindowImpl->mpPrev = mpWindowImpl->mpPrev;
6827 : : else
6828 : 78 : mpWindowImpl->mpParent->mpWindowImpl->mpLastChild = mpWindowImpl->mpPrev;
6829 [ + - ]: 78 : if ( !pRefWindow->mpWindowImpl->mpPrev )
6830 : 78 : mpWindowImpl->mpParent->mpWindowImpl->mpFirstChild = this;
6831 : : }
6832 : :
6833 : 78 : mpWindowImpl->mpPrev = pRefWindow->mpWindowImpl->mpPrev;
6834 : 78 : mpWindowImpl->mpNext = pRefWindow;
6835 [ - + ]: 78 : if ( mpWindowImpl->mpPrev )
6836 : 0 : mpWindowImpl->mpPrev->mpWindowImpl->mpNext = this;
6837 : 78 : mpWindowImpl->mpNext->mpWindowImpl->mpPrev = this;
6838 : : }
6839 [ + - ]: 86 : else if ( nFlags & WINDOW_ZORDER_BEHIND )
6840 : : {
6841 [ + + ]: 86 : if ( pRefWindow->mpWindowImpl->mpNext == this )
6842 : 32 : return;
6843 : :
6844 [ - + ]: 54 : if ( ImplIsOverlapWindow() )
6845 : : {
6846 [ # # ]: 0 : if ( mpWindowImpl->mpPrev )
6847 : 0 : mpWindowImpl->mpPrev->mpWindowImpl->mpNext = mpWindowImpl->mpNext;
6848 : : else
6849 : 0 : mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpFirstOverlap = mpWindowImpl->mpNext;
6850 [ # # ]: 0 : if ( mpWindowImpl->mpNext )
6851 : 0 : mpWindowImpl->mpNext->mpWindowImpl->mpPrev = mpWindowImpl->mpPrev;
6852 : : else
6853 : 0 : mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpLastOverlap = mpWindowImpl->mpPrev;
6854 [ # # ]: 0 : if ( !pRefWindow->mpWindowImpl->mpNext )
6855 : 0 : mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpLastOverlap = this;
6856 : : }
6857 : : else
6858 : : {
6859 [ + + ]: 54 : if ( mpWindowImpl->mpPrev )
6860 : 52 : mpWindowImpl->mpPrev->mpWindowImpl->mpNext = mpWindowImpl->mpNext;
6861 : : else
6862 : 2 : mpWindowImpl->mpParent->mpWindowImpl->mpFirstChild = mpWindowImpl->mpNext;
6863 [ + + ]: 54 : if ( mpWindowImpl->mpNext )
6864 : 2 : mpWindowImpl->mpNext->mpWindowImpl->mpPrev = mpWindowImpl->mpPrev;
6865 : : else
6866 : 52 : mpWindowImpl->mpParent->mpWindowImpl->mpLastChild = mpWindowImpl->mpPrev;
6867 [ - + ]: 54 : if ( !pRefWindow->mpWindowImpl->mpNext )
6868 : 0 : mpWindowImpl->mpParent->mpWindowImpl->mpLastChild = this;
6869 : : }
6870 : :
6871 : 54 : mpWindowImpl->mpPrev = pRefWindow;
6872 : 54 : mpWindowImpl->mpNext = pRefWindow->mpWindowImpl->mpNext;
6873 [ + - ]: 54 : if ( mpWindowImpl->mpNext )
6874 : 54 : mpWindowImpl->mpNext->mpWindowImpl->mpPrev = this;
6875 : 54 : mpWindowImpl->mpPrev->mpWindowImpl->mpNext = this;
6876 : : }
6877 : :
6878 [ + + ]: 132 : if ( IsReallyVisible() )
6879 : : {
6880 : : // restore background storage
6881 [ - + ]: 2 : if ( mpWindowImpl->mpFrameData->mpFirstBackWin )
6882 : 0 : ImplInvalidateAllOverlapBackgrounds();
6883 : :
6884 [ - + ][ # # ]: 2 : if ( mpWindowImpl->mbInitWinClipRegion || !mpWindowImpl->maWinClipRegion.IsEmpty() )
[ + - ]
6885 : : {
6886 : 2 : sal_Bool bInitWinClipRegion = mpWindowImpl->mbInitWinClipRegion;
6887 : 2 : ImplSetClipFlag();
6888 : :
6889 : : // When ClipRegion was not initialised, assume
6890 : : // the window has not been sent, therefore do not
6891 : : // trigger any Invalidates. This is an optimisation
6892 : : // for HTML documents with many controls. If this
6893 : : // check gives problems, a flag should be introduced
6894 : : // which tracks whether the window has already been
6895 : : // emitted after Show
6896 [ - + ]: 2 : if ( !bInitWinClipRegion )
6897 : : {
6898 : : // Invalidate all windows which are next to each other
6899 : : // Is INCOMPLETE !!!
6900 [ # # ]: 0 : Rectangle aWinRect( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) );
6901 : 0 : Window* pWindow = NULL;
6902 [ # # ][ # # ]: 0 : if ( ImplIsOverlapWindow() )
6903 : : {
6904 [ # # ]: 0 : if ( mpWindowImpl->mpOverlapWindow )
6905 : 0 : pWindow = mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpFirstOverlap;
6906 : : }
6907 : : else
6908 [ # # ]: 0 : pWindow = ImplGetParent()->mpWindowImpl->mpFirstChild;
6909 : : // Invalidate all windows in front of us and which are covered by us
6910 [ # # ]: 0 : while ( pWindow )
6911 : : {
6912 [ # # ]: 0 : if ( pWindow == this )
6913 : : break;
6914 : : Rectangle aCompRect( Point( pWindow->mnOutOffX, pWindow->mnOutOffY ),
6915 [ # # ]: 0 : Size( pWindow->mnOutWidth, pWindow->mnOutHeight ) );
6916 [ # # ][ # # ]: 0 : if ( aWinRect.IsOver( aCompRect ) )
6917 [ # # ]: 0 : pWindow->Invalidate( INVALIDATE_CHILDREN | INVALIDATE_NOTRANSPARENT );
6918 : 0 : pWindow = pWindow->mpWindowImpl->mpNext;
6919 : : }
6920 : :
6921 : : // If we are covered by a window in the background
6922 : : // we should redraw it
6923 [ # # ]: 166 : while ( pWindow )
6924 : : {
6925 [ # # ]: 0 : if ( pWindow != this )
6926 : : {
6927 : : Rectangle aCompRect( Point( pWindow->mnOutOffX, pWindow->mnOutOffY ),
6928 [ # # ]: 0 : Size( pWindow->mnOutWidth, pWindow->mnOutHeight ) );
6929 [ # # ][ # # ]: 0 : if ( aWinRect.IsOver( aCompRect ) )
6930 : : {
6931 [ # # ]: 0 : Invalidate( INVALIDATE_CHILDREN | INVALIDATE_NOTRANSPARENT );
6932 : : break;
6933 : : }
6934 : : }
6935 : 0 : pWindow = pWindow->mpWindowImpl->mpNext;
6936 : : }
6937 : : }
6938 : : }
6939 : : }
6940 : : }
6941 : :
6942 : : // -----------------------------------------------------------------------
6943 : :
6944 : 0 : void Window::EnableAlwaysOnTop( sal_Bool bEnable )
6945 : : {
6946 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
6947 : :
6948 : 0 : mpWindowImpl->mbAlwaysOnTop = bEnable;
6949 : :
6950 [ # # ]: 0 : if ( mpWindowImpl->mpBorderWindow )
6951 : 0 : mpWindowImpl->mpBorderWindow->EnableAlwaysOnTop( bEnable );
6952 [ # # ][ # # ]: 0 : else if ( bEnable && IsReallyVisible() )
[ # # ]
6953 : 0 : ToTop();
6954 : :
6955 [ # # ]: 0 : if ( mpWindowImpl->mbFrame )
6956 : 0 : mpWindowImpl->mpFrame->SetAlwaysOnTop( bEnable );
6957 : 0 : }
6958 : :
6959 : : // -----------------------------------------------------------------------
6960 : :
6961 : 267241 : void Window::SetPosSizePixel( long nX, long nY,
6962 : : long nWidth, long nHeight, sal_uInt16 nFlags )
6963 : : {
6964 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
6965 : :
6966 : 267241 : sal_Bool bHasValidSize = !mpWindowImpl->mbDefSize;
6967 : :
6968 [ + + ]: 267241 : if ( nFlags & WINDOW_POSSIZE_POS )
6969 : 187649 : mpWindowImpl->mbDefPos = sal_False;
6970 [ + + ]: 267241 : if ( nFlags & WINDOW_POSSIZE_SIZE )
6971 : 242651 : mpWindowImpl->mbDefSize = sal_False;
6972 : :
6973 : : // The top BorderWindow is the window which is to be positioned
6974 : 267241 : Window* pWindow = this;
6975 [ + + ]: 295233 : while ( pWindow->mpWindowImpl->mpBorderWindow )
6976 : 27992 : pWindow = pWindow->mpWindowImpl->mpBorderWindow;
6977 : :
6978 [ + + ]: 267241 : if ( pWindow->mpWindowImpl->mbFrame )
6979 : : {
6980 : : // Note: if we're positioning a frame, the coordinates are interpreted
6981 : : // as being the top-left corner of the window's client area and NOT
6982 : : // as the position of the border ! (due to limitations of several UNIX window managers)
6983 : 5133 : long nOldWidth = pWindow->mnOutWidth;
6984 : :
6985 [ + + ]: 5133 : if ( !(nFlags & WINDOW_POSSIZE_WIDTH) )
6986 : 30 : nWidth = pWindow->mnOutWidth;
6987 [ + + ]: 5133 : if ( !(nFlags & WINDOW_POSSIZE_HEIGHT) )
6988 : 30 : nHeight = pWindow->mnOutHeight;
6989 : :
6990 : :
6991 : 5133 : sal_uInt16 nSysFlags=0;
6992 [ + + ]: 5133 : if( nFlags & WINDOW_POSSIZE_WIDTH )
6993 : 5103 : nSysFlags |= SAL_FRAME_POSSIZE_WIDTH;
6994 [ + + ]: 5133 : if( nFlags & WINDOW_POSSIZE_HEIGHT )
6995 : 5103 : nSysFlags |= SAL_FRAME_POSSIZE_HEIGHT;
6996 [ + + ]: 5133 : if( nFlags & WINDOW_POSSIZE_X )
6997 : : {
6998 : 40 : nSysFlags |= SAL_FRAME_POSSIZE_X;
6999 [ + + ][ - + ]: 40 : if( pWindow->GetParent() && (pWindow->GetStyle() & WB_SYSTEMCHILDWINDOW) )
[ - + ]
7000 : : {
7001 : 0 : Window* pParent = pWindow->GetParent();
7002 : 0 : nX += pParent->mnOutOffX;
7003 : : }
7004 [ + + ][ - + ]: 40 : if( GetParent() && GetParent()->ImplIsAntiparallel() )
[ - + ]
7005 : : {
7006 : : // --- RTL --- (re-mirror at parent window)
7007 [ # # ]: 0 : Rectangle aRect( Point ( nX, nY ), Size( nWidth, nHeight ) );
7008 [ # # ][ # # ]: 0 : GetParent()->ImplReMirror( aRect );
7009 : 0 : nX = aRect.nLeft;
7010 : : }
7011 : : }
7012 [ + + ][ + + ]: 5133 : if( !(nFlags & WINDOW_POSSIZE_X) && bHasValidSize && pWindow->mpWindowImpl->mpFrame->maGeometry.nWidth )
[ + + ]
7013 : : {
7014 : : // --- RTL --- make sure the old right aligned position is not changed
7015 : : // system windows will always grow to the right
7016 [ + - ][ - + ]: 1396 : if( pWindow->GetParent() && pWindow->GetParent()->ImplHasMirroredGraphics() )
[ - + ]
7017 : : {
7018 : 0 : long myWidth = nOldWidth;
7019 [ # # ]: 0 : if( !myWidth )
7020 : 0 : myWidth = mpWindowImpl->mpFrame->GetUnmirroredGeometry().nWidth;
7021 [ # # ]: 0 : if( !myWidth )
7022 : 0 : myWidth = nWidth;
7023 : 0 : nFlags |= WINDOW_POSSIZE_X;
7024 : 0 : nSysFlags |= SAL_FRAME_POSSIZE_X;
7025 : 0 : nX = mpWindowImpl->mpFrame->GetUnmirroredGeometry().nX - pWindow->GetParent()->mpWindowImpl->mpFrame->GetUnmirroredGeometry().nX -
7026 : 0 : mpWindowImpl->mpFrame->GetUnmirroredGeometry().nLeftDecoration;
7027 : 0 : nX = pWindow->GetParent()->mpWindowImpl->mpFrame->GetUnmirroredGeometry().nX - mpWindowImpl->mpFrame->GetUnmirroredGeometry().nLeftDecoration +
7028 : 0 : pWindow->GetParent()->mpWindowImpl->mpFrame->GetUnmirroredGeometry().nWidth - myWidth - 1 - mpWindowImpl->mpFrame->GetUnmirroredGeometry().nX;
7029 [ # # ]: 0 : if(!(nFlags & WINDOW_POSSIZE_Y))
7030 : : {
7031 : 0 : nFlags |= WINDOW_POSSIZE_Y;
7032 : 0 : nSysFlags |= SAL_FRAME_POSSIZE_Y;
7033 : 0 : nY = mpWindowImpl->mpFrame->GetUnmirroredGeometry().nY - pWindow->GetParent()->mpWindowImpl->mpFrame->GetUnmirroredGeometry().nY -
7034 : 0 : mpWindowImpl->mpFrame->GetUnmirroredGeometry().nTopDecoration;
7035 : : }
7036 : : }
7037 : : }
7038 [ + + ]: 5133 : if( nFlags & WINDOW_POSSIZE_Y )
7039 : : {
7040 : 40 : nSysFlags |= SAL_FRAME_POSSIZE_Y;
7041 [ + + ][ - + ]: 40 : if( pWindow->GetParent() && (pWindow->GetStyle() & WB_SYSTEMCHILDWINDOW) )
[ - + ]
7042 : : {
7043 : 0 : Window* pParent = pWindow->GetParent();
7044 : 0 : nY += pParent->mnOutOffY;
7045 : : }
7046 : : }
7047 : :
7048 [ + + ]: 5133 : if( nSysFlags & (SAL_FRAME_POSSIZE_WIDTH|SAL_FRAME_POSSIZE_HEIGHT) )
7049 : : {
7050 : : // check for min/max client size and adjust size accordingly
7051 : : // otherwise it may happen that the resize event is ignored, i.e. the old size remains
7052 : : // unchanged but ImplHandleResize() is called with the wrong size
7053 [ - + ]: 5103 : SystemWindow *pSystemWindow = dynamic_cast< SystemWindow* >( pWindow );
7054 [ + + ]: 5103 : if( pSystemWindow )
7055 : : {
7056 : 176 : Size aMinSize = pSystemWindow->GetMinOutputSizePixel();
7057 [ + - ]: 176 : Size aMaxSize = pSystemWindow->GetMaxOutputSizePixel();
7058 [ - + ]: 176 : if( nWidth < aMinSize.Width() )
7059 : 0 : nWidth = aMinSize.Width();
7060 [ - + ]: 176 : if( nHeight < aMinSize.Height() )
7061 : 0 : nHeight = aMinSize.Height();
7062 : :
7063 [ - + ]: 176 : if( nWidth > aMaxSize.Width() )
7064 : 0 : nWidth = aMaxSize.Width();
7065 [ - + ]: 176 : if( nHeight > aMaxSize.Height() )
7066 : 176 : nHeight = aMaxSize.Height();
7067 : : }
7068 : : }
7069 : :
7070 : 5133 : pWindow->mpWindowImpl->mpFrame->SetPosSize( nX, nY, nWidth, nHeight, nSysFlags );
7071 : :
7072 : : // Resize should be called directly. If we havn't
7073 : : // set the correct size, we get a second resize from
7074 : : // the system with the correct size. This can be happend
7075 : : // if the size is to small or to large.
7076 : 5133 : ImplHandleResize( pWindow, nWidth, nHeight );
7077 : : }
7078 : : else
7079 : : {
7080 : 262108 : pWindow->ImplPosSizeWindow( nX, nY, nWidth, nHeight, nFlags );
7081 [ + + ]: 262108 : if ( IsReallyVisible() )
7082 : 65116 : ImplGenerateMouseMove();
7083 : : }
7084 : 267241 : }
7085 : :
7086 : : // -----------------------------------------------------------------------
7087 : :
7088 : 174392 : Point Window::GetPosPixel() const
7089 : : {
7090 : 174392 : return mpWindowImpl->maPos;
7091 : : }
7092 : :
7093 : : // -----------------------------------------------------------------------
7094 : :
7095 : 11876 : Rectangle Window::GetDesktopRectPixel() const
7096 : : {
7097 : 11876 : Rectangle rRect;
7098 : 11876 : mpWindowImpl->mpFrameWindow->mpWindowImpl->mpFrame->GetWorkArea( rRect );
7099 : 11876 : return rRect;
7100 : : }
7101 : :
7102 : : // -----------------------------------------------------------------------
7103 : :
7104 : 38940 : Point Window::OutputToScreenPixel( const Point& rPos ) const
7105 : : {
7106 : : // relative to top level parent
7107 : 38940 : return Point( rPos.X()+mnOutOffX, rPos.Y()+mnOutOffY );
7108 : : }
7109 : :
7110 : : // -----------------------------------------------------------------------
7111 : :
7112 : 3136 : Point Window::ScreenToOutputPixel( const Point& rPos ) const
7113 : : {
7114 : : // relative to top level parent
7115 : 3136 : return Point( rPos.X()-mnOutOffX, rPos.Y()-mnOutOffY );
7116 : : }
7117 : :
7118 : : // -----------------------------------------------------------------------
7119 : :
7120 : 0 : long Window::ImplGetUnmirroredOutOffX()
7121 : : {
7122 : : // revert mnOutOffX changes that were potentially made in ImplPosSizeWindow
7123 : 0 : long offx = mnOutOffX;
7124 [ # # ]: 0 : if( ImplHasMirroredGraphics() )
7125 : : {
7126 [ # # ][ # # ]: 0 : if( mpWindowImpl->mpParent && !mpWindowImpl->mpParent->mpWindowImpl->mbFrame && mpWindowImpl->mpParent->ImplIsAntiparallel() )
[ # # ][ # # ]
7127 : : {
7128 [ # # ]: 0 : if ( !ImplIsOverlapWindow() )
7129 : 0 : offx -= mpWindowImpl->mpParent->mnOutOffX;
7130 : :
7131 : 0 : offx = mpWindowImpl->mpParent->mnOutWidth - mnOutWidth - offx;
7132 : :
7133 [ # # ]: 0 : if ( !ImplIsOverlapWindow() )
7134 : 0 : offx += mpWindowImpl->mpParent->mnOutOffX;
7135 : :
7136 : : }
7137 : : }
7138 : 0 : return offx;
7139 : : }
7140 : :
7141 : : // normalized screen pixel are independent of mirroring
7142 : 0 : Point Window::OutputToNormalizedScreenPixel( const Point& rPos ) const
7143 : : {
7144 : : // relative to top level parent
7145 : 0 : long offx = ((Window*) this)->ImplGetUnmirroredOutOffX();
7146 : 0 : return Point( rPos.X()+offx, rPos.Y()+mnOutOffY );
7147 : : }
7148 : :
7149 : 0 : Point Window::NormalizedScreenToOutputPixel( const Point& rPos ) const
7150 : : {
7151 : : // relative to top level parent
7152 : 0 : long offx = ((Window*) this)->ImplGetUnmirroredOutOffX();
7153 : 0 : return Point( rPos.X()-offx, rPos.Y()-mnOutOffY );
7154 : : }
7155 : :
7156 : : // -----------------------------------------------------------------------
7157 : :
7158 : 80 : Point Window::OutputToAbsoluteScreenPixel( const Point& rPos ) const
7159 : : {
7160 : : // relative to the screen
7161 [ + - ]: 80 : Point p = OutputToScreenPixel( rPos );
7162 [ + - ]: 80 : SalFrameGeometry g = mpWindowImpl->mpFrame->GetGeometry();
7163 : 80 : p.X() += g.nX;
7164 : 80 : p.Y() += g.nY;
7165 : 80 : return p;
7166 : : }
7167 : :
7168 : : // -----------------------------------------------------------------------
7169 : :
7170 : 2728 : Point Window::AbsoluteScreenToOutputPixel( const Point& rPos ) const
7171 : : {
7172 : : // relative to the screen
7173 [ + - ]: 2728 : Point p = ScreenToOutputPixel( rPos );
7174 [ + - ]: 2728 : SalFrameGeometry g = mpWindowImpl->mpFrame->GetGeometry();
7175 : 2728 : p.X() -= g.nX;
7176 : 2728 : p.Y() -= g.nY;
7177 : 2728 : return p;
7178 : : }
7179 : :
7180 : : // -----------------------------------------------------------------------
7181 : :
7182 : 0 : Rectangle Window::ImplOutputToUnmirroredAbsoluteScreenPixel( const Rectangle &rRect ) const
7183 : : {
7184 : : // this method creates unmirrored screen coordinates to be compared with the desktop
7185 : : // and is used for positioning of RTL popup windows correctly on the screen
7186 : 0 : SalFrameGeometry g = mpWindowImpl->mpFrame->GetUnmirroredGeometry();
7187 : :
7188 [ # # ][ # # ]: 0 : Point p1 = OutputToScreenPixel( rRect.TopRight() );
7189 : 0 : p1.X() = g.nX+g.nWidth-p1.X();
7190 : 0 : p1.Y() += g.nY;
7191 : :
7192 [ # # ][ # # ]: 0 : Point p2 = OutputToScreenPixel( rRect.BottomLeft() );
7193 : 0 : p2.X() = g.nX+g.nWidth-p2.X();
7194 : 0 : p2.Y() += g.nY;
7195 : :
7196 [ # # ]: 0 : return Rectangle( p1, p2 );
7197 : : }
7198 : :
7199 : :
7200 : : // -----------------------------------------------------------------------
7201 : :
7202 : 36614 : Rectangle Window::GetWindowExtentsRelative( Window *pRelativeWindow ) const
7203 : : {
7204 : : // with decoration
7205 : 36614 : return ImplGetWindowExtentsRelative( pRelativeWindow, sal_False );
7206 : : }
7207 : :
7208 : 0 : Rectangle Window::GetClientWindowExtentsRelative( Window *pRelativeWindow ) const
7209 : : {
7210 : : // without decoration
7211 : 0 : return ImplGetWindowExtentsRelative( pRelativeWindow, sal_True );
7212 : : }
7213 : :
7214 : : // -----------------------------------------------------------------------
7215 : :
7216 : 36614 : Rectangle Window::ImplGetWindowExtentsRelative( Window *pRelativeWindow, sal_Bool bClientOnly ) const
7217 : : {
7218 [ + - ]: 36614 : SalFrameGeometry g = mpWindowImpl->mpFrame->GetGeometry();
7219 : : // make sure we use the extent of our border window,
7220 : : // otherwise we miss a few pixels
7221 [ + - ][ + + ]: 36614 : const Window *pWin = (!bClientOnly && mpWindowImpl->mpBorderWindow) ? mpWindowImpl->mpBorderWindow : this;
7222 : :
7223 [ + - ]: 36614 : Point aPos( pWin->OutputToScreenPixel( Point(0,0) ) );
7224 : 36614 : aPos.X() += g.nX;
7225 : 36614 : aPos.Y() += g.nY;
7226 [ + - ]: 36614 : Size aSize ( pWin->GetSizePixel() );
7227 : : // #104088# do not add decoration to the workwindow to be compatible to java accessibility api
7228 [ + - ][ + + ]: 36614 : if( !bClientOnly && (mpWindowImpl->mbFrame || (mpWindowImpl->mpBorderWindow && mpWindowImpl->mpBorderWindow->mpWindowImpl->mbFrame && GetType() != WINDOW_WORKWINDOW)) )
[ + + ][ + + ]
[ + - ][ + + ]
[ + + ]
7229 : : {
7230 : 1844 : aPos.X() -= g.nLeftDecoration;
7231 : 1844 : aPos.Y() -= g.nTopDecoration;
7232 : 1844 : aSize.Width() += g.nLeftDecoration + g.nRightDecoration;
7233 : 1844 : aSize.Height() += g.nTopDecoration + g.nBottomDecoration;
7234 : : }
7235 [ + + ]: 36614 : if( pRelativeWindow )
7236 : : {
7237 : : // #106399# express coordinates relative to borderwindow
7238 [ + - ][ - + ]: 2704 : Window *pRelWin = (!bClientOnly && pRelativeWindow->mpWindowImpl->mpBorderWindow) ? pRelativeWindow->mpWindowImpl->mpBorderWindow : pRelativeWindow;
7239 [ + - ]: 2704 : aPos = pRelWin->AbsoluteScreenToOutputPixel( aPos );
7240 : : }
7241 [ + - ]: 36614 : return Rectangle( aPos, aSize );
7242 : : }
7243 : :
7244 : : // -----------------------------------------------------------------------
7245 : :
7246 : 1471 : void Window::Scroll( long nHorzScroll, long nVertScroll, sal_uInt16 nFlags )
7247 : : {
7248 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
7249 : :
7250 : : ImplScroll( Rectangle( Point( mnOutOffX, mnOutOffY ),
7251 : : Size( mnOutWidth, mnOutHeight ) ),
7252 [ + - ][ + - ]: 1471 : nHorzScroll, nVertScroll, nFlags & ~SCROLL_CLIP );
7253 : 1471 : }
7254 : :
7255 : : // -----------------------------------------------------------------------
7256 : :
7257 : 905 : void Window::Scroll( long nHorzScroll, long nVertScroll,
7258 : : const Rectangle& rRect, sal_uInt16 nFlags )
7259 : : {
7260 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
7261 : :
7262 [ + - ]: 905 : Rectangle aRect = ImplLogicToDevicePixel( rRect );
7263 [ + - ][ + - ]: 905 : aRect.Intersection( Rectangle( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) ) );
7264 [ + - ][ + + ]: 905 : if ( !aRect.IsEmpty() )
7265 [ + - ]: 893 : ImplScroll( aRect, nHorzScroll, nVertScroll, nFlags );
7266 : 905 : }
7267 : :
7268 : : // -----------------------------------------------------------------------
7269 : :
7270 : 171892 : void Window::Invalidate( sal_uInt16 nFlags )
7271 : : {
7272 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
7273 : :
7274 [ + + ][ + + ]: 171892 : if ( !IsDeviceOutputNecessary() || !mnOutWidth || !mnOutHeight )
[ + + ][ + + ]
7275 : 171892 : return;
7276 : :
7277 : 30805 : ImplInvalidate( NULL, nFlags );
7278 : : }
7279 : :
7280 : : // -----------------------------------------------------------------------
7281 : :
7282 : 66538 : void Window::Invalidate( const Rectangle& rRect, sal_uInt16 nFlags )
7283 : : {
7284 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
7285 : :
7286 [ + + ][ + + ]: 66538 : if ( !IsDeviceOutputNecessary() || !mnOutWidth || !mnOutHeight )
[ - + ][ + + ]
7287 : 66538 : return;
7288 : :
7289 [ + - ]: 56610 : Rectangle aRect = ImplLogicToDevicePixel( rRect );
7290 [ + - ][ + + ]: 56610 : if ( !aRect.IsEmpty() )
7291 : : {
7292 [ + - ]: 51820 : Region aRegion( aRect );
7293 [ + - ][ + - ]: 66538 : ImplInvalidate( &aRegion, nFlags );
7294 : : }
7295 : : }
7296 : :
7297 : : // -----------------------------------------------------------------------
7298 : :
7299 : 380 : void Window::Invalidate( const Region& rRegion, sal_uInt16 nFlags )
7300 : : {
7301 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
7302 : :
7303 [ + - ][ + - ]: 380 : if ( !IsDeviceOutputNecessary() || !mnOutWidth || !mnOutHeight )
[ - + ][ - + ]
7304 : 380 : return;
7305 : :
7306 [ - + ]: 380 : if ( rRegion.IsNull() )
7307 : 0 : ImplInvalidate( NULL, nFlags );
7308 : : else
7309 : : {
7310 [ + - ][ + - ]: 380 : Region aRegion = ImplPixelToDevicePixel( LogicToPixel( rRegion ) );
[ + - ]
7311 [ + - ][ + + ]: 380 : if ( !aRegion.IsEmpty() )
7312 [ + - ][ + - ]: 380 : ImplInvalidate( &aRegion, nFlags );
7313 : : }
7314 : : }
7315 : :
7316 : : // -----------------------------------------------------------------------
7317 : :
7318 : 60 : void Window::Validate( sal_uInt16 nFlags )
7319 : : {
7320 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
7321 : :
7322 [ + - ][ + - ]: 60 : if ( !IsDeviceOutputNecessary() || !mnOutWidth || !mnOutHeight )
[ - + ][ - + ]
7323 : 60 : return;
7324 : :
7325 : 60 : ImplValidate( NULL, nFlags );
7326 : : }
7327 : :
7328 : : // -----------------------------------------------------------------------
7329 : :
7330 : 35751 : sal_Bool Window::HasPaintEvent() const
7331 : : {
7332 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
7333 : :
7334 [ + + ]: 35751 : if ( !mpWindowImpl->mbReallyVisible )
7335 : 5569 : return sal_False;
7336 : :
7337 [ + + ]: 30182 : if ( mpWindowImpl->mpFrameWindow->mpWindowImpl->mbPaintFrame )
7338 : 1434 : return sal_True;
7339 : :
7340 [ + + ]: 28748 : if ( mpWindowImpl->mnPaintFlags & IMPL_PAINT_PAINT )
7341 : 7620 : return sal_True;
7342 : :
7343 [ + - ]: 21128 : if ( !ImplIsOverlapWindow() )
7344 : : {
7345 : 21128 : const Window* pTempWindow = this;
7346 [ + + ]: 19187 : do
7347 : : {
7348 : 37077 : pTempWindow = pTempWindow->ImplGetParent();
7349 [ + + ]: 37077 : if ( pTempWindow->mpWindowImpl->mnPaintFlags & (IMPL_PAINT_PAINTCHILDREN | IMPL_PAINT_PAINTALLCHILDREN) )
7350 : 17890 : return sal_True;
7351 : : }
7352 : 19187 : while ( !pTempWindow->ImplIsOverlapWindow() );
7353 : : }
7354 : :
7355 : 35751 : return sal_False;
7356 : : }
7357 : :
7358 : : // -----------------------------------------------------------------------
7359 : :
7360 : 36229 : void Window::Update()
7361 : : {
7362 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
7363 : :
7364 [ + + ]: 36229 : if ( mpWindowImpl->mpBorderWindow )
7365 : : {
7366 : 130 : mpWindowImpl->mpBorderWindow->Update();
7367 : 130 : return;
7368 : : }
7369 : :
7370 [ + + ]: 36099 : if ( !mpWindowImpl->mbReallyVisible )
7371 : 6301 : return;
7372 : :
7373 : 29798 : sal_Bool bFlush = sal_False;
7374 [ + + ]: 29798 : if ( mpWindowImpl->mpFrameWindow->mpWindowImpl->mbPaintFrame )
7375 : : {
7376 : 688 : Point aPoint( 0, 0 );
7377 [ + - ][ + - ]: 688 : Region aRegion( Rectangle( aPoint, Size( mnOutWidth, mnOutHeight ) ) );
7378 [ + - ]: 688 : ImplInvalidateOverlapFrameRegion( aRegion );
7379 [ + + ][ - + ]: 688 : if ( mpWindowImpl->mbFrame || (mpWindowImpl->mpBorderWindow && mpWindowImpl->mpBorderWindow->mpWindowImpl->mbFrame) )
[ # # ]
7380 [ + - ]: 688 : bFlush = sal_True;
7381 : : }
7382 : :
7383 : : // First we should skip all windows which are Paint-Transparent
7384 : 29798 : Window* pUpdateWindow = this;
7385 : 29798 : Window* pWindow = pUpdateWindow;
7386 [ + + ]: 29864 : while ( !pWindow->ImplIsOverlapWindow() )
7387 : : {
7388 [ + + ]: 29862 : if ( !pWindow->mpWindowImpl->mbPaintTransparent )
7389 : : {
7390 : 29796 : pUpdateWindow = pWindow;
7391 : 29796 : break;
7392 : : }
7393 : 66 : pWindow = pWindow->ImplGetParent();
7394 : : }
7395 : : // In order to limit drawing, an update only draws the window which
7396 : : // has PAINTALLCHILDREN set
7397 : 29798 : pWindow = pUpdateWindow;
7398 [ + - ]: 88821 : do
7399 : : {
7400 [ + + ]: 118619 : if ( pWindow->mpWindowImpl->mnPaintFlags & IMPL_PAINT_PAINTALLCHILDREN )
7401 : 6575 : pUpdateWindow = pWindow;
7402 [ + + ]: 118619 : if ( pWindow->ImplIsOverlapWindow() )
7403 : 29798 : break;
7404 : 88821 : pWindow = pWindow->ImplGetParent();
7405 : : }
7406 : : while ( pWindow );
7407 : :
7408 : : // if there is something to paint, trigger a Paint
7409 [ + + ]: 29798 : if ( pUpdateWindow->mpWindowImpl->mnPaintFlags & (IMPL_PAINT_PAINT | IMPL_PAINT_PAINTCHILDREN) )
7410 : : {
7411 : : // trigger an update also for system windows on top of us,
7412 : : // otherwise holes would remain
7413 : 5393 : Window* pUpdateOverlapWindow = ImplGetFirstOverlapWindow()->mpWindowImpl->mpFirstOverlap;
7414 [ - + ]: 5393 : while ( pUpdateOverlapWindow )
7415 : : {
7416 : 0 : pUpdateOverlapWindow->Update();
7417 : 0 : pUpdateOverlapWindow = pUpdateOverlapWindow->mpWindowImpl->mpNext;
7418 : : }
7419 : :
7420 : 5393 : pUpdateWindow->ImplCallPaint( NULL, pUpdateWindow->mpWindowImpl->mnPaintFlags );
7421 : : }
7422 : :
7423 [ + + ]: 29798 : if ( bFlush )
7424 : 36229 : Flush();
7425 : : }
7426 : :
7427 : : // -----------------------------------------------------------------------
7428 : :
7429 : 27209 : void Window::Flush()
7430 : : {
7431 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
7432 : :
7433 [ + - ]: 27209 : const Rectangle aWinRect( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) );
7434 [ + - ]: 27209 : mpWindowImpl->mpFrame->Flush( aWinRect );
7435 : 27209 : }
7436 : :
7437 : : // -----------------------------------------------------------------------
7438 : :
7439 : 0 : void Window::Sync()
7440 : : {
7441 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
7442 : :
7443 : 0 : mpWindowImpl->mpFrame->Sync();
7444 : 0 : }
7445 : :
7446 : : // -----------------------------------------------------------------------
7447 : :
7448 : 256166 : void Window::SetUpdateMode( sal_Bool bUpdate )
7449 : : {
7450 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
7451 : :
7452 : 256166 : mpWindowImpl->mbNoUpdate = !bUpdate;
7453 : 256166 : StateChanged( STATE_CHANGE_UPDATEMODE );
7454 : 256166 : }
7455 : :
7456 : : // -----------------------------------------------------------------------
7457 : :
7458 : 15170 : void Window::GrabFocus()
7459 : : {
7460 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
7461 : :
7462 : 15170 : ImplGrabFocus( 0 );
7463 : 15170 : }
7464 : :
7465 : : // -----------------------------------------------------------------------
7466 : :
7467 : 55359 : sal_Bool Window::HasFocus() const
7468 : : {
7469 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
7470 : :
7471 : : // #107575# the first floating window always has the keyboard focus, see also winproc.cxx: ImplGetKeyInputWindow()
7472 : : // task was shifted to 6.y, so its commented out
7473 : : /*
7474 : : Window* pFocusWin = ImplGetSVData()->maWinData.mpFirstFloat;
7475 : : if( pFocusWin && pFocusWin->mpWindowImpl->mbFloatWin && ((FloatingWindow *)pFocusWin)->GrabsFocus() )
7476 : : pFocusWin = pFocusWin->GetPreferredKeyInputWindow();
7477 : : else
7478 : : pFocusWin = ImplGetSVData()->maWinData.mpFocusWin;
7479 : :
7480 : : return (this == pFocusWin);
7481 : : */
7482 : :
7483 : 55359 : return (this == ImplGetSVData()->maWinData.mpFocusWin);
7484 : : }
7485 : :
7486 : : // -----------------------------------------------------------------------
7487 : :
7488 : 4 : void Window::GrabFocusToDocument()
7489 : : {
7490 : 4 : Window *pWin = this;
7491 [ + - ]: 8 : while( pWin )
7492 : : {
7493 [ + + ]: 8 : if( !pWin->GetParent() )
7494 : : {
7495 : 4 : pWin->ImplGetFrameWindow()->GetWindow( WINDOW_CLIENT )->GrabFocus();
7496 : 4 : return;
7497 : : }
7498 : 4 : pWin = pWin->GetParent();
7499 : : }
7500 : : }
7501 : :
7502 : 0 : void Window::SetFakeFocus( bool bFocus )
7503 : : {
7504 : 0 : ImplGetWindowImpl()->mbFakeFocusSet = bFocus;
7505 : 0 : }
7506 : :
7507 : : // -----------------------------------------------------------------------
7508 : :
7509 : 54866 : sal_Bool Window::HasChildPathFocus( sal_Bool bSystemWindow ) const
7510 : : {
7511 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
7512 : :
7513 : : // #107575#, the first floating window always has the keyboard focus, see also winproc.cxx: ImplGetKeyInputWindow()
7514 : : // task was shifted to 6.y, so its commented out
7515 : : /*
7516 : : Window* pFocusWin = ImplGetSVData()->maWinData.mpFirstFloat;
7517 : : if( pFocusWin && pFocusWin->mpWindowImpl->mbFloatWin && ((FloatingWindow *)pFocusWin)->GrabsFocus() )
7518 : : pFocusWin = pFocusWin->GetPreferredKeyInputWindow();
7519 : : else
7520 : : pFocusWin = ImplGetSVData()->maWinData.mpFocusWin;
7521 : : */
7522 : 54866 : Window* pFocusWin = ImplGetSVData()->maWinData.mpFocusWin;
7523 [ + + ]: 54866 : if ( pFocusWin )
7524 : 41410 : return ImplIsWindowOrChild( pFocusWin, bSystemWindow );
7525 : 54866 : return sal_False;
7526 : : }
7527 : :
7528 : : // -----------------------------------------------------------------------
7529 : :
7530 : 0 : void Window::CaptureMouse()
7531 : : {
7532 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
7533 : :
7534 : 0 : ImplSVData* pSVData = ImplGetSVData();
7535 : :
7536 : : // possibly stop tracking
7537 [ # # ]: 0 : if ( pSVData->maWinData.mpTrackWin != this )
7538 : : {
7539 [ # # ]: 0 : if ( pSVData->maWinData.mpTrackWin )
7540 : 0 : pSVData->maWinData.mpTrackWin->EndTracking( ENDTRACK_CANCEL );
7541 : : }
7542 : :
7543 [ # # ]: 0 : if ( pSVData->maWinData.mpCaptureWin != this )
7544 : : {
7545 : 0 : pSVData->maWinData.mpCaptureWin = this;
7546 : 0 : mpWindowImpl->mpFrame->CaptureMouse( sal_True );
7547 : : }
7548 : 0 : }
7549 : :
7550 : : // -----------------------------------------------------------------------
7551 : :
7552 : 1890 : void Window::ReleaseMouse()
7553 : : {
7554 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
7555 : :
7556 : 1890 : ImplSVData* pSVData = ImplGetSVData();
7557 : :
7558 : : DBG_ASSERTWARNING( pSVData->maWinData.mpCaptureWin == this,
7559 : : "Window::ReleaseMouse(): window doesn't have the mouse capture" );
7560 : :
7561 [ - + ]: 1890 : if ( pSVData->maWinData.mpCaptureWin == this )
7562 : : {
7563 : 0 : pSVData->maWinData.mpCaptureWin = NULL;
7564 : 0 : mpWindowImpl->mpFrame->CaptureMouse( sal_False );
7565 : 0 : ImplGenerateMouseMove();
7566 : : }
7567 : 1890 : }
7568 : :
7569 : : // -----------------------------------------------------------------------
7570 : :
7571 : 35147 : sal_Bool Window::IsMouseCaptured() const
7572 : : {
7573 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
7574 : :
7575 : 35147 : return (this == ImplGetSVData()->maWinData.mpCaptureWin);
7576 : : }
7577 : :
7578 : : // -----------------------------------------------------------------------
7579 : :
7580 : 15345 : void Window::SetPointer( const Pointer& rPointer )
7581 : : {
7582 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
7583 : :
7584 [ + + ]: 15345 : if ( mpWindowImpl->maPointer == rPointer )
7585 : 15345 : return;
7586 : :
7587 : 13876 : mpWindowImpl->maPointer = rPointer;
7588 : :
7589 : : // possibly immediately move pointer
7590 [ + - ][ - + ]: 13876 : if ( !mpWindowImpl->mpFrameData->mbInMouseMove && ImplTestMousePointerSet() )
[ - + ]
7591 : 0 : mpWindowImpl->mpFrame->SetPointer( ImplGetMousePointer() );
7592 : : }
7593 : :
7594 : : // -----------------------------------------------------------------------
7595 : :
7596 : 0 : void Window::EnableChildPointerOverwrite( sal_Bool bOverwrite )
7597 : : {
7598 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
7599 : :
7600 [ # # ]: 0 : if ( mpWindowImpl->mbChildPtrOverwrite == bOverwrite )
7601 : 0 : return;
7602 : :
7603 : 0 : mpWindowImpl->mbChildPtrOverwrite = bOverwrite;
7604 : :
7605 : : // possibly immediately move pointer
7606 [ # # ][ # # ]: 0 : if ( !mpWindowImpl->mpFrameData->mbInMouseMove && ImplTestMousePointerSet() )
[ # # ]
7607 : 0 : mpWindowImpl->mpFrame->SetPointer( ImplGetMousePointer() );
7608 : : }
7609 : :
7610 : : // -----------------------------------------------------------------------
7611 : :
7612 : 0 : void Window::SetPointerPosPixel( const Point& rPos )
7613 : : {
7614 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
7615 : :
7616 [ # # ]: 0 : Point aPos = ImplOutputToFrame( rPos );
7617 [ # # ][ # # ]: 0 : if( ImplHasMirroredGraphics() )
7618 : : {
7619 [ # # ]: 0 : if( !IsRTLEnabled() )
7620 : : {
7621 : : // --- RTL --- (re-mirror mouse pos at this window)
7622 [ # # ]: 0 : ImplReMirror( aPos );
7623 : : }
7624 : : // mirroring is required here, SetPointerPos bypasses SalGraphics
7625 [ # # ]: 0 : mpGraphics->mirror( aPos.X(), this );
7626 : : }
7627 [ # # ][ # # ]: 0 : else if( ImplIsAntiparallel() )
7628 : : {
7629 [ # # ]: 0 : ImplReMirror( aPos );
7630 : : }
7631 [ # # ]: 0 : mpWindowImpl->mpFrame->SetPointerPos( aPos.X(), aPos.Y() );
7632 : 0 : }
7633 : :
7634 : : // -----------------------------------------------------------------------
7635 : :
7636 : 18053 : Point Window::GetPointerPosPixel()
7637 : : {
7638 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
7639 : :
7640 : 18053 : Point aPos( mpWindowImpl->mpFrameData->mnLastMouseX, mpWindowImpl->mpFrameData->mnLastMouseY );
7641 [ + + ][ + - ]: 18053 : if( ImplIsAntiparallel() )
7642 : : {
7643 : : // --- RTL --- (re-mirror mouse pos at this window)
7644 [ + - ]: 18 : ImplReMirror( aPos );
7645 : : }
7646 [ + - ]: 18053 : return ImplFrameToOutput( aPos );
7647 : : }
7648 : :
7649 : : // -----------------------------------------------------------------------
7650 : :
7651 : 0 : Point Window::GetLastPointerPosPixel()
7652 : : {
7653 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
7654 : :
7655 : 0 : Point aPos( mpWindowImpl->mpFrameData->mnBeforeLastMouseX, mpWindowImpl->mpFrameData->mnBeforeLastMouseY );
7656 [ # # ][ # # ]: 0 : if( ImplIsAntiparallel() )
7657 : : {
7658 : : // --- RTL --- (re-mirror mouse pos at this window)
7659 [ # # ]: 0 : ImplReMirror( aPos );
7660 : : }
7661 [ # # ]: 0 : return ImplFrameToOutput( aPos );
7662 : : }
7663 : :
7664 : : // -----------------------------------------------------------------------
7665 : :
7666 : 0 : void Window::ShowPointer( sal_Bool bVisible )
7667 : : {
7668 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
7669 : :
7670 [ # # ]: 0 : if ( mpWindowImpl->mbNoPtrVisible != !bVisible )
7671 : : {
7672 : 0 : mpWindowImpl->mbNoPtrVisible = !bVisible;
7673 : :
7674 : : // possibly immediately move pointer
7675 [ # # ][ # # ]: 0 : if ( !mpWindowImpl->mpFrameData->mbInMouseMove && ImplTestMousePointerSet() )
[ # # ]
7676 : 0 : mpWindowImpl->mpFrame->SetPointer( ImplGetMousePointer() );
7677 : : }
7678 : 0 : }
7679 : :
7680 : : // -----------------------------------------------------------------------
7681 : :
7682 : 477 : Window::PointerState Window::GetPointerState()
7683 : : {
7684 : 477 : PointerState aState;
7685 : 477 : aState.mnState = 0;
7686 : :
7687 [ + - ]: 477 : if (mpWindowImpl->mpFrame)
7688 : : {
7689 [ + - ]: 477 : SalFrame::SalPointerState aSalPointerState;
7690 : :
7691 [ + - ]: 477 : aSalPointerState = mpWindowImpl->mpFrame->GetPointerState();
7692 [ + - ][ - + ]: 477 : if( ImplIsAntiparallel() )
7693 : : {
7694 : : // --- RTL --- (re-mirror mouse pos at this window)
7695 [ # # ]: 0 : ImplReMirror( aSalPointerState.maPos );
7696 : : }
7697 [ + - ]: 477 : aState.maPos = ImplFrameToOutput( aSalPointerState.maPos );
7698 : 477 : aState.mnState = aSalPointerState.mnState;
7699 : : }
7700 : 477 : return aState;
7701 : : }
7702 : :
7703 : : // -----------------------------------------------------------------------
7704 : :
7705 : 13468 : sal_Bool Window::IsMouseOver()
7706 : : {
7707 : 13468 : return ImplGetWinData()->mbMouseOver;
7708 : : }
7709 : :
7710 : : // -----------------------------------------------------------------------
7711 : :
7712 : 824 : void Window::EnterWait()
7713 : : {
7714 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
7715 : :
7716 : 824 : mpWindowImpl->mnWaitCount++;
7717 : :
7718 [ + + ]: 824 : if ( mpWindowImpl->mnWaitCount == 1 )
7719 : : {
7720 : : // possibly immediately move pointer
7721 [ + - ][ - + ]: 644 : if ( !mpWindowImpl->mpFrameData->mbInMouseMove && ImplTestMousePointerSet() )
[ - + ]
7722 : 0 : mpWindowImpl->mpFrame->SetPointer( ImplGetMousePointer() );
7723 : : }
7724 : 824 : }
7725 : :
7726 : : // -----------------------------------------------------------------------
7727 : :
7728 : 824 : void Window::LeaveWait()
7729 : : {
7730 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
7731 : :
7732 [ + - ]: 824 : if ( mpWindowImpl->mnWaitCount )
7733 : : {
7734 : 824 : mpWindowImpl->mnWaitCount--;
7735 : :
7736 [ + + ]: 824 : if ( !mpWindowImpl->mnWaitCount )
7737 : : {
7738 : : // possibly immediately move pointer
7739 [ + - ][ - + ]: 644 : if ( !mpWindowImpl->mpFrameData->mbInMouseMove && ImplTestMousePointerSet() )
[ - + ]
7740 : 0 : mpWindowImpl->mpFrame->SetPointer( ImplGetMousePointer() );
7741 : : }
7742 : : }
7743 : 824 : }
7744 : :
7745 : : // -----------------------------------------------------------------------
7746 : :
7747 : 17980 : void Window::SetCursor( Cursor* pCursor )
7748 : : {
7749 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
7750 : :
7751 [ + - ]: 17980 : if ( mpWindowImpl->mpCursor != pCursor )
7752 : : {
7753 [ + + ]: 17980 : if ( mpWindowImpl->mpCursor )
7754 : 8929 : mpWindowImpl->mpCursor->ImplHide();
7755 : 17980 : mpWindowImpl->mpCursor = pCursor;
7756 [ + + ]: 17980 : if ( pCursor )
7757 : 9051 : pCursor->ImplShow();
7758 : : }
7759 : 17980 : }
7760 : :
7761 : : // -----------------------------------------------------------------------
7762 : :
7763 : 15788 : void Window::SetText( const XubString& rStr )
7764 : : {
7765 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
7766 : :
7767 [ + - ]: 15788 : String oldTitle( mpWindowImpl->maText );
7768 [ + - ]: 15788 : mpWindowImpl->maText = rStr;
7769 : :
7770 [ + + ]: 15788 : if ( mpWindowImpl->mpBorderWindow )
7771 [ + - ]: 5446 : mpWindowImpl->mpBorderWindow->SetText( rStr );
7772 [ + + ]: 10342 : else if ( mpWindowImpl->mbFrame )
7773 [ + - ][ + - ]: 5434 : mpWindowImpl->mpFrame->SetTitle( rStr );
7774 : :
7775 [ + - ]: 15788 : ImplCallEventListeners( VCLEVENT_WINDOW_FRAMETITLECHANGED, &oldTitle );
7776 : :
7777 : : // #107247# needed for accessibility
7778 : : // The VCLEVENT_WINDOW_FRAMETITLECHANGED is (mis)used to notify accessible name changes.
7779 : : // Therefore a window, which is labeled by this window, must also notify an accessible
7780 : : // name change.
7781 [ + - ][ + + ]: 15788 : if ( IsReallyVisible() )
7782 : : {
7783 [ + - ]: 7602 : Window* pWindow = GetAccessibleRelationLabelFor();
7784 [ - + ][ # # ]: 7602 : if ( pWindow && pWindow != this )
7785 [ # # ]: 0 : pWindow->ImplCallEventListeners( VCLEVENT_WINDOW_FRAMETITLECHANGED, &oldTitle );
7786 : : }
7787 : :
7788 [ + - ][ + - ]: 15788 : StateChanged( STATE_CHANGE_TEXT );
7789 : 15788 : }
7790 : :
7791 : : // -----------------------------------------------------------------------
7792 : :
7793 : 39686 : String Window::GetText() const
7794 : : {
7795 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
7796 : :
7797 : 39686 : return mpWindowImpl->maText;
7798 : : }
7799 : :
7800 : : // -----------------------------------------------------------------------
7801 : :
7802 : 0 : String Window::GetDisplayText() const
7803 : : {
7804 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
7805 : :
7806 : 0 : return GetText();
7807 : : }
7808 : :
7809 : : // -----------------------------------------------------------------------
7810 : :
7811 : 4324 : const Wallpaper& Window::GetDisplayBackground() const
7812 : : {
7813 : : // FIXME: fix issue 52349, need to fix this really in
7814 : : // all NWF enabled controls
7815 [ - + ]: 4324 : const ToolBox* pTB = dynamic_cast<const ToolBox*>(this);
7816 [ + + ]: 4324 : if( pTB )
7817 : : {
7818 [ + - ]: 4160 : if( IsNativeWidgetEnabled() )
7819 : 4160 : return pTB->ImplGetToolBoxPrivateData()->maDisplayBackground;
7820 : : }
7821 : :
7822 [ + + ]: 164 : if( !IsBackground() )
7823 : : {
7824 [ + - ]: 12 : if( mpWindowImpl->mpParent )
7825 : 12 : return mpWindowImpl->mpParent->GetDisplayBackground();
7826 : : }
7827 : :
7828 : 152 : const Wallpaper& rBack = GetBackground();
7829 [ # # ][ - + ]: 456 : if( ! rBack.IsBitmap() &&
[ + - + -
- + ]
7830 : 152 : ! rBack.IsGradient() &&
7831 : 152 : rBack.GetColor().GetColor() == COL_TRANSPARENT &&
7832 : : mpWindowImpl->mpParent )
7833 : 0 : return mpWindowImpl->mpParent->GetDisplayBackground();
7834 : 4324 : return rBack;
7835 : : }
7836 : :
7837 : : // -----------------------------------------------------------------------
7838 : :
7839 : 1376 : const XubString& Window::GetHelpText() const
7840 : : {
7841 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
7842 : :
7843 [ + - ][ + - ]: 1376 : String aStrHelpId( rtl::OStringToOUString( GetHelpId(), RTL_TEXTENCODING_UTF8 ) );
[ + - ]
7844 : 1376 : bool bStrHelpId = (aStrHelpId.Len() > 0);
7845 : :
7846 [ + + ][ + + ]: 1376 : if ( !mpWindowImpl->maHelpText.Len() && bStrHelpId )
[ + + ]
7847 : : {
7848 [ + - ][ + - ]: 50 : if ( !IsDialog() && (mpWindowImpl->mnType != WINDOW_TABPAGE) && (mpWindowImpl->mnType != WINDOW_FLOATINGWINDOW) )
[ + - ][ + - ]
[ + - ]
7849 : : {
7850 [ + - ]: 50 : Help* pHelp = Application::GetHelp();
7851 [ + - ]: 50 : if ( pHelp )
7852 : : {
7853 [ + - ][ + - ]: 50 : ((Window*)this)->mpWindowImpl->maHelpText = pHelp->GetHelpText( aStrHelpId, this );
[ + - ]
7854 : 50 : mpWindowImpl->mbHelpTextDynamic = sal_False;
7855 : : }
7856 : : }
7857 : : }
7858 [ - + ][ # # ]: 1326 : else if( mpWindowImpl->mbHelpTextDynamic && bStrHelpId )
7859 : : {
7860 [ # # ][ # # ]: 0 : static const char* pEnv = getenv( "HELP_DEBUG" );
7861 [ # # ][ # # ]: 0 : if( pEnv && *pEnv )
7862 : : {
7863 : 0 : rtl::OUStringBuffer aTxt( 64+mpWindowImpl->maHelpText.Len() );
7864 [ # # ][ # # ]: 0 : aTxt.append( mpWindowImpl->maHelpText );
7865 [ # # ]: 0 : aTxt.appendAscii( "\n------------------\n" );
7866 [ # # ][ # # ]: 0 : aTxt.append( rtl::OUString( aStrHelpId ) );
7867 [ # # ][ # # ]: 0 : mpWindowImpl->maHelpText = aTxt.makeStringAndClear();
7868 : : }
7869 : 0 : mpWindowImpl->mbHelpTextDynamic = sal_False;
7870 : : }
7871 : :
7872 [ + - ]: 1376 : return mpWindowImpl->maHelpText;
7873 : : }
7874 : :
7875 : : // -----------------------------------------------------------------------
7876 : :
7877 : 0 : Window* Window::FindWindow( const Point& rPos ) const
7878 : : {
7879 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
7880 : :
7881 [ # # ]: 0 : Point aPos = OutputToScreenPixel( rPos );
7882 [ # # ]: 0 : return ((Window*)this)->ImplFindWindow( aPos );
7883 : : }
7884 : :
7885 : : // -----------------------------------------------------------------------
7886 : :
7887 : 653 : sal_uInt16 Window::GetChildCount() const
7888 : : {
7889 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
7890 : :
7891 : 653 : sal_uInt16 nChildCount = 0;
7892 : 653 : Window* pChild = mpWindowImpl->mpFirstChild;
7893 [ + + ]: 728 : while ( pChild )
7894 : : {
7895 : 75 : nChildCount++;
7896 : 75 : pChild = pChild->mpWindowImpl->mpNext;
7897 : : }
7898 : :
7899 : 653 : return nChildCount;
7900 : : }
7901 : :
7902 : : // -----------------------------------------------------------------------
7903 : :
7904 : 61 : Window* Window::GetChild( sal_uInt16 nChild ) const
7905 : : {
7906 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
7907 : :
7908 : 61 : sal_uInt16 nChildCount = 0;
7909 : 61 : Window* pChild = mpWindowImpl->mpFirstChild;
7910 [ + - ]: 61 : while ( pChild )
7911 : : {
7912 [ + - ]: 61 : if ( nChild == nChildCount )
7913 : 61 : return pChild;
7914 : 0 : pChild = pChild->mpWindowImpl->mpNext;
7915 : 0 : nChildCount++;
7916 : : }
7917 : :
7918 : 61 : return NULL;
7919 : : }
7920 : :
7921 : : // -----------------------------------------------------------------------
7922 : :
7923 : 803881 : Window* Window::GetWindow( sal_uInt16 nType ) const
7924 : : {
7925 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
7926 : :
7927 [ - + + + : 803881 : switch ( nType )
+ + - + -
+ - - + +
- - - - ]
7928 : : {
7929 : : case WINDOW_PARENT:
7930 : 0 : return mpWindowImpl->mpRealParent;
7931 : :
7932 : : case WINDOW_FIRSTCHILD:
7933 : 214229 : return mpWindowImpl->mpFirstChild;
7934 : :
7935 : : case WINDOW_LASTCHILD:
7936 : 13767 : return mpWindowImpl->mpLastChild;
7937 : :
7938 : : case WINDOW_PREV:
7939 : 6065 : return mpWindowImpl->mpPrev;
7940 : :
7941 : : case WINDOW_NEXT:
7942 : 152846 : return mpWindowImpl->mpNext;
7943 : :
7944 : : case WINDOW_FIRSTOVERLAP:
7945 : 120305 : return mpWindowImpl->mpFirstOverlap;
7946 : :
7947 : : case WINDOW_LASTOVERLAP:
7948 : 0 : return mpWindowImpl->mpLastOverlap;
7949 : :
7950 : : case WINDOW_OVERLAP:
7951 [ + + ]: 120305 : if ( ImplIsOverlapWindow() )
7952 : 5708 : return (Window*)this;
7953 : : else
7954 : 114597 : return mpWindowImpl->mpOverlapWindow;
7955 : :
7956 : : case WINDOW_PARENTOVERLAP:
7957 [ # # ]: 0 : if ( ImplIsOverlapWindow() )
7958 : 0 : return mpWindowImpl->mpOverlapWindow;
7959 : : else
7960 : 0 : return mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpOverlapWindow;
7961 : :
7962 : : case WINDOW_CLIENT:
7963 : 25471 : return ((Window*)this)->ImplGetWindow();
7964 : :
7965 : : case WINDOW_REALPARENT:
7966 : 0 : return ImplGetParent();
7967 : :
7968 : : case WINDOW_FRAME:
7969 : 0 : return mpWindowImpl->mpFrameWindow;
7970 : :
7971 : : case WINDOW_BORDER:
7972 [ + + ]: 30588 : if ( mpWindowImpl->mpBorderWindow )
7973 : 12739 : return mpWindowImpl->mpBorderWindow->GetWindow( WINDOW_BORDER );
7974 : 17849 : return (Window*)this;
7975 : :
7976 : : case WINDOW_FIRSTTOPWINDOWCHILD:
7977 [ + - ][ # # ]: 120305 : return ImplGetWinData()->maTopWindowChildren.empty() ? NULL : *ImplGetWinData()->maTopWindowChildren.begin();
[ # # ][ - + ]
[ # # ]
7978 : :
7979 : : case WINDOW_LASTTOPWINDOWCHILD:
7980 [ # # ][ # # ]: 0 : return ImplGetWinData()->maTopWindowChildren.empty() ? NULL : *ImplGetWinData()->maTopWindowChildren.rbegin();
[ # # ][ # # ]
[ # # ]
7981 : :
7982 : : case WINDOW_PREVTOPWINDOWSIBLING:
7983 : : {
7984 [ # # ]: 0 : if ( !mpWindowImpl->mpRealParent )
7985 : 0 : return NULL;
7986 [ # # ]: 0 : const ::std::list< Window* >& rTopWindows( mpWindowImpl->mpRealParent->ImplGetWinData()->maTopWindowChildren );
7987 : : ::std::list< Window* >::const_iterator myPos =
7988 [ # # ]: 0 : ::std::find( rTopWindows.begin(), rTopWindows.end(), this );
7989 [ # # ][ # # ]: 0 : if ( myPos == rTopWindows.end() )
7990 : 0 : return NULL;
7991 [ # # ][ # # ]: 0 : if ( myPos == rTopWindows.begin() )
7992 : 0 : return NULL;
7993 [ # # ][ # # ]: 0 : return *--myPos;
7994 : : }
7995 : :
7996 : : case WINDOW_NEXTTOPWINDOWSIBLING:
7997 : : {
7998 [ # # ]: 0 : if ( !mpWindowImpl->mpRealParent )
7999 : 0 : return NULL;
8000 [ # # ]: 0 : const ::std::list< Window* >& rTopWindows( mpWindowImpl->mpRealParent->ImplGetWinData()->maTopWindowChildren );
8001 : : ::std::list< Window* >::const_iterator myPos =
8002 [ # # ]: 0 : ::std::find( rTopWindows.begin(), rTopWindows.end(), this );
8003 [ # # ][ # # ]: 0 : if ( ( myPos == rTopWindows.end() ) || ( ++myPos == rTopWindows.end() ) )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # #
# # # # ]
8004 : 0 : return NULL;
8005 [ # # ]: 0 : return *myPos;
8006 : : }
8007 : :
8008 : : }
8009 : :
8010 : 803881 : return NULL;
8011 : : }
8012 : :
8013 : : // -----------------------------------------------------------------------
8014 : :
8015 : 440 : sal_Bool Window::IsChild( const Window* pWindow, sal_Bool bSystemWindow ) const
8016 : : {
8017 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
8018 : : DBG_CHKOBJ( pWindow, Window, ImplDbgCheckWindow );
8019 : :
8020 [ + + ]: 440 : do
8021 : : {
8022 [ - + ][ # # ]: 440 : if ( !bSystemWindow && pWindow->ImplIsOverlapWindow() )
[ - + ]
8023 : 0 : break;
8024 : :
8025 : 440 : pWindow = pWindow->ImplGetParent();
8026 : :
8027 [ - + ]: 440 : if ( pWindow == this )
8028 : 0 : return sal_True;
8029 : : }
8030 : : while ( pWindow );
8031 : :
8032 : 110 : return sal_False;
8033 : : }
8034 : :
8035 : : // -----------------------------------------------------------------------
8036 : :
8037 : 29286 : sal_Bool Window::IsWindowOrChild( const Window* pWindow, sal_Bool bSystemWindow ) const
8038 : : {
8039 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
8040 : : DBG_CHKOBJ( pWindow, Window, ImplDbgCheckWindow );
8041 : :
8042 [ - + ]: 29286 : if ( this == pWindow )
8043 : 0 : return sal_True;
8044 : 29286 : return ImplIsChild( pWindow, bSystemWindow );
8045 : : }
8046 : :
8047 : : // -----------------------------------------------------------------------
8048 : :
8049 : 3371 : const SystemEnvData* Window::GetSystemData() const
8050 : : {
8051 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
8052 : :
8053 [ + - ]: 3371 : return mpWindowImpl->mpFrame ? mpWindowImpl->mpFrame->GetSystemData() : NULL;
8054 : : }
8055 : :
8056 : 0 : ::com::sun::star::uno::Any Window::GetSystemDataAny() const
8057 : : {
8058 : 0 : ::com::sun::star::uno::Any aRet;
8059 [ # # ]: 0 : const SystemEnvData* pSysData = GetSystemData();
8060 [ # # ]: 0 : if( pSysData )
8061 : : {
8062 [ # # ]: 0 : ::com::sun::star::uno::Sequence< sal_Int8 > aSeq( (sal_Int8*)pSysData, pSysData->nSize );
8063 [ # # ][ # # ]: 0 : aRet <<= aSeq;
8064 : : }
8065 : 0 : return aRet;
8066 : : }
8067 : :
8068 : : // -----------------------------------------------------------------------
8069 : :
8070 : 77850 : void Window::SetWindowPeer( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xPeer, VCLXWindow* pVCLXWindow )
8071 : : {
8072 : : // be safe against re-entrance: first clear the old ref, then assign the new one
8073 : : // #133706# / 2006-03-30 / frank.schoenheit@sun.com
8074 : 77850 : mpWindowImpl->mxWindowPeer.clear();
8075 : 77850 : mpWindowImpl->mxWindowPeer = xPeer;
8076 : :
8077 : 77850 : mpWindowImpl->mpVCLXWindow = pVCLXWindow;
8078 : 77850 : }
8079 : :
8080 : : // -----------------------------------------------------------------------
8081 : :
8082 : 270923 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > Window::GetComponentInterface( sal_Bool bCreate )
8083 : : {
8084 [ + + ][ + + ]: 270923 : if ( !mpWindowImpl->mxWindowPeer.is() && bCreate )
[ + + ]
8085 : : {
8086 : 37176 : UnoWrapperBase* pWrapper = Application::GetUnoWrapper();
8087 [ + - ]: 37176 : if ( pWrapper )
8088 [ + - ]: 37176 : mpWindowImpl->mxWindowPeer = pWrapper->GetWindowInterface( this, sal_True );
8089 : : }
8090 : 270923 : return mpWindowImpl->mxWindowPeer;
8091 : : }
8092 : :
8093 : : // -----------------------------------------------------------------------
8094 : :
8095 : 2430 : void Window::SetComponentInterface( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xIFace )
8096 : : {
8097 : 2430 : UnoWrapperBase* pWrapper = Application::GetUnoWrapper();
8098 : : DBG_ASSERT( pWrapper, "SetComponentInterface: No Wrapper!" );
8099 [ + - ]: 2430 : if ( pWrapper )
8100 [ + - ]: 2430 : pWrapper->SetWindowInterface( this, xIFace );
8101 : 2430 : }
8102 : :
8103 : : // -----------------------------------------------------------------------
8104 : :
8105 : 17679 : void Window::ImplCallDeactivateListeners( Window *pNew )
8106 : : {
8107 : : // no deactivation if the the newly activated window is my child
8108 [ + + ][ + + ]: 17679 : if ( !pNew || !ImplIsChild( pNew ) )
[ + + ]
8109 : : {
8110 [ + - ]: 10541 : ImplDelData aDogtag( this );
8111 [ + - ]: 10541 : ImplCallEventListeners( VCLEVENT_WINDOW_DEACTIVATE );
8112 [ - + ]: 10541 : if( aDogtag.IsDead() )
8113 : 17679 : return;
8114 : :
8115 : : // #100759#, avoid walking the wrong frame's hierarchy
8116 : : // eg, undocked docking windows (ImplDockFloatWin)
8117 [ + - ][ + + ]: 10541 : if ( ImplGetParent() && mpWindowImpl->mpFrameWindow == ImplGetParent()->mpWindowImpl->mpFrameWindow )
[ + - ][ + - ]
[ + + ]
8118 [ + - ][ + - ]: 10541 : ImplGetParent()->ImplCallDeactivateListeners( pNew );
[ + - ][ + - ]
8119 : : }
8120 : : }
8121 : :
8122 : : // -----------------------------------------------------------------------
8123 : :
8124 : 19770 : void Window::ImplCallActivateListeners( Window *pOld )
8125 : : {
8126 : : // no activation if the the old active window is my child
8127 [ + + ][ + + ]: 19770 : if ( !pOld || !ImplIsChild( pOld ) )
[ + + ]
8128 : : {
8129 [ + - ]: 12632 : ImplDelData aDogtag( this );
8130 [ + - ]: 12632 : ImplCallEventListeners( VCLEVENT_WINDOW_ACTIVATE, pOld );
8131 [ - + ]: 12632 : if( aDogtag.IsDead() )
8132 : 19770 : return;
8133 : :
8134 : : // #106298# revoke the change for 105369, because this change
8135 : : // disabled the activate event for the parent,
8136 : : // if the parent is a compound control
8137 : : //if( !GetParent() || !GetParent()->IsCompoundControl() )
8138 : : //{
8139 : : // #100759#, avoid walking the wrong frame's hierarchy
8140 : : // eg, undocked docking windows (ImplDockFloatWin)
8141 : : // #104714#, revert the changes for 100759 because it has a side effect when pOld is a dialog
8142 : : // additionally the gallery is not dockable anymore, so 100759 canot occur
8143 [ + - ][ + + ]: 12632 : if ( ImplGetParent() ) /* && mpWindowImpl->mpFrameWindow == ImplGetParent()->mpWindowImpl->mpFrameWindow ) */
8144 [ + - ][ + - ]: 11074 : ImplGetParent()->ImplCallActivateListeners( pOld );
8145 [ + - ]: 1558 : else if( (mpWindowImpl->mnStyle & WB_INTROWIN) == 0 )
8146 : : {
8147 : : // top level frame reached: store hint for DefModalDialogParent
8148 [ + - ]: 12632 : ImplGetSVData()->maWinData.mpActiveApplicationFrame = mpWindowImpl->mpFrameWindow;
8149 [ + - ][ + - ]: 12632 : }
8150 : : //}
8151 : : }
8152 : : }
8153 : :
8154 : : // -----------------------------------------------------------------------
8155 : :
8156 : 0 : bool Window::ImplStopDnd()
8157 : : {
8158 : 0 : bool bRet = false;
8159 [ # # ][ # # ]: 0 : if( mpWindowImpl->mpFrameData && mpWindowImpl->mpFrameData->mxDropTargetListener.is() )
[ # # ]
8160 : : {
8161 : 0 : bRet = true;
8162 : 0 : mpWindowImpl->mpFrameData->mxDropTarget.clear();
8163 : 0 : mpWindowImpl->mpFrameData->mxDragSource.clear();
8164 : 0 : mpWindowImpl->mpFrameData->mxDropTargetListener.clear();
8165 : : }
8166 : :
8167 : 0 : return bRet;
8168 : : }
8169 : :
8170 : : // -----------------------------------------------------------------------
8171 : :
8172 : 0 : void Window::ImplStartDnd()
8173 : : {
8174 : 0 : GetDropTarget();
8175 : 0 : }
8176 : :
8177 : : // -----------------------------------------------------------------------
8178 : :
8179 : 88548 : uno::Reference< XDropTarget > Window::GetDropTarget()
8180 : : {
8181 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
8182 : :
8183 [ + + ]: 88548 : if( ! mpWindowImpl->mxDNDListenerContainer.is() )
8184 : : {
8185 : 15941 : sal_Int8 nDefaultActions = 0;
8186 : :
8187 [ + - ]: 15941 : if( mpWindowImpl->mpFrameData )
8188 : : {
8189 [ + + ]: 15941 : if( ! mpWindowImpl->mpFrameData->mxDropTarget.is() )
8190 : : {
8191 : : // initialization is done in GetDragSource
8192 [ + - ]: 3371 : uno::Reference< XDragSource > xDragSource = GetDragSource();
8193 : : }
8194 : :
8195 [ + + ]: 15941 : if( mpWindowImpl->mpFrameData->mxDropTarget.is() )
8196 : : {
8197 : 14603 : nDefaultActions = mpWindowImpl->mpFrameData->mxDropTarget->getDefaultActions();
8198 : :
8199 [ + + ]: 14603 : if( ! mpWindowImpl->mpFrameData->mxDropTargetListener.is() )
8200 : : {
8201 [ + - ][ + - ]: 2033 : mpWindowImpl->mpFrameData->mxDropTargetListener = new DNDEventDispatcher( mpWindowImpl->mpFrameWindow );
8202 : :
8203 : : try
8204 : : {
8205 [ + - ][ + - ]: 2033 : mpWindowImpl->mpFrameData->mxDropTarget->addDropTargetListener( mpWindowImpl->mpFrameData->mxDropTargetListener );
8206 : :
8207 : : // register also as drag gesture listener if directly supported by drag source
8208 : : uno::Reference< XDragGestureRecognizer > xDragGestureRecognizer =
8209 [ + - ]: 2033 : uno::Reference< XDragGestureRecognizer > (mpWindowImpl->mpFrameData->mxDragSource, UNO_QUERY);
8210 : :
8211 [ - + ]: 2033 : if( xDragGestureRecognizer.is() )
8212 : : {
8213 [ # # ]: 0 : xDragGestureRecognizer->addDragGestureListener(
8214 [ # # ][ # # ]: 0 : uno::Reference< XDragGestureListener > (mpWindowImpl->mpFrameData->mxDropTargetListener, UNO_QUERY));
8215 : : }
8216 : : else
8217 [ # # ]: 2033 : mpWindowImpl->mpFrameData->mbInternalDragGestureRecognizer = sal_True;
8218 : :
8219 : : }
8220 : 0 : catch (const RuntimeException&)
8221 : : {
8222 : : // release all instances
8223 : 0 : mpWindowImpl->mpFrameData->mxDropTarget.clear();
8224 : 0 : mpWindowImpl->mpFrameData->mxDragSource.clear();
8225 : : }
8226 : : }
8227 : : }
8228 : :
8229 : : }
8230 : :
8231 [ + - ][ + - ]: 15941 : mpWindowImpl->mxDNDListenerContainer = static_cast < XDropTarget * > ( new DNDListenerContainer( nDefaultActions ) );
8232 : : }
8233 : :
8234 : : // this object is located in the same process, so there will be no runtime exception
8235 : 88548 : return uno::Reference< XDropTarget > ( mpWindowImpl->mxDNDListenerContainer, UNO_QUERY );
8236 : : }
8237 : :
8238 : : // -----------------------------------------------------------------------
8239 : :
8240 : 3373 : uno::Reference< XDragSource > Window::GetDragSource()
8241 : : {
8242 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
8243 : :
8244 [ + - ]: 3373 : if( mpWindowImpl->mpFrameData )
8245 : : {
8246 [ + + ]: 3373 : if( ! mpWindowImpl->mpFrameData->mxDragSource.is() )
8247 : : {
8248 : : try
8249 : : {
8250 [ + - ]: 3371 : uno::Reference< XMultiServiceFactory > xFactory = vcl::unohelper::GetMultiServiceFactory();
8251 [ + - ]: 3371 : if ( xFactory.is() )
8252 : : {
8253 [ + - ]: 3371 : const SystemEnvData * pEnvData = GetSystemData();
8254 : :
8255 [ + - ]: 3371 : if( pEnvData )
8256 : : {
8257 [ + - ][ + - ]: 3371 : Sequence< Any > aDragSourceAL( 2 ), aDropTargetAL( 2 );
8258 : 3371 : OUString aDragSourceSN, aDropTargetSN;
8259 : : #if defined WNT
8260 : : aDragSourceSN = OUString("com.sun.star.datatransfer.dnd.OleDragSource");
8261 : : aDropTargetSN = OUString("com.sun.star.datatransfer.dnd.OleDropTarget");
8262 : : aDragSourceAL[ 1 ] = makeAny( (sal_uInt32) pEnvData->hWnd );
8263 : : aDropTargetAL[ 0 ] = makeAny( (sal_uInt32) pEnvData->hWnd );
8264 : : #elif defined QUARTZ
8265 : : /* FIXME: Mac OS X specific dnd interface does not exist! *
8266 : : * Using Windows based dnd as a temporary solution */
8267 : : aDragSourceSN = OUString("com.sun.star.datatransfer.dnd.OleDragSource");
8268 : : aDropTargetSN = OUString("com.sun.star.datatransfer.dnd.OleDropTarget");
8269 : : aDragSourceAL[ 1 ] = makeAny( static_cast<sal_uInt64>( reinterpret_cast<sal_IntPtr>(pEnvData->pView) ) );
8270 : : aDropTargetAL[ 0 ] = makeAny( static_cast<sal_uInt64>( reinterpret_cast<sal_IntPtr>(pEnvData->pView) ) );
8271 : : #elif defined IOS
8272 : : /* What does LibreOffice's use of DND concepts mean on
8273 : : * iOS, huh, is this both inter-app DND (which clearly is
8274 : : * meaningless), or intra-app? Anyway, use the same code
8275 : : * as for MacOSX for now, even if meaningless...
8276 : : */
8277 : : aDragSourceSN = OUString("com.sun.star.datatransfer.dnd.OleDragSource");
8278 : : aDropTargetSN = OUString("com.sun.star.datatransfer.dnd.OleDropTarget");
8279 : : aDragSourceAL[ 1 ] = makeAny( static_cast<sal_uInt64>( reinterpret_cast<sal_IntPtr>(pEnvData->pView) ) );
8280 : : aDropTargetAL[ 0 ] = makeAny( static_cast<sal_uInt64>( reinterpret_cast<sal_IntPtr>(pEnvData->pView) ) );
8281 : : #elif defined UNX
8282 [ + - ]: 3371 : aDropTargetAL.realloc( 3 );
8283 [ + - ]: 3371 : aDragSourceAL.realloc( 3 );
8284 : 3371 : aDragSourceSN = OUString("com.sun.star.datatransfer.dnd.X11DragSource");
8285 : 3371 : aDropTargetSN = OUString("com.sun.star.datatransfer.dnd.X11DropTarget");
8286 : :
8287 [ + - ][ + - ]: 3371 : aDragSourceAL[ 0 ] = makeAny( Application::GetDisplayConnection() );
[ + - ]
8288 [ + - ][ + - ]: 3371 : aDragSourceAL[ 2 ] = makeAny( vcl::createBmpConverter() );
[ + - ]
8289 [ + - ][ + - ]: 3371 : aDropTargetAL[ 0 ] = makeAny( Application::GetDisplayConnection() );
[ + - ]
8290 [ + - ][ + - ]: 3371 : aDropTargetAL[ 1 ] = makeAny( (sal_Size)(pEnvData->aShellWindow) );
8291 [ + - ][ + - ]: 3371 : aDropTargetAL[ 2 ] = makeAny( vcl::createBmpConverter() );
[ + - ]
8292 : : #endif
8293 [ + - ]: 3371 : if( !aDragSourceSN.isEmpty() )
8294 [ + - ][ + - ]: 3371 : mpWindowImpl->mpFrameData->mxDragSource = uno::Reference< XDragSource > ( xFactory->createInstanceWithArguments( aDragSourceSN, aDragSourceAL ), UNO_QUERY );
[ + - ][ + - ]
8295 : :
8296 [ + - ]: 3371 : if( !aDropTargetSN.isEmpty() )
8297 [ + - ][ + - ]: 3371 : mpWindowImpl->mpFrameData->mxDropTarget = uno::Reference< XDropTarget > ( xFactory->createInstanceWithArguments( aDropTargetSN, aDropTargetAL ), UNO_QUERY );
[ + - ][ + - ]
[ + - ][ + - ]
8298 : : }
8299 [ # # ]: 3371 : }
8300 : : }
8301 : :
8302 : : // createInstance can throw any exception
8303 : 0 : catch (const Exception&)
8304 : : {
8305 : : // release all instances
8306 : 0 : mpWindowImpl->mpFrameData->mxDropTarget.clear();
8307 : 0 : mpWindowImpl->mpFrameData->mxDragSource.clear();
8308 : : }
8309 : : }
8310 : :
8311 : 3373 : return mpWindowImpl->mpFrameData->mxDragSource;
8312 : : }
8313 : :
8314 : 3373 : return uno::Reference< XDragSource > ();
8315 : : }
8316 : :
8317 : : // -----------------------------------------------------------------------
8318 : :
8319 : 25850 : uno::Reference< XDragGestureRecognizer > Window::GetDragGestureRecognizer()
8320 : : {
8321 [ + - ]: 25850 : return uno::Reference< XDragGestureRecognizer > ( GetDropTarget(), UNO_QUERY );
8322 : : }
8323 : :
8324 : : // -----------------------------------------------------------------------
8325 : :
8326 : 7773 : uno::Reference< XClipboard > Window::GetClipboard()
8327 : : {
8328 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
8329 : :
8330 [ + - ]: 7773 : if( mpWindowImpl->mpFrameData )
8331 : : {
8332 [ + + ]: 7773 : if( ! mpWindowImpl->mpFrameData->mxClipboard.is() )
8333 : : {
8334 : : try
8335 : : {
8336 [ + - ]: 1711 : uno::Reference< XMultiServiceFactory > xFactory( vcl::unohelper::GetMultiServiceFactory() );
8337 : :
8338 [ + - ]: 1711 : if( xFactory.is() )
8339 : : {
8340 [ + - ][ + - ]: 1711 : mpWindowImpl->mpFrameData->mxClipboard = uno::Reference< XClipboard >( xFactory->createInstance( OUString("com.sun.star.datatransfer.clipboard.SystemClipboardExt") ), UNO_QUERY );
[ + - ][ + - ]
8341 : :
8342 [ + - ]: 1711 : if( !mpWindowImpl->mpFrameData->mxClipboard.is() )
8343 [ + - ][ + - ]: 1711 : mpWindowImpl->mpFrameData->mxClipboard = uno::Reference< XClipboard >( xFactory->createInstance( OUString("com.sun.star.datatransfer.clipboard.SystemClipboard") ), UNO_QUERY );
[ + - ][ + - ]
8344 : :
8345 : : #if defined(UNX) && !defined(QUARTZ) // unix clipboard needs to be initialized
8346 [ + + ]: 1711 : if( mpWindowImpl->mpFrameData->mxClipboard.is() )
8347 : : {
8348 [ + - ]: 1147 : uno::Reference< XInitialization > xInit = uno::Reference< XInitialization >( mpWindowImpl->mpFrameData->mxClipboard, UNO_QUERY );
8349 : :
8350 [ - + ]: 1147 : if( xInit.is() )
8351 : : {
8352 [ # # ]: 0 : Sequence< Any > aArgumentList( 3 );
8353 [ # # ][ # # ]: 0 : aArgumentList[ 0 ] = makeAny( Application::GetDisplayConnection() );
[ # # ]
8354 [ # # ][ # # ]: 0 : aArgumentList[ 1 ] = makeAny( OUString("CLIPBOARD") );
8355 [ # # ][ # # ]: 0 : aArgumentList[ 2 ] = makeAny( vcl::createBmpConverter() );
[ # # ]
8356 : :
8357 [ # # ][ # # ]: 0 : xInit->initialize( aArgumentList );
[ # # ]
8358 : 1147 : }
8359 : : }
8360 : : #endif
8361 [ # # ]: 1711 : }
8362 : : }
8363 : :
8364 : : // createInstance can throw any exception
8365 : 0 : catch (const Exception&)
8366 : : {
8367 : : // release all instances
8368 : 0 : mpWindowImpl->mpFrameData->mxClipboard.clear();
8369 : : }
8370 : : }
8371 : :
8372 : 7773 : return mpWindowImpl->mpFrameData->mxClipboard;
8373 : : }
8374 : :
8375 : 7773 : return static_cast < XClipboard * > (0);
8376 : : }
8377 : :
8378 : : // -----------------------------------------------------------------------
8379 : :
8380 : 86 : uno::Reference< XClipboard > Window::GetPrimarySelection()
8381 : : {
8382 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
8383 : :
8384 [ + - ]: 86 : if( mpWindowImpl->mpFrameData )
8385 : : {
8386 [ + + ]: 86 : if( ! mpWindowImpl->mpFrameData->mxSelection.is() )
8387 : : {
8388 : : try
8389 : : {
8390 [ + - ]: 9 : uno::Reference< XMultiServiceFactory > xFactory( vcl::unohelper::GetMultiServiceFactory() );
8391 : :
8392 [ + - ]: 9 : if( xFactory.is() )
8393 : : {
8394 : : #if defined(UNX) && !defined(QUARTZ)
8395 [ + - ]: 9 : Sequence< Any > aArgumentList( 3 );
8396 [ + - ][ + - ]: 9 : aArgumentList[ 0 ] = makeAny( Application::GetDisplayConnection() );
[ + - ]
8397 [ + - ][ + - ]: 9 : aArgumentList[ 1 ] = makeAny( OUString("PRIMARY") );
8398 [ + - ][ + - ]: 9 : aArgumentList[ 2 ] = makeAny( vcl::createBmpConverter() );
[ + - ]
8399 : :
8400 [ + - ]: 9 : mpWindowImpl->mpFrameData->mxSelection = uno::Reference< XClipboard >( xFactory->createInstanceWithArguments(
8401 [ + - ][ + - ]: 9 : OUString("com.sun.star.datatransfer.clipboard.SystemClipboard"), aArgumentList ), UNO_QUERY );
[ + - ][ + - ]
8402 : : # else
8403 : : static uno::Reference< XClipboard > s_xSelection;
8404 : :
8405 : : if ( !s_xSelection.is() )
8406 : : s_xSelection = uno::Reference< XClipboard >( xFactory->createInstance( OUString("com.sun.star.datatransfer.clipboard.GenericClipboardExt") ), UNO_QUERY );
8407 : :
8408 : : if ( !s_xSelection.is() )
8409 : : s_xSelection = uno::Reference< XClipboard >( xFactory->createInstance( OUString("com.sun.star.datatransfer.clipboard.GenericClipboard") ), UNO_QUERY );
8410 : :
8411 : : mpWindowImpl->mpFrameData->mxSelection = s_xSelection;
8412 : : # endif
8413 [ # # ]: 9 : }
8414 : : }
8415 : :
8416 : : // createInstance can throw any exception
8417 : 0 : catch (const Exception&)
8418 : : {
8419 : : // release all instances
8420 : 0 : mpWindowImpl->mpFrameData->mxSelection.clear();
8421 : : }
8422 : : }
8423 : :
8424 : 86 : return mpWindowImpl->mpFrameData->mxSelection;
8425 : : }
8426 : :
8427 : 86 : return static_cast < XClipboard * > (0);
8428 : : }
8429 : :
8430 : : // -----------------------------------------------------------------------
8431 : : // Accessibility
8432 : : // -----------------------------------------------------------------------
8433 : :
8434 : 5910 : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > Window::GetAccessible( sal_Bool bCreate )
8435 : : {
8436 : : // do not optimize hierarchy for the top level border win (ie, when there is no parent)
8437 : : /* // do not optimize accessible hierarchy at all to better reflect real VCL hierarchy
8438 : : if ( GetParent() && ( GetType() == WINDOW_BORDERWINDOW ) && ( GetChildCount() == 1 ) )
8439 : : //if( !ImplIsAccessibleCandidate() )
8440 : : {
8441 : : Window* pChild = GetAccessibleChildWindow( 0 );
8442 : : if ( pChild )
8443 : : return pChild->GetAccessible();
8444 : : }
8445 : : */
8446 [ + + ][ + + ]: 5910 : if ( !mpWindowImpl->mxAccessible.is() && bCreate )
[ + + ]
8447 [ + - ]: 603 : mpWindowImpl->mxAccessible = CreateAccessible();
8448 : :
8449 : 5910 : return mpWindowImpl->mxAccessible;
8450 : : }
8451 : :
8452 : 490 : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > Window::CreateAccessible()
8453 : : {
8454 [ + - ]: 490 : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAcc( GetComponentInterface( sal_True ), ::com::sun::star::uno::UNO_QUERY );
8455 : 490 : return xAcc;
8456 : : }
8457 : :
8458 : 1654 : void Window::SetAccessible( ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > x )
8459 : : {
8460 : 1654 : mpWindowImpl->mxAccessible = x;
8461 : 1654 : }
8462 : :
8463 : : // skip all border windows that are no top level frames
8464 : 480406 : sal_Bool Window::ImplIsAccessibleCandidate() const
8465 : : {
8466 [ + + ]: 480406 : if( !mpWindowImpl->mbBorderWin )
8467 : 413655 : return sal_True;
8468 : : else
8469 : : // #101741 do not check for WB_CLOSEABLE because undecorated floaters (like menus!) are closeable
8470 [ + + ][ + + ]: 66751 : if( mpWindowImpl->mbFrame && mpWindowImpl->mnStyle & (WB_MOVEABLE | WB_SIZEABLE) )
8471 : 10899 : return sal_True;
8472 : : else
8473 : 480406 : return sal_False;
8474 : : }
8475 : :
8476 : 450507 : sal_Bool Window::ImplIsAccessibleNativeFrame() const
8477 : : {
8478 [ + + ]: 450507 : if( mpWindowImpl->mbFrame )
8479 : : // #101741 do not check for WB_CLOSEABLE because undecorated floaters (like menus!) are closeable
8480 [ + + ]: 16362 : if( (mpWindowImpl->mnStyle & (WB_MOVEABLE | WB_SIZEABLE)) )
8481 : 4479 : return sal_True;
8482 : : else
8483 : 11883 : return sal_False;
8484 : : else
8485 : 450507 : return sal_False;
8486 : : }
8487 : :
8488 : 0 : sal_uInt16 Window::ImplGetAccessibleCandidateChildWindowCount( sal_uInt16 nFirstWindowType ) const
8489 : : {
8490 : 0 : sal_uInt16 nChildren = 0;
8491 : 0 : Window* pChild = GetWindow( nFirstWindowType );
8492 [ # # ]: 0 : while ( pChild )
8493 : : {
8494 [ # # ]: 0 : if( pChild->ImplIsAccessibleCandidate() )
8495 : 0 : nChildren++;
8496 : : else
8497 : 0 : nChildren = sal::static_int_cast<sal_uInt16>(nChildren + pChild->ImplGetAccessibleCandidateChildWindowCount( WINDOW_FIRSTCHILD ));
8498 : 0 : pChild = pChild->mpWindowImpl->mpNext;
8499 : : }
8500 : 0 : return nChildren;
8501 : : }
8502 : :
8503 : 0 : Window* Window::ImplGetAccessibleCandidateChild( sal_uInt16 nChild, sal_uInt16& rChildCount, sal_uInt16 nFirstWindowType, sal_Bool bTopLevel ) const
8504 : : {
8505 : : DBG_CHKTHIS( Window, ImplDbgCheckWindow );
8506 : :
8507 [ # # ]: 0 : if( bTopLevel )
8508 : 0 : rChildCount = 0;
8509 : :
8510 : 0 : Window* pChild = GetWindow( nFirstWindowType );
8511 [ # # ]: 0 : while ( pChild )
8512 : : {
8513 : 0 : Window *pTmpChild = pChild;
8514 : :
8515 [ # # ]: 0 : if( !pChild->ImplIsAccessibleCandidate() )
8516 : 0 : pTmpChild = pChild->ImplGetAccessibleCandidateChild( nChild, rChildCount, WINDOW_FIRSTCHILD, sal_False );
8517 : :
8518 [ # # ]: 0 : if ( nChild == rChildCount )
8519 : 0 : return pTmpChild;
8520 : 0 : pChild = pChild->mpWindowImpl->mpNext;
8521 : 0 : rChildCount++;
8522 : : }
8523 : :
8524 : 0 : return NULL;
8525 : : }
8526 : :
8527 : 328084 : Window* Window::GetAccessibleParentWindow() const
8528 : : {
8529 [ + + ]: 328084 : if ( ImplIsAccessibleNativeFrame() )
8530 : 2289 : return NULL;
8531 : :
8532 : 325795 : Window* pParent = mpWindowImpl->mpParent;
8533 [ + + ]: 325795 : if( GetType() == WINDOW_MENUBARWINDOW )
8534 : : {
8535 : : // report the menubar as a child of THE workwindow
8536 : 3497 : Window *pWorkWin = GetParent()->mpWindowImpl->mpFirstChild;
8537 [ + - ][ + + ]: 6321 : while( pWorkWin && (pWorkWin == this) )
[ + + ]
8538 : 2824 : pWorkWin = pWorkWin->mpWindowImpl->mpNext;
8539 : 3497 : pParent = pWorkWin;
8540 : : }
8541 : : // If this a floating window which has a native boarder window, this one should be reported as
8542 : : // accessible parent
8543 [ + + ][ + + ]: 322298 : else if( GetType() == WINDOW_FLOATINGWINDOW &&
[ + - ][ + + ]
8544 : : mpWindowImpl->mpBorderWindow && mpWindowImpl->mpBorderWindow->mpWindowImpl->mbFrame)
8545 : : {
8546 : 12 : pParent = mpWindowImpl->mpBorderWindow;
8547 : : }
8548 [ + + ][ + + ]: 322286 : else if( pParent && !pParent->ImplIsAccessibleCandidate() )
[ + + ]
8549 : : {
8550 : 44086 : pParent = pParent->mpWindowImpl->mpParent;
8551 : : }
8552 : 328084 : return pParent;
8553 : : }
8554 : :
8555 : 2186 : sal_uInt16 Window::GetAccessibleChildWindowCount()
8556 : : {
8557 : 2186 : sal_uInt16 nChildren = 0;
8558 : 2186 : Window* pChild = mpWindowImpl->mpFirstChild;
8559 [ + + ]: 15093 : while( pChild )
8560 : : {
8561 [ + + ]: 12907 : if( pChild->IsVisible() )
8562 : 7568 : nChildren++;
8563 : 12907 : pChild = pChild->mpWindowImpl->mpNext;
8564 : : }
8565 : :
8566 : : // #107176# ignore overlapwindows
8567 : : // this only affects non-system floating windows
8568 : : // which are either not accessible (like the HelpAgent) or should be changed to system windows anyway
8569 : : /*
8570 : : if( ImplIsOverlapWindow() )
8571 : : {
8572 : : Window* pOverlap = GetWindow( WINDOW_FIRSTOVERLAP );
8573 : : while ( pOverlap )
8574 : : {
8575 : : if( pOverlap->IsVisible() )
8576 : : nChildren++;
8577 : : pOverlap = pOverlap->GetWindow( WINDOW_NEXT );
8578 : : }
8579 : : }
8580 : : */
8581 : :
8582 : : // report the menubarwindow as a child of THE workwindow
8583 [ + + ]: 2186 : if( GetType() == WINDOW_BORDERWINDOW )
8584 : : {
8585 [ + - + - ]: 744 : if( ((ImplBorderWindow *) this)->mpMenuBarWindow &&
[ + - ]
8586 : 372 : ((ImplBorderWindow *) this)->mpMenuBarWindow->IsVisible()
8587 : : )
8588 : 372 : --nChildren;
8589 : : }
8590 [ + + ]: 1814 : else if( GetType() == WINDOW_WORKWINDOW )
8591 : : {
8592 [ + - + - : 1482 : if( ((WorkWindow *) this)->GetMenuBar() &&
+ - ][ + - ]
8593 : 494 : ((WorkWindow *) this)->GetMenuBar()->GetWindow() &&
8594 : 494 : ((WorkWindow *) this)->GetMenuBar()->GetWindow()->IsVisible()
8595 : : )
8596 : 494 : ++nChildren;
8597 : : }
8598 : :
8599 : 2186 : return nChildren;
8600 : : }
8601 : :
8602 : 511 : Window* Window::GetAccessibleChildWindow( sal_uInt16 n )
8603 : : {
8604 : : // report the menubarwindow as a the first child of THE workwindow
8605 [ + + ][ + - ]: 511 : if( GetType() == WINDOW_WORKWINDOW && ((WorkWindow *) this)->GetMenuBar() )
[ + + ]
8606 : : {
8607 [ + + ]: 90 : if( n == 0 )
8608 : : {
8609 : 30 : MenuBar *pMenuBar = ((WorkWindow *) this)->GetMenuBar();
8610 [ + - ][ + - ]: 30 : if( pMenuBar->GetWindow() && pMenuBar->GetWindow()->IsVisible() )
[ + - ]
8611 : 30 : return pMenuBar->GetWindow();
8612 : : }
8613 : : else
8614 : 60 : --n;
8615 : : }
8616 : :
8617 : : // transform n to child number including invisible children
8618 : 481 : sal_uInt16 nChildren = n;
8619 : 481 : Window* pChild = mpWindowImpl->mpFirstChild;
8620 [ + - ]: 1485 : while( pChild )
8621 : : {
8622 [ + + ]: 1485 : if( pChild->IsVisible() )
8623 : : {
8624 [ + + ]: 1079 : if( ! nChildren )
8625 : 481 : break;
8626 : 598 : nChildren--;
8627 : : }
8628 : 1004 : pChild = pChild->mpWindowImpl->mpNext;
8629 : : }
8630 : :
8631 [ + + ][ + - ]: 481 : if( GetType() == WINDOW_BORDERWINDOW && pChild && pChild->GetType() == WINDOW_MENUBARWINDOW )
[ + + ][ + + ]
8632 : : {
8633 [ + - ][ - + ]: 36 : do pChild = pChild->mpWindowImpl->mpNext; while( pChild && ! pChild->IsVisible() );
[ - + ]
8634 : : DBG_ASSERT( pChild, "GetAccessibleChildWindow(): wrong index in border window");
8635 : : }
8636 : : if ( !pChild )
8637 : : {
8638 : : // #107176# ignore overlapwindows
8639 : : /*
8640 : : if( ImplIsOverlapWindow() )
8641 : : {
8642 : : Window* pOverlap = GetWindow( WINDOW_FIRSTOVERLAP );
8643 : : while ( !pChild && pOverlap )
8644 : : {
8645 : : if ( !nChildren && pOverlap->IsVisible() )
8646 : : {
8647 : : pChild = pOverlap;
8648 : : break;
8649 : : }
8650 : : pOverlap = pOverlap->GetWindow( WINDOW_NEXT );
8651 : : if( pOverlap && pOverlap->IsVisible() )
8652 : : nChildren--;
8653 : : }
8654 : : }
8655 : : */
8656 : :
8657 : : }
8658 [ + - ][ + + ]: 481 : if ( pChild && ( pChild->GetType() == WINDOW_BORDERWINDOW ) && ( pChild->GetChildCount() == 1 ) )
[ + - ][ + + ]
8659 : : {
8660 : 54 : pChild = pChild->GetChild( 0 );
8661 : : }
8662 : 511 : return pChild;
8663 : : }
8664 : :
8665 : :
8666 : 7900 : void Window::SetAccessibleRole( sal_uInt16 nRole )
8667 : : {
8668 [ + - ]: 7900 : if ( !mpWindowImpl->mpAccessibleInfos )
8669 : 7900 : mpWindowImpl->mpAccessibleInfos = new ImplAccessibleInfos;
8670 : :
8671 : : DBG_ASSERT( mpWindowImpl->mpAccessibleInfos->nAccessibleRole == 0xFFFF, "AccessibleRole already set!" );
8672 : 7900 : mpWindowImpl->mpAccessibleInfos->nAccessibleRole = nRole;
8673 : 7900 : }
8674 : :
8675 : 2960 : sal_uInt16 Window::GetAccessibleRole() const
8676 : : {
8677 : : using namespace ::com::sun::star;
8678 : :
8679 [ + + ]: 2960 : sal_uInt16 nRole = mpWindowImpl->mpAccessibleInfos ? mpWindowImpl->mpAccessibleInfos->nAccessibleRole : 0xFFFF;
8680 [ + - ]: 2960 : if ( nRole == 0xFFFF )
8681 : : {
8682 [ - + + - : 2960 : switch ( GetType() )
- - - - -
- - - - -
+ - - - +
+ - - + +
- - + - +
+ - + + ]
8683 : : {
8684 : : case WINDOW_MESSBOX: // MT: Would be nice to have special roles!
8685 : : case WINDOW_INFOBOX:
8686 : : case WINDOW_WARNINGBOX:
8687 : : case WINDOW_ERRORBOX:
8688 : 0 : case WINDOW_QUERYBOX: nRole = accessibility::AccessibleRole::ALERT; break;
8689 : :
8690 : : case WINDOW_MODELESSDIALOG:
8691 : : case WINDOW_MODALDIALOG:
8692 : : case WINDOW_SYSTEMDIALOG:
8693 : : case WINDOW_PRINTERSETUPDIALOG:
8694 : : case WINDOW_PRINTDIALOG:
8695 : : case WINDOW_TABDIALOG:
8696 : : case WINDOW_BUTTONDIALOG:
8697 : 12 : case WINDOW_DIALOG: nRole = accessibility::AccessibleRole::DIALOG; break;
8698 : :
8699 : : case WINDOW_PUSHBUTTON:
8700 : : case WINDOW_OKBUTTON:
8701 : : case WINDOW_CANCELBUTTON:
8702 : : case WINDOW_HELPBUTTON:
8703 : : case WINDOW_IMAGEBUTTON:
8704 : : case WINDOW_MENUBUTTON:
8705 : : case WINDOW_MOREBUTTON:
8706 : : case WINDOW_SPINBUTTON:
8707 : 30 : case WINDOW_BUTTON: nRole = accessibility::AccessibleRole::PUSH_BUTTON; break;
8708 : :
8709 : 0 : case WINDOW_PATHDIALOG: nRole = accessibility::AccessibleRole::DIRECTORY_PANE; break;
8710 : 0 : case WINDOW_FILEDIALOG: nRole = accessibility::AccessibleRole::FILE_CHOOSER; break;
8711 : 0 : case WINDOW_COLORDIALOG: nRole = accessibility::AccessibleRole::COLOR_CHOOSER; break;
8712 : 0 : case WINDOW_FONTDIALOG: nRole = accessibility::AccessibleRole::FONT_CHOOSER; break;
8713 : :
8714 : : case WINDOW_IMAGERADIOBUTTON:
8715 : 0 : case WINDOW_RADIOBUTTON: nRole = accessibility::AccessibleRole::RADIO_BUTTON; break;
8716 : : case WINDOW_TRISTATEBOX:
8717 : 0 : case WINDOW_CHECKBOX: nRole = accessibility::AccessibleRole::CHECK_BOX; break;
8718 : :
8719 : 0 : case WINDOW_MULTILINEEDIT: nRole = accessibility::AccessibleRole::SCROLL_PANE; break;
8720 : :
8721 : : case WINDOW_PATTERNFIELD:
8722 : : case WINDOW_NUMERICFIELD:
8723 : : case WINDOW_METRICFIELD:
8724 : : case WINDOW_CURRENCYFIELD:
8725 : : case WINDOW_LONGCURRENCYFIELD:
8726 : : case WINDOW_CALCINPUTLINE:
8727 [ # # ]: 0 : case WINDOW_EDIT: nRole = ( GetStyle() & WB_PASSWORD ) ? (accessibility::AccessibleRole::PASSWORD_TEXT) : (accessibility::AccessibleRole::TEXT); break;
8728 : :
8729 : : case WINDOW_PATTERNBOX:
8730 : : case WINDOW_NUMERICBOX:
8731 : : case WINDOW_METRICBOX:
8732 : : case WINDOW_CURRENCYBOX:
8733 : : case WINDOW_LONGCURRENCYBOX:
8734 : 0 : case WINDOW_COMBOBOX: nRole = accessibility::AccessibleRole::COMBO_BOX; break;
8735 : :
8736 : : case WINDOW_LISTBOX:
8737 : 0 : case WINDOW_MULTILISTBOX: nRole = accessibility::AccessibleRole::LIST; break;
8738 : :
8739 : 0 : case WINDOW_TREELISTBOX: nRole = accessibility::AccessibleRole::TREE; break;
8740 : :
8741 : 8 : case WINDOW_FIXEDTEXT: nRole = accessibility::AccessibleRole::LABEL; break;
8742 : 0 : case WINDOW_FIXEDLINE: nRole = accessibility::AccessibleRole::SEPARATOR; break;
8743 : : case WINDOW_FIXEDBITMAP:
8744 : 0 : case WINDOW_FIXEDIMAGE: nRole = accessibility::AccessibleRole::ICON; break;
8745 : 0 : case WINDOW_GROUPBOX: nRole = accessibility::AccessibleRole::GROUP_BOX; break;
8746 : 32 : case WINDOW_SCROLLBAR: nRole = accessibility::AccessibleRole::SCROLL_BAR; break;
8747 : :
8748 : : case WINDOW_SLIDER:
8749 : : case WINDOW_SPLITTER:
8750 : 58 : case WINDOW_SPLITWINDOW: nRole = accessibility::AccessibleRole::SPLIT_PANE; break;
8751 : :
8752 : : case WINDOW_DATEBOX:
8753 : : case WINDOW_TIMEBOX:
8754 : : case WINDOW_DATEFIELD:
8755 : 0 : case WINDOW_TIMEFIELD: nRole = accessibility::AccessibleRole::DATE_EDITOR; break;
8756 : :
8757 : 0 : case WINDOW_SPINFIELD: nRole = accessibility::AccessibleRole::SPIN_BOX; break;
8758 : :
8759 : 46 : case WINDOW_TOOLBOX: nRole = accessibility::AccessibleRole::TOOL_BAR; break;
8760 : 2 : case WINDOW_STATUSBAR: nRole = accessibility::AccessibleRole::STATUS_BAR; break;
8761 : :
8762 : 0 : case WINDOW_TABPAGE: nRole = accessibility::AccessibleRole::PANEL; break;
8763 : 0 : case WINDOW_TABCONTROL: nRole = accessibility::AccessibleRole::PAGE_TAB_LIST; break;
8764 : :
8765 : : case WINDOW_DOCKINGWINDOW:
8766 : : case WINDOW_SYSWINDOW: nRole = (mpWindowImpl->mbFrame) ? accessibility::AccessibleRole::FRAME :
8767 [ - + ]: 86 : accessibility::AccessibleRole::PANEL; break;
8768 : :
8769 : : case WINDOW_FLOATINGWINDOW: nRole = ( mpWindowImpl->mbFrame ||
8770 : : (mpWindowImpl->mpBorderWindow && mpWindowImpl->mpBorderWindow->mpWindowImpl->mbFrame) ||
8771 : 0 : (GetStyle() & WB_OWNERDRAWDECORATION) ) ? accessibility::AccessibleRole::FRAME :
8772 [ # # ][ # # ]: 0 : accessibility::AccessibleRole::WINDOW; break;
[ # # # # ]
8773 : :
8774 : 701 : case WINDOW_WORKWINDOW: nRole = accessibility::AccessibleRole::ROOT_PANE; break;
8775 : :
8776 : :
8777 : 35 : case WINDOW_SCROLLBARBOX: nRole = accessibility::AccessibleRole::FILLER; break;
8778 : :
8779 : 0 : case WINDOW_HELPTEXTWINDOW: nRole = accessibility::AccessibleRole::TOOL_TIP; break;
8780 : :
8781 : 20 : case WINDOW_RULER: nRole = accessibility::AccessibleRole::RULER; break;
8782 : : case WINDOW_WINDOW:
8783 : : case WINDOW_CONTROL:
8784 : : case WINDOW_BORDERWINDOW:
8785 : : case WINDOW_SYSTEMCHILDWINDOW:
8786 : : default:
8787 [ + + ]: 1930 : if (ImplIsAccessibleNativeFrame() )
8788 : 372 : nRole = accessibility::AccessibleRole::FRAME;
8789 [ + + ]: 1558 : else if( IsScrollable() )
8790 : 806 : nRole = accessibility::AccessibleRole::SCROLL_PANE;
8791 [ - + ]: 752 : else if( ((Window*)this)->ImplGetWindow()->IsMenuFloatingWindow() )
8792 : 0 : nRole = accessibility::AccessibleRole::WINDOW; // #106002#, contextmenus are windows (i.e. toplevel)
8793 : : else
8794 : : // #104051# WINDOW seems to be a bad default role, use LAYEREDPANE instead
8795 : : // a WINDOW is interpreted as a top-level window, which is typically not the case
8796 : : //nRole = accessibility::AccessibleRole::WINDOW;
8797 : 2960 : nRole = accessibility::AccessibleRole::PANEL;
8798 : : }
8799 : : }
8800 : 2960 : return nRole;
8801 : : }
8802 : :
8803 : 5803 : void Window::SetAccessibleName( const String& rName )
8804 : : {
8805 [ + + ]: 5803 : if ( !mpWindowImpl->mpAccessibleInfos )
8806 : 5543 : mpWindowImpl->mpAccessibleInfos = new ImplAccessibleInfos;
8807 : :
8808 : : DBG_ASSERT( !mpWindowImpl->mpAccessibleInfos->pAccessibleName || !rName.Len(), "AccessibleName already set!" );
8809 [ - + ]: 5803 : delete mpWindowImpl->mpAccessibleInfos->pAccessibleName;
8810 [ + - ]: 5803 : mpWindowImpl->mpAccessibleInfos->pAccessibleName = new String( rName );
8811 : 5803 : }
8812 : :
8813 : 1380 : String Window::GetAccessibleName() const
8814 : : {
8815 : 1380 : String aAccessibleName;
8816 [ + - ][ + + ]: 1380 : if ( mpWindowImpl->mpAccessibleInfos && mpWindowImpl->mpAccessibleInfos->pAccessibleName )
8817 : : {
8818 [ + - ]: 24 : aAccessibleName = *mpWindowImpl->mpAccessibleInfos->pAccessibleName;
8819 : : }
8820 : : else
8821 : : {
8822 [ + - ]: 1356 : switch ( GetType() )
[ + - + ]
8823 : : {
8824 : : case WINDOW_MULTILINEEDIT:
8825 : : case WINDOW_PATTERNFIELD:
8826 : : case WINDOW_NUMERICFIELD:
8827 : : case WINDOW_METRICFIELD:
8828 : : case WINDOW_CURRENCYFIELD:
8829 : : case WINDOW_LONGCURRENCYFIELD:
8830 : : case WINDOW_CALCINPUTLINE:
8831 : : case WINDOW_EDIT:
8832 : :
8833 : : case WINDOW_DATEBOX:
8834 : : case WINDOW_TIMEBOX:
8835 : : case WINDOW_CURRENCYBOX:
8836 : : case WINDOW_LONGCURRENCYBOX:
8837 : : case WINDOW_DATEFIELD:
8838 : : case WINDOW_TIMEFIELD:
8839 : : case WINDOW_SPINFIELD:
8840 : :
8841 : : case WINDOW_COMBOBOX:
8842 : : case WINDOW_LISTBOX:
8843 : : case WINDOW_MULTILISTBOX:
8844 : : case WINDOW_TREELISTBOX:
8845 : : case WINDOW_METRICBOX:
8846 : : {
8847 [ + - ]: 46 : Window *pLabel = GetAccessibleRelationLabeledBy();
8848 [ - + ][ # # ]: 46 : if ( pLabel && pLabel != this )
8849 [ # # ][ # # ]: 0 : aAccessibleName = pLabel->GetText();
[ # # ]
8850 : : }
8851 : 46 : break;
8852 : :
8853 : : case WINDOW_IMAGEBUTTON:
8854 : : case WINDOW_PUSHBUTTON:
8855 [ # # ][ # # ]: 0 : aAccessibleName = GetText();
[ # # ]
8856 [ # # ]: 0 : if ( !aAccessibleName.Len() )
8857 : : {
8858 [ # # ][ # # ]: 0 : aAccessibleName = GetQuickHelpText();
8859 [ # # ]: 0 : if ( !aAccessibleName.Len() )
8860 [ # # ][ # # ]: 0 : aAccessibleName = GetHelpText();
8861 : : }
8862 : 0 : break;
8863 : :
8864 : : default:
8865 [ + - ][ + - ]: 1310 : aAccessibleName = GetText();
[ + - ]
8866 : 1310 : break;
8867 : : }
8868 : :
8869 [ + - ][ + - ]: 1356 : aAccessibleName = GetNonMnemonicString( aAccessibleName );
[ + - ]
8870 : : }
8871 : :
8872 : 1380 : return aAccessibleName;
8873 : : }
8874 : :
8875 : 304 : void Window::SetAccessibleDescription( const String& rDescription )
8876 : : {
8877 [ - + ]: 304 : if ( ! mpWindowImpl->mpAccessibleInfos )
8878 : 0 : mpWindowImpl->mpAccessibleInfos = new ImplAccessibleInfos;
8879 : :
8880 : : DBG_ASSERT( !mpWindowImpl->mpAccessibleInfos->pAccessibleDescription, "AccessibleDescription already set!" );
8881 [ - + ]: 304 : delete mpWindowImpl->mpAccessibleInfos->pAccessibleDescription;
8882 [ + - ]: 304 : mpWindowImpl->mpAccessibleInfos->pAccessibleDescription = new String( rDescription );
8883 : 304 : }
8884 : :
8885 : 1394 : String Window::GetAccessibleDescription() const
8886 : : {
8887 : 1394 : String aAccessibleDescription;
8888 [ + + ][ + + ]: 1394 : if ( mpWindowImpl->mpAccessibleInfos && mpWindowImpl->mpAccessibleInfos->pAccessibleDescription )
8889 : : {
8890 [ + - ]: 18 : aAccessibleDescription = *mpWindowImpl->mpAccessibleInfos->pAccessibleDescription;
8891 : : }
8892 : : else
8893 : : {
8894 : : // Special code for help text windows. ZT asks the border window for the
8895 : : // description so we have to forward this request to our inner window.
8896 [ + - ]: 1376 : const Window* pWin = ((Window *)this)->ImplGetWindow();
8897 [ + - ][ - + ]: 1376 : if ( pWin->GetType() == WINDOW_HELPTEXTWINDOW )
8898 [ # # ][ # # ]: 0 : aAccessibleDescription = pWin->GetHelpText();
8899 : : else
8900 [ + - ][ + - ]: 1376 : aAccessibleDescription = GetHelpText();
8901 : : }
8902 : :
8903 : 1394 : return aAccessibleDescription;
8904 : : }
8905 : :
8906 : 0 : void Window::SetAccessibleRelationLabeledBy( Window* pLabeledBy )
8907 : : {
8908 [ # # ]: 0 : if ( !mpWindowImpl->mpAccessibleInfos )
8909 : 0 : mpWindowImpl->mpAccessibleInfos = new ImplAccessibleInfos;
8910 : 0 : mpWindowImpl->mpAccessibleInfos->pLabeledByWindow = pLabeledBy;
8911 : 0 : }
8912 : :
8913 : 0 : void Window::SetAccessibleRelationMemberOf( Window* pMemberOfWin )
8914 : : {
8915 [ # # ]: 0 : if ( !mpWindowImpl->mpAccessibleInfos )
8916 : 0 : mpWindowImpl->mpAccessibleInfos = new ImplAccessibleInfos;
8917 : 0 : mpWindowImpl->mpAccessibleInfos->pMemberOfWindow = pMemberOfWin;
8918 : 0 : }
8919 : :
8920 : 44721 : sal_Bool Window::IsAccessibilityEventsSuppressed( sal_Bool bTraverseParentPath )
8921 : : {
8922 [ + + ]: 44721 : if( !bTraverseParentPath )
8923 : 640 : return mpWindowImpl->mbSuppressAccessibilityEvents;
8924 : : else
8925 : : {
8926 : 44081 : Window *pParent = this;
8927 [ + + ][ + - ]: 263395 : while ( pParent && pParent->mpWindowImpl)
[ + + ]
8928 : : {
8929 [ + + ]: 221747 : if( pParent->mpWindowImpl->mbSuppressAccessibilityEvents )
8930 : 2433 : return sal_True;
8931 : : else
8932 : 219314 : pParent = pParent->mpWindowImpl->mpParent; // do not use GetParent() to find borderwindows that are frames
8933 : : }
8934 : 44721 : return sal_False;
8935 : : }
8936 : : }
8937 : :
8938 : 1280 : void Window::SetAccessibilityEventsSuppressed(sal_Bool bSuppressed)
8939 : : {
8940 : 1280 : mpWindowImpl->mbSuppressAccessibilityEvents = bSuppressed;
8941 : 1280 : }
8942 : :
8943 : 202 : void Window::RecordLayoutData( vcl::ControlLayoutData* pLayout, const Rectangle& rRect )
8944 : : {
8945 [ + + ]: 202 : if( ! mpOutDevData )
8946 : 2 : ImplInitOutDevData();
8947 : 202 : mpOutDevData->mpRecordLayout = pLayout;
8948 : 202 : mpOutDevData->maRecordRect = rRect;
8949 : 202 : Paint( rRect );
8950 : 202 : mpOutDevData->mpRecordLayout = NULL;
8951 : 202 : }
8952 : :
8953 : : // -----------------------------------------------------------------------
8954 : :
8955 : 0 : void Window::DrawSelectionBackground( const Rectangle& rRect, sal_uInt16 highlight, sal_Bool bChecked, sal_Bool bDrawBorder, sal_Bool bDrawExtBorderOnly )
8956 : : {
8957 : 0 : DrawSelectionBackground( rRect, highlight, bChecked, bDrawBorder, bDrawExtBorderOnly, 0, NULL, NULL );
8958 : 0 : }
8959 : :
8960 : 0 : void Window::DrawSelectionBackground( const Rectangle& rRect, sal_uInt16 highlight, sal_Bool bChecked, sal_Bool bDrawBorder, sal_Bool bDrawExtBorderOnly, Color* pSelectionTextColor )
8961 : : {
8962 : 0 : DrawSelectionBackground( rRect, highlight, bChecked, bDrawBorder, bDrawExtBorderOnly, 0, pSelectionTextColor, NULL );
8963 : 0 : }
8964 : :
8965 : 4184 : void Window::DrawSelectionBackground( const Rectangle& rRect,
8966 : : sal_uInt16 highlight,
8967 : : sal_Bool bChecked,
8968 : : sal_Bool bDrawBorder,
8969 : : sal_Bool bDrawExtBorderOnly,
8970 : : long nCornerRadius,
8971 : : Color* pSelectionTextColor,
8972 : : Color* pPaintColor
8973 : : )
8974 : : {
8975 [ + - ][ + - ]: 4184 : if( rRect.IsEmpty() )
8976 : 4184 : return;
8977 : :
8978 : 4184 : bool bRoundEdges = nCornerRadius > 0;
8979 : :
8980 : 4184 : const StyleSettings& rStyles = GetSettings().GetStyleSettings();
8981 : :
8982 : :
8983 : : // colors used for item highlighting
8984 [ + + ]: 4184 : Color aSelectionBorderCol( pPaintColor ? *pPaintColor : rStyles.GetHighlightColor() );
8985 : 4184 : Color aSelectionFillCol( aSelectionBorderCol );
8986 : :
8987 [ + - ]: 4184 : sal_Bool bDark = rStyles.GetFaceColor().IsDark();
8988 : 4184 : sal_Bool bBright = ( rStyles.GetFaceColor() == Color( COL_WHITE ) );
8989 : :
8990 [ + - ]: 4184 : int c1 = aSelectionBorderCol.GetLuminance();
8991 [ + - ][ + - ]: 4184 : int c2 = GetDisplayBackground().GetColor().GetLuminance();
[ + - ]
8992 : :
8993 [ + - ][ + - ]: 4184 : if( !bDark && !bBright && abs( c2-c1 ) < (pPaintColor ? 40 : 75) )
[ + + ][ - + ]
8994 : : {
8995 : : // constrast too low
8996 : : sal_uInt16 h,s,b;
8997 [ # # ]: 0 : aSelectionFillCol.RGBtoHSB( h, s, b );
8998 [ # # ]: 0 : if( b > 50 ) b -= 40;
8999 : 0 : else b += 40;
9000 [ # # ]: 0 : aSelectionFillCol.SetColor( Color::HSBtoRGB( h, s, b ) );
9001 : 0 : aSelectionBorderCol = aSelectionFillCol;
9002 : : }
9003 : :
9004 [ + - ]: 4184 : if( bRoundEdges )
9005 : : {
9006 [ + - ][ + - ]: 4184 : if( aSelectionBorderCol.IsDark() )
9007 [ + - ]: 4184 : aSelectionBorderCol.IncreaseLuminance( 128 );
9008 : : else
9009 [ # # ]: 0 : aSelectionBorderCol.DecreaseLuminance( 128 );
9010 : : }
9011 : :
9012 : 4184 : Rectangle aRect( rRect );
9013 [ - + ]: 4184 : if( bDrawExtBorderOnly )
9014 : : {
9015 : 0 : aRect.nLeft -= 1;
9016 : 0 : aRect.nTop -= 1;
9017 : 0 : aRect.nRight += 1;
9018 : 0 : aRect.nBottom += 1;
9019 : : }
9020 : 4184 : Color oldFillCol = GetFillColor();
9021 : 4184 : Color oldLineCol = GetLineColor();
9022 : :
9023 [ + - ]: 4184 : if( bDrawBorder )
9024 [ - + ][ - + ]: 4184 : SetLineColor( bDark ? Color(COL_WHITE) : ( bBright ? Color(COL_BLACK) : aSelectionBorderCol ) );
[ + - ]
9025 : : else
9026 [ # # ]: 0 : SetLineColor();
9027 : :
9028 : 4184 : sal_uInt16 nPercent = 0;
9029 [ + + ]: 4184 : if( !highlight )
9030 : : {
9031 [ - + ]: 4182 : if( bDark )
9032 : 0 : aSelectionFillCol = COL_BLACK;
9033 : : else
9034 : 4182 : nPercent = 80; // just checked (light)
9035 : : }
9036 : : else
9037 : : {
9038 [ - + ][ # # ]: 2 : if( bChecked && highlight == 2 )
9039 : : {
9040 [ # # ]: 0 : if( bDark )
9041 : 0 : aSelectionFillCol = COL_LIGHTGRAY;
9042 [ # # ]: 0 : else if ( bBright )
9043 : : {
9044 : 0 : aSelectionFillCol = COL_BLACK;
9045 [ # # ]: 0 : SetLineColor( COL_BLACK );
9046 : 0 : nPercent = 0;
9047 : : }
9048 : : else
9049 [ # # ]: 0 : nPercent = bRoundEdges ? 40 : 20; // selected, pressed or checked ( very dark )
9050 : : }
9051 [ + - ][ - + ]: 2 : else if( bChecked || highlight == 1 )
9052 : : {
9053 [ # # ]: 0 : if( bDark )
9054 : 0 : aSelectionFillCol = COL_GRAY;
9055 [ # # ]: 0 : else if ( bBright )
9056 : : {
9057 : 0 : aSelectionFillCol = COL_BLACK;
9058 [ # # ]: 0 : SetLineColor( COL_BLACK );
9059 : 0 : nPercent = 0;
9060 : : }
9061 : : else
9062 [ # # ]: 0 : nPercent = bRoundEdges ? 60 : 35; // selected, pressed or checked ( very dark )
9063 : : }
9064 : : else
9065 : : {
9066 [ - + ]: 2 : if( bDark )
9067 : 0 : aSelectionFillCol = COL_LIGHTGRAY;
9068 [ - + ]: 2 : else if ( bBright )
9069 : : {
9070 : 0 : aSelectionFillCol = COL_BLACK;
9071 [ # # ]: 0 : SetLineColor( COL_BLACK );
9072 [ # # ]: 0 : if( highlight == 3 )
9073 : 0 : nPercent = 80;
9074 : : else
9075 : 0 : nPercent = 0;
9076 : : }
9077 : : else
9078 : 2 : nPercent = 70; // selected ( dark )
9079 : : }
9080 : : }
9081 : :
9082 [ - + ][ # # ]: 4184 : if( bDark && bDrawExtBorderOnly )
9083 : : {
9084 [ # # ]: 0 : SetFillColor();
9085 [ # # ]: 0 : if( pSelectionTextColor )
9086 : 0 : *pSelectionTextColor = rStyles.GetHighlightTextColor();
9087 : : }
9088 : : else
9089 : : {
9090 [ + - ]: 4184 : SetFillColor( aSelectionFillCol );
9091 [ - + ]: 4184 : if( pSelectionTextColor )
9092 : : {
9093 [ # # ][ # # ]: 0 : Color aTextColor = IsControlBackground() ? GetControlForeground() : rStyles.GetButtonTextColor();
[ # # ]
9094 : 0 : Color aHLTextColor = rStyles.GetHighlightTextColor();
9095 [ # # ][ # # ]: 0 : int nTextDiff = abs(aSelectionFillCol.GetLuminance() - aTextColor.GetLuminance());
9096 [ # # ][ # # ]: 0 : int nHLDiff = abs(aSelectionFillCol.GetLuminance() - aHLTextColor.GetLuminance());
9097 [ # # ]: 0 : *pSelectionTextColor = (nHLDiff >= nTextDiff) ? aHLTextColor : aTextColor;
9098 : : }
9099 : : }
9100 : :
9101 : :
9102 [ - + ]: 4184 : if( bDark )
9103 : : {
9104 [ # # ]: 0 : DrawRect( aRect );
9105 : : }
9106 : : else
9107 : : {
9108 [ + - ]: 4184 : if( bRoundEdges )
9109 : : {
9110 [ + - ]: 4184 : Polygon aPoly( aRect, nCornerRadius, nCornerRadius );
9111 [ + - ]: 4184 : PolyPolygon aPolyPoly( aPoly );
9112 [ + - ][ + - ]: 4184 : DrawTransparent( aPolyPoly, nPercent );
[ + - ]
9113 : : }
9114 : : else
9115 : : {
9116 [ # # ]: 0 : Polygon aPoly( aRect );
9117 [ # # ]: 0 : PolyPolygon aPolyPoly( aPoly );
9118 [ # # ][ # # ]: 0 : DrawTransparent( aPolyPoly, nPercent );
[ # # ]
9119 : : }
9120 : : }
9121 : :
9122 [ + - ]: 4184 : SetFillColor( oldFillCol );
9123 [ + - ]: 4184 : SetLineColor( oldLineCol );
9124 : : }
9125 : :
9126 : : // controls should return the window that gets the
9127 : : // focus by default, so keyevents can be sent to that window directly
9128 : 0 : Window* Window::GetPreferredKeyInputWindow()
9129 : : {
9130 : 0 : return this;
9131 : : }
9132 : :
9133 : :
9134 : 1558 : sal_Bool Window::IsScrollable() const
9135 : : {
9136 : : // check for scrollbars
9137 : 1558 : Window *pChild = mpWindowImpl->mpFirstChild;
9138 [ + + ]: 8322 : while( pChild )
9139 : : {
9140 [ + + ]: 7570 : if( pChild->GetType() == WINDOW_SCROLLBAR )
9141 : 806 : return true;
9142 : : else
9143 : 6764 : pChild = pChild->mpWindowImpl->mpNext;
9144 : : }
9145 : 1558 : return false;
9146 : : }
9147 : :
9148 : 323927 : sal_Bool Window::IsTopWindow() const
9149 : : {
9150 [ - + ]: 323927 : if ( mpWindowImpl->mbInDtor )
9151 : 0 : return sal_False;
9152 : :
9153 : : // topwindows must be frames or they must have a borderwindow which is a frame
9154 [ + + ][ + - ]: 323927 : if( !mpWindowImpl->mbFrame && (!mpWindowImpl->mpBorderWindow || (mpWindowImpl->mpBorderWindow && !mpWindowImpl->mpBorderWindow->mpWindowImpl->mbFrame) ) )
[ + - ][ - + ]
9155 : 0 : return sal_False;
9156 : :
9157 : 323927 : ImplGetWinData();
9158 [ + + ]: 323927 : if( mpWindowImpl->mpWinData->mnIsTopWindow == (sal_uInt16)~0) // still uninitialized
9159 : : {
9160 : : // #113722#, cache result of expensive queryInterface call
9161 : 11040 : Window *pThisWin = (Window*)this;
9162 [ + - ][ + - ]: 11040 : uno::Reference< XTopWindow > xTopWindow( pThisWin->GetComponentInterface(), UNO_QUERY );
9163 [ + + ]: 11040 : pThisWin->mpWindowImpl->mpWinData->mnIsTopWindow = xTopWindow.is() ? 1 : 0;
9164 : : }
9165 [ + + ]: 323927 : return mpWindowImpl->mpWinData->mnIsTopWindow == 1 ? sal_True : sal_False;
9166 : : }
9167 : :
9168 : 0 : void Window::ImplMirrorFramePos( Point &pt ) const
9169 : : {
9170 : 0 : pt.X() = mpWindowImpl->mpFrame->maGeometry.nWidth-1-pt.X();
9171 : 0 : }
9172 : :
9173 : : // frame based modal counter (dialogs are not modal to the whole application anymore)
9174 : 21315 : sal_Bool Window::IsInModalMode() const
9175 : : {
9176 : 21315 : return (mpWindowImpl->mpFrameWindow->mpWindowImpl->mpFrameData->mnModalMode != 0);
9177 : : }
9178 : 0 : void Window::ImplIncModalCount()
9179 : : {
9180 : 0 : Window* pFrameWindow = mpWindowImpl->mpFrameWindow;
9181 : 0 : Window* pParent = pFrameWindow;
9182 [ # # ]: 0 : while( pFrameWindow )
9183 : : {
9184 : 0 : pFrameWindow->mpWindowImpl->mpFrameData->mnModalMode++;
9185 [ # # ][ # # ]: 0 : while( pParent && pParent->mpWindowImpl->mpFrameWindow == pFrameWindow )
[ # # ]
9186 : : {
9187 : 0 : pParent = pParent->GetParent();
9188 : : }
9189 [ # # ]: 0 : pFrameWindow = pParent ? pParent->mpWindowImpl->mpFrameWindow : NULL;
9190 : : }
9191 : 0 : }
9192 : 0 : void Window::ImplDecModalCount()
9193 : : {
9194 : 0 : Window* pFrameWindow = mpWindowImpl->mpFrameWindow;
9195 : 0 : Window* pParent = pFrameWindow;
9196 [ # # ]: 0 : while( pFrameWindow )
9197 : : {
9198 : 0 : pFrameWindow->mpWindowImpl->mpFrameData->mnModalMode--;
9199 [ # # ][ # # ]: 0 : while( pParent && pParent->mpWindowImpl->mpFrameWindow == pFrameWindow )
[ # # ]
9200 : : {
9201 : 0 : pParent = pParent->GetParent();
9202 : : }
9203 [ # # ]: 0 : pFrameWindow = pParent ? pParent->mpWindowImpl->mpFrameWindow : NULL;
9204 : : }
9205 : 0 : }
9206 : :
9207 : 12629 : void Window::ImplIsInTaskPaneList( sal_Bool mbIsInTaskList )
9208 : : {
9209 : 12629 : mpWindowImpl->mbIsInTaskPaneList = mbIsInTaskList;
9210 : 12629 : }
9211 : :
9212 : 157 : void Window::ImplNotifyIconifiedState( sal_Bool bIconified )
9213 : : {
9214 [ + + ]: 157 : mpWindowImpl->mpFrameWindow->ImplCallEventListeners( bIconified ? VCLEVENT_WINDOW_MINIMIZE : VCLEVENT_WINDOW_NORMALIZE );
9215 : : // #109206# notify client window as well to have toolkit topwindow listeners notified
9216 [ + - ][ + + ]: 157 : if( mpWindowImpl->mpFrameWindow->mpWindowImpl->mpClientWindow && mpWindowImpl->mpFrameWindow != mpWindowImpl->mpFrameWindow->mpWindowImpl->mpClientWindow )
9217 [ + + ]: 19 : mpWindowImpl->mpFrameWindow->mpWindowImpl->mpClientWindow->ImplCallEventListeners( bIconified ? VCLEVENT_WINDOW_MINIMIZE : VCLEVENT_WINDOW_NORMALIZE );
9218 : 157 : }
9219 : :
9220 : 40 : sal_Bool Window::HasActiveChildFrame()
9221 : : {
9222 : 40 : sal_Bool bRet = sal_False;
9223 : 40 : Window *pFrameWin = ImplGetSVData()->maWinData.mpFirstFrame;
9224 [ + + ]: 258 : while( pFrameWin )
9225 : : {
9226 [ + + ]: 218 : if( pFrameWin != mpWindowImpl->mpFrameWindow )
9227 : : {
9228 : 178 : sal_Bool bDecorated = sal_False;
9229 : 178 : Window *pChildFrame = pFrameWin->ImplGetWindow();
9230 : : // #i15285# unfortunately WB_MOVEABLE is the same as WB_TABSTOP which can
9231 : : // be removed for ToolBoxes to influence the keyboard accessibility
9232 : : // thus WB_MOVEABLE is no indicator for decoration anymore
9233 : : // but FloatingWindows carry this information in their TitleType...
9234 : : // TODO: avoid duplicate WinBits !!!
9235 [ + + ][ + + ]: 178 : if( pChildFrame && pChildFrame->ImplIsFloatingWindow() )
[ + - ]
9236 : 138 : bDecorated = ((FloatingWindow*) pChildFrame)->GetTitleType() != FLOATWIN_TITLE_NONE;
9237 [ + + ][ - + ]: 178 : if( bDecorated || (pFrameWin->mpWindowImpl->mnStyle & (WB_MOVEABLE | WB_SIZEABLE) ) )
9238 [ + - ][ + - ]: 2 : if( pChildFrame && pChildFrame->IsVisible() && pChildFrame->IsActive() )
[ + - ][ + - ]
9239 : : {
9240 [ - + ]: 2 : if( ImplIsChild( pChildFrame, sal_True ) )
9241 : : {
9242 : 0 : bRet = sal_True;
9243 : 0 : break;
9244 : : }
9245 : : }
9246 : : }
9247 : 218 : pFrameWin = pFrameWin->mpWindowImpl->mpFrameData->mpNextFrame;
9248 : : }
9249 : 40 : return bRet;
9250 : : }
9251 : :
9252 : 3427 : LanguageType Window::GetInputLanguage() const
9253 : : {
9254 : 3427 : return mpWindowImpl->mpFrame->GetInputLanguage();
9255 : : }
9256 : :
9257 : 36585 : void Window::EnableNativeWidget( sal_Bool bEnable )
9258 : : {
9259 [ + + ][ + - ]: 36585 : static const char* pNoNWF = getenv( "SAL_NO_NWF" );
9260 [ - + ][ # # ]: 36585 : if( pNoNWF && *pNoNWF )
9261 : 0 : bEnable = sal_False;
9262 : :
9263 [ + + ]: 36585 : if( bEnable != ImplGetWinData()->mbEnableNativeWidget )
9264 : : {
9265 [ + - ]: 8935 : ImplGetWinData()->mbEnableNativeWidget = bEnable;
9266 : :
9267 : : // send datachanged event to allow for internal changes required for NWF
9268 : : // like clipmode, transparency, etc.
9269 [ + - ]: 8935 : DataChangedEvent aDCEvt( DATACHANGED_SETTINGS, &maSettings, SETTINGS_STYLE );
9270 [ + - ]: 8935 : DataChanged( aDCEvt );
9271 : :
9272 : : // sometimes the borderwindow is queried, so keep it in sync
9273 [ + + ]: 8935 : if( mpWindowImpl->mpBorderWindow )
9274 [ + - ]: 8935 : mpWindowImpl->mpBorderWindow->ImplGetWinData()->mbEnableNativeWidget = bEnable;
9275 : : }
9276 : :
9277 : : // push down, useful for compound controls
9278 : 36585 : Window *pChild = mpWindowImpl->mpFirstChild;
9279 [ + + ]: 66702 : while( pChild )
9280 : : {
9281 : 30117 : pChild->EnableNativeWidget( bEnable );
9282 : 30117 : pChild = pChild->mpWindowImpl->mpNext;
9283 : : }
9284 : 36585 : }
9285 : :
9286 : 626321 : sal_Bool Window::IsNativeWidgetEnabled() const
9287 : : {
9288 : 626321 : return ImplGetWinData()->mbEnableNativeWidget;
9289 : : }
9290 : :
9291 : : #ifdef WNT // see #140456#
9292 : : #include <win/salframe.h>
9293 : : #endif
9294 : :
9295 : 0 : uno::Reference< rendering::XCanvas > Window::ImplGetCanvas( const Size& rFullscreenSize,
9296 : : bool bFullscreen,
9297 : : bool bSpriteCanvas ) const
9298 : : {
9299 : : // try to retrieve hard reference from weak member
9300 [ # # ]: 0 : uno::Reference< rendering::XCanvas > xCanvas( mpWindowImpl->mxCanvas );
9301 : :
9302 : : // canvas still valid? Then we're done.
9303 [ # # ]: 0 : if( xCanvas.is() )
9304 : : return xCanvas;
9305 : :
9306 [ # # ]: 0 : Sequence< Any > aArg(6);
9307 : :
9308 : : // Feed any with operating system's window handle
9309 : : // ==============================================
9310 : :
9311 : : // common: first any is VCL pointer to window (for VCL canvas)
9312 [ # # ][ # # ]: 0 : aArg[ 0 ] = makeAny( reinterpret_cast<sal_Int64>(this) );
9313 : :
9314 : : // TODO(Q1): Make GetSystemData method virtual
9315 : :
9316 : : // check whether we're a SysChild: have to fetch system data
9317 : : // directly from SystemChildWindow, because the GetSystemData
9318 : : // method is unfortunately not virtual
9319 [ # # ]: 0 : const SystemChildWindow* pSysChild = dynamic_cast< const SystemChildWindow* >( this );
9320 [ # # ]: 0 : if( pSysChild )
9321 : : {
9322 [ # # ][ # # ]: 0 : aArg[ 1 ] = pSysChild->GetSystemDataAny();
9323 [ # # ][ # # ]: 0 : aArg[ 5 ] = pSysChild->GetSystemGfxDataAny();
9324 : : }
9325 : : else
9326 : : {
9327 [ # # ][ # # ]: 0 : aArg[ 1 ] = GetSystemDataAny();
9328 [ # # ][ # # ]: 0 : aArg[ 5 ] = GetSystemGfxDataAny();
9329 : : }
9330 : :
9331 [ # # ]: 0 : if( bFullscreen )
9332 [ # # ]: 0 : aArg[ 2 ] = makeAny( ::com::sun::star::awt::Rectangle( 0, 0,
9333 : 0 : rFullscreenSize.Width(),
9334 [ # # ]: 0 : rFullscreenSize.Height() ) );
9335 : : else
9336 [ # # ][ # # ]: 0 : aArg[ 2 ] = makeAny( ::com::sun::star::awt::Rectangle( mnOutOffX, mnOutOffY, mnOutWidth, mnOutHeight ) );
9337 : :
9338 [ # # ][ # # ]: 0 : aArg[ 3 ] = makeAny( mpWindowImpl->mbAlwaysOnTop ? sal_True : sal_False );
[ # # ]
9339 [ # # ]: 0 : aArg[ 4 ] = makeAny( uno::Reference< awt::XWindow >(
9340 : 0 : const_cast<Window*>(this)->GetComponentInterface(),
9341 [ # # ][ # # ]: 0 : uno::UNO_QUERY ));
[ # # ]
9342 : :
9343 [ # # ]: 0 : uno::Reference< XMultiServiceFactory > xFactory = vcl::unohelper::GetMultiServiceFactory();
9344 : :
9345 : : // Create canvas instance with window handle
9346 : : // =========================================
9347 [ # # ]: 0 : if ( xFactory.is() )
9348 : : {
9349 : : static ::vcl::DeleteUnoReferenceOnDeinit<lang::XMultiServiceFactory> xStaticCanvasFactory(
9350 : : uno::Reference<lang::XMultiServiceFactory>(
9351 [ # # ]: 0 : xFactory->createInstance(
9352 : 0 : OUString( "com.sun.star.rendering.CanvasFactory" ) ),
9353 [ # # ][ # # ]: 0 : UNO_QUERY ));
[ # # ][ # # ]
[ # # ][ # # ]
9354 : 0 : uno::Reference<lang::XMultiServiceFactory> xCanvasFactory(xStaticCanvasFactory.get());
9355 : :
9356 [ # # ]: 0 : if(xCanvasFactory.is())
9357 : : {
9358 : : #ifdef WNT
9359 : : // see #140456# - if we're running on a multiscreen setup,
9360 : : // request special, multi-screen safe sprite canvas
9361 : : // implementation (not DX5 canvas, as it cannot cope with
9362 : : // surfaces spanning multiple displays). Note: canvas
9363 : : // (without sprite) stays the same)
9364 : : const sal_uInt32 nDisplay = static_cast< WinSalFrame* >( mpWindowImpl->mpFrame )->mnDisplay;
9365 : : if( (nDisplay >= Application::GetScreenCount()) )
9366 : : {
9367 : : xCanvas.set( xCanvasFactory->createInstanceWithArguments(
9368 : : bSpriteCanvas ?
9369 : : OUString( "com.sun.star.rendering.SpriteCanvas.MultiScreen" ) :
9370 : : OUString( "com.sun.star.rendering.Canvas" ),
9371 : : aArg ),
9372 : : UNO_QUERY );
9373 : :
9374 : : }
9375 : : else
9376 : : {
9377 : : #endif
9378 [ # # ]: 0 : xCanvas.set( xCanvasFactory->createInstanceWithArguments(
9379 : : bSpriteCanvas ?
9380 : : OUString( "com.sun.star.rendering.SpriteCanvas" ) :
9381 : : OUString( "com.sun.star.rendering.Canvas" ),
9382 : 0 : aArg ),
9383 [ # # ][ # # ]: 0 : UNO_QUERY );
[ # # ][ # # ]
[ # # ]
[ # # # # ]
9384 : :
9385 : : #ifdef WNT
9386 : : }
9387 : : #endif
9388 : :
9389 [ # # ]: 0 : mpWindowImpl->mxCanvas = xCanvas;
9390 : 0 : }
9391 : : }
9392 : :
9393 : : // no factory??? Empty reference, then.
9394 [ # # ]: 0 : return xCanvas;
9395 : : }
9396 : :
9397 : 0 : uno::Reference< rendering::XCanvas > Window::GetCanvas() const
9398 : : {
9399 [ # # ]: 0 : return ImplGetCanvas( Size(), false, false );
9400 : : }
9401 : :
9402 : 0 : uno::Reference< rendering::XSpriteCanvas > Window::GetSpriteCanvas() const
9403 : : {
9404 : : uno::Reference< rendering::XSpriteCanvas > xSpriteCanvas(
9405 [ # # ][ # # ]: 0 : ImplGetCanvas( Size(), false, true ), uno::UNO_QUERY );
9406 : 0 : return xSpriteCanvas;
9407 : : }
9408 : :
9409 : 10762 : void Window::ImplPaintToDevice( OutputDevice* i_pTargetOutDev, const Point& i_rPos )
9410 : : {
9411 : 10762 : sal_Bool bRVisible = mpWindowImpl->mbReallyVisible;
9412 : 10762 : mpWindowImpl->mbReallyVisible = mpWindowImpl->mbVisible;
9413 : 10762 : sal_Bool bDevOutput = mbDevOutput;
9414 : 10762 : mbDevOutput = sal_True;
9415 : :
9416 : 10762 : long nOldDPIX = ImplGetDPIX();
9417 : 10762 : long nOldDPIY = ImplGetDPIY();
9418 : 10762 : mnDPIX = i_pTargetOutDev->ImplGetDPIX();
9419 : 10762 : mnDPIY = i_pTargetOutDev->ImplGetDPIY();
9420 : 10762 : sal_Bool bOutput = IsOutputEnabled();
9421 [ + - ]: 10762 : EnableOutput();
9422 : :
9423 : : DBG_ASSERT( GetMapMode().GetMapUnit() == MAP_PIXEL, "MapMode must be PIXEL based" );
9424 [ + - ]: 10762 : if ( GetMapMode().GetMapUnit() != MAP_PIXEL )
9425 : 10762 : return;
9426 : :
9427 : : // preserve graphicsstate
9428 [ + - ]: 10762 : Push();
9429 [ + - ]: 10762 : Region aClipRegion( GetClipRegion() );
9430 [ + - ]: 10762 : SetClipRegion();
9431 : :
9432 : 10762 : GDIMetaFile* pOldMtf = GetConnectMetaFile();
9433 [ + - ]: 10762 : GDIMetaFile aMtf;
9434 [ + - ]: 10762 : SetConnectMetaFile( &aMtf );
9435 : :
9436 : : // put a push action to metafile
9437 [ + - ]: 10762 : Push();
9438 : : // copy graphics state to metafile
9439 [ + - ]: 10762 : Font aCopyFont = GetFont();
9440 [ + - ][ - + ]: 10762 : if( nOldDPIX != mnDPIX || nOldDPIY != mnDPIY )
9441 : : {
9442 [ # # ][ # # ]: 0 : aCopyFont.SetHeight( aCopyFont.GetHeight() * mnDPIY / nOldDPIY );
9443 [ # # ][ # # ]: 0 : aCopyFont.SetWidth( aCopyFont.GetWidth() * mnDPIX / nOldDPIX );
9444 : : }
9445 [ + - ]: 10762 : SetFont( aCopyFont );
9446 [ + - ]: 10762 : SetTextColor( GetTextColor() );
9447 [ + + ]: 10762 : if( IsLineColor() )
9448 [ + - ]: 10438 : SetLineColor( GetLineColor() );
9449 : : else
9450 [ + - ]: 324 : SetLineColor();
9451 [ + - ]: 10762 : if( IsFillColor() )
9452 [ + - ]: 10762 : SetFillColor( GetFillColor() );
9453 : : else
9454 [ # # ]: 0 : SetFillColor();
9455 [ - + ]: 10762 : if( IsTextLineColor() )
9456 [ # # ]: 0 : SetTextLineColor( GetTextLineColor() );
9457 : : else
9458 [ + - ]: 10762 : SetTextLineColor();
9459 [ - + ]: 10762 : if( IsOverlineColor() )
9460 [ # # ]: 0 : SetOverlineColor( GetOverlineColor() );
9461 : : else
9462 [ + - ]: 10762 : SetOverlineColor();
9463 [ + - ][ + + ]: 10762 : if( IsTextFillColor() )
9464 [ + - ][ + - ]: 73 : SetTextFillColor( GetTextFillColor() );
9465 : : else
9466 [ + - ]: 10689 : SetTextFillColor();
9467 [ + - ][ + - ]: 10762 : SetTextAlign( GetTextAlign() );
9468 [ + - ]: 10762 : SetRasterOp( GetRasterOp() );
9469 [ - + ]: 10762 : if( IsRefPoint() )
9470 [ # # ]: 0 : SetRefPoint( GetRefPoint() );
9471 : : else
9472 [ + - ]: 10762 : SetRefPoint();
9473 [ + - ]: 10762 : SetLayoutMode( GetLayoutMode() );
9474 [ + - ]: 10762 : SetDigitLanguage( GetDigitLanguage() );
9475 [ + - ]: 10762 : Rectangle aPaintRect( Point( 0, 0 ), GetOutputSizePixel() );
9476 [ + - ]: 10762 : aClipRegion.Intersect( aPaintRect );
9477 [ + - ]: 10762 : SetClipRegion( aClipRegion );
9478 : :
9479 : : // do the actual paint
9480 : :
9481 : : // background
9482 [ + - ][ + + ]: 10762 : if( ! IsPaintTransparent() && IsBackground() && ! (GetParentClipMode() & PARENTCLIPMODE_NOCLIP ) )
[ + + ][ + - ]
[ + - ][ + + ]
9483 [ + - ]: 4656 : Erase();
9484 : : // foreground
9485 [ + - ]: 10762 : Paint( aPaintRect );
9486 : : // put a pop action to metafile
9487 [ + - ]: 10762 : Pop();
9488 : :
9489 [ + - ]: 10762 : SetConnectMetaFile( pOldMtf );
9490 [ + - ]: 10762 : EnableOutput( bOutput );
9491 : 10762 : mpWindowImpl->mbReallyVisible = bRVisible;
9492 : :
9493 : : // paint metafile to VDev
9494 [ + - ][ + - ]: 10762 : VirtualDevice* pMaskedDevice = new VirtualDevice( *i_pTargetOutDev, 0, 0 );
9495 [ + - ]: 10762 : pMaskedDevice->SetOutputSizePixel( GetOutputSizePixel() );
9496 [ + - ]: 10762 : pMaskedDevice->EnableRTL( IsRTLEnabled() );
9497 [ + - ]: 10762 : aMtf.WindStart();
9498 [ + - ]: 10762 : aMtf.Play( pMaskedDevice );
9499 [ + - ]: 10762 : BitmapEx aBmpEx( pMaskedDevice->GetBitmapEx( Point( 0, 0 ), pMaskedDevice->GetOutputSizePixel() ) );
9500 [ + - ]: 10762 : i_pTargetOutDev->DrawBitmapEx( i_rPos, aBmpEx );
9501 : : // get rid of virtual device now so they don't pile up during recursive calls
9502 [ + - ][ + - ]: 10762 : delete pMaskedDevice, pMaskedDevice = NULL;
9503 : :
9504 : :
9505 [ + + ]: 18668 : for( Window* pChild = mpWindowImpl->mpFirstChild; pChild; pChild = pChild->mpWindowImpl->mpNext )
9506 : : {
9507 [ + - ][ + - ]: 7906 : if( pChild->mpWindowImpl->mpFrame == mpWindowImpl->mpFrame && pChild->IsVisible() )
[ + + ][ + + ]
9508 : : {
9509 : 6720 : long nDeltaX = pChild->mnOutOffX - mnOutOffX;
9510 [ + - ][ - + ]: 6720 : if( ImplHasMirroredGraphics() )
9511 : 0 : nDeltaX = mnOutWidth - nDeltaX - pChild->mnOutWidth;
9512 : 6720 : long nDeltaY = pChild->GetOutOffYPixel() - GetOutOffYPixel();
9513 : 6720 : Point aPos( i_rPos );
9514 : 6720 : Point aDelta( nDeltaX, nDeltaY );
9515 : 6720 : aPos += aDelta;
9516 [ + - ]: 6720 : pChild->ImplPaintToDevice( i_pTargetOutDev, aPos );
9517 : : }
9518 : : }
9519 : :
9520 : : // restore graphics state
9521 [ + - ]: 10762 : Pop();
9522 : :
9523 [ + - ]: 10762 : EnableOutput( bOutput );
9524 : 10762 : mpWindowImpl->mbReallyVisible = bRVisible;
9525 : 10762 : mbDevOutput = bDevOutput;
9526 : 10762 : mnDPIX = nOldDPIX;
9527 [ + - ][ + - ]: 10762 : mnDPIY = nOldDPIY;
[ + - ][ + - ]
9528 : : }
9529 : :
9530 : 4042 : void Window::PaintToDevice( OutputDevice* pDev, const Point& rPos, const Size& /*rSize*/ )
9531 : : {
9532 : : // FIXME: scaling: currently this is for pixel copying only
9533 : :
9534 : : DBG_ASSERT( ! pDev->ImplHasMirroredGraphics(), "PaintToDevice to mirroring graphics" );
9535 : : DBG_ASSERT( ! pDev->IsRTLEnabled(), "PaintToDevice to mirroring device" );
9536 : :
9537 : 4042 : Window* pRealParent = NULL;
9538 [ + - ]: 4042 : if( ! mpWindowImpl->mbVisible )
9539 : : {
9540 : 4042 : Window* pTempParent = ImplGetDefaultWindow();
9541 [ + - ]: 4042 : if( pTempParent )
9542 : 4042 : pTempParent->EnableChildTransparentMode();
9543 : 4042 : pRealParent = GetParent();
9544 : 4042 : SetParent( pTempParent );
9545 : : // trigger correct visibility flags for children
9546 : 4042 : Show();
9547 : 4042 : Hide();
9548 : : }
9549 : :
9550 : 4042 : sal_Bool bVisible = mpWindowImpl->mbVisible;
9551 : 4042 : mpWindowImpl->mbVisible = sal_True;
9552 : :
9553 [ + + ]: 4042 : if( mpWindowImpl->mpBorderWindow )
9554 : 2780 : mpWindowImpl->mpBorderWindow->ImplPaintToDevice( pDev, rPos );
9555 : : else
9556 : 1262 : ImplPaintToDevice( pDev, rPos );
9557 : :
9558 : 4042 : mpWindowImpl->mbVisible = bVisible;
9559 : :
9560 [ + - ]: 4042 : if( pRealParent )
9561 : 4042 : SetParent( pRealParent );
9562 : 4042 : }
9563 : :
9564 : 0 : rtl::OUString Window::GetSurroundingText() const
9565 : : {
9566 : 0 : return rtl::OUString();
9567 : : }
9568 : :
9569 : 0 : Selection Window::GetSurroundingTextSelection() const
9570 : : {
9571 : 0 : return Selection( 0, 0 );
9572 : : }
9573 : :
9574 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|