summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Power <noel.power@suse.com>2013-02-20 19:29:10 +0000
committerNoel Power <noel.power@suse.com>2013-02-21 13:02:58 +0000
commitc4a8e6b62e80d79d98743af022b3d5e5d1f22f51 (patch)
tree1a5eb02a003bd610db29e32b3b377a005460ca40
parent1d0f45ee2efb5dc8d3c40f33ba1494807c117729 (diff)
clone documentfontsdialog from sw, add method to SfxDocumentInfoDialog add tab
Change-Id: I9cfb4f65e27a73921ac7944376677c5ddecdf9a9
-rw-r--r--sc/source/ui/docshell/docsh.cxx1
-rw-r--r--sfx2/Library_sfx.mk1
-rw-r--r--sfx2/UI_sfx.mk1
-rw-r--r--sfx2/inc/sfx2/dinfdlg.hxx1
-rw-r--r--sfx2/source/dialog/dialog.hrc1
-rw-r--r--sfx2/source/dialog/dialog.src5
-rw-r--r--sfx2/source/dialog/dinfdlg.cxx8
-rw-r--r--sfx2/source/dialog/documentfontsdialog.cxx75
-rw-r--r--sfx2/source/inc/documentfontsdialog.hxx44
-rw-r--r--sfx2/uiconfig/ui/documentfontspage.ui29
10 files changed, 166 insertions, 0 deletions
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index adeefaf63c0e..08cfe0019f14 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 032d7c4e2f7f..f8024b1e7cf1 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 6c02310854d9..4b6466d1fc29 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 d365e5e91f0f..b90b548e27ef 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 5cb1b355bfbd..243110f64a10 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 27f50e0bfd08..6951af91128d 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 894072f6e87a..fee23481e897 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 000000000000..46094fbd4fd4
--- /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 000000000000..1f0c56038e0d
--- /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 000000000000..0003f477811e
--- /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>