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