xref: /AOO41X/main/cui/source/inc/hltpbase.hxx (revision c4eee24dc018e70cce741d2c2ecfc43b06c69c41)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _SVX_TABBASE_HYPERLINK_HXX
24 #define _SVX_TABBASE_HYPERLINK_HXX
25 
26 #define INET_TELNET_SCHEME      "telnet://"
27 
28 #include <sfx2/app.hxx>
29 #include <sfx2/tabdlg.hxx>
30 #include <vcl/group.hxx>
31 #include <vcl/button.hxx>
32 #include <vcl/fixed.hxx>
33 #include <vcl/combobox.hxx>
34 #include <vcl/edit.hxx>
35 #include <vcl/lstbox.hxx>
36 #include <tools/urlobj.hxx>
37 #include <svl/stritem.hxx>
38 #include <svl/eitem.hxx>
39 #include <svtools/transfer.hxx>
40 #include <sfx2/dispatch.hxx>
41 #include <vcl/msgbox.hxx>
42 #include <sfx2/fcontnr.hxx>
43 #include <svtools/inettbc.hxx>
44 #include <vcl/timer.hxx>
45 
46 #include <dialmgr.hxx>
47 #include <sfx2/docfile.hxx>
48 #include <cuires.hrc>
49 #include <com/sun/star/frame/XFrame.hpp>
50 #include "helpid.hrc"
51 #include <svx/hlnkitem.hxx>
52 
53 #include "hlmarkwn.hxx"
54 #include "iconcdlg.hxx"
55 
56 
57 /*************************************************************************
58 |*
59 |* ComboBox-Control, wich is filled with all current framenames
60 |*
61 \************************************************************************/
62 
63 class SvxFramesComboBox : public ComboBox
64 {
65 public:
66     SvxFramesComboBox (Window* pParent, const ResId& rResId, SfxDispatcher* pDispatch);
67     ~SvxFramesComboBox ();
68 };
69 
70 /*************************************************************************
71 |*
72 |* ComboBox-Control for URL's with History and Autocompletion
73 |*
74 \************************************************************************/
75 
76 class SvxHyperURLBox : public SvtURLBox, public DropTargetHelper
77 {
78 private:
79     sal_Bool   mbAccessAddress;
80 
81 //  String GetAllEmailNamesFromDragItem( sal_uInt16 nItem );
82 
83 protected:
84 
85     virtual sal_Int8    AcceptDrop( const AcceptDropEvent& rEvt );
86     virtual sal_Int8    ExecuteDrop( const ExecuteDropEvent& rEvt );
87 
88     virtual long        Notify( NotifyEvent& rNEvt );
89     virtual void        Select();
90     virtual void        Modify();
91     virtual long        PreNotify( NotifyEvent& rNEvt );
92 
93 public:
94     SvxHyperURLBox( Window* pParent, INetProtocol eSmart = INET_PROT_FILE, sal_Bool bAddresses = sal_False );
95 
96 };
97 
98 /*************************************************************************
99 |*
100 |* Tabpage : Basisclass
101 |*
102 \************************************************************************/
103 
104 class SvxHyperlinkTabPageBase : public IconChoicePage
105 {
106 private:
107     FixedLine           *mpGrpMore;
108     FixedText           *mpFtFrame;
109     SvxFramesComboBox   *mpCbbFrame;
110     FixedText           *mpFtForm;
111     ListBox             *mpLbForm;
112     FixedText           *mpFtIndication;
113     Edit                *mpEdIndication;
114     FixedText           *mpFtText;
115     Edit                *mpEdText;
116     ImageButton         *mpBtScript;
117 
118     sal_Bool            mbIsCloseDisabled;
119 
120     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >
121                         mxDocumentFrame;
122 
123 protected:
124     Window*             mpDialog;
125 
126     sal_Bool                mbStdControlsInit;
127 
128     String              maStrInitURL;
129 
130     Timer               maTimer;
131 
132     SvxHlinkDlgMarkWnd* mpMarkWnd;
133 
134     void InitStdControls ();
135     virtual void FillStandardDlgFields ( SvxHyperlinkItem* pHyperlinkItem );
136     virtual void FillDlgFields         ( String& aStrURL ) = 0;
137     virtual void GetCurentItemData     ( String& aStrURL, String& aStrName,
138                                          String& aStrIntName, String& aStrFrame,
139                                          SvxLinkInsertMode& eMode ) = 0;
140     virtual String CreateUiNameFromURL( const String& aStrURL );
141 
142     void         GetDataFromCommonFields( String& aStrName,
143                                           String& aStrIntName, String& aStrFrame,
144                                           SvxLinkInsertMode& eMode );
145 
146     DECL_LINK (ClickScriptHdl_Impl, void * );       // Button : Script
147 
148     String              aEmptyStr;
149 
150     sal_Bool            FileExists( const INetURLObject& rURL );
151     static String   GetSchemeFromURL( String aStrURL );
152 
DisableClose(sal_Bool _bDisable)153     inline void     DisableClose( sal_Bool _bDisable ) { mbIsCloseDisabled = _bDisable; }
154 
155 public:
156     SvxHyperlinkTabPageBase (
157         Window *pParent,
158         const ResId &rResId,
159         const SfxItemSet& rItemSet
160     );
161     virtual ~SvxHyperlinkTabPageBase ();
162 
SetDocumentFrame(const::com::sun::star::uno::Reference<::com::sun::star::frame::XFrame> & rxDocumentFrame)163     void    SetDocumentFrame(
164         const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxDocumentFrame )
165     {
166         mxDocumentFrame = rxDocumentFrame;
167     }
168 
169     virtual sal_Bool AskApply ();
170     virtual void DoApply ();
171     virtual void SetOnlineMode( sal_Bool bEnable );
172     virtual void SetInitFocus();
173     virtual void SetMarkStr ( String& aStrMark );
174     virtual void Reset( const SfxItemSet& );
175     virtual sal_Bool FillItemSet( SfxItemSet& );
176     virtual void ActivatePage( const SfxItemSet& rItemSet );
177     virtual int  DeactivatePage( SfxItemSet* pSet = 0 );
178 
IsMarkWndVisible()179     sal_Bool IsMarkWndVisible ()      { return ((Window*)mpMarkWnd)->IsVisible(); }
GetSizeExtraWnd()180     Size GetSizeExtraWnd ()       { return ( mpMarkWnd->GetSizePixel() ); }
181     sal_Bool MoveToExtraWnd ( Point aNewPos, sal_Bool bDisConnectDlg = sal_False );
182 
183     virtual void        ActivatePage();
184     virtual void        DeactivatePage();
185     virtual sal_Bool    QueryClose();
186 
187 protected:
188     virtual sal_Bool ShouldOpenMarkWnd();
189     virtual void SetMarkWndShouldOpen(sal_Bool bOpen);
190 
191     void ShowMarkWnd ();
HideMarkWnd()192     void HideMarkWnd ()           { ( ( Window* ) mpMarkWnd )->Hide(); }
InvalidateMarkWnd()193     void InvalidateMarkWnd ()     { ( ( Window* ) mpMarkWnd )->Invalidate(); }
194 
195     SfxDispatcher* GetDispatcher() const;
196 
197     sal_uInt16             GetMacroEvents();
198     SvxMacroTableDtor* GetMacroTable();
199 
200     sal_Bool IsHTMLDoc() const;
201 };
202 
203 #endif // _SVX_TABBASE_HYPERLINK_HXX
204 
205