From 470db78ef09351db67fc22c70c5dd4b98bc43a14 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Wed, 16 Sep 2015 09:30:41 +0200 Subject: lok::Document: add get/setView() Change-Id: Ic3bce8f01d7e048e853c063c4bce1255845c60d0 (cherry picked from commit 46588c42a546d4517b773853856b9c8f8c2e5ece) --- sfx2/source/view/lokhelper.cxx | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'sfx2/source') diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx index 557478a78ae6..0aea6db9c24e 100644 --- a/sfx2/source/view/lokhelper.cxx +++ b/sfx2/source/view/lokhelper.cxx @@ -38,6 +38,30 @@ void SfxLokHelper::destroyView(size_t nId) pViewFrame->Exec_Impl(aRequest); } +void SfxLokHelper::setView(size_t nId) +{ + SfxViewShellArr_Impl& rViewArr = SfxGetpApp()->GetViewShells_Impl(); + if (nId > rViewArr.size() - 1) + return; + + SfxViewShell* pViewShell = rViewArr[nId]; + if (SfxViewFrame* pViewFrame = pViewShell->GetViewFrame()) + pViewFrame->GetWindow().GrabFocus(); +} + +size_t SfxLokHelper::getView() +{ + SfxViewShellArr_Impl& rViewArr = SfxGetpApp()->GetViewShells_Impl(); + SfxViewFrame* pViewFrame = SfxViewFrame::Current(); + for (size_t i = 0; i < rViewArr.size(); ++i) + { + if (rViewArr[i]->GetViewFrame() == pViewFrame) + return i; + } + assert(false); + return 0; +} + int SfxLokHelper::getViews() { SfxViewShellArr_Impl& rViewArr = SfxGetpApp()->GetViewShells_Impl(); -- cgit v1.2.3