diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-09-16 09:30:41 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-10-06 16:24:11 +0200 |
commit | 470db78ef09351db67fc22c70c5dd4b98bc43a14 (patch) | |
tree | 4846ceb384427d7acc2fda4fe74f5ed89eb42477 /sfx2/source/view | |
parent | a0b7695a88ee54595880582dd0a17a0a38bb9a78 (diff) |
lok::Document: add get/setView()
Change-Id: Ic3bce8f01d7e048e853c063c4bce1255845c60d0
(cherry picked from commit 46588c42a546d4517b773853856b9c8f8c2e5ece)
Diffstat (limited to 'sfx2/source/view')
-rw-r--r-- | sfx2/source/view/lokhelper.cxx | 24 |
1 files changed, 24 insertions, 0 deletions
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(); |