12ee96f1cSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
32ee96f1cSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
42ee96f1cSAndrew Rist * or more contributor license agreements. See the NOTICE file
52ee96f1cSAndrew Rist * distributed with this work for additional information
62ee96f1cSAndrew Rist * regarding copyright ownership. The ASF licenses this file
72ee96f1cSAndrew Rist * to you under the Apache License, Version 2.0 (the
82ee96f1cSAndrew Rist * "License"); you may not use this file except in compliance
92ee96f1cSAndrew Rist * with the License. You may obtain a copy of the License at
10cdf0e10cSrcweir *
112ee96f1cSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir *
132ee96f1cSAndrew Rist * Unless required by applicable law or agreed to in writing,
142ee96f1cSAndrew Rist * software distributed under the License is distributed on an
152ee96f1cSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
162ee96f1cSAndrew Rist * KIND, either express or implied. See the License for the
172ee96f1cSAndrew Rist * specific language governing permissions and limitations
182ee96f1cSAndrew Rist * under the License.
19cdf0e10cSrcweir *
202ee96f1cSAndrew Rist *************************************************************/
212ee96f1cSAndrew Rist
222ee96f1cSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_cui.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir // include ---------------------------------------------------------------
28cdf0e10cSrcweir #include <vcl/settings.hxx>
29cdf0e10cSrcweir #include <unotools/viewoptions.hxx>
30cdf0e10cSrcweir #include "cuihyperdlg.hxx"
31cdf0e10cSrcweir #include "hlinettp.hxx"
32cdf0e10cSrcweir #include "hlmailtp.hxx"
33cdf0e10cSrcweir #include "hldoctp.hxx"
34cdf0e10cSrcweir #include "hldocntp.hxx"
35cdf0e10cSrcweir #include "hyperdlg.hrc"
36cdf0e10cSrcweir #include <svx/svxids.hrc> // SID_READONLY_MODE
37cdf0e10cSrcweir
38cdf0e10cSrcweir using ::com::sun::star::uno::Reference;
39cdf0e10cSrcweir using ::com::sun::star::frame::XFrame;
40cdf0e10cSrcweir
41cdf0e10cSrcweir //########################################################################
42cdf0e10cSrcweir //# #
43cdf0e10cSrcweir //# Childwindow-Wrapper-Class #
44cdf0e10cSrcweir //# #
45cdf0e10cSrcweir //########################################################################
46cdf0e10cSrcweir
SvxHlinkCtrl(sal_uInt16 _nId,SfxBindings & rBindings,SvxHpLinkDlg * pDlg)47cdf0e10cSrcweir SvxHlinkCtrl::SvxHlinkCtrl( sal_uInt16 _nId, SfxBindings & rBindings, SvxHpLinkDlg* pDlg )
48cdf0e10cSrcweir : SfxControllerItem ( _nId, rBindings )
49cdf0e10cSrcweir ,aOnlineForwarder ( SID_INTERNET_ONLINE , *this )
50cdf0e10cSrcweir ,aRdOnlyForwarder ( SID_READONLY_MODE, *this )
51cdf0e10cSrcweir {
52cdf0e10cSrcweir pParent = pDlg;
53cdf0e10cSrcweir }
54cdf0e10cSrcweir
StateChanged(sal_uInt16 nSID,SfxItemState eState,const SfxPoolItem * pState)55cdf0e10cSrcweir void SvxHlinkCtrl::StateChanged( sal_uInt16 nSID, SfxItemState eState,
56cdf0e10cSrcweir const SfxPoolItem* pState )
57cdf0e10cSrcweir {
58cdf0e10cSrcweir if ( eState == SFX_ITEM_AVAILABLE )
59cdf0e10cSrcweir {
60cdf0e10cSrcweir switch ( nSID )
61cdf0e10cSrcweir {
62cdf0e10cSrcweir case SID_INTERNET_ONLINE :
63cdf0e10cSrcweir {
64cdf0e10cSrcweir pParent->EnableInetBrowse( !( (SfxBoolItem*)pState)->GetValue() );
65cdf0e10cSrcweir }
66cdf0e10cSrcweir break;
67cdf0e10cSrcweir case SID_HYPERLINK_GETLINK :
68cdf0e10cSrcweir {
69cdf0e10cSrcweir pParent->SetPage ( (SvxHyperlinkItem*)pState);
70cdf0e10cSrcweir }
71cdf0e10cSrcweir break;
72cdf0e10cSrcweir case SID_READONLY_MODE :
73cdf0e10cSrcweir {
74cdf0e10cSrcweir pParent->SetReadOnlyMode( ( (SfxBoolItem*)pState)->GetValue() == sal_True );
75cdf0e10cSrcweir }
76cdf0e10cSrcweir break;
77cdf0e10cSrcweir }
78cdf0e10cSrcweir }
79cdf0e10cSrcweir }
80cdf0e10cSrcweir
81cdf0e10cSrcweir
82cdf0e10cSrcweir
83cdf0e10cSrcweir // -----------------------------------------------------------------------
84cdf0e10cSrcweir
85cdf0e10cSrcweir
86cdf0e10cSrcweir
87cdf0e10cSrcweir //########################################################################
88cdf0e10cSrcweir //# #
89cdf0e10cSrcweir //# Hyperlink - Dialog #
90cdf0e10cSrcweir //# #
91cdf0e10cSrcweir //########################################################################
92cdf0e10cSrcweir
93cdf0e10cSrcweir /*************************************************************************
94cdf0e10cSrcweir |*
95*a8f4084dSMatthias Seidel |* Constructor / Destructor
96cdf0e10cSrcweir |*
97cdf0e10cSrcweir |************************************************************************/
98cdf0e10cSrcweir
SvxHpLinkDlg(Window * pParent,SfxBindings * pBindings)99cdf0e10cSrcweir SvxHpLinkDlg::SvxHpLinkDlg (Window* pParent, SfxBindings* pBindings)
100cdf0e10cSrcweir : IconChoiceDialog( pParent, CUI_RES ( RID_SVXDLG_NEWHYPERLINK ) ),
101cdf0e10cSrcweir maCtrl ( SID_HYPERLINK_GETLINK, *pBindings, this ),
102cdf0e10cSrcweir mpBindings ( pBindings ),
103cdf0e10cSrcweir mbReadOnly ( sal_False ),
104cdf0e10cSrcweir mbIsHTMLDoc ( sal_False )
105cdf0e10cSrcweir {
106cdf0e10cSrcweir SetUniqueId( HID_HYPERLINK_DIALOG );
107cdf0e10cSrcweir mbGrabFocus = sal_True;
108cdf0e10cSrcweir // insert pages
109cdf0e10cSrcweir Image aImage;
110cdf0e10cSrcweir Image aImageHC;
111cdf0e10cSrcweir String aStrTitle;
112cdf0e10cSrcweir SvxIconChoiceCtrlEntry* pEntry = NULL;
113cdf0e10cSrcweir
114cdf0e10cSrcweir aStrTitle = CUI_RESSTR( RID_SVXSTR_HYPERDLG_HLINETTP );
115cdf0e10cSrcweir aImage = Image( CUI_RES ( RID_SVXBMP_HLINETTP ) );
116cdf0e10cSrcweir aImageHC = Image( CUI_RES ( RID_SVXBMP_HLINETTP_H ) );
117cdf0e10cSrcweir pEntry = AddTabPage ( RID_SVXPAGE_HYPERLINK_INTERNET, aStrTitle, aImage, aImageHC, SvxHyperlinkInternetTp::Create );
118cdf0e10cSrcweir pEntry->SetQuickHelpText( CUI_RESSTR( RID_SVXSTR_HYPERDLG_HLINETTP_HELP ) );
119cdf0e10cSrcweir aStrTitle = CUI_RESSTR( RID_SVXSTR_HYPERDLG_HLMAILTP );
120cdf0e10cSrcweir aImage = Image( CUI_RES ( RID_SVXBMP_HLMAILTP ) );
121cdf0e10cSrcweir aImageHC = Image( CUI_RES ( RID_SVXBMP_HLMAILTP_H ) );
122cdf0e10cSrcweir pEntry = AddTabPage ( RID_SVXPAGE_HYPERLINK_MAIL, aStrTitle, aImage, aImageHC, SvxHyperlinkMailTp::Create );
123cdf0e10cSrcweir pEntry->SetQuickHelpText( CUI_RESSTR( RID_SVXSTR_HYPERDLG_HLMAILTP_HELP ) );
124cdf0e10cSrcweir aStrTitle = CUI_RESSTR( RID_SVXSTR_HYPERDLG_HLDOCTP );
125cdf0e10cSrcweir aImage = Image( CUI_RES ( RID_SVXBMP_HLDOCTP ) );
126cdf0e10cSrcweir aImageHC = Image( CUI_RES ( RID_SVXBMP_HLDOCTP_H ) );
127cdf0e10cSrcweir pEntry = AddTabPage ( RID_SVXPAGE_HYPERLINK_DOCUMENT, aStrTitle, aImage, aImageHC, SvxHyperlinkDocTp::Create );
128cdf0e10cSrcweir pEntry->SetQuickHelpText( CUI_RESSTR( RID_SVXSTR_HYPERDLG_HLDOCTP_HELP ) );
129cdf0e10cSrcweir aStrTitle = CUI_RESSTR( RID_SVXSTR_HYPERDLG_HLDOCNTP );
130cdf0e10cSrcweir aImage = Image( CUI_RES ( RID_SVXBMP_HLDOCNTP ) );
131cdf0e10cSrcweir aImageHC = Image( CUI_RES ( RID_SVXBMP_HLDOCNTP_H ) );
132cdf0e10cSrcweir pEntry = AddTabPage ( RID_SVXPAGE_HYPERLINK_NEWDOCUMENT, aStrTitle, aImage, aImageHC, SvxHyperlinkNewDocTp::Create );
133cdf0e10cSrcweir pEntry->SetQuickHelpText( CUI_RESSTR( RID_SVXSTR_HYPERDLG_HLDOCNTP_HELP ) );
134cdf0e10cSrcweir
135cdf0e10cSrcweir // create itemset for tabpages
136cdf0e10cSrcweir mpItemSet = new SfxItemSet( SFX_APP()->GetPool(), SID_HYPERLINK_GETLINK,
137cdf0e10cSrcweir SID_HYPERLINK_SETLINK );
138cdf0e10cSrcweir
139cdf0e10cSrcweir SvxHyperlinkItem aItem;
140cdf0e10cSrcweir mpItemSet->Put (aItem, SID_HYPERLINK_GETLINK);
141cdf0e10cSrcweir
142cdf0e10cSrcweir SetInputSet (mpItemSet);
143cdf0e10cSrcweir
144cdf0e10cSrcweir // Init Dialog
145cdf0e10cSrcweir Start (sal_False);
146cdf0e10cSrcweir
147cdf0e10cSrcweir pBindings->Update( SID_READONLY_MODE );
148cdf0e10cSrcweir
149cdf0e10cSrcweir // set OK/Cancel - button
150cdf0e10cSrcweir GetOKButton().SetText ( CUI_RESSTR(RID_SVXSTR_HYPDLG_APPLYBUT) );
151cdf0e10cSrcweir GetCancelButton().SetText ( CUI_RESSTR(RID_SVXSTR_HYPDLG_CLOSEBUT) );
152cdf0e10cSrcweir
153cdf0e10cSrcweir GetOKButton().SetClickHdl ( LINK ( this, SvxHpLinkDlg, ClickApplyHdl_Impl ) );
154cdf0e10cSrcweir GetCancelButton().SetClickHdl( LINK ( this, SvxHpLinkDlg, ClickCloseHdl_Impl ) );
155cdf0e10cSrcweir }
156cdf0e10cSrcweir
~SvxHpLinkDlg()157cdf0e10cSrcweir SvxHpLinkDlg::~SvxHpLinkDlg ()
158cdf0e10cSrcweir {
159cdf0e10cSrcweir // delete config item, so the base class (IconChoiceDialog) can not load it on the next start
160cdf0e10cSrcweir SvtViewOptions aViewOpt( E_TABDIALOG, String::CreateFromInt32( SID_HYPERLINK_DIALOG ) );
161cdf0e10cSrcweir aViewOpt.Delete();
162cdf0e10cSrcweir
163cdf0e10cSrcweir delete mpItemSet;
164cdf0e10cSrcweir }
165cdf0e10cSrcweir
166cdf0e10cSrcweir /*************************************************************************
167cdf0e10cSrcweir |*
168cdf0e10cSrcweir |* Close Dialog-Window
169cdf0e10cSrcweir |*
170cdf0e10cSrcweir |************************************************************************/
171cdf0e10cSrcweir
Close()172cdf0e10cSrcweir sal_Bool SvxHpLinkDlg::Close()
173cdf0e10cSrcweir {
174cdf0e10cSrcweir GetDispatcher()->Execute( SID_HYPERLINK_DIALOG,
175cdf0e10cSrcweir SFX_CALLMODE_ASYNCHRON |
176cdf0e10cSrcweir SFX_CALLMODE_RECORD);
177cdf0e10cSrcweir return sal_True;
178cdf0e10cSrcweir }
179cdf0e10cSrcweir
180cdf0e10cSrcweir /*************************************************************************
181cdf0e10cSrcweir |*
182cdf0e10cSrcweir |* When extrawindow is visible and its never moved by user, then move that
183cdf0e10cSrcweir |* window, too.
184cdf0e10cSrcweir |*
185cdf0e10cSrcweir |************************************************************************/
186cdf0e10cSrcweir
Move()187cdf0e10cSrcweir void SvxHpLinkDlg::Move()
188cdf0e10cSrcweir {
189cdf0e10cSrcweir SvxHyperlinkTabPageBase* pCurrentPage = ( SvxHyperlinkTabPageBase* )
190cdf0e10cSrcweir GetTabPage ( GetCurPageId() );
191cdf0e10cSrcweir
192cdf0e10cSrcweir if( pCurrentPage->IsMarkWndVisible () )
193cdf0e10cSrcweir {
194cdf0e10cSrcweir // Pos&Size of this dialog-window
195cdf0e10cSrcweir Point aDlgPos ( GetPosPixel () );
196cdf0e10cSrcweir Size aDlgSize ( GetSizePixel () );
197cdf0e10cSrcweir
198cdf0e10cSrcweir // Size of Office-Main-Window
199cdf0e10cSrcweir Size aWindowSize( SFX_APP()->GetTopWindow()->GetSizePixel() );
200cdf0e10cSrcweir
201cdf0e10cSrcweir // Size of Extrawindow
202cdf0e10cSrcweir Size aExtraWndSize( pCurrentPage->GetSizeExtraWnd() );
203cdf0e10cSrcweir
204cdf0e10cSrcweir sal_Bool bDoInvalid ;
205cdf0e10cSrcweir if( aDlgPos.X()+(1.02*aDlgSize.Width())+aExtraWndSize.Width() > aWindowSize.Width() )
206cdf0e10cSrcweir {
207cdf0e10cSrcweir if( aDlgPos.X() - ( 0.02*aDlgSize.Width() ) - aExtraWndSize.Width() < 0 )
208cdf0e10cSrcweir {
209cdf0e10cSrcweir // Pos Extrawindow anywhere
210cdf0e10cSrcweir bDoInvalid = pCurrentPage->MoveToExtraWnd( Point( 1, long(1.1*aDlgPos.Y()) ), sal_True );
211cdf0e10cSrcweir }
212cdf0e10cSrcweir else
213cdf0e10cSrcweir {
214cdf0e10cSrcweir // Pos Extrawindow on the left side of Dialog
215cdf0e10cSrcweir bDoInvalid = pCurrentPage->MoveToExtraWnd( aDlgPos -
216cdf0e10cSrcweir Point( long(0.02*aDlgSize.Width()), 0 ) -
217cdf0e10cSrcweir Point( aExtraWndSize.Width(), 0 ) );
218cdf0e10cSrcweir }
219cdf0e10cSrcweir }
220cdf0e10cSrcweir else
221cdf0e10cSrcweir {
222cdf0e10cSrcweir // Pos Extrawindow on the right side of Dialog
223cdf0e10cSrcweir bDoInvalid = pCurrentPage->MoveToExtraWnd ( aDlgPos + Point( long(1.02*aDlgSize.Width()), 0 ) );
224cdf0e10cSrcweir }
225cdf0e10cSrcweir
226cdf0e10cSrcweir if ( bDoInvalid )
227cdf0e10cSrcweir Invalidate(INVALIDATE_BACKGROUND);
228cdf0e10cSrcweir }
229cdf0e10cSrcweir
230cdf0e10cSrcweir Window::Move();
231cdf0e10cSrcweir }
232cdf0e10cSrcweir
233cdf0e10cSrcweir /*long SvxHpLinkDlg::PreNotify( NotifyEvent& rNEvt )
234cdf0e10cSrcweir {
235cdf0e10cSrcweir long nRet = 0;
236cdf0e10cSrcweir
237cdf0e10cSrcweir if( rNEvt.GetType() == EVENT_KEYINPUT )
238cdf0e10cSrcweir {
239cdf0e10cSrcweir DBG_ASSERT( rNEvt.GetKeyEvent(), "-SvxHpLinkDlg::PreNotify(): no KeyEvent for key event?!" );
240cdf0e10cSrcweir
241cdf0e10cSrcweir const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
242cdf0e10cSrcweir
243cdf0e10cSrcweir if( KEY_MOD2 == pKEvt->GetKeyCode().GetModifier() && pKEvt->GetCharCode() && HandleShortCutKey( *pKEvt ) )
244cdf0e10cSrcweir nRet = 1;
245cdf0e10cSrcweir }
246cdf0e10cSrcweir
247cdf0e10cSrcweir if( !nRet )
248cdf0e10cSrcweir nRet = IconChoiceDialog::PreNotify( rNEvt );
249cdf0e10cSrcweir
250cdf0e10cSrcweir return nRet;
251cdf0e10cSrcweir }*/
252cdf0e10cSrcweir
253cdf0e10cSrcweir /*************************************************************************
254cdf0e10cSrcweir |*
255cdf0e10cSrcweir |* Click on Apply-button
256cdf0e10cSrcweir |*
257cdf0e10cSrcweir |************************************************************************/
258cdf0e10cSrcweir
IMPL_LINK(SvxHpLinkDlg,ClickApplyHdl_Impl,void *,EMPTYARG)259cdf0e10cSrcweir IMPL_LINK ( SvxHpLinkDlg, ClickApplyHdl_Impl, void *, EMPTYARG )
260cdf0e10cSrcweir {
261cdf0e10cSrcweir SfxItemSet aItemSet( SFX_APP()->GetPool(), SID_HYPERLINK_GETLINK,
262cdf0e10cSrcweir SID_HYPERLINK_SETLINK );
263cdf0e10cSrcweir
264cdf0e10cSrcweir SvxHyperlinkTabPageBase* pCurrentPage = (SvxHyperlinkTabPageBase*)
265cdf0e10cSrcweir GetTabPage ( GetCurPageId() );
266cdf0e10cSrcweir
267cdf0e10cSrcweir if ( pCurrentPage->AskApply() )
268cdf0e10cSrcweir {
269cdf0e10cSrcweir pCurrentPage->FillItemSet( aItemSet );
270cdf0e10cSrcweir
271cdf0e10cSrcweir SvxHyperlinkItem *aItem = (SvxHyperlinkItem *)
272cdf0e10cSrcweir aItemSet.GetItem (SID_HYPERLINK_SETLINK);
273cdf0e10cSrcweir
274cdf0e10cSrcweir String aStrEmpty;
275cdf0e10cSrcweir if ( aItem->GetURL() != aStrEmpty )
276cdf0e10cSrcweir GetDispatcher()->Execute( SID_HYPERLINK_SETLINK, SFX_CALLMODE_ASYNCHRON |
277cdf0e10cSrcweir SFX_CALLMODE_RECORD, aItem, 0L);
278cdf0e10cSrcweir
279cdf0e10cSrcweir ( (SvxHyperlinkTabPageBase*)GetTabPage ( GetCurPageId() ) )->DoApply();
280cdf0e10cSrcweir }
281cdf0e10cSrcweir
282cdf0e10cSrcweir return( 0L );
283cdf0e10cSrcweir }
284cdf0e10cSrcweir
285cdf0e10cSrcweir /*************************************************************************
286cdf0e10cSrcweir |*
287cdf0e10cSrcweir |* Click on Close-button
288cdf0e10cSrcweir |*
289cdf0e10cSrcweir |************************************************************************/
290cdf0e10cSrcweir
IMPL_LINK(SvxHpLinkDlg,ClickCloseHdl_Impl,void *,EMPTYARG)291cdf0e10cSrcweir IMPL_LINK ( SvxHpLinkDlg, ClickCloseHdl_Impl, void *, EMPTYARG )
292cdf0e10cSrcweir {
293cdf0e10cSrcweir Close();
294cdf0e10cSrcweir
295cdf0e10cSrcweir return( 0L );
296cdf0e10cSrcweir }
297cdf0e10cSrcweir
298cdf0e10cSrcweir /*************************************************************************
299cdf0e10cSrcweir |*
300cdf0e10cSrcweir |* Set Page
301cdf0e10cSrcweir |*
302cdf0e10cSrcweir |************************************************************************/
303cdf0e10cSrcweir
SetPage(SvxHyperlinkItem * pItem)304cdf0e10cSrcweir sal_uInt16 SvxHpLinkDlg::SetPage ( SvxHyperlinkItem* pItem )
305cdf0e10cSrcweir {
306cdf0e10cSrcweir sal_uInt16 nPageId = RID_SVXPAGE_HYPERLINK_INTERNET;
307cdf0e10cSrcweir
308cdf0e10cSrcweir String aStrURL ( pItem->GetURL() );
309cdf0e10cSrcweir INetURLObject aURL ( aStrURL );
310cdf0e10cSrcweir INetProtocol eProtocolTyp = aURL.GetProtocol();
311cdf0e10cSrcweir
312cdf0e10cSrcweir switch ( eProtocolTyp )
313cdf0e10cSrcweir {
314cdf0e10cSrcweir case INET_PROT_HTTP :
315cdf0e10cSrcweir case INET_PROT_FTP :
316cdf0e10cSrcweir case INET_PROT_TELNET :
317cdf0e10cSrcweir nPageId = RID_SVXPAGE_HYPERLINK_INTERNET;
318cdf0e10cSrcweir break;
319cdf0e10cSrcweir case INET_PROT_FILE :
320cdf0e10cSrcweir case INET_PROT_POP3 :
321cdf0e10cSrcweir case INET_PROT_IMAP :
322cdf0e10cSrcweir nPageId = RID_SVXPAGE_HYPERLINK_DOCUMENT;
323cdf0e10cSrcweir break;
324cdf0e10cSrcweir case INET_PROT_MAILTO :
325cdf0e10cSrcweir case INET_PROT_NEWS :
326cdf0e10cSrcweir nPageId = RID_SVXPAGE_HYPERLINK_MAIL;
327cdf0e10cSrcweir break;
328cdf0e10cSrcweir default :
329cdf0e10cSrcweir sal_Char const sNewsSrvScheme[] = "news://";
330cdf0e10cSrcweir // TODO news:// is nonsense
331cdf0e10cSrcweir
332cdf0e10cSrcweir if ( aStrURL.SearchAscii( sNewsSrvScheme ) == 0 )
333cdf0e10cSrcweir nPageId = RID_SVXPAGE_HYPERLINK_DOCUMENT;
334cdf0e10cSrcweir else
335cdf0e10cSrcweir {
336cdf0e10cSrcweir sal_Char const sHash[] = "#";
337cdf0e10cSrcweir if( aStrURL.SearchAscii( sHash ) == 0 )
338cdf0e10cSrcweir nPageId = RID_SVXPAGE_HYPERLINK_DOCUMENT;
339cdf0e10cSrcweir else
340cdf0e10cSrcweir {
341cdf0e10cSrcweir eProtocolTyp = INET_PROT_NOT_VALID;
342cdf0e10cSrcweir nPageId = GetCurPageId();
343cdf0e10cSrcweir }
344cdf0e10cSrcweir }
345cdf0e10cSrcweir break;
346cdf0e10cSrcweir }
347cdf0e10cSrcweir
348cdf0e10cSrcweir ShowPage (nPageId);
349cdf0e10cSrcweir
350cdf0e10cSrcweir SvxHyperlinkTabPageBase* pCurrentPage = (SvxHyperlinkTabPageBase*)GetTabPage( nPageId );
351cdf0e10cSrcweir
352cdf0e10cSrcweir mbIsHTMLDoc = (pItem->GetInsertMode() & HLINK_HTMLMODE) ? true : false;
353cdf0e10cSrcweir
354cdf0e10cSrcweir SfxItemSet& aPageSet = (SfxItemSet&)GetTabPage (nPageId)->GetItemSet ();
355cdf0e10cSrcweir aPageSet.Put ( *pItem );
356cdf0e10cSrcweir
357cdf0e10cSrcweir pCurrentPage->Reset( aPageSet );
358cdf0e10cSrcweir if ( mbGrabFocus )
359cdf0e10cSrcweir {
360cdf0e10cSrcweir pCurrentPage->SetInitFocus(); // #92535# grab the focus only once at initialization
361cdf0e10cSrcweir mbGrabFocus = sal_False;
362cdf0e10cSrcweir }
363cdf0e10cSrcweir return nPageId;
364cdf0e10cSrcweir }
365cdf0e10cSrcweir
366cdf0e10cSrcweir /*************************************************************************
367cdf0e10cSrcweir |*
368cdf0e10cSrcweir |* Enable/Disable to browse targets in a html-doc
369cdf0e10cSrcweir |*
370cdf0e10cSrcweir |************************************************************************/
371cdf0e10cSrcweir
EnableInetBrowse(sal_Bool bEnable)372cdf0e10cSrcweir void SvxHpLinkDlg::EnableInetBrowse( sal_Bool bEnable )
373cdf0e10cSrcweir {
374cdf0e10cSrcweir SvxHyperlinkTabPageBase* pCurrentPage = ( SvxHyperlinkTabPageBase* )
375cdf0e10cSrcweir GetTabPage ( GetCurPageId() );
376cdf0e10cSrcweir pCurrentPage->SetOnlineMode( bEnable );
377cdf0e10cSrcweir }
378cdf0e10cSrcweir
379cdf0e10cSrcweir /*************************************************************************
380cdf0e10cSrcweir |*
381cdf0e10cSrcweir |* Enable/Disable ReadOnly mode
382cdf0e10cSrcweir |*
383cdf0e10cSrcweir |************************************************************************/
384cdf0e10cSrcweir
SetReadOnlyMode(sal_Bool bRdOnly)385cdf0e10cSrcweir void SvxHpLinkDlg::SetReadOnlyMode( sal_Bool bRdOnly )
386cdf0e10cSrcweir {
387cdf0e10cSrcweir mbReadOnly = bRdOnly;
388cdf0e10cSrcweir if ( bRdOnly )
389cdf0e10cSrcweir GetOKButton().Disable();
390cdf0e10cSrcweir else
391cdf0e10cSrcweir GetOKButton().Enable();
392cdf0e10cSrcweir }
393cdf0e10cSrcweir
394cdf0e10cSrcweir /*************************************************************************
395cdf0e10cSrcweir |*
396cdf0e10cSrcweir |* late-initialization of newly created pages
397cdf0e10cSrcweir |*
398cdf0e10cSrcweir |************************************************************************/
399cdf0e10cSrcweir
PageCreated(sal_uInt16,IconChoicePage & rPage)400cdf0e10cSrcweir void SvxHpLinkDlg::PageCreated( sal_uInt16 /*nId*/, IconChoicePage& rPage )
401cdf0e10cSrcweir {
402cdf0e10cSrcweir SvxHyperlinkTabPageBase& rHyperlinkPage = dynamic_cast< SvxHyperlinkTabPageBase& >( rPage );
403cdf0e10cSrcweir Reference< XFrame > xDocumentFrame;
404cdf0e10cSrcweir if ( mpBindings )
405cdf0e10cSrcweir xDocumentFrame = mpBindings->GetActiveFrame();
406cdf0e10cSrcweir OSL_ENSURE( xDocumentFrame.is(), "SvxHpLinkDlg::PageCreated: macro assignment functionality won't work with a proper frame!" );
407cdf0e10cSrcweir rHyperlinkPage.SetDocumentFrame( xDocumentFrame );
408cdf0e10cSrcweir }
409