1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #ifndef INCLUDED_WRITERFILTER_SOURCE_DMAPPER_GRAPHICIMPORT_HXX
20 #define INCLUDED_WRITERFILTER_SOURCE_DMAPPER_GRAPHICIMPORT_HXX
25 #include "LoggedResources.hxx"
27 #include <com/sun/star/graphic/XGraphic.hpp>
29 namespace com
{ namespace sun
{ namespace star
{
32 class XComponentContext
;
36 class XMultiServiceFactory
;
52 namespace writerfilter
56 class GraphicImport_Impl
;
59 enum GraphicImportType
61 IMPORT_AS_DETECTED_INLINE
,
62 IMPORT_AS_DETECTED_ANCHOR
65 class GraphicImport
: public LoggedProperties
, public LoggedTable
66 ,public BinaryObj
, public LoggedStream
68 std::unique_ptr
<GraphicImport_Impl
> m_pImpl
;
70 css::uno::Reference
<css::uno::XComponentContext
> m_xComponentContext
;
71 css::uno::Reference
<css::lang::XMultiServiceFactory
> m_xTextFactory
;
73 css::uno::Reference
<css::text::XTextContent
> m_xGraphicObject
;
75 css::uno::Reference
<css::drawing::XShape
> m_xShape
;
76 void ProcessShapeOptions(Value
const & val
);
78 css::uno::Reference
<css::text::XTextContent
>
79 createGraphicObject(css::uno::Reference
<css::graphic::XGraphic
> const & rxGraphic
,
80 css::uno::Reference
<css::beans::XPropertySet
> const & xShapeProps
);
82 void putPropertyToFrameGrabBag( const OUString
& sPropertyName
, const css::uno::Any
& aPropertyValue
);
85 explicit GraphicImport( css::uno::Reference
<css::uno::XComponentContext
> const& xComponentContext
,
86 css::uno::Reference
<css::lang::XMultiServiceFactory
> const& xTextFactory
,
87 DomainMapper
& rDomainMapper
,
88 GraphicImportType eGraphicImportType
,
89 std::pair
<OUString
, OUString
>& rPositionOffsets
,
90 std::pair
<OUString
, OUString
>& rAligns
,
91 std::queue
<OUString
>& rPositivePercentages
);
92 virtual ~GraphicImport() override
;
95 virtual void data(const sal_uInt8
* buffer
, size_t len
) override
;
97 css::uno::Reference
<css::text::XTextContent
> GetGraphicObject();
98 const css::uno::Reference
<css::drawing::XShape
>& GetXShapeObject() const { return m_xShape
;}
99 bool IsGraphic() const;
100 sal_Int32
GetLeftMarginOrig() const;
104 virtual void lcl_attribute(Id Name
, Value
& val
) override
;
105 virtual void lcl_sprm(Sprm
& sprm
) override
;
108 virtual void lcl_entry(writerfilter::Reference
<Properties
>::Pointer_t ref
) override
;
111 virtual void lcl_startSectionGroup() override
;
112 virtual void lcl_endSectionGroup() override
;
113 virtual void lcl_startParagraphGroup() override
;
114 virtual void lcl_endParagraphGroup() override
;
115 virtual void lcl_startCharacterGroup() override
;
116 virtual void lcl_endCharacterGroup() override
;
117 virtual void lcl_text(const sal_uInt8
* data
, size_t len
) override
;
118 virtual void lcl_utext(const sal_uInt8
* data
, size_t len
) override
;
119 virtual void lcl_props(writerfilter::Reference
<Properties
>::Pointer_t ref
) override
;
120 virtual void lcl_table(Id name
,
121 writerfilter::Reference
<Table
>::Pointer_t ref
) override
;
122 virtual void lcl_substream(Id name
, writerfilter::Reference
<Stream
>::Pointer_t ref
) override
;
123 virtual void lcl_startShape(css::uno::Reference
<css::drawing::XShape
> const& xShape
) override
;
124 virtual void lcl_endShape() override
;
126 void handleWrapTextValue(sal_uInt32 nVal
);
129 typedef tools::SvRef
<GraphicImport
> GraphicImportPtr
;
135 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */