LibreOffice Module embeddedobj (master) 1
olecomponent.hxx
Go to the documentation of this file.
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
20#pragma once
21
22#include <com/sun/star/uno/Sequence.hxx>
23#include <com/sun/star/uno/Reference.hxx>
24#include <com/sun/star/uno/Any.hxx>
25#include <com/sun/star/lang/XComponent.hpp>
26#include <com/sun/star/util/XCloseable.hpp>
27#include <com/sun/star/datatransfer/XTransferable.hpp>
28#include <com/sun/star/embed/VerbDescriptor.hpp>
29#include <com/sun/star/awt/Size.hpp>
30#include <com/sun/star/lang/XUnoTunnel.hpp>
32#include <com/sun/star/util/XModifiable.hpp>
33#include <com/sun/star/util/XModifyListener.hpp>
34#include <com/sun/star/uno/XComponentContext.hpp>
35#include <rtl/ref.hxx>
36
37namespace comphelper {
38 class OMultiTypeInterfaceContainerHelper2;
39}
40
45
46class OleComponent : public ::cppu::WeakImplHelper< css::util::XCloseable, css::lang::XComponent,
47 css::lang::XUnoTunnel, css::util::XModifiable,
48 css::datatransfer::XTransferable >
49{
50 ::osl::Mutex m_aMutex;
52
56
60
61 sal_Int32 m_nOLEMiscFlags;
62 sal_Int32 m_nAdvConn;
63
64 css::uno::Sequence< css::embed::VerbDescriptor > m_aVerbList;
65 css::uno::Sequence< css::datatransfer::DataFlavor > m_aDataFlavors;
66
67 css::uno::Reference< css::uno::XComponentContext > m_xContext;
68
70
71 // specifies whether the workaround for some rare embedded objects is activated ( f.e. AcrobatReader 7.0.8 object )
72 // such objects report the dirty state wrongly sometimes and do not allow to store them any time
74
76
79 void Dispose();
80
81
82public:
83 OleComponent( const css::uno::Reference< css::uno::XComponentContext >& xContext,
84 OleEmbeddedObject* pOleObj );
85
86 virtual ~OleComponent() override;
87
89
91
92 static css::awt::Size CalculateWithFactor( const css::awt::Size& aSize,
93 const css::awt::Size& aMultiplier,
94 const css::awt::Size& aDivisor );
95
96 css::awt::Size CalculateTheRealSize( const css::awt::Size& aContSize, bool bUpdate );
97
98 // ==== Initialization ==================================================
99 void LoadEmbeddedObject( const OUString& aTempURL );
101 void CreateNewEmbeddedObject( const css::uno::Sequence< sal_Int8 >& aSeqCLSID );
102 static void CreateObjectFromData(
103 const css::uno::Reference< css::datatransfer::XTransferable >& xTransfer );
104 void CreateObjectFromFile( const OUString& aFileName );
105 void CreateLinkFromFile( const OUString& aFileName );
106 void InitEmbeddedCopyOfLink( rtl::Reference<OleComponent> const & pOleLinkComponent );
107
108
109 void RunObject(); // switch OLE object to running state
110 void CloseObject(); // switch OLE object to loaded state
111
112 css::uno::Sequence< css::embed::VerbDescriptor > GetVerbList();
113
114 void ExecuteVerb( sal_Int32 nVerbID );
115 void SetHostName( const OUString& aEmbDocName );
116 void SetExtent( const css::awt::Size& aVisAreaSize, sal_Int64 nAspect );
117
118 css::awt::Size GetExtent( sal_Int64 nAspect );
119 css::awt::Size GetCachedExtent( sal_Int64 nAspect );
120 css::awt::Size GetRecommendedExtent( sal_Int64 nAspect );
121
122 sal_Int64 GetMiscStatus( sal_Int64 nAspect );
123
124 css::uno::Sequence< sal_Int8 > GetCLSID();
125
127 bool IsDirty();
128
130
131 bool SaveObject_Impl();
132 bool OnShowWindow_Impl( bool bShow );
133 void OnViewChange_Impl( sal_uInt32 dwAspect );
134 void OnClose_Impl();
135
136 // XCloseable
137 virtual void SAL_CALL close( sal_Bool DeliverOwnership ) override;
138 virtual void SAL_CALL addCloseListener( const css::uno::Reference< css::util::XCloseListener >& Listener ) override;
139 virtual void SAL_CALL removeCloseListener( const css::uno::Reference< css::util::XCloseListener >& Listener ) override;
140
141 // XTransferable
142 virtual css::uno::Any SAL_CALL getTransferData( const css::datatransfer::DataFlavor& aFlavor ) override;
143 virtual css::uno::Sequence< css::datatransfer::DataFlavor > SAL_CALL getTransferDataFlavors( ) override;
144 virtual sal_Bool SAL_CALL isDataFlavorSupported( const css::datatransfer::DataFlavor& aFlavor ) override;
145
146 // XComponent
147 virtual void SAL_CALL dispose() override;
148 virtual void SAL_CALL addEventListener(const css::uno::Reference < css::lang::XEventListener >& aListener) override;
149 virtual void SAL_CALL removeEventListener(const css::uno::Reference < css::lang::XEventListener >& aListener) override;
150
151 // XUnoTunnel
152 virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
153
154 // XModifiable
155 virtual sal_Bool SAL_CALL isModified() override;
156 virtual void SAL_CALL setModified( sal_Bool bModified ) override;
157 virtual void SAL_CALL addModifyListener( const css::uno::Reference < css::util::XModifyListener >& xListener ) override;
158 virtual void SAL_CALL removeModifyListener( const css::uno::Reference < css::util::XModifyListener >& xListener) override;
159};
160
161/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void RetrieveObjectDataFlavors_Impl()
virtual void SAL_CALL close(sal_Bool DeliverOwnership) override
sal_Int64 GetMiscStatus(sal_Int64 nAspect)
virtual css::uno::Any SAL_CALL getTransferData(const css::datatransfer::DataFlavor &aFlavor) override
void SetExtent(const css::awt::Size &aVisAreaSize, sal_Int64 nAspect)
css::uno::Sequence< sal_Int8 > GetCLSID()
virtual void SAL_CALL removeCloseListener(const css::uno::Reference< css::util::XCloseListener > &Listener) override
css::awt::Size CalculateTheRealSize(const css::awt::Size &aContSize, bool bUpdate)
bool m_bOleInitialized
void CreateNewIStorage_Impl()
void SetHostName(const OUString &aEmbDocName)
OleComponent(const css::uno::Reference< css::uno::XComponentContext > &xContext, OleEmbeddedObject *pOleObj)
css::uno::Sequence< css::datatransfer::DataFlavor > m_aDataFlavors
void disconnectEmbeddedObject()
css::uno::Sequence< css::embed::VerbDescriptor > m_aVerbList
virtual void SAL_CALL dispose() override
static void CreateObjectFromData(const css::uno::Reference< css::datatransfer::XTransferable > &xTransfer)
virtual void SAL_CALL setModified(sal_Bool bModified) override
OleEmbeddedObject * m_pUnoOleObject
sal_Int32 m_nAdvConn
bool SaveObject_Impl()
void StoreOwnTmpIfNecessary()
void CreateObjectFromFile(const OUString &aFileName)
bool m_bWorkaroundActive
OleWrapperClientSite * m_pOleWrapClientSite
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &aIdentifier) override
void LoadEmbeddedObject(const OUString &aTempURL)
virtual sal_Bool SAL_CALL isModified() override
void InitEmbeddedCopyOfLink(rtl::Reference< OleComponent > const &pOleLinkComponent)
css::awt::Size GetExtent(sal_Int64 nAspect)
OleWrapperAdviseSink * m_pImplAdviseSink
virtual void SAL_CALL addModifyListener(const css::uno::Reference< css::util::XModifyListener > &xListener) override
css::awt::Size GetCachedExtent(sal_Int64 nAspect)
sal_Int32 m_nOLEMiscFlags
static css::awt::Size CalculateWithFactor(const css::awt::Size &aSize, const css::awt::Size &aMultiplier, const css::awt::Size &aDivisor)
bool IsWorkaroundActive() const
css::awt::Size GetRecommendedExtent(sal_Int64 nAspect)
void CreateLinkFromFile(const OUString &aFileName)
bool OnShowWindow_Impl(bool bShow)
virtual ~OleComponent() override
void CreateNewEmbeddedObject(const css::uno::Sequence< sal_Int8 > &aSeqCLSID)
virtual sal_Bool SAL_CALL isDataFlavorSupported(const css::datatransfer::DataFlavor &aFlavor) override
virtual css::uno::Sequence< css::datatransfer::DataFlavor > SAL_CALL getTransferDataFlavors() override
void CreateObjectFromClipboard()
bool InitializeObject_Impl()
comphelper::OMultiTypeInterfaceContainerHelper2 * m_pInterfaceContainer
OleComponentNative_Impl * m_pNativeImpl
void ExecuteVerb(sal_Int32 nVerbID)
OleComponent * createEmbeddedCopyOfLink()
virtual void SAL_CALL removeModifyListener(const css::uno::Reference< css::util::XModifyListener > &xListener) override
virtual void SAL_CALL addCloseListener(const css::uno::Reference< css::util::XCloseListener > &Listener) override
css::uno::Sequence< css::embed::VerbDescriptor > GetVerbList()
void CloseObject()
css::uno::Reference< css::uno::XComponentContext > m_xContext
::osl::Mutex m_aMutex
void OnViewChange_Impl(sal_uInt32 dwAspect)
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
Represents an OLE object that has native data and we try to let an external application handle that d...
Definition: oleembobj.hxx:120
unsigned char sal_Bool