[Libreoffice-commits] core.git: 6 commits - scripting/Module_scripting.mk sw/source

Michael Stahl mstahl at redhat.com
Wed Dec 7 21:49:59 UTC 2016


 scripting/Module_scripting.mk                |   10 ++-
 sw/source/core/draw/dcontact.cxx             |   69 +++++++++------------------
 sw/source/core/layout/anchoreddrawobject.cxx |   10 +--
 sw/source/core/layout/anchoredobject.cxx     |    9 +--
 4 files changed, 36 insertions(+), 62 deletions(-)

New commits:
commit 1b6545d21815e8a033699ed5d6a49c80ea635949
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Dec 7 22:23:52 2016 +0100

    sw: convert OSL_ENSURE to assert in anchoreddrawobject.cxx
    
    Change-Id: I9cce5acd2baca419bb430603b9fff34d6b6b3655

diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx
index acaebcb..9fe438d 100644
--- a/sw/source/core/layout/anchoreddrawobject.cxx
+++ b/sw/source/core/layout/anchoreddrawobject.cxx
@@ -330,7 +330,7 @@ void SwAnchoredDrawObject::MakeObjPos()
             break;
             default:
             {
-                OSL_FAIL( "<SwAnchoredDrawObject::MakeObjPos()> - unknown anchor type." );
+                assert(!"<SwAnchoredDrawObject::MakeObjPos()> - unknown anchor type.");
             }
         }
 
@@ -608,14 +608,12 @@ void SwAnchoredDrawObject::InvalidateObjPos()
 
 SwFrameFormat& SwAnchoredDrawObject::GetFrameFormat()
 {
-    OSL_ENSURE( static_cast<SwDrawContact*>(GetUserCall(GetDrawObj()))->GetFormat(),
-            "<SwAnchoredDrawObject::GetFrameFormat()> - missing frame format -> crash." );
+    assert(static_cast<SwDrawContact*>(GetUserCall(GetDrawObj()))->GetFormat());
     return *(static_cast<SwDrawContact*>(GetUserCall(GetDrawObj()))->GetFormat());
 }
 const SwFrameFormat& SwAnchoredDrawObject::GetFrameFormat() const
 {
-    OSL_ENSURE( static_cast<SwDrawContact*>(GetUserCall(GetDrawObj()))->GetFormat(),
-            "<SwAnchoredDrawObject::GetFrameFormat()> - missing frame format -> crash." );
+    assert(static_cast<SwDrawContact*>(GetUserCall(GetDrawObj()))->GetFormat());
     return *(static_cast<SwDrawContact*>(GetUserCall(GetDrawObj()))->GetFormat());
 }
 
@@ -791,7 +789,7 @@ void SwAnchoredDrawObject::SetPositioningAttr()
                 break;
                 default:
                 {
-                    OSL_FAIL( "<SwAnchoredDrawObject::SetPositioningAttr()> - unsupported layout direction" );
+                    assert(!"<SwAnchoredDrawObject::SetPositioningAttr()> - unsupported layout direction");
                 }
             }
         }
commit 97517ef7d26da69b99dc28a8dc3affb788432b9a
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Dec 7 22:21:26 2016 +0100

    sw: convert some OSL_ENSURE to assert in anchoredobject.cxx
    
    Change-Id: Ie55fca8526f6a7e1f9bbbc05587812466bc17d67

diff --git a/sw/source/core/layout/anchoredobject.cxx b/sw/source/core/layout/anchoredobject.cxx
index 20c4a3c..120666e 100644
--- a/sw/source/core/layout/anchoredobject.cxx
+++ b/sw/source/core/layout/anchoredobject.cxx
@@ -807,8 +807,7 @@ Point SwAnchoredObject::GetRelPosToAnchorFrame() const
 {
     Point aRelPos;
 
-    OSL_ENSURE( GetAnchorFrame(),
-            "<SwAnchoredObject::GetRelPosToAnchorFrame()> - missing anchor frame." );
+    assert(GetAnchorFrame());
     aRelPos = GetObjRect().Pos();
     aRelPos -= GetAnchorFrame()->Frame().Pos();
 
@@ -832,10 +831,8 @@ Point SwAnchoredObject::GetRelPosToPageFrame( const bool _bFollowTextFlow,
     Point aRelPos;
     _obRelToTableCell = false;
 
-    OSL_ENSURE( GetAnchorFrame(),
-            "<SwAnchoredObject::GetRelPosToPageFrame()> - missing anchor frame." );
-    OSL_ENSURE( GetAnchorFrame()->FindPageFrame(),
-            "<SwAnchoredObject::GetRelPosToPageFrame()> - missing page frame." );
+    assert(GetAnchorFrame());
+    assert(GetAnchorFrame()->FindPageFrame());
 
     aRelPos = GetObjRect().Pos();
     // --> #i33818# - search for cell frame, if object has to
commit c9fc16f8a9b2f267fdea680a67938e3292660e8e
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Dec 7 22:16:05 2016 +0100

    sw: simplify SwContact::MoveObjToVisibleLayer()
    
    Change-Id: I8ebaf42ce9af6a4d28fceab2a1f68b4c8ab00b96

diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index 9baab81..88015f5 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -195,21 +195,17 @@ void SwContact::MoveObjToVisibleLayer( SdrObject* _pDrawObj )
     if ( bNotify )
     {
         SwAnchoredObject* pAnchoredObj = GetAnchoredObj( _pDrawObj );
-        OSL_ENSURE( pAnchoredObj,
-                "<SwContact::MoveObjToInvisibleLayer(..)> - missing anchored object" );
-        if ( pAnchoredObj )
+        assert(pAnchoredObj);
+        ::setContextWritingMode( _pDrawObj, pAnchoredObj->GetAnchorFrameContainingAnchPos() );
+        // Note: as-character anchored objects aren't registered at a page frame and
+        //       a notification of its background isn't needed.
+        if ( pAnchoredObj->GetPageFrame() )
         {
-            ::setContextWritingMode( _pDrawObj, pAnchoredObj->GetAnchorFrameContainingAnchPos() );
-            // Note: as-character anchored objects aren't registered at a page frame and
-            //       a notification of its background isn't needed.
-            if ( pAnchoredObj->GetPageFrame() )
-            {
-                ::Notify_Background( _pDrawObj, pAnchoredObj->GetPageFrame(),
-                                     pAnchoredObj->GetObjRect(), PREP_FLY_ARRIVE, true );
-            }
-
-            pAnchoredObj->InvalidateObjPos();
+            ::Notify_Background( _pDrawObj, pAnchoredObj->GetPageFrame(),
+                                 pAnchoredObj->GetObjRect(), PREP_FLY_ARRIVE, true );
         }
+
+        pAnchoredObj->InvalidateObjPos();
     }
 }
 
@@ -225,11 +221,10 @@ void SwContact::MoveObjToInvisibleLayer( SdrObject* _pDrawObj )
     if ( bNotify )
     {
         SwAnchoredObject* pAnchoredObj = GetAnchoredObj( _pDrawObj );
-        OSL_ENSURE( pAnchoredObj,
-                "<SwContact::MoveObjToInvisibleLayer(..)> - missing anchored object" );
+        assert(pAnchoredObj);
         // Note: as-character anchored objects aren't registered at a page frame and
         //       a notification of its background isn't needed.
-        if ( pAnchoredObj && pAnchoredObj->GetPageFrame() )
+        if (pAnchoredObj->GetPageFrame())
         {
             ::Notify_Background( _pDrawObj, pAnchoredObj->GetPageFrame(),
                                  pAnchoredObj->GetObjRect(), PREP_FLY_LEAVE, true );
commit ab96779a30de5ce8373253bc00ff3046df64282e
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Dec 7 22:11:27 2016 +0100

    sw: remove some copypasta in SwFlyDrawContact with const_casts
    
    Change-Id: I95dbb8406c022fe05e4499bf865d4be7862b782f

diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index d987949..9baab81 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -423,23 +423,9 @@ const SwAnchoredObject* SwFlyDrawContact::GetAnchoredObj( const SdrObject* _pSdr
     return pRetAnchoredObj;
 }
 
-SwAnchoredObject* SwFlyDrawContact::GetAnchoredObj( SdrObject* _pSdrObj )
+SwAnchoredObject* SwFlyDrawContact::GetAnchoredObj(SdrObject *const pSdrObj)
 {
-    OSL_ENSURE( _pSdrObj,
-            "<SwFlyDrawContact::GetAnchoredObj(..)> - no object provided" );
-    OSL_ENSURE( dynamic_cast<const SwVirtFlyDrawObj*>( _pSdrObj) !=  nullptr,
-            "<SwFlyDrawContact::GetAnchoredObj(..)> - wrong object type provided" );
-    assert(GetUserCall(_pSdrObj) == this &&
-        "<SwFlyDrawContact::GetAnchoredObj(..)> - provided object doesn't belong to this contact");
-
-    SwAnchoredObject* pRetAnchoredObj = nullptr;
-
-    if ( _pSdrObj && dynamic_cast<const SwVirtFlyDrawObj*>( _pSdrObj) !=  nullptr )
-    {
-        pRetAnchoredObj = static_cast<SwVirtFlyDrawObj*>(_pSdrObj)->GetFlyFrame();
-    }
-
-    return pRetAnchoredObj;
+    return const_cast<SwAnchoredObject *>(const_cast<SwFlyDrawContact const*>(this)->GetAnchoredObj(pSdrObj));
 }
 
 const SdrObject* SwFlyDrawContact::GetMaster() const
commit e54e88b74c6c5c18041d357fbd107bcdeb372c6d
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Dec 7 22:07:54 2016 +0100

    sw: convert some obvious OSL_ENSURE to assert in dcontact.cxx
    
    Change-Id: Ib2c53c790d4ba6b4c969d2012c87464c3ee02512

diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index b8aaa40..d987949 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -151,7 +151,7 @@ SwContact* GetUserCall( const SdrObject* pObj )
     SdrObject *pTmp;
     while ( !pObj->GetUserCall() && nullptr != (pTmp = pObj->GetUpGroup()) )
         pObj = pTmp;
-    OSL_ENSURE( !pObj->GetUserCall() || nullptr != dynamic_cast< const SwContact*> (pObj->GetUserCall()),
+    assert((!pObj->GetUserCall() || nullptr != dynamic_cast<const SwContact*>(pObj->GetUserCall())) &&
             "<::GetUserCall(..)> - wrong type of found object user call." );
     return static_cast<SwContact*>(pObj->GetUserCall());
 }
@@ -410,8 +410,8 @@ const SwAnchoredObject* SwFlyDrawContact::GetAnchoredObj( const SdrObject* _pSdr
             "<SwFlyDrawContact::GetAnchoredObj(..)> - no object provided" );
     OSL_ENSURE( dynamic_cast<const SwVirtFlyDrawObj*>( _pSdrObj) !=  nullptr,
             "<SwFlyDrawContact::GetAnchoredObj(..)> - wrong object type object provided" );
-    OSL_ENSURE( GetUserCall( _pSdrObj ) == this,
-            "<SwFlyDrawContact::GetAnchoredObj(..)> - provided object doesn't belongs to this contact" );
+    assert(GetUserCall(_pSdrObj) == this &&
+        "<SwFlyDrawContact::GetAnchoredObj(..)> - provided object doesn't belong to this contact");
 
     const SwAnchoredObject* pRetAnchoredObj = nullptr;
 
@@ -429,8 +429,8 @@ SwAnchoredObject* SwFlyDrawContact::GetAnchoredObj( SdrObject* _pSdrObj )
             "<SwFlyDrawContact::GetAnchoredObj(..)> - no object provided" );
     OSL_ENSURE( dynamic_cast<const SwVirtFlyDrawObj*>( _pSdrObj) !=  nullptr,
             "<SwFlyDrawContact::GetAnchoredObj(..)> - wrong object type provided" );
-    OSL_ENSURE( GetUserCall( _pSdrObj ) == this,
-            "<SwFlyDrawContact::GetAnchoredObj(..)> - provided object doesn't belongs to this contact" );
+    assert(GetUserCall(_pSdrObj) == this &&
+        "<SwFlyDrawContact::GetAnchoredObj(..)> - provided object doesn't belong to this contact");
 
     SwAnchoredObject* pRetAnchoredObj = nullptr;
 
@@ -454,8 +454,7 @@ SdrObject* SwFlyDrawContact::GetMaster()
 
 void SwFlyDrawContact::SetMaster( SdrObject* _pNewMaster )
 {
-    OSL_ENSURE( dynamic_cast<const SwFlyDrawObj*>( _pNewMaster) !=  nullptr,
-            "<SwFlyDrawContact::SetMaster(..)> - wrong type of new master object" );
+    assert(dynamic_cast<const SwFlyDrawObj*>(_pNewMaster) != nullptr);
     mpMasterObj = static_cast<SwFlyDrawObj *>(_pNewMaster);
 }
 
@@ -470,8 +469,7 @@ void SwFlyDrawContact::SwClientNotify(const SwModify&, const SfxHint&)
  */
 void SwFlyDrawContact::MoveObjToVisibleLayer( SdrObject* _pDrawObj )
 {
-    OSL_ENSURE( dynamic_cast<const SwVirtFlyDrawObj*>( _pDrawObj) !=  nullptr,
-            "<SwFlyDrawContact::MoveObjToVisibleLayer(..)> - wrong SdrObject type -> crash" );
+    assert(dynamic_cast<const SwVirtFlyDrawObj*>(_pDrawObj) != nullptr);
 
     if ( GetFormat()->getIDocumentDrawModelAccess().IsVisibleLayerId( _pDrawObj->GetLayer() ) )
     {
@@ -511,8 +509,7 @@ void SwFlyDrawContact::MoveObjToVisibleLayer( SdrObject* _pDrawObj )
  */
 void SwFlyDrawContact::MoveObjToInvisibleLayer( SdrObject* _pDrawObj )
 {
-    OSL_ENSURE( dynamic_cast<const SwVirtFlyDrawObj*>( _pDrawObj) !=  nullptr,
-            "<SwFlyDrawContact::MoveObjToInvisibleLayer(..)> - wrong SdrObject type -> crash" );
+    assert(dynamic_cast<const SwVirtFlyDrawObj*>(_pDrawObj) != nullptr);
 
     if ( !GetFormat()->getIDocumentDrawModelAccess().IsVisibleLayerId( _pDrawObj->GetLayer() ) )
     {
@@ -1296,7 +1293,7 @@ void SwDrawContact::Changed_( const SdrObject& rObj,
                     break;
                     default:
                     {
-                        OSL_FAIL( "<SwDrawContact::Changed_(..)> - unsupported layout direction" );
+                        assert(!"<SwDrawContact::Changed_(..)> - unsupported layout direction");
                     }
                 }
                 SfxItemSet aSet( GetFormat()->GetDoc()->GetAttrPool(),
@@ -1474,7 +1471,7 @@ void SwDrawContact::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
                 }
                 break;
                 default:
-                    OSL_FAIL("<SwDraw Contact::Modify(..)> - unhandled attribute? - please inform od at openoffice.org");
+                    assert(!"<SwDraw Contact::Modify(..)> - unhandled attribute?");
             }
             lcl_NotifyBackgroundOfObj(*this, *GetMaster(), nullptr);
             NotifyBackgrdOfAllVirtObjs(nullptr);
@@ -1828,8 +1825,7 @@ void SwDrawContact::ConnectToLayout( const SwFormatAnchor* pAnch )
                         if ( FLY_AT_FLY == pAnch->GetAnchorId() && !pFrame->IsFlyFrame() )
                         {
                             pFrame = pFrame->FindFlyFrame();
-                            OSL_ENSURE( pFrame,
-                                    "<SwDrawContact::ConnectToLayout(..)> - missing fly frame -> crash." );
+                            assert(pFrame);
                         }
 
                         // find correct follow for as character anchored objects
@@ -1869,7 +1865,7 @@ void SwDrawContact::ConnectToLayout( const SwFormatAnchor* pAnch )
             }
             break;
         default:
-            OSL_FAIL( "Unknown Anchor." );
+            assert(!"Unknown Anchor.");
             break;
     }
     if ( GetAnchorFrame() )
commit d90427d767fd9dae298577ef114bfef3e2618868
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Dec 7 22:43:55 2016 +0100

    scripting: more inconsistent Package conditions
    
    Change-Id: Ifcefef2de15aab4dae6e14b3e689504d4fe9d11e

diff --git a/scripting/Module_scripting.mk b/scripting/Module_scripting.mk
index b2db3e1..1d603d5 100644
--- a/scripting/Module_scripting.mk
+++ b/scripting/Module_scripting.mk
@@ -31,16 +31,18 @@ $(eval $(call gb_Module_add_targets,scripting,\
 		$(if $(ENABLE_SCRIPTING_BEANSHELL),Package_ScriptsBeanShell) \
 		$(if $(ENABLE_SCRIPTING_JAVASCRIPT),Package_ScriptsJavaScript) \
 	) \
-	Package_scriptbindinglib \
-	$(if $(DISABLE_PYTHON),,Package_scriptproviderforpython) \
-	Package_ScriptsPython \
+	$(if $(DISABLE_SCRIPTING),,Package_scriptbindinglib) \
+	$(if $(DISABLE_PYTHON),,\
+		Package_scriptproviderforpython \
+		Package_ScriptsPython \
+		Pyuno_mailmerge \
+	) \
 	Library_basprov \
 	Library_dlgprov \
 	Library_protocolhandler \
 	Library_scriptframe \
 	Library_stringresource \
 	Library_vbaevents \
-	Pyuno_mailmerge \
 ))
 
 endif


More information about the Libreoffice-commits mailing list