android: Update app-specific/MIME type icons
[LibreOffice.git] / writerfilter / source / dmapper / GraphicImport.hxx
blob9729aecace62a5d7b2790498d7ba90259bed97e1
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #pragma once
21 #include <queue>
22 #include <memory>
24 #include "LoggedResources.hxx"
26 #include <com/sun/star/awt/Size.hpp>
27 #include <com/sun/star/beans/XPropertySet.hpp>
28 #include <com/sun/star/graphic/XGraphic.hpp>
30 namespace com::sun::star {
31 namespace uno
33 class XComponentContext;
35 namespace lang
37 class XMultiServiceFactory;
39 namespace text
41 class XTextContent;
43 namespace drawing
45 class XShape;
47 namespace beans
49 struct PropertyValue;
53 namespace writerfilter::dmapper
55 class GraphicImport_Impl;
56 class DomainMapper;
58 enum GraphicImportType
60 IMPORT_AS_DETECTED_INLINE,
61 IMPORT_AS_DETECTED_ANCHOR
64 class GraphicImport : public LoggedProperties, public LoggedTable
65 ,public BinaryObj, public LoggedStream
67 std::unique_ptr<GraphicImport_Impl> m_pImpl;
69 css::uno::Reference<css::uno::XComponentContext> m_xComponentContext;
70 css::uno::Reference<css::lang::XMultiServiceFactory> m_xTextFactory;
72 css::uno::Reference<css::text::XTextContent> m_xGraphicObject;
74 css::uno::Reference<css::drawing::XShape> m_xShape;
75 void ProcessShapeOptions(Value const & val);
77 css::uno::Reference<css::text::XTextContent>
78 createGraphicObject(css::uno::Reference<css::graphic::XGraphic> const & rxGraphic,
79 css::uno::Reference<css::beans::XPropertySet> const & xShapeProps);
81 void putPropertyToFrameGrabBag( const OUString& sPropertyName, const css::uno::Any& aPropertyValue );
83 public:
84 explicit GraphicImport( css::uno::Reference<css::uno::XComponentContext> xComponentContext,
85 css::uno::Reference<css::lang::XMultiServiceFactory> xTextFactory,
86 DomainMapper& rDomainMapper,
87 GraphicImportType & rGraphicImportType,
88 std::pair<OUString, OUString>& rPositionOffsets,
89 std::pair<OUString, OUString>& rAligns,
90 std::queue<OUString>& rPositivePercentages);
91 virtual ~GraphicImport() override;
93 // BinaryObj
94 virtual void data(const sal_uInt8* buffer, size_t len) override;
96 css::uno::Reference<css::text::XTextContent> GetGraphicObject();
97 const css::uno::Reference<css::drawing::XShape>& GetXShapeObject() const { return m_xShape;}
98 bool IsGraphic() const;
99 sal_Int32 GetLeftMarginOrig() const;
101 com::sun::star::awt::Point GetGraphicObjectPosition() const;
103 bool GetLayoutInCell() const;
105 private:
106 // Properties
107 virtual void lcl_attribute(Id Name, Value & val) override;
108 virtual void lcl_sprm(Sprm & sprm) override;
110 // Table
111 virtual void lcl_entry(writerfilter::Reference<Properties>::Pointer_t ref) override;
113 // Stream
114 virtual void lcl_startSectionGroup() override;
115 virtual void lcl_endSectionGroup() override;
116 virtual void lcl_startParagraphGroup() override;
117 virtual void lcl_endParagraphGroup() override;
118 virtual void lcl_startCharacterGroup() override;
119 virtual void lcl_endCharacterGroup() override;
120 virtual void lcl_text(const sal_uInt8 * data, size_t len) override;
121 virtual void lcl_utext(const sal_uInt8 * data, size_t len) override;
122 virtual void lcl_props(writerfilter::Reference<Properties>::Pointer_t ref) override;
123 virtual void lcl_table(Id name,
124 writerfilter::Reference<Table>::Pointer_t ref) override;
125 virtual void lcl_substream(Id name, writerfilter::Reference<Stream>::Pointer_t ref) override;
126 virtual void lcl_startShape(css::uno::Reference<css::drawing::XShape> const& xShape) override;
127 virtual void lcl_startTextBoxContent() override {};
128 virtual void lcl_endTextBoxContent() override {};
129 virtual void lcl_endShape() override;
131 void handleWrapTextValue(sal_uInt32 nVal);
132 void lcl_expandRectangleByEffectExtent(css::awt::Point& rLeftTop, css::awt::Size& rSize);
133 void lcl_correctWord2007EffectExtent(const sal_Int32 nMSOAngle);
136 typedef tools::SvRef<GraphicImport> GraphicImportPtr;
140 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */