/* -*- 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 .
*/
SchXMLImport::~SchXMLImport() noexcept
{
uno::Reference< chart2::XChartDocument > xChartDoc( GetModel(), uno::UNO_QUERY ); if (xChartDoc.is())
{ if (xChartDoc->hasControllersLocked())
xChartDoc->unlockControllers(); if (auto xPropSet = xChartDoc.query<beans::XPropertySet>())
{ try
{ // The view of the chart might not received a notification about the updates, // which is only sent when the chart model is set modified; during the load, // setting modified is disabled. So, the view needs an explicit notification. // See ChartDocumentWrapper::setPropertyValue
xPropSet->setPropertyValue(u"ODFImport_UpdateView"_ustr, css::uno::Any(xChartDoc));
} catch (css::beans::UnknownPropertyException&)
{ // That's absolutely fine!
}
}
}
}
// create the main context (subcontexts are created // by the one created here)
SvXMLImportContext *SchXMLImport::CreateFastContext( sal_Int32 nElement, const uno::Reference< xml::sax::XFastAttributeList >& /*xAttrList*/ )
{
SvXMLImportContext* pContext = nullptr;
switch (nElement)
{ case XML_ELEMENT( OFFICE, XML_DOCUMENT ): case XML_ELEMENT( OFFICE, XML_DOCUMENT_META ):
{
uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
GetModel(), uno::UNO_QUERY); // mst@: right now, this seems to be not supported, so it is untested if (xDPS.is()) {
pContext = (nElement == XML_ELEMENT(OFFICE, XML_DOCUMENT_META))
? new SvXMLMetaDocumentContext(*this, xDPS->getDocumentProperties()) // flat OpenDocument file format
: new SchXMLFlatDocContext_Impl(*maImportHelper, *this, nElement,
xDPS->getDocumentProperties());
}
} break; // accept <office:document> case XML_ELEMENT(OFFICE, XML_DOCUMENT_STYLES): case XML_ELEMENT(OFFICE, XML_DOCUMENT_CONTENT):
pContext = new SchXMLDocContext(*maImportHelper, *this, nElement); break;
} return pContext;
}
SvXMLImportContext* SchXMLImport::CreateStylesContext()
{ //#i103287# make sure that the version information is set before importing all the properties (especially stroke-opacity!)
SchXMLTools::setBuildIDAtImportInfo( GetModel(), getImportInfo() );
SvXMLStylesContext* pStylesCtxt = new SvXMLStylesContext( *this );
// set context at base class, so that all auto-style classes are imported
SetAutoStyles( pStylesCtxt );
maImportHelper->SetAutoStylesContext( pStylesCtxt );
if (!xChartDoc.is()) return; try
{ // prevent rebuild of view during load (necessary especially if loaded not // via load api, which is the case for example if binary files are loaded)
xChartDoc->lockControllers();
uno::Reference<container::XChild> xChild(xChartDoc, uno::UNO_QUERY);
uno::Reference<chart2::data::XDataReceiver> xDataReceiver(xChartDoc, uno::UNO_QUERY); if (xChild.is() && xDataReceiver.is())
{
Reference<lang::XMultiServiceFactory> xFact(xChild->getParent(), uno::UNO_QUERY); if (xFact.is())
{ //if the parent has a number formatter we will use the numberformatter of the parent
Reference<util::XNumberFormatsSupplier> xNumberFormatsSupplier(xFact, uno::UNO_QUERY);
xDataReceiver->attachNumberFormatsSupplier(xNumberFormatsSupplier);
}
}
} catch (const uno::Exception &)
{
TOOLS_INFO_EXCEPTION("xmloff.chart", "SchXMLChartContext::StartElement(): Exception caught");
}
}
// first version: everything comes from one storage
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.