summaryrefslogtreecommitdiff
path: root/sw
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 /sw
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 'sw')
-rw-r--r--sw/inc/fesh.hxx2
-rw-r--r--sw/source/core/draw/dview.cxx2
-rw-r--r--sw/source/core/frmedt/feshview.cxx33
-rw-r--r--sw/source/core/inc/UndoInsert.hxx5
-rw-r--r--sw/source/core/inc/dview.hxx2
-rw-r--r--sw/source/core/layout/fly.cxx4
-rw-r--r--sw/source/core/text/txtfly.cxx4
-rw-r--r--sw/source/core/undo/unins.cxx2
-rw-r--r--sw/source/core/unocore/unodraw.cxx6
-rw-r--r--sw/source/filter/ww8/writerhelper.hxx3
-rw-r--r--sw/source/uibase/shells/drawsh.cxx6
-rw-r--r--sw/source/uibase/shells/drwbassh.cxx2
12 files changed, 38 insertions, 33 deletions
diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx
index 295b0bb95961..cb7d75a1b827 100644
--- a/sw/inc/fesh.hxx
+++ b/sw/inc/fesh.hxx
@@ -278,7 +278,7 @@ public:
void SelectionToTop ( bool bTop = true );
void SelectionToBottom( bool bBottom = true );
- short GetLayerId() const; ///< 1 Heaven, 0 Hell, -1 Ambiguous.
+ SdrLayerID GetLayerId() const; ///< 1 Heaven, 0 Hell, SDRLAYER_NOTFOUND Ambiguous.
void SelectionToHeaven(); ///< Above document.
void SelectionToHell(); ///< Below document.
diff --git a/sw/source/core/draw/dview.cxx b/sw/source/core/draw/dview.cxx
index 94192f51b299..d1ba6086d476 100644
--- a/sw/source/core/draw/dview.cxx
+++ b/sw/source/core/draw/dview.cxx
@@ -186,7 +186,7 @@ SdrObject* impLocalHitCorrection(SdrObject* pRetval, const Point& rPnt, sal_uInt
return pRetval;
}
-SdrObject* SwDrawView::CheckSingleSdrObjectHit(const Point& rPnt, sal_uInt16 nTol, SdrObject* pObj, SdrPageView* pPV, SdrSearchOptions nOptions, const SetOfByte* pMVisLay) const
+SdrObject* SwDrawView::CheckSingleSdrObjectHit(const Point& rPnt, sal_uInt16 nTol, SdrObject* pObj, SdrPageView* pPV, SdrSearchOptions nOptions, const SdrLayerIDSet* pMVisLay) const
{
// call parent
SdrObject* pRetval = FmFormView::CheckSingleSdrObjectHit(rPnt, nTol, pObj, pPV, nOptions, pMVisLay);
diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx
index 06963f3b1b50..edf4cb9dff26 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -1062,29 +1062,26 @@ void SwFEShell::SelectionToBottom( bool bBottom )
}
// Object above/below the document? 2 Controls, 1 Heaven, 0 Hell,
-// -1 Ambiguous
-short SwFEShell::GetLayerId() const
+// SDRLAYER_NOTFOUND Ambiguous
+SdrLayerID SwFEShell::GetLayerId() const
{
- short nRet = SHRT_MAX;
- if ( Imp()->HasDrawView() )
+ if ( !Imp()->HasDrawView() )
+ return SDRLAYER_NOTFOUND;
+
+ SdrLayerID nRet = SDRLAYER_NOTFOUND;
+ const SdrMarkList &rMrkList = Imp()->GetDrawView()->GetMarkedObjectList();
+ for ( size_t i = 0; i < rMrkList.GetMarkCount(); ++i )
{
- const SdrMarkList &rMrkList = Imp()->GetDrawView()->GetMarkedObjectList();
- for ( size_t i = 0; i < rMrkList.GetMarkCount(); ++i )
+ const SdrObject *pObj = rMrkList.GetMark( i )->GetMarkedSdrObj();
+ if( !pObj )
+ continue;
+ if ( nRet == SDRLAYER_NOTFOUND )
+ nRet = pObj->GetLayer();
+ else if ( nRet != pObj->GetLayer() )
{
- const SdrObject *pObj = rMrkList.GetMark( i )->GetMarkedSdrObj();
- if( !pObj )
- continue;
- if ( nRet == SHRT_MAX )
- nRet = pObj->GetLayer();
- else if ( nRet != pObj->GetLayer() )
- {
- nRet = -1;
- break;
- }
+ return SDRLAYER_NOTFOUND;
}
}
- if ( nRet == SHRT_MAX )
- nRet = -1;
return nRet;
}
diff --git a/sw/source/core/inc/UndoInsert.hxx b/sw/source/core/inc/UndoInsert.hxx
index 09b9d89912a9..9af50eb0efdb 100644
--- a/sw/source/core/inc/UndoInsert.hxx
+++ b/sw/source/core/inc/UndoInsert.hxx
@@ -23,6 +23,7 @@
#include <memory>
#include <undobj.hxx>
+#include <svx/svdtypes.hxx>
#include <rtl/ustring.hxx>
#include <tools/mempool.hxx>
#include <swtypes.hxx>
@@ -175,7 +176,7 @@ class SwUndoInsertLabel : public SwUndo
// #i26791# - re-store of drawing object position no longer needed
sal_uInt16 nFieldId;
SwLabelType eType;
- sal_uInt8 nLayerId; // for character objects
+ SdrLayerID nLayerId; // for character objects
bool bBefore :1;
bool bUndoKeep :1;
bool bCpyBrd :1;
@@ -215,7 +216,7 @@ public:
void SetUndoKeep() { bUndoKeep = true; }
void SetFlys( SwFrameFormat& rOldFly, SfxItemSet& rChgSet, SwFrameFormat& rNewFly );
- void SetDrawObj( sal_uInt8 nLayerId );
+ void SetDrawObj( SdrLayerID nLayerId );
};
#endif // INCLUDED_SW_SOURCE_CORE_INC_UNDOINSERT_HXX
diff --git a/sw/source/core/inc/dview.hxx b/sw/source/core/inc/dview.hxx
index d5c2bf6bdd23..064cc544420e 100644
--- a/sw/source/core/inc/dview.hxx
+++ b/sw/source/core/inc/dview.hxx
@@ -73,7 +73,7 @@ protected:
// override to allow extra handling when picking SwVirtFlyDrawObj's
using FmFormView::CheckSingleSdrObjectHit;
- virtual SdrObject* CheckSingleSdrObjectHit(const Point& rPnt, sal_uInt16 nTol, SdrObject* pObj, SdrPageView* pPV, SdrSearchOptions nOptions, const SetOfByte* pMVisLay) const override;
+ virtual SdrObject* CheckSingleSdrObjectHit(const Point& rPnt, sal_uInt16 nTol, SdrObject* pObj, SdrPageView* pPV, SdrSearchOptions nOptions, const SdrLayerIDSet* pMVisLay) const override;
// support enhanced text edit for draw objects
virtual SdrUndoManager* getSdrUndoManagerForEnhancedTextEdit() const override;
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index ab0ded01fb32..df8f3a6f84fe 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -802,7 +802,7 @@ void SwFlyFrame::UpdateAttr_( const SfxPoolItem *pOld, const SfxPoolItem *pNew,
if ( pSh )
pSh->InvalidateWindows( Frame() );
const IDocumentDrawModelAccess& rIDDMA = GetFormat()->getIDocumentDrawModelAccess();
- const sal_uInt8 nId = GetFormat()->GetOpaque().GetValue() ?
+ const SdrLayerID nId = GetFormat()->GetOpaque().GetValue() ?
rIDDMA.GetHeavenId() :
rIDDMA.GetHellId();
GetVirtDrawObj()->SetLayer( nId );
@@ -883,7 +883,7 @@ void SwFlyFrame::UpdateAttr_( const SfxPoolItem *pOld, const SfxPoolItem *pNew,
pSh->InvalidateWindows( Frame() );
const IDocumentDrawModelAccess& rIDDMA = GetFormat()->getIDocumentDrawModelAccess();
- const sal_uInt8 nId = static_cast<const SvxOpaqueItem*>(pNew)->GetValue() ?
+ const SdrLayerID nId = static_cast<const SvxOpaqueItem*>(pNew)->GetValue() ?
rIDDMA.GetHeavenId() :
rIDDMA.GetHellId();
GetVirtDrawObj()->SetLayer( nId );
diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx
index f28603b071ad..7d3beb76f5c3 100644
--- a/sw/source/core/text/txtfly.cxx
+++ b/sw/source/core/text/txtfly.cxx
@@ -491,7 +491,7 @@ bool SwTextFly::DrawTextOpaque( SwDrawTextInfo &rInf )
SwAnchoredObjList::size_type nCount( bOn ? GetAnchoredObjList()->size() : 0 );
if ( bOn && nCount > 0 )
{
- const sal_uInt16 nHellId = pPage->getRootFrame()->GetCurrShell()->getIDocumentDrawModelAccess().GetHellId();
+ const SdrLayerID nHellId = pPage->getRootFrame()->GetCurrShell()->getIDocumentDrawModelAccess().GetHellId();
for( SwAnchoredObjList::size_type i = 0; i < nCount; ++i )
{
// #i68520#
@@ -578,7 +578,7 @@ void SwTextFly::DrawFlyRect( OutputDevice* pOut, const SwRect &rRect )
SwAnchoredObjList::size_type nCount( bOn ? GetAnchoredObjList()->size() : 0 );
if ( bOn && nCount > 0 )
{
- const sal_uInt16 nHellId = pPage->getRootFrame()->GetCurrShell()->getIDocumentDrawModelAccess().GetHellId();
+ const SdrLayerID nHellId = pPage->getRootFrame()->GetCurrShell()->getIDocumentDrawModelAccess().GetHellId();
for( SwAnchoredObjList::size_type i = 0; i < nCount; ++i )
{
// #i68520#
diff --git a/sw/source/core/undo/unins.cxx b/sw/source/core/undo/unins.cxx
index b0b7a41b6f0f..78528a4a7f31 100644
--- a/sw/source/core/undo/unins.cxx
+++ b/sw/source/core/undo/unins.cxx
@@ -1057,7 +1057,7 @@ void SwUndoInsertLabel::SetFlys( SwFrameFormat& rOldFly, SfxItemSet& rChgSet,
}
}
-void SwUndoInsertLabel::SetDrawObj( sal_uInt8 nLId )
+void SwUndoInsertLabel::SetDrawObj( SdrLayerID nLId )
{
if( LTYPE_DRAW == eType )
{
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index cb3d5b326445..6ef892f8f5c4 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -1046,6 +1046,9 @@ uno::Reference< beans::XPropertySetInfo > SwXShape::getPropertySetInfo()
void SwXShape::setPropertyValue(const OUString& rPropertyName, const uno::Any& aValue)
{
+ if (rPropertyName == "LayerID") {
+ SAL_WARN("sw.uno", "noel");
+ }
SolarMutexGuard aGuard;
SwFrameFormat* pFormat = GetFrameFormat();
const SfxItemPropertySimpleEntry* pEntry = m_pPropSet->getPropertyMap().getByName( rPropertyName );
@@ -1445,6 +1448,9 @@ void SwXShape::setPropertyValue(const OUString& rPropertyName, const uno::Any& a
uno::Any SwXShape::getPropertyValue(const OUString& rPropertyName)
{
+ if (rPropertyName == "LayerID") {
+ SAL_WARN("sw.uno", "noel");
+ }
SolarMutexGuard aGuard;
uno::Any aRet;
SwFrameFormat* pFormat = GetFrameFormat();
diff --git a/sw/source/filter/ww8/writerhelper.hxx b/sw/source/filter/ww8/writerhelper.hxx
index 09b0b0459983..e97a9e5d025b 100644
--- a/sw/source/filter/ww8/writerhelper.hxx
+++ b/sw/source/filter/ww8/writerhelper.hxx
@@ -29,6 +29,7 @@
#include "types.hxx"
#include <svl/itempool.hxx>
#include <svl/itemset.hxx>
+#include <svx/svdtypes.hxx>
#include <format.hxx>
#include <node.hxx>
#include <pam.hxx>
@@ -628,7 +629,7 @@ namespace sw
class SetLayer
{
private:
- sal_uInt8 mnHeavenLayer, mnHellLayer, mnFormLayer;
+ SdrLayerID mnHeavenLayer, mnHellLayer, mnFormLayer;
enum Layer {eHeaven, eHell};
void SetObjectLayer(SdrObject &rObject, Layer eLayer) const;
void Swap(SetLayer &rOther) throw();
diff --git a/sw/source/uibase/shells/drawsh.cxx b/sw/source/uibase/shells/drawsh.cxx
index fc0580ea85bd..6f2ee322b88e 100644
--- a/sw/source/uibase/shells/drawsh.cxx
+++ b/sw/source/uibase/shells/drawsh.cxx
@@ -254,7 +254,7 @@ void SwDrawShell::Execute(SfxRequest &rReq)
if (rSh.IsObjSelected())
{
rSh.StartUndo( SwUndoId::START );
- if (rSh.GetLayerId() == 0)
+ if (rSh.GetLayerId() == SdrLayerID(0))
{
SetWrapMode(FN_FRAME_WRAPTHRU);
rSh.SelectionToHeaven();
@@ -407,12 +407,12 @@ void SwDrawShell::GetState(SfxItemSet& rSet)
switch( nWhich )
{
case SID_OBJECT_HELL:
- if ( !rSh.IsObjSelected() || rSh.GetLayerId() == 0 || bProtected )
+ if ( !rSh.IsObjSelected() || rSh.GetLayerId() == SdrLayerID(0) || bProtected )
rSet.DisableItem( nWhich );
break;
case SID_OBJECT_HEAVEN:
- if ( !rSh.IsObjSelected() || rSh.GetLayerId() == 1 || bProtected )
+ if ( !rSh.IsObjSelected() || rSh.GetLayerId() == SdrLayerID(1) || bProtected )
rSet.DisableItem( nWhich );
break;
diff --git a/sw/source/uibase/shells/drwbassh.cxx b/sw/source/uibase/shells/drwbassh.cxx
index ee7412daf952..ec081a2919d1 100644
--- a/sw/source/uibase/shells/drwbassh.cxx
+++ b/sw/source/uibase/shells/drwbassh.cxx
@@ -134,7 +134,7 @@ void SwDrawBaseShell::Execute(SfxRequest &rReq)
aSet.Put(SfxBoolItem(SID_HTML_MODE,
0 != ::GetHtmlMode(pSh->GetView().GetDocShell())));
- aSet.Put(SfxInt16Item(FN_DRAW_WRAP_DLG, pSh->GetLayerId()));
+ aSet.Put(SfxInt16Item(FN_DRAW_WRAP_DLG, sal_uInt8(pSh->GetLayerId())));
pSh->GetObjAttr(aSet);
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();