[Libreoffice-commits] core.git: 2 commits - lingucomponent/source vcl/source
Tor Lillqvist
tml at collabora.com
Fri May 23 02:33:21 PDT 2014
lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx | 2
vcl/source/window/window.cxx | 5276 +++++++++---------
2 files changed, 2639 insertions(+), 2639 deletions(-)
New commits:
commit f98eab9fa1d6bc78fd70d2014c8b31da556b4ef9
Author: Tor Lillqvist <tml at collabora.com>
Date: Fri May 23 12:31:16 2014 +0300
Fix typo
Change-Id: I7ee0eecc36659ac8ee9a62698923a90e96b7f302
diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
index 86b0d5e..9f7028b 100644
--- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
+++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx
@@ -288,7 +288,7 @@ Reference< XHyphenatedWord > SAL_CALL Hyphenator::hyphenate( const OUString& aWo
#if defined(WNT)
// Hyphen waits UTF-8 encoded paths with \\?\ long path prefix.
- OString sTmp = OUStringToOString(dicpath, RTL_TEXTENCODING_UTF8);
+ OString sTmp = OUStringToOString(dictpath, RTL_TEXTENCODING_UTF8);
#else
OString sTmp( OU2ENC( dictpath, osl_getThreadTextEncoding() ) );
#endif
commit d1f97479dab4da60679017313fe3369ae56117ea
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date: Fri May 23 19:26:52 2014 +1000
vcl: rearrange window.cxx functions
Change-Id: I3f59b87554b858e400056d74e04cd7ca361cf758
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index a2d2736..67a1c6a 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -115,164 +115,6 @@ using ::com::sun::star::awt::XTopWindow;
#define IMPL_PAINT_ERASE ((sal_uInt16)0x0010)
#define IMPL_PAINT_CHECKRTL ((sal_uInt16)0x0020)
-WindowImpl::WindowImpl( WindowType nType )
-{
- maZoom = Fraction( 1, 1 );
- maWinRegion = Region(true);
- maWinClipRegion = Region(true);
- mpWinData = NULL; // Extra Window Data, that we dont need for all windows
- mpOverlapData = NULL; // Overlap Data
- mpFrameData = NULL; // Frame Data
- mpFrame = NULL; // Pointer to frame window
- mpSysObj = NULL;
- mpFrameWindow = NULL; // window to top level parent (same as frame window)
- mpOverlapWindow = NULL; // first overlap parent
- mpBorderWindow = NULL; // Border-Window
- mpClientWindow = NULL; // Client-Window of a FrameWindow
- mpParent = NULL; // parent (inkl. BorderWindow)
- mpRealParent = NULL; // real parent (exkl. BorderWindow)
- mpFirstChild = NULL; // first child window
- mpLastChild = NULL; // last child window
- mpFirstOverlap = NULL; // first overlap window (only set in overlap windows)
- mpLastOverlap = NULL; // last overlap window (only set in overlap windows)
- mpPrev = NULL; // prev window
- mpNext = NULL; // next window
- mpNextOverlap = NULL; // next overlap window of frame
- mpLastFocusWindow = NULL; // window for focus restore
- mpDlgCtrlDownWindow = NULL; // window for dialog control
- mpFirstDel = NULL; // Dtor notification list
- mpUserData = NULL; // user data
- mpCursor = NULL; // cursor
- mpControlFont = NULL; // font propertie
- mpVCLXWindow = NULL;
- mpAccessibleInfos = NULL;
- maControlForeground = Color( COL_TRANSPARENT ); // no foreground set
- maControlBackground = Color( COL_TRANSPARENT ); // no background set
- mnLeftBorder = 0; // left border
- mnTopBorder = 0; // top border
- mnRightBorder = 0; // right border
- mnBottomBorder = 0; // bottom border
- mnWidthRequest = -1; // width request
- mnHeightRequest = -1; // height request
- mnX = 0; // X-Position to Parent
- mnY = 0; // Y-Position to Parent
- mnAbsScreenX = 0; // absolute X-position on screen, used for RTL window positioning
- mpChildClipRegion = NULL; // Child-Clip-Region when ClipChildren
- mpPaintRegion = NULL; // Paint-ClipRegion
- mnStyle = 0; // style (init in ImplInitWindow)
- mnPrevStyle = 0; // prevstyle (set in SetStyle)
- mnExtendedStyle = 0; // extended style (init in ImplInitWindow)
- mnPrevExtendedStyle = 0; // prevstyle (set in SetExtendedStyle)
- mnType = nType; // type
- mnGetFocusFlags = 0; // Flags fuer GetFocus()-Aufruf
- mnWaitCount = 0; // Wait-Count (>1 == Warte-MousePointer)
- mnPaintFlags = 0; // Flags for ImplCallPaint
- mnParentClipMode = 0; // Flags for Parent-ClipChildren-Mode
- mnActivateMode = 0; // Will be converted in System/Overlap-Windows
- mnDlgCtrlFlags = 0; // DialogControl-Flags
- mnLockCount = 0; // LockCount
- meAlwaysInputMode = AlwaysInputNone; // neither AlwaysEnableInput nor AlwaysDisableInput called
- meHalign = VCL_ALIGN_FILL;
- meValign = VCL_ALIGN_FILL;
- mePackType = VCL_PACK_START;
- mnPadding = 0;
- mnGridHeight = 1;
- mnGridLeftAttach = -1;
- mnGridTopAttach = -1;
- mnGridWidth = 1;
- mnBorderWidth = 0;
- mnMarginLeft = 0;
- mnMarginRight = 0;
- mnMarginTop = 0;
- mnMarginBottom = 0;
- mbFrame = false; // true: Window is a frame window
- mbBorderWin = false; // true: Window is a border window
- mbOverlapWin = false; // true: Window is a overlap window
- mbSysWin = false; // true: SystemWindow is the base class
- mbDialog = false; // true: Dialog is the base class
- mbDockWin = false; // true: DockingWindow is the base class
- mbFloatWin = false; // true: FloatingWindow is the base class
- mbPushButton = false; // true: PushButton is the base class
- mbToolBox = false; // true: ToolBox is the base class
- mbMenuFloatingWindow= false; // true: MenuFloatingWindow is the base class
- mbToolbarFloatingWindow= false; // true: ImplPopupFloatWin is the base class, used for subtoolbars
- mbSplitter = false; // true: Splitter is the base class
- mbVisible = false; // true: Show( sal_True ) called
- mbOverlapVisible = false; // true: Hide called for visible window from ImplHideAllOverlapWindow()
- mbDisabled = false; // true: Enable( sal_False ) called
- mbInputDisabled = false; // true: EnableInput( sal_False ) called
- mbDropDisabled = false; // true: Drop is enabled
- mbNoUpdate = false; // true: SetUpdateMode( sal_False ) called
- mbNoParentUpdate = false; // true: SetParentUpdateMode( sal_False ) called
- mbActive = false; // true: Window Active
- mbParentActive = false; // true: OverlapActive from Parent
- mbReallyVisible = false; // true: this and all parents to an overlapped window are visible
- mbReallyShown = false; // true: this and all parents to an overlapped window are shown
- mbInInitShow = false; // true: we are in InitShow
- mbChildNotify = false; // true: ChildNotify
- mbChildPtrOverwrite = false; // true: PointerStyle overwrites Child-Pointer
- mbNoPtrVisible = false; // true: ShowPointer( sal_False ) called
- mbMouseMove = false; // true: BaseMouseMove called
- mbPaintFrame = false; // true: Paint is visible, but not painted
- mbInPaint = false; // true: Inside PaintHdl
- mbMouseButtonDown = false; // true: BaseMouseButtonDown called
- mbMouseButtonUp = false; // true: BaseMouseButtonUp called
- mbKeyInput = false; // true: BaseKeyInput called
- mbKeyUp = false; // true: BaseKeyUp called
- mbCommand = false; // true: BaseCommand called
- mbDefPos = true; // true: Position is not Set
- mbDefSize = true; // true: Size is not Set
- mbCallMove = true; // true: Move must be called by Show
- mbCallResize = true; // true: Resize must be called by Show
- mbWaitSystemResize = true; // true: Wait for System-Resize
- mbInitWinClipRegion = true; // true: Calc Window Clip Region
- mbInitChildRegion = false; // true: InitChildClipRegion
- mbWinRegion = false; // true: Window Region
- mbClipChildren = false; // true: Child-window should be clipped
- mbClipSiblings = false; // true: Adjacent Child-window should be clipped
- mbChildTransparent = false; // true: Child-windows are allowed to switch to transparent (incl. Parent-CLIPCHILDREN)
- mbPaintTransparent = false; // true: Paints should be executed on the Parent
- mbMouseTransparent = false; // true: Window is transparent for Mouse
- mbDlgCtrlStart = false; // true: From here on own Dialog-Control
- mbFocusVisible = false; // true: Focus Visible
- mbUseNativeFocus = false;
- mbNativeFocusVisible= false; // true: native Focus Visible
- mbInShowFocus = false; // prevent recursion
- mbInHideFocus = false; // prevent recursion
- mbTrackVisible = false; // true: Tracking Visible
- mbControlForeground = false; // true: Foreground-Property set
- mbControlBackground = false; // true: Background-Property set
- mbAlwaysOnTop = false; // true: always visible for all others windows
- mbCompoundControl = false; // true: Composite Control => Listener...
- mbCompoundControlHasFocus = false; // true: Composite Control has focus somewhere
- mbPaintDisabled = false; // true: Paint should not be executed
- mbAllResize = false; // true: Also sent ResizeEvents with 0,0
- mbInDtor = false; // true: We're still in Window-Dtor
- mbExtTextInput = false; // true: ExtTextInput-Mode is active
- mbInFocusHdl = false; // true: Within GetFocus-Handler
- mbCreatedWithToolkit = false;
- mbSuppressAccessibilityEvents = false; // true: do not send any accessibility events
- mbDrawSelectionBackground = false; // true: draws transparent window background to indicate (toolbox) selection
- mbIsInTaskPaneList = false; // true: window was added to the taskpanelist in the topmost system window
- mnNativeBackground = 0; // initialize later, depends on type
- mbCallHandlersDuringInputDisabled = false; // true: call event handlers even if input is disabled
- mbHelpTextDynamic = false; // true: append help id in HELP_DEBUG case
- mbFakeFocusSet = false; // true: pretend as if the window has focus.
- mbHexpand = false;
- mbVexpand = false;
- mbExpand = false;
- mbFill = true;
- mbSecondary = false;
- mbNonHomogeneous = false;
-}
-
-WindowImpl::~WindowImpl()
-{
- delete mpChildClipRegion;
- delete mpAccessibleInfos;
- delete mpControlFont;
-}
-
Window::Window( WindowType nType )
{
ImplInitWindowData( nType );
@@ -298,3113 +140,3271 @@ Window::Window( Window* pParent, const ResId& rResId )
Show();
}
-bool Window::AcquireGraphics() const
+Window::~Window()
{
- DBG_TESTSOLARMUTEX();
-
- if ( mpGraphics )
- return true;
+ vcl::LazyDeletor<Window>::Undelete( this );
- mbInitLineColor = true;
- mbInitFillColor = true;
- mbInitFont = true;
- mbInitTextColor = true;
- mbInitClipRegion = true;
+ DBG_ASSERT( !mpWindowImpl->mbInDtor, "~Window - already in DTOR!" );
- ImplSVData* pSVData = ImplGetSVData();
+ // remove Key and Mouse events issued by Application::PostKey/MouseEvent
+ Application::RemoveMouseAndKeyEvents( this );
- mpGraphics = mpWindowImpl->mpFrame->AcquireGraphics();
- // try harder if no wingraphics was available directly
- if ( !mpGraphics )
+ // Dispose of the canvas implementation (which, currently, has an
+ // own wrapper window as a child to this one.
+ uno::Reference< rendering::XCanvas > xCanvas( mpWindowImpl->mxCanvas );
+ if( xCanvas.is() )
{
- // find another output device in the same frame
- OutputDevice* pReleaseOutDev = pSVData->maGDIData.mpLastWinGraphics;
- while ( pReleaseOutDev )
- {
- if ( ((Window*)pReleaseOutDev)->mpWindowImpl->mpFrame == mpWindowImpl->mpFrame )
- break;
- pReleaseOutDev = pReleaseOutDev->mpPrevGraphics;
- }
-
- if ( pReleaseOutDev )
- {
- // steal the wingraphics from the other outdev
- mpGraphics = pReleaseOutDev->mpGraphics;
- pReleaseOutDev->ReleaseGraphics( false );
- }
- else
- {
- // if needed retry after releasing least recently used wingraphics
- while ( !mpGraphics )
- {
- if ( !pSVData->maGDIData.mpLastWinGraphics )
- break;
- pSVData->maGDIData.mpLastWinGraphics->ReleaseGraphics();
- mpGraphics = mpWindowImpl->mpFrame->AcquireGraphics();
- }
- }
+ uno::Reference < lang::XComponent > xCanvasComponent( xCanvas,
+ uno::UNO_QUERY );
+ if( xCanvasComponent.is() )
+ xCanvasComponent->dispose();
}
- // update global LRU list of wingraphics
- if ( mpGraphics )
- {
- mpNextGraphics = pSVData->maGDIData.mpFirstWinGraphics;
- pSVData->maGDIData.mpFirstWinGraphics = const_cast<Window*>(this);
- if ( mpNextGraphics )
- mpNextGraphics->mpPrevGraphics = const_cast<Window*>(this);
- if ( !pSVData->maGDIData.mpLastWinGraphics )
- pSVData->maGDIData.mpLastWinGraphics = const_cast<Window*>(this);
- }
+ mpWindowImpl->mbInDtor = true;
- if ( mpGraphics )
- {
- mpGraphics->SetXORMode( (ROP_INVERT == meRasterOp) || (ROP_XOR == meRasterOp), ROP_INVERT == meRasterOp );
- mpGraphics->setAntiAliasB2DDraw(mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW);
- }
+ ImplCallEventListeners( VCLEVENT_OBJECT_DYING );
- return mpGraphics ? true : false;
-}
+ // do not send child events for frames that were registered as native frames
+ if( !ImplIsAccessibleNativeFrame() && mpWindowImpl->mbReallyVisible )
+ if ( ImplIsAccessibleCandidate() && GetAccessibleParentWindow() )
+ GetAccessibleParentWindow()->ImplCallEventListeners( VCLEVENT_WINDOW_CHILDDESTROYED, this );
-void Window::ReleaseGraphics( bool bRelease )
-{
- DBG_TESTSOLARMUTEX();
+ // remove associated data structures from dockingmanager
+ ImplGetDockingManager()->RemoveWindow( this );
- if ( !mpGraphics )
- return;
+ // remove ownerdraw decorated windows from list in the top-most frame window
+ if( (GetStyle() & WB_OWNERDRAWDECORATION) && mpWindowImpl->mbFrame )
+ {
+ ::std::vector< Window* >& rList = ImplGetOwnerDrawList();
+ ::std::vector< Window* >::iterator p;
+ p = ::std::find( rList.begin(), rList.end(), this );
+ if( p != rList.end() )
+ rList.erase( p );
+ }
- // release the fonts of the physically released graphics device
- if( bRelease )
- ImplReleaseFonts();
+ // shutdown drag and drop
+ ::com::sun::star::uno::Reference < ::com::sun::star::lang::XComponent > xDnDComponent( mpWindowImpl->mxDNDListenerContainer, ::com::sun::star::uno::UNO_QUERY );
- ImplSVData* pSVData = ImplGetSVData();
-
- Window* pWindow = (Window*)this;
-
- if ( bRelease )
- pWindow->mpWindowImpl->mpFrame->ReleaseGraphics( mpGraphics );
- // remove from global LRU list of window graphics
- if ( mpPrevGraphics )
- mpPrevGraphics->mpNextGraphics = mpNextGraphics;
- else
- pSVData->maGDIData.mpFirstWinGraphics = mpNextGraphics;
- if ( mpNextGraphics )
- mpNextGraphics->mpPrevGraphics = mpPrevGraphics;
- else
- pSVData->maGDIData.mpLastWinGraphics = mpPrevGraphics;
-
- mpGraphics = NULL;
- mpPrevGraphics = NULL;
- mpNextGraphics = NULL;
-}
-
-void Window::CopyDeviceArea( SalTwoRect& aPosAry, sal_uInt32 nFlags )
-{
- if (aPosAry.mnSrcWidth == 0 || aPosAry.mnSrcHeight == 0 || aPosAry.mnDestWidth == 0 || aPosAry.mnDestHeight == 0)
- return;
-
- if (nFlags & COPYAREA_WINDOWINVALIDATE)
- {
- const Rectangle aSrcRect(Point(aPosAry.mnSrcX, aPosAry.mnSrcY),
- Size(aPosAry.mnSrcWidth, aPosAry.mnSrcHeight));
-
- ImplMoveAllInvalidateRegions(aSrcRect,
- aPosAry.mnDestX-aPosAry.mnSrcX,
- aPosAry.mnDestY-aPosAry.mnSrcY,
- false);
-
- mpGraphics->CopyArea(aPosAry.mnDestX, aPosAry.mnDestY,
- aPosAry.mnSrcX, aPosAry.mnSrcY,
- aPosAry.mnSrcWidth, aPosAry.mnSrcHeight,
- SAL_COPYAREA_WINDOWINVALIDATE, this);
-
- return;
- }
-
- OutputDevice::CopyDeviceArea(aPosAry, nFlags);
-}
-
-void Window::ImplInitAppFontData( Window* pWindow )
-{
- ImplSVData* pSVData = ImplGetSVData();
- long nTextHeight = pWindow->GetTextHeight();
- long nTextWidth = pWindow->approximate_char_width() * 8;
- long nSymHeight = nTextHeight*4;
- // Make the basis wider if the font is too narrow
- // such that the dialog looks symmetrical and does not become too narrow.
- // Add some extra space when the dialog has the same width,
- // as a little more space is better.
- if ( nSymHeight > nTextWidth )
- nTextWidth = nSymHeight;
- else if ( nSymHeight+5 > nTextWidth )
- nTextWidth = nSymHeight+5;
- pSVData->maGDIData.mnAppFontX = nTextWidth * 10 / 8;
- pSVData->maGDIData.mnAppFontY = nTextHeight * 10;
+ if( xDnDComponent.is() )
+ xDnDComponent->dispose();
- // FIXME: this is currently only on OS X, check with other
- // platforms
- if( pSVData->maNWFData.mbNoFocusRects )
+ if( mpWindowImpl->mbFrame && mpWindowImpl->mpFrameData )
{
- // try to find out whether there is a large correction
- // of control sizes, if yes, make app font scalings larger
- // so dialog positioning is not completely off
- ImplControlValue aControlValue;
- Rectangle aCtrlRegion( Point(), Size( nTextWidth < 10 ? 10 : nTextWidth, nTextHeight < 10 ? 10 : nTextHeight ) );
- Rectangle aBoundingRgn( aCtrlRegion );
- Rectangle aContentRgn( aCtrlRegion );
- if( pWindow->GetNativeControlRegion( CTRL_EDITBOX, PART_ENTIRE_CONTROL, aCtrlRegion,
- CTRL_STATE_ENABLED, aControlValue, OUString(),
- aBoundingRgn, aContentRgn ) )
+ try
{
- // comment: the magical +6 is for the extra border in bordered
- // (which is the standard) edit fields
- if( aContentRgn.GetHeight() - nTextHeight > (nTextHeight+4)/4 )
- pSVData->maGDIData.mnAppFontY = (aContentRgn.GetHeight()-4) * 10;
- }
- }
-
- pSVData->maGDIData.mnRealAppFontX = pSVData->maGDIData.mnAppFontX;
- if ( pSVData->maAppData.mnDialogScaleX )
- pSVData->maGDIData.mnAppFontX += (pSVData->maGDIData.mnAppFontX*pSVData->maAppData.mnDialogScaleX)/100;
-}
+ // deregister drop target listener
+ if( mpWindowImpl->mpFrameData->mxDropTargetListener.is() )
+ {
+ uno::Reference< XDragGestureRecognizer > xDragGestureRecognizer =
+ uno::Reference< XDragGestureRecognizer > (mpWindowImpl->mpFrameData->mxDragSource, UNO_QUERY);
+ if( xDragGestureRecognizer.is() )
+ {
+ xDragGestureRecognizer->removeDragGestureListener(
+ uno::Reference< XDragGestureListener > (mpWindowImpl->mpFrameData->mxDropTargetListener, UNO_QUERY));
+ }
-bool Window::ImplCheckUIFont( const Font& rFont )
-{
- if( ImplGetSVData()->maGDIData.mbNativeFontConfig )
- return true;
+ mpWindowImpl->mpFrameData->mxDropTarget->removeDropTargetListener( mpWindowImpl->mpFrameData->mxDropTargetListener );
+ mpWindowImpl->mpFrameData->mxDropTargetListener.clear();
+ }
- // create a text string using the localized text of important buttons
- OUString aTestText;
- static const StandardButtonType aTestButtons[] =
- {
- BUTTON_OK, BUTTON_CANCEL, BUTTON_CLOSE, BUTTON_ABORT,
- BUTTON_YES, BUTTON_NO, BUTTON_MORE, BUTTON_IGNORE,
- BUTTON_RETRY, BUTTON_HELP
- };
+ // shutdown drag and drop for this frame window
+ uno::Reference< XComponent > xComponent( mpWindowImpl->mpFrameData->mxDropTarget, UNO_QUERY );
- const int nTestButtonCount = SAL_N_ELEMENTS(aTestButtons);
- for( int n = 0; n < nTestButtonCount; ++n )
- {
- OUString aButtonStr = Button::GetStandardText( aTestButtons[n] );
- // #i115432# ignore mnemonic+accelerator part of each string
- // TODO: use a string filtering method when it becomes available
- const sal_Int32 nLen = aButtonStr.getLength();
- bool bInside = false;
- for( int i = 0; i < nLen; ++i ) {
- const sal_Unicode c = aButtonStr[ i ];
- if( (c == '('))
- bInside = true;
- if( (c == ')'))
- bInside = false;
- if( (c == '~')
- || (c == '(') || (c == ')')
- || ((c >= 'A') && (c <= 'Z') && bInside) )
- aButtonStr = aButtonStr.replaceAt( i, 1, " " );
+ // DNDEventDispatcher does not hold a reference of the DropTarget,
+ // so it's ok if it does not support XComponent
+ if( xComponent.is() )
+ xComponent->dispose();
}
- // append sanitized button text to test string
- aTestText += aButtonStr;
- }
-
- const bool bUIFontOk = ( HasGlyphs( rFont, aTestText ) == -1 );
- return bUIFontOk;
-}
-
-void Window::ImplInitWindowData( WindowType nType )
-{
- // We will eventually being removing the inheritance of OutputDevice from Window.
- // It will be replaced with a composition relationship. A Window will use an OutputDevice,
- // it will not *be* an OutputDevice
- mpOutputDevice = (OutputDevice*)this;
-
- mpWindowImpl = new WindowImpl( nType );
-
- meOutDevType = OUTDEV_WINDOW;
-
- mbEnableRTL = Application::GetSettings().GetLayoutRTL(); // true: this outdev will be mirrored if RTL window layout (UI mirroring) is globally active
-}
-
-static bool ImplDoTiledRendering()
-{
-#if !HAVE_FEATURE_DESKTOP
- // We do tiled rendering only for iOS at the moment, actually, but
- // let's see what happens if we assume it for Android, too.
- return true;
-#else
- // We need some way to know globally if this process will use
- // tiled rendering or not. Or should this be a per-window setting?
- // Or what?
- return false;
-#endif
-}
-
-static sal_Int32 CountDPIScaleFactor(sal_Int32 nDPI)
-{
- sal_Int32 nResult = 1;
-
-#ifndef MACOSX
- // Setting of HiDPI is unfortunately all only a heuristic; and to add
- // insult to an injury, the system is constantly lying to us about
- // the DPI and whatnot
- // eg. fdo#77059 - set the value from which we do consider the
- // screen hi-dpi to greater than 168
- if (nDPI > 168)
- nResult = std::max(sal_Int32(1), (nDPI + 48) / 96);
-#else
- (void)nDPI;
-#endif
-
- return nResult;
-}
-
-void Window::ImplInit( Window* pParent, WinBits nStyle, SystemParentData* pSystemParentData )
-{
- DBG_ASSERT( mpWindowImpl->mbFrame || pParent, "Window::Window(): pParent == NULL" );
-
- ImplSVData* pSVData = ImplGetSVData();
- Window* pRealParent = pParent;
-
- // 3D-Look vererben
- if ( !mpWindowImpl->mbOverlapWin && pParent && (pParent->GetStyle() & WB_3DLOOK) )
- nStyle |= WB_3DLOOK;
-
- // create border window if necessary
- if ( !mpWindowImpl->mbFrame && !mpWindowImpl->mbBorderWin && !mpWindowImpl->mpBorderWindow
- && (nStyle & (WB_BORDER | WB_SYSTEMCHILDWINDOW) ) )
- {
- sal_uInt16 nBorderTypeStyle = 0;
- if( (nStyle & WB_SYSTEMCHILDWINDOW) )
+ catch (const Exception&)
{
- // handle WB_SYSTEMCHILDWINDOW
- // these should be analogous to a top level frame; meaning they
- // should have a border window with style BORDERWINDOW_STYLE_FRAME
- // which controls their size
- nBorderTypeStyle |= BORDERWINDOW_STYLE_FRAME;
- nStyle |= WB_BORDER;
+ // can be safely ignored here.
}
- ImplBorderWindow* pBorderWin = new ImplBorderWindow( pParent, nStyle & (WB_BORDER | WB_DIALOGCONTROL | WB_NODIALOGCONTROL | WB_NEEDSFOCUS), nBorderTypeStyle );
- ((Window*)pBorderWin)->mpWindowImpl->mpClientWindow = this;
- pBorderWin->GetBorder( mpWindowImpl->mnLeftBorder, mpWindowImpl->mnTopBorder, mpWindowImpl->mnRightBorder, mpWindowImpl->mnBottomBorder );
- mpWindowImpl->mpBorderWindow = pBorderWin;
- pParent = mpWindowImpl->mpBorderWindow;
- }
- else if( !mpWindowImpl->mbFrame && ! pParent )
- {
- mpWindowImpl->mbOverlapWin = true;
- mpWindowImpl->mbFrame = true;
}
- // insert window in list
- ImplInsertWindow( pParent );
- mpWindowImpl->mnStyle = nStyle;
+ UnoWrapperBase* pWrapper = Application::GetUnoWrapper( false );
+ if ( pWrapper )
+ pWrapper->WindowDestroyed( this );
- // Overlap-Window-Data
- if ( mpWindowImpl->mbOverlapWin )
+ // MT: Must be called after WindowDestroyed!
+ // Otherwise, if the accessible is a VCLXWindow, it will try to destroy this window again!
+ // But accessibility implementations from applications need this dispose.
+ if ( mpWindowImpl->mxAccessible.is() )
{
- mpWindowImpl->mpOverlapData = new ImplOverlapData;
- mpWindowImpl->mpOverlapData->mpSaveBackDev = NULL;
- mpWindowImpl->mpOverlapData->mpSaveBackRgn = NULL;
- mpWindowImpl->mpOverlapData->mpNextBackWin = NULL;
- mpWindowImpl->mpOverlapData->mnSaveBackSize = 0;
- mpWindowImpl->mpOverlapData->mbSaveBack = false;
- mpWindowImpl->mpOverlapData->mnTopLevel = 1;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent> xC( mpWindowImpl->mxAccessible, ::com::sun::star::uno::UNO_QUERY );
+ if ( xC.is() )
+ xC->dispose();
}
- if( pParent && ! mpWindowImpl->mbFrame )
- mbEnableRTL = Application::GetSettings().GetLayoutRTL();
-
- // test for frame creation
- if ( mpWindowImpl->mbFrame )
- {
- // create frame
- sal_uLong nFrameStyle = 0;
-
- if ( nStyle & WB_MOVEABLE )
- nFrameStyle |= SAL_FRAME_STYLE_MOVEABLE;
- if ( nStyle & WB_SIZEABLE )
- nFrameStyle |= SAL_FRAME_STYLE_SIZEABLE;
- if ( nStyle & WB_CLOSEABLE )
- nFrameStyle |= SAL_FRAME_STYLE_CLOSEABLE;
- if ( nStyle & WB_APP )
- nFrameStyle |= SAL_FRAME_STYLE_DEFAULT;
- // check for undecorated floating window
- if( // 1. floating windows that are not moveable/sizeable (only closeable allowed)
- ( !(nFrameStyle & ~SAL_FRAME_STYLE_CLOSEABLE) &&
- ( mpWindowImpl->mbFloatWin || ((GetType() == WINDOW_BORDERWINDOW) && ((ImplBorderWindow*)this)->mbFloatWindow) || (nStyle & WB_SYSTEMFLOATWIN) ) ) ||
- // 2. borderwindows of floaters with ownerdraw decoration
- ( ((GetType() == WINDOW_BORDERWINDOW) && ((ImplBorderWindow*)this)->mbFloatWindow && (nStyle & WB_OWNERDRAWDECORATION) ) ) )
- {
- nFrameStyle = SAL_FRAME_STYLE_FLOAT;
- if( nStyle & WB_OWNERDRAWDECORATION )
- nFrameStyle |= (SAL_FRAME_STYLE_OWNERDRAWDECORATION | SAL_FRAME_STYLE_NOSHADOW);
- if( nStyle & WB_NEEDSFOCUS )
- nFrameStyle |= SAL_FRAME_STYLE_FLOAT_FOCUSABLE;
- }
- else if( mpWindowImpl->mbFloatWin )
- nFrameStyle |= SAL_FRAME_STYLE_TOOLWINDOW;
-
- if( nStyle & WB_INTROWIN )
- nFrameStyle |= SAL_FRAME_STYLE_INTRO;
- if( nStyle & WB_TOOLTIPWIN )
- nFrameStyle |= SAL_FRAME_STYLE_TOOLTIP;
-
- if( nStyle & WB_NOSHADOW )
- nFrameStyle |= SAL_FRAME_STYLE_NOSHADOW;
-
- if( nStyle & WB_SYSTEMCHILDWINDOW )
- nFrameStyle |= SAL_FRAME_STYLE_SYSTEMCHILD;
-
- switch (mpWindowImpl->mnType)
- {
- case WINDOW_DIALOG:
- case WINDOW_TABDIALOG:
- case WINDOW_MODALDIALOG:
- case WINDOW_MODELESSDIALOG:
- case WINDOW_MESSBOX:
- case WINDOW_INFOBOX:
- case WINDOW_WARNINGBOX:
- case WINDOW_ERRORBOX:
- case WINDOW_QUERYBOX:
- nFrameStyle |= SAL_FRAME_STYLE_DIALOG;
- default:
- break;
- }
+ ImplSVData* pSVData = ImplGetSVData();
- SalFrame* pParentFrame = NULL;
- if ( pParent )
- pParentFrame = pParent->mpWindowImpl->mpFrame;
- SalFrame* pFrame;
- if ( pSystemParentData )
- pFrame = pSVData->mpDefInst->CreateChildFrame( pSystemParentData, nFrameStyle | SAL_FRAME_STYLE_PLUG );
- else
- pFrame = pSVData->mpDefInst->CreateFrame( pParentFrame, nFrameStyle );
- if ( !pFrame )
- {
- // do not abort but throw an exception, may be the current thread terminates anyway (plugin-scenario)
- throw ::com::sun::star::uno::RuntimeException(
- OUString( "Could not create system window!" ),
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >() );
- }
+ if ( pSVData->maHelpData.mpHelpWin && (pSVData->maHelpData.mpHelpWin->GetParent() == this) )
+ ImplDestroyHelpWindow( true );
- pFrame->SetCallback( this, ImplWindowFrameProc );
+ DBG_ASSERT( pSVData->maWinData.mpTrackWin != this,
+ "Window::~Window(): Window is in TrackingMode" );
+ DBG_ASSERT( pSVData->maWinData.mpCaptureWin != this,
+ "Window::~Window(): Window has the mouse captured" );
+ // #103442# DefModalDialogParent is now determined on-the-fly, so this pointer is unimportant now
+ //DBG_ASSERT( pSVData->maWinData.mpDefDialogParent != this,
+ // "Window::~Window(): Window is DefModalDialogParent" );
- // set window frame data
- mpWindowImpl->mpFrameData = new ImplFrameData;
- mpWindowImpl->mpFrame = pFrame;
- mpWindowImpl->mpFrameWindow = this;
- mpWindowImpl->mpOverlapWindow = this;
+ // due to old compatibility
+ if ( pSVData->maWinData.mpTrackWin == this )
+ EndTracking();
+ if ( pSVData->maWinData.mpCaptureWin == this )
+ ReleaseMouse();
+ if ( pSVData->maWinData.mpDefDialogParent == this )
+ pSVData->maWinData.mpDefDialogParent = NULL;
- // set frame data
- mpWindowImpl->mpFrameData->mpNextFrame = pSVData->maWinData.mpFirstFrame;
- pSVData->maWinData.mpFirstFrame = this;
- mpWindowImpl->mpFrameData->mpFirstOverlap = NULL;
- mpWindowImpl->mpFrameData->mpFocusWin = NULL;
- mpWindowImpl->mpFrameData->mpMouseMoveWin = NULL;
- mpWindowImpl->mpFrameData->mpMouseDownWin = NULL;
- mpWindowImpl->mpFrameData->mpFirstBackWin = NULL;
- mpWindowImpl->mpFrameData->mpFontCollection = pSVData->maGDIData.mpScreenFontList;
- mpWindowImpl->mpFrameData->mpFontCache = pSVData->maGDIData.mpScreenFontCache;
- mpWindowImpl->mpFrameData->mnAllSaveBackSize = 0;
- mpWindowImpl->mpFrameData->mnFocusId = 0;
- mpWindowImpl->mpFrameData->mnMouseMoveId = 0;
- mpWindowImpl->mpFrameData->mnLastMouseX = -1;
- mpWindowImpl->mpFrameData->mnLastMouseY = -1;
- mpWindowImpl->mpFrameData->mnBeforeLastMouseX = -1;
- mpWindowImpl->mpFrameData->mnBeforeLastMouseY = -1;
- mpWindowImpl->mpFrameData->mnFirstMouseX = -1;
- mpWindowImpl->mpFrameData->mnFirstMouseY = -1;
- mpWindowImpl->mpFrameData->mnLastMouseWinX = -1;
- mpWindowImpl->mpFrameData->mnLastMouseWinY = -1;
- mpWindowImpl->mpFrameData->mnModalMode = 0;
- mpWindowImpl->mpFrameData->mnMouseDownTime = 0;
- mpWindowImpl->mpFrameData->mnClickCount = 0;
- mpWindowImpl->mpFrameData->mnFirstMouseCode = 0;
- mpWindowImpl->mpFrameData->mnMouseCode = 0;
- mpWindowImpl->mpFrameData->mnMouseMode = 0;
- mpWindowImpl->mpFrameData->meMapUnit = MAP_PIXEL;
- mpWindowImpl->mpFrameData->mbHasFocus = false;
- mpWindowImpl->mpFrameData->mbInMouseMove = false;
- mpWindowImpl->mpFrameData->mbMouseIn = false;
- mpWindowImpl->mpFrameData->mbStartDragCalled = false;
- mpWindowImpl->mpFrameData->mbNeedSysWindow = false;
- mpWindowImpl->mpFrameData->mbMinimized = false;
- mpWindowImpl->mpFrameData->mbStartFocusState = false;
- mpWindowImpl->mpFrameData->mbInSysObjFocusHdl = false;
- mpWindowImpl->mpFrameData->mbInSysObjToTopHdl = false;
- mpWindowImpl->mpFrameData->mbSysObjFocus = false;
- if (!ImplDoTiledRendering())
+#if OSL_DEBUG_LEVEL > 0
+ if ( true ) // always perform these tests in non-pro versions
+ {
+ OStringBuffer aErrorStr;
+ bool bError = false;
+ Window* pTempWin;
+ if (mpWindowImpl->mpFrameData != 0)
{
- mpWindowImpl->mpFrameData->maPaintTimer.SetTimeout( 30 );
- mpWindowImpl->mpFrameData->maPaintTimer.SetTimeoutHdl( LINK( this, Window, ImplHandlePaintHdl ) );
+ pTempWin = mpWindowImpl->mpFrameData->mpFirstOverlap;
+ while ( pTempWin )
+ {
+ if ( ImplIsRealParentPath( pTempWin ) )
+ {
+ bError = true;
+ aErrorStr.append(lcl_createWindowInfo(*pTempWin));
+ }
+ pTempWin = pTempWin->mpWindowImpl->mpNextOverlap;
+ }
+ if ( bError )
+ {
+ OStringBuffer aTempStr;
+ aTempStr.append("Window (");
+ aTempStr.append(OUStringToOString(GetText(),
+ RTL_TEXTENCODING_UTF8));
+ aTempStr.append(") with live SystemWindows destroyed: ");
+ aTempStr.append(aErrorStr.toString());
+ OSL_FAIL(aTempStr.getStr());
+ // abort in non-pro version, this must be fixed!
+ GetpApp()->Abort(OStringToOUString(
+ aTempStr.makeStringAndClear(), RTL_TEXTENCODING_UTF8));
+ }
}
- mpWindowImpl->mpFrameData->maResizeTimer.SetTimeout( 50 );
- mpWindowImpl->mpFrameData->maResizeTimer.SetTimeoutHdl( LINK( this, Window, ImplHandleResizeTimerHdl ) );
- mpWindowImpl->mpFrameData->mbInternalDragGestureRecognizer = false;
- if ( pRealParent && IsTopWindow() )
+ bError = false;
+ pTempWin = pSVData->maWinData.mpFirstFrame;
+ while ( pTempWin )
{
- ImplWinData* pParentWinData = pRealParent->ImplGetWinData();
- pParentWinData->maTopWindowChildren.push_back( this );
+ if ( ImplIsRealParentPath( pTempWin ) )
+ {
+ bError = true;
+ aErrorStr.append(lcl_createWindowInfo(*pTempWin));
+ }
+ pTempWin = pTempWin->mpWindowImpl->mpFrameData->mpNextFrame;
+ }
+ if ( bError )
+ {
+ OStringBuffer aTempStr( "Window (" );
+ aTempStr.append(OUStringToOString(GetText(), RTL_TEXTENCODING_UTF8));
+ aTempStr.append(") with live SystemWindows destroyed: ");
+ aTempStr.append(aErrorStr.toString());
+ OSL_FAIL( aTempStr.getStr() );
+ GetpApp()->Abort(OStringToOUString(aTempStr.makeStringAndClear(), RTL_TEXTENCODING_UTF8)); // abort in non-pro version, this must be fixed!
}
- }
-
- // init data
- mpWindowImpl->mpRealParent = pRealParent;
-
- // #99318: make sure fontcache and list is available before call to SetSettings
- mpFontCollection = mpWindowImpl->mpFrameData->mpFontCollection;
- mpFontCache = mpWindowImpl->mpFrameData->mpFontCache;
- if ( mpWindowImpl->mbFrame )
- {
- if ( pParent )
+ if ( mpWindowImpl->mpFirstChild )
{
- mpWindowImpl->mpFrameData->mnDPIX = pParent->mpWindowImpl->mpFrameData->mnDPIX;
- mpWindowImpl->mpFrameData->mnDPIY = pParent->mpWindowImpl->mpFrameData->mnDPIY;
+ OStringBuffer aTempStr("Window (");
+ aTempStr.append(OUStringToOString(GetText(), RTL_TEXTENCODING_UTF8));
+ aTempStr.append(") with live children destroyed: ");
+ pTempWin = mpWindowImpl->mpFirstChild;
+ while ( pTempWin )
+ {
+ aTempStr.append(lcl_createWindowInfo(*pTempWin));
+ pTempWin = pTempWin->mpWindowImpl->mpNext;
+ }
+ OSL_FAIL( aTempStr.getStr() );
+ GetpApp()->Abort(OStringToOUString(aTempStr.makeStringAndClear(), RTL_TEXTENCODING_UTF8)); // abort in non-pro version, this must be fixed!
}
- else
+
+ if ( mpWindowImpl->mpFirstOverlap )
{
- OutputDevice *pOutDev = GetOutDev();
- if ( pOutDev->AcquireGraphics() )
+ OStringBuffer aTempStr("Window (");
+ aTempStr.append(OUStringToOString(GetText(), RTL_TEXTENCODING_UTF8));
+ aTempStr.append(") with live SystemWindows destroyed: ");
+ pTempWin = mpWindowImpl->mpFirstOverlap;
+ while ( pTempWin )
{
- mpGraphics->GetResolution( mpWindowImpl->mpFrameData->mnDPIX, mpWindowImpl->mpFrameData->mnDPIY );
+ aTempStr.append(lcl_createWindowInfo(*pTempWin));
+ pTempWin = pTempWin->mpWindowImpl->mpNext;
}
+ OSL_FAIL( aTempStr.getStr() );
+ GetpApp()->Abort(OStringToOUString(aTempStr.makeStringAndClear(), RTL_TEXTENCODING_UTF8)); // abort in non-pro version, this must be fixed!
}
- // add ownerdraw decorated frame windows to list in the top-most frame window
- // so they can be hidden on lose focus
- if( nStyle & WB_OWNERDRAWDECORATION )
- ImplGetOwnerDrawList().push_back( this );
+ Window* pMyParent = this;
+ SystemWindow* pMySysWin = NULL;
- // delay settings initialization until first "real" frame
- // this relies on the IntroWindow not needing any system settings
- if ( !pSVData->maAppData.mbSettingsInit &&
- ! (nStyle & (WB_INTROWIN|WB_DEFAULTWIN))
- )
+ while ( pMyParent )
{
- // side effect: ImplUpdateGlobalSettings does an ImplGetFrame()->UpdateSettings
- ImplUpdateGlobalSettings( *pSVData->maAppData.mpSettings );
- OutputDevice::SetSettings( *pSVData->maAppData.mpSettings );
- pSVData->maAppData.mbSettingsInit = true;
+ if ( pMyParent->IsSystemWindow() )
+ pMySysWin = (SystemWindow*)pMyParent;
+ pMyParent = pMyParent->GetParent();
+ }
+ if ( pMySysWin && pMySysWin->ImplIsInTaskPaneList( this ) )
+ {
+ OStringBuffer aTempStr("Window (");
+ aTempStr.append(OUStringToOString(GetText(), RTL_TEXTENCODING_UTF8));
+ aTempStr.append(") still in TaskPanelList!");
+ OSL_FAIL( aTempStr.getStr() );
+ GetpApp()->Abort(OStringToOUString(aTempStr.makeStringAndClear(), RTL_TEXTENCODING_UTF8)); // abort in non-pro version, this must be fixed!
}
-
- // If we create a Window with default size, query this
- // size directly, because we want resize all Controls to
- // the correct size before we display the window
- if ( nStyle & (WB_MOVEABLE | WB_SIZEABLE | WB_APP) )
- mpWindowImpl->mpFrame->GetClientSize( mnOutWidth, mnOutHeight );
}
- else
+#endif
+
+ if( mpWindowImpl->mbIsInTaskPaneList )
{
- if ( pParent )
- {
- if ( !ImplIsOverlapWindow() )
- {
- mpWindowImpl->mbDisabled = pParent->mpWindowImpl->mbDisabled;
- mpWindowImpl->mbInputDisabled = pParent->mpWindowImpl->mbInputDisabled;
- mpWindowImpl->meAlwaysInputMode = pParent->mpWindowImpl->meAlwaysInputMode;
- }
+ Window* pMyParent = this;
+ SystemWindow* pMySysWin = NULL;
- OutputDevice::SetSettings( pParent->GetSettings() );
+ while ( pMyParent )
+ {
+ if ( pMyParent->IsSystemWindow() )
+ pMySysWin = (SystemWindow*)pMyParent;
+ pMyParent = pMyParent->GetParent();
+ }
+ if ( pMySysWin && pMySysWin->ImplIsInTaskPaneList( this ) )
+ {
+ pMySysWin->GetTaskPaneList()->RemoveWindow( this );
+ }
+ else
+ {
+ OStringBuffer aTempStr("Window (");
+ aTempStr.append(OUStringToOString(GetText(), RTL_TEXTENCODING_UTF8));
+ aTempStr.append(") not found in TaskPanelList!");
+ OSL_FAIL( aTempStr.getStr() );
}
-
}
- // setup the scale factor for Hi-DPI displays
- mnDPIScaleFactor = CountDPIScaleFactor(mpWindowImpl->mpFrameData->mnDPIY);
-
- const StyleSettings& rStyleSettings = mxSettings->GetStyleSettings();
- sal_uInt16 nScreenZoom = rStyleSettings.GetScreenZoom();
- mnDPIX = (mpWindowImpl->mpFrameData->mnDPIX*nScreenZoom)/100;
- mnDPIY = (mpWindowImpl->mpFrameData->mnDPIY*nScreenZoom)/100;
- maFont = rStyleSettings.GetAppFont();
- ImplPointToLogic( maFont );
+ // remove from size-group if necessary
+ remove_from_all_size_groups();
- if ( nStyle & WB_3DLOOK )
+ // clear mnemonic labels
+ std::vector<FixedText*> aMnemonicLabels(list_mnemonic_labels());
+ for (std::vector<FixedText*>::iterator aI = aMnemonicLabels.begin();
+ aI != aMnemonicLabels.end(); ++aI)
{
- SetTextColor( rStyleSettings.GetButtonTextColor() );
- SetBackground( Wallpaper( rStyleSettings.GetFaceColor() ) );
+ remove_mnemonic_label(*aI);
}
- else
+
+ // hide window in order to trigger the Paint-Handling
+ Hide();
+
+ // announce the window is to be destroyed
{
- SetTextColor( rStyleSettings.GetWindowTextColor() );
- SetBackground( Wallpaper( rStyleSettings.GetWindowColor() ) );
+ NotifyEvent aNEvt( EVENT_DESTROY, this );
+ Notify( aNEvt );
}
- ImplUpdatePos();
-
- // calculate app font res (except for the Intro Window or the default window)
- if ( mpWindowImpl->mbFrame && !pSVData->maGDIData.mnAppFontX && ! (nStyle & (WB_INTROWIN|WB_DEFAULTWIN)) )
- ImplInitAppFontData( this );
+ // EndExtTextInputMode
+ if ( pSVData->maWinData.mpExtTextInputWin == this )
+ {
+ EndExtTextInput( EXTTEXTINPUT_END_COMPLETE );
+ if ( pSVData->maWinData.mpExtTextInputWin == this )
+ pSVData->maWinData.mpExtTextInputWin = NULL;
+ }
- if ( GetAccessibleParentWindow() && GetParent() != Application::GetDefDialogParent() )
- GetAccessibleParentWindow()->ImplCallEventListeners( VCLEVENT_WINDOW_CHILDCREATED, this );
-}
+ // check if the focus window is our child
+ bool bHasFocussedChild = false;
+ if( pSVData->maWinData.mpFocusWin && ImplIsRealParentPath( pSVData->maWinData.mpFocusWin ) )
+ {
+ // #122232#, this must not happen and is an application bug ! but we try some cleanup to hopefully avoid crashes, see below
+ bHasFocussedChild = true;
+#if OSL_DEBUG_LEVEL > 0
+ OStringBuffer aTempStr("Window (");
+ aTempStr.append(OUStringToOString(GetText(),
+ RTL_TEXTENCODING_UTF8)).
+ append(") with focussed child window destroyed ! THIS WILL LEAD TO CRASHES AND MUST BE FIXED !");
+ OSL_FAIL( aTempStr.getStr() );
+ GetpApp()->Abort(OStringToOUString(aTempStr.makeStringAndClear(), RTL_TEXTENCODING_UTF8 )); // abort in non-pro version, this must be fixed!
+#endif
+ }
-void Window::ImplSetFrameParent( const Window* pParent )
-{
- Window* pFrameWindow = ImplGetSVData()->maWinData.mpFirstFrame;
- while( pFrameWindow )
+ // if we get focus pass focus to another window
+ Window* pOverlapWindow = ImplGetFirstOverlapWindow();
+ if ( pSVData->maWinData.mpFocusWin == this
+ || bHasFocussedChild ) // #122232#, see above, try some cleanup
{
- // search all frames that are children of this window
- // and reparent them
- if( ImplIsRealParentPath( pFrameWindow ) )
+ if ( mpWindowImpl->mbFrame )
{
- DBG_ASSERT( mpWindowImpl->mpFrame != pFrameWindow->mpWindowImpl->mpFrame, "SetFrameParent to own" );
- DBG_ASSERT( mpWindowImpl->mpFrame, "no frame" );
- SalFrame* pParentFrame = pParent ? pParent->mpWindowImpl->mpFrame : NULL;
- pFrameWindow->mpWindowImpl->mpFrame->SetParent( pParentFrame );
+ pSVData->maWinData.mpFocusWin = NULL;
+ pOverlapWindow->mpWindowImpl->mpLastFocusWindow = NULL;
+ GetpApp()->FocusChanged();
}
- pFrameWindow = pFrameWindow->mpWindowImpl->mpFrameData->mpNextFrame;
- }
-}
+ else
+ {
+ Window* pParent = GetParent();
+ Window* pBorderWindow = mpWindowImpl->mpBorderWindow;
+ // when windows overlap, give focus to the parent
+ // of the next FrameWindow
+ if ( pBorderWindow )
+ {
+ if ( pBorderWindow->ImplIsOverlapWindow() )
+ pParent = pBorderWindow->mpWindowImpl->mpOverlapWindow;
+ }
+ else if ( ImplIsOverlapWindow() )
+ pParent = mpWindowImpl->mpOverlapWindow;
-ImplWinData* Window::ImplGetWinData() const
-{
- if ( !mpWindowImpl->mpWinData )
- {
- static const char* pNoNWF = getenv( "SAL_NO_NWF" );
+ if ( pParent && pParent->IsEnabled() && pParent->IsInputEnabled() && ! pParent->IsInModalMode() )
+ pParent->GrabFocus();
+ else
+ mpWindowImpl->mpFrameWindow->GrabFocus();
- ((Window*)this)->mpWindowImpl->mpWinData = new ImplWinData;
- mpWindowImpl->mpWinData->mpExtOldText = NULL;
- mpWindowImpl->mpWinData->mpExtOldAttrAry = NULL;
- mpWindowImpl->mpWinData->mpCursorRect = NULL;
- mpWindowImpl->mpWinData->mnCursorExtWidth = 0;
- mpWindowImpl->mpWinData->mpCompositionCharRects = NULL;
- mpWindowImpl->mpWinData->mnCompositionCharRects = 0;
- mpWindowImpl->mpWinData->mpFocusRect = NULL;
- mpWindowImpl->mpWinData->mpTrackRect = NULL;
- mpWindowImpl->mpWinData->mnTrackFlags = 0;
- mpWindowImpl->mpWinData->mnIsTopWindow = (sal_uInt16) ~0; // not initialized yet, 0/1 will indicate TopWindow (see IsTopWindow())
- mpWindowImpl->mpWinData->mbMouseOver = false;
- mpWindowImpl->mpWinData->mbEnableNativeWidget = (pNoNWF && *pNoNWF) ? sal_False : sal_True; // sal_True: try to draw this control with native theme API
- }
+ // If the focus was set back to 'this' set it to nothing
+ if ( pSVData->maWinData.mpFocusWin == this )
+ {
+ pSVData->maWinData.mpFocusWin = NULL;
+ pOverlapWindow->mpWindowImpl->mpLastFocusWindow = NULL;
+ GetpApp()->FocusChanged();
+ }
+ }
+ }
- return mpWindowImpl->mpWinData;
-}
+ if ( pOverlapWindow != 0 &&
+ pOverlapWindow->mpWindowImpl->mpLastFocusWindow == this )
+ pOverlapWindow->mpWindowImpl->mpLastFocusWindow = NULL;
-SalGraphics* Window::ImplGetFrameGraphics() const
-{
- if ( mpWindowImpl->mpFrameWindow->mpGraphics )
+ // reset hint for DefModalDialogParent
+ if( pSVData->maWinData.mpActiveApplicationFrame == this )
+ pSVData->maWinData.mpActiveApplicationFrame = NULL;
+
+ // reset marked windows
+ if ( mpWindowImpl->mpFrameData != 0 )
{
- mpWindowImpl->mpFrameWindow->mbInitClipRegion = true;
+ if ( mpWindowImpl->mpFrameData->mpFocusWin == this )
+ mpWindowImpl->mpFrameData->mpFocusWin = NULL;
+ if ( mpWindowImpl->mpFrameData->mpMouseMoveWin == this )
+ mpWindowImpl->mpFrameData->mpMouseMoveWin = NULL;
+ if ( mpWindowImpl->mpFrameData->mpMouseDownWin == this )
+ mpWindowImpl->mpFrameData->mpMouseDownWin = NULL;
}
- else
+
+ // reset Deactivate-Window
+ if ( pSVData->maWinData.mpLastDeacWin == this )
+ pSVData->maWinData.mpLastDeacWin = NULL;
+
+ if ( mpWindowImpl->mbFrame && mpWindowImpl->mpFrameData )
{
- OutputDevice *pFrameWinOutDev = mpWindowImpl->mpFrameWindow;
- pFrameWinOutDev->AcquireGraphics();
+ if ( mpWindowImpl->mpFrameData->mnFocusId )
+ Application::RemoveUserEvent( mpWindowImpl->mpFrameData->mnFocusId );
+ if ( mpWindowImpl->mpFrameData->mnMouseMoveId )
+ Application::RemoveUserEvent( mpWindowImpl->mpFrameData->mnMouseMoveId );
}
- mpWindowImpl->mpFrameWindow->mpGraphics->ResetClipRegion();
- return mpWindowImpl->mpFrameWindow->mpGraphics;
-}
-Window* Window::ImplFindWindow( const Point& rFramePos )
-{
- Window* pTempWindow;
- Window* pFindWindow;
+ // release SalGraphics
+ OutputDevice *pOutDev = GetOutDev();
+ pOutDev->ReleaseGraphics();
- // first check all overlapping windows
- pTempWindow = mpWindowImpl->mpFirstOverlap;
- while ( pTempWindow )
+ // notify ImplDelData subscribers of this window about the window deletion
+ ImplDelData* pDelData = mpWindowImpl->mpFirstDel;
+ while ( pDelData )
{
- pFindWindow = pTempWindow->ImplFindWindow( rFramePos );
- if ( pFindWindow )
- return pFindWindow;
- pTempWindow = pTempWindow->mpWindowImpl->mpNext;
+ pDelData->mbDel = true;
+ pDelData->mpWindow = NULL; // #112873# pDel is not associated with a Window anymore
+ pDelData = pDelData->mpNext;
}
- // then we check our window
- if ( !mpWindowImpl->mbVisible )
- return NULL;
+ // remove window from the lists
+ ImplRemoveWindow( true );
- sal_uInt16 nHitTest = ImplHitTest( rFramePos );
- if ( nHitTest & WINDOW_HITTEST_INSIDE )
+ // de-register as "top window child" at our parent, if necessary
+ if ( mpWindowImpl->mbFrame )
{
- // and then we check all child windows
- pTempWindow = mpWindowImpl->mpFirstChild;
- while ( pTempWindow )
+ bool bIsTopWindow = mpWindowImpl->mpWinData && ( mpWindowImpl->mpWinData->mnIsTopWindow == 1 );
+ if ( mpWindowImpl->mpRealParent && bIsTopWindow )
{
- pFindWindow = pTempWindow->ImplFindWindow( rFramePos );
- if ( pFindWindow )
- return pFindWindow;
- pTempWindow = pTempWindow->mpWindowImpl->mpNext;
- }
+ ImplWinData* pParentWinData = mpWindowImpl->mpRealParent->ImplGetWinData();
- if ( nHitTest & WINDOW_HITTEST_TRANSPARENT )
- return NULL;
- else
- return this;
+ ::std::list< Window* >::iterator myPos = ::std::find( pParentWinData->maTopWindowChildren.begin(),
+ pParentWinData->maTopWindowChildren.end(), this );
+ DBG_ASSERT( myPos != pParentWinData->maTopWindowChildren.end(), "Window::~Window: inconsistency in top window chain!" );
+ if ( myPos != pParentWinData->maTopWindowChildren.end() )
+ pParentWinData->maTopWindowChildren.erase( myPos );
+ }
}
- return NULL;
-}
-
-sal_uInt16 Window::ImplHitTest( const Point& rFramePos )
-{
- Point aFramePos( rFramePos );
- if( ImplIsAntiparallel() )
+ // cleanup Extra Window Data, TODO: add and use ImplWinData destructor
+ if ( mpWindowImpl->mpWinData )
{
- // - RTL - re-mirror frame pos at this window
- const OutputDevice *pOutDev = GetOutDev();
- pOutDev->ReMirror( aFramePos );
+ if ( mpWindowImpl->mpWinData->mpExtOldText )
+ delete mpWindowImpl->mpWinData->mpExtOldText;
+ if ( mpWindowImpl->mpWinData->mpExtOldAttrAry )
+ delete mpWindowImpl->mpWinData->mpExtOldAttrAry;
+ if ( mpWindowImpl->mpWinData->mpCursorRect )
+ delete mpWindowImpl->mpWinData->mpCursorRect;
+ if ( mpWindowImpl->mpWinData->mpCompositionCharRects)
+ delete[] mpWindowImpl->mpWinData->mpCompositionCharRects;
+ if ( mpWindowImpl->mpWinData->mpFocusRect )
+ delete mpWindowImpl->mpWinData->mpFocusRect;
+ if ( mpWindowImpl->mpWinData->mpTrackRect )
+ delete mpWindowImpl->mpWinData->mpTrackRect;
+
+ delete mpWindowImpl->mpWinData;
}
- Rectangle aRect( Point( mnOutOffX, mnOutOffY ), Size( mnOutWidth, mnOutHeight ) );
- if ( !aRect.IsInside( aFramePos ) )
- return 0;
- if ( mpWindowImpl->mbWinRegion )
+
+ // cleanup overlap related window data
+ if ( mpWindowImpl->mpOverlapData )
+ delete mpWindowImpl->mpOverlapData;
+
+ // remove BorderWindow or Frame window data
+ if ( mpWindowImpl->mpBorderWindow )
+ delete mpWindowImpl->mpBorderWindow;
+ else if ( mpWindowImpl->mbFrame )
{
- Point aTempPos = aFramePos;
- aTempPos.X() -= mnOutOffX;
- aTempPos.Y() -= mnOutOffY;
- if ( !mpWindowImpl->maWinRegion.IsInside( aTempPos ) )
- return 0;
+ if ( pSVData->maWinData.mpFirstFrame == this )
+ pSVData->maWinData.mpFirstFrame = mpWindowImpl->mpFrameData->mpNextFrame;
+ else
+ {
+ Window* pSysWin = pSVData->maWinData.mpFirstFrame;
+ while ( pSysWin->mpWindowImpl->mpFrameData->mpNextFrame != this )
+ pSysWin = pSysWin->mpWindowImpl->mpFrameData->mpNextFrame;
+ pSysWin->mpWindowImpl->mpFrameData->mpNextFrame = mpWindowImpl->mpFrameData->mpNextFrame;
+ }
+ mpWindowImpl->mpFrame->SetCallback( NULL, NULL );
+ pSVData->mpDefInst->DestroyFrame( mpWindowImpl->mpFrame );
+ delete mpWindowImpl->mpFrameData;
}
- sal_uInt16 nHitTest = WINDOW_HITTEST_INSIDE;
- if ( mpWindowImpl->mbMouseTransparent )
- nHitTest |= WINDOW_HITTEST_TRANSPARENT;
- return nHitTest;
+ // should be the last statements
+ delete mpWindowImpl; mpWindowImpl = NULL;
+}
+
+WindowImpl::WindowImpl( WindowType nType )
+{
+ maZoom = Fraction( 1, 1 );
+ maWinRegion = Region(true);
+ maWinClipRegion = Region(true);
+ mpWinData = NULL; // Extra Window Data, that we dont need for all windows
+ mpOverlapData = NULL; // Overlap Data
+ mpFrameData = NULL; // Frame Data
+ mpFrame = NULL; // Pointer to frame window
+ mpSysObj = NULL;
+ mpFrameWindow = NULL; // window to top level parent (same as frame window)
+ mpOverlapWindow = NULL; // first overlap parent
+ mpBorderWindow = NULL; // Border-Window
+ mpClientWindow = NULL; // Client-Window of a FrameWindow
+ mpParent = NULL; // parent (inkl. BorderWindow)
+ mpRealParent = NULL; // real parent (exkl. BorderWindow)
+ mpFirstChild = NULL; // first child window
+ mpLastChild = NULL; // last child window
+ mpFirstOverlap = NULL; // first overlap window (only set in overlap windows)
+ mpLastOverlap = NULL; // last overlap window (only set in overlap windows)
+ mpPrev = NULL; // prev window
+ mpNext = NULL; // next window
+ mpNextOverlap = NULL; // next overlap window of frame
+ mpLastFocusWindow = NULL; // window for focus restore
+ mpDlgCtrlDownWindow = NULL; // window for dialog control
+ mpFirstDel = NULL; // Dtor notification list
+ mpUserData = NULL; // user data
+ mpCursor = NULL; // cursor
+ mpControlFont = NULL; // font propertie
+ mpVCLXWindow = NULL;
+ mpAccessibleInfos = NULL;
+ maControlForeground = Color( COL_TRANSPARENT ); // no foreground set
+ maControlBackground = Color( COL_TRANSPARENT ); // no background set
+ mnLeftBorder = 0; // left border
+ mnTopBorder = 0; // top border
+ mnRightBorder = 0; // right border
+ mnBottomBorder = 0; // bottom border
+ mnWidthRequest = -1; // width request
+ mnHeightRequest = -1; // height request
+ mnX = 0; // X-Position to Parent
+ mnY = 0; // Y-Position to Parent
+ mnAbsScreenX = 0; // absolute X-position on screen, used for RTL window positioning
+ mpChildClipRegion = NULL; // Child-Clip-Region when ClipChildren
+ mpPaintRegion = NULL; // Paint-ClipRegion
+ mnStyle = 0; // style (init in ImplInitWindow)
+ mnPrevStyle = 0; // prevstyle (set in SetStyle)
+ mnExtendedStyle = 0; // extended style (init in ImplInitWindow)
+ mnPrevExtendedStyle = 0; // prevstyle (set in SetExtendedStyle)
+ mnType = nType; // type
+ mnGetFocusFlags = 0; // Flags fuer GetFocus()-Aufruf
+ mnWaitCount = 0; // Wait-Count (>1 == Warte-MousePointer)
+ mnPaintFlags = 0; // Flags for ImplCallPaint
+ mnParentClipMode = 0; // Flags for Parent-ClipChildren-Mode
+ mnActivateMode = 0; // Will be converted in System/Overlap-Windows
+ mnDlgCtrlFlags = 0; // DialogControl-Flags
+ mnLockCount = 0; // LockCount
+ meAlwaysInputMode = AlwaysInputNone; // neither AlwaysEnableInput nor AlwaysDisableInput called
+ meHalign = VCL_ALIGN_FILL;
+ meValign = VCL_ALIGN_FILL;
+ mePackType = VCL_PACK_START;
+ mnPadding = 0;
+ mnGridHeight = 1;
+ mnGridLeftAttach = -1;
+ mnGridTopAttach = -1;
+ mnGridWidth = 1;
+ mnBorderWidth = 0;
+ mnMarginLeft = 0;
+ mnMarginRight = 0;
+ mnMarginTop = 0;
+ mnMarginBottom = 0;
+ mbFrame = false; // true: Window is a frame window
+ mbBorderWin = false; // true: Window is a border window
+ mbOverlapWin = false; // true: Window is a overlap window
+ mbSysWin = false; // true: SystemWindow is the base class
+ mbDialog = false; // true: Dialog is the base class
+ mbDockWin = false; // true: DockingWindow is the base class
+ mbFloatWin = false; // true: FloatingWindow is the base class
+ mbPushButton = false; // true: PushButton is the base class
+ mbToolBox = false; // true: ToolBox is the base class
+ mbMenuFloatingWindow= false; // true: MenuFloatingWindow is the base class
+ mbToolbarFloatingWindow= false; // true: ImplPopupFloatWin is the base class, used for subtoolbars
+ mbSplitter = false; // true: Splitter is the base class
+ mbVisible = false; // true: Show( sal_True ) called
+ mbOverlapVisible = false; // true: Hide called for visible window from ImplHideAllOverlapWindow()
+ mbDisabled = false; // true: Enable( sal_False ) called
+ mbInputDisabled = false; // true: EnableInput( sal_False ) called
+ mbDropDisabled = false; // true: Drop is enabled
+ mbNoUpdate = false; // true: SetUpdateMode( sal_False ) called
+ mbNoParentUpdate = false; // true: SetParentUpdateMode( sal_False ) called
+ mbActive = false; // true: Window Active
+ mbParentActive = false; // true: OverlapActive from Parent
+ mbReallyVisible = false; // true: this and all parents to an overlapped window are visible
+ mbReallyShown = false; // true: this and all parents to an overlapped window are shown
+ mbInInitShow = false; // true: we are in InitShow
+ mbChildNotify = false; // true: ChildNotify
+ mbChildPtrOverwrite = false; // true: PointerStyle overwrites Child-Pointer
+ mbNoPtrVisible = false; // true: ShowPointer( sal_False ) called
+ mbMouseMove = false; // true: BaseMouseMove called
+ mbPaintFrame = false; // true: Paint is visible, but not painted
+ mbInPaint = false; // true: Inside PaintHdl
+ mbMouseButtonDown = false; // true: BaseMouseButtonDown called
+ mbMouseButtonUp = false; // true: BaseMouseButtonUp called
+ mbKeyInput = false; // true: BaseKeyInput called
+ mbKeyUp = false; // true: BaseKeyUp called
+ mbCommand = false; // true: BaseCommand called
+ mbDefPos = true; // true: Position is not Set
+ mbDefSize = true; // true: Size is not Set
+ mbCallMove = true; // true: Move must be called by Show
+ mbCallResize = true; // true: Resize must be called by Show
+ mbWaitSystemResize = true; // true: Wait for System-Resize
+ mbInitWinClipRegion = true; // true: Calc Window Clip Region
+ mbInitChildRegion = false; // true: InitChildClipRegion
+ mbWinRegion = false; // true: Window Region
+ mbClipChildren = false; // true: Child-window should be clipped
+ mbClipSiblings = false; // true: Adjacent Child-window should be clipped
+ mbChildTransparent = false; // true: Child-windows are allowed to switch to transparent (incl. Parent-CLIPCHILDREN)
+ mbPaintTransparent = false; // true: Paints should be executed on the Parent
+ mbMouseTransparent = false; // true: Window is transparent for Mouse
+ mbDlgCtrlStart = false; // true: From here on own Dialog-Control
+ mbFocusVisible = false; // true: Focus Visible
+ mbUseNativeFocus = false;
+ mbNativeFocusVisible= false; // true: native Focus Visible
+ mbInShowFocus = false; // prevent recursion
+ mbInHideFocus = false; // prevent recursion
+ mbTrackVisible = false; // true: Tracking Visible
+ mbControlForeground = false; // true: Foreground-Property set
+ mbControlBackground = false; // true: Background-Property set
+ mbAlwaysOnTop = false; // true: always visible for all others windows
+ mbCompoundControl = false; // true: Composite Control => Listener...
+ mbCompoundControlHasFocus = false; // true: Composite Control has focus somewhere
+ mbPaintDisabled = false; // true: Paint should not be executed
+ mbAllResize = false; // true: Also sent ResizeEvents with 0,0
+ mbInDtor = false; // true: We're still in Window-Dtor
+ mbExtTextInput = false; // true: ExtTextInput-Mode is active
+ mbInFocusHdl = false; // true: Within GetFocus-Handler
+ mbCreatedWithToolkit = false;
+ mbSuppressAccessibilityEvents = false; // true: do not send any accessibility events
+ mbDrawSelectionBackground = false; // true: draws transparent window background to indicate (toolbox) selection
+ mbIsInTaskPaneList = false; // true: window was added to the taskpanelist in the topmost system window
+ mnNativeBackground = 0; // initialize later, depends on type
+ mbCallHandlersDuringInputDisabled = false; // true: call event handlers even if input is disabled
+ mbHelpTextDynamic = false; // true: append help id in HELP_DEBUG case
+ mbFakeFocusSet = false; // true: pretend as if the window has focus.
+ mbHexpand = false;
+ mbVexpand = false;
+ mbExpand = false;
+ mbFill = true;
+ mbSecondary = false;
+ mbNonHomogeneous = false;
}
-bool Window::ImplIsRealParentPath( const Window* pWindow ) const
+WindowImpl::~WindowImpl()
{
- pWindow = pWindow->GetParent();
- while ( pWindow )
- {
- if ( pWindow == this )
- return true;
- pWindow = pWindow->GetParent();
- }
-
- return false;
+ delete mpChildClipRegion;
+ delete mpAccessibleInfos;
+ delete mpControlFont;
}
-bool Window::ImplIsChild( const Window* pWindow, bool bSystemWindow ) const
+bool Window::AcquireGraphics() const
{
- do
- {
- if ( !bSystemWindow && pWindow->ImplIsOverlapWindow() )
- break;
-
- pWindow = pWindow->ImplGetParent();
-
- if ( pWindow == this )
- return true;
- }
- while ( pWindow );
-
- return false;
-}
+ DBG_TESTSOLARMUTEX();
-bool Window::ImplIsWindowOrChild( const Window* pWindow, bool bSystemWindow ) const
-{
- if ( this == pWindow )
+ if ( mpGraphics )
return true;
- return ImplIsChild( pWindow, bSystemWindow );
-}
-
-int Window::ImplTestMousePointerSet()
-{
- // as soon as mouse is captured, switch mouse-pointer
- if ( IsMouseCaptured() )
- return sal_True;
-
- // if the mouse is over the window, switch it
- Rectangle aClientRect( Point( 0, 0 ), GetOutputSizePixel() );
- if ( aClientRect.IsInside( GetPointerPosPixel() ) )
- return sal_True;
-
- return sal_False;
-}
-PointerStyle Window::ImplGetMousePointer() const
-{
- PointerStyle ePointerStyle;
- bool bWait = false;
+ mbInitLineColor = true;
+ mbInitFillColor = true;
+ mbInitFont = true;
+ mbInitTextColor = true;
+ mbInitClipRegion = true;
- if ( IsEnabled() && IsInputEnabled() && ! IsInModalMode() )
- ePointerStyle = GetPointer().GetStyle();
- else
- ePointerStyle = POINTER_ARROW;
+ ImplSVData* pSVData = ImplGetSVData();
- const Window* pWindow = this;
- do
+ mpGraphics = mpWindowImpl->mpFrame->AcquireGraphics();
+ // try harder if no wingraphics was available directly
+ if ( !mpGraphics )
{
- // when the pointer is not visible stop the search, as
- // this status should not be overwritten
- if ( pWindow->mpWindowImpl->mbNoPtrVisible )
- return POINTER_NULL;
+ // find another output device in the same frame
+ OutputDevice* pReleaseOutDev = pSVData->maGDIData.mpLastWinGraphics;
+ while ( pReleaseOutDev )
+ {
+ if ( ((Window*)pReleaseOutDev)->mpWindowImpl->mpFrame == mpWindowImpl->mpFrame )
+ break;
+ pReleaseOutDev = pReleaseOutDev->mpPrevGraphics;
+ }
- if ( !bWait )
+ if ( pReleaseOutDev )
{
- if ( pWindow->mpWindowImpl->mnWaitCount )
- {
- ePointerStyle = POINTER_WAIT;
- bWait = true;
- }
- else
+ // steal the wingraphics from the other outdev
+ mpGraphics = pReleaseOutDev->mpGraphics;
+ pReleaseOutDev->ReleaseGraphics( false );
+ }
+ else
+ {
+ // if needed retry after releasing least recently used wingraphics
+ while ( !mpGraphics )
{
- if ( pWindow->mpWindowImpl->mbChildPtrOverwrite )
- ePointerStyle = pWindow->GetPointer().GetStyle();
+ if ( !pSVData->maGDIData.mpLastWinGraphics )
+ break;
+ pSVData->maGDIData.mpLastWinGraphics->ReleaseGraphics();
+ mpGraphics = mpWindowImpl->mpFrame->AcquireGraphics();
}
}
-
- if ( pWindow->ImplIsOverlapWindow() )
- break;
-
- pWindow = pWindow->ImplGetParent();
}
- while ( pWindow );
- return ePointerStyle;
-}
-
-void Window::ImplResetReallyVisible()
-{
- bool bBecameReallyInvisible = mpWindowImpl->mbReallyVisible;
-
- mbDevOutput = false;
- mpWindowImpl->mbReallyVisible = false;
- mpWindowImpl->mbReallyShown = false;
-
- // the SHOW/HIDE events serve as indicators to send child creation/destroy events to the access bridge.
- // For this, the data member of the event must not be NULL.
- // Previously, we did this in Window::Show, but there some events got lost in certain situations.
- if( bBecameReallyInvisible && ImplIsAccessibleCandidate() )
- ImplCallEventListeners( VCLEVENT_WINDOW_HIDE, this );
- // TODO. It's kind of a hack that we're re-using the VCLEVENT_WINDOW_HIDE. Normally, we should
- // introduce another event which explicitly triggers the Accessibility implementations.
-
- Window* pWindow = mpWindowImpl->mpFirstOverlap;
- while ( pWindow )
+ // update global LRU list of wingraphics
+ if ( mpGraphics )
{
- if ( pWindow->mpWindowImpl->mbReallyVisible )
- pWindow->ImplResetReallyVisible();
- pWindow = pWindow->mpWindowImpl->mpNext;
+ mpNextGraphics = pSVData->maGDIData.mpFirstWinGraphics;
+ pSVData->maGDIData.mpFirstWinGraphics = const_cast<Window*>(this);
+ if ( mpNextGraphics )
+ mpNextGraphics->mpPrevGraphics = const_cast<Window*>(this);
+ if ( !pSVData->maGDIData.mpLastWinGraphics )
+ pSVData->maGDIData.mpLastWinGraphics = const_cast<Window*>(this);
}
- pWindow = mpWindowImpl->mpFirstChild;
- while ( pWindow )
+ if ( mpGraphics )
{
- if ( pWindow->mpWindowImpl->mbReallyVisible )
- pWindow->ImplResetReallyVisible();
- pWindow = pWindow->mpWindowImpl->mpNext;
+ mpGraphics->SetXORMode( (ROP_INVERT == meRasterOp) || (ROP_XOR == meRasterOp), ROP_INVERT == meRasterOp );
+ mpGraphics->setAntiAliasB2DDraw(mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW);
}
+
+ return mpGraphics ? true : false;
}
-void Window::ImplSetReallyVisible()
+void Window::ReleaseGraphics( bool bRelease )
{
- // #i43594# it is possible that INITSHOW was never send, because the visibility state changed between
- // ImplCallInitShow() and ImplSetReallyVisible() when called from Show()
- // mbReallyShown is a useful indicator
- if( !mpWindowImpl->mbReallyShown )
- ImplCallInitShow();
+ DBG_TESTSOLARMUTEX();
- bool bBecameReallyVisible = !mpWindowImpl->mbReallyVisible;
+ if ( !mpGraphics )
+ return;
- mbDevOutput = true;
- mpWindowImpl->mbReallyVisible = true;
- mpWindowImpl->mbReallyShown = true;
+ // release the fonts of the physically released graphics device
+ if( bRelease )
+ ImplReleaseFonts();
- // the SHOW/HIDE events serve as indicators to send child creation/destroy events to the access bridge.
- // For this, the data member of the event must not be NULL.
- // Previously, we did this in Window::Show, but there some events got lost in certain situations. Now
- // we're doing it when the visibility really changes
- if( bBecameReallyVisible && ImplIsAccessibleCandidate() )
- ImplCallEventListeners( VCLEVENT_WINDOW_SHOW, this );
- // TODO. It's kind of a hack that we're re-using the VCLEVENT_WINDOW_SHOW. Normally, we should
- // introduce another event which explicitly triggers the Accessibility implementations.
+ ImplSVData* pSVData = ImplGetSVData();
- Window* pWindow = mpWindowImpl->mpFirstOverlap;
- while ( pWindow )
- {
- if ( pWindow->mpWindowImpl->mbVisible )
- pWindow->ImplSetReallyVisible();
- pWindow = pWindow->mpWindowImpl->mpNext;
- }
+ Window* pWindow = (Window*)this;
- pWindow = mpWindowImpl->mpFirstChild;
- while ( pWindow )
- {
- if ( pWindow->mpWindowImpl->mbVisible )
- pWindow->ImplSetReallyVisible();
- pWindow = pWindow->mpWindowImpl->mpNext;
- }
+ if ( bRelease )
+ pWindow->mpWindowImpl->mpFrame->ReleaseGraphics( mpGraphics );
+ // remove from global LRU list of window graphics
+ if ( mpPrevGraphics )
+ mpPrevGraphics->mpNextGraphics = mpNextGraphics;
+ else
+ pSVData->maGDIData.mpFirstWinGraphics = mpNextGraphics;
+ if ( mpNextGraphics )
+ mpNextGraphics->mpPrevGraphics = mpPrevGraphics;
+ else
+ pSVData->maGDIData.mpLastWinGraphics = mpPrevGraphics;
+
+ mpGraphics = NULL;
+ mpPrevGraphics = NULL;
+ mpNextGraphics = NULL;
}
-void Window::ImplAddDel( ImplDelData* pDel ) // TODO: make "const" when incompatiblity ok
+void Window::CopyDeviceArea( SalTwoRect& aPosAry, sal_uInt32 nFlags )
{
- DBG_ASSERT( !pDel->mpWindow, "Window::ImplAddDel(): cannot add ImplDelData twice !" );
- if( !pDel->mpWindow )
+ if (aPosAry.mnSrcWidth == 0 || aPosAry.mnSrcHeight == 0 || aPosAry.mnDestWidth == 0 || aPosAry.mnDestHeight == 0)
+ return;
+
+ if (nFlags & COPYAREA_WINDOWINVALIDATE)
{
- pDel->mpWindow = this; // #112873# store ref to this window, so pDel can remove itself
- pDel->mpNext = mpWindowImpl->mpFirstDel;
- mpWindowImpl->mpFirstDel = pDel;
+ const Rectangle aSrcRect(Point(aPosAry.mnSrcX, aPosAry.mnSrcY),
+ Size(aPosAry.mnSrcWidth, aPosAry.mnSrcHeight));
+
+ ImplMoveAllInvalidateRegions(aSrcRect,
+ aPosAry.mnDestX-aPosAry.mnSrcX,
+ aPosAry.mnDestY-aPosAry.mnSrcY,
+ false);
+
+ mpGraphics->CopyArea(aPosAry.mnDestX, aPosAry.mnDestY,
+ aPosAry.mnSrcX, aPosAry.mnSrcY,
+ aPosAry.mnSrcWidth, aPosAry.mnSrcHeight,
+ SAL_COPYAREA_WINDOWINVALIDATE, this);
+
+ return;
}
+
+ OutputDevice::CopyDeviceArea(aPosAry, nFlags);
}
-void Window::ImplRemoveDel( ImplDelData* pDel ) // TODO: make "const" when incompatiblity ok
+void Window::ImplInitAppFontData( Window* pWindow )
{
- pDel->mpWindow = NULL; // #112873# pDel is not associated with a Window anymore
- if ( mpWindowImpl->mpFirstDel == pDel )
- mpWindowImpl->mpFirstDel = pDel->mpNext;
- else
+ ImplSVData* pSVData = ImplGetSVData();
+ long nTextHeight = pWindow->GetTextHeight();
+ long nTextWidth = pWindow->approximate_char_width() * 8;
+ long nSymHeight = nTextHeight*4;
+ // Make the basis wider if the font is too narrow
+ // such that the dialog looks symmetrical and does not become too narrow.
+ // Add some extra space when the dialog has the same width,
+ // as a little more space is better.
+ if ( nSymHeight > nTextWidth )
+ nTextWidth = nSymHeight;
+ else if ( nSymHeight+5 > nTextWidth )
+ nTextWidth = nSymHeight+5;
+ pSVData->maGDIData.mnAppFontX = nTextWidth * 10 / 8;
+ pSVData->maGDIData.mnAppFontY = nTextHeight * 10;
+
+ // FIXME: this is currently only on OS X, check with other
+ // platforms
+ if( pSVData->maNWFData.mbNoFocusRects )
{
- ImplDelData* pData = mpWindowImpl->mpFirstDel;
- while ( pData->mpNext != pDel )
- pData = pData->mpNext;
- pData->mpNext = pDel->mpNext;
+ // try to find out whether there is a large correction
+ // of control sizes, if yes, make app font scalings larger
+ // so dialog positioning is not completely off
+ ImplControlValue aControlValue;
+ Rectangle aCtrlRegion( Point(), Size( nTextWidth < 10 ? 10 : nTextWidth, nTextHeight < 10 ? 10 : nTextHeight ) );
+ Rectangle aBoundingRgn( aCtrlRegion );
+ Rectangle aContentRgn( aCtrlRegion );
+ if( pWindow->GetNativeControlRegion( CTRL_EDITBOX, PART_ENTIRE_CONTROL, aCtrlRegion,
+ CTRL_STATE_ENABLED, aControlValue, OUString(),
+ aBoundingRgn, aContentRgn ) )
+ {
+ // comment: the magical +6 is for the extra border in bordered
+ // (which is the standard) edit fields
+ if( aContentRgn.GetHeight() - nTextHeight > (nTextHeight+4)/4 )
+ pSVData->maGDIData.mnAppFontY = (aContentRgn.GetHeight()-4) * 10;
+ }
}
+
+ pSVData->maGDIData.mnRealAppFontX = pSVData->maGDIData.mnAppFontX;
+ if ( pSVData->maAppData.mnDialogScaleX )
+ pSVData->maGDIData.mnAppFontX += (pSVData->maGDIData.mnAppFontX*pSVData->maAppData.mnDialogScaleX)/100;
}
-void Window::ImplInitResolutionSettings()
+bool Window::ImplCheckUIFont( const Font& rFont )
{
- // recalculate AppFont-resolution and DPI-resolution
- if ( mpWindowImpl->mbFrame )
- {
- const StyleSettings& rStyleSettings = mxSettings->GetStyleSettings();
- sal_uInt16 nScreenZoom = rStyleSettings.GetScreenZoom();
- mnDPIX = (mpWindowImpl->mpFrameData->mnDPIX*nScreenZoom)/100;
- mnDPIY = (mpWindowImpl->mpFrameData->mnDPIY*nScreenZoom)/100;
+ if( ImplGetSVData()->maGDIData.mbNativeFontConfig )
+ return true;
- // setup the scale factor for Hi-DPI displays
- mnDPIScaleFactor = CountDPIScaleFactor(mpWindowImpl->mpFrameData->mnDPIY);
- SetPointFont( rStyleSettings.GetAppFont() );
- }
- else if ( mpWindowImpl->mpParent )
+ // create a text string using the localized text of important buttons
+ OUString aTestText;
+ static const StandardButtonType aTestButtons[] =
{
- mnDPIX = mpWindowImpl->mpParent->mnDPIX;
- mnDPIY = mpWindowImpl->mpParent->mnDPIY;
- mnDPIScaleFactor = mpWindowImpl->mpParent->mnDPIScaleFactor;
- }
+ BUTTON_OK, BUTTON_CANCEL, BUTTON_CLOSE, BUTTON_ABORT,
+ BUTTON_YES, BUTTON_NO, BUTTON_MORE, BUTTON_IGNORE,
+ BUTTON_RETRY, BUTTON_HELP
+ };
- // update the recalculated values for logical units
- // and also tools belonging to the values
- if ( IsMapMode() )
+ const int nTestButtonCount = SAL_N_ELEMENTS(aTestButtons);
+ for( int n = 0; n < nTestButtonCount; ++n )
{
- MapMode aMapMode = GetMapMode();
- SetMapMode();
- SetMapMode( aMapMode );
+ OUString aButtonStr = Button::GetStandardText( aTestButtons[n] );
+ // #i115432# ignore mnemonic+accelerator part of each string
+ // TODO: use a string filtering method when it becomes available
+ const sal_Int32 nLen = aButtonStr.getLength();
+ bool bInside = false;
+ for( int i = 0; i < nLen; ++i ) {
+ const sal_Unicode c = aButtonStr[ i ];
+ if( (c == '('))
+ bInside = true;
+ if( (c == ')'))
+ bInside = false;
+ if( (c == '~')
+ || (c == '(') || (c == ')')
+ || ((c >= 'A') && (c <= 'Z') && bInside) )
+ aButtonStr = aButtonStr.replaceAt( i, 1, " " );
+ }
+ // append sanitized button text to test string
+ aTestText += aButtonStr;
}
+
+ const bool bUIFontOk = ( HasGlyphs( rFont, aTestText ) == -1 );
+ return bUIFontOk;
}
-void Window::ImplPointToLogic( Font& rFont ) const
+void Window::ImplInitWindowData( WindowType nType )
{
- Size aSize = rFont.GetSize();
- sal_uInt16 nScreenFontZoom = mxSettings->GetStyleSettings().GetScreenFontZoom();
+ // We will eventually being removing the inheritance of OutputDevice from Window.
+ // It will be replaced with a composition relationship. A Window will use an OutputDevice,
+ // it will not *be* an OutputDevice
+ mpOutputDevice = (OutputDevice*)this;
- if ( aSize.Width() )
- {
- aSize.Width() *= mpWindowImpl->mpFrameData->mnDPIX;
- aSize.Width() += 72/2;
- aSize.Width() /= 72;
- aSize.Width() *= nScreenFontZoom;
- aSize.Width() /= 100;
- }
- aSize.Height() *= mpWindowImpl->mpFrameData->mnDPIY;
- aSize.Height() += 72/2;
- aSize.Height() /= 72;
- aSize.Height() *= nScreenFontZoom;
- aSize.Height() /= 100;
+ mpWindowImpl = new WindowImpl( nType );
- if ( IsMapModeEnabled() )
- aSize = PixelToLogic( aSize );
+ meOutDevType = OUTDEV_WINDOW;
- rFont.SetSize( aSize );
+ mbEnableRTL = Application::GetSettings().GetLayoutRTL(); // true: this outdev will be mirrored if RTL window layout (UI mirroring) is globally active
}
-void Window::ImplLogicToPoint( Font& rFont ) const
+static bool ImplDoTiledRendering()
{
- Size aSize = rFont.GetSize();
- sal_uInt16 nScreenFontZoom = mxSettings->GetStyleSettings().GetScreenFontZoom();
+#if !HAVE_FEATURE_DESKTOP
+ // We do tiled rendering only for iOS at the moment, actually, but
+ // let's see what happens if we assume it for Android, too.
+ return true;
+#else
+ // We need some way to know globally if this process will use
+ // tiled rendering or not. Or should this be a per-window setting?
+ // Or what?
+ return false;
+#endif
+}
- if ( IsMapModeEnabled() )
- aSize = LogicToPixel( aSize );
+static sal_Int32 CountDPIScaleFactor(sal_Int32 nDPI)
+{
+ sal_Int32 nResult = 1;
- if ( aSize.Width() )
- {
- aSize.Width() *= 100;
- aSize.Width() /= nScreenFontZoom;
- aSize.Width() *= 72;
- aSize.Width() += mpWindowImpl->mpFrameData->mnDPIX/2;
- aSize.Width() /= mpWindowImpl->mpFrameData->mnDPIX;
- }
- aSize.Height() *= 100;
- aSize.Height() /= nScreenFontZoom;
- aSize.Height() *= 72;
- aSize.Height() += mpWindowImpl->mpFrameData->mnDPIY/2;
- aSize.Height() /= mpWindowImpl->mpFrameData->mnDPIY;
+#ifndef MACOSX
+ // Setting of HiDPI is unfortunately all only a heuristic; and to add
+ // insult to an injury, the system is constantly lying to us about
+ // the DPI and whatnot
+ // eg. fdo#77059 - set the value from which we do consider the
+ // screen hi-dpi to greater than 168
+ if (nDPI > 168)
+ nResult = std::max(sal_Int32(1), (nDPI + 48) / 96);
+#else
+ (void)nDPI;
+#endif
- rFont.SetSize( aSize );
+ return nResult;
}
-void Window::ImplIntersectWindowRegion( Region& rRegion )
+void Window::ImplInit( Window* pParent, WinBits nStyle, SystemParentData* pSystemParentData )
{
- rRegion.Intersect( Rectangle( Point( mnOutOffX, mnOutOffY ),
- Size( mnOutWidth, mnOutHeight ) ) );
- if ( mpWindowImpl->mbWinRegion )
- rRegion.Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) );
-}
+ DBG_ASSERT( mpWindowImpl->mbFrame || pParent, "Window::Window(): pParent == NULL" );
-void Window::ImplExcludeWindowRegion( Region& rRegion )
-{
- if ( mpWindowImpl->mbWinRegion )
+ ImplSVData* pSVData = ImplGetSVData();
+ Window* pRealParent = pParent;
+
+ // 3D-Look vererben
+ if ( !mpWindowImpl->mbOverlapWin && pParent && (pParent->GetStyle() & WB_3DLOOK) )
+ nStyle |= WB_3DLOOK;
+
+ // create border window if necessary
+ if ( !mpWindowImpl->mbFrame && !mpWindowImpl->mbBorderWin && !mpWindowImpl->mpBorderWindow
+ && (nStyle & (WB_BORDER | WB_SYSTEMCHILDWINDOW) ) )
{
- Point aPoint( mnOutOffX, mnOutOffY );
- Region aRegion( Rectangle( aPoint,
- Size( mnOutWidth, mnOutHeight ) ) );
- aRegion.Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) );
- rRegion.Exclude( aRegion );
+ sal_uInt16 nBorderTypeStyle = 0;
+ if( (nStyle & WB_SYSTEMCHILDWINDOW) )
+ {
+ // handle WB_SYSTEMCHILDWINDOW
+ // these should be analogous to a top level frame; meaning they
+ // should have a border window with style BORDERWINDOW_STYLE_FRAME
+ // which controls their size
+ nBorderTypeStyle |= BORDERWINDOW_STYLE_FRAME;
+ nStyle |= WB_BORDER;
+ }
+ ImplBorderWindow* pBorderWin = new ImplBorderWindow( pParent, nStyle & (WB_BORDER | WB_DIALOGCONTROL | WB_NODIALOGCONTROL | WB_NEEDSFOCUS), nBorderTypeStyle );
+ ((Window*)pBorderWin)->mpWindowImpl->mpClientWindow = this;
+ pBorderWin->GetBorder( mpWindowImpl->mnLeftBorder, mpWindowImpl->mnTopBorder, mpWindowImpl->mnRightBorder, mpWindowImpl->mnBottomBorder );
+ mpWindowImpl->mpBorderWindow = pBorderWin;
+ pParent = mpWindowImpl->mpBorderWindow;
}
- else
+ else if( !mpWindowImpl->mbFrame && ! pParent )
+ {
+ mpWindowImpl->mbOverlapWin = true;
+ mpWindowImpl->mbFrame = true;
+ }
+
+ // insert window in list
+ ImplInsertWindow( pParent );
+ mpWindowImpl->mnStyle = nStyle;
+
+ // Overlap-Window-Data
+ if ( mpWindowImpl->mbOverlapWin )
{
- Point aPoint( mnOutOffX, mnOutOffY );
- rRegion.Exclude( Rectangle( aPoint,
- Size( mnOutWidth, mnOutHeight ) ) );
+ mpWindowImpl->mpOverlapData = new ImplOverlapData;
+ mpWindowImpl->mpOverlapData->mpSaveBackDev = NULL;
+ mpWindowImpl->mpOverlapData->mpSaveBackRgn = NULL;
+ mpWindowImpl->mpOverlapData->mpNextBackWin = NULL;
+ mpWindowImpl->mpOverlapData->mnSaveBackSize = 0;
+ mpWindowImpl->mpOverlapData->mbSaveBack = false;
+ mpWindowImpl->mpOverlapData->mnTopLevel = 1;
}
-}
-void Window::ImplExcludeOverlapWindows( Region& rRegion )
-{
- Window* pWindow = mpWindowImpl->mpFirstOverlap;
- while ( pWindow )
+ if( pParent && ! mpWindowImpl->mbFrame )
+ mbEnableRTL = Application::GetSettings().GetLayoutRTL();
+
+ // test for frame creation
+ if ( mpWindowImpl->mbFrame )
{
- if ( pWindow->mpWindowImpl->mbReallyVisible )
+ // create frame
+ sal_uLong nFrameStyle = 0;
+
+ if ( nStyle & WB_MOVEABLE )
+ nFrameStyle |= SAL_FRAME_STYLE_MOVEABLE;
+ if ( nStyle & WB_SIZEABLE )
+ nFrameStyle |= SAL_FRAME_STYLE_SIZEABLE;
+ if ( nStyle & WB_CLOSEABLE )
+ nFrameStyle |= SAL_FRAME_STYLE_CLOSEABLE;
+ if ( nStyle & WB_APP )
+ nFrameStyle |= SAL_FRAME_STYLE_DEFAULT;
+ // check for undecorated floating window
+ if( // 1. floating windows that are not moveable/sizeable (only closeable allowed)
+ ( !(nFrameStyle & ~SAL_FRAME_STYLE_CLOSEABLE) &&
+ ( mpWindowImpl->mbFloatWin || ((GetType() == WINDOW_BORDERWINDOW) && ((ImplBorderWindow*)this)->mbFloatWindow) || (nStyle & WB_SYSTEMFLOATWIN) ) ) ||
+ // 2. borderwindows of floaters with ownerdraw decoration
+ ( ((GetType() == WINDOW_BORDERWINDOW) && ((ImplBorderWindow*)this)->mbFloatWindow && (nStyle & WB_OWNERDRAWDECORATION) ) ) )
{
- pWindow->ImplExcludeWindowRegion( rRegion );
- pWindow->ImplExcludeOverlapWindows( rRegion );
+ nFrameStyle = SAL_FRAME_STYLE_FLOAT;
+ if( nStyle & WB_OWNERDRAWDECORATION )
+ nFrameStyle |= (SAL_FRAME_STYLE_OWNERDRAWDECORATION | SAL_FRAME_STYLE_NOSHADOW);
+ if( nStyle & WB_NEEDSFOCUS )
+ nFrameStyle |= SAL_FRAME_STYLE_FLOAT_FOCUSABLE;
}
+ else if( mpWindowImpl->mbFloatWin )
+ nFrameStyle |= SAL_FRAME_STYLE_TOOLWINDOW;
- pWindow = pWindow->mpWindowImpl->mpNext;
- }
-}
+ if( nStyle & WB_INTROWIN )
+ nFrameStyle |= SAL_FRAME_STYLE_INTRO;
+ if( nStyle & WB_TOOLTIPWIN )
+ nFrameStyle |= SAL_FRAME_STYLE_TOOLTIP;
-void Window::ImplExcludeOverlapWindows2( Region& rRegion )
-{
- if ( mpWindowImpl->mbReallyVisible )
- ImplExcludeWindowRegion( rRegion );
+ if( nStyle & WB_NOSHADOW )
+ nFrameStyle |= SAL_FRAME_STYLE_NOSHADOW;
- ImplExcludeOverlapWindows( rRegion );
-}
+ if( nStyle & WB_SYSTEMCHILDWINDOW )
+ nFrameStyle |= SAL_FRAME_STYLE_SYSTEMCHILD;
-void Window::ImplIntersectAndUnionOverlapWindows( const Region& rInterRegion, Region& rRegion )
-{
- Window* pWindow = mpWindowImpl->mpFirstOverlap;
- while ( pWindow )
- {
- if ( pWindow->mpWindowImpl->mbReallyVisible )
+ switch (mpWindowImpl->mnType)
{
- Region aTempRegion( rInterRegion );
- pWindow->ImplIntersectWindowRegion( aTempRegion );
- rRegion.Union( aTempRegion );
- pWindow->ImplIntersectAndUnionOverlapWindows( rInterRegion, rRegion );
+ case WINDOW_DIALOG:
+ case WINDOW_TABDIALOG:
+ case WINDOW_MODALDIALOG:
+ case WINDOW_MODELESSDIALOG:
+ case WINDOW_MESSBOX:
+ case WINDOW_INFOBOX:
+ case WINDOW_WARNINGBOX:
+ case WINDOW_ERRORBOX:
+ case WINDOW_QUERYBOX:
+ nFrameStyle |= SAL_FRAME_STYLE_DIALOG;
+ default:
+ break;
}
- pWindow = pWindow->mpWindowImpl->mpNext;
- }
-}
+ SalFrame* pParentFrame = NULL;
+ if ( pParent )
+ pParentFrame = pParent->mpWindowImpl->mpFrame;
+ SalFrame* pFrame;
+ if ( pSystemParentData )
+ pFrame = pSVData->mpDefInst->CreateChildFrame( pSystemParentData, nFrameStyle | SAL_FRAME_STYLE_PLUG );
+ else
+ pFrame = pSVData->mpDefInst->CreateFrame( pParentFrame, nFrameStyle );
+ if ( !pFrame )
+ {
+ // do not abort but throw an exception, may be the current thread terminates anyway (plugin-scenario)
+ throw ::com::sun::star::uno::RuntimeException(
+ OUString( "Could not create system window!" ),
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >() );
+ }
-void Window::ImplIntersectAndUnionOverlapWindows2( const Region& rInterRegion, Region& rRegion )
-{
- if ( mpWindowImpl->mbReallyVisible )
- {
- Region aTempRegion( rInterRegion );
- ImplIntersectWindowRegion( aTempRegion );
- rRegion.Union( aTempRegion );
- }
+ pFrame->SetCallback( this, ImplWindowFrameProc );
- ImplIntersectAndUnionOverlapWindows( rInterRegion, rRegion );
-}
+ // set window frame data
+ mpWindowImpl->mpFrameData = new ImplFrameData;
+ mpWindowImpl->mpFrame = pFrame;
+ mpWindowImpl->mpFrameWindow = this;
+ mpWindowImpl->mpOverlapWindow = this;
-void Window::ImplCalcOverlapRegionOverlaps( const Region& rInterRegion, Region& rRegion )
-{
- // Clip Overlap Siblings
- Window* pStartOverlapWindow;
- if ( !ImplIsOverlapWindow() )
- pStartOverlapWindow = mpWindowImpl->mpOverlapWindow;
- else
- pStartOverlapWindow = this;
- while ( !pStartOverlapWindow->mpWindowImpl->mbFrame )
- {
- Window* pOverlapWindow = pStartOverlapWindow->mpWindowImpl->mpOverlapWindow->mpWindowImpl->mpFirstOverlap;
- while ( pOverlapWindow && (pOverlapWindow != pStartOverlapWindow) )
+ // set frame data
+ mpWindowImpl->mpFrameData->mpNextFrame = pSVData->maWinData.mpFirstFrame;
+ pSVData->maWinData.mpFirstFrame = this;
+ mpWindowImpl->mpFrameData->mpFirstOverlap = NULL;
+ mpWindowImpl->mpFrameData->mpFocusWin = NULL;
+ mpWindowImpl->mpFrameData->mpMouseMoveWin = NULL;
+ mpWindowImpl->mpFrameData->mpMouseDownWin = NULL;
+ mpWindowImpl->mpFrameData->mpFirstBackWin = NULL;
+ mpWindowImpl->mpFrameData->mpFontCollection = pSVData->maGDIData.mpScreenFontList;
+ mpWindowImpl->mpFrameData->mpFontCache = pSVData->maGDIData.mpScreenFontCache;
+ mpWindowImpl->mpFrameData->mnAllSaveBackSize = 0;
+ mpWindowImpl->mpFrameData->mnFocusId = 0;
+ mpWindowImpl->mpFrameData->mnMouseMoveId = 0;
+ mpWindowImpl->mpFrameData->mnLastMouseX = -1;
+ mpWindowImpl->mpFrameData->mnLastMouseY = -1;
+ mpWindowImpl->mpFrameData->mnBeforeLastMouseX = -1;
+ mpWindowImpl->mpFrameData->mnBeforeLastMouseY = -1;
+ mpWindowImpl->mpFrameData->mnFirstMouseX = -1;
+ mpWindowImpl->mpFrameData->mnFirstMouseY = -1;
+ mpWindowImpl->mpFrameData->mnLastMouseWinX = -1;
+ mpWindowImpl->mpFrameData->mnLastMouseWinY = -1;
+ mpWindowImpl->mpFrameData->mnModalMode = 0;
+ mpWindowImpl->mpFrameData->mnMouseDownTime = 0;
+ mpWindowImpl->mpFrameData->mnClickCount = 0;
+ mpWindowImpl->mpFrameData->mnFirstMouseCode = 0;
+ mpWindowImpl->mpFrameData->mnMouseCode = 0;
+ mpWindowImpl->mpFrameData->mnMouseMode = 0;
+ mpWindowImpl->mpFrameData->meMapUnit = MAP_PIXEL;
+ mpWindowImpl->mpFrameData->mbHasFocus = false;
+ mpWindowImpl->mpFrameData->mbInMouseMove = false;
+ mpWindowImpl->mpFrameData->mbMouseIn = false;
+ mpWindowImpl->mpFrameData->mbStartDragCalled = false;
+ mpWindowImpl->mpFrameData->mbNeedSysWindow = false;
+ mpWindowImpl->mpFrameData->mbMinimized = false;
+ mpWindowImpl->mpFrameData->mbStartFocusState = false;
+ mpWindowImpl->mpFrameData->mbInSysObjFocusHdl = false;
+ mpWindowImpl->mpFrameData->mbInSysObjToTopHdl = false;
+ mpWindowImpl->mpFrameData->mbSysObjFocus = false;
+ if (!ImplDoTiledRendering())
{
- pOverlapWindow->ImplIntersectAndUnionOverlapWindows2( rInterRegion, rRegion );
- pOverlapWindow = pOverlapWindow->mpWindowImpl->mpNext;
+ mpWindowImpl->mpFrameData->maPaintTimer.SetTimeout( 30 );
+ mpWindowImpl->mpFrameData->maPaintTimer.SetTimeoutHdl( LINK( this, Window, ImplHandlePaintHdl ) );
}
- pStartOverlapWindow = pStartOverlapWindow->mpWindowImpl->mpOverlapWindow;
- }
+ mpWindowImpl->mpFrameData->maResizeTimer.SetTimeout( 50 );
+ mpWindowImpl->mpFrameData->maResizeTimer.SetTimeoutHdl( LINK( this, Window, ImplHandleResizeTimerHdl ) );
+ mpWindowImpl->mpFrameData->mbInternalDragGestureRecognizer = false;
- // Clip Child Overlap Windows
- if ( !ImplIsOverlapWindow() )
- mpWindowImpl->mpOverlapWindow->ImplIntersectAndUnionOverlapWindows( rInterRegion, rRegion );
- else
- ImplIntersectAndUnionOverlapWindows( rInterRegion, rRegion );
-}
+ if ( pRealParent && IsTopWindow() )
+ {
+ ImplWinData* pParentWinData = pRealParent->ImplGetWinData();
+ pParentWinData->maTopWindowChildren.push_back( this );
+ }
+ }
-void Window::ImplCalcOverlapRegion( const Rectangle& rSourceRect, Region& rRegion,
- bool bChildren, bool bParent, bool bSiblings )
-{
- Region aRegion( rSourceRect );
- if ( mpWindowImpl->mbWinRegion )
- rRegion.Intersect( ImplPixelToDevicePixel( mpWindowImpl->maWinRegion ) );
- Region aTempRegion;
- Window* pWindow;
+ // init data
+ mpWindowImpl->mpRealParent = pRealParent;
- ImplCalcOverlapRegionOverlaps( aRegion, rRegion );
+ // #99318: make sure fontcache and list is available before call to SetSettings
+ mpFontCollection = mpWindowImpl->mpFrameData->mpFontCollection;
+ mpFontCache = mpWindowImpl->mpFrameData->mpFontCache;
- // Parent-Boundaries
- if ( bParent )
+ if ( mpWindowImpl->mbFrame )
{
- pWindow = this;
- if ( !ImplIsOverlapWindow() )
+ if ( pParent )
{
- pWindow = ImplGetParent();
- do
- {
- aTempRegion = aRegion;
- pWindow->ImplExcludeWindowRegion( aTempRegion );
- rRegion.Union( aTempRegion );
- if ( pWindow->ImplIsOverlapWindow() )
- break;
- pWindow = pWindow->ImplGetParent();
- }
- while ( pWindow );
+ mpWindowImpl->mpFrameData->mnDPIX = pParent->mpWindowImpl->mpFrameData->mnDPIX;
+ mpWindowImpl->mpFrameData->mnDPIY = pParent->mpWindowImpl->mpFrameData->mnDPIY;
}
- if ( pWindow && !pWindow->mpWindowImpl->mbFrame )
+ else
{
- aTempRegion = aRegion;
- aTempRegion.Exclude( Rectangle( Point( 0, 0 ), Size( mpWindowImpl->mpFrameWindow->mnOutWidth, mpWindowImpl->mpFrameWindow->mnOutHeight ) ) );
- rRegion.Union( aTempRegion );
+ OutputDevice *pOutDev = GetOutDev();
+ if ( pOutDev->AcquireGraphics() )
+ {
+ mpGraphics->GetResolution( mpWindowImpl->mpFrameData->mnDPIX, mpWindowImpl->mpFrameData->mnDPIY );
+ }
}
- }
- // Siblings
- if ( bSiblings && !ImplIsOverlapWindow() )
- {
- pWindow = mpWindowImpl->mpParent->mpWindowImpl->mpFirstChild;
- do
+ // add ownerdraw decorated frame windows to list in the top-most frame window
+ // so they can be hidden on lose focus
+ if( nStyle & WB_OWNERDRAWDECORATION )
+ ImplGetOwnerDrawList().push_back( this );
+
+ // delay settings initialization until first "real" frame
+ // this relies on the IntroWindow not needing any system settings
+ if ( !pSVData->maAppData.mbSettingsInit &&
+ ! (nStyle & (WB_INTROWIN|WB_DEFAULTWIN))
+ )
{
- if ( pWindow->mpWindowImpl->mbReallyVisible && (pWindow != this) )
- {
- aTempRegion = aRegion;
- pWindow->ImplIntersectWindowRegion( aTempRegion );
- rRegion.Union( aTempRegion );
- }
- pWindow = pWindow->mpWindowImpl->mpNext;
+ // side effect: ImplUpdateGlobalSettings does an ImplGetFrame()->UpdateSettings
+ ImplUpdateGlobalSettings( *pSVData->maAppData.mpSettings );
+ OutputDevice::SetSettings( *pSVData->maAppData.mpSettings );
+ pSVData->maAppData.mbSettingsInit = true;
}
- while ( pWindow );
- }
- if ( bChildren )
+ // If we create a Window with default size, query this
+ // size directly, because we want resize all Controls to
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list