Resolves: tdf#156398 use same color combination as used in tdf#51300

so we don't get white text on yellow background

Change-Id: I346decaab293e2bb15c1110dfa61df5838607d79
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178694
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins
This commit is contained in:
Caolán McNamara
2024-12-18 09:20:31 +01:00
parent ff20399edf
commit 3359b944fe
3 changed files with 19 additions and 10 deletions
+2 -1
View File
@@ -44,7 +44,7 @@ private:
class ScOverlayHint : public sdr::overlay::OverlayObject
{
public:
ScOverlayHint(OUString aTit, const OUString& rMsg, const Color& rColor, vcl::Font aFont);
ScOverlayHint(OUString aTit, const OUString& rMsg, const Color& rBack, const Color& rText, vcl::Font aFont);
Size GetSizePixel() const;
void SetPos(const Point& rPos, const MapMode& rMode);
@@ -57,6 +57,7 @@ private:
const OUString m_aTitle;
const OUString m_aMessage;
const vcl::Font m_aTextFont;
const Color m_aTextColor;
MapMode m_aMapMode;
sal_Int32 m_nLeft;
sal_Int32 m_nTop;
+7 -6
View File
@@ -38,11 +38,14 @@
#define HINT_INDENT 3
#define HINT_MARGIN 4
ScOverlayHint::ScOverlayHint(OUString aTit, const OUString& rMsg, const Color& rColor, vcl::Font aFont)
: OverlayObject(rColor)
ScOverlayHint::ScOverlayHint(OUString aTit, const OUString& rMsg,
const Color& rBackColor, const Color& rTextColor,
vcl::Font aFont)
: OverlayObject(rBackColor)
, m_aTitle(std::move(aTit))
, m_aMessage(convertLineEnd(rMsg, LINEEND_CR))
, m_aTextFont(std::move(aFont))
, m_aTextColor(rTextColor)
, m_aMapMode(MapUnit::MapPixel)
, m_nLeft(0)
, m_nTop(0)
@@ -57,8 +60,6 @@ drawinglayer::primitive2d::Primitive2DContainer ScOverlayHint::createOverlaySequ
MapMode aOld = pDefaultDev->GetMapMode();
pDefaultDev->SetMapMode(rMapMode);
const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
const Color& rColor = rStyleSettings.GetLabelTextColor();
vcl::Font aTextFont = m_aTextFont;
aTextFont.SetFontSize(pDefaultDev->PixelToLogic(aTextFont.GetFontSize(), rMapMode));
vcl::Font aHeadFont = aTextFont;
@@ -84,7 +85,7 @@ drawinglayer::primitive2d::Primitive2DContainer ScOverlayHint::createOverlaySequ
new drawinglayer::primitive2d::TextSimplePortionPrimitive2D(
aTextMatrix, m_aTitle, 0, m_aTitle.getLength(),
std::vector<double>(), {}, std::move(aFontAttr), css::lang::Locale(),
rColor.getBColor());
m_aTextColor.getBColor());
Point aTextStart(nLeft + aHintMargin.Width() + aIndent.Width(),
nTop + aHintMargin.Height() + aFontMetric.GetLineHeight() + aIndent.Height());
@@ -125,7 +126,7 @@ drawinglayer::primitive2d::Primitive2DContainer ScOverlayHint::createOverlaySequ
new drawinglayer::primitive2d::TextSimplePortionPrimitive2D(
aTextMatrix, aLine, 0, aLine.getLength(),
std::vector<double>(), {}, aFontAttr, css::lang::Locale(),
rColor.getBColor());
m_aTextColor.getBColor());
rRange.expand(pMessage->getB2DRange(aDummy));
+10 -3
View File
@@ -835,9 +835,13 @@ void ScTabView::TestHintWindow()
aPos.X() < aWinSize.Width() && aPos.Y() < aWinSize.Height() )
{
const svtools::ColorConfig& rColorCfg = ScModule::get()->GetColorConfig();
Color aCommentColor = rColorCfg.GetColorValue(svtools::CALCNOTESBACKGROUND).nColor;
// tdf#156398 use same color combination as used in XclDefaultPalette
Color aCommentText = rColorCfg.GetColorValue(svtools::FONTCOLOR).nColor;
Color aCommentBack = rColorCfg.GetColorValue(svtools::CALCNOTESBACKGROUND).nColor;
// create HintWindow, determines its size by itself
ScOverlayHint* pOverlay = new ScOverlayHint(aTitle, aMessage, aCommentColor, pFrameWin->GetFont());
ScOverlayHint* pOverlay = new ScOverlayHint(aTitle, aMessage,
aCommentBack, aCommentText,
pFrameWin->GetFont());
mxInputHintOO.reset(new sdr::overlay::OverlayObjectList);
mxInputHintOO->append(std::unique_ptr<sdr::overlay::OverlayObject>(pOverlay));
@@ -872,7 +876,10 @@ void ScTabView::TestHintWindow()
//missing portions will be displayed in the other split windows to form an apparent
//single tip, albeit "under" the split lines
Point aOtherPos(pWindow->ScreenToOutputPixel(pWin->OutputToScreenPixel(aHintPos)));
std::unique_ptr<ScOverlayHint> pOtherOverlay(new ScOverlayHint(aTitle, aMessage, aCommentColor, pFrameWin->GetFont()));
std::unique_ptr<ScOverlayHint> pOtherOverlay(new ScOverlayHint(aTitle, aMessage,
aCommentBack,
aCommentText,
pFrameWin->GetFont()));
Point aFooPos(pWindow->PixelToLogic(aOtherPos, pWindow->GetDrawMapMode()));
pOtherOverlay->SetPos(aFooPos, pWindow->GetDrawMapMode());
xOverlayManager->add(*pOtherOverlay);