summaryrefslogtreecommitdiffstats
path: root/embeddedobj/source/inc
diff options
context:
space:
mode:
Diffstat (limited to 'embeddedobj/source/inc')
-rw-r--r--embeddedobj/source/inc/closepreventer.hxx36
-rw-r--r--embeddedobj/source/inc/commonembobj.hxx401
-rw-r--r--embeddedobj/source/inc/docholder.hxx203
-rw-r--r--embeddedobj/source/inc/dummyobject.hxx206
-rw-r--r--embeddedobj/source/inc/intercept.hxx120
-rw-r--r--embeddedobj/source/inc/oleembobj.hxx452
-rw-r--r--embeddedobj/source/inc/specialobject.hxx55
-rw-r--r--embeddedobj/source/inc/targetstatecontrol.hxx45
-rw-r--r--embeddedobj/source/inc/xcreator.hxx75
9 files changed, 1593 insertions, 0 deletions
diff --git a/embeddedobj/source/inc/closepreventer.hxx b/embeddedobj/source/inc/closepreventer.hxx
new file mode 100644
index 000000000..009c8c7a1
--- /dev/null
+++ b/embeddedobj/source/inc/closepreventer.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EMBEDDEDOBJ_SOURCE_INC_CLOSEPREVENTER_HXX
+#define INCLUDED_EMBEDDEDOBJ_SOURCE_INC_CLOSEPREVENTER_HXX
+
+#include <com/sun/star/util/XCloseListener.hpp>
+#include <cppuhelper/implbase.hxx>
+
+class OClosePreventer : public ::cppu::WeakImplHelper < css::util::XCloseListener >
+{
+ virtual void SAL_CALL queryClosing( const css::lang::EventObject& Source, sal_Bool GetsOwnership ) override;
+ virtual void SAL_CALL notifyClosing( const css::lang::EventObject& Source ) override;
+
+ virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/inc/commonembobj.hxx b/embeddedobj/source/inc/commonembobj.hxx
new file mode 100644
index 000000000..61e939a0c
--- /dev/null
+++ b/embeddedobj/source/inc/commonembobj.hxx
@@ -0,0 +1,401 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EMBEDDEDOBJ_SOURCE_INC_COMMONEMBOBJ_HXX
+#define INCLUDED_EMBEDDEDOBJ_SOURCE_INC_COMMONEMBOBJ_HXX
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/document/XStorageBasedDocument.hpp>
+#include <com/sun/star/embed/XEmbeddedObject.hpp>
+#include <com/sun/star/embed/XEmbedPersist2.hpp>
+#include <com/sun/star/embed/XLinkageSupport.hpp>
+#include <com/sun/star/embed/XInplaceObject.hpp>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/awt/Rectangle.hpp>
+#include <com/sun/star/util/XCloseable.hpp>
+#include <com/sun/star/chart2/XDefaultSizeTransmitter.hpp>
+#include <cppuhelper/weak.hxx>
+#include <rtl/ref.hxx>
+#include <map>
+
+namespace com::sun::star {
+ namespace embed {
+ class XStorage;
+ }
+ namespace lang {
+ class XMultiServiceFactory;
+ }
+ namespace util {
+ class XCloseListener;
+ }
+ namespace beans {
+ struct PropertyValue;
+ struct NamedValue;
+ }
+}
+
+namespace cppu {
+ class OMultiTypeInterfaceContainerHelper;
+}
+
+namespace comphelper {
+ class NamedValueCollection;
+}
+
+#define NUM_SUPPORTED_STATES 5
+// #define NUM_SUPPORTED_VERBS 5
+
+#include "docholder.hxx"
+
+class Interceptor;
+
+/**
+ * Represents an OLE object that has native data and we loaded that data into a
+ * document model successfully.
+ */
+class OCommonEmbeddedObject : public css::embed::XEmbeddedObject
+ , public css::embed::XEmbedPersist2
+ , public css::embed::XLinkageSupport
+ , public css::embed::XInplaceObject
+ , public css::container::XChild
+ , public css::chart2::XDefaultSizeTransmitter
+ , public ::cppu::OWeakObject
+{
+protected:
+ ::osl::Mutex m_aMutex;
+
+ rtl::Reference<DocumentHolder> m_xDocHolder;
+
+ ::cppu::OMultiTypeInterfaceContainerHelper* m_pInterfaceContainer;
+
+ bool m_bReadOnly;
+
+ bool m_bDisposed;
+ bool m_bClosed;
+
+ sal_Int32 m_nObjectState;
+ sal_Int32 m_nTargetState; // should be -1 except during state changing
+ sal_Int32 m_nUpdateMode;
+
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+
+ css::uno::Sequence< css::beans::PropertyValue > m_aDocMediaDescriptor;
+
+ css::uno::Sequence< sal_Int8 > m_aClassID;
+ OUString m_aClassName;
+
+ OUString m_aDocServiceName;
+ OUString m_aPresetFilterName;
+
+ sal_Int64 m_nMiscStatus;
+
+ css::uno::Sequence< css::embed::VerbDescriptor > m_aObjectVerbs;
+
+ css::uno::Sequence< sal_Int32 > m_aAcceptedStates;
+ css::uno::Sequence< sal_Int32 > m_pIntermediateStatesSeqs[NUM_SUPPORTED_STATES][NUM_SUPPORTED_STATES];
+ std::map< sal_Int32, sal_Int32 > m_aVerbTable;
+
+ css::uno::Reference< css::embed::XEmbeddedClient > m_xClientSite;
+
+ OUString m_aContainerName;
+ OUString m_aDefaultParentBaseURL;
+ OUString m_aModuleName;
+ bool m_bEmbeddedScriptSupport;
+ bool m_bDocumentRecoverySupport;
+
+ // following information will be used between SaveAs and SaveCompleted
+ bool m_bWaitSaveCompleted;
+ OUString m_aNewEntryName;
+ css::uno::Reference< css::embed::XStorage > m_xNewParentStorage;
+ css::uno::Reference< css::embed::XStorage > m_xNewObjectStorage;
+ css::uno::Sequence< css::beans::PropertyValue > m_aNewDocMediaDescriptor;
+
+ css::uno::Reference< css::awt::XWindow > m_xClientWindow; // ???
+ css::awt::Rectangle m_aOwnRectangle;
+ css::awt::Rectangle m_aClipRectangle;
+
+ bool m_bIsLink;
+
+ // embedded object related stuff
+ OUString m_aEntryName;
+ css::uno::Reference< css::embed::XStorage > m_xParentStorage;
+ css::uno::Reference< css::embed::XStorage > m_xObjectStorage;
+ css::uno::Reference< css::embed::XStorage > m_xRecoveryStorage;
+
+ // link related stuff
+ OUString m_aLinkURL;
+ OUString m_aLinkFilterName;
+ bool m_bLinkHasPassword;
+ OUString m_aLinkPassword;
+
+ css::uno::Reference< css::uno::XInterface > m_xParent;
+
+ bool m_bHasClonedSize; // the object has cached size
+ css::awt::Size m_aClonedSize;
+ sal_Int32 m_nClonedMapUnit;
+ css::awt::Size m_aDefaultSizeForChart_In_100TH_MM;//#i103460# charts do not necessarily have an own size within ODF files, in this case they need to use the size settings from the surrounding frame, which is made available with this member
+
+private:
+ void CommonInit_Impl( const css::uno::Sequence< css::beans::NamedValue >& aObjectProps );
+
+ void LinkInit_Impl( const css::uno::Sequence< css::beans::NamedValue >& aObjectProps,
+ const css::uno::Sequence< css::beans::PropertyValue >& aMediaDescr,
+ const css::uno::Sequence< css::beans::PropertyValue >& aObjectDescr );
+
+
+ void SwitchOwnPersistence(
+ const css::uno::Reference< css::embed::XStorage >& xNewParentStorage,
+ const css::uno::Reference< css::embed::XStorage >& xNewObjectStorage,
+ const OUString& aNewName );
+
+ void SwitchOwnPersistence(
+ const css::uno::Reference< css::embed::XStorage >& xNewParentStorage,
+ const OUString& aNewName );
+
+ const OUString& GetDocumentServiceName() const { return m_aDocServiceName; }
+ const OUString& GetPresetFilterName() const { return m_aPresetFilterName; }
+
+ css::uno::Reference< css::io::XInputStream >
+ StoreDocumentToTempStream_Impl( sal_Int32 nStorageFormat,
+ const OUString& aBaseURL,
+ const OUString& aHierarchName );
+
+ sal_Int32 ConvertVerbToState_Impl( sal_Int32 nVerb );
+
+ void Deactivate();
+
+ void StateChangeNotification_Impl( bool bBeforeChange, sal_Int32 nOldState, sal_Int32 nNewState,::osl::ResettableMutexGuard& _rGuard );
+
+ void SwitchStateTo_Impl( sal_Int32 nNextState );
+
+ css::uno::Sequence< sal_Int32 > const & GetIntermediateStatesSequence_Impl( sal_Int32 nNewState );
+
+ OUString GetFilterName( sal_Int32 nVersion ) const;
+ css::uno::Reference< css::util::XCloseable > LoadDocumentFromStorage_Impl();
+
+ css::uno::Reference< css::util::XCloseable > LoadLink_Impl();
+
+ css::uno::Reference< css::util::XCloseable > InitNewDocument_Impl();
+
+ void StoreDocToStorage_Impl(
+ const css::uno::Reference<css::embed::XStorage>& xStorage,
+ const css::uno::Sequence<css::beans::PropertyValue>& rMediaArgs,
+ const css::uno::Sequence<css::beans::PropertyValue>& rObjArgs,
+ sal_Int32 nStorageVersion,
+ const OUString& aHierarchName,
+ bool bAttachToStorage );
+
+ void SwitchDocToStorage_Impl(
+ const css::uno::Reference< css::document::XStorageBasedDocument >& xDoc,
+ const css::uno::Reference< css::embed::XStorage >& xStorage );
+
+ void FillDefaultLoadArgs_Impl(
+ const css::uno::Reference< css::embed::XStorage >& i_rxStorage,
+ ::comphelper::NamedValueCollection& o_rLoadArgs
+ ) const;
+
+ void EmbedAndReparentDoc_Impl(
+ const css::uno::Reference< css::util::XCloseable >& i_rxDocument
+ ) const;
+
+ css::uno::Reference< css::util::XCloseable > CreateDocFromMediaDescr_Impl(
+ const css::uno::Sequence< css::beans::PropertyValue >& aMedDescr );
+
+ css::uno::Reference< css::util::XCloseable > CreateTempDocFromLink_Impl();
+
+ OUString GetBaseURL_Impl() const;
+ static OUString GetBaseURLFrom_Impl(
+ const css::uno::Sequence< css::beans::PropertyValue >& lArguments,
+ const css::uno::Sequence< css::beans::PropertyValue >& lObjArgs );
+
+public:
+ OCommonEmbeddedObject(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const css::uno::Sequence< css::beans::NamedValue >& aObjectProps );
+
+ // no persistence for linked objects, so the descriptors are provided in constructor
+ OCommonEmbeddedObject(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const css::uno::Sequence< css::beans::NamedValue >& aObjectProps,
+ const css::uno::Sequence< css::beans::PropertyValue >& aMediaDescr,
+ const css::uno::Sequence< css::beans::PropertyValue >& aObjectDescr );
+
+ virtual ~OCommonEmbeddedObject() override;
+
+ void SaveObject_Impl();
+
+ void requestPositioning( const css::awt::Rectangle& aRect );
+
+ // not a real listener and should not be
+ void PostEvent_Impl( const OUString& aEventName );
+
+ OUString const & getContainerName() const { return m_aContainerName; }
+// XInterface
+
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& rType ) override ;
+
+ virtual void SAL_CALL acquire()
+ throw() override;
+
+ virtual void SAL_CALL release()
+ throw() override;
+
+// XEmbeddedObject
+
+ virtual void SAL_CALL changeState( sal_Int32 nNewState ) override;
+
+ virtual css::uno::Sequence< sal_Int32 > SAL_CALL getReachableStates() override;
+
+ virtual sal_Int32 SAL_CALL getCurrentState() override;
+
+ virtual void SAL_CALL doVerb( sal_Int32 nVerbID ) override;
+
+ virtual css::uno::Sequence< css::embed::VerbDescriptor > SAL_CALL getSupportedVerbs() override;
+
+ virtual void SAL_CALL setClientSite(
+ const css::uno::Reference< css::embed::XEmbeddedClient >& xClient ) override;
+
+ virtual css::uno::Reference< css::embed::XEmbeddedClient > SAL_CALL getClientSite() override;
+
+ virtual void SAL_CALL update() override;
+
+ virtual void SAL_CALL setUpdateMode( sal_Int32 nMode ) override;
+
+ virtual sal_Int64 SAL_CALL getStatus( sal_Int64 nAspect ) override;
+
+ virtual void SAL_CALL setContainerName( const OUString& sName ) override;
+
+
+// XVisualObject
+
+ virtual void SAL_CALL setVisualAreaSize( sal_Int64 nAspect, const css::awt::Size& aSize ) override;
+
+ virtual css::awt::Size SAL_CALL getVisualAreaSize( sal_Int64 nAspect ) override;
+
+ virtual css::embed::VisualRepresentation SAL_CALL getPreferredVisualRepresentation( ::sal_Int64 nAspect ) override;
+
+ virtual sal_Int32 SAL_CALL getMapUnit( sal_Int64 nAspect ) override;
+
+// XEmbedPersist
+
+ 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 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;
+
+ 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 saveCompleted( sal_Bool bUseNew ) override;
+
+ virtual sal_Bool SAL_CALL hasEntry() override;
+
+ virtual OUString SAL_CALL getEntryName() override;
+
+// XLinkageSupport
+
+ virtual void SAL_CALL breakLink( const css::uno::Reference< css::embed::XStorage >& xStorage,
+ const OUString& sEntName ) override;
+
+ virtual sal_Bool SAL_CALL isLink() override;
+
+ virtual OUString SAL_CALL getLinkURL() override;
+
+
+// XCommonEmbedPersist
+
+ virtual void SAL_CALL storeOwn() override;
+
+ virtual sal_Bool SAL_CALL isReadonly() override;
+
+ virtual void SAL_CALL reload(
+ const css::uno::Sequence< css::beans::PropertyValue >& lArguments,
+ const css::uno::Sequence< css::beans::PropertyValue >& lObjArgs ) override;
+
+// XEmbedPersist2
+
+ virtual sal_Bool SAL_CALL isStored() override;
+
+// XInplaceObject
+
+ virtual void SAL_CALL setObjectRectangles( const css::awt::Rectangle& aPosRect,
+ const css::awt::Rectangle& aClipRect ) override;
+
+ virtual void SAL_CALL enableModeless( sal_Bool bEnable ) override;
+
+ virtual void SAL_CALL translateAccelerators(
+ const css::uno::Sequence< css::awt::KeyEvent >& aKeys ) override;
+
+// XClassifiedObject
+
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getClassID() override;
+
+ virtual OUString SAL_CALL getClassName() override;
+
+ virtual void SAL_CALL setClassInfo(
+ const css::uno::Sequence< sal_Int8 >& aClassID, const OUString& aClassName ) override;
+
+
+// XComponentSupplier
+
+ virtual css::uno::Reference< css::util::XCloseable > SAL_CALL getComponent() override;
+
+// XStateChangeBroadcaster
+ virtual void SAL_CALL addStateChangeListener( const css::uno::Reference< css::embed::XStateChangeListener >& xListener ) override;
+ virtual void SAL_CALL removeStateChangeListener( const css::uno::Reference< css::embed::XStateChangeListener >& xListener ) override;
+
+// XCloseable
+
+ virtual void SAL_CALL close( sal_Bool DeliverOwnership ) override;
+
+ virtual void SAL_CALL addCloseListener(
+ const css::uno::Reference< css::util::XCloseListener >& Listener ) override;
+
+ virtual void SAL_CALL removeCloseListener(
+ const css::uno::Reference< css::util::XCloseListener >& Listener ) override;
+
+// XEventBroadcaster
+ virtual void SAL_CALL addEventListener(
+ const css::uno::Reference< css::document::XEventListener >& Listener ) override;
+
+ virtual void SAL_CALL removeEventListener(
+ const css::uno::Reference< css::document::XEventListener >& Listener ) override;
+
+ // XChild
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent( ) override;
+ virtual void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface >& Parent ) override;
+
+ // XDefaultSizeTransmitter
+ //#i103460# charts do not necessarily have an own size within ODF files, in this case they need to use the size settings from the surrounding frame, which is made available with this method
+ virtual void SAL_CALL setDefaultSize( const css::awt::Size& rSize_100TH_MM ) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/inc/docholder.hxx b/embeddedobj/source/inc/docholder.hxx
new file mode 100644
index 000000000..abe49ff94
--- /dev/null
+++ b/embeddedobj/source/inc/docholder.hxx
@@ -0,0 +1,203 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EMBEDDEDOBJ_SOURCE_INC_DOCHOLDER_HXX
+#define INCLUDED_EMBEDDEDOBJ_SOURCE_INC_DOCHOLDER_HXX
+
+#include <com/sun/star/util/XCloseListener.hpp>
+#include <com/sun/star/frame/XTerminateListener.hpp>
+#include <com/sun/star/util/XModifyListener.hpp>
+#include <com/sun/star/util/XCloseable.hpp>
+#include <com/sun/star/document/XEventListener.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/XDispatchProviderInterceptor.hpp>
+#include <com/sun/star/frame/XBorderResizeListener.hpp>
+#include <com/sun/star/frame/BorderWidths.hpp>
+#include <com/sun/star/awt/XWindowPeer.hpp>
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/awt/Rectangle.hpp>
+#include <com/sun/star/embed/XHatchWindowController.hpp>
+#include <com/sun/star/frame/XLayoutManager.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <cppuhelper/implbase.hxx>
+#include <rtl/ref.hxx>
+
+class OCommonEmbeddedObject;
+class Interceptor;
+
+class DocumentHolder :
+ public ::cppu::WeakImplHelper<
+ css::util::XCloseListener,
+ css::frame::XTerminateListener,
+ css::util::XModifyListener,
+ css::document::XEventListener,
+ css::frame::XBorderResizeListener,
+ css::embed::XHatchWindowController >
+{
+private:
+
+ OCommonEmbeddedObject* m_pEmbedObj;
+
+ rtl::Reference<Interceptor> m_xInterceptor;
+ css::uno::Reference< css::frame::XDispatchProviderInterceptor > m_xOutplaceInterceptor;
+
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+
+ css::uno::Reference< css::util::XCloseable > m_xComponent;
+
+ css::uno::Reference< css::frame::XFrame > m_xFrame;
+ css::uno::Reference< css::awt::XWindow > m_xOwnWindow; // set for inplace objects
+ css::uno::Reference< css::awt::XWindow > m_xHatchWindow; // set for inplace objects
+
+ css::awt::Rectangle m_aObjRect;
+ css::frame::BorderWidths m_aBorderWidths;
+
+ OUString m_aContainerName;
+ OUString m_aDocumentNamePart;
+
+ bool m_bReadOnly;
+
+ bool m_bWaitForClose;
+ bool m_bAllowClosing;
+ bool m_bDesktopTerminated;
+
+ sal_Int32 m_nNoBorderResizeReact;
+ sal_Int32 m_nNoResizeReact;
+
+ css::uno::Sequence< css::uno::Any > m_aOutplaceFrameProps;
+
+
+ css::uno::Reference< css::frame::XFrame > const & GetDocFrame();
+ bool LoadDocToFrame( bool );
+
+ css::awt::Rectangle CalculateBorderedArea( const css::awt::Rectangle& aRect );
+ css::awt::Rectangle AddBorderToArea( const css::awt::Rectangle& aRect );
+
+ void ResizeWindows_Impl( const css::awt::Rectangle& aHatchRect );
+
+ css::uno::Reference< css::container::XIndexAccess > RetrieveOwnMenu_Impl();
+ bool MergeMenus_Impl(
+ const css::uno::Reference< css::frame::XLayoutManager >& xOwnLM,
+ const css::uno::Reference< css::frame::XLayoutManager >& xContLM,
+ const css::uno::Reference< css::frame::XDispatchProvider >& xContDisp,
+ const OUString& aContModuleName );
+
+public:
+ /// @throws css::uno::Exception
+ static void FindConnectPoints(
+ const css::uno::Reference< css::container::XIndexAccess >& xMenu,
+ sal_Int32 nConnectPoints[2] );
+
+ /// @throws css::uno::Exception
+ static css::uno::Reference< css::container::XIndexAccess > MergeMenusForInplace(
+ const css::uno::Reference< css::container::XIndexAccess >& xContMenu,
+ const css::uno::Reference< css::frame::XDispatchProvider >& xContDisp,
+ const OUString& aContModuleName,
+ const css::uno::Reference< css::container::XIndexAccess >& xOwnMenu,
+ const css::uno::Reference< css::frame::XDispatchProvider >& xOwnDisp );
+
+
+ DocumentHolder( const css::uno::Reference< css::uno::XComponentContext >& xContext,
+ OCommonEmbeddedObject* pEmbObj );
+ virtual ~DocumentHolder() override;
+
+ OCommonEmbeddedObject* GetEmbedObject() { return m_pEmbedObj; }
+
+ void SetComponent( const css::uno::Reference< css::util::XCloseable >& xDoc, bool bReadOnly );
+ void ResizeHatchWindow();
+ void FreeOffice();
+
+ void CloseDocument( bool bDeliverOwnership, bool bWaitForClose );
+ void CloseFrame();
+
+ OUString GetTitle() const
+ {
+ return m_aContainerName + ( m_aDocumentNamePart.isEmpty() ? OUString() : ( " - " + m_aDocumentNamePart ) );
+ }
+
+ OUString const & GetContainerName() const
+ {
+ return m_aContainerName;
+ }
+
+ void SetOutplaceFrameProperties( const css::uno::Sequence< css::uno::Any >& aProps )
+ { m_aOutplaceFrameProps = aProps; }
+
+ void PlaceFrame( const css::awt::Rectangle& aNewRect );
+
+ static bool SetFrameLMVisibility( const css::uno::Reference< css::frame::XFrame >& xFrame,
+ bool bVisible );
+
+ bool ShowInplace( const css::uno::Reference< css::awt::XWindowPeer >& xParent,
+ const css::awt::Rectangle& aRectangleToShow,
+ const css::uno::Reference< css::frame::XDispatchProvider >& xContainerDP );
+
+ bool ShowUI(
+ const css::uno::Reference< css::frame::XLayoutManager >& xContainerLM,
+ const css::uno::Reference< css::frame::XDispatchProvider >& xContainerDP,
+ const OUString& aContModuleName );
+ bool HideUI(
+ const css::uno::Reference< css::frame::XLayoutManager >& xContainerLM );
+
+ void Show();
+
+ bool SetExtent( sal_Int64 nAspect, const css::awt::Size& aSize );
+ bool GetExtent( sal_Int64 nAspect, css::awt::Size *pSize );
+
+ sal_Int32 GetMapUnit( sal_Int64 nAspect );
+
+ void SetOutplaceDispatchInterceptor(
+ const css::uno::Reference< css::frame::XDispatchProviderInterceptor >&
+ xOutplaceInterceptor )
+ {
+ m_xOutplaceInterceptor = xOutplaceInterceptor;
+ }
+
+ const css::uno::Reference< css::util::XCloseable >& GetComponent() const { return m_xComponent; }
+
+// XEventListener
+ virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
+
+// XCloseListener
+ virtual void SAL_CALL queryClosing( const css::lang::EventObject& Source, sal_Bool GetsOwnership ) override;
+ virtual void SAL_CALL notifyClosing( const css::lang::EventObject& Source ) override;
+
+// XTerminateListener
+ virtual void SAL_CALL queryTermination( const css::lang::EventObject& Event ) override;
+ virtual void SAL_CALL notifyTermination( const css::lang::EventObject& Event ) override;
+
+// XModifyListener
+ virtual void SAL_CALL modified( const css::lang::EventObject& aEvent ) override;
+
+// XEventListener
+ virtual void SAL_CALL notifyEvent( const css::document::EventObject& Event ) override;
+
+// XBorderResizeListener
+ virtual void SAL_CALL borderWidthsChanged( const css::uno::Reference< css::uno::XInterface >& aObject, const css::frame::BorderWidths& aNewSize ) override;
+
+// XHatchWindowController
+ virtual void SAL_CALL requestPositioning( const css::awt::Rectangle& aRect ) override;
+ virtual css::awt::Rectangle SAL_CALL calcAdjustedRectangle( const css::awt::Rectangle& aRect ) override;
+ virtual void SAL_CALL activated( ) override;
+ virtual void SAL_CALL deactivated( ) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/inc/dummyobject.hxx b/embeddedobj/source/inc/dummyobject.hxx
new file mode 100644
index 000000000..60bca914b
--- /dev/null
+++ b/embeddedobj/source/inc/dummyobject.hxx
@@ -0,0 +1,206 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EMBEDDEDOBJ_SOURCE_INC_DUMMYOBJECT_HXX
+#define INCLUDED_EMBEDDEDOBJ_SOURCE_INC_DUMMYOBJECT_HXX
+
+#include <sal/config.h>
+
+#include <memory>
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/embed/XEmbeddedObject.hpp>
+#include <com/sun/star/embed/XEmbedPersist.hpp>
+#include <cppuhelper/implbase.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+
+namespace com::sun::star {
+ namespace embed {
+ class XStorage;
+ }
+ namespace util {
+ class XCloseListener;
+ }
+ namespace beans {
+ struct PropertyValue;
+ struct NamedValue;
+ }
+}
+
+namespace cppu {
+ class OMultiTypeInterfaceContainerHelper;
+}
+
+/**
+ * Represents an OLE object that has native data (next to the replacement
+ * image), but we don't understand that data.
+ */
+class ODummyEmbeddedObject : public ::cppu::WeakImplHelper
+ < css::embed::XEmbeddedObject
+ , css::embed::XEmbedPersist >
+{
+ ::osl::Mutex m_aMutex;
+ std::unique_ptr<cppu::OMultiTypeInterfaceContainerHelper>
+ m_pInterfaceContainer;
+ bool m_bDisposed;
+
+ OUString m_aEntryName;
+ css::uno::Reference< css::embed::XStorage > m_xParentStorage;
+ sal_Int32 m_nObjectState;
+
+ css::uno::Reference< css::embed::XEmbeddedClient > m_xClientSite;
+
+ sal_Int64 m_nCachedAspect;
+ css::awt::Size m_aCachedSize;
+ bool m_bHasCachedSize;
+
+ // following information will be used between SaveAs and SaveCompleted
+ bool m_bWaitSaveCompleted;
+ OUString m_aNewEntryName;
+ css::uno::Reference< css::embed::XStorage > m_xNewParentStorage;
+
+protected:
+ void CheckInit_WrongState(); //throw WrongStateException on m_nObjectState == -1
+ void CheckInit_Runtime(); //throw RuntimeException on m_nObjectState == -1
+ void PostEvent_Impl( const OUString& aEventName );
+
+public:
+
+ ODummyEmbeddedObject()
+ : m_bDisposed( false )
+ , m_nObjectState( -1 )
+ , m_nCachedAspect( 0 )
+ , m_bHasCachedSize( false )
+ , m_bWaitSaveCompleted( false )
+ {}
+
+ virtual ~ODummyEmbeddedObject() override;
+
+// XEmbeddedObject
+
+ virtual void SAL_CALL changeState( sal_Int32 nNewState ) override;
+
+ virtual css::uno::Sequence< sal_Int32 > SAL_CALL getReachableStates() override;
+
+ virtual sal_Int32 SAL_CALL getCurrentState() override;
+
+ virtual void SAL_CALL doVerb( sal_Int32 nVerbID ) override;
+
+ virtual css::uno::Sequence< css::embed::VerbDescriptor > SAL_CALL getSupportedVerbs() override;
+
+ virtual void SAL_CALL setClientSite(
+ const css::uno::Reference< css::embed::XEmbeddedClient >& xClient ) override;
+
+ virtual css::uno::Reference< css::embed::XEmbeddedClient > SAL_CALL getClientSite() override;
+
+ virtual void SAL_CALL update() override;
+
+ virtual void SAL_CALL setUpdateMode( sal_Int32 nMode ) override;
+
+ virtual sal_Int64 SAL_CALL getStatus( sal_Int64 nAspect ) override;
+
+ virtual void SAL_CALL setContainerName( const OUString& sName ) override;
+
+
+// XVisualObject
+
+ virtual void SAL_CALL setVisualAreaSize( sal_Int64 nAspect, const css::awt::Size& aSize ) override;
+
+ virtual css::awt::Size SAL_CALL getVisualAreaSize( sal_Int64 nAspect ) override;
+
+ virtual css::embed::VisualRepresentation SAL_CALL getPreferredVisualRepresentation( ::sal_Int64 nAspect ) override;
+
+ virtual sal_Int32 SAL_CALL getMapUnit( sal_Int64 nAspect ) override;
+
+// XEmbedPersist
+
+ 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 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;
+
+ 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 saveCompleted( sal_Bool bUseNew ) override;
+
+ virtual sal_Bool SAL_CALL hasEntry() override;
+
+ virtual OUString SAL_CALL getEntryName() override;
+
+
+// XCommonEmbedPersist
+
+ virtual void SAL_CALL storeOwn() override;
+
+ virtual sal_Bool SAL_CALL isReadonly() override;
+
+ virtual void SAL_CALL reload(
+ const css::uno::Sequence< css::beans::PropertyValue >& lArguments,
+ const css::uno::Sequence< css::beans::PropertyValue >& lObjArgs ) override;
+
+
+// XClassifiedObject
+
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getClassID() override;
+
+ virtual OUString SAL_CALL getClassName() override;
+
+ virtual void SAL_CALL setClassInfo(
+ const css::uno::Sequence< sal_Int8 >& aClassID, const OUString& aClassName ) override;
+
+
+// XComponentSupplier
+
+ virtual css::uno::Reference< css::util::XCloseable > SAL_CALL getComponent() override;
+
+// XStateChangeBroadcaster
+ virtual void SAL_CALL addStateChangeListener( const css::uno::Reference< css::embed::XStateChangeListener >& xListener ) override;
+ virtual void SAL_CALL removeStateChangeListener( const css::uno::Reference< css::embed::XStateChangeListener >& xListener ) override;
+
+// XCloseable
+
+ virtual void SAL_CALL close( sal_Bool DeliverOwnership ) override;
+
+ virtual void SAL_CALL addCloseListener(
+ const css::uno::Reference< css::util::XCloseListener >& Listener ) override;
+
+ virtual void SAL_CALL removeCloseListener(
+ const css::uno::Reference< css::util::XCloseListener >& Listener ) override;
+
+// XEventBroadcaster
+ virtual void SAL_CALL addEventListener(
+ const css::uno::Reference< css::document::XEventListener >& Listener ) override;
+
+ virtual void SAL_CALL removeEventListener(
+ const css::uno::Reference< css::document::XEventListener >& Listener ) override;
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/inc/intercept.hxx b/embeddedobj/source/inc/intercept.hxx
new file mode 100644
index 000000000..a551fd5b0
--- /dev/null
+++ b/embeddedobj/source/inc/intercept.hxx
@@ -0,0 +1,120 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EMBEDDEDOBJ_SOURCE_INC_INTERCEPT_HXX
+#define INCLUDED_EMBEDDEDOBJ_SOURCE_INC_INTERCEPT_HXX
+
+#include <osl/mutex.hxx>
+#include <cppuhelper/implbase.hxx>
+#include <com/sun/star/frame/XDispatchProviderInterceptor.hpp>
+#include <com/sun/star/frame/XInterceptorInfo.hpp>
+#include <com/sun/star/frame/XDispatch.hpp>
+#include <memory>
+
+
+class StatusChangeListenerContainer;
+class DocumentHolder;
+
+class Interceptor : public ::cppu::WeakImplHelper< css::frame::XDispatchProviderInterceptor,
+ css::frame::XInterceptorInfo,
+ css::frame::XDispatch>
+{
+public:
+
+ Interceptor( DocumentHolder* pDocHolder );
+ virtual ~Interceptor() override;
+
+ void DisconnectDocHolder();
+
+ //XDispatch
+ virtual void SAL_CALL
+ dispatch(
+ const css::util::URL& URL,
+ const css::uno::Sequence<
+ css::beans::PropertyValue >& Arguments ) override;
+
+ virtual void SAL_CALL
+ addStatusListener(
+ const css::uno::Reference<
+ css::frame::XStatusListener >& Control,
+ const css::util::URL& URL ) override;
+
+ virtual void SAL_CALL
+ removeStatusListener(
+ const css::uno::Reference<
+ css::frame::XStatusListener >& Control,
+ const css::util::URL& URL ) override;
+
+ //XInterceptorInfo
+ virtual css::uno::Sequence< OUString >
+ SAL_CALL getInterceptedURLs( ) override;
+
+ //XDispatchProvider ( inherited by XDispatchProviderInterceptor )
+ virtual css::uno::Reference<
+ css::frame::XDispatch > SAL_CALL
+ queryDispatch(
+ const css::util::URL& URL,
+ const OUString& TargetFrameName,
+ sal_Int32 SearchFlags ) override;
+
+ virtual css::uno::Sequence<
+ css::uno::Reference<
+ css::frame::XDispatch > > SAL_CALL
+ queryDispatches(
+ const css::uno::Sequence<
+ css::frame::DispatchDescriptor >& Requests ) override;
+
+
+ //XDispatchProviderInterceptor
+ virtual css::uno::Reference<
+ css::frame::XDispatchProvider > SAL_CALL
+ getSlaveDispatchProvider( ) override;
+
+ virtual void SAL_CALL
+ setSlaveDispatchProvider(
+ const css::uno::Reference<
+ css::frame::XDispatchProvider >& NewDispatchProvider ) override;
+
+ virtual css::uno::Reference<
+ css::frame::XDispatchProvider > SAL_CALL
+ getMasterDispatchProvider( ) override;
+
+ virtual void SAL_CALL
+ setMasterDispatchProvider(
+ const css::uno::Reference<
+ css::frame::XDispatchProvider >& NewSupplier ) override;
+
+
+private:
+
+ osl::Mutex m_aMutex;
+
+ DocumentHolder* m_pDocHolder;
+
+ css::uno::Reference< css::frame::XDispatchProvider > m_xSlaveDispatchProvider;
+ css::uno::Reference< css::frame::XDispatchProvider > m_xMasterDispatchProvider;
+
+ static css::uno::Sequence< OUString > m_aInterceptedURL;
+
+ std::unique_ptr<StatusChangeListenerContainer> m_pStatCL;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/inc/oleembobj.hxx b/embeddedobj/source/inc/oleembobj.hxx
new file mode 100644
index 000000000..051d63294
--- /dev/null
+++ b/embeddedobj/source/inc/oleembobj.hxx
@@ -0,0 +1,452 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EMBEDDEDOBJ_SOURCE_INC_OLEEMBOBJ_HXX
+#define INCLUDED_EMBEDDEDOBJ_SOURCE_INC_OLEEMBOBJ_HXX
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/embed/XEmbeddedObject.hpp>
+#include <com/sun/star/embed/XEmbeddedOleObject.hpp>
+#include <com/sun/star/embed/XInplaceObject.hpp>
+#include <com/sun/star/embed/XEmbedPersist.hpp>
+#include <com/sun/star/embed/XLinkageSupport.hpp>
+#include <com/sun/star/embed/VerbDescriptor.hpp>
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/util/XCloseable.hpp>
+#include <com/sun/star/util/XCloseListener.hpp>
+#include <com/sun/star/io/XActiveDataStreamer.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <cppuhelper/implbase.hxx>
+#include <rtl/ref.hxx>
+
+#include <osl/thread.h>
+#include <memory>
+
+namespace cppu {
+ class OMultiTypeInterfaceContainerHelper;
+}
+
+class VerbExecutionController
+{
+ // the following mutex is allowed to be locked only for variables initialization, so no deadlock can be caused
+ ::osl::Mutex m_aVerbExecutionMutex;
+
+ sal_Int32 m_nNotificationLock;
+
+#ifdef _WIN32
+ bool m_bWasEverActive;
+ bool m_bVerbExecutionInProgress;
+ oslThreadIdentifier m_nVerbExecutionThreadIdentifier;
+ bool m_bChangedOnVerbExecution;
+#endif
+
+public:
+
+ VerbExecutionController()
+ : m_nNotificationLock( 0 )
+#ifdef _WIN32
+ , m_bWasEverActive( false )
+ , m_bVerbExecutionInProgress( false )
+ , m_nVerbExecutionThreadIdentifier( 0 )
+ , m_bChangedOnVerbExecution( false )
+#endif
+ {}
+
+#ifdef _WIN32
+ void StartControlExecution();
+ bool EndControlExecution_WasModified();
+ void ModificationNotificationIsDone();
+ // no need to lock anything to check the value of the numeric members
+ bool CanDoNotification() { return ( !m_bVerbExecutionInProgress && !m_bWasEverActive && !m_nNotificationLock ); }
+ // ... or to change it
+ void ObjectIsActive() { m_bWasEverActive = true; }
+#endif
+ void LockNotification();
+ void UnlockNotification();
+};
+
+class VerbExecutionControllerGuard
+{
+ VerbExecutionController& m_rController;
+public:
+
+ VerbExecutionControllerGuard( VerbExecutionController& rController )
+ : m_rController( rController )
+ {
+ m_rController.LockNotification();
+ }
+
+ ~VerbExecutionControllerGuard()
+ {
+ m_rController.UnlockNotification();
+ }
+};
+
+
+class OleComponent;
+class OwnView_Impl;
+/**
+ * Represents an OLE object that has native data and we try to let an external
+ * application handle that data.
+ */
+class OleEmbeddedObject : public ::cppu::WeakImplHelper
+ < css::embed::XEmbeddedObject
+ , css::embed::XEmbeddedOleObject
+ , css::embed::XEmbedPersist
+ , css::embed::XLinkageSupport
+ , css::embed::XInplaceObject
+ , css::container::XChild
+ , css::io::XActiveDataStreamer
+ , css::lang::XInitialization >
+{
+ friend class OleComponent;
+
+ ::osl::Mutex m_aMutex;
+
+ OleComponent* m_pOleComponent;
+
+ std::unique_ptr<::cppu::OMultiTypeInterfaceContainerHelper> m_pInterfaceContainer;
+
+ bool m_bReadOnly;
+
+ bool m_bDisposed;
+ sal_Int32 m_nObjectState;
+ sal_Int32 m_nTargetState;
+ sal_Int32 m_nUpdateMode;
+
+ css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory;
+
+ css::uno::Sequence< sal_Int8 > m_aClassID;
+ OUString m_aClassName;
+
+ css::uno::Reference< css::embed::XEmbeddedClient > m_xClientSite;
+
+ OUString m_aContainerName;
+
+ css::uno::Reference< css::util::XCloseListener > m_xClosePreventer;
+
+ bool m_bWaitSaveCompleted;
+ bool m_bNewVisReplInStream;
+ css::uno::Reference< css::io::XStream > m_xNewCachedVisRepl;
+ OUString m_aNewEntryName;
+ css::uno::Reference< css::embed::XStorage > m_xNewParentStorage;
+ css::uno::Reference< css::io::XStream > m_xNewObjectStream;
+ bool m_bStoreLoaded;
+
+ css::uno::Reference< css::io::XStream > m_xCachedVisualRepresentation;
+ bool m_bVisReplInitialized;
+ bool m_bVisReplInStream;
+ bool m_bStoreVisRepl;
+
+ bool m_bIsLink;
+
+ // TODO/LATER: may need to cache more than one aspect in future
+ bool m_bHasCachedSize; // the object has cached size
+ css::awt::Size m_aCachedSize;
+ sal_Int64 m_nCachedAspect;
+
+ bool m_bHasSizeToSet; // the object has cached size that should be set to OLE component
+ css::awt::Size m_aSizeToSet; // this size might be different from the cached one ( scaling is applied )
+ sal_Int64 m_nAspectToSet;
+
+
+ // cache the status of the object
+ // TODO/LATER: may need to cache more than one aspect in future
+ bool m_bGotStatus;
+ sal_Int64 m_nStatus;
+ sal_Int64 m_nStatusAspect;
+
+ // embedded object related stuff
+ OUString m_aEntryName;
+ css::uno::Reference< css::embed::XStorage > m_xParentStorage;
+ css::uno::Reference< css::io::XStream > m_xObjectStream;
+
+ // link related stuff
+ OUString m_aLinkURL; // ???
+
+ // points to own view provider if the object has no server
+ rtl::Reference<OwnView_Impl> m_xOwnView;
+
+ // whether the object should be initialized from clipboard in case of default initialization
+ bool m_bFromClipboard;
+
+ OUString m_aTempURL;
+
+ OUString m_aTempDumpURL;
+
+ // STAMPIT solution
+ // the following member is used during verb execution to detect whether the verb execution modifies the object
+ VerbExecutionController m_aVerbExecutionController;
+
+ // if the following member is set, the object works in wrapper mode
+ css::uno::Reference< css::embed::XEmbeddedObject > m_xWrappedObject;
+ bool m_bTriedConversion;
+ OUString m_aFilterName; // if m_bTriedConversion, then the filter detected by that
+
+ css::uno::Reference< css::uno::XInterface > m_xParent;
+
+ /// If it is allowed to modify entries in the stream of the OLE storage.
+ bool m_bStreamReadOnly = false;
+
+protected:
+ /// @throws css::uno::Exception
+ css::uno::Reference< css::io::XStream > TryToGetAcceptableFormat_Impl(
+ const css::uno::Reference< css::io::XStream >& xStream );
+
+ /// @throws css::io::IOException
+ /// @throws css::uno::RuntimeException
+ css::uno::Reference< css::io::XStream > GetNewFilledTempStream_Impl(
+ const css::uno::Reference< css::io::XInputStream >& xInStream );
+#ifdef _WIN32
+ void SwitchComponentToRunningState_Impl();
+#endif
+ void MakeEventListenerNotification_Impl( const OUString& aEventName );
+#ifdef _WIN32
+ void StateChangeNotification_Impl( bool bBeforeChange, sal_Int32 nOldState, sal_Int32 nNewState );
+ css::uno::Reference< css::io::XOutputStream > GetStreamForSaving();
+
+
+ css::uno::Sequence< sal_Int32 > GetIntermediateVerbsSequence_Impl( sal_Int32 nNewState );
+
+ static css::uno::Sequence< sal_Int32 > GetReachableStatesList_Impl(
+ const css::uno::Sequence< css::embed::VerbDescriptor >& aVerbList );
+#endif
+
+ void Dispose();
+
+ void SwitchOwnPersistence(
+ const css::uno::Reference< css::embed::XStorage >& xNewParentStorage,
+ const css::uno::Reference< css::io::XStream >& xNewObjectStream,
+ const OUString& aNewName );
+
+ void SwitchOwnPersistence(
+ const css::uno::Reference< css::embed::XStorage >& xNewParentStorage,
+ const OUString& aNewName );
+
+ void GetRidOfComponent();
+
+ /// @throws css::uno::Exception
+ void StoreToLocation_Impl(
+ const css::uno::Reference< css::embed::XStorage >& xStorage,
+ const OUString& sEntName,
+ const css::uno::Sequence< css::beans::PropertyValue >& lObjArgs,
+ bool bSaveAs );
+#ifdef _WIN32
+ /// @throws css::uno::Exception
+ void StoreObjectToStream( css::uno::Reference< css::io::XOutputStream > const & xOutStream );
+#endif
+ /// @throws css::uno::Exception
+ void InsertVisualCache_Impl(
+ const css::uno::Reference< css::io::XStream >& xTargetStream,
+ const css::uno::Reference< css::io::XStream >& xCachedVisualRepresentation );
+
+ /// @throws css::uno::Exception
+ void RemoveVisualCache_Impl( const css::uno::Reference< css::io::XStream >& xTargetStream );
+
+ void SetVisReplInStream( bool bExists );
+ bool HasVisReplInStream();
+
+ /// @throws css::uno::Exception
+ css::embed::VisualRepresentation GetVisualRepresentationInNativeFormat_Impl(
+ const css::uno::Reference< css::io::XStream >& xCachedVisRepr );
+
+ css::uno::Reference< css::io::XStream > TryToRetrieveCachedVisualRepresentation_Impl(
+ const css::uno::Reference< css::io::XStream >& xStream,
+ bool bAllowRepair50 = false )
+ throw ();
+#ifdef _WIN32
+ bool SaveObject_Impl();
+ bool OnShowWindow_Impl( bool bShow );
+ void CreateOleComponent_Impl( OleComponent* pOleComponent = nullptr );
+ void CreateOleComponentAndLoad_Impl( OleComponent* pOleComponent = nullptr );
+ void CreateOleComponentFromClipboard_Impl( OleComponent* pOleComponent = nullptr );
+ OUString CreateTempURLEmpty_Impl();
+ OUString GetTempURL_Impl();
+ void SetObjectIsLink_Impl( bool bIsLink ) { m_bIsLink = bIsLink; }
+#endif
+
+ // the following 4 methods are related to switch to wrapping mode
+ void MoveListeners();
+ css::uno::Reference< css::embed::XStorage > CreateTemporarySubstorage( OUString& o_aStorageName );
+ OUString MoveToTemporarySubstream();
+ bool TryToConvertToOOo( const css::uno::Reference< css::io::XStream >& xStream );
+
+public:
+ // in case a new object must be created the class ID must be specified
+ OleEmbeddedObject( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory,
+ const css::uno::Sequence< sal_Int8 >& aClassID,
+ const OUString& aClassName );
+
+ // in case object will be loaded from a persistent entry or from a file the class ID will be detected on loading
+ // factory can do it for OOo objects, but for OLE objects OS dependent code is required
+ OleEmbeddedObject( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory,
+ bool bLink );
+#ifdef _WIN32
+ // this constructor let object be initialized from clipboard
+ OleEmbeddedObject( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory );
+#endif
+
+ virtual ~OleEmbeddedObject() override;
+
+#ifdef _WIN32
+ static void OnIconChanged_Impl();
+ void OnViewChanged_Impl();
+ void OnClosed_Impl();
+#endif
+
+// XEmbeddedObject
+
+ virtual void SAL_CALL changeState( sal_Int32 nNewState ) override;
+
+ virtual css::uno::Sequence< sal_Int32 > SAL_CALL getReachableStates() override;
+
+ virtual sal_Int32 SAL_CALL getCurrentState() override;
+
+ virtual void SAL_CALL doVerb( sal_Int32 nVerbID ) override;
+
+ virtual css::uno::Sequence< css::embed::VerbDescriptor > SAL_CALL getSupportedVerbs() override;
+
+ virtual void SAL_CALL setClientSite(
+ const css::uno::Reference< css::embed::XEmbeddedClient >& xClient ) override;
+
+ virtual css::uno::Reference< css::embed::XEmbeddedClient > SAL_CALL getClientSite() override;
+
+ virtual void SAL_CALL update() override;
+
+ virtual void SAL_CALL setUpdateMode( sal_Int32 nMode ) override;
+
+ virtual sal_Int64 SAL_CALL getStatus( sal_Int64 nAspect ) override;
+
+ virtual void SAL_CALL setContainerName( const OUString& sName ) override;
+
+
+// XVisualObject
+
+ virtual void SAL_CALL setVisualAreaSize( sal_Int64 nAspect, const css::awt::Size& aSize ) override;
+
+ virtual css::awt::Size SAL_CALL getVisualAreaSize( sal_Int64 nAspect ) override;
+
+ virtual css::embed::VisualRepresentation SAL_CALL getPreferredVisualRepresentation( ::sal_Int64 nAspect ) override;
+
+ virtual sal_Int32 SAL_CALL getMapUnit( sal_Int64 nAspect ) override;
+
+
+// XEmbedPersist
+
+ 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 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;
+
+ 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 saveCompleted( sal_Bool bUseNew ) override;
+
+ virtual sal_Bool SAL_CALL hasEntry() override;
+
+ virtual OUString SAL_CALL getEntryName() override;
+
+// XLinkageSupport
+
+ virtual void SAL_CALL breakLink( const css::uno::Reference< css::embed::XStorage >& xStorage,
+ const OUString& sEntName ) override;
+
+ virtual sal_Bool SAL_CALL isLink() override;
+
+ virtual OUString SAL_CALL getLinkURL() override;
+
+// XCommonEmbedPersist
+ virtual void SAL_CALL storeOwn() override;
+
+ virtual sal_Bool SAL_CALL isReadonly() override;
+
+ virtual void SAL_CALL reload(
+ const css::uno::Sequence< css::beans::PropertyValue >& lArguments,
+ const css::uno::Sequence< css::beans::PropertyValue >& lObjArgs ) override;
+
+// XClassifiedObject
+
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getClassID() override;
+
+ virtual OUString SAL_CALL getClassName() override;
+
+ virtual void SAL_CALL setClassInfo(
+ const css::uno::Sequence< sal_Int8 >& aClassID, const OUString& aClassName ) override;
+
+// XStateChangeBroadcaster
+ virtual void SAL_CALL addStateChangeListener( const css::uno::Reference< css::embed::XStateChangeListener >& xListener ) override;
+ virtual void SAL_CALL removeStateChangeListener( const css::uno::Reference< css::embed::XStateChangeListener >& xListener ) override;
+
+
+// XComponentSupplier
+
+ virtual css::uno::Reference< css::util::XCloseable > SAL_CALL getComponent() override;
+
+// XCloseable
+
+ virtual void SAL_CALL close( sal_Bool DeliverOwnership ) override;
+
+ virtual void SAL_CALL addCloseListener(
+ const css::uno::Reference< css::util::XCloseListener >& Listener ) override;
+
+ virtual void SAL_CALL removeCloseListener(
+ const css::uno::Reference< css::util::XCloseListener >& Listener ) override;
+
+// XEventBroadcaster
+ virtual void SAL_CALL addEventListener(
+ const css::uno::Reference< css::document::XEventListener >& Listener ) override;
+
+ virtual void SAL_CALL removeEventListener(
+ const css::uno::Reference< css::document::XEventListener >& Listener ) override;
+
+// XInplaceObject ( only for wrapping scenario here )
+
+ virtual void SAL_CALL setObjectRectangles( const css::awt::Rectangle& aPosRect,
+ const css::awt::Rectangle& aClipRect ) override;
+
+ virtual void SAL_CALL enableModeless( sal_Bool bEnable ) override;
+
+ virtual void SAL_CALL translateAccelerators(
+ const css::uno::Sequence< css::awt::KeyEvent >& aKeys ) override;
+
+ // XChild ( only for wrapping scenario here )
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent( ) override;
+ virtual void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface >& Parent ) override;
+
+ // XActiveDataStreamer
+ void SAL_CALL setStream(const css::uno::Reference<css::io::XStream>& xStream) override;
+ css::uno::Reference<css::io::XStream> SAL_CALL getStream() override;
+
+ // XInitialization
+ void SAL_CALL initialize(const css::uno::Sequence<css::uno::Any>& rArguments) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/inc/specialobject.hxx b/embeddedobj/source/inc/specialobject.hxx
new file mode 100644
index 000000000..32ad61a7a
--- /dev/null
+++ b/embeddedobj/source/inc/specialobject.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EMBEDDEDOBJ_SOURCE_INC_SPECIALOBJECT_HXX
+#define INCLUDED_EMBEDDEDOBJ_SOURCE_INC_SPECIALOBJECT_HXX
+
+#include <com/sun/star/awt/Size.hpp>
+
+#include "commonembobj.hxx"
+
+class OSpecialEmbeddedObject : public OCommonEmbeddedObject
+{
+private:
+ css::awt::Size maSize;
+public:
+ OSpecialEmbeddedObject(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const css::uno::Sequence< css::beans::NamedValue >& aObjectProps );
+
+ // XInterface
+ virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& rType ) override ;
+
+ // XVisualObject
+ virtual css::embed::VisualRepresentation SAL_CALL getPreferredVisualRepresentation( ::sal_Int64 nAspect ) override;
+
+ virtual void SAL_CALL setVisualAreaSize( sal_Int64 nAspect, const css::awt::Size& aSize ) override;
+
+ virtual css::awt::Size SAL_CALL getVisualAreaSize( sal_Int64 nAspect ) override;
+
+ virtual sal_Int32 SAL_CALL getMapUnit( sal_Int64 nAspect ) override;
+
+ virtual void SAL_CALL changeState( sal_Int32 nNewState ) override;
+
+ virtual void SAL_CALL doVerb( sal_Int32 nVerbID ) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/inc/targetstatecontrol.hxx b/embeddedobj/source/inc/targetstatecontrol.hxx
new file mode 100644
index 000000000..3e099eac1
--- /dev/null
+++ b/embeddedobj/source/inc/targetstatecontrol.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EMBEDDEDOBJ_SOURCE_INC_TARGETSTATECONTROL_HXX
+#define INCLUDED_EMBEDDEDOBJ_SOURCE_INC_TARGETSTATECONTROL_HXX
+
+#include <sal/types.h>
+#include <osl/diagnose.h>
+
+class TargetStateControl_Impl
+{
+ sal_Int32& m_nTargetStateVariable;
+public:
+ TargetStateControl_Impl( sal_Int32& nVariable, sal_Int32 nValue )
+ : m_nTargetStateVariable( nVariable )
+ {
+ OSL_ENSURE( m_nTargetStateVariable == -1, "The target state variable is not initialized properly!" );
+ m_nTargetStateVariable = nValue;
+ }
+
+ ~TargetStateControl_Impl()
+ {
+ m_nTargetStateVariable = -1;
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/inc/xcreator.hxx b/embeddedobj/source/inc/xcreator.hxx
new file mode 100644
index 000000000..3c0118fde
--- /dev/null
+++ b/embeddedobj/source/inc/xcreator.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EMBEDDEDOBJ_SOURCE_INC_XCREATOR_HXX
+#define INCLUDED_EMBEDDEDOBJ_SOURCE_INC_XCREATOR_HXX
+
+#include <com/sun/star/embed/XEmbeddedObjectCreator.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+
+#include <osl/diagnose.h>
+#include <cppuhelper/implbase.hxx>
+#include <comphelper/mimeconfighelper.hxx>
+
+class UNOEmbeddedObjectCreator : public ::cppu::WeakImplHelper<
+ css::embed::XEmbeddedObjectCreator,
+ css::lang::XServiceInfo >
+{
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+
+ ::comphelper::MimeConfigurationHelper m_aConfigHelper;
+public:
+ UNOEmbeddedObjectCreator(
+ const css::uno::Reference< css::uno::XComponentContext >& rxContext )
+ : m_xContext( rxContext )
+ , m_aConfigHelper( rxContext )
+ {
+ OSL_ENSURE( rxContext.is(), "No service manager is provided!" );
+ }
+
+ static css::uno::Sequence< OUString > impl_staticGetSupportedServiceNames();
+
+ static OUString impl_staticGetImplementationName();
+
+ static css::uno::Reference< css::uno::XInterface >
+ impl_staticCreateSelfInstance(
+ const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager );
+
+
+ // XEmbedObjectCreator
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceInitNew( const css::uno::Sequence< sal_Int8 >& aClassID, const OUString& aClassName, const css::uno::Reference< css::embed::XStorage >& xStorage, const OUString& sEntName, const css::uno::Sequence< css::beans::PropertyValue >& lObjArgs ) override;
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceInitFromEntry( const css::uno::Reference< css::embed::XStorage >& xStorage, const OUString& sEntName, const css::uno::Sequence< css::beans::PropertyValue >& aMedDescr, const css::uno::Sequence< css::beans::PropertyValue >& lObjArgs ) override;
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceInitFromMediaDescriptor( const css::uno::Reference< css::embed::XStorage >& xStorage, const OUString& sEntName, const css::uno::Sequence< css::beans::PropertyValue >& aMediaDescr, const css::uno::Sequence< css::beans::PropertyValue >& lObjArgs ) override;
+
+ // XEmbedObjectFactory
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceUserInit( const css::uno::Sequence< sal_Int8 >& aClassID, const OUString& sClassName, const css::uno::Reference< css::embed::XStorage >& xStorage, const OUString& sEntName, sal_Int32 nEntryConnectionMode, const css::uno::Sequence< css::beans::PropertyValue >& aArgs, const css::uno::Sequence< css::beans::PropertyValue >& aObjectArgs ) override;
+
+ // XLinkCreator
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceLink( const css::uno::Reference< css::embed::XStorage >& xStorage, const OUString& sEntName, const css::uno::Sequence< css::beans::PropertyValue >& aMediaDescr, const css::uno::Sequence< css::beans::PropertyValue >& lObjArgs ) override;
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() override;
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */