[Libreoffice-commits] core.git: sfx2/inc sfx2/source

Jacobo Aragunde Pérez jaragunde at igalia.com
Mon Apr 13 02:09:03 PDT 2015


 sfx2/inc/guisaveas.hxx           |    3 ++-
 sfx2/source/dialog/alienwarn.cxx |   13 +++++++++++--
 sfx2/source/doc/guisaveas.cxx    |    8 +++++---
 sfx2/source/inc/alienwarn.hxx    |    3 ++-
 4 files changed, 20 insertions(+), 7 deletions(-)

New commits:
commit 5c308ad7696f3873c0747afef1ea143047e4eafb
Author: Jacobo Aragunde Pérez <jaragunde at igalia.com>
Date:   Fri Apr 10 18:52:33 2015 +0200

    tdf#90478: Hide explanation on ODF when default format is alien
    
    When saving a file that is not in ODF format (the default format), there
    is a dialog asking if should keep the original format or rather use ODF.
    
    But the default format can be changed to a different one than ODF, and
    the dialog will let users choose between saving in the default format
    or the one they chose in the save as dialog.
    
    In this case, the explanation about ODF shown in the dialog is
    pointless, so this commit hides it.
    
    Change-Id: I91cf95d35b70cb46e7667025a4a649b390205f0b
    Reviewed-on: https://gerrit.libreoffice.org/15234
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Jacobo Aragunde Pérez <jaragunde at igalia.com>

diff --git a/sfx2/inc/guisaveas.hxx b/sfx2/inc/guisaveas.hxx
index 19bfb51..914094b 100644
--- a/sfx2/inc/guisaveas.hxx
+++ b/sfx2/inc/guisaveas.hxx
@@ -81,7 +81,8 @@ public:
                                     const OUString& aOldUIName,
                                     const OUString& aDefUIName,
                                     const OUString& aDefExtension,
-                                    bool bCanProceedFurther );
+                                    bool bCanProceedFurther,
+                                    bool rDefaultIsAlien );
 
     static vcl::Window* GetModelWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel );
 
diff --git a/sfx2/source/dialog/alienwarn.cxx b/sfx2/source/dialog/alienwarn.cxx
index e6c8234..09f59c1 100644
--- a/sfx2/source/dialog/alienwarn.cxx
+++ b/sfx2/source/dialog/alienwarn.cxx
@@ -25,7 +25,8 @@
 #include <vcl/msgbox.hxx>
 #include "alienwarn.hxx"
 
-SfxAlienWarningDialog::SfxAlienWarningDialog(vcl::Window* pParent, const OUString& _rFormatName, const OUString& _rDefaultExtension)
+SfxAlienWarningDialog::SfxAlienWarningDialog(vcl::Window* pParent, const OUString& _rFormatName,
+                                             const OUString& _rDefaultExtension, bool rDefaultIsAlien)
     : MessageDialog(pParent, "AlienWarnDialog", "sfx/ui/alienwarndialog.ui")
 {
     get(m_pWarningOnBox, "ask");
@@ -36,7 +37,7 @@ SfxAlienWarningDialog::SfxAlienWarningDialog(vcl::Window* pParent, const OUStrin
     get(m_pKeepCurrentBtn, "save");
     get(m_pUseDefaultFormatBtn, "cancel");
 
-    OUString aExtension = _rDefaultExtension.toAsciiUpperCase();
+    OUString aExtension = "ODF";
 
     // replace formatname (text)
     OUString sInfoText = get_primary_text();
@@ -48,6 +49,14 @@ SfxAlienWarningDialog::SfxAlienWarningDialog(vcl::Window* pParent, const OUStrin
     sInfoText = sInfoText.replaceAll( "%FORMATNAME", _rFormatName );
     m_pKeepCurrentBtn->SetText( sInfoText );
 
+    // hide ODF explanation if default format is alien
+    // and set the proper extension in the button
+    if( rDefaultIsAlien )
+    {
+        set_secondary_text(OUString());
+        aExtension = _rDefaultExtension.toAsciiUpperCase();
+    }
+
     // replace defaultextension (button)
     sInfoText = m_pUseDefaultFormatBtn->GetText();
     sInfoText = sInfoText.replaceAll( "%DEFAULTEXTENSION", aExtension );
diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index 1251942..3dc833c 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -833,7 +833,8 @@ sal_Int8 ModelData_Impl::CheckFilter( const OUString& aFilterName )
                         return STATUS_SAVEAS;
                 }
             }
-            if ( !SfxStoringHelper::WarnUnacceptableFormat( GetModel(), aUIName, aDefUIName, aDefExtension, true ) )
+            if ( !SfxStoringHelper::WarnUnacceptableFormat( GetModel(), aUIName, aDefUIName, aDefExtension,
+                                                            true, (bool)( nDefFiltFlags & SfxFilterFlags::ALIEN ) ) )
                 return STATUS_SAVEAS_STANDARDNAME;
         }
     }
@@ -1875,13 +1876,14 @@ bool SfxStoringHelper::WarnUnacceptableFormat( const uno::Reference< frame::XMod
                                                     const OUString& aOldUIName,
                                                     const OUString& /*aDefUIName*/,
                                                     const OUString& aDefExtension,
-                                                    bool /*bCanProceedFurther*/ )
+                                                    bool /*bCanProceedFurther*/,
+                                                    bool bDefIsAlien )
 {
     if ( !SvtSaveOptions().IsWarnAlienFormat() )
         return true;
 
     vcl::Window* pWin = SfxStoringHelper::GetModelWindow( xModel );
-    SfxAlienWarningDialog aDlg( pWin, aOldUIName, aDefExtension );
+    SfxAlienWarningDialog aDlg( pWin, aOldUIName, aDefExtension, bDefIsAlien );
 
     return aDlg.Execute() == RET_OK;
 }
diff --git a/sfx2/source/inc/alienwarn.hxx b/sfx2/source/inc/alienwarn.hxx
index f2f4552..7e812d2 100644
--- a/sfx2/source/inc/alienwarn.hxx
+++ b/sfx2/source/inc/alienwarn.hxx
@@ -30,7 +30,8 @@ private:
     CheckBox*               m_pWarningOnBox;
 
 public:
-    SfxAlienWarningDialog(vcl::Window* pParent, const OUString& _rFormatName, const OUString& _rDefaultExtension);
+    SfxAlienWarningDialog(vcl::Window* pParent, const OUString& _rFormatName,
+                          const OUString& _rDefaultExtension, bool rDefaultIsAlien);
     virtual ~SfxAlienWarningDialog();
 };
 


More information about the Libreoffice-commits mailing list