Commits

Henning Brinkmann  committed c2c01fd Merge

sw34bf06: merged from outgoing

  • Participants
  • Parent commits cba4eb3, b5be4ce

Comments (0)

Files changed (6)

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/doc/docnum.cxx

 #include "precompiled_sw.hxx"
 
 #include <hintids.hxx>
-#include <tools/date.hxx>
-#include <tools/time.hxx>
+#include <rtl/random.h>
 #include <tools/resid.hxx>
 #include <editeng/lrspitem.hxx>
 #include <ftninfo.hxx>
 	String aName;
 	if( bAutoNum )
 	{
-		long n = Time().GetTime();
-		n += Date().GetDate();
-		aName = String::CreateFromInt32( n );
+        // --> OD #o12311627#
+        static rtlRandomPool s_RandomPool( rtl_random_createPool() );
+        sal_Int64 n;
+        rtl_random_getBytes( s_RandomPool, &n, sizeof(n) );
+        aName = String::CreateFromInt64( (n < 0 ? -n : n) );
+        // <--
 		if( pChkStr && !pChkStr->Len() )
 			pChkStr = 0;
 	}
         // --> OD 2008-08-06 #i92478#
         String aNewListId = String::CreateFromAscii( "list" );
         // <--
-        sal_Int64 n = Time().GetTime();
-        n += Date().GetDate();
-        n += rand();
-        // --> OD 2008-08-06 #i92478#
-        aNewListId += String::CreateFromInt64( n );
+        // --> OD #o12311627#
+        static rtlRandomPool s_RandomPool( rtl_random_createPool() );
+        sal_Int64 n;
+        rtl_random_getBytes( s_RandomPool, &n, sizeof(n) );
+        aNewListId += String::CreateFromInt64( (n < 0 ? -n : n) );
         // <--
 
         return MakeListIdUnique( rDoc, aNewListId );

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/frmedt/feshview.cxx

 		while( pSect );
 	}
 	SwIterator<SwSectionFrm,SwFmt> aIter( rFmt );
-    for ( SwSectionFrm* pSct = aIter.First(); pFrm; pFrm = aIter.Next() )
-			if( !pSct->IsFollow() )
-				return pSct->Frm().Width();
+    for ( SwSectionFrm* pSct = aIter.First(); pSct; pSct = aIter.Next() )
+    {        
+        if( !pSct->IsFollow() )
+        {        
+            return pSct->Frm().Width();
+        }
+    }
 	return 0;
 }
 

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,