From dcc92a7cb5aa1faa711c8da7f7d8ecee0a192c25 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Fri, 16 Sep 2016 12:38:31 +0200 Subject: sfx2: add SfxLokHelper::getViewIds and also expose it in the LOK API. This way clients don't have to keep track of what views they created / destroyed, they can also get an up to date list with this method. Change-Id: Ibaee42c545803e04a31e7c13ab6ec370b99465c4 --- sfx2/source/view/lokhelper.cxx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'sfx2') diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx index 5769127c299d..619e48e61d22 100644 --- a/sfx2/source/view/lokhelper.cxx +++ b/sfx2/source/view/lokhelper.cxx @@ -94,6 +94,20 @@ std::size_t SfxLokHelper::getViewsCount() return rViewArr.size(); } +bool SfxLokHelper::getViewIds(int* pArray, size_t nSize) +{ + SfxViewShellArr_Impl& rViewArr = SfxGetpApp()->GetViewShells_Impl(); + if (rViewArr.size() > nSize) + return false; + + for (std::size_t i = 0; i < rViewArr.size(); ++i) + { + SfxViewShell* pViewShell = rViewArr[i]; + pArray[i] = pViewShell->GetViewShellId(); + } + return true; +} + void SfxLokHelper::notifyOtherView(SfxViewShell* pThisView, SfxViewShell* pOtherView, int nType, const OString& rKey, const OString& rPayload) { boost::property_tree::ptree aTree; -- cgit