Bug 53833 - Cannot change endnote to footnote
Summary: Cannot change endnote to footnote
Status: RESOLVED FIXED
Alias: None
Product: kword
Classification: Miscellaneous
Component: general (show other bugs)
Version: 1.5 or before
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Thomas Zander
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-02-01 16:18 UTC by Mike McBride
Modified: 2003-02-02 15:28 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike McBride 2003-02-01 16:18:49 UTC
Version:           1.2post (using KDE 3.1.0)
Installed from:    compiled sources
Compiler:          gcc version 2.96 20000731 (Red Hat Linux 7.2 2.96-108.7.2)
OS:          Linux (i686) release 2.4.7-10

To replicate the bug do the following.

1) Place two sample sentances in a blank document (Text oriented)
2) Place a sample footnote at the end of the first sentance.
3) Place a sample endnote at the end of the second sentance.
4) Select the endnote character.
5) Click once with the Right mouse button to bring up a submenu.
6) Select "Change footnote parameter".

First notice that the dialog box defaults to "Footnote", even when selecting an endnote.  I think if you have selected an end note, it should default to endnote.

More importantly, if you select footnote, then click "OK", the numbering if the notation now follows the numbering of footnotes, but it is still located at the "endnotes" position.

The opposite case also holds true (can not change a footnote to an endnote, but the numbering does change.
Comment 1 Mike McBride 2003-02-01 16:32:28 UTC
I have now noticed, that if you (using the numbered way to replicate bugs) insert 
another footnote, both references are now displayed as footnotes. 
 
Also, if I save the file (after completing step number 6, then reload the file, the 
"endnote" is now down as a footnote the way it should be. 
 
THis may simply be a need to update the display. 
 
Note:  If I repeat steps 1-6 on a new document, then select Print -> Preview -- The 
endnotes/Footnotes are not changed correctly. 
Comment 2 David Faure 2003-02-02 15:28:59 UTC
Subject: koffice/kword

CVS commit by faure: 

Many fixes for changing a note type between endnote and footnote.
CCMAIL: 53833-done@bugs.kde.org


  M +9 -7      kwcommand.cc   1.212
  M +1 -0      kwdoc.cc   1.596
  M +7 -1      kwframelayout.cc   1.29
  M +8 -4      kwvariable.cc   1.145


--- koffice/kword/kwdoc.cc  #1.595:1.596
@@ -734,4 +734,5 @@ void KWDocument::recalcFrames( int fromP
         KWTextFrameSet *firstHeader = 0L, *evenHeader = 0L, *oddHeader = 0L;
         KWTextFrameSet *firstFooter = 0L, *evenFooter = 0L, *oddFooter = 0L;
+        m_bHasEndNotes = false; // will be set to true if we find any endnote
 
         // Lookup the various header / footer framesets into the variables above

--- koffice/kword/kwcommand.cc  #1.211:1.212
@@ -2062,14 +2061,17 @@ void KWChangeFootNoteParametersCommand::
     m_var->setNumberingType( _param.numberingType );
     m_var->setManualString( _param.manualString );
-    m_var->resize();
-    m_var->frameSet()->setCounterText( m_var->text() );
-    m_var->setNumDisplay( -1 );
+    m_var->setNumDisplay( -1 ); // force renumberFootNotes to recalc
     KWTextFrameSet * frameset = dynamic_cast<KWTextFrameSet *>( m_doc->frameSet( 0 ));
+    Q_ASSERT( frameset );
     if ( frameset)
         frameset->renumberFootNotes();
 
-    m_var->paragraph()->invalidate(0);
-    m_var->paragraph()->setChanged( true );
-    m_doc->slotRepaintVariable();
+    // Re-layout the footnote/endnote frame
+    KWFrame* footNoteFrame = m_var->frameSet()->frame( 0 );
+    int framePage = footNoteFrame->pageNum();
+    m_doc->recalcFrames( framePage, -1 );
+
+    // Repaint
+    m_doc->delayedRepaintAllViews();
 }
 

--- koffice/kword/kwframelayout.cc  #1.28:1.29
@@ -386,5 +386,11 @@ void KWFrameLayout::layout( KWFrameSet* 
         if ( m_doc->hasEndNotes() ) {
             KWFrame* lastMainFrame = mainTextFrameSet->frameIterator().getLast();
+            if ( lastMainFrame->frameBehavior() != KWFrame::AutoExtendFrame )
+            {
             lastMainFrame->setFrameBehavior( KWFrame::AutoExtendFrame );
+                // make sure it gets resized
+                if ( mainTextFrameResized == -1 )
+                    mainTextFrameResized = lastMainFrame->pageNum();
+            }
         }
     }

--- koffice/kword/kwvariable.cc  #1.144:1.145
@@ -335,9 +335,9 @@ void KWFootNoteVariable::formatedNote()
     if ( m_numberingType == Auto )
     {
-        m_varValue = QVariant(applyStyle( ));
+        m_varValue = QVariant(applyStyle());
     }
 }
 
-QString KWFootNoteVariable::applyStyle(  )
+QString KWFootNoteVariable::applyStyle()
 {
     KWVariableSettings* settings = static_cast<KWVariableSettings*>(m_varColl->variableSetting());
@@ -345,5 +345,8 @@ QString KWFootNoteVariable::applyStyle( 
 
     QString tmp;
-    int val = m_numDisplay+ tmpCounter.startNumber()-1;
+    int val = m_numDisplay + tmpCounter.startNumber()-1;
+    Q_ASSERT( val >= 0 );
+    if ( val < 0 ) // let's not go into makeRomanNumber with a negative number :}
+        return i18n("ERROR");
     switch ( tmpCounter.style() )
     {
@@ -387,4 +390,5 @@ void KWFootNoteVariable::setNumDisplay( 
 {
     m_numDisplay = val;
+    if ( val != -1 ) // -1 is used to 'invalidate so that renumberFootNotes recalcs'
     formatedNote();
 }