]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
The class addition.
authornds <nds@opencascade.com>
Fri, 21 Sep 2007 12:38:30 +0000 (12:38 +0000)
committernds <nds@opencascade.com>
Fri, 21 Sep 2007 12:38:30 +0000 (12:38 +0000)
16 files changed:
src/HTMLService/HTMLService.hxx [new file with mode: 0755]
src/HTMLService/HTMLService.pro [new file with mode: 0755]
src/HTMLService/HTMLService_HTML.cxx [new file with mode: 0755]
src/HTMLService/HTMLService_HTML.hxx [new file with mode: 0755]
src/HTMLService/HTMLService_HTMLImage.cxx [new file with mode: 0755]
src/HTMLService/HTMLService_HTMLImage.hxx [new file with mode: 0755]
src/HTMLService/HTMLService_HTMLParagraph.cxx [new file with mode: 0755]
src/HTMLService/HTMLService_HTMLParagraph.hxx [new file with mode: 0755]
src/HTMLService/HTMLService_HTMLTable.cxx [new file with mode: 0755]
src/HTMLService/HTMLService_HTMLTable.hxx [new file with mode: 0755]
src/HTMLService/HTMLService_HTMLTableCell.cxx [new file with mode: 0755]
src/HTMLService/HTMLService_HTMLTableCell.hxx [new file with mode: 0755]
src/HTMLService/HTMLService_HTMLTableRow.cxx [new file with mode: 0755]
src/HTMLService/HTMLService_HTMLTableRow.hxx [new file with mode: 0755]
src/HTMLService/HTMLService_HTMLText.cxx [new file with mode: 0755]
src/HTMLService/HTMLService_HTMLText.hxx [new file with mode: 0755]

diff --git a/src/HTMLService/HTMLService.hxx b/src/HTMLService/HTMLService.hxx
new file mode 100755 (executable)
index 0000000..a5bd3b2
--- /dev/null
@@ -0,0 +1,56 @@
+// Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+// 
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either 
+// version 2.1 of the License.
+// 
+// This library is distributed in the hope that it will be useful 
+// but WITHOUT ANY WARRANTY; without even the implied warranty of 
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public  
+// License along with this library; if not, write to the Free Software 
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+#ifndef HTMLSERVICE_H
+#define HTMLSERVICE_H
+
+#if defined HTMLSERVICE_EXPORTS
+#if defined WIN32
+#define HTMLSERVICE_EXPORT             __declspec( dllexport )
+#else
+#define HTMLSERVICE_EXPORT
+#endif
+#else
+#if defined WIN32
+#define HTMLSERVICE_EXPORT             __declspec( dllimport )
+#else
+#define HTMLSERVICE_EXPORT
+#endif
+#endif
+
+#if defined SOLARIS
+#define bool  int
+#define false 0
+#define true  1
+#endif
+
+#if defined WIN32
+#pragma warning ( disable: 4251 )
+#endif
+
+#if defined ( _DEBUG ) || defined ( DEBUG )
+#include <assert.h>
+#define HTMLSERVICE_VERIFY(x)                          (assert(x))
+#define HTMLSERVICE_ASSERT(x)              (assert(x))
+#else
+#define HTMLSERVICE_VERIFY(x)                          (x)
+#define HTMLSERVICE_ASSERT(x)
+#endif
+
+
+#endif
diff --git a/src/HTMLService/HTMLService.pro b/src/HTMLService/HTMLService.pro
new file mode 100755 (executable)
index 0000000..1bb6e33
--- /dev/null
@@ -0,0 +1,30 @@
+TEMPLATE = lib
+
+DESTDIR = ../../$(CONFIG_ID)/lib
+MOC_DIR = ../../moc
+OBJECTS_DIR = ../../$(CONFIG_ID)/obj/$$TARGET
+
+CASROOT = $$(CASROOT)
+CAS_CPPFLAGS = $${CASROOT}/inc
+
+CAS_KERNEL = -L$${CASROOT}/Linux/lib -lTKernel
+
+CAS_VIEWER = -L$${CASROOT}/Linux/lib -lTKV3d -lTKService
+
+INCLUDEPATH += ../../include  $${CAS_CPPFLAGS}
+LIBS += -L../../$(CONFIG_ID)/lib $${CAS_KERNEL} $${CAS_VIEWER}
+
+CONFIG -= debug release debug_and_release
+CONFIG += qt thread debug dll shared
+
+win32:DEFINES += WIN32 
+DEFINES += HTMLSERVICE_EXPORTS OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS
+
+HEADERS  = *.hxx
+
+SOURCES  = *.cxx
+
+includes.files = $$HEADERS
+includes.path = ../../include
+
+INSTALLS += includes
diff --git a/src/HTMLService/HTMLService_HTML.cxx b/src/HTMLService/HTMLService_HTML.cxx
new file mode 100755 (executable)
index 0000000..70b4773
--- /dev/null
@@ -0,0 +1,279 @@
+// File:      HTMLService_HTML.cxx\r
+// Created:   12.10.2006\r
+// Author:    Sergey TELKOV\r
+// Copyright (C) AREVA NP 2006\r
+\r
+#include <HTMLService_HTML.hxx>\r
+\r
+#include <Quantity_Color.hxx>\r
+\r
+#include <OSD_File.hxx>\r
+#include <OSD_Protection.hxx>\r
+#include <Standard_TypeDef.hxx>\r
+#include <Standard_ExtCharacter.hxx>\r
+\r
+IMPLEMENT_STANDARD_HANDLE(HTMLService_HTML, MMgt_TShared)\r
+IMPLEMENT_STANDARD_RTTIEXT(HTMLService_HTML, MMgt_TShared)\r
+\r
+HTMLService_HTML::HTMLService_HTML()\r
+: myVisible( Standard_True )\r
+{\r
+}\r
+\r
+HTMLService_HTML::HTMLService_HTML( const Handle(HTMLService_HTML)& parent )\r
+: myVisible( Standard_True )\r
+{\r
+  if ( !parent.IsNull() )\r
+    parent->InsertSubItem( this );\r
+}\r
+\r
+HTMLService_HTML::~HTMLService_HTML()\r
+{\r
+}\r
+\r
+TCollection_ExtendedString HTMLService_HTML::GetTitle() const\r
+{\r
+  return myTitle;\r
+}\r
+\r
+void HTMLService_HTML::SetTitle( const TCollection_ExtendedString& title )\r
+{\r
+  myTitle = title;\r
+}\r
+\r
+Standard_Boolean HTMLService_HTML::GenerateFile( const TCollection_ExtendedString& aFileName,\r
+                                              const Standard_Boolean fullDoc ) const\r
+{\r
+  if ( !aFileName.Length() )\r
+    return Standard_False;\r
+\r
+  TCollection_AsciiString aFName( aFileName );\r
+  OSD_File aFile( aFName );\r
+  aFile.Build( OSD_WriteOnly, OSD_Protection() );\r
+  if ( !aFile.IsOpen() )\r
+    return Standard_False;\r
+\r
+  SequenceOfHTMLLine aHTML = GenerateText( fullDoc );\r
+\r
+  TCollection_AsciiString endL( "\n" );\r
+  for ( Standard_Integer i = 1; i <= aHTML.Length(); i++ )\r
+  {\r
+    TCollection_ExtendedString aLine = aHTML.Value( i );\r
+    TCollection_AsciiString aAsciiLine;\r
+    if ( aLine.IsAscii() )\r
+      aAsciiLine = TCollection_AsciiString( aLine );\r
+    else\r
+    {\r
+      for ( Standard_Integer j = 1; j <= aLine.Length(); j++ )\r
+      {\r
+        Standard_ExtCharacter curExt = aLine.Value(j);\r
+        if ( IsAnAscii( curExt ) )\r
+          aAsciiLine += TCollection_AsciiString( ToCharacter( curExt ) );\r
+        else\r
+        {\r
+          char buf[256];\r
+          sprintf( buf, "&#%d;", curExt );\r
+          aAsciiLine+= TCollection_AsciiString( buf );\r
+        }\r
+      }\r
+    }\r
+    aFile.Write( aAsciiLine, aAsciiLine.Length() );\r
+    aFile.Write( endL, 1 );\r
+  }\r
+  aFile.Close();\r
+\r
+  return Standard_True;\r
+}\r
+\r
+SequenceOfHTMLLine HTMLService_HTML::GenerateText( const Standard_Boolean fullDoc ) const\r
+{\r
+  SequenceOfHTMLLine aHTML;\r
+\r
+  if ( fullDoc )\r
+    BeginDocument( aHTML );\r
+\r
+  SequenceOfHTMLLine aBody;\r
+  Generate( aBody );\r
+  if ( fullDoc )\r
+    AppendIndent( aBody );\r
+\r
+  for ( Standard_Integer i = 1; i <= aBody.Length(); i++ )\r
+    aHTML.Append( aBody.Value( i ) );\r
+\r
+  if ( fullDoc )\r
+    EndDocument( aHTML );\r
+\r
+  return aHTML;\r
+}\r
+\r
+Standard_Boolean HTMLService_HTML::IsVisible() const\r
+{\r
+  return myVisible;\r
+}\r
+\r
+void HTMLService_HTML::SetVisible( const Standard_Boolean vis )\r
+{\r
+  myVisible = vis;\r
+}\r
+\r
+void HTMLService_HTML::SubItemsHTML( SequenceOfHTMLLine& theHTML ) const\r
+{\r
+  for ( Standard_Integer i = 1; i <= mySubItems.Length(); i++ )\r
+  {\r
+    Handle(HTMLService_HTML) item = mySubItems.Value( i );\r
+    if ( !item->IsVisible() )\r
+      continue;\r
+\r
+    SequenceOfHTMLLine aLines;\r
+    item->Generate( aLines );\r
+    AppendIndent( aLines );\r
+    Concatenate( theHTML, aLines );\r
+  }\r
+}\r
+\r
+void HTMLService_HTML::AppendIndent( SequenceOfHTMLLine& aHTML ) const\r
+{\r
+  for ( Standard_Integer i = 1; i <= aHTML.Length(); i++ )\r
+    AppendIndent( aHTML.ChangeValue( i ) );\r
+}\r
+\r
+void HTMLService_HTML::AppendIndent( TCollection_ExtendedString& aLine ) const\r
+{\r
+  Standard_Integer ident = 2;\r
+  TCollection_ExtendedString identString( ident, ' ' );\r
+  aLine.Insert( 1, identString );\r
+}\r
+\r
+void HTMLService_HTML::Concatenate( SequenceOfHTMLLine& aTrg, const SequenceOfHTMLLine& aSrc ) const\r
+{\r
+  for ( Standard_Integer i = 1; i <= aSrc.Length(); i++ )\r
+    aTrg.Append( aSrc.Value( i ) );\r
+}\r
+\r
+void HTMLService_HTML::BeginDocument( SequenceOfHTMLLine& theHTML ) const\r
+{\r
+  theHTML.Append( "<html>" );\r
+  theHTML.Append( "<head>" );\r
+  theHTML.Append( TCollection_ExtendedString( "<title>" ) + GetTitle() + TCollection_ExtendedString( "</title>" ) );\r
+  theHTML.Append( "</head>" );\r
+  theHTML.Append( "<body>" );\r
+}\r
+\r
+void HTMLService_HTML::EndDocument( SequenceOfHTMLLine& theHTML ) const\r
+{\r
+  theHTML.Append( "</body>" );\r
+  theHTML.Append( "</html>" );\r
+}\r
+\r
+void HTMLService_HTML::InsertSubItem( const Handle(HTMLService_HTML)& item )\r
+{\r
+  if ( item.IsNull() )\r
+    return;\r
+\r
+  Standard_Boolean found = Standard_False;\r
+  for ( Standard_Integer i = 1; i <= mySubItems.Length() && !found; i++ )\r
+    found = mySubItems.Value( i ) == item;\r
+\r
+  if ( !found )\r
+    mySubItems.Append( item );\r
+}\r
+\r
+void HTMLService_HTML::RemoveSubItem( const Handle(HTMLService_HTML)& item )\r
+{\r
+  if ( item.IsNull() )\r
+    return;\r
+\r
+  Standard_Integer idx = -1;\r
+  for ( Standard_Integer i = 1; i <= mySubItems.Length() && idx == -1; i++ )\r
+  {\r
+    if ( mySubItems.Value( i ) == item )\r
+      idx = i;\r
+  }\r
+\r
+  if ( idx != -1 )\r
+    mySubItems.Remove( idx );\r
+}\r
+\r
+void HTMLService_HTML::ClearSubItems()\r
+{\r
+  mySubItems.Clear();\r
+}\r
+\r
+TCollection_ExtendedString HTMLService_HTML::ColorString( const Quantity_Color& c )\r
+{\r
+  Standard_Integer r = (Standard_Integer)( c.Red() * 255 );\r
+  Standard_Integer g = (Standard_Integer)( c.Green() * 255 );\r
+  Standard_Integer b = (Standard_Integer)( c.Blue() * 255 );\r
+\r
+  char buf[255];\r
+  sprintf( buf, "#%02X%02X%02X", r, g, b );\r
+  return TCollection_ExtendedString( buf );\r
+}\r
+\r
+TCollection_ExtendedString HTMLService_HTML::AlignString( const Standard_Integer flags )\r
+{\r
+  TCollection_ExtendedString hRes;\r
+  switch ( flags & HAlignment )\r
+  {\r
+  case Left:\r
+    hRes = TCollection_ExtendedString( "left" );\r
+    break;\r
+  case Right:\r
+    hRes = TCollection_ExtendedString( "right" );\r
+    break;\r
+  case Center:\r
+    hRes = TCollection_ExtendedString( "center" );\r
+    break;\r
+  }\r
+\r
+  if ( hRes.Length() )\r
+    hRes = TCollection_ExtendedString( "align=" ) + hRes;\r
+\r
+  TCollection_ExtendedString vRes;\r
+  switch ( flags & VAlignment )\r
+  {\r
+  case Top:\r
+    vRes = TCollection_ExtendedString( "top" );\r
+    break;\r
+  case Bottom:\r
+    vRes = TCollection_ExtendedString( "bottom" );\r
+    break;\r
+  case Middle:\r
+    vRes = TCollection_ExtendedString( "middle" );\r
+    break;\r
+  }\r
+\r
+  if ( vRes.Length() )\r
+    vRes = TCollection_ExtendedString( "valign=" ) + hRes;\r
+\r
+  TCollection_ExtendedString res;\r
+  if ( hRes.Length() )\r
+    res += hRes;\r
+  if ( vRes.Length() )\r
+  {\r
+    if ( res.Length() )\r
+      res += TCollection_ExtendedString( " " );\r
+    res += vRes;\r
+  }\r
+\r
+  return res;\r
+}\r
+\r
+TCollection_ExtendedString HTMLService_HTML::EncloseToTag( const TCollection_ExtendedString& txt,\r
+                                                        const TCollection_ExtendedString& tag,\r
+                                                        const TCollection_ExtendedString& attribs ) const\r
+{\r
+  TCollection_ExtendedString res;\r
+  if ( tag.Length() )\r
+  {\r
+    res = TCollection_ExtendedString ( "<" ) + tag;\r
+    if ( attribs.Length() )\r
+      res += TCollection_ExtendedString( " " ) + attribs;\r
+    res += TCollection_ExtendedString( ">" ) + txt + TCollection_ExtendedString( "</" ) +\r
+           tag + TCollection_ExtendedString( ">" );\r
+  }\r
+  else\r
+    res = txt;\r
+\r
+  return res;\r
+}\r
diff --git a/src/HTMLService/HTMLService_HTML.hxx b/src/HTMLService/HTMLService_HTML.hxx
new file mode 100755 (executable)
index 0000000..083e6ef
--- /dev/null
@@ -0,0 +1,84 @@
+// File:      HTMLService_HTML.hxx\r
+// Created:   12.10.2006\r
+// Author:    Sergey TELKOV\r
+// Copyright (C) AREVA NP 2006\r
+\r
+#ifndef HTMLSERVICE_HTML_H\r
+#define HTMLSERVICE_HTML_H\r
+\r
+#include <HTMLService.hxx>\r
+\r
+#include <MMgt_TShared.hxx>\r
+#include <Standard_DefineHandle.hxx>\r
+\r
+#include <NCollection_Sequence.hxx>\r
+#include <TCollection_ExtendedString.hxx>\r
+\r
+class Quantity_Color;\r
+class Handle(HTMLService_HTML);\r
+\r
+typedef NCollection_Sequence<TCollection_ExtendedString> SequenceOfHTMLLine;\r
+\r
+/*!\r
+  Class HTMLService_HTML. Base class for HTML generation.\r
+*/\r
+\r
+class HTMLSERVICE_EXPORT HTMLService_HTML : public MMgt_TShared\r
+{\r
+public:\r
+  enum { Left = 0x01, Right = 0x02, Center = 0x04,\r
+         Top = 0x08, Bottom = 0x10, Middle = 0x20,\r
+         HAlignment = Left | Right | Center, VAlignment = Top | Bottom | Middle } AlignmentFlags;\r
+\r
+public:\r
+  Standard_EXPORT HTMLService_HTML();\r
+  Standard_EXPORT HTMLService_HTML( const Handle(HTMLService_HTML)& );\r
+  Standard_EXPORT ~HTMLService_HTML();\r
+\r
+  Standard_EXPORT TCollection_ExtendedString GetTitle() const;\r
+  Standard_EXPORT void                       SetTitle( const TCollection_ExtendedString& );\r
+\r
+  Standard_EXPORT Standard_Boolean   GenerateFile( const TCollection_ExtendedString&,\r
+                                                   const Standard_Boolean = Standard_False ) const;\r
+  Standard_EXPORT SequenceOfHTMLLine GenerateText( const Standard_Boolean = Standard_False ) const;\r
+\r
+  Standard_EXPORT static TCollection_ExtendedString ColorString( const Quantity_Color& );\r
+  Standard_EXPORT static TCollection_ExtendedString AlignString( const Standard_Integer );\r
+\r
+  Standard_EXPORT Standard_Boolean   IsVisible() const;\r
+  Standard_EXPORT void               SetVisible( const Standard_Boolean );\r
+\r
+protected:\r
+  Standard_EXPORT virtual void       Generate( SequenceOfHTMLLine& ) const = 0;\r
+  Standard_EXPORT virtual void       SubItemsHTML( SequenceOfHTMLLine& ) const;\r
+\r
+  Standard_EXPORT TCollection_ExtendedString EncloseToTag( const TCollection_ExtendedString&, const TCollection_ExtendedString&,\r
+                                                           const TCollection_ExtendedString& = TCollection_ExtendedString() ) const;\r
+\r
+  Standard_EXPORT void               ClearSubItems();\r
+  Standard_EXPORT void               InsertSubItem( const Handle(HTMLService_HTML)& );\r
+  Standard_EXPORT void               RemoveSubItem( const Handle(HTMLService_HTML)& );\r
+\r
+  void                               AppendIndent( SequenceOfHTMLLine& ) const;\r
+  void                               AppendIndent( TCollection_ExtendedString& ) const;\r
+  void                               Concatenate( SequenceOfHTMLLine&, const SequenceOfHTMLLine& ) const;\r
+\r
+private:\r
+  void                               BeginDocument( SequenceOfHTMLLine& ) const;\r
+  void                               EndDocument( SequenceOfHTMLLine& ) const;\r
+\r
+private:\r
+  typedef NCollection_Sequence<Handle(HTMLService_HTML)> HTMLSequence;\r
+\r
+private:\r
+  TCollection_ExtendedString         myTitle;\r
+  Standard_Boolean                   myVisible;\r
+  HTMLSequence                       mySubItems;\r
+\r
+public:\r
+  DEFINE_STANDARD_RTTI(HTMLService_HTML)\r
+};\r
+\r
+DEFINE_STANDARD_HANDLE(HTMLService_HTML, MMgt_TShared)\r
+\r
+#endif\r
diff --git a/src/HTMLService/HTMLService_HTMLImage.cxx b/src/HTMLService/HTMLService_HTMLImage.cxx
new file mode 100755 (executable)
index 0000000..b379832
--- /dev/null
@@ -0,0 +1,123 @@
+// File:      HTMLService_HTMLImage.cxx\r
+// Created:   13.10.2006\r
+// Author:    Sergey TELKOV\r
+// Copyright (C) AREVA NP 2006\r
+\r
+#include <HTMLService_HTMLImage.hxx>\r
+\r
+IMPLEMENT_STANDARD_HANDLE(HTMLService_HTMLImage, HTMLService_HTML)\r
+IMPLEMENT_STANDARD_RTTIEXT(HTMLService_HTMLImage, HTMLService_HTML)\r
+\r
+HTMLService_HTMLImage::HTMLService_HTMLImage( const TCollection_ExtendedString& img )\r
+: HTMLService_HTML(),\r
+myAlign( -1 ),\r
+myWidth( -1 ),\r
+myHeight( -1 ),\r
+mySource( img ),\r
+mySrcProto( SP_File )\r
+{\r
+}\r
+\r
+HTMLService_HTMLImage::HTMLService_HTMLImage( const Handle(HTMLService_HTML)& parent,\r
+                                        const TCollection_ExtendedString& img )\r
+: HTMLService_HTML( parent ),\r
+myAlign( -1 ),\r
+myWidth( -1 ),\r
+myHeight( -1 ),\r
+mySource( img ),\r
+mySrcProto( SP_File )\r
+{\r
+}\r
+\r
+HTMLService_HTMLImage::~HTMLService_HTMLImage()\r
+{\r
+}\r
+\r
+TCollection_ExtendedString HTMLService_HTMLImage::GetSource() const\r
+{\r
+  return mySource;\r
+}\r
+\r
+Standard_Integer HTMLService_HTMLImage::GetAlignment() const\r
+{\r
+  return myAlign;\r
+}\r
+\r
+Standard_Integer HTMLService_HTMLImage::GetWidth() const\r
+{\r
+  return myWidth;\r
+}\r
+\r
+Standard_Integer HTMLService_HTMLImage::GetHeight() const\r
+{\r
+  return myHeight;\r
+}\r
+\r
+Standard_Integer HTMLService_HTMLImage::GetSourceProtocol() const\r
+{\r
+  return mySrcProto;\r
+}\r
+\r
+void HTMLService_HTMLImage::SetSource( const TCollection_ExtendedString& src )\r
+{\r
+  mySource = src;\r
+}\r
+\r
+void HTMLService_HTMLImage::SetAlignment( const Standard_Integer align )\r
+{\r
+  myAlign = align;\r
+}\r
+\r
+void HTMLService_HTMLImage::SetWidth( const Standard_Integer val )\r
+{\r
+  myWidth = val;\r
+}\r
+\r
+void HTMLService_HTMLImage::SetHeight( const Standard_Integer val )\r
+{\r
+  myHeight = val;\r
+}\r
+\r
+void HTMLService_HTMLImage::SetSourceProtocol( const Standard_Integer& sp )\r
+{\r
+  mySrcProto = sp;\r
+}\r
+\r
+void HTMLService_HTMLImage::Generate( SequenceOfHTMLLine& aHTML ) const\r
+{\r
+  TCollection_ExtendedString aLine( "<img" );\r
+\r
+  aLine += TCollection_ExtendedString( " src=\"" ) + SourcePrefix() +\r
+           GetSource() + TCollection_ExtendedString( "\"" );\r
+\r
+  if ( GetWidth() >= 0 )\r
+    aLine += TCollection_ExtendedString( " width=" ) + TCollection_ExtendedString( GetWidth() );\r
+  if ( GetHeight() >= 0 )\r
+    aLine += TCollection_ExtendedString( " height=" ) + TCollection_ExtendedString( GetHeight() );\r
+\r
+  TCollection_ExtendedString align = AlignString( GetAlignment() );\r
+  if ( align.Length() )\r
+    aLine += TCollection_ExtendedString( " " ) + align;\r
+\r
+  aLine += TCollection_ExtendedString( ">" );\r
+\r
+  aHTML.Append( aLine );\r
+}\r
+\r
+TCollection_ExtendedString HTMLService_HTMLImage::SourcePrefix() const\r
+{\r
+  TCollection_ExtendedString prefix;\r
+  switch ( GetSourceProtocol() )\r
+  {\r
+  case SP_File:\r
+    prefix = TCollection_ExtendedString( "file://" );\r
+    break;\r
+  case SP_HTTP:\r
+    prefix = TCollection_ExtendedString( "http://" );\r
+    break;\r
+  case SP_FTP:\r
+    prefix = TCollection_ExtendedString( "ftp://" );\r
+    break;\r
+  }\r
+  return prefix;\r
+}\r
diff --git a/src/HTMLService/HTMLService_HTMLImage.hxx b/src/HTMLService/HTMLService_HTMLImage.hxx
new file mode 100755 (executable)
index 0000000..95bae3c
--- /dev/null
@@ -0,0 +1,60 @@
+// File:      HTMLService_HTMLImage.hxx\r
+// Created:   13.10.2006\r
+// Author:    Sergey TELKOV\r
+// Copyright (C) AREVA NP 2006\r
+\r
+#ifndef HTMLSERVICE_HTMLIMAGE_H\r
+#define HTMLSERVICE_HTMLIMAGE_H\r
+\r
+#include <HTMLService.hxx>\r
+#include <HTMLService_HTML.hxx>\r
+\r
+#include <Quantity_Color.hxx>\r
+\r
+/*!\r
+  Class HTMLService_HTMLImage. Generator of the HTML image.\r
+*/\r
+\r
+class HTMLSERVICE_EXPORT HTMLService_HTMLImage : public HTMLService_HTML\r
+{\r
+public:\r
+  enum { SP_Unknown, SP_File, SP_HTTP, SP_FTP } SourceProtocol;\r
+\r
+public:\r
+  Standard_EXPORT HTMLService_HTMLImage( const TCollection_ExtendedString& = TCollection_ExtendedString() );\r
+  Standard_EXPORT HTMLService_HTMLImage( const Handle(HTMLService_HTML)&,\r
+                                      const TCollection_ExtendedString& = TCollection_ExtendedString() );\r
+  Standard_EXPORT virtual ~HTMLService_HTMLImage();\r
+\r
+  Standard_EXPORT Standard_Integer           GetWidth() const;\r
+  Standard_EXPORT Standard_Integer           GetHeight() const;\r
+  Standard_EXPORT TCollection_ExtendedString GetSource() const;\r
+  Standard_EXPORT Standard_Integer           GetAlignment() const;\r
+  Standard_EXPORT Standard_Integer           GetSourceProtocol() const;\r
+\r
+  Standard_EXPORT void                       SetWidth( const Standard_Integer );\r
+  Standard_EXPORT void                       SetHeight( const Standard_Integer );\r
+  Standard_EXPORT void                       SetAlignment( const Standard_Integer );\r
+  Standard_EXPORT void                       SetSource( const TCollection_ExtendedString& );\r
+  Standard_EXPORT void                       SetSourceProtocol( const Standard_Integer& );\r
+\r
+protected:\r
+  Standard_EXPORT virtual void               Generate( SequenceOfHTMLLine& ) const;\r
+\r
+private:\r
+  TCollection_ExtendedString                 SourcePrefix() const;\r
+\r
+private:\r
+  Standard_Integer                           myAlign;\r
+  Standard_Integer                           myWidth;\r
+  Standard_Integer                           myHeight;\r
+  TCollection_ExtendedString                 mySource;\r
+  Standard_Integer                           mySrcProto;\r
+\r
+public:\r
+  DEFINE_STANDARD_RTTI(HTMLService_HTMLImage)\r
+};\r
+\r
+DEFINE_STANDARD_HANDLE(HTMLService_HTMLImage, HTMLService_HTML)\r
+\r
+#endif\r
diff --git a/src/HTMLService/HTMLService_HTMLParagraph.cxx b/src/HTMLService/HTMLService_HTMLParagraph.cxx
new file mode 100755 (executable)
index 0000000..641fee6
--- /dev/null
@@ -0,0 +1,92 @@
+// File:      HTMLService_HTMLParagraph.cxx\r
+// Created:   13.10.2006\r
+// Author:    Sergey TELKOV\r
+// Copyright (C) AREVA NP 2006\r
+\r
+#include <HTMLService_HTMLParagraph.hxx>\r
+\r
+#include <HTMLService_HTMLImage.hxx>\r
+\r
+IMPLEMENT_STANDARD_HANDLE(HTMLService_HTMLParagraph, HTMLService_HTMLText)\r
+IMPLEMENT_STANDARD_RTTIEXT(HTMLService_HTMLParagraph, HTMLService_HTMLText)\r
+\r
+HTMLService_HTMLParagraph::HTMLService_HTMLParagraph()\r
+: HTMLService_HTMLText(),\r
+myNoBr( Standard_False )\r
+{\r
+}\r
+\r
+HTMLService_HTMLParagraph::HTMLService_HTMLParagraph( const Handle(HTMLService_HTML)& parent )\r
+: HTMLService_HTMLText( parent ),\r
+myNoBr( Standard_False )\r
+{\r
+}\r
+\r
+HTMLService_HTMLParagraph::~HTMLService_HTMLParagraph()\r
+{\r
+}\r
+\r
+Standard_Boolean HTMLService_HTMLParagraph::GetNoBreak() const\r
+{\r
+  return myNoBr;\r
+}\r
+\r
+void HTMLService_HTMLParagraph::SetNoBreak( const Standard_Boolean& on )\r
+{\r
+  myNoBr = on;\r
+}\r
+\r
+void HTMLService_HTMLParagraph::Clear()\r
+{\r
+  ClearSubItems();\r
+}\r
+\r
+void HTMLService_HTMLParagraph::Insert( const Handle(HTMLService_HTML)& item )\r
+{\r
+  InsertSubItem( item );\r
+}\r
+\r
+void HTMLService_HTMLParagraph::InsertText( const TCollection_ExtendedString& text )\r
+{\r
+  Insert( new HTMLService_HTMLText( this, text ) );\r
+}\r
+\r
+void HTMLService_HTMLParagraph::InsertImage( const TCollection_ExtendedString& img,\r
+                                          const Standard_Integer w, const Standard_Integer h )\r
+{\r
+  Handle(HTMLService_HTMLImage) image = new HTMLService_HTMLImage( this, img );\r
+  if ( w > 0 )\r
+    image->SetWidth( w );\r
+  if ( h > 0 )\r
+    image->SetHeight( h );\r
+\r
+  Insert( image );\r
+}\r
+\r
+void HTMLService_HTMLParagraph::Generate( SequenceOfHTMLLine& aHTML ) const\r
+{\r
+  SequenceOfHTMLLine aLines;\r
+  HTMLService_HTMLText::Generate( aLines );\r
+\r
+  TCollection_ExtendedString aText;\r
+  for ( Standard_Integer i = 1; i <= aLines.Length(); i++ )\r
+    aText += aLines.Value( i );\r
+\r
+  if ( GetNoBreak() )\r
+    aText = EncloseToTag( aText, "nobr" );\r
+\r
+  aText = EncloseToTag( aText, "p" );\r
+\r
+  TCollection_ExtendedString aHead( aText ), aTail;\r
+  Standard_Integer idx = aHead.Search( "</" );\r
+  if ( idx != -1 )\r
+    aTail = aHead.Split( idx - 1 );\r
+\r
+  if ( aHead.Length() )\r
+    aHTML.Append( aHead );\r
+\r
+  SubItemsHTML( aHTML );\r
+\r
+  if ( aTail.Length() )\r
+    aHTML.Append( aTail );\r
+}\r
diff --git a/src/HTMLService/HTMLService_HTMLParagraph.hxx b/src/HTMLService/HTMLService_HTMLParagraph.hxx
new file mode 100755 (executable)
index 0000000..1b65e51
--- /dev/null
@@ -0,0 +1,44 @@
+// File:      HTMLService_HTMLParagraph.hxx\r
+// Created:   13.10.2006\r
+// Author:    Sergey TELKOV\r
+// Copyright (C) AREVA NP 2006\r
+\r
+#ifndef HTMLSERVICE_HTMLPARAGRAPH_H\r
+#define HTMLSERVICE_HTMLPARAGRAPH_H\r
+\r
+#include <HTMLService.hxx>\r
+#include <HTMLService_HTMLText.hxx>\r
+\r
+/*!\r
+  Class HTMLService_HTMLParagraph. Generator of the HTML paragraph text.\r
+*/\r
+\r
+class HTMLSERVICE_EXPORT HTMLService_HTMLParagraph : public HTMLService_HTMLText\r
+{\r
+public:\r
+  Standard_EXPORT HTMLService_HTMLParagraph();\r
+  Standard_EXPORT HTMLService_HTMLParagraph( const Handle(HTMLService_HTML)& );\r
+  Standard_EXPORT virtual ~HTMLService_HTMLParagraph();\r
+\r
+  Standard_EXPORT Standard_Boolean GetNoBreak() const;\r
+  Standard_EXPORT void             SetNoBreak( const Standard_Boolean& );\r
+\r
+  Standard_EXPORT void             Clear();\r
+  Standard_EXPORT void             Insert( const Handle(HTMLService_HTML)& );\r
+  Standard_EXPORT void             InsertText( const TCollection_ExtendedString& );\r
+  Standard_EXPORT void             InsertImage( const TCollection_ExtendedString&,\r
+                                                const Standard_Integer = -1, const Standard_Integer = -1 );\r
+\r
+protected:\r
+  Standard_EXPORT virtual void     Generate( SequenceOfHTMLLine& ) const;\r
+\r
+private:\r
+  Standard_Boolean                 myNoBr;\r
+\r
+public:\r
+  DEFINE_STANDARD_RTTI(HTMLService_HTMLParagraph)\r
+};\r
+\r
+DEFINE_STANDARD_HANDLE(HTMLService_HTMLParagraph, HTMLService_HTMLText)\r
+\r
+#endif\r
diff --git a/src/HTMLService/HTMLService_HTMLTable.cxx b/src/HTMLService/HTMLService_HTMLTable.cxx
new file mode 100755 (executable)
index 0000000..ff414e7
--- /dev/null
@@ -0,0 +1,255 @@
+// File:      HTMLService_HTMLTable.cxx\r
+// Created:   12.10.2006\r
+// Author:    Sergey TELKOV\r
+// Copyright (C) AREVA NP 2006\r
+\r
+#include <HTMLService_HTMLTable.hxx>\r
+\r
+IMPLEMENT_STANDARD_HANDLE(HTMLService_HTMLTable, HTMLService_HTML)\r
+IMPLEMENT_STANDARD_RTTIEXT(HTMLService_HTMLTable, HTMLService_HTML)\r
+\r
+HTMLService_HTMLTable::HTMLService_HTMLTable( const Standard_Integer rows, const Standard_Integer cols )\r
+: HTMLService_HTML(),\r
+myWidth( -1 ),\r
+myBorder( -1 ),\r
+mySpacing( -1 ),\r
+myPadding( -1 ),\r
+myUseBC( Standard_False ),\r
+myPercent( Standard_False )\r
+{\r
+  Initialize( rows, cols );\r
+}\r
+\r
+HTMLService_HTMLTable::HTMLService_HTMLTable( const Handle(HTMLService_HTML)& parent,\r
+                                        const Standard_Integer rows, const Standard_Integer cols )\r
+: HTMLService_HTML( parent ),\r
+myWidth( -1 ),\r
+myBorder( -1 ),\r
+mySpacing( -1 ),\r
+myPadding( -1 ),\r
+myUseBC( Standard_False ),\r
+myPercent( Standard_False )\r
+{\r
+  Initialize( rows, cols );\r
+}\r
+\r
+HTMLService_HTMLTable::~HTMLService_HTMLTable()\r
+{\r
+}\r
+\r
+Standard_Integer HTMLService_HTMLTable::GetNumRows() const\r
+{\r
+  if ( myRows.IsNull() )\r
+    return 0;\r
+\r
+  return myRows->Length();\r
+}\r
+\r
+Standard_Integer HTMLService_HTMLTable::GetNumCols() const\r
+{\r
+  if ( myRows.IsNull() )\r
+    return 0;\r
+\r
+  Handle(HTMLService_HTMLTableRow) row = Handle(HTMLService_HTMLTableRow)::DownCast(myRows->Value( myRows->Lower() ));\r
+  if ( row.IsNull() )\r
+    return 0;\r
+\r
+  return row->GetSize();\r
+}\r
+\r
+Handle(HTMLService_HTMLTableRow) HTMLService_HTMLTable::GetRow( const Standard_Integer index ) const\r
+{\r
+  Handle(HTMLService_HTMLTableRow) row;\r
+  if ( !myRows.IsNull() )\r
+  {\r
+    Standard_Integer idx = index + myRows->Lower();\r
+    if ( idx >= myRows->Lower() && idx <= myRows->Upper() )\r
+      row = Handle(HTMLService_HTMLTableRow)::DownCast(myRows->Value( idx ));\r
+  }\r
+  return row;\r
+}\r
+\r
+Handle(HTMLService_HTMLTableCell) HTMLService_HTMLTable::GetCell( const Standard_Integer r, const Standard_Integer c ) const\r
+{\r
+  Handle(HTMLService_HTMLTableCell) cell;\r
+  Handle(HTMLService_HTMLTableRow) row = GetRow( r );\r
+  if ( !row.IsNull() )\r
+    cell = row->GetCell( c );\r
+  return cell;\r
+}\r
+\r
+Standard_Integer HTMLService_HTMLTable::GetBorder() const\r
+{\r
+  return myBorder;\r
+}\r
+\r
+Standard_Integer HTMLService_HTMLTable::GetCellSpacing() const\r
+{\r
+  return mySpacing;\r
+}\r
+\r
+Standard_Integer HTMLService_HTMLTable::GetCellPadding() const\r
+{\r
+  return myPadding;\r
+}\r
+\r
+Quantity_Color HTMLService_HTMLTable::GetBackgroundColor() const\r
+{\r
+  return myBgColor;\r
+}\r
+\r
+Standard_Integer HTMLService_HTMLTable::GetWidth( Standard_Boolean* percent ) const\r
+{\r
+  if ( percent )\r
+    *percent = myPercent;\r
+  return myWidth;\r
+}\r
+\r
+void HTMLService_HTMLTable::SetBorder( const Standard_Integer val )\r
+{\r
+  myBorder = val;\r
+}\r
+\r
+void HTMLService_HTMLTable::SetCellSpacing( const Standard_Integer val )\r
+{\r
+  mySpacing = val;\r
+}\r
+\r
+void HTMLService_HTMLTable::SetCellPadding( const Standard_Integer val )\r
+{\r
+  myPadding = val;\r
+}\r
+\r
+void HTMLService_HTMLTable::SetBackgroundColor( const Quantity_Color& c )\r
+{\r
+  myBgColor = c;\r
+  myUseBC = Standard_True;\r
+}\r
+\r
+void HTMLService_HTMLTable::SetWidth( const Standard_Integer width, const Standard_Boolean percent )\r
+{\r
+  myWidth = width;\r
+  myPercent = percent;\r
+}\r
+\r
+void HTMLService_HTMLTable::SetColumnWidth( const Standard_Integer col,\r
+                                         const Standard_Integer w, const Standard_Boolean percent )\r
+{\r
+  for ( Standard_Integer r = myRows->Lower(); r <= myRows->Upper(); r++ )\r
+  {\r
+    Handle(HTMLService_HTMLTableRow) row = Handle(HTMLService_HTMLTableRow)::DownCast(myRows->Value( r ));\r
+    if ( !row.IsNull() )\r
+    {\r
+      Handle(HTMLService_HTMLTableCell) cell = row->GetCell( col );\r
+      if ( !cell.IsNull() )\r
+        cell->SetWidth( w, percent );\r
+    }\r
+  }\r
+}\r
+\r
+void HTMLService_HTMLTable::SetRowSpan( const Standard_Integer row, const Standard_Integer span )\r
+{\r
+  Handle(HTMLService_HTMLTableRow) aRow = GetRow( row );\r
+  if ( !aRow.IsNull() )\r
+  {\r
+    for ( Standard_Integer i = 0; i < aRow->GetSize(); i++ )\r
+      aRow->GetCell( i )->SetRowSpan( span );\r
+  }\r
+}\r
+\r
+void HTMLService_HTMLTable::SetColumnSpan( const Standard_Integer col, const Standard_Integer span )\r
+{\r
+  for ( Standard_Integer r = myRows->Lower(); r <= myRows->Upper(); r++ )\r
+  {\r
+    Handle(HTMLService_HTMLTableRow) row = Handle(HTMLService_HTMLTableRow)::DownCast(myRows->Value( r ));\r
+    if ( !row.IsNull() )\r
+    {\r
+      Handle(HTMLService_HTMLTableCell) cell = row->GetCell( col );\r
+      if ( !cell.IsNull() )\r
+        cell->SetColSpan( span );\r
+    }\r
+  }\r
+}\r
+\r
+void HTMLService_HTMLTable::Initialize( const Standard_Integer rows, const Standard_Integer cols )\r
+{\r
+  if ( rows > 0 )\r
+    myRows = new TColStd_HArray1OfTransient( 1, rows );\r
+\r
+  if ( myRows.IsNull() )\r
+    return;\r
+\r
+  for ( Standard_Integer i = myRows->Lower(); i <= myRows->Upper(); i++ )\r
+  {\r
+    Handle(HTMLService_HTMLTableRow) row = new HTMLService_HTMLTableRow( cols );\r
+    myRows->SetValue( i, row );\r
+    InsertSubItem( row );\r
+  }\r
+}\r
+\r
+void HTMLService_HTMLTable::Generate( SequenceOfHTMLLine& aHTML ) const\r
+{\r
+  PrepareCells();\r
+\r
+  TCollection_ExtendedString aLine( "<table" );\r
+  Standard_Boolean percent = Standard_False;\r
+  if ( GetWidth( &percent ) >= 0 )\r
+  {\r
+    aLine += TCollection_ExtendedString( " width=" ) + TCollection_ExtendedString( GetWidth() );\r
+    if ( percent )\r
+      aLine += TCollection_ExtendedString( "%" );\r
+  }\r
+  if ( GetBorder() >= 0 )\r
+    aLine += TCollection_ExtendedString( " border=" ) + TCollection_ExtendedString( GetBorder() );\r
+  if ( GetCellSpacing() > 1 )\r
+    aLine += TCollection_ExtendedString( " cellspacing=" ) + TCollection_ExtendedString( GetCellSpacing() );\r
+  if ( GetCellPadding() > 1 )\r
+    aLine += TCollection_ExtendedString( " cellpadding=" ) + TCollection_ExtendedString( GetCellPadding() );\r
+\r
+  if ( myUseBC )\r
+    aLine += TCollection_ExtendedString( " bgcolor=" ) + ColorString( GetBackgroundColor() );\r
+\r
+  aLine += TCollection_ExtendedString( ">" );\r
+  aHTML.Append( aLine );\r
+  SubItemsHTML( aHTML );\r
+\r
+  aHTML.Append( TCollection_ExtendedString( "</table>" ) );\r
+}\r
+\r
+void HTMLService_HTMLTable::PrepareCells() const\r
+{\r
+  for ( Standard_Integer row = 0; row < GetNumRows(); row++ )\r
+  {\r
+    for ( Standard_Integer col = 0; col < GetNumCols(); col++ )\r
+    {\r
+      Handle(HTMLService_HTMLTableCell) cell = GetCell( row, col );\r
+      if ( !cell.IsNull() )\r
+        cell->SetVisible( Standard_True );\r
+    }\r
+  }\r
+\r
+  for ( Standard_Integer r = 0; r < GetNumRows(); r++ )\r
+  {\r
+    for ( Standard_Integer c = 0; c < GetNumCols(); c++ )\r
+    {\r
+      Handle(HTMLService_HTMLTableCell) cell = GetCell( r, c );\r
+      if ( !cell->IsVisible() )\r
+        continue;\r
+\r
+      Standard_Integer rowSpan = cell->GetRowSpan();\r
+      Standard_Integer colSpan = cell->GetColSpan();\r
+      if ( rowSpan < 2 && colSpan < 2 )\r
+        continue;\r
+\r
+      for ( Standard_Integer sr = r; sr < r + rowSpan; sr++ )\r
+      {\r
+        for ( Standard_Integer sc = c; sc < c + colSpan; sc++ )\r
+        {\r
+          Handle(HTMLService_HTMLTableCell) spanedCell = GetCell( sr, sc );\r
+          if ( !spanedCell.IsNull() && spanedCell != cell )\r
+            spanedCell->SetVisible( Standard_False );\r
+        }\r
+      }\r
+    }\r
+  }\r
+}\r
diff --git a/src/HTMLService/HTMLService_HTMLTable.hxx b/src/HTMLService/HTMLService_HTMLTable.hxx
new file mode 100755 (executable)
index 0000000..840f0aa
--- /dev/null
@@ -0,0 +1,77 @@
+// File:      HTMLService_HTMLTable.hxx\r
+// Created:   12.10.2006\r
+// Author:    Sergey TELKOV\r
+// Copyright (C) AREVA NP 2006\r
+\r
+#ifndef HTMLSERVICE_HTMLTABLE_H\r
+#define HTMLSERVICE_HTMLTABLE_H\r
+\r
+#include <HTMLService.hxx>\r
+#include <HTMLService_HTML.hxx>\r
+\r
+#include <HTMLService_HTMLTableRow.hxx>\r
+\r
+#include <TColStd_HArray1OfTransient.hxx>\r
+\r
+#include <Quantity_Color.hxx>\r
+\r
+/*!\r
+  Class HTMLService_HTMLTable. Generator of the HTML Table text.\r
+*/\r
+\r
+class HTMLSERVICE_EXPORT HTMLService_HTMLTable : public HTMLService_HTML\r
+{\r
+public:\r
+  Standard_EXPORT HTMLService_HTMLTable( const Standard_Integer = 0, const Standard_Integer = 0 );\r
+  Standard_EXPORT HTMLService_HTMLTable( const Handle(HTMLService_HTML)&, const Standard_Integer = 0, const Standard_Integer = 0 );\r
+  Standard_EXPORT virtual ~HTMLService_HTMLTable();\r
+\r
+  Standard_EXPORT Standard_Integer   GetNumRows() const;\r
+  Standard_EXPORT Standard_Integer   GetNumCols() const;\r
+\r
+  Standard_EXPORT Handle(HTMLService_HTMLTableRow)  GetRow( const Standard_Integer ) const;\r
+  Standard_EXPORT Handle(HTMLService_HTMLTableCell) GetCell( const Standard_Integer, const Standard_Integer ) const;\r
+\r
+  Standard_EXPORT Standard_Integer   GetBorder() const;\r
+  Standard_EXPORT Standard_Integer   GetCellSpacing() const;\r
+  Standard_EXPORT Standard_Integer   GetCellPadding() const;\r
+  Standard_EXPORT Quantity_Color     GetBackgroundColor() const;\r
+  Standard_EXPORT Standard_Integer   GetWidth( Standard_Boolean* = 0 ) const;\r
+\r
+  Standard_EXPORT void               SetBorder( const Standard_Integer );\r
+  Standard_EXPORT void               SetCellSpacing( const Standard_Integer );\r
+  Standard_EXPORT void               SetCellPadding( const Standard_Integer );\r
+  Standard_EXPORT void               SetBackgroundColor( const Quantity_Color& );\r
+  Standard_EXPORT void               SetWidth( const Standard_Integer,\r
+                                               const Standard_Boolean = Standard_False );\r
+\r
+  Standard_EXPORT void               SetRowSpan( const Standard_Integer, const Standard_Integer );\r
+  Standard_EXPORT void               SetColumnSpan( const Standard_Integer, const Standard_Integer );\r
+  Standard_EXPORT void               SetColumnWidth( const Standard_Integer, const Standard_Integer,\r
+                                                     const Standard_Boolean = Standard_False );\r
+\r
+protected:\r
+  Standard_EXPORT virtual void       Generate( SequenceOfHTMLLine& ) const;\r
+\r
+private:\r
+  void                               PrepareCells() const;\r
+  void                               Initialize( const Standard_Integer, const Standard_Integer );\r
+\r
+private:\r
+  Handle(TColStd_HArray1OfTransient) myRows;\r
+\r
+  Standard_Boolean                   myUseBC;\r
+  Standard_Integer                   myWidth;\r
+  Standard_Integer                   myBorder;\r
+  Standard_Boolean                   myPercent;\r
+  Quantity_Color                     myBgColor;\r
+  Standard_Integer                   mySpacing;\r
+  Standard_Integer                   myPadding;\r
+\r
+public:\r
+  DEFINE_STANDARD_RTTI(HTMLService_HTMLTable)\r
+};\r
+\r
+DEFINE_STANDARD_HANDLE(HTMLService_HTMLTable, HTMLService_HTML)\r
+\r
+#endif\r
diff --git a/src/HTMLService/HTMLService_HTMLTableCell.cxx b/src/HTMLService/HTMLService_HTMLTableCell.cxx
new file mode 100755 (executable)
index 0000000..876b81b
--- /dev/null
@@ -0,0 +1,162 @@
+// File:      HTMLService_HTMLTableCell.cxx\r
+// Created:   12.10.2006\r
+// Author:    Sergey TELKOV\r
+// Copyright (C) AREVA NP 2006\r
+\r
+#include <HTMLService_HTMLTableCell.hxx>\r
+\r
+IMPLEMENT_STANDARD_HANDLE(HTMLService_HTMLTableCell, HTMLService_HTMLParagraph)\r
+IMPLEMENT_STANDARD_RTTIEXT(HTMLService_HTMLTableCell, HTMLService_HTMLParagraph)\r
+\r
+HTMLService_HTMLTableCell::HTMLService_HTMLTableCell()\r
+: HTMLService_HTMLParagraph(),\r
+myRowSpan( 1 ),\r
+myColSpan( 1 ),\r
+myWidth( -1 ),\r
+myAlign( -1 ),\r
+myUseBC( Standard_False ),\r
+myPercent( Standard_False ),\r
+myIsHeader( Standard_False )\r
+{\r
+}\r
+\r
+HTMLService_HTMLTableCell::HTMLService_HTMLTableCell( const Handle(HTMLService_HTML)& parent )\r
+: HTMLService_HTMLParagraph( parent ),\r
+myRowSpan( 1 ),\r
+myColSpan( 1 ),\r
+myWidth( -1 ),\r
+myAlign( -1 ),\r
+myUseBC( Standard_False ),\r
+myPercent( Standard_False ),\r
+myIsHeader( Standard_False )\r
+{\r
+}\r
+\r
+HTMLService_HTMLTableCell::~HTMLService_HTMLTableCell()\r
+{\r
+}\r
+\r
+Standard_Integer HTMLService_HTMLTableCell::GetColSpan() const\r
+{\r
+  return myColSpan;\r
+}\r
+\r
+Standard_Integer HTMLService_HTMLTableCell::GetRowSpan() const\r
+{\r
+  return myRowSpan;\r
+}\r
+\r
+Standard_Integer HTMLService_HTMLTableCell::GetAlignment() const\r
+{\r
+  return myAlign;\r
+}\r
+\r
+Standard_Integer HTMLService_HTMLTableCell::GetWidth( Standard_Boolean* percent ) const\r
+{\r
+  if ( percent )\r
+    *percent = myPercent;\r
+  return myWidth;\r
+}\r
+\r
+Quantity_Color HTMLService_HTMLTableCell::GetBackgroundColor() const\r
+{\r
+  return myBgColor;\r
+}\r
+\r
+Standard_Boolean HTMLService_HTMLTableCell::IsHeaderCell() const\r
+{\r
+  return myIsHeader;\r
+}\r
+\r
+void HTMLService_HTMLTableCell::SetColSpan( const Standard_Integer span )\r
+{\r
+  myColSpan = span;\r
+}\r
+\r
+void HTMLService_HTMLTableCell::SetRowSpan( const Standard_Integer span )\r
+{\r
+  myRowSpan = span;\r
+}\r
+\r
+void HTMLService_HTMLTableCell::SetAlignment( const Standard_Integer align )\r
+{\r
+  myAlign = align;\r
+}\r
+\r
+void HTMLService_HTMLTableCell::SetWidth( const Standard_Integer width, const Standard_Boolean percent )\r
+{\r
+  myWidth = width;\r
+  myPercent = percent;\r
+}\r
+\r
+void HTMLService_HTMLTableCell::SetBackgroundColor( const Quantity_Color& c )\r
+{\r
+  myBgColor = c;\r
+  myUseBC = Standard_True;\r
+}\r
+\r
+void HTMLService_HTMLTableCell::SetHeaderCell( const Standard_Boolean on )\r
+{\r
+  myIsHeader = on;\r
+}\r
+\r
+void HTMLService_HTMLTableCell::Generate( SequenceOfHTMLLine& aHTML ) const\r
+{\r
+  TCollection_ExtendedString aLine;\r
+  if ( IsHeaderCell() )\r
+    aLine = TCollection_ExtendedString( "<th" );\r
+  else\r
+    aLine = TCollection_ExtendedString( "<td" );\r
+  Standard_Boolean percent = Standard_False;\r
+  if ( GetWidth( &percent ) >= 0 )\r
+  {\r
+    aLine += TCollection_ExtendedString( " width=" ) + TCollection_ExtendedString( GetWidth() );\r
+    if ( percent )\r
+      aLine += TCollection_ExtendedString( "%" );\r
+  }\r
+  if ( GetRowSpan() > 1 )\r
+    aLine += TCollection_ExtendedString( " rowspan=" ) + TCollection_ExtendedString( GetRowSpan() );\r
+  if ( GetColSpan() > 1 )\r
+    aLine += TCollection_ExtendedString( " colspan=" ) + TCollection_ExtendedString( GetColSpan() );\r
+\r
+  TCollection_ExtendedString align = AlignString( GetAlignment() );\r
+  if ( align.Length() )\r
+    aLine += align;\r
+\r
+  if ( myUseBC )\r
+    aLine += TCollection_ExtendedString( " bgcolor=" ) + ColorString( GetBackgroundColor() );\r
+\r
+  aLine += TCollection_ExtendedString( ">" );\r
+  aHTML.Append( aLine );\r
+\r
+  HTMLService_HTMLParagraph::Generate( aHTML );\r
+  if ( IsHeaderCell() )\r
+    aHTML.Append( "</th>" );\r
+  else\r
+    aHTML.Append( "</td>" );\r
+}\r
+\r
+TCollection_ExtendedString HTMLService_HTMLTableCell::CellString() const\r
+{\r
+  TCollection_ExtendedString txt = GetText();\r
+\r
+  if ( GetHeadingLevel() >= 0 )\r
+    txt = EncloseToTag( txt, TCollection_ExtendedString( "h" ) + TCollection_ExtendedString( GetHeadingLevel() ) );\r
+\r
+  if ( GetFontFlags() & Bold )\r
+    txt = EncloseToTag( txt, TCollection_ExtendedString( "b" ) );\r
+    \r
+  if ( GetFontFlags() & Italic )\r
+    txt = EncloseToTag( txt, TCollection_ExtendedString( "i" ) );\r
+\r
+  if ( GetFontFlags() & Underline )\r
+    txt = EncloseToTag( txt, TCollection_ExtendedString( "u" ) );\r
+  \r
+  if ( GetFontFlags() & Subscript )\r
+    txt = EncloseToTag( txt, TCollection_ExtendedString( "sub" ) );\r
+\r
+  if ( GetFontFlags() & Superscript )\r
+    txt = EncloseToTag( txt, TCollection_ExtendedString( "sup" ) );\r
+\r
+  return txt;\r
+}\r
diff --git a/src/HTMLService/HTMLService_HTMLTableCell.hxx b/src/HTMLService/HTMLService_HTMLTableCell.hxx
new file mode 100755 (executable)
index 0000000..c90c0ca
--- /dev/null
@@ -0,0 +1,63 @@
+// File:      HTMLService_HTMLTableCell.hxx\r
+// Created:   12.10.2006\r
+// Author:    Sergey TELKOV\r
+// Copyright (C) AREVA NP 2006\r
+\r
+#ifndef HTMLService_HTMLTABLECELL_H\r
+#define HTMLService_HTMLTABLECELL_H\r
+\r
+#include <HTMLService.hxx>\r
+#include <HTMLService_HTMLParagraph.hxx>\r
+\r
+#include <Quantity_Color.hxx>\r
+\r
+/*!\r
+  Class HTMLService_HTMLTableCell. Generator of the HTML Table cell text.\r
+*/\r
+\r
+class HTMLSERVICE_EXPORT HTMLService_HTMLTableCell : public HTMLService_HTMLParagraph\r
+{\r
+public:\r
+  Standard_EXPORT HTMLService_HTMLTableCell();\r
+  Standard_EXPORT HTMLService_HTMLTableCell( const Handle(HTMLService_HTML)& );\r
+  Standard_EXPORT virtual ~HTMLService_HTMLTableCell();\r
+\r
+  Standard_EXPORT Standard_Integer           GetColSpan() const;\r
+  Standard_EXPORT Standard_Integer           GetRowSpan() const;\r
+  Standard_EXPORT Standard_Integer           GetAlignment() const;\r
+  Standard_EXPORT Standard_Integer           GetWidth( Standard_Boolean* = 0 ) const;\r
+\r
+  Standard_EXPORT Quantity_Color             GetBackgroundColor() const;\r
+  Standard_EXPORT Standard_Boolean           IsHeaderCell() const;\r
+\r
+  Standard_EXPORT void                       SetColSpan( const Standard_Integer );\r
+  Standard_EXPORT void                       SetRowSpan( const Standard_Integer );\r
+  Standard_EXPORT void                       SetAlignment( const Standard_Integer );\r
+  Standard_EXPORT void                       SetWidth( const Standard_Integer,\r
+                                                       const Standard_Boolean = Standard_False );\r
+  Standard_EXPORT void                       SetBackgroundColor( const Quantity_Color& );\r
+  Standard_EXPORT void                       SetHeaderCell( const Standard_Boolean );\r
+\r
+protected:\r
+  Standard_EXPORT virtual void               Generate( SequenceOfHTMLLine& ) const;\r
+\r
+private:\r
+  TCollection_ExtendedString                 CellString() const;\r
+\r
+private:\r
+  Standard_Integer           myWidth;\r
+  Standard_Integer           myAlign;\r
+  Standard_Boolean           myUseBC;\r
+  Standard_Boolean           myPercent;\r
+  Standard_Integer           myColSpan;\r
+  Standard_Integer           myRowSpan;\r
+  Quantity_Color             myBgColor;\r
+  Standard_Boolean           myIsHeader;\r
+\r
+public:\r
+  DEFINE_STANDARD_RTTI(HTMLService_HTMLTableCell)\r
+};\r
+\r
+DEFINE_STANDARD_HANDLE(HTMLService_HTMLTableCell, HTMLService_HTMLParagraph)\r
+\r
+#endif\r
diff --git a/src/HTMLService/HTMLService_HTMLTableRow.cxx b/src/HTMLService/HTMLService_HTMLTableRow.cxx
new file mode 100755 (executable)
index 0000000..d953766
--- /dev/null
@@ -0,0 +1,86 @@
+// File:      HTMLService_HTMLTableRow.cxx\r
+// Created:   12.10.2006\r
+// Author:    Sergey TELKOV\r
+// Copyright (C) AREVA NP 2006\r
+\r
+#include <HTMLService_HTMLTableRow.hxx>\r
+\r
+IMPLEMENT_STANDARD_HANDLE(HTMLService_HTMLTableRow, HTMLService_HTML)\r
+IMPLEMENT_STANDARD_RTTIEXT(HTMLService_HTMLTableRow, HTMLService_HTML)\r
+\r
+HTMLService_HTMLTableRow::HTMLService_HTMLTableRow( const Standard_Integer cells )\r
+: HTMLService_HTML(),\r
+myUseBC( Standard_False )\r
+{\r
+  Initialize( cells );\r
+}\r
+\r
+HTMLService_HTMLTableRow::HTMLService_HTMLTableRow( const Handle(HTMLService_HTML)& parent, const Standard_Integer cells )\r
+: HTMLService_HTML( parent ),\r
+myUseBC( Standard_False )\r
+{\r
+  Initialize( cells );\r
+}\r
+\r
+HTMLService_HTMLTableRow::~HTMLService_HTMLTableRow()\r
+{\r
+}\r
+\r
+Standard_Integer HTMLService_HTMLTableRow::GetSize() const\r
+{\r
+  if ( myCells.IsNull() )\r
+    return 0;\r
+\r
+  return myCells->Length();\r
+}\r
+\r
+Handle(HTMLService_HTMLTableCell) HTMLService_HTMLTableRow::GetCell( const Standard_Integer index ) const\r
+{\r
+  Handle(HTMLService_HTMLTableCell) cell;\r
+  if ( !myCells.IsNull() )\r
+  {\r
+    Standard_Integer idx = index + myCells->Lower();\r
+    if ( idx >= myCells->Lower() && idx <= myCells->Upper() )\r
+      cell = Handle(HTMLService_HTMLTableCell)::DownCast(myCells->Value( idx ));\r
+  }\r
+  return cell;\r
+}\r
+\r
+Quantity_Color HTMLService_HTMLTableRow::GetBackgroundColor() const\r
+{\r
+  return myBgColor;\r
+}\r
+\r
+void HTMLService_HTMLTableRow::SetBackgroundColor( const Quantity_Color& c )\r
+{\r
+  myBgColor = c;\r
+  myUseBC = Standard_True;\r
+}\r
+\r
+void HTMLService_HTMLTableRow::Initialize( const Standard_Integer num )\r
+{\r
+  if ( num > 0 )\r
+    myCells = new TColStd_HArray1OfTransient( 0, num - 1 );\r
+\r
+  if ( myCells.IsNull() )\r
+    return;\r
+\r
+  for ( Standard_Integer i = myCells->Lower(); i <= myCells->Upper(); i++ )\r
+  {\r
+    Handle(HTMLService_HTMLTableCell) cell = new HTMLService_HTMLTableCell();\r
+    myCells->SetValue( i, cell );\r
+    InsertSubItem( cell );\r
+  }\r
+}\r
+\r
+void HTMLService_HTMLTableRow::Generate( SequenceOfHTMLLine& aHTML ) const\r
+{\r
+  TCollection_ExtendedString aLine( "<tr" );\r
+  if ( myUseBC )\r
+    aLine += TCollection_ExtendedString( " bgcolor=" ) + ColorString( GetBackgroundColor() );\r
+\r
+  aLine += TCollection_ExtendedString( ">" );\r
+  aHTML.Append( aLine );\r
+  SubItemsHTML( aHTML );\r
+  aHTML.Append( TCollection_ExtendedString( "</tr>" ) );\r
+}\r
diff --git a/src/HTMLService/HTMLService_HTMLTableRow.hxx b/src/HTMLService/HTMLService_HTMLTableRow.hxx
new file mode 100755 (executable)
index 0000000..6dd714e
--- /dev/null
@@ -0,0 +1,50 @@
+// File:      HTMLService_HTMLTableRow.hxx\r
+// Created:   12.10.2006\r
+// Author:    Sergey TELKOV\r
+// Copyright (C) AREVA NP 2006\r
+\r
+#ifndef HTMLService_HTMLTABLEROW_H\r
+#define HTMLService_HTMLTABLEROW_H\r
+\r
+#include <HTMLService.hxx>\r
+#include <HTMLService_HTML.hxx>\r
+\r
+#include <HTMLService_HTMLTableCell.hxx>\r
+\r
+#include <TColStd_HArray1OfTransient.hxx>\r
+\r
+/*!\r
+  Class HTMLService_HTMLTableRow. Generator of the HTML Table row text.\r
+*/\r
+\r
+class HTMLSERVICE_EXPORT HTMLService_HTMLTableRow : public HTMLService_HTML\r
+{\r
+public:\r
+  Standard_EXPORT HTMLService_HTMLTableRow( const Standard_Integer = 0 );\r
+  Standard_EXPORT HTMLService_HTMLTableRow( const Handle(HTMLService_HTML)&, const Standard_Integer = 0 );\r
+  Standard_EXPORT virtual ~HTMLService_HTMLTableRow();\r
+\r
+  Standard_EXPORT Standard_Integer          GetSize() const;\r
+  Standard_EXPORT Handle(HTMLService_HTMLTableCell) GetCell( const Standard_Integer ) const;\r
+\r
+  Standard_EXPORT Quantity_Color            GetBackgroundColor() const;\r
+  Standard_EXPORT void                      SetBackgroundColor( const Quantity_Color& );\r
+\r
+protected:\r
+  Standard_EXPORT virtual void              Generate( SequenceOfHTMLLine& ) const;\r
+\r
+private:\r
+  void                                      Initialize( const Standard_Integer );\r
+\r
+private:\r
+  Handle(TColStd_HArray1OfTransient)        myCells;\r
+  Standard_Boolean                          myUseBC;\r
+  Quantity_Color                            myBgColor;\r
+\r
+public:\r
+  DEFINE_STANDARD_RTTI(HTMLService_HTMLTableRow)\r
+};\r
+\r
+DEFINE_STANDARD_HANDLE(HTMLService_HTMLTableRow, HTMLService_HTML)\r
+\r
+#endif\r
diff --git a/src/HTMLService/HTMLService_HTMLText.cxx b/src/HTMLService/HTMLService_HTMLText.cxx
new file mode 100755 (executable)
index 0000000..1af7fce
--- /dev/null
@@ -0,0 +1,105 @@
+// File:      HTMLService_HTMLText.cxx\r
+// Created:   13.10.2006\r
+// Author:    Sergey TELKOV\r
+// Copyright (C) AREVA NP 2006\r
+\r
+#include <HTMLService_HTMLText.hxx>\r
+\r
+IMPLEMENT_STANDARD_HANDLE(HTMLService_HTMLText, HTMLService_HTML)\r
+IMPLEMENT_STANDARD_RTTIEXT(HTMLService_HTMLText, HTMLService_HTML)\r
+\r
+HTMLService_HTMLText::HTMLService_HTMLText( const TCollection_ExtendedString& text, const Standard_Integer fontFlags )\r
+: HTMLService_HTML(),\r
+myText( text ),\r
+myHeading( -1 ),\r
+myFontFlags( fontFlags ),\r
+myUseColor( Standard_False )\r
+{\r
+}\r
+\r
+HTMLService_HTMLText::HTMLService_HTMLText( const Handle(HTMLService_HTML)& parent,\r
+                                      const TCollection_ExtendedString& text, const Standard_Integer fontFlags )\r
+: HTMLService_HTML( parent ),\r
+myText( text ),\r
+myHeading( -1 ),\r
+myFontFlags( fontFlags ),\r
+myUseColor( Standard_False )\r
+{\r
+}\r
+\r
+HTMLService_HTMLText::~HTMLService_HTMLText()\r
+{\r
+}\r
+\r
+TCollection_ExtendedString HTMLService_HTMLText::GetText() const\r
+{\r
+  return myText;\r
+}\r
+\r
+Quantity_Color HTMLService_HTMLText::GetForegroundColor() const\r
+{\r
+  return myColor;\r
+}\r
+\r
+Standard_Integer HTMLService_HTMLText::GetFontFlags() const\r
+{\r
+  return myFontFlags;\r
+}\r
+\r
+Standard_Integer HTMLService_HTMLText::GetHeadingLevel() const\r
+{\r
+  return myHeading;\r
+}\r
+\r
+void HTMLService_HTMLText::SetText( const TCollection_ExtendedString& text )\r
+{\r
+  myText = text;\r
+}\r
+\r
+void HTMLService_HTMLText::SetForegroundColor( const Quantity_Color& c )\r
+{\r
+  myColor = c;\r
+  myUseColor = Standard_True;\r
+}\r
+\r
+void HTMLService_HTMLText::SetFontFlags( const Standard_Integer flags )\r
+{\r
+  myFontFlags = flags;\r
+}\r
+\r
+void HTMLService_HTMLText::SetHeadingLevel( const Standard_Integer level )\r
+{\r
+  myHeading = level;\r
+}\r
+\r
+void HTMLService_HTMLText::Generate( SequenceOfHTMLLine& aHTML ) const\r
+{\r
+  TCollection_ExtendedString txt = GetText();\r
+\r
+  if ( GetHeadingLevel() >= 0 )\r
+    txt = EncloseToTag( txt, TCollection_ExtendedString( "h" ) + TCollection_ExtendedString( GetHeadingLevel() ) );\r
+\r
+  if ( GetFontFlags() & Bold )\r
+    txt = EncloseToTag( txt, TCollection_ExtendedString( "b" ) );\r
+    \r
+  if ( GetFontFlags() & Italic )\r
+    txt = EncloseToTag( txt, TCollection_ExtendedString( "i" ) );\r
+\r
+  if ( GetFontFlags() & Underline )\r
+    txt = EncloseToTag( txt, TCollection_ExtendedString( "u" ) );\r
+  \r
+  if ( GetFontFlags() & StrikeOut )\r
+    txt = EncloseToTag( txt, TCollection_ExtendedString( "s" ) );\r
+\r
+  if ( GetFontFlags() & Subscript )\r
+    txt = EncloseToTag( txt, TCollection_ExtendedString( "sub" ) );\r
+\r
+  if ( GetFontFlags() & Superscript )\r
+    txt = EncloseToTag( txt, TCollection_ExtendedString( "sup" ) );\r
+\r
+  if ( myUseColor )\r
+    txt = EncloseToTag( txt, TCollection_ExtendedString( "font" ),\r
+                        TCollection_ExtendedString ( "color=" ) + ColorString( GetForegroundColor() ) );\r
+\r
+  aHTML.Append( txt );\r
+}\r
diff --git a/src/HTMLService/HTMLService_HTMLText.hxx b/src/HTMLService/HTMLService_HTMLText.hxx
new file mode 100755 (executable)
index 0000000..4cd1101
--- /dev/null
@@ -0,0 +1,58 @@
+// File:      HTMLService_HTMLText.hxx\r
+// Created:   13.10.2006\r
+// Author:    Sergey TELKOV\r
+// Copyright (C) AREVA NP 2006\r
+\r
+#ifndef HTMLSERVICE_HTMLTEXT_H\r
+#define HTMLSERVICE_HTMLTEXT_H\r
+\r
+#include <HTMLService.hxx>\r
+#include <HTMLService_HTML.hxx>\r
+\r
+#include <Quantity_Color.hxx>\r
+\r
+/*!\r
+  Class HTMLService_HTMLText. Generator of the simple HTML text.\r
+*/\r
+\r
+class HTMLSERVICE_EXPORT HTMLService_HTMLText : public HTMLService_HTML\r
+{\r
+public:\r
+  enum { Normal = 0x00, Bold = 0x01, Italic = 0x02, Underline = 0x04,\r
+         StrikeOut = 0x08, Subscript = 0x10, Superscript = 0x20 } FontFlags;\r
+\r
+public:\r
+  Standard_EXPORT HTMLService_HTMLText( const TCollection_ExtendedString& = TCollection_ExtendedString(),\r
+                                     const Standard_Integer = Normal );\r
+  Standard_EXPORT HTMLService_HTMLText( const Handle(HTMLService_HTML)&,\r
+                                     const TCollection_ExtendedString& = TCollection_ExtendedString(),\r
+                                     const Standard_Integer = Normal );\r
+  Standard_EXPORT virtual ~HTMLService_HTMLText();\r
+\r
+  Standard_EXPORT TCollection_ExtendedString GetText() const;\r
+  Standard_EXPORT Standard_Integer           GetFontFlags() const;\r
+  Standard_EXPORT Standard_Integer           GetHeadingLevel() const;\r
+  Standard_EXPORT Quantity_Color             GetForegroundColor() const;\r
+\r
+  Standard_EXPORT void                       SetFontFlags( const Standard_Integer );\r
+  Standard_EXPORT void                       SetHeadingLevel( const Standard_Integer );\r
+  Standard_EXPORT void                       SetForegroundColor( const Quantity_Color& );\r
+  Standard_EXPORT void                       SetText( const TCollection_ExtendedString& );\r
+\r
+protected:\r
+  Standard_EXPORT virtual void               Generate( SequenceOfHTMLLine& ) const;\r
+\r
+private:\r
+  TCollection_ExtendedString myText;\r
+  Quantity_Color             myColor;\r
+  Standard_Integer           myHeading;\r
+  Standard_Boolean           myUseColor;\r
+  Standard_Integer           myFontFlags;\r
+\r
+public:\r
+  DEFINE_STANDARD_RTTI(HTMLService_HTMLText)\r
+};\r
+\r
+DEFINE_STANDARD_HANDLE(HTMLService_HTMLText, HTMLService_HTML)\r
+\r
+#endif\r