xref: /aoo41x/main/cui/source/inc/hltpbase.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _SVX_TABBASE_HYPERLINK_HXX
28 #define _SVX_TABBASE_HYPERLINK_HXX
29 
30 #define INET_TELNET_SCHEME		"telnet://"
31 
32 #include <sfx2/app.hxx>
33 #include <sfx2/tabdlg.hxx>
34 #include <vcl/group.hxx>
35 #include <vcl/button.hxx>
36 #include <vcl/fixed.hxx>
37 #include <vcl/combobox.hxx>
38 #include <vcl/edit.hxx>
39 #include <vcl/lstbox.hxx>
40 #include <tools/urlobj.hxx>
41 #include <svl/stritem.hxx>
42 #include <svl/eitem.hxx>
43 #include <svtools/transfer.hxx>
44 #include <sfx2/dispatch.hxx>
45 #include <vcl/msgbox.hxx>
46 #include <sfx2/fcontnr.hxx>
47 #include <svtools/inettbc.hxx>
48 #include <vcl/timer.hxx>
49 
50 #include <dialmgr.hxx>
51 #include <sfx2/docfile.hxx>
52 #include <cuires.hrc>
53 #include <com/sun/star/frame/XFrame.hpp>
54 #include "helpid.hrc"
55 #include <svx/hlnkitem.hxx>
56 
57 #include "hlmarkwn.hxx"
58 #include "iconcdlg.hxx"
59 
60 
61 /*************************************************************************
62 |*
63 |* ComboBox-Control, wich is filled with all current framenames
64 |*
65 \************************************************************************/
66 
67 class SvxFramesComboBox : public ComboBox
68 {
69 public:
70     SvxFramesComboBox (Window* pParent, const ResId& rResId, SfxDispatcher* pDispatch);
71 	~SvxFramesComboBox ();
72 };
73 
74 /*************************************************************************
75 |*
76 |* ComboBox-Control for URL's with History and Autocompletion
77 |*
78 \************************************************************************/
79 
80 class SvxHyperURLBox : public SvtURLBox, public DropTargetHelper
81 {
82 private:
83 	sal_Bool   mbAccessAddress;
84 
85 //	String GetAllEmailNamesFromDragItem( sal_uInt16 nItem );
86 
87 protected:
88 
89 	virtual sal_Int8    AcceptDrop( const AcceptDropEvent& rEvt );
90 	virtual sal_Int8    ExecuteDrop( const ExecuteDropEvent& rEvt );
91 
92 	virtual long        Notify( NotifyEvent& rNEvt );
93 	virtual void        Select();
94 	virtual void        Modify();
95 	virtual long        PreNotify( NotifyEvent& rNEvt );
96 
97 public:
98 	SvxHyperURLBox( Window* pParent, INetProtocol eSmart = INET_PROT_FILE, sal_Bool bAddresses = sal_False );
99 
100 };
101 
102 /*************************************************************************
103 |*
104 |* Tabpage : Basisclass
105 |*
106 \************************************************************************/
107 
108 class SvxHyperlinkTabPageBase : public IconChoicePage
109 {
110 private:
111 	FixedLine           *mpGrpMore;
112 	FixedText			*mpFtFrame;
113 	SvxFramesComboBox	*mpCbbFrame;
114 	FixedText			*mpFtForm;
115 	ListBox				*mpLbForm;
116 	FixedText			*mpFtIndication;
117 	Edit				*mpEdIndication;
118 	FixedText			*mpFtText;
119 	Edit				*mpEdText;
120 	ImageButton			*mpBtScript;
121 
122     sal_Bool            mbIsCloseDisabled;
123 
124     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >
125                         mxDocumentFrame;
126 
127 protected:
128 	Window*				mpDialog;
129 
130 	sal_Bool				mbStdControlsInit;
131 
132 	String				maStrInitURL;
133 
134 	Timer				maTimer;
135 
136 	SvxHlinkDlgMarkWnd* mpMarkWnd;
137 
138 	void InitStdControls ();
139 	virtual void FillStandardDlgFields ( SvxHyperlinkItem* pHyperlinkItem );
140 	virtual void FillDlgFields         ( String& aStrURL ) = 0;
141 	virtual void GetCurentItemData     ( String& aStrURL, String& aStrName,
142 		                                 String& aStrIntName, String& aStrFrame,
143 									     SvxLinkInsertMode& eMode ) = 0;
144 	virtual String CreateUiNameFromURL( const String& aStrURL );
145 
146 	void		 GetDataFromCommonFields( String& aStrName,
147 										  String& aStrIntName, String& aStrFrame,
148 										  SvxLinkInsertMode& eMode );
149 
150 	DECL_LINK (ClickScriptHdl_Impl, void * );		// Button : Script
151 
152 	String				aEmptyStr;
153 
154 	sal_Bool			FileExists( const INetURLObject& rURL );
155     static String   GetSchemeFromURL( String aStrURL );
156 
157     inline void     DisableClose( sal_Bool _bDisable ) { mbIsCloseDisabled = _bDisable; }
158 
159 public:
160 	SvxHyperlinkTabPageBase (
161         Window *pParent,
162         const ResId &rResId,
163         const SfxItemSet& rItemSet
164     );
165 	virtual ~SvxHyperlinkTabPageBase ();
166 
167     void    SetDocumentFrame(
168         const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxDocumentFrame )
169     {
170         mxDocumentFrame = rxDocumentFrame;
171     }
172 
173 	virtual sal_Bool AskApply ();
174 	virtual void DoApply ();
175 	virtual void SetOnlineMode( sal_Bool bEnable );
176 	virtual void SetInitFocus();
177 	virtual void SetMarkStr ( String& aStrMark );
178 	virtual void Reset( const SfxItemSet& );
179 	virtual sal_Bool FillItemSet( SfxItemSet& );
180 	virtual void ActivatePage( const SfxItemSet& rItemSet );
181 	virtual int	 DeactivatePage( SfxItemSet* pSet = 0 );
182 
183 	sal_Bool IsMarkWndVisible ()      { return ((Window*)mpMarkWnd)->IsVisible(); }
184 	Size GetSizeExtraWnd ()		  { return ( mpMarkWnd->GetSizePixel() ); }
185 	sal_Bool MoveToExtraWnd ( Point aNewPos, sal_Bool bDisConnectDlg = sal_False );
186 
187     virtual void        ActivatePage();
188     virtual void        DeactivatePage();
189     virtual sal_Bool    QueryClose();
190 
191 protected:
192 	virtual sal_Bool ShouldOpenMarkWnd();
193 	virtual void SetMarkWndShouldOpen(sal_Bool bOpen);
194 
195 	void ShowMarkWnd ();
196 	void HideMarkWnd ()	          { ( ( Window* ) mpMarkWnd )->Hide(); }
197 	void InvalidateMarkWnd ()     { ( ( Window* ) mpMarkWnd )->Invalidate(); }
198 
199 	SfxDispatcher* GetDispatcher() const;
200 
201 	sal_uInt16             GetMacroEvents();
202 	SvxMacroTableDtor* GetMacroTable();
203 
204 	sal_Bool IsHTMLDoc() const;
205 };
206 
207 #endif // _SVX_TABBASE_HYPERLINK_HXX
208 
209