xref: /aoo4110/main/svx/source/dialog/hyprdlg.hxx (revision b1cdbd2c)
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 
SetRatio(long nR)54 	inline void	SetRatio( long nR ) { nRatio = nR; }
GetRatio()55 	inline long	GetRatio()			{ return nRatio; }
56 	long		CalcResizeWidth( long nW );
GetResizeWidth()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				bHasOldName;
97 	long				nMaxWidth;
98 	long				nMinWidth;
99 	long				nMaxHeight;
100 	sal_Bool				bHtmlMode;
101 
102 	SfxImageManager*	mpManager;
103 
104     virtual void    StateChanged( sal_uInt16 nSID, SfxItemState eState,	const SfxPoolItem* pState );
105 	virtual void DataChanged( const DataChangedEvent& rDCEvt );
106 
107 	// DockingWindow
108 	virtual void Resize();
109 	virtual void Resizing(Size& rSize);
110 
111 	// Drag&Drop
112 	sal_Bool 		 GetDragData(sal_uInt16 nItem, sal_uIntPtr nDDFormatId, String& rBuffer);
113 
114 	DECL_LINK(TBClickHdl, ToolBox *);
115 	DECL_LINK(TBSelectHdl, ToolBox *);
116     DECL_LINK(DropdownClick, ToolBox * );
117 	DECL_LINK(LinkPopupSelectHdl, Menu *);
118 	DECL_LINK(SearchPopupSelectHdl, Menu *);
119 	DECL_LINK(ComboSelectHdl, ComboBox *);
120 	DECL_LINK(ComboModifyHdl, ComboBox *);
121 	DECL_LINK(BookmarkFoundHdl, String *);
122 
123     void    OpenDoc( const String& rURL, SfxViewFrame* pViewFrame );
124     void    EnableLink();
125 	void	SendToApp(sal_uInt16 nType);
126 	void	AddToHistory(const String& rName, const String& rURL);
127 	void	TargetMenu(const String& rSelEntry, sal_Bool bExecute);
128 	String	GetSelTarget();
129 
130 	void	SetImages();
131 public:
132 	SvxHyperlinkDlg(SfxBindings *pBindings, Window* pWindow);
133 	~SvxHyperlinkDlg();
134 };
135 
136 
137 #endif // _SVX_DLG_HYPERDLG_HXX
138 
139