/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- *//* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */#include <limits.h>#include <tools/poly.hxx>#include <sal/log.hxx>#include <vcl/bitmap.hxx>#include <vcl/dialog.hxx>#include <vcl/event.hxx>#include <vcl/fixed.hxx>#include <vcl/layout.hxx>#include <vcl/timer.hxx>#include <vcl/metric.hxx>#include <vcl/virdev.hxx>#include <vcl/window.hxx>#include <vcl/scrbar.hxx>#include <vcl/dockwin.hxx>#include <vcl/tabctrl.hxx>#include <vcl/settings.hxx>#include <vcl/builder.hxx>#include <window.h>#include <fontinstance.hxx>#include <outdev.h>#include <svdata.hxx>#include <salbmp.hxx>#include <salgdi.hxx>#include <salframe.hxx>#include <scrwnd.hxx>#include <com/sun/star/accessibility/AccessibleRole.hpp>usingnamespacecom::sun::star;namespacevcl{voidWindow::ShowFocus(consttools::Rectangle&rRect){if(mpWindowImpl->mbInShowFocus)return;mpWindowImpl->mbInShowFocus=true;ImplWinData*pWinData=ImplGetWinData();// native themeing suggest not to use focus rectsif(!(mpWindowImpl->mbUseNativeFocus&&IsNativeWidgetEnabled())){if(!mpWindowImpl->mbInPaint){if(mpWindowImpl->mbFocusVisible){if(*pWinData->mpFocusRect==rRect){mpWindowImpl->mbInShowFocus=false;return;}ImplInvertFocus(*pWinData->mpFocusRect);}ImplInvertFocus(rRect);}pWinData->mpFocusRect=rRect;mpWindowImpl->mbFocusVisible=true;}else{if(!mpWindowImpl->mbNativeFocusVisible){mpWindowImpl->mbNativeFocusVisible=true;if(!mpWindowImpl->mbInPaint)Invalidate();}}mpWindowImpl->mbInShowFocus=false;}voidWindow::HideFocus(){if(mpWindowImpl->mbInHideFocus)return;mpWindowImpl->mbInHideFocus=true;// native themeing can suggest not to use focus rectsif(!(mpWindowImpl->mbUseNativeFocus&&IsNativeWidgetEnabled())){if(!mpWindowImpl->mbFocusVisible){mpWindowImpl->mbInHideFocus=false;return;}if(!mpWindowImpl->mbInPaint)ImplInvertFocus(*ImplGetWinData()->mpFocusRect);mpWindowImpl->mbFocusVisible=false;}else{if(mpWindowImpl->mbNativeFocusVisible){mpWindowImpl->mbNativeFocusVisible=false;if(!mpWindowImpl->mbInPaint)Invalidate();}}mpWindowImpl->mbInHideFocus=false;}voidWindow::ShowTracking(consttools::Rectangle&rRect,ShowTrackFlagsnFlags){ImplWinData*pWinData=ImplGetWinData();if(!mpWindowImpl->mbInPaint||!(nFlags&ShowTrackFlags::TrackWindow)){if(mpWindowImpl->mbTrackVisible){if((*pWinData->mpTrackRect==rRect)&&(pWinData->mnTrackFlags==nFlags))return;InvertTracking(*pWinData->mpTrackRect,pWinData->mnTrackFlags);}InvertTracking(rRect,nFlags);}pWinData->mpTrackRect=rRect;pWinData->mnTrackFlags=nFlags;mpWindowImpl->mbTrackVisible=true;}voidWindow::HideTracking(){if(mpWindowImpl->mbTrackVisible){ImplWinData*pWinData=ImplGetWinData();if(!mpWindowImpl->mbInPaint||!(pWinData->mnTrackFlags&ShowTrackFlags::TrackWindow))InvertTracking(*pWinData->mpTrackRect,pWinData->mnTrackFlags);mpWindowImpl->mbTrackVisible=false;}}voidWindow::InvertTracking(consttools::Rectangle&rRect,ShowTrackFlagsnFlags){OutputDevice*pOutDev=GetOutDev();tools::RectangleaRect(pOutDev->ImplLogicToDevicePixel(rRect));if(aRect.IsEmpty())return;aRect.Justify();SalGraphics*pGraphics;if(nFlags&ShowTrackFlags::TrackWindow){if(!IsDeviceOutputNecessary())return;// we need a graphicsif(!mpGraphics){if(!pOutDev->AcquireGraphics())return;}if(mbInitClipRegion)InitClipRegion();if(mbOutputClipped)return;pGraphics=mpGraphics;}else{pGraphics=ImplGetFrameGraphics();if(nFlags&ShowTrackFlags::Clip){PointaPoint(mnOutOffX,mnOutOffY);vcl::RegionaRegion(tools::Rectangle(aPoint,Size(mnOutWidth,mnOutHeight)));ImplClipBoundaries(aRegion,false,false);pOutDev->SelectClipRegion(aRegion,pGraphics);}}ShowTrackFlagsnStyle=nFlags&ShowTrackFlags::StyleMask;if(nStyle==ShowTrackFlags::Object)pGraphics->Invert(aRect.Left(),aRect.Top(),aRect.GetWidth(),aRect.GetHeight(),SalInvert::TrackFrame,this);elseif(nStyle==ShowTrackFlags::Split)pGraphics->Invert(aRect.Left(),aRect.Top(),aRect.GetWidth(),aRect.GetHeight(),SalInvert::N50,this);else{longnBorder=1;if(nStyle==ShowTrackFlags::Big)nBorder=5;pGraphics->Invert(aRect.Left(),aRect.Top(),aRect.GetWidth(),nBorder,SalInvert::N50,this);pGraphics->Invert(aRect.Left(),aRect.Bottom()-nBorder+1,aRect.GetWidth(),nBorder,SalInvert::N50,this);pGraphics->Invert(aRect.Left(),aRect.Top()+nBorder,nBorder,aRect.GetHeight()-(nBorder*2),SalInvert::N50,this);pGraphics->Invert(aRect.Right()-nBorder+1,aRect.Top()+nBorder,nBorder,aRect.GetHeight()-(nBorder*2),SalInvert::N50,this);}}IMPL_LINK(Window,ImplTrackTimerHdl,Timer*,pTimer,void)<--- syntax error{ImplSVData*pSVData=ImplGetSVData();// if Button-Repeat we have to change the timeoutif(pSVData->maWinData.mnTrackFlags&StartTrackingFlags::ButtonRepeat)pTimer->SetTimeout(GetSettings().GetMouseSettings().GetButtonRepeat());// create Tracking-EventPointaMousePos(mpWindowImpl->mpFrameData->mnLastMouseX,mpWindowImpl->mpFrameData->mnLastMouseY);if(ImplIsAntiparallel()){// re-mirror frame pos at pChildconstOutputDevice*pOutDev=GetOutDev();pOutDev->ReMirror(aMousePos);}MouseEventaMEvt(ImplFrameToOutput(aMousePos),mpWindowImpl->mpFrameData->mnClickCount,MouseEventModifiers::NONE,mpWindowImpl->mpFrameData->mnMouseCode,mpWindowImpl->mpFrameData->mnMouseCode);TrackingEventaTEvt(aMEvt,TrackingEventFlags::Repeat);Tracking(aTEvt);}voidWindow::StartTracking(StartTrackingFlagsnFlags){ImplSVData*pSVData=ImplGetSVData();if(pSVData->maWinData.mpTrackWin.get()!=this){if(pSVData->maWinData.mpTrackWin)pSVData->maWinData.mpTrackWin->EndTracking(TrackingEventFlags::Cancel);}if(nFlags&(StartTrackingFlags::ScrollRepeat|StartTrackingFlags::ButtonRepeat)){pSVData->maWinData.mpTrackTimer=newAutoTimer;if(nFlags&StartTrackingFlags::ScrollRepeat)pSVData->maWinData.mpTrackTimer->SetTimeout(MouseSettings::GetScrollRepeat());elsepSVData->maWinData.mpTrackTimer->SetTimeout(MouseSettings::GetButtonStartRepeat());pSVData->maWinData.mpTrackTimer->SetInvokeHandler(LINK(this,Window,ImplTrackTimerHdl));pSVData->maWinData.mpTrackTimer->SetDebugName("vcl::Window pSVData->maWinData.mpTrackTimer");pSVData->maWinData.mpTrackTimer->Start();}pSVData->maWinData.mpTrackWin=this;pSVData->maWinData.mnTrackFlags=nFlags;CaptureMouse();}voidWindow::EndTracking(TrackingEventFlagsnFlags){ImplSVData*pSVData=ImplGetSVData();if(pSVData->maWinData.mpTrackWin.get()==this){// due to DbgChkThis in brackets, as the window could be destroyed// in the handler{if(pSVData->maWinData.mpTrackTimer){deletepSVData->maWinData.mpTrackTimer;pSVData->maWinData.mpTrackTimer=nullptr;}pSVData->maWinData.mpTrackWin=nullptr;pSVData->maWinData.mnTrackFlags=StartTrackingFlags::NONE;ReleaseMouse();}// call EndTracking if requiredif(!(nFlags&TrackingEventFlags::DontCallHdl)){PointaMousePos(mpWindowImpl->mpFrameData->mnLastMouseX,mpWindowImpl->mpFrameData->mnLastMouseY);if(ImplIsAntiparallel()){// re-mirror frame pos at pChildconstOutputDevice*pOutDev=GetOutDev();pOutDev->ReMirror(aMousePos);}MouseEventaMEvt(ImplFrameToOutput(aMousePos),mpWindowImpl->mpFrameData->mnClickCount,MouseEventModifiers::NONE,mpWindowImpl->mpFrameData->mnMouseCode,mpWindowImpl->mpFrameData->mnMouseCode);TrackingEventaTEvt(aMEvt,nFlags|TrackingEventFlags::End);// CompatTracking effectivelyif(!mpWindowImpl||mpWindowImpl->mbInDispose)returnWindow::Tracking(aTEvt);elsereturnTracking(aTEvt);}}}boolWindow::IsTracking()const{return(ImplGetSVData()->maWinData.mpTrackWin==this);}voidWindow::StartAutoScroll(StartAutoScrollFlagsnFlags){ImplSVData*pSVData=ImplGetSVData();if(pSVData->maWinData.mpAutoScrollWin.get()!=this){if(pSVData->maWinData.mpAutoScrollWin)pSVData->maWinData.mpAutoScrollWin->EndAutoScroll();}pSVData->maWinData.mpAutoScrollWin=this;pSVData->maWinData.mnAutoScrollFlags=nFlags;pSVData->maAppData.mpWheelWindow=VclPtr<ImplWheelWindow>::Create(this);}voidWindow::EndAutoScroll(){ImplSVData*pSVData=ImplGetSVData();if(pSVData->maWinData.mpAutoScrollWin.get()==this){pSVData->maWinData.mpAutoScrollWin=nullptr;pSVData->maWinData.mnAutoScrollFlags=StartAutoScrollFlags::NONE;pSVData->maAppData.mpWheelWindow->ImplStop();pSVData->maAppData.mpWheelWindow->SetParentToDefaultWindow();pSVData->maAppData.mpWheelWindow.disposeAndClear();}}VclPtr<vcl::Window>Window::SaveFocus(){ImplSVData*pSVData=ImplGetSVData();if(pSVData->maWinData.mpFocusWin){returnpSVData->maWinData.mpFocusWin;}elsereturnnullptr;}voidWindow::EndSaveFocus(constVclPtr<vcl::Window>&xFocusWin){if(xFocusWin&&!xFocusWin->IsDisposed()){xFocusWin->GrabFocus();}}voidWindow::SetZoom(constFraction&rZoom){if(mpWindowImpl&&mpWindowImpl->maZoom!=rZoom){mpWindowImpl->maZoom=rZoom;CompatStateChanged(StateChangedType::Zoom);}}staticlongWinFloatRound(doublefVal){return(fVal>0.0?static_cast<long>(fVal+0.5):-static_cast<long>(-fVal+0.5));}voidWindow::SetZoomedPointFont(vcl::RenderContext&rRenderContext,constvcl::Font&rFont){constFraction&rZoom=GetZoom();if(rZoom.GetNumerator()!=rZoom.GetDenominator()){vcl::FontaFont(rFont);SizeaSize=aFont.GetFontSize();aSize.setWidth(WinFloatRound(double(aSize.Width()*rZoom)));aSize.setHeight(WinFloatRound(double(aSize.Height()*rZoom)));aFont.SetFontSize(aSize);SetPointFont(rRenderContext,aFont);}else{SetPointFont(rRenderContext,rFont);}}longWindow::CalcZoom(longnCalc)const{constFraction&rZoom=GetZoom();if(rZoom.GetNumerator()!=rZoom.GetDenominator()){doublen=double(nCalc*rZoom);nCalc=WinFloatRound(n);}returnnCalc;}voidWindow::SetControlFont(){if(mpWindowImpl&&mpWindowImpl->mpControlFont){mpWindowImpl->mpControlFont.reset();CompatStateChanged(StateChangedType::ControlFont);}}voidWindow::SetControlFont(constvcl::Font&rFont){if(rFont==vcl::Font()){SetControlFont();return;}if(mpWindowImpl->mpControlFont){if(*mpWindowImpl->mpControlFont==rFont)return;*mpWindowImpl->mpControlFont=rFont;}elsempWindowImpl->mpControlFont.reset(newvcl::Font(rFont));CompatStateChanged(StateChangedType::ControlFont);}vcl::FontWindow::GetControlFont()const{if(mpWindowImpl->mpControlFont)return*mpWindowImpl->mpControlFont;else{vcl::FontaFont;returnaFont;}}voidWindow::ApplyControlFont(vcl::RenderContext&rRenderContext,constvcl::Font&rFont){vcl::FontaFont(rFont);if(IsControlFont())aFont.Merge(GetControlFont());SetZoomedPointFont(rRenderContext,aFont);}voidWindow::SetControlForeground(){if(mpWindowImpl->mbControlForeground){mpWindowImpl->maControlForeground=COL_TRANSPARENT;mpWindowImpl->mbControlForeground=false;CompatStateChanged(StateChangedType::ControlForeground);}}voidWindow::SetControlForeground(constColor&rColor){if(rColor.GetTransparency()){if(mpWindowImpl->mbControlForeground){mpWindowImpl->maControlForeground=COL_TRANSPARENT;mpWindowImpl->mbControlForeground=false;CompatStateChanged(StateChangedType::ControlForeground);}}else{if(mpWindowImpl->maControlForeground!=rColor){mpWindowImpl->maControlForeground=rColor;mpWindowImpl->mbControlForeground=true;CompatStateChanged(StateChangedType::ControlForeground);}}}voidWindow::ApplyControlForeground(vcl::RenderContext&rRenderContext,constColor&rDefaultColor){ColoraTextColor(rDefaultColor);if(IsControlForeground())aTextColor=GetControlForeground();rRenderContext.SetTextColor(aTextColor);}voidWindow::SetControlBackground(){if(mpWindowImpl->mbControlBackground){mpWindowImpl->maControlBackground=COL_TRANSPARENT;mpWindowImpl->mbControlBackground=false;CompatStateChanged(StateChangedType::ControlBackground);}}voidWindow::SetControlBackground(constColor&rColor){if(rColor.GetTransparency()){if(mpWindowImpl->mbControlBackground){mpWindowImpl->maControlBackground=COL_TRANSPARENT;mpWindowImpl->mbControlBackground=false;CompatStateChanged(StateChangedType::ControlBackground);}}else{if(mpWindowImpl->maControlBackground!=rColor){mpWindowImpl->maControlBackground=rColor;mpWindowImpl->mbControlBackground=true;CompatStateChanged(StateChangedType::ControlBackground);}}}voidWindow::ApplyControlBackground(vcl::RenderContext&rRenderContext,constColor&rDefaultColor){ColoraColor(rDefaultColor);if(IsControlBackground())aColor=GetControlBackground();rRenderContext.SetBackground(aColor);}SizeWindow::CalcWindowSize(constSize&rOutSz)const{SizeaSz=rOutSz;aSz.AdjustWidth(mpWindowImpl->mnLeftBorder+mpWindowImpl->mnRightBorder);aSz.AdjustHeight(mpWindowImpl->mnTopBorder+mpWindowImpl->mnBottomBorder);returnaSz;}SizeWindow::CalcOutputSize(constSize&rWinSz)const{SizeaSz=rWinSz;aSz.AdjustWidth(-(mpWindowImpl->mnLeftBorder+mpWindowImpl->mnRightBorder));aSz.AdjustHeight(-(mpWindowImpl->mnTopBorder+mpWindowImpl->mnBottomBorder));returnaSz;}vcl::FontWindow::GetDrawPixelFont(OutputDeviceconst*pDev)const{vcl::FontaFont=GetPointFont(*const_cast<Window*>(this));SizeaFontSize=aFont.GetFontSize();MapModeaPtMapMode(MapUnit::MapPoint);aFontSize=pDev->LogicToPixel(aFontSize,aPtMapMode);aFont.SetFontSize(aFontSize);returnaFont;}longWindow::GetDrawPixel(OutputDeviceconst*pDev,longnPixels)const{longnP=nPixels;if(pDev->GetOutDevType()!=OUTDEV_WINDOW){MapModeaMap(MapUnit::Map100thMM);SizeaSz(nP,0);aSz=PixelToLogic(aSz,aMap);aSz=pDev->LogicToPixel(aSz,aMap);nP=aSz.Width();}returnnP;}staticvoidlcl_HandleScrollHelper(ScrollBar*pScrl,doublenN,boolisMultiplyByLineSize){if(pScrl&&nN&&pScrl->IsEnabled()&&pScrl->IsInputEnabled()&&!pScrl->IsInModalMode()){longnNewPos=pScrl->GetThumbPos();if(nN==-LONG_MAX)nNewPos+=pScrl->GetPageSize();elseif(nN==LONG_MAX)nNewPos-=pScrl->GetPageSize();else{// allowing both chunked and continuous scrollingif(isMultiplyByLineSize){nN*=pScrl->GetLineSize();}constdoublefVal=nNewPos-nN;if(fVal<LONG_MIN)nNewPos=LONG_MIN;elseif(fVal>LONG_MAX)nNewPos=LONG_MAX;elsenNewPos=static_cast<long>(fVal);}pScrl->DoScroll(nNewPos);}}boolWindow::HandleScrollCommand(constCommandEvent&rCmd,ScrollBar*pHScrl,ScrollBar*pVScrl){boolbRet=false;if(pHScrl||pVScrl){switch(rCmd.GetCommand()){caseCommandEventId::StartAutoScroll:{StartAutoScrollFlagsnFlags=StartAutoScrollFlags::NONE;if(pHScrl){if((pHScrl->GetVisibleSize()<pHScrl->GetRangeMax())&&pHScrl->IsEnabled()&&pHScrl->IsInputEnabled()&&!pHScrl->IsInModalMode())nFlags|=StartAutoScrollFlags::Horz;}if(pVScrl){if((pVScrl->GetVisibleSize()<pVScrl->GetRangeMax())&&pVScrl->IsEnabled()&&pVScrl->IsInputEnabled()&&!pVScrl->IsInModalMode())nFlags|=StartAutoScrollFlags::Vert;}if(nFlags!=StartAutoScrollFlags::NONE){StartAutoScroll(nFlags);bRet=true;}}break;caseCommandEventId::Wheel:{constCommandWheelData*pData=rCmd.GetWheelData();if(pData&&(CommandWheelMode::SCROLL==pData->GetMode())){if(!pData->IsDeltaPixel()){doublenScrollLines=pData->GetScrollLines();doublenLines;if(nScrollLines==COMMAND_WHEEL_PAGESCROLL){if(pData->GetDelta()<0)nLines=-LONG_MAX;elsenLines=LONG_MAX;}elsenLines=pData->GetNotchDelta()*nScrollLines;if(nLines){ImplHandleScroll(nullptr,0L,pData->IsHorz()?pHScrl:pVScrl,nLines);bRet=true;}}else{// Mobile / touch scrolling sectionconstPoint&deltaPoint=rCmd.GetMousePosPixel();doubledeltaXInPixels=double(deltaPoint.X());doubledeltaYInPixels=double(deltaPoint.Y());SizewinSize=GetOutputSizePixel();if(pHScrl){doublevisSizeX=double(pHScrl->GetVisibleSize());doubleratioX=deltaXInPixels/double(winSize.getWidth());longdeltaXInLogic=long(visSizeX*ratioX);// Touch need to work by pixels. Did not apply this to// Android, as android code may require adaptations// to work with this scrolling code#ifndef IOSlonglineSizeX=pHScrl->GetLineSize();if(lineSizeX){deltaXInLogic/=lineSizeX;}else{deltaXInLogic=0;}#endifif(deltaXInLogic){#ifndef IOSboolconstisMultiplyByLineSize=true;#elseboolconstisMultiplyByLineSize=false;#endiflcl_HandleScrollHelper(pHScrl,deltaXInLogic,isMultiplyByLineSize);bRet=true;}}if(pVScrl){doublevisSizeY=double(pVScrl->GetVisibleSize());doubleratioY=deltaYInPixels/double(winSize.getHeight());longdeltaYInLogic=long(visSizeY*ratioY);// Touch need to work by pixels. Did not apply this to// Android, as android code may require adaptations// to work with this scrolling code#ifndef IOSlonglineSizeY=pVScrl->GetLineSize();if(lineSizeY){deltaYInLogic/=lineSizeY;}else{deltaYInLogic=0;}#endifif(deltaYInLogic){#ifndef IOSboolconstisMultiplyByLineSize=true;#elseboolconstisMultiplyByLineSize=false;#endiflcl_HandleScrollHelper(pVScrl,deltaYInLogic,isMultiplyByLineSize);bRet=true;}}}}}break;caseCommandEventId::AutoScroll:{constCommandScrollData*pData=rCmd.GetAutoScrollData();if(pData&&(pData->GetDeltaX()||pData->GetDeltaY())){ImplHandleScroll(pHScrl,pData->GetDeltaX(),pVScrl,pData->GetDeltaY());bRet=true;}}break;default:break;}}returnbRet;}// Note that when called for CommandEventId::Wheel above, despite its name,// pVScrl isn't necessarily the vertical scroll bar. Depending on// whether the scroll is horizontal or vertical, it is either the// horizontal or vertical scroll bar. nY is correspondingly either// the horizontal or vertical scroll amount.voidWindow::ImplHandleScroll(ScrollBar*pHScrl,doublenX,ScrollBar*pVScrl,doublenY){lcl_HandleScrollHelper(pHScrl,nX,true);lcl_HandleScrollHelper(pVScrl,nY,true);}DockingManager*Window::GetDockingManager(){returnImplGetDockingManager();}voidWindow::EnableDocking(boolbEnable){// update list of dockable windowsif(bEnable)ImplGetDockingManager()->AddWindow(this);elseImplGetDockingManager()->RemoveWindow(this);}// retrieves the list of owner draw decorated windows for this window hierarchy::std::vector<VclPtr<vcl::Window>>&Window::ImplGetOwnerDrawList(){returnImplGetTopmostFrameWindow()->mpWindowImpl->mpFrameData->maOwnerDrawList;}voidWindow::SetHelpId(constOString&rHelpId){mpWindowImpl->maHelpId=rHelpId;}constOString&Window::GetHelpId()const{returnmpWindowImpl->maHelpId;}OStringWindow::GetScreenshotId()const{returnGetHelpId();}// --------- old inline methods ---------------vcl::Window*Window::ImplGetWindow()const{if(mpWindowImpl->mpClientWindow)returnmpWindowImpl->mpClientWindow;elsereturnconst_cast<vcl::Window*>(this);}ImplFrameData*Window::ImplGetFrameData(){returnmpWindowImpl?mpWindowImpl->mpFrameData:nullptr;}SalFrame*Window::ImplGetFrame()const{returnmpWindowImpl?mpWindowImpl->mpFrame:nullptr;}weld::Window*Window::GetFrameWeld()const{SalFrame*pFrame=ImplGetFrame();returnpFrame?pFrame->GetFrameWeld():nullptr;}vcl::Window*Window::ImplGetParent()const{returnmpWindowImpl?mpWindowImpl->mpParent.get():nullptr;}vcl::Window*Window::ImplGetClientWindow()const{returnmpWindowImpl?mpWindowImpl->mpClientWindow.get():nullptr;}vcl::Window*Window::ImplGetBorderWindow()const{returnmpWindowImpl?mpWindowImpl->mpBorderWindow.get():nullptr;}vcl::Window*Window::ImplGetFirstOverlapWindow(){if(mpWindowImpl->mbOverlapWin)returnthis;elsereturnmpWindowImpl->mpOverlapWindow;}constvcl::Window*Window::ImplGetFirstOverlapWindow()const{if(mpWindowImpl->mbOverlapWin)returnthis;elsereturnmpWindowImpl->mpOverlapWindow;}vcl::Window*Window::ImplGetFrameWindow()const{returnmpWindowImpl?mpWindowImpl->mpFrameWindow.get():nullptr;}boolWindow::IsDockingWindow()const{returnmpWindowImpl&&mpWindowImpl->mbDockWin;}boolWindow::ImplIsFloatingWindow()const{returnmpWindowImpl&&mpWindowImpl->mbFloatWin;}boolWindow::ImplIsSplitter()const{returnmpWindowImpl&&mpWindowImpl->mbSplitter;}boolWindow::ImplIsPushButton()const{returnmpWindowImpl&&mpWindowImpl->mbPushButton;}boolWindow::ImplIsOverlapWindow()const{returnmpWindowImpl&&mpWindowImpl->mbOverlapWin;}voidWindow::ImplSetMouseTransparent(boolbTransparent){if(mpWindowImpl)mpWindowImpl->mbMouseTransparent=bTransparent;}PointWindow::ImplOutputToFrame(constPoint&rPos){returnPoint(rPos.X()+mnOutOffX,rPos.Y()+mnOutOffY);}PointWindow::ImplFrameToOutput(constPoint&rPos){returnPoint(rPos.X()-mnOutOffX,rPos.Y()-mnOutOffY);}voidWindow::SetCompoundControl(boolbCompound){if(mpWindowImpl)mpWindowImpl->mbCompoundControl=bCompound;}WinBitsWindow::GetStyle()const{returnmpWindowImpl?mpWindowImpl->mnStyle:0;}WinBitsWindow::GetPrevStyle()const{returnmpWindowImpl?mpWindowImpl->mnPrevStyle:0;}WindowExtendedStyleWindow::GetExtendedStyle()const{returnmpWindowImpl?mpWindowImpl->mnExtendedStyle:WindowExtendedStyle::NONE;}voidWindow::SetType(WindowTypenType){if(mpWindowImpl)mpWindowImpl->mnType=nType;}WindowTypeWindow::GetType()const{if(mpWindowImpl)returnmpWindowImpl->mnType;elsereturnWindowType::NONE;}Dialog*Window::GetParentDialog()const{constvcl::Window*pWindow=this;while(pWindow){if(pWindow->IsDialog())break;pWindow=pWindow->GetParent();}returnconst_cast<Dialog*>(dynamic_cast<constDialog*>(pWindow));}boolWindow::IsSystemWindow()const{returnmpWindowImpl&&mpWindowImpl->mbSysWin;}boolWindow::IsDialog()const{returnmpWindowImpl&&mpWindowImpl->mbDialog;}boolWindow::IsMenuFloatingWindow()const{returnmpWindowImpl&&mpWindowImpl->mbMenuFloatingWindow;}boolWindow::IsToolbarFloatingWindow()const{returnmpWindowImpl&&mpWindowImpl->mbToolbarFloatingWindow;}voidWindow::EnableAllResize(){mpWindowImpl->mbAllResize=true;}voidWindow::EnableChildTransparentMode(boolbEnable){mpWindowImpl->mbChildTransparent=bEnable;}boolWindow::IsChildTransparentModeEnabled()const{returnmpWindowImpl&&mpWindowImpl->mbChildTransparent;}boolWindow::IsMouseTransparent()const{returnmpWindowImpl&&mpWindowImpl->mbMouseTransparent;}boolWindow::IsPaintTransparent()const{returnmpWindowImpl&&mpWindowImpl->mbPaintTransparent;}voidWindow::SetDialogControlStart(boolbStart){mpWindowImpl->mbDlgCtrlStart=bStart;}boolWindow::IsDialogControlStart()const{returnmpWindowImpl&&mpWindowImpl->mbDlgCtrlStart;}voidWindow::SetDialogControlFlags(DialogControlFlagsnFlags){mpWindowImpl->mnDlgCtrlFlags=nFlags;}DialogControlFlagsWindow::GetDialogControlFlags()const{returnmpWindowImpl->mnDlgCtrlFlags;}constInputContext&Window::GetInputContext()const{returnmpWindowImpl->maInputContext;}boolWindow::IsControlFont()const{returnbool(mpWindowImpl->mpControlFont);}constColor&Window::GetControlForeground()const{returnmpWindowImpl->maControlForeground;}boolWindow::IsControlForeground()const{returnmpWindowImpl->mbControlForeground;}constColor&Window::GetControlBackground()const{returnmpWindowImpl->maControlBackground;}boolWindow::IsControlBackground()const{returnmpWindowImpl->mbControlBackground;}boolWindow::IsInPaint()const{returnmpWindowImpl&&mpWindowImpl->mbInPaint;}vcl::Window*Window::GetParent()const{returnmpWindowImpl?mpWindowImpl->mpRealParent.get():nullptr;}boolWindow::IsVisible()const{returnmpWindowImpl&&mpWindowImpl->mbVisible;}boolWindow::IsReallyVisible()const{returnmpWindowImpl&&mpWindowImpl->mbReallyVisible;}boolWindow::IsReallyShown()const{returnmpWindowImpl&&mpWindowImpl->mbReallyShown;}boolWindow::IsInInitShow()const{returnmpWindowImpl->mbInInitShow;}boolWindow::IsEnabled()const{returnmpWindowImpl&&!mpWindowImpl->mbDisabled;}boolWindow::IsInputEnabled()const{returnmpWindowImpl&&!mpWindowImpl->mbInputDisabled;}boolWindow::IsAlwaysEnableInput()const{returnmpWindowImpl->meAlwaysInputMode==AlwaysInputEnabled;}ActivateModeFlagsWindow::GetActivateMode()const{returnmpWindowImpl->mnActivateMode;}boolWindow::IsAlwaysOnTopEnabled()const{returnmpWindowImpl->mbAlwaysOnTop;}boolWindow::IsDefaultPos()const{returnmpWindowImpl->mbDefPos;}boolWindow::IsDefaultSize()const{returnmpWindowImpl->mbDefSize;}PointWindow::GetOffsetPixelFrom(constvcl::Window&rWindow)const{returnPoint(GetOutOffXPixel()-rWindow.GetOutOffXPixel(),GetOutOffYPixel()-rWindow.GetOutOffYPixel());}voidWindow::EnablePaint(boolbEnable){mpWindowImpl->mbPaintDisabled=!bEnable;}boolWindow::IsPaintEnabled()const{return!mpWindowImpl->mbPaintDisabled;}boolWindow::IsUpdateMode()const{return!mpWindowImpl->mbNoUpdate;}voidWindow::SetParentUpdateMode(boolbUpdate){mpWindowImpl->mbNoParentUpdate=!bUpdate;}boolWindow::IsActive()const{returnmpWindowImpl->mbActive;}GetFocusFlagsWindow::GetGetFocusFlags()const{returnmpWindowImpl->mnGetFocusFlags;}boolWindow::IsCompoundControl()const{returnmpWindowImpl->mbCompoundControl;}boolWindow::IsWait()const{return(mpWindowImpl->mnWaitCount!=0);}vcl::Cursor*Window::GetCursor()const{if(!mpWindowImpl)returnnullptr;returnmpWindowImpl->mpCursor;}constFraction&Window::GetZoom()const{returnmpWindowImpl->maZoom;}boolWindow::IsZoom()const{returnmpWindowImpl->maZoom.GetNumerator()!=mpWindowImpl->maZoom.GetDenominator();}voidWindow::SetHelpText(constOUString&rHelpText){mpWindowImpl->maHelpText=rHelpText;mpWindowImpl->mbHelpTextDynamic=true;}voidWindow::SetQuickHelpText(constOUString&rHelpText){if(mpWindowImpl)mpWindowImpl->maQuickHelpText=rHelpText;}constOUString&Window::GetQuickHelpText()const{returnmpWindowImpl->maQuickHelpText;}boolWindow::IsCreatedWithToolkit()const{returnmpWindowImpl->mbCreatedWithToolkit;}voidWindow::SetCreatedWithToolkit(boolb){mpWindowImpl->mbCreatedWithToolkit=b;}constPointer&Window::GetPointer()const{returnmpWindowImpl->maPointer;}VCLXWindow*Window::GetWindowPeer()const{returnmpWindowImpl?mpWindowImpl->mpVCLXWindow:nullptr;}voidWindow::SetPosPixel(constPoint&rNewPos){setPosSizePixel(rNewPos.X(),rNewPos.Y(),0,0,PosSizeFlags::Pos);}voidWindow::SetSizePixel(constSize&rNewSize){setPosSizePixel(0,0,rNewSize.Width(),rNewSize.Height(),PosSizeFlags::Size);}voidWindow::SetPosSizePixel(constPoint&rNewPos,constSize&rNewSize){setPosSizePixel(rNewPos.X(),rNewPos.Y(),rNewSize.Width(),rNewSize.Height());}voidWindow::SetOutputSizePixel(constSize&rNewSize){SetSizePixel(Size(rNewSize.Width()+mpWindowImpl->mnLeftBorder+mpWindowImpl->mnRightBorder,rNewSize.Height()+mpWindowImpl->mnTopBorder+mpWindowImpl->mnBottomBorder));}//When a widget wants to renegotiate layout, get toplevel parent dialog and call//resize on it. Mark all intermediate containers (or container-alike) widgets//as dirty for the size remains unchanged, but layout changed circumstancesnamespace{boolqueue_ungrouped_resize(vcl::Windowconst*pOrigWindow){boolbSomeoneCares=false;vcl::Window*pWindow=pOrigWindow->GetParent();if(pWindow){if(isContainerWindow(*pWindow)){bSomeoneCares=true;}elseif(pWindow->GetType()==WindowType::TABCONTROL){bSomeoneCares=true;}pWindow->queue_resize();}returnbSomeoneCares;}}voidWindow::InvalidateSizeCache(){WindowImpl*pWindowImpl=mpWindowImpl->mpBorderWindow?mpWindowImpl->mpBorderWindow->mpWindowImpl.get():mpWindowImpl.get();pWindowImpl->mnOptimalWidthCache=-1;pWindowImpl->mnOptimalHeightCache=-1;}voidWindow::queue_resize(StateChangedTypeeReason){if(IsDisposed())return;boolbSomeoneCares=queue_ungrouped_resize(this);if(eReason!=StateChangedType::Visible){InvalidateSizeCache();}WindowImpl*pWindowImpl=mpWindowImpl->mpBorderWindow?mpWindowImpl->mpBorderWindow->mpWindowImpl.get():mpWindowImpl.get();if(pWindowImpl->m_xSizeGroup&&pWindowImpl->m_xSizeGroup->get_mode()!=VclSizeGroupMode::NONE){std::set<VclPtr<vcl::Window>>&rWindows=pWindowImpl->m_xSizeGroup->get_widgets();for(VclPtr<vcl::Window>const&pOther:rWindows){if(pOther==this)continue;queue_ungrouped_resize(pOther);}}if(bSomeoneCares&&!mpWindowImpl->mbInDispose){//fdo#57090 force a resync of the borders of the borderwindow onto this//window in case they have changedvcl::Window*pBorderWindow=ImplGetBorderWindow();if(pBorderWindow)pBorderWindow->Resize();}if(VclPtr<vcl::Window>pParent=GetParentWithLOKNotifier()){if(!pParent->IsInInitShow())LogicInvalidate(nullptr);}}namespace{VclAligntoAlign(constOUString&rValue){VclAligneRet=VclAlign::Fill;if(rValue=="fill")eRet=VclAlign::Fill;elseif(rValue=="start")eRet=VclAlign::Start;elseif(rValue=="end")eRet=VclAlign::End;elseif(rValue=="center")eRet=VclAlign::Center;returneRet;}}boolWindow::set_font_attribute(constOString&rKey,constOUString&rValue){if(rKey=="weight"){vcl::FontaFont(GetControlFont());if(rValue=="thin")aFont.SetWeight(WEIGHT_THIN);elseif(rValue=="ultralight")aFont.SetWeight(WEIGHT_ULTRALIGHT);elseif(rValue=="light")aFont.SetWeight(WEIGHT_LIGHT);elseif(rValue=="book")aFont.SetWeight(WEIGHT_SEMILIGHT);elseif(rValue=="normal")aFont.SetWeight(WEIGHT_NORMAL);elseif(rValue=="medium")aFont.SetWeight(WEIGHT_MEDIUM);elseif(rValue=="semibold")aFont.SetWeight(WEIGHT_SEMIBOLD);elseif(rValue=="bold")aFont.SetWeight(WEIGHT_BOLD);elseif(rValue=="ultrabold")aFont.SetWeight(WEIGHT_ULTRABOLD);elseaFont.SetWeight(WEIGHT_BLACK);SetControlFont(aFont);}elseif(rKey=="style"){vcl::FontaFont(GetControlFont());if(rValue=="normal")aFont.SetItalic(ITALIC_NONE);elseif(rValue=="oblique")aFont.SetItalic(ITALIC_OBLIQUE);elseif(rValue=="italic")aFont.SetItalic(ITALIC_NORMAL);SetControlFont(aFont);}elseif(rKey=="underline"){vcl::FontaFont(GetControlFont());aFont.SetUnderline(toBool(rValue)?LINESTYLE_SINGLE:LINESTYLE_NONE);SetControlFont(aFont);}elseif(rKey=="size"){vcl::FontaFont(GetControlFont());sal_Int32nHeight=rValue.toInt32()/1000;aFont.SetFontHeight(nHeight);SetControlFont(aFont);}else{SAL_INFO("vcl.layout","unhandled font attribute: "<<rKey);returnfalse;}returntrue;}boolWindow::set_property(constOString&rKey,constOUString&rValue){if((rKey=="label")||(rKey=="title")||(rKey=="text")){SetText(BuilderUtils::convertMnemonicMarkup(rValue));}elseif(rKey=="visible")Show(toBool(rValue));elseif(rKey=="sensitive")Enable(toBool(rValue));elseif(rKey=="resizable"){WinBitsnBits=GetStyle();nBits&=~WB_SIZEABLE;if(toBool(rValue))nBits|=WB_SIZEABLE;SetStyle(nBits);}elseif(rKey=="xalign"){WinBitsnBits=GetStyle();nBits&=~(WB_LEFT|WB_CENTER|WB_RIGHT);floatf=rValue.toFloat();if(f==0.0)nBits|=WB_LEFT;elseif(f==1.0)nBits|=WB_RIGHT;elseif(f==0.5)nBits|=WB_CENTER;SetStyle(nBits);}elseif(rKey=="justification"){WinBitsnBits=GetStyle();nBits&=~(WB_LEFT|WB_CENTER|WB_RIGHT);if(rValue=="left")nBits|=WB_LEFT;elseif(rValue=="right")nBits|=WB_RIGHT;elseif(rValue=="center")nBits|=WB_CENTER;SetStyle(nBits);}elseif(rKey=="yalign"){WinBitsnBits=GetStyle();nBits&=~(WB_TOP|WB_VCENTER|WB_BOTTOM);floatf=rValue.toFloat();if(f==0.0)nBits|=WB_TOP;elseif(f==1.0)nBits|=WB_BOTTOM;elseif(f==0.5)nBits|=WB_CENTER;SetStyle(nBits);}elseif(rKey=="wrap"){WinBitsnBits=GetStyle();nBits&=~WB_WORDBREAK;if(toBool(rValue))nBits|=WB_WORDBREAK;SetStyle(nBits);}elseif(rKey=="height-request")set_height_request(rValue.toInt32());elseif(rKey=="width-request")set_width_request(rValue.toInt32());elseif(rKey=="hexpand")set_hexpand(toBool(rValue));elseif(rKey=="vexpand")set_vexpand(toBool(rValue));elseif(rKey=="halign")set_halign(toAlign(rValue));elseif(rKey=="valign")set_valign(toAlign(rValue));elseif(rKey=="tooltip-markup")SetQuickHelpText(rValue);elseif(rKey=="tooltip-text")SetQuickHelpText(rValue);elseif(rKey=="border-width")set_border_width(rValue.toInt32());elseif(rKey=="margin-left")set_margin_left(rValue.toInt32());elseif(rKey=="margin-right")set_margin_right(rValue.toInt32());elseif(rKey=="margin-top")set_margin_top(rValue.toInt32());elseif(rKey=="margin-bottom")set_margin_bottom(rValue.toInt32());elseif(rKey=="hscrollbar-policy"){WinBitsnBits=GetStyle();nBits&=~(WB_AUTOHSCROLL|WB_HSCROLL);if(rValue=="always")nBits|=WB_HSCROLL;elseif(rValue=="automatic")nBits|=WB_AUTOHSCROLL;SetStyle(nBits);}elseif(rKey=="vscrollbar-policy"){WinBitsnBits=GetStyle();nBits&=~(WB_AUTOVSCROLL|WB_VSCROLL);if(rValue=="always")nBits|=WB_VSCROLL;elseif(rValue=="automatic")nBits|=WB_AUTOVSCROLL;SetStyle(nBits);}elseif(rKey=="accessible-name"){SetAccessibleName(rValue);}elseif(rKey=="accessible-description"){SetAccessibleDescription(rValue);}elseif(rKey=="accessible-role"){sal_Int16role=BuilderUtils::getRoleFromName(rValue.toUtf8());if(role!=com::sun::star::accessibility::AccessibleRole::UNKNOWN)SetAccessibleRole(role);}elseif(rKey=="use-markup"){//https://live.gnome.org/GnomeGoals/RemoveMarkupInMessagesSAL_WARN_IF(toBool(rValue),"vcl.layout","Use pango attributes instead of mark-up");}elseif(rKey=="has-focus"){if(toBool(rValue))GrabFocus();}elseif(rKey=="can-focus"){WinBitsnBits=GetStyle();nBits&=~(WB_TABSTOP|WB_NOTABSTOP);if(toBool(rValue))nBits|=WB_TABSTOP;elsenBits|=WB_NOTABSTOP;SetStyle(nBits);}else{SAL_INFO("vcl.layout","unhandled property: "<<rKey);returnfalse;}returntrue;}voidWindow::set_height_request(sal_Int32nHeightRequest){if(!mpWindowImpl)return;WindowImpl*pWindowImpl=mpWindowImpl->mpBorderWindow?mpWindowImpl->mpBorderWindow->mpWindowImpl.get():mpWindowImpl.get();if(pWindowImpl->mnHeightRequest!=nHeightRequest){pWindowImpl->mnHeightRequest=nHeightRequest;queue_resize();}}voidWindow::set_width_request(sal_Int32nWidthRequest){if(!mpWindowImpl)return;WindowImpl*pWindowImpl=mpWindowImpl->mpBorderWindow?mpWindowImpl->mpBorderWindow->mpWindowImpl.get():mpWindowImpl.get();if(pWindowImpl->mnWidthRequest!=nWidthRequest){pWindowImpl->mnWidthRequest=nWidthRequest;queue_resize();}}SizeWindow::get_ungrouped_preferred_size()const{SizeaRet(get_width_request(),get_height_request());if(aRet.Width()==-1||aRet.Height()==-1){//cache gets blown away by queue_resizeWindowImpl*pWindowImpl=mpWindowImpl->mpBorderWindow?mpWindowImpl->mpBorderWindow->mpWindowImpl.get():mpWindowImpl.get();if(pWindowImpl->mnOptimalWidthCache==-1||pWindowImpl->mnOptimalHeightCache==-1){SizeaOptimal(GetOptimalSize());pWindowImpl->mnOptimalWidthCache=aOptimal.Width();pWindowImpl->mnOptimalHeightCache=aOptimal.Height();}if(aRet.Width()==-1)aRet.setWidth(pWindowImpl->mnOptimalWidthCache);if(aRet.Height()==-1)aRet.setHeight(pWindowImpl->mnOptimalHeightCache);}returnaRet;}SizeWindow::get_preferred_size()const{SizeaRet(get_ungrouped_preferred_size());WindowImpl*pWindowImpl=mpWindowImpl->mpBorderWindow?mpWindowImpl->mpBorderWindow->mpWindowImpl.get():mpWindowImpl.get();if(pWindowImpl->m_xSizeGroup){constVclSizeGroupModeeMode=pWindowImpl->m_xSizeGroup->get_mode();if(eMode!=VclSizeGroupMode::NONE){constboolbIgnoreInHidden=pWindowImpl->m_xSizeGroup->get_ignore_hidden();conststd::set<VclPtr<vcl::Window>>&rWindows=pWindowImpl->m_xSizeGroup->get_widgets();for(autoconst&window:rWindows){constvcl::Window*pOther=window;if(pOther==this)continue;if(bIgnoreInHidden&&!pOther->IsVisible())continue;SizeaOtherSize=pOther->get_ungrouped_preferred_size();if(eMode==VclSizeGroupMode::Both||eMode==VclSizeGroupMode::Horizontal)aRet.setWidth(std::max(aRet.Width(),aOtherSize.Width()));if(eMode==VclSizeGroupMode::Both||eMode==VclSizeGroupMode::Vertical)aRet.setHeight(std::max(aRet.Height(),aOtherSize.Height()));}}}returnaRet;}VclAlignWindow::get_halign()const{WindowImpl*pWindowImpl=mpWindowImpl->mpBorderWindow?mpWindowImpl->mpBorderWindow->mpWindowImpl.get():mpWindowImpl.get();returnpWindowImpl->meHalign;}voidWindow::set_halign(VclAligneAlign){WindowImpl*pWindowImpl=mpWindowImpl->mpBorderWindow?mpWindowImpl->mpBorderWindow->mpWindowImpl.get():mpWindowImpl.get();pWindowImpl->meHalign=eAlign;}VclAlignWindow::get_valign()const{WindowImpl*pWindowImpl=mpWindowImpl->mpBorderWindow?mpWindowImpl->mpBorderWindow->mpWindowImpl.get():mpWindowImpl.get();returnpWindowImpl->meValign;}voidWindow::set_valign(VclAligneAlign){WindowImpl*pWindowImpl=mpWindowImpl->mpBorderWindow?mpWindowImpl->mpBorderWindow->mpWindowImpl.get():mpWindowImpl.get();pWindowImpl->meValign=eAlign;}boolWindow::get_hexpand()const{WindowImpl*pWindowImpl=mpWindowImpl->mpBorderWindow?mpWindowImpl->mpBorderWindow->mpWindowImpl.get():mpWindowImpl.get();returnpWindowImpl->mbHexpand;}voidWindow::set_hexpand(boolbExpand){WindowImpl*pWindowImpl=mpWindowImpl->mpBorderWindow?mpWindowImpl->mpBorderWindow->mpWindowImpl.get():mpWindowImpl.get();pWindowImpl->mbHexpand=bExpand;}boolWindow::get_vexpand()const{WindowImpl*pWindowImpl=mpWindowImpl->mpBorderWindow?mpWindowImpl->mpBorderWindow->mpWindowImpl.get():mpWindowImpl.get();returnpWindowImpl->mbVexpand;}voidWindow::set_vexpand(boolbExpand){WindowImpl*pWindowImpl=mpWindowImpl->mpBorderWindow?mpWindowImpl->mpBorderWindow->mpWindowImpl.get():mpWindowImpl.get();pWindowImpl->mbVexpand=bExpand;}boolWindow::get_expand()const{WindowImpl*pWindowImpl=mpWindowImpl->mpBorderWindow?mpWindowImpl->mpBorderWindow->mpWindowImpl.get():mpWindowImpl.get();returnpWindowImpl->mbExpand;}voidWindow::set_expand(boolbExpand){WindowImpl*pWindowImpl=mpWindowImpl->mpBorderWindow?mpWindowImpl->mpBorderWindow->mpWindowImpl.get():mpWindowImpl.get();pWindowImpl->mbExpand=bExpand;}VclPackTypeWindow::get_pack_type()const{WindowImpl*pWindowImpl=mpWindowImpl->mpBorderWindow?mpWindowImpl->mpBorderWindow->mpWindowImpl.get():mpWindowImpl.get();returnpWindowImpl->mePackType;}voidWindow::set_pack_type(VclPackTypeePackType){WindowImpl*pWindowImpl=mpWindowImpl->mpBorderWindow?mpWindowImpl->mpBorderWindow->mpWindowImpl.get():mpWindowImpl.get();pWindowImpl->mePackType=ePackType;}sal_Int32Window::get_padding()const{WindowImpl*pWindowImpl=mpWindowImpl->mpBorderWindow?mpWindowImpl->mpBorderWindow->mpWindowImpl.get():mpWindowImpl.get();returnpWindowImpl->mnPadding;}voidWindow::set_padding(sal_Int32nPadding){WindowImpl*pWindowImpl=mpWindowImpl->mpBorderWindow?mpWindowImpl->mpBorderWindow->mpWindowImpl.get():mpWindowImpl.get();pWindowImpl->mnPadding=nPadding;}boolWindow::get_fill()const{WindowImpl*pWindowImpl=mpWindowImpl->mpBorderWindow?mpWindowImpl->mpBorderWindow->mpWindowImpl.get():mpWindowImpl.get();returnpWindowImpl->mbFill;}voidWindow::set_fill(boolbFill){WindowImpl*pWindowImpl=mpWindowImpl->mpBorderWindow?mpWindowImpl->mpBorderWindow->mpWindowImpl.get():mpWindowImpl.get();pWindowImpl->mbFill=bFill;}sal_Int32Window::get_grid_width()const{WindowImpl*pWindowImpl=mpWindowImpl->mpBorderWindow?mpWindowImpl->mpBorderWindow->mpWindowImpl.get():mpWindowImpl.get();returnpWindowImpl->mnGridWidth;}voidWindow::set_grid_width(sal_Int32nCols){WindowImpl*pWindowImpl=mpWindowImpl->mpBorderWindow?mpWindowImpl->mpBorderWindow->mpWindowImpl.get():mpWindowImpl.get();pWindowImpl->mnGridWidth=nCols;}sal_Int32Window::get_grid_left_attach()const{WindowImpl*pWindowImpl=mpWindowImpl->mpBorderWindow?mpWindowImpl->mpBorderWindow->mpWindowImpl.get():mpWindowImpl.get();returnpWindowImpl->mnGridLeftAttach;}voidWindow::set_grid_left_attach(sal_Int32nAttach){WindowImpl*pWindowImpl=mpWindowImpl->mpBorderWindow?mpWindowImpl->mpBorderWindow->mpWindowImpl.get():mpWindowImpl.get();pWindowImpl->mnGridLeftAttach=nAttach;}sal_Int32Window::get_grid_height()const{WindowImpl*pWindowImpl=mpWindowImpl->mpBorderWindow?mpWindowImpl->mpBorderWindow->mpWindowImpl.get():mpWindowImpl.get();returnpWindowImpl->mnGridHeight;}voidWindow::set_grid_height(sal_Int32nRows){WindowImpl*pWindowImpl=mpWindowImpl->mpBorderWindow?mpWindowImpl->mpBorderWindow->mpWindowImpl.get():mpWindowImpl.get();pWindowImpl->mnGridHeight=nRows;}sal_Int32Window::get_grid_top_attach()const{WindowImpl*pWindowImpl=mpWindowImpl->mpBorderWindow?mpWindowImpl->mpBorderWindow->mpWindowImpl.get():mpWindowImpl.get();returnpWindowImpl->mnGridTopAttach;}voidWindow::set_grid_top_attach(sal_Int32nAttach){WindowImpl*pWindowImpl=mpWindowImpl->mpBorderWindow?mpWindowImpl->mpBorderWindow->mpWindowImpl.get():mpWindowImpl.get();pWindowImpl->mnGridTopAttach=nAttach;}voidWindow::set_border_width(sal_Int32nBorderWidth){WindowImpl*pWindowImpl=mpWindowImpl->mpBorderWindow?mpWindowImpl->mpBorderWindow->mpWindowImpl.get():mpWindowImpl.get();pWindowImpl->mnBorderWidth=nBorderWidth;}sal_Int32Window::get_border_width()const{WindowImpl*pWindowImpl=mpWindowImpl->mpBorderWindow?mpWindowImpl->mpBorderWindow->mpWindowImpl.get():mpWindowImpl.get();returnpWindowImpl->mnBorderWidth;}voidWindow::set_margin_left(sal_Int32nWidth){WindowImpl*pWindowImpl=mpWindowImpl->mpBorderWindow?mpWindowImpl->mpBorderWindow->mpWindowImpl.get():mpWindowImpl.get();if(pWindowImpl->mnMarginLeft!=nWidth){pWindowImpl->mnMarginLeft=nWidth;queue_resize();}}sal_Int32Window::get_margin_left()const{WindowImpl*pWindowImpl=mpWindowImpl->mpBorderWindow?mpWindowImpl->mpBorderWindow->mpWindowImpl.get():mpWindowImpl.get();returnpWindowImpl->mnMarginLeft;}voidWindow::set_margin_right(sal_Int32nWidth){WindowImpl*pWindowImpl=mpWindowImpl->mpBorderWindow?mpWindowImpl->mpBorderWindow->mpWindowImpl.get():mpWindowImpl.get();if(pWindowImpl->mnMarginRight!=nWidth){pWindowImpl->mnMarginRight=nWidth;queue_resize();}}sal_Int32Window::get_margin_right()const{WindowImpl*pWindowImpl=mpWindowImpl->mpBorderWindow?mpWindowImpl->mpBorderWindow->mpWindowImpl.get():mpWindowImpl.get();returnpWindowImpl->mnMarginRight;}voidWindow::set_margin_top(sal_Int32nWidth){WindowImpl*pWindowImpl=mpWindowImpl->mpBorderWindow?mpWindowImpl->mpBorderWindow->mpWindowImpl.get():mpWindowImpl.get();if(pWindowImpl->mnMarginTop!=nWidth){pWindowImpl->mnMarginTop=nWidth;queue_resize();}}sal_Int32Window::get_margin_top()const{WindowImpl*pWindowImpl=mpWindowImpl->mpBorderWindow?mpWindowImpl->mpBorderWindow->mpWindowImpl.get():mpWindowImpl.get();returnpWindowImpl->mnMarginTop;}voidWindow::set_margin_bottom(sal_Int32nWidth){WindowImpl*pWindowImpl=mpWindowImpl->mpBorderWindow?mpWindowImpl->mpBorderWindow->mpWindowImpl.get():mpWindowImpl.get();if(pWindowImpl->mnMarginBottom!=nWidth){pWindowImpl->mnMarginBottom=nWidth;queue_resize();}}sal_Int32Window::get_margin_bottom()const{WindowImpl*pWindowImpl=mpWindowImpl->mpBorderWindow?mpWindowImpl->mpBorderWindow->mpWindowImpl.get():mpWindowImpl.get();returnpWindowImpl->mnMarginBottom;}sal_Int32Window::get_height_request()const{WindowImpl*pWindowImpl=mpWindowImpl->mpBorderWindow?mpWindowImpl->mpBorderWindow->mpWindowImpl.get():mpWindowImpl.get();returnpWindowImpl->mnHeightRequest;}sal_Int32Window::get_width_request()const{WindowImpl*pWindowImpl=mpWindowImpl->mpBorderWindow?mpWindowImpl->mpBorderWindow->mpWindowImpl.get():mpWindowImpl.get();returnpWindowImpl->mnWidthRequest;}boolWindow::get_secondary()const{WindowImpl*pWindowImpl=mpWindowImpl->mpBorderWindow?mpWindowImpl->mpBorderWindow->mpWindowImpl.get():mpWindowImpl.get();returnpWindowImpl->mbSecondary;}voidWindow::set_secondary(boolbSecondary){WindowImpl*pWindowImpl=mpWindowImpl->mpBorderWindow?mpWindowImpl->mpBorderWindow->mpWindowImpl.get():mpWindowImpl.get();pWindowImpl->mbSecondary=bSecondary;}boolWindow::get_non_homogeneous()const{WindowImpl*pWindowImpl=mpWindowImpl->mpBorderWindow?mpWindowImpl->mpBorderWindow->mpWindowImpl.get():mpWindowImpl.get();returnpWindowImpl->mbNonHomogeneous;}voidWindow::set_non_homogeneous(boolbNonHomogeneous){WindowImpl*pWindowImpl=mpWindowImpl->mpBorderWindow?mpWindowImpl->mpBorderWindow->mpWindowImpl.get():mpWindowImpl.get();pWindowImpl->mbNonHomogeneous=bNonHomogeneous;}voidWindow::add_to_size_group(conststd::shared_ptr<VclSizeGroup>&xGroup){WindowImpl*pWindowImpl=mpWindowImpl->mpBorderWindow?mpWindowImpl->mpBorderWindow->mpWindowImpl.get():mpWindowImpl.get();//To-Do, multiple groupspWindowImpl->m_xSizeGroup=xGroup;pWindowImpl->m_xSizeGroup->insert(this);if(VclSizeGroupMode::NONE!=pWindowImpl->m_xSizeGroup->get_mode())queue_resize();}voidWindow::remove_from_all_size_groups(){WindowImpl*pWindowImpl=mpWindowImpl->mpBorderWindow?mpWindowImpl->mpBorderWindow->mpWindowImpl.get():mpWindowImpl.get();//To-Do, multiple groupsif(pWindowImpl->m_xSizeGroup){if(VclSizeGroupMode::NONE!=pWindowImpl->m_xSizeGroup->get_mode())queue_resize();pWindowImpl->m_xSizeGroup->erase(this);pWindowImpl->m_xSizeGroup.reset();}}voidWindow::add_mnemonic_label(FixedText*pLabel){std::vector<VclPtr<FixedText>>&v=mpWindowImpl->m_aMnemonicLabels;if(std::find(v.begin(),v.end(),VclPtr<FixedText>(pLabel))!=v.end())return;v.emplace_back(pLabel);pLabel->set_mnemonic_widget(this);}voidWindow::remove_mnemonic_label(FixedText*pLabel){std::vector<VclPtr<FixedText>>&v=mpWindowImpl->m_aMnemonicLabels;autoaFind=std::find(v.begin(),v.end(),VclPtr<FixedText>(pLabel));if(aFind==v.end())return;v.erase(aFind);pLabel->set_mnemonic_widget(nullptr);}conststd::vector<VclPtr<FixedText>>&Window::list_mnemonic_labels()const{returnmpWindowImpl->m_aMnemonicLabels;}}/* namespace vcl */voidDrawFocusRect(vcl::RenderContext&rRenderContext,consttools::Rectangle&rRect){constintnBorder=1;rRenderContext.Invert(tools::Rectangle(Point(rRect.Left(),rRect.Top()),Size(rRect.GetWidth(),nBorder)),InvertFlags::N50);rRenderContext.Invert(tools::Rectangle(Point(rRect.Left(),rRect.Bottom()-nBorder+1),Size(rRect.GetWidth(),nBorder)),InvertFlags::N50);rRenderContext.Invert(tools::Rectangle(Point(rRect.Left(),rRect.Top()+nBorder),Size(nBorder,rRect.GetHeight()-(nBorder*2))),InvertFlags::N50);rRenderContext.Invert(tools::Rectangle(Point(rRect.Right()-nBorder+1,rRect.Top()+nBorder),Size(nBorder,rRect.GetHeight()-(nBorder*2))),InvertFlags::N50);}/* vim:set shiftwidth=4 softtabstop=4 expandtab: */