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
Show 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
...
@@ -81,7 +81,6 @@ namespace DocFileFormat
void
OpenXmlPackage
::
SaveToFile
(
const
std
::
wstring
&
outputDir
,
const
std
::
wstring
&
fileName
,
const
void
*
buf
,
unsigned
int
size
)
void
OpenXmlPackage
::
SaveToFile
(
const
std
::
wstring
&
outputDir
,
const
std
::
wstring
&
fileName
,
const
void
*
buf
,
unsigned
int
size
)
{
{
if
(
buf
!=
NULL
)
if
(
buf
!=
NULL
)
{
{
...
...
ASCOfficeDocFile/DocDocxConverter/WordprocessingDocument.cpp
View file @
45e75646
...
@@ -4,6 +4,8 @@
...
@@ -4,6 +4,8 @@
#include "../../Common/DocxFormat/Source/SystemUtility/SystemUtility.h"
#include "../../Common/DocxFormat/Source/SystemUtility/SystemUtility.h"
#include "../../Common/DocxFormat/Source/SystemUtility/FileSystem/Directory.h"
#include "../../Common/DocxFormat/Source/SystemUtility/FileSystem/Directory.h"
#include "../../DesktopEditor/raster/BgraFrame.h"
namespace
ImageHelper
namespace
ImageHelper
{
{
inline
static
int
CompareStrings
(
const
wchar_t
*
str1
,
const
wchar_t
*
str2
)
inline
static
int
CompareStrings
(
const
wchar_t
*
str1
,
const
wchar_t
*
str2
)
...
@@ -16,92 +18,34 @@ namespace ImageHelper
...
@@ -16,92 +18,34 @@ namespace ImageHelper
return
1
;
return
1
;
}
}
//inline static void GetEncoderCLSID (const wchar_t* pFormat, CLSID* pClsid)
inline
bool
SaveImageToFileFromDIB
(
unsigned
char
*
buffer
,
int
size
,
const
std
::
wstring
&
file
)
//{
{
// // variables
bool
result
=
false
;
// UINT nEncoders = 0;
const
BITMAPINFOHEADER
*
info
=
(
BITMAPINFOHEADER
*
)
buffer
;
// UINT nSize = 0;
// Gdiplus::ImageCodecInfo* pImageCodecInfo = 0;
if
(
NULL
!=
info
&&
info
->
biSize
==
40
)
{
// // retrieve encoders info
unsigned
char
*
pBgraData
=
buffer
+
sizeof
(
BITMAPINFOHEADER
);
// Gdiplus::GetImageEncodersSize(&nEncoders, &nSize);
int
nWidth
=
info
->
biWidth
;
// // check for valid encoders
int
nHeight
=
info
->
biHeight
;
// if (!nSize)
// throw 0;
CBgraFrame
oFrame
;
oFrame
.
put_Data
(
pBgraData
);
// // create encoders info structure of necessary size
oFrame
.
put_Width
(
nWidth
);
// pImageCodecInfo = (Gdiplus::ImageCodecInfo*)(malloc(nSize));
oFrame
.
put_Height
(
nHeight
);
// // check for valid encoder
int
nStride
=
info
->
biSizeImage
/
nHeight
;
// if (!pImageCodecInfo)
oFrame
.
put_Stride
(
-
nStride
);
// throw 0;
result
=
oFrame
.
SaveFile
(
file
,
4
);
// // retrieve all encoders
// Gdiplus::GetImageEncoders(nEncoders, nSize, pImageCodecInfo);
oFrame
.
put_Data
(
NULL
);
// // locate necessary encoder
}
// for (UINT nEncoder = 0; nEncoder < nEncoders; ++nEncoder)
// {
return
result
;
// // 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;
//}
}
}
namespace
DocFileFormat
namespace
DocFileFormat
...
@@ -154,18 +98,13 @@ namespace DocFileFormat
...
@@ -154,18 +98,13 @@ namespace DocFileFormat
copy
(
iter
->
data
.
begin
(),
iter
->
data
.
end
(),
bytes
);
copy
(
iter
->
data
.
begin
(),
iter
->
data
.
end
(),
bytes
);
if
(
Global
::
msoblipDIB
==
iter
->
blipType
)
if
(
Global
::
msoblipDIB
==
iter
->
blipType
)
{
{
//user_manual_v52.doc
std
::
wstring
file
=
string2std_string
(
pathMedia
.
GetPath
())
+
FILE_SEPARATOR_STR
+
_T
(
"image"
)
+
FormatUtils
::
IntToWideString
(
i
++
)
+
iter
->
ext
;
std
::
wstring
file_name
=
string2std_string
(
pathMedia
.
GetPath
())
+
FILE_SEPARATOR_STR
+
_T
(
"image"
)
+
FormatUtils
::
IntToWideString
(
i
++
)
+
iter
->
ext
;
//ImageHelper::SaveImageToFileFromDIB(bytes, file);
ImageHelper
::
SaveImageToFileFromDIB
(
bytes
,
iter
->
data
.
size
(),
file_name
);
//todooo ... any system
}
}
else
else
{
{
SaveToFile
(
string2std_string
(
pathMedia
.
GetPath
()),
std
::
wstring
(
_T
(
"image"
))
+
FormatUtils
::
IntToWideString
(
i
++
)
+
iter
->
ext
,
(
void
*
)
bytes
,
(
unsigned
int
)
iter
->
data
.
size
());
SaveToFile
(
string2std_string
(
pathMedia
.
GetPath
()),
std
::
wstring
(
_T
(
"image"
))
+
FormatUtils
::
IntToWideString
(
i
++
)
+
iter
->
ext
,
(
void
*
)
bytes
,
(
unsigned
int
)
iter
->
data
.
size
());
}
}
RELEASEARRAYOBJECTS
(
bytes
);
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