summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/inc/attarray.hxx5
-rw-r--r--sc/inc/cell.hxx12
-rw-r--r--sc/inc/document.hxx21
-rw-r--r--sc/inc/patattr.hxx60
-rw-r--r--sc/inc/stlpool.hxx6
-rw-r--r--sc/source/core/data/attarray.cxx47
-rw-r--r--sc/source/core/data/cell2.cxx35
-rw-r--r--sc/source/core/data/column2.cxx105
-rw-r--r--sc/source/core/data/documen2.cxx34
-rw-r--r--sc/source/core/data/patattr.cxx15
-rw-r--r--sc/source/core/data/stlpool.cxx39
11 files changed, 304 insertions, 75 deletions
diff --git a/sc/inc/attarray.hxx b/sc/inc/attarray.hxx
index 2371f23e993c..1c5a595e679a 100644
--- a/sc/inc/attarray.hxx
+++ b/sc/inc/attarray.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: attarray.hxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 16:44:47 $
+ * last change: $Author: er $ $Date: 2001-08-10 18:01:16 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -211,6 +211,7 @@ public:
void Save( SvStream& rStream ) const;
void Load( SvStream& rStream );
+ void ConvertFontsAfterLoad(); // old binary file format
};
diff --git a/sc/inc/cell.hxx b/sc/inc/cell.hxx
index 1244e19167bb..75092d82d6e5 100644
--- a/sc/inc/cell.hxx
+++ b/sc/inc/cell.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: cell.hxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: sab $ $Date: 2001-06-15 17:21:10 $
+ * last change: $Author: er $ $Date: 2001-08-10 18:01:16 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -81,6 +81,10 @@
#include <rtl/ustrbuf.hxx>
#endif
+#ifndef _SV_FONTCVT_HXX
+#include <vcl/fontcvt.hxx>
+#endif
+
#define USE_MEMPOOL
#define TEXTWIDTH_DIRTY 0xffff
@@ -206,7 +210,9 @@ public:
void SetString( const String& rString );
void GetString( String& rString ) const;
- void Save( SvStream& rStream ) const;
+ void Save( SvStream& rStream, FontToSubsFontConverter hConv = 0 ) const;
+ // convert symbol font after loading binary format
+ void ConvertFont( FontToSubsFontConverter hConv );
};
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 73ac8fb1efcd..14900a04d7a6 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: document.hxx,v $
*
- * $Revision: 1.45 $
+ * $Revision: 1.46 $
*
- * last change: $Author: nn $ $Date: 2001-08-02 18:14:42 $
+ * last change: $Author: er $ $Date: 2001-08-10 18:01:16 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -116,9 +116,11 @@ class SvxSearchItem;
class SvxShadowItem;
class Window;
class XColorTable;
+class List;
class ScAutoFormatData;
class ScBaseCell;
+class ScStringCell;
class ScBroadcastAreaSlotMachine;
class ScChangeViewSettings;
class ScChartCollection;
@@ -303,6 +305,14 @@ struct ScCopyBlockFromClipParams
#define ROWINFO_MAX 1024
+// for loading of binary file format symbol string cells which need font conversion
+struct ScSymbolStringCellEntry
+{
+ ScStringCell* pCell;
+ USHORT nRow;
+};
+
+
// Spezialwert fuer Recalc-Alwyas-Zellen
#define BCA_BRDCST_ALWAYS ScAddress( 0, 32767, 0 )
@@ -379,6 +389,8 @@ private:
ScExtDocOptions* pExtDocOptions; // fuer Import etc.
ScConsolidateParam* pConsolidateDlgData;
+ List* pLoadedSymbolStringCellList; // binary file format import of symbol font string cells
+
ScRange aClipRange;
ScRange aEmbedRange;
ScAddress aCurTextWidthCalcPos;
@@ -1514,6 +1526,11 @@ public:
ScRefreshTimerControl * const * GetRefreshTimerControlAddress() const
{ return &pRefreshTimerControl; }
+ /// if symbol string cells of old binary file format are in list
+ BOOL SymbolStringCellsPending() const;
+ /// get list of ScSymbolStringCellEntry, create if necessary
+ List& GetLoadedSymbolStringCellsList();
+
private: // CLOOK-Impl-Methoden
void ImplLoadDocOptions( SvStream& rStream );
void ImplLoadViewOptions( SvStream& rStream );
diff --git a/sc/inc/patattr.hxx b/sc/inc/patattr.hxx
index 3b00e9edbe9f..f4eb2562a6d1 100644
--- a/sc/inc/patattr.hxx
+++ b/sc/inc/patattr.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: patattr.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: nn $ $Date: 2000-11-23 20:17:08 $
+ * last change: $Author: er $ $Date: 2001-08-10 18:01:16 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -70,6 +70,10 @@
#include <svtools/itemset.hxx>
#endif
+#ifndef _SV_FONTCVT_HXX
+#include <vcl/fontcvt.hxx>
+#endif
+
class Font;
class OutputDevice;
@@ -128,8 +132,24 @@ public:
BOOL IsVisible() const;
BOOL IsVisibleEqual( const ScPatternAttr& rOther ) const;
+
+ /** If font is an old symbol font StarBats/StarMath
+ with text encoding RTL_TEXTENC_SYMBOL */
BOOL IsSymbolFont() const;
+ /** Create a FontToSubsFontConverter if needed for
+ this pattern, else return 0.
+
+ @param nFlags is the bit mask which shall be
+ used for CreateFontToSubsFontConverter().
+
+ The converter must be destroyed by the caller
+ using DestroyFontToSubsFontConverter() which
+ should be accomplished using the
+ ScFontToSubsFontConverter_AutoPtr
+ */
+ FontToSubsFontConverter GetSubsFontConverter( ULONG nFlags ) const;
+
ULONG GetNumberFormat( SvNumberFormatter* ) const;
ULONG GetNumberFormat( SvNumberFormatter* pFormatter,
const SfxItemSet* pCondSet ) const;
@@ -138,4 +158,40 @@ public:
BYTE GetRotateDir( const SfxItemSet* pCondSet ) const;
};
+
+class ScFontToSubsFontConverter_AutoPtr
+{
+ FontToSubsFontConverter h;
+
+ void release()
+ {
+ if ( h )
+ DestroyFontToSubsFontConverter( h );
+ }
+
+ // prevent usage
+ ScFontToSubsFontConverter_AutoPtr( const ScFontToSubsFontConverter_AutoPtr& );
+ ScFontToSubsFontConverter_AutoPtr& operator=( const ScFontToSubsFontConverter_AutoPtr& );
+
+public:
+ ScFontToSubsFontConverter_AutoPtr()
+ : h(0)
+ {}
+ ~ScFontToSubsFontConverter_AutoPtr()
+ {
+ release();
+ }
+
+ ScFontToSubsFontConverter_AutoPtr& operator=( FontToSubsFontConverter hN )
+ {
+ release();
+ h = hN;
+ return *this;
+ }
+
+ operator FontToSubsFontConverter() const
+ { return h; }
+};
+
+
#endif
diff --git a/sc/inc/stlpool.hxx b/sc/inc/stlpool.hxx
index 72f92b718532..78fc458b7e19 100644
--- a/sc/inc/stlpool.hxx
+++ b/sc/inc/stlpool.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: stlpool.hxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 16:44:50 $
+ * last change: $Author: er $ $Date: 2001-08-10 18:01:16 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -103,6 +103,8 @@ public:
virtual SfxStyleSheetBase& Make( const String&, SfxStyleFamily eFam,
USHORT nMask = 0xffff, USHORT nPos = 0xffff );
+ void ConvertFontsAfterLoad(); // old binary file format
+
protected:
virtual SfxStyleSheetBase* Create( const String& rName,
SfxStyleFamily eFamily,
diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index d350dcbd68de..6e6973b3c9a1 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: attarray.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: nn $ $Date: 2001-07-02 19:36:20 $
+ * last change: $Author: er $ $Date: 2001-08-10 18:02:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -73,6 +73,13 @@
#include <svx/shaditem.hxx>
#include <svtools/poolcach.hxx>
+#ifndef _SVX_FONTITEM_HXX
+#include <svx/fontitem.hxx>
+#endif
+#ifndef _SV_FONTCVT_HXX
+#include <vcl/fontcvt.hxx>
+#endif
+
#include "attarray.hxx"
#include "global.hxx"
#include "document.hxx"
@@ -2439,6 +2446,40 @@ void ScAttrArray::Load( SvStream& rStream )
}
+void ScAttrArray::ConvertFontsAfterLoad()
+{
+ ScFontToSubsFontConverter_AutoPtr xFontConverter;
+ const ULONG nFlags = FONTTOSUBSFONT_IMPORT | FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS;
+ short nIndex = 0;
+ USHORT nThisRow = 0;
-
+ while ( nThisRow <= MAXROW )
+ {
+ const ScPatternAttr* pOldPattern = pData[nIndex].pPattern;
+ const SfxPoolItem* pItem;
+ if( pOldPattern->GetItemSet().GetItemState( ATTR_FONT, FALSE, &pItem ) == SFX_ITEM_SET )
+ {
+ const SvxFontItem* pFontItem = (const SvxFontItem*) pItem;
+ const String& rOldName = pFontItem->GetFamilyName();
+ xFontConverter = CreateFontToSubsFontConverter( rOldName, nFlags );
+ if ( xFontConverter )
+ {
+ String aNewName( GetFontToSubsFontName( xFontConverter ) );
+ if ( aNewName != rOldName )
+ {
+ USHORT nAttrRow = pData[nIndex].nRow;
+ SvxFontItem aNewItem( pFontItem->GetFamily(), aNewName,
+ pFontItem->GetStyleName(), pFontItem->GetPitch(),
+ RTL_TEXTENCODING_DONTKNOW, ATTR_FONT );
+ ScPatternAttr aNewPattern( *pOldPattern );
+ aNewPattern.GetItemSet().Put( aNewItem );
+ SetPatternArea( nThisRow, nAttrRow, &aNewPattern, TRUE );
+ Search( nThisRow, nIndex ); //! data changed
+ }
+ }
+ }
+ ++nIndex;
+ nThisRow = pData[nIndex-1].nRow+1;
+ }
+}
diff --git a/sc/source/core/data/cell2.cxx b/sc/source/core/data/cell2.cxx
index fde109f6e520..fb7282079189 100644
--- a/sc/source/core/data/cell2.cxx
+++ b/sc/source/core/data/cell2.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: cell2.cxx,v $
*
- * $Revision: 1.9 $
+ * $Revision: 1.10 $
*
- * last change: $Author: sab $ $Date: 2001-06-15 17:22:45 $
+ * last change: $Author: er $ $Date: 2001-08-10 18:02:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -1511,10 +1511,37 @@ ScStringCell::ScStringCell( SvStream& rStream, USHORT nVer ) :
rStream.ReadByteString( aString, rStream.GetStreamCharSet() );
}
-void ScStringCell::Save( SvStream& rStream ) const
+void ScStringCell::Save( SvStream& rStream, FontToSubsFontConverter hConv ) const
{
rStream << (BYTE) 0x00;
- rStream.WriteByteString( aString, rStream.GetStreamCharSet() );
+ if ( !hConv )
+ rStream.WriteByteString( aString, rStream.GetStreamCharSet() );
+ else
+ {
+ String aTmp( aString );
+ sal_Unicode* p = aTmp.GetBufferAccess();
+ sal_Unicode const * const pStop = p + aTmp.Len();
+ for ( ; p < pStop; ++p )
+ {
+ *p = ConvertFontToSubsFontChar( hConv, *p );
+ }
+ aTmp.ReleaseBufferAccess();
+ rStream.WriteByteString( aTmp, rStream.GetStreamCharSet() );
+ }
+}
+
+void ScStringCell::ConvertFont( FontToSubsFontConverter hConv )
+{
+ if ( hConv )
+ {
+ sal_Unicode* p = aString.GetBufferAccess();
+ sal_Unicode const * const pStop = p + aString.Len();
+ for ( ; p < pStop; ++p )
+ {
+ *p = ConvertFontToSubsFontChar( hConv, *p );
+ }
+ aString.ReleaseBufferAccess();
+ }
}
ScNoteCell::ScNoteCell( SvStream& rStream, USHORT nVer ) :
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 01f4e94afaf3..f7bcd7cfc8f9 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: column2.cxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: nn $ $Date: 2001-06-25 20:37:39 $
+ * last change: $Author: er $ $Date: 2001-08-10 18:02:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -199,51 +199,21 @@ void ScColumn::LoadData( SvStream& rStream )
{
ScStringCell* pCell = new ScStringCell( rStream, nVer );
Append( nNewRow, pCell );
-
-// special handling for non-convertable characters is no longer needed here
-//! handle non-convertable characters when saving to file?
-#if 0
- // #68427# manually convert CharSet so non-convertable characters
- // can be stored in an EditEngine cell
-
- CharSet eSystemCharSet = ::GetSystemCharSet();
- CharSet eSourceCharSet = pDocument->GetSrcCharSet();
- String aSourceString = lcl_ReadOriginalStringCell( rStream, nVer, eSystemCharSet );
-
- ScBaseCell* pCell = NULL;
- String aCellString = aSourceString;
- if ( eSourceCharSet != eSystemCharSet )
- {
- // bReplace = FALSE: null characters for non-convertable
- aCellString.Convert( eSourceCharSet, eSystemCharSet, FALSE );
- if ( aCellString.Search( (char)0 ) != STRING_NOTFOUND )
- {
- // contains non-convertable characters -> use EditEngine
-
- EditEngine& rEngine = pDocument->GetEditEngine();
- rEngine.SetText( aSourceString, eSourceCharSet );
- EditTextObject* pObj = rEngine.CreateTextObject();
- pCell = new ScEditCell( pObj, pDocument, rEngine.GetEditTextObjectPool() );
- delete pObj;
- }
- // else use aCellString
- }
-
- // create string cell if no edit cell is needed
- if ( !pCell )
- pCell = new ScStringCell( aCellString );
- Append( nNewRow, pCell );
-#endif
}
break;
case CELLTYPE_SYMBOLS:
{
-//! CharSet eOld = rStream.GetStreamCharSet();
-//! // convert into true symbol characters
-//! rStream.SetStreamCharSet( RTL_TEXTENCODING_SYMBOL );
+ CharSet eOld = rStream.GetStreamCharSet();
+ // convert into true symbol characters
+ rStream.SetStreamCharSet( RTL_TEXTENCODING_SYMBOL );
ScStringCell* pCell = new ScStringCell( rStream, nVer );
Append( nNewRow, pCell );
-//! rStream.SetStreamCharSet( eOld );
+ rStream.SetStreamCharSet( eOld );
+ ScSymbolStringCellEntry * pEntry = new ScSymbolStringCellEntry;
+ pEntry->pCell = pCell;
+ pEntry->nRow = nNewRow;
+ pDocument->GetLoadedSymbolStringCellsList().Insert(
+ pEntry, LIST_APPEND );
}
break;
case CELLTYPE_EDIT:
@@ -327,6 +297,8 @@ void ScColumn::SaveData( SvStream& rStream ) const
CellType eCellType;
ScBaseCell* pCell;
USHORT i;
+ ScFontToSubsFontConverter_AutoPtr xFontConverter;
+ const ULONG nFontConverterFlags = FONTTOSUBSFONT_EXPORT | FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS;
ScMultipleWriteHeader aHdr( rStream );
@@ -367,7 +339,9 @@ void ScColumn::SaveData( SvStream& rStream ) const
{
pAttr = aIter.Next( nStt, nEnd );
}
- while( pAttr && !pAttr->IsSymbolFont() );
+ while( pAttr && !(
+ (xFontConverter = pAttr->GetSubsFontConverter( nFontConverterFlags ))
+ || pAttr->IsSymbolFont()) );
for (i=0; i<nSaveCount; i++) // nSaveCount: Ende auf MAXROW angepasst
{
@@ -390,11 +364,15 @@ void ScColumn::SaveData( SvStream& rStream ) const
if( pAttr )
{
if( nRow > nEnd )
- do
{
- pAttr = aIter.Next( nStt, nEnd );
+ do
+ {
+ pAttr = aIter.Next( nStt, nEnd );
+ }
+ while( pAttr && !(
+ (xFontConverter = pAttr->GetSubsFontConverter( nFontConverterFlags ))
+ || pAttr->IsSymbolFont()) );
}
- while( pAttr && !pAttr->IsSymbolFont() );
if( pAttr && nRow >= nStt && nRow <= nEnd )
eCellType = CELLTYPE_SYMBOLS;
}
@@ -402,10 +380,10 @@ void ScColumn::SaveData( SvStream& rStream ) const
if ( eCellType == CELLTYPE_SYMBOLS )
{
// cell string contains true symbol characters
-//! CharSet eOld = rStream.GetStreamCharSet();
-//! rStream.SetStreamCharSet( RTL_TEXTENCODING_SYMBOL );
- ((ScStringCell*)pCell)->Save( rStream );
-//! rStream.SetStreamCharSet( eOld );
+ CharSet eOld = rStream.GetStreamCharSet();
+ rStream.SetStreamCharSet( RTL_TEXTENCODING_SYMBOL );
+ ((ScStringCell*)pCell)->Save( rStream, xFontConverter );
+ rStream.SetStreamCharSet( eOld );
}
else
((ScStringCell*)pCell)->Save( rStream );
@@ -547,6 +525,35 @@ BOOL ScColumn::Load( SvStream& rStream, ScMultipleReadHeader& rHdr )
}
rHdr.EndEntry();
+ if ( pDocument->SymbolStringCellsPending() )
+ {
+ ScFontToSubsFontConverter_AutoPtr xFontConverter;
+ const ULONG nFontConverterFlags = FONTTOSUBSFONT_IMPORT | FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS;
+ ScSymbolStringCellEntry* pE;
+ USHORT nStt, nEnd;
+
+ ScAttrIterator aIter( pAttrArray, 0, MAXROW );
+ const ScPatternAttr* pAttr = aIter.Next( nStt, nEnd );
+ xFontConverter = pAttr->GetSubsFontConverter( nFontConverterFlags );
+
+ List& rList = pDocument->GetLoadedSymbolStringCellsList();
+ for ( pE = (ScSymbolStringCellEntry*) rList.First(); pE;
+ pE = (ScSymbolStringCellEntry*) rList.Next() )
+ {
+ const ScPatternAttr* pLastAttr = pAttr;
+ while ( nEnd < pE->nRow )
+ {
+ pAttr = aIter.Next( nStt, nEnd );
+ }
+ if ( pAttr != pLastAttr )
+ xFontConverter = pAttr->GetSubsFontConverter( nFontConverterFlags );
+ pE->pCell->ConvertFont( xFontConverter );
+ delete pE;
+ }
+ rList.Clear();
+ }
+ pAttrArray->ConvertFontsAfterLoad();
+
return TRUE;
}
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index d3ee4cc30469..05424b10b8a4 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: documen2.cxx,v $
*
- * $Revision: 1.26 $
+ * $Revision: 1.27 $
*
- * last change: $Author: er $ $Date: 2001-08-02 14:46:38 $
+ * last change: $Author: er $ $Date: 2001-08-10 18:02:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -268,6 +268,9 @@
#ifndef _TOOLS_TENCCVT_HXX
#include <tools/tenccvt.hxx>
#endif
+#ifndef _LIST_HXX
+#include <tools/list.hxx>
+#endif
#include "document.hxx"
#include "table.hxx"
@@ -371,7 +374,8 @@ ScDocument::ScDocument( ScDocumentMode eMode,
eLinkMode(LM_UNKNOWN),
pDPCollection( NULL ),
pScriptTypeData( NULL ),
- nAsianCompression(SC_ASIANCOMPRESSION_INVALID)
+ nAsianCompression(SC_ASIANCOMPRESSION_INVALID),
+ pLoadedSymbolStringCellList( NULL )
{
eSrcSet = gsl_getSystemTextEncoding();
nSrcVer = SC_CURRENT_VERSION;
@@ -665,6 +669,21 @@ void lcl_RefreshPivotData( ScPivotCollection* pColl )
}
}
+
+BOOL ScDocument::SymbolStringCellsPending() const
+{
+ return pLoadedSymbolStringCellList && pLoadedSymbolStringCellList->Count();
+}
+
+
+List& ScDocument::GetLoadedSymbolStringCellsList()
+{
+ if ( !pLoadedSymbolStringCellList )
+ pLoadedSymbolStringCellList = new List;
+ return *pLoadedSymbolStringCellList;
+}
+
+
void lcl_AddLanguage( SfxItemSet& rSet, SvNumberFormatter& rFormatter )
{
// Sprache dann dazutueten, wenn ein Zahlformat mit einer anderen Sprache
@@ -936,6 +955,9 @@ BOOL ScDocument::Load( SvStream& rStream, ScProgress* pProgress )
lcl_AddLanguage( pStyle->GetItemSet(), *pFormatter );
}
+ // change FontItems in styles
+ xPoolHelper->GetStylePool()->ConvertFontsAfterLoad();
+
// Druckbereiche etc.
SfxStyleSheetIterator aIter( xPoolHelper->GetStylePool(), SFX_STYLE_FAMILY_PAGE );
@@ -1030,6 +1052,12 @@ BOOL ScDocument::Load( SvStream& rStream, ScProgress* pProgress )
CalcAfterLoad();
}
+ if ( pLoadedSymbolStringCellList )
+ { // we had symbol string cells, list was cleared by columns, delete it
+ delete pLoadedSymbolStringCellList;
+ pLoadedSymbolStringCellList = NULL;
+ }
+
//----------------------------------------------------
bLoadingDone = TRUE;
diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx
index 50f4c0eb3a1b..e29898485de9 100644
--- a/sc/source/core/data/patattr.cxx
+++ b/sc/source/core/data/patattr.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: patattr.cxx,v $
*
- * $Revision: 1.10 $
+ * $Revision: 1.11 $
*
- * last change: $Author: nn $ $Date: 2001-05-18 19:41:13 $
+ * last change: $Author: er $ $Date: 2001-08-10 18:02:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -1059,6 +1059,17 @@ BOOL ScPatternAttr::IsSymbolFont() const
return FALSE;
}
+FontToSubsFontConverter ScPatternAttr::GetSubsFontConverter( ULONG nFlags ) const
+{
+ const SfxPoolItem* pItem;
+ if( GetItemSet().GetItemState( ATTR_FONT, TRUE, &pItem ) == SFX_ITEM_SET )
+ return CreateFontToSubsFontConverter(
+ ((const SvxFontItem*) pItem)->GetFamilyName(), nFlags );
+ else
+ return 0;
+}
+
+
ULONG ScPatternAttr::GetNumberFormat( SvNumberFormatter* pFormatter ) const
{
ULONG nFormat =
diff --git a/sc/source/core/data/stlpool.cxx b/sc/source/core/data/stlpool.cxx
index 49c5f9b46fba..c802aeb9c63a 100644
--- a/sc/source/core/data/stlpool.cxx
+++ b/sc/source/core/data/stlpool.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: stlpool.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: nn $ $Date: 2001-06-18 16:48:35 $
+ * last change: $Author: er $ $Date: 2001-08-10 18:02:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -86,6 +86,12 @@
#include <svtools/itemset.hxx>
#include <svtools/zforlist.hxx>
#include <unotools/charclass.hxx>
+#ifndef _SVX_FONTITEM_HXX
+#include <svx/fontitem.hxx>
+#endif
+#ifndef _SV_FONTCVT_HXX
+#include <vcl/fontcvt.hxx>
+#endif
#include "sc.hrc"
#include "attrib.hxx"
@@ -97,6 +103,7 @@
#include "stlsheet.hxx"
#include "rechead.hxx"
#include "editutil.hxx"
+#include "patattr.hxx"
//========================================================================
@@ -614,5 +621,31 @@ ScStyleSheet* ScStyleSheetPool::FindCaseIns( const String& rName, SfxStyleFamily
}
-
+void ScStyleSheetPool::ConvertFontsAfterLoad()
+{
+ ScFontToSubsFontConverter_AutoPtr xFontConverter;
+ const ULONG nFlags = FONTTOSUBSFONT_IMPORT | FONTTOSUBSFONT_ONLYOLDSOSYMBOLFONTS;
+ SfxStyleSheetIterator aIter( this, SFX_STYLE_FAMILY_PARA );
+ for ( SfxStyleSheetBase* pStyle = aIter.First(); pStyle; pStyle = aIter.Next() )
+ {
+ const SfxPoolItem* pItem;
+ if( pStyle->GetItemSet().GetItemState( ATTR_FONT, FALSE, &pItem ) == SFX_ITEM_SET )
+ {
+ const SvxFontItem* pFontItem = (const SvxFontItem*) pItem;
+ const String& rOldName = pFontItem->GetFamilyName();
+ xFontConverter = CreateFontToSubsFontConverter( rOldName, nFlags );
+ if ( xFontConverter )
+ {
+ String aNewName( GetFontToSubsFontName( xFontConverter ) );
+ if ( aNewName != rOldName )
+ {
+ SvxFontItem aNewItem( pFontItem->GetFamily(), aNewName,
+ pFontItem->GetStyleName(), pFontItem->GetPitch(),
+ RTL_TEXTENCODING_DONTKNOW, ATTR_FONT );
+ pStyle->GetItemSet().Put( aNewItem );
+ }
+ }
+ }
+ }
+}