Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/3824
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/24/3824/1
Remove code associated with psprint::CompatMetricOverride service
We don't actually have any implementations of this service.
This service was introduced by
commit 01cf481111436df2cc3f01d1c57cc4348fc037ef
Author: Kurt Zenker <kz@openoffice.org>
Date: Wed Jun 20 09:07:44 2007 +0000
INTEGRATION: CWS compmetric (1.77.2); FILE MERGED
2007/05/09 16:27:46 pl 1.77.2.2: #146890# algorithm is needed
2007/05/09 12:13:59 pl 1.77.2.1: #146890# backwards compatibility service for metrics
Michael Stahl seems to think it was a Sun-internal hack introduced
for a specific customer.
Change-Id: I1b27778f827504c2adb0e27e8d7c0f0dedcaf940
---
M include/vcl/fontmanager.hxx
M include/vcl/print.hxx
M padmin/source/prtsetup.cxx
M sw/inc/IDocumentSettingAccess.hxx
M sw/source/core/doc/doc.cxx
M sw/source/filter/xml/xmlimp.cxx
M sw/source/ui/uno/SwXDocumentSettings.cxx
M vcl/generic/fontmanager/fontmanager.cxx
M vcl/generic/print/genpspgraphics.cxx
M vcl/inc/salprn.hxx
M vcl/source/gdi/print.cxx
11 files changed, 17 insertions(+), 265 deletions(-)
diff --git a/include/vcl/fontmanager.hxx b/include/vcl/fontmanager.hxx
index 05955f9..41cf2e2 100644
--- a/include/vcl/fontmanager.hxx
+++ b/include/vcl/fontmanager.hxx
@@ -284,8 +284,6 @@
mutable FontCache* m_pFontCache;
- mutable std::vector< fontID > m_aOverrideFonts;
-
OString getAfmFile( PrintFont* pFont ) const;
OString getFontFile( PrintFont* pFont ) const;
@@ -343,8 +341,6 @@
*/
bool addFontconfigDir(const OString& rDirectory);
- bool readOverrideMetrics();
-
std::set<OString> m_aPreviousLangSupportRequests;
std::vector<OString> m_aCurrentRequests;
Timer m_aFontInstallerTimer;
@@ -371,9 +367,9 @@
// returns the ids of all managed fonts. on pParser != NULL
// all fonttype::Builtin type fonts are not listed
// which do not occur in the PPD of pParser
- void getFontList( std::list< fontID >& rFontIDs, const PPDParser* pParser = NULL, bool
bUseOverrideMetrics = false );
+ void getFontList( std::list< fontID >& rFontIDs, const PPDParser* pParser = NULL );
// get the font list and fast font info. see getFontList for pParser
- void getFontListWithFastInfo( std::list< FastPrintFontInfo >& rFonts, const PPDParser* pParser
= NULL, bool bUseOverrideMetrics = false );
+ void getFontListWithFastInfo( std::list< FastPrintFontInfo >& rFonts, const PPDParser* pParser
= NULL );
// get font info for a specific font
bool getFontInfo( fontID nFontID, PrintFontInfo& rInfo ) const;
diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx
index c40e8bc..c0cb364 100644
--- a/include/vcl/print.hxx
+++ b/include/vcl/print.hxx
@@ -357,8 +357,6 @@
void SetErrorHdl( const Link& rLink ) { maErrorHdl = rLink; }
const Link& GetErrorHdl() const { return maErrorHdl; }
- void Compat_OldPrinterMetrics( bool bSet );
-
/** checks the printer list and updates it necessary
*
* sends a DataChanged event of type DATACHANGED_PRINTER
diff --git a/padmin/source/prtsetup.cxx b/padmin/source/prtsetup.cxx
index 53d09ce..15c5fc5 100644
--- a/padmin/source/prtsetup.cxx
+++ b/padmin/source/prtsetup.cxx
@@ -650,7 +650,7 @@
// fill to box
PrintFontManager& rFontManager = PrintFontManager::get();
::std::list< FastPrintFontInfo > aFonts;
- rFontManager.getFontListWithFastInfo( aFonts, m_pParent->m_aJobData.m_pParser, false );
+ rFontManager.getFontListWithFastInfo( aFonts, m_pParent->m_aJobData.m_pParser );
::std::list< FastPrintFontInfo >::const_iterator it;
::boost::unordered_map< OUString, int, OUStringHash > aToMap, aFromMap;
for( it = aFonts.begin(); it != aFonts.end(); ++it )
diff --git a/sw/inc/IDocumentSettingAccess.hxx b/sw/inc/IDocumentSettingAccess.hxx
index 8214f1a..1203915 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -65,7 +65,6 @@
CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAME,
UNIX_FORCE_ZERO_EXT_LEADING,
- USE_OLD_PRINTER_METRICS,
TABS_RELATIVE_TO_INDENT,
PROTECT_FORM,
// #i89181#
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index c8e6c90..db23e35 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -181,7 +181,6 @@
// #i68949#
case CLIP_AS_CHARACTER_ANCHORED_WRITER_FLY_FRAME: return
mbClipAsCharacterAnchoredWriterFlyFrames;
case UNIX_FORCE_ZERO_EXT_LEADING: return mbUnixForceZeroExtLeading;
- case USE_OLD_PRINTER_METRICS: return mbOldPrinterMetrics;
case TABS_RELATIVE_TO_INDENT : return mbTabRelativeToIndent;
case PROTECT_FORM: return mbProtectForm;
// #i89181#
@@ -310,9 +309,6 @@
mbProtectForm = value;
break;
- case USE_OLD_PRINTER_METRICS:
- mbOldPrinterMetrics = value;
- break;
case TABS_RELATIVE_TO_INDENT:
mbTabRelativeToIndent = value;
break;
diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index 34e1648..2be3074 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -1455,14 +1455,6 @@
// The flag might be set from setting the printer, so it
// it is required to clear it.
pDoc->SetOLEPrtNotifyPending( !pPrinter->IsKnown() );
-
- // old printer metrics compatibility
- if ( pDoc->get(IDocumentSettingAccess::USE_OLD_PRINTER_METRICS ) &&
- !pDoc->get(IDocumentSettingAccess::USE_VIRTUAL_DEVICE ) )
- {
- pPrinter->Compat_OldPrinterMetrics( true );
- pDoc->GetDocShell()->UpdateFontList();
- }
}
}
diff --git a/sw/source/ui/uno/SwXDocumentSettings.cxx b/sw/source/ui/uno/SwXDocumentSettings.cxx
index a2f3e07..8944837 100644
--- a/sw/source/ui/uno/SwXDocumentSettings.cxx
+++ b/sw/source/ui/uno/SwXDocumentSettings.cxx
@@ -662,10 +662,7 @@
}
break;
case HANDLE_USE_OLD_PRINTER_METRICS:
- {
- sal_Bool bTmp = *(sal_Bool*)rValue.getValue();
- mpDoc->set(IDocumentSettingAccess::USE_OLD_PRINTER_METRICS, bTmp);
- }
+ // ignore - this is a dead property
break;
case HANDLE_TABS_RELATIVE_TO_INDENT:
{
@@ -1085,12 +1082,6 @@
case HANDLE_UNIX_FORCE_ZERO_EXT_LEADING:
{
sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::UNIX_FORCE_ZERO_EXT_LEADING);
- rValue.setValue( &bTmp, ::getBooleanCppuType() );
- }
- break;
- case HANDLE_USE_OLD_PRINTER_METRICS:
- {
- sal_Bool bTmp = mpDoc->get(IDocumentSettingAccess::USE_OLD_PRINTER_METRICS);
rValue.setValue( &bTmp, ::getBooleanCppuType() );
}
break;
diff --git a/vcl/generic/fontmanager/fontmanager.cxx b/vcl/generic/fontmanager/fontmanager.cxx
index e86fceb..14f5759 100644
--- a/vcl/generic/fontmanager/fontmanager.cxx
+++ b/vcl/generic/fontmanager/fontmanager.cxx
@@ -1656,7 +1656,6 @@
m_aFonts.clear();
m_aFontDirectories.clear();
m_aPrivateFontDirectories.clear();
- m_aOverrideFonts.clear();
}
#if OSL_DEBUG_LEVEL > 1
@@ -1951,7 +1950,7 @@
};
}
-void PrintFontManager::getFontList( ::std::list< fontID >& rFontIDs, const PPDParser* pParser,
bool bUseOverrideMetrics )
+void PrintFontManager::getFontList( ::std::list< fontID >& rFontIDs, const PPDParser* pParser )
{
rFontIDs.clear();
boost::unordered_map< fontID, PrintFont* >::const_iterator it;
@@ -1980,20 +1979,6 @@
BuiltinFontIdentifierHash
> aBuiltinFonts;
- std::map<int, fontID > aOverridePSNames;
- if( bUseOverrideMetrics )
- {
- readOverrideMetrics();
- for( std::vector<fontID>::const_iterator over = m_aOverrideFonts.begin();
- over != m_aOverrideFonts.end(); ++over )
- {
- boost::unordered_map<fontID,PrintFont*>::const_iterator font_it = m_aFonts.find(
*over );
- DBG_ASSERT( font_it != m_aFonts.end(), "override to nonexistant font" );
- if( font_it != m_aFonts.end() )
- aOverridePSNames[ font_it->second->m_nPSName ] = *over;
- }
- }
-
int nFonts = pParser->getFonts();
for( int i = 0; i < nFonts; i++ )
aBuiltinPSNames.insert( m_pAtoms->getAtom( ATOM_PSNAME, pParser->getFont( i ) ) );
@@ -2003,30 +1988,13 @@
if( it->second->m_eType == fonttype::Builtin &&
aBuiltinPSNames.find( pFont->m_nPSName ) != aBuiltinPSNames.end() )
{
- bool bInsert = true;
- if( bUseOverrideMetrics )
- {
- // in override case only use the override fonts, not their counterparts
- std::map<int,fontID>::const_iterator over = aOverridePSNames.find(
pFont->m_nPSName );
- if( over != aOverridePSNames.end() && over->second != it->first )
- bInsert = false;
- }
- else
- {
- // do not insert override fonts in non override case
- if( std::find( m_aOverrideFonts.begin(), m_aOverrideFonts.end(), it->first )
!= m_aOverrideFonts.end() )
- bInsert = false;
- }
- if( bInsert )
- {
- aBuiltinFonts.insert( BuiltinFontIdentifier(
- m_pAtoms->getString( ATOM_FAMILYNAME, pFont->m_nFamilyName ),
- pFont->m_eItalic,
- pFont->m_eWeight,
- pFont->m_ePitch,
- pFont->m_aEncoding
- ) );
- }
+ aBuiltinFonts.insert( BuiltinFontIdentifier(
+ m_pAtoms->getString( ATOM_FAMILYNAME, pFont->m_nFamilyName ),
+ pFont->m_eItalic,
+ pFont->m_eWeight,
+ pFont->m_ePitch,
+ pFont->m_aEncoding
+ ) );
}
}
for( it = m_aFonts.begin(); it != m_aFonts.end(); ++it )
@@ -2036,22 +2004,7 @@
{
if( aBuiltinPSNames.find( pFont->m_nPSName ) != aBuiltinPSNames.end() )
{
- bool bInsert = true;
- if( bUseOverrideMetrics )
- {
- // in override case only use the override fonts, not their counterparts
- std::map<int,fontID>::const_iterator over = aOverridePSNames.find(
pFont->m_nPSName );
- if( over != aOverridePSNames.end() && over->second != it->first )
- bInsert = false;
- }
- else
- {
- // do not insert override fonts in non override case
- if( std::find( m_aOverrideFonts.begin(), m_aOverrideFonts.end(), it->first
) != m_aOverrideFonts.end() )
- bInsert = false;
- }
- if( bInsert )
- rFontIDs.push_back( it->first );
+ rFontIDs.push_back( it->first );
}
}
else if( aBuiltinFonts.find( BuiltinFontIdentifier(
@@ -2122,11 +2075,11 @@
// -------------------------------------------------------------------------
-void PrintFontManager::getFontListWithFastInfo( ::std::list< FastPrintFontInfo >& rFonts, const
PPDParser* pParser, bool bUseOverrideMetrics )
+void PrintFontManager::getFontListWithFastInfo( ::std::list< FastPrintFontInfo >& rFonts, const
PPDParser* pParser )
{
rFonts.clear();
::std::list< fontID > aFontList;
- getFontList( aFontList, pParser, bUseOverrideMetrics );
+ getFontList( aFontList, pParser );
::std::list< fontID >::iterator it;
for( it = aFontList.begin(); it != aFontList.end(); ++it )
@@ -2867,165 +2820,4 @@
return n;
}
}
-bool PrintFontManager::readOverrideMetrics()
-{
- if( ! m_aOverrideFonts.empty() )
- return false;
-
- css::uno::Reference< XMultiServiceFactory > xFact( comphelper::getProcessServiceFactory() );
- if( !xFact.is() )
- return false;
- css::uno::Reference< XMaterialHolder > xMat(
- xFact->createInstance( "com.sun.star.psprint.CompatMetricOverride" ),
- UNO_QUERY );
- if( !xMat.is() )
- return false;
-
- Any aAny( xMat->getMaterial() );
- Sequence< Any > aOverrideFonts;
- if( ! (aAny >>= aOverrideFonts ) )
- return false;
- sal_Int32 nFonts = aOverrideFonts.getLength();
- for( sal_Int32 i = 0; i < nFonts; i++ )
- {
- Sequence< NamedValue > aMetrics;
- if( ! (aOverrideFonts.getConstArray()[i] >>= aMetrics) )
- continue;
- BuiltinFont* pFont = new BuiltinFont();
- pFont->m_nDirectory = 0;
- pFont->m_bUserOverride = false;
- pFont->m_pMetrics = new PrintFontMetrics;
- memset( pFont->m_pMetrics->m_aPages, 0xff, sizeof( pFont->m_pMetrics->m_aPages ) );
- pFont->m_pMetrics->m_bKernPairsQueried = true;
- sal_Int32 nProps = aMetrics.getLength();
- const NamedValue* pProps = aMetrics.getConstArray();
- for( sal_Int32 n = 0; n < nProps; n++ )
- {
- if ( pProps[n].Name == "FamilyName" )
- pFont->m_nFamilyName = m_pAtoms->getAtom( ATOM_FAMILYNAME,
- getString(pProps[n].Value),
- sal_True );
- else if ( pProps[n].Name == "PSName" )
- pFont->m_nPSName = m_pAtoms->getAtom( ATOM_PSNAME,
- getString(pProps[n].Value),
- sal_True );
- else if ( pProps[n].Name == "StyleName" )
- pFont->m_aStyleName = getString(pProps[n].Value);
- else if ( pProps[n].Name == "Italic" )
- pFont->m_eItalic = static_cast<FontItalic>(getInt(pProps[n].Value));
- else if ( pProps[n].Name == "Width" )
- pFont->m_eWidth = static_cast<FontWidth>(getInt(pProps[n].Value));
- else if ( pProps[n].Name == "Weight" )
- pFont->m_eWeight = static_cast<FontWeight>(getInt(pProps[n].Value));
- else if ( pProps[n].Name == "Pitch" )
- pFont->m_ePitch = static_cast<FontPitch>(getInt(pProps[n].Value));
- else if ( pProps[n].Name == "Encoding" )
- pFont->m_aEncoding = static_cast<rtl_TextEncoding>(getInt(pProps[n].Value));
- else if ( pProps[n].Name == "FontEncodingOnly" )
- pFont->m_bFontEncodingOnly = getBool(pProps[n].Value);
- else if ( pProps[n].Name == "GlobalMetricXWidth" )
- pFont->m_aGlobalMetricX.width = getInt(pProps[n].Value);
- else if ( pProps[n].Name == "GlobalMetricXHeight" )
- pFont->m_aGlobalMetricX.height = getInt(pProps[n].Value);
- else if ( pProps[n].Name == "GlobalMetricYWidth" )
- pFont->m_aGlobalMetricY.width = getInt(pProps[n].Value);
- else if ( pProps[n].Name == "GlobalMetricYHeight" )
- pFont->m_aGlobalMetricY.height = getInt(pProps[n].Value);
- else if ( pProps[n].Name == "Ascend" )
- pFont->m_nAscend = getInt(pProps[n].Value);
- else if ( pProps[n].Name == "Descend" )
- pFont->m_nDescend = getInt(pProps[n].Value);
- else if ( pProps[n].Name == "Leading" )
- pFont->m_nLeading = getInt(pProps[n].Value);
- else if ( pProps[n].Name == "XMin" )
- pFont->m_nXMin = getInt(pProps[n].Value);
- else if ( pProps[n].Name == "YMin" )
- pFont->m_nYMin = getInt(pProps[n].Value);
- else if ( pProps[n].Name == "XMax" )
- pFont->m_nXMax = getInt(pProps[n].Value);
- else if ( pProps[n].Name == "YMax" )
- pFont->m_nYMax = getInt(pProps[n].Value);
- else if ( pProps[n].Name == "VerticalSubstitutes" )
- pFont->m_bHaveVerticalSubstitutedGlyphs = getBool(pProps[n].Value);
- else if ( pProps[n].Name == "EncodingVector" )
- {
- Sequence< NamedValue > aEncoding;
- pProps[n].Value >>= aEncoding;
- sal_Int32 nEnc = aEncoding.getLength();
- const NamedValue* pEnc = aEncoding.getConstArray();
- for( sal_Int32 m = 0; m < nEnc; m++ )
- {
- sal_Unicode cCode = *pEnc[m].Name.getStr();
- sal_Int32 nGlyph = getInt(pEnc[m].Value);
- pFont->m_aEncodingVector[ cCode ] = nGlyph;
- }
- }
- else if ( pProps[n].Name == "NonEncoded" )
- {
- Sequence< NamedValue > aEncoding;
- pProps[n].Value >>= aEncoding;
- sal_Int32 nEnc = aEncoding.getLength();
- const NamedValue* pEnc = aEncoding.getConstArray();
- for( sal_Int32 m = 0; m < nEnc; m++ )
- {
- sal_Unicode cCode = *pEnc[m].Name.getStr();
- OUString aGlyphName( getString(pEnc[m].Value) );
- pFont->m_aNonEncoded[ cCode ] =
OUStringToOString(aGlyphName,RTL_TEXTENCODING_ASCII_US);
- }
- }
- else if ( pProps[n].Name == "CharacterMetrics" )
- {
- // fill pFont->m_pMetrics->m_aMetrics
- // expect triples of int: int -> CharacterMetric.{ width, height }
- Sequence< sal_Int32 > aSeq;
- pProps[n].Value >>= aSeq;
- sal_Int32 nInts = aSeq.getLength();
- const sal_Int32* pInts = aSeq.getConstArray();
- for( sal_Int32 m = 0; m < nInts; m+=3 )
- {
- pFont->m_pMetrics->m_aMetrics[ pInts[m] ].width = static_cast<short
int>(pInts[m+1]);
- pFont->m_pMetrics->m_aMetrics[ pInts[m] ].height = static_cast<short
int>(pInts[m+2]);
- }
- }
- else if ( pProps[n].Name == "XKernPairs" )
- {
- // fill pFont->m_pMetrics->m_aXKernPairs
- // expection name: <unicode1><unicode2> value: ((height << 16)| width)
- Sequence< NamedValue > aKern;
- pProps[n].Value >>= aKern;
- KernPair aPair;
- const NamedValue* pVals = aKern.getConstArray();
- int nPairs = aKern.getLength();
- for( int m = 0; m < nPairs; m++ )
- {
- if( pVals[m].Name.getLength() == 2 )
- {
- aPair.first = pVals[m].Name.getStr()[0];
- aPair.second = pVals[m].Name.getStr()[1];
- sal_Int32 nKern = getInt( pVals[m].Value );
- aPair.kern_x = static_cast<short int>(nKern & 0xffff);
- aPair.kern_y = static_cast<short int>((sal_uInt32(nKern) >> 16) & 0xffff);
- pFont->m_pMetrics->m_aXKernPairs.push_back( aPair );
- }
- }
- }
- }
- // sanity check
- if( pFont->m_nPSName &&
- pFont->m_nFamilyName &&
- ! pFont->m_pMetrics->m_aMetrics.empty() )
- {
- m_aOverrideFonts.push_back( m_nNextFontID );
- m_aFonts[ m_nNextFontID++ ] = pFont;
- }
- else
- {
- DBG_ASSERT( 0, "override font failed" );
- delete pFont;
- }
- }
-
- return true;
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/generic/print/genpspgraphics.cxx b/vcl/generic/print/genpspgraphics.cxx
index a26a844..10af660 100644
--- a/vcl/generic/print/genpspgraphics.cxx
+++ b/vcl/generic/print/genpspgraphics.cxx
@@ -894,7 +894,7 @@
{
::std::list< psp::fontID > aList;
psp::PrintFontManager& rMgr = psp::PrintFontManager::get();
- rMgr.getFontList( aList, m_pJobData->m_pParser, m_pInfoPrinter->m_bCompatMetrics );
+ rMgr.getFontList( aList, m_pJobData->m_pParser );
::std::list< psp::fontID >::iterator it;
psp::FastPrintFontInfo aInfo;
diff --git a/vcl/inc/salprn.hxx b/vcl/inc/salprn.hxx
index 9a23731..4f1066c 100644
--- a/vcl/inc/salprn.hxx
+++ b/vcl/inc/salprn.hxx
@@ -52,9 +52,8 @@
public:
std::vector< PaperInfo > m_aPaperFormats; // all printer supported formats
bool m_bPapersInit; // set to true after InitPaperFormats
- bool m_bCompatMetrics;
- SalInfoPrinter() : m_bPapersInit( false ), m_bCompatMetrics( false ) {}
+ SalInfoPrinter() : m_bPapersInit( false ) {}
virtual ~SalInfoPrinter();
// SalGraphics or NULL, but two Graphics for all SalFrames
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index a3a107b..bbda65f 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -689,17 +689,6 @@
pSVData->maGDIData.mpLastPrinter = mpPrev;
}
-void Printer::Compat_OldPrinterMetrics( bool bSet )
-{
- // propagate flag
- if( mpInfoPrinter )
- mpInfoPrinter->m_bCompatMetrics = bSet;
-
- // get new font data
- ImplUpdateFontData( sal_True );
-}
-
-
sal_uLong Printer::GetCapabilities( sal_uInt16 nType ) const
{
if ( IsDisplayPrinter() )
--
To view, visit https://gerrit.libreoffice.org/3824
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1b27778f827504c2adb0e27e8d7c0f0dedcaf940
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Noel Grandin <noelgrandin@gmail.com>
Context
- [PATCH] Remove code associated with psprint::CompatMetricOverride se... · Noel Grandin (via Code Review)
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.