xref: /AOO41X/main/sw/source/ui/docvw/edtwin2.cxx (revision efeef26f81c84063fb0a91bde3856d4a51172d90)
1*efeef26fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*efeef26fSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*efeef26fSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*efeef26fSAndrew Rist  * distributed with this work for additional information
6*efeef26fSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*efeef26fSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*efeef26fSAndrew Rist  * "License"); you may not use this file except in compliance
9*efeef26fSAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*efeef26fSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*efeef26fSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*efeef26fSAndrew Rist  * software distributed under the License is distributed on an
15*efeef26fSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*efeef26fSAndrew Rist  * KIND, either express or implied.  See the License for the
17*efeef26fSAndrew Rist  * specific language governing permissions and limitations
18*efeef26fSAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*efeef26fSAndrew Rist  *************************************************************/
21*efeef26fSAndrew Rist 
22*efeef26fSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sw.hxx"
26cdf0e10cSrcweir #include <tools/ref.hxx>
27cdf0e10cSrcweir #include <hintids.hxx>
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include <doc.hxx>
30cdf0e10cSrcweir #ifdef DBG_UTIL
31cdf0e10cSrcweir #include <stdio.h>
32cdf0e10cSrcweir #endif
33cdf0e10cSrcweir 
34cdf0e10cSrcweir #include <vcl/help.hxx>
35cdf0e10cSrcweir #include <svl/stritem.hxx>
36cdf0e10cSrcweir #include <unotools/securityoptions.hxx>
37cdf0e10cSrcweir #include <tools/urlobj.hxx>
38cdf0e10cSrcweir #include <txtrfmrk.hxx>
39cdf0e10cSrcweir #include <fmtrfmrk.hxx>
40cdf0e10cSrcweir #include <editeng/flditem.hxx>
41cdf0e10cSrcweir #include <svl/urihelper.hxx>
42cdf0e10cSrcweir #include <svx/svdotext.hxx>
43cdf0e10cSrcweir #include <editeng/outliner.hxx>
44cdf0e10cSrcweir #include <svl/itemiter.hxx>
45cdf0e10cSrcweir #include <svx/svdview.hxx>
46cdf0e10cSrcweir #include <svx/svdpagv.hxx>
47cdf0e10cSrcweir #include <swmodule.hxx>
48cdf0e10cSrcweir #include <modcfg.hxx>
49cdf0e10cSrcweir #include <view.hxx>
50cdf0e10cSrcweir #include <wrtsh.hxx>
51cdf0e10cSrcweir #include <docsh.hxx>
52cdf0e10cSrcweir #include <edtwin.hxx>
53cdf0e10cSrcweir #include <dpage.hxx>
54cdf0e10cSrcweir #include <shellres.hxx>
55cdf0e10cSrcweir #include <docufld.hxx>
56cdf0e10cSrcweir #include <dbfld.hxx>
57cdf0e10cSrcweir #include <reffld.hxx>
58cdf0e10cSrcweir #include <cellatr.hxx>
59cdf0e10cSrcweir #include <shdwcrsr.hxx>
60cdf0e10cSrcweir #include <fmtcol.hxx>
61cdf0e10cSrcweir #include <charfmt.hxx>
62cdf0e10cSrcweir #include <fmtftn.hxx>
63cdf0e10cSrcweir #include <redline.hxx>
64cdf0e10cSrcweir #include <tox.hxx>
65cdf0e10cSrcweir #include <txttxmrk.hxx>
66cdf0e10cSrcweir #include <uitool.hxx>
67cdf0e10cSrcweir #include <viewopt.hxx>
68cdf0e10cSrcweir #include <docvw.hrc>
69cdf0e10cSrcweir #include <utlui.hrc>
70cdf0e10cSrcweir 
71cdf0e10cSrcweir #include <PostItMgr.hxx>
72cdf0e10cSrcweir #include <fmtfld.hxx>
73cdf0e10cSrcweir 
74cdf0e10cSrcweir // --> OD 2009-08-18 #i104300#
75cdf0e10cSrcweir #include <IDocumentMarkAccess.hxx>
76cdf0e10cSrcweir #include <ndtxt.hxx>
77cdf0e10cSrcweir // <--
78cdf0e10cSrcweir 
79cdf0e10cSrcweir /*--------------------------------------------------------------------
80cdf0e10cSrcweir 	Beschreibung:	KeyEvents
81cdf0e10cSrcweir  --------------------------------------------------------------------*/
82cdf0e10cSrcweir static void lcl_GetRedlineHelp( const SwRedline& rRedl, String& rTxt, sal_Bool bBalloon )
83cdf0e10cSrcweir {
84cdf0e10cSrcweir 	sal_uInt16 nResId = 0;
85cdf0e10cSrcweir 	switch( rRedl.GetType() )
86cdf0e10cSrcweir 	{
87cdf0e10cSrcweir 	case nsRedlineType_t::REDLINE_INSERT:	nResId = STR_REDLINE_INSERT; break;
88cdf0e10cSrcweir 	case nsRedlineType_t::REDLINE_DELETE:	nResId = STR_REDLINE_DELETE; break;
89cdf0e10cSrcweir 	case nsRedlineType_t::REDLINE_FORMAT:	nResId = STR_REDLINE_FORMAT; break;
90cdf0e10cSrcweir 	case nsRedlineType_t::REDLINE_TABLE:		nResId = STR_REDLINE_TABLE; break;
91cdf0e10cSrcweir 	case nsRedlineType_t::REDLINE_FMTCOLL:	nResId = STR_REDLINE_FMTCOLL; break;
92cdf0e10cSrcweir 	}
93cdf0e10cSrcweir 
94cdf0e10cSrcweir 	if( nResId )
95cdf0e10cSrcweir 	{
96cdf0e10cSrcweir 		rTxt = SW_RESSTR( nResId );
97cdf0e10cSrcweir 		rTxt.AppendAscii( RTL_CONSTASCII_STRINGPARAM(": " ));
98cdf0e10cSrcweir 		rTxt += rRedl.GetAuthorString();
99cdf0e10cSrcweir 		rTxt.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " - " ));
100cdf0e10cSrcweir 		rTxt += GetAppLangDateTimeString( rRedl.GetTimeStamp() );
101cdf0e10cSrcweir 		if( bBalloon && rRedl.GetComment().Len() )
102cdf0e10cSrcweir 			( rTxt += '\n' ) += rRedl.GetComment();
103cdf0e10cSrcweir 	}
104cdf0e10cSrcweir }
105cdf0e10cSrcweir 
106cdf0e10cSrcweir 
107cdf0e10cSrcweir void SwEditWin::RequestHelp(const HelpEvent &rEvt)
108cdf0e10cSrcweir {
109cdf0e10cSrcweir     SwWrtShell &rSh = rView.GetWrtShell();
110cdf0e10cSrcweir     sal_Bool bQuickBalloon = 0 != (rEvt.GetMode() & ( HELPMODE_QUICK | HELPMODE_BALLOON ));
111cdf0e10cSrcweir     if(bQuickBalloon && rSh.GetViewOptions()->IsPreventTips())
112cdf0e10cSrcweir         return;
113cdf0e10cSrcweir     sal_Bool bWeiter = sal_True;
114cdf0e10cSrcweir     SET_CURR_SHELL(&rSh);
115cdf0e10cSrcweir 	String sTxt;
116cdf0e10cSrcweir 	Point aPos( PixelToLogic( ScreenToOutputPixel( rEvt.GetMousePosPixel() ) ));
117cdf0e10cSrcweir     sal_Bool bBalloon = static_cast< sal_Bool >(rEvt.GetMode() & HELPMODE_BALLOON);
118cdf0e10cSrcweir 
119cdf0e10cSrcweir 	SdrView *pSdrView = rSh.GetDrawView();
120cdf0e10cSrcweir 
121cdf0e10cSrcweir     if( bQuickBalloon )
122cdf0e10cSrcweir 	{
123cdf0e10cSrcweir 		if( pSdrView )
124cdf0e10cSrcweir 		{
125cdf0e10cSrcweir 			SdrPageView* pPV = pSdrView->GetSdrPageView();
126cdf0e10cSrcweir             SwDPage* pPage = pPV ? ((SwDPage*)pPV->GetPage()) : 0;
127cdf0e10cSrcweir             bWeiter = pPage && pPage->RequestHelp(this, pSdrView, rEvt);
128cdf0e10cSrcweir 		}
129cdf0e10cSrcweir 	}
130cdf0e10cSrcweir 
131cdf0e10cSrcweir     if( bWeiter && bQuickBalloon)
132cdf0e10cSrcweir 	{
133cdf0e10cSrcweir 		SwRect aFldRect;
134cdf0e10cSrcweir         sal_uInt16 nStyle = 0; // style of quick help
135cdf0e10cSrcweir 		SwContentAtPos aCntntAtPos( SwContentAtPos::SW_FIELD |
136cdf0e10cSrcweir 									SwContentAtPos::SW_INETATTR |
137cdf0e10cSrcweir 									SwContentAtPos::SW_FTN |
138cdf0e10cSrcweir 									SwContentAtPos::SW_REDLINE |
139cdf0e10cSrcweir 									SwContentAtPos::SW_TOXMARK |
140cdf0e10cSrcweir 									SwContentAtPos::SW_REFMARK |
141cdf0e10cSrcweir                                     SwContentAtPos::SW_SMARTTAG |
142cdf0e10cSrcweir #ifdef DBG_UTIL
143cdf0e10cSrcweir 									SwContentAtPos::SW_TABLEBOXVALUE |
144cdf0e10cSrcweir 						( bBalloon ? SwContentAtPos::SW_CURR_ATTRS : 0) |
145cdf0e10cSrcweir #endif
146cdf0e10cSrcweir 									SwContentAtPos::SW_TABLEBOXFML );
147cdf0e10cSrcweir 
148cdf0e10cSrcweir 		if( rSh.GetContentAtPos( aPos, aCntntAtPos, sal_False, &aFldRect ) )
149cdf0e10cSrcweir 		{
150cdf0e10cSrcweir              switch( aCntntAtPos.eCntntAtPos )
151cdf0e10cSrcweir 			{
152cdf0e10cSrcweir 			case SwContentAtPos::SW_TABLEBOXFML:
153cdf0e10cSrcweir 				sTxt.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "= " ));
154cdf0e10cSrcweir 				sTxt += ((SwTblBoxFormula*)aCntntAtPos.aFnd.pAttr)->GetFormula();
155cdf0e10cSrcweir 				break;
156cdf0e10cSrcweir #ifdef DBG_UTIL
157cdf0e10cSrcweir 			case SwContentAtPos::SW_TABLEBOXVALUE:
158cdf0e10cSrcweir 			{
159cdf0e10cSrcweir                 sTxt = UniString(
160cdf0e10cSrcweir                             ByteString::CreateFromDouble(
161cdf0e10cSrcweir                                 ((SwTblBoxValue*)aCntntAtPos.aFnd.pAttr)->GetValue()  )
162cdf0e10cSrcweir                             , gsl_getSystemTextEncoding());
163cdf0e10cSrcweir 			}
164cdf0e10cSrcweir 			break;
165cdf0e10cSrcweir 			case SwContentAtPos::SW_CURR_ATTRS:
166cdf0e10cSrcweir 				sTxt = aCntntAtPos.sStr;
167cdf0e10cSrcweir 				break;
168cdf0e10cSrcweir #endif
169cdf0e10cSrcweir 
170cdf0e10cSrcweir 			case SwContentAtPos::SW_INETATTR:
171cdf0e10cSrcweir             {
172cdf0e10cSrcweir 				sTxt = ((SfxStringItem*)aCntntAtPos.aFnd.pAttr)->GetValue();
173cdf0e10cSrcweir 				sTxt = URIHelper::removePassword( sTxt,
174cdf0e10cSrcweir 										INetURLObject::WAS_ENCODED,
175cdf0e10cSrcweir 			   							INetURLObject::DECODE_UNAMBIGUOUS);
176cdf0e10cSrcweir                 //#i63832# remove the link target type
177cdf0e10cSrcweir                 xub_StrLen nFound = sTxt.Search(cMarkSeperator);
178cdf0e10cSrcweir                 if( nFound != STRING_NOTFOUND && (++nFound) < sTxt.Len() )
179cdf0e10cSrcweir                 {
180cdf0e10cSrcweir                     String sSuffix( sTxt.Copy(nFound) );
181cdf0e10cSrcweir                     if( sSuffix.EqualsAscii( pMarkToTable ) ||
182cdf0e10cSrcweir                         sSuffix.EqualsAscii( pMarkToFrame ) ||
183cdf0e10cSrcweir                         sSuffix.EqualsAscii( pMarkToRegion ) ||
184cdf0e10cSrcweir                         sSuffix.EqualsAscii( pMarkToOutline ) ||
185cdf0e10cSrcweir                         sSuffix.EqualsAscii( pMarkToText ) ||
186cdf0e10cSrcweir                         sSuffix.EqualsAscii( pMarkToGraphic ) ||
187cdf0e10cSrcweir                         sSuffix.EqualsAscii( pMarkToOLE ))
188cdf0e10cSrcweir                     sTxt = sTxt.Copy( 0, nFound - 1);
189cdf0e10cSrcweir                 }
190cdf0e10cSrcweir                 // --> OD 2009-08-18 #i104300#
191cdf0e10cSrcweir                 // special handling if target is a cross-reference bookmark
192cdf0e10cSrcweir                 {
193cdf0e10cSrcweir                     String sTmpSearchStr = sTxt.Copy( 1, sTxt.Len() );
194cdf0e10cSrcweir                     IDocumentMarkAccess* const pMarkAccess =
195cdf0e10cSrcweir                                                 rSh.getIDocumentMarkAccess();
196cdf0e10cSrcweir                     IDocumentMarkAccess::const_iterator_t ppBkmk =
197cdf0e10cSrcweir                                     pMarkAccess->findBookmark( sTmpSearchStr );
198cdf0e10cSrcweir                     if ( ppBkmk != pMarkAccess->getBookmarksEnd() &&
199cdf0e10cSrcweir                          IDocumentMarkAccess::GetType( *(ppBkmk->get()) )
200cdf0e10cSrcweir                             == IDocumentMarkAccess::CROSSREF_HEADING_BOOKMARK )
201cdf0e10cSrcweir                     {
202cdf0e10cSrcweir                         SwTxtNode* pTxtNode = ppBkmk->get()->GetMarkStart().nNode.GetNode().GetTxtNode();
203cdf0e10cSrcweir                         if ( pTxtNode )
204cdf0e10cSrcweir                         {
205cdf0e10cSrcweir                             sTxt = pTxtNode->GetExpandTxt( 0, pTxtNode->Len(), true, true );
206cdf0e10cSrcweir 
207cdf0e10cSrcweir                             if( sTxt.Len() )
208cdf0e10cSrcweir                             {
209cdf0e10cSrcweir                                 sTxt.EraseAllChars( 0xad );
210cdf0e10cSrcweir                                 for( sal_Unicode* p = sTxt.GetBufferAccess(); *p; ++p )
211cdf0e10cSrcweir                                 {
212cdf0e10cSrcweir                                     if( *p < 0x20 )
213cdf0e10cSrcweir                                         *p = 0x20;
214cdf0e10cSrcweir                                     else if(*p == 0x2011)
215cdf0e10cSrcweir                                         *p = '-';
216cdf0e10cSrcweir                                 }
217cdf0e10cSrcweir                             }
218cdf0e10cSrcweir                         }
219cdf0e10cSrcweir                     }
220cdf0e10cSrcweir                 }
221cdf0e10cSrcweir                 // <--
222cdf0e10cSrcweir                 // --> OD 2007-07-26 #i80029#
223cdf0e10cSrcweir                 sal_Bool bExecHyperlinks = rView.GetDocShell()->IsReadOnly();
224cdf0e10cSrcweir                 if ( !bExecHyperlinks )
225cdf0e10cSrcweir                 {
226cdf0e10cSrcweir                     SvtSecurityOptions aSecOpts;
227cdf0e10cSrcweir                     bExecHyperlinks = !aSecOpts.IsOptionSet( SvtSecurityOptions::E_CTRLCLICK_HYPERLINK );
228cdf0e10cSrcweir 
229cdf0e10cSrcweir                     if ( !bExecHyperlinks )
230cdf0e10cSrcweir                     {
231cdf0e10cSrcweir                         sTxt.InsertAscii( ": ", 0 );
232cdf0e10cSrcweir                         sTxt.Insert( ViewShell::GetShellRes()->aHyperlinkClick, 0 );
233cdf0e10cSrcweir                     }
234cdf0e10cSrcweir                 }
235cdf0e10cSrcweir                 // <--
236cdf0e10cSrcweir 				break;
237cdf0e10cSrcweir             }
238cdf0e10cSrcweir 			case SwContentAtPos::SW_SMARTTAG:
239cdf0e10cSrcweir             {
240cdf0e10cSrcweir 				sTxt = SW_RESSTR(STR_SMARTTAG_CLICK);
241cdf0e10cSrcweir 
242cdf0e10cSrcweir                 KeyCode aCode( KEY_SPACE );
243cdf0e10cSrcweir                 KeyCode aModifiedCode( KEY_SPACE, KEY_MOD1 );
244cdf0e10cSrcweir                 String aModStr( aModifiedCode.GetName() );
245cdf0e10cSrcweir                 aModStr.SearchAndReplace( aCode.GetName(), String() );
246cdf0e10cSrcweir                 aModStr.SearchAndReplaceAllAscii( "+", String() );
247cdf0e10cSrcweir                 sTxt.SearchAndReplaceAllAscii( "%s", aModStr );
248cdf0e10cSrcweir             }
249cdf0e10cSrcweir             break;
250cdf0e10cSrcweir 
251cdf0e10cSrcweir 			case SwContentAtPos::SW_FTN:
252cdf0e10cSrcweir 				if( aCntntAtPos.pFndTxtAttr && aCntntAtPos.aFnd.pAttr )
253cdf0e10cSrcweir 				{
254cdf0e10cSrcweir                     const SwFmtFtn* pFtn = (SwFmtFtn*)aCntntAtPos.aFnd.pAttr;
255cdf0e10cSrcweir 					pFtn->GetFtnText( sTxt );
256cdf0e10cSrcweir 					sTxt.Insert( SW_RESSTR( pFtn->IsEndNote()
257cdf0e10cSrcweir 									? STR_ENDNOTE : STR_FTNNOTE ), 0 );
258cdf0e10cSrcweir                     if( aCntntAtPos.IsInRTLText() )
259cdf0e10cSrcweir                         nStyle |= QUICKHELP_BIDI_RTL;
260cdf0e10cSrcweir                 }
261cdf0e10cSrcweir 				break;
262cdf0e10cSrcweir 
263cdf0e10cSrcweir 			case SwContentAtPos::SW_REDLINE:
264cdf0e10cSrcweir 				lcl_GetRedlineHelp( *aCntntAtPos.aFnd.pRedl, sTxt, bBalloon );
265cdf0e10cSrcweir 				break;
266cdf0e10cSrcweir 
267cdf0e10cSrcweir 			case SwContentAtPos::SW_TOXMARK:
268cdf0e10cSrcweir 				sTxt = aCntntAtPos.sStr;
269cdf0e10cSrcweir 				if( sTxt.Len() && aCntntAtPos.pFndTxtAttr )
270cdf0e10cSrcweir 				{
271cdf0e10cSrcweir 					const SwTOXType* pTType = aCntntAtPos.pFndTxtAttr->
272cdf0e10cSrcweir 										GetTOXMark().GetTOXType();
273cdf0e10cSrcweir 					if( pTType && pTType->GetTypeName().Len() )
274cdf0e10cSrcweir 					{
275cdf0e10cSrcweir 						sTxt.InsertAscii( ": ", 0 );
276cdf0e10cSrcweir 						sTxt.Insert( pTType->GetTypeName(), 0 );
277cdf0e10cSrcweir 					}
278cdf0e10cSrcweir 				}
279cdf0e10cSrcweir 				break;
280cdf0e10cSrcweir 			case SwContentAtPos::SW_REFMARK:
281cdf0e10cSrcweir 				if(aCntntAtPos.aFnd.pAttr)
282cdf0e10cSrcweir 				{
283cdf0e10cSrcweir 					sTxt = SW_RES(STR_CONTENT_TYPE_SINGLE_REFERENCE);
284cdf0e10cSrcweir 					sTxt.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": "));
285cdf0e10cSrcweir 					sTxt += ((const SwFmtRefMark*)aCntntAtPos.aFnd.pAttr)->GetRefName();
286cdf0e10cSrcweir 				}
287cdf0e10cSrcweir 			break;
288cdf0e10cSrcweir 
289cdf0e10cSrcweir 			default:
290cdf0e10cSrcweir 				{
291cdf0e10cSrcweir 					SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig();
292cdf0e10cSrcweir 					if(!pModOpt->IsHideFieldTips())
293cdf0e10cSrcweir 					{
294cdf0e10cSrcweir 						const SwField* pFld = aCntntAtPos.aFnd.pFld;
295cdf0e10cSrcweir 						switch( pFld->Which() )
296cdf0e10cSrcweir 						{
297cdf0e10cSrcweir 						case RES_SETEXPFLD:
298cdf0e10cSrcweir 						case RES_TABLEFLD:
299cdf0e10cSrcweir 						case RES_GETEXPFLD:
300cdf0e10cSrcweir 						{
301cdf0e10cSrcweir 							sal_uInt16 nOldSubType = pFld->GetSubType();
302cdf0e10cSrcweir 							((SwField*)pFld)->SetSubType(nsSwExtendedSubType::SUB_CMD);
303cdf0e10cSrcweir                             sTxt = pFld->ExpandField(true);
304cdf0e10cSrcweir 							((SwField*)pFld)->SetSubType(nOldSubType);
305cdf0e10cSrcweir 						}
306cdf0e10cSrcweir 						break;
307cdf0e10cSrcweir 
308cdf0e10cSrcweir 						case RES_POSTITFLD:
309cdf0e10cSrcweir 							{
310cdf0e10cSrcweir 								/*
311cdf0e10cSrcweir 								SwPostItMgr* pMgr = rView.GetPostItMgr();
312cdf0e10cSrcweir 								if (pMgr->ShowNotes())
313cdf0e10cSrcweir 								{
314cdf0e10cSrcweir 									SwFmtFld* pSwFmtFld = 0;
315cdf0e10cSrcweir 									if (pMgr->ShowPreview(pFld,pSwFmtFld))
316cdf0e10cSrcweir 									{
317cdf0e10cSrcweir 										SwPostIt* pPostIt = new SwPostIt(static_cast<Window*>(this),0,pSwFmtFld,pMgr,PB_Preview);
318cdf0e10cSrcweir 										pPostIt->InitControls();
319cdf0e10cSrcweir 										pPostIt->SetReadonly(true);
320cdf0e10cSrcweir 										pMgr->SetColors(pPostIt,static_cast<SwPostItField*>(pSwFmtFld->GetFld()));
321cdf0e10cSrcweir 										pPostIt->SetVirtualPosSize(rEvt.GetMousePosPixel(),Size(180,70));
322cdf0e10cSrcweir 										pPostIt->ShowNote();
323cdf0e10cSrcweir 										SetPointerPosPixel(pPostIt->GetPosPixel() + Point(20,20));
324cdf0e10cSrcweir 									}
325cdf0e10cSrcweir 									return;
326cdf0e10cSrcweir 								}
327cdf0e10cSrcweir 								*/
328cdf0e10cSrcweir 								break;
329cdf0e10cSrcweir 							}
330cdf0e10cSrcweir 						case RES_INPUTFLD:	// BubbleHelp, da der Hinweis ggf ziemlich lang sein kann
331cdf0e10cSrcweir 							bBalloon = sal_True;
332cdf0e10cSrcweir 							/* no break */
333cdf0e10cSrcweir 						case RES_JUMPEDITFLD:
334cdf0e10cSrcweir 							sTxt = pFld->GetPar2();
335cdf0e10cSrcweir 							break;
336cdf0e10cSrcweir 
337cdf0e10cSrcweir 						case RES_DBFLD:
338cdf0e10cSrcweir                             sTxt = pFld->GetFieldName();
339cdf0e10cSrcweir 							break;
340cdf0e10cSrcweir 
341cdf0e10cSrcweir 						case RES_USERFLD:
342cdf0e10cSrcweir 						case RES_HIDDENTXTFLD:
343cdf0e10cSrcweir 							sTxt = pFld->GetPar1();
344cdf0e10cSrcweir 							break;
345cdf0e10cSrcweir 
346cdf0e10cSrcweir 						case RES_DOCSTATFLD:
347cdf0e10cSrcweir 							break;
348cdf0e10cSrcweir 
349cdf0e10cSrcweir 						case RES_MACROFLD:
350cdf0e10cSrcweir 							sTxt = ((const SwMacroField*)pFld)->GetMacro();
351cdf0e10cSrcweir 							break;
352cdf0e10cSrcweir 
353cdf0e10cSrcweir 						case RES_GETREFFLD:
354cdf0e10cSrcweir                         {
355cdf0e10cSrcweir                             // --> OD 2008-01-09 #i85090#
356cdf0e10cSrcweir                             const SwGetRefField* pRefFld( dynamic_cast<const SwGetRefField*>(pFld) );
357cdf0e10cSrcweir                             ASSERT( pRefFld,
358cdf0e10cSrcweir                                     "<SwEditWin::RequestHelp(..)> - unexpected type of <pFld>" );
359cdf0e10cSrcweir                             if ( pRefFld )
360cdf0e10cSrcweir                             {
361cdf0e10cSrcweir                                 if ( pRefFld->IsRefToHeadingCrossRefBookmark() ||
362cdf0e10cSrcweir                                      pRefFld->IsRefToNumItemCrossRefBookmark() )
363cdf0e10cSrcweir                                 {
364cdf0e10cSrcweir                                     sTxt = pRefFld->GetExpandedTxtOfReferencedTxtNode();
365cdf0e10cSrcweir                                     if ( sTxt.Len() > 80  )
366cdf0e10cSrcweir                                     {
367cdf0e10cSrcweir                                         sTxt.Erase( 80 );
368cdf0e10cSrcweir                                         sTxt += '.';
369cdf0e10cSrcweir                                         sTxt += '.';
370cdf0e10cSrcweir                                         sTxt += '.';
371cdf0e10cSrcweir                                     }
372cdf0e10cSrcweir                                 }
373cdf0e10cSrcweir                                 else
374cdf0e10cSrcweir                                 {
375cdf0e10cSrcweir                                     sTxt = ((SwGetRefField*)pFld)->GetSetRefName();
376cdf0e10cSrcweir                                 }
377cdf0e10cSrcweir                             }
378cdf0e10cSrcweir                             // <--
379cdf0e10cSrcweir                         }
380cdf0e10cSrcweir                         break;
381cdf0e10cSrcweir 						}
382cdf0e10cSrcweir 					}
383cdf0e10cSrcweir 
384cdf0e10cSrcweir 					if( !sTxt.Len() )
385cdf0e10cSrcweir 					{
386cdf0e10cSrcweir 						aCntntAtPos.eCntntAtPos = SwContentAtPos::SW_REDLINE;
387cdf0e10cSrcweir 						if( rSh.GetContentAtPos( aPos, aCntntAtPos, sal_False, &aFldRect ) )
388cdf0e10cSrcweir 							lcl_GetRedlineHelp( *aCntntAtPos.aFnd.pRedl,
389cdf0e10cSrcweir 													sTxt, bBalloon );
390cdf0e10cSrcweir 					}
391cdf0e10cSrcweir                 }
392cdf0e10cSrcweir 			}
393cdf0e10cSrcweir 			if (sTxt.Len() )
394cdf0e10cSrcweir 			{
395cdf0e10cSrcweir 				if( bBalloon )
396cdf0e10cSrcweir 					Help::ShowBalloon( this, rEvt.GetMousePosPixel(), sTxt );
397cdf0e10cSrcweir 				else
398cdf0e10cSrcweir 				{
399cdf0e10cSrcweir 					// dann zeige die Hilfe mal an:
400cdf0e10cSrcweir 					Rectangle aRect( aFldRect.SVRect() );
401cdf0e10cSrcweir 					Point aPt( OutputToScreenPixel( LogicToPixel( aRect.TopLeft() )));
402cdf0e10cSrcweir 					aRect.Left()   = aPt.X();
403cdf0e10cSrcweir 					aRect.Top()    = aPt.Y();
404cdf0e10cSrcweir 					aPt = OutputToScreenPixel( LogicToPixel( aRect.BottomRight() ));
405cdf0e10cSrcweir 					aRect.Right()  = aPt.X();
406cdf0e10cSrcweir 					aRect.Bottom() = aPt.Y();
407cdf0e10cSrcweir                     Help::ShowQuickHelp( this, aRect, sTxt, nStyle );
408cdf0e10cSrcweir 				}
409cdf0e10cSrcweir 			}
410cdf0e10cSrcweir 
411cdf0e10cSrcweir 			bWeiter = sal_False;
412cdf0e10cSrcweir 		}
413cdf0e10cSrcweir         if( bWeiter )
414cdf0e10cSrcweir         {
415cdf0e10cSrcweir             sal_uInt8 nTabCols = rSh.WhichMouseTabCol(aPos);
416cdf0e10cSrcweir             sal_uInt16 nTabRes = 0;
417cdf0e10cSrcweir             switch(nTabCols)
418cdf0e10cSrcweir             {
419cdf0e10cSrcweir                 case SW_TABCOL_HORI:
420cdf0e10cSrcweir                 case SW_TABCOL_VERT:
421cdf0e10cSrcweir                     nTabRes = STR_TABLE_COL_ADJUST;
422cdf0e10cSrcweir                     break;
423cdf0e10cSrcweir                 case SW_TABROW_HORI:
424cdf0e10cSrcweir                 case SW_TABROW_VERT:
425cdf0e10cSrcweir                     nTabRes = STR_TABLE_ROW_ADJUST;
426cdf0e10cSrcweir                     break;
427cdf0e10cSrcweir                 // --> FME 2004-07-30 #i32329# Enhanced table selection
428cdf0e10cSrcweir                 case SW_TABSEL_HORI:
429cdf0e10cSrcweir                 case SW_TABSEL_HORI_RTL:
430cdf0e10cSrcweir                 case SW_TABSEL_VERT:
431cdf0e10cSrcweir                     nTabRes = STR_TABLE_SELECT_ALL;
432cdf0e10cSrcweir                     break;
433cdf0e10cSrcweir                 case SW_TABROWSEL_HORI:
434cdf0e10cSrcweir                 case SW_TABROWSEL_HORI_RTL:
435cdf0e10cSrcweir                 case SW_TABROWSEL_VERT:
436cdf0e10cSrcweir                     nTabRes = STR_TABLE_SELECT_ROW;
437cdf0e10cSrcweir                     break;
438cdf0e10cSrcweir                 case SW_TABCOLSEL_HORI:
439cdf0e10cSrcweir                 case SW_TABCOLSEL_VERT:
440cdf0e10cSrcweir                     nTabRes = STR_TABLE_SELECT_COL;
441cdf0e10cSrcweir                     break;
442cdf0e10cSrcweir                 // <--
443cdf0e10cSrcweir             }
444cdf0e10cSrcweir             if(nTabRes)
445cdf0e10cSrcweir             {
446cdf0e10cSrcweir                 sTxt = SW_RESSTR(nTabRes);
447cdf0e10cSrcweir                 Size aTxtSize( GetTextWidth(sTxt), GetTextHeight());
448cdf0e10cSrcweir                 Rectangle aRect(rEvt.GetMousePosPixel(), aTxtSize);
449cdf0e10cSrcweir                 Help::ShowQuickHelp(this, aRect, sTxt);
450cdf0e10cSrcweir             }
451cdf0e10cSrcweir             bWeiter = sal_False;
452cdf0e10cSrcweir         }
453cdf0e10cSrcweir     }
454cdf0e10cSrcweir 
455cdf0e10cSrcweir /*
456cdf0e10cSrcweir aktuelle Zeichenvorlage anzeigen?
457cdf0e10cSrcweir 	if( bWeiter && rEvt.GetMode() & ( HELPMODE_QUICK | HELPMODE_BALLOON ))
458cdf0e10cSrcweir 	{
459cdf0e10cSrcweir 		SwCharFmt* pChrFmt = rSh.GetCurCharFmt();
460cdf0e10cSrcweir 
461cdf0e10cSrcweir 	}
462cdf0e10cSrcweir */
463cdf0e10cSrcweir     if( bWeiter && pSdrView && bQuickBalloon)
464cdf0e10cSrcweir 	{
465cdf0e10cSrcweir 		SdrViewEvent aVEvt;
466cdf0e10cSrcweir 		SdrHitKind eHit = pSdrView->PickAnything(aPos, aVEvt);
467cdf0e10cSrcweir 		const SvxURLField *pField;
468cdf0e10cSrcweir 		SdrObject* pObj = NULL;
469cdf0e10cSrcweir 
470cdf0e10cSrcweir 		if ((pField = aVEvt.pURLField) != 0)
471cdf0e10cSrcweir 		{
472cdf0e10cSrcweir 			// URL-Feld getroffen
473cdf0e10cSrcweir 			if (pField)
474cdf0e10cSrcweir 			{
475cdf0e10cSrcweir 				pObj = aVEvt.pObj;
476cdf0e10cSrcweir 				sTxt = pField->GetURL();
477cdf0e10cSrcweir 
478cdf0e10cSrcweir 				bWeiter = sal_False;
479cdf0e10cSrcweir 			}
480cdf0e10cSrcweir 		}
481cdf0e10cSrcweir 		if (bWeiter && eHit == SDRHIT_TEXTEDIT)
482cdf0e10cSrcweir 		{
483cdf0e10cSrcweir 			// URL-Feld in zum Editieren ge?ffneten DrawText-Objekt suchen
484cdf0e10cSrcweir 			OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
485cdf0e10cSrcweir 			const SvxFieldItem* pFieldItem;
486cdf0e10cSrcweir 
487cdf0e10cSrcweir 			if (pSdrView->AreObjectsMarked())
488cdf0e10cSrcweir 			{
489cdf0e10cSrcweir 				const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
490cdf0e10cSrcweir 
491cdf0e10cSrcweir 				if (rMarkList.GetMarkCount() == 1)
492cdf0e10cSrcweir 					pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
493cdf0e10cSrcweir 			}
494cdf0e10cSrcweir 
495cdf0e10cSrcweir 			if (pObj && pObj->ISA(SdrTextObj) && pOLV &&
496cdf0e10cSrcweir 					(pFieldItem = pOLV->GetFieldUnderMousePointer()) != 0)
497cdf0e10cSrcweir 			{
498cdf0e10cSrcweir                 pField = dynamic_cast<const SvxURLField*>(pFieldItem->GetField());
499cdf0e10cSrcweir 
500cdf0e10cSrcweir                 if (pField )
501cdf0e10cSrcweir 				{
502cdf0e10cSrcweir 					sTxt = ((const SvxURLField*) pField)->GetURL();
503cdf0e10cSrcweir 					bWeiter = sal_False;
504cdf0e10cSrcweir 				}
505cdf0e10cSrcweir 			}
506cdf0e10cSrcweir 		}
507cdf0e10cSrcweir 		if (sTxt.Len() && pObj)
508cdf0e10cSrcweir 		{
509cdf0e10cSrcweir 			sTxt = URIHelper::removePassword( sTxt, INetURLObject::WAS_ENCODED,
510cdf0e10cSrcweir 			   							INetURLObject::DECODE_UNAMBIGUOUS);
511cdf0e10cSrcweir 
512cdf0e10cSrcweir 			Rectangle aLogicPix = LogicToPixel(pObj->GetLogicRect());
513cdf0e10cSrcweir 			Rectangle aScreenRect(OutputToScreenPixel(aLogicPix.TopLeft()),
514cdf0e10cSrcweir 								OutputToScreenPixel(aLogicPix.BottomRight()));
515cdf0e10cSrcweir 
516cdf0e10cSrcweir 			if (bBalloon)
517cdf0e10cSrcweir 				Help::ShowBalloon(this, rEvt.GetMousePosPixel(), aScreenRect, sTxt);
518cdf0e10cSrcweir 			else
519cdf0e10cSrcweir 				Help::ShowQuickHelp(this, aScreenRect, sTxt);
520cdf0e10cSrcweir 		}
521cdf0e10cSrcweir 	}
522cdf0e10cSrcweir 
523cdf0e10cSrcweir 	if( bWeiter )
524cdf0e10cSrcweir 		Window::RequestHelp( rEvt );
525cdf0e10cSrcweir }
526cdf0e10cSrcweir 
527cdf0e10cSrcweir void SwEditWin::PrePaint()
528cdf0e10cSrcweir {
529cdf0e10cSrcweir 	SwWrtShell* pWrtShell = GetView().GetWrtShellPtr();
530cdf0e10cSrcweir 
531cdf0e10cSrcweir     if(pWrtShell)
532cdf0e10cSrcweir     {
533cdf0e10cSrcweir 		pWrtShell->PrePaint();
534cdf0e10cSrcweir     }
535cdf0e10cSrcweir }
536cdf0e10cSrcweir 
537cdf0e10cSrcweir void  SwEditWin::Paint(const Rectangle& rRect)
538cdf0e10cSrcweir {
539cdf0e10cSrcweir #if defined(MYDEBUG)
540cdf0e10cSrcweir 	// StartUp-Statistik
541cdf0e10cSrcweir 	if ( pTickList )
542cdf0e10cSrcweir 	{
543cdf0e10cSrcweir 		SYSTICK( "Start SwEditWin::Paint" );
544cdf0e10cSrcweir 		READ_FIRST_TICKS()
545cdf0e10cSrcweir 		FLUSH_TICKS()
546cdf0e10cSrcweir 	}
547cdf0e10cSrcweir #endif
548cdf0e10cSrcweir 
549cdf0e10cSrcweir 	SwWrtShell* pWrtShell = GetView().GetWrtShellPtr();
550cdf0e10cSrcweir 	if(!pWrtShell)
551cdf0e10cSrcweir 		return;
552cdf0e10cSrcweir 	sal_Bool bPaintShadowCrsr = sal_False;
553cdf0e10cSrcweir 	if( pShadCrsr )
554cdf0e10cSrcweir 	{
555cdf0e10cSrcweir 		Rectangle aRect( pShadCrsr->GetRect());
556cdf0e10cSrcweir 		// liegt vollstaendig drin?
557cdf0e10cSrcweir 		if( rRect.IsInside( aRect ) )
558cdf0e10cSrcweir 			// dann aufheben
559cdf0e10cSrcweir 			delete pShadCrsr, pShadCrsr = 0;
560cdf0e10cSrcweir 		else if( rRect.IsOver( aRect ))
561cdf0e10cSrcweir 		{
562cdf0e10cSrcweir 			// liegt irgendwie drueber, dann ist alles ausserhalb geclippt
563cdf0e10cSrcweir 			// und wir muessen den "inneren Teil" am Ende vom Paint
564cdf0e10cSrcweir 			// wieder sichtbar machen. Sonst kommt es zu Paintfehlern!
565cdf0e10cSrcweir 			bPaintShadowCrsr = sal_True;
566cdf0e10cSrcweir 		}
567cdf0e10cSrcweir 	}
568cdf0e10cSrcweir /*
569cdf0e10cSrcweir     //TODO/LATER: what's the replacement for this? Do we need it?
570cdf0e10cSrcweir 	SwDocShell* pDocShell = GetView().GetDocShell();
571cdf0e10cSrcweir 
572cdf0e10cSrcweir   SvInPlaceEnvironment *pIpEnv =  pDocShell ?
573cdf0e10cSrcweir 								  pDocShell->GetIPEnv() : 0;
574cdf0e10cSrcweir 	if ( pIpEnv && pIpEnv->GetRectsChangedLockCount() )
575cdf0e10cSrcweir 		//Wir stehen in Groessenverhandlungen (MM), Paint verzoegern
576cdf0e10cSrcweir 		Invalidate( rRect );
577cdf0e10cSrcweir     else */
578cdf0e10cSrcweir     if ( GetView().GetVisArea().GetWidth()  <= 0 ||
579cdf0e10cSrcweir 			  GetView().GetVisArea().GetHeight() <= 0 )
580cdf0e10cSrcweir 		Invalidate( rRect );
581cdf0e10cSrcweir 	else
582cdf0e10cSrcweir 		pWrtShell->Paint( rRect );
583cdf0e10cSrcweir 
584cdf0e10cSrcweir 	if( bPaintShadowCrsr )
585cdf0e10cSrcweir 		pShadCrsr->Paint();
586cdf0e10cSrcweir }
587cdf0e10cSrcweir 
588cdf0e10cSrcweir 
589