Until now the 'local' StyleSheet got set, but that may not be the same as the original. It was/gets identified just by searching by name and type, not comparing content. What to do? We could... (a) the Style-Friendly way: - check if StyleSheet is identical - if not, create a new in-between StyleSheet hosting missing Items - if yes, use, done. (b) the pragmatic/practical way: - Just hard-attribute the Items that are detected as different similar to what BurnInStyleSheetAttributes does/did, but only for a view differing Items (b) is the most simple for now, but will lead to more hard attributes. The other possibilities will be better in the long term. For now, I will use (b). Note that there are more cases in that VERY complex and grown stuff emerging from SdDrawDocument::PasteBookmarkAsPage. More things will need to be fixed, see this as a 1st step. Needed to adapt postProcessAfterCloneToDifferentModel due to UT testTdf96206 failing, see comment there for details. That 1st implementation showed weaknesses with those Items critical and only on MasterPages, so decided to give up on that and implement ContentCompare to SdPage::Equals. That was easier than thought: No parameter needed, only used by InsertBookmarkAsPage_FindDuplicateLayouts::operator(). Thus, SdPage::Equals needs no change, just SdrObject::Equals. Due to still problems with Items corrected in Objects on MasterPages I will for now exclude this. Could now isolate remaining problems, these are defaults and/or PresObj things on MasterPages. Important is that I can completely correct all Items for all Objects in postProcessAfterCloneToDifferentModel. I can react to these false-positives in the ContentCompare in SdrObject::Equals. Signed-off-by: Armin Le Grand (collabora) <Armin.LeGrand@collabora.com> Change-Id: I10e17c8d6a893dbe92ab716182f07bafce1f3284 Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/6595 Tested-by: Jenkins CPCI <releng@collaboraoffice.com> Reviewed-by: Armin Le Grand <armin.legrand@collabora.com> (cherry picked from commit 92ffaeac04c5c8586006b026f29ce12fba3674f1) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211729 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
225 lines
8.2 KiB
C++
225 lines
8.2 KiB
C++
/* -*- 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 .
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <memory>
|
|
#include <svx/svdorect.hxx>
|
|
#include <svx/svxdllapi.h>
|
|
#include <sfx2/lnkbase.hxx>
|
|
|
|
#include <com/sun/star/beans/PropertyValue.hpp>
|
|
#include <com/sun/star/uno/Reference.h>
|
|
|
|
namespace com::sun::star {
|
|
|
|
namespace awt { class XWindow; }
|
|
|
|
namespace embed { class XEmbeddedObject; }
|
|
|
|
namespace frame { class XModel; }
|
|
|
|
namespace io { class XInputStream; }
|
|
}
|
|
|
|
namespace svt { class EmbeddedObjectRef; }
|
|
|
|
class SdrOle2ObjImpl;
|
|
class SvxOle2Shape;
|
|
|
|
class SVXCORE_DLLPUBLIC SdrOle2Obj : public SdrRectObj
|
|
{
|
|
std::unique_ptr<SdrOle2ObjImpl> mpImpl;
|
|
|
|
SVX_DLLPRIVATE void Connect_Impl(SvxOle2Shape* pCreator = nullptr);
|
|
SVX_DLLPRIVATE void Disconnect_Impl();
|
|
SVX_DLLPRIVATE void AddListeners_Impl();
|
|
SVX_DLLPRIVATE void RemoveListeners_Impl();
|
|
SVX_DLLPRIVATE void GetObjRef_Impl();
|
|
|
|
// #i118485# helper added
|
|
SVX_DLLPRIVATE rtl::Reference<SdrObject> createSdrGrafObjReplacement(bool bAddText) const;
|
|
SVX_DLLPRIVATE void ImpSetVisAreaSize();
|
|
|
|
SVX_DLLPRIVATE void Init();
|
|
|
|
virtual rtl::Reference<SdrObject> implCloneSdrObject(SdrModel& rTargetModel) const override;
|
|
|
|
protected:
|
|
virtual std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact() override;
|
|
virtual std::unique_ptr<sdr::properties::BaseProperties> CreateObjectSpecificProperties() override;
|
|
|
|
// protected destructor
|
|
virtual ~SdrOle2Obj() override;
|
|
|
|
public:
|
|
OUString GetStyleString();
|
|
|
|
SdrOle2Obj(
|
|
SdrModel& rSdrModel,
|
|
bool bFrame_ = false);
|
|
// Copy constructor
|
|
SdrOle2Obj(SdrModel& rSdrModel, SdrOle2Obj const & rSource);
|
|
SdrOle2Obj(
|
|
SdrModel& rSdrModel,
|
|
const svt::EmbeddedObjectRef& rNewObjRef,
|
|
const OUString& rNewObjName,
|
|
const tools::Rectangle& rNewRect);
|
|
|
|
const svt::EmbeddedObjectRef& getEmbeddedObjectRef() const;
|
|
|
|
sal_Int64 GetAspect() const;
|
|
bool isInplaceActive() const;
|
|
bool isUiActive() const;
|
|
void SetAspect( sal_Int64 nAspect );
|
|
|
|
// An OLE graphic object can contain a StarView graphic,
|
|
// which will be displayed if the OLE object is empty.
|
|
void SetGraphic(const Graphic& rGrf);
|
|
void ClearGraphic();
|
|
const Graphic* GetGraphic() const;
|
|
void GetNewReplacement();
|
|
|
|
// The original size of the object (size of the icon for iconified object)
|
|
// no conversion is done if no target mode is provided
|
|
Size GetOrigObjSize( MapMode const * pTargetMapMode = nullptr ) const;
|
|
|
|
// #i118524# Allow suppress SetVisAreaSize in changing methods when call
|
|
// comes from OLE client
|
|
void setSuppressSetVisAreaSize( bool bNew );
|
|
|
|
// OLE object has got a separate PersistName member now;
|
|
// !!! use ::SetPersistName( ... ) only, if you know what you do !!!
|
|
const OUString& GetPersistName() const;
|
|
void SetPersistName( const OUString& rPersistName, SvxOle2Shape* pCreator = nullptr );
|
|
|
|
// One can add an application name to a SdrOle2Obj, which can be queried for
|
|
// later on (SD needs this for presentation objects).
|
|
void SetProgName( const OUString& rName );
|
|
const OUString& GetProgName() const;
|
|
bool IsEmpty() const;
|
|
|
|
void SetObjRef(const css::uno::Reference < css::embed::XEmbeddedObject >& rNewObjRef);
|
|
css::uno::Reference < css::embed::XEmbeddedObject > const & GetObjRef() const;
|
|
|
|
SVX_DLLPRIVATE css::uno::Reference < css::embed::XEmbeddedObject > const & GetObjRef_NoInit() const;
|
|
|
|
void AbandonObject();
|
|
|
|
// react on model/page change
|
|
virtual void handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage) override;
|
|
|
|
/** Change the IsClosedObj attribute
|
|
|
|
@param bIsClosed
|
|
Whether the OLE object is closed, i.e. has opaque background
|
|
*/
|
|
void SetClosedObj( bool bIsClosed );
|
|
|
|
// FullDrag support
|
|
virtual rtl::Reference<SdrObject> getFullDragClone() const override;
|
|
|
|
virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override;
|
|
virtual SdrObjKind GetObjIdentifier() const override;
|
|
virtual OUString TakeObjNameSingul() const override;
|
|
virtual OUString TakeObjNamePlural() const override;
|
|
|
|
virtual void NbcMove(const Size& rSize) override;
|
|
virtual void NbcResize(const Point& rRef, double xFact, double yFact) override;
|
|
virtual void NbcSetSnapRect(const tools::Rectangle& rRect) override;
|
|
virtual void NbcSetLogicRect(const tools::Rectangle& rRect, bool bAdaptTextMinSize = true) override;
|
|
virtual void SetGeoData(const SdrObjGeoData& rGeo) override;
|
|
|
|
static bool CanUnloadRunningObj( const css::uno::Reference< css::embed::XEmbeddedObject >& xObj,
|
|
sal_Int64 nAspect );
|
|
static bool Unload( const css::uno::Reference< css::embed::XEmbeddedObject >& xObj, sal_Int64 nAspect );
|
|
bool Unload();
|
|
void Connect(SvxOle2Shape* pCreator = nullptr);
|
|
void Disconnect();
|
|
void ObjectLoaded();
|
|
|
|
css::uno::Reference< css::frame::XModel > getXModel() const;
|
|
|
|
bool IsChart() const;
|
|
bool IsCalc() const;
|
|
|
|
bool UpdateLinkURL_Impl();
|
|
void BreakFileLink_Impl();
|
|
void DisconnectFileLink_Impl();
|
|
void CheckFileLink_Impl();
|
|
|
|
// Register a deferred link during import when the document has not yet
|
|
// prompted the user about link updates. The actual embedded object will be
|
|
// created when the user confirms via UpdateAllLinks
|
|
void SetDeferredLink(const OUString& rLinkURL,
|
|
const css::uno::Sequence<css::beans::PropertyValue>& rMediaDescriptor);
|
|
bool CompleteDeferredLink();
|
|
bool HasDeferredLink() const;
|
|
|
|
void SyncObjVisualArea(const css::uno::Reference<css::embed::XEmbeddedObject>& xObj);
|
|
|
|
// allows to transfer the graphics to the object helper
|
|
void SetGraphicToObj( const Graphic& aGraphic );
|
|
void SetGraphicToObj( const css::uno::Reference< css::io::XInputStream >& xGrStream,
|
|
const OUString& aMediaType );
|
|
|
|
const css::uno::Reference< css::frame::XModel > & GetParentXModel() const;
|
|
bool CalculateNewScaling( double& aScaleWidth, double& aScaleHeight, Size& aObjAreaSize );
|
|
bool AddOwnLightClient();
|
|
|
|
// handy to get the empty replacement graphic without accessing all the old stuff
|
|
static Graphic GetEmptyOLEReplacementGraphic();
|
|
|
|
void SetWindow(const css::uno::Reference < css::awt::XWindow >& _xWindow);
|
|
|
|
// #i118485# missing converter added
|
|
virtual rtl::Reference<SdrObject> DoConvertToPolyObj(bool bBezier, bool bAddText) const override;
|
|
|
|
virtual bool IsSdrOle2Obj() const final { return true; }
|
|
|
|
void SetIgnoreOLEObjectScale(bool val);
|
|
};
|
|
|
|
class SVXCORE_DLLPUBLIC SdrEmbedObjectLink final : public sfx2::SvBaseLink
|
|
{
|
|
SdrOle2Obj* m_pObj;
|
|
|
|
public:
|
|
SAL_DLLPRIVATE explicit SdrEmbedObjectLink(SdrOle2Obj* pObj);
|
|
SAL_DLLPRIVATE virtual ~SdrEmbedObjectLink() override;
|
|
|
|
SAL_DLLPRIVATE virtual void Closed() override;
|
|
SAL_DLLPRIVATE virtual ::sfx2::SvBaseLink::UpdateResult DataChanged(
|
|
const OUString& rMimeType, const css::uno::Any & rValue ) override;
|
|
|
|
void Connect() { GetRealObject(); }
|
|
};
|
|
|
|
class SVXCORE_DLLPUBLIC SdrIFrameLink final : public sfx2::SvBaseLink
|
|
{
|
|
SdrOle2Obj* m_pObject;
|
|
|
|
public:
|
|
explicit SdrIFrameLink(SdrOle2Obj* pObject);
|
|
virtual ::sfx2::SvBaseLink::UpdateResult DataChanged(
|
|
const OUString& rMimeType, const css::uno::Any & rValue ) override;
|
|
};
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|