LibreOffice Module vcl (master)  1
window3.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #include <vcl/window.hxx>
21 #include <window.h>
22 #include <vcl/cursor.hxx>
23 
24 namespace vcl
25 {
26 Size Window::GetOptimalSize() const { return Size(); }
27 
29 {
30  for (Window* pWin = GetWindow(GetWindowType::FirstChild); pWin;
31  pWin = pWin->GetWindow(GetWindowType::Next))
32  pWin->ImplAdjustNWFSizes();
33 }
34 
35 void WindowOutputDevice::ImplClearFontData(bool bNewFontLists)
36 {
37  OutputDevice::ImplClearFontData(bNewFontLists);
38  for (Window* pChild = mxOwnerWindow->mpWindowImpl->mpFirstChild; pChild;
39  pChild = pChild->mpWindowImpl->mpNext)
40  pChild->GetOutDev()->ImplClearFontData(bNewFontLists);
41 }
42 
44 {
45  OutputDevice::ImplRefreshFontData(bNewFontLists);
46  for (Window* pChild = mxOwnerWindow->mpWindowImpl->mpFirstChild; pChild;
47  pChild = pChild->mpWindowImpl->mpNext)
48  pChild->GetOutDev()->ImplRefreshFontData(bNewFontLists);
49 }
50 
52 {
54  if (mxOwnerWindow->mpWindowImpl->mpCursor)
55  mxOwnerWindow->mpWindowImpl->mpCursor->ImplNew();
56 }
57 
58 const Font& Window::GetFont() const { return GetOutDev()->GetFont(); }
59 void Window::SetFont(Font const& font) { return GetOutDev()->SetFont(font); }
60 
62 
63 const Wallpaper& Window::GetBackground() const { return GetOutDev()->GetBackground(); }
64 bool Window::IsBackground() const { return GetOutDev()->IsBackground(); }
66 tools::Long Window::GetTextWidth(const OUString& rStr, sal_Int32 nIndex, sal_Int32 nLen,
67  vcl::text::TextLayoutCache const* pCache,
68  SalLayoutGlyphs const* const pLayoutCache) const
69 {
70  return GetOutDev()->GetTextWidth(rStr, nIndex, nLen, pCache, pLayoutCache);
71 }
73 
75 {
76  return GetOutDev()->IsNativeControlSupported(nType, nPart);
77 }
78 
80  const tools::Rectangle& rControlRegion, ControlState nState,
81  const ImplControlValue& aValue,
82  tools::Rectangle& rNativeBoundingRegion,
83  tools::Rectangle& rNativeContentRegion) const
84 {
85  return GetOutDev()->GetNativeControlRegion(nType, nPart, rControlRegion, nState, aValue,
86  rNativeBoundingRegion, rNativeContentRegion);
87 }
88 
90 
92 
94 void Window::SetTextLineColor(const Color& rColor) { GetOutDev()->SetTextLineColor(rColor); }
96 void Window::SetOverlineColor(const Color& rColor) { GetOutDev()->SetOverlineColor(rColor); }
98 void Window::SetTextFillColor(const Color& rColor) { GetOutDev()->SetTextFillColor(rColor); }
99 const MapMode& Window::GetMapMode() const { return GetOutDev()->GetMapMode(); }
101 void Window::SetBackground(const Wallpaper& rBackground)
102 {
103  GetOutDev()->SetBackground(rBackground);
104 }
105 void Window::EnableMapMode(bool bEnable) { GetOutDev()->EnableMapMode(bEnable); }
107 
108 void Window::SetTextColor(const Color& rColor) { GetOutDev()->SetTextColor(rColor); }
109 const Color& Window::GetTextColor() const { return GetOutDev()->GetTextColor(); }
111 
112 bool Window::IsTextLineColor() const { return GetOutDev()->IsTextLineColor(); }
113 
115 
116 bool Window::IsTextFillColor() const { return GetOutDev()->IsTextFillColor(); }
117 
119 bool Window::IsOverlineColor() const { return GetOutDev()->IsOverlineColor(); }
121 
126 void Window::SetMapMode(const MapMode& rNewMapMode) { GetOutDev()->SetMapMode(rNewMapMode); }
127 bool Window::IsRTLEnabled() const { return GetOutDev()->IsRTLEnabled(); }
129 const AllSettings& Window::GetSettings() const { return GetOutDev()->GetSettings(); }
130 
131 Point Window::LogicToPixel(const Point& rLogicPt) const
132 {
133  return GetOutDev()->LogicToPixel(rLogicPt);
134 }
135 Size Window::LogicToPixel(const Size& rLogicSize) const
136 {
137  return GetOutDev()->LogicToPixel(rLogicSize);
138 }
140 {
141  return GetOutDev()->LogicToPixel(rLogicRect);
142 }
143 vcl::Region Window::LogicToPixel(const vcl::Region& rLogicRegion) const
144 {
145  return GetOutDev()->LogicToPixel(rLogicRegion);
146 }
147 Point Window::LogicToPixel(const Point& rLogicPt, const MapMode& rMapMode) const
148 {
149  return GetOutDev()->LogicToPixel(rLogicPt, rMapMode);
150 }
151 Size Window::LogicToPixel(const Size& rLogicSize, const MapMode& rMapMode) const
152 {
153  return GetOutDev()->LogicToPixel(rLogicSize, rMapMode);
154 }
156  const MapMode& rMapMode) const
157 {
158  return GetOutDev()->LogicToPixel(rLogicRect, rMapMode);
159 }
160 
161 Point Window::PixelToLogic(const Point& rDevicePt) const
162 {
163  return GetOutDev()->PixelToLogic(rDevicePt);
164 }
165 Size Window::PixelToLogic(const Size& rDeviceSize) const
166 {
167  return GetOutDev()->PixelToLogic(rDeviceSize);
168 }
170 {
171  return GetOutDev()->PixelToLogic(rDeviceRect);
172 }
174 {
175  return GetOutDev()->PixelToLogic(rDevicePolyPoly);
176 }
177 vcl::Region Window::PixelToLogic(const vcl::Region& rDeviceRegion) const
178 {
179  return GetOutDev()->PixelToLogic(rDeviceRegion);
180 }
181 Point Window::PixelToLogic(const Point& rDevicePt, const MapMode& rMapMode) const
182 {
183  return GetOutDev()->PixelToLogic(rDevicePt, rMapMode);
184 }
185 Size Window::PixelToLogic(const Size& rDeviceSize, const MapMode& rMapMode) const
186 {
187  return GetOutDev()->PixelToLogic(rDeviceSize, rMapMode);
188 }
190  const MapMode& rMapMode) const
191 {
192  return GetOutDev()->PixelToLogic(rDeviceRect, rMapMode);
193 }
194 
195 Size Window::LogicToLogic(const Size& rSzSource, const MapMode* pMapModeSource,
196  const MapMode* pMapModeDest) const
197 {
198  return GetOutDev()->LogicToLogic(rSzSource, pMapModeSource, pMapModeDest);
199 }
200 
201 tools::Rectangle Window::GetTextRect(const tools::Rectangle& rRect, const OUString& rStr,
202  DrawTextFlags nStyle, TextRectInfo* pInfo,
203  const vcl::ITextLayout* _pTextLayout) const
204 {
205  return GetOutDev()->GetTextRect(rRect, rStr, nStyle, pInfo, _pTextLayout);
206 }
207 
208 void Window::SetSettings(const AllSettings& rSettings) { GetOutDev()->SetSettings(rSettings); }
209 void Window::SetSettings(const AllSettings& rSettings, bool bChild)
210 {
211  static_cast<vcl::WindowOutputDevice*>(GetOutDev())->SetSettings(rSettings, bChild);
212 }
213 
215 
216 void Window::EnableRTL(bool bEnable) { GetOutDev()->EnableRTL(bEnable); }
217 
218 } /* namespace vcl */
219 
220 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
tools::Long GetTextHeight() const
Height where any character of the current font fits; in logic coordinates.
Definition: window3.cxx:65
const Color & GetTextColor() const
Definition: outdev.hxx:1011
tools::Long GetOutOffYPixel() const
Definition: window3.cxx:124
SAL_DLLPRIVATE float approximate_char_width() const
Definition: text.cxx:887
void SetBackground()
Definition: window3.cxx:100
const Wallpaper & GetBackground() const
Definition: outdev.hxx:519
void ImplClearFontData(bool bNewFontLists) override
Definition: window3.cxx:35
bool GetNativeControlRegion(ControlType nType, ControlPart nPart, const tools::Rectangle &rControlRegion, ControlState nState, const ImplControlValue &aValue, tools::Rectangle &rNativeBoundingRegion, tools::Rectangle &rNativeContentRegion) const
Query the native control's actual drawing region (including adornment)
virtual void EnableRTL(bool bEnable=true)
Definition: window3.cxx:216
bool IsBackground() const
Definition: window3.cxx:64
virtual void ImplRefreshFontData(bool bNewFontLists)
virtual void ImplAdjustNWFSizes()
Definition: window3.cxx:28
SAL_WARN_UNUSED_RESULT Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
Definition: map.cxx:1564
bool IsTextLineColor() const
Definition: window3.cxx:112
const Color & GetTextLineColor() const
Definition: outdev.hxx:1020
SAL_DLLPRIVATE float approximate_char_width() const
Definition: window3.cxx:61
void SetOverlineColor()
Definition: window3.cxx:95
void SetSettings(const AllSettings &rSettings)
Definition: window3.cxx:208
const Color & GetTextLineColor() const
Definition: window3.cxx:110
bool IsBackground() const
Definition: outdev.hxx:522
long Long
TextAlign GetTextAlign() const
Definition: outdev.hxx:1029
float approximate_digit_width() const
Definition: window3.cxx:72
bool IsMapModeEnabled() const
Definition: outdev.hxx:1526
bool IsTextLineColor() const
Definition: outdev.hxx:1021
tools::Long GetOutOffXPixel() const
Definition: outdev.hxx:314
virtual Size GetOptimalSize() const
Definition: window3.cxx:26
const MapMode & GetMapMode() const
Definition: outdev.hxx:1532
void SetTextFillColor()
Definition: text.cxx:706
virtual void SetSettings(const AllSettings &rSettings)
Definition: outdev.cxx:216
void EnableMapMode(bool bEnable=true)
Definition: map.cxx:586
bool IsRTLEnabled() const
Definition: window3.cxx:127
void ImplRefreshFontData(bool bNewFontLists) override
Definition: window3.cxx:43
bool IsNativeControlSupported(ControlType nType, ControlPart nPart) const
Query the platform layer for control support.
void SetMapMode()
Definition: map.cxx:594
DrawTextFlags
void SetTextColor(const Color &rColor)
Definition: window3.cxx:108
bool IsTextFillColor() const
Definition: window3.cxx:116
void SetTextLineColor()
Definition: window3.cxx:93
const Color & GetOverlineColor() const
Definition: outdev.hxx:1025
tools::Rectangle GetTextRect(const tools::Rectangle &rRect, const OUString &rStr, DrawTextFlags nStyle=DrawTextFlags::WordBreak, TextRectInfo *pInfo=nullptr, const vcl::ITextLayout *_pTextLayout=nullptr) const
Definition: text.cxx:1779
Color GetTextFillColor() const
Definition: text.cxx:738
void SetBackground()
Definition: background.cxx:27
const Color & GetOverlineColor() const
Definition: window3.cxx:118
const vcl::Font & GetFont() const
Definition: outdev.hxx:525
void EnableMapMode(bool bEnable=true)
Definition: window3.cxx:105
VclPtr< vcl::Window > mxOwnerWindow
Definition: windowdev.hxx:77
virtual void EnableRTL(bool bEnable=true)
Definition: outdev.cxx:641
void SetTextFillColor()
Definition: window3.cxx:97
void SetTextLineColor()
Definition: textline.cxx:881
bool IsTextFillColor() const
Definition: outdev.hxx:1016
virtual void ImplInitMapModeObjects()
Definition: map.cxx:718
bool IsRTLEnabled() const
Definition: outdev.hxx:1243
Point LogicToPixel(const Point &rLogicPt) const
Definition: window3.cxx:131
tools::Long GetTextWidth(const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, vcl::text::TextLayoutCache const *=nullptr, SalLayoutGlyphs const *const pLayoutCache=nullptr) const
Width of the text.
Definition: text.cxx:863
float approximate_digit_width() const
Definition: text.cxx:895
const MapMode & GetMapMode() const
Definition: window3.cxx:99
const AllSettings & GetSettings() const
Definition: window3.cxx:129
void SetTextColor(const Color &rColor)
Definition: text.cxx:688
bool GetNativeControlRegion(ControlType nType, ControlPart nPart, const tools::Rectangle &rControlRegion, ControlState nState, const ImplControlValue &aValue, tools::Rectangle &rNativeBoundingRegion, tools::Rectangle &rNativeContentRegion) const
Query the native control's actual drawing region (including adornment)
Definition: window3.cxx:79
virtual Color GetBackgroundColor() const
Definition: background.cxx:22
std::unique_ptr< WindowImpl > mpWindowImpl
Definition: window.hxx:483
void SetOverlineColor()
Definition: textline.cxx:906
const AllSettings & GetSettings() const
Definition: outdev.hxx:287
Size GetOutputSizePixel() const
Definition: outdev.hxx:310
Point PixelToLogic(const Point &rDevicePt) const
Definition: window3.cxx:161
void SetTextAlign(TextAlign eAlign)
Definition: window3.cxx:120
tools::Rectangle GetOutputRectPixel() const
Definition: window3.cxx:91
Size LogicToLogic(const Size &rSzSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
Definition: window3.cxx:195
TextAlign
float GetDPIScaleFactor() const
Definition: outdev.hxx:392
tools::Long GetOutOffYPixel() const
Definition: outdev.hxx:315
float GetDPIScaleFactor() const
Definition: window3.cxx:122
vcl::Window * GetWindow(GetWindowType nType) const
Definition: stacking.cxx:1035
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
Definition: map.cxx:1109
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
Definition: map.cxx:878
ControlType
These types are all based on the supported variants vcl/salnativewidgets.hxx and must be kept in-sync...
bool IsMapModeEnabled() const
Definition: window3.cxx:106
Color GetBackgroundColor() const
Definition: window3.cxx:214
void SetFont(const vcl::Font &rNewFont)
Definition: outdev/font.cxx:53
tools::Rectangle GetOutputRectPixel() const
Definition: outdev.hxx:320
tools::Long GetTextHeight() const
Height where any character of the current font fits; in logic coordinates.
Definition: text.cxx:874
::OutputDevice const * GetOutDev() const
Definition: window.cxx:568
tools::Rectangle GetTextRect(const tools::Rectangle &rRect, const OUString &rStr, DrawTextFlags nStyle=DrawTextFlags::WordBreak, TextRectInfo *pInfo=nullptr, const vcl::ITextLayout *_pTextLayout=nullptr) const
Definition: window3.cxx:201
const Color & GetTextColor() const
Definition: window3.cxx:109
virtual void ImplClearFontData(bool bNewFontLists)
const vcl::Font & GetFont() const
Definition: window3.cxx:58
TextAlign GetTextAlign() const
Definition: window3.cxx:128
Color GetTextFillColor() const
Definition: window3.cxx:114
Size GetOutputSizePixel() const
Definition: window3.cxx:89
tools::Long GetTextWidth(const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, vcl::text::TextLayoutCache const *=nullptr, SalLayoutGlyphs const *const pLayoutCache=nullptr) const
Width of the text.
Definition: window3.cxx:66
bool IsOverlineColor() const
Definition: window3.cxx:119
void SetFont(const vcl::Font &rNewFont)
Definition: window3.cxx:59
bool IsNativeControlSupported(ControlType nType, ControlPart nPart) const
Query the platform layer for control support.
Definition: window3.cxx:74
bool IsOverlineColor() const
Definition: outdev.hxx:1026
tools::Long GetOutOffXPixel() const
Definition: window3.cxx:123
const Wallpaper & GetBackground() const
Definition: window3.cxx:63
void SetMapMode()
Definition: window3.cxx:125
void SetTextAlign(TextAlign eAlign)
Definition: text.cxx:746
void ImplInitMapModeObjects() override
Definition: window3.cxx:51