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
23 #include <boost/scoped_ptr.hpp>
25 #include <resourcemodel/LoggedResources.hxx>
27 namespace com
{ namespace sun
{ namespace star
{
30 class XComponentContext
;
34 class XMultiServiceFactory
;
47 typedef css::uno::Sequence
< css::beans::PropertyValue
> PropertyValues
;
51 namespace writerfilter
55 class GraphicImport_Impl
;
58 enum GraphicImportType
62 IMPORT_AS_DETECTED_INLINE
,
63 IMPORT_AS_DETECTED_ANCHOR
66 class GraphicImport
: public LoggedProperties
, public LoggedTable
67 ,public BinaryObj
, public LoggedStream
69 boost::scoped_ptr
<GraphicImport_Impl
> m_pImpl
;
71 css::uno::Reference
<css::uno::XComponentContext
> m_xComponentContext
;
72 css::uno::Reference
<css::lang::XMultiServiceFactory
> m_xTextFactory
;
74 css::uno::Reference
<css::text::XTextContent
> m_xGraphicObject
;
76 css::uno::Reference
<css::drawing::XShape
> m_xShape
;
77 void ProcessShapeOptions(Value
& val
);
79 css::uno::Reference
<css::text::XTextContent
> createGraphicObject(const css::beans::PropertyValues
& aMediaProperties
, const css::uno::Reference
<css::beans::XPropertySet
>& xShapeProps
);
81 void putPropertyToFrameGrabBag( const OUString
& sPropertyName
, const css::uno::Any
& aPropertyValue
);
84 explicit GraphicImport( css::uno::Reference
<css::uno::XComponentContext
> xComponentContext
,
85 css::uno::Reference
<css::lang::XMultiServiceFactory
> xTextFactory
,
86 DomainMapper
& rDomainMapper
,
87 GraphicImportType eGraphicImportType
,
88 std::queue
<OUString
>& rPositivePercentages
);
89 virtual ~GraphicImport();
92 virtual void data(const sal_uInt8
* buffer
, size_t len
, writerfilter::Reference
<Properties
>::Pointer_t ref
) SAL_OVERRIDE
;
94 css::uno::Reference
<css::text::XTextContent
> GetGraphicObject();
95 css::uno::Reference
<css::drawing::XShape
> GetXShapeObject();
96 bool IsGraphic() const;
100 virtual void lcl_attribute(Id Name
, Value
& val
) SAL_OVERRIDE
;
101 virtual void lcl_sprm(Sprm
& sprm
) SAL_OVERRIDE
;
104 virtual void lcl_entry(int pos
, writerfilter::Reference
<Properties
>::Pointer_t ref
) SAL_OVERRIDE
;
107 virtual void lcl_startSectionGroup() SAL_OVERRIDE
;
108 virtual void lcl_endSectionGroup() SAL_OVERRIDE
;
109 virtual void lcl_startParagraphGroup() SAL_OVERRIDE
;
110 virtual void lcl_endParagraphGroup() SAL_OVERRIDE
;
111 virtual void lcl_startCharacterGroup() SAL_OVERRIDE
;
112 virtual void lcl_endCharacterGroup() SAL_OVERRIDE
;
113 virtual void lcl_text(const sal_uInt8
* data
, size_t len
) SAL_OVERRIDE
;
114 virtual void lcl_utext(const sal_uInt8
* data
, size_t len
) SAL_OVERRIDE
;
115 virtual void lcl_props(writerfilter::Reference
<Properties
>::Pointer_t ref
) SAL_OVERRIDE
;
116 virtual void lcl_table(Id name
,
117 writerfilter::Reference
<Table
>::Pointer_t ref
) SAL_OVERRIDE
;
118 virtual void lcl_substream(Id name
, writerfilter::Reference
<Stream
>::Pointer_t ref
) SAL_OVERRIDE
;
119 virtual void lcl_info(const std::string
& info
) SAL_OVERRIDE
;
120 virtual void lcl_startShape(css::uno::Reference
<css::drawing::XShape
> xShape
) SAL_OVERRIDE
;
121 virtual void lcl_endShape() SAL_OVERRIDE
;
123 void handleWrapTextValue(sal_uInt32 nVal
);
126 typedef boost::shared_ptr
<GraphicImport
> GraphicImportPtr
;
132 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */