LibreOffice Module writerfilter (master) 1
GraphicImport.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19#pragma once
20
21#include <queue>
22#include <memory>
23
24#include "LoggedResources.hxx"
25
26#include <com/sun/star/awt/Size.hpp>
27#include <com/sun/star/beans/XPropertySet.hpp>
28#include <com/sun/star/graphic/XGraphic.hpp>
29
30namespace com::sun::star {
31 namespace uno
32 {
33 class XComponentContext;
34 }
35 namespace lang
36 {
37 class XMultiServiceFactory;
38 }
39 namespace text
40 {
41 class XTextContent;
42 }
43 namespace drawing
44 {
45 class XShape;
46 }
47 namespace beans
48 {
49 struct PropertyValue;
50 }
51}
52
54{
55class GraphicImport_Impl;
56class DomainMapper;
57
59{
62};
63
65 ,public BinaryObj, public LoggedStream
66{
67 std::unique_ptr<GraphicImport_Impl> m_pImpl;
68
69 css::uno::Reference<css::uno::XComponentContext> m_xComponentContext;
70 css::uno::Reference<css::lang::XMultiServiceFactory> m_xTextFactory;
71
72 css::uno::Reference<css::text::XTextContent> m_xGraphicObject;
73
74 css::uno::Reference<css::drawing::XShape> m_xShape;
75 void ProcessShapeOptions(Value const & val);
76
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);
80
81 void putPropertyToFrameGrabBag( const OUString& sPropertyName, const css::uno::Any& aPropertyValue );
82
83public:
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;
92
93 // BinaryObj
94 virtual void data(const sal_uInt8* buffer, size_t len) override;
95
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;
100
101 com::sun::star::awt::Point GetGraphicObjectPosition() const;
102
103 bool GetLayoutInCell() const;
104
105 private:
106 // Properties
107 virtual void lcl_attribute(Id Name, Value & val) override;
108 virtual void lcl_sprm(Sprm & sprm) override;
109
110 // Table
112
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;
123 virtual void lcl_table(Id name,
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;
130
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);
134};
135
137
138}
139
140/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Handler for binary objects.
void sprm(Sprm &sprm) override
Receives a SPRM.
An SPRM: Section, Paragraph and Run Modifier.
virtual void lcl_endSectionGroup() override
virtual void lcl_startTextBoxContent() override
std::unique_ptr< GraphicImport_Impl > m_pImpl
virtual void lcl_startCharacterGroup() override
virtual void lcl_startShape(css::uno::Reference< css::drawing::XShape > const &xShape) override
virtual void lcl_entry(writerfilter::Reference< Properties >::Pointer_t ref) override
virtual void lcl_endTextBoxContent() override
virtual void lcl_props(writerfilter::Reference< Properties >::Pointer_t ref) override
virtual void lcl_table(Id name, writerfilter::Reference< Table >::Pointer_t ref) override
virtual void lcl_startParagraphGroup() override
virtual void lcl_endParagraphGroup() override
virtual void lcl_attribute(Id Name, Value &val) override
css::uno::Reference< css::lang::XMultiServiceFactory > m_xTextFactory
css::uno::Reference< css::text::XTextContent > m_xGraphicObject
virtual void lcl_text(const sal_uInt8 *data, size_t len) override
virtual void lcl_substream(Id name, writerfilter::Reference< Stream >::Pointer_t ref) override
virtual void lcl_utext(const sal_uInt8 *data, size_t len) override
css::uno::Reference< css::text::XTextContent > GetGraphicObject()
virtual void lcl_endCharacterGroup() override
void putPropertyToFrameGrabBag(const OUString &sPropertyName, const css::uno::Any &aPropertyValue)
void handleWrapTextValue(sal_uInt32 nVal)
virtual void lcl_endShape() override
css::uno::Reference< css::uno::XComponentContext > m_xComponentContext
void lcl_expandRectangleByEffectExtent(css::awt::Point &rLeftTop, css::awt::Size &rSize)
void ProcessShapeOptions(Value const &val)
css::uno::Reference< css::drawing::XShape > m_xShape
virtual void data(const sal_uInt8 *buffer, size_t len) override
Receives binary data of the object.
const css::uno::Reference< css::drawing::XShape > & GetXShapeObject() const
GraphicImport(css::uno::Reference< css::uno::XComponentContext > xComponentContext, css::uno::Reference< css::lang::XMultiServiceFactory > xTextFactory, DomainMapper &rDomainMapper, GraphicImportType &rGraphicImportType, std::pair< OUString, OUString > &rPositionOffsets, std::pair< OUString, OUString > &rAligns, std::queue< OUString > &rPositivePercentages)
void lcl_correctWord2007EffectExtent(const sal_Int32 nMSOAngle)
css::uno::Reference< css::text::XTextContent > createGraphicObject(css::uno::Reference< css::graphic::XGraphic > const &rxGraphic, css::uno::Reference< css::beans::XPropertySet > const &xShapeProps)
com::sun::star::awt::Point GetGraphicObjectPosition() const
virtual void lcl_startSectionGroup() override
virtual void lcl_sprm(Sprm &sprm) override
def text(shape, orig_st)
tools::SvRef< GraphicImport > GraphicImportPtr
sal_uInt32 Id
unsigned char sal_uInt8