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