/* -*- 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 (mpLineStyle)
{ auto& rLineDash = mpLineStyle->maLineDash; switch (rAttribs.getToken(XML_val, XML_TOKEN_INVALID))
{ case XML_solid: rLineDash.mePresetType = model::PresetDashType::Solid; break; case XML_dot: rLineDash.mePresetType = model::PresetDashType::Dot; break; case XML_dash: rLineDash.mePresetType = model::PresetDashType::Dash; break; case XML_lgDash: rLineDash.mePresetType = model::PresetDashType::LargeDash; break; case XML_dashDot: rLineDash.mePresetType = model::PresetDashType::DashDot; break; case XML_lgDashDot: rLineDash.mePresetType = model::PresetDashType::LargeDashDot; break; case XML_lgDashDotDot: rLineDash.mePresetType = model::PresetDashType::LargeDashDotDot; break; case XML_sysDash: rLineDash.mePresetType = model::PresetDashType::SystemDash; break; case XML_sysDot: rLineDash.mePresetType = model::PresetDashType::SystemDot; break; case XML_sysDashDot: rLineDash.mePresetType = model::PresetDashType::SystemDashDot; break; case XML_sysDashDotDot: rLineDash.mePresetType = model::PresetDashType::SystemDashDotDot; break; default:
rLineDash.mePresetType = model::PresetDashType::Unset; break;
}
}
} break; case A_TOKEN( custDash ): // CT_DashStopList returnthis; case A_TOKEN( ds ):
{ // 'a:ds' has 2 attributes : 'd' and 'sp' // both are of type 'a:ST_PositivePercentage' // according to the specs Office will read percentages formatted with a trailing percent sign // or formatted as 1000th of a percent without a trailing percent sign, but only write percentages // as 1000th's of a percent without a trailing percent sign. // The code below takes care of both scenarios by converting to '1000th of a percent' always
OUString aStr;
sal_Int32 nDashLength = 0;
aStr = rAttribs.getStringDefaulted( XML_d); if ( aStr.endsWith("%") )
{ // Ends with a '%'
aStr = aStr.copy(0, aStr.getLength() - 1);
aStr = aStr.trim();
nDashLength = aStr.toInt32();
// Convert to 1000th of a percent
nDashLength *= 1000;
} else
{
nDashLength = rAttribs.getInteger( XML_d, 0 );
}
sal_Int32 nSpaceLength = 0;
aStr = rAttribs.getStringDefaulted( XML_sp); if ( aStr.endsWith("%") )
{ // Ends with a '%'
aStr = aStr.copy(0, aStr.getLength() - 1);
aStr = aStr.trim();
nSpaceLength = aStr.toInt32();
// Convert to 1000th of a percent
nSpaceLength *= 1000;
} else
{
nSpaceLength = rAttribs.getInteger( XML_sp, 0 );
}
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.