screenshots: clang plugin & tabpage usage fixes
Adapted clang compiler results, made TabDialog implementaions of ScreenShot API work with real UXMLDescription names, including a solution for using multiple tabPages with the same *.ui file Change-Id: I56df878b3db3bcc18fa2b4713b7ad72d42e8eb30
This commit is contained in:
parent
b85600c9d4
commit
2bc4917a9b
@ -51,8 +51,8 @@ public:
|
||||
void SetViewAlign( WindowAlign eAlign ) { meViewAlign = eAlign; }
|
||||
|
||||
// Screenshot interface
|
||||
virtual std::vector<OString> getAllPageUIXMLDescriptions() const;
|
||||
virtual bool selectPageByUIXMLDescription(const OString& rUIXMLDescription);
|
||||
virtual std::vector<OString> getAllPageUIXMLDescriptions() const override;
|
||||
virtual bool selectPageByUIXMLDescription(const OString& rUIXMLDescription) override;
|
||||
};
|
||||
|
||||
#endif // INCLUDED_VCL_TABDLG_HXX
|
||||
|
@ -65,10 +65,10 @@ public: \
|
||||
{} \
|
||||
virtual ~Class(); \
|
||||
virtual short Execute() override ; \
|
||||
std::vector<OString> getAllPageUIXMLDescriptions() const; \
|
||||
std::vector<OString> getAllPageUIXMLDescriptions() const override; \
|
||||
bool selectPageByUIXMLDescription(const OString& rUIXMLDescription) override; \
|
||||
virtual Bitmap createScreenshot() const override; \
|
||||
virtual OString GetScreenshotId() const; \
|
||||
virtual OString GetScreenshotId() const override; \
|
||||
|
||||
#define DECL_ABSTDLG2_BASE(Class,DialogClass) \
|
||||
ScopedVclPtr<DialogClass> pDlg; \
|
||||
|
@ -32,7 +32,7 @@ public: \
|
||||
virtual std::vector<OString> getAllPageUIXMLDescriptions() const override; \
|
||||
virtual bool selectPageByUIXMLDescription(const OString& rUIXMLDescription) override; \
|
||||
virtual Bitmap createScreenshot() const override; \
|
||||
virtual OString GetScreenshotId() const; \
|
||||
virtual OString GetScreenshotId() const override; \
|
||||
virtual ~Class(); \
|
||||
virtual short Execute() override ;
|
||||
|
||||
|
@ -131,7 +131,7 @@ void ScreenshotTest::dumpDialogToPath(VclAbstractDialog& rDialog)
|
||||
|
||||
if (aPageDescriptions.size())
|
||||
{
|
||||
for (sal_uInt32 a(0); a < aPageDescriptions.size(); a++)
|
||||
for (size_t a(0); a < aPageDescriptions.size(); a++)
|
||||
{
|
||||
if (rDialog.selectPageByUIXMLDescription(aPageDescriptions[a]))
|
||||
{
|
||||
@ -155,7 +155,7 @@ void ScreenshotTest::dumpDialogToPath(Dialog& rDialog)
|
||||
|
||||
if (aPageDescriptions.size())
|
||||
{
|
||||
for (sal_uInt32 a(0); a < aPageDescriptions.size(); a++)
|
||||
for (size_t a(0); a < aPageDescriptions.size(); a++)
|
||||
{
|
||||
if (rDialog.selectPageByUIXMLDescription(aPageDescriptions[a]))
|
||||
{
|
||||
|
@ -290,12 +290,32 @@ std::vector<OString> TabDialog::getAllPageUIXMLDescriptions() const
|
||||
|
||||
if (pCandidate)
|
||||
{
|
||||
// use UIXMLDescription (without '.ui', with '/')
|
||||
// aRetval.push_back(pCandidate->getUIFile());
|
||||
OString aNewName(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));
|
||||
if (!aNewName.isEmpty())
|
||||
{
|
||||
// we have to check for double entries, this may happen e.g.
|
||||
// in the HeaderFooterDialog which has two times the same
|
||||
// tabPage added. Add the PageID as hint to the name, separated
|
||||
// by a token (using "|" here). Do not do this for 1st ocurrence,
|
||||
// that is used for detection and is not necessary.
|
||||
// Use the UIXMLDescription without trailing '.ui', with one trailing '/'
|
||||
bool bAlreadyAdded(false);
|
||||
|
||||
for (auto i = aRetval.begin(); !bAlreadyAdded && i != aRetval.end(); i++)
|
||||
{
|
||||
bAlreadyAdded = (*i == aNewName);
|
||||
}
|
||||
|
||||
if (bAlreadyAdded)
|
||||
{
|
||||
// add the PageId to be able to detect the correct tabPage in
|
||||
// selectPageByUIXMLDescription below
|
||||
aNewName = aNewName + "|" + OString::number(nPageId);
|
||||
}
|
||||
|
||||
aRetval.push_back(aNewName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -310,6 +330,19 @@ bool TabDialog::selectPageByUIXMLDescription(const OString& rUIXMLDescription)
|
||||
|
||||
if (pTabCtrl)
|
||||
{
|
||||
sal_uInt32 nTargetPageId(0);
|
||||
OString aTargetName(rUIXMLDescription);
|
||||
const sal_Int32 nIndexOfSeparator(rUIXMLDescription.indexOf("|"));
|
||||
|
||||
if (-1 != nIndexOfSeparator)
|
||||
{
|
||||
// more than one tabPage with that UXMLDescription is added to this dialog,
|
||||
// see getAllPageUIXMLDescriptions() above. Extract target PageId and
|
||||
// strip the UXMLDescription name for comparison
|
||||
nTargetPageId = rUIXMLDescription.copy(nIndexOfSeparator + 1).toUInt32();
|
||||
aTargetName = rUIXMLDescription.copy(0, nIndexOfSeparator);
|
||||
}
|
||||
|
||||
for (sal_uInt16 a(0); a < pTabCtrl->GetPageCount(); a++)
|
||||
{
|
||||
const sal_uInt16 nPageId(pTabCtrl->GetPageId(a));
|
||||
@ -320,15 +353,26 @@ bool TabDialog::selectPageByUIXMLDescription(const OString& rUIXMLDescription)
|
||||
|
||||
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)
|
||||
if (pCandidate->getUIFile() == aTargetName)
|
||||
{
|
||||
pTabCtrl->SelectTabPage(nPageId);
|
||||
|
||||
return true;
|
||||
if (nTargetPageId)
|
||||
{
|
||||
// when multiple versions may exist, name is not sufficient. Also
|
||||
// check for the given PageId to select the correct tabPage
|
||||
// for cases where the same TabPage is used more than once
|
||||
// in a tabDialog (e.g. HeaderFooterDialog)
|
||||
if (nTargetPageId == nPageId)
|
||||
{
|
||||
pTabCtrl->SelectTabPage(nPageId);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// select that tabPage
|
||||
pTabCtrl->SelectTabPage(nPageId);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user