21#include <osl/diagnose.h>
22#include <osl/thread.h>
57#include <com/sun/star/text/XTextRange.hpp>
64#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
68bool 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)
112 if (!aPos.GetContentNode()->IsTextNode())
115 uno::Reference<text::XTextRange> xRange(
118 uno::Reference<beans::XPropertySet> xPropertySet(xRange, uno::UNO_QUERY_THROW);
120 SwContentFrame* pContentFrame = aPos.GetContentNode()->GetTextNode()->getLayoutFrame(
125 bool bContainsPt =
false;
134 }
while((pContentFrame = pContentFrame->
GetFollow()));
142 xPropertySet->getPropertyValue(
"CharStyleName") >>= sCharStyle;
143 if (!sCharStyle.isEmpty())
150 const std::vector<OUString> aHiddenProperties{
UNO_NAME_RSID,
169 uno::Reference<beans::XPropertyState> xPropertiesState(xRange, uno::UNO_QUERY_THROW);
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);
200 pContentFrame = aPos.GetContentNode()->GetTextNode()->getLayoutFrame(
208 aFrameAreaRect.
Left(aFrameAreaRect.
Right() - 300);
213 aFrameAreaRect.
Right(aFrameAreaRect.
Left() + 300);
218 xPropertySet->getPropertyValue(
"ParaStyleName") >>= sParaStyle;
222 sText = sText +
" + " +
SwResId(STR_PARAGRAPH_DIRECT_FORMATTING);
225 }
while((pContentFrame = pContentFrame->
GetFollow()));
229 if (!sText.isEmpty())
235 aRect.SetLeft(aPt.X());
236 aRect.SetTop(aPt.Y());
238 aRect.SetRight(aPt.X());
239 aRect.SetBottom(aPt.Y());
243 aRect.AdjustLeft(-1);
244 aRect.AdjustRight(1);
246 aRect.AdjustBottom(1);
252 return !sText.isEmpty();
257 bool bTableChange,
bool bTableColChange )
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)
296 if( bBalloon && !rRedl.
GetComment().isEmpty() )
298 return sBuf.makeStringAndClear();
303 OUString sDisplayText(rText);
307 if (nTextWidth > nMaxWidth)
316 if (PSCSDFPropsQuickHelp(rEvt, rSh))
319 bool bQuickBalloon = bool(rEvt.
GetMode() & ( HelpEventMode::QUICK | HelpEventMode::BALLOON ));
322 bool bContinue =
true;
326 bool bBalloon = bool(rEvt.
GetMode() & HelpEventMode::BALLOON);
330 if( bQuickBalloon && pSdrView )
334 bContinue = pPage && pPage->
RequestHelp(
this, pSdrView, rEvt);
337 if( bContinue && bQuickBalloon)
368 sText = OUString::number(
374 sText = aContentAtPos.
sStr;
386 if( nFound != -1 && (++nFound) < sText.getLength() )
388 std::u16string_view
sSuffix( sText.subView(nFound) );
397 sText = sText.copy( 0, nFound - 1);
402 OUString sTmpSearchStr = sText.copy( 1 );
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();
432 if ( !bExecHyperlinks )
442 OUString aModStr( aModifiedCode.
GetName() );
443 aModStr = aModStr.replaceFirst(aCode.
GetName(),
"");
444 aModStr = aModStr.replaceAll(
"+",
"");
445 sText =
SwResId(STR_SMARTTAG_CLICK).replaceAll(
"%s", aModStr);
455 ? STR_ENDNOTE : STR_FTNNOTE ) + sTmp;
458 nStyle |= QuickHelpFlags::BiDiRtl;
468 if ( bShowTrackChanges && bShowInlineTooltips )
479 sText = aContentAtPos.
sStr;
483 GetTOXMark().GetTOXType();
486 sText =
": " + sText;
495 sText =
SwResId(STR_CONTENT_TYPE_SINGLE_REFERENCE) +
": " +
506 switch( pField->
Which() )
512 sal_uInt16 nOldSubType = pField->
GetSubType();
515 const_cast<SwField*
>(pField)->SetSubType(nOldSubType);
537 OUString aTitle = pField->
GetTitle();
538 if (!aTitle.isEmpty())
556 sText =
static_cast<const SwMacroField*
>(pField)->GetMacro();
563 OSL_ENSURE( pRefField,
564 "<SwEditWin::RequestHelp(..)> - unexpected type of <pField>" );
571 if ( sText.getLength() > 80 )
573 sText = OUString::Concat(sText.subView(0, 80)) +
"...";
588 if (
auto t = pAuthorityField->GetTargetType();
589 t == SwAuthorityField::TargetType::UseDisplayURL
590 ||
t == SwAuthorityField::TargetType::UseTargetURL)
592 const OUString& rURL = pAuthorityField->GetAbsoluteURL();
603 if( sText.isEmpty() )
607 if ( bShowTrackChanges && bShowInlineTooltips )
616 if (!sText.isEmpty())
649 Window::RequestHelp( rEvt );
655 pWrtShell->PrePaint();
664 if (
GetView().GetVisArea().GetWidth() <= 0 ||
665 GetView().GetVisArea().GetHeight() <= 0 )
670 bool bTiledPainting =
false;
676 pWrtShell->
Paint(rRenderContext, rRect);
PropertiesInfo aProperties
HelpEventMode GetMode() const
const Point & GetMousePosPixel() const
static void ShowQuickHelp(vcl::Window *pParent, const tools::Rectangle &rScreenRect, const OUString &rHelpText, QuickHelpFlags nStyle=QuickHelpFlags::NONE)
static void ShowBalloon(vcl::Window *pParent, const Point &rScreenPos, const tools::Rectangle &, const OUString &rHelpText)
wrapper iterator: wraps iterator of implementation while hiding MarkBase class; only IMark instances ...
Provides access to the marks of a document.
virtual const_iterator_t findBookmark(const OUString &rMark) const =0
Finds a bookmark by name.
@ CROSSREF_HEADING_BOOKMARK
static SW_DLLPUBLIC MarkType GetType(const ::sw::mark::IMark &rMark)
Returns the MarkType used to create the mark.
virtual const_iterator_t getBookmarksEnd() const =0
returns a STL-like random access iterator to the end of the sequence of IBookmarks.
static bool IsShowChanges(const RedlineFlags eM)
virtual RedlineFlags GetRedlineFlags() const =0
Query the currently set redline mode.
OUString GetEllipsisString(const OUString &rStr, tools::Long nMaxWidth, DrawTextFlags nStyle=DrawTextFlags::EndEllipsis) const
constexpr tools::Long Y() const
constexpr tools::Long X() const
SdrPage * GetPage() const
SdrPageView * GetSdrPageView() const
static OUString GetURLHelpText(std::u16string_view)
StylesHighlighterColorMap & GetStylesHighlighterCharColorMap()
StylesHighlighterColorMap & GetStylesHighlighterParaColorMap()
Represents an inserted bibliography entry, created using Insert -> Table of Contents and Index -> Bib...
OUString GetAuthority(const SwRootFrame *pLayout, const SwForm *pTOX=nullptr) const
Returns the line matching the source's default row in the ToX.
SwContentFrame is the layout for content nodes: a common base class for text (paragraph) and non-text...
const SwContentFrame * GetFollow() const
void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
bool GetContentAtPos(const Point &rPt, SwContentAtPos &rContentAtPos, bool bSetCursor=false, SwRect *pFieldRect=nullptr)
SwDPage is Writer's draw page: derives from SdrPage, but has a reference to the Writer document via S...
bool RequestHelp(vcl::Window *pWindow, SdrView const *pView, const HelpEvent &rEvt)
SwDoc * GetDoc()
returns Doc. But be careful!
static bool HasParagraphDirectFormatting(const SwPosition &rPos)
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
virtual void PrePaint(vcl::RenderContext &rRenderContext) override
OUString ClipLongToolTip(const OUString &rText)
fdo#55546 cut very long tooltips to 2/3 of the width of the screen via center ellipsis
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
const SwView & GetView() const
virtual void RequestHelp(const HelpEvent &rEvt) override
Base class of all fields.
virtual OUString GetPar1() const
virtual sal_uInt16 GetSubType() const
OUString ExpandField(bool bCached, SwRootFrame const *pLayout) const
expand the field.
virtual OUString GetFieldName() const
get name or content
SwFieldIds Which() const
ResId.
virtual OUString GetPar2() const
const OUString & GetTitle() const
const SwRect & getFrameArea() const
bool IsRightToLeft() const
bool IsRefToNumItemCrossRefBookmark() const
bool IsRefToHeadingCrossRefBookmark() const
OUString GetExpandedTextOfReferencedTextNode(SwRootFrame const &rLayout) const
const OUString & GetSetRefName() const
bool IsHideFieldTips() const
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
const OUString & GetComment(sal_uInt16 nPos=0) const
OUString const & GetAuthorString(sal_uInt16 nPos=0) const
const DateTime & GetTimeStamp(sal_uInt16 nPos=0) const
RedlineType GetType(sal_uInt16 nPos=0) const
Of course Writer needs its own rectangles.
void Right(const tools::Long nRight)
void AddLeft(const tools::Long nAdd)
bool Contains(const Point &rPOINT) const
void AddRight(const tools::Long nAdd)
tools::Rectangle SVRect() const
void Left(const tools::Long nLeft)
virtual bool GetModelPositionForViewPoint(SwPosition *, Point &, SwCursorMoveState *=nullptr, bool bTestBackground=false) const override
Primary passes the call to the first page.
static const OUString & GetUIName(const OUString &rName, SwGetPoolIdFromName)
const OUString & GetTypeName() const
SwTextNode is a paragraph in the document model.
const SfxItemPropertySet * GetPropertySet(sal_uInt16 PropertyId)
bool IsShowContentTips() const
bool IsShowInlineTooltips() const
const SwViewOption * GetViewOptions() const
void setOutputToWindow(bool bOutputToWindow)
const IDocumentMarkAccess * getIDocumentMarkAccess() const
Provides access to the document bookmark interface.
SwRootFrame * GetLayout() const
vcl::Window * GetWin() const
SwWrtShell & GetWrtShell() const
SwWrtShell * GetWrtShellPtr() const
SwDocShell * GetDocShell()
Used by the UI to modify the document model.
const SwView & GetView() const
Point OutputToScreenPixel(const Point &rPos) const
tools::Long GetTextWidth(const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, vcl::text::TextLayoutCache const *=nullptr, SalLayoutGlyphs const *const pLayoutCache=nullptr) const
Point LogicToPixel(const Point &rLogicPt) const
tools::Rectangle GetDesktopRectPixel() const
::OutputDevice const * GetOutDev() const
Point PixelToLogic(const Point &rDevicePt) const
void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
Point ScreenToOutputPixel(const Point &rPos) const
@ CurrAttrs
only for debugging
@ TableBoxValue
only for debugging
static OUString lcl_GetRedlineHelp(const SwRangeRedline &rRedl, bool bBalloon, bool bTableChange, bool bTableColChange)
@ Database
For old documents the Field-Which IDs must be preserved !!!
constexpr sal_uInt16 KEY_MOD1
constexpr sal_uInt16 KEY_SPACE
ExpandMode
Some helpers for converting model strings to view strings.
SVL_DLLPUBLIC OUString removePassword(OUString const &rURI, INetURLObject::EncodeMechanism eEncodeMechanism, INetURLObject::DecodeMechanism eDecodeMechanism=INetURLObject::DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
void setTiledPainting(bool bTiledPainting)
const SwExtendedSubType SUB_CMD
Show command.
OUString GetExpandTextMerged(SwRootFrame const *const pLayout, SwTextNode const &rNode, bool const bWithNumber, bool const bWithSpacesForLevel, ExpandMode const i_mode)
union SwContentAtPos::@21 aFnd
const SwRangeRedline * pRedl
const SfxPoolItem * pAttr
const SwTextAttr * pFndTextAttr
IsAttrAtPos eContentAtPos
Marks a position in the document model.
OUString SwResId(TranslateId aId)
const sal_Unicode cMarkSeparator
SwUnoPropertyMapProvider aSwMapProvider
#define PROPERTY_MAP_CHAR_AUTO_STYLE
constexpr OUStringLiteral UNO_NAME_SORTED_TEXT_ID
constexpr OUStringLiteral UNO_NAME_PARA_IS_NUMBERING_RESTART
constexpr OUStringLiteral UNO_NAME_CHAR_COLOR_THEME
constexpr OUStringLiteral UNO_NAME_NUMBERING_IS_NUMBER
constexpr OUStringLiteral UNO_NAME_PARA_CONDITIONAL_STYLE_NAME
constexpr OUStringLiteral UNO_NAME_PARA_STYLE_NAME
constexpr OUStringLiteral UNO_NAME_CHAR_COLOR_TINT_OR_SHADE
constexpr OUStringLiteral UNO_NAME_RSID
constexpr OUStringLiteral UNO_NAME_NUMBERING_LEVEL
constexpr OUStringLiteral UNO_NAME_PAGE_STYLE_NAME
constexpr OUStringLiteral UNO_NAME_NUMBERING_START_VALUE
constexpr OUStringLiteral UNO_NAME_PARA_CONTINUEING_PREVIOUS_SUB_TREE
constexpr OUStringLiteral UNO_NAME_PARRSID
constexpr OUStringLiteral UNO_NAME_CHAR_STYLE_NAME