Kaydet (Commit) 16cba772 authored tarafından Daniel Vogelheim's avatar Daniel Vogelheim

#112673# initial checkin of HWP filter

üst 20140e17
..\%__SRC%\bin\*.dll %_DEST%\bin%_EXT%\*.dll
..\%__SRC%\lib\*.lib %_DEST%\bin%_EXT%\*.lib
..\%__SRC%\lib\*.so %_DEST%\lib%_EXT%\*.so
/*************************************************************************
*
* $RCSfile: attributes.cxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: dvo $ $Date: 2003-10-15 14:38:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2001 by Mizi Research Inc.
* Copyright 2003 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Mizi Research Inc.
*
* Copyright: 2001 by Mizi Research Inc.
* Copyright: 2003 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#include <assert.h>
#ifndef __SGI_STL_VECTOR
#include <vector>
#endif
#ifndef _CONFIGMGR_MISC_ATTRIBUTES_HXX_
#include "attributes.hxx"
#endif
//using namespace ::std;
struct TagAttribute
{
TagAttribute(){}
TagAttribute( const OUString &sName, const OUString &sType , const OUString &sValue )
{
this->sName = sName;
this->sType = sType;
this->sValue = sValue;
}
OUString sName;
OUString sType;
OUString sValue;
};
struct AttributeListImpl_impl
{
AttributeListImpl_impl()
{
// performance improvement during adding
vecAttribute.reserve(20);
}
std::vector<struct TagAttribute> vecAttribute;
};
sal_Int16 SAL_CALL AttributeListImpl::getLength(void) throw (RuntimeException)
{
return m_pImpl->vecAttribute.size();
}
AttributeListImpl::AttributeListImpl( const AttributeListImpl &r )
{
m_pImpl = new AttributeListImpl_impl;
*m_pImpl = *(r.m_pImpl);
}
OUString AttributeListImpl::getNameByIndex(sal_Int16 i) throw (RuntimeException)
{
if( i < m_pImpl->vecAttribute.size() )
{
return m_pImpl->vecAttribute[i].sName;
}
return OUString();
}
OUString AttributeListImpl::getTypeByIndex(sal_Int16 i) throw (RuntimeException)
{
if( i < m_pImpl->vecAttribute.size() )
{
return m_pImpl->vecAttribute[i].sType;
}
return OUString();
}
OUString AttributeListImpl::getValueByIndex(sal_Int16 i) throw (RuntimeException)
{
if( i < m_pImpl->vecAttribute.size() )
{
return m_pImpl->vecAttribute[i].sValue;
}
return OUString();
}
OUString AttributeListImpl::getTypeByName( const OUString& sName ) throw (RuntimeException)
{
std::vector<struct TagAttribute>::iterator ii = m_pImpl->vecAttribute.begin();
for( ; ii != m_pImpl->vecAttribute.end() ; ii ++ )
{
if( (*ii).sName == sName )
{
return (*ii).sType;
}
}
return OUString();
}
OUString AttributeListImpl::getValueByName(const OUString& sName) throw (RuntimeException)
{
std::vector<struct TagAttribute>::iterator ii = m_pImpl->vecAttribute.begin();
for( ; ii != m_pImpl->vecAttribute.end() ; ii ++ )
{
if( (*ii).sName == sName )
{
return (*ii).sValue;
}
}
return OUString();
}
AttributeListImpl::AttributeListImpl()
{
m_pImpl = new AttributeListImpl_impl;
}
AttributeListImpl::~AttributeListImpl()
{
delete m_pImpl;
}
void AttributeListImpl::addAttribute( const OUString &sName ,
const OUString &sType ,
const OUString &sValue )
{
m_pImpl->vecAttribute.push_back( TagAttribute( sName , sType , sValue ) );
}
void AttributeListImpl::clear()
{
std::vector<struct TagAttribute> dummy;
m_pImpl->vecAttribute.swap( dummy );
assert( ! getLength() );
}
/*************************************************************************
*
* $RCSfile: attributes.hxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: dvo $ $Date: 2003-10-15 14:34:10 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2001 by Mizi Research Inc.
* Copyright 2003 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Mizi Research Inc.
*
* Copyright: 2001 by Mizi Research Inc.
* Copyright: 2003 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _CONFIGMGR_MISC_ATTRIBUTES_HXX_
#define _CONFIGMGR_MISC_ATTRIBUTES_HXX_
#ifndef _COM_SUN_STAR_XML_SAX_XATTRIBUTELIST_HPP_
#include <com/sun/star/xml/sax/XAttributeList.hpp>
#endif
#ifndef _CPPUHELPER_IMPLBASE1_HXX_
#include <cppuhelper/implbase1.hxx>
#endif
/*----------------------------------------
*
* Attributlist implementation
*
*----------------------------------------*/
using namespace ::cppu;
using namespace ::rtl;
using namespace ::com::sun::star::xml::sax;
using namespace ::com::sun::star::uno;
struct AttributeListImpl_impl;
class AttributeListImpl : public WeakImplHelper1< XAttributeList >
{
protected:
~AttributeListImpl();
public:
AttributeListImpl();
AttributeListImpl( const AttributeListImpl & );
public:
virtual sal_Int16 SAL_CALL getLength(void) throw (RuntimeException);
virtual OUString SAL_CALL getNameByIndex(sal_Int16 i) throw (RuntimeException);
virtual OUString SAL_CALL getTypeByIndex(sal_Int16 i) throw (RuntimeException);
virtual OUString SAL_CALL getTypeByName(const OUString& aName) throw (RuntimeException);
virtual OUString SAL_CALL getValueByIndex(sal_Int16 i) throw (RuntimeException);
virtual OUString SAL_CALL getValueByName(const OUString& aName) throw (RuntimeException);
public:
void addAttribute( const OUString &sName , const OUString &sType , const OUString &sValue );
void clear();
private:
struct AttributeListImpl_impl *m_pImpl;
};
#endif // _CONFIGMGR_MISC_ATTRIBUTES_HXX_
/*************************************************************************
*
* $RCSfile: cspline.cpp,v $
*
* $Revision: 1.1 $
*
* last change: $Author: dvo $ $Date: 2003-10-15 14:38:47 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2001 by Mizi Research Inc.
* Copyright 2003 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Mizi Research Inc.
*
* Copyright: 2001 by Mizi Research Inc.
* Copyright: 2003 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
// Natural, Clamped, or Periodic Cubic Splines
//
// Input: A list of N+1 points (x_i,a_i), 0 <= i <= N, which are sampled
// from a function, a_i = f(x_i). The function f is unknown. Boundary
// conditions are
// (1) Natural splines: f"(x_0) = f"(x_N) = 0
// (2) Clamped splines: f'(x_0) and f'(x_N) are user-specified.
// (3) Periodic splines: f(x_0) = f(x_N) [in which case a_N = a_0 is
// required in the input], f'(x_0) = f'(x_N), and f"(x_0) = f"(x_N).
//
// Output: b_i, c_i, d_i, 0 <= i <= N-1, which are coefficients for the cubic
// spline S_i(x) = a_i + b_i(x-x_i) + c_i(x-x_i)^2 + d_i(x-x_i)^3 for
// x_i <= x < x_{i+1}.
//
// The natural and clamped algorithms were implemented from
//
// Numerical Analysis, 3rd edition
// Richard L. Burden and J. Douglas Faires
// Prindle, Weber & Schmidt
// Boston, 1985, pp. 122-124.
//
// The algorithm sets up a tridiagonal linear system of equations in the
// c_i values. This can be solved in O(N) time.
//
// The periodic spline algorithm was implemented from my own derivation. The
// linear system of equations is not tridiagonal. For now I use a standard
// linear solver that does not take advantage of the sparseness of the
// matrix. Therefore for very large N, you may have to worry about memory
// usage.
#include "solver.h"
//-----------------------------------------------------------------------------
void NaturalSpline (int N, double* x, double* a, double*& b, double*& c,
double*& d)
{
const double oneThird = 1.0/3.0;
int i;
double* h = new double[N];
double* hdiff = new double[N];
double* alpha = new double[N];
for (i = 0; i < N; i++){
h[i] = x[i+1]-x[i];
}
for (i = 1; i < N; i++)
hdiff[i] = x[i+1]-x[i-1];
for (i = 1; i < N; i++)
{
double numer = 3.0*(a[i+1]*h[i-1]-a[i]*hdiff[i]+a[i-1]*h[i]);
double denom = h[i-1]*h[i];
alpha[i] = numer/denom;
}
double* ell = new double[N+1];
double* mu = new double[N];
double* z = new double[N+1];
double recip;
ell[0] = 1.0;
mu[0] = 0.0;
z[0] = 0.0;
for (i = 1; i < N; i++)
{
ell[i] = 2.0*hdiff[i]-h[i-1]*mu[i-1];
recip = 1.0/ell[i];
mu[i] = recip*h[i];
z[i] = recip*(alpha[i]-h[i-1]*z[i-1]);
}
ell[N] = 1.0;
z[N] = 0.0;
b = new double[N];
c = new double[N+1];
d = new double[N];
c[N] = 0.0;
for (i = N-1; i >= 0; i--)
{
c[i] = z[i]-mu[i]*c[i+1];
recip = 1.0/h[i];
b[i] = recip*(a[i+1]-a[i])-h[i]*(c[i+1]+2.0*c[i])*oneThird;
d[i] = oneThird*recip*(c[i+1]-c[i]);
}
delete[] h;
delete[] hdiff;
delete[] alpha;
delete[] ell;
delete[] mu;
delete[] z;
}
void PeriodicSpline (int N, double* x, double* a, double*& b, double*& c,
double*& d)
{
double* h = new double[N];
int i;
for (i = 0; i < N; i++)
h[i] = x[i+1]-x[i];
mgcLinearSystemD sys;
double** mat = sys.NewMatrix(N+1); // guaranteed to be zeroed memory
c = sys.NewVector(N+1); // guaranteed to be zeroed memory
// c[0] - c[N] = 0
mat[0][0] = +1.0f;
mat[0][N] = -1.0f;
// h[i-1]*c[i-1]+2*(h[i-1]+h[i])*c[i]+h[i]*c[i+1] =
// 3*{(a[i+1]-a[i])/h[i] - (a[i]-a[i-1])/h[i-1]}
for (i = 1; i <= N-1; i++)
{
mat[i][i-1] = h[i-1];
mat[i][i ] = 2.0f*(h[i-1]+h[i]);
mat[i][i+1] = h[i];
c[i] = 3.0f*((a[i+1]-a[i])/h[i] - (a[i]-a[i-1])/h[i-1]);
}
// "wrap around equation" for periodicity
// h[N-1]*c[N-1]+2*(h[N-1]+h[0])*c[0]+h[0]*c[1] =
// 3*{(a[1]-a[0])/h[0] - (a[0]-a[N-1])/h[N-1]}
mat[N][N-1] = h[N-1];
mat[N][0 ] = 2.0f*(h[N-1]+h[0]);
mat[N][1 ] = h[0];
c[N] = 3.0f*((a[1]-a[0])/h[0] - (a[0]-a[N-1])/h[N-1]);
// solve for c[0] through c[N]
sys.Solve(N+1,mat,c);
const double oneThird = 1.0/3.0;
b = new double[N];
d = new double[N];
for (i = 0; i < N; i++)
{
b[i] = (a[i+1]-a[i])/h[i] - oneThird*(c[i+1]+2.0f*c[i])*h[i];
d[i] = oneThird*(c[i+1]-c[i])/h[i];
}
sys.DeleteMatrix(N+1,mat);
}
/*************************************************************************
*
* $RCSfile: cspline.h,v $
*
* $Revision: 1.1 $
*
* last change: $Author: dvo $ $Date: 2003-10-15 14:34:20 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2001 by Mizi Research Inc.
* Copyright 2003 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Mizi Research Inc.
*
* Copyright: 2001 by Mizi Research Inc.
* Copyright: 2003 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef _CSPLINE_H_
#define _CSPLINE_H_
void NaturalSpline (int N, double* x, double* a, double*& b, double*& c,
double*& d);
void PeriodicSpline (int N, double* x, double* a, double*& b, double*& c,
double*& d);
#endif /* _CSPLINE_H_ */
/*************************************************************************
*
* $RCSfile: datecode.h,v $
*
* $Revision: 1.1 $
*
* last change: $Author: dvo $ $Date: 2003-10-15 14:34:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2001 by Mizi Research Inc.
* Copyright 2003 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Mizi Research Inc.
*
* Copyright: 2001 by Mizi Research Inc.
* Copyright: 2003 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef __DATECODE_H__
#define __DATACODE_H__
static hchar defaultform[] =
{
'1', 0x9165, 32, '2', 0xB6A9, 32, '3', 0xB7A9, 0
};
static hchar kor_week[] =
{
0xB7A9, 0xB6A9, 0xD1C1, 0xAE81, 0xA1A2, 0x8B71, 0xC9A1
};
static hchar china_week[] =
{
0x4CC8, 0x4BE4, 0x525A, 0x48D8, 0x45AB, 0x4270, 0x50B4
};
static char eng_week[] = { "SunMonTueWedThuFriSat" };
static char eng_mon[] = { "JanFebMarAprMayJunJulAugSepOctNovDec" };
static const char *en_mon[] =
{
"January", "February", "March", "April", "May", "June", "July",
"August", "September", "October", "November", "December"
};
static const char *en_week[] =
{
"Sunday", "Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday"
};
#endif
/*************************************************************************
*
* $RCSfile: drawdef.h,v $
*
* $Revision: 1.1 $
*
* last change: $Author: dvo $ $Date: 2003-10-15 14:34:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 1999 by Mizi Research Inc.
* Copyright 2003 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Mizi Research Inc.
*
* Copyright: 1999 by Mizi Research Inc.
* Copyright: 2003 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
/* NAME $Id: drawdef.h,v 1.1 2003-10-15 14:34:39 dvo Exp $
*
* HISTORY
* frog - Jan 11, 1999: Created.
*/
#ifndef _DRAWDEF_H_
#define _DRAWDEF_H_
#include "hwplib.h"
class HWPPara;
/**
* Constant for drawing objects
*/
enum
{
HWPDO_CONTAINER,
HWPDO_LINE,
HWPDO_RECT,
HWPDO_ELLIPSE,
HWPDO_ARC,
HWPDO_FREEFORM,
HWPDO_TEXTBOX,
HWPDO_CURVE,
HWPDO_ADVANCED_ELLIPSE,
HWPDO_ADVANCED_ARC,
HWPDO_CLOSED_FREEFORM,
HWPDO_NITEMS
};
#define HWPDO_PAT_TYPE_BITS 0xFF000000
#define HWPDO_PAT_STYLE_BITS 0x00FFFFFF
#define HWPDO_PAT_SOLID 0x00000000
#define HWPDO_PAT_WIN_HATCHED 0x01000000
#define HWPDO_PAT_BITMAP 0x02000000
#define HWPDO_COLOR_NONE 0x10000000
#define HWPDO_FLAG_ROUND_CORNER 0x00000001
#define HWPDO_FLAG_DRAW_PIE 0x00000002
#define HWPDO_FLAG_SEMICIRCLE 0x00000004
#define HWPDO_FLAG_SCALE_BITMAP 0x00000008
#define HWPDO_FLAG_LOCAL_BITS 0x0000ffff
#define HWPDO_FLAG_PROPERTY_BITS 0x00ff0000
#define HWPDO_FLAG_GRADATION 0x00010000
#define HWPDO_FLAG_ROTATION 0x00020000
#define HWPDO_FLAG_BITMAP 0x00040000
#define HWPDO_FLAG_AS_TEXTBOX 0x00080000
#define HWPDO_FLAG_WATERMARK 0x00100000
/**
* @short Basic properties for drawing objects
*
* The order of pstyle, hstyle and tstyle is important.
* @see LineObject
*/
struct BAREHWPDOProperty
{
int line_pstyle;
int line_hstyle;
int line_tstyle;
DWORD line_color;
hunit line_width;
DWORD fill_color;
uint pattern_type;
DWORD pattern_color;
hunit hmargin;
hunit vmargin;
uint flag;
};
/**
* @short Gradation properties for drawing object
*/
struct GradationProperty
{
int fromcolor;
int tocolor;
int gstyle;
int angle;
int center_x;
int center_y;
int nstep;
};
/**
* @short Bitmap properties for drawing object
*/
struct BitmapProperty
{
ZZPoint offset1;
ZZPoint offset2;
char szPatternFile[260 + 1];
char pictype;
};
/**
* @short Rotation properties for drawing object
*/
struct RotationProperty
{
int rot_originx;
int rot_originy;
ZZParall parall;
};
/**
* @short All properties for drawing object
*/
struct HWPDOProperty
{
int line_pstyle; // 선 중간 모양
int line_hstyle; // 끝 화살표 모양
int line_tstyle; // 시작 모양
DWORD line_color;
hunit line_width;
DWORD fill_color;
uint pattern_type;
DWORD pattern_color;
hunit hmargin;
hunit vmargin;
uint flag;
/* Lotation properties */
int rot_originx;
int rot_originy;
ZZParall parall;
/* Gradation properties */
int fromcolor;
int tocolor;
int gstyle;
int angle;
int center_x;
int center_y;
int nstep;
/* Watermark */
int luminance;
int contrast;
int greyscale;
/* As TextBox */
HWPPara *pPara;
ZZPoint offset1;
ZZPoint offset2;
char szPatternFile[MAX_PATH + 1];
char pictype;
};
/**
* @short Line Object
*/
struct HWPDOLine
{
uint flip;
};
/**
* @short Polygon or Polyline Object
*/
struct HWPDOFreeForm
{
int npt;
ZZPoint *pt;
};
/**
* @short Textbox Object
*/
struct HWPDOTextBox
{
HWPPara *h;
};
/**
* @short Arc Object
*/
struct HWPDOArc
{
ZZPoint radial[2];
};
/**
* @short Common header for drawing object
*/
struct HWPDrawingObject
{
/**
* type of drawing object
*/
int type;
/**
* offset from origin of current group
*/
ZZPoint offset;
/**
* offset from origin of drawing object
*/
ZZPoint offset2;
ZZSize extent;
/**
* rectangle with consideration of line width
*/
ZZRect vrect;
HWPDOProperty property;
union
{
HWPDOLine line_arc;
HWPDOFreeForm freeform;
HWPDOTextBox textbox;
/**
* extended from hwpw96
*/
HWPDOArc arc;
}
u;
struct HWPDrawingObject *next;
/**
* This exists for container object
*/
struct HWPDrawingObject *child;
int index;
HWPDrawingObject();
~HWPDrawingObject();
};
#endif /* _DRAWDEF_H_ */
This diff is collapsed.
/*************************************************************************
*
* $RCSfile: fontmap.cpp,v $
*
* $Revision: 1.1 $
*
* last change: $Author: dvo $ $Date: 2003-10-15 14:38:55 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2001 by Mizi Research Inc.
* Copyright 2003 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Mizi Research Inc.
*
* Copyright: 2001 by Mizi Research Inc.
* Copyright: 2003 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#include <stdio.h>
#ifdef SOLARIS
#include <strings.h>
#else
#include <string.h>
#endif
struct FontEntry
{
const char *familyname;
int key;
double ratio;
};
/**
* ratio는 한글 70%, 숫자 10% 영문 20%의 비율로 구성되었다는 가정하에 정해진다.
*/
const struct FontEntry FontMapTab[] =
{
{"명조",0, 0.97},
{"고딕",1, 0.97},
{"샘물",1, 0.97},
{"필기",0, 0.97},
{"시스템",1, 0.84},
{"시스템 약자",1, 0.84},
{"시스템 간자",1, 0.84},
{"HY둥근 고딕",2, 0.97},
{"옛한글",0, 0.97},
{"가는공한",0, 0.72},
{"중간공한",0, 0.72},
{"굵은공한",0, 0.72},
{"가는한",0, 0.72},
{"중간한",0, 0.72},
{"굵은한",0, 0.72},
{"휴먼명조",0, 0.97},
{"휴먼고딕",1, 0.97},
{"가는안상수체",0, 0.55},
{"중간안상수체",0, 0.637},
{"굵은안상수체",0, 0.63},
{"휴먼가는샘체",0, 0.666},
{"휴먼중간샘체",0, 0.685},
{"휴먼굵은샘체",0, 0.727},
{"휴먼가는팸체",0, 0.666},
{"휴먼중간팸체",0, 0.685},
{"휴먼굵은팸체",0, 0.727},
{"휴먼옛체",3, 0.97},
{"한양신명조",0, 0.97},
{"한양견명조",1, 0.97},
{"한양중고딕",1, 0.97},
{"한양견고딕",1, 0.97},
{"한양그래픽",0, 0.97},
{"한양궁서",3, 0.97},
{"문화바탕",0, 0.97},
{"문화바탕제목",1, 0.97},
{"문화돋움",1, 0.97},
{"문화돋움제목",0, 0.97},
{"문화쓰기",0, 0.97},
{"문화쓰기흘림",0, 0.97},
{"펜흘림",0, 0.97},
{"복숭아",0, 0.827},
{"옥수수",0, 0.97},
{"오이",0, 0.97},
{"가지",0, 0.97},
{"강낭콩",2, 0.97},
{"딸기",3, 0.97},
{"타이프",0, 0.987},
{"태 나무",1, 0.97},
{"태 헤드라인",0, 0.97},
{"태 가는 헤드라인",0, 0.97},
{"태 헤드라인T",0, 0.97},
{"태 가는 헤드라인T",0, 0.97},
{"양재 다운명조M",0, 0.97},
{"양재 본목각M",0, 0.97},
{"양재 소슬",1, 0.97},
{"양재 매화",1, 0.987},
{"양재 튼튼",0, 0.97},
{"양재 참숯",1, 0.97},
{"양재 둘기",0, 0.97},
{"양재 샤넬",1, 0.97},
{"양재 와당",1, 0.97},
{"신명 세명조",0, 0.97},
{"신명 신명조",0, 0.97},
{"신명 신신명조",0, 0.97},
{"신명 중명조",0, 0.97},
{"신명 태명조",0, 0.97},
{"신명 견명조",0, 0.97},
{"신명 신문명조",0, 0.97},
{"신명 순명조",0, 0.97},
{"신명 세고딕",1, 0.97},
{"신명 중고딕",1, 0.97},
{"신명 태고딕",1, 0.97},
{"신명 견고딕",1, 0.97},
{"신명 세나루",2, 0.97},
{"신명 디나루",2, 0.97},
{"신명 신그래픽",2, 0.97},
{"신명 태그래픽",2, 0.97},
{"신명 궁서",3, 0.97}
};
#define FONTCOUNT 4
#ifndef WIN32
#if defined(LINUX)
char* RepFontTab[] =
{
"백묵 바탕", /* 0 */
"백묵 돋움", /* 1 */
"백묵 굴림", /* 2 */
"백묵 헤드라인" /* 3 */
};
#else
char* RepFontTab[] =
{
"Batang", /* 0 */
"Dotum", /* 1 */
"Gulim", /* 2 */
"Gungso" /* 3 */
};
#endif
#else
char* RepFontTab[] =
{
"바탕", /* 0 */
"돋움", /* 1 */
"굴림", /* 2 */
"궁서" /* 3 */
};
#endif
int getRepFamilyName(const char* orig, char *buf, double &ratio)
{
int i;
int size = sizeof(FontMapTab)/sizeof(FontEntry);
for( i = 0 ; i < size ; i++)
{
if( !strcmp(orig, FontMapTab[i].familyname) ){
ratio = FontMapTab[i].ratio;
return strlen( strcpy(buf,RepFontTab[FontMapTab[i].key]) );
}
}
ratio = FontMapTab[0].ratio;
return strlen( strcpy(buf, RepFontTab[0] ) );
}
This diff is collapsed.
/*************************************************************************
*
* $RCSfile: formula.h,v $
*
* $Revision: 1.1 $
*
* last change: $Author: dvo $ $Date: 2003-10-15 14:34:58 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2001 by Mizi Research Inc.
* Copyright 2003 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Mizi Research Inc.
*
* Copyright: 2001 by Mizi Research Inc.
* Copyright: 2003 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#ifndef __FORMULA_H__
#define __FORMULA_H__
// DVO: remove DEBUG dependency
// #ifndef DEBUG
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
#include "attributes.hxx"
// DVO: remove DEBUG dependency
// #endif
class Node;
// DVO: remove DEBUG dependency
// #ifndef DEBUG
using namespace ::com::sun::star::xml::sax;
// #endif
class Formula{
public:
Formula(char *_eq, int _ishwpeq = 1) {
eq = _eq;
isHwpEQ = _ishwpeq;
trim();
}
virtual ~Formula(){ }
// DVO: remove DEBUG dependency
// #ifndef DEBUG
void setDocumentHandler(Reference < XDocumentHandler > xHandler ){
rDocumentHandler = xHandler;
}
void setAttributeListImpl( AttributeListImpl *p ){
pList = p;
rList = (XAttributeList *) pList;
}
// DVO: remove DEBUG dependency
// #endif
int parse();
private:
void trim();
void makeMathML(Node *res);
void makeLines(Node *res);
void makeLine(Node *res);
void makeExprList(Node *res);
void makeExpr(Node *res);
void makePrimary(Node *res);
void makeIdentifier(Node *res);
void makeSubSup(Node *res);
void makeUnderOver(Node *res);
void makeFraction(Node *res);
void makeDecoration(Node *res);
void makeFunction(Node *res);
void makeRoot(Node *res);
void makeArrow(Node *res);
void makeAccent(Node *res);
void makeParenth(Node *res);
void makeFence(Node *res);
void makeBracket(Node *res);
void makeBlock(Node *res);
void makeOperator(Node *res);
void makeDelimeter(Node *res);
void makeBegin(Node *res);
void makeEnd(Node *res);
private:
// DVO: remove DEBUG dependency
// #ifndef DEBUG
Reference< XDocumentHandler > rDocumentHandler;
Reference< XAttributeList > rList;
AttributeListImpl *pList;
// DVO: remove DEBUG dependency
// #endif
char *eq;
int isHwpEQ;
};
#endif
This diff is collapsed.
/*************************************************************************
*
* $RCSfile: grammar.h,v $
*
* $Revision: 1.1 $
*
* last change: $Author: dvo $ $Date: 2003-10-15 14:35:08 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2001 by Mizi Research Inc.
* Copyright 2003 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Mizi Research Inc.
*
* Copyright: 2001 by Mizi Research Inc.
* Copyright: 2003 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
typedef union {
char *dval;
char *str;
Node *ptr;
} YYSTYPE;
#define ACCENT 257
#define SMALL_GREEK 258
#define CAPITAL_GREEK 259
#define BINARY_OPERATOR 260
#define RELATION_OPERATOR 261
#define ARROW 262
#define GENERAL_IDEN 263
#define GENERAL_OPER 264
#define BIG_SYMBOL 265
#define FUNCTION 266
#define ROOT 267
#define FRACTION 268
#define SUBSUP 269
#define EQOVER 270
#define DELIMETER 271
#define LARGE_DELIM 272
#define DECORATION 273
#define SPACE_SYMBOL 274
#define CHARACTER 275
#define STRING 276
#define OPERATOR 277
#define EQBEGIN 278
#define EQEND 279
#define EQLEFT 280
#define EQRIGHT 281
#define NEWLINE 282
#define LEFT_DELIM 283
#define RIGHT_DELIM 284
#define DIGIT 285
#ifndef _WIN32
extern YYSTYPE yylval;
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*************************************************************************
*
* $RCSfile: hcode.h,v $
*
* $Revision: 1.1 $
*
* last change: $Author: dvo $ $Date: 2003-10-15 14:35:27 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2001 by Mizi Research Inc.
* Copyright 2003 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Mizi Research Inc.
*
* Copyright: 2001 by Mizi Research Inc.
* Copyright: 2003 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
/* $Id: hcode.h,v 1.1 2003-10-15 14:35:27 dvo Exp $ */
#ifndef _HCODE_H_
#define _HCODE_H_
#include "hwplib.h"
/**
* Codetype of Korean
* KSSM - Johap, KS - Wansung
*/
enum { KSSM, KS, UNICODE };
/**
* Transfer combination-code for internal using of hwp to ascii
*/
DLLEXPORT int hcharconv(hchar ch, hchar *dest, int codeType) ;
DLLEXPORT int kssm_hangul_to_ucs2(hchar ch, hchar *dest) ;
DLLEXPORT hchar ksc5601_han_to_ucs2 (hchar);
DLLEXPORT hchar ksc5601_sym_to_ucs2 (hchar);
DLLEXPORT hchar* hstr2ucsstr(hchar* hstr, hchar* ubuf);
/**
* 한컴스트링을 완성형스트링으로 변환한다.
*/
DLLEXPORT int hstr2ksstr(hchar* hstr, char* buf);
/**
* 한글을 포함할 수 있는 char형스트링을 한컴스트링으로 변환한다.
*/
DLLEXPORT hchar *kstr2hstr( uchar *src, hchar *dest );
/**
* hwp의 경로를 unix형태로 바꾼다.
*/
DLLEXPORT char *urltounix(const char *src, char *buf );
/**
* hwp의 경로를 windows형태로 바꾼다.
*/
#ifdef _WIN32
DLLEXPORT char *urltowin(const char *src, char *buf );
#endif
/**
* Transfer interger to string following format
*/
DLLEXPORT char* Int2Str(int value, const char *format, char *buf);
/**
* color인덱스 값과 음영값을 조합하여 스타오피스의 color로 변환
*/
DLLEXPORT char *hcolor2str(uchar color, uchar shade, char *buf, bool bIsChar = false);
DLLEXPORT char *base64_encode_string( const uchar *buf, unsigned int len );
DLLEXPORT double calcAngle(int x1, int y1, int x2, int y2);
#endif /* _HCODE_H_ */
/*************************************************************************
*
* $RCSfile: hfont.cpp,v $
*
* $Revision: 1.1 $
*
* last change: $Author: dvo $ $Date: 2003-10-15 14:39:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2001 by Mizi Research Inc.
* Copyright 2003 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Mizi Research Inc.
*
* Copyright: 2001 by Mizi Research Inc.
* Copyright: 2003 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
/* $Id: hfont.cpp,v 1.1 2003-10-15 14:39:39 dvo Exp $ */
#include "precompile.h"
#include "hwplib.h"
#include "hwpfile.h"
#include "hfont.h"
/* 이 함수는 HWP 파일을 해석하는 부분이다. */
HWPFont::HWPFont(void)
{
for (int ii = 0; ii < NLanguage; ii++)
{
nFonts[ii] = 0;
fontnames[ii] = NULL;
}
}
HWPFont::~HWPFont(void)
{
for (int ii = 0; ii < NLanguage; ii++)
{
nFonts[ii] = 0;
delete[]fontnames[ii];
}
}
int HWPFont::NFonts(int lang)
{
if (!(lang >= 0 && lang < NLanguage))
return 0;
return nFonts[lang];
}
int HWPFont::AddFont(int lang, const char *font)
{
int nfonts;
if (!(lang >= 0 && lang < NLanguage))
return 0;
nfonts = nFonts[lang];
if (MAXFONTS <= nfonts)
return 0;
strncpy(fontnames[lang] + FONTNAMELEN * nfonts, font, FONTNAMELEN - 1);
nFonts[lang]++;
return nfonts;
}
const char *HWPFont::GetFontName(int lang, int id)
{
if (!(lang >= 0 && lang < NLanguage))
return 0;
if (id < 0 || nFonts[lang] <= id)
return 0;
return fontnames[lang] + id * FONTNAMELEN;
}
static char buffer[FONTNAMELEN];
bool HWPFont::Read(HWPFile & hwpf)
{
int lang = 0;
short nfonts = 0;
//printf("HWPFont::Read : lang = %d\n",NLanguage);
for(lang = 0; lang < NLanguage; lang++)
{
hwpf.Read2b(&nfonts, 1);
if (!(nfonts > 0 && nfonts < MAXFONTS))
{
return !hwpf.SetState(HWP_InvalidFileFormat);
}
fontnames[lang] = new char[nfonts * FONTNAMELEN];
memset(fontnames[lang], 0, nfonts * FONTNAMELEN);
for (int jj = 0; jj < nfonts; jj++)
{
hwpf.ReadBlock(buffer, FONTNAMELEN);
AddFont(lang, buffer);
}
}
return !hwpf.State();
}
/*************************************************************************
*
* $RCSfile: hfont.h,v $
*
* $Revision: 1.1 $
*
* last change: $Author: dvo $ $Date: 2003-10-15 14:35:36 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2001 by Mizi Research Inc.
* Copyright 2003 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* 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
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (the "License"); You may not use this file
* except in compliance with the License. You may obtain a copy of the
* License at http://www.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Mizi Research Inc.
*
* Copyright: 2001 by Mizi Research Inc.
* Copyright: 2003 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
/* $Id: hfont.h,v 1.1 2003-10-15 14:35:36 dvo Exp $ */
#ifndef _HWPFONTS_H_
#define _HWPFONTS_H_
#include <stdlib.h>
#include <string.h>
#define MAXFONTS 256
#define FONTNAMELEN 40
class HWPFile;
/**
* The HWPFont class has the font list for the document when it's saved.
* @short Font information
*/
class DLLEXPORT HWPFont
{
protected:
/**
* System font count for each language
* NLanguage is 7 in common case.
*/
int nFonts[NLanguage];
/**
* list of the font family name
*/
char *fontnames[NLanguage];
public:
HWPFont(void);
~HWPFont(void);
/**
* @param lang Language index
* @returns Count of the font list for given language
*/
int NFonts(int lang);
/**
* Adds a font into font list of a language
* @param lang Language index
* @param font Name of font family
*/
int AddFont( int lang, const char *font );
/**
* @param lang Language index
* @param id Index of font
* @returns Font name
*/
const char *GetFontName( int lang, int id );
bool Read( HWPFile &hwpf );
};
#endif /* _HWPFONTS+H_ */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
UDK_3_0_0 {
global:
component_getImplementationEnvironment;
component_writeInfo;
component_getFactory;
component_getDescriptionFunc;
local:
*;
};
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment