/* -*- 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 .
*/
// Put UnoAny in the item value if(eState < SfxItemState::DEFAULT || pItem == nullptr)
{ if( pPool == nullptr )
{
OSL_FAIL( "No default item and no pool?" ); return;
}
/** converts the given any with a metric to 100th/mm if needed */ void SvxUnoConvertToMM( const MapUnit eSourceMapUnit, uno::Any & rMetric ) noexcept
{ // map the metric of the itempool to 100th mm switch(eSourceMapUnit)
{ case MapUnit::MapTwip :
{ switch( rMetric.getValueTypeClass() )
{ case uno::TypeClass_BYTE:
rMetric <<= static_cast<sal_Int8>(convertTwipToMm100(*o3tl::forceAccess<sal_Int8>(rMetric))); break; case uno::TypeClass_SHORT:
rMetric <<= static_cast<sal_Int16>(convertTwipToMm100(*o3tl::forceAccess<sal_Int16>(rMetric))); break; case uno::TypeClass_UNSIGNED_SHORT:
rMetric <<= static_cast<sal_uInt16>(convertTwipToMm100(*o3tl::forceAccess<sal_uInt16>(rMetric))); break; case uno::TypeClass_LONG:
rMetric <<= static_cast<sal_Int32>(convertTwipToMm100(*o3tl::forceAccess<sal_Int32>(rMetric))); break; case uno::TypeClass_UNSIGNED_LONG:
rMetric <<= static_cast<sal_uInt32>(convertTwipToMm100(*o3tl::forceAccess<sal_uInt32>(rMetric))); break; default:
SAL_WARN("editeng", "AW: Missing unit translation to 100th mm, " << OString::number(static_cast<sal_Int32>(rMetric.getValueTypeClass())));
assert(false);
} break;
} default:
{
OSL_FAIL("AW: Missing unit translation to 100th mm!");
}
}
}
/** converts the given any with a metric from 100th/mm to the given metric if needed */ void SvxUnoConvertFromMM( const MapUnit eDestinationMapUnit, uno::Any & rMetric ) noexcept
{ switch(eDestinationMapUnit)
{ case MapUnit::MapTwip :
{ switch( rMetric.getValueTypeClass() )
{ case uno::TypeClass_BYTE:
rMetric <<= static_cast<sal_Int8>(sanitiseMm100ToTwip(*o3tl::forceAccess<sal_Int8>(rMetric))); break; case uno::TypeClass_SHORT:
rMetric <<= static_cast<sal_Int16>(sanitiseMm100ToTwip(*o3tl::forceAccess<sal_Int16>(rMetric))); break; case uno::TypeClass_UNSIGNED_SHORT:
rMetric <<= static_cast<sal_uInt16>(sanitiseMm100ToTwip(*o3tl::forceAccess<sal_uInt16>(rMetric))); break; case uno::TypeClass_LONG:
rMetric <<= static_cast<sal_Int32>(sanitiseMm100ToTwip(*o3tl::forceAccess<sal_Int32>(rMetric))); break; case uno::TypeClass_UNSIGNED_LONG:
rMetric <<= static_cast<sal_uInt32>(sanitiseMm100ToTwip(*o3tl::forceAccess<sal_uInt32>(rMetric))); break; default:
OSL_FAIL("AW: Missing unit translation to 100th mm!");
} break;
} default:
{
OSL_FAIL("AW: Missing unit translation to PoolMetrics!");
}
}
}
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.