summaryrefslogtreecommitdiff
path: root/reportdesign
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-05-10 13:52:51 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-05-12 09:54:23 +0200
commita651dbcfca9e198b5c2561076961504586bc6bea (patch)
tree812eee16af9bc3c4c75b8b45a4c126f99ad1bab3 /reportdesign
parent9b5ce4023d35c4cc82f7b17e79b8fedbcb1367dd (diff)
convert SdrLayerId to strong_int
Also - rename SetOfByte to SdrLayerIDSet - add asserts in SdrLayerAdmin::GetUniqueLayerID so that we don't allocate overlapping SdrLayerID values - add a new constant SDRLAYERPOS_NOTFOUND to be returned from SdrLayerAdmin::GetLayerPos Change-Id: I3bb3489f9338e3d02c4040bcbd811744699941c8 Reviewed-on: https://gerrit.libreoffice.org/37467 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'reportdesign')
-rw-r--r--reportdesign/inc/RptDef.hxx6
-rw-r--r--reportdesign/source/core/api/ReportDefinition.cxx6
-rw-r--r--reportdesign/source/ui/inc/SectionView.hxx2
-rw-r--r--reportdesign/source/ui/report/ReportSection.cxx2
-rw-r--r--reportdesign/source/ui/report/SectionView.cxx9
5 files changed, 11 insertions, 14 deletions
diff --git a/reportdesign/inc/RptDef.hxx b/reportdesign/inc/RptDef.hxx
index 0007bedd9c1a..01cea68a878c 100644
--- a/reportdesign/inc/RptDef.hxx
+++ b/reportdesign/inc/RptDef.hxx
@@ -44,9 +44,9 @@ namespace com { namespace sun { namespace star {
namespace rptui
{
// not all used at the moment
-#define RPT_LAYER_FRONT 0
-#define RPT_LAYER_BACK 1
-#define RPT_LAYER_HIDDEN 2
+constexpr SdrLayerID RPT_LAYER_FRONT (0);
+constexpr SdrLayerID RPT_LAYER_BACK (1);
+constexpr SdrLayerID RPT_LAYER_HIDDEN (2);
diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx
index 620951d2088e..9f853f677626 100644
--- a/reportdesign/source/core/api/ReportDefinition.cxx
+++ b/reportdesign/source/core/api/ReportDefinition.cxx
@@ -590,9 +590,9 @@ void OReportDefinition::init()
m_pImpl->m_pReportModel->GetItemPool().FreezeIdRanges();
m_pImpl->m_pReportModel->SetScaleUnit( MapUnit::Map100thMM );
SdrLayerAdmin& rAdmin = m_pImpl->m_pReportModel->GetLayerAdmin();
- rAdmin.NewStandardLayer(RPT_LAYER_FRONT);
- rAdmin.NewLayer("back", RPT_LAYER_BACK);
- rAdmin.NewLayer("HiddenLayer", RPT_LAYER_HIDDEN);
+ rAdmin.NewStandardLayer(sal_uInt8(RPT_LAYER_FRONT));
+ rAdmin.NewLayer("back", sal_uInt8(RPT_LAYER_BACK));
+ rAdmin.NewLayer("HiddenLayer", sal_uInt8(RPT_LAYER_HIDDEN));
m_pImpl->m_pUndoManager = new ::dbaui::UndoManager( *this, m_aMutex );
m_pImpl->m_pReportModel->SetSdrUndoManager( &m_pImpl->m_pUndoManager->GetSfxUndoManager() );
diff --git a/reportdesign/source/ui/inc/SectionView.hxx b/reportdesign/source/ui/inc/SectionView.hxx
index 1035a8a7ef5f..c5c48661c059 100644
--- a/reportdesign/source/ui/inc/SectionView.hxx
+++ b/reportdesign/source/ui/inc/SectionView.hxx
@@ -59,7 +59,7 @@ public:
/* returns the common layer id of the marked objects, otherwise -1 will be returned.
*/
- short GetLayerIdOfMarkedObjects() const;
+ SdrLayerID GetLayerIdOfMarkedObjects() const;
// returns true if objects at Drag & Drop is resize not move
bool IsDragResize() const;
diff --git a/reportdesign/source/ui/report/ReportSection.cxx b/reportdesign/source/ui/report/ReportSection.cxx
index 580c228ccb56..88171c364b60 100644
--- a/reportdesign/source/ui/report/ReportSection.cxx
+++ b/reportdesign/source/ui/report/ReportSection.cxx
@@ -163,7 +163,7 @@ void OReportSection::Paint( vcl::RenderContext& rRenderContext, const tools::Rec
// do paint (unbuffered) and mark repaint end
if(pPgView)
{
- pPgView->DrawLayer(0, &rRenderContext);
+ pPgView->DrawLayer(RPT_LAYER_FRONT, &rRenderContext);
pPgView->GetView().EndDrawLayers(*pTargetPaintWindow, true);
}
diff --git a/reportdesign/source/ui/report/SectionView.cxx b/reportdesign/source/ui/report/SectionView.cxx
index 1c5ba21f4865..d94fe0deb51d 100644
--- a/reportdesign/source/ui/report/SectionView.cxx
+++ b/reportdesign/source/ui/report/SectionView.cxx
@@ -229,23 +229,20 @@ bool OSectionView::IsDragResize() const
}
-short OSectionView::GetLayerIdOfMarkedObjects() const
+SdrLayerID OSectionView::GetLayerIdOfMarkedObjects() const
{
- short nRet = SHRT_MAX;
+ SdrLayerID nRet = SDRLAYER_NOTFOUND;
const SdrMarkList &rMrkList = GetMarkedObjectList();
for ( size_t i = 0; i < rMrkList.GetMarkCount(); ++i )
{
const SdrObject *pObj = rMrkList.GetMark( i )->GetMarkedSdrObj();
- if ( nRet == SHRT_MAX )
+ if ( nRet == SDRLAYER_NOTFOUND )
nRet = pObj->GetLayer();
else if ( nRet != pObj->GetLayer() )
{
- nRet = -1;
break;
}
}
- if ( nRet == SHRT_MAX )
- nRet = -1;
return nRet;
}