Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef INCLUDED_CUI_SOURCE_INC_HLTPBASE_HXX
20 : #define INCLUDED_CUI_SOURCE_INC_HLTPBASE_HXX
21 :
22 : #include <sfx2/app.hxx>
23 : #include <sfx2/tabdlg.hxx>
24 : #include <vcl/group.hxx>
25 : #include <vcl/button.hxx>
26 : #include <vcl/fixed.hxx>
27 : #include <vcl/combobox.hxx>
28 : #include <vcl/edit.hxx>
29 : #include <vcl/lstbox.hxx>
30 : #include <svl/stritem.hxx>
31 : #include <svl/eitem.hxx>
32 : #include <svtools/transfer.hxx>
33 : #include <sfx2/dispatch.hxx>
34 : #include <vcl/msgbox.hxx>
35 : #include <sfx2/fcontnr.hxx>
36 : #include <svtools/inettbc.hxx>
37 : #include <vcl/timer.hxx>
38 :
39 : #include <dialmgr.hxx>
40 : #include <sfx2/docfile.hxx>
41 : #include <cuires.hrc>
42 : #include <com/sun/star/frame/XFrame.hpp>
43 : #include "helpid.hrc"
44 : #include <svx/hlnkitem.hxx>
45 :
46 : #include "hlmarkwn.hxx"
47 : #include "iconcdlg.hxx"
48 :
49 : /// ComboBox-Control, which is filled with all current framenames
50 : class SvxFramesComboBox : public ComboBox
51 : {
52 : public:
53 : SvxFramesComboBox (Window* pParent, const ResId& rResId, SfxDispatcher* pDispatch);
54 : virtual ~SvxFramesComboBox ();
55 : };
56 :
57 : /// ComboBox-Control for URL's with History and Autocompletion
58 0 : class SvxHyperURLBox : public SvtURLBox, public DropTargetHelper
59 : {
60 : protected:
61 : virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) SAL_OVERRIDE;
62 : virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) SAL_OVERRIDE;
63 :
64 : virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
65 : virtual void Select() SAL_OVERRIDE;
66 : virtual void Modify() SAL_OVERRIDE;
67 : virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
68 :
69 : public:
70 : SvxHyperURLBox( Window* pParent, INetProtocol eSmart = INET_PROT_FILE );
71 :
72 : };
73 :
74 : /// Tabpage : Basisclass
75 : class SvxHyperlinkTabPageBase : public IconChoicePage
76 : {
77 : private:
78 : FixedLine *mpGrpMore;
79 : FixedText *mpFtFrame;
80 : SvxFramesComboBox *mpCbbFrame;
81 : FixedText *mpFtForm;
82 : ListBox *mpLbForm;
83 : FixedText *mpFtIndication;
84 : Edit *mpEdIndication;
85 : FixedText *mpFtText;
86 : Edit *mpEdText;
87 : ImageButton *mpBtScript;
88 :
89 : sal_Bool mbIsCloseDisabled;
90 :
91 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >
92 : mxDocumentFrame;
93 :
94 : protected:
95 : Window* mpDialog;
96 :
97 : sal_Bool mbStdControlsInit;
98 :
99 : OUString maStrInitURL;
100 :
101 : Timer maTimer;
102 :
103 : SvxHlinkDlgMarkWnd* mpMarkWnd;
104 :
105 : void InitStdControls ();
106 : virtual void FillStandardDlgFields ( SvxHyperlinkItem* pHyperlinkItem );
107 : virtual void FillDlgFields(const OUString& rStrURL) = 0;
108 : virtual void GetCurentItemData ( OUString& rStrURL, OUString& aStrName,
109 : OUString& aStrIntName, OUString& aStrFrame,
110 : SvxLinkInsertMode& eMode ) = 0;
111 : virtual OUString CreateUiNameFromURL( const OUString& aStrURL );
112 :
113 : void GetDataFromCommonFields( OUString& aStrName,
114 : OUString& aStrIntName, OUString& aStrFrame,
115 : SvxLinkInsertMode& eMode );
116 :
117 : DECL_LINK (ClickScriptHdl_Impl, void * ); ///< Button : Script
118 :
119 : OUString aEmptyStr;
120 :
121 : static OUString GetSchemeFromURL( const OUString& rStrURL );
122 :
123 0 : inline void DisableClose( sal_Bool _bDisable ) { mbIsCloseDisabled = _bDisable; }
124 :
125 : public:
126 : SvxHyperlinkTabPageBase (
127 : Window *pParent,
128 : const ResId &rResId,
129 : const SfxItemSet& rItemSet
130 : );
131 : virtual ~SvxHyperlinkTabPageBase ();
132 :
133 0 : void SetDocumentFrame(
134 : const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxDocumentFrame )
135 : {
136 0 : mxDocumentFrame = rxDocumentFrame;
137 0 : }
138 :
139 : virtual sal_Bool AskApply ();
140 : virtual void DoApply ();
141 : virtual void SetInitFocus();
142 : virtual void SetMarkStr ( const OUString& aStrMark );
143 : virtual void Reset( const SfxItemSet& ) SAL_OVERRIDE;
144 : virtual bool FillItemSet( SfxItemSet& ) SAL_OVERRIDE;
145 : virtual void ActivatePage( const SfxItemSet& rItemSet ) SAL_OVERRIDE;
146 : virtual int DeactivatePage( SfxItemSet* pSet = 0 ) SAL_OVERRIDE;
147 :
148 0 : sal_Bool IsMarkWndVisible () { return ((Window*)mpMarkWnd)->IsVisible(); }
149 0 : Size GetSizeExtraWnd () { return ( mpMarkWnd->GetSizePixel() ); }
150 : sal_Bool MoveToExtraWnd ( Point aNewPos, sal_Bool bDisConnectDlg = sal_False );
151 :
152 : virtual void ActivatePage() SAL_OVERRIDE;
153 : virtual void DeactivatePage() SAL_OVERRIDE;
154 : virtual sal_Bool QueryClose() SAL_OVERRIDE;
155 :
156 : protected:
157 : virtual sal_Bool ShouldOpenMarkWnd();
158 : virtual void SetMarkWndShouldOpen(sal_Bool bOpen);
159 :
160 : void ShowMarkWnd ();
161 0 : void HideMarkWnd () { ( ( Window* ) mpMarkWnd )->Hide(); }
162 : void InvalidateMarkWnd () { ( ( Window* ) mpMarkWnd )->Invalidate(); }
163 :
164 : SfxDispatcher* GetDispatcher() const;
165 :
166 : sal_uInt16 GetMacroEvents();
167 : SvxMacroTableDtor* GetMacroTable();
168 :
169 : sal_Bool IsHTMLDoc() const;
170 : };
171 :
172 : #endif // INCLUDED_CUI_SOURCE_INC_HLTPBASE_HXX
173 :
174 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|