Kaydet (Commit) 1d0f45ee authored tarafından Noel Power's avatar Noel Power

basic support for writing embedded fonts for calc docs

üst 868cb164
......@@ -302,7 +302,6 @@ private:
com::sun::star::uno::Reference< com::sun::star::script::vba::XVBAEventProcessor >
mxVbaEvents;
public:
boost::ptr_vector< ScInterpreterTableOpParams > aTableOpList; // list of ScInterpreterTableOpParams currently in use
ScInterpreterTableOpParams aLastTableOpParams; // remember last params
......@@ -403,7 +402,10 @@ private:
::std::set<ScFormulaCell*> maSubTotalCells;
bool mbUseEmbedFonts;
public:
bool IsUsingEmbededFonts() { return mbUseEmbedFonts; }
void SetIsUsingEmbededFonts( bool bUse ) { mbUseEmbedFonts = bUse; }
SC_DLLPUBLIC sal_uLong GetCellCount() const; // all cells
SCSIZE GetCellCount(SCTAB nTab, SCCOL nCol) const;
sal_uLong GetCodeCount() const; // RPN-Code in formulas
......
......@@ -665,6 +665,8 @@
// Named ranges
#define SC_UNO_MODIFY_BROADCAST "ModifyAndBroadcast"
#define SC_UNO_EMBED_FONTS "EmbedFonts"
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -206,7 +206,8 @@ ScDocument::ScDocument( ScDocumentMode eMode,
mbChangeReadOnlyEnabled( false ),
mbStreamValidLocked( false ),
mbUserInteractionEnabled(true),
mnNamedRangesLockCount(0)
mnNamedRangesLockCount(0),
mbUseEmbedFonts(false)
{
SetStorageGrammar( formula::FormulaGrammar::GRAM_STORAGE_DEFAULT);
......
......@@ -35,7 +35,7 @@ class ScXMLFontAutoStylePool_Impl: public XMLFontAutoStylePool
void AddFontItems(sal_uInt16* pWhichIds, sal_uInt8 nIdCount, const SfxItemPool* pItemPool, const sal_Bool bExportDefaults);
public:
ScXMLFontAutoStylePool_Impl( ScXMLExport& rExport );
ScXMLFontAutoStylePool_Impl( ScXMLExport& rExport, bool bBlockFontEmbedding );
};
......@@ -69,8 +69,8 @@ void ScXMLFontAutoStylePool_Impl::AddFontItems(sal_uInt16* pWhichIds, sal_uInt8
}
ScXMLFontAutoStylePool_Impl::ScXMLFontAutoStylePool_Impl(
ScXMLExport& rExportP ) :
XMLFontAutoStylePool( rExportP )
ScXMLExport& rExportP, bool bBlockFontEmbedding ) :
XMLFontAutoStylePool( rExportP, bBlockFontEmbedding )
{
sal_uInt16 aWhichIds[3] = { ATTR_FONT, ATTR_CJK_FONT,
ATTR_CTL_FONT };
......@@ -131,7 +131,16 @@ ScXMLFontAutoStylePool_Impl::ScXMLFontAutoStylePool_Impl(
XMLFontAutoStylePool* ScXMLExport::CreateFontAutoStylePool()
{
return new ScXMLFontAutoStylePool_Impl( *this );
bool blockFontEmbedding = false;
// We write font info to both content.xml and styles.xml, but they are both
// written by different ScXMLExport instance, and would therefore write each
// font file twice without complicated checking for duplicates, so handle
// the embedding only in one of them.
if(( getExportFlags() & EXPORT_CONTENT ) == 0 )
blockFontEmbedding = true;
if( !GetDocument()->IsUsingEmbededFonts())
blockFontEmbedding = true;
return new ScXMLFontAutoStylePool_Impl( *this, !blockFontEmbedding );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -3404,4 +3404,10 @@ const ScXMLEditAttributeMap& ScXMLImport::GetEditAttributeMap() const
return *mpEditAttrMap;
}
void ScXMLImport::NotifyEmbeddedFontRead()
{
if ( pDoc )
pDoc->SetIsUsingEmbededFonts( true );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -1195,6 +1195,7 @@ public:
ScEditEngineDefaulter* GetEditEngine();
const ScXMLEditAttributeMap& GetEditAttributeMap() const;
virtual void NotifyEmbeddedFontRead() SAL_OVERRIDE;
};
#endif
......
......@@ -74,6 +74,7 @@ static const SfxItemPropertyMapEntry* lcl_GetConfigPropertyMap()
{MAP_CHAR_LEN(SC_UNO_LOADREADONLY), 0, &getBooleanCppuType(), 0, 0},
{MAP_CHAR_LEN(SC_UNO_SHAREDOC), 0, &getBooleanCppuType(), 0, 0},
{MAP_CHAR_LEN(SC_UNO_MODIFYPASSWORDINFO), 0, &getCppuType((uno::Sequence< beans::PropertyValue >*)0), 0, 0},
{MAP_CHAR_LEN(SC_UNO_EMBED_FONTS), 0, &getBooleanCppuType(), 0, 0},
{0,0,0,0,0,0}
};
return aConfigPropertyMap_Impl;
......@@ -276,6 +277,15 @@ void SAL_CALL ScDocumentConfiguration::setPropertyValue(
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "The hash is not allowed to be changed now!" ) ),
uno::Reference< uno::XInterface >() );
}
else if ( aPropertyName.compareToAscii( SC_UNO_EMBED_FONTS ) == 0 )
{
sal_Bool bVal = sal_False;
if ( aValue >>=bVal )
{
pDoc->SetIsUsingEmbededFonts(bVal);
}
}
else
{
ScGridOptions aGridOpt(aViewOpt.GetGridOptions());
......@@ -410,6 +420,11 @@ uno::Any SAL_CALL ScDocumentConfiguration::getPropertyValue( const rtl::OUString
}
else if ( aPropertyName.compareToAscii( SC_UNO_MODIFYPASSWORDINFO ) == 0 )
aRet <<= pDocShell->GetModifyPasswordInfo();
else if ( aPropertyName.compareToAscii( SC_UNO_EMBED_FONTS ) == 0 )
{
aRet <<= pDoc->IsUsingEmbededFonts();
}
else
{
const ScGridOptions& aGridOpt = aViewOpt.GetGridOptions();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment