1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include <osl/diagnose.h>
22 #include <osl/thread.h>
23 #include <vcl/help.hxx>
24 #include <tools/urlobj.hxx>
25 #include <fmtrfmrk.hxx>
26 #include <svl/urihelper.hxx>
27 #include <sfx2/sfxhelp.hxx>
28 #include <svx/svdview.hxx>
29 #include <svx/svdpagv.hxx>
30 #include <swmodule.hxx>
37 #include <docufld.hxx>
39 #include <cellatr.hxx>
40 #include <shdwcrsr.hxx>
41 #include <fmtinfmt.hxx>
43 #include <redline.hxx>
45 #include <txatbase.hxx>
47 #include <viewopt.hxx>
48 #include <strings.hrc>
50 #include <IDocumentMarkAccess.hxx>
51 #include <IDocumentRedlineAccess.hxx>
54 #include <comphelper/lok.hxx>
55 #include <authfld.hxx>
57 #include <com/sun/star/text/XTextRange.hpp>
58 #include <unotextrange.hxx>
59 #include <SwStyleNameMapper.hxx>
60 #include <unoprnms.hxx>
61 #include <editeng/unoprnms.hxx>
62 #include <rootfrm.hxx>
64 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
68 bool HasValidPropertyValue(const uno::Any
& rAny
)
70 if (bool bValue
; rAny
>>= bValue
)
74 else if (OUString aValue
; (rAny
>>= aValue
) && !(aValue
.isEmpty()))
78 else if (awt::FontSlant eValue
; rAny
>>= eValue
)
82 else if (tools::Long nValueLong
; rAny
>>= nValueLong
)
86 else if (double fValue
; rAny
>>= fValue
)
90 else if (short nValueShort
; rAny
>>= nValueShort
)
98 bool PSCSDFPropsQuickHelp(const HelpEvent
&rEvt
, SwWrtShell
& rSh
)
101 SwView
& rView
= rSh
.GetView();
103 if (rView
.IsHighlightCharDF() || rView
.GetStylesHighlighterParaColorMap().size()
104 || rView
.GetStylesHighlighterCharColorMap().size())
106 SwPosition
aPos(rSh
.GetDoc()->GetNodes());
107 Point
aPt(rSh
.GetWin()->PixelToLogic(
108 rSh
.GetWin()->ScreenToOutputPixel(rEvt
.GetMousePosPixel())));
110 rSh
.GetLayout()->GetModelPositionForViewPoint(&aPos
, aPt
);
112 if (!aPos
.GetContentNode()->IsTextNode())
115 uno::Reference
<text::XTextRange
> xRange(
116 SwXTextRange::CreateXTextRange(*(rView
.GetDocShell()->GetDoc()),
118 uno::Reference
<beans::XPropertySet
> xPropertySet(xRange
, uno::UNO_QUERY_THROW
);
120 SwContentFrame
* pContentFrame
= aPos
.GetContentNode()->GetTextNode()->getLayoutFrame(
123 SwRect aFrameAreaRect
;
125 bool bContainsPt
= false;
128 aFrameAreaRect
= pContentFrame
->getFrameArea();
129 if (aFrameAreaRect
.Contains(aPt
))
134 } while((pContentFrame
= pContentFrame
->GetFollow()));
138 if (rView
.GetStylesHighlighterCharColorMap().size())
140 // check if in CS formatting highlighted area
142 xPropertySet
->getPropertyValue("CharStyleName") >>= sCharStyle
;
143 if (!sCharStyle
.isEmpty())
144 sText
= SwStyleNameMapper::GetUIName(sCharStyle
, SwGetPoolIdFromName::ChrFmt
);
147 if (sText
.isEmpty() && rView
.IsHighlightCharDF())
149 // check if in direct formatting highlighted area
150 const std::vector
<OUString
> aHiddenProperties
{ UNO_NAME_RSID
,
151 UNO_NAME_PARA_IS_NUMBERING_RESTART
,
152 UNO_NAME_PARA_STYLE_NAME
,
153 UNO_NAME_PARA_CONDITIONAL_STYLE_NAME
,
154 UNO_NAME_PAGE_STYLE_NAME
,
155 UNO_NAME_NUMBERING_START_VALUE
,
156 UNO_NAME_NUMBERING_IS_NUMBER
,
157 UNO_NAME_PARA_CONTINUEING_PREVIOUS_SUB_TREE
,
158 UNO_NAME_CHAR_STYLE_NAME
,
159 UNO_NAME_NUMBERING_LEVEL
,
160 UNO_NAME_SORTED_TEXT_ID
,
162 UNO_NAME_CHAR_COLOR_THEME
,
163 UNO_NAME_CHAR_COLOR_TINT_OR_SHADE
};
165 SfxItemPropertySet
const& rPropSet(
166 *aSwMapProvider
.GetPropertySet(PROPERTY_MAP_CHAR_AUTO_STYLE
));
167 SfxItemPropertyMap
const& rMap(rPropSet
.getPropertyMap());
169 uno::Reference
<beans::XPropertyState
> xPropertiesState(xRange
, uno::UNO_QUERY_THROW
);
170 const uno::Sequence
<beans::Property
> aProperties
171 = xPropertySet
->getPropertySetInfo()->getProperties();
173 for (const beans::Property
& rProperty
: aProperties
)
175 const OUString
& rPropName
= rProperty
.Name
;
177 if (!rMap
.hasPropertyByName(rPropName
))
180 if (std::find(aHiddenProperties
.begin(), aHiddenProperties
.end(), rPropName
)
181 != aHiddenProperties
.end())
184 if (xPropertiesState
->getPropertyState(rPropName
)
185 == beans::PropertyState_DIRECT_VALUE
)
187 const uno::Any aAny
= xPropertySet
->getPropertyValue(rPropName
);
188 if (HasValidPropertyValue(aAny
))
190 sText
= SwResId(STR_CHARACTER_DIRECT_FORMATTING
);
197 else if (rView
.GetStylesHighlighterParaColorMap().size())
199 // check if in paragraph style formatting highlighted area
200 pContentFrame
= aPos
.GetContentNode()->GetTextNode()->getLayoutFrame(
204 aFrameAreaRect
= pContentFrame
->getFrameArea();
205 if (pContentFrame
->IsRightToLeft())
207 aFrameAreaRect
.AddRight(375);
208 aFrameAreaRect
.Left(aFrameAreaRect
.Right() - 300);
212 aFrameAreaRect
.AddLeft(-375);
213 aFrameAreaRect
.Right(aFrameAreaRect
.Left() + 300);
215 if (aFrameAreaRect
.Contains(aPt
))
218 xPropertySet
->getPropertyValue("ParaStyleName") >>= sParaStyle
;
219 sText
= SwStyleNameMapper::GetUIName(sParaStyle
, SwGetPoolIdFromName::TxtColl
);
220 // check for paragraph direct formatting
221 if (SwDoc::HasParagraphDirectFormatting(aPos
))
222 sText
= sText
+ " + " + SwResId(STR_PARAGRAPH_DIRECT_FORMATTING
);
225 } while((pContentFrame
= pContentFrame
->GetFollow()));
229 if (!sText
.isEmpty())
231 tools::Rectangle
aRect(rSh
.GetWin()->PixelToLogic(
232 rSh
.GetWin()->ScreenToOutputPixel(rEvt
.GetMousePosPixel())),
234 Point
aPt(rSh
.GetWin()->OutputToScreenPixel(rSh
.GetWin()->LogicToPixel(aRect
.TopLeft())));
235 aRect
.SetLeft(aPt
.X());
236 aRect
.SetTop(aPt
.Y());
237 aPt
= rSh
.GetWin()->OutputToScreenPixel(rSh
.GetWin()->LogicToPixel(aRect
.BottomRight()));
238 aRect
.SetRight(aPt
.X());
239 aRect
.SetBottom(aPt
.Y());
241 // tdf#136336 ensure tooltip area surrounds the current mouse position with at least a pixel margin
242 aRect
.Union(tools::Rectangle(rEvt
.GetMousePosPixel(), Size(1, 1)));
243 aRect
.AdjustLeft(-1);
244 aRect
.AdjustRight(1);
246 aRect
.AdjustBottom(1);
248 QuickHelpFlags nStyle
= QuickHelpFlags::NONE
; //TipStyleBalloon;
249 Help::ShowQuickHelp(rSh
.GetWin(), aRect
, sText
, nStyle
);
252 return !sText
.isEmpty();
256 static OUString
lcl_GetRedlineHelp( const SwRangeRedline
& rRedl
, bool bBalloon
,
257 bool bTableChange
, bool bTableColChange
)
260 switch( rRedl
.GetType() )
262 case RedlineType::Insert
: pResId
= bTableChange
264 ? STR_REDLINE_TABLE_ROW_INSERT
265 : STR_REDLINE_TABLE_COLUMN_INSERT
267 ? STR_REDLINE_INSERT_MOVED
268 : STR_REDLINE_INSERT
;
270 case RedlineType::Delete
: pResId
= bTableChange
272 ? STR_REDLINE_TABLE_ROW_DELETE
273 : STR_REDLINE_TABLE_COLUMN_DELETE
275 ? STR_REDLINE_DELETE_MOVED
276 : STR_REDLINE_DELETE
;
278 case RedlineType::Format
: pResId
= STR_REDLINE_FORMAT
; break;
279 case RedlineType::Table
: pResId
= STR_REDLINE_TABLE
; break;
280 case RedlineType::FmtColl
: pResId
= STR_REDLINE_FMTCOLL
; break;
281 case RedlineType::ParagraphFormat
: pResId
= STR_REDLINE_PARAGRAPH_FORMAT
; break;
282 case RedlineType::TableRowInsert
: pResId
= STR_REDLINE_TABLE_ROW_INSERT
; break;
283 case RedlineType::TableRowDelete
: pResId
= STR_REDLINE_TABLE_ROW_DELETE
; break;
284 case RedlineType::TableCellInsert
: pResId
= STR_REDLINE_TABLE_CELL_INSERT
; break;
285 case RedlineType::TableCellDelete
: pResId
= STR_REDLINE_TABLE_CELL_DELETE
; break;
291 OUStringBuffer
sBuf(SwResId(pResId
)
293 + rRedl
.GetAuthorString()
295 + GetAppLangDateTimeString(rRedl
.GetTimeStamp()));
296 if( bBalloon
&& !rRedl
.GetComment().isEmpty() )
297 sBuf
.append("\n" + rRedl
.GetComment());
298 return sBuf
.makeStringAndClear();
301 OUString
SwEditWin::ClipLongToolTip(const OUString
& rText
)
303 OUString
sDisplayText(rText
);
304 tools::Long nTextWidth
= GetTextWidth(sDisplayText
);
305 tools::Long nMaxWidth
= GetDesktopRectPixel().GetWidth() * 2 / 3;
306 nMaxWidth
= PixelToLogic(Size(nMaxWidth
, 0)).Width();
307 if (nTextWidth
> nMaxWidth
)
308 sDisplayText
= GetOutDev()->GetEllipsisString(sDisplayText
, nMaxWidth
, DrawTextFlags::CenterEllipsis
);
312 void SwEditWin::RequestHelp(const HelpEvent
&rEvt
)
314 SwWrtShell
&rSh
= m_rView
.GetWrtShell();
316 if (PSCSDFPropsQuickHelp(rEvt
, rSh
))
319 bool bQuickBalloon
= bool(rEvt
.GetMode() & ( HelpEventMode::QUICK
| HelpEventMode::BALLOON
));
320 if(bQuickBalloon
&& !rSh
.GetViewOptions()->IsShowContentTips())
322 bool bContinue
= true;
323 CurrShell
aCurr(&rSh
);
325 Point
aPos( PixelToLogic( ScreenToOutputPixel( rEvt
.GetMousePosPixel() ) ));
326 bool bBalloon
= bool(rEvt
.GetMode() & HelpEventMode::BALLOON
);
328 SdrView
*pSdrView
= rSh
.GetDrawView();
330 if( bQuickBalloon
&& pSdrView
)
332 SdrPageView
* pPV
= pSdrView
->GetSdrPageView();
333 SwDPage
* pPage
= pPV
? static_cast<SwDPage
*>(pPV
->GetPage()) : nullptr;
334 bContinue
= pPage
&& pPage
->RequestHelp(this, pSdrView
, rEvt
);
337 if( bContinue
&& bQuickBalloon
)
340 SwContentAtPos
aContentAtPos( IsAttrAtPos::Field
|
341 IsAttrAtPos::InetAttr
|
343 IsAttrAtPos::Redline
|
344 IsAttrAtPos::ToxMark
|
345 IsAttrAtPos::RefMark
|
346 IsAttrAtPos::SmartTag
|
348 IsAttrAtPos::TableBoxValue
|
349 ( bBalloon
? IsAttrAtPos::CurrAttrs
: IsAttrAtPos::NONE
) |
351 IsAttrAtPos::TableBoxFml
|
352 IsAttrAtPos::TableRedline
|
353 IsAttrAtPos::TableColRedline
);
355 if( rSh
.GetContentAtPos( aPos
, aContentAtPos
, false, &aFieldRect
) )
357 QuickHelpFlags nStyle
= QuickHelpFlags::NONE
; // style of quick help
358 switch( aContentAtPos
.eContentAtPos
)
360 case IsAttrAtPos::TableBoxFml
:
361 sText
= "= " + static_cast<const SwTableBoxFormula
*>(aContentAtPos
.aFnd
.pAttr
)->GetFormula();
364 case IsAttrAtPos::TableBoxValue
:
366 if(aContentAtPos
.aFnd
.pAttr
)
368 sText
= OUString::number(
369 static_cast<const SwTableBoxValue
*>(aContentAtPos
.aFnd
.pAttr
)->GetValue());
373 case IsAttrAtPos::CurrAttrs
:
374 sText
= aContentAtPos
.sStr
;
378 case IsAttrAtPos::InetAttr
:
380 sText
= static_cast<const SwFormatINetFormat
*>(aContentAtPos
.aFnd
.pAttr
)->GetValue();
381 sText
= URIHelper::removePassword( sText
,
382 INetURLObject::EncodeMechanism::WasEncoded
,
383 INetURLObject::DecodeMechanism::Unambiguous
);
384 //#i63832# remove the link target type
385 sal_Int32 nFound
= sText
.indexOf(cMarkSeparator
);
386 if( nFound
!= -1 && (++nFound
) < sText
.getLength() )
388 std::u16string_view
sSuffix( sText
.subView(nFound
) );
389 if( sSuffix
== u
"table" ||
390 sSuffix
== u
"frame" ||
391 sSuffix
== u
"region" ||
392 sSuffix
== u
"outline" ||
393 sSuffix
== u
"text" ||
394 sSuffix
== u
"graphic" ||
396 sSuffix
== u
"drawingobject" )
397 sText
= sText
.copy( 0, nFound
- 1);
400 // special handling if target is a cross-reference bookmark
402 OUString sTmpSearchStr
= sText
.copy( 1 );
403 IDocumentMarkAccess
* pMarkAccess
= rSh
.getIDocumentMarkAccess();
404 IDocumentMarkAccess::const_iterator_t ppBkmk
=
405 pMarkAccess
->findBookmark( sTmpSearchStr
);
406 if ( ppBkmk
!= pMarkAccess
->getBookmarksEnd() &&
407 IDocumentMarkAccess::GetType(**ppBkmk
)
408 == IDocumentMarkAccess::MarkType::CROSSREF_HEADING_BOOKMARK
)
410 SwTextNode
* pTextNode
= (*ppBkmk
)->GetMarkStart().GetNode().GetTextNode();
413 sText
= sw::GetExpandTextMerged(rSh
.GetLayout(), *pTextNode
, true, false, ExpandMode(0));
415 if( !sText
.isEmpty() )
417 OUStringBuffer
sTmp(sText
.replaceAll(u
"\u00ad", ""));
418 for (sal_Int32 i
= 0; i
< sTmp
.getLength(); ++i
)
422 else if (sTmp
[i
] == 0x2011)
425 sText
= sTmp
.makeStringAndClear();
431 bool bExecHyperlinks
= m_rView
.GetDocShell()->IsReadOnly();
432 if ( !bExecHyperlinks
)
434 sText
= SfxHelp::GetURLHelpText(sText
);
438 case IsAttrAtPos::SmartTag
:
440 vcl::KeyCode
aCode( KEY_SPACE
);
441 vcl::KeyCode
aModifiedCode( KEY_SPACE
, KEY_MOD1
);
442 OUString
aModStr( aModifiedCode
.GetName() );
443 aModStr
= aModStr
.replaceFirst(aCode
.GetName(), "");
444 aModStr
= aModStr
.replaceAll("+", "");
445 sText
= SwResId(STR_SMARTTAG_CLICK
).replaceAll("%s", aModStr
);
449 case IsAttrAtPos::Ftn
:
450 if( aContentAtPos
.pFndTextAttr
&& aContentAtPos
.aFnd
.pAttr
)
452 const SwFormatFootnote
* pFootnote
= static_cast<const SwFormatFootnote
*>(aContentAtPos
.aFnd
.pAttr
);
453 OUString
sTmp(pFootnote
->GetFootnoteText(*rSh
.GetLayout()));
454 sText
= SwResId( pFootnote
->IsEndNote()
455 ? STR_ENDNOTE
: STR_FTNNOTE
) + sTmp
;
457 if( aContentAtPos
.IsInRTLText() )
458 nStyle
|= QuickHelpFlags::BiDiRtl
;
462 case IsAttrAtPos::TableRedline
:
463 case IsAttrAtPos::TableColRedline
:
464 case IsAttrAtPos::Redline
:
466 const bool bShowTrackChanges
= IDocumentRedlineAccess::IsShowChanges( m_rView
.GetDocShell()->GetDoc()->getIDocumentRedlineAccess().GetRedlineFlags() );
467 const bool bShowInlineTooltips
= rSh
.GetViewOptions()->IsShowInlineTooltips();
468 if ( bShowTrackChanges
&& bShowInlineTooltips
)
470 sText
= lcl_GetRedlineHelp(*aContentAtPos
.aFnd
.pRedl
, bBalloon
,
471 IsAttrAtPos::TableRedline
== aContentAtPos
.eContentAtPos
||
472 IsAttrAtPos::TableColRedline
== aContentAtPos
.eContentAtPos
,
473 IsAttrAtPos::TableColRedline
== aContentAtPos
.eContentAtPos
);
478 case IsAttrAtPos::ToxMark
:
479 sText
= aContentAtPos
.sStr
;
480 if( !sText
.isEmpty() && aContentAtPos
.pFndTextAttr
)
482 const SwTOXType
* pTType
= aContentAtPos
.pFndTextAttr
->
483 GetTOXMark().GetTOXType();
484 if( pTType
&& !pTType
->GetTypeName().isEmpty() )
486 sText
= ": " + sText
;
487 sText
= pTType
->GetTypeName() + sText
;
492 case IsAttrAtPos::RefMark
:
493 if(aContentAtPos
.aFnd
.pAttr
)
495 sText
= SwResId(STR_CONTENT_TYPE_SINGLE_REFERENCE
) + ": " +
496 static_cast<const SwFormatRefMark
*>(aContentAtPos
.aFnd
.pAttr
)->GetRefName();
502 SwModuleOptions
* pModOpt
= SW_MOD()->GetModuleConfig();
503 if(!pModOpt
->IsHideFieldTips())
505 const SwField
* pField
= aContentAtPos
.aFnd
.pField
;
506 switch( pField
->Which() )
508 case SwFieldIds::SetExp
:
509 case SwFieldIds::Table
:
510 case SwFieldIds::GetExp
:
512 sal_uInt16 nOldSubType
= pField
->GetSubType();
513 const_cast<SwField
*>(pField
)->SetSubType(nsSwExtendedSubType::SUB_CMD
);
514 sText
= pField
->ExpandField(true, rSh
.GetLayout());
515 const_cast<SwField
*>(pField
)->SetSubType(nOldSubType
);
519 case SwFieldIds::Postit
:
523 case SwFieldIds::Input
: // BubbleHelp, because the suggestion could be quite long
526 case SwFieldIds::Dropdown
:
527 case SwFieldIds::JumpEdit
:
528 sText
= pField
->GetPar2();
531 case SwFieldIds::Database
:
532 sText
= pField
->GetFieldName();
535 case SwFieldIds::User
:
537 OUString aTitle
= pField
->GetTitle();
538 if (!aTitle
.isEmpty())
544 sText
= pField
->GetPar1();
548 case SwFieldIds::HiddenText
:
549 sText
= pField
->GetPar1();
552 case SwFieldIds::DocStat
:
555 case SwFieldIds::Macro
:
556 sText
= static_cast<const SwMacroField
*>(pField
)->GetMacro();
559 case SwFieldIds::GetRef
:
562 const SwGetRefField
* pRefField( dynamic_cast<const SwGetRefField
*>(pField
) );
563 OSL_ENSURE( pRefField
,
564 "<SwEditWin::RequestHelp(..)> - unexpected type of <pField>" );
567 if ( pRefField
->IsRefToHeadingCrossRefBookmark() ||
568 pRefField
->IsRefToNumItemCrossRefBookmark() )
570 sText
= pRefField
->GetExpandedTextOfReferencedTextNode(*rSh
.GetLayout());
571 if ( sText
.getLength() > 80 )
573 sText
= OUString::Concat(sText
.subView(0, 80)) + "...";
578 sText
= pRefField
->GetSetRefName();
583 case SwFieldIds::TableOfAuthorities
:
585 const auto pAuthorityField
= static_cast<const SwAuthorityField
*>(pField
);
586 sText
= pAuthorityField
->GetAuthority(rSh
.GetLayout());
588 if (auto t
= pAuthorityField
->GetTargetType();
589 t
== SwAuthorityField::TargetType::UseDisplayURL
590 || t
== SwAuthorityField::TargetType::UseTargetURL
)
592 const OUString
& rURL
= pAuthorityField
->GetAbsoluteURL();
593 sText
+= "\n" + SfxHelp::GetURLHelpText(rURL
);
603 if( sText
.isEmpty() )
605 const bool bShowTrackChanges
= IDocumentRedlineAccess::IsShowChanges( m_rView
.GetDocShell()->GetDoc()->getIDocumentRedlineAccess().GetRedlineFlags() );
606 const bool bShowInlineTooltips
= rSh
.GetViewOptions()->IsShowInlineTooltips();
607 if ( bShowTrackChanges
&& bShowInlineTooltips
)
609 aContentAtPos
.eContentAtPos
= IsAttrAtPos::Redline
;
610 if( rSh
.GetContentAtPos( aPos
, aContentAtPos
, false, &aFieldRect
) )
611 sText
= lcl_GetRedlineHelp(*aContentAtPos
.aFnd
.pRedl
, bBalloon
, /*bTableChange=*/false, /*bTableColChange=*/false);
616 if (!sText
.isEmpty())
618 tools::Rectangle
aRect( aFieldRect
.SVRect() );
619 Point
aPt( OutputToScreenPixel( LogicToPixel( aRect
.TopLeft() )));
620 aRect
.SetLeft( aPt
.X() );
621 aRect
.SetTop( aPt
.Y() );
622 aPt
= OutputToScreenPixel( LogicToPixel( aRect
.BottomRight() ));
623 aRect
.SetRight( aPt
.X() );
624 aRect
.SetBottom( aPt
.Y() );
626 // tdf#136336 ensure tooltip area surrounds the current mouse position with at least a pixel margin
627 aRect
.Union(tools::Rectangle(rEvt
.GetMousePosPixel(), Size(1, 1)));
628 aRect
.AdjustLeft(-1);
629 aRect
.AdjustRight(1);
631 aRect
.AdjustBottom(1);
634 Help::ShowBalloon( this, rEvt
.GetMousePosPixel(), aRect
, sText
);
638 OUString
sDisplayText(ClipLongToolTip(sText
));
639 Help::ShowQuickHelp(this, aRect
, sDisplayText
, nStyle
);
649 Window::RequestHelp( rEvt
);
652 void SwEditWin::PrePaint(vcl::RenderContext
& /*rRenderContext*/)
654 if (SwWrtShell
* pWrtShell
= GetView().GetWrtShellPtr())
655 pWrtShell
->PrePaint();
658 void SwEditWin::Paint(vcl::RenderContext
& rRenderContext
, const tools::Rectangle
& rRect
)
660 SwWrtShell
* pWrtShell
= GetView().GetWrtShellPtr();
663 bool bPaintShadowCursor
= false;
666 tools::Rectangle
aRect( m_pShadCursor
->GetRect());
667 // fully resides inside?
668 if( rRect
.Contains( aRect
) )
671 m_pShadCursor
.reset();
673 else if( rRect
.Overlaps( aRect
))
675 // resides somewhat above, then everything is clipped outside
676 // and we have to make the "inner part" at the end of the
677 // Paint visible again. Otherwise Paint errors occur!
678 bPaintShadowCursor
= true;
682 if ( GetView().GetVisArea().GetWidth() <= 0 ||
683 GetView().GetVisArea().GetHeight() <= 0 )
687 pWrtShell
->setOutputToWindow(true);
688 bool bTiledPainting
= false;
689 if (comphelper::LibreOfficeKit::isActive())
691 bTiledPainting
= comphelper::LibreOfficeKit::isTiledPainting();
692 comphelper::LibreOfficeKit::setTiledPainting(true);
694 pWrtShell
->Paint(rRenderContext
, rRect
);
695 if (comphelper::LibreOfficeKit::isActive())
697 comphelper::LibreOfficeKit::setTiledPainting(bTiledPainting
);
699 pWrtShell
->setOutputToWindow(false);
702 if( bPaintShadowCursor
)
703 m_pShadCursor
->Paint();
706 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */