Update to m13
[ooovba.git] / embedserv / source / inc / syswinwrapper.hxx
blobb5a06a2fed34f7f07b53b858c7c2de639dcc46cc
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: syswinwrapper.hxx,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
32 #include <windows.h>
34 /**
35 ** CWindow: Our basic window class.
36 **/
39 class DocumentHolder;
42 namespace winwrap {
45 void TransformRect(LPRECT rect,HWND pWnd,HWND pWndClipTo);
48 LRESULT APIENTRY HatchWndProc(
49 HWND hWnd, UINT iMsg
50 , WPARAM wParam, LPARAM lParam);
53 BOOL HatchWindowRegister(HINSTANCE hInst);
55 class CWindow
57 protected:
58 HINSTANCE m_hInst; //Task instance
59 HWND m_hWnd; //Window handle of the window
61 public:
62 //Standard Class Functions
63 CWindow(HINSTANCE);
64 ~CWindow(void);
66 //Just returns members. No need to modify
67 HWND Window(void);
68 HINSTANCE Instance(void);
73 class Tracker {
74 public:
75 // Constructors
76 Tracker();
77 Tracker(LPCRECT lpSrcRect, UINT nStyle);
79 // Style Flags
80 enum StyleFlags
82 solidLine = 1, dottedLine = 2, hatchedBorder = 4,
83 resizeInside = 8, resizeOutside = 16, hatchInside = 32,
86 // Hit-Test codes
87 enum TrackerHit
89 hitNothing = -1,
90 hitTopLeft = 0, hitTopRight = 1,
91 hitBottomRight = 2, hitBottomLeft = 3,
92 hitTop = 4, hitRight = 5, hitBottom = 6,
93 hitLeft = 7, hitMiddle = 8
96 // Attributes
97 UINT m_nStyle; // current state
98 RECT m_rect; // current position (always in pixels)
99 SIZE m_sizeMin; // minimum X and Y size during track operation
100 int m_nHandleSize; // size of resize handles (default from WIN.INI)
102 // Operations
103 void Draw(HDC hDC) const;
104 void GetTrueRect(LPRECT lpTrueRect) const;
105 BOOL SetCursor(HWND hWnd,UINT nHitTest) const;
106 BOOL Track(HWND hWnd,POINT point,BOOL bAllowInvert = FALSE,
107 HWND hWndClipTo = NULL);
108 // BOOL TrackRubberBand(HWND hWnd,POINT point,BOOL bAllowInvert = TRUE);
109 int HitTest(POINT point) const;
110 int NormalizeHit(int nHandle) const;
112 // Overridables
113 virtual void DrawTrackerRect(
114 LPRECT lpRect, HWND hWndClipTo,
115 HDC hDC, HWND hWnd);
116 virtual void AdjustRect(int nHandle, LPRECT lpRect);
117 virtual void OnChangedRect(const RECT& rectOld);
118 virtual UINT GetHandleMask() const;
120 // Implementation
121 public:
122 virtual ~Tracker();
124 protected:
125 BOOL m_bAllowInvert; // flag passed to Track or TrackRubberBand
126 RECT m_rectLast;
127 SIZE m_sizeLast;
128 BOOL m_bErase; // TRUE if DrawTrackerRect is called for erasing
129 BOOL m_bFinalErase; // TRUE if DragTrackerRect called for final erase
131 // implementation helpers
132 int HitTestHandles(POINT point) const;
133 void GetHandleRect(int nHandle,RECT* pHandleRect) const;
134 void GetModifyPointers(
135 int nHandle,int**ppx, int**ppy, int* px, int*py);
136 virtual int GetHandleSize(LPRECT lpRect = NULL) const;
137 BOOL TrackHandle(int nHandle,HWND hWnd,POINT point,HWND hWndClipTo);
138 void Construct();
143 //Width of the border
144 #define HATCHWIN_BORDERWIDTHDEFAULT 4
147 class CHatchWin : public CWindow
149 friend LRESULT APIENTRY HatchWndProc(HWND, UINT, WPARAM, LPARAM);
151 public:
153 const DocumentHolder* m_pDocHolder;
154 Tracker m_aTracker;
156 int m_dBorder;
157 int m_dBorderOrg;
158 UINT m_uID;
159 HWND m_hWndParent;
160 HWND m_hWndKid;
161 HWND m_hWndAssociate;
162 RECT m_rcPos;
163 RECT m_rcClip;
165 public:
166 CHatchWin(HINSTANCE,const DocumentHolder*);
167 ~CHatchWin(void);
169 BOOL Init(HWND, UINT, HWND);
171 HWND HwndAssociateSet(HWND);
172 HWND HwndAssociateGet(void);
174 void RectsSet(LPRECT, LPRECT);
175 void ChildSet(HWND);
176 void ShowHatch(BOOL);
177 void SetTrans();