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