Line data Source code
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 : #ifndef INCLUDED_WRITERFILTER_SOURCE_DMAPPER_OLEHANDLER_HXX
20 : #define INCLUDED_WRITERFILTER_SOURCE_DMAPPER_OLEHANDLER_HXX
21 :
22 : #include "LoggedResources.hxx"
23 : #include <memory>
24 : #include <com/sun/star/awt/Size.hpp>
25 : #include <com/sun/star/awt/Point.hpp>
26 :
27 : #include <com/sun/star/drawing/XShape.hpp>
28 :
29 : namespace com{ namespace sun{ namespace star{
30 : namespace graphic{
31 : class XGraphic;
32 : }
33 : namespace io{
34 : class XInputStream;
35 : }
36 : namespace text{
37 : class XTextContent;
38 : class XTextDocument;
39 : }
40 : namespace uno {
41 : class XComponentContext;
42 : }
43 : }}}
44 : namespace writerfilter {
45 : namespace dmapper
46 : {
47 : class DomainMapper;
48 : /** Handler for OLE objects
49 : */
50 : class OLEHandler : public LoggedProperties
51 : {
52 : OUString m_sObjectType;
53 : OUString m_sProgId;
54 : OUString m_sShapeId;
55 : OUString m_sDrawAspect;
56 : OUString m_sObjectId;
57 : OUString m_sr_id;
58 : /// The stream URL right after the import of the raw data.
59 : OUString m_aURL;
60 :
61 : sal_Int32 m_nDxaOrig;
62 : sal_Int32 m_nDyaOrig;
63 : sal_Int32 m_nWrapMode;
64 :
65 : css::uno::Reference<css::drawing::XShape> m_xShape;
66 :
67 : css::awt::Size m_aShapeSize;
68 : css::awt::Point m_aShapePosition;
69 :
70 : css::uno::Reference<css::graphic::XGraphic> m_xReplacement;
71 :
72 : css::uno::Reference<css::io::XInputStream> m_xInputStream;
73 : DomainMapper& m_rDomainMapper;
74 :
75 : // Properties
76 : virtual void lcl_attribute(Id Name, Value & val) SAL_OVERRIDE;
77 : virtual void lcl_sprm(Sprm & sprm) SAL_OVERRIDE;
78 :
79 : // Interoperability
80 : void saveInteropProperties(css::uno::Reference<css::text::XTextDocument> const& xTextDocument,
81 : const OUString& sObjectName,
82 : const OUString& sOldObjectName = OUString());
83 :
84 : public:
85 : OLEHandler(DomainMapper& rDomainMapper);
86 : virtual ~OLEHandler();
87 :
88 55 : css::uno::Reference<css::drawing::XShape> getShape() { return m_xShape; };
89 :
90 299 : bool isOLEObject() { return m_xInputStream.is(); }
91 :
92 : /// In case of a valid CLSID, import the native data to the previously created empty OLE object.
93 : void importStream(css::uno::Reference<css::uno::XComponentContext> xComponentContext,
94 : css::uno::Reference<css::text::XTextDocument> xTextDocument,
95 : css::uno::Reference<css::text::XTextContent> xOLE);
96 :
97 : /// Get the CLSID of the OLE object, in case we can find one based on m_sProgId.
98 : OUString getCLSID(css::uno::Reference<css::uno::XComponentContext> xComponentContext) const;
99 :
100 : OUString copyOLEOStream(css::uno::Reference<css::text::XTextDocument> const& xTextDocument);
101 :
102 55 : css::awt::Size getSize() const { return m_aShapeSize; }
103 : css::awt::Point getPosition() const { return m_aShapePosition; }
104 55 : css::uno::Reference<css::graphic::XGraphic> getReplacement() const { return m_xReplacement; }
105 :
106 : };
107 : typedef std::shared_ptr< OLEHandler > OLEHandlerPtr;
108 : }}
109 :
110 : #endif
111 :
112 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|