void LLFloaterPostProcess::onLoadEffect(void* userData)
{
	LLComboBox* comboBox = static_cast<LLComboBox*>(userData);

	LLSD::String effectName(comboBox->getSelectedValue().asString());

	gPostProcess->setSelectedEffect(effectName);

	sPostProcess->syncMenu();
}
Exemplo n.º 2
0
void CMainFrame::OnAttachEffectSelectChange( NMHDR* pNMHDR, LRESULT* pResult )
{
	CString effectName(L"");
	int curSel = m_effectList->GetCurSel();
	if(curSel >= 0)
	{
		m_effectList->GetLBText(curSel, effectName);
		const std::string name = Utility::UnicodeToEngine(effectName);
		ManipulatorSystem.GetEffect().OnAttachEffectSelChange(name);
		_OnAttachmentPaneChange(TRUE, FALSE);
		m_paneAttachment->Select();
	}
	else
	{
		ManipulatorSystem.GetEffect().OnAttachEffectSelChange("");
	}
}
void LLFloaterPostProcess::onSaveEffect(void* userData)
{
	LLLineEditor* editBox = static_cast<LLLineEditor*>(userData);

	std::string effectName(editBox->getValue().asString());

	if (gPostProcess->mAllEffects.has(effectName))
	{
		LLSD payload;
		payload["effect_name"] = effectName;
		LLNotificationsUtil::add("PPSaveEffectAlert", LLSD(), payload, &LLFloaterPostProcess::saveAlertCallback);
	}
	else
	{
		gPostProcess->saveEffect(effectName);
		sPostProcess->syncMenu();
	}
}
Exemplo n.º 4
0
const QString Filterkpr2odf::createPageStyle(const KXmlElement& page)
{
    KOdfGenericStyle style(KOdfGenericStyle::DrawingPageStyle, "drawing-page");

    bool useMasterBackground = false;
    if (page.nodeName() == "PAGE") {
        KXmlElement backMaster = page.namedItem("BACKMASTER").toElement();
        if (!backMaster.isNull()) {
            style.addProperty("presentation:background-visible", backMaster.attribute("displayBackground", "1") == "1");
            style.addProperty("presentation:background-objects-visible", backMaster.attribute("displayMasterPageObject", "1") == "1");
            useMasterBackground = backMaster.attribute("useMasterBackground", "0") == "1";
        } else {
            //if BACKMASTER is not found we assume it's true
            style.addProperty("presentation:background-visible", true);
            style.addProperty("presentation:background-objects-visible", true);
            style.addProperty("draw:fill", "none");
        }
    }

    style.setAutoStyleInStylesDotXml(m_sticky);

    if (!page.hasChildNodes()) { //we check if this is an empty page
        return m_styles.insert(style, "dp");
    }

    if (!useMasterBackground) {
        //it is not an empty page let's keep loading
        KXmlElement backType = page.namedItem("BACKTYPE").toElement();
        if (backType.isNull() || backType.attribute("value") == "0") {
            //it's some form of color, plain or a gradient
            KXmlElement bcType = page.namedItem("BCTYPE").toElement();
            if (bcType.isNull() || bcType.attribute("value") == "0") {
                //background is a plain color
                QString color = page.namedItem("BACKCOLOR1").toElement().attribute("color");
                //if the backcolor is not present it's implicitally white
                //unless a draw:fill is found, in which case even though a
                //draw:fill-color is not present it's black in SCesenter2.0
                style.addProperty("draw:fill", "solid");
                style.addProperty("draw:fill-color", page.namedItem("BACKCOLOR1").toElement().attribute("color", "#ffffff"));
            } else {
                //background is a gradient
                style.addProperty("draw:fill", "gradient");
                style.addProperty("draw:fill-gradient-name", createGradientStyle(page));
            }
        } else {
            //it's a picture instead
            QString pictureName = getPictureNameFromKey(page.namedItem("BACKPICTUREKEY").toElement());
            KXmlElement backView = page.namedItem("BACKVIEW").toElement();
            style.addProperty("draw:fill", "bitmap");

            //The image is specified by a draw:fill-image style in draw:fill-image-name
            KOdfGenericStyle drawFillImage(KOdfGenericStyle::FillImageStyle);

            //default values
            drawFillImage.addAttribute("xlink:href", "Pictures/" + m_pictures[ pictureName ]);
            drawFillImage.addAttribute("xlink:type", "simple");
            drawFillImage.addAttribute("xlink:show", "embed");
            drawFillImage.addAttribute("xlink:actuate", "onLoad");
            QString repeat;
            if (backView.isNull()) {
                //the picture is just centered
                repeat = "no-repeat";
            } else if (backView.attribute("value") == "0") {
                //the picture is stretched
                repeat = "stretch";
            } else if (backView.attribute("value") == "2") {
                //picture is in mosaic
                repeat = "repeat";
            }
            style.addProperty("style:repeat", repeat);

            style.addProperty("draw:fill-image-name", m_styles.insert(drawFillImage, "picture"));
        }
    }

    //Add the duration of the page effect
    KXmlElement pageDuration = page.namedItem("PGTIMER").toElement();
    if (!pageDuration.isNull()) {
        QTime time;
        time = time.addSecs(pageDuration.attribute("timer", "0").toInt());
        style.addProperty("presentation:duration", time.toString("'PT'hh'H'mm'M'ss'S'"));
        style.addProperty("presentation:transition-type", "automatic");
    }

    //Add the page effect
    //Enum: PageEffect
    KXmlElement pageEffect = page.namedItem("PGEFFECT").toElement();
    if (!pageEffect.isNull()) {
        QString effectName("none");  //we default to none
        int effect = pageEffect.attribute("value", "0").toInt();
        switch (effect) {
        case -1: //PEF_RANDOM
            effectName = "random";
            break;
        case 0: //PEF_NONE
            effectName = "none";
            break;
        case 1: //PEF_CLOSE_HORZ
            effectName = "close-horizontal";
            break;
        case 2: //PEF_CLOSE_VERT
            effectName = "close-vertical";
            break;
        case 3: //PEF_CLOSE_ALL
            effectName = "close";
            break;
        case 4: //PEF_OPEN_HORZ
            effectName = "open-horizontal";
            break;
        case 5: //PEF_OPEN VERT
            effectName = "open-vertical";
            break;
        case 6: //PEF_OPEN_ALL
            effectName = "open";
            break;
        case 7: //PEF_INTERLOCKING_HORZ_1
            effectName = "interlocking-horizontal-left";
            break;
        case 8: //PEF_INTERLOCKING_HORZ_2
            effectName = "interlocking-horizontal-right";
            break;
        case 9: //PEF_INTERLOCKING_VERT_1
            effectName = "interlocking-vertical-up";
            break;
        case 10: //PEF_INTERLOCKING_VERT_2
            effectName = "interlocking-vertical-bottom";
            break;
        case 11: //PEF_SURROUND1
            effectName = "spiralin-left";
            break;
        case 12: //PEF_FLY1
            effectName = "fly-away";
            break;
        case 13: //PEF_BLINDS_HOR
            effectName = "horizontal-stripes";
            break;
        case 14: //PEF_BLINDS_VER
            effectName = "vertical-stripes";
            break;
        case 15: //PEF_BOX_IN
            effectName = "fade-to-center";
            break;
        case 16: //PEF_BOX_OUT
            effectName = "fade-from-center";
            break;
        case 17: //PEF_CHECKBOARD_ACROSS
            effectName = "horizontal-checkerboard";
            break;
        case 18: //PEF_CHECKBOARD_DOWN
            effectName = "vertical-checkerboard";
            break;
        case 19: //PEF_COVER_DOWN
            effectName = "fade-from-top";
            break;
        case 20: //PEF_UNCOVER_DOWN
            effectName = "uncover-to-bottom";
            break;
        case 21: //PEF_COVER_UP
            effectName = "fade-from-bottom";
            break;
        case 22: //PEF_UNCOVER_UP
            effectName = "uncover-to-top";
            break;
        case 23: //PEF_COVER_LEFT
            effectName = "fade-from-right";
            break;
        case 24: //PEF_UNCOVER_LEFT
            effectName = "uncover-to-left";
            break;
        case 25: //PEF_COVER_RIGHT
            effectName = "fade-from-left";
            break;
        case 26: //PEF_UNCOVER_RIGHT
            effectName = "uncover-to-right";
            break;
        case 27: //PEF_COVER_LEFT_UP
            effectName = "fade-from-lowerright";
            break;
        case 28: //PEF_UNCOVER_LEFT_UP
            effectName = "uncover-to-upperleft";
            break;
        case 29: //PEF_COVER_LEFT_DOWN
            effectName = "fade-from-upperrigh";
            break;
        case 30: //PEF_UNCOVER_LEFT_DOWN
            effectName = "uncover-to-lowerleft";
            break;
        case 31: //PEF_COVER_RIGHT_UP
            effectName = "fade-from-lowerleft";
            break;
        case 32: //PEF_UNCOVER_RIGHT_UP
            effectName = "uncover-to-upperright";
            break;
        case 33: //PEF_COVER_RIGHT_DOWN
            effectName = "fade-from-upperleft";
            break;
        case 34: //PEF_UNCOVER_RIGHT_DOWN
            effectName = "fade-from-lowerleft";
            break;
        case 35: //PEF_DISSOLVE
            effectName = "dissolve";
            break;
        case 36: //PEF_STRIPS_LEFT_UP
            effectName = "fade-from-lowerright";
            break;
        case 37: //PEF_STRIPS_LEFT_DOWN
            effectName = "fade-from-upperright";
            break;
        case 38: //PEF_STRIPS_RIGHT_UP
            effectName = "fade-from-lowerleft";
            break;
        case 39: //PEF_STRIPS_RIGHT_DOWN
            effectName = "fade-from-upperleft";
            break;
        case 40: //PEF_MELTING
            effectName = "melt";
            break;
        }//switch efect
        style.addProperty("presentation:transition-style", effectName);

        //Add the sound
        KXmlElement soundEffect = page.namedItem("PGSOUNDEFFECT").toElement();
        if (!soundEffect.isNull() && soundEffect.attribute("soundEffect") != "0") {
            //As this is a "complex" tag we add it "manually"
            QBuffer buffer;
            buffer.open(QIODevice::WriteOnly);
            KXmlWriter elementWriter(&buffer);
//          FIXME:   elementWriter.startElement( "style:presentation-properties" );
            elementWriter.startElement("presentation:sound");
            elementWriter.addAttribute("xlink:href", "Sounds/" + m_sounds[ soundEffect.attribute("soundFileName")]);
            elementWriter.addAttribute("xlink:type", "simple");
            elementWriter.addAttribute("xlink:show", "new");
            elementWriter.addAttribute("xlink:actuate", "onRequest");
            elementWriter.endElement();//presentation:sound
//             elementWriter.endElement();//style:presentation-properties

            QString elementContents = QString::fromUtf8(buffer.buffer(), buffer.buffer().size());
            style.addChildElement("presentationSound", elementContents);
        }
    }//if pageEfect is null
    return m_styles.insert(style, "dp");
}