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 .
21 #include "LoggedResources.hxx"
22 #include <com/sun/star/awt/Size.hpp>
23 #include <com/sun/star/drawing/XShape.hpp>
24 #include <com/sun/star/text/WrapTextMode.hpp>
26 namespace com::sun::star
{
38 class XComponentContext
;
41 namespace writerfilter::dmapper
44 /** Handler for OLE objects
46 class OLEHandler
: public LoggedProperties
49 OUString m_sDrawAspect
;
50 OUString m_sVisAreaWidth
;
51 OUString m_sVisAreaHeight
;
52 /// The stream URL right after the import of the raw data.
55 css::text::WrapTextMode m_nWrapMode
;
57 css::uno::Reference
<css::drawing::XShape
> m_xShape
;
59 css::uno::Reference
<css::io::XInputStream
> m_xInputStream
;
60 DomainMapper
& m_rDomainMapper
;
63 virtual void lcl_attribute(Id Name
, Value
& val
) override
;
64 virtual void lcl_sprm(Sprm
& sprm
) override
;
67 explicit OLEHandler(DomainMapper
& rDomainMapper
);
68 virtual ~OLEHandler() override
;
70 const css::uno::Reference
<css::drawing::XShape
>& getShape() const { return m_xShape
; };
72 bool isOLEObject() const { return m_xInputStream
.is(); }
74 /// In case of a valid CLSID, import the native data to the previously created empty OLE object.
75 void importStream(const css::uno::Reference
<css::uno::XComponentContext
>& xComponentContext
,
76 const css::uno::Reference
<css::text::XTextDocument
>& xTextDocument
,
77 const css::uno::Reference
<css::text::XTextContent
>& xOLE
);
79 /// Get the CLSID of the OLE object, in case we can find one based on m_sProgId.
80 OUString
getCLSID() const;
82 OUString
const & GetDrawAspect() const;
83 OUString
const & GetVisAreaWidth() const;
84 OUString
const & GetVisAreaHeight() const;
86 OUString
copyOLEOStream(css::uno::Reference
<css::text::XTextDocument
> const& xTextDocument
);
88 css::awt::Size
getSize() const;
89 css::uno::Reference
<css::graphic::XGraphic
> getReplacement() const;
94 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */