bool
ElemUse::processUseAttributeSets(
			StylesheetConstructionContext&	constructionContext,
			const XalanDOMChar*				attrName,
			const AttributeListType&		atts,
			int								which)
{
	bool isUAS = false;

	if(StylesheetConstructionContext::ELEMNAME_LITERAL_RESULT == getXSLToken())
	{
		isUAS = constructionContext.isXSLUseAttributeSetsAttribute(
			attrName,
			getStylesheet(),
			getLocator());
	}
	else
	{
		isUAS = equals(attrName, Constants::ATTRNAME_USEATTRIBUTESETS);
	}

	if(isUAS == true)
	{
		m_attributeSetsNames =
			constructionContext.tokenizeQNames(
				m_attributeSetsNamesCount,
				atts.getValue(which),
				getStylesheet().getNamespaces(),
				getLocator());
		assert(m_attributeSetsNamesCount == 0 || m_attributeSetsNames != 0);
	}

	return isUAS;
}
const ElemTemplateElement*
ElemUse::getNextAttributeSet(
			StylesheetExecutionContext& executionContext) const
{
	const StylesheetRoot& theStylesheetRoot = getStylesheet().getStylesheetRoot();

	StylesheetExecutionContext::UseAttributeSetIndexes& useAttributeSetIndexes = executionContext.getUseAttributeSetIndexes();
	
	const ElemTemplateElement* attributeSet = 0;

	while (0 == attributeSet &&
		   useAttributeSetIndexes.attributeSetNameIndex < m_attributeSetsNamesCount)
	{
		attributeSet = theStylesheetRoot.getAttributeSet(
				executionContext,
				*m_attributeSetsNames[useAttributeSetIndexes.attributeSetNameIndex],
				 useAttributeSetIndexes.matchingAttributeSetIndex++,
				getLocator());

		if (0 == attributeSet)
		{

			useAttributeSetIndexes.attributeSetNameIndex++;
			useAttributeSetIndexes.matchingAttributeSetIndex = 0;
		}
	}

	return attributeSet;

}
XALAN_CPP_NAMESPACE_BEGIN



ElemExtensionCall::ElemExtensionCall(
            StylesheetConstructionContext&  constructionContext,
            Stylesheet&                     stylesheetTree,
            const XalanDOMChar*             name,
            const AttributeListType&        atts,
            int                             lineNumber,
            int                             columnNumber,
            ExtensionNSHandler&             ns) :
    ElemLiteralResult(constructionContext,
        stylesheetTree,
        name,
        atts,
        lineNumber,
        columnNumber,
        StylesheetConstructionContext::ELEMNAME_EXTENSION_CALL),
    m_qname(
        constructionContext.createXalanQName(
            name,
            getStylesheet().getNamespaces(),
            getLocator())),
    m_nsh(ns)
{
    assert(m_qname != 0);
}
Esempio n. 4
0
void IdeMailBox::onPreRender()
{
	ControlBase::onPreRender();

	getStylesheet()->setBoolParam(PARAM_SECURE, getSecure());

	if(m_message.empty())
	{
		shared_ptr<XMLNode> folder_node = getDocument()->create(_S("folder"));
		switch(m_folder)
		{
		case messageFolderInbox:		renderFolder(messageFolderInbox, folder_node);
										break;

		case messageFolderTrash:		renderFolder(messageFolderTrash, folder_node);
										break;

		case messageFolderSentItems:	renderFolder(messageFolderSentItems, folder_node);
										break;

		default:						OS_ASSERTFALSE();
										break;
		}
	}
	else
	{
		renderMessage(m_message, getDocument()->create(_S("message")));
	}
}
Esempio n. 5
0
void
ElemVariable::addToStylesheet(
			StylesheetConstructionContext&	constructionContext,
			Stylesheet&						theStylesheet)
{
	// Processing a top-level element only...
	if (&theStylesheet != &getStylesheet())
	{
		constructionContext.error(
			XalanMessageLoader::getMessage(XalanMessages::ElemVariableInstanceAddedToWrongStylesheet),
			0,
			this);
	}
	else if (getParentNodeElem() != 0)
	{
		constructionContext.error(
			XalanMessageLoader::getMessage(XalanMessages::ElemVariableInstanceIsAlreadyParented),
			0,
			this);
	}
	else
	{
		theStylesheet.setTopLevelVariable(this);

		m_isTopLevel = true;
	}
}
void SPIMB040OptionsWidget::on_cmbStylesheet_currentIndexChanged( int /*index*/ ) {
//    QString fn=ui->cmbStylesheet->itemData(index).toString();
//    QFile f(fn);
//    QString qss="";
//    if (f.open(QFile::ReadOnly)) {
//        QTextStream s(&f);
//        qss=s.readAll();
//    }
//    this->setStyleSheet(qss);

    emit styleChanged(getStyle(), getStylesheet());
}
void SPIMB040OptionsWidget::readSettings(ProgramOptions *options)
{
    QDir().mkpath(ProgramOptions::getInstance()->getHomeQFDirectory()+"/acq_templates/");
    ui->edtOptTemplatesDir->setText(options->getConfigValue("spimb040/templates_directory", ProgramOptions::getInstance()->getHomeQFDirectory()+"/acq_templates/").toString());
    ui->edtOptScriptsDir->setText(options->getConfigValue("spimb040/script_directory", ProgramOptions::getInstance()->getHomeQFDirectory()+"/acquisitionScripts/").toString());
    ui->edtOptSetupDir->setText(options->getConfigValue("spimb040/optsetup_directory", options->getGlobalConfigFileDirectory()).toString());
    ui->edtOptSetupConfigDir->setText(options->getConfigValue("spimb040/optsetup_config_directory", options->getConfigFileDirectory()+"/plugins/ext_spimb040/").toString());
    ui->edtOptSetupConfigDirReadonly->setText(options->getConfigValue("spimb040/optsetup_config_directory_readonly", options->getGlobalConfigFileDirectory()).toString());
    ui->cmbStyle->setCurrentIndex(ui->cmbStyle->findText(options->getConfigValue("spimb040/style", ProgramOptions::getInstance()->getStyle()).toString(), Qt::MatchExactly ));
    ui->cmbStylesheet->setCurrentIndex(ui->cmbStylesheet->findText(options->getConfigValue("spimb040/stylesheet", ProgramOptions::getInstance()->getStylesheet()).toString(), Qt::MatchExactly ));
    emit styleChanged(getStyle(), getStylesheet());
}
void
ElemUse::doExecute(
			StylesheetExecutionContext&		executionContext,
			bool							applyAttributeSets) const
{
	assert(m_attributeSetsNamesCount == 0 || m_attributeSetsNames != 0);

	ElemTemplateElement::execute(executionContext);

	if(applyAttributeSets == true && m_attributeSetsNamesCount > 0)
	{
		assert(canGenerateAttributes() == true);

		const StylesheetRoot&		theStylesheetRoot = getStylesheet().getStylesheetRoot();
		const LocatorType* const	theLocator = getLocator();

		for(size_type i = 0; i < m_attributeSetsNamesCount; ++i)
		{
			theStylesheetRoot.executeAttributeSet(executionContext, *m_attributeSetsNames[i], theLocator);
		}
	}
}
Esempio n. 9
0
bool
ElemLiteralResult::isAttrOK(
			const XalanDOMChar*				attrName,
			const AttributeListType&		/* atts */,
			int								/* which */,
			StylesheetConstructionContext&	constructionContext) const
{
    bool	isAttrOK = equals(attrName, DOMServices::s_XMLNamespace) ||
					   startsWith(attrName, DOMServices::s_XMLNamespaceWithSeparator);

    if(isAttrOK == false)
    {
		const XalanDOMString::size_type		len = length(attrName);
		const XalanDOMString::size_type		indexOfNSSep = indexOf(attrName, XalanUnicode::charColon);

		if(indexOfNSSep >= len)
		{
			// An empty namespace is OK.
			isAttrOK = true;
		}
		else
		{
			const StylesheetConstructionContext::GetAndReleaseCachedString	theGuard(constructionContext);

			XalanDOMString&		thePrefix = theGuard.get();

			thePrefix.assign(attrName, indexOfNSSep);

			const XalanDOMString* const		ns = getStylesheet().getNamespaceForPrefixFromStack(thePrefix);

			if (ns != 0 && equals(*ns, constructionContext.getXSLTNamespaceURI()) == false)
			{
				isAttrOK = true;
			}
		}
    }

    return isAttrOK;
}
ElemTemplate::ElemTemplate(
            StylesheetConstructionContext&  constructionContext,
            Stylesheet&                     stylesheetTree,
            const AttributeListType&        atts,
            int                             lineNumber,
            int                             columnNumber) :
    ElemTemplateElement(constructionContext,
                        stylesheetTree,
                        lineNumber,
                        columnNumber,
                        StylesheetConstructionContext::ELEMNAME_TEMPLATE),
    m_matchPattern(0),
    m_name(&s_empty),
    m_mode(&s_empty),
    m_priority(XPath::getMatchScoreValue(XPath::eMatchScoreNone))
{
    const unsigned int  nAttrs = atts.getLength();

    for(unsigned int i = 0; i < nAttrs; i++)
    {
        const XalanDOMChar* const   aname = atts.getName(i);

        if (equals(aname, Constants::ATTRNAME_MATCH))
        {
            m_matchPattern = constructionContext.createMatchPattern(getLocator(), atts.getValue(i), *this);
        }
        else if (equals(aname, Constants::ATTRNAME_NAME))
        {
            m_name = constructionContext.createXalanQName(
                        atts.getValue(i),
                        getStylesheet().getNamespaces(),
                        getLocator());

            if (m_name->isValid() == false)
            {
                error(
                    constructionContext,
                    XalanMessages::AttributeValueNotValidQName_2Param,
                    aname,
                    atts.getValue(i));
            }
        }
        else if (equals(aname, Constants::ATTRNAME_PRIORITY))
        {
            assert(atts.getValue(i) != 0);

            m_priority = DoubleSupport::toDouble(atts.getValue(i), constructionContext.getMemoryManager());
        }
        else if (equals(aname, Constants::ATTRNAME_MODE))
        {
            m_mode = constructionContext.createXalanQName(
                        atts.getValue(i),
                        getStylesheet().getNamespaces(),
                        getLocator());

            if (m_mode->isValid() == false)
            {
                error(
                    constructionContext,
                    XalanMessages::AttributeValueNotValidQName_2Param,
                    aname,
                    atts.getValue(i));
            }
        }
        else if(isAttrOK(
                    aname,
                    atts,
                    i,
                    constructionContext) == false &&
                 processSpaceAttr(
                    Constants::ELEMNAME_TEMPLATE_WITH_PREFIX_STRING.c_str(),
                    aname,
                    atts,
                    i,
                    constructionContext) == false)
        {
            error(
                constructionContext,
                XalanMessages::ElementHasIllegalAttribute_2Param,
                Constants::ELEMNAME_TEMPLATE_WITH_PREFIX_STRING.c_str(),
                aname);
        }
    }

    if(0 == m_matchPattern && m_name->isEmpty() == true)
    {
        error(
            constructionContext,
            XalanMessages::ElementRequiresEitherNameOrMatchAttribute_1Param,
            Constants::ELEMNAME_TEMPLATE_WITH_PREFIX_STRING);
    }

    assert(m_name->isEmpty() == true || m_name->isValid() == true);
    assert(m_mode->isEmpty() == true || m_mode->isValid() == true);
}
Esempio n. 11
0
void SPIMB040OptionsWidget::on_cmbStyle_currentIndexChanged( const QString & /*text*/ ) {
//    parentWidget()->setStyle(QStyleFactory::create(text));
//    parentWidget()->setPalette(parentWidget()->style()->standardPalette());
    emit styleChanged(getStyle(), getStylesheet());
}
Esempio n. 12
0
void MainPanel::init()
{
    if (!db.init())
    {
        QMessageBox error;
        error.critical(0, "Error!", "An error occured while trying to load the database.");
        exit(EXIT_FAILURE);
        return;
    }

    stack = new QStackedWidget(this);

    QString style = getStylesheet(":/Styles/Content.css");
    // Prepare UI objects for each tab
    libraryPtr = new Library(db);
    libraryPtr->setStyleSheet(style);
    browserPtr = new Browser();
    browserPtr->setStyleSheet(style);
    stack->addWidget(libraryPtr);
    stack->addWidget(browserPtr);
    stack->setCurrentWidget(libraryPtr);

    // System layout
    QHBoxLayout* systemLayout = new QHBoxLayout;
    systemLayout->setSpacing(0);
    systemLayout->setMargin(8);

    // Header spacing
    QVBoxLayout* topLayout = new QVBoxLayout;
    topLayout->setMargin(0);

    // Header layout
    QHBoxLayout* headerLayout = new QHBoxLayout;
    headerLayout->setSpacing(0);
    headerLayout->setMargin(0);

    // Window title
    QLabel* windowTitle = new QLabel(this);
    windowTitle->setObjectName("windowTitle");
    windowTitle->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    windowTitle->setMinimumWidth(175);
    windowTitle->setMaximumWidth(175);
    windowTitle->setAlignment(Qt::AlignTop);
    windowTitle->setFont(QFont("Sansation", 18));
    windowTitle->setText("Project \nASCENSION");
    windowTitle->setStyleSheet("color: #7D818C;");
    windowTitle->setAttribute(Qt::WA_TransparentForMouseEvents);

    // Post-initialization header spacing
    topLayout->addLayout(systemLayout);
    topLayout->addLayout(headerLayout);
    topLayout->addSpacing(10);

    headerLayout->addSpacing(20);
    headerLayout->addWidget(windowTitle);
    headerLayout->addSpacing(40);

    // Header tabs
    libraryTab = new TabLabel(this);
    libraryTab = g_tabFactory(libraryTab, "libraryTab", "LIBRARY");
    headerLayout->addSpacing(8);
    headerLayout->addWidget(libraryTab);
    libraryTab->setStyleSheet("font-weight: bold; color: lightgreen;");

    storeTab = new TabLabel(this);
    storeTab = g_tabFactory(storeTab, "storeTab", "  STORE");
    headerLayout->addSpacing(8);
    headerLayout->addWidget(storeTab);

    modsTab = new TabLabel(this);
    modsTab = g_tabFactory(modsTab, "modsTab", " MODS");
    headerLayout->addSpacing(8);
    headerLayout->addWidget(modsTab);

    newsTab = new TabLabel(this);
    newsTab = g_tabFactory(newsTab, "newsTab", "NEWS");
    headerLayout->addSpacing(8);
    headerLayout->addWidget(newsTab);

    browserTab = new TabLabel(this);
    browserTab = g_tabFactory(browserTab, "browserTab", "BROWSER");
    headerLayout->addSpacing(8);
    headerLayout->addWidget(browserTab);

    activeTab = libraryTab;

    headerLayout->addStretch();

    // System buttons
    systemLayout->addStretch();

    // Minimize
    QPushButton* pushButtonMinimize = new QPushButton("", this);
    pushButtonMinimize->setObjectName("pushButtonMinimize");
    systemLayout->addWidget(pushButtonMinimize);
    QObject::connect(pushButtonMinimize, SIGNAL(clicked()), this, SLOT(pushButtonMinimize()));

    // Maximize
    QPushButton* pushButtonMaximize = new QPushButton("", this);
    pushButtonMaximize->setObjectName("pushButtonMaximize");
    systemLayout->addWidget(pushButtonMaximize);
    QObject::connect(pushButtonMaximize, SIGNAL(clicked()), this, SLOT(pushButtonMaximize()));

    // Close
    QPushButton* pushButtonClose = new QPushButton("", this);
    pushButtonClose->setObjectName("pushButtonClose");
    systemLayout->addWidget(pushButtonClose);
    QObject::connect(pushButtonClose, SIGNAL(clicked()), this, SLOT(pushButtonClose()));

    // Main panel layout
    QGridLayout* mainGridLayout = new QGridLayout();
    mainGridLayout->setSpacing(0);
    mainGridLayout->setMargin(0);
    setLayout(mainGridLayout);

    // Central widget
    QWidget* centralWidget = new QWidget(this);
    centralWidget->setObjectName("centralWidget");
    centralWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

    // Main panel scroll area
    QScrollArea* scrollArea = new QScrollArea(this);
    scrollArea->setWidgetResizable(true);
    scrollArea->setObjectName("mainPanelScrollArea");
    scrollArea->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);

    // Vertical layout example
    QVBoxLayout* verticalLayout = new QVBoxLayout();
    verticalLayout->setSpacing(5);
    verticalLayout->setMargin(0);
    verticalLayout->setAlignment(Qt::AlignHCenter);
    verticalLayout->addLayout(topLayout, 1);

    verticalLayout->addWidget(stack, 4);

    // Connect signals
    connect(libraryTab, SIGNAL(clicked()), this, SLOT(setTabLibrary()));
    connect(browserTab, SIGNAL(clicked()), this, SLOT(setTabBrowser()));

    // Show
    centralWidget->setLayout(verticalLayout);
    scrollArea->setWidget(centralWidget);
    mainGridLayout->addWidget(scrollArea);
}