/* -*- 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 .
*/
// tell the style about it's events (if applicable) if (m_xEventContext.is())
{ // pass events into event supplier
Reference<document::XEventsSupplier> xEventsSupplier(xStyle,UNO_QUERY);
m_xEventContext->SetEvents(xEventsSupplier);
m_xEventContext.clear();
}
// XML import: reconstruction of assignment of paragraph style to outline levels (#i69629#) if (m_nOutlineLevel > 0)
{
GetImport().GetTextImport()->AddOutlineStyleCandidate(m_nOutlineLevel,
GetDisplayName() );
}
}
void XMLTextStyleContext::FillPropertySet( const Reference<XPropertySet > & rPropSet )
{ // imitate the FillPropertySet of the super class, so we get a chance to // catch the combined characters attribute
// imitate XMLPropStyleContext::FillPropertySet(...)
SvXMLStylesContext* pSvXMLStylesContext = GetStyles();
SvXMLImportPropertyMapper* pImpPrMap = pSvXMLStylesContext->GetImportPropertyMapper(GetFamily());
DBG_ASSERT(pImpPrMap,"Where is the import prop mapper?");
if(!pImpPrMap) return;
// imitate SvXMLImportPropertyMapper::FillPropertySet(...) // The reason for this is that we have no other way to // efficiently intercept the value of combined characters. To // get that value, we could iterate through the map once more, // but instead we chose to insert the code into this // iteration. I haven't been able to come up with a much more // intelligent solution. struct ContextID_Index_Pair aContextIDs[] =
{
{ CTF_COMBINED_CHARACTERS_FIELD, -1, drawing::FillStyle::FillStyle_MAKE_FIXED_SIZE },
{ CTF_KEEP_TOGETHER, -1, drawing::FillStyle::FillStyle_MAKE_FIXED_SIZE },
{ CTF_BORDER_MODEL, -1, drawing::FillStyle::FillStyle_MAKE_FIXED_SIZE },
{ CTF_TEXT_DISPLAY, -1, drawing::FillStyle::FillStyle_MAKE_FIXED_SIZE },
{ CTF_FONTFAMILYNAME, -1, drawing::FillStyle::FillStyle_MAKE_FIXED_SIZE },
{ CTF_FONTFAMILYNAME_CJK, -1, drawing::FillStyle::FillStyle_MAKE_FIXED_SIZE },
{ CTF_FONTFAMILYNAME_CTL, -1, drawing::FillStyle::FillStyle_MAKE_FIXED_SIZE },
//UUU need special handling for DrawingLayer FillStyle names
{ CTF_FILLGRADIENTNAME, -1, drawing::FillStyle::FillStyle_GRADIENT },
{ CTF_FILLTRANSNAME, -1, drawing::FillStyle::FillStyle_MAKE_FIXED_SIZE },
{ CTF_FILLHATCHNAME, -1, drawing::FillStyle::FillStyle_HATCH },
{ CTF_FILLBITMAPNAME, -1, drawing::FillStyle::FillStyle_BITMAP },
// the style families associated with the same index modulo 4 staticconst XmlStyleFamily aFamilies[] =
{
XmlStyleFamily::SD_GRADIENT_ID,
XmlStyleFamily::SD_GRADIENT_ID,
XmlStyleFamily::SD_HATCH_ID,
XmlStyleFamily::SD_FILL_IMAGE_ID
};
// get property set info
Reference< XPropertySetInfo > xInfo;
rtl::Reference< XMLPropertySetMapper > rPropMapper; bool bAutomatic = false;
// have we found a combined characters if ( nIndex != -1 )
{
Any& rAny = GetProperties()[nIndex].maValue; bool bVal = *o3tl::doAccess<bool>(rAny);
m_bHasCombinedCharactersLetter = bVal;
}
// keep-together: the application default is different from // the file format default. Hence, if we always set this // value; if we didn't find one, we'll set to false, the file // format default. // border-model: same if(IsDefaultStyle() && XmlStyleFamily::TABLE_ROW == GetFamily())
{
OUString sIsSplitAllowed(u"IsSplitAllowed"_ustr);
SAL_WARN_IF( !rPropSet->getPropertySetInfo()->hasPropertyByName( sIsSplitAllowed ), "xmloff", "property missing?" );
rPropSet->setPropertyValue(
sIsSplitAllowed,
(aContextIDs[1].nIndex == -1) ? Any( false ) : GetProperties()[aContextIDs[1].nIndex].maValue );
}
switch(aContextIDs[i].nContextID)
{ case CTF_FILLGRADIENTNAME: case CTF_FILLTRANSNAME: case CTF_FILLHATCHNAME: case CTF_FILLBITMAPNAME:
{ // DrawingLayer FillStyle name needs to be mapped to DisplayName
OUString sStyleName;
rState.maValue >>= sStyleName;
// translate the used name from ODF intern to the name used in the Model
sStyleName = GetImport().GetStyleDisplayName(aFamilies[i - 7], sStyleName);
if(bAutomatic)
{ // in this case the rPropSet got not really filled since above the call to // CheckSpecialContext was used and not FillPropertySet, thus the below call to // setPropertyValue can fail/will not be useful (e.g. when the rPropSet // is a SwXTextCursor). // This happens for AutoStyles which are already filled in XMLPropStyleContext::CreateAndInsert, // thus the whole mechanism based on _ContextID_Index_Pair will not work // in that case. Thus the slots which need to be converted already get // converted there (it's called first) and not here (see // translateNameBasedDrawingLayerFillStyleDefinitionsToStyleDisplayNames) // For convenience, still Write back the corrected value to the XMLPropertyState entry
rState.maValue <<= sStyleName; break;
}
if (::xmloff::IsIgnoreFillStyleNamedItem(rPropSet, aContextIDs[i].nExpectedFillStyle))
{
SAL_INFO("xmloff.style", "XMLTextStyleContext: dropping fill named item: " << sStyleName); break; // ignore it, it's not used
}
// Still needed if it's not an AutomaticStyle (!) try
{ if(!rPropMapper.is())
{
rPropMapper = pImpPrMap->getPropertySetMapper();
}
// set property const OUString& rPropertyName = rPropMapper->GetEntryAPIName(rState.mnIndex);
if(xInfo->hasPropertyByName(rPropertyName))
{
rPropSet->setPropertyValue(rPropertyName,aAny);
}
} // else: "normal" style name -> no correction is necessary
} // else: no style name found -> illegal value -> ignore
}
}
}
}
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.