/* -*- 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 compatibility to beta files, search for CTF_SD_NUMBERINGRULES_NAME to // import numbering rules from the style:properties element const rtl::Reference< XMLPropertySetMapper >&rMapper = GetStyles()->GetImportPropertyMapper( GetFamily() )->getPropertySetMapper();
// first, look for the old format, where we had a text:list-style-name // attribute in the style:properties element auto property = std::find_if(rProperties.begin(), end, [&rMapper](XMLPropertyState& rProp) { // find properties with context return (rProp.mnIndex != -1) && (rMapper->GetEntryContextId( rProp.mnIndex ) == CTF_SD_NUMBERINGRULES_NAME); });
// if we did not find an old list-style-name in the properties, and we need one // because we got a style:list-style attribute in the style-style element // we generate one if( (property == end) && ( !m_sListStyleName.isEmpty() ) )
{
sal_Int32 nIndex = rMapper->FindEntryIndex( CTF_SD_NUMBERINGRULES_NAME );
SAL_WARN_IF( -1 == nIndex, "xmloff", "can't find numbering rules property entry, can't set numbering rule!" );
XMLPropertyState aNewState( nIndex );
rProperties.push_back( aNewState );
end = rProperties.end();
property = end - 1;
}
// so, if we have an old or a new list style name, we set its value to // a numbering rule if( property != end )
{ if( m_sListStyleName.isEmpty() )
{
property->maValue >>= m_sListStyleName;
}
Reference< XPropertySetInfo > xInfo; // get property set mapper
rtl::Reference<XMLPropertySetMapper> xPropMapper( pImpPrMap->getPropertySetMapper() );
for( sal_uInt16 i=0; aContextIDs[i].nContextID != -1; i++ )
{
sal_Int32 nIndex = aContextIDs[i].nIndex; if( nIndex != -1 ) switch( aContextIDs[i].nContextID )
{ case CTF_DASHNAME: case CTF_LINESTARTNAME: case CTF_LINEENDNAME: case CTF_FILLGRADIENTNAME: case CTF_FILLTRANSNAME: case CTF_FILLHATCHNAME: case CTF_FILLBITMAPNAME:
{ struct XMLPropertyState& rState = GetProperties()[nIndex];
OUString sStyleName;
rState.maValue >>= sStyleName;
sStyleName = GetImport().GetStyleDisplayName( aFamilies[i], sStyleName ); // All of these attributes refer to something with draw:name // of type styleName = NCName which is non-empty. // tdf#89802: for Writer frames there would be no exception here but // it will fail later on attach() and take out the entire frame if (sStyleName.isEmpty() &&
( CTF_FILLGRADIENTNAME == aContextIDs[i].nContextID
|| CTF_FILLTRANSNAME == aContextIDs[i].nContextID
|| CTF_FILLHATCHNAME == aContextIDs[i].nContextID
|| CTF_FILLBITMAPNAME == aContextIDs[i].nContextID))
{
Sequence<OUString> const seq{ sStyleName };
GetImport().SetError(
XMLERROR_STYLE_PROP_VALUE | XMLERROR_FLAG_WARNING,
seq, u"empty style name reference"_ustr, nullptr ); break;
}
if (::xmloff::IsIgnoreFillStyleNamedItem(rPropSet, aContextIDs[i].nExpectedFillStyle))
{
SAL_INFO("xmloff.style", "ShapeStyleContext: dropping fill named item: " << sStyleName); break; // ignore it, it's not used
}
// set the formatting on the control model of the control shape
uno::Reference< drawing::XControlShape > xControlShape(rPropSet, uno::UNO_QUERY);
DBG_ASSERT(xControlShape.is(), "XMLShapeStyleContext::FillPropertySet: data style for a non-control shape!"); if (xControlShape.is())
{
uno::Reference< beans::XPropertySet > xControlModel(xControlShape->getControl(), uno::UNO_QUERY);
DBG_ASSERT(xControlModel.is(), "XMLShapeStyleContext::FillPropertySet: no control model for the shape!"); if (xControlModel.is())
{
GetImport().GetFormImport()->applyControlNumberStyle(xControlModel, m_sControlDataStyleName);
}
}
}
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.