Commits

Anonymous committed 737b944

CWS-TOOLING: integrate CWS c17v006_DEV300
2009-05-26 14:54:33 +0200 os r272304 : #i99069# modification of bibliography entries fixed

Comments (0)

Files changed (3)

sw/inc/authfld.hxx

 	void 				GetAllEntryIdentifiers( SvStringsDtor& rToFill )const;
 	const SwAuthEntry* 	GetEntryByIdentifier(const String& rIdentifier)const;
 
-	void				ChangeEntryContent(const SwAuthEntry* pNewEntry);
+    bool                ChangeEntryContent(const SwAuthEntry* pNewEntry);
 	// import interface
 	USHORT				AppendField(const SwAuthEntry& rInsert);
 	long				GetHandle(USHORT nPos);

sw/source/core/fields/authfld.cxx

 /* -----------------------------21.12.99 13:20--------------------------------
 
  ---------------------------------------------------------------------------*/
-void SwAuthorityFieldType::ChangeEntryContent(const SwAuthEntry* pNewEntry)
+bool SwAuthorityFieldType::ChangeEntryContent(const SwAuthEntry* pNewEntry)
 {
+    bool bChanged = false;
 	for( USHORT j = 0; j < m_pDataArr->Count(); ++j )
 	{
 		SwAuthEntry* pTemp = m_pDataArr->GetObject(j);
 			for(USHORT i = 0; i < AUTH_FIELD_END; i++)
 				pTemp->SetAuthorField((ToxAuthorityField) i,
 					pNewEntry->GetAuthorField((ToxAuthorityField)i));
+            bChanged = true;
 			break;
 		}
 	}
+    return bChanged;
 }
 /*-- 11.10.99 08:49:22---------------------------------------------------
 	Description: 	appends a new entry (if new) and returns the array position

sw/source/ui/fldui/fldmgr.cxx

 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
 
-#ifndef _CMDID_H
 #include <cmdid.h>
-#endif
 #include <hintids.hxx>
 #include <svtools/stritem.hxx>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <svtools/zforlist.hxx>
 #include <svtools/zformat.hxx>
 #include <vcl/mnemonic.hxx>
-#ifndef _VIEW_HXX
 #include <view.hxx>
-#endif
 #include <wrtsh.hxx>		// Actives Fenster
 #include <doc.hxx>		// Actives Fenster
-#ifndef _DOCSH_HXX
 #include <docsh.hxx>		// Actives Fenster
-#endif
 #include <swmodule.hxx>
 #include <charatr.hxx>
 #include <fmtinfmt.hxx>
 #include <cellatr.hxx>
-#ifndef _DBMGR_HXX
 #include <dbmgr.hxx>
-#endif
 #include <shellres.hxx>
 #include <fldbas.hxx>
 #include <docufld.hxx>
 #include <fldmgr.hxx>
 #include <crsskip.hxx>
 #include <flddropdown.hxx>
-#ifndef _FLDUI_HRC
 #include <fldui.hrc>
-#endif
+#include <tox.hxx>
 
 using rtl::OUString;
 using namespace com::sun::star::uno;
 			bSetPar1 = bSetPar2 = FALSE;
 		}
 		break;
+        case TYP_AUTHORITY :
+        {    
+            //#i99069# changes to a bibliography field should change the field type
+            SwAuthorityField* pAuthorityField = static_cast<SwAuthorityField*>(pTmpFld);
+            SwAuthorityFieldType* pAuthorityType = static_cast<SwAuthorityFieldType*>(pType);
+            SwAuthEntry aTempEntry;
+            for( USHORT i = 0; i < AUTH_FIELD_END; ++i )
+                aTempEntry.SetAuthorField( (ToxAuthorityField)i,
+                                rPar1.GetToken( i, TOX_STYLE_DELIMITER ));
+            if( pAuthorityType->ChangeEntryContent( &aTempEntry ) )
+            {
+                pType->UpdateFlds();
+                pSh->SetModified();
+            }
+        
+            if( aTempEntry.GetAuthorField( AUTH_FIELD_IDENTIFIER ) == 
+                pAuthorityField->GetFieldText( AUTH_FIELD_IDENTIFIER ) ) 
+                bSetPar1 = FALSE; //otherwise it's a new or changed entry, the field needs to be updated    
+            bSetPar2 = FALSE;
+        }
+        break;
 	}
 
 	// Format setzen