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 --------------------------------------------------------------------*/ 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 )); 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 143*69a74367SOliver-Rainer Wittmann SwContentAtPos::SW_TABLEBOXVALUE | 144*69a74367SOliver-Rainer Wittmann ( bBalloon ? SwContentAtPos::SW_CURR_ATTRS : 0) | 145cdf0e10cSrcweir #endif 146*69a74367SOliver-Rainer Wittmann SwContentAtPos::SW_TABLEBOXFML ); 147cdf0e10cSrcweir 148*69a74367SOliver-Rainer Wittmann if( rSh.GetContentAtPos( aPos, aCntntAtPos, sal_False, &aFldRect ) ) 149*69a74367SOliver-Rainer Wittmann { 150*69a74367SOliver-Rainer Wittmann switch( aCntntAtPos.eCntntAtPos ) 151cdf0e10cSrcweir { 152*69a74367SOliver-Rainer Wittmann case SwContentAtPos::SW_TABLEBOXFML: 153*69a74367SOliver-Rainer Wittmann sTxt.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "= " )); 154*69a74367SOliver-Rainer Wittmann sTxt += ((SwTblBoxFormula*)aCntntAtPos.aFnd.pAttr)->GetFormula(); 155*69a74367SOliver-Rainer Wittmann break; 156*69a74367SOliver-Rainer Wittmann #ifdef DBG_UTIL 157*69a74367SOliver-Rainer Wittmann case SwContentAtPos::SW_TABLEBOXVALUE: 158cdf0e10cSrcweir { 159*69a74367SOliver-Rainer Wittmann sTxt = UniString( 160*69a74367SOliver-Rainer Wittmann ByteString::CreateFromDouble( 161*69a74367SOliver-Rainer Wittmann ((SwTblBoxValue*)aCntntAtPos.aFnd.pAttr)->GetValue() ) 162*69a74367SOliver-Rainer Wittmann , gsl_getSystemTextEncoding()); 163cdf0e10cSrcweir } 164*69a74367SOliver-Rainer Wittmann break; 165*69a74367SOliver-Rainer Wittmann case SwContentAtPos::SW_CURR_ATTRS: 166*69a74367SOliver-Rainer Wittmann sTxt = aCntntAtPos.sStr; 167*69a74367SOliver-Rainer Wittmann break; 168*69a74367SOliver-Rainer Wittmann #endif 169*69a74367SOliver-Rainer Wittmann 170*69a74367SOliver-Rainer Wittmann case SwContentAtPos::SW_INETATTR: 171cdf0e10cSrcweir { 172*69a74367SOliver-Rainer Wittmann sTxt = ((SfxStringItem*)aCntntAtPos.aFnd.pAttr)->GetValue(); 173*69a74367SOliver-Rainer Wittmann sTxt = URIHelper::removePassword( sTxt, 174*69a74367SOliver-Rainer Wittmann INetURLObject::WAS_ENCODED, 175*69a74367SOliver-Rainer Wittmann INetURLObject::DECODE_UNAMBIGUOUS); 176*69a74367SOliver-Rainer Wittmann //#i63832# remove the link target type 177*69a74367SOliver-Rainer Wittmann xub_StrLen nFound = sTxt.Search(cMarkSeperator); 178*69a74367SOliver-Rainer Wittmann if( nFound != STRING_NOTFOUND && (++nFound) < sTxt.Len() ) 179cdf0e10cSrcweir { 180*69a74367SOliver-Rainer Wittmann String sSuffix( sTxt.Copy(nFound) ); 181*69a74367SOliver-Rainer Wittmann if( sSuffix.EqualsAscii( pMarkToTable ) || 182*69a74367SOliver-Rainer Wittmann sSuffix.EqualsAscii( pMarkToFrame ) || 183*69a74367SOliver-Rainer Wittmann sSuffix.EqualsAscii( pMarkToRegion ) || 184*69a74367SOliver-Rainer Wittmann sSuffix.EqualsAscii( pMarkToOutline ) || 185*69a74367SOliver-Rainer Wittmann sSuffix.EqualsAscii( pMarkToText ) || 186*69a74367SOliver-Rainer Wittmann sSuffix.EqualsAscii( pMarkToGraphic ) || 187*69a74367SOliver-Rainer Wittmann sSuffix.EqualsAscii( pMarkToOLE )) 188*69a74367SOliver-Rainer Wittmann sTxt = sTxt.Copy( 0, nFound - 1); 189*69a74367SOliver-Rainer Wittmann } 190*69a74367SOliver-Rainer Wittmann // special handling if target is a cross-reference bookmark 191*69a74367SOliver-Rainer Wittmann { 192*69a74367SOliver-Rainer Wittmann 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 { 198*69a74367SOliver-Rainer Wittmann SwTxtNode* pTxtNode = ppBkmk->get()->GetMarkStart().nNode.GetNode().GetTxtNode(); 199*69a74367SOliver-Rainer Wittmann if ( pTxtNode ) 200cdf0e10cSrcweir { 201*69a74367SOliver-Rainer Wittmann sTxt = pTxtNode->GetExpandTxt( 0, pTxtNode->Len(), true, true ); 202*69a74367SOliver-Rainer Wittmann 203*69a74367SOliver-Rainer Wittmann if( sTxt.Len() ) 204cdf0e10cSrcweir { 205*69a74367SOliver-Rainer Wittmann sTxt.EraseAllChars( 0xad ); 206*69a74367SOliver-Rainer Wittmann for( sal_Unicode* p = sTxt.GetBufferAccess(); *p; ++p ) 207*69a74367SOliver-Rainer Wittmann { 208*69a74367SOliver-Rainer Wittmann if( *p < 0x20 ) 209*69a74367SOliver-Rainer Wittmann *p = 0x20; 210*69a74367SOliver-Rainer Wittmann else if(*p == 0x2011) 211*69a74367SOliver-Rainer Wittmann *p = '-'; 212*69a74367SOliver-Rainer Wittmann } 213cdf0e10cSrcweir } 214cdf0e10cSrcweir } 215cdf0e10cSrcweir } 216cdf0e10cSrcweir } 217cdf0e10cSrcweir 218*69a74367SOliver-Rainer Wittmann sal_Bool bExecHyperlinks = rView.GetDocShell()->IsReadOnly(); 219cdf0e10cSrcweir if ( !bExecHyperlinks ) 220cdf0e10cSrcweir { 221*69a74367SOliver-Rainer Wittmann SvtSecurityOptions aSecOpts; 222*69a74367SOliver-Rainer Wittmann bExecHyperlinks = !aSecOpts.IsOptionSet( SvtSecurityOptions::E_CTRLCLICK_HYPERLINK ); 223*69a74367SOliver-Rainer Wittmann 224*69a74367SOliver-Rainer Wittmann if ( !bExecHyperlinks ) 225*69a74367SOliver-Rainer Wittmann { 226*69a74367SOliver-Rainer Wittmann sTxt.InsertAscii( ": ", 0 ); 227*69a74367SOliver-Rainer Wittmann sTxt.Insert( ViewShell::GetShellRes()->aHyperlinkClick, 0 ); 228*69a74367SOliver-Rainer Wittmann } 229cdf0e10cSrcweir } 230*69a74367SOliver-Rainer Wittmann break; 231cdf0e10cSrcweir } 232*69a74367SOliver-Rainer Wittmann case SwContentAtPos::SW_SMARTTAG: 233*69a74367SOliver-Rainer Wittmann { 234*69a74367SOliver-Rainer Wittmann sTxt = SW_RESSTR(STR_SMARTTAG_CLICK); 235*69a74367SOliver-Rainer Wittmann 236*69a74367SOliver-Rainer Wittmann KeyCode aCode( KEY_SPACE ); 237*69a74367SOliver-Rainer Wittmann KeyCode aModifiedCode( KEY_SPACE, KEY_MOD1 ); 238*69a74367SOliver-Rainer Wittmann String aModStr( aModifiedCode.GetName() ); 239*69a74367SOliver-Rainer Wittmann aModStr.SearchAndReplace( aCode.GetName(), String() ); 240*69a74367SOliver-Rainer Wittmann aModStr.SearchAndReplaceAllAscii( "+", String() ); 241*69a74367SOliver-Rainer Wittmann sTxt.SearchAndReplaceAllAscii( "%s", aModStr ); 242*69a74367SOliver-Rainer Wittmann } 243*69a74367SOliver-Rainer Wittmann break; 244cdf0e10cSrcweir 245*69a74367SOliver-Rainer Wittmann case SwContentAtPos::SW_FTN: 246*69a74367SOliver-Rainer Wittmann if( aCntntAtPos.pFndTxtAttr && aCntntAtPos.aFnd.pAttr ) 247*69a74367SOliver-Rainer Wittmann { 248cdf0e10cSrcweir const SwFmtFtn* pFtn = (SwFmtFtn*)aCntntAtPos.aFnd.pAttr; 249*69a74367SOliver-Rainer Wittmann pFtn->GetFtnText( sTxt ); 250*69a74367SOliver-Rainer Wittmann sTxt.Insert( SW_RESSTR( pFtn->IsEndNote() 251*69a74367SOliver-Rainer Wittmann ? STR_ENDNOTE : STR_FTNNOTE ), 0 ); 252cdf0e10cSrcweir if( aCntntAtPos.IsInRTLText() ) 253cdf0e10cSrcweir nStyle |= QUICKHELP_BIDI_RTL; 254cdf0e10cSrcweir } 255*69a74367SOliver-Rainer Wittmann break; 256cdf0e10cSrcweir 257*69a74367SOliver-Rainer Wittmann case SwContentAtPos::SW_REDLINE: 258*69a74367SOliver-Rainer Wittmann lcl_GetRedlineHelp( *aCntntAtPos.aFnd.pRedl, sTxt, bBalloon ); 259*69a74367SOliver-Rainer Wittmann break; 260cdf0e10cSrcweir 261*69a74367SOliver-Rainer Wittmann case SwContentAtPos::SW_TOXMARK: 262*69a74367SOliver-Rainer Wittmann sTxt = aCntntAtPos.sStr; 263*69a74367SOliver-Rainer Wittmann if( sTxt.Len() && aCntntAtPos.pFndTxtAttr ) 264*69a74367SOliver-Rainer Wittmann { 265*69a74367SOliver-Rainer Wittmann const SwTOXType* pTType = aCntntAtPos.pFndTxtAttr-> 266*69a74367SOliver-Rainer Wittmann GetTOXMark().GetTOXType(); 267*69a74367SOliver-Rainer Wittmann if( pTType && pTType->GetTypeName().Len() ) 268*69a74367SOliver-Rainer Wittmann { 269*69a74367SOliver-Rainer Wittmann sTxt.InsertAscii( ": ", 0 ); 270*69a74367SOliver-Rainer Wittmann sTxt.Insert( pTType->GetTypeName(), 0 ); 271*69a74367SOliver-Rainer Wittmann } 272*69a74367SOliver-Rainer Wittmann } 273*69a74367SOliver-Rainer Wittmann break; 274cdf0e10cSrcweir 275*69a74367SOliver-Rainer Wittmann case SwContentAtPos::SW_REFMARK: 276*69a74367SOliver-Rainer Wittmann if(aCntntAtPos.aFnd.pAttr) 277*69a74367SOliver-Rainer Wittmann { 278*69a74367SOliver-Rainer Wittmann sTxt = SW_RES(STR_CONTENT_TYPE_SINGLE_REFERENCE); 279*69a74367SOliver-Rainer Wittmann sTxt.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": ")); 280*69a74367SOliver-Rainer Wittmann sTxt += ((const SwFmtRefMark*)aCntntAtPos.aFnd.pAttr)->GetRefName(); 281*69a74367SOliver-Rainer Wittmann } 282*69a74367SOliver-Rainer Wittmann break; 283cdf0e10cSrcweir 284*69a74367SOliver-Rainer Wittmann default: 285*69a74367SOliver-Rainer Wittmann { 286*69a74367SOliver-Rainer Wittmann SwModuleOptions* pModOpt = SW_MOD()->GetModuleConfig(); 287*69a74367SOliver-Rainer Wittmann if(!pModOpt->IsHideFieldTips()) 288*69a74367SOliver-Rainer Wittmann { 289*69a74367SOliver-Rainer Wittmann const SwField* pFld = aCntntAtPos.aFnd.pFld; 290*69a74367SOliver-Rainer Wittmann switch( pFld->Which() ) 291cdf0e10cSrcweir { 292*69a74367SOliver-Rainer Wittmann case RES_SETEXPFLD: 293*69a74367SOliver-Rainer Wittmann case RES_TABLEFLD: 294*69a74367SOliver-Rainer Wittmann case RES_GETEXPFLD: 295*69a74367SOliver-Rainer Wittmann { 296*69a74367SOliver-Rainer Wittmann sal_uInt16 nOldSubType = pFld->GetSubType(); 297*69a74367SOliver-Rainer Wittmann ((SwField*)pFld)->SetSubType(nsSwExtendedSubType::SUB_CMD); 298*69a74367SOliver-Rainer Wittmann sTxt = pFld->ExpandField(true); 299*69a74367SOliver-Rainer Wittmann ((SwField*)pFld)->SetSubType(nOldSubType); 300*69a74367SOliver-Rainer Wittmann } 301*69a74367SOliver-Rainer Wittmann break; 302*69a74367SOliver-Rainer Wittmann 303*69a74367SOliver-Rainer Wittmann case RES_POSTITFLD: 304cdf0e10cSrcweir { 305*69a74367SOliver-Rainer Wittmann break; 306*69a74367SOliver-Rainer Wittmann } 307*69a74367SOliver-Rainer Wittmann case RES_INPUTFLD: // BubbleHelp, da der Hinweis ggf ziemlich lang sein kann 308*69a74367SOliver-Rainer Wittmann bBalloon = sal_True; 309*69a74367SOliver-Rainer Wittmann /* no break */ 310*69a74367SOliver-Rainer Wittmann case RES_JUMPEDITFLD: 311*69a74367SOliver-Rainer Wittmann sTxt = pFld->GetPar2(); 312*69a74367SOliver-Rainer Wittmann break; 313*69a74367SOliver-Rainer Wittmann 314*69a74367SOliver-Rainer Wittmann case RES_DBFLD: 315*69a74367SOliver-Rainer Wittmann sTxt = pFld->GetFieldName(); 316*69a74367SOliver-Rainer Wittmann break; 317*69a74367SOliver-Rainer Wittmann 318*69a74367SOliver-Rainer Wittmann case RES_USERFLD: 319*69a74367SOliver-Rainer Wittmann case RES_HIDDENTXTFLD: 320*69a74367SOliver-Rainer Wittmann sTxt = pFld->GetPar1(); 321*69a74367SOliver-Rainer Wittmann break; 322*69a74367SOliver-Rainer Wittmann 323*69a74367SOliver-Rainer Wittmann case RES_DOCSTATFLD: 324*69a74367SOliver-Rainer Wittmann break; 325*69a74367SOliver-Rainer Wittmann 326*69a74367SOliver-Rainer Wittmann case RES_MACROFLD: 327*69a74367SOliver-Rainer Wittmann sTxt = ((const SwMacroField*)pFld)->GetMacro(); 328*69a74367SOliver-Rainer Wittmann break; 329*69a74367SOliver-Rainer Wittmann 330*69a74367SOliver-Rainer Wittmann case RES_GETREFFLD: 331*69a74367SOliver-Rainer Wittmann { 332*69a74367SOliver-Rainer Wittmann const SwGetRefField* pRefFld( dynamic_cast<const SwGetRefField*>(pFld) ); 333*69a74367SOliver-Rainer Wittmann ASSERT( pRefFld, 334*69a74367SOliver-Rainer Wittmann "<SwEditWin::RequestHelp(..)> - unexpected type of <pFld>" ); 335*69a74367SOliver-Rainer Wittmann if ( pRefFld ) 336cdf0e10cSrcweir { 337*69a74367SOliver-Rainer Wittmann if ( pRefFld->IsRefToHeadingCrossRefBookmark() || 338*69a74367SOliver-Rainer Wittmann pRefFld->IsRefToNumItemCrossRefBookmark() ) 339cdf0e10cSrcweir { 340*69a74367SOliver-Rainer Wittmann sTxt = pRefFld->GetExpandedTxtOfReferencedTxtNode(); 341*69a74367SOliver-Rainer Wittmann if ( sTxt.Len() > 80 ) 342*69a74367SOliver-Rainer Wittmann { 343*69a74367SOliver-Rainer Wittmann sTxt.Erase( 80 ); 344*69a74367SOliver-Rainer Wittmann sTxt += '.'; 345*69a74367SOliver-Rainer Wittmann sTxt += '.'; 346*69a74367SOliver-Rainer Wittmann sTxt += '.'; 347*69a74367SOliver-Rainer Wittmann } 348*69a74367SOliver-Rainer Wittmann } 349*69a74367SOliver-Rainer Wittmann else 350*69a74367SOliver-Rainer Wittmann { 351*69a74367SOliver-Rainer Wittmann sTxt = ((SwGetRefField*)pFld)->GetSetRefName(); 352cdf0e10cSrcweir } 353cdf0e10cSrcweir } 354cdf0e10cSrcweir } 355*69a74367SOliver-Rainer Wittmann break; 356cdf0e10cSrcweir } 357*69a74367SOliver-Rainer Wittmann } 358*69a74367SOliver-Rainer Wittmann 359*69a74367SOliver-Rainer Wittmann if( !sTxt.Len() ) 360*69a74367SOliver-Rainer Wittmann { 361*69a74367SOliver-Rainer Wittmann aCntntAtPos.eCntntAtPos = SwContentAtPos::SW_REDLINE; 362*69a74367SOliver-Rainer Wittmann if( rSh.GetContentAtPos( aPos, aCntntAtPos, sal_False, &aFldRect ) ) 363*69a74367SOliver-Rainer Wittmann lcl_GetRedlineHelp( *aCntntAtPos.aFnd.pRedl, sTxt, bBalloon ); 364*69a74367SOliver-Rainer Wittmann } 365cdf0e10cSrcweir } 366*69a74367SOliver-Rainer Wittmann } 367*69a74367SOliver-Rainer Wittmann if (sTxt.Len() ) 368*69a74367SOliver-Rainer Wittmann { 369*69a74367SOliver-Rainer Wittmann if( bBalloon ) 370*69a74367SOliver-Rainer Wittmann Help::ShowBalloon( this, rEvt.GetMousePosPixel(), sTxt ); 371*69a74367SOliver-Rainer Wittmann else 372*69a74367SOliver-Rainer Wittmann { 373*69a74367SOliver-Rainer Wittmann // dann zeige die Hilfe mal an: 374*69a74367SOliver-Rainer Wittmann Rectangle aRect( aFldRect.SVRect() ); 375*69a74367SOliver-Rainer Wittmann Point aPt( OutputToScreenPixel( LogicToPixel( aRect.TopLeft() ))); 376*69a74367SOliver-Rainer Wittmann aRect.Left() = aPt.X(); 377*69a74367SOliver-Rainer Wittmann aRect.Top() = aPt.Y(); 378*69a74367SOliver-Rainer Wittmann aPt = OutputToScreenPixel( LogicToPixel( aRect.BottomRight() )); 379*69a74367SOliver-Rainer Wittmann aRect.Right() = aPt.X(); 380*69a74367SOliver-Rainer Wittmann aRect.Bottom() = aPt.Y(); 381cdf0e10cSrcweir Help::ShowQuickHelp( this, aRect, sTxt, nStyle ); 382*69a74367SOliver-Rainer Wittmann } 383*69a74367SOliver-Rainer Wittmann } 384cdf0e10cSrcweir 385*69a74367SOliver-Rainer Wittmann bWeiter = sal_False; 386*69a74367SOliver-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 499cdf0e10cSrcweir void SwEditWin::PrePaint() 500cdf0e10cSrcweir { 501cdf0e10cSrcweir SwWrtShell* pWrtShell = GetView().GetWrtShellPtr(); 502cdf0e10cSrcweir 503cdf0e10cSrcweir if(pWrtShell) 504cdf0e10cSrcweir { 505cdf0e10cSrcweir pWrtShell->PrePaint(); 506cdf0e10cSrcweir } 507cdf0e10cSrcweir } 508cdf0e10cSrcweir 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