66 SAL_WARN_IF(!pParent,
"vcl",
"FloatWindow::FloatingWindow(): - pParent == NULL!");
71 SAL_WARN_IF(!pParent,
"vcl",
"FloatWindow::FloatingWindow(): - pParent == NULL and no AppWindow exists");
88 WinBits nFloatWinStyle = nStyle;
100 if (nStyle & WB_OWNERDRAWDECORATION)
112 pBorderWin->mpWindowImpl->mpClientWindow =
this;
159 , mpNextFloat(nullptr)
160 , mpFirstPopupModeWin(nullptr)
165 , mbInPopupMode(
false)
167 , mbPopupModeCanceled(
false)
168 , mbPopupModeTearOff(
false)
173 loadUI(pParent, rID, rUIXMLDescription, rFrame);
233 sal_uInt16& rArrangeIndex, Point* pLOKTwipsPos)
263 sal_uInt16 nArrangeAttempts = 5;
289 nArrangeAttempts = 3;
305 nArrangeAttempts = 3;
315 sal_uInt16 nArrangeIndex = 0;
318 for ( ; nArrangeIndex < nArrangeAttempts; nArrangeIndex++ )
321 switch ( nArrangeAry[nArrangeIndex] )
324 case FloatWinPopupFlags::Left:
325 aPos.setX( devRect.Left()-aSize.
Width()+1 );
326 aPos.setY( devRect.Top() );
335 if ( aPos.X() < aScreenRect.
Left() )
338 if (bBreak || bLOKActive)
340 e1 = devRect.TopLeft();
341 e2 = devRect.BottomLeft();
349 case FloatWinPopupFlags::Right:
350 aPos = devRect.TopRight();
354 if( (devRectRTL.
Left() - aSize.
Width()) < aScreenRect.
Left() )
359 if ( aPos.X()+aSize.
Width() > aScreenRect.
Right() )
362 if (bBreak || bLOKActive)
364 e1 = devRect.TopRight();
365 e2 = devRect.BottomRight();
373 case FloatWinPopupFlags::Up:
374 aPos.setX( devRect.Left() );
375 aPos.setY( devRect.Top()-aSize.
Height()+1 );
376 if ( aPos.Y() < aScreenRect.
Top() )
378 if (bBreak || bLOKActive)
380 e1 = devRect.TopLeft();
381 e2 = devRect.TopRight();
390 aPos = devRect.BottomLeft();
393 if (bBreak || bLOKActive)
395 e1 = devRect.BottomLeft();
396 e2 = devRect.BottomRight();
414 if ( (nArrangeAry[nArrangeIndex] == FloatWinPopupFlags::Left) ||
415 (nArrangeAry[nArrangeIndex] == FloatWinPopupFlags::Right) )
419 aPos.setY( devRect.Bottom()-aSize.
Height()+1 );
420 if ( aPos.Y() < aScreenRect.
Top() )
421 aPos.setY( aScreenRect.
Top() );
429 aPos.AdjustX( -(aScreenRect.
Left() - devRectRTL.
Right() + aSize.
Width() - 1) );
431 else if ( aPos.X()+aSize.
Width() > aScreenRect.
Right() )
433 aPos.setX( devRect.Right()-aSize.
Width()+1 );
434 if ( aPos.X() < aScreenRect.
Left() )
435 aPos.setX( aScreenRect.
Left() );
443 if (nArrangeIndex >= nArrangeAttempts)
444 nArrangeIndex = nArrangeAttempts - 1;
446 rArrangeIndex = nArrangeIndex;
451 if( pFloatingWindow && pFloatingWindow->
mpImplData->mpBox )
453 pFloatingWindow->
mpImplData->maItemEdgeClipRect =
457 if (bLOKActive && pLOKTwipsPos)
483 Point aAbsolute( rPos );
491 pWindowOutDev->
ReMirror( aAbsolute );
515 pParentWinOutDev->
ReMirror(aFloatRect);
540 pParentWinOutDev->
ReMirror(aFloatRect);
551 rbHitTestInsideRect =
false;
566 if ( devRect.Contains( aAbsolute ) )
578 rbHitTestInsideRect =
true;
597 pLastFoundWin = pWin;
603 return pLastFoundWin;
641 sal_uInt16 nKeyCode = aKeyCode.
GetCode();
659 std::vector<vcl::LOKPayloadItem> aPayload
661 std::make_pair(OString(
"rectangle"), aRect.
toString())
663 const vcl::ILibreOfficeKitNotifier* pNotifier = pParent->GetLOKNotifier();
664 pNotifier->notifyWindow(
GetLOKWindowId(),
"invalidate", aPayload);
682 std::vector<vcl::LOKPayloadItem> aItems;
689 aItems.emplace_back(
"type",
"dropdown");
691 aItems.emplace_back(
"type",
"dialog");
692 aItems.emplace_back(
"position",
mpImplData->maLOKTwipsPos.toString());
697 if (dynamic_cast<HelpTextWindow*>(
this))
698 aItems.emplace_back(
"type",
"tooltip");
700 aItems.emplace_back(
"type",
"child");
702 aItems.emplace_back(
"parentId", OString::number(pParent->
GetLOKWindowId()));
704 aItems.emplace_back(
"position",
mpImplData->maPos.toString());
714 if (
const vcl::ILibreOfficeKitNotifier* pNotifier =
GetLOKNotifier())
792 sal_uInt16 nArrangeIndex;
879 std::vector<VclPtr<FloatingWindow>> aCancelFloats;
882 pFloat !=
nullptr && pFloat !=
this;
884 aCancelFloats.push_back(pFloat);
885 for (
auto & it : aCancelFloats)
904 Window::EndSaveFocus(xFocusId);
921 mpImplData->mpBox->ImplFloatControl(
false,
this );
941 pLastLevelFloat->
EndPopupMode( FloatWinPopupEndFlags::Cancel | FloatWinPopupEndFlags::CloseAll );
966 pWin->ImplCallMove();
virtual Point GetPosPixel() const
#define LINK(Instance, Class, Member)
FloatWinTitleType mnOldTitle
bool IsControlBackground() const
bool IsInPopupMode() const
vcl::LOKWindowId GetLOKWindowId() const
void StartPopupMode(const tools::Rectangle &rRect, FloatWinPopupFlags nFlags)
WinBits const WB_SYSTEMWINDOW
VclPtr< vcl::Window > mpFocusWin
void loadUI(vcl::Window *pParent, const OString &rID, const OUString &rUIXMLDescription, const css::uno::Reference< css::frame::XFrame > &rFrame=css::uno::Reference< css::frame::XFrame >())
virtual bool EventNotify(NotifyEvent &rNEvt) override
SAL_WARN_UNUSED_RESULT Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
virtual void StateChanged(StateChangedType nType) override
WinBits const WB_NODIALOGCONTROL
void PixelInvalidate(const tools::Rectangle *pRectangle) override
Notification about some rectangle of the output device got invalidated.
FloatingWindow(const FloatingWindow &)=delete
Point AbsoluteScreenToOutputPixel(const Point &rPos) const
SAL_DLLPRIVATE void ImplInitFloating(vcl::Window *pParent, WinBits nStyle)
void SetDisplayActive(bool bActive)
const StyleSettings & GetStyleSettings() const
const Color & GetFaceColor() const
Link< FloatingWindow *, void > maPopupModeEndHdl
virtual Size GetSizePixel() const
SAL_DLLPRIVATE vcl::Window * ImplGetFrameWindow() const
virtual ~FloatingWindow() override
void SetLOKNotifier(const vcl::ILibreOfficeKitNotifier *pNotifier, bool bParent=false)
Interface to register for dialog / window tunneling.
static ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
Post a user event to the default window.
sal_uInt16 GetCode() const
static bool IsUnifiedDisplay()
Determines if the screens that make up a display are separate or form one large display area...
SAL_DLLPRIVATE tools::Rectangle ImplOutputToUnmirroredAbsoluteScreenPixel(const tools::Rectangle &rRect) const
DataChangedEventType GetType() const
const KeyEvent * GetKeyEvent() const
tools::Rectangle GetDesktopRectPixel() const
SAL_DLLPRIVATE void ImplInitSettings()
const Color & GetControlBackground() const
bool IsRTLEnabled() const
static Point ImplCalcPos(vcl::Window *pWindow, const tools::Rectangle &rRect, FloatWinPopupFlags nFlags, sal_uInt16 &rArrangeIndex, Point *pLOKTwipsPos=nullptr)
bool HasChildPathFocus(bool bSystemWindow=false) const
DialogControlFlags GetDialogControlFlags() const
tools::Rectangle maFloatRect
constexpr tools::Long Width() const
WinBits const WB_OWNERDRAWDECORATION
static tools::Rectangle ImplConvertToRelPos(vcl::Window *pReference, const tools::Rectangle &rRect)
SAL_DLLPRIVATE void ReMirror(Point &rPoint) const
VclPtr< vcl::Window > GetParentWithLOKNotifier()
Find the nearest parent with LOK Notifier; can be itself if this Window has LOK notifier set...
AllSettingsFlags GetFlags() const
FloatWinPopupFlags GetPopupModeFlags() const
SAL_DLLPRIVATE tools::Rectangle & ImplGetItemEdgeClipRect()
tools::Rectangle maItemEdgeClipRect
IMPL_LINK_NOARG(FloatingWindow, ImplEndPopupModeHdl, void *, void)
std::unique_ptr< ImplData > mpImplData
static void RemoveUserEvent(ImplSVEvent *nUserEvent)
Remove user event based on event ID.
WinBits const WB_DIALOGCONTROL
ImplSVData * ImplGetSVData()
static tools::Rectangle GetScreenPosSizePixel(unsigned int nScreen)
Get a screen's rectangular area.
VclPtr< vcl::Window > mxPrevFocusWin
void SetActivateMode(ActivateModeFlags nMode)
Point maLOKTwipsPos
absolute position of the floating window in the document - in twips (for toplevel floating windows)...
const MapMode & GetMapMode() const
virtual void doDeferredInit(WinBits nBits) override
VclPtr< WorkWindow > mpAppWin
virtual void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
static Point ImplConvertToAbsPos(vcl::Window *pReference, const Point &rPos)
virtual bool HasMirroredGraphics() const
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
const AllSettings & GetSettings() const
void AddPopupModeWindow(vcl::Window *pWindow)
static bool GetLayoutRTL()
std::unique_ptr< WindowImpl > mpWindowImpl
SAL_DLLPRIVATE vcl::Window * ImplGetParent() const
Size get_preferred_size() const
MouseNotifyEvent GetType() const
VclPtr< FloatingWindow > mpNextFloat
SAL_DLLPRIVATE FloatingWindow * ImplFindLastLevelFloat()
const AllSettings & GetSettings() const
FloatWinPopupFlags mnPopupModeFlags
MapUnit GetMapUnit() const
static unsigned int GetScreenCount()
Get the number of screens available for the display.
static SAL_DLLPRIVATE unsigned int GetBestScreen(const tools::Rectangle &)
Get the "best" screen.
Point PixelToLogic(const Point &rDevicePt) const
SAL_DLLPRIVATE bool ImplIsFloatPopupModeWindow(const vcl::Window *pWindow)
virtual void PopupModeEnd()
Point ScreenToOutputPixel(const Point &rPos) const
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
vcl::Window * GetParent() const
Point OutputToAbsoluteScreenPixel(const Point &rPos) const
vcl::Window * GetWindow(GetWindowType nType) const
SAL_DLLPRIVATE void ImplEndPopupMode(FloatWinPopupEndFlags nFlags, const VclPtr< vcl::Window > &xFocusId)
SAL_DLLPRIVATE void ImplInit(vcl::Window *pParent, WinBits nStyle, SystemParentData *pSystemParentData)
SAL_DLLPRIVATE void ImplCallPopupModeEnd()
WinBits const WB_SIZEABLE
WinBits const WB_STANDALONE
void GetBorder(sal_Int32 &rLeftBorder, sal_Int32 &rTopBorder, sal_Int32 &rRightBorder, sal_Int32 &rBottomBorder) const
bool IsMapModeEnabled() const
SalFrame * ImplGetFrame() const
const vcl::KeyCode & GetKeyCode() const
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects...
virtual bool EventNotify(NotifyEvent &rNEvt) override
#define SAL_WARN_IF(condition, area, stream)
constexpr tools::Long Height() const
constexpr sal_uInt16 KEY_ESCAPE
void GetBorder(sal_Int32 &rLeftBorder, sal_Int32 &rTopBorder, sal_Int32 &rRightBorder, sal_Int32 &rBottomBorder) const
ImplSVFrameData maFrameData
virtual OUString GetText() const override
::OutputDevice const * GetOutDev() const
SAL_DLLPRIVATE tools::Rectangle ImplUnmirroredAbsoluteScreenToOutputPixel(const tools::Rectangle &rRect) const
static VclPtr< reference_type > Create(Arg &&...arg)
A construction helper for VclPtr.
virtual void PositionByToolkit(const tools::Rectangle &, FloatWinPopupFlags)
FloatWinTitleType mnTitle
bool UpdatePositionData()
const Color & GetWindowColor() const
SAL_DLLPRIVATE bool ImplIsWindowOrChild(const vcl::Window *pWindow, bool bSystemWindow=false) const
VclPtr< FloatingWindow > mpFirstFloat
void ApplyControlBackground(vcl::RenderContext &rRenderContext, const Color &rDefaultColor)
virtual void ApplySettings(vcl::RenderContext &rRenderContext) override
Size GetOutputSizePixel() const
VclPtr< vcl::Window > mpFirstPopupModeWin
VclPtr< vcl::Window > mpDialogParent
SAL_DLLPRIVATE FloatingWindow * ImplFloatHitTest(vcl::Window *pReference, const Point &rPos, bool &rbHitTestInsideRect)
virtual void StateChanged(StateChangedType nStateChange)
const vcl::ILibreOfficeKitNotifier * GetLOKNotifier() const
void SetDialogControlFlags(DialogControlFlags nFlags)
Point OutputToScreenPixel(const Point &rPos) const
void ReleaseLOKNotifier()
Indicate that LOK is not going to use this dialog any more.
WinBits const WB_CLOSEABLE
WinBits const WB_MOVEABLE
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects...
void SetTitleType(FloatWinTitleType nTitle)
void EndPopupMode(FloatWinPopupEndFlags nFlags=FloatWinPopupEndFlags::NONE)
virtual void SetPosPixel(const Point &rNewPos)
bool isLayoutEnabled() const
SAL_DLLPRIVATE void DoInitialLayout()
static DockingManager * GetDockingManager()
virtual void DataChanged(const DataChangedEvent &rDCEvt)
OUString toString(OptionInfo const *info)
ImplSVWinData * mpWinData
bool m_bDetectedRangeSegmentation false
void Show(bool bVisible=true, ShowFlags nFlags=ShowFlags::NONE)