[Libreoffice-commits] core.git: sw/inc sw/Library_swui.mk sw/source sw/uiconfig sw/UI_swriter.mk

Luboš Luňák l.lunak at suse.cz
Mon Feb 18 06:50:45 PST 2013


 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                 |    1 
 sw/source/ui/dialog/documentfontsdialog.cxx |   54 ++++++++++++++++++++++++++++
 sw/source/ui/dialog/swdlgfact.cxx           |    4 ++
 sw/source/ui/inc/documentfontsdialog.hxx    |   44 ++++++++++++++++++++++
 sw/uiconfig/swriter/ui/documentfontspage.ui |   29 +++++++++++++++
 9 files changed, 141 insertions(+)

New commits:
commit e0210c3ef0ed56a6b45934e2ecb5b42b99808199
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Mon Feb 18 15:45:51 2013 +0100

    UI option for embedding fonts in a Writer document (fdo#42195)
    
    File->Properties.
    
    Change-Id: I92757153c8815d17ea9f721a98b22b9088014f31

diff --git a/sw/Library_swui.mk b/sw/Library_swui.mk
index 771ddfa..4731533 100644
--- a/sw/Library_swui.mk
+++ b/sw/Library_swui.mk
@@ -78,6 +78,7 @@ $(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 d410de6..86e75e2 100644
--- a/sw/UI_swriter.mk
+++ b/sw/UI_swriter.mk
@@ -21,6 +21,7 @@ $(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 0653aaf..8a2b81d 100644
--- a/sw/inc/globals.hrc
+++ b/sw/inc/globals.hrc
@@ -30,6 +30,7 @@
 #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)
@@ -138,6 +139,7 @@
 #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 38f114f..9e1eff6 100644
--- a/sw/source/ui/app/app.src
+++ b/sw/source/ui/app/app.src
@@ -305,6 +305,11 @@ 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 f0fa5c3..b13e53d 100644
--- a/sw/source/ui/app/docsh2.cxx
+++ b/sw/source/ui/app/docsh2.cxx
@@ -141,6 +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->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
new file mode 100644
index 0000000..0ac99d5
--- /dev/null
+++ b/sw/source/ui/dialog/documentfontsdialog.cxx
@@ -0,0 +1,54 @@
+/* -*- 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 da55531..8dfeac0 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -47,6 +47,7 @@
 #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
@@ -1456,6 +1457,9 @@ 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
new file mode 100644
index 0000000..931b811
--- /dev/null
+++ b/sw/source/ui/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 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/uiconfig/swriter/ui/documentfontspage.ui b/sw/uiconfig/swriter/ui/documentfontspage.ui
new file mode 100644
index 0000000..0003f47
--- /dev/null
+++ b/sw/uiconfig/swriter/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>


More information about the Libreoffice-commits mailing list