/* -*- 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 .
*/
// tdf#161204 Creates a poly-polygon using white hairline to provide contrast static basegfx::B2DPolyPolygon impCombineRangesToContrastPolyPolygon(const std::vector< basegfx::B2DRange >& rRanges)
{ const sal_uInt32 nCount(rRanges.size());
basegfx::B2DPolyPolygon aRetval;
for(sal_uInt32 a(0); a < nCount; a++)
{ const basegfx::B2DPolygon aDiscretePolygon(basegfx::utils::createPolygonFromRect(rRanges[a]));
// check if wanted type OverlayType::Transparent or OverlayType::Solid // is possible. If not, fallback to invert mode (classic mode) static OverlayType impCheckPossibleOverlayType(OverlayType aOverlayType)
{ if(OverlayType::Invert != aOverlayType)
{ if(!officecfg::Office::Common::Drawinglayer::TransparentSelection::get())
{ // not possible when switched off by user return OverlayType::Invert;
} elseif (const OutputDevice* pOut = Application::GetDefaultDevice())
{
if(pOut->GetSettings().GetStyleSettings().GetHighContrastMode())
{ // not possible when in high contrast mode return OverlayType::Invert;
}
}
}
// embed all rectangles in transparent paint const drawinglayer::primitive2d::Primitive2DReference aUnifiedTransparence( new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D(
std::move(aRetval),
fTransparence));
// tdf#161204 Outline with white color to provide contrast if (mbContrastOutline)
{
basegfx::B2DPolyPolygon aContrastPolyPolygon(impCombineRangesToContrastPolyPolygon(getRanges())); const drawinglayer::primitive2d::Primitive2DReference aContrastSelectionOutline( new drawinglayer::primitive2d::PolyPolygonHairlinePrimitive2D(
std::move(aContrastPolyPolygon),
basegfx::BColor(1.0, 1.0, 1.0)));
aRetval.append(drawinglayer::primitive2d::Primitive2DContainer{aContrastSelectionOutline});
}
// Offset to be applied to the external outline double fOffset(0); if (getOverlayManager())
fOffset = getOverlayManager()->getOutputDevice().PixelToLogic(Size(1, 1)).getWidth();
// External outline using themed color
basegfx::B2DPolyPolygon aPolyPolygon(impCombineRangesToPolyPolygon(getRanges(), mbContrastOutline, fOffset)); const drawinglayer::primitive2d::Primitive2DReference aSelectionOutline( new drawinglayer::primitive2d::PolyPolygonHairlinePrimitive2D(
std::move(aPolyPolygon),
aRGBColor));
// Add to result
aRetval.append(drawinglayer::primitive2d::Primitive2DContainer {aSelectionOutline});
} else
{ // just add transparent part
aRetval = drawinglayer::primitive2d::Primitive2DContainer { aUnifiedTransparence };
}
}
}
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.