sc/inc/document.hxx | 4 + sc/inc/unonames.hxx | 2 sc/source/core/data/documen2.cxx | 3 - sc/source/filter/xml/xmlfonte.cxx | 17 ++++-- sc/source/filter/xml/xmlimprt.cxx | 6 ++ sc/source/filter/xml/xmlimprt.hxx | 1 sc/source/ui/docshell/docsh.cxx | 1 sc/source/ui/unoobj/confuno.cxx | 15 +++++ sfx2/Library_sfx.mk | 1 sfx2/UI_sfx.mk | 1 sfx2/inc/sfx2/dinfdlg.hxx | 1 sfx2/source/dialog/dialog.hrc | 1 sfx2/source/dialog/dialog.src | 5 + sfx2/source/dialog/dinfdlg.cxx | 8 ++ sfx2/source/dialog/documentfontsdialog.cxx | 75 +++++++++++++++++++++++++++ sfx2/source/inc/documentfontsdialog.hxx | 44 +++++++++++++++ sfx2/uiconfig/ui/documentfontspage.ui | 29 ++++++++++ sw/Library_swui.mk | 1 sw/UI_swriter.mk | 1 sw/inc/globals.hrc | 2 sw/source/ui/app/app.src | 5 - sw/source/ui/app/docsh2.cxx | 2 sw/source/ui/dialog/documentfontsdialog.cxx | 54 ------------------- sw/source/ui/dialog/swdlgfact.cxx | 4 - sw/source/ui/inc/documentfontsdialog.hxx | 44 --------------- sw/source/ui/uno/SwXDocumentSettings.cxx | 1 xmloff/source/style/XMLFontStylesContext.cxx | 1 27 files changed, 211 insertions(+), 118 deletions(-)
New commits: commit db28ed792e08d3eef3e901eaedb255bdc66d1db1 Author: Noel Power <noel.po...@suse.com> Date: Thu Feb 21 10:39:10 2013 +0000 adapt writer to use centralised font dialog and fix some minor bugs fixed incorrect return of EmbeddFonts property and also make sure that NotifyEmbeddedFontRead is called on reload Change-Id: I085f50ff88bbf73b5dcdb9630b6c5844430a47c2 diff --git a/sw/Library_swui.mk b/sw/Library_swui.mk index 4731533..771ddfa 100644 --- a/sw/Library_swui.mk +++ b/sw/Library_swui.mk @@ -78,7 +78,6 @@ $(eval $(call gb_Library_add_exception_objects,swui,\ sw/source/ui/dialog/abstract \ sw/source/ui/dialog/addrdlg \ sw/source/ui/dialog/ascfldlg \ - sw/source/ui/dialog/documentfontsdialog \ sw/source/ui/dialog/docstdlg \ sw/source/ui/dialog/macassgn \ sw/source/ui/dialog/swdialmgr \ diff --git a/sw/UI_swriter.mk b/sw/UI_swriter.mk index 86e75e2..d410de6 100644 --- a/sw/UI_swriter.mk +++ b/sw/UI_swriter.mk @@ -21,7 +21,6 @@ $(eval $(call gb_UI_add_uifiles,modules/swriter,\ sw/uiconfig/swriter/ui/columnpage \ sw/uiconfig/swriter/ui/columnwidth \ sw/uiconfig/swriter/ui/converttexttable \ - sw/uiconfig/swriter/ui/documentfontspage \ sw/uiconfig/swriter/ui/endnotepage \ sw/uiconfig/swriter/ui/editcategories \ sw/uiconfig/swriter/ui/exchangedatabases \ diff --git a/sw/inc/globals.hrc b/sw/inc/globals.hrc index 8a2b81d..0653aaf 100644 --- a/sw/inc/globals.hrc +++ b/sw/inc/globals.hrc @@ -30,7 +30,6 @@ #define STR_LOAD_GLOBAL_DOC (RC_GLOBALS_BEGIN + 2) #define STR_DOC_STAT (RC_GLOBALS_BEGIN + 10) -#define STR_DOC_FONTS (RC_GLOBALS_BEGIN + 107) #define STR_PAGE (RC_GLOBALS_BEGIN + 14) #define STR_PRINTOPTUI (RC_GLOBALS_BEGIN + 15) @@ -139,7 +138,6 @@ #define TP_COLUMN (RC_GLOBALS_BEGIN + 13) #define TP_DOC_STAT (RC_GLOBALS_BEGIN + 15) -#define TP_DOC_FONTS (RC_GLOBALS_BEGIN + 108) #define TP_HEADER_PAGE (RC_GLOBALS_BEGIN + 16) #define TP_FOOTER_PAGE (RC_GLOBALS_BEGIN + 17) diff --git a/sw/source/ui/app/app.src b/sw/source/ui/app/app.src index 9e1eff6..38f114f 100644 --- a/sw/source/ui/app/app.src +++ b/sw/source/ui/app/app.src @@ -305,11 +305,6 @@ String STR_DOC_STAT Text [ en-US ] = "Statistics" ; }; -String STR_DOC_FONTS -{ - Text [ en-US ] = "Fonts" ; -}; - // ---------------------------- // Statusbar-titles // ---------------------------- diff --git a/sw/source/ui/app/docsh2.cxx b/sw/source/ui/app/docsh2.cxx index b13e53d..b306ded 100644 --- a/sw/source/ui/app/docsh2.cxx +++ b/sw/source/ui/app/docsh2.cxx @@ -141,7 +141,7 @@ SfxDocumentInfoDialog* SwDocShell::CreateDocumentInfoDialog( { SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); - pDlg->AddTabPage(TP_DOC_FONTS, SW_RESSTR(STR_DOC_FONTS),pFact->GetTabPageCreatorFunc( TP_DOC_FONTS ),0); + pDlg->AddFontTabPage(); pDlg->AddTabPage(TP_DOC_STAT, SW_RESSTR(STR_DOC_STAT),pFact->GetTabPageCreatorFunc( TP_DOC_STAT ),0); } } diff --git a/sw/source/ui/dialog/documentfontsdialog.cxx b/sw/source/ui/dialog/documentfontsdialog.cxx deleted file mode 100644 index 0ac99d5..0000000 --- a/sw/source/ui/dialog/documentfontsdialog.cxx +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "documentfontsdialog.hxx" - -#include <doc.hxx> -#include <docsh.hxx> - -SfxTabPage* SwDocumentFontsPage::Create( Window* parent, const SfxItemSet& set ) -{ - return new SwDocumentFontsPage( parent, set ); -} - -SwDocumentFontsPage::SwDocumentFontsPage( Window* parent, const SfxItemSet& set ) - : SfxTabPage( parent, "DocumentFontsPage", "modules/swriter/ui/documentfontspage.ui", set ) -{ - get( embedFontsCheckbox, "embedFonts" ); -} - -void SwDocumentFontsPage::Reset( const SfxItemSet& ) -{ - // I take it the SfxItemSet should be "officially" used, but the dialog - // is modal (and SwDocStatPage does it too), so it should be safe, and - // also simpler, to short-circuit directly to the setting. - SwDocShell* docShell = static_cast< SwDocShell* >( SfxObjectShell::Current()); - SwDoc* doc = docShell->GetDoc(); - embedFontsCheckbox->Check( doc->get( IDocumentSettingAccess::EMBED_FONTS )); -} - -sal_Bool SwDocumentFontsPage::FillItemSet( SfxItemSet& ) -{ - SwDocShell* docShell = static_cast< SwDocShell* >( SfxObjectShell::Current()); - SwDoc* doc = docShell->GetDoc(); - doc->set( IDocumentSettingAccess::EMBED_FONTS, embedFontsCheckbox->IsChecked()); - return false; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx index 8dfeac0..da55531 100644 --- a/sw/source/ui/dialog/swdlgfact.cxx +++ b/sw/source/ui/dialog/swdlgfact.cxx @@ -47,7 +47,6 @@ #include "dbinsdlg.hxx" //add for SwInsertDBColAutoPilot #include "docfnote.hxx" //add for SwFootNoteOptionDlg #include "docstdlg.hxx" //add for SwDocStatPage -#include "documentfontsdialog.hxx" #include "DropDownFieldDialog.hxx" //add for DropDownFieldDialog #include "envlop.hxx" //add for SwEnvDlg #include "label.hxx" //add for SwLabDlg @@ -1457,9 +1456,6 @@ CreateTabPage SwAbstractDialogFactory_Impl::GetTabPageCreatorFunc( sal_uInt16 nI case TP_DOC_STAT : pRet = SwDocStatPage::Create; break; - case TP_DOC_FONTS : - pRet = SwDocumentFontsPage::Create; - break; case RID_SW_TP_MAILCONFIG: pRet = SwMailConfigPage::Create; break; diff --git a/sw/source/ui/inc/documentfontsdialog.hxx b/sw/source/ui/inc/documentfontsdialog.hxx deleted file mode 100644 index 931b811..0000000 --- a/sw/source/ui/inc/documentfontsdialog.hxx +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef SW_DOCUMENTFONTSDIALOG_HXX -#define SW_DOCUMENTFONTSDIALOG_HXX - -#include <sfx2/tabdlg.hxx> - -#include <vcl/fixed.hxx> -#include <svtools/stdctrl.hxx> - -/** - Tab page for document font settings in the document properties dialog. -*/ -class SwDocumentFontsPage: public SfxTabPage -{ -public: - SwDocumentFontsPage( Window* parent, const SfxItemSet& set ); - static SfxTabPage* Create( Window* parent, const SfxItemSet& set ); -protected: - virtual sal_Bool FillItemSet( SfxItemSet& set ); - virtual void Reset( const SfxItemSet& set ); -private: - CheckBox* embedFontsCheckbox; -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/uno/SwXDocumentSettings.cxx b/sw/source/ui/uno/SwXDocumentSettings.cxx index 828b603..b42e907 100644 --- a/sw/source/ui/uno/SwXDocumentSettings.cxx +++ b/sw/source/ui/uno/SwXDocumentSettings.cxx @@ -1194,6 +1194,7 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf sal_Bool bTmp = mpDoc->get( IDocumentSettingAccess::EMBED_FONTS ); rValue.setValue( &bTmp, ::getBooleanCppuType() ); } + break; case HANDLE_EMBED_SYSTEM_FONTS: { sal_Bool bTmp = mpDoc->get( IDocumentSettingAccess::EMBED_SYSTEM_FONTS ); diff --git a/xmloff/source/style/XMLFontStylesContext.cxx b/xmloff/source/style/XMLFontStylesContext.cxx index e822fc6..86433b8 100644 --- a/xmloff/source/style/XMLFontStylesContext.cxx +++ b/xmloff/source/style/XMLFontStylesContext.cxx @@ -265,6 +265,7 @@ void XMLFontStyleContextFontFaceUri::handleEmbeddedFont( const OUString& url ) case osl::File::E_None: break; // ok case osl::File::E_EXIST: + GetImport().NotifyEmbeddedFontRead(); return; // Assume it's already been added correctly. default: SAL_WARN( "xmloff", "Cannot open file for temporary font" ); commit c4a8e6b62e80d79d98743af022b3d5e5d1f22f51 Author: Noel Power <noel.po...@suse.com> Date: Wed Feb 20 19:29:10 2013 +0000 clone documentfontsdialog from sw, add method to SfxDocumentInfoDialog add tab Change-Id: I9cfb4f65e27a73921ac7944376677c5ddecdf9a9 diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index adeefaf..08cfe00 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -2813,6 +2813,7 @@ SfxDocumentInfoDialog* ScDocShell::CreateDocumentInfoDialog( OSL_ENSURE(pFact, "ScAbstractFactory create fail!"); ::CreateTabPage ScDocStatPageCreate = pFact->GetTabPageCreatorFunc( RID_SCPAGE_STAT ); OSL_ENSURE(ScDocStatPageCreate, "Tabpage create fail!"); + pDlg->AddFontTabPage(); pDlg->AddTabPage( 42, ScGlobal::GetRscString( STR_DOC_STAT ), ScDocStatPageCreate, diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk index 032d7c4..f8024b1 100644 --- a/sfx2/Library_sfx.mk +++ b/sfx2/Library_sfx.mk @@ -157,6 +157,7 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\ sfx2/source/dialog/dinfdlg \ sfx2/source/dialog/dinfedt \ sfx2/source/dialog/dockwin \ + sfx2/source/dialog/documentfontsdialog \ sfx2/source/dialog/filedlghelper \ sfx2/source/dialog/filtergrouping \ sfx2/source/dialog/itemconnect \ diff --git a/sfx2/UI_sfx.mk b/sfx2/UI_sfx.mk index 6c02310..4b6466d 100644 --- a/sfx2/UI_sfx.mk +++ b/sfx2/UI_sfx.mk @@ -21,6 +21,7 @@ $(eval $(call gb_UI_add_uifiles,sfx,\ sfx2/uiconfig/ui/printeroptionsdialog \ sfx2/uiconfig/ui/securityinfopage \ sfx2/uiconfig/ui/singletabdialog \ + sfx2/uiconfig/ui/documentfontspage \ )) # vim: set noet sw=4 ts=4: diff --git a/sfx2/inc/sfx2/dinfdlg.hxx b/sfx2/inc/sfx2/dinfdlg.hxx index d365e5e..b90b548 100644 --- a/sfx2/inc/sfx2/dinfdlg.hxx +++ b/sfx2/inc/sfx2/dinfdlg.hxx @@ -310,6 +310,7 @@ protected: public: SfxDocumentInfoDialog( Window* pParent, const SfxItemSet& ); + void AddFontTabPage(); }; // class CustomPropertiesRemoveButton ------------------------------------ diff --git a/sfx2/source/dialog/dialog.hrc b/sfx2/source/dialog/dialog.hrc index 5cb1b35..243110f 100644 --- a/sfx2/source/dialog/dialog.hrc +++ b/sfx2/source/dialog/dialog.hrc @@ -68,6 +68,7 @@ #define SFX_PB_EDIT ( RC_DIALOG_BEGIN + 124 ) #define STR_STYLE_ELEMTLIST ( RC_DIALOG_BEGIN + 125 ) +#define STR_FONT_TABPAGE ( RC_DIALOG_BEGIN + 126 ) #endif // #ifndef _SFX_DIALOG_HRC diff --git a/sfx2/source/dialog/dialog.src b/sfx2/source/dialog/dialog.src index 27f50e0..6951af9 100644 --- a/sfx2/source/dialog/dialog.src +++ b/sfx2/source/dialog/dialog.src @@ -128,5 +128,10 @@ Image IMG_INFO }; }; +String STR_FONT_TABPAGE +{ + Text [ en-US ] = "Font" ; +}; + // ******************************************************************* EOF diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index 894072f..fee2348 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -61,6 +61,7 @@ #include <comphelper/storagehelper.hxx> #include <comphelper/string.hxx> +#include "documentfontsdialog.hxx" #include <sfx2/sfx.hrc> #include "dinfdlg.hrc" #include "../appl/app.hrc" @@ -75,6 +76,8 @@ using namespace ::com::sun::star::lang; using namespace ::com::sun::star::ui::dialogs; using namespace ::com::sun::star::uno; +const sal_uInt16 FONT_PAGE_ID = 99; + struct CustomProperty { ::rtl::OUString m_sName; @@ -1489,6 +1492,11 @@ void SfxDocumentInfoDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) ( (SfxDocumentPage&)rPage ).EnableUseUserData(); } +void SfxDocumentInfoDialog::AddFontTabPage() +{ + AddTabPage( FONT_PAGE_ID, SfxResId( STR_FONT_TABPAGE ).toString(), SfxDocumentFontsPage::Create, 0); +} + // class CustomPropertiesYesNoButton ------------------------------------- CustomPropertiesYesNoButton::CustomPropertiesYesNoButton( Window* pParent, const ResId& rResId ) : diff --git a/sfx2/source/dialog/documentfontsdialog.cxx b/sfx2/source/dialog/documentfontsdialog.cxx new file mode 100644 index 0000000..46094fb --- /dev/null +++ b/sfx2/source/dialog/documentfontsdialog.cxx @@ -0,0 +1,75 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include "documentfontsdialog.hxx" + +#include <objsh.hxx> + +using namespace ::com::sun::star; + +SfxTabPage* SfxDocumentFontsPage::Create( Window* parent, const SfxItemSet& set ) +{ + return new SfxDocumentFontsPage( parent, set ); +} + +SfxDocumentFontsPage::SfxDocumentFontsPage( Window* parent, const SfxItemSet& set ) + : SfxTabPage( parent, "DocumentFontsPage", "sfx/ui/documentfontspage.ui", set ) +{ + get( embedFontsCheckbox, "embedFonts" ); +} + +void SfxDocumentFontsPage::Reset( const SfxItemSet& ) +{ + bool bVal = false; + SfxObjectShell* pDocSh = SfxObjectShell::Current(); + 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; + } + catch( uno::Exception& ) + { + } + } + embedFontsCheckbox->Check( bVal ); +} + +sal_Bool SfxDocumentFontsPage::FillItemSet( SfxItemSet& ) +{ + bool bVal = embedFontsCheckbox->IsChecked(); + SfxObjectShell* pDocSh = SfxObjectShell::Current(); + 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->setPropertyValue("EmbedFonts", uno::makeAny( bVal ) ); + } + catch( uno::Exception& ) + { + } + } + return false; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/documentfontsdialog.hxx b/sfx2/source/inc/documentfontsdialog.hxx new file mode 100644 index 0000000..1f0c560 --- /dev/null +++ b/sfx2/source/inc/documentfontsdialog.hxx @@ -0,0 +1,44 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef SW_DOCUMENTFONTSDIALOG_HXX +#define SW_DOCUMENTFONTSDIALOG_HXX + +#include <sfx2/tabdlg.hxx> + +#include <vcl/fixed.hxx> +#include <svtools/stdctrl.hxx> + +/** + Tab page for document font settings in the document properties dialog. +*/ +class SfxDocumentFontsPage: public SfxTabPage +{ +public: + SfxDocumentFontsPage( Window* parent, const SfxItemSet& set ); + static SfxTabPage* Create( Window* parent, const SfxItemSet& set ); +protected: + virtual sal_Bool FillItemSet( SfxItemSet& set ); + virtual void Reset( const SfxItemSet& set ); +private: + CheckBox* embedFontsCheckbox; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/uiconfig/ui/documentfontspage.ui b/sfx2/uiconfig/ui/documentfontspage.ui new file mode 100644 index 0000000..0003f47 --- /dev/null +++ b/sfx2/uiconfig/ui/documentfontspage.ui @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<interface> + <!-- interface-requires gtk+ 3.0 --> + <object class="GtkGrid" id="DocumentFontsPage"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="row_spacing">12</property> + <property name="column_spacing">18</property> + <child> + <object class="GtkCheckButton" id="embedFonts"> + <property name="label" translatable="yes">_Embed fonts in the document</property> + <property name="use_action_appearance">False</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_action_appearance">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> + <property name="width">1</property> + <property name="height">1</property> + </packing> + </child> + </object> +</interface> commit 1d0f45ee2efb5dc8d3c40f33ba1494807c117729 Author: Noel Power <noel.po...@suse.com> Date: Wed Feb 20 17:27:32 2013 +0000 basic support for writing embedded fonts for calc docs diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 0663cb9..fa4ccc1 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 9ab1856..1a34e6d 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 a995d12..b034bbf 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 ca93674..0caca55 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 ff9bb374..0d76652 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 2d8201d..3b97f18 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 acb831d..8ac0dfb 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(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits