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