Version 24.2.2.2, tag libreoffice-24.2.2.2
[LibreOffice.git] / embeddedobj / source / inc / dummyobject.hxx
blob64ee7deeb5e8d273ffb1357b1f432eba1d11d325
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
20 #pragma once
22 #include <sal/config.h>
24 #include <memory>
26 #include <com/sun/star/uno/Sequence.hxx>
27 #include <com/sun/star/uno/Reference.hxx>
28 #include <com/sun/star/embed/XEmbeddedObject.hpp>
29 #include <com/sun/star/embed/XEmbedPersist.hpp>
30 #include <com/sun/star/lang/XServiceInfo.hpp>
31 #include <cppuhelper/implbase.hxx>
32 #include <comphelper/multicontainer2.hxx>
34 namespace com::sun::star {
35 namespace embed {
36 class XStorage;
38 namespace util {
39 class XCloseListener;
41 namespace beans {
42 struct PropertyValue;
43 struct NamedValue;
47 /**
48 * Represents an OLE object that has native data (next to the replacement
49 * image), but we don't understand that data.
51 class ODummyEmbeddedObject : public ::cppu::WeakImplHelper
52 < css::embed::XEmbeddedObject
53 , css::embed::XEmbedPersist
54 , css::lang::XServiceInfo >
56 ::osl::Mutex m_aMutex;
57 std::unique_ptr<comphelper::OMultiTypeInterfaceContainerHelper2>
58 m_pInterfaceContainer;
59 bool m_bDisposed;
61 OUString m_aEntryName;
62 css::uno::Reference< css::embed::XStorage > m_xParentStorage;
63 sal_Int32 m_nObjectState;
65 css::uno::Reference< css::embed::XEmbeddedClient > m_xClientSite;
67 sal_Int64 m_nCachedAspect;
68 css::awt::Size m_aCachedSize;
69 bool m_bHasCachedSize;
71 // following information will be used between SaveAs and SaveCompleted
72 bool m_bWaitSaveCompleted;
73 OUString m_aNewEntryName;
74 css::uno::Reference< css::embed::XStorage > m_xNewParentStorage;
76 protected:
77 void CheckInit_WrongState(); //throw WrongStateException on m_nObjectState == -1
78 void CheckInit_Runtime(); //throw RuntimeException on m_nObjectState == -1
79 void PostEvent_Impl( const OUString& aEventName );
81 public:
83 ODummyEmbeddedObject()
84 : m_bDisposed( false )
85 , m_nObjectState( -1 )
86 , m_nCachedAspect( 0 )
87 , m_bHasCachedSize( false )
88 , m_bWaitSaveCompleted( false )
91 virtual ~ODummyEmbeddedObject() override;
93 // XEmbeddedObject
95 virtual void SAL_CALL changeState( sal_Int32 nNewState ) override;
97 virtual css::uno::Sequence< sal_Int32 > SAL_CALL getReachableStates() override;
99 virtual sal_Int32 SAL_CALL getCurrentState() override;
101 virtual void SAL_CALL doVerb( sal_Int32 nVerbID ) override;
103 virtual css::uno::Sequence< css::embed::VerbDescriptor > SAL_CALL getSupportedVerbs() override;
105 virtual void SAL_CALL setClientSite(
106 const css::uno::Reference< css::embed::XEmbeddedClient >& xClient ) override;
108 virtual css::uno::Reference< css::embed::XEmbeddedClient > SAL_CALL getClientSite() override;
110 virtual void SAL_CALL update() override;
112 virtual void SAL_CALL setUpdateMode( sal_Int32 nMode ) override;
114 virtual sal_Int64 SAL_CALL getStatus( sal_Int64 nAspect ) override;
116 virtual void SAL_CALL setContainerName( const OUString& sName ) override;
119 // XVisualObject
121 virtual void SAL_CALL setVisualAreaSize( sal_Int64 nAspect, const css::awt::Size& aSize ) override;
123 virtual css::awt::Size SAL_CALL getVisualAreaSize( sal_Int64 nAspect ) override;
125 virtual css::embed::VisualRepresentation SAL_CALL getPreferredVisualRepresentation( ::sal_Int64 nAspect ) override;
127 virtual sal_Int32 SAL_CALL getMapUnit( sal_Int64 nAspect ) override;
129 // XEmbedPersist
131 virtual void SAL_CALL setPersistentEntry(
132 const css::uno::Reference< css::embed::XStorage >& xStorage,
133 const OUString& sEntName,
134 sal_Int32 nEntryConnectionMode,
135 const css::uno::Sequence< css::beans::PropertyValue >& lArguments,
136 const css::uno::Sequence< css::beans::PropertyValue >& lObjArgs ) override;
138 virtual void SAL_CALL storeToEntry( const css::uno::Reference< css::embed::XStorage >& xStorage, const OUString& sEntName, const css::uno::Sequence< css::beans::PropertyValue >& lArguments, const css::uno::Sequence< css::beans::PropertyValue >& lObjArgs ) override;
140 virtual void SAL_CALL storeAsEntry(
141 const css::uno::Reference< css::embed::XStorage >& xStorage,
142 const OUString& sEntName,
143 const css::uno::Sequence< css::beans::PropertyValue >& lArguments,
144 const css::uno::Sequence< css::beans::PropertyValue >& lObjArgs ) override;
146 virtual void SAL_CALL saveCompleted( sal_Bool bUseNew ) override;
148 virtual sal_Bool SAL_CALL hasEntry() override;
150 virtual OUString SAL_CALL getEntryName() override;
153 // XCommonEmbedPersist
155 virtual void SAL_CALL storeOwn() override;
157 virtual sal_Bool SAL_CALL isReadonly() override;
159 virtual void SAL_CALL reload(
160 const css::uno::Sequence< css::beans::PropertyValue >& lArguments,
161 const css::uno::Sequence< css::beans::PropertyValue >& lObjArgs ) override;
164 // XClassifiedObject
166 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getClassID() override;
168 virtual OUString SAL_CALL getClassName() override;
170 virtual void SAL_CALL setClassInfo(
171 const css::uno::Sequence< sal_Int8 >& aClassID, const OUString& aClassName ) override;
174 // XComponentSupplier
176 virtual css::uno::Reference< css::util::XCloseable > SAL_CALL getComponent() override;
178 // XStateChangeBroadcaster
179 virtual void SAL_CALL addStateChangeListener( const css::uno::Reference< css::embed::XStateChangeListener >& xListener ) override;
180 virtual void SAL_CALL removeStateChangeListener( const css::uno::Reference< css::embed::XStateChangeListener >& xListener ) override;
182 // XCloseable
184 virtual void SAL_CALL close( sal_Bool DeliverOwnership ) override;
186 virtual void SAL_CALL addCloseListener(
187 const css::uno::Reference< css::util::XCloseListener >& Listener ) override;
189 virtual void SAL_CALL removeCloseListener(
190 const css::uno::Reference< css::util::XCloseListener >& Listener ) override;
192 // XEventBroadcaster
193 virtual void SAL_CALL addEventListener(
194 const css::uno::Reference< css::document::XEventListener >& Listener ) override;
196 virtual void SAL_CALL removeEventListener(
197 const css::uno::Reference< css::document::XEventListener >& Listener ) override;
199 // XServiceInfo
200 OUString SAL_CALL getImplementationName() override;
201 sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
202 css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
205 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */