diff --git a/OOXML/Binary/Sheets/Writer/BinaryReaderS.cpp b/OOXML/Binary/Sheets/Writer/BinaryReaderS.cpp index 288db3a25e..72b9a82a59 100644 --- a/OOXML/Binary/Sheets/Writer/BinaryReaderS.cpp +++ b/OOXML/Binary/Sheets/Writer/BinaryReaderS.cpp @@ -6328,7 +6328,7 @@ int BinaryWorksheetsTableReader::ReadDrawings(BYTE type, long length, void* poRe { OOX::Spreadsheet::COleObject* pOleObject = new OOX::Spreadsheet::COleObject(); - if (oPic.oleObject->m_sProgId.IsInit()) pOleObject->m_oProgId = oPic.oleObject->m_sProgId.get(); + if (oPic.oleObject->m_sProgId.IsInit()) pOleObject->m_oProgId = oPic.oleObject->m_sProgId.get(); if (oPic.oleObject->m_oDrawAspect.IsInit()) { std::wstring sDrawAspect; diff --git a/OdfFile/Common/logging.cpp b/OdfFile/Common/logging.cpp index b434a89944..6df3f3d8cc 100644 --- a/OdfFile/Common/logging.cpp +++ b/OdfFile/Common/logging.cpp @@ -36,10 +36,11 @@ namespace cpdoccore { - logging< std::wostream > logging_err(std::wcerr); - logging< std::wostream > logging_cout(std::wcout); - - std::wstringstream log_stringstream; - logging< std::wstringstream > logging_log (log_stringstream); - + logging logging_cout(std::wcout, true); + logging logging_cout_continue(std::wcout, false); + + std::wstringstream log_stringstream; + + logging logging_log(log_stringstream, true); + logging logging_log_continue(log_stringstream, false); } diff --git a/OdfFile/Common/logging.h b/OdfFile/Common/logging.h index 337baf2d08..71a8374b7c 100644 --- a/OdfFile/Common/logging.h +++ b/OdfFile/Common/logging.h @@ -43,32 +43,39 @@ namespace cpdoccore class logging { public: - logging(Ostream &stream) : ostream_(stream) + logging(Ostream &stream, bool bTime) : ostream_(stream), bTime_(bTime) {} template Ostream & operator << (const T & t) { + if (bTime_) + { #if defined(_DEBUG) || defined(_LOGOUT_ALWAYS) - std::chrono::system_clock::time_point now{ std::chrono::system_clock::now() }; - std::time_t now_c = std::chrono::system_clock::to_time_t(now); - std::tm tm = *std::localtime(&now_c); + std::chrono::system_clock::time_point now{ std::chrono::system_clock::now() }; + std::time_t now_c = std::chrono::system_clock::to_time_t(now); + std::tm tm = *std::localtime(&now_c); - auto duration_since_epoch = now.time_since_epoch(); - auto milliseconds = std::chrono::duration_cast(duration_since_epoch) % 1000; + auto duration_since_epoch = now.time_since_epoch(); + auto milliseconds = std::chrono::duration_cast(duration_since_epoch) % 1000; - ostream_ << std::put_time(&tm, L"%H:%M:%S") << L"." << milliseconds.count() << L"\t"; + ostream_ << std::put_time(&tm, L"%H:%M:%S") << L"." << milliseconds.count() << L"\t"; #endif + } ostream_ << t; return ostream_; } private: Ostream & ostream_; + bool bTime_ = true; }; extern logging logging_cout; extern logginglogging_log; + + extern logging logging_cout_continue; + extern logginglogging_log_continue; } #if defined( _DEBUG) || defined(_LOGOUT_ALWAYS) @@ -76,3 +83,9 @@ namespace cpdoccore #else #define _CP_LOG cpdoccore::logging_log #endif + +#if defined( _DEBUG) || defined(_LOGOUT_ALWAYS) +#define _CP_LOG_CONTINUE cpdoccore::logging_cout_continue +#else +#define _CP_LOG_CONTINUE cpdoccore::logging_log_continue +#endif \ No newline at end of file diff --git a/OdfFile/Projects/Windows/OdfFormatW.vcxproj b/OdfFile/Projects/Windows/OdfFormatW.vcxproj index c939187b7e..e8fc357ec7 100644 --- a/OdfFile/Projects/Windows/OdfFormatW.vcxproj +++ b/OdfFile/Projects/Windows/OdfFormatW.vcxproj @@ -29,7 +29,6 @@ - diff --git a/OdfFile/Projects/Windows/OdfFormatW.vcxproj.filters b/OdfFile/Projects/Windows/OdfFormatW.vcxproj.filters index f035eb6633..8d59abb983 100644 --- a/OdfFile/Projects/Windows/OdfFormatW.vcxproj.filters +++ b/OdfFile/Projects/Windows/OdfFormatW.vcxproj.filters @@ -154,7 +154,6 @@ - diff --git a/OdfFile/Reader/Converter/measuredigits.cpp b/OdfFile/Reader/Converter/measuredigits.cpp index b8d59512e9..5fd04307a5 100644 --- a/OdfFile/Reader/Converter/measuredigits.cpp +++ b/OdfFile/Reader/Converter/measuredigits.cpp @@ -41,14 +41,20 @@ namespace utils { std::pair GetMaxDigitSizePixelsImpl(const std::wstring & fontName, double fontSize, double dpi, long fontStyle, NSFonts::IFontManager *pFontManager) { - if (pFontManager == NULL) return std::pair(7., 8.); + if (pFontManager == NULL) + { + _CP_LOG_CONTINUE << " wrong FontManager" << std::endl; + return std::pair(7., 8.); + } int hr = FALSE; if (FALSE == (hr = pFontManager->LoadFontByName(fontName, fontSize, fontStyle, dpi, dpi ))) { + _CP_LOG_CONTINUE << " wrong load font: " << fontName << L" " << std::to_wstring(fontSize) << L" pt"; if (FALSE == (hr = pFontManager->LoadFontByName(L"Arial", fontSize, fontStyle, dpi, dpi ))) { + _CP_LOG_CONTINUE << " wrong load font: Arial " << std::to_wstring(fontSize) << L" pt ... default set" << std::endl; return std::pair(7, 8); } } @@ -64,8 +70,11 @@ std::pair GetMaxDigitSizePixelsImpl(const std::wstring & fontNam //if (FALSE == (hr = pFontManager->LoadString2( std::to_wstring(i), 0, 0))) // return std::pair(7,8); - if (FALSE == (hr = pFontManager->LoadString2( L"0123456789" , 0, 0)))// - return std::pair(7., 8.); + if (FALSE == (hr = pFontManager->LoadString2(L"0123456789", 0, 0)))// + { + _CP_LOG_CONTINUE << " wrong load string ... default set" << std::endl; + return std::pair(7., 8.); + } TBBox box; try @@ -73,12 +82,16 @@ std::pair GetMaxDigitSizePixelsImpl(const std::wstring & fontNam box = pFontManager->MeasureString(); }catch(...) { + _CP_LOG_CONTINUE << " wrong measure string ... default set" << std::endl; return std::pair(7.,8.); } - if (box.fMaxX < -0xffff+1 || box.fMaxY < -0xffff+1 || - box.fMinX > 0xffff-1 || box.fMinY > 0xffff-1) - return std::pair(7., 8. ); + if (box.fMaxX < -0xffff + 1 || box.fMaxY < -0xffff + 1 || + box.fMinX > 0xffff - 1 || box.fMinY > 0xffff - 1) + { + _CP_LOG_CONTINUE << " wrong get box size from FontManager ... default set" << std::endl; + return std::pair(7., 8.); + } if (box.fMaxX - box.fMinX > maxWidth) maxWidth = box.fMaxX - box.fMinX; if (box.fMaxY - box.fMinY > maxHeight) maxHeight = box.fMaxY - box.fMinY; @@ -90,19 +103,25 @@ std::pair GetMaxDigitSizePixelsImpl(const std::wstring & fontNam double width = (minWidth + 2 * maxWidth) /10. /3.; //double width = (minWidth + 2 * maxWidth) / 5./*/36.*/ /3.; - if (width > 0.01 && maxHeight > 0.01) - return std::pair(width, maxHeight); - else - return std::pair(7., 8.); + if (width > 0.01 && maxHeight > 0.01) + { + _CP_LOG_CONTINUE << std::to_wstring(width) << ", " << std::to_wstring(maxHeight) << std::endl; + return std::pair(width, maxHeight); + } + else + { + _CP_LOG_CONTINUE << " wrong size ... default set" << std::endl; + return std::pair(7., 8.); + } } std::pair GetMaxDigitSizePixels(const std::wstring & fontName, double fontSize, double dpi, long fontStyle, NSFonts::IApplicationFonts *appFonts) { - try - { - _CP_LOG << "[info] : GetMaxDigitSizePixels..."; + _CP_LOG << "[info] : GetMaxDigitSizePixels..."; + try + { if (appFonts) { NSFonts::IFontManager *pFontManager = appFonts->GenerateFontManager(); @@ -114,15 +133,14 @@ std::pair GetMaxDigitSizePixels(const std::wstring & fontName, d delete pFontManager; } - _CP_LOG << "ok" << std::endl; return val; } } catch(...) { - // TODO: default value! } - return std::pair(7., 8.); + _CP_LOG_CONTINUE << " default set" << std::endl; + return std::pair(7., 8.); } } diff --git a/OdfFile/Reader/Format/styles_list.cpp b/OdfFile/Reader/Format/styles_list.cpp index dc716633d4..f5498d83f4 100644 --- a/OdfFile/Reader/Format/styles_list.cpp +++ b/OdfFile/Reader/Format/styles_list.cpp @@ -930,7 +930,16 @@ void text_list_level_style_image::pptx_convert(oox::pptx_conversion_context & Co std::wstring rid = Context.get_mediaitems()->add_or_find(*image_attr_.xlink_attlist_.href_, oox::typeImage, isMediaInternal, ref_image, oox::document_place); Context.get_slide_context().add_rels(isMediaInternal, rid, ref_image, oox::typeImage); - //a:buSzPct + if (listLevelProperties && listLevelProperties->fo_width_ && listLevelProperties->fo_height_) + { + double width_pt = listLevelProperties->fo_width_->get_value_unit(length::pt); + double height_pt = listLevelProperties->fo_height_->get_value_unit(length::pt); + + CP_XML_NODE(L"a:buSzPts") + { + CP_XML_ATTR(L"val", (int)(width_pt * 100)); + } + } CP_XML_NODE(L"a:buBlip") { CP_XML_NODE(L"a:blip") diff --git a/OdfFile/Writer/Format/logging.cpp b/OdfFile/Writer/Format/logging.cpp deleted file mode 100644 index dc9163abb4..0000000000 --- a/OdfFile/Writer/Format/logging.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - * (c) Copyright Ascensio System SIA 2010-2023 - * - * This program is a free software product. You can redistribute it and/or - * modify it under the terms of the GNU Affero General Public License (AGPL) - * version 3 as published by the Free Software Foundation. In accordance with - * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect - * that Ascensio System SIA expressly excludes the warranty of non-infringement - * of any third-party rights. - * - * This program is distributed WITHOUT ANY WARRANTY; without even the implied - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For - * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html - * - * You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish - * street, Riga, Latvia, EU, LV-1050. - * - * The interactive user interfaces in modified source and object code versions - * of the Program must display Appropriate Legal Notices, as required under - * Section 5 of the GNU AGPL version 3. - * - * Pursuant to Section 7(b) of the License you must retain the original Product - * logo when distributing the program. Pursuant to Section 7(e) we decline to - * grant you any rights under trademark law for use of our trademarks. - * - * All the Product's GUI elements, including illustrations and icon sets, as - * well as technical writing content are licensed under the terms of the - * Creative Commons Attribution-ShareAlike 4.0 International. See the License - * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode - * - */ - -#include "logging.h" -#include - -namespace cpdoccore { - -logging< std::wostream > logging_err(std::wcerr); -logging< std::wostream > logging_cout(std::wcout); - -}