/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
if (bContainsPt)
{ if (rView.IsSpotlightCharStyles())
{ // check if in CS formatting highlighted area
OUString sCharStyle;
xRange->getPropertyValue(u"CharStyleName"_ustr) >>= sCharStyle; if (!sCharStyle.isEmpty())
sText = SwStyleNameMapper::GetUIName(ProgName(sCharStyle), SwGetPoolIdFromName::ChrFmt);
}
if (sText.isEmpty() && rView.IsHighlightCharDF())
{ // check if in direct formatting highlighted area const std::vector<OUString> aHiddenProperties{ UNO_NAME_RSID,
UNO_NAME_PARA_IS_NUMBERING_RESTART,
UNO_NAME_PARA_STYLE_NAME,
UNO_NAME_PARA_CONDITIONAL_STYLE_NAME,
UNO_NAME_PAGE_STYLE_NAME,
UNO_NAME_NUMBERING_START_VALUE,
UNO_NAME_NUMBERING_IS_NUMBER,
UNO_NAME_PARA_CONTINUEING_PREVIOUS_SUB_TREE,
UNO_NAME_CHAR_STYLE_NAME,
UNO_NAME_NUMBERING_LEVEL,
UNO_NAME_SORTED_TEXT_ID,
UNO_NAME_PARRSID,
UNO_NAME_CHAR_COLOR_THEME,
UNO_NAME_CHAR_COLOR_TINT_OR_SHADE };
if (std::find(aHiddenProperties.begin(), aHiddenProperties.end(), rPropName)
!= aHiddenProperties.end()) continue;
if (xRange->getPropertyState(rPropName)
== beans::PropertyState_DIRECT_VALUE)
{ const uno::Any aAny = xRange->getPropertyValue(rPropName); if (HasValidPropertyValue(aAny))
{
sText = UIName(SwResId(STR_CHARACTER_DIRECT_FORMATTING)); break;
}
}
}
}
} elseif (rView.IsSpotlightParaStyles())
{ // check if in paragraph style formatting highlighted area
pContentFrame = aPos.GetContentNode()->GetTextNode()->getLayoutFrame(
rSh.GetLayout()); do
{
aFrameAreaRect = pContentFrame->getFrameArea(); if (pContentFrame->IsRightToLeft())
{
aFrameAreaRect.AddRight(375);
aFrameAreaRect.Left(aFrameAreaRect.Right() - 300);
} else
{
aFrameAreaRect.AddLeft(-375);
aFrameAreaRect.Right(aFrameAreaRect.Left() + 300);
} if (aFrameAreaRect.Contains(aPt))
{
OUString sParaStyle;
xRange->getPropertyValue(u"ParaStyleName"_ustr) >>= sParaStyle;
sText = SwStyleNameMapper::GetUIName(ProgName(sParaStyle), SwGetPoolIdFromName::TxtColl); // check for paragraph direct formatting if (SwDoc::HasParagraphDirectFormatting(aPos))
sText = UIName(sText.toString() + " + " + SwResId(STR_PARAGRAPH_DIRECT_FORMATTING)); break;
}
} while((pContentFrame = pContentFrame->GetFollow()));
}
}
if (!sText.isEmpty())
{
tools::Rectangle aRect(rSh.GetWin()->PixelToLogic(
rSh.GetWin()->ScreenToOutputPixel(rEvt.GetMousePosPixel())),
Size(1, 1));
Point aPt(rSh.GetWin()->OutputToScreenPixel(rSh.GetWin()->LogicToPixel(aRect.TopLeft())));
aRect.SetLeft(aPt.X());
aRect.SetTop(aPt.Y());
aPt = rSh.GetWin()->OutputToScreenPixel(rSh.GetWin()->LogicToPixel(aRect.BottomRight()));
aRect.SetRight(aPt.X());
aRect.SetBottom(aPt.Y());
// tdf#136336 ensure tooltip area surrounds the current mouse position with at least a pixel margin
aRect.Union(tools::Rectangle(rEvt.GetMousePosPixel(), Size(1, 1)));
aRect.AdjustLeft(-1);
aRect.AdjustRight(1);
aRect.AdjustTop(-1);
aRect.AdjustBottom(1);
SwPosition aPos(rSh.GetDoc()->GetNodes());
rSh.GetLayout()->GetModelPositionForViewPoint(&aPos, aPt); // Do not try to create a range for non-text and non-startnode; // see MarkManager::makeMark if (!aPos.GetNode().IsTextNode() && !aPos.GetNode().IsStartNode()) break;
rtl::Reference<SwXTextRange> xRange(SwXTextRange::CreateXTextRange(
*(m_rView.GetDocShell()->GetDoc()), aPos, &aPos));
case SwFieldIds::Postit:
{ break;
} case SwFieldIds::Input: // BubbleHelp, because the suggestion could be quite long
bBalloon = true;
[[fallthrough]]; case SwFieldIds::Dropdown: case SwFieldIds::JumpEdit:
sText = pField->GetPar2(); break;
case SwFieldIds::Database:
sText = pField->GetFieldName(); break;
case SwFieldIds::User:
{
OUString aTitle = pField->GetTitle(); if (!aTitle.isEmpty())
{
sText = aTitle;
} else
{
sText = pField->GetPar1();
} break;
} case SwFieldIds::HiddenText:
sText = pField->GetPar1(); break;
case SwFieldIds::DocStat: break;
case SwFieldIds::Macro:
sText = static_cast<const SwMacroField*>(pField)->GetMacro(); break;
case SwFieldIds::GetRef:
{ // #i85090# const SwGetRefField* pRefField( dynamic_cast<const SwGetRefField*>(pField) );
OSL_ENSURE( pRefField, " - unexpected type of " ); if ( pRefField )
{ if ( pRefField->IsRefToHeadingCrossRefBookmark() ||
pRefField->IsRefToNumItemCrossRefBookmark() )
{
sText = pRefField->GetExpandedTextOfReferencedTextNode(*rSh.GetLayout()); if ( sText.getLength() > 80 )
{
sText = OUString::Concat(sText.subView(0, 80)) + "...";
}
} else
{
sText = pRefField->GetSetRefName().toString();
}
} break;
} case SwFieldIds::TableOfAuthorities:
{ constauto pAuthorityField = static_cast<const SwAuthorityField*>(pField);
sText = pAuthorityField->GetAuthority(rSh.GetLayout());
if (auto t = pAuthorityField->GetTargetType();
t == SwAuthorityField::TargetType::UseDisplayURL
|| t == SwAuthorityField::TargetType::UseTargetURL)
{ const OUString aURL = pAuthorityField->GetAbsoluteURL();
sText += "\n" + SfxHelp::GetURLHelpText(aURL);
}
// tdf#136336 ensure tooltip area surrounds the current mouse position with at least a pixel margin
aRect.Union(tools::Rectangle(rEvt.GetMousePosPixel(), Size(1, 1)));
aRect.AdjustLeft(-1);
aRect.AdjustRight(1);
aRect.AdjustTop(-1);
aRect.AdjustBottom(1);
if (bBalloon)
Help::ShowBalloon(this, rEvt.GetMousePosPixel(), aRect, sText); else
{ // the show the help
OUString sDisplayText(sText); if (!bScreenTip)
sDisplayText = ClipLongToolTip(sText);
Help::ShowQuickHelp(this, aRect, sDisplayText, nStyle);
}
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.