~ubuntu-branches/ubuntu/breezy/koffice/breezy

« back to all changes in this revision

Viewing changes to lib/kscript/kscript_typecode.cc

  • Committer: Bazaar Package Importer
  • Author(s): Ben Burton
  • Date: 2004-05-09 11:33:00 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040509113300-vfrdadqsvjfuhn3b
Tags: 1:1.3.1-1
* New upstream bugfix release.
* Built against newer imagemagick (closes: #246623).
* Made koffice-libs/kformula recommend/depend on latex-xft-fonts, which
  provides mathematical fonts that the formula editor can use.  Also
  patched the kformula part to make these fonts the default.
* Changed kword menu hint from "WordProcessors" to "Word processors"
  (closes: #246209).
* Spellchecker configuration is now fixed (closes: #221256, #227568).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#if 0
2
 
 
3
 
#define WITH_CORBA
4
 
#include <CORBA.h>
5
 
 
6
 
#include "kscript_typecode.h"
7
 
#include "kscript_interface.h"
8
 
#include "kscript_struct.h"
9
 
 
10
 
KSTypeCode::KSTypeCode()
11
 
{
12
 
  m_typecode = new CORBA::TypeCode();
13
 
}
14
 
 
15
 
KSTypeCode::KSTypeCode( void* tc )
16
 
{
17
 
  m_typecode = (CORBA::TypeCode*)tc;
18
 
  m_typecode->_ref();
19
 
}
20
 
 
21
 
KSTypeCode::KSTypeCode( const QString& stringified )
22
 
{
23
 
  m_typecode = new CORBA::TypeCode( stringified.ascii() );
24
 
}
25
 
 
26
 
KSTypeCode::~KSTypeCode()
27
 
{
28
 
  m_typecode->_deref();
29
 
}
30
 
 
31
 
bool KSTypeCode::fromString( const QString& stringified )
32
 
{
33
 
  return m_typecode->from_string( stringified.ascii() );
34
 
}
35
 
 
36
 
void* KSTypeCode::tc()
37
 
{
38
 
  return m_typecode;
39
 
}
40
 
 
41
 
bool KSTypeCode::convertToTypeCode( KSContext& context, KSValue* v )
42
 
{
43
 
  if ( v->type() == KSValue::TypeCodeType )
44
 
    return true;
45
 
 
46
 
  if ( v->type() != KSValue::StringType )
47
 
    return false;
48
 
 
49
 
  QString tc = v->stringValue();
50
 
  v->setValue( new KSTypeCode() );
51
 
  if ( !v->typeCodeValue()->fromString( tc ) )
52
 
  {
53
 
    context.setException( new KSException( "InvalidTypeCode", tc, -1 ) );
54
 
    return false;
55
 
  }
56
 
  return true;
57
 
}
58
 
 
59
 
KSTypeCode::Ptr KSTypeCode::typeCode( KSContext& context, KSValue* v )
60
 
{
61
 
  if( v->type() == KSValue::TypeCodeType )
62
 
  {
63
 
    v->typeCodeValue()->ref();
64
 
    return v->typeCodeValue();
65
 
  }
66
 
  else if( v->type() == KSValue::StringType )
67
 
  {
68
 
    if ( !convertToTypeCode( context, v ) )
69
 
      return 0;
70
 
    KSTypeCode* tc = v->typeCodeValue();
71
 
    tc->ref();
72
 
    return tc;
73
 
  }
74
 
  else if( v->type() == KSValue::StructClassType )
75
 
  {
76
 
    KSValue::Ptr p = v->structClassValue()->member( context, "typecode" );
77
 
    if ( !p )
78
 
      return 0;
79
 
    if ( !convertToTypeCode( context, p ) )
80
 
      return 0;
81
 
    KSTypeCode* tc = p->typeCodeValue();
82
 
    tc->ref();
83
 
    return tc;
84
 
  }
85
 
  else if( v->type() == KSValue::InterfaceType )
86
 
  {
87
 
    KSValue::Ptr p = v->interfaceValue()->member( context, "typecode" );
88
 
    if ( !p )
89
 
      return 0;
90
 
    printf("   tc=%s\n",p->toString().ascii());
91
 
    if ( !convertToTypeCode( context, p ) )
92
 
      return 0;
93
 
    KSTypeCode* tc = p->typeCodeValue();
94
 
    tc->ref();
95
 
    return tc;
96
 
  }
97
 
 
98
 
  context.setException( new KSException( "InvalidTypeCode", v->toString(), -1 ) );
99
 
  return 0;
100
 
}
101
 
 
102
 
#endif