示例#1
0
int KPrGeneralProperty::getGeneralPropertyChange() const
{
    int flags = 0;

    if ( !m_generalValue.m_name.isNull() && m_generalValue.m_name != m_ui->nameInput->text() )
        flags |= Name;

    if ( m_ui->protect->state() != QButton::NoChange )
    {
        if ( ( m_ui->protect->isOn() ? STATE_ON : STATE_OFF ) != m_generalValue.m_protect )
            flags |= Protect;

        if ( !m_ui->protect->isOn() )
        {
            KoRect rect = getRect();
            if ( m_generalValue.m_rect.left() != rect.left() )
                flags |= Left;
            if ( m_generalValue.m_rect.top() != rect.top() )
                flags |= Top;
            // this has to be done as the rect cahnges width/hight if left or top is changed
            if ( QABS( m_generalValue.m_rect.width() - rect.width() ) > 1e-6 )
                flags |= Width;
            if ( QABS( m_generalValue.m_rect.height() - rect.height() ) > 1e-6 )
                flags |= Height;
        }
    }

    if ( m_ui->keepRatio->state() != QButton::NoChange
         && ( m_ui->keepRatio->isOn() ? STATE_ON : STATE_OFF ) != m_generalValue.m_keepRatio )
    {
        flags |= KeepRatio;
    }

    return flags;
}
示例#2
0
void KPrGeneralProperty::setRect( KoRect &rect )
{
    m_ui->xInput->changeValue( QMAX( 0.00, rect.left() ) );
    m_ui->yInput->changeValue( QMAX( 0.00, rect.top() ) );
    m_ui->widthInput->changeValue( QMAX( 0.00, rect.width() ) );
    m_ui->heightInput->changeValue( QMAX( 0.00, rect.height() ) );
}
示例#3
0
bool KivioStencil::isInRect(const KoRect& rect)
{
  bool retVal;
  retVal = rect.contains(m_x, m_y);
  retVal = retVal && rect.contains(m_x + m_w, m_y + m_h);

  return retVal;
}
示例#4
0
KPrDuplicatObjDia::KPrDuplicatObjDia( QWidget *parent, KPrDocument * _doc, const char *name)
    : KDialogBase( parent, name, true, "", Ok | Cancel, Ok, true )
{
    m_doc=_doc;
    KoUnit::Unit unit = m_doc->unit();

    KoRect pageRect = m_doc->masterPage()->getPageRect();

    setCaption( i18n("Duplicate Object") );

    QVBox *page = makeVBoxMainWidget();
    QLabel *lab=new QLabel(i18n("Number of copies:"), page);

    m_nbCopy = new KIntNumInput( 1, page );
    m_nbCopy->setRange( 1 , 10, 1);

    KSeparator *tmp=new KSeparator(page);
    lab=new QLabel(i18n("Rotation angle:"), page);

    m_rotation = new KDoubleNumInput( page, "customInput" );
    m_rotation->setRange(0.0, 360, 1, false);

    tmp=new KSeparator(page);

    lab=new QLabel(i18n("Increase width:"), page);
    m_increaseX= new KoUnitDoubleSpinBox( page );
    m_increaseX->setMinValue(0.0);
    m_increaseX->setMaxValue(pageRect.width());
    m_increaseX->changeValue( 1 );
    m_increaseX->setUnit(unit);

    lab=new QLabel(i18n("Increase height:"), page);
    m_increaseY= new KoUnitDoubleSpinBox( page );
    m_increaseY->setMinValue(0.0);
    m_increaseY->setMaxValue(pageRect.height());
    m_increaseY->changeValue( 1 );
    m_increaseY->setUnit(unit);

    tmp=new KSeparator(page);
    lab=new QLabel(i18n("Move X:"), page);
    m_moveX= new KoUnitDoubleSpinBox( page );
    m_moveX->setMinValue(0.0);
    m_moveX->setMaxValue(pageRect.width());
    m_moveX->changeValue( 20.0 );
    m_moveX->setUnit(unit);


    lab=new QLabel(i18n("Move Y:"), page);
    m_moveY= new KoUnitDoubleSpinBox( page );
    m_moveY->setMinValue(0.0);
    m_moveY->setMaxValue(pageRect.height());
    m_moveY->changeValue( 20.0 );
    m_moveY->setUnit(unit);

    resize( 200,100 );
}