Kaydet (Commit) ed43afc3 authored tarafından Armin Le Grand's avatar Armin Le Grand Kaydeden (comit) Thorsten Behrens

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
üst 797db46a
......@@ -49,6 +49,10 @@ public:
void SetViewWindow( vcl::Window* pWindow ) { mpViewWindow = pWindow; }
vcl::Window* GetViewWindow() const { return mpViewWindow; }
void SetViewAlign( WindowAlign eAlign ) { meViewAlign = eAlign; }
// Screenshot interface
virtual std::vector<OString> getAllPageUIXMLDescriptions() const;
virtual bool selectPageByUIXMLDescription(const OString& rUIXMLDescription);
};
#endif // INCLUDED_VCL_TABDLG_HXX
......
......@@ -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();
}
......
......@@ -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: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment