xref: /aoo42x/main/svx/source/dialog/hyprdlg.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_DLG_HYPERDLG_HXX
28 #define _SVX_DLG_HYPERDLG_HXX
29 
30 #include <vcl/combobox.hxx>
31 #include <vcl/toolbox.hxx>
32 #include <vcl/menu.hxx>
33 #include <svtools/stdctrl.hxx>
34 #include <sfx2/ctrlitem.hxx>
35 #include <svl/srchcfg.hxx>
36 #include <sfx2/tbxctrl.hxx>
37 
38 class SvxHyperlinkDlg;
39 class SfxViewFrame;
40 
41 /*--------------------------------------------------------------------
42 	Beschreibung:
43  --------------------------------------------------------------------*/
44 
45 class HyperCombo : public ComboBox
46 {
47 	SvxHyperlinkDlg *pDlg;
48 	long			nMaxWidth;
49 	long			nMinWidth;
50 	long			nRatio;
51 
52 	virtual long Notify( NotifyEvent& rNEvt );
53 	virtual long PreNotify( NotifyEvent& rNEvt );
54 
55 public:
56 	HyperCombo( SvxHyperlinkDlg* pDialog, const ResId& rResId );
57 
58 	inline void	SetRatio( long nR ) { nRatio = nR; }
59 	inline long	GetRatio()			{ return nRatio; }
60 	long		CalcResizeWidth( long nW );
61 	inline long	GetResizeWidth()	{ return (nMaxWidth - nMinWidth); }
62 	void		DoResize( long nW );
63 };
64 
65 class HyperFixedText : public FixedInfo
66 {
67 	SvxHyperlinkDlg *pDlg;
68 
69 public:
70 	HyperFixedText( SvxHyperlinkDlg* pDialog, const ResId& rResId );
71 
72 };
73 
74 /*--------------------------------------------------------------------
75 	Beschreibung: Dialog zum Einf�gen/�ndern eines Hyperlink
76  --------------------------------------------------------------------*/
77 
78 class SvxHyperlinkDlg : public ToolBox, public SfxControllerItem
79 {
80 	friend class HyperCombo;
81 	friend class HyperFixedText;
82 	using ToolBox::StateChanged;
83 
84 private:
85 	SfxStatusForwarder	aForwarder;
86 	SfxStatusForwarder	aHyperlinkDlgForward;
87 	HyperCombo			aNameCB;
88 	HyperFixedText		aUrlFT;
89 	HyperCombo			aUrlCB;
90 
91     SvxSearchConfig     aSearchConfig;
92 
93     String              sAddress;
94 	String				sExplorer;
95 	String				sOldName;
96 	String 				sSearchTitle;
97 	PopupMenu			aLinkPopup;
98 	PopupMenu			*pTargetMenu;
99 	sal_Bool				bNoDoc;
100 	sal_Bool				bSend;
101 	sal_Bool				bHasOldName;
102 	long				nMaxWidth;
103 	long				nMinWidth;
104 	long				nMaxHeight;
105 	sal_Bool				bHtmlMode;
106 
107 	SfxImageManager*	mpManager;
108 
109     virtual void    StateChanged( sal_uInt16 nSID, SfxItemState eState,	const SfxPoolItem* pState );
110 	virtual void DataChanged( const DataChangedEvent& rDCEvt );
111 
112 	// DockingWindow
113 	virtual void Resize();
114 	virtual void Resizing(Size& rSize);
115 
116 	// Drag&Drop
117 	sal_Bool 		 GetDragData(sal_uInt16 nItem, sal_uIntPtr nDDFormatId, String& rBuffer);
118 
119 	DECL_LINK(TBClickHdl, ToolBox *);
120 	DECL_LINK(TBSelectHdl, ToolBox *);
121     DECL_LINK(DropdownClick, ToolBox * );
122 	DECL_LINK(LinkPopupSelectHdl, Menu *);
123 	DECL_LINK(SearchPopupSelectHdl, Menu *);
124 	DECL_LINK(ComboSelectHdl, ComboBox *);
125 	DECL_LINK(ComboModifyHdl, ComboBox *);
126 	DECL_LINK(BookmarkFoundHdl, String *);
127 
128     void    OpenDoc( const String& rURL, SfxViewFrame* pViewFrame );
129     void    EnableLink();
130 	void	SendToApp(sal_uInt16 nType);
131 	void	AddToHistory(const String& rName, const String& rURL);
132 	void	TargetMenu(const String& rSelEntry, sal_Bool bExecute);
133 	String	GetSelTarget();
134 
135 	void	SetImages();
136 public:
137 	SvxHyperlinkDlg(SfxBindings *pBindings, Window* pWindow);
138 	~SvxHyperlinkDlg();
139 };
140 
141 
142 #endif // _SVX_DLG_HYPERDLG_HXX
143 
144