26#include <document.hxx>
29#include <com/sun/star/embed/XEmbeddedObject.hpp>
30#include <com/sun/star/embed/XComponentSupplier.hpp>
31#include <com/sun/star/frame/XModel.hpp>
34using ::com::sun::star::uno::Reference;
35using ::com::sun::star::uno::WeakReference;
37#define SC_CHARTLOCKTIMEOUT 660
42std::vector< WeakReference< frame::XModel > > lcl_getAllLivingCharts(
ScDocument* pDoc )
44 std::vector< WeakReference< frame::XModel > > aRet;
55 SdrPage* pPage = pDrawLayer->
GetPage(
static_cast<sal_uInt16
>(nTab));
56 OSL_ENSURE(pPage,
"Page ?");
64 uno::Reference< embed::XEmbeddedObject > xIPObj =
static_cast<SdrOle2Obj*
>(
pObject)->GetObjRef();
65 uno::Reference< embed::XComponentSupplier > xCompSupp = xIPObj;
68 Reference< frame::XModel >
xModel( xCompSupp->getComponent(), uno::UNO_QUERY );
70 aRet.emplace_back(
xModel );
84 maChartModels( lcl_getAllLivingCharts( pDoc ) )
90 Reference< frame::XModel >
xModel( rxChartModel );
94 catch ( uno::Exception& )
107 Reference< frame::XModel >
xModel( rxChartModel );
109 xModel->unlockControllers();
111 catch ( uno::Exception& )
123 WeakReference< frame::XModel > xWeakModel(
xModel);
125 std::vector< WeakReference< frame::XModel > >::iterator aFindIter(
132 xModel->lockControllers();
135 catch ( uno::Exception& )
144 mpDoc( pDocP ), maTimer(
"ScTemporaryChartLock maTimer")
177 mapScChartLockGuard.reset();
#define SC_CHARTLOCKTIMEOUT
IMPL_LINK_NOARG(ScTemporaryChartLock, TimeoutHdl, Timer *, void)
All current charts in the calc will be locked in constructor and unlocked in destructor.
void AlsoLockThisChart(const css::uno::Reference< css::frame::XModel > &xModel)
ScChartLockGuard(ScDocument *pDoc)
std::vector< css::uno::WeakReference< css::frame::XModel > > maChartModels
SC_DLLPUBLIC ScDrawLayer * GetDrawLayer()
static bool IsChart(const SdrObject *pObject)
SCTAB GetMaxTableNumber() const
SC_DLLPUBLIC bool HasTable(SCTAB nTab) const
Use this to lock all charts in the calc for a little time.
void StartOrContinueLocking()
void AlsoLockThisChart(const css::uno::Reference< css::frame::XModel > &xModel)
ScTemporaryChartLock(ScDocument *pDoc)
std::unique_ptr< ScChartLockGuard > mapScChartLockGuard
const SdrPage * GetPage(sal_uInt16 nPgNum) const
void SetTimeout(sal_uInt64 nTimeoutMs)
void SetInvokeHandler(const Link< Timer *, void > &rLink)
virtual void Start(bool bStartTimer=true) override
#define TOOLS_WARN_EXCEPTION(area, stream)
EmbeddedObjectRef * pObject
#define LINK(Instance, Class, Member)
Reference< XModel > xModel