Back to index

scribus-ng  1.3.4.dfsg+svn20071115
mpalette.cpp
Go to the documentation of this file.
00001 /*
00002 For general Scribus (>=1.3.2) copyright and licensing information please refer
00003 to the COPYING file provided with the program. Following this notice may exist
00004 a copyright and/or license notice that predates the release of Scribus 1.3.2
00005 for which a new license (GPL+exception) is in place.
00006 */
00007 
00008 
00009 #include "mpalette.h"
00010 #include "mpalette.moc"
00011 
00012 #include <cmath>
00013 #include <qpoint.h>
00014 #include <qwmatrix.h>
00015 #include <qmessagebox.h>
00016 #include <qtoolbutton.h>
00017 #include <qradiobutton.h>
00018 #include <qobjectlist.h>
00019 #include <qvalidator.h>
00020 #include <qregexp.h>
00021 
00022 #include "arrowchooser.h"
00023 #include "autoform.h"
00024 #include "commonstrings.h"
00025 #include "colorlistbox.h"
00026 #include "cpalette.h"
00027 #include "lineformats.h"
00028 #include "sccombobox.h"
00029 #include "scfonts.h"
00030 #include "scribus.h"
00031 #include "scribuscore.h"
00032 #include "scraction.h"
00033 #include "scribusview.h"
00034 #include "selection.h"
00035 #include "spalette.h"
00036 #include "styleselect.h"
00037 #include "tabmanager.h"
00038 #include "units.h"
00039 #include "undomanager.h"
00040 #include "util.h"
00041 #include "text/nlsconfig.h"
00042 #ifdef HAVE_CAIRO
00043 #include <cairo.h>
00044 #endif
00045 
00046 using namespace std;
00047 
00048 
00049 /*
00050 LabelButton::LabelButton(QWidget* parent, QString text1, QString text2) : QLabel(parent)
00051 {
00052        state = true;
00053        setTexts(text1, text2);
00054 }
00055 
00056 void LabelButton::setTexts(QString text1, QString text2)
00057 {
00058        TextA = text1;
00059        TextB = text2;
00060        if (state)
00061               setText(TextA);
00062        else
00063               setText(TextB);
00064 }
00065 
00066 bool LabelButton::getState()
00067 {
00068        return state;
00069 }
00070 
00071 void LabelButton::enterEvent(QEvent*)
00072 {
00073        setFrameStyle( QFrame::Panel | QFrame::Raised );
00074        setLineWidth( 2 );
00075 }
00076 
00077 void LabelButton::leaveEvent(QEvent*)
00078 {
00079        setFrameStyle( QFrame::Panel | QFrame::Plain );
00080        setLineWidth( 0 );
00081 }
00082 
00083 void LabelButton::mousePressEvent(QMouseEvent*)
00084 {
00085        setFrameStyle( QFrame::Panel | QFrame::Sunken );
00086        setLineWidth( 2 );
00087 }
00088 
00089 void LabelButton::mouseReleaseEvent(QMouseEvent*)
00090 {
00091        state = !state;
00092        if (state)
00093               setText(TextA);
00094        else
00095               setText(TextB);
00096        setFrameStyle( QFrame::Panel | QFrame::Raised );
00097        setLineWidth( 2 );
00098        emit clicked();
00099 }
00100 */
00101 NameWidget::NameWidget(QWidget* parent) : QLineEdit(parent)
00102 {
00103        QRegExp rx( "\\w+" );
00104        QValidator* validator = new QRegExpValidator( rx, this );
00105        setValidator( validator );
00106 }
00107 
00108 void NameWidget::focusOutEvent(QFocusEvent *e)
00109 {
00110        emit Leaved();
00111        QLineEdit::focusOutEvent(e);
00112 }
00113 
00114 Mpalette::Mpalette( QWidget* parent) : ScrPaletteBase( parent, "PropertiesPalette", false, 0)
00115 {
00116        m_ScMW=0;
00117        doc=0;
00118        HaveDoc = false;
00119        HaveItem = false;
00120        RoVal = 0;
00121        Umrech = 1.0;
00122        setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)1, 0, 0, sizePolicy().hasHeightForWidth() ) );
00123 
00124        _userActionOn = false;
00125        userActionSniffer = new UserActionSniffer();
00126        connect(userActionSniffer, SIGNAL(actionStart()), this, SLOT(mspinboxStartUserAction()));
00127        connect(userActionSniffer, SIGNAL(actionEnd()), this, SLOT(mspinboxFinishUserAction()));
00128 
00129        MpalLayout = new QVBoxLayout( this, 5, 1, "MpalLayout");
00130        setOrientation(Qt::Vertical);
00131        QFont f(font());
00132        f.setPointSize(f.pointSize()-1);
00133        setFont(f);
00134 
00135        TabStack = new QToolBox( this, "TabStack" );
00136 
00137        page = new QWidget( TabStack, "page" );
00138        pageLayout = new QVBoxLayout( page, 0, 5, "pageLayout");
00139 
00140        NameGroup = new QGroupBox( "Name", page, "NameGroup" );
00141        NameGroup->setColumnLayout(0, Qt::Vertical );
00142        NameGroup->layout()->setSpacing( 4 );
00143        NameGroup->layout()->setMargin( 5 );
00144        NameGroupLayout = new QHBoxLayout( NameGroup->layout() );
00145        NameGroupLayout->setAlignment( Qt::AlignTop );
00146        NameEdit = new NameWidget(NameGroup);
00147        NameEdit->setFocusPolicy(QWidget::ClickFocus);
00148        NameGroupLayout->addWidget( NameEdit );
00149        pageLayout->addWidget( NameGroup );
00150 
00151        GeoGroup = new QGroupBox( "Geometry", page, "GeoGroup" );
00152        GeoGroup->setColumnLayout(0, Qt::Vertical );
00153        GeoGroup->layout()->setSpacing( 4 );
00154        GeoGroup->layout()->setMargin( 5 );
00155        GeoGroupLayout = new QGridLayout( GeoGroup->layout() );
00156        GeoGroupLayout->setAlignment( Qt::AlignTop );
00157 
00158        Xpos = new MSpinBox( -3000, 3000, GeoGroup, 2 );
00159        installSniffer(Xpos);
00160        GeoGroupLayout->addWidget( Xpos, 0, 1 );
00161        Ypos = new MSpinBox( -3000, 3000, GeoGroup, 2 );
00162        installSniffer(Ypos);
00163        GeoGroupLayout->addWidget( Ypos, 1, 1 );
00164        Width = new MSpinBox( GeoGroup, 2 );
00165        installSniffer(Width);
00166        GeoGroupLayout->addWidget( Width, 2, 1 );
00167        Height = new MSpinBox( GeoGroup, 2 );
00168        installSniffer(Height);
00169        GeoGroupLayout->addWidget( Height, 3, 1 );
00170 
00171        xposLabel = new QLabel( Xpos, "&X-Pos:", GeoGroup, "xposLabel" );
00172        GeoGroupLayout->addWidget( xposLabel, 0, 0 );
00173        yposLabel = new QLabel( Ypos, "&Y-Pos:", GeoGroup, "yposLabel" );
00174        GeoGroupLayout->addWidget( yposLabel, 1, 0 );
00175        widthLabel = new QLabel( Width, "&Width:", GeoGroup, "widthLabel" );
00176        GeoGroupLayout->addWidget( widthLabel, 2, 0 );
00177        heightLabel = new QLabel( Height, "&Height:", GeoGroup, "heightLabel" );
00178        GeoGroupLayout->addWidget( heightLabel, 3, 0 );
00179 
00180        keepFrameWHRatioButton = new LinkButton( GeoGroup );
00181        keepFrameWHRatioButton->setToggleButton( true );
00182        keepFrameWHRatioButton->setAutoRaise( true );
00183        keepFrameWHRatioButton->setMaximumSize( QSize( 15, 32767 ) );
00184        keepFrameWHRatioButton->setOn(true);
00185        GeoGroupLayout->addMultiCellWidget( keepFrameWHRatioButton, 2, 3, 2, 2 );
00186        Rot = new MSpinBox( GeoGroup, 2);
00187        Rot->setWrapping( true );
00188        installSniffer(Rot);
00189        rotationLabel = new QLabel( Rot, "&Rotation:", GeoGroup, "rotationLabel" );
00190        GeoGroupLayout->addWidget( rotationLabel, 4, 0 );
00191        GeoGroupLayout->addWidget( Rot, 4, 1 );
00192        basepointLabel = new QLabel( "Basepoint:", GeoGroup, "basepointLabel" );
00193        GeoGroupLayout->addWidget( basepointLabel, 5, 0 );
00194        RotationGroup = new QButtonGroup( "", GeoGroup, "RotationGroup" );
00195        RotationGroup->setFrameShape( QButtonGroup::NoFrame );
00196        RotationGroup->setColumnLayout(0, Qt::Vertical );
00197        RotationGroup->layout()->setSpacing( 0 );
00198        RotationGroup->layout()->setMargin( 0 );
00199        RotationGroupLayout = new QHBoxLayout( RotationGroup->layout() );
00200        RotationGroupLayout->setAlignment( Qt::AlignTop );
00201        Layout12 = new QGridLayout( 0, 1, 1, 0, 0, "Layout12");
00202        TopLeft = new QRadioButton( RotationGroup, "TopLeft" );
00203        TopLeft->setText( "" );
00204        TopLeft->setChecked( true );
00205        Layout12->addWidget( TopLeft, 0, 0, Qt::AlignCenter );
00206        Line1 = new QFrame( RotationGroup, "Line1" );
00207        Line1->setMinimumSize( QSize( 20, 4 ) );
00208        Line1->setMaximumSize( QSize( 20, 4 ) );
00209        Line1->setFrameShape( QFrame::HLine );
00210        Line1->setFrameShadow( QFrame::Plain );
00211        Line1->setLineWidth( 3 );
00212        Line1->setFrameShape( QFrame::HLine );
00213        Layout12->addWidget( Line1, 0, 1, Qt::AlignCenter );
00214        TopRight = new QRadioButton( RotationGroup, "TopRight" );
00215        TopRight->setText( "" );
00216        Layout12->addWidget( TopRight, 0, 2, Qt::AlignCenter );
00217        Line2 = new QFrame( RotationGroup, "Line2" );
00218        Line2->setMinimumSize( QSize( 4, 20 ) );
00219        Line2->setMaximumSize( QSize( 4, 20 ) );
00220        Line2->setFrameShape( QFrame::VLine );
00221        Line2->setFrameShadow( QFrame::Plain );
00222        Line2->setLineWidth( 3 );
00223        Line2->setFrameShape( QFrame::VLine );
00224        Layout12->addWidget( Line2, 1, 0, Qt::AlignCenter );
00225        Center = new QRadioButton( RotationGroup, "Center" );
00226        Center->setText( "" );
00227        Layout12->addWidget( Center, 1, 1, Qt::AlignCenter );
00228        Line4 = new QFrame( RotationGroup, "Line4" );
00229        Line4->setMinimumSize( QSize( 4, 20 ) );
00230        Line4->setMaximumSize( QSize( 4, 20 ) );
00231        Line4->setFrameShadow( QFrame::Plain );
00232        Line4->setLineWidth( 3 );
00233        Line4->setFrameShape( QFrame::VLine );
00234        Layout12->addWidget( Line4, 1, 2, Qt::AlignCenter );
00235        BottomLeft = new QRadioButton( RotationGroup, "BottomLeft" );
00236        BottomLeft->setText( "" );
00237        Layout12->addWidget( BottomLeft, 2, 0, Qt::AlignCenter );
00238        Line5 = new QFrame( RotationGroup, "Line5" );
00239        Line5->setMinimumSize( QSize( 20, 4 ) );
00240        Line5->setMaximumSize( QSize( 20, 4 ) );
00241        Line5->setFrameShape( QFrame::HLine );
00242        Line5->setFrameShadow( QFrame::Plain );
00243        Line5->setLineWidth( 3 );
00244        Line5->setFrameShape( QFrame::HLine );
00245        Layout12->addWidget( Line5, 2, 1, Qt::AlignCenter );
00246        BottomRight = new QRadioButton( RotationGroup, "BottomRight" );
00247        BottomRight->setText( "" );
00248        Layout12->addWidget( BottomRight, 2, 2, Qt::AlignCenter );
00249        RotationGroupLayout->addLayout( Layout12 );
00250        QSpacerItem* spacer12 = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );
00251        RotationGroupLayout->addItem( spacer12 );
00252        GeoGroupLayout->addWidget( RotationGroup, 5, 1 );
00253        pageLayout->addWidget( GeoGroup );
00254 
00255        layout60 = new QHBoxLayout( 0, 0, 5, "layout60");
00256 
00257        LayerGroup = new QGroupBox( "Level", page, "LayerGroup" );
00258        LayerGroup->setColumnLayout(0, Qt::Vertical );
00259        LayerGroup->layout()->setSpacing( 4 );
00260        LayerGroup->layout()->setMargin( 5 );
00261        LayerGroupLayout = new QGridLayout( LayerGroup->layout() );
00262        LayerGroupLayout->setAlignment( Qt::AlignTop );
00263        Zup = new QToolButton( LayerGroup, "Zup" );
00264        Zup->setMaximumSize( QSize( 22, 22 ) );
00265        Zup->setPixmap(loadIcon("16/go-up.png"));
00266        LayerGroupLayout->addWidget( Zup, 0, 0 );
00267        ZDown = new QToolButton( LayerGroup, "ZDown" );
00268        ZDown->setMaximumSize( QSize( 22, 22 ) );
00269        ZDown->setPixmap(loadIcon("16/go-down.png"));
00270        LayerGroupLayout->addWidget( ZDown, 1, 0 );
00271        ZTop = new QToolButton( LayerGroup, "ZTop" );
00272        ZTop->setMaximumSize( QSize( 22, 22 ) );
00273        ZTop->setPixmap(loadIcon("16/go-top.png"));
00274        LayerGroupLayout->addWidget( ZTop, 0, 1 );
00275        ZBottom = new QToolButton( LayerGroup, "ZBottom" );
00276        ZBottom->setMaximumSize( QSize( 22, 22 ) );
00277        ZBottom->setPixmap(loadIcon("16/go-bottom.png"));
00278        LayerGroupLayout->addWidget( ZBottom, 1, 1 );
00279        LevelTxt = new QLabel( "  1", LayerGroup, "LevelTxt" );
00280        LevelTxt->setAlignment( Qt::AlignCenter );
00281        LayerGroupLayout->addMultiCellWidget( LevelTxt, 0, 1, 2, 2 );
00282 
00283        layout60->addWidget( LayerGroup );
00284        QSpacerItem* spacer2 = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );
00285        layout60->addItem( spacer2 );
00286 
00287        Layout44 = new QGridLayout( 0, 1, 1, 8, 4, "Layout44");
00288 
00289        DoGroup = new QToolButton( page, "DoGroup" );
00290        DoGroup->setPixmap(loadIcon("group.png"));
00291        Layout44->addWidget( DoGroup, 0, 0 );
00292        DoUnGroup = new QToolButton( page, "DoUnGroup" );
00293        DoUnGroup->setPixmap(loadIcon("ungroup.png"));
00294        Layout44->addWidget( DoUnGroup, 1, 0 );
00295 
00296        FlipH = new QToolButton( page, "MirrorH" );
00297        FlipH->setPixmap(loadIcon("16/flip-object-horizontal.png"));
00298        FlipH->setToggleButton( true );
00299        Layout44->addWidget( FlipH, 0, 1 );
00300        FlipV = new QToolButton( page, "MirrorV" );
00301        FlipV->setPixmap(loadIcon("16/flip-object-vertical.png"));
00302        FlipV->setToggleButton( true );
00303        Layout44->addWidget( FlipV, 1, 1 );
00304        Locked = new QToolButton( page, "Lock" );
00305        Locked->setToggleButton( true );
00306        QIconSet a = QIconSet();
00307        a.setPixmap(loadIcon("16/lock.png"), QIconSet::Automatic, QIconSet::Normal, QIconSet::On);
00308        a.setPixmap(loadIcon("16/lock-unlocked.png"), QIconSet::Automatic, QIconSet::Normal, QIconSet::Off);
00309        Locked->setIconSet(a);
00310        Layout44->addWidget( Locked, 0, 2 );
00311        NoPrint = new QToolButton( page, "NoPrint" );
00312        NoPrint->setToggleButton( true );
00313        QIconSet a2 = QIconSet();
00314        a2.setPixmap(loadIcon("NoPrint.png"), QIconSet::Automatic, QIconSet::Normal, QIconSet::On);
00315        a2.setPixmap(loadIcon("16/document-print.png"), QIconSet::Automatic, QIconSet::Normal, QIconSet::Off);
00316        NoPrint->setIconSet(a2);
00317        Layout44->addWidget( NoPrint, 1, 2 );
00318        NoResize = new QToolButton( page, "NoResize" );
00319        NoResize->setToggleButton( true );
00320        QIconSet a3 = QIconSet();
00321        a3.setPixmap(loadIcon("framenoresize.png"), QIconSet::Automatic, QIconSet::Normal, QIconSet::On);
00322        a3.setPixmap(loadIcon("frameresize.png"), QIconSet::Automatic, QIconSet::Normal, QIconSet::Off);
00323        NoResize->setIconSet(a3);
00324        Layout44->addWidget( NoResize, 0, 3 );
00325        layout60->addLayout( Layout44 );
00326 
00327        pageLayout->addLayout( layout60 );
00328 
00329        QSpacerItem* spacer13 = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding );
00330        pageLayout->addItem( spacer13 );
00331        idXYZItem=TabStack->addItem( page, "X, Y, &Z" );
00332 
00333        page_2 = new QWidget( TabStack, "page_2" );
00334        pageLayout_2 = new QVBoxLayout( page_2, 0, 5, "pageLayout_2");
00335 
00336        ShapeGroup = new QButtonGroup( "", page_2, "ShapeGroup" );
00337        ShapeGroup->setFrameShape( QButtonGroup::NoFrame );
00338        ShapeGroup->setExclusive( true );
00339        ShapeGroup->setColumnLayout(0, Qt::Vertical );
00340        ShapeGroup->layout()->setSpacing( 2 );
00341        ShapeGroup->layout()->setMargin( 0 );
00342        ShapeGroupLayout = new QHBoxLayout( ShapeGroup->layout() );
00343        ShapeGroupLayout->setAlignment( Qt::AlignTop );
00344        SRect = new QLabel( "Shape:", ShapeGroup, "SRect" );
00345        ShapeGroupLayout->addWidget( SRect );
00346        SCustom = new Autoforms( ShapeGroup );
00347        ShapeGroupLayout->addWidget( SCustom );
00348        pageLayout_2->addWidget( ShapeGroup );
00349 
00350        EditShape = new QToolButton( page_2, "EditShape" );
00351        pageLayout_2->addWidget( EditShape );
00352 
00353        Layout13 = new QHBoxLayout( 0, 0, 2, "Layout13");
00354 
00355        RoundRect = new MSpinBox( page_2, 1 );
00356        rndcornersLabel = new QLabel( RoundRect, "R&ound\nCorners:", page_2, "rndcornersLabel" );
00357        Layout13->addWidget( rndcornersLabel );
00358        Layout13->addWidget( RoundRect );
00359        pageLayout_2->addLayout( Layout13 );
00360 
00361        TabStack2 = new QWidgetStack( page_2, "TabStack2" );
00362        TabStack2->setFrameShape( QWidgetStack::NoFrame );
00363 
00364        page_2a = new QWidget( TabStack2, "page" );
00365        pageLayout_2a = new QVBoxLayout( page_2a, 0, 5, "pageLayout_2");
00366        Distance = new QGroupBox( "Distance of Text", page_2a, "Distance" );
00367        Distance->setColumnLayout(0, Qt::Vertical );
00368        Distance->layout()->setSpacing( 2 );
00369        Distance->layout()->setMargin( 5 );
00370        DistanceLayout = new QGridLayout( Distance->layout() );
00371        DistanceLayout->setAlignment( Qt::AlignTop );
00372 
00373        DCol = new QSpinBox(Distance, "Cols" );
00374     DCol->setMaxValue( 3000 );
00375     DCol->setMinValue( 1 );
00376        columnsLabel = new QLabel( DCol, "Colu&mns:", Distance, "columnsLabel" );
00377        DistanceLayout->addWidget( columnsLabel, 0, 0 );
00378        DistanceLayout->addWidget( DCol, 0, 1 );
00379 
00380        dGap = new MSpinBox( 0, 300, Distance, 1 );
00381 //     colgapLabel = new LabelButton( Distance, "&Gap:", "&Width:");
00382 //     colgapLabel->setBuddy(dGap);
00383        colgapLabel = new ScComboBox( false, Distance, "colgapLabel" );
00384        DistanceLayout->addWidget( colgapLabel, 1, 0, Qt::AlignLeft );
00385        DistanceLayout->addWidget( dGap, 1, 1 );
00386 
00387        DTop = new MSpinBox( 0, 300, Distance, 1 );
00388        topLabel = new QLabel( DTop, "To&p:", Distance, "topLabel" );
00389        DistanceLayout->addWidget( topLabel, 2, 0 );
00390        DistanceLayout->addWidget( DTop, 2, 1 );
00391 
00392        DBottom = new MSpinBox( 0, 300, Distance, 1 );
00393        bottomLabel = new QLabel( DBottom, "&Bottom:", Distance, "bottomLabel" );
00394        DistanceLayout->addWidget( bottomLabel, 3, 0 );
00395        DistanceLayout->addWidget( DBottom, 3, 1 );
00396 
00397        DLeft = new MSpinBox( 0, 300, Distance, 1 );
00398        leftLabel = new QLabel( DLeft, "&Left:", Distance, "leftLabel" );
00399        DistanceLayout->addWidget( leftLabel, 4, 0 );
00400        DistanceLayout->addWidget( DLeft, 4, 1 );
00401 
00402        DRight = new MSpinBox( 0, 300, Distance, 1 );
00403        rightLabel = new QLabel( DRight, "&Right:", Distance, "rightLabel" );
00404        DistanceLayout->addWidget( rightLabel, 5, 0 );
00405        DistanceLayout->addWidget( DRight, 5, 1 );
00406 
00407        TabsButton = new QToolButton( Distance, "T&abulators..." );
00408        DistanceLayout->addMultiCellWidget( TabsButton, 6, 6, 0, 1 );
00409        pageLayout_2a->addWidget(Distance);
00410        TabStack2->addWidget( page_2a, 0 );
00411 
00412        page_2b = new QWidget( TabStack2, "page" );
00413        pageLayout_2b = new QVBoxLayout( page_2b, 0, 5, "pageLayout_2");
00414        Distance2 = new QGroupBox( "Path Text Properties", page_2b, "Distance" );
00415        Distance2->setColumnLayout(0, Qt::Vertical );
00416        Distance2->layout()->setSpacing( 2 );
00417        Distance2->layout()->setMargin( 5 );
00418        DistanceLayout2 = new QGridLayout( Distance2->layout() );
00419        DistanceLayout2->setAlignment( Qt::AlignTop );
00420 
00421        pathTextType = new ScComboBox( false, Distance2, "pathTextType" );
00422        DistanceLayout2->addWidget( pathTextType, 0, 1);
00423        pathTextTypeLabel = new QLabel( "Type:", Distance2, "pathTextTypeLabel" );
00424        DistanceLayout2->addWidget( pathTextTypeLabel, 0, 0);
00425        
00426        startoffsetLabel = new QLabel( "Start Offset:", Distance2, "startoffsetLabel" );
00427        DistanceLayout2->addWidget( startoffsetLabel, 1, 0);
00428        Dist = new MSpinBox( 0, 30000, Distance2, 1 );
00429        Dist->setLineStepM(10);
00430        DistanceLayout2->addWidget( Dist, 1, 1);
00431 
00432        distfromcurveLabel = new QLabel( "Distance from Curve:", Distance2, "distfromcurveLabel" );
00433        DistanceLayout2->addWidget( distfromcurveLabel, 2, 0);
00434        LineW = new MSpinBox( -300, 300, Distance2, 1 );
00435        LineW->setLineStepM(10);
00436        DistanceLayout2->addWidget( LineW, 2, 1);
00437 
00438        flippedPathText = new QCheckBox( Distance2, "flippedPathText" );
00439        flippedPathText->setText( "Flip Text" );
00440        DistanceLayout2->addMultiCellWidget( flippedPathText, 3, 3, 0, 1 );
00441 
00442        showcurveCheckBox = new QCheckBox( Distance2, "showcurveCheckBox" );
00443        showcurveCheckBox->setText( "Show Curve" );
00444        DistanceLayout2->addMultiCellWidget( showcurveCheckBox, 4, 4, 0, 1 );
00445 
00446        pageLayout_2b->addWidget(Distance2);
00447        TabStack2->addWidget( page_2b, 1 );
00448 
00449        page_2c = new QWidget( TabStack2, "page" );
00450        pageLayout_2c = new QVBoxLayout( page_2c, 0, 5, "pageLayout_2");
00451        Distance3 = new QButtonGroup( "Fill Rule", page_2c, "Distance" );
00452        Distance3->setColumnLayout(0, Qt::Vertical );
00453        Distance3->layout()->setSpacing( 2 );
00454        Distance3->layout()->setMargin( 5 );
00455        DistanceLayout3 = new QVBoxLayout( Distance3->layout() );
00456        DistanceLayout3->setAlignment( Qt::AlignTop );
00457        EvenOdd = new QRadioButton( "Even-Odd", Distance3, "EvenOdd" );
00458        DistanceLayout3->addWidget( EvenOdd );
00459        NonZero = new QRadioButton( "Non Zero", Distance3, "NonZero" );
00460        DistanceLayout3->addWidget( NonZero );
00461        EvenOdd->setChecked( true );
00462        pageLayout_2c->addWidget(Distance3);
00463        TabStack2->addWidget( page_2c, 2 );
00464 
00465        pageLayout_2->addWidget( TabStack2 );
00466 
00467        textFlowOptions = new QButtonGroup( page_2, "textFlowOptions" );
00468        textFlowOptions->setColumnLayout(0, Qt::Vertical );
00469        textFlowOptions->layout()->setSpacing( 5 );
00470        textFlowOptions->layout()->setMargin( 10 );
00471        textFlowOptionsLayout = new QVBoxLayout( textFlowOptions->layout() );
00472        textFlowOptionsLayout->setAlignment( Qt::AlignTop );
00473        textFlowOptions->setCheckable( false );
00474        textFlowOptions->setExclusive( true );
00475        textFlowDisabled = new QToolButton( textFlowOptions, "textFlowDisabled" );
00476        textFlowDisabled->setToggleButton( true );
00477        textFlowDisabled->setTextPosition( QToolButton::BesideIcon );
00478        textFlowDisabled->setUsesTextLabel( true );
00479        textFlowDisabled->setTextLabel( "Disabled" );
00480        textFlowDisabled->setPixmap(loadIcon("flow-none.png"));
00481        textFlowOptionsLayout->addWidget( textFlowDisabled );
00482        textFlowUsesFrameShape  = new QToolButton( textFlowOptions, "textFlowUsesObjectFrame" );
00483        textFlowUsesFrameShape->setToggleButton( true );
00484        textFlowUsesFrameShape->setTextPosition( QToolButton::BesideIcon );
00485        textFlowUsesFrameShape->setUsesTextLabel( true );
00486        textFlowUsesFrameShape->setTextLabel( "Use &Frame Shape" );
00487        textFlowUsesFrameShape->setPixmap(loadIcon("flow-frame.png"));
00488        textFlowOptionsLayout->addWidget( textFlowUsesFrameShape );
00489        textFlowUsesBoundingBox = new QToolButton( textFlowOptions, "textFlowUsesBoundingBox" );
00490        textFlowUsesBoundingBox->setToggleButton( true );
00491        textFlowUsesBoundingBox->setTextPosition( QToolButton::BesideIcon );
00492        textFlowUsesBoundingBox->setUsesTextLabel( true );
00493        textFlowUsesBoundingBox->setTextLabel( "Use &Bounding Box" );
00494        textFlowUsesBoundingBox->setPixmap(loadIcon("flow-bounding.png"));
00495        textFlowOptionsLayout->addWidget( textFlowUsesBoundingBox );
00496        textFlowUsesContourLine = new QToolButton( textFlowOptions, "textFlowUsesContourLine" );
00497        textFlowUsesContourLine->setToggleButton( true );
00498        textFlowUsesContourLine->setTextPosition( QToolButton::BesideIcon );
00499        textFlowUsesContourLine->setUsesTextLabel( true );
00500        textFlowUsesContourLine->setTextLabel( "&Use Contour Line" );
00501        textFlowUsesContourLine->setPixmap(loadIcon("flow-contour.png"));
00502        textFlowOptionsLayout->addWidget( textFlowUsesContourLine );
00503        textFlowUsesImageClipping = new QToolButton( textFlowOptions, "textFlowUsesImageClipping" );
00504        textFlowUsesImageClipping->setToggleButton( true );
00505        textFlowUsesImageClipping->setTextPosition( QToolButton::BesideIcon );
00506        textFlowUsesImageClipping->setUsesTextLabel( true );
00507        textFlowUsesImageClipping->setTextLabel( "Use Image Clip Path" );
00508        textFlowUsesImageClipping->setPixmap(loadIcon("flow-contour.png"));
00509        textFlowOptionsLayout->addWidget( textFlowUsesImageClipping );
00510        pageLayout_2->addWidget( textFlowOptions  );
00511 
00512        QSpacerItem* spacer6 = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding );
00513        pageLayout_2->addItem( spacer6 );
00514        idShapeItem=TabStack->addItem( page_2, "&Shape" );
00515 
00516        page_group = new QWidget(TabStack, "page_group");
00517        page_group_layout = new QVBoxLayout( page_group, 0, 5, "pageLayout_2");
00518 
00519        ShapeGroup2 = new QButtonGroup( "", page_group, "ShapeGroup2" );
00520        ShapeGroup2->setFrameShape( QButtonGroup::NoFrame );
00521        ShapeGroup2->setExclusive( true );
00522        ShapeGroup2->setColumnLayout(0, Qt::Vertical );
00523        ShapeGroup2->layout()->setSpacing( 2 );
00524        ShapeGroup2->layout()->setMargin( 0 );
00525        ShapeGroupLayout2 = new QHBoxLayout( ShapeGroup2->layout() );
00526        ShapeGroupLayout2->setAlignment( Qt::AlignTop );
00527        SRect2 = new QLabel( "Shape:", ShapeGroup2, "SRect" );
00528        ShapeGroupLayout2->addWidget( SRect2 );
00529        SCustom2 = new Autoforms( ShapeGroup2 );
00530        ShapeGroupLayout2->addWidget( SCustom2 );
00531        page_group_layout->addWidget( ShapeGroup2 );
00532        EditShape2 = new QToolButton( page_group, "EditShape" );
00533        page_group_layout->addWidget( EditShape2 );
00534 
00535        textFlowOptions2 = new QButtonGroup( page_group, "textFlowOptions" );
00536        textFlowOptions2->setColumnLayout(0, Qt::Vertical );
00537        textFlowOptions2->layout()->setSpacing( 5 );
00538        textFlowOptions2->layout()->setMargin( 10 );
00539        textFlowOptionsLayout2 = new QVBoxLayout( textFlowOptions2->layout() );
00540        textFlowOptionsLayout2->setAlignment( Qt::AlignTop );
00541        textFlowOptions2->setCheckable( false );
00542        textFlowOptions2->setExclusive( true );
00543        textFlowDisabled2 = new QToolButton( textFlowOptions2, "textFlowDisabled" );
00544        textFlowDisabled2->setToggleButton( true );
00545        textFlowDisabled2->setTextPosition( QToolButton::BesideIcon );
00546        textFlowDisabled2->setUsesTextLabel( true );
00547        textFlowDisabled2->setTextLabel( "Disabled" );
00548        textFlowDisabled2->setPixmap(loadIcon("flow-none.png"));
00549        textFlowOptionsLayout2->addWidget( textFlowDisabled2 );
00550        textFlowUsesFrameShape2  = new QToolButton( textFlowOptions2, "textFlowUsesObjectFrame" );
00551        textFlowUsesFrameShape2->setToggleButton( true );
00552        textFlowUsesFrameShape2->setTextPosition( QToolButton::BesideIcon );
00553        textFlowUsesFrameShape2->setUsesTextLabel( true );
00554        textFlowUsesFrameShape2->setTextLabel( "Use &Frame Shape" );
00555        textFlowUsesFrameShape2->setPixmap(loadIcon("flow-frame.png"));
00556        textFlowOptionsLayout2->addWidget( textFlowUsesFrameShape2 );
00557        textFlowUsesBoundingBox2 = new QToolButton( textFlowOptions2, "textFlowUsesBoundingBox" );
00558        textFlowUsesBoundingBox2->setToggleButton( true );
00559        textFlowUsesBoundingBox2->setTextPosition( QToolButton::BesideIcon );
00560        textFlowUsesBoundingBox2->setUsesTextLabel( true );
00561        textFlowUsesBoundingBox2->setTextLabel( "Use &Bounding Box" );
00562        textFlowUsesBoundingBox2->setPixmap(loadIcon("flow-bounding.png"));
00563        textFlowOptionsLayout2->addWidget( textFlowUsesBoundingBox2 );
00564        textFlowUsesContourLine2 = new QToolButton( textFlowOptions2, "textFlowUsesContourLine" );
00565        textFlowUsesContourLine2->setToggleButton( true );
00566        textFlowUsesContourLine2->setTextPosition( QToolButton::BesideIcon );
00567        textFlowUsesContourLine2->setUsesTextLabel( true );
00568        textFlowUsesContourLine2->setTextLabel( "&Use Contour Line" );
00569        textFlowUsesContourLine2->setPixmap(loadIcon("flow-contour.png"));
00570        textFlowOptionsLayout2->addWidget( textFlowUsesContourLine2 );
00571        textFlowUsesImageClipping2 = new QToolButton( textFlowOptions2, "textFlowUsesImageClipping" );
00572        textFlowUsesImageClipping2->setToggleButton( true );
00573        textFlowUsesImageClipping2->setTextPosition( QToolButton::BesideIcon );
00574        textFlowUsesImageClipping2->setUsesTextLabel( true );
00575        textFlowUsesImageClipping2->setTextLabel( "Use Image Clip Path" );
00576        textFlowUsesImageClipping2->setPixmap(loadIcon("flow-contour.png"));
00577        textFlowOptionsLayout2->addWidget( textFlowUsesImageClipping2 );
00578        page_group_layout->addWidget( textFlowOptions2 );
00579 
00580        TransGroup = new QGroupBox( tr( "Transparency Settings" ), page_group, "TransGroup" );
00581        TransGroup->setColumnLayout(0, Qt::Vertical );
00582        TransGroup->layout()->setSpacing( 0 );
00583        TransGroup->layout()->setMargin( 0 );
00584        Layout1t = new QGridLayout( TransGroup->layout() );
00585        Layout1t->setAlignment( Qt::AlignTop );
00586        Layout1t->setSpacing( 5 );
00587        Layout1t->setMargin( 5 );
00588        TransTxt = new QLabel( TransGroup, "Transtxt" );
00589        Layout1t->addWidget( TransTxt, 0, 0 );
00590        TransSpin = new QSpinBox( TransGroup, "traspin" );
00591        TransSpin->setMinValue(0);
00592        TransSpin->setMaxValue(100);
00593        TransSpin->setLineStep(10);
00594        TransSpin->setValue(100);
00595        Layout1t->addWidget(TransSpin, 0, 1);
00596        TransTxt2 = new QLabel( TransGroup, "textLabel1" );
00597        Layout1t->addWidget( TransTxt2, 1, 0 );
00598        blendMode = new ScComboBox( false, TransGroup, "blendMode" );
00599        Layout1t->addWidget( blendMode, 1, 1 );
00600        page_group_layout->addWidget(TransGroup);
00601 //     TransGroup->setEnabled(false);
00602 #ifndef HAVE_CAIRO
00603        blendMode->hide();
00604        TransTxt2->hide();
00605 /*
00606 #else
00607 #if CAIRO_VERSION < CAIRO_VERSION_ENCODE(1, 1, 8)
00608        blendMode->hide();
00609        TransTxt2->hide();
00610 #endif
00611 */
00612 #endif
00613        QSpacerItem* spacerTr2 = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding );
00614        page_group_layout->addItem( spacerTr2 );
00615        idGroupItem = TabStack->addItem(page_group, "Groups");
00616 
00617        page_3 = new QWidget( TabStack, "page_3" );
00618        pageLayout_3 = new QVBoxLayout( page_3, 0, 5, "pageLayout_3");
00619        pageLayout_3->setAlignment( Qt::AlignLeft );
00620 
00621        layout47 = new QHBoxLayout( 0, 0, 5, "layout47");
00622 
00623        layout46 = new QVBoxLayout( 0, 0, 5, "layout46");
00624 
00625        layout41 = new QGridLayout( 0, 1, 1, 0, 5, "layout41");
00626        layout41->setAlignment( Qt::AlignLeft );
00627 
00628        Fonts = new FontComboH(page_3);
00629 //     Fonts->setMaximumSize(200, 80);
00630        layout41->addMultiCellWidget( Fonts, 0, 0, 0, 3 );
00631 
00632        Size = new MSpinBox( 0.5, 2048, page_3, 1 );
00633        Size->setPrefix( "" );
00634        fontsizeLabel = new QLabel( "", page_3, "fontsizeLabel" );
00635        fontsizeLabel->setPixmap(loadIcon("Zeichen.xpm"));
00636        layout41->addWidget( fontsizeLabel, 1, 0 );
00637        layout41->addWidget( Size, 1, 1 );
00638        ChBase = new MSpinBox( -100, 100, page_3, 1 );
00639        ChBase->setValue( 0 );
00640        ChBaseTxt = new QLabel("", page_3, "ChBaseTxt" );
00641        ChBaseTxt->setPixmap(loadIcon("textbase.png"));
00642        layout41->addWidget( ChBaseTxt, 1, 2 );
00643        layout41->addWidget( ChBase, 1, 3 );
00644        LineSp = new MSpinBox( page_3, 1 );
00645        layout41->addWidget( LineSp, 2, 1 );
00646        lineSpacingPop = new QPopupMenu();
00647        lineSpacingPop->insertItem( tr("Fixed Linespacing"));
00648        lineSpacingPop->insertItem( tr("Automatic Linespacing"));
00649        lineSpacingPop->insertItem( tr("Align to Baseline Grid"));
00650        linespacingButton = new QToolButton(page_3, "linespacingButton" );
00651        linespacingButton->setText("");
00652        linespacingButton->setPixmap(loadIcon("linespacing.png"));
00653        linespacingButton->setPopup(lineSpacingPop);
00654        linespacingButton->setPopupDelay(400);
00655        linespacingButton->setAutoRaise(true);
00656        layout41->addWidget( linespacingButton, 2, 0 );
00657        Extra = new MSpinBox( page_3, 1 );
00658        layout41->addWidget( Extra, 2, 3 );
00659        trackingLabel = new QLabel( "", page_3, "trackingLabel" );
00660        trackingLabel->setText("");
00661        trackingLabel->setPixmap(loadIcon("textkern.png"));
00662        layout41->addWidget( trackingLabel, 2, 2 );
00663        ChScale = new MSpinBox( 10, 400, page_3, 1 );
00664        ChScale->setValue( 100 );
00665        ScaleTxt = new QLabel("", page_3, "ScaleTxt" );
00666        ScaleTxt->setPixmap(loadIcon("textscaleh.png"));
00667        layout41->addWidget( ScaleTxt, 3, 0 );
00668        layout41->addWidget( ChScale, 3 , 1 );
00669        ChScaleV = new MSpinBox( 10, 400, page_3, 1 );
00670        ChScaleV->setValue( 100 );
00671        ScaleTxtV = new QLabel("", page_3, "ScaleTxtV" );
00672        ScaleTxtV->setPixmap(loadIcon("textscalev.png"));
00673        layout41->addWidget( ScaleTxtV, 3, 2 );
00674        layout41->addWidget( ChScaleV, 3, 3 );
00675 
00676        layout46->addLayout( layout41 );
00677 
00678        layout23 = new QHBoxLayout( 0, 0, 5, "layout23");
00679        layout23->setAlignment( Qt::AlignLeft );
00680        StrokeIcon = new QLabel( "", page_3, "StrokeIcon" );
00681        StrokeIcon->setPixmap(loadIcon("16/color-stroke.png"));
00682        StrokeIcon->setScaledContents( false );
00683        layout23->addWidget( StrokeIcon );
00684        TxStroke = new ColorCombo( false, page_3, "TxStroke" );
00685        layout23->addWidget( TxStroke );
00686        ShadeTxt1 = new QLabel( "", page_3, "ShadeTxt" );
00687        ShadeTxt1->setPixmap(loadIcon("shade.png"));
00688        layout23->addWidget( ShadeTxt1 );
00689        PM1 = new ShadeButton(page_3);
00690        layout23->addWidget( PM1 );
00691        layout46->addLayout( layout23 );
00692        layout24 = new QHBoxLayout( 0, 0, 5, "layout24");
00693        layout24->setAlignment( Qt::AlignLeft );
00694        FillIcon = new QLabel( "", page_3, "FillIcon" );
00695        FillIcon->setPixmap(loadIcon("16/color-fill.png"));
00696        layout24->addWidget( FillIcon );
00697        TxFill = new ColorCombo( false, page_3, "TxFill" );
00698        layout24->addWidget( TxFill );
00699        ShadeTxt2 = new QLabel("", page_3, "ShadeTxt" );
00700        ShadeTxt2->setPixmap(loadIcon("shade.png"));
00701        layout24->addWidget( ShadeTxt2 );
00702        PM2 = new ShadeButton(page_3);
00703        layout24->addWidget( PM2 );
00704        layout46->addLayout( layout24 );
00705 
00706        Layout1 = new QHBoxLayout( 0, 0, 0, "Layout1");
00707        Layout1->setAlignment( Qt::AlignLeft );
00708        SeStyle = new StyleSelect(page_3);
00709        Layout1->addWidget(SeStyle);
00710        Revert = new QToolButton( page_3, "Bold" );
00711        Revert->setMaximumSize( QSize( 22, 22 ) );
00712        Revert->setText("");
00713        Revert->setPixmap(loadIcon("Revers.png"));
00714        Revert->setToggleButton( true );
00715        Layout1->addWidget( Revert );
00716        QSpacerItem* spacer7 = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );
00717        Layout1->addItem( spacer7 );
00718        layout46->addLayout( Layout1 );
00719        layout47->addLayout( layout46 );
00720        pageLayout_3->addLayout( layout47 );
00721 
00722        GroupAlign = new AlignSelect(page_3);
00723        pageLayout_3->addWidget( GroupAlign );
00724 
00725        GroupBox3aLayout = new QGridLayout( 0, 6, 1, 0, 5, "Layout25");
00726        GroupBox3aLayout->setAlignment( Qt::AlignLeft );
00727        paraStyleCombo = new ParaStyleComboBox(page_3);
00728        paraStyleLabel = new QLabel( paraStyleCombo, "Paragraph St&yle:", page_3, "parastyleLabel" );
00729        paraStyleClear = new QToolButton( page_3, "Clear_PStyle" );
00730        paraStyleClear->setMaximumSize( QSize( 22, 22 ) );
00731        paraStyleClear->setText("");
00732        paraStyleClear->setPixmap(loadIcon("16/edit-clear.png"));
00733        GroupBox3aLayout->addWidget( paraStyleLabel, 0, 0 );
00734        GroupBox3aLayout->addWidget( paraStyleCombo, 0, 1 );
00735        GroupBox3aLayout->addWidget( paraStyleClear, 0, 2 );
00736        charStyleCombo = new CharStyleComboBox(page_3);
00737        charStyleLabel = new QLabel( charStyleCombo, "Character St&yle:", page_3, "charstyleLabel" );
00738        charStyleClear = new QToolButton( page_3, "Clear_CStyle" );
00739        charStyleClear->setMaximumSize( QSize( 22, 22 ) );
00740        charStyleClear->setText("");
00741        charStyleClear->setPixmap(loadIcon("16/edit-clear.png"));
00742        GroupBox3aLayout->addWidget( charStyleLabel, 1, 0 );
00743        GroupBox3aLayout->addWidget( charStyleCombo, 1, 1 );
00744        GroupBox3aLayout->addWidget( charStyleClear, 1, 2 );
00745        optMarginCombo = new QComboBox(page_3);
00746        optMarginLabel = new QLabel( optMarginCombo, "Optical Margins:", page_3, "optMarginLabel" );
00747        GroupBox3aLayout->addWidget( optMarginLabel, 2, 0 );
00748        GroupBox3aLayout->addWidget( optMarginCombo, 2, 1 );
00749        
00750        wordTrackingLabel = new QLabel( "Word Tracking", page_3, "wordTrackingLabel" );
00751        GroupBox3aLayout->addWidget( wordTrackingLabel, 3, 0 );
00752        wordTrackingHLayout = new QHBoxLayout(0,0,5,"wordTrackingHLayout");
00753        wordTrackingHLayout->setAlignment(Qt::AlignLeft);
00754        minWordTrackingSpinBox = new MSpinBox( 1, 200, page_3, 1 );
00755        minWordTrackingLabel = new QLabel( minWordTrackingSpinBox, "Min:", page_3, "wordTrackingMinLabel" );
00756        wordTrackingHLayout->add(minWordTrackingLabel);
00757        wordTrackingHLayout->add(minWordTrackingSpinBox);
00758        normWordTrackingSpinBox = new MSpinBox( 1, 200, page_3, 1 );
00759        normWordTrackingLabel = new QLabel( normWordTrackingSpinBox, "Norm:", page_3, "wordTrackingNormLabel" );
00760        wordTrackingHLayout->add(normWordTrackingLabel);
00761        wordTrackingHLayout->add(normWordTrackingSpinBox);
00762        GroupBox3aLayout->addMultiCellLayout(wordTrackingHLayout, 4, 4, 0, 1);
00763        
00764        glyphExtensionLabel = new QLabel( "Glyph Extension", page_3, "glyphExtensionLabel" );
00765        GroupBox3aLayout->addWidget( glyphExtensionLabel, 5, 0 );
00766        glyphExtensionHLayout = new QHBoxLayout(0,0,5,"glyphExtensionHLayout");
00767        glyphExtensionHLayout->setAlignment(Qt::AlignLeft);
00768        minGlyphExtSpinBox = new MSpinBox( 90, 110, page_3, 1 );
00769        minGlyphExtensionLabel = new QLabel( minGlyphExtSpinBox, "Min:", page_3, "glyphExtensionMinLabel" );
00770        glyphExtensionHLayout->add(minGlyphExtensionLabel);
00771        glyphExtensionHLayout->add(minGlyphExtSpinBox);
00772        maxGlyphExtSpinBox = new MSpinBox( 90, 110, page_3, 1 );
00773        maxGlyphExtensionLabel = new QLabel( maxGlyphExtSpinBox, "Max:", page_3, "glyphExtensionMaxLabel" );
00774        glyphExtensionHLayout->add(maxGlyphExtensionLabel);
00775        glyphExtensionHLayout->add(maxGlyphExtSpinBox);
00776        GroupBox3aLayout->addMultiCellLayout(glyphExtensionHLayout, 6, 6, 0, 1);
00777        
00778 /*     langCombo = new ScComboBox( false, page_3, "Lang" );
00779        langLabel = new QLabel( langCombo, "Lan&guage:", page_3, "langLabel" );
00780        GroupBox3aLayout->addWidget( langLabel, 1, 0 );
00781        GroupBox3aLayout->addWidget( langCombo, 1, 1 ); */
00782        pageLayout_3->addLayout(GroupBox3aLayout);
00783 
00784        QSpacerItem* spacer8 = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding );
00785        pageLayout_3->addItem( spacer8 );
00786        idTextItem=TabStack->addItem( page_3, "&Text" );
00787 
00788        page_4 = new QWidget( TabStack, "page_4" );
00789        pageLayout_4 = new QVBoxLayout( page_4, 0, 5, "pageLayout_4");
00790 
00791        FreeScale = new QRadioButton( "&Free Scaling", page_4, "FreeScale" );
00792        FreeScale->setChecked( true );
00793        pageLayout_4->addWidget( FreeScale );
00794 
00795        layout43 = new QGridLayout( 0, 1, 1, 0, 5, "layout43");
00796        imageXOffsetSpinBox = new MSpinBox( page_4, 2 );
00797        installSniffer(imageXOffsetSpinBox);
00798        xposImgLabel = new QLabel( imageXOffsetSpinBox, "&X-Pos:", page_4, "xposImgLabel" );
00799        layout43->addWidget( xposImgLabel, 0, 0 );
00800        layout43->addWidget( imageXOffsetSpinBox, 0, 1 );
00801        imageYOffsetSpinBox = new MSpinBox( page_4, 2 );
00802        installSniffer(imageYOffsetSpinBox);
00803        yposImgLabel = new QLabel( imageYOffsetSpinBox, "&Y-Pos:", page_4, "yposImgLabel" );
00804        layout43->addWidget( yposImgLabel, 1, 0 );
00805        layout43->addWidget( imageYOffsetSpinBox, 1, 1 );
00806        imageXScaleSpinBox = new MSpinBox( page_4, 1 );
00807        installSniffer(imageXScaleSpinBox);
00808        xscaleLabel = new QLabel( imageXScaleSpinBox, "X-Sc&ale:", page_4, "xscaleLabel" );
00809        layout43->addWidget( xscaleLabel, 2, 0 );
00810        layout43->addWidget( imageXScaleSpinBox, 2, 1 );
00811        imageYScaleSpinBox = new MSpinBox( page_4, 1 );
00812        installSniffer(imageYScaleSpinBox);
00813        yscaleLabel = new QLabel( imageYScaleSpinBox, "Y-Scal&e:", page_4, "yscaleLabel" );
00814        layout43->addWidget( yscaleLabel, 3, 0 );
00815        layout43->addWidget( imageYScaleSpinBox, 3, 1 );
00816        keepImageWHRatioButton = new LinkButton( page_4 );
00817        keepImageWHRatioButton->setToggleButton( true );
00818        keepImageWHRatioButton->setAutoRaise( true );
00819        keepImageWHRatioButton->setMaximumSize( QSize( 15, 32767 ) );
00820        layout43->addMultiCellWidget( keepImageWHRatioButton, 2, 3, 2, 2 );
00821        imgDpiX = new MSpinBox( page_4, 1 );
00822        installSniffer(imgDpiX);
00823        imgDPIXLabel = new QLabel( imgDpiX, "Actual X-DPI:", page_4, "imgDPIYLabel" );
00824        layout43->addWidget( imgDPIXLabel, 4, 0 );
00825        layout43->addWidget( imgDpiX, 4, 1 );
00826        imgDpiY = new MSpinBox( page_4, 1 );
00827        installSniffer(imgDpiY);
00828        imgDPIYLabel = new QLabel( imgDpiY, "Actual Y-DPI:", page_4, "imgDPIYLabel" );
00829        layout43->addWidget( imgDPIYLabel, 5, 0 );
00830        layout43->addWidget( imgDpiY, 5, 1 );
00831        keepImageDPIRatioButton = new LinkButton( page_4 );
00832        keepImageDPIRatioButton->setToggleButton( true );
00833        keepImageDPIRatioButton->setAutoRaise( true );
00834        keepImageDPIRatioButton->setMaximumSize( QSize( 15, 32767 ) );
00835        layout43->addMultiCellWidget( keepImageDPIRatioButton, 4, 5, 2, 2 );
00836        pageLayout_4->addLayout( layout43 );
00837 
00838        Layout24 = new QVBoxLayout( 0, 0, 3, "Layout24");
00839 
00840        FrameScale = new QRadioButton( page_4, "FixedScale" );
00841        FrameScale->setText( "Scale &To Frame Size" );
00842        Layout24->addWidget( FrameScale );
00843 
00844        Layout18 = new QHBoxLayout( 0, 0, 6, "Layout18");
00845 
00846        Frame4 = new QFrame( page_4, "Frame4" );
00847        Frame4->setMinimumSize( QSize( 15, 2 ) );
00848        Frame4->setMaximumSize( QSize( 15, 10 ) );
00849        Frame4->setFrameShape( QFrame::NoFrame );
00850        Frame4->setFrameShadow( QFrame::Plain );
00851        Layout18->addWidget( Frame4 );
00852 
00853        Aspect = new QCheckBox( page_4, "Aspect" );
00854        Aspect->setEnabled( false );
00855        Aspect->setText( "P&roportional" );
00856        Aspect->setChecked( true );
00857 
00858        Layout18->addWidget( Aspect );
00859        Layout24->addLayout( Layout18 );
00860        pageLayout_4->addLayout( Layout24 );
00861 
00862        EditEffects = new QToolButton( page_4, "EditEffects");
00863        pageLayout_4->addWidget( EditEffects );
00864 
00865        EditPSDProps = new QToolButton( page_4, "EditPSDProps");
00866        pageLayout_4->addWidget( EditPSDProps );
00867 
00868        GroupBoxCM = new QGroupBox( "", page_4, "GroupBoxcm" );
00869        GroupBoxCM->setColumnLayout(0, Qt::Vertical );
00870        GroupBoxCM->layout()->setSpacing( 2 );
00871        GroupBoxCM->layout()->setMargin( 5 );
00872        GroupBoxCM->setFrameShape( QFrame::NoFrame );
00873        GroupBoxCM->setFrameShadow( QFrame::Plain );
00874        GroupBoxCMLayout = new QVBoxLayout( GroupBoxCM->layout() );
00875        GroupBoxCMLayout->setAlignment( Qt::AlignTop );
00876        TextCms1 = new QLabel( GroupBoxCM, "xposLabel" );
00877        GroupBoxCMLayout->addWidget( TextCms1 );
00878        InputP = new ScComboBox( false, GroupBoxCM, "InputP" );
00879        GroupBoxCMLayout->addWidget(InputP);
00880        TextCms2 = new QLabel( GroupBoxCM, "TextCms2" );
00881        GroupBoxCMLayout->addWidget(TextCms2);
00882        MonitorI = new ScComboBox( false, GroupBoxCM, "MonitorI" );
00883        GroupBoxCMLayout->addWidget(MonitorI);
00884        pageLayout_4->addWidget(GroupBoxCM);
00885 
00886        QSpacerItem* spacer9 = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding );
00887        pageLayout_4->addItem( spacer9 );
00888        idImageItem=TabStack->addItem( page_4, "&Image" );
00889 
00890        page_5 = new QWidget( TabStack, "page_5" );
00891        pageLayout_5 = new QVBoxLayout( page_5, 0, 5, "pageLayout_5");
00892 
00893        Layout13_2 = new QHBoxLayout( 0, 0, 4, "Layout13_2");
00894        LineMode = new ScComboBox( false, page_5, "LMode" );
00895        LineModeT = new QLabel( LineMode, "&Basepoint:", page_5, "LModeText" );
00896        Layout13_2->addWidget( LineModeT );
00897        Layout13_2->addWidget( LineMode );
00898        LMode = false;
00899        QSpacerItem* spacer10 = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );
00900        Layout13_2->addItem( spacer10 );
00901        pageLayout_5->addLayout( Layout13_2 );
00902 
00903        Layout12_2 = new QGridLayout( 0, 1, 1, 0, 3, "Layout12_2");
00904        LStyle = new LineCombo(page_5);
00905        linetypeLabel = new QLabel( LStyle, "T&ype of Line:", page_5, "linetypeLabel" );
00906        Layout12_2->addWidget( linetypeLabel, 0, 0 );
00907        Layout12_2->addWidget( LStyle, 0, 1 );
00908        startArrow = new ArrowChooser(page_5, true);
00909        Layout12_2->addWidget( startArrow, 2, 0 );
00910        endArrow = new ArrowChooser(page_5, false);
00911        Layout12_2->addWidget( endArrow, 2, 1 );
00912        startArrowText = new QLabel( startArrow, "Start Arrow:", page_5, "startArrowText" );
00913        Layout12_2->addWidget( startArrowText, 1, 0 );
00914        endArrowText = new QLabel( endArrow, "End Arrow:", page_5, "endArrowText" );
00915        Layout12_2->addWidget( endArrowText, 1, 1 );
00916        LSize = new MSpinBox( page_5, 3 );
00917        linewidthLabel = new QLabel(LSize, "Line &Width:", page_5, "linewidthLabel" );
00918        Layout12_2->addWidget( linewidthLabel, 3, 0 );
00919        Layout12_2->addWidget( LSize, 3, 1 );
00920        LJoinStyle = new ScComboBox( false, page_5, "LJoin" );
00921        edgesLabel = new QLabel( LJoinStyle, "Ed&ges:", page_5, "edgesLabel" );
00922        Layout12_2->addWidget( edgesLabel, 4, 0 );
00923        Layout12_2->addWidget( LJoinStyle, 4, 1 );
00924        LEndStyle = new ScComboBox( false, page_5, "LCap" );
00925        endingsLabel = new QLabel( LEndStyle, "&Endings:", page_5, "endingsLabel" );
00926        Layout12_2->addWidget( endingsLabel, 5, 0 );
00927        Layout12_2->addWidget( LEndStyle, 5, 1 );
00928        pageLayout_5->addLayout( Layout12_2 );
00929 
00930        TabStack3 = new QWidgetStack( page_5, "TabStack3" );
00931        TabStack3->setFrameShape( QWidgetStack::NoFrame );
00932 
00933        page_5a = new QWidget( TabStack3, "page" );
00934        pageLayout_5a = new QVBoxLayout( page_5a, 0, 5, "pageLayout_5a");
00935        StyledLine = new QListBox(page_5a, "StyledL");
00936        StyledLine->insertItem( "No Style", 0);
00937        pageLayout_5a->addWidget(StyledLine);
00938        TabStack3->addWidget( page_5a, 0 );
00939 
00940        page_5b = new QWidget( TabStack3, "page" );
00941        pageLayout_5b = new QVBoxLayout( page_5b, 0, 5, "pageLayout_5a");
00942        TLines = new QGroupBox( "Cell Lines", page_5b, "Distance" );
00943        TLines->setColumnLayout(0, Qt::Vertical );
00944        TLines->layout()->setSpacing( 2 );
00945        TLines->layout()->setMargin( 5 );
00946        TLineLayout = new QVBoxLayout( TLines->layout() );
00947        TLineLayout->setAlignment( Qt::AlignTop );
00948        TopLine = new QCheckBox( TLines, "TopLine" );
00949        TopLine->setText( "Line at Top" );
00950        TLineLayout->addWidget(TopLine);
00951        LeftLine = new QCheckBox( TLines, "TopLine" );
00952        LeftLine->setText( "Line at the Left" );
00953        TLineLayout->addWidget(LeftLine);
00954        RightLine = new QCheckBox( TLines, "TopLine" );
00955        RightLine->setText( "Line at the Right " );
00956        TLineLayout->addWidget(RightLine);
00957        BottomLine = new QCheckBox( TLines, "TopLine" );
00958        BottomLine->setText( "Line at Bottom" );
00959        TLineLayout->addWidget(BottomLine);
00960        pageLayout_5b->addWidget(TLines);
00961        TabStack3->addWidget( page_5b, 1 );
00962        pageLayout_5->addWidget( TabStack3 );
00963        idLineItem=TabStack->addItem( page_5, "&Line" );
00964        
00965        page_6 = new QWidget( TabStack, "page_6" );
00966        pageLayout_6 = new QVBoxLayout( page_6, 0, 5, "pageLayout_6");
00967 
00968        Cpal = new Cpalette(page_6);
00969        pageLayout_6->addWidget( Cpal );
00970 
00971        OverP = new QButtonGroup( "Overprinting", page_6, "Distance" );
00972        OverP->setColumnLayout(0, Qt::Vertical );
00973        OverP->layout()->setSpacing( 2 );
00974        OverP->layout()->setMargin( 5 );
00975        OverPLayout = new QVBoxLayout( OverP->layout() );
00976        OverPLayout->setAlignment( Qt::AlignTop );
00977        KnockOut = new QRadioButton( "Knockout", OverP, "KnockOut" );
00978        OverPLayout->addWidget( KnockOut );
00979        Overprint = new QRadioButton( "Overprint", OverP, "Overprint" );
00980        OverPLayout->addWidget( Overprint );
00981        KnockOut->setChecked( true );
00982        pageLayout_6->addWidget(OverP);
00983 
00984        idColorsItem=TabStack->addItem(page_6, "&Colors" );
00985        MpalLayout->addWidget( TabStack );
00986 
00987        languageChange();
00988 
00989        connect(Xpos, SIGNAL(valueChanged(int)), this, SLOT(NewX()));
00990        connect(Ypos, SIGNAL(valueChanged(int)), this, SLOT(NewY()));
00991        connect(Width, SIGNAL(valueChanged(int)), this, SLOT(NewW()));
00992        connect(Height, SIGNAL(valueChanged(int)), this, SLOT(NewH()));
00993        connect(Rot, SIGNAL(valueChanged(int)), this, SLOT(NewR()));
00994        connect(RoundRect, SIGNAL(valueChanged(int)), this, SLOT(NewRR()));
00995        connect(LineSp, SIGNAL(valueChanged(int)), this, SLOT(NewLsp()));
00996        connect(Size, SIGNAL(valueChanged(int)), this, SLOT(NewSize()));
00997        connect(Extra, SIGNAL(valueChanged(int)), this, SLOT(NewExtra()));
00998        connect(imageXScaleSpinBox, SIGNAL(valueChanged(int)), this, SLOT(HChange()));
00999        connect(imageYScaleSpinBox, SIGNAL(valueChanged(int)), this, SLOT(VChange()));
01000        connect(imageXOffsetSpinBox, SIGNAL(valueChanged(int)), this, SLOT(NewLocalXY()));
01001        connect(imageYOffsetSpinBox, SIGNAL(valueChanged(int)), this, SLOT(NewLocalXY()));
01002        connect(imgDpiX, SIGNAL(valueChanged(int)), this, SLOT(HChangeD()));
01003        connect(imgDpiY, SIGNAL(valueChanged(int)), this, SLOT(VChangeD()));
01004        connect(LSize, SIGNAL(valueChanged(int)), this, SLOT(NewLS()));
01005        connect(LStyle, SIGNAL(activated(int)), this, SLOT(NewLSty()));
01006        connect(LJoinStyle, SIGNAL(activated(int)), this, SLOT(NewLJoin()));
01007        connect(LEndStyle, SIGNAL(activated(int)), this, SLOT(NewLEnd()));
01008        connect(LineMode, SIGNAL(activated(int)), this, SLOT(NewLMode()));
01009        connect(keepImageWHRatioButton, SIGNAL(clicked()), this, SLOT(ToggleKette()));
01010        connect(keepImageDPIRatioButton, SIGNAL(clicked()), this, SLOT(ToggleKetteD()));
01011        connect(FlipH, SIGNAL(clicked()), this, SLOT(handleFlipH()));
01012        connect(FlipV, SIGNAL(clicked()), this, SLOT(handleFlipV()));
01013        connect(GroupAlign, SIGNAL(State(int)), this, SLOT(NewAli(int)));
01014        connect(Revert, SIGNAL(clicked()), this, SLOT(DoRevert()));
01015        connect(charStyleClear, SIGNAL(clicked()), this, SLOT(doClearCStyle()));
01016        connect(paraStyleClear, SIGNAL(clicked()), this, SLOT(doClearPStyle()));
01017        connect(SeStyle, SIGNAL(State(int)), this, SLOT(setTypeStyle(int)));
01018        connect(SeStyle->ShadowVal->Xoffset, SIGNAL(valueChanged(int)), this, SLOT(newShadowOffs()));
01019        connect(SeStyle->ShadowVal->Yoffset, SIGNAL(valueChanged(int)), this, SLOT(newShadowOffs()));
01020        connect(SeStyle->OutlineVal->LWidth, SIGNAL(valueChanged(int)), this, SLOT(newOutlineW()));
01021        connect(SeStyle->UnderlineVal->LPos, SIGNAL(valueChanged(int)), this, SLOT(newUnderline()));
01022        connect(SeStyle->UnderlineVal->LWidth, SIGNAL(valueChanged(int)), this, SLOT(newUnderline()));
01023        connect(SeStyle->StrikeVal->LPos, SIGNAL(valueChanged(int)), this, SLOT(newStrike()));
01024        connect(SeStyle->StrikeVal->LWidth, SIGNAL(valueChanged(int)), this, SLOT(newStrike()));
01025        connect(FreeScale, SIGNAL(clicked()), this, SLOT(ChangeScaling()));
01026        connect(FrameScale, SIGNAL(clicked()), this, SLOT(ChangeScaling()));
01027        connect(Aspect, SIGNAL(clicked()), this, SLOT(ChangeScaling()));
01028        connect(EditEffects, SIGNAL(clicked()), this, SLOT(EditEff()));
01029        connect(EditPSDProps, SIGNAL(clicked()), this, SLOT(EditPSD()));
01030        connect(Zup, SIGNAL(clicked()), this, SLOT(DoRaise()));
01031        connect(ZDown, SIGNAL(clicked()), this, SLOT(DoLower()));
01032        connect(ZTop, SIGNAL(clicked()), this, SLOT(DoFront()));
01033        connect(ZBottom, SIGNAL(clicked()), this, SLOT(DoBack()));
01034        connect(RotationGroup, SIGNAL(clicked(int)), this, SLOT(NewRotMode(int)));
01035        connect(textFlowOptions, SIGNAL(clicked(int)), this, SLOT(DoFlow(int)));
01036        connect(textFlowOptions2, SIGNAL(clicked(int)), this, SLOT(DoFlow(int)));
01037 
01038        connect(SCustom, SIGNAL(FormSel(int, int, double *)), this, SLOT(MakeIrre(int, int, double *)));
01039        connect(EditShape, SIGNAL(clicked()), this, SLOT(EditSh()));
01040        connect(SCustom2, SIGNAL(FormSel(int, int, double *)), this, SLOT(MakeIrre(int, int, double *)));
01041        connect(EditShape2, SIGNAL(clicked()), this, SLOT(EditSh2()));
01042        connect(dGap, SIGNAL(valueChanged(int)), this, SLOT(NewGap()));
01043        connect(DCol, SIGNAL(valueChanged(int)), this, SLOT(NewCols()));
01044        connect(DTop, SIGNAL(valueChanged(int)), this, SLOT(NewTDist()));
01045        connect(DLeft, SIGNAL(valueChanged(int)), this, SLOT(NewTDist()));
01046        connect(DRight, SIGNAL(valueChanged(int)), this, SLOT(NewTDist()));
01047        connect(DBottom, SIGNAL(valueChanged(int)), this, SLOT(NewTDist()));
01048        connect(TabStack, SIGNAL(currentChanged(int)), this, SLOT(SelTab(int)));
01049        connect(StyledLine, SIGNAL(clicked(QListBoxItem*)), this, SLOT(SetSTline(QListBoxItem*)));
01050        connect(Fonts, SIGNAL(fontSelected(QString )), this, SLOT(NewTFont(QString)));
01051        connect(TxFill, SIGNAL(activated(int)), this, SLOT(newTxtFill()));
01052        connect(TxStroke, SIGNAL(activated(int)), this, SLOT(newTxtStroke()));
01053        connect(PM1, SIGNAL(clicked()), this, SLOT(setActShade()));
01054        connect(PM2, SIGNAL(clicked()), this, SLOT(setActShade()));
01055        connect(ChScale, SIGNAL(valueChanged(int)), this, SLOT(NewTScale()));
01056        connect(ChScaleV, SIGNAL(valueChanged(int)), this, SLOT(NewTScaleV()));
01057        connect(ChBase, SIGNAL(valueChanged(int)), this, SLOT(NewTBase()));
01058        connect(Locked, SIGNAL(clicked()), this, SLOT(handleLock()));
01059        connect(NoPrint, SIGNAL(clicked()), this, SLOT(handlePrint()));
01060        connect(NoResize, SIGNAL(clicked()), this, SLOT(handleLockSize()));
01061        connect(showcurveCheckBox, SIGNAL(clicked()), this, SLOT(handlePathLine()));
01062        connect(pathTextType, SIGNAL(activated(int)), this, SLOT(handlePathType()));
01063        connect(flippedPathText, SIGNAL(clicked()), this, SLOT(handlePathFlip()));
01064        connect(Dist, SIGNAL(valueChanged(int)), this, SLOT(handlePathDist()));
01065        connect(LineW, SIGNAL(valueChanged(int)), this, SLOT(handlePathOffs()));
01066        connect(InputP, SIGNAL(activated(const QString&)), this, SLOT(ChProf(const QString&)));
01067        connect(MonitorI, SIGNAL(activated(int)), this, SLOT(ChIntent()));
01068        connect(NameEdit, SIGNAL(Leaved()), this, SLOT(NewName()));
01069 //     connect(langCombo, SIGNAL(activated(int)), this, SLOT(NewLanguage()));
01070        connect( TabsButton, SIGNAL( clicked() ), this, SLOT( ManageTabs() ) );
01071        connect( TopLine, SIGNAL( clicked() ), this, SLOT( HandleTLines() ) );
01072        connect( LeftLine, SIGNAL( clicked() ), this, SLOT( HandleTLines() ) );
01073        connect( RightLine, SIGNAL( clicked() ), this, SLOT( HandleTLines() ) );
01074        connect( BottomLine, SIGNAL( clicked() ), this, SLOT( HandleTLines() ) );
01075 //     connect( colgapLabel, SIGNAL( clicked() ), this, SLOT( HandleGapSwitch() ) );
01076        connect(colgapLabel, SIGNAL(activated(int)), this, SLOT(HandleGapSwitch()));
01077        connect( Cpal, SIGNAL(NewSpecial(double, double, double, double )), this, SLOT(NewSpGradient(double, double, double, double )));
01078        connect( Cpal, SIGNAL(editGradient()), this, SLOT(toggleGradientEdit()));
01079        connect(startArrow, SIGNAL(activated(int)), this, SLOT(setStartArrow(int )));
01080        connect(endArrow, SIGNAL(activated(int)), this, SLOT(setEndArrow(int )));
01081        connect(lineSpacingPop, SIGNAL(activated(int)), this, SLOT(setLspMode(int )));
01082        connect( EvenOdd, SIGNAL( clicked() ), this, SLOT(handleFillRule() ) );
01083        connect( NonZero, SIGNAL( clicked() ), this, SLOT( handleFillRule() ) );
01084        connect( KnockOut, SIGNAL( clicked() ), this, SLOT( handleOverprint() ) );
01085        connect( Overprint, SIGNAL( clicked() ), this, SLOT( handleOverprint() ) );
01086        connect(TransSpin, SIGNAL(valueChanged(int)), this, SLOT(setGroupTransparency(int)));
01087        connect(blendMode, SIGNAL(activated(int)), this, SLOT(setGroupBlending(int)));
01088        connect(DoGroup, SIGNAL(clicked()), this, SLOT(doGrouping()) );
01089        connect(optMarginCombo, SIGNAL(activated(int)), this, SLOT(setOpticalMargins(int)) );
01090        connect(minWordTrackingSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setMinWordTracking()) );
01091        connect(normWordTrackingSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setNormWordTracking()) );
01092        connect(minGlyphExtSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setMinGlyphExtension()) );
01093        connect(maxGlyphExtSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setMaxGlyphExtension()) );
01094 
01095        HaveItem = false;
01096        Xpos->setValue(0);
01097        Ypos->setValue(0);
01098        Width->setValue(0);
01099        Height->setValue(0);
01100        Rot->setValue(0);
01101        RoundRect->setValue(0);
01102        TabStack3->raiseWidget(0);
01103        TabStack2->raiseWidget(0);
01104        for (int ws = 1; ws < 7; ++ws)
01105               TabStack->setItemEnabled(ws, false);
01106        TabStack->setCurrentIndex(0);
01107        TabStack->item(0)->setEnabled(false);
01108        TabStack->setItemEnabled(0, false);
01109        StrokeIcon->setEnabled(false);
01110        TxStroke->setEnabled(false);
01111        PM1->setEnabled(false);
01112 }
01113 
01114 void Mpalette::closeEvent(QCloseEvent *closeEvent)
01115 {
01116        if (m_ScMW && !m_ScMW->ScriptRunning)
01117        {
01118               if ((HaveDoc) && (HaveItem))
01119               {
01120                      if (Cpal->gradEditButton->isOn())
01121                      {
01122                             m_ScMW->setAppMode(modeNormal);
01123                             m_ScMW->view->RefreshGradient(CurItem);
01124                      }
01125               }
01126        }
01127        ScrPaletteBase::closeEvent(closeEvent);
01128 }
01129 
01130 void Mpalette::setMainWindow(ScribusMainWindow* mw)
01131 {
01132        m_ScMW=mw;
01133        QPoint p1 = mapToGlobal(pos());
01134        QPoint p2 = m_ScMW->mapFromGlobal(p1);
01135        reparent(m_ScMW, this->getWFlags(), p2);
01136        
01137        connect(this, SIGNAL(DocChanged()), m_ScMW, SLOT(slotDocCh()));
01138 //     connect(this, SIGNAL(NewParStyle(int)), m_ScMW, SLOT(setNewParStyle(int)));
01139        connect(this, SIGNAL(NewAlignment(int)), m_ScMW, SLOT(setNewAlignment(int)));
01140        connect(this, SIGNAL(NewEffects(int)), m_ScMW, SLOT(setItemHoch(int)));
01141        connect(this, SIGNAL(ShapeEdit()), m_ScMW, SLOT(ToggleFrameEdit()));
01142        connect(this, SIGNAL(NewFont(const QString&)), m_ScMW, SLOT(SetNewFont(const QString&)));
01143        connect(this, SIGNAL(UpdtGui(int)), m_ScMW, SLOT(HaveNewSel(int)));
01144        connect(this->Cpal, SIGNAL(modeChanged()), m_ScMW, SLOT(setCSMenu()));
01145        connect(this->Cpal->gradEdit->Preview, SIGNAL(gradientChanged()), m_ScMW, SLOT(updtGradFill()));
01146        connect(this->Cpal, SIGNAL(gradientChanged()), m_ScMW, SLOT(updtGradFill()));
01147        connect(DoUnGroup, SIGNAL(clicked()), m_ScMW, SLOT(UnGroupObj()) );
01148        
01149 }
01150 
01151 void Mpalette::SelTab(int t)
01152 {
01153        if (!m_ScMW || m_ScMW->ScriptRunning)
01154               return;
01155        if ((HaveDoc) && (HaveItem) && (t == idColorsItem))
01156        {
01157               Cpal->setActGradient(CurItem->GrType);
01158               updateColorSpecialGradient();
01159               Cpal->gradEdit->Preview->fill_gradient = CurItem->fill_gradient;
01160               Cpal->gradEdit->Preview->updateDisplay();
01161        }
01162 }
01163 
01164 void Mpalette::setDoc(ScribusDoc *d)
01165 {
01166        if(doc == d)
01167               return;
01168 
01169        disconnect(this->Cpal, SIGNAL(NewTrans(double)), 0, 0);
01170        disconnect(this->Cpal, SIGNAL(NewTransS(double)), 0, 0);
01171        disconnect(this->Cpal, SIGNAL(NewPen(QString)), 0, 0);
01172        disconnect(this->Cpal, SIGNAL(NewBrush(QString)), 0, 0);
01173        disconnect(this->Cpal, SIGNAL(NewPenShade(int)), 0, 0);
01174        disconnect(this->Cpal, SIGNAL(NewBrushShade(int)), 0, 0);
01175        disconnect(this->Cpal, SIGNAL(NewGradient(int)), 0, 0);
01176        disconnect(this->Cpal, SIGNAL(NewBlend(int)), 0, 0);
01177        disconnect(this->Cpal, SIGNAL(NewBlendS(int)), 0, 0);
01178        disconnect(this->Cpal, SIGNAL(NewPattern(QString)), 0, 0);
01179        disconnect(this->Cpal, SIGNAL(NewPatternProps(double, double, double, double, double)), 0, 0);
01180 
01181        doc = d;
01182        CurItem = NULL;
01183        Cpal->setDocument(doc);
01184        Cpal->setCurrentItem(NULL);
01185        Umrech=doc->unitRatio();
01186        double maxXYWHVal= 30000 * Umrech;
01187        double minXYVal= -30000 * Umrech;
01188        HaveDoc = true;
01189        HaveItem = false;
01190 
01191        Xpos->setValues( minXYVal, maxXYWHVal, 100, minXYVal);
01192        Ypos->setValues( minXYVal, maxXYWHVal, 100, minXYVal);
01193        Width->setValues( Umrech, maxXYWHVal, 100, Umrech);
01194        Height->setValues( Umrech, maxXYWHVal, 100, Umrech);
01195        imageXOffsetSpinBox->setValues( -30000, maxXYWHVal, 100, 0);
01196        imageYOffsetSpinBox->setValues( -30000, maxXYWHVal, 100, 0);
01197 
01198        Rot->setValues( 0, 359.99, 100, 0);
01199        RoundRect->setValues( -300, 300, 10, 0);
01200        Extra->setValues( -300, 300, 10, 0);
01201        Size->setValues( 0.5, 2048, 10, 1);
01202        LineSp->setValues( 1, 2048, 10, 1);
01203        minWordTrackingSpinBox->setValues(1, 100, 10, 100);
01204        normWordTrackingSpinBox->setValues(1, 200, 10, 100);
01205        minGlyphExtSpinBox->setValues(90, 110, 10, 100);
01206        maxGlyphExtSpinBox->setValues(90, 110, 10, 100);
01207        imageXScaleSpinBox->setValues( 1, 30000, 10, 1);
01208        imageYScaleSpinBox->setValues( 1, 30000, 10, 1);
01209        imgDpiX->setValues( 1, 30000, 10, 1);
01210        imgDpiY->setValues( 1, 30000, 10, 1);
01211 
01212        dGap->setDecimals(10);
01213        DTop->setDecimals(10);
01214        DLeft->setDecimals(10);
01215        DBottom->setDecimals(10);
01216        DRight->setDecimals(10);
01217        LSize->setMaxValue( 300 );
01218        LSize->setMinValue( 0 );
01219        Dist->setMaxValue( 30000 );
01220        Dist->setMinValue( 0 );
01221        Dist->setLineStepM(10);
01222        LineW->setMaxValue( 300 );
01223        LineW->setMinValue( -300 );
01224        LineW->setLineStepM(10);
01225 
01226        updateColorList();
01227 
01228        updateSpinBoxConstants();
01229        paraStyleCombo->setDoc(doc);
01230        charStyleCombo->setDoc(doc);
01231        SetLineFormats(doc);
01232        startArrow->rebuildList(&doc->arrowStyles);
01233        endArrow->rebuildList(&doc->arrowStyles);
01234 
01235        connect(this->Cpal, SIGNAL(NewTrans(double)), doc, SLOT(itemSelection_SetItemFillTransparency(double)));
01236        connect(this->Cpal, SIGNAL(NewTransS(double)), doc, SLOT(itemSelection_SetItemLineTransparency(double)));
01237        connect(this->Cpal, SIGNAL(NewBlend(int)), doc, SLOT(itemSelection_SetItemFillBlend(int)));
01238        connect(this->Cpal, SIGNAL(NewBlendS(int)), doc, SLOT(itemSelection_SetItemLineBlend(int)));
01239        connect(this->Cpal, SIGNAL(NewPen(QString)), doc, SLOT(ItemPen(QString)));
01240        connect(this->Cpal, SIGNAL(NewBrush(QString)), doc, SLOT(ItemBrush(QString)));
01241        connect(this->Cpal, SIGNAL(NewPenShade(int)), doc, SLOT(ItemPenShade(int)));
01242        connect(this->Cpal, SIGNAL(NewBrushShade(int)), doc, SLOT(ItemBrushShade(int)));
01243        connect(this->Cpal, SIGNAL(NewGradient(int)), doc, SLOT(ItemGradFill(int)));
01244        connect(this->Cpal, SIGNAL(NewPattern(QString)), doc, SLOT(ItemPatternFill(QString)));
01245        connect(this->Cpal, SIGNAL(NewPatternProps(double, double, double, double, double)), doc, SLOT(ItemPatternProps(double, double, double, double, double)));
01246 }
01247 
01248 void Mpalette::unsetDoc()
01249 {
01250        HaveDoc = false;
01251        HaveItem = false;
01252        doc=NULL;
01253        CurItem = NULL;
01254        Cpal->setCurrentItem(NULL);
01255        Cpal->setDocument(NULL);
01256        paraStyleCombo->setDoc(0);
01257        charStyleCombo->setDoc(0);
01258        SetLineFormats(0);
01259 }
01260 
01261 void Mpalette::unsetItem()
01262 {
01263        HaveItem=false;
01264        CurItem = NULL;
01265        Cpal->setCurrentItem(NULL);
01266        NewSel(-1);
01267 }
01268 /*
01269 void Mpalette::setCurrentItem(PageItem *i)
01270 {
01271        if (!m_ScMW || m_ScMW->ScriptRunning)
01272               return;
01273        //CB We shouldnt really need to process this if our item is the same one
01274        //maybe we do if the item has been changed by scripter.. but that should probably
01275        //set some status if so.
01276        //FIXME: This wont work until when a canvas deselect happens, CurItem must be NULL.
01277        //if (CurItem == i)
01278        //     return;
01279        disconnect(StyledLine, SIGNAL(clicked(QListBoxItem*)), this, SLOT(SetSTline(QListBoxItem*)));
01280        disconnect(NameEdit, SIGNAL(Leaved()), this, SLOT(NewName()));
01281        disconnect(startArrow, SIGNAL(activated(int)), this, SLOT(setStartArrow(int )));
01282        disconnect(endArrow, SIGNAL(activated(int)), this, SLOT(setEndArrow(int )));
01283        HaveItem = false;
01284        CurItem = i;
01285 
01286        NewSel(i->itemType());
01287        NameEdit->setText(i->itemName());
01288        setXY(i->xPos(), i->yPos());
01289        setBH(i->width(), i->height());
01290        setR(i->rotation());
01291 
01292        Revert->setOn(i->reversed());
01293        setDvals(i->textToFrameDistLeft(), i->textToFrameDistTop(), i->textToFrameDistBottom(), i->textToFrameDistRight());
01294        LevelTxt->setText(QString::number(i->ItemNr));
01295        setTextFlowMode(i->textFlowMode());
01296        RoundRect->setValue(i->cornerRadius()*Umrech); */
01297        /*
01298        disconnect(FlipH, SIGNAL(clicked()), this, SLOT(handleFlipH()));
01299        disconnect(FlipV, SIGNAL(clicked()), this, SLOT(handleFlipV()));
01300        FlipH->setOn(i->imageFlippedH());
01301        FlipV->setOn(i->imageFlippedV());
01302        connect(FlipH, SIGNAL(clicked()), this, SLOT(handleFlipH()));
01303        connect(FlipV, SIGNAL(clicked()), this, SLOT(handleFlipV()));
01304        */
01305 //     langCombo->setCurrentText(m_ScMW->LangTransl[i->doc()->Language]);
01306 /*     Cpal->setCurrentItem(CurItem);
01307        Cpal->updateFromItem(); */
01308 /*     if (TabStack->currentIndex() == idColorsItem)
01309               Cpal->setActGradient(CurItem->GrType);
01310        updateColorSpecialGradient();
01311        Cpal->gradEdit->Preview->fill_gradient = CurItem->fill_gradient;
01312        Cpal->gradEdit->Preview->updateDisplay(); */
01313 /*     if (i->FrameType == 0)
01314               SCustom->setPixmap(SCustom->getIconPixmap(0));
01315        if (i->FrameType == 1)
01316               SCustom->setPixmap(SCustom->getIconPixmap(1));
01317        if (i->FrameType > 3)
01318               SCustom->setPixmap(SCustom->getIconPixmap(i->FrameType-2));
01319        if ((i->asLine()) || (i->asPolyLine()))
01320        {
01321               startArrow->setEnabled(true);
01322               endArrow->setEnabled(true);
01323               startArrow->setCurrentItem(i->startArrowIndex());
01324               endArrow->setCurrentItem(i->endArrowIndex());
01325        }
01326        else
01327        {
01328               startArrow->setEnabled(false);
01329               endArrow->setEnabled(false);
01330        }
01331        PageItem_TextFrame* i2=i->asTextFrame();
01332        if (i2!=0)
01333        {
01334               DCol->setMaxValue(QMAX(qRound(i2->width() / QMAX(i2->ColGap, 10.0)), 1));
01335               DCol->setMinValue(1);
01336               DCol->setValue(i2->Cols);
01337               dGap->setMinValue(0);
01338 //            if (colgapLabel->getState())
01339               if (colgapLabel->currentItem() == 0)
01340               {
01341                      dGap->setMaxValue(QMAX((i2->width() / i2->Cols - i2->textToFrameDistLeft() - i2->textToFrameDistRight())*Umrech, 0));
01342                      dGap->setValue(i2->ColGap*Umrech);
01343               }
01344               else
01345               {
01346                      dGap->setMaxValue(QMAX((i2->width() / i2->Cols)*Umrech, 0));
01347                      dGap->setValue(i2->columnWidth()*Umrech);
01348               }
01349        }
01350        bool setter;
01351        if (i->NamedLStyle.isEmpty())
01352        {
01353               StyledLine->setCurrentItem(0);
01354               setter = true;
01355        }
01356        else
01357        {
01358               StyledLine->setSelected(StyledLine->findItem(i->NamedLStyle), true);
01359               setter = false;
01360        }
01361        LStyle->setEnabled(setter);
01362        LSize->setEnabled(setter);
01363        LJoinStyle->setEnabled(setter);
01364        LEndStyle->setEnabled(setter);
01365        connect(StyledLine, SIGNAL(clicked(QListBoxItem*)), this, SLOT(SetSTline(QListBoxItem*)));
01366        connect(NameEdit, SIGNAL(Leaved()), this, SLOT(NewName()));
01367        connect(startArrow, SIGNAL(activated(int)), this, SLOT(setStartArrow(int )));
01368        connect(endArrow, SIGNAL(activated(int)), this, SLOT(setEndArrow(int )));
01369        setPrintingEnabled(i->printEnabled());
01370        //CB not needed, done from pageitem->emitalltogui or individual emit.
01371        //setLocked(i->locked());
01372        //setSizeLocked(i->sizeLocked());
01373        if ((i->isTableItem) && (i->isSingleSel))
01374        {
01375               setter = true;
01376               TabStack3->raiseWidget(1);
01377               TopLine->setChecked(i->TopLine);
01378               LeftLine->setChecked(i->LeftLine);
01379               RightLine->setChecked(i->RightLine);
01380               BottomLine->setChecked(i->BottomLine);
01381               Xpos->setEnabled(false);
01382               Ypos->setEnabled(false);
01383               Rot->setEnabled(false);
01384        }
01385        else
01386               TabStack3->raiseWidget(0);
01387        LayerGroup->setEnabled(!setter);
01388        disconnect(TransSpin, SIGNAL(valueChanged(int)), this, SLOT(setGroupTransparency(int)));
01389        disconnect(blendMode, SIGNAL(activated(int)), this, SLOT(setGroupBlending(int)));
01390        if (i->isGroupControl)
01391        {
01392               TabStack->setItemEnabled(idGroupItem, true);
01393               if (i->FrameType == 0)
01394                      SCustom2->setPixmap(SCustom2->getIconPixmap(0));
01395               if (i->FrameType == 1)
01396                      SCustom2->setPixmap(SCustom2->getIconPixmap(1));
01397               if (i->FrameType > 3)
01398                      SCustom2->setPixmap(SCustom2->getIconPixmap(i->FrameType-2));
01399               TransSpin->setValue(qRound(100 - (i->fillTransparency() * 100)));
01400               blendMode->setCurrentItem(i->fillBlendmode());
01401        }
01402        else
01403               TabStack->setItemEnabled(idGroupItem, false);
01404        connect(TransSpin, SIGNAL(valueChanged(int)), this, SLOT(setGroupTransparency(int)));
01405        connect(blendMode, SIGNAL(activated(int)), this, SLOT(setGroupBlending(int))); */
01406        /*
01407        Xpos->setReadOnly(setter);
01408        Ypos->setReadOnly(setter);
01409        Rot->setReadOnly(setter);
01410        */
01411 /*     if (i->asPathText())
01412        {
01413               TabStack2->raiseWidget(1);
01414               showcurveCheckBox->setChecked(i->PoShow);
01415               LineW->setValue(i->BaseOffs * -1);
01416               Dist->setValue(i->textToFrameDistLeft());
01417        }
01418        else if (i->asPolygon())
01419        {
01420               TabStack2->raiseWidget(2);
01421               NonZero->setChecked(!i->fillRule);
01422               EvenOdd->setChecked(i->fillRule);
01423        }
01424        else
01425               TabStack2->raiseWidget(0);
01426        // Frame type 3 is obsolete: CR 2005-02-06
01427        //if (((i->itemType() == PageItem::TextFrame) || (i->itemType() == PageItem::ImageFrame) || (i->itemType() == 3)) &&  (!i->ClipEdited))
01428        if (((i->asTextFrame()) || (i->asImageFrame())) &&  (!i->ClipEdited))
01429               RoundRect->setEnabled(true);
01430        else
01431        {
01432               if ((i->asPolygon()) && ((i->FrameType == 0) || (i->FrameType == 2)))
01433                      RoundRect->setEnabled(true);
01434               else
01435                      RoundRect->setEnabled(false);
01436        }
01437        KnockOut->setChecked(!i->doOverprint);
01438        Overprint->setChecked(i->doOverprint);
01439 
01440        if ((i->itemType() == PageItem::Line) && LMode)
01441        {
01442               xposLabel->setText( tr( "&X1:" ) );
01443               widthLabel->setText( tr( "X&2:" ) );
01444               yposLabel->setText( tr( "Y&1:" ) );
01445               heightLabel->setText( tr( "&Y2:" ) );
01446               Rot->setEnabled(false);
01447        }
01448        else
01449        {
01450               xposLabel->setText( tr( "&X-Pos:" ) );
01451               widthLabel->setText( tr( "&Width:" ) );
01452               yposLabel->setText( tr( "&Y-Pos:" ) );
01453               heightLabel->setText( tr( "&Height:" ) );
01454               if ((CurItem->isTableItem) && (CurItem->isSingleSel))
01455                      Rot->setEnabled(false);
01456               else
01457                      Rot->setEnabled(true);
01458        }
01459        HaveItem = true;
01460        if (i->asLine())
01461        {
01462               keepFrameWHRatioButton->setEnabled(false);
01463               if (LMode && !i->locked())
01464                      Height->setEnabled(true);
01465               else
01466                      Height->setEnabled(false);
01467        }
01468        else
01469        {
01470               Height->setEnabled(true);
01471               keepFrameWHRatioButton->setEnabled(true);
01472               if (i->asImageFrame())
01473               {
01474                      updateCmsList();
01475                      EditEffects->setShown(i->PicAvail && i->isRaster);
01476                      EditPSDProps->setShown(i->PicAvail && i->pixm.imgInfo.valid);
01477                      setter = i->ScaleType;
01478                      FreeScale->setChecked(setter);
01479                      FrameScale->setChecked(!setter);
01480                      if (setter == true)
01481                      {
01482                             keepImageWHRatioButton->setOn(setter);
01483                             keepImageDPIRatioButton->setOn(setter);
01484                      }
01485                      Aspect->setEnabled(!setter);
01486                      Aspect->setChecked(i->AspectRatio);
01487                      imageXOffsetSpinBox->setEnabled(setter);
01488                      imageYOffsetSpinBox->setEnabled(setter);
01489                      imageXScaleSpinBox->setEnabled(setter);
01490                      imageYScaleSpinBox->setEnabled(setter);
01491                      imgDpiX->setEnabled(setter);
01492                      imgDpiY->setEnabled(setter);
01493               }
01494        }
01495        connect(StyledLine, SIGNAL(clicked(QListBoxItem*)), this, SLOT(SetSTline(QListBoxItem*)));
01496        connect(NameEdit, SIGNAL(Leaved()), this, SLOT(NewName()));
01497        connect(startArrow, SIGNAL(activated(int)), this, SLOT(setStartArrow(int )));
01498        connect(endArrow, SIGNAL(activated(int)), this, SLOT(setEndArrow(int )));
01499 }
01500 */
01501 
01502 void Mpalette::setTextFlowMode(PageItem::TextFlowMode mode)
01503 {
01504        if (!m_ScMW || m_ScMW->ScriptRunning || !HaveItem)
01505               return;
01506        if (CurItem->isGroupControl)
01507        {
01508               if (mode == PageItem::TextFlowDisabled)
01509                      textFlowDisabled2->setOn(true);
01510               else if (mode == PageItem::TextFlowUsesFrameShape)
01511                      textFlowUsesFrameShape2->setOn(true);
01512               else if (mode == PageItem::TextFlowUsesBoundingBox)
01513                      textFlowUsesBoundingBox2->setOn(true);
01514               else if (mode == PageItem::TextFlowUsesContourLine)
01515                      textFlowUsesContourLine2->setOn(true);
01516               else if (mode == PageItem::TextFlowUsesImageClipping)
01517                      textFlowUsesImageClipping2->setOn(true);
01518               if ((CurItem->asImageFrame()) && (CurItem->imageClip.size() != 0))
01519                      textFlowUsesImageClipping2->setEnabled(true);
01520               else
01521                      textFlowUsesImageClipping2->setEnabled(false);
01522        }
01523        else
01524        {
01525               if (mode == PageItem::TextFlowDisabled)
01526                      textFlowDisabled->setOn(true);
01527               else if (mode == PageItem::TextFlowUsesFrameShape)
01528                      textFlowUsesFrameShape->setOn(true);
01529               else if (mode == PageItem::TextFlowUsesBoundingBox)
01530                      textFlowUsesBoundingBox->setOn(true);
01531               else if (mode == PageItem::TextFlowUsesContourLine)
01532                      textFlowUsesContourLine->setOn(true);
01533               else if (mode == PageItem::TextFlowUsesImageClipping)
01534                      textFlowUsesImageClipping->setOn(true);
01535               if ((CurItem->asImageFrame()) && (CurItem->imageClip.size() != 0))
01536                      textFlowUsesImageClipping->setEnabled(true);
01537               else
01538                      textFlowUsesImageClipping->setEnabled(false);
01539        }
01540 }
01541 
01542 void Mpalette::SetCurItem(PageItem *i)
01543 {
01544        if (!m_ScMW || m_ScMW->ScriptRunning)
01545               return;
01546        //CB We shouldnt really need to process this if our item is the same one
01547        //maybe we do if the item has been changed by scripter.. but that should probably
01548        //set some status if so.
01549        //FIXME: This wont work until when a canvas deselect happens, CurItem must be NULL.
01550        //if (CurItem == i)
01551        //     return;
01552        disconnect(StyledLine, SIGNAL(clicked(QListBoxItem*)), this, SLOT(SetSTline(QListBoxItem*)));
01553        disconnect(NameEdit, SIGNAL(Leaved()), this, SLOT(NewName()));
01554        disconnect(startArrow, SIGNAL(activated(int)), this, SLOT(setStartArrow(int )));
01555        disconnect(endArrow, SIGNAL(activated(int)), this, SLOT(setEndArrow(int )));
01556        disconnect(TabStack, SIGNAL(currentChanged(int)), this, SLOT(SelTab(int)));
01557 
01558        HaveItem = false;
01559        CurItem = i;
01560 
01561        Cpal->setCurrentItem(CurItem);
01562        Cpal->updateFromItem();
01563 /*     if (TabStack->currentIndex() == idColorsItem)
01564               Cpal->setActGradient(CurItem->GrType);
01565        updateColorSpecialGradient();
01566        Cpal->gradEdit->Preview->fill_gradient = CurItem->fill_gradient;
01567        Cpal->gradEdit->Preview->updateDisplay(); */
01568        if (CurItem->FrameType == 0)
01569               SCustom->setPixmap(SCustom->getIconPixmap(0));
01570        if (CurItem->FrameType == 1)
01571               SCustom->setPixmap(SCustom->getIconPixmap(1));
01572        if (CurItem->FrameType > 3)
01573               SCustom->setPixmap(SCustom->getIconPixmap(CurItem->FrameType-2));
01574        if ((CurItem->asLine()) || (CurItem->asPolyLine()))
01575        {
01576               startArrow->setEnabled(true);
01577               endArrow->setEnabled(true);
01578               startArrow->setCurrentItem(CurItem->startArrowIndex());
01579               endArrow->setCurrentItem(CurItem->endArrowIndex());
01580        }
01581        else
01582        {
01583               startArrow->setEnabled(false);
01584               endArrow->setEnabled(false);
01585        }
01586        NameEdit->setText(CurItem->itemName());
01587        RoundRect->setValue(CurItem->cornerRadius()*Umrech);
01588        QString tm;
01589        LevelTxt->setText(tm.setNum(CurItem->ItemNr + 1));
01590        PageItem_TextFrame *i2=CurItem->asTextFrame();
01591        if (i2!=0)
01592        {
01593               DCol->setMaxValue(QMAX(qRound(i2->width() / QMAX(i2->ColGap, 10.0)), 1));
01594               DCol->setMinValue(1);
01595               DCol->setValue(i2->Cols);
01596               dGap->setMinValue(0);
01597 //            if (colgapLabel->getState())
01598               if (colgapLabel->currentItem() == 0)
01599               {
01600                      dGap->setMaxValue(QMAX((i2->width() / i2->Cols - i2->textToFrameDistLeft() - i2->textToFrameDistRight())*Umrech, 0));
01601                      dGap->setValue(i2->ColGap*Umrech);
01602               }
01603               else
01604               {
01605                      dGap->setMaxValue(QMAX((i2->width() / i2->Cols)*Umrech, 0));
01606                      dGap->setValue(i2->columnWidth()*Umrech);
01607               }
01608               DLeft->setValue(i2->textToFrameDistLeft()*Umrech);
01609               DTop->setValue(i2->textToFrameDistTop()*Umrech);
01610               DBottom->setValue(i2->textToFrameDistBottom()*Umrech);
01611               DRight->setValue(i2->textToFrameDistRight()*Umrech);
01612        }
01613        Revert->setOn(CurItem->reversed());
01614        setTextFlowMode(CurItem->textFlowMode());
01615        /*
01616        disconnect(FlipH, SIGNAL(clicked()), this, SLOT(handleFlipH()));
01617        disconnect(FlipV, SIGNAL(clicked()), this, SLOT(handleFlipV()));
01618        FlipH->setOn(i->imageFlippedH());
01619        FlipV->setOn(i->imageFlippedV());
01620        connect(FlipH, SIGNAL(clicked()), this, SLOT(handleFlipH()));
01621        connect(FlipV, SIGNAL(clicked()), this, SLOT(handleFlipV()));
01622        */
01623 //     langCombo->setCurrentText(m_ScMW->LangTransl[i->doc()->Language]);
01624        bool setter;
01625        if (CurItem->NamedLStyle.isEmpty())
01626        {
01627               StyledLine->setCurrentItem(0);
01628               setter = true;
01629        }
01630        else
01631        {
01632               StyledLine->setCurrentItem(0);
01633               StyledLine->setSelected(StyledLine->findItem(CurItem->NamedLStyle), true);
01634               setter = false;
01635        }
01636        LStyle->setEnabled(setter);
01637        LSize->setEnabled(setter);
01638        LJoinStyle->setEnabled(setter);
01639        LEndStyle->setEnabled(setter);
01640        connect(StyledLine, SIGNAL(clicked(QListBoxItem*)), this, SLOT(SetSTline(QListBoxItem*)));
01641        connect(NameEdit, SIGNAL(Leaved()), this, SLOT(NewName()));
01642        connect(startArrow, SIGNAL(activated(int)), this, SLOT(setStartArrow(int )));
01643        connect(endArrow, SIGNAL(activated(int)), this, SLOT(setEndArrow(int )));
01644        //CB not needed, done from pageitem->emitalltogui or individual emit.
01645        //NoPrint->setOn(!i->printEnabled());
01646        //setLocked(i->locked());
01647        //setSizeLocked(i->sizeLocked());
01648        if ((CurItem->isTableItem) && (CurItem->isSingleSel))
01649        {
01650               setter = true;
01651               TabStack3->raiseWidget(1);
01652               TopLine->setChecked(CurItem->TopLine);
01653               LeftLine->setChecked(CurItem->LeftLine);
01654               RightLine->setChecked(CurItem->RightLine);
01655               BottomLine->setChecked(CurItem->BottomLine);
01656               Xpos->setEnabled(false);
01657               Ypos->setEnabled(false);
01658               Rot->setEnabled(false);
01659        }
01660        else
01661        {
01662               setter = false;
01663               TabStack3->raiseWidget(0);
01664        }
01665        LayerGroup->setEnabled(!setter);
01666        disconnect(TransSpin, SIGNAL(valueChanged(int)), this, SLOT(setGroupTransparency(int)));
01667        disconnect(blendMode, SIGNAL(activated(int)), this, SLOT(setGroupBlending(int)));
01668        if (CurItem->isGroupControl)
01669        {
01670               TabStack->setItemEnabled(idXYZItem, true);
01671               TabStack->setItemEnabled(idShapeItem, false);
01672               TabStack->setItemEnabled(idGroupItem, true);
01673               TabStack->setItemEnabled(idLineItem, false);
01674               TabStack->setItemEnabled(idColorsItem, false);
01675               TabStack->setItemEnabled(idTextItem, false);
01676               TabStack->setItemEnabled(idImageItem, false);
01677               if (CurItem->FrameType == 0)
01678                      SCustom2->setPixmap(SCustom2->getIconPixmap(0));
01679               if (CurItem->FrameType == 1)
01680                      SCustom2->setPixmap(SCustom2->getIconPixmap(1));
01681               if (CurItem->FrameType > 3)
01682                      SCustom2->setPixmap(SCustom2->getIconPixmap(CurItem->FrameType-2));
01683               TransSpin->setValue(qRound(100 - (CurItem->fillTransparency() * 100)));
01684               blendMode->setCurrentItem(CurItem->fillBlendmode());
01685        }
01686        else
01687               TabStack->setItemEnabled(idGroupItem, false);
01688        connect(TransSpin, SIGNAL(valueChanged(int)), this, SLOT(setGroupTransparency(int)));
01689        connect(blendMode, SIGNAL(activated(int)), this, SLOT(setGroupBlending(int)));
01690        /*
01691        Xpos->setReadOnly(setter);
01692        Ypos->setReadOnly(setter);
01693        Rot->setReadOnly(setter);
01694        */
01695        if (CurItem->asPathText())
01696        {
01697               TabStack2->raiseWidget(1);
01698               pathTextType->setCurrentItem(CurItem->textPathType);
01699               flippedPathText->setChecked(CurItem->textPathFlipped);
01700               showcurveCheckBox->setChecked(CurItem->PoShow);
01701               LineW->setValue(CurItem->BaseOffs * -1);
01702               Dist->setValue(CurItem->textToFrameDistLeft());
01703        }
01704        else if (CurItem->asPolygon())
01705        {
01706               TabStack2->raiseWidget(2);
01707               NonZero->setChecked(!CurItem->fillRule);
01708               EvenOdd->setChecked(CurItem->fillRule);
01709        }
01710        else
01711               TabStack2->raiseWidget(0);
01712        // Frame type 3 is obsolete: CR 2005-02-06
01713        //if (((i->itemType() == PageItem::TextFrame) || (i->itemType() == PageItem::ImageFrame) || (i->itemType() == 3)) &&  (!i->ClipEdited))
01714        if (((CurItem->asTextFrame()) || (CurItem->asImageFrame())) &&  (!CurItem->ClipEdited) && ((CurItem->FrameType == 0) || (CurItem->FrameType == 2)))
01715               RoundRect->setEnabled(true);
01716        else
01717        {
01718               if ((CurItem->asPolygon()) &&  (!CurItem->ClipEdited)  && ((CurItem->FrameType == 0) || (CurItem->FrameType == 2)))
01719                      RoundRect->setEnabled(true);
01720               else
01721                      RoundRect->setEnabled(false);
01722        }
01723        KnockOut->setChecked(!CurItem->doOverprint);
01724        Overprint->setChecked(CurItem->doOverprint);
01725        if ((CurItem->itemType() == PageItem::Line) && LMode)
01726        {
01727               xposLabel->setText( tr( "&X1:" ) );
01728               widthLabel->setText( tr( "X&2:" ) );
01729               yposLabel->setText( tr( "Y&1:" ) );
01730               heightLabel->setText( tr( "&Y2:" ) );
01731               Rot->setEnabled(false);
01732        }
01733        else
01734        {
01735               xposLabel->setText( tr( "&X-Pos:" ) );
01736               widthLabel->setText( tr( "&Width:" ) );
01737               yposLabel->setText( tr( "&Y-Pos:" ) );
01738               heightLabel->setText( tr( "&Height:" ) );
01739               if ((CurItem->isTableItem) && (CurItem->isSingleSel))
01740                      Rot->setEnabled(false);
01741               else
01742                      Rot->setEnabled(true);
01743        }
01744        HaveItem = true;
01745        if (CurItem->asLine())
01746        {
01747               keepFrameWHRatioButton->setEnabled(false);
01748               if (LMode && !CurItem->locked())
01749                      Height->setEnabled(true);
01750               else
01751                      Height->setEnabled(false);
01752        }
01753        else
01754        {
01755               Height->setEnabled(true);
01756               keepFrameWHRatioButton->setEnabled(true);
01757               if (CurItem->asImageFrame())
01758               {
01759                      updateCmsList();
01760                      EditEffects->setShown(CurItem->PicAvail && CurItem->isRaster);
01761                      EditPSDProps->setShown(CurItem->PicAvail && CurItem->pixm.imgInfo.valid);
01762                      setter = CurItem->ScaleType;
01763                      FreeScale->setChecked(setter);
01764                      FrameScale->setChecked(!setter);
01765 //CB Why do we need this? Setting it too much here
01766 //                   if (setter == true)
01767 //                   {
01768 //                          keepImageWHRatioButton->setOn(setter);
01769 //                          keepImageDPIRatioButton->setOn(setter);
01770 //                   }
01771                      Aspect->setEnabled(!setter);
01772                      Aspect->setChecked(CurItem->AspectRatio);
01773                      imageXOffsetSpinBox->setEnabled(setter);
01774                      imageYOffsetSpinBox->setEnabled(setter);
01775                      imageXScaleSpinBox->setEnabled(setter);
01776                      imageYScaleSpinBox->setEnabled(setter);
01777                      imgDpiX->setEnabled(setter);
01778                      imgDpiY->setEnabled(setter);
01779               }
01780        }
01781        setXY(CurItem->xPos(), CurItem->yPos());
01782 
01783        DoGroup->setEnabled(false);
01784        DoUnGroup->setEnabled(false);
01785        if (doc->m_Selection->count() > 1)
01786        {
01787               bool isGroup = true;
01788               int firstElem = -1;
01789               if (CurItem->Groups.count() != 0)
01790                      firstElem = CurItem->Groups.top();
01791               for (uint bx = 0; bx < doc->m_Selection->count(); ++bx)
01792               {
01793                      if (doc->m_Selection->itemAt(bx)->Groups.count() != 0)
01794                      {
01795                             if (doc->m_Selection->itemAt(bx)->Groups.top() != firstElem)
01796                                    isGroup = false;
01797                      }
01798                      else
01799                             isGroup = false;
01800               }
01801               if (!isGroup)
01802                      DoGroup->setEnabled(true);
01803               else
01804               {
01805                      if (CurItem->isGroupControl)
01806                             NameEdit->setEnabled(true);
01807               }
01808               if (CurItem->Groups.count() != 0)
01809                      DoUnGroup->setEnabled(true);
01810        }
01811        updateSpinBoxConstants();
01812 }
01813 
01814 void Mpalette::NewSel(int nr)
01815 {
01816        if (!HaveDoc || !m_ScMW || m_ScMW->ScriptRunning)
01817               return;
01818        int visID;
01819        PageItem *i=0;
01820        disconnect(TabStack, SIGNAL(currentChanged(int)), this, SLOT(SelTab(int)));
01821        if (doc->m_Selection->count()>1)
01822        {
01823               RoVal = 0;
01824               double gx, gy, gh, gw;
01825               doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
01826               if (TopLeft->isChecked())
01827                      m_ScMW->view->RCenter = FPoint(gx, gy);
01828               if (TopRight->isChecked())
01829                      m_ScMW->view->RCenter = FPoint(gx + gw, gy);
01830               if (Center->isChecked())
01831                      m_ScMW->view->RCenter = FPoint(gx + gw / 2.0, gy + gh / 2.0);
01832               if (BottomLeft->isChecked())
01833                      m_ScMW->view->RCenter = FPoint(gx, gy + gh);
01834               if (BottomRight->isChecked())
01835                      m_ScMW->view->RCenter = FPoint(gx + gw, gy + gh);
01836               xposLabel->setText( tr( "&X-Pos:" ) );
01837               widthLabel->setText( tr( "&Width:" ) );
01838               yposLabel->setText( tr( "&Y-Pos:" ) );
01839               heightLabel->setText( tr( "&Height:" ) );
01840               HaveItem = false;
01841               Xpos->setValue(0);
01842               Ypos->setValue(0);
01843               Width->setValue(0);
01844               Height->setValue(0);
01845               Rot->setValue(0);
01846               RoundRect->setValue(0);
01847               HaveItem = true;
01848               Xpos->setEnabled(true);
01849               Ypos->setEnabled(true);
01850               Width->setEnabled(true);
01851               Height->setEnabled(true);
01852               Rot->setEnabled(true);
01853 //            TabStack->setCurrentIndex(0);
01854               TabStack->item(0)->setEnabled(true);
01855               TabStack->setItemEnabled(idXYZItem, true);
01856               NameEdit->setEnabled(false);
01857               TabStack->setItemEnabled(idLineItem, true);
01858               TabStack->setItemEnabled(idColorsItem, true);
01859               FlipH->setToggleButton( false );
01860               FlipV->setToggleButton( false );
01861               FlipH->setOn(false);
01862               FlipV->setOn(false);
01863        }
01864        else
01865        {
01866               if (nr!=-1)
01867               {
01868                      i=doc->m_Selection->itemAt(0);
01869                      HaveItem=true;
01870                      EditShape->setEnabled(!i->locked());
01871                      ShapeGroup->setEnabled(nr!=5 && nr!=7 && nr!=8 && !i->locked());
01872               }
01873               else
01874               {
01875                      DoGroup->setEnabled(false);
01876                      DoUnGroup->setEnabled(false);
01877                      EditShape->setEnabled(false);
01878                      ShapeGroup->setEnabled(false);
01879               }
01880               NameEdit->setEnabled(true);
01881 //            ShapeGroup->setEnabled(false);
01882 //            RoundRect->setEnabled(false);
01883               Distance->setEnabled(false);
01884               LineMode->setEnabled(false);
01885               TopLeft->setEnabled(true);
01886               TopRight->setEnabled(true);
01887               BottomLeft->setEnabled(true);
01888               BottomRight->setEnabled(true);
01889               Center->setEnabled(true);
01890               visID = TabStack->currentIndex ();
01891               TabStack->item(0)->setEnabled(true);
01892               TabStack->setItemEnabled(idXYZItem, true);
01893               TabStack->setItemEnabled(idColorsItem, true);
01894               /*
01895               disconnect(FlipH, SIGNAL(clicked()), this, SLOT(handleFlipH()));
01896               disconnect(FlipV, SIGNAL(clicked()), this, SLOT(handleFlipV()));
01897               FlipH->setOn(false);
01898               FlipV->setOn(false);
01899               connect(FlipH, SIGNAL(clicked()), this, SLOT(handleFlipH()));
01900               connect(FlipV, SIGNAL(clicked()), this, SLOT(handleFlipV()));
01901               */
01902               
01903               //CB If Toggle is not possible, then we need to enable it so we can turn it off
01904               //It then gets reset below for items where its valid
01905               if ((nr>4) && (nr<9))
01906               {
01907                      FlipH->setToggleButton(true);
01908                      FlipV->setToggleButton(true);
01909                      FlipH->setOn(false);
01910                      FlipV->setOn(false);
01911               }
01912               FlipH->setToggleButton((nr>=0) && (nr<5));
01913               FlipV->setToggleButton((nr>=0) && (nr<5));
01914               //CB Why cant we do this for lines?
01915 //            FlipH->setEnabled((nr!=-1) && (nr!=5));
01916 //            FlipV->setEnabled((nr!=-1) && (nr!=5));
01917               FlipH->setEnabled(nr!=-1);
01918               FlipV->setEnabled(nr!=-1);
01919               switch (nr)
01920               {
01921               case -1:
01922                      xposLabel->setText( tr( "&X-Pos:" ) );
01923                      widthLabel->setText( tr( "&Width:" ) );
01924                      yposLabel->setText( tr( "&Y-Pos:" ) );
01925                      heightLabel->setText( tr( "&Height:" ) );
01926                      //Rot->setEnabled(true);
01927                      //Height->setEnabled(true);
01928                      RoundRect->setEnabled(false);
01929                      HaveItem = false;
01930                      Xpos->setValue(0);
01931                      Ypos->setValue(0);
01932                      Width->setValue(0);
01933                      Height->setValue(0);
01934                      Rot->setValue(0);
01935                      RoundRect->setValue(0);
01936                      for (int ws = 1; ws < 7; ++ws)
01937                             TabStack->setItemEnabled(ws, false);
01938 //                   TabStack->setCurrentIndex(0);
01939                      TabStack->item(0)->setEnabled(false);
01940                      TabStack->setItemEnabled(idXYZItem, false);
01941                      Cpal->ChooseGrad(0);
01942                      break;
01943               case 2:
01944                      TabStack->setItemEnabled(idShapeItem, true);
01945                      TabStack->setItemEnabled(idTextItem, false);
01946                      TabStack->setItemEnabled(idImageItem, true);
01947                      TabStack->setItemEnabled(idLineItem, true);
01948                      if ((!i->ClipEdited) && ((i->FrameType == 0) || (i->FrameType == 2)))
01949                             RoundRect->setEnabled(!i->locked());
01950                      else
01951                             RoundRect->setEnabled(false);
01952                      if ((doc->m_Selection->itemAt(0)->FrameType == 0) || (doc->m_Selection->itemAt(0)->FrameType == 2))
01953                             RoundRect->setEnabled(!i->locked());
01954 //                   if (visID == 2)
01955 //                          TabStack->setCurrentIndex(0);
01956                      break;
01957               case 4:
01958                      TabStack->setItemEnabled(idShapeItem, true);
01959                      TabStack->setItemEnabled(idTextItem, true);
01960                      TabStack->setItemEnabled(idImageItem, false);
01961                      TabStack->setItemEnabled(idLineItem, true);
01962                      if ((!i->ClipEdited) && ((i->FrameType == 0) || (i->FrameType == 2)))
01963                             RoundRect->setEnabled(!i->locked());
01964                      else
01965                             RoundRect->setEnabled(false);
01966                      Distance->setEnabled(true);
01967 //                   if (visID == 3)
01968 //                          TabStack->setCurrentIndex(0);
01969                      break;
01970               case 5:
01971                      TabStack->setItemEnabled(idShapeItem, false);
01972                      TabStack->setItemEnabled(idTextItem, false);
01973                      TabStack->setItemEnabled(idImageItem, false);
01974                      TabStack->setItemEnabled(idLineItem, true);
01975                      RoundRect->setEnabled(false);
01976                      LineMode->setEnabled(true);
01977                      TopLeft->setEnabled(false);
01978                      TopRight->setEnabled(false);
01979                      BottomLeft->setEnabled(false);
01980                      BottomRight->setEnabled(false);
01981                      Center->setEnabled(false);
01982 //                   if ((visID == 1) || (visID == 2) || (visID == 3))
01983 //                          TabStack->setCurrentIndex(0);
01984                      break;
01985               case 1:
01986               case 3:
01987               case 6:
01988                      TabStack->setItemEnabled(idShapeItem, true);
01989                      TabStack->setItemEnabled(idTextItem, false);
01990                      TabStack->setItemEnabled(idImageItem, false);
01991                      TabStack->setItemEnabled(idLineItem, true);
01992                      if ((!i->ClipEdited) && ((i->FrameType == 0) || (i->FrameType == 2)))
01993                             RoundRect->setEnabled(!i->locked());
01994                      else
01995                             RoundRect->setEnabled(false);
01996 //                   if ((visID == 2) || (visID == 3))
01997 //                          TabStack->setCurrentIndex(0);
01998                      break;
01999               case 7:
02000                      TabStack->setItemEnabled(idShapeItem, true);
02001                      TabStack->setItemEnabled(idTextItem, false);
02002                      TabStack->setItemEnabled(idImageItem, false);
02003                      TabStack->setItemEnabled(idLineItem, true);
02004                      RoundRect->setEnabled(false);
02005 //                   if ((visID == 2) || (visID == 3))
02006 //                          TabStack->setCurrentIndex(0);
02007                      break;
02008               case 8:
02009                      TabStack->setItemEnabled(idShapeItem, true);
02010                      TabStack->setItemEnabled(idTextItem, true);
02011                      TabStack->setItemEnabled(idImageItem, false);
02012                      TabStack->setItemEnabled(idLineItem, true);
02013                      RoundRect->setEnabled(false);
02014 //                   if (visID == 3)
02015 //                          TabStack->setCurrentIndex(0);
02016                      break;
02017               }
02018        }
02019        updateGeometry();
02020 //     setFocus();
02021        repaint();
02022        connect(TabStack, SIGNAL(currentChanged(int)), this, SLOT(SelTab(int)));
02023 }
02024 
02025 void Mpalette::setMultipleSelection(bool isMultiple)
02026 {
02027        //CB Having added the selection and undo transaction to mirrorpolyh/v in doc,
02028        //these can be enabled all the time
02029        FlipH->setEnabled(true);
02030        FlipV->setEnabled(true);
02031        NameEdit->setEnabled(!isMultiple);
02032        if (doc->m_Selection->count() > 1)
02033        {
02034               FlipH->setToggleButton( false );
02035               FlipV->setToggleButton( false );
02036               PageItem *i;
02037               uint lowestItem = 999999;
02038               for (uint a=0; a<doc->m_Selection->count(); ++a)
02039               {
02040                      i = doc->m_Selection->itemAt(a);
02041                      lowestItem = QMIN(lowestItem, i->ItemNr);
02042               }
02043               i = doc->Items->at(lowestItem);
02044               SetCurItem(i);
02045        }
02046 }
02047 
02048 void Mpalette::unitChange()
02049 {
02050        double oldRatio = Umrech;
02051        Umrech = doc->unitRatio();
02052        bool tmp = HaveItem;
02053        HaveItem = false;
02054        double maxXYWHVal=30000 * Umrech;
02055        double minXYVal=-30000 * Umrech;
02056 
02057        double ratioDivisor = Umrech / oldRatio;
02058        double newX = Xpos->value() * ratioDivisor;
02059        double newY = Ypos->value() * ratioDivisor;
02060        double newW = Width->value() * ratioDivisor;
02061        double newH = Height->value() * ratioDivisor;
02062        double newLX = imageXOffsetSpinBox->value() * ratioDivisor;
02063        double newLY = imageYOffsetSpinBox->value() * ratioDivisor;
02064        double newG = dGap->value() * ratioDivisor;
02065        double newGM = dGap->maxValue() * ratioDivisor;
02066        double newDT = DTop->value() * ratioDivisor;
02067        double newDL = DLeft->value() * ratioDivisor;
02068        double newDB = DBottom->value() * ratioDivisor;
02069        double newDR = DRight->value() * ratioDivisor;
02070        double newRR = RoundRect->value() * ratioDivisor;
02071        double newRM = RoundRect->maxValue() * ratioDivisor;
02072        double newLZ = LSize->value() * ratioDivisor;
02073 
02074        if (doc->unitIndex() > unitGetMaxIndex())
02075               doc->setUnitIndex(0);
02076        QString ein = unitGetSuffixFromIndex(doc->unitIndex());
02077 
02078        Xpos->setSuffix( ein );
02079        Ypos->setSuffix( ein );
02080        Width->setSuffix( ein );
02081        Height->setSuffix( ein );
02082        imageXOffsetSpinBox->setSuffix( ein );
02083        imageYOffsetSpinBox->setSuffix( ein );
02084        dGap->setSuffix( ein );
02085        DLeft->setSuffix( ein );
02086        DTop->setSuffix( ein );
02087        DBottom->setSuffix( ein );
02088        DRight->setSuffix( ein );
02089        RoundRect->setSuffix( ein );
02090        LSize->setSuffix( ein );
02091        LSize->setValue(newLZ);
02092 
02093        int decimals = unitGetDecimalsFromIndex(doc->unitIndex());
02094 
02095        Xpos->setValues( minXYVal, maxXYWHVal, decimals, newX );
02096        Ypos->setValues( minXYVal, maxXYWHVal, decimals, newY );
02097        Width->setValues( Umrech, maxXYWHVal, decimals, newW );
02098        Height->setValues( Umrech, maxXYWHVal, decimals, newH );
02099 
02100        imageXOffsetSpinBox->setDecimals(decimals);
02101        imageXOffsetSpinBox->setMaxValue( maxXYWHVal );
02102        imageXOffsetSpinBox->setValue(newLX);
02103 
02104        imageYOffsetSpinBox->setDecimals(decimals);
02105        imageYOffsetSpinBox->setMaxValue( maxXYWHVal );
02106        imageYOffsetSpinBox->setValue(newLY);
02107 
02108        dGap->setDecimals(decimals);
02109        dGap->setMaxValue(newGM);
02110        dGap->setValue(newG);
02111 
02112        DLeft->setDecimals(decimals);
02113        DLeft->setMaxValue( 300 );
02114        DLeft->setValue(newDL);
02115 
02116        DTop->setDecimals(decimals);
02117        DTop->setMaxValue( 300 );
02118        DTop->setValue(newDT);
02119 
02120        DBottom->setDecimals(decimals);
02121        DBottom->setMaxValue( 300 );
02122        DBottom->setValue(newDB);
02123 
02124        DRight->setDecimals(decimals);
02125        DRight->setMaxValue( 300 );
02126        DRight->setValue(newDR);
02127 
02128        RoundRect->setValues(-newRM, newRM, decimals, newRR);
02129        Cpal->unitChange(oldRatio, Umrech, doc->unitIndex());
02130        HaveItem = tmp;
02131 }
02132 
02133 void Mpalette::setLevel(uint l)
02134 {
02135        QString tm;
02136        LevelTxt->setText(tm.setNum(l + 1));
02137 }
02138 
02139 void Mpalette::setXY(double x, double y)
02140 {
02141        if (!m_ScMW || m_ScMW->ScriptRunning)
02142               return;
02143        disconnect(Xpos, SIGNAL(valueChanged(int)), this, SLOT(NewX()));
02144        disconnect(Ypos, SIGNAL(valueChanged(int)), this, SLOT(NewY()));
02145        bool tmp = HaveItem;
02146        double inX, inY, b, h, r, dummy1, dummy2;
02147        QWMatrix ma;
02148        FPoint n;
02149        if (HaveItem)
02150        {
02151               if (doc->m_Selection->isMultipleSelection())
02152               {
02153                      doc->m_Selection->getGroupRect(&dummy1, &dummy2, &b, &h);
02154                      r = 0.0;
02155               }
02156               else
02157               {
02158                      b = CurItem->width();
02159                      h = CurItem->height();
02160                      r = CurItem->rotation();
02161               }
02162        }
02163        else
02164        {
02165               b = 0.0;
02166               h = 0.0;
02167               r = 0.0;
02168        }
02169        HaveItem = false;
02170        ma.translate(x, y);
02171        ma.rotate(r);
02172        if (TopLeft->isChecked())
02173               n = FPoint(0.0, 0.0);
02174        if (TopRight->isChecked())
02175               n = FPoint(b, 0.0);
02176        if (Center->isChecked())
02177               n = FPoint(b / 2.0, h / 2.0);
02178        if (BottomLeft->isChecked())
02179               n = FPoint(0.0, h);
02180        if (BottomRight->isChecked())
02181               n = FPoint(b, h);
02182        inX = ma.m11() * n.x() + ma.m21() * n.y() + ma.dx();
02183        inY = ma.m22() * n.y() + ma.m12() * n.x() + ma.dy();
02184        if (tmp)
02185        {
02186               inX -= doc->rulerXoffset;
02187               inY -= doc->rulerYoffset;
02188               if (doc->guidesSettings.rulerMode)
02189               {
02190                      inX -= doc->currentPage()->xOffset();
02191                      inY -= doc->currentPage()->yOffset();
02192               }
02193        }
02194        Xpos->setValue(inX*Umrech);
02195        Ypos->setValue(inY*Umrech);
02196        if ((LMode) && (tmp))
02197               setBH(CurItem->width(), CurItem->height());
02198        HaveItem = tmp;
02199        connect(Xpos, SIGNAL(valueChanged(int)), this, SLOT(NewX()));
02200        connect(Ypos, SIGNAL(valueChanged(int)), this, SLOT(NewY()));
02201 }
02202 
02203 void Mpalette::setBH(double x, double y)
02204 {
02205        if (!m_ScMW || m_ScMW->ScriptRunning)
02206               return;
02207        bool tmp = HaveItem;
02208        HaveItem = false;
02209        QWMatrix ma;
02210        QPoint dp;
02211        if ((LMode) && (CurItem->asLine()))
02212        {
02213               ma.translate(static_cast<double>(Xpos->value()) / Umrech, static_cast<double>(Ypos->value()) / Umrech);
02214               ma.rotate(static_cast<double>(Rot->value())*(-1));
02215               dp = ma * QPoint(static_cast<int>(x), static_cast<int>(y));
02216               Width->setValue(dp.x()*Umrech);
02217               Height->setValue(dp.y()*Umrech);
02218        }
02219        else
02220        {
02221               RoundRect->setMaxValue(QMIN(x, y)/2*Umrech);
02222               RoundRect->setMinValue(-QMIN(x, y)/2*Umrech);
02223               Width->setValue(x*Umrech);
02224               Height->setValue(y*Umrech);
02225        }
02226        HaveItem = tmp;
02227 }
02228 
02229 void Mpalette::setR(double r)
02230 {
02231        if (!m_ScMW || m_ScMW->ScriptRunning)
02232               return;
02233        bool tmp = HaveItem;
02234        double rr = r;
02235        if (r > 0)
02236               rr = 360 - rr;
02237        HaveItem = false;
02238        Rot->setValue(fabs(rr));
02239        HaveItem = tmp;
02240 }
02241 
02242 void Mpalette::setRR(double r)
02243 {
02244        if (!m_ScMW || m_ScMW->ScriptRunning)
02245               return;
02246        bool tmp = HaveItem;
02247        HaveItem = false;
02248        RoundRect->setValue(r*Umrech);
02249        HaveItem = tmp;
02250 }
02251 
02252 void Mpalette::setCols(int r, double g)
02253 {
02254        if (!m_ScMW || m_ScMW->ScriptRunning)
02255               return;
02256        bool tmp = HaveItem;
02257        HaveItem = false;
02258        DCol->setValue(r);
02259        dGap->setValue(g*Umrech);
02260        if (tmp)
02261        {
02262               PageItem_TextFrame *i2=CurItem->asTextFrame();
02263               if (i2!=0)
02264               {
02265                      DCol->setMaxValue(QMAX(qRound(i2->width() / QMAX(i2->ColGap, 10.0)), 1));
02266 //                   if (colgapLabel->getState())
02267                      if (colgapLabel->currentItem() == 0)
02268                      {
02269                             dGap->setMaxValue(QMAX((i2->width() / i2->Cols - i2->textToFrameDistLeft() - i2->textToFrameDistRight())*Umrech, 0));
02270                             dGap->setValue(i2->ColGap*Umrech);
02271                      }
02272                      else
02273                      {
02274                             dGap->setMaxValue(QMAX((i2->width() / i2->Cols)*Umrech, 0));
02275                             dGap->setValue(i2->columnWidth()*Umrech);
02276                      }
02277               }
02278        }
02279        DCol->setMinValue(1);
02280        dGap->setMinValue(0);
02281        HaveItem = tmp;
02282 }
02283 
02284 // NewLspMode?
02285 void Mpalette::setLspMode(int id)
02286 {
02287        if ((HaveDoc) && (HaveItem))
02288        {
02289               doc->itemSelection_SetLineSpacingMode(lineSpacingPop->indexOf(id));
02290               updateStyle(doc->appMode == modeEdit? CurItem->currentStyle() : CurItem->itemText.defaultStyle());
02291        }
02292 }
02293 
02294 void Mpalette::setLsp(double r)
02295 {
02296        if (!m_ScMW || m_ScMW->ScriptRunning)
02297               return;
02298        bool tmp = HaveItem;
02299        HaveItem = false;
02300        LineSp->setValue(r);
02301        const ParagraphStyle& curStyle(tmp && doc->appMode == modeEdit? CurItem->currentStyle() : CurItem->itemText.defaultStyle());
02302        if (tmp)
02303        {
02304               if (curStyle.lineSpacingMode() > 0)
02305               {
02306                      LineSp->setSpecialValueText( tr( "Auto" ) );
02307                      LineSp->setMinValue(0);
02308                      LineSp->setValue(0);
02309                      LineSp->setEnabled(false);
02310               }
02311               else
02312               {
02313                      LineSp->setEnabled(true);
02314                      LineSp->setSpecialValueText("");
02315                      LineSp->setMinValue(1);
02316                      LineSp->setValue(r);
02317               }
02318               for (uint al = 0; al < lineSpacingPop->count(); ++al)
02319               {
02320                      lineSpacingPop->setItemChecked(lineSpacingPop->idAt(al), false);
02321               }
02322               lineSpacingPop->setItemChecked(lineSpacingPop->idAt(curStyle.lineSpacingMode()), true);
02323        }
02324        HaveItem = tmp;
02325 }
02326 
02327 void Mpalette::setDvals(double left, double top, double bottom, double right)
02328 {
02329        if (!m_ScMW || m_ScMW->ScriptRunning)
02330               return;
02331        bool tmp = HaveItem;
02332        HaveItem = false;
02333        DLeft->setValue(left*Umrech);
02334        DTop->setValue(top*Umrech);
02335        DBottom->setValue(bottom*Umrech);
02336        DRight->setValue(right*Umrech);
02337        HaveItem = tmp;
02338 }
02339 
02340 void Mpalette::setFontFace(const QString& newFont)
02341 {
02342        if (!m_ScMW || m_ScMW->ScriptRunning)
02343               return;
02344        bool tmp = HaveItem;
02345        HaveItem = false;
02346        if (CurItem != NULL)
02347               Fonts->RebuildList(doc, CurItem->isAnnotation());
02348        Fonts->setCurrentFont(newFont);
02349        HaveItem = tmp;
02350 }
02351 
02352 
02353 void Mpalette::setSize(int s)
02354 {
02355        if (!m_ScMW || m_ScMW->ScriptRunning)
02356               return;
02357        bool tmp = HaveItem;
02358        HaveItem = false;
02359        Size->setValue(s / 10.0);
02360        HaveItem = tmp;
02361 }
02362 
02363 void Mpalette::setExtra(int e)
02364 {
02365        if (!m_ScMW || m_ScMW->ScriptRunning)
02366               return;
02367        bool tmp = HaveItem;
02368        HaveItem = false;
02369        Extra->setValue(e / 10.0);
02370        HaveItem = tmp;
02371 }
02372 
02373 void Mpalette::ChangeScaling()
02374 {
02375        if (!m_ScMW || m_ScMW->ScriptRunning)
02376               return;
02377        if (FreeScale == sender())
02378        {
02379               FrameScale->setChecked(false);
02380               FreeScale->setChecked(true);
02381               Aspect->setEnabled(false);
02382               imageXOffsetSpinBox->setEnabled(true);
02383               imageYOffsetSpinBox->setEnabled(true);
02384               imageXScaleSpinBox->setEnabled(true);
02385               imageYScaleSpinBox->setEnabled(true);
02386               imgDpiX->setEnabled(true);
02387               imgDpiY->setEnabled(true);
02388        }
02389        if (FrameScale == sender())
02390        {
02391               FrameScale->setChecked(true);
02392               FreeScale->setChecked(false);
02393               Aspect->setEnabled(true);
02394               imageXOffsetSpinBox->setEnabled(false);
02395               imageYOffsetSpinBox->setEnabled(false);
02396               imageXScaleSpinBox->setEnabled(false);
02397               imageYScaleSpinBox->setEnabled(false);
02398               imgDpiX->setEnabled(false);
02399               imgDpiY->setEnabled(false);
02400        }
02401        if ((HaveDoc) && (HaveItem))
02402        {
02403               CurItem->setImageScalingMode(FreeScale->isChecked(), Aspect->isChecked());
02404               emit UpdtGui(PageItem::ImageFrame);
02405               emit DocChanged();
02406 //            setFocus();
02407        }
02408 }
02409 
02410 void Mpalette::setLvalue(double scx, double scy, double x, double y)
02411 {
02412        if (!m_ScMW || m_ScMW->ScriptRunning)
02413               return;
02414        bool tmp = HaveItem;
02415        HaveItem = false;
02416        if (tmp)
02417        {
02418               imageXOffsetSpinBox->setValue(x * Umrech * CurItem->imageXScale());
02419               imageYOffsetSpinBox->setValue(y * Umrech * CurItem->imageYScale());
02420               imageXScaleSpinBox->setValue(scx * 100 / 72.0 * CurItem->pixm.imgInfo.xres);
02421               imageYScaleSpinBox->setValue(scy * 100 / 72.0 * CurItem->pixm.imgInfo.yres);
02422               imgDpiX->setValue(qRound(720.0 / CurItem->imageXScale()) / 10.0);
02423               imgDpiY->setValue(qRound(720.0 / CurItem->imageYScale()) / 10.0);
02424        }
02425        else
02426        {
02427               imageXOffsetSpinBox->setValue(x * Umrech);
02428               imageYOffsetSpinBox->setValue(y * Umrech);
02429               imageXScaleSpinBox->setValue(scx * 100);
02430               imageYScaleSpinBox->setValue(scy * 100);
02431               imgDpiX->setValue(72);
02432               imgDpiY->setValue(72);
02433        }
02434        HaveItem = tmp;
02435 }
02436 
02437 void Mpalette::setSvalue(double s)
02438 {
02439        if (!m_ScMW || m_ScMW->ScriptRunning)
02440               return;
02441        bool tmp = HaveItem;
02442        HaveItem = false;
02443        LSize->setValue(s*Umrech);
02444        HaveItem = tmp;
02445 }
02446 
02447 void Mpalette::setLIvalue(Qt::PenStyle p, Qt::PenCapStyle pc, Qt::PenJoinStyle pj)
02448 {
02449        if (!m_ScMW || m_ScMW->ScriptRunning)
02450               return;
02451        bool tmp = HaveItem;
02452        HaveItem = false;
02453        switch (p)
02454        {
02455        case SolidLine:
02456               LStyle->setCurrentItem(0);
02457               break;
02458        case DashLine:
02459               LStyle->setCurrentItem(1);
02460               break;
02461        case DotLine:
02462               LStyle->setCurrentItem(2);
02463               break;
02464        case DashDotLine:
02465               LStyle->setCurrentItem(3);
02466               break;
02467        case DashDotDotLine:
02468               LStyle->setCurrentItem(4);
02469               break;
02470        default:
02471               LStyle->setCurrentItem(0);
02472               break;
02473        }
02474        switch (pc)
02475        {
02476        case FlatCap:
02477               LEndStyle->setCurrentItem(0);
02478               break;
02479        case SquareCap:
02480               LEndStyle->setCurrentItem(1);
02481               break;
02482        case RoundCap:
02483               LEndStyle->setCurrentItem(2);
02484               break;
02485        default:
02486               LEndStyle->setCurrentItem(0);
02487               break;
02488        }
02489        switch (pj)
02490        {
02491        case MiterJoin:
02492               LJoinStyle->setCurrentItem(0);
02493               break;
02494        case BevelJoin:
02495               LJoinStyle->setCurrentItem(1);
02496               break;
02497        case RoundJoin:
02498               LJoinStyle->setCurrentItem(2);
02499               break;
02500        default:
02501               LJoinStyle->setCurrentItem(0);
02502               break;
02503        }
02504        HaveItem = tmp;
02505 }
02506 
02507 
02508 void Mpalette::updateStyle(const ParagraphStyle& newCurrent)
02509 {
02510        if (!m_ScMW || m_ScMW->ScriptRunning)
02511               return;
02512        bool tmp = HaveItem;
02513        HaveItem = false;
02514        if (newCurrent.lineSpacingMode() > 0)
02515        {
02516               LineSp->setSpecialValueText( tr( "Auto" ) );
02517               LineSp->setMinValue(0);
02518               LineSp->setValue(0);
02519               LineSp->setEnabled(false);
02520        }
02521        else
02522        {
02523               LineSp->setEnabled(true);
02524               LineSp->setSpecialValueText("");
02525               LineSp->setMinValue(1);
02526               LineSp->setValue(newCurrent.lineSpacing());
02527        }
02528        for (uint al = 0; al < lineSpacingPop->count(); ++al)
02529        {
02530               lineSpacingPop->setItemChecked(lineSpacingPop->idAt(al), false);
02531        }
02532        lineSpacingPop->setItemChecked(lineSpacingPop->idAt(newCurrent.lineSpacingMode()), true);
02533        GroupAlign->setStyle(newCurrent.alignment());
02534        minWordTrackingSpinBox->setValue(newCurrent.minWordTracking() * 100.0);
02535        normWordTrackingSpinBox->setValue(newCurrent.charStyle().wordTracking() * 100.0);
02536        minGlyphExtSpinBox->setValue(newCurrent.minGlyphExtension() * 100.0);
02537        maxGlyphExtSpinBox->setValue(newCurrent.maxGlyphExtension() * 100.0);
02538        HaveItem = tmp;
02539        
02540        
02541 }
02542 
02543 void Mpalette::setStil(int s)
02544 {
02545        if (!m_ScMW || m_ScMW->ScriptRunning)
02546               return;
02547        StrokeIcon->setEnabled(false);
02548        TxStroke->setEnabled(false);
02549        PM1->setEnabled(false);
02550        SeStyle->setStyle(s);
02551        if ((s & 4) || (s & 256))
02552        {
02553               StrokeIcon->setEnabled(true);
02554               TxStroke->setEnabled(true);
02555               PM1->setEnabled(true);
02556        }
02557 }
02558 
02559 void Mpalette::setAli(int e)
02560 {
02561        if (!m_ScMW || m_ScMW->ScriptRunning)
02562               return;
02563        bool tmp = HaveItem;
02564        HaveItem = false;
02565        GroupAlign->setEnabled(true);
02566        GroupAlign->setStyle(e);
02567        HaveItem = tmp;
02568 }
02569 
02570 
02571 void Mpalette::setParStyle(const QString& name)
02572 {
02573        if (!m_ScMW || m_ScMW->ScriptRunning)
02574               return;
02575        bool tmp = HaveItem;
02576        HaveItem = false;
02577        paraStyleCombo->setFormat(name);
02578        HaveItem = tmp;
02579 }
02580 
02581 
02582 void Mpalette::setCharStyle(const QString& name)
02583 {
02584        if (!m_ScMW || m_ScMW->ScriptRunning)
02585               return;
02586        bool tmp = HaveItem;
02587        HaveItem = false;
02588        charStyleCombo->setFormat(name);
02589        HaveItem = tmp;
02590 }
02591 
02592 void Mpalette::setOpticalMargins(int i)
02593 {
02594        if (!HaveDoc || !m_ScMW || m_ScMW->ScriptRunning)
02595               return;
02596        doc->itemSelection_SetOpticalMargins(i==0 ? ParagraphStyle::OM_None : ParagraphStyle::OM_Default);
02597 }
02598 
02599 
02600 void Mpalette::setMinWordTracking()
02601 {
02602        if (!HaveDoc || !m_ScMW || m_ScMW->ScriptRunning)
02603               return;
02604        ParagraphStyle newStyle;
02605        newStyle.setMinWordTracking(minWordTrackingSpinBox->value() / 100.0);
02606        doc->itemSelection_ApplyParagraphStyle(newStyle);
02607 }
02608 
02609 
02610 void Mpalette::setNormWordTracking()
02611 {
02612        if (!HaveDoc || !m_ScMW || m_ScMW->ScriptRunning)
02613               return;
02614        ParagraphStyle newStyle;
02615 //     newStyle.setNormWordTracking(percent / 100.0);
02616        newStyle.charStyle().setWordTracking(normWordTrackingSpinBox->value() / 100.0);
02617        doc->itemSelection_ApplyParagraphStyle(newStyle);
02618 }
02619 
02620 void Mpalette::setMinGlyphExtension()
02621 {
02622        if (!HaveDoc || !m_ScMW || m_ScMW->ScriptRunning)
02623               return;
02624        ParagraphStyle newStyle;
02625        newStyle.setMinGlyphExtension(minGlyphExtSpinBox->value() / 100.0);
02626        doc->itemSelection_ApplyParagraphStyle(newStyle);
02627 }
02628 
02629 void Mpalette::setMaxGlyphExtension()
02630 {
02631        if (!HaveDoc || !m_ScMW || m_ScMW->ScriptRunning)
02632               return;
02633        ParagraphStyle newStyle;
02634        newStyle.setMaxGlyphExtension(maxGlyphExtSpinBox->value() / 100.0);
02635        doc->itemSelection_ApplyParagraphStyle(newStyle);
02636 }
02637 
02638 void Mpalette::setTScaleV(int e)
02639 {
02640        if (!m_ScMW || m_ScMW->ScriptRunning)
02641               return;
02642        bool tmp = HaveItem;
02643        HaveItem = false;
02644        ChScaleV->setValue(e / 10.0);
02645        HaveItem = tmp;
02646 }
02647 
02648 void Mpalette::NewTScaleV()
02649 {
02650        if ((HaveDoc) && (HaveItem))
02651        {
02652               doc->itemSelection_SetScaleV(qRound(ChScaleV->value() * 10));
02653 //            doc->currentStyle.charStyle().setScaleV(qRound(ChScaleV->value() * 10));
02654 //            emit DocChanged();
02655        }
02656 }
02657 
02658 void Mpalette::NewTBase()
02659 {
02660        if ((HaveDoc) && (HaveItem))
02661        {
02662               doc->itemSelection_SetBaselineOffset(qRound(ChBase->value() * 10));
02663 //            doc->currentStyle.charStyle().setBaselineOffset(qRound(ChBase->value() * 10));
02664 //            emit DocChanged();
02665        }
02666 }
02667 
02668 void Mpalette::setTScale(int e)
02669 {
02670        if (!m_ScMW || m_ScMW->ScriptRunning)
02671               return;
02672        bool tmp = HaveItem;
02673        HaveItem = false;
02674        ChScale->setValue(e / 10.0);
02675        HaveItem = tmp;
02676 }
02677 
02678 void Mpalette::setTBase(int e)
02679 {
02680        if (!m_ScMW || m_ScMW->ScriptRunning)
02681               return;
02682        bool tmp = HaveItem;
02683        HaveItem = false;
02684        ChBase->setValue(e / 10.0);
02685        HaveItem = tmp;
02686 }
02687 
02688 void Mpalette::NewTScale()
02689 {
02690        if ((HaveDoc) && (HaveItem))
02691        {
02692               doc->itemSelection_SetScaleH(qRound(ChScale->value() * 10));
02693 //            doc->currentStyle.charStyle().setScaleH(qRound(ChScale->value() * 10));
02694 //            emit DocChanged();
02695        }
02696 }
02697 
02698 void Mpalette::NewX()
02699 {
02700        if (!m_ScMW || m_ScMW->ScriptRunning)
02701               return;
02702        if ((HaveDoc) && (HaveItem))
02703        {
02704               double x,y,w,h, gx, gy, gh, gw, base;
02705               QWMatrix ma;
02706               x = Xpos->value() / Umrech;
02707               y = Ypos->value() / Umrech;
02708               w = Width->value() / Umrech;
02709               h = Height->value() / Umrech;
02710               base = 0;
02711               x += doc->rulerXoffset;
02712               y += doc->rulerYoffset;
02713               if (doc->guidesSettings.rulerMode)
02714               {
02715                      x += doc->currentPage()->xOffset();
02716                      y += doc->currentPage()->yOffset();
02717               }
02718               if (doc->m_Selection->isMultipleSelection())
02719               {
02720                      doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
02721                      if ((TopLeft->isChecked()) || (BottomLeft->isChecked()))
02722                             base = gx;
02723                      if (Center->isChecked())
02724                             base = gx + gw / 2.0;
02725                      if ((TopRight->isChecked()) || (BottomRight->isChecked()))
02726                             base = gx + gw;
02727                      m_ScMW->view->moveGroup(x - base, 0, true);
02728                      if (!_userActionOn && m_ScMW->view->groupTransactionStarted())
02729                      {
02730                             UndoManager::instance()->commit();
02731                             m_ScMW->view->setGroupTransactionStarted(false);
02732                      }
02733               }
02734               else
02735               {
02736                      if ((CurItem->asLine()) && (LMode))
02737                      {
02738                             w += doc->rulerXoffset;
02739                             h += doc->rulerYoffset;
02740                             if (doc->guidesSettings.rulerMode)
02741                             {
02742                                    w += doc->currentPage()->xOffset();
02743                                    h += doc->currentPage()->yOffset();
02744                             }
02745                             double r = atan2(h-y,w-x)*(180.0/M_PI);
02746                             w = sqrt(pow(w-x,2)+pow(h-y,2));
02747 //                          doc->MoveItem(x - CurItem->xPos(), 0, CurItem, true);
02748                             CurItem->setXYPos(x, CurItem->yPos(), true);
02749                             CurItem->setRotation(r, true);
02750                             doc->SizeItem(w, CurItem->height(), CurItem->ItemNr, true);
02751 //                          doc->RotateItem(r, CurItem->ItemNr);
02752                      }
02753                      else
02754                      {
02755                             ma.translate(CurItem->xPos(), CurItem->yPos());
02756                             ma.rotate(CurItem->rotation());
02757                             if (TopLeft->isChecked())
02758                                    base = CurItem->xPos();
02759                             if (Center->isChecked())
02760                                    base = ma.m11() * (CurItem->width() / 2.0) + ma.m21() * (CurItem->height() / 2.0) + ma.dx();
02761                             if (TopRight->isChecked())
02762                                    base = ma.m11() * CurItem->width() + ma.m21() * 0.0 + ma.dx();
02763                             if (BottomRight->isChecked())
02764                                    base = ma.m11() * CurItem->width() + ma.m21() * CurItem->height() + ma.dx();
02765                             if (BottomLeft->isChecked())
02766                                    base = ma.m11() * 0.0 + ma.m21() * CurItem->height() + ma.dx();
02767                             doc->MoveItem(x - base, 0, CurItem, true);
02768                      }
02769               }
02770               m_ScMW->view->updateContents();
02771               emit DocChanged();
02772        }
02773 }
02774 
02775 void Mpalette::NewY()
02776 {
02777        if (!m_ScMW || m_ScMW->ScriptRunning)
02778               return;
02779        if ((HaveDoc) && (HaveItem))
02780        {
02781               double x,y,w,h, gx, gy, gh, gw, base;
02782               QWMatrix ma;
02783               x = Xpos->value() / Umrech;
02784               y = Ypos->value() / Umrech;
02785               w = Width->value() / Umrech;
02786               h = Height->value() / Umrech;
02787               base = 0;
02788               x += doc->rulerXoffset;
02789               y += doc->rulerYoffset;
02790               if (doc->guidesSettings.rulerMode)
02791               {
02792                      x += doc->currentPage()->xOffset();
02793                      y += doc->currentPage()->yOffset();
02794               }
02795               if (doc->m_Selection->isMultipleSelection())
02796               {
02797                      doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
02798                      if ((TopLeft->isChecked()) || (TopRight->isChecked()))
02799                             base = gy;
02800                      if (Center->isChecked())
02801                             base = gy + gh / 2.0;
02802                      if ((BottomLeft->isChecked()) || (BottomRight->isChecked()))
02803                             base = gy + gh;
02804                      m_ScMW->view->moveGroup(0, y - base, true);
02805                      if (!_userActionOn && m_ScMW->view->groupTransactionStarted())
02806                      {
02807                             UndoManager::instance()->commit();
02808                             m_ScMW->view->setGroupTransactionStarted(false);
02809                      }
02810               }
02811               else
02812               {
02813                      if ((CurItem->asLine()) && (LMode))
02814                      {
02815                             w += doc->rulerXoffset;
02816                             h += doc->rulerYoffset;
02817                             if (doc->guidesSettings.rulerMode)
02818                             {
02819                                    w += doc->currentPage()->xOffset();
02820                                    h += doc->currentPage()->yOffset();
02821                             }
02822                             double r = atan2(h-y,w-x)*(180.0/M_PI);
02823                             w = sqrt(pow(w-x,2)+pow(h-y,2));
02824 //                          doc->MoveItem(0, y - CurItem->yPos(), CurItem, true);
02825                             CurItem->setXYPos(CurItem->xPos(), y, true);
02826                             CurItem->setRotation(r, true);
02827                             doc->SizeItem(w, CurItem->height(), CurItem->ItemNr, true);
02828 //                          doc->RotateItem(r, CurItem->ItemNr);
02829                      }
02830                      else
02831                      {
02832                             ma.translate(CurItem->xPos(), CurItem->yPos());
02833                             ma.rotate(CurItem->rotation());
02834                             if (TopLeft->isChecked())
02835                                    base = CurItem->yPos();
02836                             if (Center->isChecked())
02837                                    base = ma.m22() * (CurItem->height() / 2.0) + ma.m12() * (CurItem->width() / 2.0) + ma.dy();
02838                             if (TopRight->isChecked())
02839                                    base = ma.m22() * 0.0 + ma.m12() * CurItem->width() + ma.dy();
02840                             if (BottomRight->isChecked())
02841                                    base = ma.m22() * CurItem->height() + ma.m12() * CurItem->width() + ma.dy();
02842                             if (BottomLeft->isChecked())
02843                                    base = ma.m22() * CurItem->height() + ma.m12() * 0.0 + ma.dy();
02844                             doc->MoveItem(0, y - base, CurItem, true);
02845                      }
02846               }
02847               m_ScMW->view->updateContents();
02848               emit DocChanged();
02849        }
02850 }
02851 
02852 void Mpalette::NewW()
02853 {
02854        if (!m_ScMW || m_ScMW->ScriptRunning)
02855               return;
02856        if ((HaveDoc) && (HaveItem))
02857        {
02858               double x,y,w,h, gx, gy, gh, gw;
02859               x = Xpos->value() / Umrech;
02860               y = Ypos->value() / Umrech;
02861               w = Width->value() / Umrech;
02862               h = Height->value() / Umrech;
02863               if (doc->m_Selection->isMultipleSelection())
02864               {
02865                      doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
02866                      if (keepFrameWHRatioButton->isOn())
02867                      {
02868                             m_ScMW->view->frameResizeHandle = 1;
02869                             m_ScMW->view->scaleGroup(w / gw, w / gw);
02870                             setBH(w, (w / gw) * gh);
02871                      }
02872                      else
02873                      {
02874                             m_ScMW->view->frameResizeHandle = 6;
02875                             m_ScMW->view->scaleGroup(w / gw, 1.0);
02876                             doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
02877                             setBH(gw, gh);
02878                      }
02879                      if (!_userActionOn && m_ScMW->view->groupTransactionStarted())
02880                      {
02881                             UndoManager::instance()->commit();
02882                             m_ScMW->view->setGroupTransactionStarted(false);
02883                      }
02884               }
02885               else
02886               {
02887                      CurItem->OldB2 = CurItem->width();
02888                      CurItem->OldH2 = CurItem->height();
02889                      if (CurItem->asLine())
02890                      {
02891                             if (LMode)
02892                             {
02893                                    double r = atan2(h-y,w-x)*(180.0/M_PI);
02894                                    CurItem->setRotation(r, true);
02895                                    w = sqrt(pow(w-x,2)+pow(h-y,2));
02896                             }
02897                             doc->SizeItem(w, CurItem->height(), CurItem->ItemNr, true);
02898                      }
02899                      else
02900                      {
02901                             if (CurItem->isTableItem)
02902                             {
02903                                    int rmo = doc->RotMode;
02904                                    doc->RotMode = 0;
02905                                    double dist = w - CurItem->width();
02906                                    double oldW = CurItem->width();
02907                                    PageItem* bb2;
02908                                    PageItem* bb = CurItem;
02909                                    while (bb->TopLink != 0)
02910                                    {
02911                                           bb = bb->TopLink;
02912                                    }
02913                                    while (bb->BottomLink != 0)
02914                                    {
02915                                           bb2 = bb;
02916                                           while (bb2->RightLink != 0)
02917                                           {
02918                                                  doc->MoveRotated(bb2->RightLink, FPoint(dist, 0), true);
02919                                                  bb2 = bb2->RightLink;
02920                                           }
02921                                           doc->MoveSizeItem(FPoint(0, 0), FPoint(-dist, 0), bb->ItemNr, true);
02922                                           bb = bb->BottomLink;
02923                                    }
02924                                    bb2 = bb;
02925                                    while (bb2->RightLink != 0)
02926                                    {
02927                                           doc->MoveRotated(bb2->RightLink, FPoint(dist, 0), true);
02928                                           bb2 = bb2->RightLink;
02929                                    }
02930                                    doc->MoveSizeItem(FPoint(0, 0), FPoint(-dist, 0), bb->ItemNr, true);
02931                                    doc->RotMode = rmo;
02932                                    if (keepFrameWHRatioButton->isOn())
02933                                    {
02934                                           keepFrameWHRatioButton->setOn(false);
02935                                           setBH(w, (w / oldW) * CurItem->height());
02936                                           NewH();
02937                                           keepFrameWHRatioButton->setOn(true);
02938                                    }
02939                             }
02940                             else
02941                             {
02942                                    if (keepFrameWHRatioButton->isOn())
02943                                    {
02944                                           setBH(w, (w / CurItem->width()) * CurItem->height());
02945                                           doc->SizeItem(w, (w / CurItem->width()) * CurItem->height(), CurItem->ItemNr, true);
02946                                    }
02947                                    else
02948                                           doc->SizeItem(w, CurItem->height(), CurItem->ItemNr, true);
02949                             }
02950                      }
02951               }
02952               emit DocChanged();
02953               m_ScMW->view->updateContents();
02954        }
02955 }
02956 
02957 void Mpalette::NewH()
02958 {
02959        if (!m_ScMW || m_ScMW->ScriptRunning)
02960               return;
02961        if ((HaveDoc) && (HaveItem))
02962        {
02963               double x,y,w,h, gx, gy, gh, gw;
02964               x = Xpos->value() / Umrech;
02965               y = Ypos->value() / Umrech;
02966               w = Width->value() / Umrech;
02967               h = Height->value() / Umrech;
02968               if (doc->m_Selection->isMultipleSelection())
02969               {
02970                      doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
02971                      if (keepFrameWHRatioButton->isOn())
02972                      {
02973                             m_ScMW->view->frameResizeHandle = 1;
02974                             m_ScMW->view->scaleGroup(h / gh, h / gh);
02975                             setBH((h / gh) * gw, h);
02976                      }
02977                      else
02978                      {
02979                             m_ScMW->view->frameResizeHandle = 5;
02980                             m_ScMW->view->scaleGroup(1.0, h / gh);
02981                             doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
02982                             setBH(gw, gh);
02983                      }
02984                      if (!_userActionOn && m_ScMW->view->groupTransactionStarted())
02985                      {
02986                             UndoManager::instance()->commit();
02987                             m_ScMW->view->setGroupTransactionStarted(false);
02988                      }
02989               }
02990               else
02991               {
02992                      CurItem->OldB2 = CurItem->width();
02993                      CurItem->OldH2 = CurItem->height();
02994                      if (CurItem->asLine())
02995                      {
02996                             if (LMode)
02997                             {
02998                                    double r = atan2(h-y,w-x)*(180.0/M_PI);
02999                                    CurItem->setRotation(r, true);
03000                                    w = sqrt(pow(w-x,2)+pow(h-y,2));
03001                             }
03002                             doc->SizeItem(w, CurItem->height(), CurItem->ItemNr, true);
03003                      }
03004                      else
03005                      {
03006                             if (CurItem->isTableItem)
03007                             {
03008                                    int rmo = doc->RotMode;
03009                                    doc->RotMode = 0;
03010                                    double dist = h - CurItem->height();
03011                                    double oldH = CurItem->height();
03012                                    PageItem* bb2;
03013                                    PageItem* bb = CurItem;
03014                                    while (bb->LeftLink != 0)
03015                                    {
03016                                           bb = bb->LeftLink;
03017                                    }
03018                                    while (bb->RightLink != 0)
03019                                    {
03020                                           bb2 = bb;
03021                                           while (bb2->BottomLink != 0)
03022                                           {
03023                                                  doc->MoveRotated(bb2->BottomLink, FPoint(0, dist), true);
03024                                                  bb2 = bb2->BottomLink;
03025                                           }
03026                                           doc->MoveSizeItem(FPoint(0, 0), FPoint(0, -dist), bb->ItemNr, true);
03027                                           bb = bb->RightLink;
03028                                    }
03029                                    bb2 = bb;
03030                                    while (bb2->BottomLink != 0)
03031                                    {
03032                                           doc->MoveRotated(bb2->BottomLink, FPoint(0, dist), true);
03033                                           bb2 = bb2->BottomLink;
03034                                    }
03035                                    doc->MoveSizeItem(FPoint(0, 0), FPoint(0, -dist), bb->ItemNr, true);
03036                                    doc->RotMode = rmo;
03037                                    if (keepFrameWHRatioButton->isOn())
03038                                    {
03039                                           keepFrameWHRatioButton->setOn(false);
03040                                           setBH((h / oldH) * CurItem->width(), h);
03041                                           NewW();
03042                                           keepFrameWHRatioButton->setOn(true);
03043                                    }
03044                             }
03045                             else
03046                             {
03047                                    if (keepFrameWHRatioButton->isOn())
03048                                    {
03049                                           setBH((h / CurItem->height()) * CurItem->width(), h);
03050                                           doc->SizeItem((h / CurItem->height()) * CurItem->width(), h, CurItem->ItemNr, true);
03051                                    }
03052                                    else
03053                                           doc->SizeItem(CurItem->width(), h, CurItem->ItemNr, true);
03054                             }
03055                      }
03056               }
03057               emit DocChanged();
03058               m_ScMW->view->updateContents();
03059        }
03060 }
03061 
03062 void Mpalette::NewR()
03063 {
03064        if (!m_ScMW || m_ScMW->ScriptRunning)
03065               return;
03066        double gx, gy, gh, gw;
03067        if ((HaveDoc) && (HaveItem))
03068        {
03069               if (doc->m_Selection->isMultipleSelection())
03070               {
03071                      m_ScMW->view->RotateGroup((Rot->value() - RoVal)*(-1));
03072                      if (!_userActionOn && m_ScMW->view->groupTransactionStarted())
03073                      {
03074                             UndoManager::instance()->commit();
03075                             m_ScMW->view->setGroupTransactionStarted(false);
03076                      }
03077                      doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
03078                      setXY(gx, gy);
03079               }
03080               else
03081                      doc->RotateItem(Rot->value()*(-1), CurItem->ItemNr);
03082               emit DocChanged();
03083               m_ScMW->view->updateContents();
03084               RoVal = Rot->value();
03085        }
03086 }
03087 
03088 void Mpalette::NewRR()
03089 {
03090        if (!m_ScMW || m_ScMW->ScriptRunning)
03091               return;
03092        if ((HaveDoc) && (HaveItem))
03093        {
03094               CurItem->setCornerRadius(RoundRect->value() / Umrech);
03095               m_ScMW->view->SetFrameRounded();
03096               emit DocChanged();
03097        }
03098 }
03099 
03100 void Mpalette::NewLsp()
03101 {
03102        if (!m_ScMW || m_ScMW->ScriptRunning)
03103               return;
03104        if ((HaveDoc) && (HaveItem))
03105        {
03106               doc->itemSelection_SetLineSpacing(LineSp->value());
03107 //            emit DocChanged();
03108        }
03109 }
03110 
03111 void Mpalette::HandleGapSwitch()
03112 {
03113        if ((HaveDoc) && (HaveItem))
03114        {
03115               setCols(CurItem->Cols, CurItem->ColGap);
03116               QToolTip::remove(dGap);
03117 //            if (colgapLabel->getState())
03118               if (colgapLabel->currentItem() == 0)
03119                      QToolTip::add( dGap, tr( "Distance between columns" ) );
03120               else
03121                      QToolTip::add( dGap, tr( "Column width" ) );
03122        }
03123 }
03124 
03125 void Mpalette::NewCols()
03126 {
03127        if (!m_ScMW || m_ScMW->ScriptRunning)
03128               return;
03129        if ((HaveDoc) && (HaveItem))
03130        {
03131               CurItem->Cols = DCol->value();
03132               setCols(CurItem->Cols, CurItem->ColGap);
03133               m_ScMW->view->RefreshItem(CurItem);
03134               emit DocChanged();
03135        }
03136 }
03137 
03138 void Mpalette::NewGap()
03139 {
03140        if (!m_ScMW || m_ScMW->ScriptRunning)
03141               return;
03142        if ((HaveDoc) && (HaveItem))
03143        {
03144 //            if (colgapLabel->getState())
03145               if (colgapLabel->currentItem() == 0)
03146                      CurItem->ColGap = dGap->value() / Umrech;
03147               else
03148               {
03149                      double lineCorr;
03150                      if (CurItem->lineColor() != CommonStrings::None)
03151                             lineCorr = CurItem->lineWidth();
03152                      else
03153                             lineCorr = 0;
03154                      double newWidth = dGap->value() / Umrech;
03155                      double newGap = QMAX(((CurItem->width() - CurItem->textToFrameDistLeft() - CurItem->textToFrameDistRight() - lineCorr) - (newWidth * CurItem->Cols)) / (CurItem->Cols - 1), 0);
03156                      CurItem->ColGap = newGap;
03157               }
03158               m_ScMW->view->RefreshItem(CurItem);
03159               emit DocChanged();
03160        }
03161 }
03162 
03163 void Mpalette::NewSize()
03164 {
03165        if (!m_ScMW || m_ScMW->ScriptRunning)
03166               return;
03167        if ((HaveDoc) && (HaveItem))
03168        {
03169               doc->itemSelection_SetFontSize(qRound(Size->value()*10.0));
03170 //            emit DocChanged();
03171        }
03172 }
03173 
03174 void Mpalette::NewExtra()
03175 {
03176        if (!m_ScMW || m_ScMW->ScriptRunning)
03177               return;
03178        if ((HaveDoc) && (HaveItem))
03179        {
03180               doc->itemSelection_SetTracking(qRound(Extra->value() * 10.0));
03181 //            emit DocChanged();
03182        }
03183 }
03184 
03185 void Mpalette::NewLocalXY()
03186 {
03187        if (!m_ScMW || m_ScMW->ScriptRunning)
03188               return;
03189        if ((HaveDoc) && (HaveItem))
03190        {
03191               doc->itemSelection_SetImageOffset(imageXOffsetSpinBox->value() / Umrech / CurItem->imageXScale(), imageYOffsetSpinBox->value() / Umrech / CurItem->imageYScale());
03192        }
03193 }
03194 
03195 void Mpalette::NewLocalSC()
03196 {
03197        if (!m_ScMW || m_ScMW->ScriptRunning)
03198               return;
03199        if ((HaveDoc) && (HaveItem))
03200        {
03201               /*doc->itemSelection_SetImageScale(imageXScaleSpinBox->value() / 100.0 / CurItem->pixm.imgInfo.xres * 72.0, imageYScaleSpinBox->value() / 100.0 / CurItem->pixm.imgInfo.yres * 72.0);
03202               doc->itemSelection_SetImageOffset(imageXOffsetSpinBox->value() / Umrech / CurItem->imageXScale(), imageYOffsetSpinBox->value() / Umrech / CurItem->imageYScale());
03203               */
03204               //CB Dont pass in the scale to the offset change as its taken from the new scale
03205               doc->itemSelection_SetImageScaleAndOffset(imageXScaleSpinBox->value() / 100.0 / CurItem->pixm.imgInfo.xres * 72.0, imageYScaleSpinBox->value() / 100.0 / CurItem->pixm.imgInfo.yres * 72.0, imageXOffsetSpinBox->value() / Umrech, imageYOffsetSpinBox->value() / Umrech);
03206               disconnect(imgDpiX, SIGNAL(valueChanged(int)), this, SLOT(HChangeD()));
03207               disconnect(imgDpiY, SIGNAL(valueChanged(int)), this, SLOT(VChangeD()));
03208               imgDpiX->setValue(qRound(720.0 / CurItem->imageXScale()) / 10.0);
03209               imgDpiY->setValue(qRound(720.0 / CurItem->imageYScale()) / 10.0);
03210               connect(imgDpiX, SIGNAL(valueChanged(int)), this, SLOT(HChangeD()));
03211               connect(imgDpiY, SIGNAL(valueChanged(int)), this, SLOT(VChangeD()));
03212        }
03213 }
03214 
03215 void Mpalette::NewLocalDpi()
03216 {
03217        if (!m_ScMW || m_ScMW->ScriptRunning)
03218               return;
03219        if ((HaveDoc) && (HaveItem))
03220        {
03221               /*
03222               doc->itemSelection_SetImageScale(72.0 / imgDpiX->value(), 72.0 / imgDpiY->value());
03223               doc->itemSelection_SetImageOffset(imageXOffsetSpinBox->value() / Umrech / CurItem->imageXScale(), imageYOffsetSpinBox->value() / Umrech / CurItem->imageYScale());
03224               */
03225               //CB Dont pass in the scale to the offset change as its taken from the new scale
03226               doc->itemSelection_SetImageScaleAndOffset(72.0 / imgDpiX->value(), 72.0 / imgDpiY->value(), imageXOffsetSpinBox->value() / Umrech, imageYOffsetSpinBox->value() / Umrech);
03227               disconnect(imageXScaleSpinBox, SIGNAL(valueChanged(int)), this, SLOT(HChange()));
03228               disconnect(imageYScaleSpinBox, SIGNAL(valueChanged(int)), this, SLOT(VChange()));
03229               imageXScaleSpinBox->setValue(CurItem->imageXScale() * 100 / 72.0 * CurItem->pixm.imgInfo.xres);
03230               imageYScaleSpinBox->setValue(CurItem->imageYScale() * 100 / 72.0 * CurItem->pixm.imgInfo.yres);
03231               connect(imageXScaleSpinBox, SIGNAL(valueChanged(int)), this, SLOT(HChange()));
03232               connect(imageYScaleSpinBox, SIGNAL(valueChanged(int)), this, SLOT(VChange()));
03233        }
03234 }
03235 
03236 void Mpalette::EditEff()
03237 {
03238        if (!m_ScMW || m_ScMW->ScriptRunning)
03239               return;
03240        if ((HaveDoc) && (HaveItem))
03241               m_ScMW->ImageEffects();
03242 }
03243 
03244 void Mpalette::EditPSD()
03245 {
03246        if (!m_ScMW || m_ScMW->ScriptRunning)
03247               return;
03248        if ((HaveDoc) && (HaveItem))
03249        {
03250               m_ScMW->view->editExtendedImageProperties();
03251               emit DocChanged();
03252        }
03253 }
03254 
03255 void Mpalette::NewLS()
03256 {
03257        if (!m_ScMW || m_ScMW->ScriptRunning)
03258               return;
03259        if ((HaveDoc) && (HaveItem))
03260        {
03261               doc->ChLineWidth(LSize->value() / Umrech);
03262 //            emit DocChanged();
03263        }
03264 }
03265 
03266 void Mpalette::setStartArrow(int id)
03267 {
03268        if (!m_ScMW || m_ScMW->ScriptRunning)
03269               return;
03270        if ((HaveDoc) && (HaveItem))
03271               doc->itemSelection_ApplyArrowHead(id,-1);
03272 }
03273 
03274 void Mpalette::setEndArrow(int id)
03275 {
03276        if (!m_ScMW || m_ScMW->ScriptRunning)
03277               return;
03278        if ((HaveDoc) && (HaveItem))
03279               doc->itemSelection_ApplyArrowHead(-1, id);
03280 }
03281 
03282 void Mpalette::NewLSty()
03283 {
03284        if (!m_ScMW || m_ScMW->ScriptRunning)
03285               return;
03286        PenStyle c = SolidLine;
03287        switch (LStyle->currentItem())
03288        {
03289        case 0:
03290               c = SolidLine;
03291               break;
03292        case 1:
03293               c = DashLine;
03294               break;
03295        case 2:
03296               c = DotLine;
03297               break;
03298        case 3:
03299               c = DashDotLine;
03300               break;
03301        case 4:
03302               c = DashDotDotLine;
03303               break;
03304        }
03305        if ((HaveDoc) && (HaveItem))
03306        {
03307               doc->ChLineArt(c);
03308 //            emit DocChanged();
03309        }
03310 }
03311 
03312 void Mpalette::NewLMode()
03313 {
03314        if (!m_ScMW || m_ScMW->ScriptRunning)
03315               return;
03316        if (LineMode->currentItem() == 0)
03317        {
03318               xposLabel->setText( tr( "&X-Pos:" ) );
03319               widthLabel->setText( tr( "&Width:" ) );
03320               yposLabel->setText( tr( "&Y-Pos:" ) );
03321               heightLabel->setText( tr( "&Height:" ) );
03322               Rot->setEnabled(true);
03323               Height->setEnabled(false);
03324               LMode = false;
03325        }
03326        else
03327        {
03328               xposLabel->setText( tr( "&X1:" ) );
03329               widthLabel->setText( tr( "X&2:" ) );
03330               yposLabel->setText( tr( "Y&1:" ) );
03331               heightLabel->setText( tr( "&Y2:" ) );
03332               Rot->setEnabled(false);
03333               Height->setEnabled(true);
03334               LMode = true;
03335        }
03336        setBH(CurItem->width(), CurItem->height());
03337        updateGeometry();
03338 //     setFocus();
03339        repaint();
03340 }
03341 
03342 void Mpalette::NewLJoin()
03343 {
03344        if (!m_ScMW || m_ScMW->ScriptRunning)
03345               return;
03346        PenJoinStyle c = MiterJoin;
03347        switch (LJoinStyle->currentItem())
03348        {
03349        case 0:
03350               c = MiterJoin;
03351               break;
03352        case 1:
03353               c = BevelJoin;
03354               break;
03355        case 2:
03356               c = RoundJoin;
03357               break;
03358        }
03359        if ((HaveDoc) && (HaveItem))
03360        {
03361               doc->ChLineJoin(c);
03362 //            emit DocChanged();
03363        }
03364 }
03365 
03366 void Mpalette::NewLEnd()
03367 {
03368        if (!m_ScMW || m_ScMW->ScriptRunning)
03369               return;
03370        PenCapStyle c = FlatCap;
03371        switch (LEndStyle->currentItem())
03372        {
03373        case 0:
03374               c = FlatCap;
03375               break;
03376        case 1:
03377               c = SquareCap;
03378               break;
03379        case 2:
03380               c = RoundCap;
03381               break;
03382        }
03383        if ((HaveDoc) && (HaveItem))
03384        {
03385               doc->ChLineEnd(c);
03386 //            emit DocChanged();
03387        }
03388 }
03389 
03390 void Mpalette::ToggleKette()
03391 {
03392        if (!m_ScMW || m_ScMW->ScriptRunning)
03393               return;
03394        disconnect(imageXScaleSpinBox, SIGNAL(valueChanged(int)), this, SLOT(HChange()));
03395        disconnect(imageYScaleSpinBox, SIGNAL(valueChanged(int)), this, SLOT(VChange()));
03396        if (keepImageWHRatioButton->isOn())
03397        {
03398               imageYScaleSpinBox->setValue(imageXScaleSpinBox->value());
03399               NewLocalSC();
03400               keepImageDPIRatioButton->setOn(true);
03401        }
03402        else
03403               keepImageDPIRatioButton->setOn(false);
03404        connect(imageXScaleSpinBox, SIGNAL(valueChanged(int)), this, SLOT(HChange()));
03405        connect(imageYScaleSpinBox, SIGNAL(valueChanged(int)), this, SLOT(VChange()));
03406 }
03407 
03408 void Mpalette::HChange()
03409 {
03410        disconnect(imageXScaleSpinBox, SIGNAL(valueChanged(int)), this, SLOT(HChange()));
03411        disconnect(imageYScaleSpinBox, SIGNAL(valueChanged(int)), this, SLOT(VChange()));
03412        if (keepImageWHRatioButton->isOn())
03413               imageYScaleSpinBox->setValue(imageXScaleSpinBox->value());
03414        NewLocalSC();
03415        connect(imageXScaleSpinBox, SIGNAL(valueChanged(int)), this, SLOT(HChange()));
03416        connect(imageYScaleSpinBox, SIGNAL(valueChanged(int)), this, SLOT(VChange()));
03417 }
03418 
03419 void Mpalette::VChange()
03420 {
03421        disconnect(imageXScaleSpinBox, SIGNAL(valueChanged(int)), this, SLOT(HChange()));
03422        disconnect(imageYScaleSpinBox, SIGNAL(valueChanged(int)), this, SLOT(VChange()));
03423        if (keepImageWHRatioButton->isOn())
03424               imageXScaleSpinBox->setValue(imageYScaleSpinBox->value());
03425        NewLocalSC();
03426        connect(imageXScaleSpinBox, SIGNAL(valueChanged(int)), this, SLOT(HChange()));
03427        connect(imageYScaleSpinBox, SIGNAL(valueChanged(int)), this, SLOT(VChange()));
03428 }
03429 
03430 void Mpalette::ToggleKetteD()
03431 {
03432        if (!m_ScMW || m_ScMW->ScriptRunning)
03433               return;
03434        disconnect(imgDpiX, SIGNAL(valueChanged(int)), this, SLOT(HChangeD()));
03435        disconnect(imgDpiY, SIGNAL(valueChanged(int)), this, SLOT(VChangeD()));
03436        if (keepImageDPIRatioButton->isOn())
03437        {
03438               imgDpiY->setValue(imgDpiX->value());
03439               NewLocalDpi();
03440               keepImageWHRatioButton->setOn(true);
03441        }
03442        else
03443               keepImageWHRatioButton->setOn(false);
03444        connect(imgDpiX, SIGNAL(valueChanged(int)), this, SLOT(HChangeD()));
03445        connect(imgDpiY, SIGNAL(valueChanged(int)), this, SLOT(VChangeD()));
03446 }
03447 
03448 void Mpalette::HChangeD()
03449 {
03450        disconnect(imgDpiX, SIGNAL(valueChanged(int)), this, SLOT(HChangeD()));
03451        disconnect(imgDpiY, SIGNAL(valueChanged(int)), this, SLOT(VChangeD()));
03452        if (keepImageDPIRatioButton->isOn())
03453               imgDpiY->setValue(imgDpiX->value());
03454        NewLocalDpi();
03455        connect(imgDpiX, SIGNAL(valueChanged(int)), this, SLOT(HChangeD()));
03456        connect(imgDpiY, SIGNAL(valueChanged(int)), this, SLOT(VChangeD()));
03457 }
03458 
03459 void Mpalette::VChangeD()
03460 {
03461        disconnect(imgDpiX, SIGNAL(valueChanged(int)), this, SLOT(HChangeD()));
03462        disconnect(imgDpiY, SIGNAL(valueChanged(int)), this, SLOT(VChangeD()));
03463        if (keepImageDPIRatioButton->isOn())
03464               imgDpiX->setValue(imgDpiY->value());
03465        NewLocalDpi();
03466        connect(imgDpiX, SIGNAL(valueChanged(int)), this, SLOT(HChangeD()));
03467        connect(imgDpiY, SIGNAL(valueChanged(int)), this, SLOT(VChangeD()));
03468 }
03469 
03470 void Mpalette::NewAli(int a)
03471 {
03472        if (!m_ScMW || m_ScMW->ScriptRunning)
03473               return;
03474        if ((HaveDoc) && (HaveItem))
03475        {
03476               doc->itemSelection_SetAlignment(a);
03477 //            emit DocChanged();
03478 
03479 //old:        if (findParagraphStyle(doc, doc->currentStyle) < 5)
03480 //                   emit NewAlignment(a);
03481        }
03482 }
03483 
03484 void Mpalette::setTypeStyle(int s)
03485 {
03486        if (!m_ScMW || m_ScMW->ScriptRunning)
03487               return;
03488        emit NewEffects(s);
03489 }
03490 
03491 void Mpalette::newShadowOffs()
03492 {
03493        int x = qRound(SeStyle->ShadowVal->Xoffset->value() * 10.0);
03494        int y = qRound(SeStyle->ShadowVal->Yoffset->value() * 10.0);
03495        if ((HaveDoc) && (HaveItem))
03496        {
03497               doc->itemSelection_SetShadowOffsets(x, y);
03498 //            doc->currentStyle.charStyle().setShadowXOffset(x);
03499 //            doc->currentStyle.charStyle().setShadowYOffset(y);
03500 //            emit DocChanged();
03501        }
03502 }
03503 
03504 void Mpalette::setShadowOffs(int x, int y)
03505 {
03506        if (!m_ScMW || m_ScMW->ScriptRunning)
03507               return;
03508        disconnect(SeStyle->ShadowVal->Xoffset, SIGNAL(valueChanged(int)), this, SLOT(newShadowOffs()));
03509        disconnect(SeStyle->ShadowVal->Yoffset, SIGNAL(valueChanged(int)), this, SLOT(newShadowOffs()));
03510        SeStyle->ShadowVal->Xoffset->setValue(x / 10.0);
03511        SeStyle->ShadowVal->Yoffset->setValue(y / 10.0);
03512        connect(SeStyle->ShadowVal->Xoffset, SIGNAL(valueChanged(int)), this, SLOT(newShadowOffs()));
03513        connect(SeStyle->ShadowVal->Yoffset, SIGNAL(valueChanged(int)), this, SLOT(newShadowOffs()));
03514 }
03515 
03516 void Mpalette::newUnderline()
03517 {
03518        int x = qRound(SeStyle->UnderlineVal->LPos->value() * 10.0);
03519        int y = qRound(SeStyle->UnderlineVal->LWidth->value() * 10.0);
03520        if ((HaveDoc) && (HaveItem))
03521        {
03522               doc->itemSelection_SetUnderline(x, y);
03523 //            doc->currentStyle.charStyle().setUnderlineOffset(x);
03524 //            doc->currentStyle.charStyle().setUnderlineWidth(y);
03525 //            emit DocChanged();
03526        }
03527 }
03528 
03529 void Mpalette::setUnderline(int p, int w)
03530 {
03531        if (!m_ScMW || m_ScMW->ScriptRunning)
03532               return;
03533        disconnect(SeStyle->UnderlineVal->LPos, SIGNAL(valueChanged(int)), this, SLOT(newUnderline()));
03534        disconnect(SeStyle->UnderlineVal->LWidth, SIGNAL(valueChanged(int)), this, SLOT(newUnderline()));
03535        SeStyle->UnderlineVal->LPos->setValue(p / 10.0);
03536        SeStyle->UnderlineVal->LWidth->setValue(w / 10.0);
03537        connect(SeStyle->UnderlineVal->LPos, SIGNAL(valueChanged(int)), this, SLOT(newUnderline()));
03538        connect(SeStyle->UnderlineVal->LWidth, SIGNAL(valueChanged(int)), this, SLOT(newUnderline()));
03539 }
03540 
03541 void Mpalette::newStrike()
03542 {
03543        int x = qRound(SeStyle->StrikeVal->LPos->value() * 10.0);
03544        int y = qRound(SeStyle->StrikeVal->LWidth->value() * 10.0);
03545        if ((HaveDoc) && (HaveItem))
03546        {
03547               doc->itemSelection_SetStrikethru(x, y);
03548 //            doc->currentStyle.charStyle().setStrikethruOffset(x);
03549 //            doc->currentStyle.charStyle().setStrikethruWidth(y);
03550 //            emit DocChanged();
03551        }
03552 }
03553 
03554 void Mpalette::setStrike(int p, int w)
03555 {
03556        if (!m_ScMW || m_ScMW->ScriptRunning)
03557               return;
03558        disconnect(SeStyle->StrikeVal->LPos, SIGNAL(valueChanged(int)), this, SLOT(newStrike()));
03559        disconnect(SeStyle->StrikeVal->LWidth, SIGNAL(valueChanged(int)), this, SLOT(newStrike()));
03560        SeStyle->StrikeVal->LPos->setValue(p / 10.0);
03561        SeStyle->StrikeVal->LWidth->setValue(w / 10.0);
03562        connect(SeStyle->StrikeVal->LPos, SIGNAL(valueChanged(int)), this, SLOT(newStrike()));
03563        connect(SeStyle->StrikeVal->LWidth, SIGNAL(valueChanged(int)), this, SLOT(newStrike()));
03564 }
03565 
03566 void Mpalette::setOutlineW(int x)
03567 {
03568        if (!m_ScMW || m_ScMW->ScriptRunning)
03569               return;
03570        disconnect(SeStyle->OutlineVal->LWidth, SIGNAL(valueChanged(int)), this, SLOT(newOutlineW()));
03571        SeStyle->OutlineVal->LWidth->setValue(x / 10.0);
03572        connect(SeStyle->OutlineVal->LWidth, SIGNAL(valueChanged(int)), this, SLOT(newOutlineW()));
03573 }
03574 
03575 void Mpalette::newOutlineW()
03576 {
03577        int x = qRound(SeStyle->OutlineVal->LWidth->value() * 10.0);
03578        if ((HaveDoc) && (HaveItem))
03579        {
03580               doc->itemSelection_SetOutlineWidth(x);
03581 //            doc->currentStyle.charStyle().setOutlineWidth(x);
03582 //            emit DocChanged();
03583        }
03584 }
03585 
03586 void Mpalette::DoLower()
03587 {
03588        if (!m_ScMW || m_ScMW->ScriptRunning)
03589               return;
03590        if ((HaveDoc) && (HaveItem))
03591        {
03592               m_ScMW->view->LowerItem();
03593        }
03594 }
03595 
03596 void Mpalette::DoRaise()
03597 {
03598        if (!m_ScMW || m_ScMW->ScriptRunning)
03599               return;
03600        if ((HaveDoc) && (HaveItem))
03601        {
03602               m_ScMW->view->RaiseItem();
03603        }
03604 }
03605 
03606 void Mpalette::DoFront()
03607 {
03608        if (!m_ScMW || m_ScMW->ScriptRunning)
03609               return;
03610        if ((HaveDoc) && (HaveItem))
03611        {
03612               m_ScMW->view->ToFront();
03613        }
03614 }
03615 
03616 void Mpalette::DoBack()
03617 {
03618        if (!m_ScMW || m_ScMW->ScriptRunning)
03619               return;
03620        if ((HaveDoc) && (HaveItem))
03621        {
03622               m_ScMW->view->ToBack();
03623        }
03624 }
03625 
03626 void Mpalette::NewRotMode(int m)
03627 {
03628        if (!m_ScMW || m_ScMW->ScriptRunning)
03629               return;
03630        double inX, inY, gx, gy, gh, gw;
03631        inX = 0;
03632        inY = 0;
03633        if ((HaveDoc) && (HaveItem))
03634        {
03635               HaveItem = false;
03636               doc->RotMode = m;
03637               if (doc->m_Selection->isMultipleSelection())
03638               {
03639                      doc->m_Selection->setGroupRect();
03640                      doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
03641                      if (m == 0)
03642                      {
03643                             m_ScMW->view->RCenter = FPoint(gx, gy);
03644                             inX = gx;
03645                             inY = gy;
03646                      }
03647                      if (m == 1)
03648                      {
03649                             m_ScMW->view->RCenter = FPoint(gx+gw, gy);
03650                             inX = gx+gw;
03651                             inY = gy;
03652                      }
03653                      if (m == 2)
03654                      {
03655                             m_ScMW->view->RCenter = FPoint(gx + gw / 2.0, gy + gh / 2.0);
03656                             inX = gx + gw / 2.0;
03657                             inY = gy + gh / 2.0;
03658                      }
03659                      if (m == 3)
03660                      {
03661                             m_ScMW->view->RCenter = FPoint(gx, gy+gh);
03662                             inX = gx;
03663                             inY = gy+gh;
03664                      }
03665                      if (m == 4)
03666                      {
03667                             m_ScMW->view->RCenter = FPoint(gx+gw, gy+gh);
03668                             inX = gx+gw;
03669                             inY = gy+gh;
03670                      }
03671                      inX -= doc->rulerXoffset;
03672                      inY -= doc->rulerYoffset;
03673                      if (doc->guidesSettings.rulerMode)
03674                      {
03675                             inX -= doc->currentPage()->xOffset();
03676                             inY -= doc->currentPage()->yOffset();
03677                      }
03678                      Xpos->setValue(inX*Umrech);
03679                      Ypos->setValue(inY*Umrech);
03680               }
03681               else
03682               {
03683                      double b, h, r;
03684                      QWMatrix ma;
03685                      FPoint n;
03686                      b = CurItem->width();
03687                      h = CurItem->height();
03688                      r = CurItem->rotation();
03689 //                   ma.translate(CurItem->xPos()-doc->getXOffsetForPage(CurItem->OwnPage), CurItem->yPos()-doc->getYOffsetForPage(CurItem->OwnPage));
03690                      ma.translate(CurItem->xPos(), CurItem->yPos());
03691                      ma.rotate(r);
03692                      if (TopLeft->isChecked())
03693                             n = FPoint(0.0, 0.0);
03694                      if (TopRight->isChecked())
03695                             n = FPoint(b, 0.0);
03696                      if (Center->isChecked())
03697                             n = FPoint(b / 2.0, h / 2.0);
03698                      if (BottomLeft->isChecked())
03699                             n = FPoint(0.0, h);
03700                      if (BottomRight->isChecked())
03701                             n = FPoint(b, h);
03702                      inX = ma.m11() * n.x() + ma.m21() * n.y() + ma.dx();
03703                      inY = ma.m22() * n.y() + ma.m12() * n.x() + ma.dy();
03704                      inX -= doc->rulerXoffset;
03705                      inY -= doc->rulerYoffset;
03706                      if (doc->guidesSettings.rulerMode)
03707                      {
03708                             inX -= doc->currentPage()->xOffset();
03709                             inY -= doc->currentPage()->yOffset();
03710                      }
03711                      Xpos->setValue(inX*Umrech);
03712                      Ypos->setValue(inY*Umrech);
03713               }
03714               HaveItem = true;
03715        }
03716 }
03717 
03718 void Mpalette::DoFlow(int /*id*/)
03719 {
03720        PageItem::TextFlowMode mode = PageItem::TextFlowDisabled;
03721        if (!m_ScMW || m_ScMW->ScriptRunning)
03722               return;
03723        if ((HaveDoc) && (HaveItem))
03724        {
03725               if (CurItem->isGroupControl)
03726               {
03727                      if (textFlowDisabled2->isOn())
03728                             mode = PageItem::TextFlowDisabled;
03729                      if (textFlowUsesFrameShape2->isOn())
03730                             mode = PageItem::TextFlowUsesFrameShape;
03731                      if (textFlowUsesBoundingBox2->isOn())
03732                             mode = PageItem::TextFlowUsesBoundingBox;
03733                      if (textFlowUsesContourLine2->isOn())
03734                             mode = PageItem::TextFlowUsesContourLine;
03735                      if (textFlowUsesImageClipping2->isOn())
03736                             mode = PageItem::TextFlowUsesImageClipping;
03737               }
03738               else
03739               {
03740                      if (textFlowDisabled->isOn())
03741                             mode = PageItem::TextFlowDisabled;
03742                      if (textFlowUsesFrameShape->isOn())
03743                             mode = PageItem::TextFlowUsesFrameShape;
03744                      if (textFlowUsesBoundingBox->isOn())
03745                             mode = PageItem::TextFlowUsesBoundingBox;
03746                      if (textFlowUsesContourLine->isOn())
03747                             mode = PageItem::TextFlowUsesContourLine;
03748                      if (textFlowUsesImageClipping->isOn())
03749                             mode = PageItem::TextFlowUsesImageClipping;
03750               }
03751               CurItem->setTextFlowMode(mode);
03752               m_ScMW->view->DrawNew();
03753               emit DocChanged();
03754        }
03755 }
03756 
03757 void Mpalette::MakeIrre(int f, int c, double *vals)
03758 {
03759        if (!m_ScMW || m_ScMW->ScriptRunning)
03760               return;
03761        if ((HaveDoc) && (HaveItem))
03762        {
03763               if ((CurItem->itemType() == PageItem::PolyLine) || (CurItem->itemType() == PageItem::PathText))
03764                      return;
03765               switch (f)
03766               {
03767               case 0:
03768                      CurItem->SetRectFrame();
03769                      doc->setRedrawBounding(CurItem);
03770                      break;
03771               case 1:
03772                      CurItem->SetOvalFrame();
03773                      doc->setRedrawBounding(CurItem);
03774                      break;
03775               default:
03776                      CurItem->SetFrameShape(c, vals);
03777                      doc->setRedrawBounding(CurItem);
03778                      CurItem->FrameType = f+2;
03779                      break;
03780               }
03781               m_ScMW->SCustom->setPixmap(m_ScMW->SCustom->getIconPixmap(f));
03782               m_ScMW->view->RefreshItem(CurItem);
03783               emit DocChanged();
03784               if ((CurItem->itemType() == PageItem::ImageFrame) || (CurItem->itemType() == PageItem::TextFrame))
03785               {
03786                      if (f != 0)
03787                             RoundRect->setEnabled(false);
03788                      else
03789                             RoundRect->setEnabled(true);
03790                      return;
03791               }
03792               CurItem->convertTo(PageItem::Polygon);
03793               NewSel(6);
03794               if (f != 0)
03795                      RoundRect->setEnabled(false);
03796               else
03797                      RoundRect->setEnabled(true);
03798 //            TabStack->setCurrentIndex(1);
03799        }
03800 }
03801 
03802 void Mpalette::EditSh()
03803 {
03804        if (!m_ScMW || m_ScMW->ScriptRunning)
03805               return;
03806        if ((HaveDoc) && (HaveItem))
03807        {
03808               /* Frame types 1 and 3 are OBSOLETE: CR 2005-02-06
03809               if ((CurItem->PType == 1) || (CurItem->PType == 3))
03810               {
03811                      CurItem->PType = 6;
03812                      NewSel(6);
03813                      TabStack->raiseWidget(1);
03814               }
03815               */
03816               emit ShapeEdit();
03817               RoundRect->setEnabled(false);
03818 //            emit DocChanged();
03819        }
03820 }
03821 
03822 void Mpalette::NewTDist()
03823 {
03824        if (!m_ScMW || m_ScMW->ScriptRunning)
03825               return;
03826        if ((HaveDoc) && (HaveItem))
03827        {
03828               CurItem->setTextToFrameDist(DLeft->value() / Umrech, DRight->value() / Umrech, DTop->value() / Umrech, DBottom->value() / Umrech);
03829               setCols(CurItem->Cols, CurItem->ColGap);
03830               m_ScMW->view->RefreshItem(CurItem);
03831               emit DocChanged();
03832        }
03833 }
03834 
03835 void Mpalette::NewSpGradient(double x1, double y1, double x2, double y2)
03836 {
03837        if (!m_ScMW || m_ScMW->ScriptRunning)
03838               return;
03839        if ((HaveDoc) && (HaveItem))
03840        {
03841               CurItem->GrStartX = x1 / Umrech;
03842               CurItem->GrStartY = y1 / Umrech;
03843               CurItem->GrEndX = x2 / Umrech;
03844               CurItem->GrEndY = y2 / Umrech;
03845               m_ScMW->view->RefreshItem(CurItem);
03846               emit DocChanged();
03847        }
03848 }
03849 
03850 void Mpalette::toggleGradientEdit()
03851 {
03852        if (!m_ScMW || m_ScMW->ScriptRunning)
03853               return;
03854        if ((HaveDoc) && (HaveItem))
03855        {
03856               if (Cpal->gradEditButton->isOn())
03857                      m_ScMW->setAppMode(modeEditGradientVectors);
03858               else
03859                      m_ScMW->setAppMode(modeNormal);
03860               m_ScMW->view->RefreshGradient(CurItem);
03861        }
03862 }
03863 
03864 void Mpalette::NewTFont(QString c)
03865 {
03866        if (!m_ScMW || m_ScMW->ScriptRunning)
03867               return;
03868        if ((HaveDoc) && (HaveItem))
03869               emit NewFont(c);
03870 }
03871 
03872 void Mpalette::DoRevert()
03873 {
03874        if (!m_ScMW || m_ScMW->ScriptRunning)
03875               return;
03876        if ((HaveDoc) && (HaveItem))
03877        {
03878               bool setter=Revert->isOn();
03879               CurItem->setImageFlippedH(setter);
03880               CurItem->setReversed(setter);
03881               m_ScMW->view->RefreshItem(CurItem);
03882               emit DocChanged();
03883        }
03884 }
03885 
03886 
03887 void Mpalette::doClearCStyle()
03888 {
03889        if (!m_ScMW || m_ScMW->ScriptRunning)
03890               return;
03891        if (HaveDoc)
03892        {
03893               doc->itemSelection_EraseCharStyle();
03894        }
03895 }
03896 
03897 
03898 void Mpalette::doClearPStyle()
03899 {
03900        if (!m_ScMW || m_ScMW->ScriptRunning)
03901               return;
03902        if (HaveDoc)
03903        {
03904               doc->itemSelection_EraseParagraphStyle();
03905               CharStyle emptyCStyle;
03906               doc->itemSelection_SetCharStyle(emptyCStyle);
03907        }
03908 }
03909 
03910 
03911 void Mpalette::SetLineFormats(ScribusDoc *dd)
03912 {
03913        if (!m_ScMW || m_ScMW->ScriptRunning)
03914               return;
03915        disconnect(StyledLine, SIGNAL(clicked(QListBoxItem*)), this, SLOT(SetSTline(QListBoxItem*)));
03916        StyledLine->clear();
03917        if (dd != 0)
03918        {
03919               QMap<QString,multiLine>::Iterator it;
03920               for (it = dd->MLineStyles.begin(); it != dd->MLineStyles.end(); ++it)
03921                      StyledLine->insertItem( new LineFormateItem(dd, it.data(), it.key()) );
03922               StyledLine->sort( true );
03923               StyledLine->insertItem( tr("No Style"), 0);
03924               StyledLine->setSelected(StyledLine->currentItem(), false);
03925        }
03926        connect(StyledLine, SIGNAL(clicked(QListBoxItem*)), this, SLOT(SetSTline(QListBoxItem*)));
03927 }
03928 
03929 void Mpalette::SetSTline(QListBoxItem *c)
03930 {
03931        if (!m_ScMW || m_ScMW->ScriptRunning)
03932               return;
03933        if (c == NULL)
03934               return;
03935        bool setter = c->listBox()->currentItem() == 0 ? true : false;
03936        if (setter == true)
03937               CurItem->setCustomLineStyle("");
03938        else
03939               CurItem->setCustomLineStyle(c->text());
03940        LStyle->setEnabled(setter);
03941        LSize->setEnabled(setter);
03942        LJoinStyle->setEnabled(setter);
03943        LEndStyle->setEnabled(setter);
03944        m_ScMW->view->RefreshItem(CurItem);
03945        emit DocChanged();
03946 }
03947 
03948 void Mpalette::updateColorList()
03949 {
03950        if (!HaveDoc || !m_ScMW || m_ScMW->ScriptRunning)
03951               return;
03952        Cpal->SetColors(doc->PageColors);
03953        Cpal->SetPatterns(&doc->docPatterns);
03954        TxFill->updateBox(doc->PageColors, ColorCombo::fancyPixmaps, true);
03955        TxStroke->updateBox(doc->PageColors, ColorCombo::fancyPixmaps, true);
03956        TxFill->listBox()->setMinimumWidth(TxFill->listBox()->maxItemWidth()+24);
03957        TxStroke->listBox()->setMinimumWidth(TxStroke->listBox()->maxItemWidth()+24);
03958 }
03959 
03960 void Mpalette::updateCmsList()
03961 {
03962        if (!m_ScMW || m_ScMW->ScriptRunning)
03963               return;
03964        if (HaveDoc)
03965        {
03966               if (ScCore->haveCMS() && doc->CMSSettings.CMSinUse)
03967                      GroupBoxCM->show();
03968               else
03969               {
03970                      GroupBoxCM->hide();
03971                      return;
03972               }
03973               disconnect(InputP, SIGNAL(activated(const QString&)), this, SLOT(ChProf(const QString&)));
03974               disconnect(MonitorI, SIGNAL(activated(int)), this, SLOT(ChIntent()));
03975               InputP->clear();
03976               if (HaveItem)
03977               {
03978                      if (CurItem->pixm.imgInfo.colorspace == 1)
03979                      {
03980                             ProfilesL::Iterator itP;
03981                             ProfilesL::Iterator itPend=ScCore->InputProfilesCMYK.end();
03982                             for (itP = ScCore->InputProfilesCMYK.begin(); itP != itPend; ++itP)
03983                             {
03984                                    InputP->insertItem(itP.key());
03985                                    if (itP.key() == CurItem->IProfile)
03986                                           InputP->setCurrentItem(InputP->count()-1);
03987                             }
03988                             if (!ScCore->InputProfilesCMYK.contains(CurItem->IProfile))
03989                             {
03990                                    InputP->insertItem(CurItem->IProfile);
03991                                    InputP->setCurrentItem(InputP->count()-1);
03992                             }
03993                             else
03994                             {
03995                                    if (!CurItem->EmProfile.isEmpty())
03996                                           InputP->insertItem(CurItem->EmProfile);
03997                             }
03998                      }
03999                      else
04000                      {
04001                             ProfilesL::Iterator itP;
04002                             ProfilesL::Iterator itPend=ScCore->InputProfiles.end();
04003                             for (itP = ScCore->InputProfiles.begin(); itP != itPend; ++itP)
04004                             {
04005                                    InputP->insertItem(itP.key());
04006                                    if (itP.key() == CurItem->IProfile)
04007                                           InputP->setCurrentItem(InputP->count()-1);
04008                             }
04009                             if (!ScCore->InputProfiles.contains(CurItem->IProfile))
04010                             {
04011                                    InputP->insertItem(CurItem->IProfile);
04012                                    InputP->setCurrentItem(InputP->count()-1);
04013                             }
04014                             else
04015                             {
04016                                    if (!CurItem->EmProfile.isEmpty())
04017                                           InputP->insertItem(CurItem->EmProfile);
04018                             }
04019                      }
04020                      MonitorI->setCurrentItem(CurItem->IRender);
04021               }
04022               connect(MonitorI, SIGNAL(activated(int)), this, SLOT(ChIntent()));
04023               connect(InputP, SIGNAL(activated(const QString&)), this, SLOT(ChProf(const QString&)));
04024        }
04025 }
04026 
04027 void Mpalette::ChProf(const QString& prn)
04028 {
04029        if (!m_ScMW || m_ScMW->ScriptRunning)
04030               return;
04031        /* PFJ - 29.02.04 - Moved bool into if scope */
04032        if ((HaveDoc) && (HaveItem))
04033        {
04034               CurItem->IProfile = InputP->currentText();
04035               /* PFJ - 29.02.04 - re-arranged the initialisation of EmbedP */
04036               bool EmbedP = prn.startsWith("Embedded") ? true : false;
04037               CurItem->UseEmbedded = EmbedP;
04038               doc->LoadPict(CurItem->Pfile, CurItem->ItemNr, true);
04039               m_ScMW->view->RefreshItem(CurItem);
04040        }
04041 }
04042 
04043 void Mpalette::ChIntent()
04044 {
04045        if (!m_ScMW || m_ScMW->ScriptRunning)
04046               return;
04047        if ((HaveDoc) && (HaveItem))
04048        {
04049               CurItem->IRender = MonitorI->currentItem();
04050               doc->LoadPict(CurItem->Pfile, CurItem->ItemNr, true);
04051               m_ScMW->view->RefreshItem(CurItem);
04052        }
04053 }
04054 
04055 void Mpalette::ShowCMS()
04056 {
04057        if (!m_ScMW || m_ScMW->ScriptRunning)
04058               return;
04059        if (HaveItem)
04060               updateCmsList();
04061        else
04062        {
04063               if (ScCore->haveCMS() && doc->CMSSettings.CMSinUse)
04064                      GroupBoxCM->show();
04065               else
04066                      GroupBoxCM->hide();
04067        }
04068 }
04069 
04070 void Mpalette::newTxtFill()
04071 {
04072        if ((HaveDoc) && (HaveItem))
04073        {
04074               doc->itemSelection_SetFillColor(TxFill->currentText());
04075 //            doc->currentStyle.charStyle().setFillColor(TxFill->currentText());
04076 //            emit DocChanged();
04077        }
04078 }
04079 
04080 void Mpalette::newTxtStroke()
04081 {
04082        if ((HaveDoc) && (HaveItem))
04083        {
04084               doc->itemSelection_SetStrokeColor(TxStroke->currentText());
04085 //            doc->currentStyle.charStyle().setStrokeColor(TxStroke->currentText());
04086 //            emit DocChanged();
04087        }
04088 }
04089 
04090 void Mpalette::setActShade()
04091 {
04092        if (!m_ScMW || m_ScMW->ScriptRunning)
04093               return;
04094        int b;
04095        if (PM1 == sender())
04096        {
04097               b = PM1->getValue();
04098               doc->itemSelection_SetFillShade(b);
04099 //            doc->currentStyle.charStyle().setFillShade(b);
04100        }
04101        else
04102        {
04103               b = PM2->getValue();
04104               doc->itemSelection_SetStrokeShade(b);
04105 //            doc->currentStyle.charStyle().setStrokeShade(b);
04106        }
04107 //     emit DocChanged();
04108 }
04109 
04110 void Mpalette::setActFarben(QString p, QString b, int shp, int shb)
04111 {
04112        if (!m_ScMW || m_ScMW->ScriptRunning)
04113               return;
04114        ColorList::Iterator it;
04115        int c = 0;
04116        PM2->setValue(shb);
04117        PM1->setValue(shp);
04118        if ((b != CommonStrings::None) && (!b.isEmpty()))
04119        {
04120               c++;
04121               for (it = doc->PageColors.begin(); it != doc->PageColors.end(); ++it)
04122               {
04123                      if (it.key() == b)
04124                             break;
04125                      c++;
04126               }
04127        }
04128        TxFill->setCurrentItem(c);
04129        c = 0;
04130        if ((p != CommonStrings::None) && (!p.isEmpty()))
04131        {
04132               c++;
04133               for (it = doc->PageColors.begin(); it != doc->PageColors.end(); ++it)
04134               {
04135                      if (it.key() == p)
04136                             break;
04137                      c++;
04138               }
04139        }
04140        TxStroke->setCurrentItem(c);
04141 }
04142 
04143 void Mpalette::handleLock()
04144 {
04145        if (!m_ScMW || m_ScMW->ScriptRunning)
04146               return;
04147        m_ScMW->scrActions["itemLock"]->toggle();
04148 }
04149 
04150 void Mpalette::handleLockSize()
04151 {
04152        if (!m_ScMW || m_ScMW->ScriptRunning)
04153               return;
04154        m_ScMW->scrActions["itemLockSize"]->toggle();
04155 }
04156 
04157 void Mpalette::handlePrint()
04158 {
04159        if (!m_ScMW || m_ScMW->ScriptRunning)
04160               return;
04161        m_ScMW->scrActions["itemPrintingEnabled"]->toggle();
04162 }
04163 
04164 void Mpalette::handleFlipH()
04165 {
04166        if (!m_ScMW || m_ScMW->ScriptRunning)
04167               return;
04168        m_ScMW->scrActions["itemFlipH"]->toggle();
04169        /*
04170        if ((HaveDoc) && (HaveItem))
04171        {
04172               if ((CurItem->itemType() == PageItem::ImageFrame) || (CurItem->itemType() == PageItem::TextFrame))
04173                      doc->FlipImageH();
04174               else
04175                      doc->MirrorPolyH();
04176               emit DocChanged();
04177        }
04178        */
04179 }
04180 
04181 void Mpalette::handleFlipV()
04182 {
04183        if (!m_ScMW || m_ScMW->ScriptRunning)
04184               return;
04185        m_ScMW->scrActions["itemFlipV"]->toggle();
04186        /*
04187        if ((HaveDoc) && (HaveItem))
04188        {
04189               if ((CurItem->itemType() == PageItem::ImageFrame) || (CurItem->itemType() == PageItem::TextFrame))
04190                      doc->FlipImageV();
04191               else
04192                      doc->MirrorPolyV();
04193               emit DocChanged();
04194        }
04195        */
04196 }
04197 
04198 
04199 void Mpalette::handlePathType()
04200 {
04201        if (!m_ScMW || m_ScMW->ScriptRunning)
04202               return;
04203        if ((HaveDoc) && (HaveItem))
04204        {
04205               CurItem->textPathType = pathTextType->currentItem();
04206               m_ScMW->view->RefreshItem(CurItem);
04207               emit DocChanged();
04208        }
04209 }
04210 
04211 void Mpalette::handlePathFlip()
04212 {
04213        if (!m_ScMW || m_ScMW->ScriptRunning)
04214               return;
04215        if ((HaveDoc) && (HaveItem))
04216        {
04217               CurItem->textPathFlipped = flippedPathText->isChecked();
04218               CurItem->updatePolyClip();
04219               m_ScMW->view->RefreshItem(CurItem);
04220               emit DocChanged();
04221        }
04222 }
04223 
04224 void Mpalette::handlePathLine()
04225 {
04226        if (!m_ScMW || m_ScMW->ScriptRunning)
04227               return;
04228        if ((HaveDoc) && (HaveItem))
04229        {
04230               CurItem->PoShow = showcurveCheckBox->isChecked();
04231               m_ScMW->view->RefreshItem(CurItem);
04232               emit DocChanged();
04233        }
04234 }
04235 
04236 void Mpalette::handlePathDist()
04237 {
04238        if (!m_ScMW || m_ScMW->ScriptRunning)
04239               return;
04240        if ((HaveDoc) && (HaveItem))
04241        {
04242               CurItem->setTextToFrameDistLeft(Dist->value());
04243               doc->AdjustItemSize(CurItem);
04244               CurItem->updatePolyClip();
04245               m_ScMW->view->RefreshItem(CurItem);
04246               emit DocChanged();
04247        }
04248 }
04249 
04250 void Mpalette::handlePathOffs()
04251 {
04252        if (!m_ScMW || m_ScMW->ScriptRunning)
04253               return;
04254        if ((HaveDoc) && (HaveItem))
04255        {
04256               CurItem->BaseOffs = -LineW->value();
04257               doc->AdjustItemSize(CurItem);
04258               CurItem->updatePolyClip();
04259               m_ScMW->view->RefreshItem(CurItem);
04260               emit DocChanged();
04261        }
04262 }
04263 
04264 void Mpalette::handleFillRule()
04265 {
04266        if ((HaveDoc) && (HaveItem))
04267        {
04268               CurItem->fillRule = EvenOdd->isChecked();
04269               m_ScMW->view->RefreshItem(CurItem);
04270               emit DocChanged();
04271        }
04272 }
04273 
04274 void Mpalette::handleOverprint()
04275 {
04276        if ((HaveDoc) && (HaveItem))
04277        {
04278               CurItem->doOverprint = Overprint->isChecked();
04279               m_ScMW->view->RefreshItem(CurItem);
04280               emit DocChanged();
04281        }
04282 }
04283 
04284 void Mpalette::NewName()
04285 {
04286        if (m_ScMW->ScriptRunning || !HaveDoc || !HaveItem)
04287               return;
04288        QString NameOld = CurItem->itemName();
04289        QString NameNew = NameEdit->text();
04290        if (NameNew.isEmpty())
04291        {
04292               NameEdit->setText(NameOld);
04293               return;
04294        }
04295        bool found = false;
04296        for (uint b = 0; b < doc->Items->count(); ++b)
04297        {
04298               if ((NameNew == doc->Items->at(b)->itemName()) && (doc->Items->at(b) != CurItem))
04299               {
04300                      found = true;
04301                      break;
04302               }
04303        }
04304        if (found)
04305        {
04306               QMessageBox::warning(this, CommonStrings::trWarning, "<qt>"+ tr("Name \"%1\" isn't unique.<br/>Please choose another.").arg(NameNew)+"</qt>", CommonStrings::tr_OK);
04307               NameEdit->setText(NameOld);
04308               NameEdit->setFocus();
04309        }
04310        else
04311        {
04312               if (CurItem->itemName() != NameEdit->text())
04313               {
04314                      CurItem->setItemName(NameEdit->text());
04315                      CurItem->AutoName = false;
04316                      emit DocChanged();
04317               }
04318        }
04319 }
04320 
04321 void Mpalette::fillLangCombo(QMap<QString,QString> langMap)
04322 {
04323        QStringList sortList;
04324        QMap<QString,QString>::Iterator it;
04325        if (!m_ScMW || m_ScMW->ScriptRunning)
04326               return;
04327        langCombo->clear();
04328        for (it = langMap.begin(); it != langMap.end(); ++it)
04329               sortList.push_back(it.data());
04330        langCombo->insertStringList(sortQStringList(sortList));
04331        langCombo->listBox()->setMinimumWidth(langCombo->listBox()->maxItemWidth() + 24);
04332 }
04333 
04334 void Mpalette::NewLanguage()
04335 {
04336        if ((HaveDoc) && (HaveItem))
04337        {
04338               CurItem->doc()->Language = (m_ScMW->GetLang(langCombo->currentText()));
04339               emit DocChanged();
04340        }
04341 }
04342 
04343 void Mpalette::ManageTabs()
04344 {
04345        if ((HaveDoc) && (HaveItem))
04346        {
04347               PageItem_TextFrame *i2=CurItem->asTextFrame();
04348               if (i2==0)
04349                      return;
04350               TabManager *dia = new TabManager(this, doc->unitIndex(), i2->itemText.defaultStyle().tabValues(), i2->columnWidth());
04351               if (dia->exec())
04352               {
04353                      ParagraphStyle newStyle(CurItem->itemText.defaultStyle());
04354                      newStyle.setTabValues(dia->tmpTab);
04355                      CurItem->itemText.setDefaultStyle(newStyle);
04356                      m_ScMW->view->RefreshItem(CurItem);
04357                      emit DocChanged();
04358               }
04359               delete dia;
04360        }
04361 }
04362 
04363 void Mpalette::HandleTLines()
04364 {
04365        if ((HaveDoc) && (HaveItem))
04366        {
04367               CurItem->TopLine = TopLine->isChecked();
04368               CurItem->LeftLine = LeftLine->isChecked();
04369               CurItem->RightLine = RightLine->isChecked();
04370               CurItem->BottomLine = BottomLine->isChecked();
04371               m_ScMW->view->RefreshItem(CurItem);
04372               emit DocChanged();
04373        }
04374 }
04375 
04376 void Mpalette::installSniffer(MSpinBox *spinBox)
04377 {
04378        const QObjectList* list = spinBox->children();
04379        if (list)
04380        {
04381               QObjectListIterator it(*list);
04382               QObject *obj;
04383               while ((obj = it.current()) != 0)
04384               {
04385                      ++it;
04386                      obj->installEventFilter(userActionSniffer);
04387               }
04388        }
04389 }
04390 
04391 bool Mpalette::userActionOn()
04392 {
04393        return _userActionOn;
04394 }
04395 
04396 void Mpalette::mspinboxStartUserAction()
04397 {
04398        _userActionOn = true;
04399 }
04400 
04401 void Mpalette::mspinboxFinishUserAction()
04402 {
04403        _userActionOn = false;
04404 
04405        for (uint i = 0; i < doc->m_Selection->count(); ++i)
04406               doc->m_Selection->itemAt(i)->checkChanges(true);
04407        if (m_ScMW->view->groupTransactionStarted())
04408        {
04409               UndoManager::instance()->commit();
04410               m_ScMW->view->setGroupTransactionStarted(false);
04411        }
04412 }
04413 
04414 void Mpalette::languageChange()
04415 {
04416        setCaption( tr("Properties"));
04417 
04418        TabStack->setItemLabel(idXYZItem, tr("X, Y, &Z"));
04419        TabStack->setItemLabel(idTextItem, tr("&Text"));
04420        TabStack->setItemLabel(idImageItem, tr("&Image"));
04421        TabStack->setItemLabel(idShapeItem, tr("&Shape"));
04422        TabStack->setItemLabel(idLineItem, tr("&Line"));
04423        TabStack->setItemLabel(idColorsItem, tr("&Colors"));
04424        TabStack->setItemLabel(idGroupItem, tr("&Group"));
04425 
04426        NameGroup->setTitle( tr("Name"));
04427        GeoGroup->setTitle( tr("Geometry"));
04428        xposLabel->setText( tr("&X-Pos:"));
04429        yposLabel->setText( tr("&Y-Pos:"));
04430        widthLabel->setText( tr("&Width:"));
04431        heightLabel->setText( tr("&Height:"));
04432        rotationLabel->setText( tr("&Rotation:"));
04433        basepointLabel->setText( tr("Basepoint:"));
04434        LayerGroup->setTitle( tr("Level"));
04435        SRect->setText( tr("Shape:"));
04436        EditShape->setText( tr("&Edit Shape..."));
04437        SRect2->setText( tr("Shape:"));
04438        EditShape2->setText( tr("&Edit Shape..."));
04439        TransGroup->setTitle( tr( "Transparency Settings" ));
04440        TransTxt->setText( tr( "Opacity:" ) );
04441        TransTxt2->setText( tr( "Blend Mode:" ) );
04442        blendMode->clear();
04443        blendMode->insertItem( tr("Normal"));
04444        blendMode->insertItem( tr("Darken"));
04445        blendMode->insertItem( tr("Lighten"));
04446        blendMode->insertItem( tr("Multiply"));
04447        blendMode->insertItem( tr("Screen"));
04448        blendMode->insertItem( tr("Overlay"));
04449        blendMode->insertItem( tr("Hard Light"));
04450        blendMode->insertItem( tr("Soft Light"));
04451        blendMode->insertItem( tr("Difference"));
04452        blendMode->insertItem( tr("Exclusion"));
04453        blendMode->insertItem( tr("Color Dodge"));
04454        blendMode->insertItem( tr("Color Burn"));
04455        blendMode->insertItem( tr("Hue"));
04456        blendMode->insertItem( tr("Saturation"));
04457        blendMode->insertItem( tr("Color"));
04458        rndcornersLabel->setText( tr("R&ound\nCorners:"));
04459        Distance->setTitle( tr("Distance of Text"));
04460        columnsLabel->setText( tr("Colu&mns:"));
04461        int oldcolgapLabel = colgapLabel->currentItem();
04462        colgapLabel->clear();
04463        colgapLabel->insertItem( tr("Gap:"));
04464        colgapLabel->insertItem( tr("Width:"));
04465        colgapLabel->setCurrentItem(oldcolgapLabel);
04466 //     colgapLabel->setTexts( tr("&Gap:"), tr("&Width:"));
04467        topLabel->setText( tr("To&p:"));
04468        bottomLabel->setText( tr("&Bottom:"));
04469        leftLabel->setText( tr("&Left:"));
04470        rightLabel->setText( tr("&Right:"));
04471        TabsButton->setText( tr("T&abulators..."));
04472        Distance2->setTitle( tr("Path Text Properties"));
04473        pathTextType->clear();
04474        pathTextType->insertItem( tr("Default"));
04475        pathTextType->insertItem( tr("Stair Step"));
04476        pathTextType->insertItem( tr("Skew"));
04477        flippedPathText->setText( tr("Flip Text"));
04478        showcurveCheckBox->setText( tr("Show Curve"));
04479        pathTextTypeLabel->setText( tr("Type:"));
04480        startoffsetLabel->setText( tr("Start Offset:"));
04481        distfromcurveLabel->setText( tr("Distance from Curve:"));
04482        Distance3->setTitle( tr("Fill Rule"));
04483        EvenOdd->setText( tr("Even-Odd"));
04484        NonZero->setText( tr("Non Zero"));
04485        textFlowOptions->setTitle( tr("Text &Flow Around Frame"));
04486        textFlowDisabled->setTextLabel( tr("Disabled"));
04487        textFlowUsesFrameShape->setTextLabel( tr("Use Frame &Shape"));
04488        textFlowUsesBoundingBox->setTextLabel( tr("Use &Bounding Box"));
04489        textFlowUsesContourLine->setTextLabel( tr("&Use Contour Line"));
04490        textFlowUsesImageClipping->setTextLabel( tr("Use Image Clip Path"));
04491        textFlowOptions2->setTitle( tr("Text &Flow Around Frame"));
04492        textFlowDisabled2->setTextLabel( tr("Disabled"));
04493        textFlowUsesFrameShape2->setTextLabel( tr("Use Frame &Shape"));
04494        textFlowUsesBoundingBox2->setTextLabel( tr("Use &Bounding Box"));
04495        textFlowUsesContourLine2->setTextLabel( tr("&Use Contour Line"));
04496        textFlowUsesImageClipping2->setTextLabel( tr("Use Image Clip Path"));
04497        paraStyleLabel->setText( tr("Paragraph St&yle:"));
04498        charStyleLabel->setText( tr("Character St&yle:"));
04499        optMarginLabel->setText( tr("Optical Margins:"));
04500        int c=optMarginCombo->currentItem();
04501        optMarginCombo->clear();
04502        optMarginCombo->insertItem( CommonStrings::trOpticalMarginsNone );
04503 //     Out for 1.3.4
04504 //     optMarginCombo->insertItem( CommonStrings::trOpticalMarginsLeftProtruding );
04505 //     optMarginCombo->insertItem( CommonStrings::trOpticalMarginsRightProtruding );
04506 //     optMarginCombo->insertItem( CommonStrings::trOpticalMarginsLeftHangPunct );
04507 //     optMarginCombo->insertItem( CommonStrings::trOpticalMarginsRightHangPunct );
04508        optMarginCombo->insertItem( CommonStrings::trOpticalMarginsDefault );
04509        optMarginCombo->setCurrentItem(c);
04510        wordTrackingLabel->setText( tr("Word Tracking"));
04511        minWordTrackingLabel->setText( tr("Min:"));
04512        normWordTrackingLabel->setText( tr("Norm:"));
04513        glyphExtensionLabel->setText( tr("Glyph Extension"));
04514        minGlyphExtensionLabel->setText( tr("Min:"));
04515        maxGlyphExtensionLabel->setText( tr("Max:"));
04516        FreeScale->setText( tr("&Free Scaling"));
04517        imgDPIXLabel->setText( tr("Actual X-DPI:"));
04518        imgDPIYLabel->setText( tr("Actual Y-DPI:"));
04519        xposImgLabel->setText( tr("&X-Pos:"));
04520        yposImgLabel->setText( tr("&Y-Pos:"));
04521        xscaleLabel->setText( tr("X-Sc&ale:"));
04522        yscaleLabel->setText( tr("Y-Scal&e:"));
04523        FrameScale->setText( tr("Scale &To Frame Size"));
04524        Aspect->setText( tr("P&roportional"));
04525        EditEffects->setText( tr("Image Effects"));
04526        EditPSDProps->setText( tr("Extended Image Properties"));
04527        TextCms1->setText( tr("Input Profile:"));
04528        TextCms2->setText( tr("Rendering Intent:"));
04529        lineSpacingPop->changeItem(lineSpacingPop->idAt(0), tr("Fixed Linespacing"));
04530        lineSpacingPop->changeItem(lineSpacingPop->idAt(1), tr("Automatic Linespacing"));
04531        lineSpacingPop->changeItem(lineSpacingPop->idAt(2), tr("Align to Baseline Grid"));
04532        int oldMonitorI=MonitorI->currentItem();
04533        MonitorI->clear();
04534        MonitorI->insertItem( tr("Perceptual"));
04535        MonitorI->insertItem( tr("Relative Colorimetric"));
04536        MonitorI->insertItem( tr("Saturation"));
04537        MonitorI->insertItem( tr("Absolute Colorimetric"));
04538        MonitorI->setCurrentItem(oldMonitorI);
04539        int oldLineMode=LineMode->currentItem();
04540        LineMode->clear();
04541        LineMode->insertItem( tr("Left Point"));
04542        LineMode->insertItem( tr("End Points"));
04543        LineMode->setCurrentItem(oldLineMode);
04544        LineModeT->setText( tr("&Basepoint:"));
04545        linetypeLabel->setText( tr("T&ype of Line:"));
04546        startArrowText->setText( tr("Start Arrow:"));
04547        endArrowText->setText( tr("End Arrow:"));
04548        if (HaveDoc)
04549        {
04550               int arrowItem=startArrow->currentItem();
04551               startArrow->rebuildList(&doc->arrowStyles);
04552               startArrow->setCurrentItem(arrowItem);
04553               arrowItem=endArrow->currentItem();
04554               endArrow->rebuildList(&doc->arrowStyles);
04555               endArrow->setCurrentItem(arrowItem);
04556        }
04557        linewidthLabel->setText( tr("Line &Width:"));
04558        edgesLabel->setText( tr("Ed&ges:"));
04559        int oldLJoinStyle=LJoinStyle->currentItem();
04560        LJoinStyle->clear();
04561        LJoinStyle->insertItem(loadIcon("16/stroke-join-miter.png"), tr("Miter Join"));
04562        LJoinStyle->insertItem(loadIcon("16/stroke-join-bevel.png"), tr("Bevel Join"));
04563        LJoinStyle->insertItem(loadIcon("16/stroke-join-round.png"), tr("Round Join"));
04564        LJoinStyle->setCurrentItem(oldLJoinStyle);
04565 
04566        int oldLEndStyle=LEndStyle->currentItem();
04567        LEndStyle->clear();
04568        LEndStyle->insertItem(loadIcon("16/stroke-cap-butt.png"), tr("Flat Cap"));
04569        LEndStyle->insertItem(loadIcon("16/stroke-cap-square.png"), tr("Square Cap"));
04570        LEndStyle->insertItem(loadIcon("16/stroke-cap-round.png"), tr("Round Cap"));
04571        LEndStyle->setCurrentItem(oldLEndStyle);
04572        endingsLabel->setText( tr("&Endings:"));
04573 
04574        TLines->setTitle( tr("Cell Lines"));
04575        TopLine->setText( tr("Line at Top"));
04576        LeftLine->setText( tr("Line at the Left"));
04577        RightLine->setText( tr("Line at the Right "));
04578        BottomLine->setText( tr("Line at Bottom"));
04579        
04580        OverP->setTitle( tr("Overprinting"));
04581        KnockOut->setText( tr("Knockout"));
04582        Overprint->setText( tr("Overprint"));
04583 
04584        QString pctSuffix=tr(" %");
04585        ChBase->setSuffix(pctSuffix);
04586        ChScale->setSuffix(pctSuffix);
04587        ChScaleV->setSuffix(pctSuffix);
04588        imageXScaleSpinBox->setSuffix(pctSuffix);
04589        imageYScaleSpinBox->setSuffix(pctSuffix);
04590        Extra->setSuffix(pctSuffix);
04591        minWordTrackingSpinBox->setSuffix(pctSuffix);
04592        normWordTrackingSpinBox->setSuffix(pctSuffix);
04593        minGlyphExtSpinBox->setSuffix(pctSuffix);
04594        maxGlyphExtSpinBox->setSuffix(pctSuffix);
04595        
04596        QString ptSuffix = tr(" pt");
04597        Dist->setSuffix(ptSuffix);
04598        LineW->setSuffix(ptSuffix);
04599        Size->setSuffix(ptSuffix);
04600        LineSp->setSuffix(ptSuffix);
04601 
04602        QString ein = (HaveDoc) ? unitGetSuffixFromIndex(doc->unitIndex()) : ptSuffix;
04603 
04604        LSize->setSuffix(ein);
04605        Xpos->setSuffix(ein);
04606        Ypos->setSuffix(ein);
04607        Width->setSuffix(ein);
04608        Height->setSuffix(ein);
04609        imageXOffsetSpinBox->setSuffix(ein);
04610        imageYOffsetSpinBox->setSuffix(ein);
04611        dGap->setSuffix(ein);
04612        DLeft->setSuffix(ein);
04613        DTop->setSuffix(ein);
04614        DBottom->setSuffix(ein);
04615        DRight->setSuffix(ein);
04616        RoundRect->setSuffix(ein);
04617 
04618        SeStyle->languageChange();
04619        GroupAlign->languageChange();
04620 
04621        StyledLine->changeItem( tr("No Style"), 0);
04622 //     updateCList();
04623 //     updateCmsList();
04624 
04625        QToolTip::remove(NameEdit);
04626        QToolTip::remove(Xpos);
04627        QToolTip::remove(Ypos);
04628        QToolTip::remove(Width);
04629        QToolTip::remove(Height);
04630        QToolTip::remove(Rot);
04631        QToolTip::remove(basepointLabel);
04632        QToolTip::remove(TopLeft);
04633        QToolTip::remove(TopRight);
04634        QToolTip::remove(BottomLeft);
04635        QToolTip::remove(BottomRight);
04636        QToolTip::remove(Center);
04637        QToolTip::remove(FlipH);
04638        QToolTip::remove(FlipV);
04639        QToolTip::remove(Zup);
04640        QToolTip::remove(ZDown);
04641        QToolTip::remove(ZTop);
04642        QToolTip::remove(ZBottom);
04643        QToolTip::remove(LevelTxt);
04644        QToolTip::remove(Locked);
04645        QToolTip::remove(NoResize);
04646        QToolTip::remove(NoPrint);
04647        QToolTip::remove(textFlowOptions);
04648        QToolTip::remove(textFlowDisabled);
04649        QToolTip::remove(textFlowUsesFrameShape);
04650        QToolTip::remove(textFlowUsesBoundingBox);
04651        QToolTip::remove(textFlowUsesContourLine);
04652        QToolTip::remove(textFlowUsesImageClipping);
04653        QToolTip::remove(textFlowOptions2);
04654        QToolTip::remove(textFlowDisabled2);
04655        QToolTip::remove(textFlowUsesFrameShape2);
04656        QToolTip::remove(textFlowUsesBoundingBox2);
04657        QToolTip::remove(textFlowUsesContourLine2);
04658        QToolTip::remove(textFlowUsesImageClipping2);
04659 
04660        QToolTip::remove(Fonts);
04661        QToolTip::remove(Size);
04662        QToolTip::remove(ChBase);
04663        QToolTip::remove(ChScale);
04664        QToolTip::remove(ChScaleV);
04665        QToolTip::remove(TxStroke);
04666        QToolTip::remove(TxFill);
04667        QToolTip::remove(PM1);
04668        QToolTip::remove(PM2);
04669        QToolTip::remove(Revert);
04670        QToolTip::remove(Extra);
04671        QToolTip::remove(LineSp);
04672        QToolTip::remove(linespacingButton);
04673        QToolTip::remove(paraStyleCombo);
04674        QToolTip::remove(charStyleCombo);
04675        QToolTip::remove(paraStyleClear);
04676        QToolTip::remove(charStyleClear);
04677 //     QToolTip::remove(langCombo);
04678 
04679        QToolTip::remove(minWordTrackingSpinBox);
04680        QToolTip::remove(normWordTrackingSpinBox);
04681        QToolTip::remove(minGlyphExtSpinBox);
04682        QToolTip::remove(maxGlyphExtSpinBox);
04683        QToolTip::remove(optMarginCombo);
04684        
04685        QToolTip::remove(LineMode);
04686        QToolTip::remove(LStyle);
04687        QToolTip::remove(LSize);
04688        QToolTip::remove(LJoinStyle);
04689        QToolTip::remove(LEndStyle);
04690        QToolTip::remove(StyledLine);
04691 
04692        QToolTip::remove(SCustom);
04693        QToolTip::remove(EditShape);
04694        QToolTip::remove(RoundRect);
04695        QToolTip::remove(DCol);
04696        QToolTip::remove(colgapLabel);
04697        QToolTip::remove(dGap);
04698        QToolTip::remove(DTop);
04699        QToolTip::remove(DBottom);
04700        QToolTip::remove(DLeft);
04701        QToolTip::remove(DRight);
04702        QToolTip::remove(TabsButton);
04703 
04704        QToolTip::remove(FreeScale);
04705        QToolTip::remove(imageXOffsetSpinBox);
04706        QToolTip::remove(imageYOffsetSpinBox);
04707        QToolTip::remove(imageXScaleSpinBox);
04708        QToolTip::remove(imageYScaleSpinBox);
04709        QToolTip::remove(keepImageWHRatioButton);
04710        QToolTip::remove(keepFrameWHRatioButton);
04711        QToolTip::remove(FrameScale);
04712        QToolTip::remove(Aspect);
04713        QToolTip::remove(InputP);
04714        QToolTip::remove(MonitorI);
04715 
04716        QToolTip::add(NameEdit, tr("Name of selected object"));
04717        QToolTip::add(Xpos, tr("Horizontal position of current basepoint"));
04718        QToolTip::add(Ypos, tr("Vertical position of current basepoint"));
04719        QToolTip::add(Width, tr("Width"));
04720        QToolTip::add(Height, tr("Height"));
04721        QToolTip::add(Rot, tr("Rotation of object at current basepoint"));
04722        QToolTip::add(basepointLabel, tr("Point from which measurements or rotation angles are referenced"));
04723        QToolTip::add(TopLeft, tr("Select top left for basepoint"));
04724        QToolTip::add(TopRight, tr("Select top right for basepoint"));
04725        QToolTip::add(BottomLeft, tr("Select bottom left for basepoint"));
04726        QToolTip::add(BottomRight, tr("Select bottom right for basepoint"));
04727        QToolTip::add(Center, tr("Select center for basepoint"));
04728        QToolTip::add(DoGroup, tr("Group the selected objects"));
04729        QToolTip::add(DoUnGroup, tr("Destroys the selected group"));
04730        QToolTip::add(FlipH, tr("Flip Horizontal"));
04731        QToolTip::add(FlipV, tr("Flip Vertical"));
04732        QToolTip::add(Zup, tr("Move one level up"));
04733        QToolTip::add(ZDown, tr("Move one level down"));
04734        QToolTip::add(ZTop, tr("Move to front"));
04735        QToolTip::add(ZBottom, tr("Move to back"));
04736        QToolTip::add(LevelTxt, tr("Indicates the level the object is on, 0 means the object is at the bottom"));
04737        QToolTip::add(Locked, tr("Lock or unlock the object"));
04738        QToolTip::add(NoResize, tr("Lock or unlock the size of the object"));
04739        QToolTip::add(NoPrint, tr("Enable or disable printing of the object"));
04740        /*QToolTip::add(textFlowOptions, tr("Make text in lower frames flow around the object shape")); */
04741        QToolTip::add(textFlowDisabled, tr("Disable text flow from lower frames around object"));
04742        QToolTip::add(textFlowUsesFrameShape, tr("Use the frame shape for text flow of text frames below the object."));
04743        QToolTip::add(textFlowUsesBoundingBox,  "<qt>" + tr("Use the bounding box, which is always rectangular, instead of the frame's shape for text flow of text frames below the object. ") + "</qt>" );
04744        QToolTip::add(textFlowUsesContourLine,  "<qt>" + tr("When chosen, the contour line can be edited with the Edit Shape Tool on the palette further above. When edited via the shape palette, this becomes a second separate line originally based on the frame's shape for text flow of text frames below the object. T") + "</qt>" );
04745        QToolTip::add(textFlowUsesImageClipping,  "<qt>" + tr("Use the clipping path of the image") + "</qt>" );
04746        QToolTip::add(textFlowDisabled2, tr("Disable text flow from lower frames around object"));
04747        QToolTip::add(textFlowUsesFrameShape2, tr("Use the frame shape for text flow of text frames below the object."));
04748        QToolTip::add(textFlowUsesBoundingBox2,  "<qt>" + tr("Use the bounding box, which is always rectangular, instead of the frame's shape for text flow of text frames below the object. ") + "</qt>" );
04749        QToolTip::add(textFlowUsesContourLine2,  "<qt>" + tr("When chosen, the contour line can be edited with the Edit Shape Tool on the palette further above. When edited via the shape palette, this becomes a second separate line originally based on the frame's shape for text flow of text frames below the object. T") + "</qt>" );
04750        QToolTip::add(textFlowUsesImageClipping2,  "<qt>" + tr("Use the clipping path of the image") + "</qt>" );
04751 
04752        QToolTip::add(Fonts, tr("Font of selected text or object"));
04753        QToolTip::add(Size, tr("Font Size"));
04754        QToolTip::add(ChBase, tr("Offset to baseline of characters"));
04755        QToolTip::add(ChScale, tr("Scaling width of characters"));
04756        QToolTip::add(ChScaleV, tr("Scaling height of characters"));
04757        QToolTip::add(TxStroke, "<qt>" + tr("Color of text stroke and/or drop shadow, depending which is chosen.If both are chosen, then they share the same color.") + "</qt>" );
04758        QToolTip::add(TxFill, "<qt>" + tr("Color of selected text. If Outline text decoration is enabled, this color will be the fill color. If Drop Shadow Text is enabled, then this will be the top most color.") + "</qt>" );
04759        QToolTip::add(PM1, tr("Saturation of color of text stroke"));
04760        QToolTip::add(PM2, tr("Saturation of color of text fill"));
04761        QToolTip::add(Revert, tr("Right to Left Writing"));
04762        QToolTip::add(Extra, tr("Manual Tracking"));
04763        QToolTip::add(LineSp, tr("Line Spacing"));
04764        QToolTip::add(linespacingButton, "<qt>" + tr("Click and hold down to select the line spacing mode.") + "</qt>" );
04765        QToolTip::add(paraStyleCombo, tr("Paragraph style of currently selected text or paragraph"));
04766        QToolTip::add(charStyleCombo, tr("Character style of currently selected text or paragraph"));
04767        QToolTip::add(paraStyleClear, tr("Remove Direct Paragraph Formatting"));
04768        QToolTip::add(charStyleClear, tr("Remove Direct Character Formatting"));
04769 //     QToolTip::add(langCombo, tr("Hyphenation language of frame"));
04770 
04771        QToolTip::add(minWordTrackingSpinBox, tr("Minimal width of spaces between words"));
04772        QToolTip::add(normWordTrackingSpinBox, tr("Normal width of spaces between words"));
04773        QToolTip::add(minGlyphExtSpinBox, tr("Minimal shrinkage of glyphs for justification"));
04774        QToolTip::add(maxGlyphExtSpinBox, tr("Maximal extension of glyphs for justification"));
04775        QToolTip::add(optMarginCombo, tr("Uses hanging punctuation and margin kerning to achieve nicer looking columns"));
04776 
04777        QToolTip::add(LineMode, tr("Change settings for left or end points"));
04778        QToolTip::add(LStyle, tr("Pattern of line"));
04779        QToolTip::add(LSize, tr("Thickness of line"));
04780        QToolTip::add(LJoinStyle, tr("Type of line joins"));
04781        QToolTip::add(LEndStyle, tr("Type of line end"));
04782        QToolTip::add(StyledLine, tr("Line style of current object"));
04783 
04784        QToolTip::add(SCustom, tr("Choose the shape of frame..."));
04785        QToolTip::add(EditShape, tr("Edit shape of the frame..."));
04786        QToolTip::add(RoundRect, tr("Set radius of corner rounding"));
04787        QToolTip::add(DCol, tr("Number of columns in text frame"));
04788        QToolTip::add(colgapLabel, tr("Switches between Gap or Column width"));
04789        QToolTip::add(dGap, tr("Distance between columns"));
04790        QToolTip::add(DTop, tr("Distance of text from top of frame"));
04791        QToolTip::add(DBottom, tr("Distance of text from bottom of frame"));
04792        QToolTip::add(DLeft, tr("Distance of text from left of frame"));
04793        QToolTip::add(DRight, tr("Distance of text from right of frame"));
04794        QToolTip::add(TabsButton, tr("Edit tab settings of text frame..."));
04795 
04796        QToolTip::add(FreeScale, tr("Allow the image to be a different size to the frame"));
04797        QToolTip::add(imageXOffsetSpinBox, tr("Horizontal offset of image within frame"));
04798        QToolTip::add(imageYOffsetSpinBox, tr("Vertical offset of image within frame"));
04799        QToolTip::add(imageXScaleSpinBox, tr("Resize the image horizontally"));
04800        QToolTip::add(imageYScaleSpinBox, tr("Resize the image vertically"));
04801        QToolTip::add(keepImageWHRatioButton, tr("Keep the X and Y scaling the same"));
04802        QToolTip::add(keepFrameWHRatioButton, tr("Keep the aspect ratio"));
04803        QToolTip::add(FrameScale, tr("Make the image fit within the size of the frame"));
04804        QToolTip::add(Aspect, tr("Use image proportions rather than those of the frame"));
04805        QToolTip::add(InputP, tr("Source profile of the image"));
04806        QToolTip::add(MonitorI, tr("Rendering intent for the image"));
04807 }
04808 
04809 
04810 const VGradient Mpalette::getFillGradient()
04811 {
04812        return Cpal->gradEdit->Preview->fill_gradient;
04813 }
04814 
04815 void Mpalette::setGradientEditMode(bool on)
04816 {
04817        Cpal->gradEditButton->setOn(on);
04818 }
04819 
04820 void Mpalette::updateColorSpecialGradient()
04821 {
04822        if (!HaveDoc)
04823               return;
04824        if(doc->m_Selection->isEmpty())
04825               return;
04826        double dur=doc->unitRatio();
04827        PageItem *currItem=doc->m_Selection->itemAt(0);
04828        if (currItem)
04829               Cpal->setSpecialGradient(currItem->GrStartX * dur, currItem->GrStartY * dur,
04830                                                         currItem->GrEndX * dur, currItem->GrEndY * dur);
04831 }
04832 
04833 void Mpalette::updateSpinBoxConstants()
04834 {
04835        if (!HaveDoc)
04836               return;
04837        if(doc->m_Selection->count()==0)
04838               return;
04839        Width->setConstants(doc->constants());
04840        Height->setConstants(doc->constants());
04841        Xpos->setConstants(doc->constants());
04842        Ypos->setConstants(doc->constants());
04843 }
04844 
04845 UserActionSniffer::UserActionSniffer() : QObject (this)
04846 {
04847 
04848 }
04849 
04850 bool UserActionSniffer::eventFilter(QObject*, QEvent *e)
04851 {
04852        if (e->type() == QEvent::MouseButtonPress)
04853               emit actionStart();
04854        else if (e->type() == QEvent::MouseButtonRelease)
04855               emit actionEnd();
04856        else if (e->type() == QEvent::KeyPress)
04857        {
04858               QKeyEvent *k = dynamic_cast<QKeyEvent*>(e);
04859               if (k && !k->isAutoRepeat() && (k->key() == Key_Up || k->key() == Key_Down))
04860                      emit actionStart();
04861        }
04862        else if (e->type() == QEvent::KeyRelease)
04863        {
04864               QKeyEvent *k = dynamic_cast<QKeyEvent*>(e);
04865               if (k && !k->isAutoRepeat() && (k->key() == Key_Up || k->key() == Key_Down))
04866                      emit actionEnd();
04867        }
04868        return false;
04869 }
04870 
04871 void Mpalette::setLocked(bool isLocked)
04872 {
04873        Xpos->setReadOnly(isLocked);
04874        Ypos->setReadOnly(isLocked);
04875        Width->setReadOnly(isLocked);
04876        Height->setReadOnly(isLocked);
04877        Rot->setReadOnly(isLocked);
04878        if (isLocked)
04879        {
04880               QPalette pal(qApp->palette().disabled(), qApp->palette().disabled(), qApp->palette().disabled());
04881               Xpos->setPalette(pal);
04882               Ypos->setPalette(pal);
04883               Width->setPalette(pal);
04884               Height->setPalette(pal);
04885               Rot->setPalette(pal);
04886        }
04887        else
04888        {
04889               Xpos->setPalette(qApp->palette());
04890               Ypos->setPalette(qApp->palette());
04891               Width->setPalette(qApp->palette());
04892               Height->setPalette(qApp->palette());
04893               Rot->setPalette(qApp->palette());
04894        }
04895        EditShape->setEnabled(!isLocked);
04896        LayerGroup->setEnabled(!isLocked);
04897        Locked->setOn(isLocked);
04898        if ((HaveDoc) && (HaveItem))
04899        {
04900               ShapeGroup->setEnabled(!CurItem->asLine() && !CurItem->asPolyLine() && !CurItem->asPathText() && !isLocked);
04901               if (((CurItem->asTextFrame()) || (CurItem->asImageFrame()) || (CurItem->asPolygon())) &&  (!CurItem->ClipEdited) && ((CurItem->FrameType == 0) || (CurItem->FrameType == 2)))
04902                      RoundRect->setEnabled(!isLocked);
04903               else
04904                      RoundRect->setEnabled(false);
04905        }
04906 }
04907 
04908 void Mpalette::setSizeLocked(bool isSizeLocked)
04909 {
04910        bool b=isSizeLocked;
04911        if (HaveItem && CurItem->locked())
04912               b=true;
04913        Width->setReadOnly(b);
04914        Height->setReadOnly(b);
04915        if (b)
04916        {
04917               QPalette pal(qApp->palette().disabled(), qApp->palette().disabled(), qApp->palette().disabled());
04918               Width->setPalette(pal);
04919               Height->setPalette(pal);
04920        }
04921        else
04922        {
04923               Width->setPalette(qApp->palette());
04924               Height->setPalette(qApp->palette());
04925        }
04926        NoResize->setOn(isSizeLocked);
04927 }
04928 
04929 void Mpalette::setPrintingEnabled(bool isPrintingEnabled)
04930 {
04931        NoPrint->setOn(!isPrintingEnabled);
04932 }
04933 
04934 void Mpalette::setFlippedH(bool isFlippedH)
04935 {
04936        FlipH->setOn(isFlippedH);
04937 }
04938 
04939 void Mpalette::setFlippedV(bool isFlippedV)
04940 {
04941        FlipV->setOn(isFlippedV);
04942 }
04943 
04944 void Mpalette::setGroupTransparency(int trans)
04945 {
04946        if ((HaveDoc) && (HaveItem))
04947        {
04948               CurItem->setFillTransparency(static_cast<double>(100 - trans) / 100.0);
04949               m_ScMW->view->RefreshItem(CurItem);
04950               emit DocChanged();
04951        }
04952 }
04953 
04954 void Mpalette::setGroupBlending(int blend)
04955 {
04956               CurItem->setFillBlendmode(blend);
04957               m_ScMW->view->RefreshItem(CurItem);
04958               emit DocChanged();
04959 }
04960 
04961 void Mpalette::doGrouping()
04962 {
04963        m_ScMW->GroupObj();
04964        DoGroup->setEnabled(false);
04965        DoUnGroup->setEnabled(true);
04966        setMultipleSelection(true);
04967        double gx, gy, gh, gw;
04968        doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
04969        if (TopLeft->isChecked())
04970               m_ScMW->view->RCenter = FPoint(gx, gy);
04971        if (TopRight->isChecked())
04972               m_ScMW->view->RCenter = FPoint(gx + gw, gy);
04973        if (Center->isChecked())
04974               m_ScMW->view->RCenter = FPoint(gx + gw / 2.0, gy + gh / 2.0);
04975        if (BottomLeft->isChecked())
04976               m_ScMW->view->RCenter = FPoint(gx, gy + gh);
04977        if (BottomRight->isChecked())
04978               m_ScMW->view->RCenter = FPoint(gx + gw, gy + gh);
04979        TabStack->setItemEnabled(idShapeItem, false);
04980 }
04981 
04982 void Mpalette::EditSh2()
04983 {
04984        if (!m_ScMW || m_ScMW->ScriptRunning)
04985               return;
04986        if ((HaveDoc) && (HaveItem))
04987        {
04988               doc->m_Selection->clear();
04989               doc->m_Selection->addItem(CurItem);
04990               CurItem->isSingleSel = true;
04991               m_ScMW->view->RefreshItem(CurItem);
04992               emit ShapeEdit();
04993               RoundRect->setEnabled(false);
04994        }
04995 }