[Libreoffice-commits] core.git: sc/source

Noel Grandin noel.grandin at collabora.co.uk
Mon Feb 20 11:25:03 UTC 2017


 sc/source/filter/excel/xicontent.cxx  |    2 +-
 sc/source/filter/excel/xihelper.cxx   |    9 ++++-----
 sc/source/filter/excel/xistyle.cxx    |   10 ++++------
 sc/source/filter/inc/xlstyle.hxx      |    9 ++++-----
 sc/source/filter/oox/stylesbuffer.cxx |    4 ++--
 5 files changed, 15 insertions(+), 19 deletions(-)

New commits:
commit e407079b21c15d4ad1c5b27dc52d7b24f4bcc318
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Mon Feb 20 11:36:09 2017 +0200

    convert XclFontItemType to scoped enum
    
    and drop unused EXC_FONTITEM_NOTE enumerator
    
    Change-Id: If38532e61a14ea009fc6156d4f158ff22e68935a
    Reviewed-on: https://gerrit.libreoffice.org/34465
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx
index e0724e2..f0549d8 100644
--- a/sc/source/filter/excel/xicontent.cxx
+++ b/sc/source/filter/excel/xicontent.cxx
@@ -596,7 +596,7 @@ void XclImpCondFormat::ReadCF( XclImpStream& rStrm )
     {
         XclImpFont aFont( GetRoot() );
         aFont.ReadCFFontBlock( rStrm );
-        aFont.FillToItemSet( rStyleItemSet, EXC_FONTITEM_CELL );
+        aFont.FillToItemSet( rStyleItemSet, XclFontItemType::Cell );
     }
 
     // alignment
diff --git a/sc/source/filter/excel/xihelper.cxx b/sc/source/filter/excel/xihelper.cxx
index 2d85d64..20f5e33 100644
--- a/sc/source/filter/excel/xihelper.cxx
+++ b/sc/source/filter/excel/xihelper.cxx
@@ -152,8 +152,7 @@ EditTextObject* lclCreateTextObject( const XclImpRoot& rRoot,
         const XclImpFontBuffer& rFontBuffer = rRoot.GetFontBuffer();
         const XclFormatRunVec& rFormats = rString.GetFormats();
 
-        ScEditEngineDefaulter& rEE = (eType == EXC_FONTITEM_NOTE) ?
-            static_cast< ScEditEngineDefaulter& >( rRoot.GetDoc().GetNoteEngine() ) : rRoot.GetEditEngine();
+        ScEditEngineDefaulter& rEE = rRoot.GetEditEngine();
         rEE.SetText( rString.GetText() );
 
         SfxItemSet aItemSet( rEE.GetEmptyItemSet() );
@@ -218,7 +217,7 @@ EditTextObject* lclCreateTextObject( const XclImpRoot& rRoot,
 EditTextObject* XclImpStringHelper::CreateTextObject(
         const XclImpRoot& rRoot, const XclImpString& rString )
 {
-    return lclCreateTextObject( rRoot, rString, EXC_FONTITEM_EDITENG, 0 );
+    return lclCreateTextObject( rRoot, rString, XclFontItemType::Editeng, 0 );
 }
 
 void XclImpStringHelper::SetToDocument(
@@ -228,7 +227,7 @@ void XclImpStringHelper::SetToDocument(
     if (rString.GetText().isEmpty())
         return;
 
-    ::std::unique_ptr< EditTextObject > pTextObj( lclCreateTextObject( rRoot, rString, EXC_FONTITEM_EDITENG, nXFIndex ) );
+    ::std::unique_ptr< EditTextObject > pTextObj( lclCreateTextObject( rRoot, rString, XclFontItemType::Editeng, nXFIndex ) );
 
     if (pTextObj.get())
     {
@@ -515,7 +514,7 @@ void XclImpHFConverter::SetAttribs()
     {
         SfxItemSet aItemSet( mrEE.GetEmptyItemSet() );
         XclImpFont aFont( GetRoot(), *mxFontData );
-        aFont.FillToItemSet( aItemSet, EXC_FONTITEM_HF );
+        aFont.FillToItemSet( aItemSet, XclFontItemType::HeaderFooter );
         mrEE.QuickSetAttribs( aItemSet, rSel );
         rSel.nStartPara = rSel.nEndPara;
         rSel.nStartPos = rSel.nEndPos;
diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx
index 35ae5df..b7111bc 100644
--- a/sc/source/filter/excel/xistyle.cxx
+++ b/sc/source/filter/excel/xistyle.cxx
@@ -300,7 +300,7 @@ void XclImpFont::ReadCFFontBlock( XclImpStream& rStrm )
 void XclImpFont::FillToItemSet( SfxItemSet& rItemSet, XclFontItemType eType, bool bSkipPoolDefs ) const
 {
     // true = edit engine Which-IDs (EE_CHAR_*); false = Calc Which-IDs (ATTR_*)
-    bool bEE = eType != EXC_FONTITEM_CELL;
+    bool bEE = eType != XclFontItemType::Cell;
 
 // item = the item to put into the item set
 // sc_which = the Calc Which-ID of the item
@@ -309,9 +309,7 @@ void XclImpFont::FillToItemSet( SfxItemSet& rItemSet, XclFontItemType eType, boo
     ScfTools::PutItem( rItemSet, item, (bEE ? (ee_which) : (sc_which)), bSkipPoolDefs )
 
 // Font item
-    // #i36997# do not set default Tahoma font from notes
-    bool bDefNoteFont = (eType == EXC_FONTITEM_NOTE) && (maData.maName.equalsIgnoreAsciiCase( "Tahoma" ));
-    if( mbFontNameUsed && !bDefNoteFont )
+    if( mbFontNameUsed )
     {
         rtl_TextEncoding eFontEnc = maData.GetFontEncoding();
         rtl_TextEncoding eTempTextEnc = (bEE && (eFontEnc == GetTextEncoding())) ?
@@ -342,7 +340,7 @@ void XclImpFont::FillToItemSet( SfxItemSet& rItemSet, XclFontItemType eType, boo
     if( mbHeightUsed )
     {
         sal_Int32 nHeight = maData.mnHeight;
-        if( bEE && (eType != EXC_FONTITEM_HF) )     // do not convert header/footer height
+        if( bEE && (eType != XclFontItemType::HeaderFooter) )     // do not convert header/footer height
             nHeight = (nHeight * 127 + 36) / EXC_POINTS_PER_INCH;   // 1 in == 72 pt
 
         SvxFontHeightItem aHeightItem( nHeight, 100, ATTR_FONT_HEIGHT );
@@ -1272,7 +1270,7 @@ const ScPatternAttr& XclImpXF::CreatePattern( bool bSkipPoolDefs )
 
     // font
     if( mbFontUsed )
-        GetFontBuffer().FillToItemSet( rItemSet, EXC_FONTITEM_CELL, mnXclFont, bSkipPoolDefs );
+        GetFontBuffer().FillToItemSet( rItemSet, XclFontItemType::Cell, mnXclFont, bSkipPoolDefs );
 
     // value format
     if( mbFmtUsed )
diff --git a/sc/source/filter/inc/xlstyle.hxx b/sc/source/filter/inc/xlstyle.hxx
index 339002d..5a258be 100644
--- a/sc/source/filter/inc/xlstyle.hxx
+++ b/sc/source/filter/inc/xlstyle.hxx
@@ -389,12 +389,11 @@ struct XclFontData
 bool operator==( const XclFontData& rLeft, const XclFontData& rRight );
 
 /** Enumerates different types of Which-IDs for font items. */
-enum XclFontItemType
+enum class XclFontItemType
 {
-    EXC_FONTITEM_CELL,          /// Use Calc Which-IDs (ATTR_*).
-    EXC_FONTITEM_EDITENG,       /// Use edit engine Which-IDs (EE_CHAR_*).
-    EXC_FONTITEM_HF,            /// Use header/footer edit engine Which-IDs (EE_CHAR_*).
-    EXC_FONTITEM_NOTE           /// Use note edit engine Which-IDs (EE_CHAR_*), special font handling.
+    Cell,          /// Use Calc Which-IDs (ATTR_*).
+    Editeng,       /// Use edit engine Which-IDs (EE_CHAR_*).
+    HeaderFooter   /// Use header/footer edit engine Which-IDs (EE_CHAR_*).
 };
 
 /** Enumerates different types for objects with font settings (using different property names). */
diff --git a/sc/source/filter/oox/stylesbuffer.cxx b/sc/source/filter/oox/stylesbuffer.cxx
index a4de365..0a83623 100644
--- a/sc/source/filter/oox/stylesbuffer.cxx
+++ b/sc/source/filter/oox/stylesbuffer.cxx
@@ -892,8 +892,8 @@ void Font::fillToItemSet( SfxItemSet& rItemSet, bool bEditEngineText, bool bSkip
     if( maUsedFlags.mbHeightUsed )
     {
         sal_Int32 nHeight = maApiData.maDesc.Height;
-        // do we use EXC_FONTITEM_HF ( or is it just relevant for the binary filter )
-        if( bEditEngineText/* && (eType != EXC_FONTITEM_HF) */)     // do not convert header/footer height
+        // do we use XclFontItemType::HeaderFooter ( or is it just relevant for the binary filter )
+        if( bEditEngineText/* && (eType != XclFontItemType::HeaderFooter) */)     // do not convert header/footer height
             nHeight = (nHeight * 127 + 36) / EXC_POINTS_PER_INCH;   // 1 in == 72 pt
         SvxFontHeightItem aHeightItem( nHeight, 100, ATTR_FONT_HEIGHT );
         ScfTools::PutItem( rItemSet, aHeightItem, bEditEngineText ? EE_CHAR_FONTHEIGHT :  ATTR_FONT_HEIGHT, bSkipPoolDefs );


More information about the Libreoffice-commits mailing list