[Libreoffice-commits] core.git: extras/source include/sfx2 sfx2/AllLangResTarget_sfx2.mk sfx2/source sfx2/uiconfig sfx2/UIConfig_sfx.mk svtools/source

Palenik Mihály palenik.mihaly at gmail.com
Fri Jul 11 08:06:06 PDT 2014


 extras/source/glade/libreoffice-catalog.xml.in |    3 
 include/sfx2/templateinfodlg.hxx               |    4 -
 sfx2/AllLangResTarget_sfx2.mk                  |    1 
 sfx2/UIConfig_sfx.mk                           |    3 
 sfx2/source/dialog/templateinfodlg.cxx         |   28 ++------
 sfx2/source/dialog/templateinfodlg.hrc         |   14 ----
 sfx2/source/dialog/templateinfodlg.src         |   28 --------
 sfx2/uiconfig/ui/templateinfodialog.ui         |   79 +++++++++++++++++++++++++
 svtools/source/contnr/DocumentInfoPreview.cxx  |    5 +
 9 files changed, 101 insertions(+), 64 deletions(-)

New commits:
commit bfdacadec9a6472826a23ef86d5ebe21794e1bf9
Author: Palenik Mihály <palenik.mihaly at gmail.com>
Date:   Fri Jul 11 09:05:53 2014 +0200

    Convert DLG_TEMPLATE_INFORMATION to .ui
    
    Change-Id: I66469c17a46c1157b8e3801c0dc2b252c569a4bd
    Reviewed-on: https://gerrit.libreoffice.org/10213
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in
index f8b74a7..5250a82 100644
--- a/extras/source/glade/libreoffice-catalog.xml.in
+++ b/extras/source/glade/libreoffice-catalog.xml.in
@@ -355,6 +355,9 @@
     <glade-widget-class title="SvtValueSet" name="svtlo-ValueSet"
                         generic-name="Set of Value Options" parent="GtkDrawingArea"
                         icon-name="widget-gtk-drawingarea"/>
+    <glade-widget-class title="Document Info Preview" name="svtlo-ODocumentInfoPreview"
+                        generic-name="Document Info Preview" parent="GtkDrawingArea"
+                        icon-name="widget-gtk-drawingarea"/>
     <glade-widget-class title="SvxColorValueSet" name="svxcorelo-SvxColorValueSet"
                         generic-name="Set of Value Options" parent="GtkDrawingArea"
                         icon-name="widget-gtk-drawingarea"/>
diff --git a/include/sfx2/templateinfodlg.hxx b/include/sfx2/templateinfodlg.hxx
index dd32e49..a38f981 100644
--- a/include/sfx2/templateinfodlg.hxx
+++ b/include/sfx2/templateinfodlg.hxx
@@ -12,6 +12,7 @@
 
 #include <vcl/dialog.hxx>
 #include <vcl/button.hxx>
+#include <vcl/layout.hxx>
 
 namespace svtools {
     class ODocumentInfoPreview;
@@ -36,7 +37,8 @@ protected:
 
 private:
 
-    PushButton maBtnClose;
+    PushButton*   mpBtnClose;
+    VclBox*      mpBox;
 
     Window *mpPreviewView;  // gets released when xWindows get destroyed (dont delete in constructor)
     svtools::ODocumentInfoPreview *mpInfoView;
diff --git a/sfx2/AllLangResTarget_sfx2.mk b/sfx2/AllLangResTarget_sfx2.mk
index 9d7b685..6513e1cb 100644
--- a/sfx2/AllLangResTarget_sfx2.mk
+++ b/sfx2/AllLangResTarget_sfx2.mk
@@ -46,7 +46,6 @@ $(eval $(call gb_SrsTarget_add_files,sfx/res,\
     sfx2/source/dialog/newstyle.src \
     sfx2/source/dialog/recfloat.src \
     sfx2/source/dialog/taskpane.src \
-    sfx2/source/dialog/templateinfodlg.src \
     sfx2/source/dialog/templdlg.src \
     sfx2/source/dialog/versdlg.src \
     sfx2/source/doc/doc.src \
diff --git a/sfx2/UIConfig_sfx.mk b/sfx2/UIConfig_sfx.mk
index 310d6e43..0713047 100644
--- a/sfx2/UIConfig_sfx.mk
+++ b/sfx2/UIConfig_sfx.mk
@@ -40,10 +40,11 @@ $(eval $(call gb_UIConfig_add_uifiles,sfx,\
 	sfx2/uiconfig/ui/securityinfopage \
 	sfx2/uiconfig/ui/singletabdialog \
 	sfx2/uiconfig/ui/startcenter \
+	sfx2/uiconfig/ui/templatedlg \
+	sfx2/uiconfig/ui/templateinfodialog \
 	sfx2/uiconfig/ui/versionsofdialog \
 	sfx2/uiconfig/ui/versioncommentdialog \
 	sfx2/uiconfig/ui/versionscmis \
-	sfx2/uiconfig/ui/templatedlg \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/sfx2/source/dialog/templateinfodlg.cxx b/sfx2/source/dialog/templateinfodlg.cxx
index 9437f33..45dcd78 100644
--- a/sfx2/source/dialog/templateinfodlg.cxx
+++ b/sfx2/source/dialog/templateinfodlg.cxx
@@ -24,10 +24,6 @@
 #include <com/sun/star/util/URLTransformer.hpp>
 #include <com/sun/star/util/XURLTransformer.hpp>
 
-#include "templateinfodlg.hrc"
-
-#define DLG_BORDER_SIZE 12
-
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::beans;
 using namespace ::com::sun::star::document;
@@ -37,34 +33,28 @@ using namespace ::com::sun::star::task;
 using namespace ::com::sun::star::util;
 
 SfxTemplateInfoDlg::SfxTemplateInfoDlg (Window *pParent)
-    : ModalDialog(pParent,SfxResId(DLG_TEMPLATE_INFORMATION)),
-      maBtnClose(this,SfxResId(BTN_TEMPLATE_INFO_CLOSE)),
-      mpPreviewView(new Window(this)),
-      mpInfoView(new svtools::ODocumentInfoPreview(this,WB_LEFT | WB_VSCROLL | WB_READONLY | WB_BORDER | WB_3DLOOK))
+    : ModalDialog(pParent, "TemplateInfo", "sfx/ui/templateinfodialog.ui")
 {
-    maBtnClose.SetClickHdl(LINK(this,SfxTemplateInfoDlg,CloseHdl));
+    get(mpBtnClose, "close");
+    get(mpBox, "box");
+    get(mpInfoView, "infoDrawingArea");
+    mpPreviewView = new Window(mpBox);
 
-    Size aWinSize = GetOutputSizePixel();
-    aWinSize.setHeight( aWinSize.getHeight() - 3*DLG_BORDER_SIZE - maBtnClose.GetOutputHeightPixel() );
-    aWinSize.setWidth( (aWinSize.getWidth() - 3*DLG_BORDER_SIZE)/2 );
-    mpInfoView->SetPosSizePixel(Point(DLG_BORDER_SIZE,DLG_BORDER_SIZE),aWinSize);
+    Size aSize(LogicToPixel(Size(250, 160), MAP_APPFONT));
+    mpBox->set_width_request(aSize.Width());
+    mpBox->set_height_request(aSize.Height());
 
-    mpPreviewView->SetPosSizePixel(Point(aWinSize.getWidth()+2*DLG_BORDER_SIZE,DLG_BORDER_SIZE),aWinSize);
+    mpBtnClose->SetClickHdl(LINK(this,SfxTemplateInfoDlg,CloseHdl));
 
     xWindow = VCLUnoHelper::GetInterface(mpPreviewView);
 
     m_xFrame = Frame::create( comphelper::getProcessComponentContext() );
     m_xFrame->initialize( xWindow );
-
-    mpPreviewView->Show();
-    mpInfoView->Show();
 }
 
 SfxTemplateInfoDlg::~SfxTemplateInfoDlg()
 {
     m_xFrame->dispose();
-
-    delete mpInfoView;
 }
 
 void SfxTemplateInfoDlg::loadDocument(const OUString &rURL)
diff --git a/sfx2/source/dialog/templateinfodlg.hrc b/sfx2/source/dialog/templateinfodlg.hrc
deleted file mode 100644
index 7d2fa6f..0000000
--- a/sfx2/source/dialog/templateinfodlg.hrc
+++ /dev/null
@@ -1,14 +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/.
- */
-
-#define DLG_TEMPLATE_INFORMATION        400
-
-#define BTN_TEMPLATE_INFO_CLOSE         11
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/dialog/templateinfodlg.src b/sfx2/source/dialog/templateinfodlg.src
deleted file mode 100644
index f012965..0000000
--- a/sfx2/source/dialog/templateinfodlg.src
+++ /dev/null
@@ -1,28 +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/.
- */
-
-#include "templateinfodlg.hrc"
-
-ModalDialog DLG_TEMPLATE_INFORMATION
-{
-    OutputSize = TRUE;
-    SVLook = TRUE;
-    Size = MAP_APPFONT( 250, 180 );
-    Moveable = TRUE;
-    Closeable = TRUE;
-
-    PushButton BTN_TEMPLATE_INFO_CLOSE
-    {
-        Pos = MAP_APPFONT( 194, 160 );
-        Size = MAP_APPFONT( 50, 14 );
-        Text [ en-US ] = "Close";
-    };
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/uiconfig/ui/templateinfodialog.ui b/sfx2/uiconfig/ui/templateinfodialog.ui
new file mode 100644
index 0000000..0ba4f9d
--- /dev/null
+++ b/sfx2/uiconfig/ui/templateinfodialog.ui
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <!-- interface-requires LibreOffice 1.0 -->
+  <object class="GtkDialog" id="TemplateInfo">
+    <property name="can_focus">False</property>
+    <property name="border_width">6</property>
+    <property name="type_hint">dialog</property>
+    <child internal-child="vbox">
+      <object class="GtkBox" id="dialog-vbox1">
+        <property name="can_focus">False</property>
+        <property name="hexpand">True</property>
+        <property name="vexpand">True</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">12</property>
+        <child internal-child="action_area">
+          <object class="GtkButtonBox" id="dialog-action_area1">
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="close">
+                <property name="label" translatable="yes">_Close</property>
+                <property name="use_action_appearance">False</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="has_default">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_underline">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkBox" id="box">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="hexpand">True</property>
+            <property name="vexpand">True</property>
+            <property name="spacing">6</property>
+            <property name="homogeneous">True</property>
+            <child>
+              <object class="svtlo-ODocumentInfoPreview" id="infoDrawingArea">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="hexpand">True</property>
+                <property name="vexpand">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="0">close</action-widget>
+    </action-widgets>
+  </object>
+</interface>
diff --git a/svtools/source/contnr/DocumentInfoPreview.cxx b/svtools/source/contnr/DocumentInfoPreview.cxx
index 4481b50..5a4e154 100644
--- a/svtools/source/contnr/DocumentInfoPreview.cxx
+++ b/svtools/source/contnr/DocumentInfoPreview.cxx
@@ -54,6 +54,11 @@ ODocumentInfoPreview::ODocumentInfoPreview(Window * pParent, WinBits nBits):
 
 ODocumentInfoPreview::~ODocumentInfoPreview() {}
 
+extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeODocumentInfoPreview(Window *pParent, VclBuilder::stringmap)
+{
+    return new ODocumentInfoPreview(pParent, WB_BORDER | WB_READONLY);
+}
+
 void ODocumentInfoPreview::Resize() {
     m_pEditWin.SetPosSizePixel(Point(0, 0), GetOutputSize());
 }


More information about the Libreoffice-commits mailing list