[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - vcl/inc vcl/source
vcl/inc/IconThemeSelector.hxx|3 ++- vcl/source/app/IconThemeSelector.cxx | 13 ++--- vcl/source/app/settings.cxx |9 +++-- 3 files changed, 19 insertions(+), 6 deletions(-) New commits: commit 4aef8133f522be2f2d51456990cd64faaa90d080 Author: Caolán McNamara AuthorDate: Thu May 19 11:08:50 2022 +0100 Commit: Adolfo Jayme Barrientos CommitDate: Thu May 19 23:49:19 2022 +0200 icon-theme not dynamically changing to match desktop if set to 'auto' Change-Id: Id5700cff1000fe4b6df6e73c1ce9ff4f206e0a96 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134613 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos diff --git a/vcl/inc/IconThemeSelector.hxx b/vcl/inc/IconThemeSelector.hxx index 7e2dfc0da1dd..8dab03d3a8d2 100644 --- a/vcl/inc/IconThemeSelector.hxx +++ b/vcl/inc/IconThemeSelector.hxx @@ -62,7 +62,8 @@ public: void SetUseHighContrastTheme(bool); -void +/** Returns true if the PreferredIconTheme was changed */ +bool SetPreferredIconTheme(const OUString&, bool bDarkIconTheme); bool diff --git a/vcl/source/app/IconThemeSelector.cxx b/vcl/source/app/IconThemeSelector.cxx index 253242bcd5ad..5abb7b29d5df 100644 --- a/vcl/source/app/IconThemeSelector.cxx +++ b/vcl/source/app/IconThemeSelector.cxx @@ -124,13 +124,20 @@ IconThemeSelector::SetUseHighContrastTheme(bool v) mUseHighContrastTheme = v; } -void +bool IconThemeSelector::SetPreferredIconTheme(const OUString& theme, bool bDarkIconTheme) { // lower case theme name, and (tdf#120175) replace - with _ // see icon-themes/README -mPreferredIconTheme = theme.toAsciiLowerCase().replace('-','_'); -mPreferDarkIconTheme = bDarkIconTheme; +OUString sIconTheme = theme.toAsciiLowerCase().replace('-','_'); + +const bool bChanged = mPreferredIconTheme != sIconTheme || mPreferDarkIconTheme != bDarkIconTheme; +if (bChanged) +{ +mPreferredIconTheme = sIconTheme; +mPreferDarkIconTheme = bDarkIconTheme; +} +return bChanged; } bool diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index 0e64a4269e35..186013ebc999 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -184,7 +184,7 @@ struct ImplStyleData std::shared_ptr mIconThemeSelector; -OUString mIconTheme; +OUStringmIconTheme; boolmbSkipDisabledInMenus; boolmbHideDisabledMenuItems; boolmbPreferredContextMenuShortcuts; @@ -3139,7 +3139,12 @@ StyleSettings::GetHighContrastMode() const void StyleSettings::SetPreferredIconTheme(const OUString& theme, bool bDarkIconTheme) { -mxData->mIconThemeSelector->SetPreferredIconTheme(theme, bDarkIconTheme); +const bool bChanged = mxData->mIconThemeSelector->SetPreferredIconTheme(theme, bDarkIconTheme); +if (bChanged) +{ +// clear this so it is recalculated if it was selected as the automatic theme +mxData->mIconTheme.clear(); +} } void
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - vcl/inc vcl/source
vcl/inc/fontinstance.hxx | 16 +-- vcl/source/font/PhysicalFontCollection.cxx | 64 + vcl/source/font/fontinstance.cxx | 19 ++-- 3 files changed, 64 insertions(+), 35 deletions(-) New commits: commit ea7f625a83d9d9772c2bea2d52e0ed5f8622b6b6 Author: Caolán McNamara AuthorDate: Wed Mar 2 15:05:18 2022 + Commit: Adolfo Jayme Barrientos CommitDate: Wed May 4 16:33:41 2022 +0200 tdf#147283 allow 'fake italic/bold' glyph fallback results to be cached see also tdf#32665 Change-Id: I69746b815fec3c73f87de4dc3fe84dbc91e61f0f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130877 Tested-by: Jenkins Reviewed-by: Caolán McNamara (cherry picked from commit 04f9a8957c04b8c5abaa58140328d2c83381f4ff) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133724 Reviewed-by: Adolfo Jayme Barrientos diff --git a/vcl/inc/fontinstance.hxx b/vcl/inc/fontinstance.hxx index 7fe31dbea828..d23c6a58548d 100644 --- a/vcl/inc/fontinstance.hxx +++ b/vcl/inc/fontinstance.hxx @@ -61,8 +61,10 @@ public: // TODO: make data members private Degree10mnOrientation; // text angle in 3600 system boolmbInit; // true if maFontMetric member is valid -voidAddFallbackForUnicode( sal_UCS4, FontWeight eWeight, const OUString& rFontName ); -boolGetFallbackForUnicode( sal_UCS4, FontWeight eWeight, OUString* pFontName ) const; +voidAddFallbackForUnicode(sal_UCS4 cChar, FontWeight eWeight, const OUString& rFontName, + bool bEmbolden, const ItalicMatrix& rMatrix); +boolGetFallbackForUnicode(sal_UCS4 cInChar, FontWeight eInWeight, + OUString* pOutFontName, bool* pOutEmbolden, ItalicMatrix* pOutItalicMatrix) const; voidIgnoreFallbackForUnicode( sal_UCS4, FontWeight eWeight, std::u16string_view rFontName ); inline hb_font_t* GetHbFont(); @@ -93,10 +95,16 @@ protected: virtual hb_font_t* ImplInitHbFont() { assert(false); return hb_font_get_empty(); } private: -// cache of Unicode characters and replacement font names +struct MapEntry +{ +OUString sFontName; +bool bEmbolden; +ItalicMatrix aItalicMatrix; +}; +// cache of Unicode characters and replacement font names and attributes // TODO: a fallback map can be shared with many other ImplFontEntries // TODO: at least the ones which just differ in orientation, stretching or height -typedef ::std::unordered_map< ::std::pair, OUString > UnicodeFallbackList; +typedef ::std::unordered_map< ::std::pair, MapEntry > UnicodeFallbackList; std::unique_ptr mpUnicodeFallbackList; mutable ImplFontCache * mpFontCache; const vcl::font::FontSelectPattern m_aFontSelData; diff --git a/vcl/source/font/PhysicalFontCollection.cxx b/vcl/source/font/PhysicalFontCollection.cxx index 0cb503a7df54..5ced193aee8a 100644 --- a/vcl/source/font/PhysicalFontCollection.cxx +++ b/vcl/source/font/PhysicalFontCollection.cxx @@ -196,7 +196,10 @@ PhysicalFontFamily* PhysicalFontCollection::GetGlyphFallbackFont(FontSelectPatte while( nStrIndex < rMissingCodes.getLength() ) { cChar = rMissingCodes.iterateCodePoints( ); -bCached = pFontInstance->GetFallbackForUnicode( cChar, rFontSelData.GetWeight(), ); +bCached = pFontInstance->GetFallbackForUnicode(cChar, rFontSelData.GetWeight(), + , + , + ); // ignore entries which don't have a fallback if( !bCached || !rFontSelData.maSearchName.isEmpty() ) @@ -210,13 +213,20 @@ PhysicalFontFamily* PhysicalFontCollection::GetGlyphFallbackFont(FontSelectPatte int nRemainingLength = 0; std::unique_ptr const pRemainingCodes(new sal_UCS4[rMissingCodes.getLength()]); OUString aFontName; +bool bEmbolden; +ItalicMatrix aMatrix; while( nStrIndex < rMissingCodes.getLength() ) { cChar = rMissingCodes.iterateCodePoints( ); -bCached = pFontInstance->GetFallbackForUnicode( cChar, rFontSelData.GetWeight(), ); -if( !bCached || (rFontSelData.maSearchName != aFontName) ) +bCached = pFontInstance->GetFallbackForUnicode(cChar, rFontSelData.GetWeight(), + , , ); +if (!bCached || rFontSelData.maSearchName != aFontName || +rFontSelData.mbEmbolden != bEmbolden || +rFontSelData.maItalicMatrix != aMatrix) +{
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - vcl/inc vcl/source
vcl/inc/bitmap/Octree.hxx|5 ++--- vcl/source/bitmap/Octree.cxx | 40 2 files changed, 18 insertions(+), 27 deletions(-) New commits: commit 6da6e942409d8a9bd4d9a95c43f489443e88346f Author: Stephan Bergmann AuthorDate: Mon Jan 17 21:47:48 2022 +0100 Commit: Caolán McNamara CommitDate: Sat Feb 5 21:53:55 2022 +0100 Avoid -Werror=dangling-pointer= > vcl/source/bitmap/Octree.cxx: In constructor ‘Octree::Octree(const BitmapReadAccess&, sal_uLong)’: > vcl/source/bitmap/Octree.cxx:69:17: error: storing the address of local variable ‘aColor’ in ‘*this.Octree::mpColor’ [-Werror=dangling-pointer=] >69 | mpColor = > | ^ > vcl/source/bitmap/Octree.cxx:67:21: note: ‘aColor’ declared here >67 | BitmapColor aColor; > | ^~ > vcl/source/bitmap/Octree.cxx:67:21: note: ‘’ declared here (new with GCC 12) Change-Id: I5b1ffa15b92f2c41dbe51dfa843eb6bab3a4b449 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128517 Tested-by: Jenkins Reviewed-by: Stephan Bergmann (cherry picked from commit 5db574727f4564238a54159a1a0673eaa2884b69) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129444 Reviewed-by: Caolán McNamara diff --git a/vcl/inc/bitmap/Octree.hxx b/vcl/inc/bitmap/Octree.hxx index 216f2fdd1875..4db06502256d 100644 --- a/vcl/inc/bitmap/Octree.hxx +++ b/vcl/inc/bitmap/Octree.hxx @@ -42,9 +42,9 @@ class VCL_PLUGIN_PUBLIC Octree { private: void CreatePalette(OctreeNode* pNode); -void GetPalIndex(const OctreeNode* pNode); +void GetPalIndex(const OctreeNode* pNode, BitmapColor const& color); -SAL_DLLPRIVATE void add(std::unique_ptr& rpNode); +SAL_DLLPRIVATE void add(std::unique_ptr& rpNode, BitmapColor const& color); SAL_DLLPRIVATE void reduce(); BitmapPalette maPalette; @@ -52,7 +52,6 @@ private: sal_uLong mnLevel; std::unique_ptr pTree; std::vector mpReduce; -BitmapColor const* mpColor; sal_uInt16 mnPalIndex; public: diff --git a/vcl/source/bitmap/Octree.cxx b/vcl/source/bitmap/Octree.cxx index fab0c8374ca8..98ad8c9fcf5d 100644 --- a/vcl/source/bitmap/Octree.cxx +++ b/vcl/source/bitmap/Octree.cxx @@ -34,7 +34,6 @@ Octree::Octree(const BitmapReadAccess& rReadAcc, sal_uLong nColors) : mnLeafCount(0) , mnLevel(0) , mpReduce(OCTREE_BITS + 1, nullptr) -, mpColor(nullptr) , mnPalIndex(0) { const BitmapReadAccess* pAccess = @@ -53,9 +52,8 @@ Octree::Octree(const BitmapReadAccess& rReadAcc, sal_uLong nColors) Scanline pScanline = pAccess->GetScanline(nY); for (tools::Long nX = 0; nX < nWidth; nX++) { -mpColor = >GetPaletteColor(pAccess->GetIndexFromData(pScanline, nX)); mnLevel = 0; -add(pTree); +add(pTree, pAccess->GetPaletteColor(pAccess->GetIndexFromData(pScanline, nX))); while (mnLeafCount > nMax) reduce(); @@ -64,18 +62,13 @@ Octree::Octree(const BitmapReadAccess& rReadAcc, sal_uLong nColors) } else { -BitmapColor aColor; - -mpColor = - for (tools::Long nY = 0; nY < nHeight; nY++) { Scanline pScanline = pAccess->GetScanline(nY); for (tools::Long nX = 0; nX < nWidth; nX++) { -aColor = pAccess->GetPixelFromData(pScanline, nX); mnLevel = 0; -add(pTree); +add(pTree, pAccess->GetPixelFromData(pScanline, nX)); while (mnLeafCount > nMax) reduce(); @@ -86,7 +79,7 @@ Octree::Octree(const BitmapReadAccess& rReadAcc, sal_uLong nColors) Octree::~Octree() {} -void Octree::add(std::unique_ptr& rpNode) +void Octree::add(std::unique_ptr& rpNode, BitmapColor const& color) { // possibly generate new nodes if (!rpNode) @@ -106,20 +99,20 @@ void Octree::add(std::unique_ptr& rpNode) if (rpNode->bLeaf) { rpNode->nCount++; -rpNode->nRed += mpColor->GetRed(); -rpNode->nGreen += mpColor->GetGreen(); -rpNode->nBlue += mpColor->GetBlue(); +rpNode->nRed += color.GetRed(); +rpNode->nGreen += color.GetGreen(); +rpNode->nBlue += color.GetBlue(); } else { const sal_uLong nShift = 7 - mnLevel; const sal_uInt8 cMask = 0x80 >> mnLevel; -const sal_uLong nIndex = (((mpColor->GetRed() & cMask) >> nShift) << 2) - | (((mpColor->GetGreen() & cMask) >> nShift) << 1) - | ((mpColor->GetBlue() & cMask) >> nShift); +const sal_uLong nIndex = (((color.GetRed() & cMask) >> nShift) << 2) + | (((color.GetGreen() & cMask) >> nShift) << 1) + |
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - vcl/inc vcl/source
vcl/inc/printdlg.hxx |1 + vcl/source/window/printdlg.cxx | 13 + 2 files changed, 6 insertions(+), 8 deletions(-) New commits: commit 85fb61fbbf3ee5b786e73a66ec1e1ce06500bbcc Author: Tor Lillqvist AuthorDate: Sat Dec 4 21:53:45 2021 +0200 Commit: Justin Luth CommitDate: Sat Dec 11 07:39:02 2021 +0100 Revert "tdf#145354: Ensure displayed paper name matches displayed paper ..." It causes tdf#146045. This reverts commit 65081542d2dabdf17820d62abdc5a22d3734e52d Change-Id: Id980701b1a823c8bf7cfb57e0b32cf5d672c3bfa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126373 Tested-by: Jenkins Reviewed-by: Tor Lillqvist (cherry picked from commit d2ca15952de167b6236139d53f6757a7c0d22d0a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126526 Reviewed-by: Justin Luth diff --git a/vcl/inc/printdlg.hxx b/vcl/inc/printdlg.hxx index d2ce1670a845..21aab3667d4e 100644 --- a/vcl/inc/printdlg.hxx +++ b/vcl/inc/printdlg.hxx @@ -65,6 +65,7 @@ namespace vcl virtual void Resize() override; void setPreview( const GDIMetaFile&, const Size& i_rPaperSize, + std::u16string_view i_rPaperName, const OUString& i_rNoPageString, sal_Int32 i_nDPIX, sal_Int32 i_nDPIY, bool i_bGreyscale diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index 12aa14628887..46cb72752bbf 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -207,6 +207,7 @@ bool PrintDialog::PrintPreviewWindow::Command( const CommandEvent& rEvt ) void PrintDialog::PrintPreviewWindow::setPreview( const GDIMetaFile& i_rNewPreview, const Size& i_rOrigSize, + std::u16string_view i_rPaperName, const OUString& i_rReplacement, sal_Int32 i_nDPIX, sal_Int32 i_nDPIY, @@ -234,18 +235,12 @@ void PrintDialog::PrintPreviewWindow::setPreview( const GDIMetaFile& i_rNewPrevi OUStringBuffer aBuf; aBuf.append( aNumText + " " ); aBuf.appendAscii( eUnit == MapUnit::MapMM ? "mm" : "in" ); - -// Look up the paper name from the dimensions -PaperInfo aPaperInfoFromSize(i_rOrigSize.getWidth(), i_rOrigSize.getHeight()); -aPaperInfoFromSize.doSloppyFit( true ); - -if (aPaperInfoFromSize.getPaper() != PAPER_USER) +if( !i_rPaperName.empty() ) { aBuf.append( " (" ); -aBuf.append( Printer::GetPaperName(aPaperInfoFromSize.getPaper()) ); +aBuf.append( i_rPaperName ); aBuf.append( ')' ); } - maHorzText = aBuf.makeStringAndClear(); aNumText = rLocWrap.getNum( aLogicPaperSize.Height(), nDigits ); @@ -959,6 +954,7 @@ void PrintDialog::preparePreview( bool i_bMayUseCache ) if ( !hasPreview() ) { mxPreview->setPreview( aMtf, aCurPageSize, +Printer::GetPaperName( mePaper ), maNoPreviewStr, aPrt->GetDPIX(), aPrt->GetDPIY(), aPrt->GetPrinterOptions().IsConvertToGreyscales() @@ -994,6 +990,7 @@ void PrintDialog::preparePreview( bool i_bMayUseCache ) } mxPreview->setPreview( aMtf, aCurPageSize, +Printer::GetPaperName( mePaper ), nPages > 0 ? OUString() : maNoPageStr, aPrt->GetDPIX(), aPrt->GetDPIY(), aPrt->GetPrinterOptions().IsConvertToGreyscales()