/* -*- 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 .
*/
// All paragraphs should be either undefined (default) or the same style, // because it will only be applied to the entire shape, and not per-paragraph. if (sParaStyle.isEmpty() )
{ if ( rParagraph.moParaStyleName.has_value() )
sParaStyle = rParagraph.moParaStyleName.value(); if ( bAmbiguousStyle )
bAmbiguousStyle = false; // both empty parastyle and ambiguous can only be true at the first paragraph else
bAmbiguousStyle = rParagraph.moParaStyleName.has_value(); // ambiguous if both default and specified style used.
} elseif ( !bAmbiguousStyle )
{ if ( !rParagraph.moParaStyleName.has_value() )
bAmbiguousStyle = true; // ambiguous if both specified and default style used. elseif ( rParagraph.moParaStyleName.value() != sParaStyle )
bAmbiguousStyle = true; // ambiguous if two different styles specified.
} if (rFont.moColor.has_value())
{
aPropertyValue.Name = "CharColor";
aPropertyValue.Value <<= rFont.moColor.value().toUInt32(16);
aPropVec.push_back(aPropertyValue);
}
xTextAppend->appendTextPortion(portion.maText, comphelper::containerToSequence(aPropVec));
}
try
{ // Track the style in a grabBag for use later when style details are known.
comphelper::SequenceAsHashMap aGrabBag;
uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY_THROW);
aGrabBag.update( xPropertySet->getPropertyValue(u"CharInteropGrabBag"_ustr) );
aGrabBag[u"mso-pStyle"_ustr] <<= sParaStyle;
xPropertySet->setPropertyValue(u"CharInteropGrabBag"_ustr, uno::Any(aGrabBag.getAsConstPropertyValueList()));
} catch (const uno::Exception&)
{
TOOLS_WARN_EXCEPTION( "oox.vml","convert() grabbag exception" );
}
// Remove the last character of the shape text, if it would be a newline.
uno::Reference< text::XTextCursor > xCursor = xTextAppend->createTextCursor();
xCursor->gotoEnd(false);
xCursor->goLeft(1, true); if (xCursor->getString() == "\n")
xCursor->setString(u""_ustr);
// VML has the text horizontally aligned to left (all the time), // v-text-anchor for vertical alignment, and vertical mode to swap the // two. drawinglayer supports both horizontal and vertical alignment, // but no vertical mode: we use T->B, R->L instead. // As a result, we need to set horizontal adjustment here to 'right', // that will result in vertical 'top' after writing mode is applied, // which matches the VML behavior.
xProperties->setPropertyValue(u"TextHorizontalAdjust"_ustr, uno::Any(drawing::TextHorizontalAdjust_RIGHT));
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.