[Libreoffice-commits] core.git: include/sfx2 sd/source sfx2/source sfx2/uiconfig

Akshay Deep akshaydeepiitr at gmail.com
Mon Jun 6 09:52:54 UTC 2016


 include/sfx2/templatedlg.hxx    |    3 +++
 sd/source/ui/app/sdmod1.cxx     |    3 +++
 sfx2/source/doc/doc.hrc         |    1 +
 sfx2/source/doc/doc.src         |    4 ++++
 sfx2/source/doc/templatedlg.cxx |   21 ++++++++++++++++++++-
 sfx2/uiconfig/ui/templatedlg.ui |   18 ++++++++++++++++--
 6 files changed, 47 insertions(+), 3 deletions(-)

New commits:
commit ecece54942a8e5f20ae6dc69f25a2499d38c78bd
Author: Akshay Deep <akshaydeepiitr at gmail.com>
Date:   Sun Jun 5 05:38:13 2016 +0530

    Improve Impress Template Selection Dialog
    
    1. Hide controls: export, move, action menu, repository menu, Online Button
    2. Checkbox to easily hide the dialog
    
    Change-Id: Id2899edb9ba280c9a714d09fa534f975600b05af
    Reviewed-on: https://gerrit.libreoffice.org/25913
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
    Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>

diff --git a/include/sfx2/templatedlg.hxx b/include/sfx2/templatedlg.hxx
index 9dadcf8..3affc1b 100644
--- a/include/sfx2/templatedlg.hxx
+++ b/include/sfx2/templatedlg.hxx
@@ -149,6 +149,7 @@ protected:
     VclPtr<PushButton> mpExportButton;
     VclPtr<PushButton> mpImportButton;
     VclPtr<PushButton> mpLinkButton;
+    VclPtr<CheckBox> mpCBXHideDlg;
     VclPtr<ToolBox> mpActionBar;
     VclPtr<TemplateSearchView> mpSearchView;
     VclPtr<TemplateAbstractView> mpCurView;
@@ -222,9 +223,11 @@ public:
     virtual short Execute() override;
 
     inline OUString const & getTemplatePath() const { return msTemplatePath; };
+    inline bool IsStartWithTemplate() const { return mpCBXHideDlg->IsChecked(); };
 
 private:
     DECL_LINK_TYPED(OpenTemplateHdl, ThumbnailViewItem*, void);
+    DECL_LINK_TYPED(OkClickHdl, Button*, void);
 
     OUString   msTemplatePath;
 };
diff --git a/sd/source/ui/app/sdmod1.cxx b/sd/source/ui/app/sdmod1.cxx
index 2bb372a..1e5dab9 100644
--- a/sd/source/ui/app/sdmod1.cxx
+++ b/sd/source/ui/app/sdmod1.cxx
@@ -559,6 +559,9 @@ SfxFrame* SdModule::ExecuteNewDocument( SfxRequest& rReq )
             ScopedVclPtrInstance< SfxTemplateSelectionDlg > aTemplDlg;
             aTemplDlg->Execute();
 
+            //check to disable the dialog
+            pOpt->SetStartWithTemplate( aTemplDlg->IsStartWithTemplate() );
+
             //pFrame is loaded with the desired template
             if(!aTemplDlg->getTemplatePath().isEmpty())
                 pFrame = CreateFromTemplate(aTemplDlg->getTemplatePath(), xTargetFrame);
diff --git a/sfx2/source/doc/doc.hrc b/sfx2/source/doc/doc.hrc
index 10877ab..c802ccc 100644
--- a/sfx2/source/doc/doc.hrc
+++ b/sfx2/source/doc/doc.hrc
@@ -123,6 +123,7 @@
 #define STR_CREATE_ERROR                    (RID_SFX_DOC_START+103)
 #define STR_ERROR_SAVEAS                    (RID_SFX_DOC_START+105)
 #define STR_CATEGORY_RENAME                 (RID_SFX_DOC_START+109)
+#define STR_TEMPLATE_SELECTION              (RID_SFX_DOC_START+120)
 
 // please update to the last id
 #define ACT_SFX_DOC_END IMG_ACTION_REFRESH
diff --git a/sfx2/source/doc/doc.src b/sfx2/source/doc/doc.src
index ed7f8db..84c9456 100644
--- a/sfx2/source/doc/doc.src
+++ b/sfx2/source/doc/doc.src
@@ -80,6 +80,10 @@ String STR_RENAME_TEMPLATE
 {
     Text [ en-US ] = "Enter New Name: " ;
 };
+String STR_TEMPLATE_SELECTION
+{
+    Text [ en-US ] = "Select a Template" ;
+};
 String STR_AUTOMATICVERSION
 {
     Text [ en-US ] = "Automatically saved version" ;
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index db75aa7..9ba3b7c 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -179,6 +179,7 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg(vcl::Window *parent)
     get(mpExportButton, "export_btn");
     get(mpImportButton, "import_btn");
     get(mpLinkButton, "online_link");
+    get(mpCBXHideDlg, "hidedialogcb");
 
     // Create popup menus
     mpActionMenu = new PopupMenu;
@@ -326,6 +327,7 @@ void SfxTemplateManagerDlg::dispose()
     mpExportButton.clear();
     mpImportButton.clear();
     mpLinkButton.clear();
+    mpCBXHideDlg.clear();
     mpSearchFilter.clear();
     mpCBApp.clear();
     mpCBFolder.clear();
@@ -1646,8 +1648,8 @@ SfxTemplateSelectionDlg::SfxTemplateSelectionDlg(vcl::Window* pParent):
     msTemplatePath(OUString())
 {
     mpCBApp->SelectEntryPos(MNI_IMPRESS);
-    mpCBApp->Disable();
     mpCBFolder->SelectEntryPos(0);
+    SetText(SfxResId(STR_TEMPLATE_SELECTION).toString());
 
     if(mpLocalView->IsVisible())
     {
@@ -1655,8 +1657,17 @@ SfxTemplateSelectionDlg::SfxTemplateSelectionDlg(vcl::Window* pParent):
         mpLocalView->showAllTemplates();
     }
 
+    mpCBApp->Disable();
+    mpActionBar->Hide();
+    mpLinkButton->Hide();
+    mpMoveButton->Hide();
+    mpExportButton->Hide();
+    mpCBXHideDlg->Show();
+    mpCBXHideDlg->Check(true);
+
     mpLocalView->setOpenTemplateHdl(LINK(this,SfxTemplateSelectionDlg, OpenTemplateHdl));
     mpSearchView->setOpenTemplateHdl(LINK(this,SfxTemplateSelectionDlg, OpenTemplateHdl));
+    mpOKButton->SetClickHdl(LINK(this, SfxTemplateSelectionDlg, OkClickHdl));
 }
 
 SfxTemplateSelectionDlg::~SfxTemplateSelectionDlg()
@@ -1682,4 +1693,12 @@ IMPL_LINK_TYPED(SfxTemplateSelectionDlg, OpenTemplateHdl, ThumbnailViewItem*, pI
     EndDialog(RET_OK);
 }
 
+IMPL_LINK_NOARG_TYPED(SfxTemplateSelectionDlg, OkClickHdl, Button*, void)
+{
+   TemplateViewItem *pViewItem = static_cast<TemplateViewItem*>(const_cast<ThumbnailViewItem*>(*maSelTemplates.begin()));
+   msTemplatePath = pViewItem->getPath();
+
+   EndDialog(RET_OK);
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/uiconfig/ui/templatedlg.ui b/sfx2/uiconfig/ui/templatedlg.ui
index ca7134e..4c7bdf0 100644
--- a/sfx2/uiconfig/ui/templatedlg.ui
+++ b/sfx2/uiconfig/ui/templatedlg.ui
@@ -330,7 +330,7 @@
                       <packing>
                         <property name="expand">False</property>
                         <property name="fill">True</property>
-                        <property name="position">1</property>
+                        <property name="position">0</property>
                       </packing>
                     </child>
                     <child>
@@ -347,7 +347,21 @@
                       <packing>
                         <property name="expand">False</property>
                         <property name="fill">True</property>
-                        <property name="position">2</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkCheckButton" id="hidedialogcb">
+                        <property name="label" translatable="yes">Show this dialog at startup</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</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">3</property>
                       </packing>
                     </child>
                   </object>


More information about the Libreoffice-commits mailing list