Example #1
0
void WTemplate::setTemplateText(const WString& text, TextFormat textFormat)
{
  text_ = text;

  if (textFormat == XHTMLText && text_.literal()) {
    if (!removeScript(text_))
      text_ = escapeText(text_, true);
  } else if (textFormat == PlainText)
    text_ = escapeText(text_, true);

  if (!text_.literal() && !text_.isLanguage())
  {
	  WLocalizedStrings *ls = 0;
	  WApplication *app = WApplication::instance();
	  if (app)
		  ls = app->localizedStrings();

	  if (!ls) {
		  WServer *server = WServer::instance();
		  if (server)
			  ls = server->localizedStrings();
	  }
	  ls->loadTemplateStyleSheet(text_.key(), text_.moduleAuthorId());
  }

  changed_ = true;
  repaint(RepaintSizeAffected);
}