xref: /aoo41x/main/sw/inc/swevent.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _SWEVENT_HXX
29 #define _SWEVENT_HXX
30 
31 // #include *****************************************************************
32 
33 #include <tools/solar.h>
34 #include <sfx2/sfx.hrc>
35 
36 #define     SW_EVENT_OBJECT_SELECT        ( EVENT_APP_START + 0 )
37 #define     SW_EVENT_START_INS_GLOSSARY   ( EVENT_APP_START + 1 )
38 #define     SW_EVENT_END_INS_GLOSSARY     ( EVENT_APP_START + 2 )
39 #define     SW_EVENT_MAIL_MERGE           ( EVENT_APP_START + 3 )
40 #define     SW_EVENT_FRM_KEYINPUT_ALPHA   ( EVENT_APP_START + 4 )
41 #define     SW_EVENT_FRM_KEYINPUT_NOALPHA ( EVENT_APP_START + 5 )
42 #define     SW_EVENT_FRM_RESIZE           ( EVENT_APP_START + 6 )
43 #define     SW_EVENT_FRM_MOVE             ( EVENT_APP_START + 7 )
44 #define     SW_EVENT_PAGE_COUNT			  ( EVENT_APP_START + 8 )
45 #define     SW_EVENT_MAIL_MERGE_END		  ( EVENT_APP_START + 9 )
46 #define     SW_EVENT_FIELD_MERGE          ( EVENT_APP_START + 10 )
47 #define     SW_EVENT_FIELD_MERGE_FINISHED ( EVENT_APP_START + 11 )
48 #define     SW_EVENT_LAYOUT_FINISHED	  ( EVENT_APP_START + 12 )
49 
50 #define     STR_SW_EVENT_PAGE_COUNT           0
51 #define     STR_SW_EVENT_MAIL_MERGE           1
52 #define     STR_SW_EVENT_MAIL_MERGE_END       2
53 #define     STR_SW_EVENT_FIELD_MERGE          3
54 #define     STR_SW_EVENT_FIELD_MERGE_FINISHED 4
55 #define     STR_SW_EVENT_LAYOUT_FINISHED      5
56 #define     STR_SW_EVENT_OBJECT_SELECT        6
57 #define     STR_SW_EVENT_START_INS_GLOSSARY   7
58 #define     STR_SW_EVENT_END_INS_GLOSSARY     8
59 #define     STR_SW_EVENT_FRM_KEYINPUT_ALPHA   9
60 #define     STR_SW_EVENT_FRM_KEYINPUT_NOALPHA 10
61 #define     STR_SW_EVENT_FRM_RESIZE           11
62 #define     STR_SW_EVENT_FRM_MOVE             12
63 
64 class SwFrmFmt;
65 class SwFmtINetFmt;
66 class IMapObject;
67 
68 // enum fuer Objecte die Events ins Basic oder in JavaScript Callen
69 enum SwCallEventObjectType
70 {
71 	EVENT_OBJECT_NONE = 0,			// Null ist garnichts
72 	EVENT_OBJECT_IMAGE,
73 	EVENT_OBJECT_INETATTR,
74 	EVENT_OBJECT_URLITEM,
75 	EVENT_OBJECT_IMAGEMAP
76 };
77 
78 // structur fuer den Austausch zwischen UI/CORE
79 
80 struct SwCallMouseEvent
81 {
82 	SwCallEventObjectType eType;
83 	union
84 	{
85 		// EVENT_OBJECT_IMAGE/EVENT_OBJECT_URLITEM
86 		const SwFrmFmt* pFmt;
87 
88 		// EVENT_OBJECT_INETATTR
89 		const SwFmtINetFmt* pINetAttr;
90 
91 		// EVENT_OBJECT_IMAGEMAP
92 		struct
93 		{
94 			const SwFrmFmt* pFmt;
95 			const IMapObject* pIMapObj;
96 		} IMAP;
97 	} PTR;
98 
99 	SwCallMouseEvent()
100 		: eType( EVENT_OBJECT_NONE )
101 		{ PTR.pFmt = 0; PTR.IMAP.pIMapObj = 0; }
102 
103 	void Set( SwCallEventObjectType eTyp, const SwFrmFmt* pFmt )
104 		{ eType = eTyp; PTR.pFmt = pFmt; PTR.IMAP.pIMapObj = 0; }
105 
106 	void Set( const SwFrmFmt* pFmt, const IMapObject* pIMapObj )
107 		{ eType = EVENT_OBJECT_IMAGEMAP; PTR.pFmt = pFmt; PTR.IMAP.pIMapObj = pIMapObj; }
108 
109 	void Set( const SwFmtINetFmt* pINetAttr )
110 		{ eType = EVENT_OBJECT_INETATTR; PTR.pINetAttr = pINetAttr; PTR.IMAP.pIMapObj = 0; }
111 
112 	int operator==( const SwCallMouseEvent& rEvent ) const
113 		{
114 			return eType == rEvent.eType &&
115 					PTR.pFmt == rEvent.PTR.pFmt &&
116 					PTR.IMAP.pIMapObj == rEvent.PTR.IMAP.pIMapObj;
117 		}
118 	int operator!=( const SwCallMouseEvent& rEvent ) const
119 		{	return !( *this == rEvent );	}
120 
121 	void Clear()
122 		{ eType = EVENT_OBJECT_NONE; PTR.pFmt = 0; PTR.IMAP.pIMapObj = 0; }
123 
124 	sal_Bool HasEvent() const { return EVENT_OBJECT_NONE != eType; }
125 };
126 
127 
128 #endif
129 
130