xref: /AOO41X/main/sw/source/ui/chrdlg/chardlg.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3) !
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_sw.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #ifdef SW_DLLIMPLEMENTATION
32*cdf0e10cSrcweir #undef SW_DLLIMPLEMENTATION
33*cdf0e10cSrcweir #endif
34*cdf0e10cSrcweir 
35*cdf0e10cSrcweir 
36*cdf0e10cSrcweir #include <hintids.hxx>
37*cdf0e10cSrcweir 
38*cdf0e10cSrcweir #ifndef _MSGBOX_HXX //autogen
39*cdf0e10cSrcweir #include <vcl/msgbox.hxx>
40*cdf0e10cSrcweir #endif
41*cdf0e10cSrcweir #include <svl/urihelper.hxx>
42*cdf0e10cSrcweir #include <svl/stritem.hxx>
43*cdf0e10cSrcweir #include <editeng/flstitem.hxx>
44*cdf0e10cSrcweir #include <svx/htmlmode.hxx>
45*cdf0e10cSrcweir #include <svl/cjkoptions.hxx>
46*cdf0e10cSrcweir 
47*cdf0e10cSrcweir #ifndef _CMDID_H
48*cdf0e10cSrcweir #include <cmdid.h>
49*cdf0e10cSrcweir #endif
50*cdf0e10cSrcweir #ifndef _HELPID_H
51*cdf0e10cSrcweir #include <helpid.h>
52*cdf0e10cSrcweir #endif
53*cdf0e10cSrcweir #include <swtypes.hxx>
54*cdf0e10cSrcweir #include <errhdl.hxx>
55*cdf0e10cSrcweir #ifndef _VIEW_HXX
56*cdf0e10cSrcweir #include <view.hxx>
57*cdf0e10cSrcweir #endif
58*cdf0e10cSrcweir #include <wrtsh.hxx>
59*cdf0e10cSrcweir #ifndef _DOCSH_HXX
60*cdf0e10cSrcweir #include <docsh.hxx>
61*cdf0e10cSrcweir #endif
62*cdf0e10cSrcweir #include <uitool.hxx>
63*cdf0e10cSrcweir #include <fmtinfmt.hxx>
64*cdf0e10cSrcweir #include <macassgn.hxx>
65*cdf0e10cSrcweir #ifndef _CHRDLG_HXX
66*cdf0e10cSrcweir #include <chrdlg.hxx>		// der Dialog
67*cdf0e10cSrcweir #endif
68*cdf0e10cSrcweir #include <swmodule.hxx>
69*cdf0e10cSrcweir #include <poolfmt.hxx>
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir #ifndef _GLOBALS_HRC
72*cdf0e10cSrcweir #include <globals.hrc>
73*cdf0e10cSrcweir #endif
74*cdf0e10cSrcweir #ifndef _CHRDLG_HRC
75*cdf0e10cSrcweir #include <chrdlg.hrc>
76*cdf0e10cSrcweir #endif
77*cdf0e10cSrcweir #ifndef _CHARDLG_HRC
78*cdf0e10cSrcweir #include <chardlg.hrc>
79*cdf0e10cSrcweir #endif
80*cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
81*cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/XFilePicker.hpp>
82*cdf0e10cSrcweir #include <SwStyleNameMapper.hxx>
83*cdf0e10cSrcweir #include <sfx2/filedlghelper.hxx>
84*cdf0e10cSrcweir #include <sfx2/viewfrm.hxx>
85*cdf0e10cSrcweir 
86*cdf0e10cSrcweir #include <svx/svxdlg.hxx>
87*cdf0e10cSrcweir #include <svx/svxids.hrc>
88*cdf0e10cSrcweir #include <svx/flagsdef.hxx>
89*cdf0e10cSrcweir #include <svx/dialogs.hrc>
90*cdf0e10cSrcweir 
91*cdf0e10cSrcweir using namespace ::com::sun::star::ui::dialogs;
92*cdf0e10cSrcweir using namespace ::com::sun::star::lang;
93*cdf0e10cSrcweir using namespace ::com::sun::star::uno;
94*cdf0e10cSrcweir using namespace ::sfx2;
95*cdf0e10cSrcweir 
96*cdf0e10cSrcweir /*--------------------------------------------------------------------
97*cdf0e10cSrcweir 	Beschreibung:	Der Traeger des Dialoges
98*cdf0e10cSrcweir  --------------------------------------------------------------------*/
99*cdf0e10cSrcweir 
100*cdf0e10cSrcweir 
101*cdf0e10cSrcweir SwCharDlg::SwCharDlg(Window* pParent, SwView& rVw, const SfxItemSet& rCoreSet,
102*cdf0e10cSrcweir 					 const String* pStr, sal_Bool bIsDrwTxtDlg) :
103*cdf0e10cSrcweir 	SfxTabDialog(pParent, SW_RES(DLG_CHAR), &rCoreSet, pStr != 0),
104*cdf0e10cSrcweir 	rView(rVw),
105*cdf0e10cSrcweir 	bIsDrwTxtMode(bIsDrwTxtDlg)
106*cdf0e10cSrcweir {
107*cdf0e10cSrcweir 	FreeResource();
108*cdf0e10cSrcweir 
109*cdf0e10cSrcweir 	// bspFonr fuer beide Bsp-TabPages
110*cdf0e10cSrcweir 
111*cdf0e10cSrcweir 	if(pStr)
112*cdf0e10cSrcweir 	{
113*cdf0e10cSrcweir 		String aTmp( GetText() );
114*cdf0e10cSrcweir 		aTmp += SW_RESSTR(STR_TEXTCOLL_HEADER);
115*cdf0e10cSrcweir 		aTmp += *pStr;
116*cdf0e10cSrcweir 		aTmp += ')';
117*cdf0e10cSrcweir 		SetText(aTmp);
118*cdf0e10cSrcweir 	}
119*cdf0e10cSrcweir     SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create();
120*cdf0e10cSrcweir     DBG_ASSERT(pFact, "Dialogdiet fail!");
121*cdf0e10cSrcweir     AddTabPage(TP_CHAR_STD, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_NAME ), 0 );
122*cdf0e10cSrcweir     AddTabPage(TP_CHAR_EXT, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_EFFECTS ), 0 );
123*cdf0e10cSrcweir     AddTabPage(TP_CHAR_POS, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_POSITION ), 0 );
124*cdf0e10cSrcweir     AddTabPage(TP_CHAR_TWOLN, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_CHAR_TWOLINES ), 0 );
125*cdf0e10cSrcweir 	AddTabPage(TP_CHAR_URL, SwCharURLPage::Create, 0);
126*cdf0e10cSrcweir     AddTabPage(TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), 0 );
127*cdf0e10cSrcweir 
128*cdf0e10cSrcweir     SvtCJKOptions aCJKOptions;
129*cdf0e10cSrcweir     if(bIsDrwTxtMode)
130*cdf0e10cSrcweir 	{
131*cdf0e10cSrcweir 		RemoveTabPage( TP_CHAR_URL );
132*cdf0e10cSrcweir 		RemoveTabPage( TP_BACKGROUND );
133*cdf0e10cSrcweir 		RemoveTabPage( TP_CHAR_TWOLN );
134*cdf0e10cSrcweir 	}
135*cdf0e10cSrcweir     else if(!aCJKOptions.IsDoubleLinesEnabled())
136*cdf0e10cSrcweir         RemoveTabPage( TP_CHAR_TWOLN );
137*cdf0e10cSrcweir }
138*cdf0e10cSrcweir /*--------------------------------------------------------------------
139*cdf0e10cSrcweir 	Beschreibung:
140*cdf0e10cSrcweir  --------------------------------------------------------------------*/
141*cdf0e10cSrcweir 
142*cdf0e10cSrcweir 
143*cdf0e10cSrcweir SwCharDlg::~SwCharDlg()
144*cdf0e10cSrcweir {
145*cdf0e10cSrcweir }
146*cdf0e10cSrcweir 
147*cdf0e10cSrcweir /*--------------------------------------------------------------------
148*cdf0e10cSrcweir 	Beschreibung:	FontList setzen
149*cdf0e10cSrcweir  --------------------------------------------------------------------*/
150*cdf0e10cSrcweir 
151*cdf0e10cSrcweir 
152*cdf0e10cSrcweir 
153*cdf0e10cSrcweir void SwCharDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
154*cdf0e10cSrcweir {
155*cdf0e10cSrcweir     SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool()));
156*cdf0e10cSrcweir 	switch( nId )
157*cdf0e10cSrcweir 	{
158*cdf0e10cSrcweir 		case TP_CHAR_STD:
159*cdf0e10cSrcweir 			{
160*cdf0e10cSrcweir 			SvxFontListItem aFontListItem( *( (SvxFontListItem*)
161*cdf0e10cSrcweir                ( rView.GetDocShell()->GetItem( SID_ATTR_CHAR_FONTLIST ) ) ) );
162*cdf0e10cSrcweir             aSet.Put (SvxFontListItem( aFontListItem.GetFontList(), SID_ATTR_CHAR_FONTLIST));
163*cdf0e10cSrcweir                 if(!bIsDrwTxtMode)
164*cdf0e10cSrcweir                     aSet.Put (SfxUInt32Item(SID_FLAG_TYPE,SVX_PREVIEW_CHARACTER));
165*cdf0e10cSrcweir             rPage.PageCreated(aSet);
166*cdf0e10cSrcweir 			}
167*cdf0e10cSrcweir             break;
168*cdf0e10cSrcweir 		case TP_CHAR_EXT:
169*cdf0e10cSrcweir 			if(bIsDrwTxtMode)
170*cdf0e10cSrcweir                 aSet.Put (SfxUInt16Item(SID_DISABLE_CTL,DISABLE_CASEMAP));
171*cdf0e10cSrcweir 
172*cdf0e10cSrcweir 			else
173*cdf0e10cSrcweir             {
174*cdf0e10cSrcweir                 aSet.Put (SfxUInt32Item(SID_FLAG_TYPE,SVX_PREVIEW_CHARACTER|SVX_ENABLE_FLASH));
175*cdf0e10cSrcweir             }
176*cdf0e10cSrcweir             rPage.PageCreated(aSet);
177*cdf0e10cSrcweir 			break;
178*cdf0e10cSrcweir         case TP_CHAR_POS:
179*cdf0e10cSrcweir             aSet.Put (SfxUInt32Item(SID_FLAG_TYPE,SVX_PREVIEW_CHARACTER));
180*cdf0e10cSrcweir             rPage.PageCreated(aSet);
181*cdf0e10cSrcweir         break;
182*cdf0e10cSrcweir         case TP_CHAR_TWOLN:
183*cdf0e10cSrcweir             aSet.Put (SfxUInt32Item(SID_FLAG_TYPE,SVX_PREVIEW_CHARACTER));
184*cdf0e10cSrcweir             rPage.PageCreated(aSet);
185*cdf0e10cSrcweir         break;
186*cdf0e10cSrcweir     }
187*cdf0e10cSrcweir }
188*cdf0e10cSrcweir 
189*cdf0e10cSrcweir /*-----------------14.08.96 11.28-------------------
190*cdf0e10cSrcweir 
191*cdf0e10cSrcweir --------------------------------------------------*/
192*cdf0e10cSrcweir 
193*cdf0e10cSrcweir SwCharURLPage::SwCharURLPage( 	Window* pParent,
194*cdf0e10cSrcweir 								const SfxItemSet& rCoreSet ) :
195*cdf0e10cSrcweir 	SfxTabPage( pParent, SW_RES( TP_CHAR_URL ), rCoreSet ),
196*cdf0e10cSrcweir     aURLFL (        this, SW_RES(FL_URL)),
197*cdf0e10cSrcweir 
198*cdf0e10cSrcweir     aURLFT(         this, SW_RES(FT_URL        )),
199*cdf0e10cSrcweir 	aURLED(			this, SW_RES(ED_URL        )),
200*cdf0e10cSrcweir 	aTextFT(        this, SW_RES(FT_TEXT		  )),
201*cdf0e10cSrcweir 	aTextED(        this, SW_RES(ED_TEXT		  )),
202*cdf0e10cSrcweir 	aNameFT(     	this, SW_RES(FT_NAME	)),
203*cdf0e10cSrcweir 	aNameED(     	this, SW_RES(ED_NAME)),
204*cdf0e10cSrcweir 	aTargetFrmFT(	this, SW_RES(FT_TARGET     )),
205*cdf0e10cSrcweir 	aTargetFrmLB(   this, SW_RES(LB_TARGET 	  )),
206*cdf0e10cSrcweir     aURLPB(         this, SW_RES(PB_URL        )),
207*cdf0e10cSrcweir     aEventPB(       this, SW_RES(PB_EVENT      )),
208*cdf0e10cSrcweir     aStyleFL(       this, SW_RES(FL_STYLE      )),
209*cdf0e10cSrcweir 	aVisitedFT(		this, SW_RES(FT_VISITED    )),
210*cdf0e10cSrcweir 	aVisitedLB(		this, SW_RES(LB_VISITED    )),
211*cdf0e10cSrcweir 	aNotVisitedFT(	this, SW_RES(FT_NOT_VISITED)),
212*cdf0e10cSrcweir 	aNotVisitedLB(	this, SW_RES(LB_NOT_VISITED)),
213*cdf0e10cSrcweir 	pINetItem(0),
214*cdf0e10cSrcweir 	bModified(sal_False)
215*cdf0e10cSrcweir 
216*cdf0e10cSrcweir {
217*cdf0e10cSrcweir 	FreeResource();
218*cdf0e10cSrcweir 
219*cdf0e10cSrcweir 	aEventPB.SetAccessibleRelationMemberOf(&aURLFL);
220*cdf0e10cSrcweir 
221*cdf0e10cSrcweir 	const SfxPoolItem* pItem;
222*cdf0e10cSrcweir 	SfxObjectShell* pShell;
223*cdf0e10cSrcweir 	if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_HTML_MODE, sal_False, &pItem) ||
224*cdf0e10cSrcweir 		( 0 != ( pShell = SfxObjectShell::Current()) &&
225*cdf0e10cSrcweir 					0 != (pItem = pShell->GetItem(SID_HTML_MODE))))
226*cdf0e10cSrcweir 	{
227*cdf0e10cSrcweir 		sal_uInt16 nHtmlMode = ((const SfxUInt16Item*)pItem)->GetValue();
228*cdf0e10cSrcweir 		if(HTMLMODE_ON & nHtmlMode)
229*cdf0e10cSrcweir 		{
230*cdf0e10cSrcweir             aStyleFL.Hide();
231*cdf0e10cSrcweir 			aVisitedFT.Hide();
232*cdf0e10cSrcweir 			aVisitedLB.Hide();
233*cdf0e10cSrcweir 			aNotVisitedFT.Hide();
234*cdf0e10cSrcweir 			aNotVisitedLB.Hide();
235*cdf0e10cSrcweir 		}
236*cdf0e10cSrcweir 	}
237*cdf0e10cSrcweir 
238*cdf0e10cSrcweir 	aURLPB.SetClickHdl	(LINK( this, SwCharURLPage, InsertFileHdl));
239*cdf0e10cSrcweir 	aEventPB.SetClickHdl(LINK( this, SwCharURLPage, EventHdl ));
240*cdf0e10cSrcweir 
241*cdf0e10cSrcweir 	SwView *pView = ::GetActiveView();
242*cdf0e10cSrcweir 	::FillCharStyleListBox(aVisitedLB, pView->GetDocShell());
243*cdf0e10cSrcweir 	::FillCharStyleListBox(aNotVisitedLB, pView->GetDocShell());
244*cdf0e10cSrcweir 
245*cdf0e10cSrcweir 	TargetList* pList = new TargetList;
246*cdf0e10cSrcweir 	const SfxFrame& rFrame = pView->GetViewFrame()->GetTopFrame();
247*cdf0e10cSrcweir 	rFrame.GetTargetList(*pList);
248*cdf0e10cSrcweir 	sal_uInt16 nCount = (sal_uInt16)pList->Count();
249*cdf0e10cSrcweir 	if( nCount )
250*cdf0e10cSrcweir 	{
251*cdf0e10cSrcweir 		sal_uInt16 i;
252*cdf0e10cSrcweir 
253*cdf0e10cSrcweir 		for ( i = 0; i < nCount; i++ )
254*cdf0e10cSrcweir 		{
255*cdf0e10cSrcweir 			aTargetFrmLB.InsertEntry(*pList->GetObject(i));
256*cdf0e10cSrcweir 		}
257*cdf0e10cSrcweir 		for ( i = nCount; i; i-- )
258*cdf0e10cSrcweir 		{
259*cdf0e10cSrcweir 			delete pList->GetObject( i - 1 );
260*cdf0e10cSrcweir 		}
261*cdf0e10cSrcweir 	}
262*cdf0e10cSrcweir 	delete pList;
263*cdf0e10cSrcweir 
264*cdf0e10cSrcweir 
265*cdf0e10cSrcweir }
266*cdf0e10cSrcweir 
267*cdf0e10cSrcweir /*-----------------15.08.96 09.04-------------------
268*cdf0e10cSrcweir 
269*cdf0e10cSrcweir --------------------------------------------------*/
270*cdf0e10cSrcweir 
271*cdf0e10cSrcweir SwCharURLPage::~SwCharURLPage()
272*cdf0e10cSrcweir {
273*cdf0e10cSrcweir 	delete pINetItem;
274*cdf0e10cSrcweir }
275*cdf0e10cSrcweir 
276*cdf0e10cSrcweir /*-----------------14.08.96 11.31-------------------
277*cdf0e10cSrcweir 
278*cdf0e10cSrcweir --------------------------------------------------*/
279*cdf0e10cSrcweir 
280*cdf0e10cSrcweir void SwCharURLPage::Reset(const SfxItemSet& rSet)
281*cdf0e10cSrcweir {
282*cdf0e10cSrcweir 	const SfxPoolItem* pItem;
283*cdf0e10cSrcweir 	if(SFX_ITEM_SET == rSet.GetItemState(RES_TXTATR_INETFMT, sal_False, &pItem))
284*cdf0e10cSrcweir 	{
285*cdf0e10cSrcweir 		const SwFmtINetFmt* pINetFmt = (const SwFmtINetFmt*)pItem;
286*cdf0e10cSrcweir 		aURLED.SetText( INetURLObject::decode( pINetFmt->GetValue(),
287*cdf0e10cSrcweir 										INET_HEX_ESCAPE,
288*cdf0e10cSrcweir 						   				INetURLObject::DECODE_UNAMBIGUOUS,
289*cdf0e10cSrcweir 										RTL_TEXTENCODING_UTF8 ));
290*cdf0e10cSrcweir 		aURLED.SaveValue();
291*cdf0e10cSrcweir 		aNameED.SetText(pINetFmt->GetName());
292*cdf0e10cSrcweir 		String sEntry = pINetFmt->GetVisitedFmt();
293*cdf0e10cSrcweir 		if( !sEntry.Len() )
294*cdf0e10cSrcweir 			SwStyleNameMapper::FillUIName( RES_POOLCHR_INET_VISIT, sEntry );
295*cdf0e10cSrcweir 		aVisitedLB.SelectEntry(sEntry);
296*cdf0e10cSrcweir 		sEntry = pINetFmt->GetINetFmt();
297*cdf0e10cSrcweir 		if(!sEntry.Len())
298*cdf0e10cSrcweir 			SwStyleNameMapper::FillUIName( RES_POOLCHR_INET_NORMAL, sEntry );
299*cdf0e10cSrcweir 		aNotVisitedLB.SelectEntry(sEntry);
300*cdf0e10cSrcweir 
301*cdf0e10cSrcweir 		aTargetFrmLB.SetText(pINetFmt->GetTargetFrame());
302*cdf0e10cSrcweir 		aVisitedLB.   SaveValue();
303*cdf0e10cSrcweir 		aNotVisitedLB.SaveValue();
304*cdf0e10cSrcweir 		aTargetFrmLB. SaveValue();
305*cdf0e10cSrcweir 		pINetItem = new SvxMacroItem(FN_INET_FIELD_MACRO);
306*cdf0e10cSrcweir 
307*cdf0e10cSrcweir 		if( pINetFmt->GetMacroTbl() )
308*cdf0e10cSrcweir 			pINetItem->SetMacroTable( *pINetFmt->GetMacroTbl() );
309*cdf0e10cSrcweir 	}
310*cdf0e10cSrcweir 	if(SFX_ITEM_SET == rSet.GetItemState(FN_PARAM_SELECTION, sal_False, &pItem))
311*cdf0e10cSrcweir 	{
312*cdf0e10cSrcweir 		aTextED.SetText(((const SfxStringItem*)pItem)->GetValue());
313*cdf0e10cSrcweir 		aTextFT.Enable( sal_False );
314*cdf0e10cSrcweir 		aTextED.Enable( sal_False );
315*cdf0e10cSrcweir 	}
316*cdf0e10cSrcweir }
317*cdf0e10cSrcweir 
318*cdf0e10cSrcweir /*-----------------14.08.96 11.32-------------------
319*cdf0e10cSrcweir 
320*cdf0e10cSrcweir --------------------------------------------------*/
321*cdf0e10cSrcweir 
322*cdf0e10cSrcweir sal_Bool SwCharURLPage::FillItemSet(SfxItemSet& rSet)
323*cdf0e10cSrcweir {
324*cdf0e10cSrcweir    ::rtl::OUString sURL = aURLED.GetText();
325*cdf0e10cSrcweir    if(sURL.getLength())
326*cdf0e10cSrcweir     {
327*cdf0e10cSrcweir         sURL = URIHelper::SmartRel2Abs(INetURLObject(), sURL, Link(), false );
328*cdf0e10cSrcweir         // #i100683# file URLs should be normalized in the UI
329*cdf0e10cSrcweir         static const sal_Char* pFile = "file:";
330*cdf0e10cSrcweir        sal_Int32 nLength = ((sal_Int32)sizeof(pFile)-1);
331*cdf0e10cSrcweir        if( sURL.copy(0, nLength ).equalsAsciiL( pFile, nLength ))
332*cdf0e10cSrcweir             sURL = URIHelper::simpleNormalizedMakeRelative(::rtl::OUString(), sURL);
333*cdf0e10cSrcweir     }
334*cdf0e10cSrcweir 
335*cdf0e10cSrcweir     SwFmtINetFmt aINetFmt(sURL, aTargetFrmLB.GetText());
336*cdf0e10cSrcweir 	aINetFmt.SetName(aNameED.GetText());
337*cdf0e10cSrcweir 	bModified |= aURLED.GetText() != aURLED.GetSavedValue();
338*cdf0e10cSrcweir 	bModified |= aNameED.IsModified();
339*cdf0e10cSrcweir 	bModified |= aTargetFrmLB.GetSavedValue() != aTargetFrmLB.GetText();
340*cdf0e10cSrcweir 
341*cdf0e10cSrcweir 	//zuerst die gueltigen Einstellungen setzen
342*cdf0e10cSrcweir 	String sEntry = aVisitedLB.GetSelectEntry();
343*cdf0e10cSrcweir 	sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName( sEntry, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT);
344*cdf0e10cSrcweir 	aINetFmt.SetVisitedFmtId(nId);
345*cdf0e10cSrcweir 	aINetFmt.SetVisitedFmt(nId == RES_POOLCHR_INET_VISIT ? aEmptyStr : sEntry);
346*cdf0e10cSrcweir 
347*cdf0e10cSrcweir 	sEntry = aNotVisitedLB.GetSelectEntry();
348*cdf0e10cSrcweir 	nId = SwStyleNameMapper::GetPoolIdFromUIName( sEntry, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT);
349*cdf0e10cSrcweir 	aINetFmt.SetINetFmtId( nId );
350*cdf0e10cSrcweir 	aINetFmt.SetINetFmt(nId == RES_POOLCHR_INET_NORMAL ? aEmptyStr : sEntry);
351*cdf0e10cSrcweir 
352*cdf0e10cSrcweir 	if( pINetItem && pINetItem->GetMacroTable().Count() )
353*cdf0e10cSrcweir 		aINetFmt.SetMacroTbl( &pINetItem->GetMacroTable() );
354*cdf0e10cSrcweir 
355*cdf0e10cSrcweir 	if(aVisitedLB.GetSavedValue() != aVisitedLB.GetSelectEntryPos())
356*cdf0e10cSrcweir 		bModified = sal_True;
357*cdf0e10cSrcweir 
358*cdf0e10cSrcweir 	if(aNotVisitedLB.GetSavedValue() != aNotVisitedLB.GetSelectEntryPos())
359*cdf0e10cSrcweir 		bModified = sal_True;
360*cdf0e10cSrcweir 
361*cdf0e10cSrcweir 	if(aTextED.IsModified())
362*cdf0e10cSrcweir 	{
363*cdf0e10cSrcweir 		bModified = sal_True;
364*cdf0e10cSrcweir 		rSet.Put(SfxStringItem(FN_PARAM_SELECTION, aTextED.GetText()));
365*cdf0e10cSrcweir 	}
366*cdf0e10cSrcweir 	if(bModified)
367*cdf0e10cSrcweir 		rSet.Put(aINetFmt);
368*cdf0e10cSrcweir 	return bModified;
369*cdf0e10cSrcweir }
370*cdf0e10cSrcweir 
371*cdf0e10cSrcweir 
372*cdf0e10cSrcweir /*-----------------14.08.96 11.30-------------------
373*cdf0e10cSrcweir 
374*cdf0e10cSrcweir --------------------------------------------------*/
375*cdf0e10cSrcweir 
376*cdf0e10cSrcweir SfxTabPage* SwCharURLPage::Create( 	Window* pParent,
377*cdf0e10cSrcweir 						const SfxItemSet& rAttrSet )
378*cdf0e10cSrcweir {
379*cdf0e10cSrcweir 	return ( new SwCharURLPage( pParent, rAttrSet ) );
380*cdf0e10cSrcweir }
381*cdf0e10cSrcweir 
382*cdf0e10cSrcweir /*-----------------14.08.96 15.00-------------------
383*cdf0e10cSrcweir 
384*cdf0e10cSrcweir --------------------------------------------------*/
385*cdf0e10cSrcweir 
386*cdf0e10cSrcweir IMPL_LINK( SwCharURLPage, InsertFileHdl, PushButton *, EMPTYARG )
387*cdf0e10cSrcweir {
388*cdf0e10cSrcweir     FileDialogHelper aDlgHelper( TemplateDescription::FILEOPEN_SIMPLE, 0 );
389*cdf0e10cSrcweir     if( aDlgHelper.Execute() == ERRCODE_NONE )
390*cdf0e10cSrcweir     {
391*cdf0e10cSrcweir         Reference < XFilePicker > xFP = aDlgHelper.GetFilePicker();
392*cdf0e10cSrcweir         aURLED.SetText(xFP->getFiles().getConstArray()[0]);
393*cdf0e10cSrcweir     }
394*cdf0e10cSrcweir 	return 0;
395*cdf0e10cSrcweir }
396*cdf0e10cSrcweir /*-----------------14.08.96 15.00-------------------
397*cdf0e10cSrcweir 
398*cdf0e10cSrcweir --------------------------------------------------*/
399*cdf0e10cSrcweir 
400*cdf0e10cSrcweir IMPL_LINK( SwCharURLPage, EventHdl, PushButton *, EMPTYARG )
401*cdf0e10cSrcweir {
402*cdf0e10cSrcweir 	bModified |= SwMacroAssignDlg::INetFmtDlg( this,
403*cdf0e10cSrcweir 					::GetActiveView()->GetWrtShell(), pINetItem );
404*cdf0e10cSrcweir 	return 0;
405*cdf0e10cSrcweir }
406*cdf0e10cSrcweir 
407*cdf0e10cSrcweir 
408