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