Kaydet (Commit) eb6ff076 authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl Kaydeden (comit) Tomaž Vajngerl

[API CHANGE] tdf#65353 Add more doc. settings more embedding fonts

- Add setting to embed used fonts only
- Add setting for filtering of Latin, Asian, Complex script fonts

Change-Id: I8d093ed05fdcef3715616c008f6eeaa8cfbcc850
Reviewed-on: https://gerrit.libreoffice.org/57167
Tested-by: Jenkins
Reviewed-by: 's avatarTomaž Vajngerl <quikee@gmail.com>
üst 76b48200
......@@ -45,6 +45,10 @@ private:
OUString embedFontFile(OUString const & rFileUrl, OUString const & rFamilyName);
protected:
bool m_bEmbedUsedOnly;
bool m_bEmbedLatinScript;
bool m_bEmbedAsianScript;
bool m_bEmbedComplexScript;
SvXMLExport& GetExport() { return rExport; }
......@@ -68,6 +72,17 @@ public:
rtl_TextEncoding eEnc )const;
void exportXML();
void setEmbedOnlyUsedFonts(bool bEmbedUsedOnly)
{
m_bEmbedUsedOnly = bEmbedUsedOnly;
}
void setEmbedFontScripts(bool bEmbedLatinScript, bool bEmbedAsianScript, bool bEmbedComplexScript)
{
m_bEmbedLatinScript = bEmbedLatinScript;
m_bEmbedAsianScript = bEmbedAsianScript;
m_bEmbedComplexScript = bEmbedComplexScript;
}
};
#endif // INCLUDED_XMLOFF_XMLFONTAUTOSTYLEPOOL_HXX
......
......@@ -260,6 +260,29 @@ published service Settings
*/
[optional, property] boolean EmbedSystemFonts;
/** Whether to embed only the fonts that are used in the document.
@since LibreOffice 6.2
*/
[optional, property] boolean EmbedOnlyUsedFonts;
/** Whether to embed Latin script fonts.
@since LibreOffice 6.2
*/
[optional, property] short EmbedLatinScriptFonts;
/** Whether to embed Asian script fonts.
@since LibreOffice 6.2
*/
[optional, property] short EmbedAsianScriptFonts;
/** Whether to embed Complex script fonts.
@since LibreOffice 6.2
*/
[optional, property] short EmbedComplexScriptFonts;
};
......
......@@ -523,7 +523,12 @@ private:
std::set<ScFormulaCell*> maSubTotalCells;
bool mbUseEmbedFonts;
bool mbEmbedFonts : 1;
bool mbEmbedUsedFontsOnly : 1;
bool mbEmbedFontScriptLatin : 1;
bool mbEmbedFontScriptAsian : 1;
bool mbEmbedFontScriptComplex : 1;
std::unique_ptr<sc::IconSetBitmapMap> m_pIconSetBitmapMap;
......@@ -535,8 +540,19 @@ private:
public:
bool IsCellInChangeTrack(const ScAddress &cell,Color *pColCellBorder);
void GetCellChangeTrackNote(const ScAddress &cell, OUString &strTrackText, bool &pbLeftEdge);
bool IsUsingEmbededFonts() { return mbUseEmbedFonts; }
void SetIsUsingEmbededFonts( bool bUse ) { mbUseEmbedFonts = bUse; }
bool IsEmbedFonts() { return mbEmbedFonts; }
bool IsEmbedUsedFontsOnly() { return mbEmbedUsedFontsOnly; }
bool IsEmbedFontScriptLatin() { return mbEmbedFontScriptLatin; }
bool IsEmbedFontScriptAsian() { return mbEmbedFontScriptAsian; }
bool IsEmbedFontScriptComplex() { return mbEmbedFontScriptComplex; }
void SetEmbedFonts(bool bUse) { mbEmbedFonts = bUse; }
void SetEmbedUsedFontsOnly(bool bUse) { mbEmbedUsedFontsOnly = bUse; }
void SetEmbedFontScriptLatin(bool bUse) { mbEmbedFontScriptLatin = bUse; }
void SetEmbedFontScriptAsian(bool bUse) { mbEmbedFontScriptAsian = bUse; }
void SetEmbedFontScriptComplex(bool bUse) { mbEmbedFontScriptComplex = bUse; }
SC_DLLPUBLIC sal_uLong GetCellCount() const; // all cells
SC_DLLPUBLIC sal_uLong GetFormulaGroupCount() const; // all cells
sal_uLong GetCodeCount() const; // RPN-Code in formulas
......
......@@ -691,7 +691,11 @@
// Named ranges
#define SC_UNO_MODIFY_BROADCAST "ModifyAndBroadcast"
#define SC_UNO_EMBED_FONTS "EmbedFonts"
#define SC_UNO_EMBED_FONTS "EmbedFonts"
#define SC_UNO_EMBED_ONLY_USED_FONTS "EmbedOnlyUsedFonts"
#define SC_UNO_EMBED_FONT_SCRIPT_LATIN "EmbedLatinScriptFonts"
#define SC_UNO_EMBED_FONT_SCRIPT_ASIAN "EmbedAsianScriptFonts"
#define SC_UNO_EMBED_FONT_SCRIPT_COMPLEX "EmbedComplexScriptFonts"
#define SC_UNO_ODS_LOCK_SOLAR_MUTEX "ODSLockSolarMutex"
#define SC_UNO_ODS_IMPORT_STYLES "ODSImportStyles"
......
......@@ -6521,7 +6521,11 @@ void Test::testEmptyCalcDocDefaults()
CPPUNIT_ASSERT_EQUAL( false, m_pDoc->HasNotes() );
CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IsCutMode() );
CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IsUsingEmbededFonts() );
CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IsEmbedFonts() );
CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IsEmbedUsedFontsOnly() );
CPPUNIT_ASSERT_EQUAL( true, m_pDoc->IsEmbedFontScriptLatin() );
CPPUNIT_ASSERT_EQUAL( true, m_pDoc->IsEmbedFontScriptAsian() );
CPPUNIT_ASSERT_EQUAL( true, m_pDoc->IsEmbedFontScriptComplex() );
CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IsEmbedded() );
CPPUNIT_ASSERT_EQUAL( true, m_pDoc->IsDocEditable() );
......
......@@ -221,7 +221,11 @@ ScDocument::ScDocument( ScDocumentMode eMode, SfxObjectShell* pDocShell ) :
mbStreamValidLocked( false ),
mbUserInteractionEnabled(true),
mnNamedRangesLockCount(0),
mbUseEmbedFonts(false),
mbEmbedFonts(false),
mbEmbedUsedFontsOnly(false),
mbEmbedFontScriptLatin(true),
mbEmbedFontScriptAsian(true),
mbEmbedFontScriptComplex(true),
mbTrackFormulasPending(false),
mbFinalTrackFormulas(false),
mnMutationGuardFlags(0)
......
......@@ -39,7 +39,7 @@ private:
void AddFontItems(const sal_uInt16* pWhichIds, sal_uInt8 nIdCount, const SfxItemPool* pItemPool, const bool bExportDefaults);
public:
ScXMLFontAutoStylePool_Impl( ScXMLExport& rExport, bool bBlockFontEmbedding );
ScXMLFontAutoStylePool_Impl( ScXMLExport& rExport, bool bEmbedFonts);
virtual ~ScXMLFontAutoStylePool_Impl() override;
};
......@@ -70,8 +70,8 @@ void ScXMLFontAutoStylePool_Impl::AddFontItems(const sal_uInt16* pWhichIds, sal_
}
}
ScXMLFontAutoStylePool_Impl::ScXMLFontAutoStylePool_Impl(ScXMLExport& rExportP, bool bBlockFontEmbedding)
: XMLFontAutoStylePool(rExportP, bBlockFontEmbedding)
ScXMLFontAutoStylePool_Impl::ScXMLFontAutoStylePool_Impl(ScXMLExport& rExportP, bool bEmbedFonts)
: XMLFontAutoStylePool(rExportP, bEmbedFonts)
, mpEditEnginePool(nullptr)
{
sal_uInt16 const aWhichIds[] { ATTR_FONT, ATTR_CJK_FONT,
......@@ -88,6 +88,11 @@ ScXMLFontAutoStylePool_Impl::ScXMLFontAutoStylePool_Impl(ScXMLExport& rExportP,
std::shared_ptr<SfxStyleSheetIterator> pItr = rExportP.GetDocument()->GetStyleSheetPool()->CreateIterator(SfxStyleFamily::Page, SfxStyleSearchBits::All);
m_bEmbedUsedOnly = rExportP.GetDocument()->IsEmbedUsedFontsOnly();
m_bEmbedLatinScript = rExportP.GetDocument()->IsEmbedFontScriptLatin();
m_bEmbedAsianScript = rExportP.GetDocument()->IsEmbedFontScriptAsian();
m_bEmbedComplexScript = rExportP.GetDocument()->IsEmbedFontScriptComplex();
if(pItr)
{
SfxStyleSheetBase* pStyle(pItr->First());
......@@ -157,7 +162,7 @@ XMLFontAutoStylePool* ScXMLExport::CreateFontAutoStylePool()
// the embedding only in one of them.
if(!( getExportFlags() & SvXMLExportFlags::CONTENT ))
blockFontEmbedding = true;
if( !GetDocument()->IsUsingEmbededFonts())
if (!GetDocument()->IsEmbedFonts())
blockFontEmbedding = true;
return new ScXMLFontAutoStylePool_Impl( *this, !blockFontEmbedding );
}
......
......@@ -2012,8 +2012,8 @@ const ScXMLEditAttributeMap& ScXMLImport::GetEditAttributeMap() const
void ScXMLImport::NotifyEmbeddedFontRead()
{
if ( pDoc )
pDoc->SetIsUsingEmbededFonts( true );
if (pDoc)
pDoc->SetEmbedFonts(true);
}
ScMyImpDetectiveOpArray* ScXMLImport::GetDetectiveOpArray()
......
......@@ -84,7 +84,11 @@ static const SfxItemPropertyMapEntry* lcl_GetConfigPropertyMap()
{OUString(SC_UNO_LOADREADONLY), 0, cppu::UnoType<bool>::get(), 0, 0},
{OUString(SC_UNO_SHAREDOC), 0, cppu::UnoType<bool>::get(), 0, 0},
{OUString(SC_UNO_MODIFYPASSWORDINFO), 0, cppu::UnoType<uno::Sequence< beans::PropertyValue >>::get(), 0, 0},
{OUString(SC_UNO_EMBED_FONTS), 0, cppu::UnoType<bool>::get(), 0, 0},
{OUString(SC_UNO_EMBED_FONTS), 0, cppu::UnoType<bool>::get(), 0, 0},
{OUString(SC_UNO_EMBED_ONLY_USED_FONTS), 0, cppu::UnoType<bool>::get(), 0, 0},
{OUString(SC_UNO_EMBED_FONT_SCRIPT_LATIN), 0, cppu::UnoType<bool>::get(), 0, 0},
{OUString(SC_UNO_EMBED_FONT_SCRIPT_ASIAN), 0, cppu::UnoType<bool>::get(), 0, 0},
{OUString(SC_UNO_EMBED_FONT_SCRIPT_COMPLEX), 0, cppu::UnoType<bool>::get(), 0, 0},
{OUString(SC_UNO_SYNTAXSTRINGREF), 0, cppu::UnoType<sal_Int16>::get(), 0, 0},
{ OUString(), 0, css::uno::Type(), 0, 0 }
};
......@@ -337,13 +341,30 @@ void SAL_CALL ScDocumentConfiguration::setPropertyValue(
throw beans::PropertyVetoException(
"The hash is not allowed to be changed now!" );
}
else if ( aPropertyName == SC_UNO_EMBED_FONTS )
else if (aPropertyName == SC_UNO_EMBED_FONTS)
{
bool bVal = false;
if ( aValue >>=bVal )
{
rDoc.SetIsUsingEmbededFonts(bVal);
}
bool bVal = aValue.has<bool>() && aValue.get<bool>();
rDoc.SetEmbedFonts(bVal);
}
else if (aPropertyName == SC_UNO_EMBED_ONLY_USED_FONTS)
{
bool bVal = aValue.has<bool>() && aValue.get<bool>();
rDoc.SetEmbedUsedFontsOnly(bVal);
}
else if (aPropertyName == SC_UNO_EMBED_FONT_SCRIPT_LATIN)
{
bool bVal = aValue.has<bool>() && aValue.get<bool>();
rDoc.SetEmbedFontScriptLatin(bVal);
}
else if (aPropertyName == SC_UNO_EMBED_FONT_SCRIPT_ASIAN)
{
bool bVal = aValue.has<bool>() && aValue.get<bool>();
rDoc.SetEmbedFontScriptAsian(bVal);
}
else if (aPropertyName == SC_UNO_EMBED_FONT_SCRIPT_COMPLEX)
{
bool bVal = aValue.has<bool>() && aValue.get<bool>();
rDoc.SetEmbedFontScriptComplex(bVal);
}
else if ( aPropertyName == SC_UNO_SYNTAXSTRINGREF )
{
......@@ -524,10 +545,16 @@ uno::Any SAL_CALL ScDocumentConfiguration::getPropertyValue( const OUString& aPr
}
else if ( aPropertyName == SC_UNO_MODIFYPASSWORDINFO )
aRet <<= pDocShell->GetModifyPasswordInfo();
else if ( aPropertyName == SC_UNO_EMBED_FONTS )
{
aRet <<= rDoc.IsUsingEmbededFonts();
}
else if (aPropertyName == SC_UNO_EMBED_FONTS)
aRet <<= rDoc.IsEmbedFonts();
else if (aPropertyName == SC_UNO_EMBED_ONLY_USED_FONTS)
aRet <<= rDoc.IsEmbedUsedFontsOnly();
else if (aPropertyName == SC_UNO_EMBED_FONT_SCRIPT_LATIN)
aRet <<= rDoc.IsEmbedFontScriptLatin();
else if (aPropertyName == SC_UNO_EMBED_FONT_SCRIPT_ASIAN)
aRet <<= rDoc.IsEmbedFontScriptAsian();
else if (aPropertyName == SC_UNO_EMBED_FONT_SCRIPT_COMPLEX)
aRet <<= rDoc.IsEmbedFontScriptComplex();
else if ( aPropertyName == SC_UNO_SYNTAXSTRINGREF )
{
ScCalcConfig aCalcConfig = rDoc.GetCalcConfig();
......
......@@ -196,7 +196,12 @@ private:
std::vector<css::uno::Reference< css::xml::dom::XNode> > maPresObjectInfo;
bool mbUseEmbedFonts;
bool mbEmbedFonts : 1;
bool mbEmbedUsedFontsOnly : 1;
bool mbEmbedFontScriptLatin : 1;
bool mbEmbedFontScriptAsian : 1;
bool mbEmbedFontScriptComplex : 1;
protected:
SAL_DLLPRIVATE virtual css::uno::Reference< css::uno::XInterface > createUnoModel() override;
......@@ -618,8 +623,17 @@ public:
SAL_DLLPRIVATE sal_uInt16 GetAnnotationAuthorIndex( const OUString& rAuthor );
SAL_DLLPRIVATE bool IsUsingEmbededFonts() { return mbUseEmbedFonts; }
SAL_DLLPRIVATE void SetIsUsingEmbededFonts( bool bUse ) { mbUseEmbedFonts = bUse; }
SAL_DLLPRIVATE bool IsEmbedFonts() { return mbEmbedFonts; }
SAL_DLLPRIVATE bool IsEmbedUsedFontsOnly() { return mbEmbedUsedFontsOnly; }
SAL_DLLPRIVATE bool IsEmbedFontScriptLatin() { return mbEmbedFontScriptLatin; }
SAL_DLLPRIVATE bool IsEmbedFontScriptAsian() { return mbEmbedFontScriptAsian; }
SAL_DLLPRIVATE bool IsEmbedFontScriptComplex() { return mbEmbedFontScriptComplex; }
SAL_DLLPRIVATE void SetEmbedFonts(bool bUse) { mbEmbedFonts = bUse; }
SAL_DLLPRIVATE void SetEmbedUsedFontsOnly(bool bUse) { mbEmbedUsedFontsOnly = bUse; }
SAL_DLLPRIVATE void SetEmbedFontScriptLatin(bool bUse) { mbEmbedFontScriptLatin = bUse; }
SAL_DLLPRIVATE void SetEmbedFontScriptAsian(bool bUse) { mbEmbedFontScriptAsian = bUse; }
SAL_DLLPRIVATE void SetEmbedFontScriptComplex(bool bUse) { mbEmbedFontScriptComplex = bUse; }
void dumpAsXml(struct _xmlTextWriter* pWriter) const override;
......
......@@ -156,7 +156,11 @@ SdDrawDocument::SdDrawDocument(DocumentType eType, SfxObjectShell* pDrDocSh)
, mbAllocDocSh(false)
, meDocType(eType)
, mpCharClass(nullptr)
, mbUseEmbedFonts(false)
, mbEmbedFonts(false)
, mbEmbedUsedFontsOnly(false)
, mbEmbedFontScriptLatin(true)
, mbEmbedFontScriptAsian(true)
, mbEmbedFontScriptComplex(true)
{
mpDrawPageListWatcher.reset(new ImpDrawPageListWatcher(*this));
mpMasterPageListWatcher.reset(new ImpMasterPageListWatcher(*this));
......
......@@ -141,7 +141,9 @@ enum SdDocumentSettingsPropertyHandles
HANDLE_UPDATEFROMTEMPLATE, HANDLE_PRINTER_INDEPENDENT_LAYOUT
// #i33095#
,HANDLE_LOAD_READONLY, HANDLE_MODIFY_PASSWD, HANDLE_SAVE_VERSION
,HANDLE_SLIDESPERHANDOUT, HANDLE_HANDOUTHORIZONTAL, HANDLE_EMBED_FONTS
,HANDLE_SLIDESPERHANDOUT, HANDLE_HANDOUTHORIZONTAL,
HANDLE_EMBED_FONTS, HANDLE_EMBED_USED_FONTS,
HANDLE_EMBED_LATIN_SCRIPT_FONTS, HANDLE_EMBED_ASIAN_SCRIPT_FONTS, HANDLE_EMBED_COMPLEX_SCRIPT_FONTS,
};
#define MID_PRINTER 1
......@@ -205,7 +207,11 @@ enum SdDocumentSettingsPropertyHandles
{ OUString("LoadReadonly"), HANDLE_LOAD_READONLY, cppu::UnoType<bool>::get(), 0, 0 },
{ OUString("ModifyPasswordInfo"), HANDLE_MODIFY_PASSWD, cppu::UnoType<uno::Sequence < beans::PropertyValue >>::get(), 0, 0 },
{ OUString("SaveVersionOnClose"), HANDLE_SAVE_VERSION, cppu::UnoType<bool>::get(), 0, 0 },
{ OUString("EmbedFonts"), HANDLE_EMBED_FONTS, cppu::UnoType<bool>::get(), 0, 0 },
{ OUString("EmbedFonts"), HANDLE_EMBED_FONTS, cppu::UnoType<bool>::get(), 0, 0 },
{ OUString("EmbedOnlyUsedFonts"), HANDLE_EMBED_USED_FONTS, cppu::UnoType<bool>::get(), 0, 0 },
{ OUString("EmbedLatinScriptFonts"), HANDLE_EMBED_LATIN_SCRIPT_FONTS, cppu::UnoType<bool>::get(), 0, 0 },
{ OUString("EmbedAsianScriptFonts"), HANDLE_EMBED_ASIAN_SCRIPT_FONTS, cppu::UnoType<bool>::get(), 0, 0 },
{ OUString("EmbedComplexScriptFonts"), HANDLE_EMBED_COMPLEX_SCRIPT_FONTS, cppu::UnoType<bool>::get(), 0, 0 },
{ OUString(), 0, css::uno::Type(), 0, 0 }
};
......@@ -960,11 +966,59 @@ DocumentSettings::_setPropertyValues(const PropertyMapEntry** ppEntries,
case HANDLE_EMBED_FONTS:
{
bool bNewValue = false;
if ( *pValues >>= bNewValue )
if (pValues->has<bool>())
{
bool bNewValue = pValues->get<bool>();
bChanged = (pDoc->IsEmbedFonts() != bNewValue);
pDoc->SetEmbedFonts(bNewValue);
bOk = true;
}
}
break;
case HANDLE_EMBED_USED_FONTS:
{
if (pValues->has<bool>())
{
bool bNewValue = pValues->get<bool>();
bChanged = (pDoc->IsEmbedUsedFontsOnly() != bNewValue);
pDoc->SetEmbedUsedFontsOnly(bNewValue);
bOk = true;
}
}
break;
case HANDLE_EMBED_LATIN_SCRIPT_FONTS:
{
if (pValues->has<bool>())
{
bool bNewValue = pValues->get<bool>();
bChanged = (pDoc->IsEmbedFontScriptLatin() != bNewValue);
pDoc->SetEmbedFontScriptLatin(bNewValue);
bOk = true;
}
}
break;
case HANDLE_EMBED_ASIAN_SCRIPT_FONTS:
{
if (pValues->has<bool>())
{
bChanged = ( pDoc->IsUsingEmbededFonts() != bNewValue );
pDoc->SetIsUsingEmbededFonts( bNewValue );
bool bNewValue = pValues->get<bool>();
bChanged = (pDoc->IsEmbedFontScriptAsian() != bNewValue);
pDoc->SetEmbedFontScriptAsian(bNewValue);
bOk = true;
}
}
break;
case HANDLE_EMBED_COMPLEX_SCRIPT_FONTS:
{
if (pValues->has<bool>())
{
bool bNewValue = pValues->get<bool>();
bChanged = (pDoc->IsEmbedFontScriptComplex() != bNewValue);
pDoc->SetEmbedFontScriptComplex(bNewValue);
bOk = true;
}
}
......@@ -1220,7 +1274,31 @@ DocumentSettings::_getPropertyValues(
case HANDLE_EMBED_FONTS:
{
*pValue <<= pDoc->IsUsingEmbededFonts();
*pValue <<= pDoc->IsEmbedFonts();
}
break;
case HANDLE_EMBED_USED_FONTS:
{
*pValue <<= pDoc->IsEmbedUsedFontsOnly();
}
break;
case HANDLE_EMBED_LATIN_SCRIPT_FONTS:
{
*pValue <<= pDoc->IsEmbedFontScriptLatin();
}
break;
case HANDLE_EMBED_ASIAN_SCRIPT_FONTS:
{
*pValue <<= pDoc->IsEmbedFontScriptAsian();
}
break;
case HANDLE_EMBED_COMPLEX_SCRIPT_FONTS:
{
*pValue <<= pDoc->IsEmbedFontScriptComplex();
}
break;
......
......@@ -31,6 +31,10 @@ VclPtr<SfxTabPage> SfxDocumentFontsPage::Create(TabPageParent pParent, const Sfx
SfxDocumentFontsPage::SfxDocumentFontsPage(TabPageParent parent, const SfxItemSet& set)
: SfxTabPage(parent, "sfx/ui/documentfontspage.ui", "DocumentFontsPage", &set)
, embedFontsCheckbox(m_xBuilder->weld_check_button("embedFonts"))
, embedUsedFontsCheckbox(m_xBuilder->weld_check_button("embedUsedFonts"))
, embedLatinScriptFontsCheckbox(m_xBuilder->weld_check_button("embedLatinScriptFonts"))
, embedAsianScriptFontsCheckbox(m_xBuilder->weld_check_button("embedAsianScriptFonts"))
, embedComplexScriptFontsCheckbox(m_xBuilder->weld_check_button("embedComplexScriptFonts"))
{
}
......@@ -40,26 +44,48 @@ SfxDocumentFontsPage::~SfxDocumentFontsPage()
void SfxDocumentFontsPage::Reset( const SfxItemSet* )
{
bool bVal = false;
bool bEmbedFonts = false;
bool bEmbedUsedFonts = false;
bool bEmbedLatinScriptFonts = false;
bool bEmbedAsianScriptFonts = false;
bool bEmbedComplexScriptFonts = false;
SfxObjectShell* pDocSh = SfxObjectShell::Current();
if ( pDocSh )
if (pDocSh)
{
try
{
uno::Reference< lang::XMultiServiceFactory > xFac( pDocSh->GetModel(), uno::UNO_QUERY_THROW );
uno::Reference< beans::XPropertySet > xProps( xFac->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY_THROW );
xProps->getPropertyValue("EmbedFonts") >>= bVal;
xProps->getPropertyValue("EmbedFonts") >>= bEmbedFonts;
xProps->getPropertyValue("EmbedOnlyUsedFonts") >>= bEmbedUsedFonts;
xProps->getPropertyValue("EmbedLatinScriptFonts") >>= bEmbedLatinScriptFonts;
xProps->getPropertyValue("EmbedAsianScriptFonts") >>= bEmbedAsianScriptFonts;
xProps->getPropertyValue("EmbedComplexScriptFonts") >>= bEmbedComplexScriptFonts;
}
catch( uno::Exception& )
{
}
}
embedFontsCheckbox->set_active(bVal);
embedFontsCheckbox->set_active(bEmbedFonts);
embedUsedFontsCheckbox->set_active(bEmbedUsedFonts);
embedLatinScriptFontsCheckbox->set_active(bEmbedLatinScriptFonts);
embedAsianScriptFontsCheckbox->set_active(bEmbedAsianScriptFonts);
embedComplexScriptFontsCheckbox->set_active(bEmbedComplexScriptFonts);
}
bool SfxDocumentFontsPage::FillItemSet( SfxItemSet* )
{
bool bVal = embedFontsCheckbox->get_active();
bool bEmbedFonts = embedFontsCheckbox->get_active();
bool bEmbedUsedFonts = embedUsedFontsCheckbox->get_active();
bool bEmbedLatinScriptFonts = embedLatinScriptFontsCheckbox->get_active();
bool bEmbedAsianScriptFonts = embedAsianScriptFontsCheckbox->get_active();
bool bEmbedComplexScriptFonts = embedComplexScriptFontsCheckbox->get_active();
SfxObjectShell* pDocSh = SfxObjectShell::Current();
if ( pDocSh )
{
......@@ -67,7 +93,11 @@ bool SfxDocumentFontsPage::FillItemSet( SfxItemSet* )
{
uno::Reference< lang::XMultiServiceFactory > xFac( pDocSh->GetModel(), uno::UNO_QUERY_THROW );
uno::Reference< beans::XPropertySet > xProps( xFac->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY_THROW );
xProps->setPropertyValue("EmbedFonts", uno::makeAny( bVal ) );
xProps->setPropertyValue("EmbedFonts", uno::makeAny(bEmbedFonts));
xProps->setPropertyValue("EmbedOnlyUsedFonts", uno::makeAny(bEmbedUsedFonts));
xProps->setPropertyValue("EmbedLatinScriptFonts", uno::makeAny(bEmbedLatinScriptFonts));
xProps->setPropertyValue("EmbedAsianScriptFonts", uno::makeAny(bEmbedAsianScriptFonts));
xProps->setPropertyValue("EmbedComplexScriptFonts", uno::makeAny(bEmbedComplexScriptFonts));
}
catch( uno::Exception& )
{
......
......@@ -35,6 +35,10 @@ protected:
virtual void Reset( const SfxItemSet* set ) override;
private:
std::unique_ptr<weld::CheckButton> embedFontsCheckbox;
std::unique_ptr<weld::CheckButton> embedUsedFontsCheckbox;
std::unique_ptr<weld::CheckButton> embedLatinScriptFontsCheckbox;
std::unique_ptr<weld::CheckButton> embedAsianScriptFontsCheckbox;
std::unique_ptr<weld::CheckButton> embedComplexScriptFontsCheckbox;
};
#endif
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<!-- Generated with glade 3.22.1 -->
<interface domain="sfx">
<requires lib="gtk+" version="3.18"/>
<object class="GtkGrid" id="DocumentFontsPage">
......@@ -21,14 +21,115 @@
<property name="top_padding">6</property>
<property name="left_padding">12</property>
<child>
<object class="GtkCheckButton" id="embedFonts">
<property name="label" translatable="yes" context="documentfontspage|embedFonts">_Embed fonts in the document</property>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkCheckButton" id="embedFonts">
<property name="label" translatable="yes" context="documentfontspage|embedFonts">_Embed fonts in the document</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="embedUsedFonts">
<property name="label" translatable="yes" context="documentfontspage|embedUsedFonts">Only embed fonts that are used in documents</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkFrame">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkCheckButton" id="embedLatinScriptFonts">
<property name="label" translatable="yes" context="documentfontspage|embedLatinScriptFonts">Latin fonts</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="embedAsianScriptFonts">
<property name="label" translatable="yes" context="documentfontspage|embedAsianScriptFonts">Asian fonts</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="embedComplexScriptFonts">
<property name="label" translatable="yes" context="documentfontspage|embedComplexScriptFonts">Complex fonts</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="documentfontspage|fontScriptFrameLabel">Select font scripts to embed</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
</packing>
</child>
</object>
</child>
</object>
......
......@@ -96,6 +96,10 @@ enum class DocumentSettingId
STYLES_NODEFAULT,
FLOATTABLE_NOMARGINS,
EMBED_FONTS,
EMBED_USED_FONTS,
EMBED_LATIN_SCRIPT_FONTS,
EMBED_ASIAN_SCRIPT_FONTS,
EMBED_COMPLEX_SCRIPT_FONTS,
EMBED_SYSTEM_FONTS,
APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING,
};
......
......@@ -61,6 +61,10 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc &rDoc)
mbStylesNoDefault(false),
mbFloattableNomargins(false),
mEmbedFonts(false),
mEmbedUsedFonts(false),
mEmbedLatinScriptFonts(true),
mEmbedAsianScriptFonts(true),
mEmbedComplexScriptFonts(true),
mEmbedSystemFonts(false),
mbOldNumbering(false),
mbIgnoreFirstLineIndentInNumbering(false),
......@@ -204,6 +208,10 @@ bool sw::DocumentSettingManager::get(/*[in]*/ DocumentSettingId id) const
case DocumentSettingId::STYLES_NODEFAULT: return mbStylesNoDefault;
case DocumentSettingId::FLOATTABLE_NOMARGINS: return mbFloattableNomargins;
case DocumentSettingId::EMBED_FONTS: return mEmbedFonts;
case DocumentSettingId::EMBED_USED_FONTS: return mEmbedUsedFonts;
case DocumentSettingId::EMBED_LATIN_SCRIPT_FONTS: return mEmbedLatinScriptFonts;
case DocumentSettingId::EMBED_ASIAN_SCRIPT_FONTS: return mEmbedAsianScriptFonts;
case DocumentSettingId::EMBED_COMPLEX_SCRIPT_FONTS: return mEmbedComplexScriptFonts;
case DocumentSettingId::EMBED_SYSTEM_FONTS: return mEmbedSystemFonts;
case DocumentSettingId::APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING: return mApplyParagraphMarkFormatToNumbering;
case DocumentSettingId::DISABLE_OFF_PAGE_POSITIONING: return mbDisableOffPagePositioning;
......@@ -416,6 +424,18 @@ void sw::DocumentSettingManager::set(/*[in]*/ DocumentSettingId id, /*[in]*/ boo
case DocumentSettingId::EMBED_FONTS:
mEmbedFonts = value;
break;
case DocumentSettingId::EMBED_USED_FONTS:
mEmbedUsedFonts = value;
break;
case DocumentSettingId::EMBED_LATIN_SCRIPT_FONTS:
mEmbedLatinScriptFonts = value;
break;
case DocumentSettingId::EMBED_ASIAN_SCRIPT_FONTS: