diff options
author | Armin Le Grand <Armin.Le.Grand@cib.de> | 2016-06-15 17:59:54 +0200 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2016-08-18 02:39:08 +0200 |
commit | ed43afc3a7d7f8ceadb01827b2c67f793cddd7bb (patch) | |
tree | bbc91c27f3dccd5214bd3d1806d0a3a3776b821a /vcl | |
parent | 797db46a892eda18ca9b76f96e091c13211f1a33 (diff) |
screenshots: added support for minimal Screenshot ifc
For simple TabDialogs with minimal interface. That works, but found out
that for SD it's using a TabDialog with two TabPages with the same *.ui
file. To avoid problems for now, adapted to use PageIDs again, marked in
the code as to-be-changed.
Change-Id: I30af6367f4d3c1e9097b1fe3d2b230ab4eab5ed7
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/app/settings.cxx | 2 | ||||
-rw-r--r-- | vcl/source/window/tabdlg.cxx | 94 |
2 files changed, 96 insertions, 0 deletions
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index c57465d04c0e..5b1bf9aee543 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -2374,6 +2374,8 @@ ImplMiscData::ImplMiscData() static const char* pEnv = getenv("SAL_DECIMALSEP_ENABLED" ); // set default without UI mbEnableLocalizedDecimalSep = (pEnv != nullptr); // Should we display any windows? + + // need to hardly mask here for now, needs to be adapted of course... mbPseudoHeadless = false; // getenv("VCL_HIDE_WINDOWS") || comphelper::LibreOfficeKit::isActive(); } diff --git a/vcl/source/window/tabdlg.cxx b/vcl/source/window/tabdlg.cxx index 3e8531b43cc2..868eb3f7e77f 100644 --- a/vcl/source/window/tabdlg.cxx +++ b/vcl/source/window/tabdlg.cxx @@ -242,4 +242,98 @@ void TabDialog::StateChanged( StateChangedType nType ) Dialog::StateChanged( nType ); } +vcl::Window* findTabControl(vcl::Window* pCurrent) +{ + if (!pCurrent) + { + return nullptr; + } + + if (pCurrent->GetType() == WINDOW_TABCONTROL) + { + return pCurrent; + } + + vcl::Window* pChild = pCurrent->GetWindow(GetWindowType::FirstChild); + + while (pChild) + { + + vcl::Window* pInorderChild = findTabControl(pChild); + + if (pInorderChild) + { + return pInorderChild; + } + + pChild = pChild->GetWindow(GetWindowType::Next); + } +} + +std::vector<OString> TabDialog::getAllPageUIXMLDescriptions() const +{ + std::vector<OString> aRetval; + + const TabControl* pTabCtrl = dynamic_cast<TabControl*>(findTabControl(const_cast<TabDialog*>(this))); + + if (pTabCtrl) + { + for (sal_uInt16 a(0); a < pTabCtrl->GetPageCount(); a++) + { + const sal_uInt16 nPageId(pTabCtrl->GetPageId(a)); + + if (TAB_PAGE_NOTFOUND != nPageId) + { + TabPage* pCandidate = pTabCtrl->GetTabPage(nPageId); + + if (pCandidate) + { + // use UIXMLDescription (without '.ui', with '/') + // aRetval.push_back(pCandidate->getUIFile()); + + // for now, directly use nPageID since we had a case where + // two TabPages had the same ui file (HeaderFooterDialog) + aRetval.push_back(OString::number(nPageId)); + } + } + } + } + + return aRetval; +} + +bool TabDialog::selectPageByUIXMLDescription(const OString& rUIXMLDescription) +{ + TabControl* pTabCtrl = dynamic_cast<TabControl*>(findTabControl(const_cast<TabDialog*>(this))); + + if (pTabCtrl) + { + for (sal_uInt16 a(0); a < pTabCtrl->GetPageCount(); a++) + { + const sal_uInt16 nPageId(pTabCtrl->GetPageId(a)); + + if (TAB_PAGE_NOTFOUND != nPageId) + { + TabPage* pCandidate = pTabCtrl->GetTabPage(nPageId); + + if (pCandidate) + { + // if (pCandidate->getUIFile() == rUIXMLDescription) + + // for now, directly work with nPageID, see above. Will need to be + // adapted to the schema later planned to be used in rUIXMLDescription + if (rUIXMLDescription.toUInt32() == nPageId) + { + pTabCtrl->SelectTabPage(nPageId); + + return true; + } + } + } + } + } + + return false; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |