Commits

Anonymous committed d2030e6

sw34bf06: #i117863# - use hint which allows to specify, if content is saved or not for deletion of <SwFrm> instances triggered from <SwSectionNode> resp. <SwSectionFmt> methods

  • Participants
  • Parent commits 5438b9c

Comments (0)

Files changed (4)

File sw/inc/section.hxx

 #include <tools/rtti.hxx>
 #include <tools/ref.hxx>
 #include <svl/svarray.hxx>
+// --> OD #i117863#
+#include <svl/smplhint.hxx>
+// <--
 #include <sfx2/lnkbase.hxx>
 #include <sfx2/Metadatable.hxx>
 
 
 };
 
+// --> OD #i117863#
+class SwSectionFrmMoveAndDeleteHint : public SfxSimpleHint
+{
+    public:
+        SwSectionFrmMoveAndDeleteHint( const sal_Bool bSaveCntnt )
+            : SfxSimpleHint( SFX_HINT_DYING )
+            , mbSaveCntnt( bSaveCntnt )
+        {}
+
+        ~SwSectionFrmMoveAndDeleteHint()
+        {}
+        
+        sal_Bool IsSaveCntnt() const
+        {
+            return mbSaveCntnt;
+        }
+    
+    private:
+        const sal_Bool mbSaveCntnt;
+};            
+// <--
 
 enum SectionSort { SORTSECT_NOT, SORTSECT_NAME, SORTSECT_POS };
 

File sw/source/core/docnode/ndsect.cxx

 SwSectionNode::~SwSectionNode()
 {
     // mba: test if iteration works as clients will be removed in callback
-    m_pSection->GetFmt()->CallSwClientNotify( SfxSimpleHint( SFX_HINT_DYING ) );
+    // --> OD #i117863#
+    // use hint which allows to specify, if the content shall be saved or not
+    m_pSection->GetFmt()->CallSwClientNotify( SwSectionFrmMoveAndDeleteHint( sal_True ) );
+    // <--
     SwSectionFmt* pFmt = m_pSection->GetFmt();
 	if( pFmt )
 	{

File sw/source/core/docnode/section.cxx

 				}
 			}
             // mba: test iteration; objects are removed while iterating
-            CallSwClientNotify( SfxSimpleHint(SFX_HINT_DYING) );
+            // --> OD #i117863#
+            // use hint which allows to specify, if the content shall be saved or not
+            CallSwClientNotify( SwSectionFrmMoveAndDeleteHint( sal_True ) );
+            // <--
 
 			// hebe die Section doch mal auf
 			SwNodeRange aRg( *pSectNd, 0, *pSectNd->EndOfSectionNode() );
 	{
         // #147431# : First delete the <SwSectionFrm> of the <SwSectionFmt> instance
         // mba: test iteration as objects are removed in iteration
-        CallSwClientNotify( SfxSimpleHint(SFX_HINT_DYING) );
+        // --> OD #i117863#
+        // use hint which allows to specify, if the content shall be saved or not
+        CallSwClientNotify( SwSectionFrmMoveAndDeleteHint( sal_False ) );
+        // <--
  
         // Then delete frames of the nested <SwSectionFmt> instances
         SwIterator<SwSectionFmt,SwSectionFmt> aIter( *this );

File sw/source/core/layout/sectfrm.cxx

 
 void SwSectionFrm::SwClientNotify( const SwModify& rMod, const SfxHint& rHint )
 {
-    const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint);
-    if ( pSimpleHint && pSimpleHint->GetId() == SFX_HINT_DYING && &rMod == GetRegisteredIn() )
+    // --> OD #i117863#
+    const SwSectionFrmMoveAndDeleteHint* pHint = 
+                    dynamic_cast<const SwSectionFrmMoveAndDeleteHint*>(&rHint);
+    if ( pHint && pHint->GetId() == SFX_HINT_DYING && &rMod == GetRegisteredIn() )
     {
-        SwSectionFrm::MoveCntntAndDelete( this, sal_True );
+        SwSectionFrm::MoveCntntAndDelete( this, pHint->IsSaveCntnt() );
     }
+    // <--
 }
 
 void SwSectionFrm::_UpdateAttr( const SfxPoolItem *pOld, const SfxPoolItem *pNew,