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