Ejemplo n.º 1
0
void CTDLTransformDialog::OnChangeStylesheet() 
{
	UpdateData();

	BOOL bEnable = FileMisc::FileExists(GetStylesheet());
	GetDlgItem(IDOK)->EnableWindow(bEnable);
}
Ejemplo n.º 2
0
BOOL CTDLTransformDialog::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
    VERIFY(m_taskSel.Create(IDC_FRAME, this));

	BOOL bEnable = FileMisc::FileExists(GetStylesheet());
	GetDlgItem(IDOK)->EnableWindow(bEnable);
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Ejemplo n.º 3
0
void QmitkNodeSelectionButton::paintEvent(QPaintEvent *p)
{
  QString stylesheet;

  ctkPluginContext* context = berry::WorkbenchPlugin::GetDefault()->GetPluginContext();
  ctkServiceReference styleManagerRef = context->getServiceReference<berry::IQtStyleManager>();
  if (styleManagerRef)
  {
    auto styleManager = context->getService<berry::IQtStyleManager>(styleManagerRef);
    stylesheet = styleManager->GetStylesheet();
  }
  
  QPushButton::paintEvent(p);

  QPainter painter(this);
  QTextDocument td(this);
  td.setDefaultStyleSheet(stylesheet);

  auto widgetSize = this->size();
  QPoint origin = QPoint(5, 5);

  if (this->m_SelectedNode)
  {
    auto iconLength = widgetSize.height() - 10;
    auto node = this->m_SelectedNode;

    if (this->m_OutDatedThumpNail)
    {
      this->m_ThumpNail = GetPixmapFromImageNode(node, iconLength);
      this->m_OutDatedThumpNail = false;
    }

    painter.drawPixmap(origin, m_ThumpNail);
    origin.setX(origin.x() + iconLength + 5);

    td.setHtml(QString::fromStdString("<font class=\"normal\">"+node->GetName()+"</font>"));
  }
  else
  {
    td.setHtml(m_Info);
  }

  auto textSize = td.size();

  origin.setY( (widgetSize.height() - textSize.height()) / 2.);

  painter.translate(origin);
  td.drawContents(&painter);

}
Ejemplo n.º 4
0
#include "core/pch.h"

#ifdef XSLT_SUPPORT

#include "modules/xslt/src/xslt_xpathextensions.h"
#include "modules/xslt/src/xslt_parser.h"
#include "modules/xslt/src/xslt_stylesheet.h"
#include "modules/xslt/src/xslt_variable.h"

/* virtual */ OP_STATUS
XSLT_XPathExtensions::GetFunction (XPathFunction *&function, const XMLExpandedName &name)
{
  if (name == XMLExpandedName ((const uni_char *) 0, UNI_L ("system-property")))
    function = OP_NEW (XSLT_Functions::SystemProperty, ());
  else if (name == XMLExpandedName ((const uni_char *) 0, UNI_L ("key")))
    function = OP_NEW (XSLT_Functions::Key, (GetStylesheet ()));
  else if (name == XMLExpandedName ((const uni_char *) 0, UNI_L ("element-available")))
    function = OP_NEW (XSLT_Functions::ElementOrFunctionAvailable, (TRUE));
  else if (name == XMLExpandedName ((const uni_char *) 0, UNI_L ("function-available")))
    function = OP_NEW (XSLT_Functions::ElementOrFunctionAvailable, (FALSE));
  else if (name == XMLExpandedName ((const uni_char *) 0, UNI_L ("format-number")))
    function = OP_NEW (XSLT_Functions::FormatNumber, (GetStylesheet ()));
  else if (name == XMLExpandedName ((const uni_char *) 0, UNI_L ("current")))
    function = OP_NEW (XSLT_Functions::Current, ());
  else if (name == XMLExpandedName ((const uni_char *) 0, UNI_L ("generate-id")))
    function = OP_NEW (XSLT_Functions::GenerateID, ());
  else if (name == XMLExpandedName ((const uni_char *) 0, UNI_L ("unparsed-entity-uri")))
    function = OP_NEW (XSLT_Functions::UnparsedEntityUri, ());
  else if (name == XMLExpandedName ((const uni_char *) 0, UNI_L ("document")))
    function = OP_NEW (XSLT_Functions::Document, (element->GetBaseURL ()));
  else if (name == XMLExpandedName (UNI_L ("http://exslt.org/common"), UNI_L ("node-set")))
Ejemplo n.º 5
0
void FdoXslTransformerXalan::Transform()
{
    // Reading from a stream at EOF is a common client error.
    // Therefore trap this particular problem.
    FdoIoStreamP stream = FdoXmlReaderP(GetInDoc())->GetStream();

    FdoInt64 streamLen = stream->GetLength();

    if ( (streamLen >= 0) && (stream->GetIndex() >= streamLen) ) 
        throw FdoXmlException::Create(
            FdoException::NLSGetMessage(
                FDO_NLSID(FDO_55_XSLINPUTEOF)
            )
        );

    stream = FdoXmlReaderP(GetStylesheet())->GetStream();

    streamLen = stream->GetLength();

    if ( (streamLen >= 0) && (stream->GetIndex() >= streamLen) ) 
        throw FdoXmlException::Create(
            FdoException::NLSGetMessage(
                FDO_NLSID(FDO_56_XSLSTYLESHEETEOF)
            )
        );

    // Create the Xalan transformer
    XALAN_CPP_NAMESPACE::XalanTransformer transformer;
    // Attach the in document to it
	FdoXmlReaderP readerP = GetInDoc();
    InputSource inSource( readerP );
    // Attach the stylesheet to it.
	readerP = GetStylesheet();
	InputSource sheetSource( readerP );
    sheetSource.setSystemId((const XMLCh*) L"sheet");

    try {
        FdoDictionaryP params = GetParameters();
        FdoInt32 i;

        // Give Xalan all the parameters
        for ( i = 0; i < params->GetCount(); i++ ) {
            FdoDictionaryElementP param = params->GetItem(i);

            if ( param->GetValue() )
                transformer.setStylesheetParam( 
                    XALAN_CPP_NAMESPACE::XalanDOMString( (const char*) FdoStringP(param->GetName()) ), 
                    XALAN_CPP_NAMESPACE::XalanDOMString( (const char*) FdoStringP(param->GetValue()) )
                );
        }

        // Listen to messages, warnings, and errors:
        transformer.setProblemListener(this);

        // Do the transformation.
        if ( transformer.transform( inSource, sheetSource, (void*) this, (XalanOutputHandlerType) outputHandler, (XalanFlushHandlerType) flushHandler ) ) {
			const char* lastError = transformer.getLastError();
			size_t i = strlen ( lastError ) + 1;
			wchar_t* wstrLastError = (wchar_t*)alloca (i * sizeof (wchar_t));

//#ifdef _WIN32
//			i = MultiByteToWideChar ( CP_THREAD_ACP, 0,lastError,(int)i, wstrLastError,(int)i);
			
//#else
			i = mbstowcs (wstrLastError, lastError, i);
//#endif
			if( i == 0 )
				wstrLastError[0] = 0;
			throw FdoXmlException::Create(
                FdoException::NLSGetMessage(
                    FDO_NLSID(FDO_42_GENERICCHAR),
                    wstrLastError
                )
            );

        }
    }
    catch ( const XALAN_CPP_NAMESPACE::XSLException& ex ) {
        throw FdoXmlException::Create(
            FdoException::NLSGetMessage(
                FDO_NLSID(FDO_43_XSLERROR),
                ex.getLineNumber(),
                ex.getColumnNumber(),
                (FdoString*)XalanDomStringToUnicode(ex.getMessage())
            )
        );
    }
}