summaryrefslogtreecommitdiff
path: root/embeddedobj/source/inc/commonembobj.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'embeddedobj/source/inc/commonembobj.hxx')
-rw-r--r--embeddedobj/source/inc/commonembobj.hxx73
1 files changed, 61 insertions, 12 deletions
diff --git a/embeddedobj/source/inc/commonembobj.hxx b/embeddedobj/source/inc/commonembobj.hxx
index 2294b0d7e915..2e2cfc38d326 100644
--- a/embeddedobj/source/inc/commonembobj.hxx
+++ b/embeddedobj/source/inc/commonembobj.hxx
@@ -32,9 +32,16 @@
#include <com/sun/star/awt/Rectangle.hpp>
#include <com/sun/star/util/XCloseable.hpp>
#include <com/sun/star/chart2/XDefaultSizeTransmitter.hpp>
+#include <com/sun/star/io/XTempFile.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
#include <cppuhelper/weak.hxx>
+#include <embeddedobj/embeddedupdate.hxx>
#include <rtl/ref.hxx>
#include <map>
+#include <memory>
+#include <svtools/filechangedchecker.hxx>
+#include <unotools/resmgr.hxx>
namespace com::sun::star {
namespace embed {
@@ -52,8 +59,8 @@ namespace com::sun::star {
}
}
-namespace cppu {
- class OMultiTypeInterfaceContainerHelper;
+namespace comphelper {
+ class OMultiTypeInterfaceContainerHelper2;
}
namespace comphelper {
@@ -65,26 +72,30 @@ namespace comphelper {
#include "docholder.hxx"
-class Interceptor;
+namespace embeddedobj { 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::EmbeddedUpdate
, public css::embed::XEmbedPersist2
, public css::embed::XLinkageSupport
, public css::embed::XInplaceObject
, public css::container::XChild
, public css::chart2::XDefaultSizeTransmitter
+ , public css::lang::XServiceInfo
+ , public css::lang::XInitialization
+ , public css::lang::XTypeProvider
, public ::cppu::OWeakObject
{
protected:
::osl::Mutex m_aMutex;
- rtl::Reference<DocumentHolder> m_xDocHolder;
+ rtl::Reference<embeddedobj::DocumentHolder> m_xDocHolder;
- ::cppu::OMultiTypeInterfaceContainerHelper* m_pInterfaceContainer;
+ std::unique_ptr<::comphelper::OMultiTypeInterfaceContainerHelper2> m_pInterfaceContainer;
bool m_bReadOnly;
@@ -109,8 +120,6 @@ protected:
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;
@@ -132,7 +141,11 @@ protected:
css::awt::Rectangle m_aOwnRectangle;
css::awt::Rectangle m_aClipRectangle;
- bool m_bIsLink;
+ bool m_bIsLinkURL;
+ bool m_bLinkTempFileChanged;
+ ::std::unique_ptr< FileChangedChecker > m_pLinkFile;
+ bool m_bOleUpdate;
+ bool m_bInHndFunc;
// embedded object related stuff
OUString m_aEntryName;
@@ -146,6 +159,9 @@ protected:
bool m_bLinkHasPassword;
OUString m_aLinkPassword;
+ // tdf#141529 hold a cc of a linked OLE
+ css::uno::Reference < css::io::XTempFile > m_aLinkTempFile;
+
css::uno::Reference< css::uno::XInterface > m_xParent;
bool m_bHasClonedSize; // the object has cached size
@@ -182,6 +198,16 @@ private:
void Deactivate();
+ // when State = CopyTempToLink -> the user pressed the save button
+ // when change in embedded part then copy to the linked-file
+ // CopyLinkToTemp -> the user pressed the refresh button
+ // when change in linked-file then copy to the embedded part (temp-file)
+ // CopyLinkToTempInit -> create the temp file
+ // CopyLinkToTempRefresh -> when save and Link change but not temp then update temp
+ enum class CopyBackToOLELink {NoCopy, CopyTempToLink, CopyLinkToTemp, CopyLinkToTempInit, CopyLinkToTempRefresh};
+
+ void handleLinkedOLE( CopyBackToOLELink eState );
+
void StateChangeNotification_Impl( bool bBeforeChange, sal_Int32 nOldState, sal_Int32 nNewState,::osl::ResettableMutexGuard& _rGuard );
void SwitchStateTo_Impl( sal_Int32 nNextState );
@@ -226,14 +252,21 @@ private:
const css::uno::Sequence< css::beans::PropertyValue >& lArguments,
const css::uno::Sequence< css::beans::PropertyValue >& lObjArgs );
+ int ShowMsgDialog(TranslateId Msg, const OUString& sFileName);
+
+ bool getAllowLinkUpdate() const;
+
+protected:
+ void SetInplaceActiveState();
+
public:
OCommonEmbeddedObject(
- const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ css::uno::Reference< css::uno::XComponentContext > xContext,
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,
+ css::uno::Reference< css::uno::XComponentContext > xContext,
const css::uno::Sequence< css::beans::NamedValue >& aObjectProps,
const css::uno::Sequence< css::beans::PropertyValue >& aMediaDescr,
const css::uno::Sequence< css::beans::PropertyValue >& aObjectDescr );
@@ -253,10 +286,10 @@ public:
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& rType ) override ;
virtual void SAL_CALL acquire()
- throw() override;
+ noexcept override;
virtual void SAL_CALL release()
- throw() override;
+ noexcept override;
// XEmbeddedObject
@@ -283,6 +316,10 @@ public:
virtual void SAL_CALL setContainerName( const OUString& sName ) override;
+// EmbeddedUpdate
+
+ virtual void SetOleState(bool bIsOleUpdate) override;
+
// XVisualObject
@@ -393,6 +430,18 @@ public:
// 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;
+
+ // XServiceInfo
+ OUString SAL_CALL getImplementationName() override;
+ sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
+ css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
+
+ // XInitialization
+ void SAL_CALL initialize(const css::uno::Sequence<css::uno::Any>& rArguments) override;
+
+ // XTypeProvider
+ css::uno::Sequence<css::uno::Type> SAL_CALL getTypes() override;
+ css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId() override;
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */