LibreOffice Module embeddedobj (master) 1
dummyobject.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 <sal/config.h>
23
24#include <memory>
25
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>
33
34namespace com::sun::star {
35 namespace embed {
36 class XStorage;
37 }
38 namespace util {
39 class XCloseListener;
40 }
41 namespace beans {
42 struct PropertyValue;
43 struct NamedValue;
44 }
45}
46
51class ODummyEmbeddedObject : public ::cppu::WeakImplHelper
52 < css::embed::XEmbeddedObject
53 , css::embed::XEmbedPersist
54 , css::lang::XServiceInfo >
55{
56 ::osl::Mutex m_aMutex;
57 std::unique_ptr<comphelper::OMultiTypeInterfaceContainerHelper2>
60
61 OUString m_aEntryName;
62 css::uno::Reference< css::embed::XStorage > m_xParentStorage;
63 sal_Int32 m_nObjectState;
64
65 css::uno::Reference< css::embed::XEmbeddedClient > m_xClientSite;
66
67 sal_Int64 m_nCachedAspect;
68 css::awt::Size m_aCachedSize;
70
71 // following information will be used between SaveAs and SaveCompleted
74 css::uno::Reference< css::embed::XStorage > m_xNewParentStorage;
75
76protected:
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 );
80
81public:
82
84 : m_bDisposed( false )
85 , m_nObjectState( -1 )
86 , m_nCachedAspect( 0 )
87 , m_bHasCachedSize( false )
88 , m_bWaitSaveCompleted( false )
89 {}
90
91 virtual ~ODummyEmbeddedObject() override;
92
93// XEmbeddedObject
94
95 virtual void SAL_CALL changeState( sal_Int32 nNewState ) override;
96
97 virtual css::uno::Sequence< sal_Int32 > SAL_CALL getReachableStates() override;
98
99 virtual sal_Int32 SAL_CALL getCurrentState() override;
100
101 virtual void SAL_CALL doVerb( sal_Int32 nVerbID ) override;
102
103 virtual css::uno::Sequence< css::embed::VerbDescriptor > SAL_CALL getSupportedVerbs() override;
104
105 virtual void SAL_CALL setClientSite(
106 const css::uno::Reference< css::embed::XEmbeddedClient >& xClient ) override;
107
108 virtual css::uno::Reference< css::embed::XEmbeddedClient > SAL_CALL getClientSite() override;
109
110 virtual void SAL_CALL update() override;
111
112 virtual void SAL_CALL setUpdateMode( sal_Int32 nMode ) override;
113
114 virtual sal_Int64 SAL_CALL getStatus( sal_Int64 nAspect ) override;
115
116 virtual void SAL_CALL setContainerName( const OUString& sName ) override;
117
118
119// XVisualObject
120
121 virtual void SAL_CALL setVisualAreaSize( sal_Int64 nAspect, const css::awt::Size& aSize ) override;
122
123 virtual css::awt::Size SAL_CALL getVisualAreaSize( sal_Int64 nAspect ) override;
124
125 virtual css::embed::VisualRepresentation SAL_CALL getPreferredVisualRepresentation( ::sal_Int64 nAspect ) override;
126
127 virtual sal_Int32 SAL_CALL getMapUnit( sal_Int64 nAspect ) override;
128
129// XEmbedPersist
130
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;
137
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;
139
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;
145
146 virtual void SAL_CALL saveCompleted( sal_Bool bUseNew ) override;
147
148 virtual sal_Bool SAL_CALL hasEntry() override;
149
150 virtual OUString SAL_CALL getEntryName() override;
151
152
153// XCommonEmbedPersist
154
155 virtual void SAL_CALL storeOwn() override;
156
157 virtual sal_Bool SAL_CALL isReadonly() override;
158
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;
162
163
164// XClassifiedObject
165
166 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getClassID() override;
167
168 virtual OUString SAL_CALL getClassName() override;
169
170 virtual void SAL_CALL setClassInfo(
171 const css::uno::Sequence< sal_Int8 >& aClassID, const OUString& aClassName ) override;
172
173
174// XComponentSupplier
175
176 virtual css::uno::Reference< css::util::XCloseable > SAL_CALL getComponent() override;
177
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;
181
182// XCloseable
183
184 virtual void SAL_CALL close( sal_Bool DeliverOwnership ) override;
185
186 virtual void SAL_CALL addCloseListener(
187 const css::uno::Reference< css::util::XCloseListener >& Listener ) override;
188
189 virtual void SAL_CALL removeCloseListener(
190 const css::uno::Reference< css::util::XCloseListener >& Listener ) override;
191
192// XEventBroadcaster
193 virtual void SAL_CALL addEventListener(
194 const css::uno::Reference< css::document::XEventListener >& Listener ) override;
195
196 virtual void SAL_CALL removeEventListener(
197 const css::uno::Reference< css::document::XEventListener >& Listener ) override;
198
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;
203};
204
205/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Represents an OLE object that has native data (next to the replacement image), but we don't understan...
Definition: dummyobject.hxx:55
std::unique_ptr< comphelper::OMultiTypeInterfaceContainerHelper2 > m_pInterfaceContainer
Definition: dummyobject.hxx:58
virtual css::uno::Reference< css::util::XCloseable > SAL_CALL getComponent() override
void PostEvent_Impl(const OUString &aEventName)
Definition: dummyobject.cxx:61
css::uno::Reference< css::embed::XEmbeddedClient > m_xClientSite
Definition: dummyobject.hxx:65
virtual void SAL_CALL addStateChangeListener(const css::uno::Reference< css::embed::XStateChangeListener > &xListener) override
virtual void SAL_CALL close(sal_Bool DeliverOwnership) override
virtual void SAL_CALL changeState(sal_Int32 nNewState) override
virtual css::uno::Sequence< sal_Int32 > SAL_CALL getReachableStates() override
css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual void SAL_CALL storeAsEntry(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
virtual void SAL_CALL setClassInfo(const css::uno::Sequence< sal_Int8 > &aClassID, const OUString &aClassName) override
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getClassID() override
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::document::XEventListener > &Listener) override
virtual sal_Int64 SAL_CALL getStatus(sal_Int64 nAspect) override
sal_Int32 m_nObjectState
Definition: dummyobject.hxx:63
css::uno::Reference< css::embed::XStorage > m_xParentStorage
Definition: dummyobject.hxx:62
virtual void SAL_CALL addCloseListener(const css::uno::Reference< css::util::XCloseListener > &Listener) override
virtual void SAL_CALL doVerb(sal_Int32 nVerbID) override
sal_Int64 m_nCachedAspect
Definition: dummyobject.hxx:67
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
::osl::Mutex m_aMutex
Definition: dummyobject.hxx:56
virtual void SAL_CALL setVisualAreaSize(sal_Int64 nAspect, const css::awt::Size &aSize) override
virtual void SAL_CALL saveCompleted(sal_Bool bUseNew) override
virtual void SAL_CALL setContainerName(const OUString &sName) override
virtual sal_Int32 SAL_CALL getMapUnit(sal_Int64 nAspect) override
virtual void SAL_CALL storeOwn() override
css::uno::Reference< css::embed::XStorage > m_xNewParentStorage
Definition: dummyobject.hxx:74
virtual css::uno::Reference< css::embed::XEmbeddedClient > SAL_CALL getClientSite() override
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::document::XEventListener > &Listener) override
virtual void SAL_CALL setClientSite(const css::uno::Reference< css::embed::XEmbeddedClient > &xClient) override
virtual void SAL_CALL removeStateChangeListener(const css::uno::Reference< css::embed::XStateChangeListener > &xListener) override
virtual sal_Bool SAL_CALL isReadonly() override
virtual css::embed::VisualRepresentation SAL_CALL getPreferredVisualRepresentation(::sal_Int64 nAspect) override
virtual void SAL_CALL update() override
virtual void SAL_CALL setUpdateMode(sal_Int32 nMode) override
virtual OUString SAL_CALL getEntryName() override
virtual css::awt::Size SAL_CALL getVisualAreaSize(sal_Int64 nAspect) override
virtual sal_Int32 SAL_CALL getCurrentState() override
virtual void SAL_CALL removeCloseListener(const css::uno::Reference< css::util::XCloseListener > &Listener) override
OUString SAL_CALL getImplementationName() override
virtual css::uno::Sequence< css::embed::VerbDescriptor > SAL_CALL getSupportedVerbs() override
virtual OUString SAL_CALL getClassName() override
virtual void SAL_CALL setPersistentEntry(const css::uno::Reference< css::embed::XStorage > &xStorage, const OUString &sEntName, sal_Int32 nEntryConnectionMode, const css::uno::Sequence< css::beans::PropertyValue > &lArguments, const css::uno::Sequence< css::beans::PropertyValue > &lObjArgs) override
virtual sal_Bool SAL_CALL hasEntry() override
css::awt::Size m_aCachedSize
Definition: dummyobject.hxx:68
virtual void SAL_CALL reload(const css::uno::Sequence< css::beans::PropertyValue > &lArguments, const css::uno::Sequence< css::beans::PropertyValue > &lObjArgs) override
sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual ~ODummyEmbeddedObject() override
Definition: dummyobject.cxx:96
unsigned char sal_Bool