Impress Remote 1.0.5, tag sdremote-1.0.5
[LibreOffice.git] / embedserv / source / inc / syswinwrapper.hxx
blobe596427d378b23fd41347c00d3b12e0737294aff
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
21 #include <windows.h>
23 /**
24 ** CWindow: Our basic window class.
25 **/
28 class DocumentHolder;
31 namespace winwrap {
34 void TransformRect(LPRECT rect,HWND pWnd,HWND pWndClipTo);
37 LRESULT APIENTRY HatchWndProc(
38 HWND hWnd, UINT iMsg
39 , WPARAM wParam, LPARAM lParam);
42 BOOL HatchWindowRegister(HINSTANCE hInst);
44 class CWindow
46 protected:
47 HINSTANCE m_hInst; //Task instance
48 HWND m_hWnd; //Window handle of the window
50 public:
51 //Standard Class Functions
52 CWindow(HINSTANCE);
53 ~CWindow(void);
55 //Just returns members. No need to modify
56 HWND Window(void);
57 HINSTANCE Instance(void);
62 class Tracker {
63 public:
64 // Constructors
65 Tracker();
66 Tracker(LPCRECT lpSrcRect, UINT nStyle);
68 // Style Flags
69 enum StyleFlags
71 solidLine = 1, dottedLine = 2, hatchedBorder = 4,
72 resizeInside = 8, resizeOutside = 16, hatchInside = 32,
75 // Hit-Test codes
76 enum TrackerHit
78 hitNothing = -1,
79 hitTopLeft = 0, hitTopRight = 1,
80 hitBottomRight = 2, hitBottomLeft = 3,
81 hitTop = 4, hitRight = 5, hitBottom = 6,
82 hitLeft = 7, hitMiddle = 8
85 // Attributes
86 UINT m_nStyle; // current state
87 RECT m_rect; // current position (always in pixels)
88 SIZE m_sizeMin; // minimum X and Y size during track operation
89 int m_nHandleSize; // size of resize handles (default from WIN.INI)
91 // Operations
92 void Draw(HDC hDC) const;
93 void GetTrueRect(LPRECT lpTrueRect) const;
94 BOOL SetCursor(HWND hWnd,UINT nHitTest) const;
95 BOOL Track(HWND hWnd,POINT point,BOOL bAllowInvert = FALSE,
96 HWND hWndClipTo = NULL);
97 // BOOL TrackRubberBand(HWND hWnd,POINT point,BOOL bAllowInvert = TRUE);
98 int HitTest(POINT point) const;
99 int NormalizeHit(int nHandle) const;
101 // Overridables
102 virtual void DrawTrackerRect(
103 LPRECT lpRect, HWND hWndClipTo,
104 HDC hDC, HWND hWnd);
105 virtual void AdjustRect(int nHandle, LPRECT lpRect);
106 virtual void OnChangedRect(const RECT& rectOld);
107 virtual UINT GetHandleMask() const;
109 // Implementation
110 public:
111 virtual ~Tracker();
113 protected:
114 BOOL m_bAllowInvert; // flag passed to Track or TrackRubberBand
115 RECT m_rectLast;
116 SIZE m_sizeLast;
117 BOOL m_bErase; // TRUE if DrawTrackerRect is called for erasing
118 BOOL m_bFinalErase; // TRUE if DragTrackerRect called for final erase
120 // implementation helpers
121 int HitTestHandles(POINT point) const;
122 void GetHandleRect(int nHandle,RECT* pHandleRect) const;
123 void GetModifyPointers(
124 int nHandle,int**ppx, int**ppy, int* px, int*py);
125 virtual int GetHandleSize(LPRECT lpRect = NULL) const;
126 BOOL TrackHandle(int nHandle,HWND hWnd,POINT point,HWND hWndClipTo);
127 void Construct();
132 //Width of the border
133 #define HATCHWIN_BORDERWIDTHDEFAULT 4
136 class CHatchWin : public CWindow
138 friend LRESULT APIENTRY HatchWndProc(HWND, UINT, WPARAM, LPARAM);
140 public:
142 const DocumentHolder* m_pDocHolder;
143 Tracker m_aTracker;
145 int m_dBorder;
146 int m_dBorderOrg;
147 UINT m_uID;
148 HWND m_hWndParent;
149 HWND m_hWndKid;
150 HWND m_hWndAssociate;
151 RECT m_rcPos;
152 RECT m_rcClip;
154 public:
155 CHatchWin(HINSTANCE,const DocumentHolder*);
156 ~CHatchWin(void);
158 BOOL Init(HWND, UINT, HWND);
160 HWND HwndAssociateSet(HWND);
161 HWND HwndAssociateGet(void);
163 void RectsSet(LPRECT, LPRECT);
164 void ChildSet(HWND);
165 void ShowHatch(BOOL);
166 void SetTrans();
171 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */