]> git.lyx.org Git - features.git/commitdiff
Added Ascii export for tabulars + small fixes
authorJürgen Vigna <jug@sad.it>
Tue, 10 Oct 2000 10:38:11 +0000 (10:38 +0000)
committerJürgen Vigna <jug@sad.it>
Tue, 10 Oct 2000 10:38:11 +0000 (10:38 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1094 a592a061-630c-0410-9148-cb99ea01b6c8

18 files changed:
ChangeLog
src/BufferView.C
src/BufferView.h
src/BufferView_pimpl.C
src/BufferView_pimpl.h
src/buffer.C
src/frontends/kde/formindexdialogdata.C
src/frontends/kde/formindexdialogdata.h
src/frontends/kde/formprintdialogdata.C
src/frontends/kde/formprintdialogdata.h
src/insets/insettabular.C
src/insets/insettabular.h
src/insets/insettext.C
src/lyx_gui_misc.C
src/lyxfunc.C
src/tabular.C
src/tabular.h
src/text.C

index 10e1a43ba985081ee7b80a1919ec9751f695d9a3..254b6f1666eccf668ce38dfbc7d1fa15df121768 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,30 @@
+2000-10-09  Juergen Vigna  <jug@sad.it>
+
+       * src/text.C (GetRow): small fix.
+
+       * src/BufferView_pimpl.C (cursorPrevious): 
+       (cursorNext): added LyXText parameter to function.
+
+       * src/insets/insettabular.C (LocalDispatch): activate cell inset on
+       keypress depending on cursor position.
+
+2000-10-06  Juergen Vigna  <jug@sad.it>
+
+       * src/insets/insettabular.C (Ascii): finally call right ascii-function.
+       (copySelection): redone this function and also copy ascii representa-
+       tion to clipboard.
+
+       * src/tabular.C (Ascii): 
+       (AsciiPrintCell): 
+       (AsciiBottomHLine): 
+       (AsciiTopHLine): 
+       (print_n_chars): new functions to realize the ascii export of tabulars.
+
+2000-10-05  Juergen Vigna  <jug@sad.it>
+
+       * src/lyx_gui_misc.C (updateAllVisibleBufferRelatedDialogs): small fix
+       if we don't have a buffer.
+
 2000-10-10  Allan Rae  <rae@lyx.org>
 
        * src/frontends/xforms/FormPreferences.[Ch] (hide): Fix the problem
index 5c317948850d6621798675ab06140642b4521f18..60f0297b525a56e458dc214ac2bbc7529df00dda 100644 (file)
@@ -197,15 +197,15 @@ void BufferView::workAreaExpose()
 }
 
 
-void BufferView::cursorPrevious()
+void BufferView::cursorPrevious(LyXText * text)
 {
-       pimpl_->cursorPrevious();
+       pimpl_->cursorPrevious(text);
 }
 
 
-void BufferView::cursorNext()
+void BufferView::cursorNext(LyXText * text)
 {
-       pimpl_->cursorNext();
+       pimpl_->cursorNext(text);
 }
 
 
index 822033ede2199a20f0b34f3e0d51cd5b7cb1bcb4..678d39a33698c78592c0a033923b651608ad3250 100644 (file)
@@ -80,9 +80,9 @@ public:
        ///
        void gotoError();
        ///
-       void cursorPrevious();
+       void cursorPrevious(LyXText *);
        ///
-       void cursorNext();
+       void cursorNext(LyXText *);
        /// 
        bool available() const;
        ///
index 3feed20534539d7368a086bdd642c22902bdf9df..85886425b5ac412b5393bcc9901e5b00033ee34f 100644 (file)
@@ -1142,45 +1142,53 @@ void BufferView::Pimpl::cursorToggle()
 }
 
 
-void BufferView::Pimpl::cursorPrevious()
+void BufferView::Pimpl::cursorPrevious(LyXText * text)
 {
-       if (!bv_->text->cursor.row()->previous()) return;
+       if (!text->cursor.row()->previous())
+               return;
        
-       int y = bv_->text->first;
-       Row * cursorrow = bv_->text->cursor.row();
-       bv_->text->SetCursorFromCoordinates(bv_, bv_->text->cursor.x_fix(), y);
+       int y = text->first;
+       if (text->inset_owner)
+               y += bv_->text->first;
+       Row * cursorrow = text->cursor.row();
+       text->SetCursorFromCoordinates(bv_, bv_->text->cursor.x_fix(), y);
        bv_->text->FinishUndo();
        // This is to allow jumping over large insets
-       if ((cursorrow == bv_->text->cursor.row()))
-               bv_->text->CursorUp(bv_);
+       if ((cursorrow == text->cursor.row()))
+               text->CursorUp(bv_);
        
-       if (bv_->text->cursor.row()->height() < workarea_->height())
+       if (text->inset_owner ||
+           text->cursor.row()->height() < workarea_->height())
                screen_->Draw(bv_->text,
-                             bv_->text->cursor.y()
-                             - bv_->text->cursor.row()->baseline()
-                             + bv_->text->cursor.row()->height()
+                             text->cursor.y()
+                             - text->cursor.row()->baseline()
+                             + text->cursor.row()->height()
                              - workarea_->height() + 1 );
        updateScrollbar();
 }
 
 
-void BufferView::Pimpl::cursorNext()
+void BufferView::Pimpl::cursorNext(LyXText * text)
 {
-       if (!bv_->text->cursor.row()->next()) return;
+       if (!text->cursor.row()->next())
+               return;
        
-       int y = bv_->text->first;
-       bv_->text->GetRowNearY(y);
-       Row * cursorrow = bv_->text->cursor.row();
-       bv_->text->SetCursorFromCoordinates(bv_, bv_->text->cursor.x_fix(), y
+       int y = text->first;
+//     if (text->inset_owner)
+//             y += bv_->text->first;
+       text->GetRowNearY(y);
+       Row * cursorrow = text->cursor.row();
+       text->SetCursorFromCoordinates(bv_, text->cursor.x_fix(), y
                                       + workarea_->height());
        bv_->text->FinishUndo();
        // This is to allow jumping over large insets
        if ((cursorrow == bv_->text->cursor.row()))
-               bv_->text->CursorDown(bv_);
+               text->CursorDown(bv_);
        
-       if (bv_->text->cursor.row()->height() < workarea_->height())
-               screen_->Draw(bv_->text, bv_->text->cursor.y()
-                            - bv_->text->cursor.row()->baseline());
+       if (text->inset_owner ||
+           text->cursor.row()->height() < workarea_->height())
+               screen_->Draw(bv_->text, text->cursor.y() -
+                             text->cursor.row()->baseline());
        updateScrollbar();
 }
 
index 858e809af38a029bc985f634468527eaee9aadce..7eaef53b6d3cffeb37ef0492aaed15112641377c 100644 (file)
@@ -81,9 +81,9 @@ struct BufferView::Pimpl : public Object {
        ///
        void cursorToggle();
        ///
-       void cursorPrevious();
+       void cursorPrevious(LyXText *);
        ///
-       void cursorNext();
+       void cursorNext(LyXText *);
        ///
        bool available() const;
        ///
index 9f4ab480e2e26cd195964a1095122304db2fa78e..d2fd0ec56d22e633f8f0d4b891151b2034593294 100644 (file)
@@ -1574,7 +1574,8 @@ string const Buffer::asciiParagraph(LyXParagraph const * par,
        font1 = LyXFont(LyXFont::ALL_INHERIT, params.language_info);
        for (LyXParagraph::size_type i = 0; i < par->size(); ++i) {
                if (!i && !footnoteflag && !noparbreak){
-                       buffer << "\n\n";
+                       if (linelen > 0)
+                               buffer << "\n\n";
                        for(char j = 0; j < depth; ++j)
                                buffer << "  ";
                        currlinelen = depth * 2;
@@ -1584,11 +1585,17 @@ string const Buffer::asciiParagraph(LyXParagraph const * par,
                        case 5: /* Description */
                                break;
                        case 6: /* Abstract */
-                               buffer << "Abstract\n\n";
+                               if (linelen > 0)
+                                       buffer << "Abstract\n\n";
+                               else
+                                       buffer << "Abstract: ";
                                break;
                        case 7: /* Bibliography */
                                if (!ref_printed) {
-                                       buffer << "References\n\n";
+                                       if (linelen > 0)
+                                               buffer << "References\n\n";
+                                       else
+                                               buffer << "References: ";
                                        ref_printed = true;
                                }
                                break;
@@ -1629,9 +1636,11 @@ string const Buffer::asciiParagraph(LyXParagraph const * par,
                        }
                        break;
                case LyXParagraph::META_NEWLINE:
-                       buffer << "\n";
-                       for(char j = 0; j < depth; ++j)
-                               buffer << "  ";
+                       if (linelen > 0) {
+                               buffer << "\n";
+                               for(char j = 0; j < depth; ++j)
+                                       buffer << "  ";
+                       }
                        currlinelen = depth * 2;
                        if (ltype_depth > depth) {
                                for(char j = ltype_depth;
index 36fceee861fd6b542439b9df0f73dc2468a119fc..f8f8b8aeca4ff2c262eb96e255547fcb6f3786d7 100644 (file)
@@ -3,15 +3,13 @@
        --- Qt Architect generated file ---
 
        File: formindexdialogdata.C
-       Last generated: Tue Oct 3 16:28:36 2000
+       Last generated: Fri Oct 6 13:10:23 2000
 
        DO NOT EDIT!!!  This file will be automatically
        regenerated by qtarch.  All changes will be lost.
 
  *********************************************************************/
 
-#include <gettext.h>
-
 #include <qpixmap.h>
 #include <qlayout.h>
 #include "formindexdialogdata.h"
@@ -39,7 +37,7 @@ FormIndexDialogData::FormIndexDialogData
        labelindex->setLineWidth( 1 );
        labelindex->setMidLineWidth( 0 );
        labelindex->QFrame::setMargin( 0 );
-       labelindex->setText( _("Keyword:") );
+       labelindex->setText( "Keyword:" );
        labelindex->setAlignment( 289 );
        labelindex->setMargin( -1 );
 
@@ -51,7 +49,7 @@ FormIndexDialogData::FormIndexDialogData
        index->setBackgroundMode( QWidget::PaletteBase );
        index->setFontPropagation( QWidget::NoChildren );
        index->setPalettePropagation( QWidget::NoChildren );
-       index->setText( _("") );
+       index->setText( "" );
        index->setMaxLength( 32767 );
        index->setFrame( QLineEdit::Normal );
        index->setFrame( TRUE );
@@ -65,7 +63,7 @@ FormIndexDialogData::FormIndexDialogData
        buttonOk->setBackgroundMode( QWidget::PaletteBackground );
        buttonOk->setFontPropagation( QWidget::NoChildren );
        buttonOk->setPalettePropagation( QWidget::NoChildren );
-       buttonOk->setText( _("&OK") );
+       buttonOk->setText( "&OK" );
        buttonOk->setAutoRepeat( FALSE );
        buttonOk->setAutoResize( FALSE );
        buttonOk->setToggleButton( FALSE );
@@ -82,7 +80,7 @@ FormIndexDialogData::FormIndexDialogData
        buttonCancel->setBackgroundMode( QWidget::PaletteBackground );
        buttonCancel->setFontPropagation( QWidget::NoChildren );
        buttonCancel->setPalettePropagation( QWidget::NoChildren );
-       buttonCancel->setText( _("&Cancel") );
+       buttonCancel->setText( "&Cancel" );
        buttonCancel->setAutoRepeat( FALSE );
        buttonCancel->setAutoResize( FALSE );
        buttonCancel->setToggleButton( FALSE );
@@ -90,36 +88,6 @@ FormIndexDialogData::FormIndexDialogData
        buttonCancel->setAutoDefault( FALSE );
        buttonCancel->setIsMenuButton( FALSE );
 
-       if (labelindex->sizeHint().width()!=-1)
-               labelindex->setMinimumWidth(labelindex->sizeHint().width());
-       if (labelindex->sizeHint().height()!=-1)
-               labelindex->setMinimumHeight(labelindex->sizeHint().height());
-       if (labelindex->sizeHint().width()!=-1)
-               labelindex->setMaximumWidth(labelindex->sizeHint().width());
-       if (labelindex->sizeHint().height()!=-1)
-               labelindex->setMaximumHeight(labelindex->sizeHint().height());
-       if (index->sizeHint().width()!=-1)
-               index->setMinimumWidth(index->sizeHint().width());
-       if (index->sizeHint().height()!=-1)
-               index->setMinimumHeight(index->sizeHint().height());
-       if (index->sizeHint().height()!=-1)
-               index->setMaximumHeight(index->sizeHint().height());
-       if (buttonOk->sizeHint().width()!=-1)
-               buttonOk->setMinimumWidth(buttonOk->sizeHint().width());
-       if (buttonOk->sizeHint().height()!=-1)
-               buttonOk->setMinimumHeight(buttonOk->sizeHint().height());
-       if (buttonOk->sizeHint().width()!=-1)
-               buttonOk->setMaximumWidth(buttonOk->sizeHint().width());
-       if (buttonOk->sizeHint().height()!=-1)
-               buttonOk->setMaximumHeight(buttonOk->sizeHint().height());
-       if (buttonCancel->sizeHint().width()!=-1)
-               buttonCancel->setMinimumWidth(buttonCancel->sizeHint().width());
-       if (buttonCancel->sizeHint().height()!=-1)
-               buttonCancel->setMinimumHeight(buttonCancel->sizeHint().height());
-       if (buttonCancel->sizeHint().width()!=-1)
-               buttonCancel->setMaximumWidth(buttonCancel->sizeHint().width());
-       if (buttonCancel->sizeHint().height()!=-1)
-               buttonCancel->setMaximumHeight(buttonCancel->sizeHint().height());
        QGridLayout* qtarch_layout_1 = new QGridLayout( this, 2, 1, 5, 5, NULL );
        qtarch_layout_1->addColSpacing( 0, 5 );
        qtarch_layout_1->setColStretch( 0, 1 );
index c176ef164d468bb034736f6c82892fddc2af7031..e0b918b004b79281ee6fe1eaafcd168780c168a1 100644 (file)
@@ -3,7 +3,7 @@
        --- Qt Architect generated file ---
 
        File: formindexdialogdata.h
-       Last generated: Tue Oct 3 16:28:36 2000
+       Last generated: Fri Oct 6 13:10:23 2000
 
        DO NOT EDIT!!!  This file will be automatically
        regenerated by qtarch.  All changes will be lost.
index f0ad6a6304017cf672abab02f72c020b3a3d8513..d7f426d1986a11560d41de6a60f8972122bbbabb 100644 (file)
@@ -3,15 +3,13 @@
        --- Qt Architect generated file ---
 
        File: formprintdialogdata.C
-       Last generated: Tue Oct 3 18:09:27 2000
+       Last generated: Fri Oct 6 13:10:28 2000
 
        DO NOT EDIT!!!  This file will be automatically
        regenerated by qtarch.  All changes will be lost.
 
  *********************************************************************/
 
-#include <gettext.h>
-
 #include <qpixmap.h>
 #include <qlayout.h>
 #include "formprintdialogdata.h"
@@ -39,7 +37,7 @@ FormPrintDialogData::FormPrintDialogData
        pagesGroupBox->setLineWidth( 1 );
        pagesGroupBox->setMidLineWidth( 0 );
        pagesGroupBox->QFrame::setMargin( 0 );
-       pagesGroupBox->setTitle( _("Pages") );
+       pagesGroupBox->setTitle( "Pages" );
        pagesGroupBox->setAlignment( 1 );
 
        pagesRadioGroup = new QButtonGroup( pagesGroupBox, "pagesRadioGroup" );
@@ -54,7 +52,7 @@ FormPrintDialogData::FormPrintDialogData
        pagesRadioGroup->setLineWidth( 1 );
        pagesRadioGroup->setMidLineWidth( 0 );
        pagesRadioGroup->QFrame::setMargin( 0 );
-       pagesRadioGroup->setTitle( _("") );
+       pagesRadioGroup->setTitle( "" );
        pagesRadioGroup->setAlignment( 1 );
        pagesRadioGroup->setExclusive( TRUE );
 
@@ -70,7 +68,7 @@ FormPrintDialogData::FormPrintDialogData
        copies->setLineWidth( 1 );
        copies->setMidLineWidth( 0 );
        copies->QFrame::setMargin( 0 );
-       copies->setTitle( _("Copies") );
+       copies->setTitle( "Copies" );
        copies->setAlignment( 1 );
 
        printToGroupBox = new QGroupBox( this, "printToGroupBox" );
@@ -85,7 +83,7 @@ FormPrintDialogData::FormPrintDialogData
        printToGroupBox->setLineWidth( 1 );
        printToGroupBox->setMidLineWidth( 0 );
        printToGroupBox->QFrame::setMargin( 0 );
-       printToGroupBox->setTitle( _("Print to") );
+       printToGroupBox->setTitle( "Print to" );
        printToGroupBox->setAlignment( 1 );
 
        printToRadioGroup = new QButtonGroup( printToGroupBox, "printToRadioGroup" );
@@ -100,7 +98,7 @@ FormPrintDialogData::FormPrintDialogData
        printToRadioGroup->setLineWidth( 1 );
        printToRadioGroup->setMidLineWidth( 0 );
        printToRadioGroup->QFrame::setMargin( 0 );
-       printToRadioGroup->setTitle( _("") );
+       printToRadioGroup->setTitle( "" );
        printToRadioGroup->setAlignment( 1 );
        printToRadioGroup->setExclusive( TRUE );
 
@@ -113,7 +111,7 @@ FormPrintDialogData::FormPrintDialogData
        print->setBackgroundMode( QWidget::PaletteBackground );
        print->setFontPropagation( QWidget::NoChildren );
        print->setPalettePropagation( QWidget::NoChildren );
-       print->setText( _("&Print") );
+       print->setText( "&Print" );
        print->setAutoRepeat( FALSE );
        print->setAutoResize( FALSE );
        print->setToggleButton( FALSE );
@@ -130,7 +128,7 @@ FormPrintDialogData::FormPrintDialogData
        cancel->setBackgroundMode( QWidget::PaletteBackground );
        cancel->setFontPropagation( QWidget::NoChildren );
        cancel->setPalettePropagation( QWidget::NoChildren );
-       cancel->setText( _("&Cancel") );
+       cancel->setText( "&Cancel" );
        cancel->setAutoRepeat( FALSE );
        cancel->setAutoResize( FALSE );
        cancel->setToggleButton( FALSE );
@@ -146,7 +144,7 @@ FormPrintDialogData::FormPrintDialogData
        allpages->setBackgroundMode( QWidget::PaletteBackground );
        allpages->setFontPropagation( QWidget::NoChildren );
        allpages->setPalettePropagation( QWidget::NoChildren );
-       allpages->setText( _("&All pages") );
+       allpages->setText( "&All pages" );
        allpages->setAutoRepeat( FALSE );
        allpages->setAutoResize( FALSE );
        allpages->setChecked( FALSE );
@@ -159,7 +157,7 @@ FormPrintDialogData::FormPrintDialogData
        evenpages->setBackgroundMode( QWidget::PaletteBackground );
        evenpages->setFontPropagation( QWidget::NoChildren );
        evenpages->setPalettePropagation( QWidget::NoChildren );
-       evenpages->setText( _("&Even pages") );
+       evenpages->setText( "&Even pages" );
        evenpages->setAutoRepeat( FALSE );
        evenpages->setAutoResize( FALSE );
        evenpages->setChecked( FALSE );
@@ -172,7 +170,7 @@ FormPrintDialogData::FormPrintDialogData
        from->setBackgroundMode( QWidget::PaletteBase );
        from->setFontPropagation( QWidget::NoChildren );
        from->setPalettePropagation( QWidget::NoChildren );
-       from->setText( _("") );
+       from->setText( "" );
        from->setMaxLength( 32767 );
        from->setFrame( QLineEdit::Normal );
        from->setFrame( TRUE );
@@ -189,7 +187,7 @@ FormPrintDialogData::FormPrintDialogData
        fromLabel->setLineWidth( 1 );
        fromLabel->setMidLineWidth( 0 );
        fromLabel->QFrame::setMargin( 0 );
-       fromLabel->setText( _("From") );
+       fromLabel->setText( "From" );
        fromLabel->setAlignment( 289 );
        fromLabel->setMargin( -1 );
 
@@ -205,7 +203,7 @@ FormPrintDialogData::FormPrintDialogData
        toLabel->setLineWidth( 1 );
        toLabel->setMidLineWidth( 0 );
        toLabel->QFrame::setMargin( 0 );
-       toLabel->setText( _("To") );
+       toLabel->setText( "To" );
        toLabel->setAlignment( 289 );
        toLabel->setMargin( -1 );
 
@@ -217,7 +215,7 @@ FormPrintDialogData::FormPrintDialogData
        oddpages->setBackgroundMode( QWidget::PaletteBackground );
        oddpages->setFontPropagation( QWidget::NoChildren );
        oddpages->setPalettePropagation( QWidget::NoChildren );
-       oddpages->setText( _("&Odd pages") );
+       oddpages->setText( "&Odd pages" );
        oddpages->setAutoRepeat( FALSE );
        oddpages->setAutoResize( FALSE );
        oddpages->setChecked( FALSE );
@@ -230,7 +228,7 @@ FormPrintDialogData::FormPrintDialogData
        toprinter->setBackgroundMode( QWidget::PaletteBackground );
        toprinter->setFontPropagation( QWidget::NoChildren );
        toprinter->setPalettePropagation( QWidget::NoChildren );
-       toprinter->setText( _("&Printer") );
+       toprinter->setText( "&Printer" );
        toprinter->setAutoRepeat( FALSE );
        toprinter->setAutoResize( FALSE );
        toprinter->setChecked( FALSE );
@@ -243,7 +241,7 @@ FormPrintDialogData::FormPrintDialogData
        tofile->setBackgroundMode( QWidget::PaletteBackground );
        tofile->setFontPropagation( QWidget::NoChildren );
        tofile->setPalettePropagation( QWidget::NoChildren );
-       tofile->setText( _("&File") );
+       tofile->setText( "&File" );
        tofile->setAutoRepeat( FALSE );
        tofile->setAutoResize( FALSE );
        tofile->setChecked( FALSE );
@@ -256,7 +254,7 @@ FormPrintDialogData::FormPrintDialogData
        printername->setBackgroundMode( QWidget::PaletteBase );
        printername->setFontPropagation( QWidget::NoChildren );
        printername->setPalettePropagation( QWidget::NoChildren );
-       printername->setText( _("") );
+       printername->setText( "" );
        printername->setMaxLength( 32767 );
        printername->setFrame( QLineEdit::Normal );
        printername->setFrame( TRUE );
@@ -269,7 +267,7 @@ FormPrintDialogData::FormPrintDialogData
        reverse->setBackgroundMode( QWidget::PaletteBackground );
        reverse->setFontPropagation( QWidget::NoChildren );
        reverse->setPalettePropagation( QWidget::NoChildren );
-       reverse->setText( _("&Reverse order") );
+       reverse->setText( "&Reverse order" );
        reverse->setAutoRepeat( FALSE );
        reverse->setAutoResize( TRUE );
        reverse->setChecked( FALSE );
@@ -282,7 +280,7 @@ FormPrintDialogData::FormPrintDialogData
        filename->setBackgroundMode( QWidget::PaletteBase );
        filename->setFontPropagation( QWidget::NoChildren );
        filename->setPalettePropagation( QWidget::NoChildren );
-       filename->setText( _("") );
+       filename->setText( "" );
        filename->setMaxLength( 32767 );
        filename->setFrame( QLineEdit::Normal );
        filename->setFrame( TRUE );
@@ -295,7 +293,7 @@ FormPrintDialogData::FormPrintDialogData
        sort->setBackgroundMode( QWidget::PaletteBackground );
        sort->setFontPropagation( QWidget::NoChildren );
        sort->setPalettePropagation( QWidget::NoChildren );
-       sort->setText( _("&Sort") );
+       sort->setText( "&Sort" );
        sort->setAutoRepeat( FALSE );
        sort->setAutoResize( TRUE );
        sort->setChecked( FALSE );
@@ -309,7 +307,7 @@ FormPrintDialogData::FormPrintDialogData
        browse->setBackgroundMode( QWidget::PaletteBackground );
        browse->setFontPropagation( QWidget::NoChildren );
        browse->setPalettePropagation( QWidget::NoChildren );
-       browse->setText( _("&Browse") );
+       browse->setText( "&Browse" );
        browse->setAutoRepeat( FALSE );
        browse->setAutoResize( FALSE );
        browse->setToggleButton( FALSE );
@@ -325,7 +323,7 @@ FormPrintDialogData::FormPrintDialogData
        count->setBackgroundMode( QWidget::PaletteBase );
        count->setFontPropagation( QWidget::NoChildren );
        count->setPalettePropagation( QWidget::NoChildren );
-       count->setText( _("") );
+       count->setText( "" );
        count->setMaxLength( 32767 );
        count->setFrame( QLineEdit::Normal );
        count->setFrame( TRUE );
@@ -342,7 +340,7 @@ FormPrintDialogData::FormPrintDialogData
        countLabel->setLineWidth( 1 );
        countLabel->setMidLineWidth( 0 );
        countLabel->QFrame::setMargin( 0 );
-       countLabel->setText( _("Count") );
+       countLabel->setText( "Count" );
        countLabel->setAlignment( 289 );
        countLabel->setMargin( -1 );
 
@@ -354,7 +352,7 @@ FormPrintDialogData::FormPrintDialogData
        to->setBackgroundMode( QWidget::PaletteBase );
        to->setFontPropagation( QWidget::NoChildren );
        to->setPalettePropagation( QWidget::NoChildren );
-       to->setText( _("") );
+       to->setText( "" );
        to->setMaxLength( 32767 );
        to->setFrame( QLineEdit::Normal );
        to->setFrame( TRUE );
@@ -366,140 +364,6 @@ FormPrintDialogData::FormPrintDialogData
        printToRadioGroup->insert( toprinter );
        printToRadioGroup->insert( tofile );
 
-       if (print->sizeHint().width()!=-1)
-               print->setMinimumWidth(print->sizeHint().width());
-       if (print->sizeHint().height()!=-1)
-               print->setMinimumHeight(print->sizeHint().height());
-       if (print->sizeHint().width()!=-1)
-               print->setMaximumWidth(print->sizeHint().width());
-       if (print->sizeHint().height()!=-1)
-               print->setMaximumHeight(print->sizeHint().height());
-       if (cancel->sizeHint().width()!=-1)
-               cancel->setMinimumWidth(cancel->sizeHint().width());
-       if (cancel->sizeHint().height()!=-1)
-               cancel->setMinimumHeight(cancel->sizeHint().height());
-       if (cancel->sizeHint().width()!=-1)
-               cancel->setMaximumWidth(cancel->sizeHint().width());
-       if (cancel->sizeHint().height()!=-1)
-               cancel->setMaximumHeight(cancel->sizeHint().height());
-       if (allpages->sizeHint().width()!=-1)
-               allpages->setMinimumWidth(allpages->sizeHint().width());
-       if (allpages->sizeHint().height()!=-1)
-               allpages->setMinimumHeight(allpages->sizeHint().height());
-       if (allpages->sizeHint().width()!=-1)
-               allpages->setMaximumWidth(allpages->sizeHint().width());
-       if (allpages->sizeHint().height()!=-1)
-               allpages->setMaximumHeight(allpages->sizeHint().height());
-       if (evenpages->sizeHint().width()!=-1)
-               evenpages->setMinimumWidth(evenpages->sizeHint().width());
-       if (evenpages->sizeHint().height()!=-1)
-               evenpages->setMinimumHeight(evenpages->sizeHint().height());
-       if (evenpages->sizeHint().width()!=-1)
-               evenpages->setMaximumWidth(evenpages->sizeHint().width());
-       if (evenpages->sizeHint().height()!=-1)
-               evenpages->setMaximumHeight(evenpages->sizeHint().height());
-       if (from->sizeHint().width()!=-1)
-               from->setMinimumWidth(from->sizeHint().width());
-       if (from->sizeHint().height()!=-1)
-               from->setMinimumHeight(from->sizeHint().height());
-       if (from->sizeHint().height()!=-1)
-               from->setMaximumHeight(from->sizeHint().height());
-       if (fromLabel->sizeHint().width()!=-1)
-               fromLabel->setMinimumWidth(fromLabel->sizeHint().width());
-       if (fromLabel->sizeHint().height()!=-1)
-               fromLabel->setMinimumHeight(fromLabel->sizeHint().height());
-       if (fromLabel->sizeHint().width()!=-1)
-               fromLabel->setMaximumWidth(fromLabel->sizeHint().width());
-       if (fromLabel->sizeHint().height()!=-1)
-               fromLabel->setMaximumHeight(fromLabel->sizeHint().height());
-       if (toLabel->sizeHint().width()!=-1)
-               toLabel->setMinimumWidth(toLabel->sizeHint().width());
-       if (toLabel->sizeHint().height()!=-1)
-               toLabel->setMinimumHeight(toLabel->sizeHint().height());
-       if (toLabel->sizeHint().width()!=-1)
-               toLabel->setMaximumWidth(toLabel->sizeHint().width());
-       if (toLabel->sizeHint().height()!=-1)
-               toLabel->setMaximumHeight(toLabel->sizeHint().height());
-       if (oddpages->sizeHint().width()!=-1)
-               oddpages->setMinimumWidth(oddpages->sizeHint().width());
-       if (oddpages->sizeHint().height()!=-1)
-               oddpages->setMinimumHeight(oddpages->sizeHint().height());
-       if (oddpages->sizeHint().width()!=-1)
-               oddpages->setMaximumWidth(oddpages->sizeHint().width());
-       if (oddpages->sizeHint().height()!=-1)
-               oddpages->setMaximumHeight(oddpages->sizeHint().height());
-       if (toprinter->sizeHint().width()!=-1)
-               toprinter->setMinimumWidth(toprinter->sizeHint().width());
-       if (toprinter->sizeHint().height()!=-1)
-               toprinter->setMinimumHeight(toprinter->sizeHint().height());
-       if (toprinter->sizeHint().width()!=-1)
-               toprinter->setMaximumWidth(toprinter->sizeHint().width());
-       if (toprinter->sizeHint().height()!=-1)
-               toprinter->setMaximumHeight(toprinter->sizeHint().height());
-       if (tofile->sizeHint().width()!=-1)
-               tofile->setMinimumWidth(tofile->sizeHint().width());
-       if (tofile->sizeHint().height()!=-1)
-               tofile->setMinimumHeight(tofile->sizeHint().height());
-       if (tofile->sizeHint().width()!=-1)
-               tofile->setMaximumWidth(tofile->sizeHint().width());
-       if (tofile->sizeHint().height()!=-1)
-               tofile->setMaximumHeight(tofile->sizeHint().height());
-       if (printername->sizeHint().width()!=-1)
-               printername->setMinimumWidth(printername->sizeHint().width());
-       if (printername->sizeHint().height()!=-1)
-               printername->setMinimumHeight(printername->sizeHint().height());
-       if (printername->sizeHint().height()!=-1)
-               printername->setMaximumHeight(printername->sizeHint().height());
-       if (reverse->sizeHint().width()!=-1)
-               reverse->setMinimumWidth(reverse->sizeHint().width());
-       if (reverse->sizeHint().height()!=-1)
-               reverse->setMinimumHeight(reverse->sizeHint().height());
-       if (reverse->sizeHint().width()!=-1)
-               reverse->setMaximumWidth(reverse->sizeHint().width());
-       if (reverse->sizeHint().height()!=-1)
-               reverse->setMaximumHeight(reverse->sizeHint().height());
-       if (filename->sizeHint().width()!=-1)
-               filename->setMinimumWidth(filename->sizeHint().width());
-       if (filename->sizeHint().height()!=-1)
-               filename->setMinimumHeight(filename->sizeHint().height());
-       if (filename->sizeHint().height()!=-1)
-               filename->setMaximumHeight(filename->sizeHint().height());
-       if (sort->sizeHint().width()!=-1)
-               sort->setMinimumWidth(sort->sizeHint().width());
-       if (sort->sizeHint().height()!=-1)
-               sort->setMinimumHeight(sort->sizeHint().height());
-       if (sort->sizeHint().width()!=-1)
-               sort->setMaximumWidth(sort->sizeHint().width());
-       if (sort->sizeHint().height()!=-1)
-               sort->setMaximumHeight(sort->sizeHint().height());
-       if (browse->sizeHint().width()!=-1)
-               browse->setMinimumWidth(browse->sizeHint().width());
-       if (browse->sizeHint().height()!=-1)
-               browse->setMinimumHeight(browse->sizeHint().height());
-       if (browse->sizeHint().width()!=-1)
-               browse->setMaximumWidth(browse->sizeHint().width());
-       if (browse->sizeHint().height()!=-1)
-               browse->setMaximumHeight(browse->sizeHint().height());
-       if (count->sizeHint().width()!=-1)
-               count->setMinimumWidth(count->sizeHint().width());
-       if (count->sizeHint().height()!=-1)
-               count->setMinimumHeight(count->sizeHint().height());
-       if (count->sizeHint().height()!=-1)
-               count->setMaximumHeight(count->sizeHint().height());
-       if (countLabel->sizeHint().width()!=-1)
-               countLabel->setMinimumWidth(countLabel->sizeHint().width());
-       if (countLabel->sizeHint().height()!=-1)
-               countLabel->setMinimumHeight(countLabel->sizeHint().height());
-       if (countLabel->sizeHint().width()!=-1)
-               countLabel->setMaximumWidth(countLabel->sizeHint().width());
-       if (countLabel->sizeHint().height()!=-1)
-               countLabel->setMaximumHeight(countLabel->sizeHint().height());
-       if (to->sizeHint().width()!=-1)
-               to->setMinimumWidth(to->sizeHint().width());
-       if (to->sizeHint().height()!=-1)
-               to->setMinimumHeight(to->sizeHint().height());
-       if (to->sizeHint().height()!=-1)
-               to->setMaximumHeight(to->sizeHint().height());
        QGridLayout* qtarch_layout_1 = new QGridLayout( this, 2, 1, 5, 5, NULL );
        qtarch_layout_1->addColSpacing( 0, 5 );
        qtarch_layout_1->setColStretch( 0, 1 );
index 23a03739bff2ca4ab45874d614c442fa022fbf4d..fb46d0262cfedf9b3ed7299fe8efc400fdd0ed37 100644 (file)
@@ -3,7 +3,7 @@
        --- Qt Architect generated file ---
 
        File: formprintdialogdata.h
-       Last generated: Tue Oct 3 18:09:27 2000
+       Last generated: Fri Oct 6 13:10:28 2000
 
        DO NOT EDIT!!!  This file will be automatically
        regenerated by qtarch.  All changes will be lost.
index 0d0bc9d93a26dba794b29e6384c6b1e4d197a682..0c2bf5647e076af65d59c01106e7230fbcac9231 100644 (file)
@@ -857,7 +857,7 @@ UpdatableInset::RESULT InsetTabular::LocalDispatch(BufferView * bv, int action,
            result = UNDISPATCHED;
        break;
     case LFUN_CUT:
-       if (!copySelection())
+       if (!copySelection(bv))
            break;
        bv->text->SetUndo(bv->buffer(), Undo::DELETE,
 #ifndef NEW_INSETS
@@ -875,7 +875,7 @@ UpdatableInset::RESULT InsetTabular::LocalDispatch(BufferView * bv, int action,
        if (!hasSelection())
            break;
        bv->text->FinishUndo();
-       copySelection();
+       copySelection(bv);
        break;
     case LFUN_PASTE:
        if (!hasPasteBuffer())
@@ -898,7 +898,7 @@ UpdatableInset::RESULT InsetTabular::LocalDispatch(BufferView * bv, int action,
        result = UNDISPATCHED;
        if (the_locking_inset)
            break;
-       if (ActivateCellInset(bv)) {
+       if (ActivateCellInset(bv, 0, 0, 0, !cellstart(cursor.pos()))) {
            result=the_locking_inset->LocalDispatch(bv, action, arg);
            if (result == DISPATCHED_NOUPDATE)
                return result;
@@ -933,7 +933,7 @@ int InsetTabular::Latex(Buffer const * buf, ostream & os,
 int InsetTabular::Ascii(Buffer const * buf, ostream & os, int) const
 {
     // This should be changed to a real ascii export
-    return tabular->Latex(buf, os, false, false);
+    return tabular->Ascii(buf, os);
 }
 
 
@@ -1061,7 +1061,7 @@ void InsetTabular::setPos(BufferView * bv, int x, int y) const
     int lx = tabular->GetWidthOfColumn(actcell) -
        tabular->GetAdditionalWidth(actcell);
 #warning Jürgen, can you rewrite this to _not_ use the sequencing operator. (Lgb)
-#if 0
+#if 1
     for(; !tabular->IsLastCellInRow(actcell) && (lx < x);
        ++actcell,lx += tabular->GetWidthOfColumn(actcell) +
            tabular->GetAdditionalWidth(actcell - 1));
@@ -1904,7 +1904,7 @@ LyXFunc::func_status InsetTabular::getStatus(string const & what) const
 }
 
 
-bool InsetTabular::copySelection()
+bool InsetTabular::copySelection(BufferView * bv)
 {
     if (!hasSelection())
        return false;
@@ -1933,25 +1933,25 @@ bool InsetTabular::copySelection()
     }
     int rows = sel_row_end - sel_row_start + 1;
 
-    paste_tabular = new LyXTabular(this, rows, columns);
-    
-    if (sel_cell_start > sel_cell_end) {
-           //int tmp = sel_cell_start;
-           //sel_cell_start = sel_cell_end;
-           //sel_cell_end = tmp;
-       swap(sel_cell_start, sel_cell_end);
-    }
-    for(int i = sel_cell_start, j = 0; i <= sel_cell_end; ++i, ++j) {
-       while(paste_tabular->row_of_cell(j) <
-             (tabular->row_of_cell(i)-sel_row_start)) {
-           ++j;
-       }
-       while(paste_tabular->row_of_cell(j) >
-             (tabular->row_of_cell(i)-sel_row_start)) {
-           ++i;
-       }
-       *(paste_tabular->GetCellInset(j)) = *(tabular->GetCellInset(i));
-    }
+    paste_tabular = new LyXTabular(this, *tabular); // rows, columns);
+    int i;
+    for(i=0; i < sel_row_start; ++i)
+       paste_tabular->DeleteRow(0);
+    while(paste_tabular->rows() > rows)
+       paste_tabular->DeleteRow(rows);
+    paste_tabular->SetTopLine(0, true, true);
+    paste_tabular->SetBottomLine(paste_tabular->GetFirstCellInRow(rows-1),
+                                true, true);
+    for(i=0; i < sel_col_start; ++i)
+       paste_tabular->DeleteColumn(0);
+    while(paste_tabular->columns() > columns)
+       paste_tabular->DeleteColumn(columns);
+    paste_tabular->SetLeftLine(0, true, true);
+    paste_tabular->SetRightLine(paste_tabular->GetLastCellInRow(0),true, true);
+
+    ostringstream sstr;
+    paste_tabular->Ascii(bv->buffer(), sstr);
+    bv->stuffClipboard(sstr.str());
     return true;
 }
 
index 6a5862f91b318936ec14105b85af7e54a711c41f..ecacb2dba7a5719eeb844d0574a427c8da894488 100644 (file)
@@ -224,7 +224,7 @@ private:
     ///
     bool hasPasteBuffer() const;
     ///
-    bool copySelection();
+    bool copySelection(BufferView *);
     ///
     bool pasteSelection(BufferView *);
     ///
index e4e6d3ad49bb0a054c815913e6b984f64cd5c2dd..87bfa469d0d09bee1200a4c28781a7b0509b4416 100644 (file)
@@ -315,10 +315,19 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
     x += TEXT_TO_INSET_OFFSET;
     int y = 0;
     Row * row = TEXT(bv)->GetRowNearY(y);
-    y += baseline - row->ascent_of_text();
+    int fa = row->ascent_of_text();
+    y += baseline - fa;
+    while (row != 0) {
+       if (((y+row->height()) > 0) && (y < pain.paperHeight()))
+           break;
+       y += row->height();
+       row = row->next();
+    }
+    TEXT(bv)->first = y - top_baseline + fa;
     if (cleared || !locked || (need_update == FULL)) {
        while (row != 0) {
-           TEXT(bv)->GetVisibleRow(bv, int(y), int(x), row, y, cleared);
+           if (((y+row->height()) > 0) && (y < pain.paperHeight()))
+               TEXT(bv)->GetVisibleRow(bv, int(y), int(x), row, y, cleared);
            y += row->height();
            row = row->next();
        }
@@ -466,7 +475,7 @@ void InsetText::Edit(BufferView * bv, int x, int y, unsigned int button)
     old_par = 0;
     if (!checkAndActivateInset(bv, x, y, button))
        TEXT(bv)->SetCursorFromCoordinates(bv, x-drawTextXOffset,
-                                          y+TEXT(bv)->first+insetAscent);
+                                          y+insetAscent);
     TEXT(bv)->sel_cursor = TEXT(bv)->cursor;
     bv->text->FinishUndo();
     ShowInsetCursor(bv);
@@ -614,7 +623,7 @@ void InsetText::InsetButtonPress(BufferView * bv, int x, int y, int button)
            paste_internally = true;
        }
        TEXT(bv)->SetCursorFromCoordinates(bv, x-drawTextXOffset,
-                                          y+TEXT(bv)->first+insetAscent);
+                                          y+insetAscent);
        TEXT(bv)->sel_cursor = TEXT(bv)->cursor;
        UpdateLocal(bv, CURSOR, false);
        bv->owner()->setLayout(cpar(bv)->GetLayout());
@@ -669,7 +678,7 @@ void InsetText::InsetMotionNotify(BufferView * bv, int x, int y, int state)
     if (!no_selection) {
        HideInsetCursor(bv);
        TEXT(bv)->SetCursorFromCoordinates(bv, x-drawTextXOffset,
-                                          y+TEXT(bv)->first+insetAscent);
+                                          y+insetAscent);
        TEXT(bv)->SetSelection();
        if (TEXT(bv)->toggle_cursor.par()!=TEXT(bv)->toggle_end_cursor.par() ||
            TEXT(bv)->toggle_cursor.pos()!=TEXT(bv)->toggle_end_cursor.pos())
@@ -1057,14 +1066,13 @@ int InsetText::Ascii(Buffer const * buf, ostream & os, int linelen) const
     LyXParagraph * p = par;
     unsigned int lines = 0;
     
+    string tmp;
     while (p) {
-       string const tmp = buf->asciiParagraph(p, linelen);
+       tmp = buf->asciiParagraph(p, linelen);
        lines += countChar(tmp, '\n');
        os << tmp;
        p = p->next;
     }
-    os << "\n";
-    ++lines;
     return lines;
 }
 
index 8d05868f4c909265b50edaed2c096ab5f23144a9..aafdf8fdf38874c684b4a38b59c63bfb7b54b487 100644 (file)
@@ -151,7 +151,7 @@ void updateAllVisibleBufferRelatedDialogs()
        if (fd_latex_log->LaTeXLog->visible) {
                LatexLogUpdate(0,0);
        }
-       if (current_view->buffer()->isReadonly()) {
+       if (current_view->buffer() &&  current_view->buffer()->isReadonly()) {
                // a little crude perhaps but it works. ARRae
                if (fd_form_character->form_character->visible) {
                        fl_hide_form(fd_form_character->form_character);
index 87c4594042547e2a7c7f5b9d8715ce1723a07273..45c612511c7bc414d709aa2efbc8431d3d4bc816 100644 (file)
@@ -687,7 +687,6 @@ string const LyXFunc::Dispatch(int ac,
         }
 
        if (owner->view()->available() && owner->view()->theLockingInset()) {
-               text = owner->view()->theLockingInset()->getLyXText(owner->view());
                UpdatableInset::RESULT result;
                if ((action > 1) || ((action == LFUN_UNKNOWN_ACTION) &&
                                     (keyseq.length >= -1)))
@@ -771,6 +770,9 @@ string const LyXFunc::Dispatch(int ac,
                                }
                        }
                }
+               if (owner->view()->theLockingInset())
+                       text = owner->view()->theLockingInset()->
+                               getLyXText(owner->view());
        }
 
        if (!text)
@@ -1644,22 +1646,28 @@ string const LyXFunc::Dispatch(int ac,
                break;
                
        case LFUN_PRIOR:
-               if(!owner->view()->text->mark_set)
-                       owner->view()->beforeChange();
+               if(!text->mark_set)
+                   owner->view()->beforeChange();
                owner->view()->update(BufferView::UPDATE);
-               owner->view()->cursorPrevious();
+               owner->view()->cursorPrevious(text);
                owner->view()->text->FinishUndo();
-               moveCursorUpdate(false);
+               if (text->inset_owner)
+                   owner->view()->updateInset(text->inset_owner, false);
+               else
+                   moveCursorUpdate(false);
                owner->showState();
                break;
                
        case LFUN_NEXT:
-               if(!owner->view()->text->mark_set)
+               if(!text->mark_set)
                        owner->view()->beforeChange();
                owner->view()->update(BufferView::UPDATE);
-               owner->view()->cursorNext();
+               owner->view()->cursorNext(text);
                owner->view()->text->FinishUndo();
-               moveCursorUpdate(false);
+               if (text->inset_owner)
+                   owner->view()->updateInset(text->inset_owner, false);
+               else
+                   moveCursorUpdate(false);
                owner->showState();
                break;
                
@@ -1802,17 +1810,23 @@ string const LyXFunc::Dispatch(int ac,
                
        case LFUN_PRIORSEL:
                owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
-               owner->view()->cursorPrevious();
+               owner->view()->cursorPrevious(text);
                owner->view()->text->FinishUndo();
-               moveCursorUpdate(true);
+               if (text->inset_owner)
+                   owner->view()->updateInset(text->inset_owner, false);
+               else
+                   moveCursorUpdate(true);
                owner->showState();
                break;
                
        case LFUN_NEXTSEL:
                owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
-               owner->view()->cursorNext();
+               owner->view()->cursorNext(text);
                owner->view()->text->FinishUndo();
-               moveCursorUpdate(true);
+               if (text->inset_owner)
+                   owner->view()->updateInset(text->inset_owner, false);
+               else
+                   moveCursorUpdate(true);
                owner->showState();
                break;
                
index b6a52c8fbe9022059daef98f1da9a4694414a96c..215729b7a7cc60eec47a123b7ae9b3b7738b59bd 100644 (file)
@@ -1589,7 +1589,7 @@ int LyXTabular::DocBookEndOfCell(ostream & os, int cell, int & depth) const
 bool LyXTabular::IsMultiColumn(int cell, bool real) const
 {
     return ((!real || (column_of_cell(cell) != right_column_of_cell(cell))) &&
-       (cellinfo_of_cell(cell)->multicolumn !=LyXTabular::CELL_NORMAL));
+       (cellinfo_of_cell(cell)->multicolumn != LyXTabular::CELL_NORMAL));
 }
 
 
@@ -1930,7 +1930,7 @@ int LyXTabular::TeXTopHLine(ostream & os, int row) const
     }
     if (tmp == (n - fcell)){
        os << "\\hline ";
-    } else {
+    } else if (tmp) {
        for (int i = fcell; i < n; ++i) {
            if (TopLine(i)) {
                os << "\\cline{"
@@ -1940,12 +1940,11 @@ int LyXTabular::TeXTopHLine(ostream & os, int row) const
                   << "} ";
            }
        }
+    } else {
+       return 0;
     }
-    if (tmp) {
-       os << endl;
-       return 1;
-    }
-    return 0;
+    os << endl;
+    return 1;
 }
 
 
@@ -1961,7 +1960,7 @@ int LyXTabular::TeXBottomHLine(ostream & os, int row) const
     }
     if (tmp == (n-fcell)){
        os << "\\hline";
-    } else {
+    } else if (tmp) {
        for (int i = fcell; i < n; ++i) {
            if (BottomLine(i)) {
                os << "\\cline{"
@@ -1971,12 +1970,11 @@ int LyXTabular::TeXBottomHLine(ostream & os, int row) const
                   << "} ";
            }
        }
+    } else {
+       return 0;
     }
-    if (tmp) {
-       os << endl;
-       return 1;
-    }
-    return 0;
+    os << endl;
+    return 1;
 }
 
 
@@ -2231,6 +2229,208 @@ int LyXTabular::Latex(Buffer const * buf,
 }
 
 
+static void print_n_chars(ostream & os, unsigned char ch, int const n)
+{
+    for(int i=0; i < n; ++i)
+       os << ch;
+}
+
+int LyXTabular::AsciiTopHLine(ostream & os, int row,
+                             vector<unsigned int> const & clen) const
+{
+    int const fcell = GetFirstCellInRow(row);
+    int const n = NumberOfCellsInRow(fcell) + fcell;
+    int len;
+    int column = 0;
+    unsigned char ch;
+    int tmp = 0;
+
+    for (int i = fcell; i < n; ++i) {
+       if (TopLine(i))
+           ++tmp;
+    }
+    if (!tmp)
+       return 0;
+
+    for (int i = fcell; i < n; ++i) {
+       if (TopLine(i)) {
+           if (LeftLine(i))
+               os << "+-";
+           else
+               os << "--";
+           ch = '-';
+       } else {
+           os << "  ";
+           ch = ' ';
+       }
+       column = column_of_cell(i);
+       len = clen[column];
+       while(IsPartOfMultiColumn(row, ++column))
+           len += clen[column] + 4;
+       print_n_chars(os, ch, len);
+       if (TopLine(i)) {
+           if (RightLine(i))
+               os << "-+";
+           else
+               os << "--";
+       } else {
+           os << "  ";
+       }
+    }
+    os << endl;
+    return 1;
+}
+
+
+int LyXTabular::AsciiBottomHLine(ostream & os, int row,
+                                vector<unsigned int> const & clen) const
+{
+    int const fcell = GetFirstCellInRow(row);
+    int const n = NumberOfCellsInRow(fcell) + fcell;
+    int len;
+    int column = 0;
+    unsigned char ch;
+    int tmp = 0;
+
+    for (int i = fcell; i < n; ++i) {
+       if (BottomLine(i))
+           ++tmp;
+    }
+    if (!tmp)
+       return 0;
+
+    for (int i = fcell; i < n; ++i) {
+       if (BottomLine(i)) {
+           if (LeftLine(i))
+               os << "+-";
+           else
+               os << "--";
+           ch = '-';
+       } else {
+           os << "  ";
+           ch = ' ';
+       }
+       column = column_of_cell(i);
+       len = clen[column];
+       while(IsPartOfMultiColumn(row, ++column))
+           len += clen[column] + 4;
+       print_n_chars(os, ch, len);
+       if (BottomLine(i)) {
+           if (RightLine(i))
+               os << "-+";
+           else
+               os << "--";
+       } else {
+           os << "  ";
+       }
+    }
+    os << endl;
+    return 1;
+}
+
+
+int LyXTabular::AsciiPrintCell(Buffer const * buf, ostream & os,
+                              int cell, int row, int column,
+                              vector<unsigned int> const & clen) const
+{
+    ostringstream sstr;
+    int ret = GetCellInset(cell)->Ascii(buf, sstr, 0);
+
+    if (LeftLine(cell))
+       os << "| ";
+    else
+       os << "  ";
+
+    unsigned int len1 = sstr.str().length();
+    unsigned int len2 = clen[column];
+    while(IsPartOfMultiColumn(row, ++column))
+       len2 += clen[column] + 4;
+    len2 -= len1;
+
+    switch(GetAlignment(cell)) {
+    default:
+    case LYX_ALIGN_LEFT:
+       len1 = 0;
+       break;
+    case LYX_ALIGN_RIGHT:
+       len1 = len2;
+       len2 = 0;
+       break;
+    case LYX_ALIGN_CENTER:
+       len1 = len2 / 2;
+       len2 -= len1;
+       break;
+    }
+
+    unsigned int i;
+    for(i=0; i < len1; ++i)
+       os << " ";
+    os << sstr.str();
+    for(i=0; i < len2; ++i)
+       os << " ";
+    if (RightLine(cell))
+       os << " |";
+    else
+       os << "  ";
+
+    return ret * 0;
+}
+
+
+int LyXTabular::Ascii(Buffer const * buf, ostream & os) const
+{
+    int ret = 0;
+
+    //+---------------------------------------------------------------------
+    //+           first calculate the width of the single columns          +
+    //+---------------------------------------------------------------------
+    vector<unsigned int> clen(columns_);
+    int cell;
+
+    // first all non (real) multicolumn cells!
+    for(int j = 0; j < columns_; ++j) {
+       clen[j] = 0;
+       for(int i = 0; i < rows_; ++i) {
+           cell = GetCellNumber(i, j);
+           if (IsMultiColumn(cell, true))
+               continue;
+           ostringstream sstr;
+           (void)GetCellInset(cell)->Ascii(buf, sstr, 0);
+           if (clen[j] < sstr.str().length())
+               clen[j] = sstr.str().length();
+       }
+    }
+    // then all (real) multicolumn cells!
+    for(int j = 0; j < columns_; ++j) {
+       for(int i = 0; i < rows_; ++i) {
+           cell = GetCellNumber(i, j);
+           if (!IsMultiColumn(cell, true) || IsPartOfMultiColumn(i, j))
+               continue;
+           ostringstream sstr;
+           (void)GetCellInset(cell)->Ascii(buf, sstr, 0);
+           int len = (int)sstr.str().length();
+           int n = cells_in_multicolumn(cell);
+           for (int k = j; (len > 0) && (k < (j+n-1)); ++k)
+               len -= clen[k];
+           if (len > (int)clen[j+n-1])
+               clen[j+n-1] = len;
+       }
+    }
+    cell = 0;
+    for(int i = 0; i < rows_; ++i) {
+       AsciiTopHLine(os, i, clen);
+       for(int j = 0; j < columns_; ++j) {
+           if (IsPartOfMultiColumn(i,j))
+               continue;
+           ret += AsciiPrintCell(buf, os, cell, i, j, clen);
+           ++cell;
+       }
+       os << endl;
+       AsciiBottomHLine(os, i, clen);
+    }
+}
+
+
 InsetText * LyXTabular::GetCellInset(int cell) const
 {
     return & cell_info[row_of_cell(cell)][column_of_cell(cell)].inset;
index 53f5474f3894c9e1f129817fc00fc4435056e6bf..c7c74d9cd013f2a88eebf7bdfa9dca47ccd1e6d2 100644 (file)
@@ -244,11 +244,11 @@ public:
     ///
     void AppendRow(int cell);
     ///
-    void DeleteRow(int cell);
+    void DeleteRow(int row);
     ///
     void AppendColumn(int cell);
     ///
-    void DeleteColumn(int cell);
+    void DeleteColumn(int column);
     ///
     bool IsFirstCellInRow(int cell) const;
     ///
@@ -280,6 +280,19 @@ public:
     ///
     int Latex(Buffer const *, std::ostream &, bool, bool) const;
     ///
+    // helper function for Latex returns number of newlines
+    ///
+    int AsciiTopHLine(std::ostream &, int row,
+                     vector<unsigned int> const &) const;
+    ///
+    int AsciiBottomHLine(std::ostream &, int row,
+                        vector<unsigned int> const &) const;
+    ///
+    int AsciiPrintCell(Buffer const *, std::ostream &, int cell, int row,
+                      int column, vector<unsigned int> const &) const;
+    ///
+    int Ascii(Buffer const *, std::ostream &) const;
+    ///
     int DocBookEndOfCell(std::ostream &, int cell, int & depth) const;
 #if 0
     ///
index 8c21418d8763fb4baa0f27a79a4e4a93c7f563cc..9c5914284870373012aab9a8df752bef191068d9 100644 (file)
@@ -4031,6 +4031,9 @@ void LyXText::InsertFootnoteEnvironment(BufferView * bview,
 Row * LyXText::GetRow(LyXParagraph * par,
                      LyXParagraph::size_type pos, int & y) const
 {
+       if (!firstrow)
+               return 0;
+
        Row * tmprow = firstrow;
        y = 0;