]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiBox.cpp
Use <cstdint> instead of <boost/cstdint.hpp>
[lyx.git] / src / frontends / qt4 / GuiBox.cpp
index 9a002fddbc8ff7f4ba32cc44ade7bf7c345fe040..6a991b5df5063e4fc6a61827c70397038ed76466 100644 (file)
@@ -6,6 +6,7 @@
  * \author Jürgen Vigna (Minipage stuff)
  * \author Martin Vermeer
  * \author Jürgen Spitzmüller
+ * \author Uwe Stöhr
  *
  * Full author contact details are available in file CREDITS.
  */
@@ -14,7 +15,9 @@
 
 #include "GuiBox.h"
 
-#include "FuncRequest.h"
+#include "GuiApplication.h"
+#include "ColorCache.h"
+#include "ColorSet.h"
 #include "LengthCombo.h"
 #include "Length.h"
 #include "qt_helpers.h"
 #include "insets/InsetBox.h"
 
 #include "support/gettext.h"
-#include "support/foreach.h"
 #include "support/lstrings.h"
 
-#include <QPushButton>
+#include <QComboBox>
 #include <QLineEdit>
+#include <QPushButton>
 
 #ifdef IN
 #undef IN
@@ -73,6 +76,32 @@ static QStringList boxGuiSpecialLengthNames()
 }
 
 
+static QList<ColorCode> colors()
+{
+       QList<ColorCode> colors;
+       colors << Color_black;
+       colors << Color_white;
+       colors << Color_blue;
+       colors << Color_brown;
+       colors << Color_cyan;
+       colors << Color_darkgray;
+       colors << Color_gray;
+       colors << Color_green;
+       colors << Color_lightgray;
+       colors << Color_lime;
+       colors << Color_magenta;
+       colors << Color_olive;
+       colors << Color_orange;
+       colors << Color_pink;
+       colors << Color_purple;
+       colors << Color_red;
+       colors << Color_teal;
+       colors << Color_violet;
+       colors << Color_yellow;
+       return colors;
+}
+
+
 GuiBox::GuiBox(QWidget * parent) : InsetParamsWidget(parent)
 {
        setupUi(this);
@@ -99,35 +128,69 @@ GuiBox::GuiBox(QWidget * parent) : InsetParamsWidget(parent)
                this, SIGNAL(changed()));
        connect(halignCO, SIGNAL(activated(int)), this, SIGNAL(changed()));
        connect(ialignCO, SIGNAL(activated(int)), this, SIGNAL(changed()));
+       connect(thicknessED, SIGNAL(textChanged(QString)), this, SIGNAL(changed()));
+       connect(thicknessUnitsLC, SIGNAL(selectionChanged(lyx::Length::UNIT)),
+               this, SIGNAL(changed()));
+       connect(separationED, SIGNAL(textChanged(QString)), this, SIGNAL(changed()));
+       connect(separationUnitsLC, SIGNAL(selectionChanged(lyx::Length::UNIT)),
+               this, SIGNAL(changed()));
+       connect(shadowsizeED, SIGNAL(textChanged(QString)), this, SIGNAL(changed()));
+       connect(shadowsizeUnitsLC, SIGNAL(selectionChanged(lyx::Length::UNIT)),
+               this, SIGNAL(changed()));
+       connect(backgroundColorCO, SIGNAL(currentIndexChanged(int)),
+               this, SIGNAL(changed()));
 
        heightED->setValidator(unsignedLengthValidator(heightED));
        widthED->setValidator(unsignedLengthValidator(widthED));
+       thicknessED->setValidator(unsignedLengthValidator(thicknessED));
+       separationED->setValidator(unsignedLengthValidator(separationED));
+       shadowsizeED->setValidator(unsignedLengthValidator(shadowsizeED));
 
        // initialize the length validator
-       addCheckedWidget(widthED, widthLA);
+       addCheckedWidget(widthED, widthCB);
        addCheckedWidget(heightED, heightCB);
+       addCheckedWidget(thicknessED, thicknessLA);
+       addCheckedWidget(separationED, separationLA);
+       addCheckedWidget(shadowsizeED, shadowsizeLA);
+
+       // the background can be uncolored while the frame cannot
+       color_codes_ = colors();
+       qSort(color_codes_.begin(), color_codes_.end(), ColorSorter);
+       fillComboColor(backgroundColorCO, true);
+       fillComboColor(frameColorCO, false);
 
        initDialog();
 }
 
 
+void GuiBox::fillComboColor(QComboBox * combo, bool const is_none)
+{
+       combo->clear();
+       QPixmap coloritem(32, 32);
+       QColor color;
+       // frameColorCO cannot be uncolored
+       if (is_none)
+               combo->addItem(toqstr(translateIfPossible(lcolor.getGUIName(Color_none))),
+                              toqstr(lcolor.getLaTeXName(Color_none)));
+       QList<ColorCode>::const_iterator cit = color_codes_.begin();
+       for (; cit != color_codes_.end(); ++cit) {
+               QString const latexname = toqstr(lcolor.getLaTeXName(*cit));
+               QString const guiname = toqstr(translateIfPossible(lcolor.getGUIName(*cit)));
+               color = QColor(guiApp->colorCache().get(*cit, false));
+               coloritem.fill(color);
+               combo->addItem(QIcon(coloritem), guiname, latexname);
+       }
+}
+
+
 void GuiBox::on_innerBoxCO_activated(int index)
 {
-       bool const ibox =
-               (innerBoxCO->itemData(index).toString() != "none");
-       QString const outer =
-               typeCO->itemData(typeCO->currentIndex()).toString();
-       valignCO->setEnabled(ibox);
-       ialignCO->setEnabled(ibox);
-       halignCO->setEnabled(!ibox);
-       heightCB->setEnabled(ibox);
-       // except for frameless and boxed, the width cannot be specified if
-       // there is no inner box
-       bool const width_disabled = (!ibox && outer != "Frameless" &&
-               outer != "Boxed");
-       widthED->setEnabled(!width_disabled);
-       widthUnitsLC->setEnabled(!width_disabled);
-       pagebreakCB->setEnabled(!ibox && outer == "Boxed");
+       QString itype = innerBoxCO->itemData(index).toString();
+       // handle parbox and minipage the same way
+       bool const ibox = (itype != "none" && itype != "makebox");
+       if (heightCB->isChecked() && !ibox)
+               heightCB->setChecked(false);
+       widthCB->setChecked(!widthED->text().isEmpty());
        setSpecial(ibox);
        changed();
 }
@@ -138,25 +201,50 @@ void GuiBox::on_typeCO_activated(int index)
        QString const type =
                typeCO->itemData(index).toString();
        bool const frameless = (type == "Frameless");
-       if (frameless) {
-               valignCO->setEnabled(true);
-               ialignCO->setEnabled(true);
-               halignCO->setEnabled(false);
-               heightCB->setEnabled(true);
-               setSpecial(true);
-       }
-       if (type != "Boxed")
-               pagebreakCB->setChecked(false);
        QString itype =
                innerBoxCO->itemData(innerBoxCO->currentIndex()).toString();
-       pagebreakCB->setEnabled(type == "Boxed" && itype == "none");
-       // except for frameless and boxed, the width cannot be specified if
-       // there is no inner box
-       bool const width_disabled = (itype == "none" && !frameless
-               && type != "Boxed");
-       widthED->setEnabled(!width_disabled);
-       widthUnitsLC->setEnabled(!width_disabled);
        setInnerType(frameless, itype);
+       // refresh itype because it might have been changed in setInnerType
+       itype =
+               innerBoxCO->itemData(innerBoxCO->currentIndex()).toString();
+       // handle parbox and minipage the same way
+       bool const ibox = (itype != "none" && itype != "makebox");
+       if (frameless && itype != "makebox") {
+               if (heightCB->isChecked() && !ibox)
+                       heightCB->setChecked(false);
+               setSpecial(ibox);
+       }
+       if (type != "Boxed") {
+               if (type != "Frameless")
+                       widthCB->setChecked(itype != "none");
+               pagebreakCB->setChecked(false);
+       }
+       // assure that the frame color is black for frameless boxes to
+       // provide the color "none"
+       int const b = frameColorCO->findData("black");
+       if (frameless && frameColorCO->currentIndex() != b)
+               frameColorCO->setCurrentIndex(b);
+       changed();
+}
+
+
+void GuiBox::on_frameColorCO_currentIndexChanged(int index)
+{
+       // if there is a non-black frame color the background cannot be uncolored
+       // therefore remove the entry "none" in this case
+       int const n = backgroundColorCO->findData("none");
+       if (index != frameColorCO->findData("black")) {
+               if (n != -1) {
+                       if (backgroundColorCO->currentIndex() == n)
+                               backgroundColorCO->setCurrentIndex(
+                                           backgroundColorCO->findData("white"));
+                       backgroundColorCO->removeItem(n);
+               }
+       } else {
+               if (n == -1)
+                       backgroundColorCO->insertItem(0, toqstr(translateIfPossible((lcolor.getGUIName(Color_none)))),
+                                                     toqstr(lcolor.getLaTeXName(Color_none)));
+       }
        changed();
 }
 
@@ -165,19 +253,31 @@ void GuiBox::initDialog()
 {
        setInnerType(true, toqstr("minipage"));
        widthED->setText("100");
+       widthCB->setChecked(true);
+       widthCB->setEnabled(false);
        widthUnitsLC->setCurrentItem(Length::PCW);
-       heightCB->setCheckState(Qt::Checked);
        heightED->setText("1");
        heightUnitsLC->setCurrentItem("totalheight");
+       // LaTeX's default for \fboxrule is 0.4 pt
+       thicknessED->setText("0.4");
+       thicknessUnitsLC->setCurrentItem(Length::PT);
+       // LaTeX's default for \fboxsep is 3 pt
+       separationED->setText("3");
+       separationUnitsLC->setCurrentItem(Length::PT);
+       // LaTeX's default for \shadowsize is 4 pt
+       shadowsizeED->setText("4");
+       shadowsizeUnitsLC->setCurrentItem(Length::PT);
 }
 
 
-void GuiBox::on_heightCB_stateChanged(int state)
+void GuiBox::on_widthCB_stateChanged(int)
+{
+       changed();
+}
+
+
+void GuiBox::on_heightCB_stateChanged(int /*state*/)
 {
-       bool const enable = (innerBoxCO->currentText() != qt_("None"))
-               && (state == Qt::Checked);
-       heightED->setEnabled(enable);
-       heightUnitsLC->setEnabled(enable);
        changed();
 }
 
@@ -185,19 +285,12 @@ void GuiBox::on_heightCB_stateChanged(int state)
 void GuiBox::on_pagebreakCB_stateChanged()
 {
        bool pbreak = (pagebreakCB->checkState() == Qt::Checked);
-       innerBoxCO->setEnabled(!pbreak);
-       widthED->setEnabled(!pbreak);
-       widthUnitsLC->setEnabled(!pbreak);
+       if (pbreak)
+               widthCB->setChecked(!pbreak);
        if (!pbreak) {
                on_typeCO_activated(typeCO->currentIndex());
                return;
        }
-       valignCO->setEnabled(false);
-       ialignCO->setEnabled(false);
-       halignCO->setEnabled(false);
-       heightCB->setEnabled(false);
-       heightED->setEnabled(false);
-       heightUnitsLC->setEnabled(false);
        setSpecial(false);
        changed();
 }
@@ -215,8 +308,6 @@ void GuiBox::paramsToDialog(Inset const * inset)
                pagebreakCB->setChecked(false);
        }
 
-       pagebreakCB->setEnabled(type == "Boxed" && !params.inner_box);
-
        typeCO->setCurrentIndex(typeCO->findData(type));
 
        // default: minipage
@@ -225,6 +316,8 @@ void GuiBox::paramsToDialog(Inset const * inset)
                inner_type = "none";
        if (params.use_parbox)
                inner_type = "parbox";
+       if (params.use_makebox)
+               inner_type = "makebox";
        bool const frameless = (params.type == "Frameless");
        setInnerType(frameless, inner_type);
 
@@ -235,24 +328,49 @@ void GuiBox::paramsToDialog(Inset const * inset)
        c = params.hor_pos;
        halignCO->setCurrentIndex(string("lcrs").find(c, 0));
 
-       bool ibox = params.inner_box;
+       bool ibox = (params.inner_box && !params.use_makebox);
        valignCO->setEnabled(ibox);
        ialignCO->setEnabled(ibox);
-       halignCO->setEnabled(!ibox);
        setSpecial(ibox);
 
+       // halign is only allowed without inner box and if a width is used and if
+       // pagebreak is not used
+       halignCO->setEnabled(!pagebreakCB->isChecked() && widthCB->isChecked()
+                            && ((!ibox && type == "Boxed") || inner_type == "makebox"));
+       // add the entry "Stretch" if the box is \makebox or \framebox and if not already there
+       if ((inner_type == "makebox" || (type == "Boxed" && inner_type == "none"))
+               && halignCO->count() < 4)
+               halignCO->addItem(qt_("Stretch"));
+       else if (inner_type != "makebox" && (type != "Boxed" && inner_type != "none"))
+               halignCO->removeItem(3);
+       // pagebreak is only allowed for Boxed without inner box
+       pagebreakCB->setEnabled(!ibox && type == "Boxed");
+
        Length::UNIT const default_unit = Length::defaultUnit();
 
-       lengthToWidgets(widthED, widthUnitsLC,
-               (params.width).asString(), default_unit);
+       // the width can only be selected for makebox or framebox
+       widthCB->setEnabled(inner_type == "makebox"
+                           || (type == "Boxed"
+                               && !ibox && !pagebreakCB->isChecked()));
+       if (params.width.empty()) {
+               widthCB->setChecked(false);
+               lengthToWidgets(widthED, widthUnitsLC,
+                       params.width, default_unit);
+       } else {
+               widthCB->setChecked(true);
+               lengthToWidgets(widthED, widthUnitsLC,
+                       params.width, default_unit);
+               QString const special = toqstr(params.special);
+               if (!special.isEmpty() && special != "none")
+                       widthUnitsLC->setCurrentItem(special);
+       }
 
-       QString const special = toqstr(params.special);
-       if (!special.isEmpty() && special != "none")
-               widthUnitsLC->setCurrentItem(special);
+       widthED->setEnabled(widthCB->isChecked());
+       widthUnitsLC->setEnabled(widthCB->isChecked());
 
        lengthToWidgets(heightED, heightUnitsLC,
                (params.height).asString(), default_unit);
-       
+
        QString const height_special = toqstr(params.height_special);
        if (!height_special.isEmpty() && height_special != "none")
                heightUnitsLC->setCurrentItem(height_special);
@@ -266,6 +384,27 @@ void GuiBox::paramsToDialog(Inset const * inset)
                heightCB->setCheckState(Qt::Checked);
 
        heightCB->setEnabled(ibox);
+
+       // enable line thickness only for the rectangular frame types and drop shadow
+       thicknessED->setEnabled(type == "Boxed" || type == "Doublebox" || type == "Shadowbox");
+       thicknessUnitsLC->setEnabled(type == "Boxed" || type == "Doublebox" || type == "Shadowbox");
+       lengthToWidgets(thicknessED, thicknessUnitsLC,
+               (params.thickness).asString(), default_unit);
+       // enable line separation for the allowed frame types
+       separationED->setEnabled(type == "Boxed" || type == "ovalbox" || type == "Ovalbox"
+               || type == "Doublebox" || type == "Shadowbox");
+       separationUnitsLC->setEnabled(type == "Boxed" || type == "ovalbox" || type == "Ovalbox"
+               || type == "Doublebox" || type == "Shadowbox");
+       lengthToWidgets(separationED, separationUnitsLC,
+               (params.separation).asString(), default_unit);
+       // enable shadow size for drop shadow
+       shadowsizeED->setEnabled(type == "Shadowbox");
+       shadowsizeUnitsLC->setEnabled(type == "Shadowbox");
+       lengthToWidgets(shadowsizeED, shadowsizeUnitsLC,
+               (params.shadowsize).asString(), default_unit);
+       // set color
+       frameColorCO->setCurrentIndex(frameColorCO->findData(toqstr(params.framecolor)));
+       backgroundColorCO->setCurrentIndex(backgroundColorCO->findData(toqstr(params.backgroundcolor)));
 }
 
 
@@ -285,6 +424,8 @@ docstring GuiBox::dialogToParams() const
                (!pagebreak && innerBoxCO->currentText() != qt_("None"));
        params.use_parbox =
                (!pagebreak && innerBoxCO->currentText() == qt_("Parbox"));
+       params.use_makebox =
+               (!pagebreak && innerBoxCO->currentText() == qt_("Makebox"));
 
        params.pos = "tcb"[valignCO->currentIndex()];
        params.inner_pos = "tcbs"[ialignCO->currentIndex()];
@@ -293,13 +434,22 @@ docstring GuiBox::dialogToParams() const
        QString unit =
                widthUnitsLC->itemData(widthUnitsLC->currentIndex()).toString();
        QString value = widthED->text();
-       if (ids_spec_.contains(unit) && !isValidLength(fromqstr(value))) {
-               params.special = fromqstr(unit);
-               // Note: the unit is simply ignored in this case
-               params.width = Length(value.toDouble(), Length::IN);
+
+       if (widthED->isEnabled()) {
+               if (ids_spec_.contains(unit) && !isValidLength(fromqstr(value))) {
+                       params.special = fromqstr(unit);
+                       // Note: the unit is simply ignored in this case
+                       params.width = Length(widgetToDouble(widthED), Length::IN);
+               } else {
+                       params.special = "none";
+                       // we must specify a valid length in this case
+                       if (value.isEmpty())
+                               widthED->setText("0");
+                       params.width = Length(widgetsToLength(widthED, widthUnitsLC));
+               }
        } else {
                params.special = "none";
-               params.width = Length(widgetsToLength(widthED, widthUnitsLC));
+               params.width = Length();
        }
 
        // the height parameter is omitted if the value
@@ -315,17 +465,141 @@ docstring GuiBox::dialogToParams() const
                if (ids_spec_.contains(unit) && !isValidLength(fromqstr(value))) {
                        params.height_special = fromqstr(unit);
                        // Note: the unit is simply ignored in this case
-                       params.height = Length(value.toDouble(), Length::IN);
+                       params.height = Length(widgetToDouble(heightED), Length::IN);
                } else {
                        params.height_special = "none";
                        params.height =
                                Length(widgetsToLength(heightED, heightUnitsLC));
                }
        }
+
+       // handle the line thickness, line separation and shadow size
+       if (thicknessED->isEnabled())
+               params.thickness = Length(widgetsToLength(thicknessED, thicknessUnitsLC));
+       else
+               params.thickness = Length("0.4pt");
+       if (separationED->isEnabled())
+               params.separation = Length(widgetsToLength(separationED, separationUnitsLC));
+       else
+               params.separation = Length("3pt");
+       if (separationED->isEnabled())
+               params.shadowsize = Length(widgetsToLength(shadowsizeED, shadowsizeUnitsLC));
+       else
+               params.shadowsize = Length("4pt");
+       if (frameColorCO->isEnabled())
+               params.framecolor =
+                       fromqstr(frameColorCO->itemData(frameColorCO->currentIndex()).toString());
+       else
+               params.framecolor = "black";
+       if (backgroundColorCO->isEnabled())
+               params.backgroundcolor =
+                       fromqstr(backgroundColorCO->itemData(backgroundColorCO->currentIndex()).toString());
+       else
+               params.backgroundcolor = "none";
+
        return from_ascii(InsetBox::params2string(params));
 }
 
 
+bool GuiBox::checkWidgets(bool readonly) const
+{
+       typeCO->setEnabled(!readonly);
+
+       if (readonly) {
+               pagebreakCB->setEnabled(false);
+               innerBoxCO->setEnabled(false);
+               valignCO->setEnabled(false);
+               ialignCO->setEnabled(false);
+               halignCO->setEnabled(false);
+               widthCB->setEnabled(false);
+               widthED->setEnabled(false);
+               widthUnitsLC->setEnabled(false);
+               heightED->setEnabled(false);
+               heightUnitsLC->setEnabled(false);
+               heightCB->setEnabled(false);
+               thicknessED->setEnabled(false);
+               thicknessUnitsLC->setEnabled(false);
+               separationED->setEnabled(false);
+               separationUnitsLC->setEnabled(false);
+               shadowsizeED->setEnabled(false);
+               shadowsizeUnitsLC->setEnabled(false);
+       } else {
+               QString const outer =
+                       typeCO->itemData(typeCO->currentIndex()).toString();
+               QString const itype =
+                       innerBoxCO->itemData(innerBoxCO->currentIndex()).toString();
+               bool const ibox = (itype != "none" && itype != "makebox");
+               valignCO->setEnabled(ibox);
+               ialignCO->setEnabled(ibox);
+               if (heightCB->isChecked() && !ibox)
+                       heightCB->setChecked(false);
+               heightCB->setEnabled(ibox);
+               // the width can only be selected for makebox or framebox
+               widthCB->setEnabled(itype == "makebox"
+                       || (outer == "Boxed" && itype == "none" && !pagebreakCB->isChecked()));
+               // except for Frameless and Boxed, the width cannot be specified if
+               // there is no inner box
+               bool const width_enabled =
+                       ibox || outer == "Frameless" || (outer == "Boxed" && !pagebreakCB->isChecked());
+               // enable if width_enabled
+               widthED->setEnabled(width_enabled);
+               widthUnitsLC->setEnabled(width_enabled);
+               if (!widthCB->isChecked() && widthCB->isEnabled()) {
+                       widthED->setEnabled(false);
+                       widthUnitsLC->setEnabled(false);
+               }
+               // halign is only allowed without inner box and if a width is used and if
+               // pagebreak is not used
+               halignCO->setEnabled(!pagebreakCB->isChecked() && widthCB->isChecked()
+                                    && ((!ibox && outer == "Boxed") || itype == "makebox"));
+               // add the entry "Stretch" if the box is \makebox or \framebox and if not already there
+               if ((itype == "makebox" || (outer == "Boxed" && itype == "none"))
+                       && halignCO->count() < 4)
+                       halignCO->addItem(qt_("Stretch"));
+               else if (itype != "makebox" && (outer != "Boxed" && itype != "none"))
+                       halignCO->removeItem(3);
+               // pagebreak is only allowed for Boxed without inner box
+               pagebreakCB->setEnabled(!ibox && outer == "Boxed");
+
+               heightED->setEnabled(itype != "none" && heightCB->isChecked());
+               heightUnitsLC->setEnabled(itype != "none" && heightCB->isChecked());
+               heightCB->setEnabled(ibox);
+
+               // enable line thickness for the rectangular frame types and drop shadow
+               thicknessED->setEnabled(outer == "Boxed" || outer == "Doublebox" || outer == "Shadowbox");
+               thicknessUnitsLC->setEnabled(outer == "Boxed" || outer == "Doublebox" || outer == "Shadowbox");
+               // set default values if empty
+               if (thicknessED->text().isEmpty() && thicknessED->isEnabled()) {
+                       thicknessED->setText("0.4");
+                       thicknessUnitsLC->setCurrentItem(Length::PT);
+               }
+               // enable line separation for the allowed frame types
+               separationED->setEnabled(outer == "Boxed" || outer == "ovalbox" || outer == "Ovalbox"
+                       || outer == "Doublebox" || outer == "Shadowbox");
+               separationUnitsLC->setEnabled(outer == "Boxed" || outer == "ovalbox" || outer == "Ovalbox"
+                       || outer == "Doublebox" || outer == "Shadowbox");
+               // set default values if empty
+               if (separationED->text().isEmpty() && separationED->isEnabled()) {
+                       separationED->setText("3");
+                       separationUnitsLC->setCurrentItem(Length::PT);
+               }
+               // enable shadow size for drop shadow
+               shadowsizeED->setEnabled(outer == "Shadowbox");
+               shadowsizeUnitsLC->setEnabled(outer == "Shadowbox");
+               // set default values if empty
+               if (shadowsizeED->text().isEmpty() && shadowsizeED->isEnabled()) {
+                       shadowsizeED->setText("4");
+                       shadowsizeUnitsLC->setCurrentItem(Length::PT);
+               }
+               // \fboxcolor and \colorbox cannot be used for fancybox boxes
+               frameColorCO->setEnabled(!pagebreakCB->isChecked() && outer == "Boxed");
+               backgroundColorCO->setEnabled(!pagebreakCB->isChecked() && (frameColorCO->isEnabled() || outer == "Frameless"));
+       }
+
+       return InsetParamsWidget::checkWidgets();
+}
+
+
 void GuiBox::setSpecial(bool ibox)
 {
        QString const last_item =
@@ -358,6 +632,8 @@ void GuiBox::setInnerType(bool frameless, QString const & type)
        innerBoxCO->clear();
        if (!frameless)
                innerBoxCO->addItem(qt_("None"), toqstr("none"));
+       else
+               innerBoxCO->addItem(qt_("Makebox"), toqstr("makebox"));
        innerBoxCO->addItem(qt_("Parbox"), toqstr("parbox"));
        innerBoxCO->addItem(qt_("Minipage"), toqstr("minipage"));
        int i = (innerBoxCO->findData(type) != -1)