Commit da94fa8d authored by Elen.Subbotina's avatar Elen.Subbotina Committed by Alexander Trofimov

SvmFile

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@62623 954022d7-b5bf-4e40-9824-e11837661b57
parent 4fd9649a
......@@ -7281,6 +7281,13 @@ DesktopEditor/raster/Metafile svnc_tsvn_003alogminsize=5 svn_global_002dignores
DesktopEditor/raster/Metafile/Common svnc_tsvn_003alogminsize=5
DesktopEditor/raster/Metafile/Emf svnc_tsvn_003alogminsize=5
DesktopEditor/raster/Metafile/Wmf svnc_tsvn_003alogminsize=5
DesktopEditor/raster/SvmFile svnc_tsvn_003alogminsize=5
DesktopEditor/raster/SvmFile/Source svnc_tsvn_003alogminsize=5
DesktopEditor/raster/SvmFile/Source/ASC svnc_tsvn_003alogminsize=5
DesktopEditor/raster/SvmFile/Source/gdi svnc_tsvn_003alogminsize=5
DesktopEditor/raster/SvmFile/Source/tools svnc_tsvn_003alogminsize=5
DesktopEditor/raster/SvmFile/Source/vcl svnc_tsvn_003alogminsize=5
DesktopEditor/raster/SvmFile/win32 svnc_tsvn_003alogminsize=5
DjVuFile/DjVuFileTest svnc_tsvn_003alogminsize=5
DjVuFile/libdjvu svnc_tsvn_003alogminsize=5
DoctRenderer/COMMON/Dlls/AVSGraphics.dll svn_mime_002dtype=application%2Foctet-stream
......@@ -2,7 +2,7 @@
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Name="OdfFormat"
Name="OdfFormatWriter"
ProjectGUID="{E5A67556-44DA-4481-8F87-0A3AEDBD20DD}"
RootNamespace="OdfFormat"
Keyword="Win32Proj"
......
......@@ -574,7 +574,10 @@ namespace NSFile
{
return m_lFileSize;
}
inline long GetFilePosition()
{
return m_lFilePosition;
}
bool OpenFile(const std::wstring& sFileName)
{
#if defined(_WIN32) || defined(_WIN32_WCE) || defined(_WIN64)
......@@ -639,7 +642,14 @@ namespace NSFile
m_lFilePosition = 0;
return true;
}
bool SeekFile(int lFilePosition)
{
if (!m_pFile)
return false;
m_lFilePosition = fseek(m_pFile, lFilePosition, 0);
return true;
}
bool ReadFile(BYTE* pData, DWORD nBytesToRead, DWORD& dwSizeRead)
{
if (!m_pFile)
......
......@@ -4,6 +4,7 @@
#include "Jp2/J2kFile.h"
#include "JBig2/source/JBig2File.h"
#include "SvmFile/source/SvmFile.h"
bool CBgraFrame::OpenFile(const std::wstring& strFileName, unsigned int nFileType)
{
......@@ -12,7 +13,12 @@ bool CBgraFrame::OpenFile(const std::wstring& strFileName, unsigned int nFileTyp
Jpeg2000::CJ2kFile oJ2;
return oJ2.Open(this, strFileName, std::wstring(L""));
}
else
if (22/*CXIMAGE_FORMAT_SVM*/ == nFileType)
{
SvmFile::CSvmFile oSvm;
return oSvm.Open(this, strFileName);
}
else
{
NSFile::CFileBinary oFile;
if (!oFile.OpenFile(strFileName))
......
#include "ASCBasic.h"
//11111
//#include <windows.h>
//#include <tchar.h>
///1111
#include "../vcl/saldata.hxx"
XubString::XubString( ByteString pBuffer, unsigned short nCharSet )
{
int nWinCodePage = SVMCore::rtl_getWindowsCodePageFromTextEncoding( nCharSet );
int nBufSize = ::MultiByteToWideChar(nWinCodePage, 0, pBuffer.GetBuffer(), -1, NULL, NULL);
nBufSize--;// nBufSize -
::MultiByteToWideChar(nWinCodePage, 0, pBuffer.GetBuffer(), -1, AllocBuffer( nBufSize ), nBufSize);
}
XubString::XubString( ByteString pBuffer, int nLen, unsigned short nCharSet )
{
(*this) = XubString( pBuffer, nCharSet );
m_oString = m_oString.substr( 0, nLen);
}
bool XubString::EqualsAscii( ByteString sText ) const
{
XubString sUniText( sText, GetACP() );
if( sUniText == (*this) )
return true;
else
return false;
}
bool XubString::EqualsAscii( ByteString sText, int nIndex, int nLen ) const
{
XubString sUniText( sText, GetACP() );
if( 0 == m_oString.compare( nIndex, nLen, sUniText.m_oString ) )
return true;
else
return false;
}
int XubString::CompareIgnoreCaseToAscii( char* pcStr, int nLen ) const
{
XubString oTemp1 = (*this);
XubString oTemp2( ByteString( pcStr ), GetACP() );
std::transform( oTemp1.m_oString.begin(), oTemp1.m_oString.end(), oTemp1.m_oString.begin(), tolower);
std::transform( oTemp2.m_oString.begin(), oTemp2.m_oString.end(), oTemp2.m_oString.begin(), tolower);
return oTemp1.m_oString.compare( 0, nLen, oTemp2.m_oString );
}
ByteString::ByteString( XubString pBuffer, unsigned short nCharSet )
{
}
unsigned short gsl_getSystemTextEncoding(void)
{
// default ansi codepage
TCHAR codepage[7];
int nRes = GetLocaleInfo( LOCALE_SYSTEM_DEFAULT, LOCALE_IDEFAULTANSICODEPAGE, codepage, 6 );
int nWinCodePage = CP_ACP;
if( nRes != 0 )
nWinCodePage = _wtoi(codepage);
return SVMCore::rtl_getTextEncodingFromWindowsCodePage( nWinCodePage );
}
#pragma once
#include "OpenOfficeBasic.h"
#include <stdlib.h>
#include <string>
#include <algorithm>
enum StringCompare { COMPARE_LESS = -1, COMPARE_EQUAL = 0, COMPARE_GREATER = 1 };
template <class T, class Char>
class TString
{
protected: T m_oString;
public: TString(){}
public: TString( const Char* pBuffer ):m_oString(pBuffer){}
public: TString( const TString& oStr, int nStart, int nLength ):m_oString(oStr.m_oString.substr( nStart, nLength )){}
public: unsigned int Len() const { return m_oString.length(); }
public: Char * GetBuffer() const
{
const Char * pcBuffer = m_oString.c_str();
return const_cast<Char *>(pcBuffer);
}
public: Char * AllocBuffer( unsigned short nSize )
{
int nCurSize = m_oString.size();
if( nCurSize < nSize )
m_oString.resize( nSize );
return GetBuffer();
}
public: Char GetChar( int nIndex ) const
{
if( nIndex >= 0 && nIndex < m_oString.length() )
return m_oString[ nIndex ];
else
return Char();
}
public: void SetChar( int nIndex, Char cNewChar )
{
if( nIndex >= 0 && nIndex < m_oString.length() )
m_oString.insert( nIndex, 1, cNewChar );
}
public: void Append( Char cChar )
{
m_oString.push_back( cChar );
}
public: void Append( TString sString )
{
m_oString.append( sString.m_oString );
}
public: TString& Erase( int nIndex = 0, int nCount = STRING_LEN )
{
m_oString.erase( nIndex, nCount );
return (*this);
}
public: TString Copy( int nIndex, int nLen ) const
{
return TString( m_oString.substr( nIndex, nLen).c_str() );
}
public: bool Equals( TString sText, int nIndex, int nLen ) const
{
if( Len() != sText.Len() )
return false;
for( int i = nIndex; i < m_oString.length() && i < sText.m_oString.length() && i < nLen; i++ )
if( m_oString[i] != sText.m_oString[i] )
return false;
return true;
}
public: bool EqualsIgnoreCaseAscii( TString sText ) const
{
TString oTemp1 = (*this);
TString oTemp2 = sText;
std::transform( oTemp1.m_oString.begin(), oTemp1.m_oString.end(), oTemp1.m_oString.begin(), tolower);
std::transform( oTemp2.m_oString.begin(), oTemp2.m_oString.end(), oTemp2.m_oString.begin(), tolower);
return oTemp1.Equals( oTemp2, 0, oTemp2.Len() );
}
public: StringCompare CompareTo( TString oStr ) const
{
int nRes = m_oString.compare( oStr.m_oString );
if( nRes > 0 )
return COMPARE_GREATER;
else if( nRes < 0 )
return COMPARE_LESS;
else
return COMPARE_EQUAL;
}
public: void operator=( TString sText )
{
m_oString = sText.m_oString;
}
public: bool operator==( TString sText ) const
{
return m_oString == sText.m_oString;
}
public: bool operator!=( TString sText ) const
{
return !( (*this) == sText );
}
public: void operator+=( Char cChar )
{
m_oString.append( cChar, 1 );
}
public: bool operator<( TString sText ) const
{
bool bRes = m_oString < sText.m_oString;
return bRes;
}
public: operator size_t() const
{
return Len();
}
protected: TString GetToken( int nToken, Char cTok, int& rIndex ) const
{
const Char* pStr = GetBuffer();
int nLen = m_oString.length();
int nTok = 0;
int nFirstChar = rIndex;
int i = nFirstChar;
// Bestimme die Token-Position und Laenge
pStr += i;
while ( i < nLen )
{
// Stimmt das Tokenzeichen ueberein, dann erhoehe TokCount
if ( *pStr == cTok )
{
++nTok;
if ( nTok == nToken )
nFirstChar = i+1;
else
{
if ( nTok > nToken )
break;
}
}
++pStr,
++i;
}
if ( nTok >= nToken )
{
if ( i < nLen )
rIndex = i+1;
else
rIndex = -1;
return Copy( nFirstChar, i-nFirstChar );
}
else
{
rIndex = -1;
return TString();
}
}
};
class ByteString;
class XubString : public TString< std::wstring, wchar_t >
{
public: XubString( ){}
public: XubString( const wchar_t* pBuffer ):TString< std::wstring, wchar_t >(pBuffer){}
public: XubString( ByteString pBuffer, unsigned short nCharSet );
public: XubString( ByteString pBuffer, int nLen, unsigned short nCharSet );
public: XubString( wchar_t* pBuffer, int nLength )
{
m_oString.append( pBuffer, nLength );
}
public: XubString( XubString pBuffer, int nStart, int nLength ):TString< std::wstring, wchar_t >(pBuffer, nStart, nLength){}
public: XubString GetToken( int nToken, wchar_t cTok = ';' ) const
{
int nTemp = 0;
TString< std::wstring, wchar_t > oTempString = TString< std::wstring, wchar_t >::GetToken( nToken, cTok, nTemp );
XubString oRes = XubString( oTempString.GetBuffer() );
return oRes;
}
public: bool EqualsAscii( ByteString sText ) const;
public: bool EqualsAscii( ByteString sText, int nIndex, int nLen ) const;
public: int CompareIgnoreCaseToAscii( char* pcStr, int nLen ) const;
};
class ByteString : public TString< std::string, char >
{
public: ByteString( ){}
public: ByteString( const char* pBuffer ):TString< std::string, char >(pBuffer){}
public: ByteString( XubString pBuffer, unsigned short nCharSet );
public: ByteString( char* pBuffer, int nLength )
{
m_oString.append( pBuffer, nLength );
}
public: ByteString( ByteString pBuffer, int nStart, int nLength ):TString< std::string, char >(pBuffer, nStart, nLength){}
};
typedef XubString String;
typedef XubString UniString;
unsigned short gsl_getSystemTextEncoding(void);
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
#include "AvsSalGraphics.h"
//#include <gdiplus.h>
//
//#pragma comment(lib, "gdiplus.lib")
//
//using namespace Gdiplus;
//
//void AvsGraphics::drawPixel( long nX, long nY )
// {
// if ( mbXORMode )
// {
// HBRUSH hBrush = CreateSolidBrush( mnPenColor );
// HBRUSH hOldBrush = SelectBrush( mhDC, hBrush );
// PatBlt( mhDC, (int)nX, (int)nY, (int)1, (int)1, PATINVERT );
// SelectBrush( mhDC, hOldBrush );
// DeleteBrush( hBrush );
// }
// else
// ::SetPixel( mhDC, (int)nX, (int)nY, mnPenColor );
// }
//void AvsGraphics::drawPixel( long nX, long nY, Color oColor )
//{
// COLORREF nCol = PALETTERGB( oColor.GetRed() ,oColor.GetGreen(), oColor.GetBlue() );
//
// if ( !mbPrinter &&
// GetSalData()->mhDitherPal &&
// ImplIsSysColorEntry( nSalColor ) )
// nCol = PALRGB_TO_RGB( nCol );
//
// if ( mbXORMode )
// {
// HBRUSH hBrush = CreateSolidBrush( nCol );
// HBRUSH hOldBrush = SelectBrush( mhDC, hBrush );
// PatBlt( mhDC, (int)nX, (int)nY, (int)1, (int)1, PATINVERT );
// SelectBrush( mhDC, hOldBrush );
// DeleteBrush( hBrush );
// }
// else
// ::SetPixel( mhDC, (int)nX, (int)nY, nCol );
//}
\ No newline at end of file
#pragma once
#include "OpenOfficeBasic.h"
#include "../tools/errcode.hxx"
#include "../tools/textenc.h"
#include "ASCBasic.h"
namespace SVMCore{
//\tools\inc\tools\stream.hxx
// read, write, create,... options
#define STREAM_READ 0x0001 // allow read accesses
#define STREAM_WRITE 0x0002 // allow write accesses
#define COMPRESSMODE_FULL (sal_uInt16)0xFFFF
#define COMPRESSMODE_NONE (sal_uInt16)0x0000
#define COMPRESSMODE_ZBITMAP (sal_uInt16)0x0001
#define COMPRESSMODE_NATIVE (sal_uInt16)0x0010
#define NUMBERFORMAT_INT_BIGENDIAN (sal_uInt16)0x0000
#define NUMBERFORMAT_INT_LITTLEENDIAN (sal_uInt16)0xFFFF
#define STREAM_SEEK_TO_BEGIN 0L
#define STREAM_SEEK_TO_END ULONG_MAX
class SvStream
{
private: sal_uInt16 m_nCompressionMode;
private: sal_uInt32 nError;
private: rtl_TextEncoding eStreamCharSet;
public: virtual bool Open( std::wstring sFilename ) = 0;
public: virtual int Read( void* pData, int nSize ) = 0;
public: virtual sal_Size Seek( sal_Size nFilePos ) = 0;
public: virtual sal_Size Tell() = 0;
public: virtual SvStream* CreateInstance() = 0;
public: virtual void SetBuffer( char* pcBuffer, sal_uInt32 nSize ) = 0;
public: virtual bool IsEof() = 0;
public: SvStream()
{
nError = SVSTREAM_OK;
m_nCompressionMode = COMPRESSMODE_NONE;
eStreamCharSet = RTL_TEXTENCODING_DONTKNOW;
}
public: virtual ~SvStream(){}
public:SvStream& operator >> ( long& r )
{
Read( &r, sizeof( long ) );
return *this;
}
public:SvStream& operator >> ( short& r )
{
Read( &r, sizeof( short ) );
return *this;
}
public:SvStream& operator >> ( int& r )
{
Read( &r, sizeof( int ) );
return *this;
}
public:SvStream& operator>>( signed char& r )
{
Read( &r, sizeof( signed char ) );
return *this;
}
public:SvStream& operator>>( char& r )
{
Read( &r, sizeof( char ) );
return *this;
}
public:SvStream& operator>>( unsigned char& r )
{
Read( &r, sizeof( unsigned char ) );
return *this;
}
public:SvStream& operator>>( unsigned short& r )
{
Read( &r, sizeof( unsigned short ) );
return *this;
}
public:SvStream& operator>>( unsigned long& r )
{
Read( &r, sizeof( unsigned long ) );
return *this;
}
public:SvStream& operator>>( float& r )
{
Read( &r, sizeof( float ) );
return *this;
}
public:SvStream& operator>>( double& r )
{
Read( &r, sizeof( double ) );
return *this;
}
public:SvStream& operator>>( wchar_t& r )
{
Read( &r, sizeof( wchar_t ) );
return *this;
}
public:SvStream& operator>>( ByteString& r )
{
ReadByteString( r );
return *this;
}
public:sal_uInt16 GetCompressMode()
{
return m_nCompressionMode;
}
public:void SetCompressMode( sal_uInt16 nCompMode )
{
m_nCompressionMode = nCompMode;
}
public: sal_uInt16 GetNumberFormatInt()
{
return NUMBERFORMAT_INT_LITTLEENDIAN;
}
// -----------------------------------------------------------------------
public: SvStream& ReadByteString( String& rStr, rtl_TextEncoding eSrcCharSet )
{
// read UTF-16 string directly from stream ?
if (eSrcCharSet == RTL_TEXTENCODING_UNICODE)
{
sal_uInt32 nLen;
operator>> (nLen);
if (nLen)
{
#ifdef AVS
if (nLen > STRING_MAXLEN) {
SetError(SVSTREAM_GENERALERROR);
return *this;
}
#endif
sal_Unicode *pStr = rStr.AllocBuffer(nLen);
//BOOST_STATIC_ASSERT(STRING_MAXLEN <= SAL_MAX_SIZE / 2);
Read( pStr, nLen << 1 );
#ifdef AVS
if (bSwap)
for (sal_Unicode *pEnd = pStr + nLen; pStr < pEnd; pStr++)
SwapUShort((sal_uInt16&)(*pStr));
#endif
}
else
rStr = String();
return *this;
}
ByteString oTempString;
ReadByteString( oTempString );
rStr = String( oTempString, eSrcCharSet );
return *this;
}
// -----------------------------------------------------------------------
public: SvStream& ReadByteString( ByteString& rStr )
{
sal_uInt16 nLen = 0;
operator>>( nLen );
if( nLen )
{
char* pTmp = rStr.AllocBuffer( nLen );
Read( pTmp, nLen );
}
else
rStr = ByteString("");
return *this;
}
public: sal_Size SeekRel( sal_sSize nPos )
{
sal_Size nActualPos = Tell();
if ( nPos >= 0 )
{
if ( SAL_MAX_SIZE - nActualPos > (sal_Size)nPos )
nActualPos += nPos;
}
else
{
sal_Size nAbsPos = (sal_Size)-nPos;
if ( nActualPos >= nAbsPos )
nActualPos -= nAbsPos;
}
return Seek( nActualPos );
}
public: void SetError( sal_uInt32 nErrorCode )
{
if ( nError == SVSTREAM_OK )
nError = nErrorCode;
}
public: sal_uInt32 GetError() const { return ERRCODE_TOERROR(nError); }
public: void ResetError() { nError = SVSTREAM_OK; }
public: rtl_TextEncoding GetStreamCharSet() const { return eStreamCharSet; }
};
}//SVMCore
\ No newline at end of file
#pragma once
//#include "../tools/errcode.hxx"
namespace SVMCore{
#define M_PI 3.1415
//template<typename T> inline T Min(T a, T b) { return (a<b?a:b); }
//template<typename T> inline T Max(T a, T b) { return (a>b?a:b); }
//template<typename T> inline T Abs(T a) { return (a>=0?a:-a); }
#if defined(_WIN32) || defined(_WIN64)
typedef __int64 sal_Int64;
typedef unsigned __int64 sal_uInt64;
#else
typedef int64_t sal_Int64;
typedef uint64_t sal_uInt64;
#endif
#define SAL_TYPES_SIZEOFSHORT 2
#define SAL_TYPES_SIZEOFLONG 4
#define SAL_W32
#define SAL_TYPES_SIZEOFPOINTER 4
#define STRING_NOTFOUND ((xub_StrLen)0xFFFF)
#define STRING_MATCH ((xub_StrLen)0xFFFF)
#define STRING_LEN ((xub_StrLen)0xFFFF)
#define STRING_MAXLEN ((xub_StrLen)0xFFFF)
// By changes you must also change: rsc/vclrsc.hxx
enum MapUnit { MAP_100TH_MM, MAP_10TH_MM, MAP_MM, MAP_CM,
MAP_1000TH_INCH, MAP_100TH_INCH, MAP_10TH_INCH, MAP_INCH,
MAP_POINT, MAP_TWIP, MAP_PIXEL, MAP_SYSFONT, MAP_APPFONT,
MAP_RELATIVE, /*MAP_REALAPPFONT,*/ MAP_LASTENUMDUMMY };
/********************************************************************************/
/* Useful defines
*/
/* The following SAL_MIN_INTn defines codify the assumption that the signed
* sal_Int types use two's complement representation. Defining them as
* "-0x7F... - 1" instead of as "-0x80..." prevents warnings about applying the
* unary minus operator to unsigned quantities.
*/
#define SAL_MIN_INT8 ((sal_Int8) (-0x7F - 1))
#define SAL_MAX_INT8 ((sal_Int8) 0x7F)
#define SAL_MAX_UINT8 ((sal_uInt8) 0xFF)
#define SAL_MIN_INT16 ((sal_Int16) (-0x7FFF - 1))
#define SAL_MAX_INT16 ((sal_Int16) 0x7FFF)
#define SAL_MAX_UINT16 ((sal_uInt16) 0xFFFF)
#define SAL_MIN_INT32 ((sal_Int32) (-0x7FFFFFFF - 1))
#define SAL_MAX_INT32 ((sal_Int32) 0x7FFFFFFF)
#define SAL_MAX_UINT32 ((sal_uInt32) 0xFFFFFFFF)
#define SAL_MIN_INT64 ((sal_Int64) (SAL_CONST_INT64(-0x7FFFFFFFFFFFFFFF) - 1))
#define SAL_MAX_INT64 ((sal_Int64) SAL_CONST_INT64(0x7FFFFFFFFFFFFFFF))
#define SAL_MAX_UINT64 ((sal_uInt64) SAL_CONST_UINT64(0xFFFFFFFFFFFFFFFF))
#if SAL_TYPES_SIZEOFLONG == 4
#define SAL_MAX_SSIZE SAL_MAX_INT32
#define SAL_MAX_SIZE SAL_MAX_UINT32
#elif SAL_TYPES_SIZEOFLONG == 8
#define SAL_MAX_SSIZE SAL_MAX_INT64
#define SAL_MAX_SIZE SAL_MAX_UINT64
#endif
//\cosv\inc\cosv\csv_env.hxx
// Exact length builtin types
typedef signed char INT8;
typedef unsigned char UINT8;
typedef short INT16;
typedef unsigned short UINT16;
typedef long INT32;
typedef unsigned long UINT32;
typedef float REAL32;
typedef double REAL64;
// Additional builtin types
typedef INT32 intt; // standard sized integer.
typedef UINT32 uintt; // standard sized unsigned integer.
typedef REAL64 real; // standard sized real.
// Constants
// ---------
// Zero-pointer for use in ellipsed (...) parameter lists which expect a
// pointer which may have another size than an int.
// Must be a define to be used in precompiled headers:
#define NIL ((void*)0)
// char '\0'
#define NULCH '\0'
// Boolesche Operatoren
#define AND &&
#define OR ||
#define NOT !
// Macro for distinguishing dynamic allocated pointers from
// referencing pointers
#define DYN // Exact specification: DYN has to be used if and only if:
// 1. DYN specifies a class member pointer or reference variable and
// the class must free the referenced memory.
// 2. DYN specifies a pointer or reference (return-) parameter of a function
// and for in-parameters the function or its class
// must free the referenced memory, the parameter is then called
// a let-parameter.
// For out- and inout-parameters
// or return values the caller of the function hast to
// free the referenced memory.
//
// It is irrelevant who allocated the memory!
//
// DYN - variables use the prefixes "dp" or "dr" instead of "p" or "r".
//****** Assertions ******//
//\sc\addin\inc\addin.h
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#undef NULL
#define NULL 0
typedef unsigned char BOOL;
typedef unsigned char BYTE;
typedef unsigned short USHORT;
typedef unsigned long ULONG;
//\vos\inc\vos\macros.hxx
#ifndef VOS_BOUND
# define VOS_BOUND(x,l,h) ((x) <= (l) ? (l) : ((x) >= (h) ? (h) : (x)))
#endif
//\sal\inc\sal\types.h
//#if defined(SAL_W32) || defined(SAL_OS2) || defined(SAL_UNX)
# define SAL_MAX_ENUM 0x7fffffff
//#elif defined(SAL_W16)
//# define SAL_MAX_ENUM 0x7fff
//#endif
/* Boolean */
typedef unsigned char sal_Bool;
# define sal_False ((sal_Bool)0)
# define sal_True ((sal_Bool)1)
/* char is assumed to always be 1 BYTE long */
typedef signed char sal_Int8;
typedef unsigned char sal_uInt8;
#if SAL_TYPES_SIZEOFSHORT == 2
typedef signed short sal_Int16;
typedef unsigned short sal_uInt16;
#else
#error "Could not find 16-bit type, add support for your architecture"
#endif
#if SAL_TYPES_SIZEOFLONG == 4
typedef signed long sal_Int32;
typedef unsigned long sal_uInt32;
#define SAL_PRIdINT32 "ld"
#define SAL_PRIuUINT32 "lu"
#define SAL_PRIxUINT32 "lx"
#define SAL_PRIXUINT32 "lX"
#elif SAL_TYPES_SIZEOFINT == 4
typedef signed int sal_Int32;
typedef unsigned int sal_uInt32;
#define SAL_PRIdINT32 "d"
#define SAL_PRIuUINT32 "u"
#define SAL_PRIxUINT32 "x"
#define SAL_PRIXUINT32 "X"
#else
#error "Could not find 32-bit type, add support for your architecture"
#endif
typedef char sal_Char;
typedef signed char sal_sChar;
typedef unsigned char sal_uChar;
#if ( defined(SAL_W32) && !defined(__MINGW32__) )
typedef wchar_t sal_Unicode;
#else
#define SAL_UNICODE_NOTEQUAL_WCHAR_T
typedef sal_uInt16 sal_Unicode;
#endif
typedef sal_Unicode xub_Unicode;
typedef sal_Unicode xub_uUnicode;
typedef void * sal_Handle;
/* sal_Size should currently be the native width of the platform */
#if SAL_TYPES_SIZEOFPOINTER == 4
typedef sal_uInt32 sal_Size;
typedef sal_Int32 sal_sSize;
#elif SAL_TYPES_SIZEOFPOINTER == 8
typedef sal_uInt64 sal_Size;
typedef sal_Int64 sal_sSize;
#else
#error "Please make sure SAL_TYPES_SIZEOFPOINTER is defined for your architecture/compiler"
#endif
/* sal_PtrDiff holds the result of a pointer subtraction */
#if SAL_TYPES_SIZEOFPOINTER == 4
typedef sal_Int32 sal_PtrDiff;
#elif SAL_TYPES_SIZEOFPOINTER == 8
typedef sal_Int64 sal_PtrDiff;
#else
#error "Please make sure SAL_TYPES_SIZEOFPOINTER is defined for your architecture/compiler"
#endif
//\tools\inc\tools\stream.hxx
// read, write, create,... options
#define STREAM_READ 0x0001 // allow read accesses
#define STREAM_WRITE 0x0002 // allow write accesses
//\tools\inc\tools\solar.h
#ifndef F_PI
#define F_PI 3.14159265358979323846
#endif
#ifndef F_PI2
#define F_PI2 1.57079632679489661923
#endif
#ifndef F_PI4
#define F_PI4 0.785398163397448309616
#endif
#ifndef F_PI180
#define F_PI180 0.01745329251994
#endif
#ifndef F_PI1800
#define F_PI1800 0.001745329251994
#endif
#ifndef F_PI18000
#define F_PI18000 0.0001745329251994
#endif
#ifndef F_2PI
#define F_2PI 6.28318530717958647694
#endif
#ifdef __cplusplus
template<typename T> inline T Min(T a, T b) { return (a<b?a:b); }
template<typename T> inline T Max(T a, T b) { return (a>b?a:b); }
template<typename T> inline T Abs(T a) { return (a>=0?a:-a); }
#endif
#ifdef STRING32
#define xub_StrLen sal_uInt32
#else
#define xub_StrLen USHORT
#endif
//AVS end
typedef sal_uInt16 rtl_TextEncoding;
typedef rtl_TextEncoding CharSet;
/* sal_IntPtr, sal_uIntPtr are integer types designed to hold pointers so that any valid
* pointer to void can be converted to this type and back to a pointer to void and the
* result will compare to the original pointer */
#if SAL_TYPES_SIZEOFPOINTER == 4
typedef sal_Int32 sal_IntPtr;
typedef sal_uInt32 sal_uIntPtr;
#define SAL_PRIdINTPTR SAL_PRIdINT32
#define SAL_PRIuUINTPTR SAL_PRIuUINT32
#define SAL_PRIxUINTPTR SAL_PRIxUINT32
#define SAL_PRIXUINTPTR SAL_PRIXUINT32
#elif SAL_TYPES_SIZEOFPOINTER == 8
typedef sal_Int64 sal_IntPtr;
typedef sal_uInt64 sal_uIntPtr;
#define SAL_PRIdINTPTR SAL_PRIdINT64
#define SAL_PRIuUINTPTR SAL_PRIuUINT64
#define SAL_PRIxUINTPTR SAL_PRIxUINT64
#define SAL_PRIXUINTPTR SAL_PRIXUINT64
#else
#error "Please make sure SAL_TYPES_SIZEOFPOINTER is defined for your architecture/compiler"
#endif
}//SVMCore
\ No newline at end of file
#pragma once
#define WIN_BYTE BYTE
typedef SVMCore::SalColor SalColor;
typedef SVMCore::SalGraphics SalGraphics;
typedef SVMCore::SalPoint SalPoint;
typedef SVMCore::sal_uInt32 sal_uInt32;
typedef SVMCore::PCONSTSALPOINT PCONSTSALPOINT;
typedef SVMCore::sal_Bool sal_Bool;
typedef SVMCore::SalTwoRect SalTwoRect;
typedef SVMCore::SalGraphics SalGraphics;
typedef SVMCore::SalBitmap SalBitmap;
typedef SVMCore::sal_uInt8 sal_uInt8;
typedef SVMCore::SalROPColor SalROPColor;
typedef SVMCore::ImplFontSelectData ImplFontSelectData;
typedef SVMCore::BitmapSystemData BitmapSystemData;
typedef SVMCore::BitmapBuffer BitmapBuffer;
typedef SVMCore::HPBYTE HPBYTE;
typedef SVMCore::BitmapColor BitmapColor;
typedef SVMCore::BitmapPalette BitmapPalette;
typedef SVMCore::ColorMask ColorMask;
typedef SVMCore::Size Size;
typedef SVMCore::Rectangle SvmRectangle;
typedef SVMCore::BOOL SvmBOOL;
typedef SVMCore::Point SvmPoint;
typedef SVMCore::SalLayout SalLayout;
typedef SVMCore::ImplLayoutArgs ImplLayoutArgs;
typedef SVMCore::ImplFontEntry ImplFontEntry;
typedef SVMCore::sal_Unicode sal_Unicode;
typedef SVMCore::ImplKernPairData ImplKernPairData;
typedef SVMCore::sal_GlyphId sal_GlyphId;
typedef SVMCore::sal_Int32 sal_Int32;
typedef SVMCore::sal_UCS4 sal_UCS4;
typedef SVMCore::sal_IntPtr sal_IntPtr;
typedef SVMCore::ImplFontCharMap ImplFontCharMap;
typedef SVMCore::CmapResult CmapResult;
typedef SVMCore::ImplFontMetricData ImplFontMetricData;
typedef SVMCore::ImplDevFontList ImplDevFontList;
typedef SVMCore::rtl_TextEncoding rtl_TextEncoding;
typedef SVMCore::sal_Char sal_Char;
typedef SVMCore::xub_StrLen xub_StrLen;
typedef SVMCore::ImplFontData ImplFontData;
typedef SVMCore::Size SvmSize;
#define WIN_GetObject GetObject
//typedef SVMCore:: ;
\ No newline at end of file
#pragma once
#include "salgdi.h"
//1111
//#include <windows.h>
///1111
class WinGraphics : public SVMCore::SalGraphics
{
public:
HDC mhDC; // HDC
HWND mhWnd; // Window-Handle, when Window-Graphics
HFONT mhFonts[ MAX_FALLBACK ]; // Font + Fallbacks
const ImplWinFontData* mpWinFontData[ MAX_FALLBACK ]; // pointer to the most recent font face
ImplWinFontEntry* mpWinFontEntry[ MAX_FALLBACK ]; // pointer to the most recent font instance
float mfFontScale; // allows metrics emulation of huge font sizes
HPEN mhPen; // Pen
HBRUSH mhBrush; // Brush
HRGN mhRegion; // Region Handle
HPEN mhDefPen; // DefaultPen
HBRUSH mhDefBrush; // DefaultBrush
HFONT mhDefFont; // DefaultFont
HPALETTE mhDefPal; // DefaultPalette
COLORREF mnPenColor; // PenColor
COLORREF mnBrushColor; // BrushColor
COLORREF mnTextColor; // TextColor
RGNDATA* mpClipRgnData; // ClipRegion-Data
RGNDATA* mpStdClipRgnData; // Cache Standard-ClipRegion-Data
RECT* mpNextClipRect; // Naechstes ClipRegion-Rect
BOOL mbFirstClipRect; // Flag for first cliprect to insert
LOGFONTA* mpLogFont; // LOG-Font which is currently selected (only W9x)
ImplFontAttrCache* mpFontAttrCache; // Cache font attributes from files in so/share/fonts
BYTE* mpFontCharSets; // All Charsets for the current font
BYTE mnFontCharSetCount; // Number of Charsets of the current font; 0 - if not queried
BOOL mbFontKernInit; // FALSE: FontKerns must be queried
KERNINGPAIR* mpFontKernPairs; // Kerning Pairs of the current Font
ULONG mnFontKernPairCount;// Number of Kerning Pairs of the current Font
int mnPenWidth; // Linienbreite
BOOL mbStockPen; // is Pen a stockpen
BOOL mbStockBrush; // is Brush a stcokbrush
BOOL mbPen; // is Pen (FALSE == NULL_PEN)
BOOL mbBrush; // is Brush (FALSE == NULL_BRUSH)
BOOL mbPrinter; // is Printer
BOOL mbVirDev; // is VirDev
BOOL mbWindow; // is Window
BOOL mbScreen; // is Screen compatible
bool mbXORMode; // _every_ output with RasterOp XOR
// remember RGB values for SetLineColor/SetFillColor
SalColor maLineColor;
SalColor maFillColor;
public: SalGraphics()
{
}
public: ~SalGraphics()
{
}
void ImplSalInitGraphics( );
void ImplSalDeInitGraphics( );
public: void drawPixel( long nX, long nY );
public: void drawPixel( long nX, long nY, Color oColor );
};
#pragma once
#include "ASCStreamReader.h"
#include "../../../common/File.h"
class WinStreamReader : public SVMCore::SvStream
{
private:
NSFile::CFileBinary m_oFileStream;
long m_nSize;
public:
WinStreamReader()
{
m_nSize = 0;
}
~WinStreamReader()
{
Close();
}
bool Open( std::wstring sFilename )
{
Close();
bool bRes = m_oFileStream.OpenFile(sFilename);
if( false == bRes )
return false;
m_nSize = m_oFileStream.GetFileSize();
return true;
}
void Close( )
{
m_oFileStream.CloseFile();
}
int Read( void* pData, int nSize )
{
if( NULL == pData )
return 0;
DWORD nSizeRead = 0;
m_oFileStream.ReadFile((BYTE*)pData, nSize, nSizeRead);
return nSizeRead;
}
void SetBuffer( char* pcBuffer, SVMCore::sal_uInt32 nSize )
{
}
SVMCore::sal_Size Seek( SVMCore::sal_Size nFilePos )
{
if( STREAM_SEEK_TO_END == nFilePos )
m_oFileStream.SeekFile( m_nSize - 1 );
else
m_oFileStream.SeekFile ( nFilePos );
return m_oFileStream.GetFilePosition();
}
SVMCore::sal_Size Tell()
{
return m_oFileStream.GetFilePosition();
}
SVMCore::SvStream* CreateInstance()
{
return new WinStreamReader();
}
bool IsEof()
{
return m_nSize - 1 == m_oFileStream.GetFilePosition();
}
};
\ No newline at end of file
#include "SvmConverter.h"
#include "SvmFile.h"
#include "ATLDefine.h"
#import "../../../Redist/ASCImageStudio3.dll" rename_namespace("ImageStudio")
void ConvertSvmToImage( const std::wstring & oSource, const std::wstring & oDestination )
{
std::wstring sXmlExt = L"Jpeg";
CoInitialize( NULL );
OfficeSvmFile oSvmFile;
BSTR bstrSource = SysAllocString(oSource.c_str()) ;
int nRes = oSvmFile.Open(bstrSource);
SysFreeString(bstrSource);
if( NOERROR != nRes )
return;
MediaCore::IAVSUncompressedVideoFrame* piImage = NULL;
piImage = oSvmFile.GetThumbnail();
if( NULL == piImage )
return;
ImageStudio::IImageTransforms* piTransform = NULL;
HRESULT hRes = CoCreateInstance( __uuidof( ImageStudio::ImageTransforms ), NULL, CLSCTX_INPROC, __uuidof( ImageStudio::IImageTransforms ), (void**)(&piTransform));
if( NULL == piTransform )
return;
VARIANT vImage;
vImage.punkVal = piImage;
vImage.vt = VT_UNKNOWN;
piTransform->SetSource( 0, vImage );
std::wstring sXml;
sXml.append( L"<ImageFile-SaveAs" );
sXml.append( sXmlExt );
sXml.append( L" destinationpath=\"" );
sXml.append( oDestination );
sXml.append( L"\" format=\"8888\"/>" );
if( piTransform->SetXml( sXml.c_str() ) )
if(piTransform->Transform())
piTransform->GetResult( 0, &vImage );
RELEASEINTERFACE( vImage.punkVal );
RELEASEINTERFACE( piTransform );
RELEASEINTERFACE( piImage );
oSvmFile.Close();
CoUninitialize();
}
\ No newline at end of file
#pragma once
#include <string>
void ConvertSvmToImage( const std::wstring & oSource, const std::wstring & oDestination );
// CSvmFile.cpp : Defines the entry point for the console application.
#include "SvmFile.h"
#include "vcl/gdimtf.hxx"
#include "vcl/bitmapex.hxx"
#include "vcl/impbmp.hxx"
#include "vcl/salbmp.hxx"
#include "vcl/salbtype.hxx"
#include "ASC/WinStreamReader.h"
namespace SvmFile
{
CSvmFile::CSvmFile()
{
m_piSvmFile = NULL;
m_eResizeType = rtAspect;
}
CSvmFile::~CSvmFile()
{
Close();
}
bool CSvmFile::Open( std::wstring sFilename )
{
if( false == IsSvmFile( sFilename ) )
{
return false;
}
WinStreamReader oStreamReader;
bool bRes = oStreamReader.Open( sFilename );
if( false == bRes )
return false;
RELEASEOBJECT( m_piSvmFile )
m_piSvmFile = new SVMCore::GDIMetaFile();
m_piSvmFile->Read( oStreamReader );
return true;
}
bool CSvmFile::IsSvmFile( std::wstring sFilename )
{
BYTE pBuffer[ 6 ];
DWORD dwBytesRead;
HANDLE hFile;
NSFile::CFileBinary file;
if (file.OpenFile(sFilename) == false) return false;
file.ReadFile( pBuffer, 6, dwBytesRead);
file.CloseFile();
if( 5 <= dwBytesRead && 'S' == pBuffer[0] && 'V' == pBuffer[1] && 'G' == pBuffer[2] && 'D' == pBuffer[3] && 'I' == pBuffer[4] )
return true;
if( 6 <= dwBytesRead && 'V' == pBuffer[0] && 'C' == pBuffer[1] && 'L' == pBuffer[2] && 'M' == pBuffer[3] && 'T' == pBuffer[4] && 'F' == pBuffer[5] )
return true;
return false;
}
void CSvmFile::Close()
{
RELEASEOBJECT( m_piSvmFile )
}
void CSvmFile::SetResizeType( ResizeType eResizeType )
{
m_eResizeType = eResizeType;
}
bool CSvmFile::Open(CBgraFrame* pFrame, const std::wstring& wsSrcPath)
{
if (!m_piSvmFile)return NULL;
SVMCore::BitmapEx oNewBitmap;
int nResizetype = 1;
if( rtStretch == m_eResizeType )
nResizetype = 0;
m_piSvmFile->CreateThumbnail( -1, -1, nResizetype, oNewBitmap );
return BitmapToBgraFrame(oNewBitmap, pFrame );
}
bool CSvmFile::BitmapToBgraFrame( SVMCore::BitmapEx& oBitmapEx, CBgraFrame* pBgraFrame)
{
SVMCore::SalBitmap* poSalBitmap = oBitmapEx.ImplGetBitmapImpBitmap()->ImplGetSalBitmap();
SVMCore::SalBitmap* poSalBitmapMask = oBitmapEx.ImplGetMaskImpBitmap()->ImplGetSalBitmap();
SVMCore::BitmapBuffer* poSalBitmapBuffer = poSalBitmap->AcquireBuffer( false );
SVMCore::BitmapBuffer* poSalBitmapMaskBuffer = poSalBitmapMask->AcquireBuffer( false );
//int nWidthPix = 8 * ( poSalBitmapBuffer->mnScanlineSize + 23 ) / poSalBitmapBuffer->mnBitCount;
int nWidthPix = oBitmapEx.GetSizePixel().getWidth();
int nHeightPix = poSalBitmapBuffer->mnHeight;
pBgraFrame->put_Width(nWidthPix);
pBgraFrame->put_Height(nHeightPix);
pBgraFrame->put_Stride(4 * nWidthPix);
int nBufferSize = 4 * nWidthPix * nHeightPix;
BYTE* pData = new BYTE[nBufferSize];
if (!pData)
{
return false;
}
pBgraFrame->put_Data(pData);
//
memset( pData, 0, nBufferSize );
//, 24 ( )
int nBitmapSize = poSalBitmapBuffer->mnScanlineSize * poSalBitmapBuffer->mnHeight;
int nBitmapMaskSize = 8 * poSalBitmapMaskBuffer->mnScanlineSize * poSalBitmapMaskBuffer->mnHeight;
// 0 - , 1 -
int nRow = 0;
int nCell = 0;
int nMaskBit = 0;
int nBitmapByte = 0;
for( int i = 0, j = 0, k = 0; i < nBufferSize && j < nBitmapSize && k < nBitmapMaskSize; i += 4, j += 3, k++ )
{
if( nCell >= nWidthPix )
{
nCell = 0;
nRow++;
}
nBitmapByte = nRow * poSalBitmapBuffer->mnScanlineSize + 3 * nCell;
nMaskBit = nRow * poSalBitmapMaskBuffer->mnScanlineSize + nCell / 8;
pData[ i ] = poSalBitmapBuffer->mpBits[ nBitmapByte ];
pData[ i + 1 ] = poSalBitmapBuffer->mpBits[ nBitmapByte + 1 ];
pData[ i + 2 ] = poSalBitmapBuffer->mpBits[ nBitmapByte + 2 ];
pData[ i + 3 ] = GetAlphaFromBit( poSalBitmapMaskBuffer->mpBits[ nMaskBit ], nCell % 8 );
nCell++;
}
poSalBitmap->ReleaseBuffer( poSalBitmapBuffer, false );
poSalBitmap->ReleaseBuffer( poSalBitmapMaskBuffer, false );
return true;
}
inline unsigned char CSvmFile::GetAlphaFromBit( int nValue, int nBit)
{
return 0 == (nValue & (1 << (7 - nBit)) ) ? 255 : 0;
}
}
\ No newline at end of file
#pragma once
#include "../../BgraFrame.h"
namespace SVMCore
{
class GDIMetaFile;
class BitmapEx;
}
namespace SvmFile
{
class CSvmFile
{
public:
typedef enum{ rtStretch = 0, rtAspect = 1 } ResizeType;
CSvmFile();
~CSvmFile();
bool IsSvmFile( std::wstring sFilename );
bool Open(CBgraFrame* pFrame, const std::wstring& wsSrcPath);
private:
void SetResizeType( ResizeType eResizeType );
bool Open( std::wstring sFilename );
void Close();
SVMCore::GDIMetaFile *m_piSvmFile;
ResizeType m_eResizeType;
inline unsigned char GetAlphaFromBit( int nValue, int nBit);
bool BitmapToBgraFrame( SVMCore::BitmapEx& oBitmapEx, CBgraFrame* pBgraFrame);
};
}
\ No newline at end of file
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.
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: hatch.cxx,v $
* $Revision: 1.7 $
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org 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 version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
#ifdef AVS
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
#include <tools/stream.hxx>
#include <tools/vcompat.hxx>
#include <tools/debug.hxx>
#ifndef _SV_HATCX_HXX
#include <vcl/hatch.hxx>
#endif
DBG_NAME( Hatch )
#endif
#include "../vcl/hatch.hxx"
#include "../tools/vcompat.hxx"
#include "../ASC/ASCStreamReader.h"
using namespace SVMCore;
// --------------
// - ImplHatch -
// --------------
ImplHatch::ImplHatch() :
mnRefCount ( 1 ),
maColor ( COL_BLACK ),
meStyle ( HATCH_SINGLE ),
mnDistance ( 1 ),
mnAngle ( 0 )
{
}
// -----------------------------------------------------------------------
ImplHatch::ImplHatch( const ImplHatch& rImplHatch ) :
mnRefCount ( 1 ),
maColor ( rImplHatch.maColor ),
meStyle ( rImplHatch.meStyle ),
mnDistance ( rImplHatch.mnDistance ),
mnAngle ( rImplHatch.mnAngle )
{
}
// ---------
// - Hatch -
// ---------
Hatch::Hatch()
{
////////DBG_CTOR( Hatch, NULL );
mpImplHatch = new ImplHatch;
}
// -----------------------------------------------------------------------
Hatch::Hatch( const Hatch& rHatch )
{
////////DBG_CTOR( Hatch, NULL );
////////DBG_CHKOBJ( &rHatch, Hatch, NULL );
mpImplHatch = rHatch.mpImplHatch;
mpImplHatch->mnRefCount++;
}
// -----------------------------------------------------------------------
Hatch::Hatch( HatchStyle eStyle, const Color& rColor,
long nDistance, USHORT nAngle10 )
{
////////DBG_CTOR( Hatch, NULL );
mpImplHatch = new ImplHatch;
mpImplHatch->maColor = rColor;
mpImplHatch->meStyle = eStyle;
mpImplHatch->mnDistance = nDistance;
mpImplHatch->mnAngle = nAngle10;
}
// -----------------------------------------------------------------------
Hatch::~Hatch()
{
////////DBG_DTOR( Hatch, NULL );
if( !( --mpImplHatch->mnRefCount ) )
delete mpImplHatch;
}
// -----------------------------------------------------------------------
Hatch& Hatch::operator=( const Hatch& rHatch )
{
//////DBG_CHKTHIS( Hatch, NULL );
////////DBG_CHKOBJ( &rHatch, Hatch, NULL );
rHatch.mpImplHatch->mnRefCount++;
if( !( --mpImplHatch->mnRefCount ) )
delete mpImplHatch;
mpImplHatch = rHatch.mpImplHatch;
return *this;
}
#ifdef AVS
// -----------------------------------------------------------------------
BOOL Hatch::operator==( const Hatch& rHatch ) const
{
//////DBG_CHKTHIS( Hatch, NULL );
////////DBG_CHKOBJ( &rHatch, Hatch, NULL );
return( mpImplHatch == rHatch.mpImplHatch ||
( mpImplHatch->maColor == rHatch.mpImplHatch->maColor &&
mpImplHatch->meStyle == rHatch.mpImplHatch->meStyle &&
mpImplHatch->mnDistance == rHatch.mpImplHatch->mnDistance &&
mpImplHatch->mnAngle == rHatch.mpImplHatch->mnAngle ) );
}
#endif
// -----------------------------------------------------------------------
void Hatch::ImplMakeUnique()
{
if( mpImplHatch->mnRefCount != 1 )
{
if( mpImplHatch->mnRefCount )
mpImplHatch->mnRefCount--;
mpImplHatch = new ImplHatch( *mpImplHatch );
}
}
// -----------------------------------------------------------------------
void Hatch::SetStyle( HatchStyle eStyle )
{
//////DBG_CHKTHIS( Hatch, NULL );
ImplMakeUnique();
mpImplHatch->meStyle = eStyle;
}
// -----------------------------------------------------------------------
void Hatch::SetColor( const Color& rColor )
{
//////DBG_CHKTHIS( Hatch, NULL );
ImplMakeUnique();
mpImplHatch->maColor = rColor;
}
// -----------------------------------------------------------------------
void Hatch::SetDistance( long nDistance )
{
//////DBG_CHKTHIS( Hatch, NULL );
ImplMakeUnique();
mpImplHatch->mnDistance = nDistance;
}
// -----------------------------------------------------------------------
void Hatch::SetAngle( USHORT nAngle10 )
{
//////DBG_CHKTHIS( Hatch, NULL );
ImplMakeUnique();
mpImplHatch->mnAngle = nAngle10;
}
namespace SVMCore{
// -----------------------------------------------------------------------
SvStream& operator>>( SvStream& rIStm, ImplHatch& rImplHatch )
{
VersionCompat aCompat( rIStm, STREAM_READ );
UINT16 nTmp16;
rIStm >> nTmp16; rImplHatch.meStyle = (HatchStyle) nTmp16;
rIStm >> rImplHatch.maColor >> rImplHatch.mnDistance >> rImplHatch.mnAngle;
return rIStm;
}
}//SVMCore
#ifdef AVS
// -----------------------------------------------------------------------
SvStream& operator<<( SvStream& rOStm, const ImplHatch& rImplHatch )
{
VersionCompat aCompat( rOStm, STREAM_WRITE, 1 );
rOStm << (UINT16) rImplHatch.meStyle << rImplHatch.maColor;
rOStm << rImplHatch.mnDistance << rImplHatch.mnAngle;
return rOStm;
}
#endif
namespace SVMCore{
// -----------------------------------------------------------------------
SvStream& operator>>( SvStream& rIStm, Hatch& rHatch )
{
rHatch.ImplMakeUnique();
return( rIStm >> *rHatch.mpImplHatch );
}
}//SVMCore
#ifdef AVS
// -----------------------------------------------------------------------
SvStream& operator<<( SvStream& rOStm, const Hatch& rHatch )
{
return( rOStm << *rHatch.mpImplHatch );
}
#endif
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: implncvt.hxx,v $
* $Revision: 1.5 $
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org 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 version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
#ifndef _SV_LINECONV_HXX
#define _SV_LINECONV_HXX
#include "../tools/poly.hxx"
#include "../vcl/lineinfo.hxx"
namespace SVMCore{
// --------------------
// - ImplLineConverter
// --------------------
struct ImplFloatPoint;
class ImplLineConverter
{
BOOL mbClosed;
BOOL mbRefPoint;
INT32 mnRefDistance;
double mfWidthHalf;
LineInfo maLineInfo;
double mfDashDotLenght;
double mfDistanceLenght;
UINT32 mnDashCount;
UINT32 mnDotCount;
Polygon maPolygon;
UINT32 mnFloat0Points;
ImplFloatPoint* mpFloat0;
UINT32 mnFloat1Points;
ImplFloatPoint* mpFloat1;
UINT32 mnLinesAvailable;
UINT32 mnLines;
ImplFloatPoint* mpFloatPoint;
public:
ImplLineConverter( const Polygon& rPoly, const LineInfo& rLineInfo, const Point* pRefPoint );
~ImplLineConverter();
const Polygon* ImplGetFirst();
const Polygon* ImplGetNext();
};
}//SVMCore
#endif
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.
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.
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.
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.
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