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>
34 using ::com::sun::star::uno::Reference;
35 using ::com::sun::star::uno::WeakReference;
37 #define SC_CHARTLOCKTIMEOUT 660
42 std::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;
70 aRet.emplace_back(
xModel );
73 pObject = aIter.
Next();
84 maChartModels( lcl_getAllLivingCharts( pDoc ) )
92 xModel->lockControllers();
94 catch ( uno::Exception& )
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& )
177 mapScChartLockGuard.reset();
#define LINK(Instance, Class, Member)
#define SC_CHARTLOCKTIMEOUT
void AlsoLockThisChart(const css::uno::Reference< css::frame::XModel > &xModel)
Use this to lock all charts in the calc for a little time.
std::vector< css::uno::WeakReference< css::frame::XModel > > maChartModels
EmbeddedObjectRef * pObject
void StartOrContinueLocking()
void AlsoLockThisChart(const css::uno::Reference< css::frame::XModel > &xModel)
IMPL_LINK_NOARG(ScTemporaryChartLock, TimeoutHdl, Timer *, void)
SC_DLLPUBLIC bool HasTable(SCTAB nTab) const
SCTAB GetMaxTableNumber() const
All current charts in the calc will be locked in constructor and unlocked in destructor.
SC_DLLPUBLIC ScDrawLayer * GetDrawLayer()
#define TOOLS_WARN_EXCEPTION(area, stream)
const SdrPage * GetPage(sal_uInt16 nPgNum) const
ScChartLockGuard(ScDocument *pDoc)
virtual void Start() override
void SetTimeout(sal_uInt64 nTimeoutMs)
ScTemporaryChartLock(ScDocument *pDoc)
std::unique_ptr< ScChartLockGuard > mapScChartLockGuard
void SetInvokeHandler(const Link< Timer *, void > &rLink)
static bool IsChart(const SdrObject *pObject)
Reference< XModel > xModel