Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_SW_INC_SWEVENT_HXX
21 : #define INCLUDED_SW_INC_SWEVENT_HXX
22 :
23 : #include <tools/solar.h>
24 : #include <sfx2/sfx.hrc>
25 :
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 )
39 :
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
53 :
54 : class SwFrmFmt;
55 : class SwFmtINetFmt;
56 : class IMapObject;
57 :
58 : // Enum for objects that call events into Basic or JavaScript.
59 : enum SwCallEventObjectType
60 : {
61 : EVENT_OBJECT_NONE = 0, // Null is nothing at all.
62 : EVENT_OBJECT_IMAGE,
63 : EVENT_OBJECT_INETATTR,
64 : EVENT_OBJECT_URLITEM,
65 : EVENT_OBJECT_IMAGEMAP
66 : };
67 :
68 : // Structure for the exchange between UI/CORE.
69 :
70 : struct SwCallMouseEvent
71 : {
72 : SwCallEventObjectType eType;
73 : union
74 : {
75 : // EVENT_OBJECT_IMAGE/EVENT_OBJECT_URLITEM
76 : const SwFrmFmt* pFmt;
77 :
78 : // EVENT_OBJECT_INETATTR
79 : const SwFmtINetFmt* pINetAttr;
80 :
81 : // EVENT_OBJECT_IMAGEMAP
82 : struct
83 : {
84 : const SwFrmFmt* pFmt;
85 : const IMapObject* pIMapObj;
86 : } IMAP;
87 : } PTR;
88 :
89 0 : SwCallMouseEvent()
90 0 : : eType( EVENT_OBJECT_NONE )
91 0 : { PTR.pFmt = 0; PTR.IMAP.pIMapObj = 0; }
92 :
93 0 : void Set( SwCallEventObjectType eTyp, const SwFrmFmt* pFmt )
94 0 : { eType = eTyp; PTR.pFmt = pFmt; PTR.IMAP.pIMapObj = 0; }
95 :
96 0 : void Set( const SwFrmFmt* pFmt, const IMapObject* pIMapObj )
97 0 : { eType = EVENT_OBJECT_IMAGEMAP; PTR.pFmt = pFmt; PTR.IMAP.pIMapObj = pIMapObj; }
98 :
99 0 : void Set( const SwFmtINetFmt* pINetAttr )
100 0 : { eType = EVENT_OBJECT_INETATTR; PTR.pINetAttr = pINetAttr; PTR.IMAP.pIMapObj = 0; }
101 :
102 0 : bool operator==( const SwCallMouseEvent& rEvent ) const
103 : {
104 0 : return eType == rEvent.eType &&
105 0 : PTR.pFmt == rEvent.PTR.pFmt &&
106 0 : PTR.IMAP.pIMapObj == rEvent.PTR.IMAP.pIMapObj;
107 : }
108 0 : bool operator!=( const SwCallMouseEvent& rEvent ) const
109 0 : { return !( *this == rEvent ); }
110 :
111 0 : void Clear()
112 0 : { eType = EVENT_OBJECT_NONE; PTR.pFmt = 0; PTR.IMAP.pIMapObj = 0; }
113 :
114 0 : sal_Bool HasEvent() const { return EVENT_OBJECT_NONE != eType; }
115 : };
116 :
117 : #endif
118 :
119 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|