1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: syswinwrapper.hxx,v $
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 ************************************************************************/
35 ** CWindow: Our basic window class.
45 void TransformRect(LPRECT rect
,HWND pWnd
,HWND pWndClipTo
);
48 LRESULT APIENTRY
HatchWndProc(
50 , WPARAM wParam
, LPARAM lParam
);
53 BOOL
HatchWindowRegister(HINSTANCE hInst
);
58 HINSTANCE m_hInst
; //Task instance
59 HWND m_hWnd
; //Window handle of the window
62 //Standard Class Functions
66 //Just returns members. No need to modify
68 HINSTANCE
Instance(void);
77 Tracker(LPCRECT lpSrcRect
, UINT nStyle
);
82 solidLine
= 1, dottedLine
= 2, hatchedBorder
= 4,
83 resizeInside
= 8, resizeOutside
= 16, hatchInside
= 32,
90 hitTopLeft
= 0, hitTopRight
= 1,
91 hitBottomRight
= 2, hitBottomLeft
= 3,
92 hitTop
= 4, hitRight
= 5, hitBottom
= 6,
93 hitLeft
= 7, hitMiddle
= 8
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)
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;
113 virtual void DrawTrackerRect(
114 LPRECT lpRect
, HWND hWndClipTo
,
116 virtual void AdjustRect(int nHandle
, LPRECT lpRect
);
117 virtual void OnChangedRect(const RECT
& rectOld
);
118 virtual UINT
GetHandleMask() const;
125 BOOL m_bAllowInvert
; // flag passed to Track or TrackRubberBand
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
);
143 //Width of the border
144 #define HATCHWIN_BORDERWIDTHDEFAULT 4
147 class CHatchWin
: public CWindow
149 friend LRESULT APIENTRY
HatchWndProc(HWND
, UINT
, WPARAM
, LPARAM
);
153 const DocumentHolder
* m_pDocHolder
;
161 HWND m_hWndAssociate
;
166 CHatchWin(HINSTANCE
,const DocumentHolder
*);
169 BOOL
Init(HWND
, UINT
, HWND
);
171 HWND
HwndAssociateSet(HWND
);
172 HWND
HwndAssociateGet(void);
174 void RectsSet(LPRECT
, LPRECT
);
176 void ShowHatch(BOOL
);