Commit 0f79419c authored by Oleg.Korshul's avatar Oleg.Korshul Committed by Alexander Trofimov

git-svn-id:...

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@52599 954022d7-b5bf-4e40-9824-e11837661b57
parent 678d19b2
...@@ -14,10 +14,10 @@ ...@@ -14,10 +14,10 @@
#include "./PPTXFormat/Logic/Colors/SysClr.h" #include "./PPTXFormat/Logic/Colors/SysClr.h"
#include "./PPTXFormat/DocxFormat/Media/Image.h" #include "./PPTXFormat/DocxFormat/Media/Image.h"
#include "../AVSPresentationEditor/OfficeDrawing/Elements.h" #include "../ASCPresentationEditor/OfficeDrawing/Elements.h"
#include "../AVSPresentationEditor/OfficeDrawing/Shapes/BaseShape/PPTXShape/pptx2pptshapeconverter.h" #include "../ASCPresentationEditor/OfficeDrawing/Shapes/BaseShape/PPTXShape/pptx2pptshapeconverter.h"
#include "./ConverterAdvanced/Structures.h" #include "PPTXFormat/PPTX.h"
const double g_emu_koef = 25.4 * 36000 / 72.0; const double g_emu_koef = 25.4 * 36000 / 72.0;
...@@ -2652,13 +2652,16 @@ HRESULT CAVSOfficeDrawingConverter::SaveObject(SAFEARRAY* pBinaryObj, LONG lStar ...@@ -2652,13 +2652,16 @@ HRESULT CAVSOfficeDrawingConverter::SaveObject(SAFEARRAY* pBinaryObj, LONG lStar
oXmlWriter.m_bIsTop = (1 == m_nCurrentIndexObject) ? true : false; oXmlWriter.m_bIsTop = (1 == m_nCurrentIndexObject) ? true : false;
#ifdef BUILD_CONFIG_FULL_VERSION
if (NULL == m_pOOXToVMLRenderer) if (NULL == m_pOOXToVMLRenderer)
{ {
CoCreateInstance(__uuidof(CAVSOOXToVMLGeometry), NULL, CLSCTX_ALL, __uuidof(IAVSRenderer), (void**)&m_pOOXToVMLRenderer); CoCreateInstance(__uuidof(CAVSOOXToVMLGeometry), NULL, CLSCTX_ALL, __uuidof(IASCRenderer), (void**)&m_pOOXToVMLRenderer);
} }
m_pOOXToVMLRenderer->QueryInterface(__uuidof(IAVSRenderer), (void**)(&(oXmlWriter.m_pOOXToVMLRenderer))); m_pOOXToVMLRenderer->QueryInterface(__uuidof(IASCRenderer), (void**)(&(oXmlWriter.m_pOOXToVMLRenderer)));
#endif
BOOL bIsNeedConvert2007 = FALSE; BOOL bIsNeedConvert2007 = FALSE;
#ifdef BUILD_CONFIG_FULL_VERSION
if (m_bIsUseConvertion2007) if (m_bIsUseConvertion2007)
{ {
if (oElem.is<PPTX::Logic::SpTree>()) if (oElem.is<PPTX::Logic::SpTree>())
...@@ -2672,6 +2675,7 @@ HRESULT CAVSOfficeDrawingConverter::SaveObject(SAFEARRAY* pBinaryObj, LONG lStar ...@@ -2672,6 +2675,7 @@ HRESULT CAVSOfficeDrawingConverter::SaveObject(SAFEARRAY* pBinaryObj, LONG lStar
bIsNeedConvert2007 = TRUE; bIsNeedConvert2007 = TRUE;
} }
} }
#endif
oXmlWriter.WriteString(_T("<w:drawing>")); oXmlWriter.WriteString(_T("<w:drawing>"));
oXmlWriter.WriteString(strMainProps); oXmlWriter.WriteString(strMainProps);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include "./PPTXFormat/Logic/SpTreeElem.h" #include "./PPTXFormat/Logic/SpTreeElem.h"
#include "../Common/DocxFormat/Source/Common/SimpleTypes_Base.h" #include "../Common/DocxFormat/Source/Common/SimpleTypes_Base.h"
#include "../AVSPresentationEditor/OfficeDrawing/Shapes/Shape.h" #include "../ASCPresentationEditor/OfficeDrawing/Shapes/Shape.h"
#include "./PPTXFormat/Logic/Geometry.h" #include "./PPTXFormat/Logic/Geometry.h"
...@@ -494,7 +494,7 @@ public: ...@@ -494,7 +494,7 @@ public:
NSBinPptxRW::CXmlWriter m_oXmlWriter; NSBinPptxRW::CXmlWriter m_oXmlWriter;
int m_nCurrentIndexObject; int m_nCurrentIndexObject;
IAVSRenderer* m_pOOXToVMLRenderer; IASCRenderer* m_pOOXToVMLRenderer;
BOOL m_bIsUseConvertion2007; BOOL m_bIsUseConvertion2007;
NSCommon::smart_ptr<PPTX::WrapperFile> m_oTheme; NSCommon::smart_ptr<PPTX::WrapperFile> m_oTheme;
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
#include "resource.h" // main symbols #include "resource.h" // main symbols
#include "../Common/OfficeFileTemplate.h" #include "../Common/OfficeFileTemplate.h"
#include "../Common/RSA/XMLEncoder.h"
#include "PPTXFormat/PPTXEvent.h" #include "PPTXFormat/PPTXEvent.h"
#include "../../../../Common/GdiPlusEx.h" #include "../../../../Common/GdiPlusEx.h"
...@@ -19,8 +18,6 @@ ...@@ -19,8 +18,6 @@
#ifdef __USE_SIMPLE_PPTX_CONVERTER_ #ifdef __USE_SIMPLE_PPTX_CONVERTER_
#include "ConverterSimple\ConverterSimpleHeader.h" #include "ConverterSimple\ConverterSimpleHeader.h"
#endif #endif
#include "ConverterAdvanced\Converter.h"
#include "Editor\PPTXWriter.h" #include "Editor\PPTXWriter.h"
#import "..\..\..\Redist\AVSOfficeStudio\AVSOfficeUtils.dll" raw_interfaces_only #import "..\..\..\Redist\AVSOfficeStudio\AVSOfficeUtils.dll" raw_interfaces_only
...@@ -71,10 +68,6 @@ private: ...@@ -71,10 +68,6 @@ private:
CStringW m_strTempDir; CStringW m_strTempDir;
CString m_strDirectory; CString m_strDirectory;
NSPresentationEditor::CDocument m_oDocument;
CXMLEncoder m_oEncoder;
// writer to ppty // writer to ppty
CString m_strFontDirectory; CString m_strFontDirectory;
CString m_strMediaDirectory; CString m_strMediaDirectory;
...@@ -192,8 +185,6 @@ public: ...@@ -192,8 +185,6 @@ public:
if (-1 != nIndex) if (-1 != nIndex)
m_strDirectory = m_strDirectory.Mid(0, nIndex); m_strDirectory = m_strDirectory.Mid(0, nIndex);
PPTX2EditorAdvanced::Convert(*m_pFolder, m_oDocument, m_strDirectory);
return S_OK; return S_OK;
} }
public: public:
...@@ -242,19 +233,6 @@ public: ...@@ -242,19 +233,6 @@ public:
if ((NULL == m_pFolder) || (NULL == pVal)) if ((NULL == m_pFolder) || (NULL == pVal))
return S_FALSE; return S_FALSE;
CString xml = m_oDocument.ToXmlVideoSource2();
#ifdef _DEBUG
m_oDocument.SaveThemeThumbnail(m_strTempDir, 180, 135, false);
CString xml2 = m_oDocument.ToXmlEditor2();
XmlUtils::SaveToFile(_T("C:\\pptx_editor.xml"), xml2);
XmlUtils::SaveToFile(_T("C:\\VideoSourcePPTX.xml"), xml);
#endif
CStringA str = m_oEncoder.EncryptXML(xml);
*pVal = str.AllocSysString();
return S_OK; return S_OK;
} }
...@@ -274,24 +252,6 @@ public: ...@@ -274,24 +252,6 @@ public:
if (NULL == ParamValue) if (NULL == ParamValue)
return S_FALSE; return S_FALSE;
CString sParamName; sParamName = ParamName;
if (g_csBlowfishKeyParamName == sParamName)
{
ParamValue->punkVal = m_oEncoder.GetBlowfishKey();
return S_OK;
}
if (_T("EditorXml") == sParamName)
{
CString xml = m_oDocument.ToXmlEditor2();
if (TRUE)
m_oDocument.SaveThemeThumbnail(m_strTempDir, 180, 135, false);
ParamValue->bstrVal = xml.AllocSysString();
#ifdef _DEBUG
XmlUtils::SaveToFile(_T("C:\\pptx_editor.xml"), xml);
#endif
}
return S_OK; return S_OK;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// //
#include "resource.h" #include "resource.h"
#define COMPONENT_NAME "OfficePPTXFile" #define COMPONENT_NAME "OfficePPTXFile"
#include "FileInfo.h" #include "../Common/FileInfo.h"
#include "version.h" #include "version.h"
#define APSTUDIO_READONLY_SYMBOLS #define APSTUDIO_READONLY_SYMBOLS
......
...@@ -404,11 +404,11 @@ ...@@ -404,11 +404,11 @@
Name="EditorSource" Name="EditorSource"
> >
<File <File
RelativePath="..\AVSPresentationEditor\OfficeDrawing\Shapes\BaseShape\BaseShape.cpp" RelativePath="..\ASCPresentationEditor\OfficeDrawing\Shapes\BaseShape\BaseShape.cpp"
> >
</File> </File>
<File <File
RelativePath="..\AVSPresentationEditor\OfficeDrawing\Elements.cpp" RelativePath="..\ASCPresentationEditor\OfficeDrawing\Elements.cpp"
> >
</File> </File>
<File <File
...@@ -416,7 +416,7 @@ ...@@ -416,7 +416,7 @@
> >
</File> </File>
<File <File
RelativePath="..\AVSPresentationEditor\OfficeDrawing\Shapes\BaseShape\PPTShape\Formula.cpp" RelativePath="..\ASCPresentationEditor\OfficeDrawing\Shapes\BaseShape\PPTXShape\Formula.cpp"
> >
<FileConfiguration <FileConfiguration
Name="Debug|Win32" Name="Debug|Win32"
...@@ -447,99 +447,23 @@ ...@@ -447,99 +447,23 @@
</FileConfiguration> </FileConfiguration>
</File> </File>
<File <File
RelativePath="..\AVSPresentationEditor\OfficeDrawing\Shapes\BaseShape\PPTXShape\Formula.cpp" RelativePath="..\ASCPresentationEditor\OfficeDrawing\Shapes\BaseShape\PPTShape\Formula.cpp"
> >
</File> </File>
<File <File
RelativePath="..\AVSPresentationEditor\OfficeDrawing\Layout.cpp" RelativePath="..\ASCPresentationEditor\OfficeDrawing\Layout.cpp"
> >
</File> </File>
<File <File
RelativePath="..\AVSPresentationEditor\OfficeDrawing\Shapes\BaseShape\PPTShape\PPTShape.cpp" RelativePath="..\ASCPresentationEditor\OfficeDrawing\Shapes\BaseShape\PPTShape\PPTShape.cpp"
> >
</File> </File>
<File <File
RelativePath="..\AVSPresentationEditor\OfficeDrawing\Shapes\BaseShape\PPTXShape\PPTXShape.cpp" RelativePath="..\ASCPresentationEditor\OfficeDrawing\Shapes\BaseShape\PPTXShape\PPTXShape.cpp"
> >
</File> </File>
<File <File
RelativePath="..\AVSPresentationEditor\OfficeDrawing\TextAttributesEx.cpp" RelativePath="..\ASCPresentationEditor\OfficeDrawing\TextAttributesEx.cpp"
>
</File>
<File
RelativePath="..\AVSPresentationEditor\OfficeDrawing\Theme.cpp"
>
</File>
</Filter>
<Filter
Name="ConverterSimple"
>
<File
RelativePath=".\ConverterSimple\ConverterSimpleHeader.h"
>
</File>
</Filter>
<Filter
Name="ConverterAdvanced"
>
<File
RelativePath=".\ConverterAdvanced\ColorConvert.h"
>
</File>
<File
RelativePath=".\ConverterAdvanced\Converter.h"
>
</File>
<File
RelativePath=".\ConverterAdvanced\FillToBrush.h"
>
</File>
<File
RelativePath=".\ConverterAdvanced\LayoutConvert.h"
>
</File>
<File
RelativePath=".\ConverterAdvanced\LnToPen.h"
>
</File>
<File
RelativePath=".\PathHelpers.h"
>
</File>
<File
RelativePath=".\ConverterAdvanced\ShapeConvert.h"
>
</File>
<File
RelativePath=".\ConverterAdvanced\SlideConvert.h"
>
</File>
<File
RelativePath=".\ConverterAdvanced\Structures.h"
>
</File>
<File
RelativePath=".\ConverterAdvanced\TableConvert.h"
>
</File>
<File
RelativePath=".\ConverterAdvanced\TextParce.h"
>
</File>
<File
RelativePath=".\ConverterAdvanced\TextStyleConvert.h"
>
</File>
<File
RelativePath=".\ConverterAdvanced\ThemeConvert.h"
>
</File>
<File
RelativePath=".\ConverterAdvanced\TimingConvert.h"
>
</File>
<File
RelativePath=".\ConverterAdvanced\TransitionConvert.h"
> >
</File> </File>
</Filter> </Filter>
......
...@@ -289,11 +289,12 @@ namespace NSBinPptxRW ...@@ -289,11 +289,12 @@ namespace NSBinPptxRW
void SaveImageAsPng(const CString& strFileSrc, const CString& strFileDst) void SaveImageAsPng(const CString& strFileSrc, const CString& strFileDst)
{ {
#ifdef BUILD_CONFIG_FULL_VERSION
CString strLoadXml = _T("<transforms><ImageFile-LoadImage sourcepath=\"") + strFileSrc + CString strLoadXml = _T("<transforms><ImageFile-LoadImage sourcepath=\"") + strFileSrc +
_T("\"/><ImageFile-SaveAsPng destinationpath=\"") + strFileDst + _T("\" format=\"888\"/></transforms>"); _T("\"/><ImageFile-SaveAsPng destinationpath=\"") + strFileDst + _T("\" format=\"888\"/></transforms>");
AVSImageStudio::IImageTransforms* pTransform = NULL; ImageStudio::IImageTransforms* pTransform = NULL;
CoCreateInstance(AVSImageStudio::CLSID_ImageTransforms, NULL, CLSCTX_INPROC_SERVER, AVSImageStudio::IID_IImageTransforms, (void**)&pTransform); CoCreateInstance(ImageStudio::CLSID_ImageTransforms, NULL, CLSCTX_INPROC_SERVER, ImageStudio::IID_IImageTransforms, (void**)&pTransform);
VARIANT_BOOL vbRes = VARIANT_FALSE; VARIANT_BOOL vbRes = VARIANT_FALSE;
BSTR bsLoad = strLoadXml.AllocSysString(); BSTR bsLoad = strLoadXml.AllocSysString();
...@@ -302,15 +303,27 @@ namespace NSBinPptxRW ...@@ -302,15 +303,27 @@ namespace NSBinPptxRW
pTransform->Transform(&vbRes); pTransform->Transform(&vbRes);
RELEASEINTERFACE(pTransform); RELEASEINTERFACE(pTransform);
#else
OfficeCore::IImageGdipFilePtr pImageFile;
pImageFile.CreateInstance(OfficeCore::CLSID_CImageGdipFile);
BSTR bs1 = strFileSrc.AllocSysString();
BSTR bs2 = strFileDst.AllocSysString();
pImageFile->OpenFile(bs1);
pImageFile->SaveFile(bs2, 4);
SysFreeString(bs1);
SysFreeString(bs2);
#endif
} }
void SaveImageAsJPG(const CString& strFileSrc, const CString& strFileDst) void SaveImageAsJPG(const CString& strFileSrc, const CString& strFileDst)
{ {
#ifdef BUILD_CONFIG_FULL_VERSION
CString strLoadXml = _T("<transforms><ImageFile-LoadImage sourcepath=\"") + strFileSrc + CString strLoadXml = _T("<transforms><ImageFile-LoadImage sourcepath=\"") + strFileSrc +
_T("\"/><ImageFile-SaveAsJpeg destinationpath=\"") + strFileDst + _T("\" format=\"888\"/></transforms>"); _T("\"/><ImageFile-SaveAsJpeg destinationpath=\"") + strFileDst + _T("\" format=\"888\"/></transforms>");
AVSImageStudio::IImageTransforms* pTransform = NULL; ImageStudio::IImageTransforms* pTransform = NULL;
CoCreateInstance(AVSImageStudio::CLSID_ImageTransforms, NULL, CLSCTX_INPROC_SERVER, AVSImageStudio::IID_IImageTransforms, (void**)&pTransform); CoCreateInstance(ImageStudio::CLSID_ImageTransforms, NULL, CLSCTX_INPROC_SERVER, ImageStudio::IID_IImageTransforms, (void**)&pTransform);
VARIANT_BOOL vbRes = VARIANT_FALSE; VARIANT_BOOL vbRes = VARIANT_FALSE;
BSTR bsLoad = strLoadXml.AllocSysString(); BSTR bsLoad = strLoadXml.AllocSysString();
...@@ -319,6 +332,17 @@ namespace NSBinPptxRW ...@@ -319,6 +332,17 @@ namespace NSBinPptxRW
pTransform->Transform(&vbRes); pTransform->Transform(&vbRes);
RELEASEINTERFACE(pTransform); RELEASEINTERFACE(pTransform);
#else
OfficeCore::IImageGdipFilePtr pImageFile;
pImageFile.CreateInstance(OfficeCore::CLSID_CImageGdipFile);
BSTR bs1 = strFileSrc.AllocSysString();
BSTR bs2 = strFileDst.AllocSysString();
pImageFile->OpenFile(bs1);
pImageFile->SaveFile(bs2, 3);
SysFreeString(bs1);
SysFreeString(bs2);
#endif
} }
AVSINLINE bool IsNeedDownload(const CString& strFile) AVSINLINE bool IsNeedDownload(const CString& strFile)
......
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
#include "BinWriters.h" #include "BinWriters.h"
#include "../ConverterAdvanced/Converter.h"
namespace PPTX2EditorAdvanced namespace PPTX2EditorAdvanced
{ {
using namespace NSBinPptxRW; using namespace NSBinPptxRW;
...@@ -269,24 +267,6 @@ namespace PPTX2EditorAdvanced ...@@ -269,24 +267,6 @@ namespace PPTX2EditorAdvanced
} }
} }
/*
//
NSPresentationEditor::CDocument oDocument;
CString strDir = strSourceDirectory;
PPTX2EditorAdvanced::Convert(oFolder, oDocument, strDir);
double _pres_w = oDocument.m_oInfo.m_lMillimetresHor;
double _pres_h = oDocument.m_oInfo.m_lMillimetresVer;
LONG _theme_h = 40;
LONG _theme_w = (LONG)((_pres_w * _theme_h) / _pres_h);
LONG _layout_h = 67;
LONG _layout_w = (LONG)((_pres_w * _layout_h) / _pres_h);
oDocument.ExtractPresentationInfo(_T(""), _theme_w, _theme_h, _layout_w, _layout_h, &oBinaryWriter);
*/
// ImageMap --------------------------------------- // ImageMap ---------------------------------------
oBinaryWriter.StartMainRecord(NSMainTables::ImageMap); oBinaryWriter.StartMainRecord(NSMainTables::ImageMap);
oBinaryWriter.StartRecord(NSMainTables::ImageMap); oBinaryWriter.StartRecord(NSMainTables::ImageMap);
......
...@@ -79,7 +79,7 @@ namespace NSFontCutter ...@@ -79,7 +79,7 @@ namespace NSFontCutter
m_strEmbeddedFontsFolder = _T(""); m_strEmbeddedFontsFolder = _T("");
} }
void CheckFont(const CString& strName, AVSGraphics::IAVSFontManager* pManager) void CheckFont(const CString& strName, ASCGraphics::IASCFontManager* pManager)
{ {
CAtlMap<CString, CEmbeddedFontInfo>::CPair* pPair = m_mapFontsEmbeddded.Lookup(strName); CAtlMap<CString, CEmbeddedFontInfo>::CPair* pPair = m_mapFontsEmbeddded.Lookup(strName);
if (NULL != pPair) if (NULL != pPair)
...@@ -170,6 +170,7 @@ namespace NSFontCutter ...@@ -170,6 +170,7 @@ namespace NSFontCutter
template<typename T> template<typename T>
void WriteEmbeddedFonts(T* pWriter) void WriteEmbeddedFonts(T* pWriter)
{ {
#ifdef BUILD_CONFIG_FULL_VERSION
ULONG nCount = 0; ULONG nCount = 0;
POSITION pos = m_mapFontsEmbeddded.GetStartPosition(); POSITION pos = m_mapFontsEmbeddded.GetStartPosition();
while (pos != NULL) while (pos != NULL)
...@@ -327,6 +328,7 @@ namespace NSFontCutter ...@@ -327,6 +328,7 @@ namespace NSFontCutter
RELEASEARRAY(pArrayUnicodes); RELEASEARRAY(pArrayUnicodes);
RELEASEINTERFACE(pFontConverter); RELEASEINTERFACE(pFontConverter);
#endif
} }
SAFEARRAY* GenerateSafearray() SAFEARRAY* GenerateSafearray()
...@@ -362,6 +364,7 @@ namespace NSFontCutter ...@@ -362,6 +364,7 @@ namespace NSFontCutter
return pArray; return pArray;
} }
#ifdef BUILD_CONFIG_FULL_VERSION
void WriteFont(CString& strName, LONG& lFaceIndex, CString& strFontPath, CFile* pFile, SAFEARRAY* pArrayUnicodes, Fonts::IFontConverter* pFontConverter) void WriteFont(CString& strName, LONG& lFaceIndex, CString& strFontPath, CFile* pFile, SAFEARRAY* pArrayUnicodes, Fonts::IFontConverter* pFontConverter)
{ {
LONG lFontConverterFlag = 16; // truetype only LONG lFontConverterFlag = 16; // truetype only
...@@ -396,6 +399,7 @@ namespace NSFontCutter ...@@ -396,6 +399,7 @@ namespace NSFontCutter
RELEASEARRAY(pArrayData); RELEASEARRAY(pArrayData);
} }
#endif
}; };
} }
......
#pragma once #pragma once
#include "../stdafx.h"
#include "../../Common/DocxFormat/Source/SystemUtility/File.h" #include "../../Common/DocxFormat/Source/SystemUtility/File.h"
#include "BinReaderWriterDefines.h" #include "BinReaderWriterDefines.h"
#include "FontCutter.h" #include "FontCutter.h"
...@@ -9,7 +10,7 @@ namespace NSFontCutter ...@@ -9,7 +10,7 @@ namespace NSFontCutter
{ {
public: public:
CAtlMap<CString, CString> m_mapPicks; CAtlMap<CString, CString> m_mapPicks;
AVSGraphics::IAVSFontManager* m_pFontManager; ASCGraphics::IASCFontManager* m_pFontManager;
CString m_strFontsDir; CString m_strFontsDir;
...@@ -22,7 +23,7 @@ namespace NSFontCutter ...@@ -22,7 +23,7 @@ namespace NSFontCutter
m_strFontsDir = _T(""); m_strFontsDir = _T("");
m_pFontManager = NULL; m_pFontManager = NULL;
CoCreateInstance(AVSGraphics::CLSID_CAVSFontManager, NULL, CLSCTX_ALL, AVSGraphics::IID_IAVSFontManager, (void**)&m_pFontManager); CoCreateInstance(ASCGraphics::CLSID_CASCFontManager, NULL, CLSCTX_ALL, ASCGraphics::IID_IASCFontManager, (void**)&m_pFontManager);
m_bIsEmbeddedFonts = FALSE; m_bIsEmbeddedFonts = FALSE;
} }
...@@ -35,6 +36,16 @@ namespace NSFontCutter ...@@ -35,6 +36,16 @@ namespace NSFontCutter
{ {
m_strFontsDir = strDir; m_strFontsDir = strDir;
#ifdef BUILD_CONFIG_OPENSOURCE_VERSION
if (_T("") != m_strFontsDir)
m_pFontManager->Init(L"", TRUE, TRUE);
else
{
BSTR bsFolder = m_strFontsDir.AllocSysString();
m_pFontManager->Init(bsFolder, FALSE, TRUE);
SysFreeString(bsFolder);
}
#else
if (_T("") != m_strFontsDir) if (_T("") != m_strFontsDir)
{ {
VARIANT var; VARIANT var;
...@@ -52,6 +63,7 @@ namespace NSFontCutter ...@@ -52,6 +63,7 @@ namespace NSFontCutter
BSTR defFontName = defaultFontName.AllocSysString(); BSTR defFontName = defaultFontName.AllocSysString();
m_pFontManager->SetDefaultFont(defFontName); m_pFontManager->SetDefaultFont(defFontName);
SysFreeString(defFontName); SysFreeString(defFontName);
#endif
} }
CString GetTypefacePickByName(const CString& strTypeface) CString GetTypefacePickByName(const CString& strTypeface)
...@@ -85,9 +97,12 @@ namespace NSFontCutter ...@@ -85,9 +97,12 @@ namespace NSFontCutter
CString strPick = _T("<FontProperties><Name value=\"") + sFind + _T("\"/></FontProperties>"); CString strPick = _T("<FontProperties><Name value=\"") + sFind + _T("\"/></FontProperties>");
BSTR bsResult = NULL; BSTR bsResult = NULL;
LONG lFontIndex = NULL; LONG lFontIndex = 0;
BSTR bsInput = strPick.AllocSysString(); BSTR bsInput = strPick.AllocSysString();
#ifdef BUILD_CONFIG_OPENSOURCE_VERSION
m_pFontManager->GetWinFontByParams(bsInput, &bsResult, NULL, NULL, &lFontIndex);
#else
m_pFontManager->GetWinFontByParams(bsInput, &bsResult, &lFontIndex); m_pFontManager->GetWinFontByParams(bsInput, &bsResult, &lFontIndex);
CString strPath = (CString)bsResult; CString strPath = (CString)bsResult;
...@@ -97,6 +112,7 @@ namespace NSFontCutter ...@@ -97,6 +112,7 @@ namespace NSFontCutter
SysFreeString(bsResult); SysFreeString(bsResult);
m_pFontManager->GetFamilyName(&bsResult); m_pFontManager->GetFamilyName(&bsResult);
#endif
CString sRes = bsResult; CString sRes = bsResult;
...@@ -194,7 +210,7 @@ public: ...@@ -194,7 +210,7 @@ public:
return S_OK; return S_OK;
RELEASEINTERFACE((m_oPicker.m_pFontManager)); RELEASEINTERFACE((m_oPicker.m_pFontManager));
newVal->QueryInterface(AVSGraphics::IID_IAVSFontManager, (void**)&(m_oPicker.m_pFontManager)); newVal->QueryInterface(ASCGraphics::IID_IASCFontManager, (void**)&(m_oPicker.m_pFontManager));
return S_OK; return S_OK;
} }
......
#pragma once #pragma once
#include "../stdafx.h" #include "../stdafx.h"
#ifdef BUILD_CONFIG_FULL_VERSION
namespace NSWMFToImageConverter namespace NSWMFToImageConverter
{ {
class CImageExt class CImageExt
{ {
private: private:
IAVSRenderer* m_pSVGRenderer; IASCRenderer* m_pSVGRenderer;
void Init() void Init()
{ {
...@@ -19,7 +21,7 @@ namespace NSWMFToImageConverter ...@@ -19,7 +21,7 @@ namespace NSWMFToImageConverter
} }
else else
{ {
CoCreateInstance( HtmlRenderer::CLSID_CAVSSVGWriter, NULL, CLSCTX_ALL, __uuidof(IAVSRenderer), (void**)(&m_pSVGRenderer) ); CoCreateInstance( HtmlRenderer::CLSID_CASCSVGWriter, NULL, CLSCTX_ALL, __uuidof(IASCRenderer), (void**)(&m_pSVGRenderer) );
} }
} }
...@@ -88,7 +90,7 @@ namespace NSWMFToImageConverter ...@@ -88,7 +90,7 @@ namespace NSWMFToImageConverter
return 0; return 0;
} }
void MetaDrawOnRenderer(IAVSRenderer* pRenderer, BSTR strFile, double dW, double dH) void MetaDrawOnRenderer(IASCRenderer* pRenderer, BSTR strFile, double dW, double dH)
{ {
if (NULL == pRenderer) if (NULL == pRenderer)
return; return;
...@@ -133,8 +135,8 @@ namespace NSWMFToImageConverter ...@@ -133,8 +135,8 @@ namespace NSWMFToImageConverter
pRenderer->get_PenAlpha( &pen_Alpha ); pRenderer->get_PenAlpha( &pen_Alpha );
pRenderer->get_PenColor( &pen_Color ); pRenderer->get_PenColor( &pen_Color );
AVSGraphics::IAVSImage *pImage = NULL; ASCGraphics::IAVSImage *pImage = NULL;
CoCreateInstance( __uuidof(AVSGraphics::CAVSImage), NULL, CLSCTX_ALL, __uuidof(AVSGraphics::IAVSImage), (void**)(&pImage) ); CoCreateInstance( __uuidof(ASCGraphics::CAVSImage), NULL, CLSCTX_ALL, __uuidof(ASCGraphics::IAVSImage), (void**)(&pImage) );
pImage->put_FontManager(NULL); pImage->put_FontManager(NULL);
...@@ -211,4 +213,6 @@ namespace NSWMFToImageConverter ...@@ -211,4 +213,6 @@ namespace NSWMFToImageConverter
return true; return true;
} }
}; };
} }
\ No newline at end of file
#endif
\ No newline at end of file
...@@ -241,7 +241,7 @@ namespace NSBinPptxRW ...@@ -241,7 +241,7 @@ namespace NSBinPptxRW
CString m_strStyleMain; CString m_strStyleMain;
CString m_strAttributesMain; CString m_strAttributesMain;
CString m_strNodes; CString m_strNodes;
IAVSRenderer* m_pOOXToVMLRenderer; IASCRenderer* m_pOOXToVMLRenderer;
bool m_bIsTop; bool m_bIsTop;
public: public:
......
...@@ -10,7 +10,7 @@ using namespace NSFontCutter; ...@@ -10,7 +10,7 @@ using namespace NSFontCutter;
#define AVSINLINE __forceinline #define AVSINLINE __forceinline
#endif #endif
#include "../../AVSPresentationEditor/PPTXWriter/FileDownloader.h" #include "../../ASCPresentationEditor/PPTXWriter/FileDownloader.h"
#include "WMFToImageConverter.h" #include "WMFToImageConverter.h"
namespace NSShapeImageGen namespace NSShapeImageGen
...@@ -107,7 +107,9 @@ namespace NSShapeImageGen ...@@ -107,7 +107,9 @@ namespace NSShapeImageGen
LONG m_lDstFormat; LONG m_lDstFormat;
#ifdef BUILD_CONFIG_FULL_VERSION
NSWMFToImageConverter::CImageExt m_oExt; NSWMFToImageConverter::CImageExt m_oExt;
#endif
public: public:
...@@ -277,12 +279,138 @@ namespace NSShapeImageGen ...@@ -277,12 +279,138 @@ namespace NSShapeImageGen
{ {
_CopyFile(strFileSrc, strFileDst, NULL, NULL); _CopyFile(strFileSrc, strFileDst, NULL, NULL);
} }
#ifdef BUILD_CONFIG_OPENSOURCE_VERSION
void SaveImage(CString& strFileSrc, CImageInfo& oInfo, LONG __width, LONG __height)
{
OfficeCore::IImageGdipFilePtr pImageFile;
pImageFile.CreateInstance(OfficeCore::CLSID_CImageGdipFile);
BSTR bsSrc = strFileSrc.AllocSysString();
pImageFile->OpenFile(bsSrc);
SysFreeString(bsSrc);
IUnknown* punkFrame = NULL;
pImageFile->get_Frame(&punkFrame);
MediaCore::IAVSUncompressedVideoFrame* pFrame = NULL;
punkFrame->QueryInterface(MediaCore::IID_IAVSUncompressedVideoFrame, (void**)&pFrame);
RELEASEINTERFACE(punkFrame);
LONG lWidth = 0;
LONG lHeight = 0;
pFrame->get_Width(&lWidth);
pFrame->get_Height(&lHeight);
oInfo.m_eType = GetImageType(pFrame);
RELEASEINTERFACE(pFrame);
LONG lMaxSize = min(max(lWidth, lHeight), m_lMaxSizeImage);
if ((lWidth > lMaxSize) || (lHeight > lMaxSize))
{
LONG lW = 0;
LONG lH = 0;
double dAspect = (double)lWidth / lHeight;
if (lWidth >= lHeight)
{
lW = lMaxSize;
lH = (LONG)((double)lW / dAspect);
}
else
{
lH = lMaxSize;
lW = (LONG)(dAspect * lH);
}
pImageFile->Resize(lW, lH, 3);
}
LONG lSaveType = 4;
CString strSaveItem = _T("");
strSaveItem.Format(_T("\\image%d."), oInfo.m_lID);
if (itJPG == oInfo.m_eType)
{
strSaveItem = m_strDstMedia + strSaveItem + _T("jpg");
lSaveType = 3;
}
else
{
strSaveItem = m_strDstMedia + strSaveItem + _T("png");
}
BSTR bsDst = strSaveItem.AllocSysString();
pImageFile->SaveFile(bsDst, lSaveType);
SysFreeString(bsDst);
}
void SaveImage(IUnknown* punkImage, CImageInfo& oInfo, LONG __width, LONG __height)
{
MediaCore::IAVSUncompressedVideoFrame* pFrame = NULL;
punkImage->QueryInterface(MediaCore::IID_IAVSUncompressedVideoFrame, (void**)&pFrame);
if (NULL == pFrame)
return;
LONG lWidth = 0;
LONG lHeight = 0;
pFrame->get_Width(&lWidth);
pFrame->get_Height(&lHeight);
oInfo.m_eType = GetImageType(pFrame);
RELEASEINTERFACE(pFrame);
OfficeCore::IImageGdipFilePtr pImageFile;
pImageFile.CreateInstance(OfficeCore::CLSID_CImageGdipFile);
pImageFile->put_Frame(punkImage);
LONG lMaxSize = min(max(lWidth, lHeight), m_lMaxSizeImage);
if ((lWidth > lMaxSize) || (lHeight > lMaxSize))
{
LONG lW = 0;
LONG lH = 0;
double dAspect = (double)lWidth / lHeight;
if (lWidth >= lHeight)
{
lW = lMaxSize;
lH = (LONG)((double)lW / dAspect);
}
else
{
lH = lMaxSize;
lW = (LONG)(dAspect * lH);
}
pImageFile->Resize(lW, lH, 3);
}
LONG lSaveType = 4;
CString strSaveItem = _T("");
strSaveItem.Format(_T("\\image%d."), oInfo.m_lID);
if (itJPG == oInfo.m_eType)
{
strSaveItem = m_strDstMedia + strSaveItem + _T("jpg");
lSaveType = 3;
}
else
{
strSaveItem = m_strDstMedia + strSaveItem + _T("png");
}
BSTR bsDst = strSaveItem.AllocSysString();
pImageFile->SaveFile(bsDst, lSaveType);
SysFreeString(bsDst);
}
#else
void SaveImage(CString& strFileSrc, CImageInfo& oInfo, LONG __width, LONG __height) void SaveImage(CString& strFileSrc, CImageInfo& oInfo, LONG __width, LONG __height)
{ {
CString strLoadXml = _T("<transforms><ImageFile-LoadImage sourcepath=\"") + strFileSrc + _T("\"/></transforms>"); CString strLoadXml = _T("<transforms><ImageFile-LoadImage sourcepath=\"") + strFileSrc + _T("\"/></transforms>");
AVSImageStudio::IImageTransforms* pTransform = NULL; ImageStudio::IImageTransforms* pTransform = NULL;
CoCreateInstance(AVSImageStudio::CLSID_ImageTransforms, NULL, CLSCTX_INPROC_SERVER, AVSImageStudio::IID_IImageTransforms, (void**)&pTransform); CoCreateInstance(ImageStudio::CLSID_ImageTransforms, NULL, CLSCTX_INPROC_SERVER, ImageStudio::IID_IImageTransforms, (void**)&pTransform);
VARIANT_BOOL vbRes = VARIANT_FALSE; VARIANT_BOOL vbRes = VARIANT_FALSE;
BSTR bsLoad = strLoadXml.AllocSysString(); BSTR bsLoad = strLoadXml.AllocSysString();
...@@ -389,8 +517,8 @@ namespace NSShapeImageGen ...@@ -389,8 +517,8 @@ namespace NSShapeImageGen
RELEASEINTERFACE(pFrame); RELEASEINTERFACE(pFrame);
AVSImageStudio::IImageTransforms* pTransform = NULL; ImageStudio::IImageTransforms* pTransform = NULL;
CoCreateInstance(AVSImageStudio::CLSID_ImageTransforms, NULL ,CLSCTX_INPROC_SERVER, AVSImageStudio::IID_IImageTransforms, (void**)&pTransform); CoCreateInstance(ImageStudio::CLSID_ImageTransforms, NULL ,CLSCTX_INPROC_SERVER, ImageStudio::IID_IImageTransforms, (void**)&pTransform);
VARIANT var; VARIANT var;
var.vt = VT_UNKNOWN; var.vt = VT_UNKNOWN;
...@@ -447,6 +575,7 @@ namespace NSShapeImageGen ...@@ -447,6 +575,7 @@ namespace NSShapeImageGen
RELEASEINTERFACE(pTransform); RELEASEINTERFACE(pTransform);
} }
#endif
CImageInfo GenerateImageID(IUnknown* punkData, double dWidth, double dHeight) CImageInfo GenerateImageID(IUnknown* punkData, double dWidth, double dHeight)
{ {
...@@ -500,6 +629,7 @@ namespace NSShapeImageGen ...@@ -500,6 +629,7 @@ namespace NSShapeImageGen
if (NULL == pPair) if (NULL == pPair)
{ {
#ifdef BUILD_CONFIG_FULL_VERSION
LONG lImageType = m_oExt.GetImageType(strFileName); LONG lImageType = m_oExt.GetImageType(strFileName);
if (1 == lImageType || 2 == lImageType) if (1 == lImageType || 2 == lImageType)
...@@ -535,6 +665,7 @@ namespace NSShapeImageGen ...@@ -535,6 +665,7 @@ namespace NSShapeImageGen
oInfo.m_eType = itJPG; oInfo.m_eType = itJPG;
} }
} }
#endif
// //
++m_lNextIDImage; ++m_lNextIDImage;
...@@ -558,6 +689,7 @@ namespace NSShapeImageGen ...@@ -558,6 +689,7 @@ namespace NSShapeImageGen
LONG lWidth = (LONG)(dWidth * 96 / 25.4); LONG lWidth = (LONG)(dWidth * 96 / 25.4);
LONG lHeight = (LONG)(dHeight * 96 / 25.4); LONG lHeight = (LONG)(dHeight * 96 / 25.4);
#ifdef BUILD_CONFIG_FULL_VERSION
LONG lImageType = m_oExt.GetImageType(strFileName); LONG lImageType = m_oExt.GetImageType(strFileName);
if (1 == lImageType || 2 == lImageType) if (1 == lImageType || 2 == lImageType)
...@@ -592,6 +724,7 @@ namespace NSShapeImageGen ...@@ -592,6 +724,7 @@ namespace NSShapeImageGen
oInfo.m_eType = itJPG; oInfo.m_eType = itJPG;
} }
} }
#endif
// //
++m_lNextIDImage; ++m_lNextIDImage;
......
...@@ -3,14 +3,13 @@ ...@@ -3,14 +3,13 @@
#ifdef AVS_USE_CONVERT_PPTX_TOCUSTOM_VML #ifdef AVS_USE_CONVERT_PPTX_TOCUSTOM_VML
#include "Geometry.h" #include "Geometry.h"
#include "../../../AVSPresentationEditor/OfficeDrawing/Elements.h" #include "../../../ASCPresentationEditor/OfficeDrawing/Elements.h"
#include "../../ConverterAdvanced/Structures.h"
namespace PPTX namespace PPTX
{ {
namespace Logic namespace Logic
{ {
void Geometry::ConvertToCustomVML(IAVSRenderer* pOOXToVMLRenderer, CString& strPath, CString& strRect, LONG& lWidth, LONG& lHeight) void Geometry::ConvertToCustomVML(IASCRenderer* pOOXToVMLRenderer, CString& strPath, CString& strRect, LONG& lWidth, LONG& lHeight)
{ {
NSPresentationEditor::CShapeElement* lpShapeElement = NULL; NSPresentationEditor::CShapeElement* lpShapeElement = NULL;
if (this->is<PPTX::Logic::PrstGeom>()) if (this->is<PPTX::Logic::PrstGeom>())
......
...@@ -341,7 +341,7 @@ namespace PPTX ...@@ -341,7 +341,7 @@ namespace PPTX
}; };
#ifdef AVS_USE_CONVERT_PPTX_TOCUSTOM_VML #ifdef AVS_USE_CONVERT_PPTX_TOCUSTOM_VML
void ConvertToCustomVML(IAVSRenderer* punkRenderer, CString& strPath, CString& strRect, LONG& lWidth, LONG& lHeight); void ConvertToCustomVML(IASCRenderer* punkRenderer, CString& strPath, CString& strRect, LONG& lWidth, LONG& lHeight);
#endif #endif
}; };
} // namespace Logic } // namespace Logic
......
...@@ -353,7 +353,9 @@ namespace PPTX ...@@ -353,7 +353,9 @@ namespace PPTX
lH = spPr.xfrm->extY.get_value_or(43200); lH = spPr.xfrm->extY.get_value_or(43200);
} }
#ifdef AVS_USE_CONVERT_PPTX_TOCUSTOM_VML
spPr.Geometry.ConvertToCustomVML(pWriter->m_pOOXToVMLRenderer, strPath, strTextRect, lW, lH); spPr.Geometry.ConvertToCustomVML(pWriter->m_pOOXToVMLRenderer, strPath, strTextRect, lW, lH);
#endif
pWriter->StartNode(_T("v:shape")); pWriter->StartNode(_T("v:shape"));
......
...@@ -375,7 +375,9 @@ namespace PPTX ...@@ -375,7 +375,9 @@ namespace PPTX
lH = spPr.xfrm->extY.get_value_or(43200); lH = spPr.xfrm->extY.get_value_or(43200);
} }
#ifdef AVS_USE_CONVERT_PPTX_TOCUSTOM_VML
spPr.Geometry.ConvertToCustomVML(pWriter->m_pOOXToVMLRenderer, strPath, strTextRect, lW, lH); spPr.Geometry.ConvertToCustomVML(pWriter->m_pOOXToVMLRenderer, strPath, strTextRect, lW, lH);
#endif
CString strId = _T(""); CString strId = _T("");
strId.Format(_T("shape %d"), pWriter->m_lObjectIdVML); strId.Format(_T("shape %d"), pWriter->m_lObjectIdVML);
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
#include <atlctl.h> #include <atlctl.h>
#include <atlhost.h> #include <atlhost.h>
#include <atlcoll.h> #include <atlcoll.h>
#include <atldefine.h> #include "../Common/atldefine.h"
#define _USE_MATH_DEFINES #define _USE_MATH_DEFINES
#include <math.h> #include <math.h>
...@@ -55,20 +55,41 @@ ...@@ -55,20 +55,41 @@
#define PPT_DEF #define PPT_DEF
#define ENABLE_PPT_TO_PPTX_CONVERT #define ENABLE_PPT_TO_PPTX_CONVERT
#define _AVS_PPT_SHAPE_INCLUDE_ #define _AVS_PPT_SHAPE_INCLUDE_
#define AVS_USE_CONVERT_PPTX_TOCUSTOM_VML
//#pragma comment(lib, "PPTXFormat.lib")
using namespace ATL; using namespace ATL;
#include "../../AVSImageStudio3/AVSGraphics/Interfaces/AVSRenderer.h" #include "../ASCImageStudio3/ASCGraphics/Interfaces/ASCRenderer.h"
#include "../Common/Config.h"
#import "../Redist/ASCOfficeDocxFile2.dll" named_guids raw_interfaces_only rename_namespace("DocxFile2")
#import "../Redist/XlsxSerializerCom.dll" named_guids raw_interfaces_only rename_namespace("XlsxCom"), exclude("_IAVSOfficeFileTemplateEvents"), exclude("_IAVSOfficeFileTemplateEvents2")
#ifdef BUILD_CONFIG_OPENSOURCE_VERSION
#import "../Redist/OfficeCore.dll" named_guids raw_interfaces_only rename_namespace("OfficeCore")
namespace MediaCore
{
typedef OfficeCore::IUncompressedFrame IAVSUncompressedVideoFrame;
const GUID CLSID_CAVSUncompressedVideoFrame = OfficeCore::CLSID_CUncompressedFrame;
const GUID IID_IAVSUncompressedVideoFrame = OfficeCore::IID_IUncompressedFrame;
}
namespace ASCGraphics
{
typedef OfficeCore::IWinFonts IASCFontManager;
const GUID CLSID_CASCFontManager = OfficeCore::CLSID_CWinFonts;
const GUID IID_IASCFontManager = OfficeCore::IID_IWinFonts;
}
#else
#define AVS_USE_CONVERT_PPTX_TOCUSTOM_VML
#import "../../../Redist/AVSMediaCore3.dll" named_guids raw_interfaces_only rename_namespace("MediaCore"), exclude("tagRECT") #import "../Redist/ASCMediaCore3.dll" named_guids raw_interfaces_only rename_namespace("MediaCore"), exclude("tagRECT")
#import "../../../Redist/AVSImageStudio3.dll" named_guids raw_interfaces_only rename_namespace("AVSImageStudio"), exclude("IAVSRenderer") #import "../Redist/ASCImageStudio3.dll" named_guids raw_interfaces_only rename_namespace("ImageStudio"), exclude("IASCRenderer")
#import "../../../Redist/AVSOfficeStudio/AVSHTMLRenderer.dll" named_guids raw_interfaces_only rename_namespace("HtmlRenderer"), exclude("IAVSRenderer") #import "../Redist/ASCHTMLRenderer.dll" named_guids raw_interfaces_only rename_namespace("HtmlRenderer"), exclude("IASCRenderer")
#import "../../../AVS/Redist/AVSVideoFile3.dll" named_guids raw_interfaces_only rename_namespace("VideoFile") #import "../Redist/ASCGraphics.dll" named_guids raw_interfaces_only rename_namespace("ASCGraphics"), exclude("IASCRenderer")
#import "../../../AVS/Redist/AVSGraphics.dll" named_guids raw_interfaces_only rename_namespace("AVSGraphics"), exclude("IAVSRenderer") #import "../Redist/ASCFontConverter.dll" named_guids raw_interfaces_only rename_namespace("Fonts")
#import "../../../AVS/Redist/AVSOfficeStudio/AVSFontConverter.dll" named_guids raw_interfaces_only rename_namespace("Fonts")
#import "../../../AVS/Redist/AVSOfficeStudio/AVSOfficeDocxFile2.dll" named_guids raw_interfaces_only rename_namespace("DocxFile2")
#import "../../../AVS/Sources/TeamlabOffice/trunk/wwwroot/Bin/XlsxSerializerCom.dll" named_guids raw_interfaces_only rename_namespace("XlsxCom"), exclude("_IAVSOfficeFileTemplateEvents"), exclude("_IAVSOfficeFileTemplateEvents2") #endif
\ No newline at end of file \ No newline at end of file
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