diff options
author | Noel Power <noel.power@suse.com> | 2013-02-20 17:27:32 +0000 |
---|---|---|
committer | Noel Power <noel.power@suse.com> | 2013-02-21 13:02:58 +0000 |
commit | 1d0f45ee2efb5dc8d3c40f33ba1494807c117729 (patch) | |
tree | 1831fb42b62eb2f829ca42d31ea64791d3870aae /sc | |
parent | 868cb16417f7a4c9bdbb55b6262eddad3db6dc14 (diff) |
basic support for writing embedded fonts for calc docs
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/document.hxx | 4 | ||||
-rw-r--r-- | sc/inc/unonames.hxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/documen2.cxx | 3 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlfonte.cxx | 17 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlimprt.cxx | 6 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlimprt.hxx | 1 | ||||
-rw-r--r-- | sc/source/ui/unoobj/confuno.cxx | 15 |
7 files changed, 42 insertions, 6 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 0663cb9f6982..fa4ccc1aa113 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -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 diff --git a/sc/inc/unonames.hxx b/sc/inc/unonames.hxx index 9ab18568fe14..1a34e6d1cf2c 100644 --- a/sc/inc/unonames.hxx +++ b/sc/inc/unonames.hxx @@ -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: */ diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index a995d126dbf9..b034bbf2b43c 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -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); diff --git a/sc/source/filter/xml/xmlfonte.cxx b/sc/source/filter/xml/xmlfonte.cxx index ca936744bd92..0caca5501dab 100644 --- a/sc/source/filter/xml/xmlfonte.cxx +++ b/sc/source/filter/xml/xmlfonte.cxx @@ -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: */ diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx index ff9bb374b573..0d766521ea0f 100644 --- a/sc/source/filter/xml/xmlimprt.cxx +++ b/sc/source/filter/xml/xmlimprt.cxx @@ -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: */ diff --git a/sc/source/filter/xml/xmlimprt.hxx b/sc/source/filter/xml/xmlimprt.hxx index 2d8201d097e2..3b97f1807c15 100644 --- a/sc/source/filter/xml/xmlimprt.hxx +++ b/sc/source/filter/xml/xmlimprt.hxx @@ -1195,6 +1195,7 @@ public: ScEditEngineDefaulter* GetEditEngine(); const ScXMLEditAttributeMap& GetEditAttributeMap() const; + virtual void NotifyEmbeddedFontRead() SAL_OVERRIDE; }; #endif diff --git a/sc/source/ui/unoobj/confuno.cxx b/sc/source/ui/unoobj/confuno.cxx index acb831da4d85..8ac0dfbf9d75 100644 --- a/sc/source/ui/unoobj/confuno.cxx +++ b/sc/source/ui/unoobj/confuno.cxx @@ -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(); |