1efeef26fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3efeef26fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4efeef26fSAndrew Rist * or more contributor license agreements. See the NOTICE file
5efeef26fSAndrew Rist * distributed with this work for additional information
6efeef26fSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7efeef26fSAndrew Rist * to you under the Apache License, Version 2.0 (the
8efeef26fSAndrew Rist * "License"); you may not use this file except in compliance
9efeef26fSAndrew Rist * with the License. You may obtain a copy of the License at
10cdf0e10cSrcweir *
11efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir *
13efeef26fSAndrew Rist * Unless required by applicable law or agreed to in writing,
14efeef26fSAndrew Rist * software distributed under the License is distributed on an
15efeef26fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16efeef26fSAndrew Rist * KIND, either express or implied. See the License for the
17efeef26fSAndrew Rist * specific language governing permissions and limitations
18efeef26fSAndrew Rist * under the License.
19cdf0e10cSrcweir *
20efeef26fSAndrew Rist *************************************************************/
21efeef26fSAndrew Rist
22efeef26fSAndrew 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 --------------------------------------------------------------------*/
lcl_GetRedlineHelp(const SwRedline & rRedl,String & rTxt,sal_Bool bBalloon)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
RequestHelp(const HelpEvent & rEvt)107cdf0e10cSrcweir void SwEditWin::RequestHelp(const HelpEvent &rEvt)
108cdf0e10cSrcweir {
109cdf0e10cSrcweir SwWrtShell &rSh = rView.GetWrtShell();
110cdf0e10cSrcweir sal_Bool bQuickBalloon = 0 != (rEvt.GetMode() & ( HELPMODE_QUICK | HELPMODE_BALLOON ));
111ef785786SAriel Constenla-Haile if(bQuickBalloon && !rSh.GetViewOptions()->IsShowContentTips())
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 // special handling if target is a cross-reference bookmark
191cdf0e10cSrcweir {
192cdf0e10cSrcweir String sTmpSearchStr = sTxt.Copy( 1, sTxt.Len() );
193*69a74367SOliver-Rainer Wittmann IDocumentMarkAccess* const pMarkAccess = rSh.getIDocumentMarkAccess();
194*69a74367SOliver-Rainer Wittmann IDocumentMarkAccess::const_iterator_t ppBkmk = pMarkAccess->findBookmark( sTmpSearchStr );
195*69a74367SOliver-Rainer Wittmann if ( ppBkmk != pMarkAccess->getBookmarksEnd()
196*69a74367SOliver-Rainer Wittmann && IDocumentMarkAccess::GetType( *(ppBkmk->get()) ) == IDocumentMarkAccess::CROSSREF_HEADING_BOOKMARK )
197cdf0e10cSrcweir {
198cdf0e10cSrcweir SwTxtNode* pTxtNode = ppBkmk->get()->GetMarkStart().nNode.GetNode().GetTxtNode();
199cdf0e10cSrcweir if ( pTxtNode )
200cdf0e10cSrcweir {
201cdf0e10cSrcweir sTxt = pTxtNode->GetExpandTxt( 0, pTxtNode->Len(), true, true );
202cdf0e10cSrcweir
203cdf0e10cSrcweir if( sTxt.Len() )
204cdf0e10cSrcweir {
205cdf0e10cSrcweir sTxt.EraseAllChars( 0xad );
206cdf0e10cSrcweir for( sal_Unicode* p = sTxt.GetBufferAccess(); *p; ++p )
207cdf0e10cSrcweir {
208cdf0e10cSrcweir if( *p < 0x20 )
209cdf0e10cSrcweir *p = 0x20;
210cdf0e10cSrcweir else if(*p == 0x2011)
211cdf0e10cSrcweir *p = '-';
212cdf0e10cSrcweir }
213cdf0e10cSrcweir }
214cdf0e10cSrcweir }
215cdf0e10cSrcweir }
216cdf0e10cSrcweir }
217*69a74367SOliver-Rainer Wittmann
218cdf0e10cSrcweir sal_Bool bExecHyperlinks = rView.GetDocShell()->IsReadOnly();
219cdf0e10cSrcweir if ( !bExecHyperlinks )
220cdf0e10cSrcweir {
221cdf0e10cSrcweir SvtSecurityOptions aSecOpts;
222cdf0e10cSrcweir bExecHyperlinks = !aSecOpts.IsOptionSet( SvtSecurityOptions::E_CTRLCLICK_HYPERLINK );
223cdf0e10cSrcweir
224cdf0e10cSrcweir if ( !bExecHyperlinks )
225cdf0e10cSrcweir {
226cdf0e10cSrcweir sTxt.InsertAscii( ": ", 0 );
227cdf0e10cSrcweir sTxt.Insert( ViewShell::GetShellRes()->aHyperlinkClick, 0 );
228cdf0e10cSrcweir }
229cdf0e10cSrcweir }
230cdf0e10cSrcweir break;
231cdf0e10cSrcweir }
232cdf0e10cSrcweir case SwContentAtPos::SW_SMARTTAG:
233cdf0e10cSrcweir {
234cdf0e10cSrcweir sTxt = SW_RESSTR(STR_SMARTTAG_CLICK);
235cdf0e10cSrcweir
236cdf0e10cSrcweir KeyCode aCode( KEY_SPACE );
237cdf0e10cSrcweir KeyCode aModifiedCode( KEY_SPACE, KEY_MOD1 );
238cdf0e10cSrcweir String aModStr( aModifiedCode.GetName() );
239cdf0e10cSrcweir aModStr.SearchAndReplace( aCode.GetName(), String() );
240cdf0e10cSrcweir aModStr.SearchAndReplaceAllAscii( "+", String() );
241cdf0e10cSrcweir sTxt.SearchAndReplaceAllAscii( "%s", aModStr );
242cdf0e10cSrcweir }
243cdf0e10cSrcweir break;
244cdf0e10cSrcweir
245cdf0e10cSrcweir case SwContentAtPos::SW_FTN:
246cdf0e10cSrcweir if( aCntntAtPos.pFndTxtAttr && aCntntAtPos.aFnd.pAttr )
247cdf0e10cSrcweir {
248cdf0e10cSrcweir const SwFmtFtn* pFtn = (SwFmtFtn*)aCntntAtPos.aFnd.pAttr;
249cdf0e10cSrcweir pFtn->GetFtnText( sTxt );
250cdf0e10cSrcweir sTxt.Insert( SW_RESSTR( pFtn->IsEndNote()
251cdf0e10cSrcweir ? STR_ENDNOTE : STR_FTNNOTE ), 0 );
252cdf0e10cSrcweir if( aCntntAtPos.IsInRTLText() )
253cdf0e10cSrcweir nStyle |= QUICKHELP_BIDI_RTL;
254cdf0e10cSrcweir }
255cdf0e10cSrcweir break;
256cdf0e10cSrcweir
257cdf0e10cSrcweir case SwContentAtPos::SW_REDLINE:
258cdf0e10cSrcweir lcl_GetRedlineHelp( *aCntntAtPos.aFnd.pRedl, sTxt, bBalloon );
259cdf0e10cSrcweir break;
260cdf0e10cSrcweir
261cdf0e10cSrcweir case SwContentAtPos::SW_TOXMARK:
262cdf0e10cSrcweir sTxt = aCntntAtPos.sStr;
263cdf0e10cSrcweir if( sTxt.Len() && aCntntAtPos.pFndTxtAttr )
264cdf0e10cSrcweir {
265cdf0e10cSrcweir const SwTOXType* pTType = aCntntAtPos.pFndTxtAttr->
266cdf0e10cSrcweir GetTOXMark().GetTOXType();
267cdf0e10cSrcweir if( pTType && pTType->GetTypeName().Len() )
268cdf0e10cSrcweir {
269cdf0e10cSrcweir sTxt.InsertAscii( ": ", 0 );
270cdf0e10cSrcweir sTxt.Insert( pTType->GetTypeName(), 0 );
271cdf0e10cSrcweir }
272cdf0e10cSrcweir }
273cdf0e10cSrcweir break;
274*69a74367SOliver-Rainer Wittmann
275cdf0e10cSrcweir case SwContentAtPos::SW_REFMARK:
276cdf0e10cSrcweir if(aCntntAtPos.aFnd.pAttr)
277cdf0e10cSrcweir {
278cdf0e10cSrcweir sTxt = SW_RES(STR_CONTENT_TYPE_SINGLE_REFERENCE);
279cdf0e10cSrcweir sTxt.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": "));
280cdf0e10cSrcweir sTxt += ((const SwFmtRefMark*)aCntntAtPos.aFnd.pAttr)->GetRefName();
281cdf0e10cSrcweir }
282cdf0e10cSrcweir break;
283cdf0e10cSrcweir
284cdf0e10cSrcweir default:
285cdf0e10cSrcweir {
286cdf0e10cSrcweir SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig();
287cdf0e10cSrcweir if(!pModOpt->IsHideFieldTips())
288cdf0e10cSrcweir {
289cdf0e10cSrcweir const SwField* pFld = aCntntAtPos.aFnd.pFld;
290cdf0e10cSrcweir switch( pFld->Which() )
291cdf0e10cSrcweir {
292cdf0e10cSrcweir case RES_SETEXPFLD:
293cdf0e10cSrcweir case RES_TABLEFLD:
294cdf0e10cSrcweir case RES_GETEXPFLD:
295cdf0e10cSrcweir {
296cdf0e10cSrcweir sal_uInt16 nOldSubType = pFld->GetSubType();
297cdf0e10cSrcweir ((SwField*)pFld)->SetSubType(nsSwExtendedSubType::SUB_CMD);
298cdf0e10cSrcweir sTxt = pFld->ExpandField(true);
299cdf0e10cSrcweir ((SwField*)pFld)->SetSubType(nOldSubType);
300cdf0e10cSrcweir }
301cdf0e10cSrcweir break;
302cdf0e10cSrcweir
303cdf0e10cSrcweir case RES_POSTITFLD:
304cdf0e10cSrcweir {
305cdf0e10cSrcweir break;
306cdf0e10cSrcweir }
307cdf0e10cSrcweir case RES_INPUTFLD: // BubbleHelp, da der Hinweis ggf ziemlich lang sein kann
308cdf0e10cSrcweir bBalloon = sal_True;
309cdf0e10cSrcweir /* no break */
310cdf0e10cSrcweir case RES_JUMPEDITFLD:
311cdf0e10cSrcweir sTxt = pFld->GetPar2();
312cdf0e10cSrcweir break;
313cdf0e10cSrcweir
314cdf0e10cSrcweir case RES_DBFLD:
315cdf0e10cSrcweir sTxt = pFld->GetFieldName();
316cdf0e10cSrcweir break;
317cdf0e10cSrcweir
318cdf0e10cSrcweir case RES_USERFLD:
319cdf0e10cSrcweir case RES_HIDDENTXTFLD:
320cdf0e10cSrcweir sTxt = pFld->GetPar1();
321cdf0e10cSrcweir break;
322cdf0e10cSrcweir
323cdf0e10cSrcweir case RES_DOCSTATFLD:
324cdf0e10cSrcweir break;
325cdf0e10cSrcweir
326cdf0e10cSrcweir case RES_MACROFLD:
327cdf0e10cSrcweir sTxt = ((const SwMacroField*)pFld)->GetMacro();
328cdf0e10cSrcweir break;
329cdf0e10cSrcweir
330cdf0e10cSrcweir case RES_GETREFFLD:
331cdf0e10cSrcweir {
332cdf0e10cSrcweir const SwGetRefField* pRefFld( dynamic_cast<const SwGetRefField*>(pFld) );
333cdf0e10cSrcweir ASSERT( pRefFld,
334cdf0e10cSrcweir "<SwEditWin::RequestHelp(..)> - unexpected type of <pFld>" );
335cdf0e10cSrcweir if ( pRefFld )
336cdf0e10cSrcweir {
337cdf0e10cSrcweir if ( pRefFld->IsRefToHeadingCrossRefBookmark() ||
338cdf0e10cSrcweir pRefFld->IsRefToNumItemCrossRefBookmark() )
339cdf0e10cSrcweir {
340cdf0e10cSrcweir sTxt = pRefFld->GetExpandedTxtOfReferencedTxtNode();
341cdf0e10cSrcweir if ( sTxt.Len() > 80 )
342cdf0e10cSrcweir {
343cdf0e10cSrcweir sTxt.Erase( 80 );
344cdf0e10cSrcweir sTxt += '.';
345cdf0e10cSrcweir sTxt += '.';
346cdf0e10cSrcweir sTxt += '.';
347cdf0e10cSrcweir }
348cdf0e10cSrcweir }
349cdf0e10cSrcweir else
350cdf0e10cSrcweir {
351cdf0e10cSrcweir sTxt = ((SwGetRefField*)pFld)->GetSetRefName();
352cdf0e10cSrcweir }
353cdf0e10cSrcweir }
354cdf0e10cSrcweir }
355cdf0e10cSrcweir break;
356cdf0e10cSrcweir }
357cdf0e10cSrcweir }
358cdf0e10cSrcweir
359cdf0e10cSrcweir if( !sTxt.Len() )
360cdf0e10cSrcweir {
361cdf0e10cSrcweir aCntntAtPos.eCntntAtPos = SwContentAtPos::SW_REDLINE;
362cdf0e10cSrcweir if( rSh.GetContentAtPos( aPos, aCntntAtPos, sal_False, &aFldRect ) )
363*69a74367SOliver-Rainer Wittmann lcl_GetRedlineHelp( *aCntntAtPos.aFnd.pRedl, sTxt, bBalloon );
364cdf0e10cSrcweir }
365cdf0e10cSrcweir }
366cdf0e10cSrcweir }
367cdf0e10cSrcweir if (sTxt.Len() )
368cdf0e10cSrcweir {
369cdf0e10cSrcweir if( bBalloon )
370cdf0e10cSrcweir Help::ShowBalloon( this, rEvt.GetMousePosPixel(), sTxt );
371cdf0e10cSrcweir else
372cdf0e10cSrcweir {
373cdf0e10cSrcweir // dann zeige die Hilfe mal an:
374cdf0e10cSrcweir Rectangle aRect( aFldRect.SVRect() );
375cdf0e10cSrcweir Point aPt( OutputToScreenPixel( LogicToPixel( aRect.TopLeft() )));
376cdf0e10cSrcweir aRect.Left() = aPt.X();
377cdf0e10cSrcweir aRect.Top() = aPt.Y();
378cdf0e10cSrcweir aPt = OutputToScreenPixel( LogicToPixel( aRect.BottomRight() ));
379cdf0e10cSrcweir aRect.Right() = aPt.X();
380cdf0e10cSrcweir aRect.Bottom() = aPt.Y();
381cdf0e10cSrcweir Help::ShowQuickHelp( this, aRect, sTxt, nStyle );
382cdf0e10cSrcweir }
383cdf0e10cSrcweir }
384cdf0e10cSrcweir
385cdf0e10cSrcweir bWeiter = sal_False;
386cdf0e10cSrcweir }
387cdf0e10cSrcweir if( bWeiter )
388cdf0e10cSrcweir {
389cdf0e10cSrcweir sal_uInt8 nTabCols = rSh.WhichMouseTabCol(aPos);
390cdf0e10cSrcweir sal_uInt16 nTabRes = 0;
391cdf0e10cSrcweir switch(nTabCols)
392cdf0e10cSrcweir {
393cdf0e10cSrcweir case SW_TABCOL_HORI:
394cdf0e10cSrcweir case SW_TABCOL_VERT:
395cdf0e10cSrcweir nTabRes = STR_TABLE_COL_ADJUST;
396cdf0e10cSrcweir break;
397cdf0e10cSrcweir case SW_TABROW_HORI:
398cdf0e10cSrcweir case SW_TABROW_VERT:
399cdf0e10cSrcweir nTabRes = STR_TABLE_ROW_ADJUST;
400cdf0e10cSrcweir break;
401cdf0e10cSrcweir case SW_TABSEL_HORI:
402cdf0e10cSrcweir case SW_TABSEL_HORI_RTL:
403cdf0e10cSrcweir case SW_TABSEL_VERT:
404cdf0e10cSrcweir nTabRes = STR_TABLE_SELECT_ALL;
405cdf0e10cSrcweir break;
406cdf0e10cSrcweir case SW_TABROWSEL_HORI:
407cdf0e10cSrcweir case SW_TABROWSEL_HORI_RTL:
408cdf0e10cSrcweir case SW_TABROWSEL_VERT:
409cdf0e10cSrcweir nTabRes = STR_TABLE_SELECT_ROW;
410cdf0e10cSrcweir break;
411cdf0e10cSrcweir case SW_TABCOLSEL_HORI:
412cdf0e10cSrcweir case SW_TABCOLSEL_VERT:
413cdf0e10cSrcweir nTabRes = STR_TABLE_SELECT_COL;
414cdf0e10cSrcweir break;
415cdf0e10cSrcweir }
416cdf0e10cSrcweir if(nTabRes)
417cdf0e10cSrcweir {
418cdf0e10cSrcweir sTxt = SW_RESSTR(nTabRes);
419cdf0e10cSrcweir Size aTxtSize( GetTextWidth(sTxt), GetTextHeight());
420cdf0e10cSrcweir Rectangle aRect(rEvt.GetMousePosPixel(), aTxtSize);
421cdf0e10cSrcweir Help::ShowQuickHelp(this, aRect, sTxt);
422cdf0e10cSrcweir }
423cdf0e10cSrcweir bWeiter = sal_False;
424cdf0e10cSrcweir }
425cdf0e10cSrcweir }
426cdf0e10cSrcweir
427cdf0e10cSrcweir /*
428cdf0e10cSrcweir aktuelle Zeichenvorlage anzeigen?
429cdf0e10cSrcweir if( bWeiter && rEvt.GetMode() & ( HELPMODE_QUICK | HELPMODE_BALLOON ))
430cdf0e10cSrcweir {
431cdf0e10cSrcweir SwCharFmt* pChrFmt = rSh.GetCurCharFmt();
432cdf0e10cSrcweir
433cdf0e10cSrcweir }
434cdf0e10cSrcweir */
435cdf0e10cSrcweir if( bWeiter && pSdrView && bQuickBalloon)
436cdf0e10cSrcweir {
437cdf0e10cSrcweir SdrViewEvent aVEvt;
438cdf0e10cSrcweir SdrHitKind eHit = pSdrView->PickAnything(aPos, aVEvt);
439cdf0e10cSrcweir const SvxURLField *pField;
440cdf0e10cSrcweir SdrObject* pObj = NULL;
441cdf0e10cSrcweir
442cdf0e10cSrcweir if ((pField = aVEvt.pURLField) != 0)
443cdf0e10cSrcweir {
444cdf0e10cSrcweir // URL-Feld getroffen
445cdf0e10cSrcweir if (pField)
446cdf0e10cSrcweir {
447cdf0e10cSrcweir pObj = aVEvt.pObj;
448cdf0e10cSrcweir sTxt = pField->GetURL();
449cdf0e10cSrcweir
450cdf0e10cSrcweir bWeiter = sal_False;
451cdf0e10cSrcweir }
452cdf0e10cSrcweir }
453cdf0e10cSrcweir if (bWeiter && eHit == SDRHIT_TEXTEDIT)
454cdf0e10cSrcweir {
455cdf0e10cSrcweir // URL-Feld in zum Editieren ge?ffneten DrawText-Objekt suchen
456cdf0e10cSrcweir OutlinerView* pOLV = pSdrView->GetTextEditOutlinerView();
457cdf0e10cSrcweir const SvxFieldItem* pFieldItem;
458cdf0e10cSrcweir
459cdf0e10cSrcweir if (pSdrView->AreObjectsMarked())
460cdf0e10cSrcweir {
461cdf0e10cSrcweir const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
462cdf0e10cSrcweir
463cdf0e10cSrcweir if (rMarkList.GetMarkCount() == 1)
464cdf0e10cSrcweir pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
465cdf0e10cSrcweir }
466cdf0e10cSrcweir
467cdf0e10cSrcweir if (pObj && pObj->ISA(SdrTextObj) && pOLV &&
468cdf0e10cSrcweir (pFieldItem = pOLV->GetFieldUnderMousePointer()) != 0)
469cdf0e10cSrcweir {
470cdf0e10cSrcweir pField = dynamic_cast<const SvxURLField*>(pFieldItem->GetField());
471cdf0e10cSrcweir
472cdf0e10cSrcweir if (pField )
473cdf0e10cSrcweir {
474cdf0e10cSrcweir sTxt = ((const SvxURLField*) pField)->GetURL();
475cdf0e10cSrcweir bWeiter = sal_False;
476cdf0e10cSrcweir }
477cdf0e10cSrcweir }
478cdf0e10cSrcweir }
479cdf0e10cSrcweir if (sTxt.Len() && pObj)
480cdf0e10cSrcweir {
481cdf0e10cSrcweir sTxt = URIHelper::removePassword( sTxt, INetURLObject::WAS_ENCODED,
482cdf0e10cSrcweir INetURLObject::DECODE_UNAMBIGUOUS);
483cdf0e10cSrcweir
484cdf0e10cSrcweir Rectangle aLogicPix = LogicToPixel(pObj->GetLogicRect());
485cdf0e10cSrcweir Rectangle aScreenRect(OutputToScreenPixel(aLogicPix.TopLeft()),
486cdf0e10cSrcweir OutputToScreenPixel(aLogicPix.BottomRight()));
487cdf0e10cSrcweir
488cdf0e10cSrcweir if (bBalloon)
489cdf0e10cSrcweir Help::ShowBalloon(this, rEvt.GetMousePosPixel(), aScreenRect, sTxt);
490cdf0e10cSrcweir else
491cdf0e10cSrcweir Help::ShowQuickHelp(this, aScreenRect, sTxt);
492cdf0e10cSrcweir }
493cdf0e10cSrcweir }
494cdf0e10cSrcweir
495cdf0e10cSrcweir if( bWeiter )
496cdf0e10cSrcweir Window::RequestHelp( rEvt );
497cdf0e10cSrcweir }
498cdf0e10cSrcweir
PrePaint()499cdf0e10cSrcweir void SwEditWin::PrePaint()
500cdf0e10cSrcweir {
501cdf0e10cSrcweir SwWrtShell* pWrtShell = GetView().GetWrtShellPtr();
502cdf0e10cSrcweir
503cdf0e10cSrcweir if(pWrtShell)
504cdf0e10cSrcweir {
505cdf0e10cSrcweir pWrtShell->PrePaint();
506cdf0e10cSrcweir }
507cdf0e10cSrcweir }
508cdf0e10cSrcweir
Paint(const Rectangle & rRect)509cdf0e10cSrcweir void SwEditWin::Paint(const Rectangle& rRect)
510cdf0e10cSrcweir {
511cdf0e10cSrcweir #if defined(MYDEBUG)
512cdf0e10cSrcweir // StartUp-Statistik
513cdf0e10cSrcweir if ( pTickList )
514cdf0e10cSrcweir {
515cdf0e10cSrcweir SYSTICK( "Start SwEditWin::Paint" );
516cdf0e10cSrcweir READ_FIRST_TICKS()
517cdf0e10cSrcweir FLUSH_TICKS()
518cdf0e10cSrcweir }
519cdf0e10cSrcweir #endif
520cdf0e10cSrcweir
521cdf0e10cSrcweir SwWrtShell* pWrtShell = GetView().GetWrtShellPtr();
522cdf0e10cSrcweir if(!pWrtShell)
523cdf0e10cSrcweir return;
524cdf0e10cSrcweir sal_Bool bPaintShadowCrsr = sal_False;
525cdf0e10cSrcweir if( pShadCrsr )
526cdf0e10cSrcweir {
527cdf0e10cSrcweir Rectangle aRect( pShadCrsr->GetRect());
528cdf0e10cSrcweir // liegt vollstaendig drin?
529cdf0e10cSrcweir if( rRect.IsInside( aRect ) )
530cdf0e10cSrcweir // dann aufheben
531cdf0e10cSrcweir delete pShadCrsr, pShadCrsr = 0;
532cdf0e10cSrcweir else if( rRect.IsOver( aRect ))
533cdf0e10cSrcweir {
534cdf0e10cSrcweir // liegt irgendwie drueber, dann ist alles ausserhalb geclippt
535cdf0e10cSrcweir // und wir muessen den "inneren Teil" am Ende vom Paint
536cdf0e10cSrcweir // wieder sichtbar machen. Sonst kommt es zu Paintfehlern!
537cdf0e10cSrcweir bPaintShadowCrsr = sal_True;
538cdf0e10cSrcweir }
539cdf0e10cSrcweir }
540cdf0e10cSrcweir /*
541cdf0e10cSrcweir //TODO/LATER: what's the replacement for this? Do we need it?
542cdf0e10cSrcweir SwDocShell* pDocShell = GetView().GetDocShell();
543cdf0e10cSrcweir
544cdf0e10cSrcweir SvInPlaceEnvironment *pIpEnv = pDocShell ?
545cdf0e10cSrcweir pDocShell->GetIPEnv() : 0;
546cdf0e10cSrcweir if ( pIpEnv && pIpEnv->GetRectsChangedLockCount() )
547cdf0e10cSrcweir //Wir stehen in Groessenverhandlungen (MM), Paint verzoegern
548cdf0e10cSrcweir Invalidate( rRect );
549cdf0e10cSrcweir else */
550cdf0e10cSrcweir if ( GetView().GetVisArea().GetWidth() <= 0 ||
551cdf0e10cSrcweir GetView().GetVisArea().GetHeight() <= 0 )
552cdf0e10cSrcweir Invalidate( rRect );
553cdf0e10cSrcweir else
554cdf0e10cSrcweir pWrtShell->Paint( rRect );
555cdf0e10cSrcweir
556cdf0e10cSrcweir if( bPaintShadowCrsr )
557cdf0e10cSrcweir pShadCrsr->Paint();
558cdf0e10cSrcweir }
559cdf0e10cSrcweir
560cdf0e10cSrcweir
561