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