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
10efeef26fSAndrew Rist *
11efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12efeef26fSAndrew Rist *
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.
19efeef26fSAndrew Rist *
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
14369a74367SOliver-Rainer Wittmann SwContentAtPos::SW_TABLEBOXVALUE |
14469a74367SOliver-Rainer Wittmann ( bBalloon ? SwContentAtPos::SW_CURR_ATTRS : 0) |
145cdf0e10cSrcweir #endif
14669a74367SOliver-Rainer Wittmann SwContentAtPos::SW_TABLEBOXFML );
147cdf0e10cSrcweir
14869a74367SOliver-Rainer Wittmann if( rSh.GetContentAtPos( aPos, aCntntAtPos, sal_False, &aFldRect ) )
14969a74367SOliver-Rainer Wittmann {
15069a74367SOliver-Rainer Wittmann switch( aCntntAtPos.eCntntAtPos )
151cdf0e10cSrcweir {
15269a74367SOliver-Rainer Wittmann case SwContentAtPos::SW_TABLEBOXFML:
153*6c6fa461Smseidel sTxt.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "=" ));
15469a74367SOliver-Rainer Wittmann sTxt += ((SwTblBoxFormula*)aCntntAtPos.aFnd.pAttr)->GetFormula();
15569a74367SOliver-Rainer Wittmann break;
15669a74367SOliver-Rainer Wittmann #ifdef DBG_UTIL
15769a74367SOliver-Rainer Wittmann case SwContentAtPos::SW_TABLEBOXVALUE:
158cdf0e10cSrcweir {
15969a74367SOliver-Rainer Wittmann sTxt = UniString(
16069a74367SOliver-Rainer Wittmann ByteString::CreateFromDouble(
16169a74367SOliver-Rainer Wittmann ((SwTblBoxValue*)aCntntAtPos.aFnd.pAttr)->GetValue() )
16269a74367SOliver-Rainer Wittmann , gsl_getSystemTextEncoding());
163cdf0e10cSrcweir }
16469a74367SOliver-Rainer Wittmann break;
16569a74367SOliver-Rainer Wittmann case SwContentAtPos::SW_CURR_ATTRS:
16669a74367SOliver-Rainer Wittmann sTxt = aCntntAtPos.sStr;
16769a74367SOliver-Rainer Wittmann break;
16869a74367SOliver-Rainer Wittmann #endif
16969a74367SOliver-Rainer Wittmann
17069a74367SOliver-Rainer Wittmann case SwContentAtPos::SW_INETATTR:
171cdf0e10cSrcweir {
17269a74367SOliver-Rainer Wittmann sTxt = ((SfxStringItem*)aCntntAtPos.aFnd.pAttr)->GetValue();
17369a74367SOliver-Rainer Wittmann sTxt = URIHelper::removePassword( sTxt,
17469a74367SOliver-Rainer Wittmann INetURLObject::WAS_ENCODED,
17569a74367SOliver-Rainer Wittmann INetURLObject::DECODE_UNAMBIGUOUS);
17669a74367SOliver-Rainer Wittmann //#i63832# remove the link target type
17769a74367SOliver-Rainer Wittmann xub_StrLen nFound = sTxt.Search(cMarkSeperator);
17869a74367SOliver-Rainer Wittmann if( nFound != STRING_NOTFOUND && (++nFound) < sTxt.Len() )
179cdf0e10cSrcweir {
18069a74367SOliver-Rainer Wittmann String sSuffix( sTxt.Copy(nFound) );
18169a74367SOliver-Rainer Wittmann if( sSuffix.EqualsAscii( pMarkToTable ) ||
18269a74367SOliver-Rainer Wittmann sSuffix.EqualsAscii( pMarkToFrame ) ||
18369a74367SOliver-Rainer Wittmann sSuffix.EqualsAscii( pMarkToRegion ) ||
18469a74367SOliver-Rainer Wittmann sSuffix.EqualsAscii( pMarkToOutline ) ||
18569a74367SOliver-Rainer Wittmann sSuffix.EqualsAscii( pMarkToText ) ||
18669a74367SOliver-Rainer Wittmann sSuffix.EqualsAscii( pMarkToGraphic ) ||
18769a74367SOliver-Rainer Wittmann sSuffix.EqualsAscii( pMarkToOLE ))
18869a74367SOliver-Rainer Wittmann sTxt = sTxt.Copy( 0, nFound - 1);
18969a74367SOliver-Rainer Wittmann }
19069a74367SOliver-Rainer Wittmann // special handling if target is a cross-reference bookmark
19169a74367SOliver-Rainer Wittmann {
19269a74367SOliver-Rainer Wittmann String sTmpSearchStr = sTxt.Copy( 1, sTxt.Len() );
19369a74367SOliver-Rainer Wittmann IDocumentMarkAccess* const pMarkAccess = rSh.getIDocumentMarkAccess();
19469a74367SOliver-Rainer Wittmann IDocumentMarkAccess::const_iterator_t ppBkmk = pMarkAccess->findBookmark( sTmpSearchStr );
19569a74367SOliver-Rainer Wittmann if ( ppBkmk != pMarkAccess->getBookmarksEnd()
19669a74367SOliver-Rainer Wittmann && IDocumentMarkAccess::GetType( *(ppBkmk->get()) ) == IDocumentMarkAccess::CROSSREF_HEADING_BOOKMARK )
197cdf0e10cSrcweir {
19869a74367SOliver-Rainer Wittmann SwTxtNode* pTxtNode = ppBkmk->get()->GetMarkStart().nNode.GetNode().GetTxtNode();
19969a74367SOliver-Rainer Wittmann if ( pTxtNode )
200cdf0e10cSrcweir {
20169a74367SOliver-Rainer Wittmann sTxt = pTxtNode->GetExpandTxt( 0, pTxtNode->Len(), true, true );
20269a74367SOliver-Rainer Wittmann
20369a74367SOliver-Rainer Wittmann if( sTxt.Len() )
204cdf0e10cSrcweir {
20569a74367SOliver-Rainer Wittmann sTxt.EraseAllChars( 0xad );
20669a74367SOliver-Rainer Wittmann for( sal_Unicode* p = sTxt.GetBufferAccess(); *p; ++p )
20769a74367SOliver-Rainer Wittmann {
20869a74367SOliver-Rainer Wittmann if( *p < 0x20 )
20969a74367SOliver-Rainer Wittmann *p = 0x20;
21069a74367SOliver-Rainer Wittmann else if(*p == 0x2011)
21169a74367SOliver-Rainer Wittmann *p = '-';
21269a74367SOliver-Rainer Wittmann }
213cdf0e10cSrcweir }
214cdf0e10cSrcweir }
215cdf0e10cSrcweir }
216cdf0e10cSrcweir }
217cdf0e10cSrcweir
21869a74367SOliver-Rainer Wittmann sal_Bool bExecHyperlinks = rView.GetDocShell()->IsReadOnly();
219cdf0e10cSrcweir if ( !bExecHyperlinks )
220cdf0e10cSrcweir {
22169a74367SOliver-Rainer Wittmann SvtSecurityOptions aSecOpts;
22269a74367SOliver-Rainer Wittmann bExecHyperlinks = !aSecOpts.IsOptionSet( SvtSecurityOptions::E_CTRLCLICK_HYPERLINK );
22369a74367SOliver-Rainer Wittmann
22469a74367SOliver-Rainer Wittmann if ( !bExecHyperlinks )
22569a74367SOliver-Rainer Wittmann {
22669a74367SOliver-Rainer Wittmann sTxt.InsertAscii( ": ", 0 );
22769a74367SOliver-Rainer Wittmann sTxt.Insert( ViewShell::GetShellRes()->aHyperlinkClick, 0 );
22869a74367SOliver-Rainer Wittmann }
229cdf0e10cSrcweir }
23069a74367SOliver-Rainer Wittmann break;
231cdf0e10cSrcweir }
23269a74367SOliver-Rainer Wittmann case SwContentAtPos::SW_SMARTTAG:
23369a74367SOliver-Rainer Wittmann {
23469a74367SOliver-Rainer Wittmann sTxt = SW_RESSTR(STR_SMARTTAG_CLICK);
23569a74367SOliver-Rainer Wittmann
23669a74367SOliver-Rainer Wittmann KeyCode aCode( KEY_SPACE );
23769a74367SOliver-Rainer Wittmann KeyCode aModifiedCode( KEY_SPACE, KEY_MOD1 );
23869a74367SOliver-Rainer Wittmann String aModStr( aModifiedCode.GetName() );
23969a74367SOliver-Rainer Wittmann aModStr.SearchAndReplace( aCode.GetName(), String() );
24069a74367SOliver-Rainer Wittmann aModStr.SearchAndReplaceAllAscii( "+", String() );
24169a74367SOliver-Rainer Wittmann sTxt.SearchAndReplaceAllAscii( "%s", aModStr );
24269a74367SOliver-Rainer Wittmann }
24369a74367SOliver-Rainer Wittmann break;
244cdf0e10cSrcweir
24569a74367SOliver-Rainer Wittmann case SwContentAtPos::SW_FTN:
24669a74367SOliver-Rainer Wittmann if( aCntntAtPos.pFndTxtAttr && aCntntAtPos.aFnd.pAttr )
24769a74367SOliver-Rainer Wittmann {
248cdf0e10cSrcweir const SwFmtFtn* pFtn = (SwFmtFtn*)aCntntAtPos.aFnd.pAttr;
24969a74367SOliver-Rainer Wittmann pFtn->GetFtnText( sTxt );
25069a74367SOliver-Rainer Wittmann sTxt.Insert( SW_RESSTR( pFtn->IsEndNote()
25169a74367SOliver-Rainer Wittmann ? STR_ENDNOTE : STR_FTNNOTE ), 0 );
252cdf0e10cSrcweir if( aCntntAtPos.IsInRTLText() )
253cdf0e10cSrcweir nStyle |= QUICKHELP_BIDI_RTL;
254cdf0e10cSrcweir }
25569a74367SOliver-Rainer Wittmann break;
256cdf0e10cSrcweir
25769a74367SOliver-Rainer Wittmann case SwContentAtPos::SW_REDLINE:
25869a74367SOliver-Rainer Wittmann lcl_GetRedlineHelp( *aCntntAtPos.aFnd.pRedl, sTxt, bBalloon );
25969a74367SOliver-Rainer Wittmann break;
260cdf0e10cSrcweir
26169a74367SOliver-Rainer Wittmann case SwContentAtPos::SW_TOXMARK:
26269a74367SOliver-Rainer Wittmann sTxt = aCntntAtPos.sStr;
26369a74367SOliver-Rainer Wittmann if( sTxt.Len() && aCntntAtPos.pFndTxtAttr )
26469a74367SOliver-Rainer Wittmann {
26569a74367SOliver-Rainer Wittmann const SwTOXType* pTType = aCntntAtPos.pFndTxtAttr->
26669a74367SOliver-Rainer Wittmann GetTOXMark().GetTOXType();
26769a74367SOliver-Rainer Wittmann if( pTType && pTType->GetTypeName().Len() )
26869a74367SOliver-Rainer Wittmann {
26969a74367SOliver-Rainer Wittmann sTxt.InsertAscii( ": ", 0 );
27069a74367SOliver-Rainer Wittmann sTxt.Insert( pTType->GetTypeName(), 0 );
27169a74367SOliver-Rainer Wittmann }
27269a74367SOliver-Rainer Wittmann }
27369a74367SOliver-Rainer Wittmann break;
274cdf0e10cSrcweir
27569a74367SOliver-Rainer Wittmann case SwContentAtPos::SW_REFMARK:
27669a74367SOliver-Rainer Wittmann if(aCntntAtPos.aFnd.pAttr)
27769a74367SOliver-Rainer Wittmann {
27869a74367SOliver-Rainer Wittmann sTxt = SW_RES(STR_CONTENT_TYPE_SINGLE_REFERENCE);
27969a74367SOliver-Rainer Wittmann sTxt.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": "));
28069a74367SOliver-Rainer Wittmann sTxt += ((const SwFmtRefMark*)aCntntAtPos.aFnd.pAttr)->GetRefName();
28169a74367SOliver-Rainer Wittmann }
28269a74367SOliver-Rainer Wittmann break;
283cdf0e10cSrcweir
28469a74367SOliver-Rainer Wittmann default:
28569a74367SOliver-Rainer Wittmann {
28669a74367SOliver-Rainer Wittmann SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig();
28769a74367SOliver-Rainer Wittmann if(!pModOpt->IsHideFieldTips())
28869a74367SOliver-Rainer Wittmann {
28969a74367SOliver-Rainer Wittmann const SwField* pFld = aCntntAtPos.aFnd.pFld;
29069a74367SOliver-Rainer Wittmann switch( pFld->Which() )
291cdf0e10cSrcweir {
29269a74367SOliver-Rainer Wittmann case RES_SETEXPFLD:
29369a74367SOliver-Rainer Wittmann case RES_TABLEFLD:
29469a74367SOliver-Rainer Wittmann case RES_GETEXPFLD:
29569a74367SOliver-Rainer Wittmann {
29669a74367SOliver-Rainer Wittmann sal_uInt16 nOldSubType = pFld->GetSubType();
29769a74367SOliver-Rainer Wittmann ((SwField*)pFld)->SetSubType(nsSwExtendedSubType::SUB_CMD);
29869a74367SOliver-Rainer Wittmann sTxt = pFld->ExpandField(true);
29969a74367SOliver-Rainer Wittmann ((SwField*)pFld)->SetSubType(nOldSubType);
30069a74367SOliver-Rainer Wittmann }
30169a74367SOliver-Rainer Wittmann break;
30269a74367SOliver-Rainer Wittmann
30369a74367SOliver-Rainer Wittmann case RES_POSTITFLD:
304cdf0e10cSrcweir {
30569a74367SOliver-Rainer Wittmann break;
30669a74367SOliver-Rainer Wittmann }
30769a74367SOliver-Rainer Wittmann case RES_INPUTFLD: // BubbleHelp, da der Hinweis ggf ziemlich lang sein kann
30869a74367SOliver-Rainer Wittmann bBalloon = sal_True;
30969a74367SOliver-Rainer Wittmann /* no break */
31069a74367SOliver-Rainer Wittmann case RES_JUMPEDITFLD:
31169a74367SOliver-Rainer Wittmann sTxt = pFld->GetPar2();
31269a74367SOliver-Rainer Wittmann break;
31369a74367SOliver-Rainer Wittmann
31469a74367SOliver-Rainer Wittmann case RES_DBFLD:
31569a74367SOliver-Rainer Wittmann sTxt = pFld->GetFieldName();
31669a74367SOliver-Rainer Wittmann break;
31769a74367SOliver-Rainer Wittmann
31869a74367SOliver-Rainer Wittmann case RES_USERFLD:
31969a74367SOliver-Rainer Wittmann case RES_HIDDENTXTFLD:
32069a74367SOliver-Rainer Wittmann sTxt = pFld->GetPar1();
32169a74367SOliver-Rainer Wittmann break;
32269a74367SOliver-Rainer Wittmann
32369a74367SOliver-Rainer Wittmann case RES_DOCSTATFLD:
32469a74367SOliver-Rainer Wittmann break;
32569a74367SOliver-Rainer Wittmann
32669a74367SOliver-Rainer Wittmann case RES_MACROFLD:
32769a74367SOliver-Rainer Wittmann sTxt = ((const SwMacroField*)pFld)->GetMacro();
32869a74367SOliver-Rainer Wittmann break;
32969a74367SOliver-Rainer Wittmann
33069a74367SOliver-Rainer Wittmann case RES_GETREFFLD:
33169a74367SOliver-Rainer Wittmann {
33269a74367SOliver-Rainer Wittmann const SwGetRefField* pRefFld( dynamic_cast<const SwGetRefField*>(pFld) );
33369a74367SOliver-Rainer Wittmann ASSERT( pRefFld,
33469a74367SOliver-Rainer Wittmann "<SwEditWin::RequestHelp(..)> - unexpected type of <pFld>" );
33569a74367SOliver-Rainer Wittmann if ( pRefFld )
336cdf0e10cSrcweir {
33769a74367SOliver-Rainer Wittmann if ( pRefFld->IsRefToHeadingCrossRefBookmark() ||
33869a74367SOliver-Rainer Wittmann pRefFld->IsRefToNumItemCrossRefBookmark() )
339cdf0e10cSrcweir {
34069a74367SOliver-Rainer Wittmann sTxt = pRefFld->GetExpandedTxtOfReferencedTxtNode();
34169a74367SOliver-Rainer Wittmann if ( sTxt.Len() > 80 )
34269a74367SOliver-Rainer Wittmann {
34369a74367SOliver-Rainer Wittmann sTxt.Erase( 80 );
34469a74367SOliver-Rainer Wittmann sTxt += '.';
34569a74367SOliver-Rainer Wittmann sTxt += '.';
34669a74367SOliver-Rainer Wittmann sTxt += '.';
34769a74367SOliver-Rainer Wittmann }
34869a74367SOliver-Rainer Wittmann }
34969a74367SOliver-Rainer Wittmann else
35069a74367SOliver-Rainer Wittmann {
35169a74367SOliver-Rainer Wittmann sTxt = ((SwGetRefField*)pFld)->GetSetRefName();
352cdf0e10cSrcweir }
353cdf0e10cSrcweir }
354cdf0e10cSrcweir }
35569a74367SOliver-Rainer Wittmann break;
356cdf0e10cSrcweir }
35769a74367SOliver-Rainer Wittmann }
35869a74367SOliver-Rainer Wittmann
35969a74367SOliver-Rainer Wittmann if( !sTxt.Len() )
36069a74367SOliver-Rainer Wittmann {
36169a74367SOliver-Rainer Wittmann aCntntAtPos.eCntntAtPos = SwContentAtPos::SW_REDLINE;
36269a74367SOliver-Rainer Wittmann if( rSh.GetContentAtPos( aPos, aCntntAtPos, sal_False, &aFldRect ) )
36369a74367SOliver-Rainer Wittmann lcl_GetRedlineHelp( *aCntntAtPos.aFnd.pRedl, sTxt, bBalloon );
36469a74367SOliver-Rainer Wittmann }
365cdf0e10cSrcweir }
36669a74367SOliver-Rainer Wittmann }
36769a74367SOliver-Rainer Wittmann if (sTxt.Len() )
36869a74367SOliver-Rainer Wittmann {
36969a74367SOliver-Rainer Wittmann if( bBalloon )
37069a74367SOliver-Rainer Wittmann Help::ShowBalloon( this, rEvt.GetMousePosPixel(), sTxt );
37169a74367SOliver-Rainer Wittmann else
37269a74367SOliver-Rainer Wittmann {
37369a74367SOliver-Rainer Wittmann // dann zeige die Hilfe mal an:
37469a74367SOliver-Rainer Wittmann Rectangle aRect( aFldRect.SVRect() );
37569a74367SOliver-Rainer Wittmann Point aPt( OutputToScreenPixel( LogicToPixel( aRect.TopLeft() )));
37669a74367SOliver-Rainer Wittmann aRect.Left() = aPt.X();
37769a74367SOliver-Rainer Wittmann aRect.Top() = aPt.Y();
37869a74367SOliver-Rainer Wittmann aPt = OutputToScreenPixel( LogicToPixel( aRect.BottomRight() ));
37969a74367SOliver-Rainer Wittmann aRect.Right() = aPt.X();
38069a74367SOliver-Rainer Wittmann aRect.Bottom() = aPt.Y();
381cdf0e10cSrcweir Help::ShowQuickHelp( this, aRect, sTxt, nStyle );
38269a74367SOliver-Rainer Wittmann }
38369a74367SOliver-Rainer Wittmann }
384cdf0e10cSrcweir
38569a74367SOliver-Rainer Wittmann bWeiter = sal_False;
38669a74367SOliver-Rainer Wittmann }
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