1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <vcl/window.hxx>
22 #include <vcl/cursor.hxx>
23 #include <salframe.hxx>
27 Size
Window::GetOptimalSize() const { return Size(); }
29 void Window::ImplAdjustNWFSizes()
31 for (Window
* pWin
= GetWindow(GetWindowType::FirstChild
); pWin
;
32 pWin
= pWin
->GetWindow(GetWindowType::Next
))
33 pWin
->ImplAdjustNWFSizes();
36 void WindowOutputDevice::ImplClearFontData(bool bNewFontLists
)
38 OutputDevice::ImplClearFontData(bNewFontLists
);
39 for (Window
* pChild
= mxOwnerWindow
->mpWindowImpl
->mpFirstChild
; pChild
;
40 pChild
= pChild
->mpWindowImpl
->mpNext
)
41 pChild
->GetOutDev()->ImplClearFontData(bNewFontLists
);
44 void WindowOutputDevice::ImplRefreshFontData(bool bNewFontLists
)
46 OutputDevice::ImplRefreshFontData(bNewFontLists
);
47 for (Window
* pChild
= mxOwnerWindow
->mpWindowImpl
->mpFirstChild
; pChild
;
48 pChild
= pChild
->mpWindowImpl
->mpNext
)
49 pChild
->GetOutDev()->ImplRefreshFontData(bNewFontLists
);
52 void WindowOutputDevice::ImplInitMapModeObjects()
54 OutputDevice::ImplInitMapModeObjects();
55 if (mxOwnerWindow
->mpWindowImpl
->mpCursor
)
56 mxOwnerWindow
->mpWindowImpl
->mpCursor
->ImplNew();
59 const Font
& Window::GetFont() const { return GetOutDev()->GetFont(); }
60 void Window::SetFont(Font
const& font
) { return GetOutDev()->SetFont(font
); }
62 float Window::approximate_char_width() const { return GetOutDev()->approximate_char_width(); }
64 const Wallpaper
& Window::GetBackground() const { return GetOutDev()->GetBackground(); }
65 bool Window::IsBackground() const { return GetOutDev()->IsBackground(); }
66 tools::Long
Window::GetTextHeight() const { return GetOutDev()->GetTextHeight(); }
67 tools::Long
Window::GetTextWidth(const OUString
& rStr
, sal_Int32 nIndex
, sal_Int32 nLen
,
68 vcl::text::TextLayoutCache
const* pCache
,
69 SalLayoutGlyphs
const* const pLayoutCache
) const
71 return GetOutDev()->GetTextWidth(rStr
, nIndex
, nLen
, pCache
, pLayoutCache
);
73 float Window::approximate_digit_width() const { return GetOutDev()->approximate_digit_width(); }
75 bool Window::IsNativeControlSupported(ControlType nType
, ControlPart nPart
) const
77 return GetOutDev()->IsNativeControlSupported(nType
, nPart
);
80 bool Window::GetNativeControlRegion(ControlType nType
, ControlPart nPart
,
81 const tools::Rectangle
& rControlRegion
, ControlState nState
,
82 const ImplControlValue
& aValue
,
83 tools::Rectangle
& rNativeBoundingRegion
,
84 tools::Rectangle
& rNativeContentRegion
) const
86 return GetOutDev()->GetNativeControlRegion(nType
, nPart
, rControlRegion
, nState
, aValue
,
87 rNativeBoundingRegion
, rNativeContentRegion
);
90 Size
Window::GetOutputSizePixel() const { return GetOutDev()->GetOutputSizePixel(); }
92 tools::Rectangle
Window::GetOutputRectPixel() const { return GetOutDev()->GetOutputRectPixel(); }
94 void Window::SetTextLineColor() { GetOutDev()->SetTextLineColor(); }
95 void Window::SetTextLineColor(const Color
& rColor
) { GetOutDev()->SetTextLineColor(rColor
); }
96 void Window::SetOverlineColor() { GetOutDev()->SetOverlineColor(); }
97 void Window::SetOverlineColor(const Color
& rColor
) { GetOutDev()->SetOverlineColor(rColor
); }
98 void Window::SetTextFillColor() { GetOutDev()->SetTextFillColor(); }
99 void Window::SetTextFillColor(const Color
& rColor
) { GetOutDev()->SetTextFillColor(rColor
); }
100 const MapMode
& Window::GetMapMode() const { return GetOutDev()->GetMapMode(); }
101 void Window::SetBackground() { GetOutDev()->SetBackground(); }
102 void Window::SetBackground(const Wallpaper
& rBackground
)
104 GetOutDev()->SetBackground(rBackground
);
106 void Window::EnableMapMode(bool bEnable
) { GetOutDev()->EnableMapMode(bEnable
); }
107 bool Window::IsMapModeEnabled() const { return GetOutDev()->IsMapModeEnabled(); }
109 void Window::SetTextColor(const Color
& rColor
) { GetOutDev()->SetTextColor(rColor
); }
110 const Color
& Window::GetTextColor() const { return GetOutDev()->GetTextColor(); }
111 const Color
& Window::GetTextLineColor() const { return GetOutDev()->GetTextLineColor(); }
113 bool Window::IsTextLineColor() const { return GetOutDev()->IsTextLineColor(); }
115 Color
Window::GetTextFillColor() const { return GetOutDev()->GetTextFillColor(); }
117 bool Window::IsTextFillColor() const { return GetOutDev()->IsTextFillColor(); }
119 const Color
& Window::GetOverlineColor() const { return GetOutDev()->GetOverlineColor(); }
120 bool Window::IsOverlineColor() const { return GetOutDev()->IsOverlineColor(); }
121 void Window::SetTextAlign(TextAlign eAlign
) { GetOutDev()->SetTextAlign(eAlign
); }
123 float Window::GetDPIScaleFactor() const { return GetOutDev()->GetDPIScaleFactor(); }
124 tools::Long
Window::GetOutOffXPixel() const { return GetOutDev()->GetOutOffXPixel(); }
125 tools::Long
Window::GetOutOffYPixel() const { return GetOutDev()->GetOutOffYPixel(); }
126 void Window::SetMapMode() { GetOutDev()->SetMapMode(); }
127 void Window::SetMapMode(const MapMode
& rNewMapMode
) { GetOutDev()->SetMapMode(rNewMapMode
); }
128 bool Window::IsRTLEnabled() const { return GetOutDev()->IsRTLEnabled(); }
129 TextAlign
Window::GetTextAlign() const { return GetOutDev()->GetTextAlign(); }
130 const AllSettings
& Window::GetSettings() const { return GetOutDev()->GetSettings(); }
132 Point
Window::LogicToPixel(const Point
& rLogicPt
) const
134 return GetOutDev()->LogicToPixel(rLogicPt
);
136 Size
Window::LogicToPixel(const Size
& rLogicSize
) const
138 return GetOutDev()->LogicToPixel(rLogicSize
);
140 tools::Rectangle
Window::LogicToPixel(const tools::Rectangle
& rLogicRect
) const
142 return GetOutDev()->LogicToPixel(rLogicRect
);
144 vcl::Region
Window::LogicToPixel(const vcl::Region
& rLogicRegion
) const
146 return GetOutDev()->LogicToPixel(rLogicRegion
);
148 Point
Window::LogicToPixel(const Point
& rLogicPt
, const MapMode
& rMapMode
) const
150 return GetOutDev()->LogicToPixel(rLogicPt
, rMapMode
);
152 Size
Window::LogicToPixel(const Size
& rLogicSize
, const MapMode
& rMapMode
) const
154 return GetOutDev()->LogicToPixel(rLogicSize
, rMapMode
);
156 tools::Rectangle
Window::LogicToPixel(const tools::Rectangle
& rLogicRect
,
157 const MapMode
& rMapMode
) const
159 return GetOutDev()->LogicToPixel(rLogicRect
, rMapMode
);
162 Point
Window::PixelToLogic(const Point
& rDevicePt
) const
164 return GetOutDev()->PixelToLogic(rDevicePt
);
166 Size
Window::PixelToLogic(const Size
& rDeviceSize
) const
168 return GetOutDev()->PixelToLogic(rDeviceSize
);
170 tools::Rectangle
Window::PixelToLogic(const tools::Rectangle
& rDeviceRect
) const
172 return GetOutDev()->PixelToLogic(rDeviceRect
);
174 tools::PolyPolygon
Window::PixelToLogic(const tools::PolyPolygon
& rDevicePolyPoly
) const
176 return GetOutDev()->PixelToLogic(rDevicePolyPoly
);
178 vcl::Region
Window::PixelToLogic(const vcl::Region
& rDeviceRegion
) const
180 return GetOutDev()->PixelToLogic(rDeviceRegion
);
182 Point
Window::PixelToLogic(const Point
& rDevicePt
, const MapMode
& rMapMode
) const
184 return GetOutDev()->PixelToLogic(rDevicePt
, rMapMode
);
186 Size
Window::PixelToLogic(const Size
& rDeviceSize
, const MapMode
& rMapMode
) const
188 return GetOutDev()->PixelToLogic(rDeviceSize
, rMapMode
);
190 tools::Rectangle
Window::PixelToLogic(const tools::Rectangle
& rDeviceRect
,
191 const MapMode
& rMapMode
) const
193 return GetOutDev()->PixelToLogic(rDeviceRect
, rMapMode
);
196 Size
Window::LogicToLogic(const Size
& rSzSource
, const MapMode
* pMapModeSource
,
197 const MapMode
* pMapModeDest
) const
199 return GetOutDev()->LogicToLogic(rSzSource
, pMapModeSource
, pMapModeDest
);
202 tools::Rectangle
Window::GetTextRect(const tools::Rectangle
& rRect
, const OUString
& rStr
,
203 DrawTextFlags nStyle
, TextRectInfo
* pInfo
,
204 const vcl::TextLayoutCommon
* _pTextLayout
) const
206 return GetOutDev()->GetTextRect(rRect
, rStr
, nStyle
, pInfo
, _pTextLayout
);
209 void Window::SetSettings(const AllSettings
& rSettings
) { GetOutDev()->SetSettings(rSettings
); }
210 void Window::SetSettings(const AllSettings
& rSettings
, bool bChild
)
212 static_cast<vcl::WindowOutputDevice
*>(GetOutDev())->SetSettings(rSettings
, bChild
);
215 Color
Window::GetBackgroundColor() const { return GetOutDev()->GetBackgroundColor(); }
217 void Window::EnableRTL(bool bEnable
) { GetOutDev()->EnableRTL(bEnable
); }
219 void Window::FlashWindow() const
221 vcl::Window
* pMyParent
= ImplGetTopmostFrameWindow();
223 if (pMyParent
&& pMyParent
->mpWindowImpl
)
224 pMyParent
->mpWindowImpl
->mpFrame
->FlashWindow();
227 void Window::SetTaskBarProgress(int nCurrentProgress
)
229 vcl::Window
* pMyParent
= ImplGetTopmostFrameWindow();
231 if (pMyParent
&& pMyParent
->mpWindowImpl
)
232 pMyParent
->mpWindowImpl
->mpFrame
->SetTaskBarProgress(nCurrentProgress
);
235 void Window::SetTaskBarState(VclTaskBarStates eTaskBarState
)
237 vcl::Window
* pMyParent
= ImplGetTopmostFrameWindow();
239 if (pMyParent
&& pMyParent
->mpWindowImpl
)
240 pMyParent
->mpWindowImpl
->mpFrame
->SetTaskBarState(eTaskBarState
);
243 } /* namespace vcl */
245 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */