Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
onlyoffice_core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
onlyoffice_core
Commits
45e75646
Commit
45e75646
authored
May 13, 2016
by
ElenaSubbotina
Committed by
Alexander Trofimov
May 21, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DocFormatReader - конвертация dib картинок в png (user_manual_v52.doc)
parent
08399f16
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
507 additions
and
103 deletions
+507
-103
ASCOfficeDocFile/DocDocxConverter/OpenXmlPackage.cpp
ASCOfficeDocFile/DocDocxConverter/OpenXmlPackage.cpp
+0
-1
ASCOfficeDocFile/DocDocxConverter/WordprocessingDocument.cpp
ASCOfficeDocFile/DocDocxConverter/WordprocessingDocument.cpp
+33
-94
ASCOfficeDocFile/Win32/OfficeDocFile_VS2005.sln
ASCOfficeDocFile/Win32/OfficeDocFile_VS2005.sln
+474
-8
No files found.
ASCOfficeDocFile/DocDocxConverter/OpenXmlPackage.cpp
View file @
45e75646
...
...
@@ -81,7 +81,6 @@ namespace DocFileFormat
void
OpenXmlPackage
::
SaveToFile
(
const
std
::
wstring
&
outputDir
,
const
std
::
wstring
&
fileName
,
const
void
*
buf
,
unsigned
int
size
)
{
if
(
buf
!=
NULL
)
{
...
...
ASCOfficeDocFile/DocDocxConverter/WordprocessingDocument.cpp
View file @
45e75646
...
...
@@ -4,6 +4,8 @@
#include "../../Common/DocxFormat/Source/SystemUtility/SystemUtility.h"
#include "../../Common/DocxFormat/Source/SystemUtility/FileSystem/Directory.h"
#include "../../DesktopEditor/raster/BgraFrame.h"
namespace
ImageHelper
{
inline
static
int
CompareStrings
(
const
wchar_t
*
str1
,
const
wchar_t
*
str2
)
...
...
@@ -16,92 +18,34 @@ namespace ImageHelper
return
1
;
}
//inline static void GetEncoderCLSID (const wchar_t* pFormat, CLSID* pClsid)
//{
// // variables
// UINT nEncoders = 0;
// UINT nSize = 0;
// Gdiplus::ImageCodecInfo* pImageCodecInfo = 0;
// // retrieve encoders info
// Gdiplus::GetImageEncodersSize(&nEncoders, &nSize);
// // check for valid encoders
// if (!nSize)
// throw 0;
// // create encoders info structure of necessary size
// pImageCodecInfo = (Gdiplus::ImageCodecInfo*)(malloc(nSize));
// // check for valid encoder
// if (!pImageCodecInfo)
// throw 0;
// // retrieve all encoders
// Gdiplus::GetImageEncoders(nEncoders, nSize, pImageCodecInfo);
// // locate necessary encoder
// for (UINT nEncoder = 0; nEncoder < nEncoders; ++nEncoder)
// {
// // compare MIME strings
// if (CompareStrings(pImageCodecInfo[nEncoder].MimeType, pFormat) == 0)
// {
// // save CLSID
// *pClsid = pImageCodecInfo[nEncoder].Clsid;
// // clear memory
// free(pImageCodecInfo);
// // all ok
// return;
// }
// }
// // clear memory
// free(pImageCodecInfo);
// // codec not found
// throw 0;
//}
//inline bool SaveImageToFileFromDIB(unsigned char* buffer, const std::wstring& file)
//{
// const BITMAPFILEHEADER* bmfh = (BITMAPFILEHEADER*)buffer;
// const BITMAPINFO* info = (BITMAPINFO*)buffer;
// if (NULL != bmfh && NULL != info)
// {
// HDC hdc = GetDC(NULL);
// if (hdc)
// {
// HBITMAP hbm = ::CreateDIBitmap(hdc, &info->bmiHeader, CBM_INIT, (buffer + sizeof(BITMAPINFO)), info, DIB_RGB_COLORS);
// if (hbm)
// {
// Gdiplus::Bitmap oBitmap (hbm, NULL);
// if (Gdiplus::Ok == oBitmap.GetLastStatus())
// {
// CLSID guid;
// GetEncoderCLSID (L"image/png", &guid);
// if (Gdiplus::Ok == oBitmap.Save (file.c_str(), &guid))
// {
// oBitmap.Save(file.c_str(), &guid);
// DeleteObject(hbm);
// ReleaseDC(NULL, hdc);
// return (Gdiplus::Ok == oBitmap.GetLastStatus());
// }
// }
// DeleteObject(hbm);
// }
// ReleaseDC(NULL, hdc);
// }
// }
// return false;
//}
inline
bool
SaveImageToFileFromDIB
(
unsigned
char
*
buffer
,
int
size
,
const
std
::
wstring
&
file
)
{
bool
result
=
false
;
const
BITMAPINFOHEADER
*
info
=
(
BITMAPINFOHEADER
*
)
buffer
;
if
(
NULL
!=
info
&&
info
->
biSize
==
40
)
{
unsigned
char
*
pBgraData
=
buffer
+
sizeof
(
BITMAPINFOHEADER
);
int
nWidth
=
info
->
biWidth
;
int
nHeight
=
info
->
biHeight
;
CBgraFrame
oFrame
;
oFrame
.
put_Data
(
pBgraData
);
oFrame
.
put_Width
(
nWidth
);
oFrame
.
put_Height
(
nHeight
);
int
nStride
=
info
->
biSizeImage
/
nHeight
;
oFrame
.
put_Stride
(
-
nStride
);
result
=
oFrame
.
SaveFile
(
file
,
4
);
oFrame
.
put_Data
(
NULL
);
}
return
result
;
}
}
namespace
DocFileFormat
...
...
@@ -154,18 +98,13 @@ namespace DocFileFormat
copy
(
iter
->
data
.
begin
(),
iter
->
data
.
end
(),
bytes
);
if
(
Global
::
msoblipDIB
==
iter
->
blipType
)
{
std
::
wstring
file
=
string2std_string
(
pathMedia
.
GetPath
())
+
FILE_SEPARATOR_STR
+
_T
(
"image"
)
+
FormatUtils
::
IntToWideString
(
i
++
)
+
iter
->
ext
;
//ImageHelper::SaveImageToFileFromDIB(bytes, file);
//todooo ... any system
{
//user_manual_v52.doc
std
::
wstring
file_name
=
string2std_string
(
pathMedia
.
GetPath
())
+
FILE_SEPARATOR_STR
+
_T
(
"image"
)
+
FormatUtils
::
IntToWideString
(
i
++
)
+
iter
->
ext
;
ImageHelper
::
SaveImageToFileFromDIB
(
bytes
,
iter
->
data
.
size
(),
file_name
);
}
else
{
SaveToFile
(
string2std_string
(
pathMedia
.
GetPath
()),
std
::
wstring
(
_T
(
"image"
))
+
FormatUtils
::
IntToWideString
(
i
++
)
+
iter
->
ext
,
(
void
*
)
bytes
,
(
unsigned
int
)
iter
->
data
.
size
());
}
RELEASEARRAYOBJECTS
(
bytes
);
...
...
ASCOfficeDocFile/Win32/OfficeDocFile_VS2005.sln
View file @
45e75646
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment