[Libreoffice-commits] core.git: 3 commits - include/svtools svtools/source sw/source vcl/source
Michael Stahl
mstahl at redhat.com
Fri May 6 14:21:04 UTC 2016
include/svtools/ctrltool.hxx | 9 +++------
svtools/source/control/ctrltool.cxx | 14 ++++++--------
svtools/source/control/stdmenu.cxx | 4 ++--
sw/source/uibase/docvw/edtwin3.cxx | 1 +
sw/source/uibase/uiview/pview.cxx | 1 +
vcl/source/font/PhysicalFontFamily.cxx | 8 ++++----
6 files changed, 17 insertions(+), 20 deletions(-)
New commits:
commit 02cdd8734636ea66259fbbda395d95aa9efd7b03
Author: Michael Stahl <mstahl at redhat.com>
Date: Fri May 6 15:56:41 2016 +0200
tdf#90923 sw: invalidate layout when font substitutions are changed
This should cause all text to re-format with the newly substituted fonts.
Change-Id: I73f64cc679f818524940a52c2f7e696b02891c43
diff --git a/sw/source/uibase/docvw/edtwin3.cxx b/sw/source/uibase/docvw/edtwin3.cxx
index 006cf7f..07037d5 100644
--- a/sw/source/uibase/docvw/edtwin3.cxx
+++ b/sw/source/uibase/docvw/edtwin3.cxx
@@ -156,6 +156,7 @@ void SwEditWin::DataChanged( const DataChangedEvent& rDCEvt )
pSh->LockPaint();
bUnlockPaint = true;
GetView().GetDocShell()->UpdateFontList(); //e.g. printer change
+ pSh->InvalidateLayout(true);
break;
default: break;
}
diff --git a/sw/source/uibase/uiview/pview.cxx b/sw/source/uibase/uiview/pview.cxx
index 3b48f81..103dabf 100644
--- a/sw/source/uibase/uiview/pview.cxx
+++ b/sw/source/uibase/uiview/pview.cxx
@@ -601,6 +601,7 @@ void SwPagePreviewWin::DataChanged( const DataChangedEvent& rDCEvt )
case DataChangedEventType::FONTS:
case DataChangedEventType::FONTSUBSTITUTION:
mrView.GetDocShell()->UpdateFontList(); // Font change
+ mpViewShell->InvalidateLayout(true);
if ( mpViewShell->GetWin() )
mpViewShell->GetWin()->Invalidate();
break;
commit 3b12b5f44c1c46a4aae644a577cb015e2940af59
Author: Michael Stahl <mstahl at redhat.com>
Date: Fri May 6 15:53:20 2016 +0200
vcl: PhysicalFontFamily::maFontFaces must be sorted
When toggling the "Apply replacement table" setting in
Tools->Options->Fonts, the fonts are re-enumerated once per
OutputDevice, so if the sorting isn't maintained properly duplicates
will be inserted and the number of font faces goes from 400 to 40k.
(regression from a20a52a2f47c67ab30bf764d420c663f7173f032)
Change-Id: I7daa53ff28187056e34efa4e2173dea45a47df27
diff --git a/vcl/source/font/PhysicalFontFamily.cxx b/vcl/source/font/PhysicalFontFamily.cxx
index b2eb5ce..a1382a9 100644
--- a/vcl/source/font/PhysicalFontFamily.cxx
+++ b/vcl/source/font/PhysicalFontFamily.cxx
@@ -158,7 +158,8 @@ bool PhysicalFontFamily::AddFontFace( PhysicalFontFace* pNewFontFace )
// add the new physical font face, replacing existing font face if necessary
// TODO: get rid of linear search?
- for(std::vector< PhysicalFontFace* >::iterator it=maFontFaces.begin(); it != maFontFaces.end(); ++it )
+ auto it(maFontFaces.begin());
+ for (; it != maFontFaces.end(); ++it)
{
PhysicalFontFace* pFoundFontFace = *it;
sal_Int32 eComp = pNewFontFace->CompareWithSize( *pFoundFontFace );
@@ -177,12 +178,11 @@ bool PhysicalFontFamily::AddFontFace( PhysicalFontFace* pNewFontFace )
// replace existing font face with a better one
delete pFoundFontFace;
- it = maFontFaces.erase( it );
- maFontFaces.push_back( pNewFontFace );
+ *it = pNewFontFace; // insert at sort position
return true;
}
- maFontFaces.push_back( pNewFontFace );
+ maFontFaces.insert(it, pNewFontFace); // insert at sort position
return true;
}
commit afad4eeaffcad716f135de2bd111bd0aca68e07f
Author: Michael Stahl <mstahl at redhat.com>
Date: Fri May 6 13:46:03 2016 +0200
svtools: FontList loops with > 2^16 fonts
Change-Id: Idfe5d76ee384dff3280f81686cbf408c2f675dc6
diff --git a/include/svtools/ctrltool.hxx b/include/svtools/ctrltool.hxx
index c05b55e..7e2ec66 100644
--- a/include/svtools/ctrltool.hxx
+++ b/include/svtools/ctrltool.hxx
@@ -127,9 +127,6 @@ You should thus not reference the array after the next method call on the
FontList.
*/
-
-#define FONTLIST_FONTINFO_NOTFOUND ((sal_uInt16)0xFFFF)
-
class SVT_DLLPUBLIC FontList
{
private:
@@ -182,11 +179,11 @@ public:
FontItalic eItalic ) const;
bool IsAvailable( const OUString& rName ) const;
- sal_uInt16 GetFontNameCount() const
+ size_t GetFontNameCount() const
{
- return (sal_uInt16)m_Entries.size();
+ return m_Entries.size();
}
- const FontMetric& GetFontName( sal_uInt16 nFont ) const;
+ const FontMetric& GetFontName(size_t nFont) const;
sal_Handle GetFirstFontMetric( const OUString& rName ) const;
static sal_Handle GetNextFontMetric( sal_Handle hFontMetric );
static const FontMetric& GetFontMetric( sal_Handle hFontMetric );
diff --git a/svtools/source/control/ctrltool.cxx b/svtools/source/control/ctrltool.cxx
index ccbb3a1..7702add 100644
--- a/svtools/source/control/ctrltool.cxx
+++ b/svtools/source/control/ctrltool.cxx
@@ -249,9 +249,8 @@ void FontList::ImplInsertFonts( OutputDevice* pDevice, bool bAll,
nType = FontListFontNameType::PRINTER;
// inquire all fonts from the device
- int n = pDevice->GetDevFontCount();
- sal_uInt16 i;
- for( i = 0; i < n; i++ )
+ int const n = pDevice->GetDevFontCount();
+ for (int i = 0; i < n; ++i)
{
FontMetric aFontMetric = pDevice->GetDevFont( i );
@@ -387,7 +386,7 @@ FontList::~FontList()
FontList* FontList::Clone() const
{
FontList* pReturn = new FontList(
- mpDev, mpDev2, GetFontNameCount() == mpDev->GetDevFontCount());
+ mpDev, mpDev2, sal::static_int_cast<int>(GetFontNameCount()) == mpDev->GetDevFontCount());
return pReturn;
}
@@ -696,7 +695,7 @@ bool FontList::IsAvailable(const OUString& rName) const
return (ImplFindByName( rName ) != nullptr);
}
-const FontMetric& FontList::GetFontName( sal_uInt16 nFont ) const
+const FontMetric& FontList::GetFontName(size_t const nFont) const
{
DBG_ASSERT( nFont < GetFontNameCount(), "FontList::GetFontName(): nFont >= Count" );
@@ -752,11 +751,10 @@ const sal_IntPtr* FontList::GetSizeAry( const FontMetric& rInfo ) const
MapMode aMap( MAP_10TH_INCH, Point(), Fraction( 1, 72 ), Fraction( 1, 72 ) );
pDevice->SetMapMode( aMap );
- sal_uInt16 i;
- sal_uInt16 nRealCount = 0;
+ int nRealCount = 0;
long nOldHeight = 0;
const_cast<FontList*>(this)->mpSizeAry = new sal_IntPtr[nDevSizeCount+1];
- for ( i = 0; i < nDevSizeCount; i++ )
+ for (int i = 0; i < nDevSizeCount; ++i)
{
Size aSize = pDevice->GetDevFontSize( rInfo, i );
if ( aSize.Height() != nOldHeight )
diff --git a/svtools/source/control/stdmenu.cxx b/svtools/source/control/stdmenu.cxx
index 6e0e55e..d2e972e 100644
--- a/svtools/source/control/stdmenu.cxx
+++ b/svtools/source/control/stdmenu.cxx
@@ -54,8 +54,8 @@ void FontNameMenu::Fill( const FontList* pList )
const vcl::I18nHelper& rI18nHelper = Application::GetSettings().GetUILocaleI18nHelper();
// more than 100 fonts reduces the speed of opening the menu.
// So only the first 100 fonts will be displayed.
- sal_uInt16 nFontCount = ::std::min( pList->GetFontNameCount(), static_cast< sal_uInt16 >(100) );
- for (sal_uInt16 i = 0; i < nFontCount; ++i)
+ size_t nFontCount = ::std::min<size_t>(pList->GetFontNameCount(), 100);
+ for (size_t i = 0; i < nFontCount; ++i)
{
const OUString& rName = pList->GetFontName( i ).GetFamilyName();
More information about the Libreoffice-commits
mailing list