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_OLEHANDLER_HXX
20 #define INCLUDED_WRITERFILTER_SOURCE_DMAPPER_OLEHANDLER_HXX
22 #include "LoggedResources.hxx"
23 #include <com/sun/star/awt/Size.hpp>
24 #include <com/sun/star/awt/Point.hpp>
25 #include <com/sun/star/drawing/XShape.hpp>
26 #include <com/sun/star/text/WrapTextMode.hpp>
28 namespace com
{ namespace sun
{ namespace star
{
40 class XComponentContext
;
43 namespace writerfilter
{
47 /** Handler for OLE objects
49 class OLEHandler
: public LoggedProperties
51 OUString m_sObjectType
;
54 OUString m_sDrawAspect
;
55 OUString m_sVisAreaWidth
;
56 OUString m_sVisAreaHeight
;
59 /// The stream URL right after the import of the raw data.
62 css::text::WrapTextMode m_nWrapMode
;
64 css::uno::Reference
<css::drawing::XShape
> m_xShape
;
66 css::awt::Size m_aShapeSize
;
67 css::awt::Point m_aShapePosition
;
69 css::uno::Reference
<css::graphic::XGraphic
> m_xReplacement
;
71 css::uno::Reference
<css::io::XInputStream
> m_xInputStream
;
72 DomainMapper
& m_rDomainMapper
;
75 virtual void lcl_attribute(Id Name
, Value
& val
) override
;
76 virtual void lcl_sprm(Sprm
& sprm
) override
;
79 explicit OLEHandler(DomainMapper
& rDomainMapper
);
80 virtual ~OLEHandler() override
;
82 const css::uno::Reference
<css::drawing::XShape
>& getShape() { return m_xShape
; };
84 bool isOLEObject() { return m_xInputStream
.is(); }
86 /// In case of a valid CLSID, import the native data to the previously created empty OLE object.
87 void importStream(const css::uno::Reference
<css::uno::XComponentContext
>& xComponentContext
,
88 const css::uno::Reference
<css::text::XTextDocument
>& xTextDocument
,
89 const css::uno::Reference
<css::text::XTextContent
>& xOLE
);
91 /// Get the CLSID of the OLE object, in case we can find one based on m_sProgId.
92 OUString
getCLSID(const css::uno::Reference
<css::uno::XComponentContext
>& xComponentContext
) const;
94 OUString
const & GetDrawAspect() const;
95 OUString
const & GetVisAreaWidth() const;
96 OUString
const & GetVisAreaHeight() const;
98 OUString
copyOLEOStream(css::uno::Reference
<css::text::XTextDocument
> const& xTextDocument
);
100 const css::awt::Size
& getSize() const { return m_aShapeSize
; }
101 const css::uno::Reference
<css::graphic::XGraphic
>& getReplacement() const { return m_xReplacement
; }
108 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */