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:
committed by
Thorsten Behrens
parent
b85600c9d4
commit
2bc4917a9b
@@ -51,8 +51,8 @@ public:
|
|||||||
void SetViewAlign( WindowAlign eAlign ) { meViewAlign = eAlign; }
|
void SetViewAlign( WindowAlign eAlign ) { meViewAlign = eAlign; }
|
||||||
|
|
||||||
// Screenshot interface
|
// Screenshot interface
|
||||||
virtual std::vector<OString> getAllPageUIXMLDescriptions() const;
|
virtual std::vector<OString> getAllPageUIXMLDescriptions() const override;
|
||||||
virtual bool selectPageByUIXMLDescription(const OString& rUIXMLDescription);
|
virtual bool selectPageByUIXMLDescription(const OString& rUIXMLDescription) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INCLUDED_VCL_TABDLG_HXX
|
#endif // INCLUDED_VCL_TABDLG_HXX
|
||||||
|
@@ -65,10 +65,10 @@ public: \
|
|||||||
{} \
|
{} \
|
||||||
virtual ~Class(); \
|
virtual ~Class(); \
|
||||||
virtual short Execute() override ; \
|
virtual short Execute() override ; \
|
||||||
std::vector<OString> getAllPageUIXMLDescriptions() const; \
|
std::vector<OString> getAllPageUIXMLDescriptions() const override; \
|
||||||
bool selectPageByUIXMLDescription(const OString& rUIXMLDescription) override; \
|
bool selectPageByUIXMLDescription(const OString& rUIXMLDescription) override; \
|
||||||
virtual Bitmap createScreenshot() const override; \
|
virtual Bitmap createScreenshot() const override; \
|
||||||
virtual OString GetScreenshotId() const; \
|
virtual OString GetScreenshotId() const override; \
|
||||||
|
|
||||||
#define DECL_ABSTDLG2_BASE(Class,DialogClass) \
|
#define DECL_ABSTDLG2_BASE(Class,DialogClass) \
|
||||||
ScopedVclPtr<DialogClass> pDlg; \
|
ScopedVclPtr<DialogClass> pDlg; \
|
||||||
|
@@ -32,7 +32,7 @@ public: \
|
|||||||
virtual std::vector<OString> getAllPageUIXMLDescriptions() const override; \
|
virtual std::vector<OString> getAllPageUIXMLDescriptions() const override; \
|
||||||
virtual bool selectPageByUIXMLDescription(const OString& rUIXMLDescription) override; \
|
virtual bool selectPageByUIXMLDescription(const OString& rUIXMLDescription) override; \
|
||||||
virtual Bitmap createScreenshot() const override; \
|
virtual Bitmap createScreenshot() const override; \
|
||||||
virtual OString GetScreenshotId() const; \
|
virtual OString GetScreenshotId() const override; \
|
||||||
virtual ~Class(); \
|
virtual ~Class(); \
|
||||||
virtual short Execute() override ;
|
virtual short Execute() override ;
|
||||||
|
|
||||||
|
@@ -131,7 +131,7 @@ void ScreenshotTest::dumpDialogToPath(VclAbstractDialog& rDialog)
|
|||||||
|
|
||||||
if (aPageDescriptions.size())
|
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]))
|
if (rDialog.selectPageByUIXMLDescription(aPageDescriptions[a]))
|
||||||
{
|
{
|
||||||
@@ -155,7 +155,7 @@ void ScreenshotTest::dumpDialogToPath(Dialog& rDialog)
|
|||||||
|
|
||||||
if (aPageDescriptions.size())
|
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]))
|
if (rDialog.selectPageByUIXMLDescription(aPageDescriptions[a]))
|
||||||
{
|
{
|
||||||
|
@@ -290,12 +290,32 @@ std::vector<OString> TabDialog::getAllPageUIXMLDescriptions() const
|
|||||||
|
|
||||||
if (pCandidate)
|
if (pCandidate)
|
||||||
{
|
{
|
||||||
// use UIXMLDescription (without '.ui', with '/')
|
OString aNewName(pCandidate->getUIFile());
|
||||||
// aRetval.push_back(pCandidate->getUIFile());
|
|
||||||
|
|
||||||
// for now, directly use nPageID since we had a case where
|
if (!aNewName.isEmpty())
|
||||||
// two TabPages had the same ui file (HeaderFooterDialog)
|
{
|
||||||
aRetval.push_back(OString::number(nPageId));
|
// 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)
|
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++)
|
for (sal_uInt16 a(0); a < pTabCtrl->GetPageCount(); a++)
|
||||||
{
|
{
|
||||||
const sal_uInt16 nPageId(pTabCtrl->GetPageId(a));
|
const sal_uInt16 nPageId(pTabCtrl->GetPageId(a));
|
||||||
@@ -320,17 +353,28 @@ bool TabDialog::selectPageByUIXMLDescription(const OString& rUIXMLDescription)
|
|||||||
|
|
||||||
if (pCandidate)
|
if (pCandidate)
|
||||||
{
|
{
|
||||||
// if (pCandidate->getUIFile() == rUIXMLDescription)
|
if (pCandidate->getUIFile() == aTargetName)
|
||||||
|
{
|
||||||
// for now, directly work with nPageID, see above. Will need to be
|
if (nTargetPageId)
|
||||||
// adapted to the schema later planned to be used in rUIXMLDescription
|
{
|
||||||
if (rUIXMLDescription.toUInt32() == nPageId)
|
// 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);
|
pTabCtrl->SelectTabPage(nPageId);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// select that tabPage
|
||||||
|
pTabCtrl->SelectTabPage(nPageId);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user