LibreOffice Module embedserv (master) 1
syswinwrapper.hxx
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#pragma once
21
22#if !defined WIN32_LEAN_AND_MEAN
23# define WIN32_LEAN_AND_MEAN
24#endif
25#include <windows.h>
26
32class DocumentHolder;
33
34
35namespace winwrap {
36
37
38 void TransformRect(LPRECT rect,HWND pWnd,HWND pWndClipTo);
39
40
41 LRESULT APIENTRY HatchWndProc(
42 HWND hWnd, UINT iMsg
43 , WPARAM wParam, LPARAM lParam);
44
45
46 BOOL HatchWindowRegister(HINSTANCE hInst);
47
48 class CWindow
49 {
50 protected:
51 HINSTANCE m_hInst; //Task instance
52 HWND m_hWnd; //Window handle of the window
53
54 public:
55 //Standard Class Functions
56 CWindow(HINSTANCE);
57 ~CWindow();
58
59 //Just returns members. No need to modify
60 HWND Window();
61 HINSTANCE Instance();
62 };
63
64
65 class Tracker {
66 public:
67 // Constructors
68 Tracker();
69 Tracker(LPCRECT lpSrcRect, UINT nStyle);
70
71 // Style Flags
73 {
76 };
77
78 // Hit-Test codes
80 {
84 hitTop = 4, hitRight = 5, hitBottom = 6,
86 };
87
88 // Attributes
89 UINT m_nStyle; // current state
90 RECT m_rect; // current position (always in pixels)
91 SIZE m_sizeMin; // minimum X and Y size during track operation
92 int m_nHandleSize; // size of resize handles (default from WIN.INI)
93
94 // Operations
95 void Draw(HDC hDC) const;
96 void GetTrueRect(LPRECT lpTrueRect) const;
97 BOOL SetCursor(HWND hWnd,UINT nHitTest) const;
98 BOOL Track(HWND hWnd,POINT point,BOOL bAllowInvert = FALSE,
99 HWND hWndClipTo = nullptr);
100// BOOL TrackRubberBand(HWND hWnd,POINT point,BOOL bAllowInvert = TRUE);
101 int HitTest(POINT point) const;
102 int NormalizeHit(int nHandle) const;
103
104 // Overridables
105 virtual void DrawTrackerRect(
106 LPRECT lpRect, HWND hWndClipTo,
107 HDC hDC, HWND hWnd);
108 virtual void AdjustRect(int nHandle, LPRECT lpRect);
109 virtual void OnChangedRect(const RECT& rectOld);
110 virtual UINT GetHandleMask() const;
111
112// Implementation
113 public:
114 virtual ~Tracker();
115
116protected:
117 BOOL m_bAllowInvert; // flag passed to Track or TrackRubberBand
120 BOOL m_bErase; // TRUE if DrawTrackerRect is called for erasing
121 BOOL m_bFinalErase; // TRUE if DragTrackerRect called for final erase
122
123 // implementation helpers
124 int HitTestHandles(POINT point) const;
125 void GetHandleRect(int nHandle,RECT* pHandleRect) const;
127 int nHandle,int**ppx, int**ppy, int* px, int*py);
128 virtual int GetHandleSize(LPRECT lpRect = nullptr) const;
129 BOOL TrackHandle(int nHandle,HWND hWnd,POINT point,HWND hWndClipTo);
130 void Construct();
131 };
132
133
134//Width of the border
135#define HATCHWIN_BORDERWIDTHDEFAULT 4
136
137
138 class CHatchWin : public CWindow
139 {
140 friend LRESULT APIENTRY HatchWndProc(HWND, UINT, WPARAM, LPARAM);
141
142 public:
143
146
155
156 public:
157 CHatchWin(HINSTANCE,const DocumentHolder*);
158 ~CHatchWin();
159
160 BOOL Init(HWND, WORD, HWND);
161
162 HWND HwndAssociateSet(HWND);
163 HWND HwndAssociateGet();
164
165 void RectsSet(LPRECT, LPRECT);
166 void ChildSet(HWND);
167 void ShowHatch(BOOL);
168 void SetTrans();
169 };
170
171}
172
173/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
BOOL Init(HWND, WORD, HWND)
const DocumentHolder * m_pDocHolder
HWND HwndAssociateSet(HWND)
friend LRESULT APIENTRY HatchWndProc(HWND, UINT, WPARAM, LPARAM)
void RectsSet(LPRECT, LPRECT)
CHatchWin(HINSTANCE, const DocumentHolder *)
CWindow(HINSTANCE)
HINSTANCE Instance()
virtual ~Tracker()
Definition: tracker.cxx:290
BOOL SetCursor(HWND hWnd, UINT nHitTest) const
Definition: tracker.cxx:313
void GetTrueRect(LPRECT lpTrueRect) const
Definition: tracker.cxx:736
virtual void DrawTrackerRect(LPRECT lpRect, HWND hWndClipTo, HDC hDC, HWND hWnd)
Definition: tracker.cxx:539
virtual UINT GetHandleMask() const
Definition: tracker.cxx:724
void GetModifyPointers(int nHandle, int **ppx, int **ppy, int *px, int *py)
Definition: tracker.cxx:801
int NormalizeHit(int nHandle) const
Definition: tracker.cxx:750
BOOL Track(HWND hWnd, POINT point, BOOL bAllowInvert=FALSE, HWND hWndClipTo=nullptr)
Definition: tracker.cxx:346
void Construct()
Definition: tracker.cxx:238
int HitTest(POINT point) const
Definition: tracker.cxx:295
BOOL TrackHandle(int nHandle, HWND hWnd, POINT point, HWND hWndClipTo)
Definition: tracker.cxx:364
void GetHandleRect(int nHandle, RECT *pHandleRect) const
Definition: tracker.cxx:672
virtual void AdjustRect(int nHandle, LPRECT lpRect)
Definition: tracker.cxx:504
int HitTestHandles(POINT point) const
Definition: tracker.cxx:766
virtual int GetHandleSize(LPRECT lpRect=nullptr) const
Definition: tracker.cxx:707
void Draw(HDC hDC) const
Definition: tracker.cxx:577
virtual void OnChangedRect(const RECT &rectOld)
Definition: tracker.cxx:499
unsigned short WORD
constexpr tools::Long SIZE
void TransformRect(LPRECT rect, HWND pWnd, HWND pWndClipTo)
Definition: tracker.cxx:187
BOOL HatchWindowRegister(HINSTANCE hInst)
LRESULT APIENTRY HatchWndProc(HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
const wchar_t *typedef BOOL