Version 6.4.0.3, tag libreoffice-6.4.0.3
[LibreOffice.git] / embeddedobj / source / inc / dummyobject.hxx
blob67795190a27aa6b62fb1123fdfc2f4c4bcb6827d
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 #ifndef INCLUDED_EMBEDDEDOBJ_SOURCE_INC_DUMMYOBJECT_HXX
21 #define INCLUDED_EMBEDDEDOBJ_SOURCE_INC_DUMMYOBJECT_HXX
23 #include <sal/config.h>
25 #include <memory>
27 #include <com/sun/star/uno/Sequence.hxx>
28 #include <com/sun/star/uno/Reference.hxx>
29 #include <com/sun/star/embed/XEmbeddedObject.hpp>
30 #include <com/sun/star/embed/XEmbedPersist.hpp>
31 #include <cppuhelper/implbase.hxx>
32 #include <cppuhelper/interfacecontainer.hxx>
34 namespace com { namespace sun { namespace star {
35 namespace embed {
36 class XStorage;
38 namespace util {
39 class XCloseListener;
41 namespace beans {
42 struct PropertyValue;
43 struct NamedValue;
45 }}}
47 namespace cppu {
48 class OMultiTypeInterfaceContainerHelper;
51 /**
52 * Represents an OLE object that has native data (next to the replacement
53 * image), but we don't understand that data.
55 class ODummyEmbeddedObject : public ::cppu::WeakImplHelper
56 < css::embed::XEmbeddedObject
57 , css::embed::XEmbedPersist >
59 ::osl::Mutex m_aMutex;
60 std::unique_ptr<cppu::OMultiTypeInterfaceContainerHelper>
61 m_pInterfaceContainer;
62 bool m_bDisposed;
64 OUString m_aEntryName;
65 css::uno::Reference< css::embed::XStorage > m_xParentStorage;
66 sal_Int32 m_nObjectState;
68 css::uno::Reference< css::embed::XEmbeddedClient > m_xClientSite;
70 sal_Int64 m_nCachedAspect;
71 css::awt::Size m_aCachedSize;
72 bool m_bHasCachedSize;
74 // following information will be used between SaveAs and SaveCompleted
75 bool m_bWaitSaveCompleted;
76 OUString m_aNewEntryName;
77 css::uno::Reference< css::embed::XStorage > m_xNewParentStorage;
79 protected:
80 void CheckInit_WrongState(); //throw WrongStateException on m_nObjectState == -1
81 void CheckInit_Runtime(); //throw RuntimeException on m_nObjectState == -1
82 void PostEvent_Impl( const OUString& aEventName );
84 public:
86 ODummyEmbeddedObject()
87 : m_bDisposed( false )
88 , m_nObjectState( -1 )
89 , m_nCachedAspect( 0 )
90 , m_bHasCachedSize( false )
91 , m_bWaitSaveCompleted( false )
94 virtual ~ODummyEmbeddedObject() override;
96 // XEmbeddedObject
98 virtual void SAL_CALL changeState( sal_Int32 nNewState ) override;
100 virtual css::uno::Sequence< sal_Int32 > SAL_CALL getReachableStates() override;
102 virtual sal_Int32 SAL_CALL getCurrentState() override;
104 virtual void SAL_CALL doVerb( sal_Int32 nVerbID ) override;
106 virtual css::uno::Sequence< css::embed::VerbDescriptor > SAL_CALL getSupportedVerbs() override;
108 virtual void SAL_CALL setClientSite(
109 const css::uno::Reference< css::embed::XEmbeddedClient >& xClient ) override;
111 virtual css::uno::Reference< css::embed::XEmbeddedClient > SAL_CALL getClientSite() override;
113 virtual void SAL_CALL update() override;
115 virtual void SAL_CALL setUpdateMode( sal_Int32 nMode ) override;
117 virtual sal_Int64 SAL_CALL getStatus( sal_Int64 nAspect ) override;
119 virtual void SAL_CALL setContainerName( const OUString& sName ) override;
122 // XVisualObject
124 virtual void SAL_CALL setVisualAreaSize( sal_Int64 nAspect, const css::awt::Size& aSize ) override;
126 virtual css::awt::Size SAL_CALL getVisualAreaSize( sal_Int64 nAspect ) override;
128 virtual css::embed::VisualRepresentation SAL_CALL getPreferredVisualRepresentation( ::sal_Int64 nAspect ) override;
130 virtual sal_Int32 SAL_CALL getMapUnit( sal_Int64 nAspect ) override;
132 // XEmbedPersist
134 virtual void SAL_CALL setPersistentEntry(
135 const css::uno::Reference< css::embed::XStorage >& xStorage,
136 const OUString& sEntName,
137 sal_Int32 nEntryConnectionMode,
138 const css::uno::Sequence< css::beans::PropertyValue >& lArguments,
139 const css::uno::Sequence< css::beans::PropertyValue >& lObjArgs ) override;
141 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;
143 virtual void SAL_CALL storeAsEntry(
144 const css::uno::Reference< css::embed::XStorage >& xStorage,
145 const OUString& sEntName,
146 const css::uno::Sequence< css::beans::PropertyValue >& lArguments,
147 const css::uno::Sequence< css::beans::PropertyValue >& lObjArgs ) override;
149 virtual void SAL_CALL saveCompleted( sal_Bool bUseNew ) override;
151 virtual sal_Bool SAL_CALL hasEntry() override;
153 virtual OUString SAL_CALL getEntryName() override;
156 // XCommonEmbedPersist
158 virtual void SAL_CALL storeOwn() override;
160 virtual sal_Bool SAL_CALL isReadonly() override;
162 virtual void SAL_CALL reload(
163 const css::uno::Sequence< css::beans::PropertyValue >& lArguments,
164 const css::uno::Sequence< css::beans::PropertyValue >& lObjArgs ) override;
167 // XClassifiedObject
169 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getClassID() override;
171 virtual OUString SAL_CALL getClassName() override;
173 virtual void SAL_CALL setClassInfo(
174 const css::uno::Sequence< sal_Int8 >& aClassID, const OUString& aClassName ) override;
177 // XComponentSupplier
179 virtual css::uno::Reference< css::util::XCloseable > SAL_CALL getComponent() override;
181 // XStateChangeBroadcaster
182 virtual void SAL_CALL addStateChangeListener( const css::uno::Reference< css::embed::XStateChangeListener >& xListener ) override;
183 virtual void SAL_CALL removeStateChangeListener( const css::uno::Reference< css::embed::XStateChangeListener >& xListener ) override;
185 // XCloseable
187 virtual void SAL_CALL close( sal_Bool DeliverOwnership ) override;
189 virtual void SAL_CALL addCloseListener(
190 const css::uno::Reference< css::util::XCloseListener >& Listener ) override;
192 virtual void SAL_CALL removeCloseListener(
193 const css::uno::Reference< css::util::XCloseListener >& Listener ) override;
195 // XEventBroadcaster
196 virtual void SAL_CALL addEventListener(
197 const css::uno::Reference< css::document::XEventListener >& Listener ) override;
199 virtual void SAL_CALL removeEventListener(
200 const css::uno::Reference< css::document::XEventListener >& Listener ) override;
204 #endif
206 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */