bool CImageFileFormatChecker::isPngFile(std::wstring & fileName)
{
	eFileType = _CXIMAGE_FORMAT_UNKNOWN;
	////////////////////////////////////////////////////////////////////////////////
	NSFile::CFileBinary file;
	if (!file.OpenFile(fileName))
		return false;

	BYTE* buffer = new BYTE[MIN_SIZE_BUFFER];
	if (!buffer)
		return false;

	DWORD sizeRead = 0;
	if (!file.ReadFile(buffer, MIN_SIZE_BUFFER, sizeRead))
	{
		delete []buffer;
		return false;
	}
	file.CloseFile();
	////////////////////////////////////////////////////////////////////////////////
	
	if (isPngFile(buffer,sizeRead))
	{
		eFileType = _CXIMAGE_FORMAT_PNG;
	}
	delete [] buffer;

	if (eFileType)return true;
	else return false;

}
示例#2
0
int CFontStream::CreateFromFile(const std::wstring& strFileName, BYTE* pDataUse)
{
	NSFile::CFileBinary oFile;
	if (!oFile.OpenFile(strFileName))
		return FALSE;

	m_lSize = oFile.GetFileSize();
    
    if (NULL == pDataUse)
	m_pData = new BYTE[m_lSize];
    else
    {
        m_bIsAttach = true;
        m_pData = pDataUse;
    }

	DWORD dwRead = 0;
	DWORD dwNeedRead = (DWORD)m_lSize;
	oFile.ReadFile(m_pData, dwNeedRead, dwRead);

	if (dwNeedRead != dwRead)
	{
        if (!m_bIsAttach)
		RELEASEARRAYOBJECTS(m_pData);
        
		m_lSize = 0;
		return FALSE;
	}
	
	oFile.CloseFile();
	return true;
}
std::wstring COfficeFileFormatChecker::getDocumentID (const std::wstring & _fileName )
{
#if defined(_WIN32) || defined(_WIN32_WCE) || defined(_WIN64)
    std::wstring fileName = CorrectPathW(_fileName);
#else
    std::wstring fileName = _fileName;
#endif
	std::wstring documentID;

	POLE::Storage storage(fileName.c_str());
    if (storage.open())
    {
		if ( isMS_OFFCRYPTOFormatFile(&storage, documentID) )
        {
            nFileType = AVS_OFFICESTUDIO_FILE_OTHER_MS_OFFCRYPTO;
        }
	}
	else
	{
		if ( false == isOpenOfficeFormatFile(fileName, documentID))
		{
			NSFile::CFileBinary file;
			if (!file.OpenFile(fileName))
				return documentID;
			
			unsigned char* buffer = new unsigned char[4096]; //enaf !!
			if (!buffer){file.CloseFile();return documentID;}

			DWORD dwReadBytes = 0;
			file.ReadFile(buffer, MIN_SIZE_BUFFER, dwReadBytes);
			file.CloseFile();

			if (isPdfFormatFile(buffer, (int)dwReadBytes, documentID) )
			{
				nFileType = AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF;
			}
		}
	}
	sDocumentID = documentID;

	return documentID;
}
示例#4
0
int oneZipFile(zipFile & zf, zip_fileinfo & zi, std::wstring & file_name, std::wstring & zip_file_name, int method, int compressionLevel)
{
	int err = -1;

	NSFile::CFileBinary oFile;
	if(oFile.OpenFile(file_name))
	{
		DWORD dwSizeRead;
		BYTE* pData = new BYTE[oFile.GetFileSize()];
		if(oFile.ReadFile(pData, oFile.GetFileSize(), dwSizeRead))
		{
			std::string zipFileNameA = codepage_issue_fixToOEM(zip_file_name);
			err = zipOpenNewFileInZip( zf, zipFileNameA.c_str(), &zi, NULL, 0, NULL, 0, NULL, method, compressionLevel );
			err = zipWriteInFileInZip( zf, pData, dwSizeRead );
			err = zipCloseFileInZip( zf );
		}
		RELEASEARRAYOBJECTS(pData);
	}
	return 0;
}
示例#5
0
文件: Image.cpp 项目: ONLYOFFICE/core
    static void CorrectImage(const wchar_t* wsFileName, BYTE*& pBuffer, int& nBufferSize, unsigned int& unWidth, unsigned int& unHeight)
    {
        pBuffer = NULL;
        nBufferSize = 0;

        CImageFileFormatChecker oChecker(wsFileName);
        if (oChecker.eFileType != _CXIMAGE_FORMAT_JPG)
            return;

        NSFile::CFileBinary oFile;
        if (!oFile.OpenFile(wsFileName))
            return;

        if (20 > oFile.GetFileSize())
            return;

        BYTE data[20];
        DWORD dwRead = 0;
        if (!oFile.ReadFile(data, 20, dwRead))
            return;

        std::string sFind((char*)data, 20);
        oFile.CloseFile();

        if (std::string::npos == sFind.find("Photoshop") && std::string::npos == sFind.find("photoshop"))
            return;

        CBgraFrame oFrame;
        if (!oFrame.OpenFile(wsFileName))
            return;

        oFrame.SetJpegQuality(85.0);
        if (!oFrame.Encode(pBuffer, nBufferSize, _CXIMAGE_FORMAT_JPG))
            return;

        if (!pBuffer || !nBufferSize)
            return;

        unWidth = (unsigned int)oFrame.get_Width();
        unHeight = (unsigned int)oFrame.get_Height();
    }
bool CImageFileFormatChecker::isImageFile(std::wstring& fileName)
{
	eFileType  = _CXIMAGE_FORMAT_UNKNOWN;
///////////////////////////////////////////////////////////////////////////////	
	NSFile::CFileBinary file;
	if (!file.OpenFile(fileName))
		return false;

	BYTE* buffer = new BYTE[MIN_SIZE_BUFFER];
	if (!buffer)
		return false;

	DWORD sizeRead = 0;
	if (!file.ReadFile(buffer, MIN_SIZE_BUFFER, sizeRead))
	{
		delete []buffer;
		return false;
	}
	file.CloseFile();
/////////////////////////////////////////////////////////////////////////////////
	if (isBmpFile(buffer,sizeRead))
	{
		eFileType = _CXIMAGE_FORMAT_BMP;
	}
	if (isGifFile(buffer,sizeRead))
	{
		eFileType = _CXIMAGE_FORMAT_GIF;
	}
	if (isPngFile(buffer,sizeRead))
	{
		eFileType = _CXIMAGE_FORMAT_PNG;
	}
	if (isTgaFile(buffer,sizeRead))
	{
		eFileType = _CXIMAGE_FORMAT_TGA;
	}
	if (isPcxFile(buffer,sizeRead))
	{
		eFileType = _CXIMAGE_FORMAT_PCX;
	}	
	if (isJpgFile(buffer,sizeRead))
	{
		eFileType = _CXIMAGE_FORMAT_JPG;
	}
	if (isEmfFile(buffer,sizeRead))
	{
		eFileType = _CXIMAGE_FORMAT_EMF;
	}
	if (isWmfFile(buffer,sizeRead))
	{
		eFileType = _CXIMAGE_FORMAT_WMF;
	}
	if (isTiffFile(buffer,sizeRead))
	{
		eFileType = _CXIMAGE_FORMAT_TIF;
	}	
	if (isIcoFile(buffer,sizeRead))
	{
		eFileType = _CXIMAGE_FORMAT_ICO;
	}
	if (isWbFile(buffer,sizeRead))
	{
		eFileType = _CXIMAGE_FORMAT_WB;
	}	
	if (isPsdFile(buffer,sizeRead))
	{
		eFileType = _CXIMAGE_FORMAT_PSD;
	}
	if (isRasFile(buffer,sizeRead))
	{
		eFileType = _CXIMAGE_FORMAT_RAS;
	}	

	if (isIpodFile(buffer,sizeRead))
	{
		eFileType = _CXIMAGE_FORMAT_UNKNOWN;
	}
	if (isJ2kFile(buffer,sizeRead))
	{
		eFileType = _CXIMAGE_FORMAT_JP2;
	}
	if (isJp2File(buffer,sizeRead))
	{
		eFileType = _CXIMAGE_FORMAT_JP2;
	}
	if (isMj2File(buffer,sizeRead))
	{
		eFileType = _CXIMAGE_FORMAT_JP2;
	}
	if (isSfwFile(buffer,sizeRead))
	{
		eFileType = _CXIMAGE_FORMAT_UNKNOWN;
	}
	if (isSvmFile(buffer,sizeRead))
	{
		eFileType = _CXIMAGE_FORMAT_UNKNOWN;
	}
	if (isSwfFile(buffer,sizeRead))
	{
		eFileType = _CXIMAGE_FORMAT_UNKNOWN;
	}
	if (isWbcFile(buffer,sizeRead))
	{
		eFileType = _CXIMAGE_FORMAT_UNKNOWN;
	}	
	if (isWbzFile(buffer,sizeRead))
	{
		eFileType = _CXIMAGE_FORMAT_UNKNOWN;
	}	
///////////////////////////////////////////////////////////////////////
	if (isSvgFile(fileName))
	{
		eFileType = _CXIMAGE_FORMAT_UNKNOWN;
	}	
	if (isRawFile(fileName))
	{
		eFileType = _CXIMAGE_FORMAT_UNKNOWN;
	}
///////////////////////////////////////////////////////////////////////
	delete [] buffer;

	if (eFileType)return true;
	return false;
}
示例#7
0
bool CFontConverter::ToOTF(std::wstring sFontIn, std::wstring sFontOut, unsigned int* pSymbols, int nCount, std::wstring sNameW, long nFlag)
{
    FT_Library pLibrary = NULL;
    if ( FT_Init_FreeType( &pLibrary ) )
        return false;

    FT_Face pFace = NULL;

    NSFile::CFileBinary oFileBinary;
    if (!oFileBinary.OpenFile(sFontIn))
        return false;

    FT_Long nFileSize = (FT_Long)oFileBinary.GetFileSize();
    BYTE* pBaseAddress = new BYTE[nFileSize];
    DWORD dwRead = 0;
    oFileBinary.ReadFile(pBaseAddress, (DWORD)nFileSize, dwRead);

    FT_Open_Args oOpenArgs;
    oOpenArgs.flags = FT_OPEN_MEMORY;
    oOpenArgs.memory_base = (BYTE*)pBaseAddress;
    oOpenArgs.memory_size = nFileSize;

    NSFontConverter::CFontFileTrueType* pTTF = NSFontConverter::CFontFileTrueType::LoadFromFile( sFontIn.c_str() );
    FT_Error oerrr;
    if ( oerrr = FT_Open_Face( pLibrary, &oOpenArgs, 0, &pFace ) )
    {
        FT_Done_FreeType( pLibrary );
        RELEASEARRAYOBJECTS(pBaseAddress);
        return false;
    }

    std::string sFontFormat( FT_Get_X11_Font_Format( pFace ) );

    // Проверим флаг конвертации и исходный формат шрифта
    bool bNeedConvert = false;

    if ( nFlag == NSFontConverter::c_lFromAll ||
         ( "TrueType" == sFontFormat && nFlag & NSFontConverter::c_lFromTT ) ||
         ( "CFF" == sFontFormat && nFlag & NSFontConverter::c_lFromCFF ) ||
         ( "Type 1" == sFontFormat && nFlag & NSFontConverter::c_lFromT1 ) )
        bNeedConvert = true;

    bool bIsGids = (NSFontConverter::c_lFlagsGids & nFlag);

    if ( bNeedConvert )
    {
        if ( "CFF" == sFontFormat || "Type 1" == sFontFormat )
        {
            NSFontConverter::TCharBuffer oCFF;
            NSFontConverter::CFontFileType1C *pT1C = NULL;
            if ( "Type 1" == sFontFormat )
            {
                // Сначала сконвертируем Type1 в CFF
                NSFontConverter::CFontFileType1* pT1 = NSFontConverter::CFontFileType1::LoadFromFile( sFontIn.c_str() );
                pT1->ToCFF( &NSFontConverter::CharBufferWrite, &oCFF );
                delete pT1;

                // Конвертируем CFF в OpenTypeCFF
                pT1C = NSFontConverter::CFontFileType1C::LoadFromBuffer( oCFF.sBuffer, oCFF.nLen );
            }
            else
            {
                // FreeType отдает тип шрифта CFF, в случаях когда файл имеет тип OpenType(CFF).
                // Если так оно и есть, тогда нам с файлом ничего делать на надо.
                pT1C = NSFontConverter::CFontFileType1C::LoadFromFile( sFontIn.c_str() );
            }

            if ( pT1C )
            {
                NSFile::CFileBinary oWriteFile;
                oWriteFile.CreateFileW(sFontOut);
                pT1C->ToOpenTypeCFF( &NSFontConverter::FileWrite, oWriteFile.GetFileNative(), pFace );
                oWriteFile.CloseFile();
            }

            delete pT1C;
        }
        else if ( "TrueType" == sFontFormat && ( pSymbols != NULL || !sNameW.empty() ) )
        {
            NSFontConverter::CFontFileTrueType* pTTF = NSFontConverter::CFontFileTrueType::LoadFromFile( sFontIn.c_str() );
            if ( pTTF )
            {
                std::string sName = U_TO_UTF8(sNameW);
                unsigned char *pUseGlyfs = NULL;
                long lGlyfsCount = pFace->num_glyphs;

                if ( pSymbols )
                {
                    // Сначала составим список нужных нами GID
                    unsigned int* pUnicode = pSymbols;
                    unsigned short* pGIDs = new unsigned short[nCount];
                    int nCMapIndex = 0;

                    int nSymbolicIndex = NSFontConverter::GetSymbolicCmapIndex(pFace);

                    if (!bIsGids)
                    {
                        for ( int nIndex = 0; nIndex < nCount; nIndex++ )
                        {
                            pGIDs[nIndex] = NSFontConverter::SetCMapForCharCode( pFace, pUnicode[nIndex], &nCMapIndex  );

                            if ((pGIDs[nIndex] == 0) && (-1 != nSymbolicIndex) && (pUnicode[nIndex] < 0xF000))
                            {
                                pGIDs[nIndex] = NSFontConverter::SetCMapForCharCode( pFace, pUnicode[nIndex] + 0xF000, &nCMapIndex  );
                            }
                        }
                    }
                    else
                    {
                        for (int i = 0; i < nCount; ++i)
                            pGIDs[i] = (unsigned short)pUnicode[i];
                    }

                    pUseGlyfs = new unsigned char[lGlyfsCount];
                    ::memset( pUseGlyfs, 0x00, lGlyfsCount * sizeof(unsigned char) );
                    pUseGlyfs[0] = 1; // нулевой гид всегда записываем
                    for ( int nGID = 1; nGID < lGlyfsCount; nGID++ )
                    {
                        if ( 1 != pUseGlyfs[nGID] )
                        {
                            bool bFound = false;
                            for ( int nIndex = 0; nIndex < nCount; nIndex++ )
                            {
                                if ( nGID == pGIDs[nIndex] )
                                {
                                    bFound = true;
                                    break;
                                }
                            }

                            // Если данный символ составной (CompositeGlyf), тогда мы должны учесть все его дочерные символы (subglyfs)
                            if ( bFound && 0 == FT_Load_Glyph( pFace, nGID, FT_LOAD_NO_SCALE | FT_LOAD_NO_RECURSE ) )
                            {
                                for ( int nSubIndex = 0; nSubIndex < pFace->glyph->num_subglyphs; nSubIndex++ )
                                {
                                    FT_Int       nSubGID;
                                    FT_UInt      unFlags;
                                    FT_Int       nArg1;
                                    FT_Int       nArg2;
                                    FT_Matrix    oMatrix;
                                    FT_Get_SubGlyph_Info( pFace->glyph, nSubIndex, &nSubGID, &unFlags, &nArg1, &nArg2, &oMatrix );

                                    if ( nSubGID < lGlyfsCount )
                                        pUseGlyfs[nSubGID] = 1;
                                }
                            }

                            if ( bFound )
                                pUseGlyfs[nGID] = 1;
                        }
                    }
                }

                NSFile::CFileBinary oWriteFile;
                oWriteFile.CreateFileW(sFontOut);
                pTTF->WriteTTF( &NSFontConverter::FileWrite, oWriteFile.GetFileNative(), sName.c_str(), NULL, pUseGlyfs, lGlyfsCount );
                oWriteFile.CloseFile();
            }
            else
            {
                // error parse font
                // Просто копируем файл
                NSFile::CFileBinary::Copy(sFontIn, sFontOut);
            }
        }
    }
    else
    {
        // Просто копируем файл
        NSFile::CFileBinary::Copy(sFontIn, sFontOut);
    }

    FT_Done_Face( pFace );
    FT_Done_FreeType( pLibrary );

    RELEASEARRAYOBJECTS(pBaseAddress);

    return true;
}
示例#8
0
  int ZipFile( const WCHAR* inputFile, const WCHAR* outputFile, int method, int compressionLevel )
  { 
	int err = -1;

    if ( ( inputFile != NULL ) && ( outputFile != NULL ) )
    {
		NSFile::CFileBinary oFile;
		if(oFile.OpenFile(inputFile))
		{
			DWORD dwSizeRead;
			BYTE* pData = new BYTE[oFile.GetFileSize()];
			if(oFile.ReadFile(pData, oFile.GetFileSize(), dwSizeRead))
			{
				zipFile zf = zipOpenHelp(outputFile);

				zip_fileinfo zi;

				zi.tmz_date.tm_sec = zi.tmz_date.tm_min = zi.tmz_date.tm_hour =
					zi.tmz_date.tm_mday = zi.tmz_date.tm_mon = zi.tmz_date.tm_year = 0;
				zi.dosDate = 0;
				zi.internal_fa = 0;
				zi.external_fa = 0;

#if defined(_WIN32) || defined (_WIN64)
				SYSTEMTIME currTime;

				GetLocalTime( &currTime );

				zi.tmz_date.tm_sec = currTime.wSecond;
				zi.tmz_date.tm_min = currTime.wMinute;
				zi.tmz_date.tm_hour = currTime.wHour;
				zi.tmz_date.tm_mday = currTime.wDay;
				zi.tmz_date.tm_mon = currTime.wMonth;
				zi.tmz_date.tm_year = currTime.wYear;
#endif

				wstring inputFileName( inputFile );

				wstring::size_type pos = 0;
				static const wstring::size_type npos = -1;

				pos = inputFileName.find_last_of( L'\\' );

				wstring zipFileName;

				if ( pos != npos )
				{
					zipFileName = wstring( ( inputFileName.begin() + pos + 1 ), inputFileName.end() );
				}
				else
				{
					zipFileName = wstring( inputFileName.begin(), inputFileName.end() );
				}
				std::string zipFileNameA = codepage_issue_fixToOEM(zipFileName);
                err = zipOpenNewFileInZip( zf, zipFileNameA.c_str(), &zi, NULL, 0, NULL, 0, NULL, method, compressionLevel );
				err = zipWriteInFileInZip( zf, pData, dwSizeRead );
				err = zipCloseFileInZip( zf );
				err = zipClose( zf, NULL );
			}
			RELEASEARRAYOBJECTS(pData);
		}
	}

    return false;
  }
bool COfficeFileFormatChecker::isOfficeFile(const std::wstring & _fileName)
{
#if defined(_WIN32) || defined(_WIN32_WCE) || defined(_WIN64)
    std::wstring fileName = CorrectPathW(_fileName);
#else
    std::wstring fileName = _fileName;
#endif

    //приоритет как оказывается важен
    //Metamorphic Manual for windows 28415.doc
	POLE::Storage storage(fileName.c_str());
    if (storage.open())
    {
        if ( isDocFormatFile(&storage) )
        {
			//nFileType внутри
			return true;
        }
        else if ( isXlsFormatFile(&storage) )
        {
            nFileType = AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLS;
            return true;
        }
        else if ( isPptFormatFile(&storage) )
        {
#if defined FILE_FORMAT_CHECKER_WITH_MACRO
			COfficePPTFile pptFile;
			
			bMacroEnabled = true;
			long nResult = pptFile.OpenFile(fileName, L"", bMacroEnabled);
			if (nResult != S_OK)
			{
				return false;
			}         
			pptFile.CloseFile();
#endif
			nFileType = AVS_OFFICESTUDIO_FILE_PRESENTATION_PPT;
            return true;
        }
        else if ( isMS_OFFCRYPTOFormatFile(&storage, sDocumentID) )
        {
            nFileType = AVS_OFFICESTUDIO_FILE_OTHER_MS_OFFCRYPTO;
            return true;
        }
	}

    COfficeUtils OfficeUtils(NULL);
    if (OfficeUtils.IsArchive(fileName) == S_OK)
	{
             if ( isOOXFormatFile(fileName) )           return true;
        else if ( isOpenOfficeFormatFile(fileName) )    return true;
        else if ( isOnlyOfficeFormatFile(fileName) )    return true;
        else if ( isXpsFile(fileName) )                 return true;
	}
//-----------------------------------------------------------------------------------------------
    // others
    {
        NSFile::CFileBinary file;
        if (!file.OpenFile(fileName))
            return false;
		
		unsigned char* buffer = new unsigned char[4096]; //enaf !!
        if (!buffer){file.CloseFile();return false;}

        DWORD dwReadBytes = 0;
        file.ReadFile(buffer, MIN_SIZE_BUFFER, dwReadBytes);
        int sizeRead = (int)dwReadBytes;

		if ( isRtfFormatFile(buffer,sizeRead) )
		{
			nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_RTF;
		}
		else if ( isBinaryDoctFormatFile(buffer,sizeRead) )
		{
			nFileType = AVS_OFFICESTUDIO_FILE_CANVAS_WORD;
		}
		else if ( isBinaryXlstFormatFile(buffer,sizeRead) )
		{
			nFileType = AVS_OFFICESTUDIO_FILE_CANVAS_SPREADSHEET;
		}
		else if ( isBinaryPpttFormatFile(buffer,sizeRead) )
		{
			nFileType = AVS_OFFICESTUDIO_FILE_CANVAS_PRESENTATION;
		}        
        else if (isPdfFormatFile(buffer,sizeRead) )
        {
            nFileType = AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF;
        }
        else if (isDjvuFormatFile(buffer,sizeRead) )
        {
            nFileType = AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_DJVU;
        }
		else if (isHtmlFormatFile(buffer,sizeRead, false))
        {
			long fileSize = file.GetFileSize();
			if (fileSize > MIN_SIZE_BUFFER)		
			{
				file.SeekFile(fileSize - MIN_SIZE_BUFFER);
				file.ReadFile(buffer, MIN_SIZE_BUFFER, dwReadBytes);
				int sizeRead = (int)dwReadBytes;
			}
			if (isHtmlFormatFile(buffer,sizeRead, true))
			{
				nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_HTML;
			}
        }
        else if (isFB2FormatFile(buffer,sizeRead) )
        {
            nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_FB2;
        }
		else if (isOpenOfficeFlatFormatFile(buffer,sizeRead) )
		{
			//nFileType
		}
		else if (isDocFlatFormatFile(buffer,sizeRead) )
		{
            nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_DOC_FLAT; // without compaund container
		}

//------------------------------------------------------------------------------------------------
		file.CloseFile();

		if (buffer)delete []buffer;
		buffer = NULL;
	}
	if (nFileType != AVS_OFFICESTUDIO_FILE_UNKNOWN)return true;
//------------------------------------------------------------------------------------------------
//// by Extension

    std::wstring::size_type nExtPos = fileName.rfind(L'.');
	std::wstring sExt = L"unknown";
    
    if (nExtPos != std::wstring::npos)
        sExt = fileName.substr(nExtPos);

	std::transform(sExt.begin(), sExt.end(), sExt.begin(), tolower);

    if (0 == sExt.compare(L".mht"))
		nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_MHT;
    else if (0 == sExt.compare(L".csv"))
		nFileType = AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV;
    else if (0 == sExt.compare(L".html") || 0 == sExt.compare(L".htm"))
		nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_HTML;
    else if (0 == sExt.compare(L".bin")) //base64 string
		nFileType = AVS_OFFICESTUDIO_FILE_CANVAS_PDF;
    else if (0 == sExt.compare(L".doct"))//случай архива с html viewer
		nFileType = AVS_OFFICESTUDIO_FILE_TEAMLAB_DOCY;
    else //if (0 == sExt.compare(L".txt") || 0 == sExt.compare(L".xml")) //volsciv.rtf -или любой другой
        nFileType = AVS_OFFICESTUDIO_FILE_DOCUMENT_TXT;

	if (nFileType != AVS_OFFICESTUDIO_FILE_UNKNOWN) return true;

	return false;
}