1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
20 #ifndef INCLUDED_SW_INC_SWEVENT_HXX
21 #define INCLUDED_SW_INC_SWEVENT_HXX
23 #include <tools/solar.h>
24 #include <sfx2/sfx.hrc>
26 #define SW_EVENT_OBJECT_SELECT ( EVENT_APP_START + 0 )
27 #define SW_EVENT_START_INS_GLOSSARY ( EVENT_APP_START + 1 )
28 #define SW_EVENT_END_INS_GLOSSARY ( EVENT_APP_START + 2 )
29 #define SW_EVENT_MAIL_MERGE ( EVENT_APP_START + 3 )
30 #define SW_EVENT_FRM_KEYINPUT_ALPHA ( EVENT_APP_START + 4 )
31 #define SW_EVENT_FRM_KEYINPUT_NOALPHA ( EVENT_APP_START + 5 )
32 #define SW_EVENT_FRM_RESIZE ( EVENT_APP_START + 6 )
33 #define SW_EVENT_FRM_MOVE ( EVENT_APP_START + 7 )
34 #define SW_EVENT_PAGE_COUNT ( EVENT_APP_START + 8 )
35 #define SW_EVENT_MAIL_MERGE_END ( EVENT_APP_START + 9 )
36 #define SW_EVENT_FIELD_MERGE ( EVENT_APP_START + 10 )
37 #define SW_EVENT_FIELD_MERGE_FINISHED ( EVENT_APP_START + 11 )
38 #define SW_EVENT_LAYOUT_FINISHED ( EVENT_APP_START + 12 )
40 #define STR_SW_EVENT_PAGE_COUNT 0
41 #define STR_SW_EVENT_MAIL_MERGE 1
42 #define STR_SW_EVENT_MAIL_MERGE_END 2
43 #define STR_SW_EVENT_FIELD_MERGE 3
44 #define STR_SW_EVENT_FIELD_MERGE_FINISHED 4
45 #define STR_SW_EVENT_LAYOUT_FINISHED 5
46 #define STR_SW_EVENT_OBJECT_SELECT 6
47 #define STR_SW_EVENT_START_INS_GLOSSARY 7
48 #define STR_SW_EVENT_END_INS_GLOSSARY 8
49 #define STR_SW_EVENT_FRM_KEYINPUT_ALPHA 9
50 #define STR_SW_EVENT_FRM_KEYINPUT_NOALPHA 10
51 #define STR_SW_EVENT_FRM_RESIZE 11
52 #define STR_SW_EVENT_FRM_MOVE 12
55 class SwFormatINetFormat
;
58 // Enum for objects that call events into Basic or JavaScript.
59 enum SwCallEventObjectType
61 EVENT_OBJECT_NONE
= 0, // Null is nothing at all.
63 EVENT_OBJECT_INETATTR
,
68 // Structure for the exchange between UI/CORE.
70 struct SwCallMouseEvent
72 SwCallEventObjectType eType
;
75 // EVENT_OBJECT_IMAGE/EVENT_OBJECT_URLITEM
76 const SwFrameFormat
* pFormat
;
78 // EVENT_OBJECT_INETATTR
79 const SwFormatINetFormat
* pINetAttr
;
81 // EVENT_OBJECT_IMAGEMAP
84 const SwFrameFormat
* pFormat
;
85 const IMapObject
* pIMapObj
;
90 : eType( EVENT_OBJECT_NONE
)
91 { PTR
.pFormat
= 0; PTR
.IMAP
.pIMapObj
= 0; }
93 void Set( SwCallEventObjectType eTyp
, const SwFrameFormat
* pFormat
)
94 { eType
= eTyp
; PTR
.pFormat
= pFormat
; PTR
.IMAP
.pIMapObj
= 0; }
96 void Set( const SwFrameFormat
* pFormat
, const IMapObject
* pIMapObj
)
97 { eType
= EVENT_OBJECT_IMAGEMAP
; PTR
.pFormat
= pFormat
; PTR
.IMAP
.pIMapObj
= pIMapObj
; }
99 void Set( const SwFormatINetFormat
* pINetAttr
)
100 { eType
= EVENT_OBJECT_INETATTR
; PTR
.pINetAttr
= pINetAttr
; PTR
.IMAP
.pIMapObj
= 0; }
102 bool operator==( const SwCallMouseEvent
& rEvent
) const
104 return eType
== rEvent
.eType
&&
105 PTR
.pFormat
== rEvent
.PTR
.pFormat
&&
106 PTR
.IMAP
.pIMapObj
== rEvent
.PTR
.IMAP
.pIMapObj
;
108 bool operator!=( const SwCallMouseEvent
& rEvent
) const
109 { return !( *this == rEvent
); }
112 { eType
= EVENT_OBJECT_NONE
; PTR
.pFormat
= 0; PTR
.IMAP
.pIMapObj
= 0; }
114 bool HasEvent() const { return EVENT_OBJECT_NONE
!= eType
; }
119 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */