xref: /aoo4110/main/sw/inc/swevent.hxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _SWEVENT_HXX
25 #define _SWEVENT_HXX
26 
27 // #include *****************************************************************
28 
29 #include <tools/solar.h>
30 #include <sfx2/sfx.hrc>
31 
32 #define     SW_EVENT_OBJECT_SELECT        ( EVENT_APP_START + 0 )
33 #define     SW_EVENT_START_INS_GLOSSARY   ( EVENT_APP_START + 1 )
34 #define     SW_EVENT_END_INS_GLOSSARY     ( EVENT_APP_START + 2 )
35 #define     SW_EVENT_MAIL_MERGE           ( EVENT_APP_START + 3 )
36 #define     SW_EVENT_FRM_KEYINPUT_ALPHA   ( EVENT_APP_START + 4 )
37 #define     SW_EVENT_FRM_KEYINPUT_NOALPHA ( EVENT_APP_START + 5 )
38 #define     SW_EVENT_FRM_RESIZE           ( EVENT_APP_START + 6 )
39 #define     SW_EVENT_FRM_MOVE             ( EVENT_APP_START + 7 )
40 #define     SW_EVENT_PAGE_COUNT			  ( EVENT_APP_START + 8 )
41 #define     SW_EVENT_MAIL_MERGE_END		  ( EVENT_APP_START + 9 )
42 #define     SW_EVENT_FIELD_MERGE          ( EVENT_APP_START + 10 )
43 #define     SW_EVENT_FIELD_MERGE_FINISHED ( EVENT_APP_START + 11 )
44 #define     SW_EVENT_LAYOUT_FINISHED	  ( EVENT_APP_START + 12 )
45 
46 #define     STR_SW_EVENT_PAGE_COUNT           0
47 #define     STR_SW_EVENT_MAIL_MERGE           1
48 #define     STR_SW_EVENT_MAIL_MERGE_END       2
49 #define     STR_SW_EVENT_FIELD_MERGE          3
50 #define     STR_SW_EVENT_FIELD_MERGE_FINISHED 4
51 #define     STR_SW_EVENT_LAYOUT_FINISHED      5
52 #define     STR_SW_EVENT_OBJECT_SELECT        6
53 #define     STR_SW_EVENT_START_INS_GLOSSARY   7
54 #define     STR_SW_EVENT_END_INS_GLOSSARY     8
55 #define     STR_SW_EVENT_FRM_KEYINPUT_ALPHA   9
56 #define     STR_SW_EVENT_FRM_KEYINPUT_NOALPHA 10
57 #define     STR_SW_EVENT_FRM_RESIZE           11
58 #define     STR_SW_EVENT_FRM_MOVE             12
59 
60 class SwFrmFmt;
61 class SwFmtINetFmt;
62 class IMapObject;
63 
64 // enum fuer Objecte die Events ins Basic oder in JavaScript Callen
65 enum SwCallEventObjectType
66 {
67 	EVENT_OBJECT_NONE = 0,			// Null ist garnichts
68 	EVENT_OBJECT_IMAGE,
69 	EVENT_OBJECT_INETATTR,
70 	EVENT_OBJECT_URLITEM,
71 	EVENT_OBJECT_IMAGEMAP
72 };
73 
74 // structur fuer den Austausch zwischen UI/CORE
75 
76 struct SwCallMouseEvent
77 {
78 	SwCallEventObjectType eType;
79 	union
80 	{
81 		// EVENT_OBJECT_IMAGE/EVENT_OBJECT_URLITEM
82 		const SwFrmFmt* pFmt;
83 
84 		// EVENT_OBJECT_INETATTR
85 		const SwFmtINetFmt* pINetAttr;
86 
87 		// EVENT_OBJECT_IMAGEMAP
88 		struct
89 		{
90 			const SwFrmFmt* pFmt;
91 			const IMapObject* pIMapObj;
92 		} IMAP;
93 	} PTR;
94 
SwCallMouseEventSwCallMouseEvent95 	SwCallMouseEvent()
96 		: eType( EVENT_OBJECT_NONE )
97 		{ PTR.pFmt = 0; PTR.IMAP.pIMapObj = 0; }
98 
SetSwCallMouseEvent99 	void Set( SwCallEventObjectType eTyp, const SwFrmFmt* pFmt )
100 		{ eType = eTyp; PTR.pFmt = pFmt; PTR.IMAP.pIMapObj = 0; }
101 
SetSwCallMouseEvent102 	void Set( const SwFrmFmt* pFmt, const IMapObject* pIMapObj )
103 		{ eType = EVENT_OBJECT_IMAGEMAP; PTR.pFmt = pFmt; PTR.IMAP.pIMapObj = pIMapObj; }
104 
SetSwCallMouseEvent105 	void Set( const SwFmtINetFmt* pINetAttr )
106 		{ eType = EVENT_OBJECT_INETATTR; PTR.pINetAttr = pINetAttr; PTR.IMAP.pIMapObj = 0; }
107 
operator ==SwCallMouseEvent108 	int operator==( const SwCallMouseEvent& rEvent ) const
109 		{
110 			return eType == rEvent.eType &&
111 					PTR.pFmt == rEvent.PTR.pFmt &&
112 					PTR.IMAP.pIMapObj == rEvent.PTR.IMAP.pIMapObj;
113 		}
operator !=SwCallMouseEvent114 	int operator!=( const SwCallMouseEvent& rEvent ) const
115 		{	return !( *this == rEvent );	}
116 
ClearSwCallMouseEvent117 	void Clear()
118 		{ eType = EVENT_OBJECT_NONE; PTR.pFmt = 0; PTR.IMAP.pIMapObj = 0; }
119 
HasEventSwCallMouseEvent120 	sal_Bool HasEvent() const { return EVENT_OBJECT_NONE != eType; }
121 };
122 
123 
124 #endif
125 
126