xref: /aoo41x/main/svx/source/items/hlnkitem.cxx (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_svx.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir // include ---------------------------------------------------------------
32*cdf0e10cSrcweir #define _SVX_HLNKITEM_CXX
33*cdf0e10cSrcweir 
34*cdf0e10cSrcweir #ifndef _SVX_SVXIDS_HRC
35*cdf0e10cSrcweir #include <svx/svxids.hrc>
36*cdf0e10cSrcweir #endif
37*cdf0e10cSrcweir #include <tools/stream.hxx>
38*cdf0e10cSrcweir 
39*cdf0e10cSrcweir #ifndef _MEMBERID_HRC
40*cdf0e10cSrcweir #include <svx/memberid.hrc>
41*cdf0e10cSrcweir #endif
42*cdf0e10cSrcweir 
43*cdf0e10cSrcweir #ifndef __SBX_SBXVARIABLE_HXX
44*cdf0e10cSrcweir #include <basic/sbxvar.hxx>
45*cdf0e10cSrcweir #endif
46*cdf0e10cSrcweir 
47*cdf0e10cSrcweir #include "svx/hlnkitem.hxx"
48*cdf0e10cSrcweir 
49*cdf0e10cSrcweir // -----------------------------------------------------------------------
50*cdf0e10cSrcweir 
51*cdf0e10cSrcweir TYPEINIT1_FACTORY(SvxHyperlinkItem, SfxPoolItem, new SvxHyperlinkItem(0));
52*cdf0e10cSrcweir 
53*cdf0e10cSrcweir // class SvxHyperlinkItem ------------------------------------------------
54*cdf0e10cSrcweir 
55*cdf0e10cSrcweir /*--------------------------------------------------------------------
56*cdf0e10cSrcweir 	Beschreibung:
57*cdf0e10cSrcweir  --------------------------------------------------------------------*/
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir #define HYPERLINKFF_MARKER	0x599401FE
60*cdf0e10cSrcweir 
61*cdf0e10cSrcweir SvStream& SvxHyperlinkItem::Store( SvStream& rStrm, sal_uInt16 /*nItemVersion*/ ) const
62*cdf0e10cSrcweir {
63*cdf0e10cSrcweir 	// store 'simple' data
64*cdf0e10cSrcweir 	// UNICODE: rStrm << sName;
65*cdf0e10cSrcweir 	rStrm.WriteByteString(sName);
66*cdf0e10cSrcweir 
67*cdf0e10cSrcweir 	// UNICODE: rStrm << sURL;
68*cdf0e10cSrcweir 	rStrm.WriteByteString(sURL);
69*cdf0e10cSrcweir 
70*cdf0e10cSrcweir 	// UNICODE: rStrm << sTarget;
71*cdf0e10cSrcweir 	rStrm.WriteByteString(sTarget);
72*cdf0e10cSrcweir 
73*cdf0e10cSrcweir 	rStrm << (sal_uInt32) eType;
74*cdf0e10cSrcweir 
75*cdf0e10cSrcweir 	// marker for versioninfo
76*cdf0e10cSrcweir 	rStrm << (sal_uInt32) HYPERLINKFF_MARKER;
77*cdf0e10cSrcweir 
78*cdf0e10cSrcweir 	// new data
79*cdf0e10cSrcweir 	// UNICODE: rStrm << sIntName;
80*cdf0e10cSrcweir 	rStrm.WriteByteString(sIntName);
81*cdf0e10cSrcweir 
82*cdf0e10cSrcweir 	// macro-events
83*cdf0e10cSrcweir 	rStrm << nMacroEvents;
84*cdf0e10cSrcweir 
85*cdf0e10cSrcweir 	// store macros
86*cdf0e10cSrcweir 	sal_uInt16 nCnt = pMacroTable ? (sal_uInt16)pMacroTable->Count() : 0;
87*cdf0e10cSrcweir 	sal_uInt16 nMax = nCnt;
88*cdf0e10cSrcweir 	if( nCnt )
89*cdf0e10cSrcweir 	{
90*cdf0e10cSrcweir 		for( SvxMacro* pMac = pMacroTable->First(); pMac; pMac = pMacroTable->Next() )
91*cdf0e10cSrcweir 			if( STARBASIC != pMac->GetScriptType() )
92*cdf0e10cSrcweir 				--nCnt;
93*cdf0e10cSrcweir 	}
94*cdf0e10cSrcweir 
95*cdf0e10cSrcweir 	rStrm << nCnt;
96*cdf0e10cSrcweir 
97*cdf0e10cSrcweir 	if( nCnt )
98*cdf0e10cSrcweir 	{
99*cdf0e10cSrcweir 		// 1. StarBasic-Macros
100*cdf0e10cSrcweir 		for( SvxMacro* pMac = pMacroTable->First(); pMac; pMac = pMacroTable->Next() )
101*cdf0e10cSrcweir 		{
102*cdf0e10cSrcweir 			if( STARBASIC == pMac->GetScriptType() )
103*cdf0e10cSrcweir 			{
104*cdf0e10cSrcweir 				rStrm << (sal_uInt16)pMacroTable->GetCurKey();
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir 				// UNICODE: rStrm << pMac->GetLibName();
107*cdf0e10cSrcweir 				rStrm.WriteByteString(pMac->GetLibName());
108*cdf0e10cSrcweir 
109*cdf0e10cSrcweir 				// UNICODE: rStrm << pMac->GetMacName();
110*cdf0e10cSrcweir 				rStrm.WriteByteString(pMac->GetMacName());
111*cdf0e10cSrcweir 			}
112*cdf0e10cSrcweir 		}
113*cdf0e10cSrcweir 	}
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir 	nCnt = nMax - nCnt;
116*cdf0e10cSrcweir 	rStrm << nCnt;
117*cdf0e10cSrcweir 	if( nCnt )
118*cdf0e10cSrcweir 	{
119*cdf0e10cSrcweir 		// 2. ::com::sun::star::script::JavaScript-Macros
120*cdf0e10cSrcweir 		for( SvxMacro* pMac = pMacroTable->First(); pMac; pMac = pMacroTable->Next() )
121*cdf0e10cSrcweir 		{
122*cdf0e10cSrcweir 			if( STARBASIC != pMac->GetScriptType() )
123*cdf0e10cSrcweir 			{
124*cdf0e10cSrcweir 				rStrm << (sal_uInt16)pMacroTable->GetCurKey();
125*cdf0e10cSrcweir 
126*cdf0e10cSrcweir 				// UNICODE: rStrm << pMac->GetLibName();
127*cdf0e10cSrcweir 				rStrm.WriteByteString(pMac->GetLibName());
128*cdf0e10cSrcweir 
129*cdf0e10cSrcweir 				// UNICODE: rStrm << pMac->GetMacName();
130*cdf0e10cSrcweir 				rStrm.WriteByteString(pMac->GetMacName());
131*cdf0e10cSrcweir 
132*cdf0e10cSrcweir 				rStrm << (sal_uInt16)pMac->GetScriptType();
133*cdf0e10cSrcweir 			}
134*cdf0e10cSrcweir 		}
135*cdf0e10cSrcweir 	}
136*cdf0e10cSrcweir 
137*cdf0e10cSrcweir 	return rStrm;
138*cdf0e10cSrcweir }
139*cdf0e10cSrcweir 
140*cdf0e10cSrcweir /*--------------------------------------------------------------------
141*cdf0e10cSrcweir 	Beschreibung:
142*cdf0e10cSrcweir  --------------------------------------------------------------------*/
143*cdf0e10cSrcweir 
144*cdf0e10cSrcweir SfxPoolItem*    SvxHyperlinkItem::Create( SvStream &rStrm, sal_uInt16 /*nItemVersion*/ ) const
145*cdf0e10cSrcweir {
146*cdf0e10cSrcweir 	SvxHyperlinkItem* pNew = new SvxHyperlinkItem( Which() );
147*cdf0e10cSrcweir 	sal_uInt32 nType;
148*cdf0e10cSrcweir 
149*cdf0e10cSrcweir 	// simple data-types
150*cdf0e10cSrcweir 	// UNICODE: rStrm >> pNew->sName;
151*cdf0e10cSrcweir 	rStrm.ReadByteString(pNew->sName);
152*cdf0e10cSrcweir 
153*cdf0e10cSrcweir 	// UNICODE: rStrm >> pNew->sURL;
154*cdf0e10cSrcweir 	rStrm.ReadByteString(pNew->sURL);
155*cdf0e10cSrcweir 
156*cdf0e10cSrcweir 	// UNICODE: rStrm >> pNew->sTarget;
157*cdf0e10cSrcweir 	rStrm.ReadByteString(pNew->sTarget);
158*cdf0e10cSrcweir 
159*cdf0e10cSrcweir 	rStrm >> nType;
160*cdf0e10cSrcweir 	pNew->eType = (SvxLinkInsertMode) nType;
161*cdf0e10cSrcweir 
162*cdf0e10cSrcweir 	sal_uInt32 nPos = rStrm.Tell();
163*cdf0e10cSrcweir 	sal_uInt32 nMarker;
164*cdf0e10cSrcweir 	rStrm >> nMarker;
165*cdf0e10cSrcweir 	if ( nMarker == HYPERLINKFF_MARKER )
166*cdf0e10cSrcweir 	{
167*cdf0e10cSrcweir 		// new data
168*cdf0e10cSrcweir 		// UNICODE: rStrm >> pNew->sIntName;
169*cdf0e10cSrcweir 		rStrm.ReadByteString(pNew->sIntName);
170*cdf0e10cSrcweir 
171*cdf0e10cSrcweir 		// macro-events
172*cdf0e10cSrcweir 		rStrm >> pNew->nMacroEvents;
173*cdf0e10cSrcweir 
174*cdf0e10cSrcweir 		// macros
175*cdf0e10cSrcweir 		sal_uInt16 nCnt;
176*cdf0e10cSrcweir 		rStrm >> nCnt;
177*cdf0e10cSrcweir 		while( nCnt-- )
178*cdf0e10cSrcweir 		{
179*cdf0e10cSrcweir 			sal_uInt16 nCurKey;
180*cdf0e10cSrcweir 			String aLibName, aMacName;
181*cdf0e10cSrcweir 
182*cdf0e10cSrcweir 			rStrm >> nCurKey;
183*cdf0e10cSrcweir 			// UNICODE: rStrm >> aLibName;
184*cdf0e10cSrcweir 			rStrm.ReadByteString(aLibName);
185*cdf0e10cSrcweir 
186*cdf0e10cSrcweir 			// UNICODE: rStrm >> aMacName;
187*cdf0e10cSrcweir 			rStrm.ReadByteString(aMacName);
188*cdf0e10cSrcweir 
189*cdf0e10cSrcweir 			pNew->SetMacro( nCurKey, SvxMacro( aMacName, aLibName, STARBASIC ) );
190*cdf0e10cSrcweir 		}
191*cdf0e10cSrcweir 
192*cdf0e10cSrcweir 		rStrm >> nCnt;
193*cdf0e10cSrcweir 		while( nCnt-- )
194*cdf0e10cSrcweir 		{
195*cdf0e10cSrcweir 			sal_uInt16 nCurKey, nScriptType;
196*cdf0e10cSrcweir 			String aLibName, aMacName;
197*cdf0e10cSrcweir 
198*cdf0e10cSrcweir 			rStrm >> nCurKey;
199*cdf0e10cSrcweir 
200*cdf0e10cSrcweir 			// UNICODE: rStrm >> aLibName;
201*cdf0e10cSrcweir 			rStrm.ReadByteString(aLibName);
202*cdf0e10cSrcweir 
203*cdf0e10cSrcweir 			// UNICODE: rStrm >> aMacName;
204*cdf0e10cSrcweir 			rStrm.ReadByteString(aMacName);
205*cdf0e10cSrcweir 
206*cdf0e10cSrcweir 			rStrm >> nScriptType;
207*cdf0e10cSrcweir 
208*cdf0e10cSrcweir 			pNew->SetMacro( nCurKey, SvxMacro( aMacName, aLibName,
209*cdf0e10cSrcweir 										(ScriptType)nScriptType ) );
210*cdf0e10cSrcweir 		}
211*cdf0e10cSrcweir 	}
212*cdf0e10cSrcweir 	else
213*cdf0e10cSrcweir 		rStrm.Seek( nPos );
214*cdf0e10cSrcweir 
215*cdf0e10cSrcweir 	return pNew;
216*cdf0e10cSrcweir }
217*cdf0e10cSrcweir 
218*cdf0e10cSrcweir /*--------------------------------------------------------------------
219*cdf0e10cSrcweir 	Beschreibung:
220*cdf0e10cSrcweir  --------------------------------------------------------------------*/
221*cdf0e10cSrcweir 
222*cdf0e10cSrcweir SvxHyperlinkItem::SvxHyperlinkItem( const SvxHyperlinkItem& rHyperlinkItem ):
223*cdf0e10cSrcweir 			SfxPoolItem(rHyperlinkItem)
224*cdf0e10cSrcweir {
225*cdf0e10cSrcweir 	sName   = rHyperlinkItem.sName;
226*cdf0e10cSrcweir 	sURL    = rHyperlinkItem.sURL;
227*cdf0e10cSrcweir 	sTarget = rHyperlinkItem.sTarget;
228*cdf0e10cSrcweir 	eType   = rHyperlinkItem.eType;
229*cdf0e10cSrcweir 	sIntName = rHyperlinkItem.sIntName;
230*cdf0e10cSrcweir 	nMacroEvents = rHyperlinkItem.nMacroEvents;
231*cdf0e10cSrcweir 
232*cdf0e10cSrcweir 	if( rHyperlinkItem.GetMacroTbl() )
233*cdf0e10cSrcweir 		pMacroTable = new SvxMacroTableDtor( *rHyperlinkItem.GetMacroTbl() );
234*cdf0e10cSrcweir 	else
235*cdf0e10cSrcweir 		pMacroTable=NULL;
236*cdf0e10cSrcweir 
237*cdf0e10cSrcweir };
238*cdf0e10cSrcweir 
239*cdf0e10cSrcweir /*--------------------------------------------------------------------
240*cdf0e10cSrcweir 	Beschreibung:
241*cdf0e10cSrcweir  --------------------------------------------------------------------*/
242*cdf0e10cSrcweir 
243*cdf0e10cSrcweir SvxHyperlinkItem::SvxHyperlinkItem( sal_uInt16 _nWhich, String& rName, String& rURL,
244*cdf0e10cSrcweir 								    String& rTarget, String& rIntName, SvxLinkInsertMode eTyp,
245*cdf0e10cSrcweir 									sal_uInt16 nEvents, SvxMacroTableDtor *pMacroTbl ):
246*cdf0e10cSrcweir     SfxPoolItem (_nWhich),
247*cdf0e10cSrcweir 	sName		(rName),
248*cdf0e10cSrcweir 	sURL    	(rURL),
249*cdf0e10cSrcweir 	sTarget 	(rTarget),
250*cdf0e10cSrcweir 	eType   	(eTyp),
251*cdf0e10cSrcweir 	sIntName (rIntName),
252*cdf0e10cSrcweir 	nMacroEvents (nEvents)
253*cdf0e10cSrcweir {
254*cdf0e10cSrcweir 	if (pMacroTbl)
255*cdf0e10cSrcweir 		pMacroTable = new SvxMacroTableDtor ( *pMacroTbl );
256*cdf0e10cSrcweir 	else
257*cdf0e10cSrcweir 		pMacroTable=NULL;
258*cdf0e10cSrcweir }
259*cdf0e10cSrcweir 
260*cdf0e10cSrcweir /*--------------------------------------------------------------------
261*cdf0e10cSrcweir 	Beschreibung:
262*cdf0e10cSrcweir  --------------------------------------------------------------------*/
263*cdf0e10cSrcweir 
264*cdf0e10cSrcweir SfxPoolItem* SvxHyperlinkItem::Clone( SfxItemPool* ) const
265*cdf0e10cSrcweir {
266*cdf0e10cSrcweir 	return new SvxHyperlinkItem( *this );
267*cdf0e10cSrcweir }
268*cdf0e10cSrcweir 
269*cdf0e10cSrcweir /*--------------------------------------------------------------------
270*cdf0e10cSrcweir 	Beschreibung:
271*cdf0e10cSrcweir  --------------------------------------------------------------------*/
272*cdf0e10cSrcweir 
273*cdf0e10cSrcweir int SvxHyperlinkItem::operator==( const SfxPoolItem& rAttr ) const
274*cdf0e10cSrcweir {
275*cdf0e10cSrcweir 	DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unterschiedliche Typen" );
276*cdf0e10cSrcweir 
277*cdf0e10cSrcweir 	const SvxHyperlinkItem& rItem = (const SvxHyperlinkItem&) rAttr;
278*cdf0e10cSrcweir 
279*cdf0e10cSrcweir 	sal_Bool bRet = ( sName   == rItem.sName   &&
280*cdf0e10cSrcweir 				  sURL    == rItem.sURL    &&
281*cdf0e10cSrcweir 				  sTarget == rItem.sTarget &&
282*cdf0e10cSrcweir 				  eType   == rItem.eType   &&
283*cdf0e10cSrcweir 				  sIntName == rItem.sIntName &&
284*cdf0e10cSrcweir 				  nMacroEvents == rItem.nMacroEvents);
285*cdf0e10cSrcweir 	if (!bRet)
286*cdf0e10cSrcweir 		return sal_False;
287*cdf0e10cSrcweir 
288*cdf0e10cSrcweir 	const SvxMacroTableDtor* pOther = ((SvxHyperlinkItem&)rAttr).pMacroTable;
289*cdf0e10cSrcweir 	if( !pMacroTable )
290*cdf0e10cSrcweir 		return ( !pOther || !pOther->Count() );
291*cdf0e10cSrcweir 	if( !pOther )
292*cdf0e10cSrcweir 		return 0 == pMacroTable->Count();
293*cdf0e10cSrcweir 
294*cdf0e10cSrcweir 	const SvxMacroTableDtor& rOwn = *pMacroTable;
295*cdf0e10cSrcweir 	const SvxMacroTableDtor& rOther = *pOther;
296*cdf0e10cSrcweir 
297*cdf0e10cSrcweir 	// Anzahl unterschiedlich => auf jeden Fall ungleich
298*cdf0e10cSrcweir 	if( rOwn.Count() != rOther.Count() )
299*cdf0e10cSrcweir 		return sal_False;
300*cdf0e10cSrcweir 
301*cdf0e10cSrcweir 	// einzeln vergleichen; wegen Performance ist die Reihenfolge wichtig
302*cdf0e10cSrcweir 	for( sal_uInt16 nNo = 0; nNo < rOwn.Count(); ++nNo )
303*cdf0e10cSrcweir 	{
304*cdf0e10cSrcweir 		const SvxMacro *pOwnMac = rOwn.GetObject(nNo);
305*cdf0e10cSrcweir 		const SvxMacro *pOtherMac = rOther.GetObject(nNo);
306*cdf0e10cSrcweir 		if ( 	rOwn.GetKey(pOwnMac) != rOther.GetKey(pOtherMac)  ||
307*cdf0e10cSrcweir 				pOwnMac->GetLibName() != pOtherMac->GetLibName() ||
308*cdf0e10cSrcweir 				pOwnMac->GetMacName() != pOtherMac->GetMacName() )
309*cdf0e10cSrcweir 			return sal_False;
310*cdf0e10cSrcweir 	}
311*cdf0e10cSrcweir 
312*cdf0e10cSrcweir 	return sal_True;
313*cdf0e10cSrcweir }
314*cdf0e10cSrcweir 
315*cdf0e10cSrcweir 
316*cdf0e10cSrcweir /*--------------------------------------------------------------------
317*cdf0e10cSrcweir 	Beschreibung:
318*cdf0e10cSrcweir  --------------------------------------------------------------------*/
319*cdf0e10cSrcweir 
320*cdf0e10cSrcweir void SvxHyperlinkItem::SetMacro( sal_uInt16 nEvent, const SvxMacro& rMacro )
321*cdf0e10cSrcweir {
322*cdf0e10cSrcweir 	if( nEvent < EVENT_SFX_START )
323*cdf0e10cSrcweir 	{
324*cdf0e10cSrcweir 		switch( nEvent )
325*cdf0e10cSrcweir 		{
326*cdf0e10cSrcweir 			case HYPERDLG_EVENT_MOUSEOVER_OBJECT:
327*cdf0e10cSrcweir 				nEvent = SFX_EVENT_MOUSEOVER_OBJECT;
328*cdf0e10cSrcweir 				break;
329*cdf0e10cSrcweir 			case HYPERDLG_EVENT_MOUSECLICK_OBJECT:
330*cdf0e10cSrcweir 				nEvent = SFX_EVENT_MOUSECLICK_OBJECT;
331*cdf0e10cSrcweir 				break;
332*cdf0e10cSrcweir 			case HYPERDLG_EVENT_MOUSEOUT_OBJECT:
333*cdf0e10cSrcweir 				nEvent = SFX_EVENT_MOUSEOUT_OBJECT;
334*cdf0e10cSrcweir 				break;
335*cdf0e10cSrcweir 		}
336*cdf0e10cSrcweir 	}
337*cdf0e10cSrcweir 
338*cdf0e10cSrcweir 	if( !pMacroTable )
339*cdf0e10cSrcweir 		pMacroTable = new SvxMacroTableDtor;
340*cdf0e10cSrcweir 
341*cdf0e10cSrcweir 	SvxMacro *pOldMacro;
342*cdf0e10cSrcweir 	if( 0 != ( pOldMacro = pMacroTable->Get( nEvent )) )
343*cdf0e10cSrcweir 	{
344*cdf0e10cSrcweir 		delete pOldMacro;
345*cdf0e10cSrcweir 		pMacroTable->Replace( nEvent, new SvxMacro( rMacro ) );
346*cdf0e10cSrcweir 	}
347*cdf0e10cSrcweir 	else
348*cdf0e10cSrcweir 		pMacroTable->Insert( nEvent, new SvxMacro( rMacro ) );
349*cdf0e10cSrcweir }
350*cdf0e10cSrcweir 
351*cdf0e10cSrcweir /*--------------------------------------------------------------------
352*cdf0e10cSrcweir 	Beschreibung:
353*cdf0e10cSrcweir  --------------------------------------------------------------------*/
354*cdf0e10cSrcweir 
355*cdf0e10cSrcweir void SvxHyperlinkItem::SetMacroTable( const SvxMacroTableDtor& rTbl )
356*cdf0e10cSrcweir {
357*cdf0e10cSrcweir 	if ( pMacroTable )
358*cdf0e10cSrcweir 		delete pMacroTable;
359*cdf0e10cSrcweir 
360*cdf0e10cSrcweir 	pMacroTable = new SvxMacroTableDtor ( rTbl );
361*cdf0e10cSrcweir }
362*cdf0e10cSrcweir 
363*cdf0e10cSrcweir sal_Bool SvxHyperlinkItem::QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId ) const
364*cdf0e10cSrcweir {
365*cdf0e10cSrcweir //    sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
366*cdf0e10cSrcweir     nMemberId &= ~CONVERT_TWIPS;
367*cdf0e10cSrcweir 	switch(nMemberId)
368*cdf0e10cSrcweir 	{
369*cdf0e10cSrcweir         case MID_HLINK_NAME   :
370*cdf0e10cSrcweir             rVal <<= ::rtl::OUString(sIntName.GetBuffer());
371*cdf0e10cSrcweir 		break;
372*cdf0e10cSrcweir         case MID_HLINK_TEXT   :
373*cdf0e10cSrcweir             rVal <<= ::rtl::OUString(sName.GetBuffer());
374*cdf0e10cSrcweir 		break;
375*cdf0e10cSrcweir         case MID_HLINK_URL:
376*cdf0e10cSrcweir             rVal <<= ::rtl::OUString(sURL.GetBuffer());
377*cdf0e10cSrcweir 		break;
378*cdf0e10cSrcweir         case MID_HLINK_TARGET:
379*cdf0e10cSrcweir             rVal <<= ::rtl::OUString(sTarget.GetBuffer());
380*cdf0e10cSrcweir 		break;
381*cdf0e10cSrcweir         case MID_HLINK_TYPE:
382*cdf0e10cSrcweir             rVal <<= (sal_Int32) eType;
383*cdf0e10cSrcweir 		break;
384*cdf0e10cSrcweir         default:
385*cdf0e10cSrcweir             return sal_False;
386*cdf0e10cSrcweir 	}
387*cdf0e10cSrcweir 
388*cdf0e10cSrcweir     return sal_True;
389*cdf0e10cSrcweir }
390*cdf0e10cSrcweir 
391*cdf0e10cSrcweir sal_Bool SvxHyperlinkItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId )
392*cdf0e10cSrcweir {
393*cdf0e10cSrcweir //    sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
394*cdf0e10cSrcweir     nMemberId &= ~CONVERT_TWIPS;
395*cdf0e10cSrcweir     ::rtl::OUString aStr;
396*cdf0e10cSrcweir     sal_Int32 nVal = 0;
397*cdf0e10cSrcweir 	switch(nMemberId)
398*cdf0e10cSrcweir 	{
399*cdf0e10cSrcweir         case MID_HLINK_NAME   :
400*cdf0e10cSrcweir 			if(!(rVal >>= aStr))
401*cdf0e10cSrcweir 				return sal_False;
402*cdf0e10cSrcweir             sIntName = aStr.getStr();
403*cdf0e10cSrcweir 		break;
404*cdf0e10cSrcweir         case MID_HLINK_TEXT   :
405*cdf0e10cSrcweir 			if(!(rVal >>= aStr))
406*cdf0e10cSrcweir 				return sal_False;
407*cdf0e10cSrcweir             sName = aStr.getStr();
408*cdf0e10cSrcweir 		break;
409*cdf0e10cSrcweir         case MID_HLINK_URL:
410*cdf0e10cSrcweir 			if(!(rVal >>= aStr))
411*cdf0e10cSrcweir 				return sal_False;
412*cdf0e10cSrcweir             sURL = aStr.getStr();
413*cdf0e10cSrcweir 		break;
414*cdf0e10cSrcweir         case MID_HLINK_TARGET:
415*cdf0e10cSrcweir 			if(!(rVal >>= aStr))
416*cdf0e10cSrcweir 				return sal_False;
417*cdf0e10cSrcweir             sTarget = aStr.getStr();
418*cdf0e10cSrcweir 		break;
419*cdf0e10cSrcweir         case MID_HLINK_TYPE:
420*cdf0e10cSrcweir             if(!(rVal >>= nVal))
421*cdf0e10cSrcweir 				return sal_False;
422*cdf0e10cSrcweir             eType = (SvxLinkInsertMode) (sal_uInt16) nVal;
423*cdf0e10cSrcweir 		break;
424*cdf0e10cSrcweir         default:
425*cdf0e10cSrcweir             return sal_False;
426*cdf0e10cSrcweir 	}
427*cdf0e10cSrcweir 
428*cdf0e10cSrcweir     return sal_True;
429*cdf0e10cSrcweir }
430*cdf0e10cSrcweir 
431