/* -*- 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 .
*/
for (size_t i = 0; i < aProps.size(); i++)
{
sal_Int32 nVal = 0;
// Hack for n#760986 // TODO: Preferred method would be to have a textbox on top // of the shape and the place it according to the (off,ext) if (nOff == 0 && moTextOffLeft)
nVal = *moTextOffLeft;
if (nOff == 1 && moTextOffUpper)
nVal = *moTextOffUpper;
if (nOff == 2 && moTextOffRight)
nVal = *moTextOffRight;
if (nOff == 3 && moTextOffLower)
nVal = *moTextOffLower;
sal_Int32 nTextOffsetValue = nVal;
if (moInsets[i])
{
nTextOffsetValue = *moInsets[i] + nVal;
}
// if inset is set, then always set the value // this prevents the default to be set (0 is a valid value) if (moInsets[i] || nTextOffsetValue)
{
maTextDistanceValues[nOff] = nTextOffsetValue;
}
nOff = (nOff + 1) % aProps.size();
}
// Check if bottom and top are set if (maTextDistanceValues[1] && maTextDistanceValues[3])
{ double nHeight = rTextAreaSize.getHeight();
// Check if top + bottom is more than text area height. // If yes, we need to adjust the values as defined in OOXML. if (nTop + nBottom >= nHeight)
{ double diffFactor = (nTop + nBottom - nHeight) / 2.0;
for (size_t i = 0; i < aProps.size(); i++)
{ if (maTextDistanceValues[i])
maPropertyMap.setProperty(aProps[i], *maTextDistanceValues[i]);
}
}
/* Readjust the text distances / insets if necessary to take
the text area into account, not just the shape area*/ void TextBodyProperties::readjustTextDistances(uno::Reference<drawing::XShape> const& xShape)
{ // Only for custom shapes (for now) auto* pCustomShape = dynamic_cast<SdrObjCustomShape*>(SdrObject::getSdrObjectFromXShape(xShape)); if (pCustomShape)
{
sal_Int32 nLower = pCustomShape->GetTextLowerDistance();
sal_Int32 nUpper = pCustomShape->GetTextUpperDistance();
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.