xref: /aoo42x/main/svx/inc/svx/hlnkitem.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 #ifndef _SVX_HLNKITEM_HXX
28 #define _SVX_HLNKITEM_HXX
29 
30 #include <tools/string.hxx>
31 #include <svl/poolitem.hxx>
32 #include <sfx2/sfxsids.hrc>
33 #include <svl/macitem.hxx>
34 #include "svx/svxdllapi.h"
35 
36 #define HYPERDLG_EVENT_MOUSEOVER_OBJECT		0x0001
37 #define HYPERDLG_EVENT_MOUSECLICK_OBJECT	0x0002
38 #define HYPERDLG_EVENT_MOUSEOUT_OBJECT		0x0004
39 
40 enum SvxLinkInsertMode
41 {
42 	HLINK_DEFAULT,
43 	HLINK_FIELD,
44 	HLINK_BUTTON,
45 	HLINK_HTMLMODE = 0x0080
46 };
47 
48 class SVX_DLLPUBLIC SvxHyperlinkItem : public SfxPoolItem
49 {
50 	String sName;
51 	String sURL;
52 	String sTarget;
53 	SvxLinkInsertMode eType;
54 
55 	String sIntName;
56 	SvxMacroTableDtor*	pMacroTable;
57 
58 	sal_uInt16 nMacroEvents;
59 
60 public:
61 	TYPEINFO();
62 
63 	SvxHyperlinkItem( sal_uInt16 _nWhich = SID_HYPERLINK_GETLINK ):
64 				SfxPoolItem(_nWhich), pMacroTable(NULL)	{ eType = HLINK_DEFAULT; nMacroEvents=0; };
65 	SvxHyperlinkItem( const SvxHyperlinkItem& rHyperlinkItem );
66 	SvxHyperlinkItem( sal_uInt16 nWhich, String& rName, String& rURL,
67 								    String& rTarget, String& rIntName,
68 									SvxLinkInsertMode eTyp = HLINK_FIELD,
69 									sal_uInt16 nEvents = 0,
70 									SvxMacroTableDtor *pMacroTbl =NULL );
71 	virtual	~SvxHyperlinkItem () { delete pMacroTable; }
72 
73 	inline SvxHyperlinkItem& operator=( const SvxHyperlinkItem &rItem );
74 
75 	virtual int 			 operator==( const SfxPoolItem& ) const;
76 	virtual SfxPoolItem*	 Clone( SfxItemPool *pPool = 0 ) const;
77 	virtual	sal_Bool        	 QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
78 	virtual	sal_Bool			 PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
79 
80 	const	String& GetName() const { return sName; }
81 	void	SetName(const String& rName) { sName = rName; }
82 
83 	const	String& GetURL() const { return sURL; }
84 	void	SetURL(const String& rURL) { sURL = rURL; }
85 
86 	const	String& GetIntName () const { return sIntName; }
87 	void	SetIntName(const String& rIntName) { sIntName = rIntName; }
88 
89 	const	String& GetTargetFrame() const { return sTarget; }
90 	void	SetTargetFrame(const String& rTarget) { sTarget = rTarget; }
91 
92 	SvxLinkInsertMode GetInsertMode() const { return eType; }
93 	void	SetInsertMode( SvxLinkInsertMode eNew ) { eType = eNew; }
94 
95 	void SetMacro( sal_uInt16 nEvent, const SvxMacro& rMacro );
96 
97 	void SetMacroTable( const SvxMacroTableDtor& rTbl );
98 	const SvxMacroTableDtor* GetMacroTbl() const	{ return pMacroTable; }
99 
100 	void SetMacroEvents (const sal_uInt16 nEvents) { nMacroEvents = nEvents; }
101 	sal_uInt16 GetMacroEvents() const { return nMacroEvents; }
102 
103 	virtual SvStream&			Store( SvStream &, sal_uInt16 nItemVersion ) const;
104 	virtual SfxPoolItem*		Create( SvStream &, sal_uInt16 nVer ) const;
105 
106 };
107 
108 #endif
109 
110 
111