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