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
24namespace vcl
25{
26Size 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
36{
38 for (Window* pChild = mxOwnerWindow->mpWindowImpl->mpFirstChild; pChild;
39 pChild = pChild->mpWindowImpl->mpNext)
40 pChild->GetOutDev()->ImplClearFontData(bNewFontLists);
41}
42
44{
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
58const Font& Window::GetFont() const { return GetOutDev()->GetFont(); }
59void Window::SetFont(Font const& font) { return GetOutDev()->SetFont(font); }
60
62
64bool Window::IsBackground() const { return GetOutDev()->IsBackground(); }
66tools::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{
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
94void Window::SetTextLineColor(const Color& rColor) { GetOutDev()->SetTextLineColor(rColor); }
96void Window::SetOverlineColor(const Color& rColor) { GetOutDev()->SetOverlineColor(rColor); }
98void Window::SetTextFillColor(const Color& rColor) { GetOutDev()->SetTextFillColor(rColor); }
99const MapMode& Window::GetMapMode() const { return GetOutDev()->GetMapMode(); }
101void Window::SetBackground(const Wallpaper& rBackground)
102{
103 GetOutDev()->SetBackground(rBackground);
104}
105void Window::EnableMapMode(bool bEnable) { GetOutDev()->EnableMapMode(bEnable); }
107
108void Window::SetTextColor(const Color& rColor) { GetOutDev()->SetTextColor(rColor); }
109const Color& Window::GetTextColor() const { return GetOutDev()->GetTextColor(); }
111
113
115
117
121
126void Window::SetMapMode(const MapMode& rNewMapMode) { GetOutDev()->SetMapMode(rNewMapMode); }
127bool Window::IsRTLEnabled() const { return GetOutDev()->IsRTLEnabled(); }
130
131Point Window::LogicToPixel(const Point& rLogicPt) const
132{
133 return GetOutDev()->LogicToPixel(rLogicPt);
134}
135Size Window::LogicToPixel(const Size& rLogicSize) const
136{
137 return GetOutDev()->LogicToPixel(rLogicSize);
138}
140{
141 return GetOutDev()->LogicToPixel(rLogicRect);
142}
144{
145 return GetOutDev()->LogicToPixel(rLogicRegion);
146}
147Point Window::LogicToPixel(const Point& rLogicPt, const MapMode& rMapMode) const
148{
149 return GetOutDev()->LogicToPixel(rLogicPt, rMapMode);
150}
151Size 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
161Point Window::PixelToLogic(const Point& rDevicePt) const
162{
163 return GetOutDev()->PixelToLogic(rDevicePt);
164}
165Size 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}
178{
179 return GetOutDev()->PixelToLogic(rDeviceRegion);
180}
181Point Window::PixelToLogic(const Point& rDevicePt, const MapMode& rMapMode) const
182{
183 return GetOutDev()->PixelToLogic(rDevicePt, rMapMode);
184}
185Size 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
195Size Window::LogicToLogic(const Size& rSzSource, const MapMode* pMapModeSource,
196 const MapMode* pMapModeDest) const
197{
198 return GetOutDev()->LogicToLogic(rSzSource, pMapModeSource, pMapModeDest);
199}
200
201tools::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
208void Window::SetSettings(const AllSettings& rSettings) { GetOutDev()->SetSettings(rSettings); }
209void Window::SetSettings(const AllSettings& rSettings, bool bChild)
210{
211 static_cast<vcl::WindowOutputDevice*>(GetOutDev())->SetSettings(rSettings, bChild);
212}
213
215
216void Window::EnableRTL(bool bEnable) { GetOutDev()->EnableRTL(bEnable); }
217
218} /* namespace vcl */
219
220/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
DrawTextFlags
ControlType
These types are all based on the supported variants vcl/salnativewidgets.hxx and must be kept in-sync...
float approximate_digit_width() const
Definition: text.cxx:918
virtual Color GetBackgroundColor() const
Definition: background.cxx:22
virtual void SetSettings(const AllSettings &rSettings)
Definition: outdev.cxx:215
void EnableMapMode(bool bEnable=true)
Definition: map.cxx:589
tools::Rectangle GetOutputRectPixel() const
Definition: outdev.hxx:324
tools::Long GetOutOffYPixel() const
Definition: outdev.hxx:319
const vcl::Font & GetFont() const
Definition: outdev.hxx:529
bool IsOverlineColor() const
Definition: outdev.hxx:1018
float GetDPIScaleFactor() const
Definition: outdev.hxx:396
void SetFont(const vcl::Font &rNewFont)
Definition: outdev/font.cxx:56
void SetTextAlign(TextAlign eAlign)
Definition: text.cxx:774
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
Definition: map.cxx:1110
Size GetOutputSizePixel() const
Definition: outdev.hxx:314
const Wallpaper & GetBackground() const
Definition: outdev.hxx:523
SAL_WARN_UNUSED_RESULT Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
Definition: map.cxx:1580
void SetMapMode()
Definition: map.cxx:597
virtual void ImplInitMapModeObjects()
Definition: map.cxx:719
const Color & GetOverlineColor() const
Definition: outdev.hxx:1017
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:886
void SetTextColor(const Color &rColor)
Definition: text.cxx:716
bool IsRTLEnabled() const
Definition: outdev.hxx:1269
SAL_DLLPRIVATE float approximate_char_width() const
Definition: text.cxx:910
virtual void ImplClearFontData(bool bNewFontLists)
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
Definition: map.cxx:879
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:1881
TextAlign GetTextAlign() const
Definition: outdev.hxx:1021
bool IsTextFillColor() const
Definition: outdev.hxx:1008
const MapMode & GetMapMode() const
Definition: outdev.hxx:1557
const Color & GetTextColor() const
Definition: outdev.hxx:1003
void SetTextFillColor()
Definition: text.cxx:734
bool IsBackground() const
Definition: outdev.hxx:526
tools::Long GetTextHeight() const
Height where any character of the current font fits; in logic coordinates.
Definition: text.cxx:897
void SetBackground()
Definition: background.cxx:27
virtual void ImplRefreshFontData(bool bNewFontLists)
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)
Color GetTextFillColor() const
Definition: text.cxx:766
tools::Long GetOutOffXPixel() const
Definition: outdev.hxx:318
bool IsTextLineColor() const
Definition: outdev.hxx:1013
void SetOverlineColor()
Definition: textline.cxx:919
virtual void EnableRTL(bool bEnable=true)
Definition: outdev.cxx:647
const AllSettings & GetSettings() const
Definition: outdev.hxx:288
bool IsNativeControlSupported(ControlType nType, ControlPart nPart) const
Query the platform layer for control support.
const Color & GetTextLineColor() const
Definition: outdev.hxx:1012
void SetTextLineColor()
Definition: textline.cxx:894
bool IsMapModeEnabled() const
Definition: outdev.hxx:1551
void ImplRefreshFontData(bool bNewFontLists) override
Definition: window3.cxx:43
void ImplClearFontData(bool bNewFontLists) override
Definition: window3.cxx:35
VclPtr< vcl::Window > mxOwnerWindow
Definition: windowdev.hxx:77
void ImplInitMapModeObjects() override
Definition: window3.cxx:51
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 Wallpaper & GetBackground() const
Definition: window3.cxx:63
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
void SetFont(const vcl::Font &rNewFont)
Definition: window3.cxx:59
float GetDPIScaleFactor() const
Definition: window3.cxx:122
tools::Long GetOutOffXPixel() const
Definition: window3.cxx:123
Point LogicToPixel(const Point &rLogicPt) const
Definition: window3.cxx:131
bool IsBackground() const
Definition: window3.cxx:64
TextAlign GetTextAlign() const
Definition: window3.cxx:128
float approximate_digit_width() const
Definition: window3.cxx:72
vcl::Window * GetWindow(GetWindowType nType) const
Definition: stacking.cxx:1036
const Color & GetTextLineColor() const
Definition: window3.cxx:110
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
Size LogicToLogic(const Size &rSzSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
Definition: window3.cxx:195
virtual void EnableRTL(bool bEnable=true)
Definition: window3.cxx:216
void SetMapMode()
Definition: window3.cxx:125
tools::Long GetTextHeight() const
Height where any character of the current font fits; in logic coordinates.
Definition: window3.cxx:65
bool IsMapModeEnabled() const
Definition: window3.cxx:106
const AllSettings & GetSettings() const
Definition: window3.cxx:129
tools::Long GetOutOffYPixel() const
Definition: window3.cxx:124
bool IsNativeControlSupported(ControlType nType, ControlPart nPart) const
Query the platform layer for control support.
Definition: window3.cxx:74
const MapMode & GetMapMode() const
Definition: window3.cxx:99
void SetTextFillColor()
Definition: window3.cxx:97
::OutputDevice const * GetOutDev() const
Definition: window.cxx:567
Color GetBackgroundColor() const
Definition: window3.cxx:214
virtual Size GetOptimalSize() const
Definition: window3.cxx:26
void SetTextAlign(TextAlign eAlign)
Definition: window3.cxx:120
const vcl::Font & GetFont() const
Definition: window3.cxx:58
SAL_DLLPRIVATE float approximate_char_width() const
Definition: window3.cxx:61
bool IsTextLineColor() const
Definition: window3.cxx:112
void SetOverlineColor()
Definition: window3.cxx:95
void SetSettings(const AllSettings &rSettings)
Definition: window3.cxx:208
const Color & GetTextColor() const
Definition: window3.cxx:109
std::unique_ptr< WindowImpl > mpWindowImpl
Definition: window.hxx:484
bool IsRTLEnabled() const
Definition: window3.cxx:127
Point PixelToLogic(const Point &rDevicePt) const
Definition: window3.cxx:161
Size GetOutputSizePixel() const
Definition: window3.cxx:89
void SetTextLineColor()
Definition: window3.cxx:93
virtual void ImplAdjustNWFSizes()
Definition: window3.cxx:28
tools::Rectangle GetOutputRectPixel() const
Definition: window3.cxx:91
void EnableMapMode(bool bEnable=true)
Definition: window3.cxx:105
bool IsTextFillColor() const
Definition: window3.cxx:116
bool IsOverlineColor() const
Definition: window3.cxx:119
Color GetTextFillColor() const
Definition: window3.cxx:114
void SetTextColor(const Color &rColor)
Definition: window3.cxx:108
const Color & GetOverlineColor() const
Definition: window3.cxx:118
void SetBackground()
Definition: window3.cxx:100
sal_Int32 nState
sal_Int32 nIndex
TextAlign
long Long
QPRO_FUNC_TYPE nType