/* -*- 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 . */ #include "smmod.hxx" #include "tmpdevice.hxx" #include // SmTmpDevice // Allows for font and color changes. The original settings will be restored // in the destructor. // It's main purpose is to allow for the "const" in the 'OutputDevice' // argument in the 'Arrange' functions and restore changes made in the 'Draw' // functions. // Usually a MapMode of 1/100th mm will be used. SmTmpDevice::SmTmpDevice(OutputDevice &rTheDev, bool bUseMap100th_mm) : rOutDev(rTheDev) { rOutDev.Push( PushFlags::FONT | PushFlags::MAPMODE | PushFlags::LINECOLOR | PushFlags::FILLCOLOR | PushFlags::TEXTCOLOR ); if (bUseMap100th_mm && MapUnit::Map100thMM != rOutDev.GetMapMode().GetMapUnit()) { SAL_WARN("starmath", "incorrect MapMode?"); rOutDev.SetMapMode( MapUnit::Map100thMM ); //format for 100% always } } Color SmTmpDevice::Impl_GetColor( const Color& rColor ) { ColorData nNewCol = rColor.GetColor(); if (COL_AUTO == nNewCol) { if (OUTDEV_PRINTER == rOutDev.GetOutDevType()) nNewCol = COL_BLACK; else { Color aBgCol( rOutDev.GetBackground().GetColor() ); if (OUTDEV_WINDOW == rOutDev.GetOutDevType()) aBgCol = static_cast(rOutDev).GetDisplayBackground().GetColor(); nNewCol = SM_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor; Color aTmpColor( nNewCol ); if (aBgCol.IsDark() && aTmpColor.IsDark()) nNewCol = COL_WHITE; else if (aBgCol.IsBright() && aTmpColor.IsBright()) nNewCol = COL_BLACK; } } return Color( nNewCol ); } void SmTmpDevice::SetFont(const vcl::Font &rNewFont) { rOutDev.SetFont( rNewFont ); rOutDev.SetTextColor( Impl_GetColor( rNewFont.GetColor() ) ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ ro/collabora/co-24.04.5 LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
AgeCommit message (Expand)Author
2018-05-10loplugin:unnecessaryvirtual improvementsNoel Grandin
2017-11-02loplugin:finalclasses in formsNoel Grandin
2017-10-23loplugin:includeform: formsStephan Bergmann
2017-05-22Fix the from-German translation of "UNO binding"Johnny_M
2017-05-20Translate German comments and debug strings (leftovers in f... dirs)Johnny_M
2017-03-30tdf#39468 Translate German commentsJens Carl
2017-03-03Fix typosAndrea Gelmini
2017-01-26Remove dynamic exception specificationsStephan Bergmann
2017-01-23Change all Idle* LINKs to be Timer*Jan-Marek Glogowski
2016-11-21remove use of tryPropertyValue Any specialisationJochen Nitschke
2016-11-08loplugin:expandablemethods in forms..formulaNoel Grandin
2016-10-27coverity#1374315 Uncaught exceptionCaolán McNamara
2016-10-05Remove _TYPED suffix from tools/link.hxx macrosStephan Bergmann
2016-09-13loplugin:override: No more need for the "MSVC dtor override" workaroundStephan Bergmann
2016-09-01coverity#1372386 Uncaught exceptionCaolán McNamara
2016-01-25InterfaceContainer2 with vector instead of SequenceNoel Grandin
2015-10-12Replace "SAL_OVERRIDE" with "override" in LIBO_INTERNAL_ONLY codeStephan Bergmann
2015-10-07cppcheck: noExplicitConstructorCaolán McNamara
2015-10-02com::sun::star->css in forms/Noel Grandin
2015-08-19Remove two silly typedefsStephan Bergmann
2015-08-11forms: tdf#88206 replace cppu::WeakImplHelper* etc.Takeshi Abe
2015-05-05Use typed Idle::SetIdleHdl LinkStephan Bergmann
2015-03-17Fix various XServiceInfo implementationsStephan Bergmann
2015-03-06Timer: Adapted all idle includes and enum usesTobias Madl
2015-01-13ListBox with value list: consider first empty value as NULLLionel Elie Mamane
2014-12-09changed timers to idlesTobias Madl
2014-06-04forms: expand DECLARE_XCLONEABLEThomas Arnhold
2014-05-25Remove ASCII art, useless comments and whitespace from forms moduleChris Laplante
2014-05-06forms: sal_Bool->boolNoel Grandin
2014-04-07Remove silly PUT_SEMICOLON_AT_THE_ENDStephan Bergmann
2014-04-03remove unnecessary scope qualifier from sal_Bool usesNoel Grandin
2014-03-27Second batch of adding SAL_OVERRIDE to overriding function declarationsStephan Bergmann
2014-02-26Remove visual noise from formsAlexander Wilms
2014-02-26cppuhelper: retrofit std::exception into overriding exception specsStephan Bergmann
2013-11-05fixincludeguards.sh: formsThomas Arnhold