1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef _INC_DUMMYOBJECT_HXX_ 25 #define _INC_DUMMYOBJECT_HXX_ 26 27 #include <com/sun/star/uno/Sequence.hxx> 28 #include <com/sun/star/uno/Reference.hxx> 29 #include <com/sun/star/uno/Any.hxx> 30 #include <com/sun/star/embed/XEmbeddedObject.hpp> 31 #include <com/sun/star/embed/XEmbedPersist.hpp> 32 #include <cppuhelper/implbase2.hxx> 33 34 namespace com { namespace sun { namespace star { 35 namespace embed { 36 class XStorage; 37 } 38 namespace frame { 39 class XModel; 40 class XFrame; 41 } 42 namespace lang { 43 class XMultiServiceFactory; 44 } 45 namespace util { 46 class XCloseListener; 47 } 48 namespace beans { 49 struct PropertyValue; 50 struct NamedValue; 51 } 52 }}} 53 54 namespace cppu { 55 class OMultiTypeInterfaceContainerHelper; 56 } 57 58 class ODummyEmbeddedObject : public ::cppu::WeakImplHelper2 59 < ::com::sun::star::embed::XEmbeddedObject 60 , ::com::sun::star::embed::XEmbedPersist > 61 { 62 ::osl::Mutex m_aMutex; 63 ::cppu::OMultiTypeInterfaceContainerHelper* m_pInterfaceContainer; 64 sal_Bool m_bDisposed; 65 66 ::rtl::OUString m_aEntryName; 67 ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > m_xParentStorage; 68 sal_Int32 m_nObjectState; 69 70 ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedClient > m_xClientSite; 71 72 sal_Int64 m_nCachedAspect; 73 ::com::sun::star::awt::Size m_aCachedSize; 74 sal_Bool m_bHasCachedSize; 75 76 // following information will be used between SaveAs and SaveCompleted 77 sal_Bool m_bWaitSaveCompleted; 78 ::rtl::OUString m_aNewEntryName; 79 ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > m_xNewParentStorage; 80 81 protected: 82 void CheckInit(); 83 void PostEvent_Impl( const ::rtl::OUString& aEventName, 84 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xSource ); 85 86 public: 87 ODummyEmbeddedObject()88 ODummyEmbeddedObject() 89 : m_pInterfaceContainer( NULL ) 90 , m_bDisposed( sal_False ) 91 , m_nObjectState( -1 ) 92 , m_nCachedAspect( 0 ) 93 , m_bHasCachedSize( sal_False ) 94 , m_bWaitSaveCompleted( sal_False ) 95 {} 96 97 ~ODummyEmbeddedObject(); 98 99 // XEmbeddedObject 100 101 virtual void SAL_CALL changeState( sal_Int32 nNewState ); 102 103 virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL getReachableStates(); 104 105 virtual sal_Int32 SAL_CALL getCurrentState(); 106 107 virtual void SAL_CALL doVerb( sal_Int32 nVerbID ); 108 109 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::embed::VerbDescriptor > SAL_CALL getSupportedVerbs(); 110 111 virtual void SAL_CALL setClientSite( 112 const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedClient >& xClient ); 113 114 virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedClient > SAL_CALL getClientSite(); 115 116 virtual void SAL_CALL update(); 117 118 virtual void SAL_CALL setUpdateMode( sal_Int32 nMode ); 119 120 virtual sal_Int64 SAL_CALL getStatus( sal_Int64 nAspect ); 121 122 virtual void SAL_CALL setContainerName( const ::rtl::OUString& sName ); 123 124 125 // XVisualObject 126 127 virtual void SAL_CALL setVisualAreaSize( sal_Int64 nAspect, const ::com::sun::star::awt::Size& aSize ); 128 129 virtual ::com::sun::star::awt::Size SAL_CALL getVisualAreaSize( sal_Int64 nAspect ); 130 131 virtual ::com::sun::star::embed::VisualRepresentation SAL_CALL getPreferredVisualRepresentation( ::sal_Int64 nAspect ); 132 133 virtual sal_Int32 SAL_CALL getMapUnit( sal_Int64 nAspect ); 134 135 // XEmbedPersist 136 137 virtual void SAL_CALL setPersistentEntry( 138 const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, 139 const ::rtl::OUString& sEntName, 140 sal_Int32 nEntryConnectionMode, 141 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArguments, 142 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs ); 143 144 virtual void SAL_CALL storeToEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, const ::rtl::OUString& sEntName, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArguments, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs ); 145 146 virtual void SAL_CALL storeAsEntry( 147 const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, 148 const ::rtl::OUString& sEntName, 149 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArguments, 150 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs ); 151 152 virtual void SAL_CALL saveCompleted( sal_Bool bUseNew ); 153 154 virtual sal_Bool SAL_CALL hasEntry(); 155 156 virtual ::rtl::OUString SAL_CALL getEntryName(); 157 158 159 // XCommonEmbedPersist 160 161 virtual void SAL_CALL storeOwn(); 162 163 virtual sal_Bool SAL_CALL isReadonly(); 164 165 virtual void SAL_CALL reload( 166 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArguments, 167 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs ); 168 169 170 // XClassifiedObject 171 172 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getClassID(); 173 174 virtual ::rtl::OUString SAL_CALL getClassName(); 175 176 virtual void SAL_CALL setClassInfo( 177 const ::com::sun::star::uno::Sequence< sal_Int8 >& aClassID, const ::rtl::OUString& aClassName ); 178 179 180 // XComponentSupplier 181 182 virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable > SAL_CALL getComponent(); 183 184 // XStateChangeBroadcaster 185 virtual void SAL_CALL addStateChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStateChangeListener >& xListener ); 186 virtual void SAL_CALL removeStateChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStateChangeListener >& xListener ); 187 188 // XCloseable 189 190 virtual void SAL_CALL close( sal_Bool DeliverOwnership ); 191 192 virtual void SAL_CALL addCloseListener( 193 const ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseListener >& Listener ); 194 195 virtual void SAL_CALL removeCloseListener( 196 const ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseListener >& Listener ); 197 198 // XEventBroadcaster 199 virtual void SAL_CALL addEventListener( 200 const ::com::sun::star::uno::Reference< ::com::sun::star::document::XEventListener >& Listener ); 201 202 virtual void SAL_CALL removeEventListener( 203 const ::com::sun::star::uno::Reference< ::com::sun::star::document::XEventListener >& Listener ); 204 205 }; 206 207 #endif 208