/* -*- 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 .
*/ #ifndef INCLUDED_XMLOFF_SHAPEEXPORT_HXX #define INCLUDED_XMLOFF_SHAPEEXPORT_HXX
namespace com::sun::star::awt { struct Point; } namespace com::sun::star::beans { class XPropertySet; } namespace com::sun::star::drawing { class XShape; } namespace com::sun::star::drawing { class XShapes; }
class XMLTableExport; namespace comphelper { class AttributeList; }
// shape export features are bits used for the nFeature // parameter of XMLShapeExport::exportShape enumclass XMLShapeExportFlags {
NONE = 0,
X = 0x0001,
Y = 0x0002,
POSITION = 0x0003,
WIDTH = 0x0004,
HEIGHT = 0x0008,
SIZE = WIDTH | HEIGHT, // When setting the flag below no ignorableWhiteSpace will be called around // the drawing object elements
NO_WS = 0x0020, // When setting the flag below a callout shape is exported as office:annotation
ANNOTATION = 0x0040,
}; namespace o3tl
{ template<> struct typed_flags<XMLShapeExportFlags> : is_typed_flags<XMLShapeExportFlags, 0x6f> {};
}
/** caches style and type info after a collectShapeAutostyle for later use in exportShape */ struct ImplXMLShapeExportInfo
{
OUString msStyleName;
OUString msTextStyleName;
XmlStyleFamily mnFamily;
XmlShapeType meShapeType;
/** a vector for shape style and type cache information */ typedef std::map< css::uno::Reference< css::drawing::XShape >, ImplXMLShapeExportInfo > ShapeExportInfoMap;
/** a map to store all cache data for already collected XShapes */ typedef std::map< css::uno::Reference < css::drawing::XShapes >, ShapeExportInfoMap > ShapesInfos;
class SvXMLExport; class SvXMLExportPropertyMapper;
namespace basegfx
{ class B2DTuple; class B2DHomMatrix;
}
class XMLOFF_DLLPUBLIC XMLShapeExport : public salhelper::SimpleReferenceObject
{ private:
// This method collects all automatic styles for the given XShape void collectShapeAutoStyles( const css::uno::Reference < css::drawing::XShape >& xShape);
// This method exports the given XShape void exportShape( const css::uno::Reference < css::drawing::XShape >& xShape,
XMLShapeExportFlags nFeatures = SEF_DEFAULT,
css::awt::Point* pRefPoint = nullptr,
comphelper::AttributeList* pAttrList = nullptr
);
// This method collects all automatic styles for the shapes inside the given XShapes collection void collectShapesAutoStyles( const css::uno::Reference < css::drawing::XShapes >& xShapes);
// This method exports all XShape inside the given XShapes collection void exportShapes( const css::uno::Reference < css::drawing::XShapes >& xShapes,
XMLShapeExportFlags nFeatures = SEF_DEFAULT,
css::awt::Point* pRefPoint = nullptr
);
/** initializes some internal structures for fast access to the given XShapes collection
<p>This method has to be called before you use exportShape or collectShapeAutoStyles. It is automatically called if you use collectShapesAutoStyles and exportShapes.
/** sets a new reference to an XMLAnimationExporter. If this is a non NULL reference, the animation information from all shapes given to exportShape() from now on are collected.
*/ void setAnimationsExporter( rtl::Reference< XMLAnimationsExporter > const & xAnimExport ) { mxAnimationsExporter = xAnimExport; }
/** returns the last set XMLAnimationExport */ const rtl::Reference< XMLAnimationsExporter >& getAnimationsExporter() const { returnmxAnimationsExporter; }
/// returns the export property mapper for external chaining static SvXMLExportPropertyMapper* CreateShapePropMapper( SvXMLExport& rExport );
/** defines if the export should increment the progress bar or not */ void enableHandleProgressBar() { mbHandleProgressBar = true; } bool IsHandleProgressBarEnabled() const { return mbHandleProgressBar; }
/** helper for chart that adds all attributes of a 3d scene element to the export */ void export3DSceneAttributes( const css::uno::Reference< css::beans::XPropertySet >& xPropSet );
/** helper for chart that exports all lamps from the propertyset */ void export3DLamps( const css::uno::Reference< css::beans::XPropertySet >& xPropSet );
/** sj: replacing CustomShapes with standard objects that are also supported in OpenOffice.org format */
css::uno::Reference < css::drawing::XShape > checkForCustomShapeReplacement( const css::uno::Reference < css::drawing::XShape >& );
/** helper to export the style for graphic defaults */ void ExportGraphicDefaults();
/** is called before a shape element for the given XShape is exported */ virtualvoid onExport( const css::uno::Reference < css::drawing::XShape >& xShape );