[Libreoffice-commits] core.git: cui/source include/sfx2 sc/source sd/source sfx2/source sw/source

Caolán McNamara caolanm at redhat.com
Thu Nov 23 20:27:52 UTC 2017


 cui/source/tabpages/backgrnd.cxx   |    2 +-
 include/sfx2/opengrf.hxx           |    6 ++++++
 sc/source/ui/drawfunc/fuins1.cxx   |    2 +-
 sd/source/ui/func/fuinsert.cxx     |    2 +-
 sfx2/source/appl/fileobj.cxx       |    2 +-
 sfx2/source/appl/opengrf.cxx       |   23 +++++++++++++++++------
 sw/source/uibase/shells/drawsh.cxx |    2 +-
 7 files changed, 28 insertions(+), 11 deletions(-)

New commits:
commit 8c9a3195068bf00e00290f363d5028e9986bbba6
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Nov 23 16:52:23 2017 +0000

    Resolves: tdf#113962 save detected filter outside file dialog
    
    different file dialog impls work differently so store the
    detected filter outside the file dialog
    
    Change-Id: I144d8df06e5265fed8f11b284a2f40c17c3e09ef
    Reviewed-on: https://gerrit.libreoffice.org/45166
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/cui/source/tabpages/backgrnd.cxx b/cui/source/tabpages/backgrnd.cxx
index 1c2afbed0409..8101b930242c 100644
--- a/cui/source/tabpages/backgrnd.cxx
+++ b/cui/source/tabpages/backgrnd.cxx
@@ -1178,7 +1178,7 @@ IMPL_LINK( SvxBackgroundTabPage, LoadIdleHdl_Impl, Timer*, pIdle, void )
             {
                 // new file chosen
                 aBgdGraphicPath   = pImportDlg->GetPath();
-                aBgdGraphicFilter = pImportDlg->GetCurrentFilter();
+                aBgdGraphicFilter = pImportDlg->GetDetectedFilter();
                 bool bLink = ( nHtmlMode & HTMLMODE_ON ) || pImportDlg->IsAsLink();
                 m_pBtnLink->Check( bLink );
                 m_pBtnLink->Enable();
diff --git a/include/sfx2/opengrf.hxx b/include/sfx2/opengrf.hxx
index 498ccdb7f9a8..fbf3c573e15f 100644
--- a/include/sfx2/opengrf.hxx
+++ b/include/sfx2/opengrf.hxx
@@ -42,8 +42,14 @@ public:
     void                    AsLink(bool);
     bool                    IsAsLink() const;
 
+    //what the dialog thought the format was
     OUString                GetCurrentFilter() const;
     void                    SetCurrentFilter(const OUString&);
+
+    //what was subsequently found to be the format
+    OUString                GetDetectedFilter() const;
+    void                    SetDetectedFilter(const OUString&);
+
 private:
     SvxOpenGraphicDialog    (const SvxOpenGraphicDialog&) = delete;
     SvxOpenGraphicDialog& operator = ( const SvxOpenGraphicDialog & ) = delete;
diff --git a/sc/source/ui/drawfunc/fuins1.cxx b/sc/source/ui/drawfunc/fuins1.cxx
index 310da9e53afe..f7f99bc6bd56 100644
--- a/sc/source/ui/drawfunc/fuins1.cxx
+++ b/sc/source/ui/drawfunc/fuins1.cxx
@@ -264,7 +264,7 @@ FuInsertGraphic::FuInsertGraphic( ScTabViewShell*   pViewSh,
             if( nError == ERRCODE_NONE )
             {
                 OUString aFileName = aDlg.GetPath();
-                OUString aFilterName = aDlg.GetCurrentFilter();
+                OUString aFilterName = aDlg.GetDetectedFilter();
                 bool bAsLink = aDlg.IsAsLink();
 
                 // really store as link only?
diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx
index 97fdea1f5768..e0ad64bd7169 100644
--- a/sd/source/ui/func/fuinsert.cxx
+++ b/sd/source/ui/func/fuinsert.cxx
@@ -148,7 +148,7 @@ void FuInsertGraphic::DoExecute( SfxRequest& rReq )
         nError = aDlg.GetGraphic(aGraphic);
         bAsLink = aDlg.IsAsLink();
         aFileName = aDlg.GetPath();
-        aFilterName = aDlg.GetCurrentFilter();
+        aFilterName = aDlg.GetDetectedFilter();
     }
 
     if( nError == ERRCODE_NONE )
diff --git a/sfx2/source/appl/fileobj.cxx b/sfx2/source/appl/fileobj.cxx
index bb71b5ddc413..46c860e2fcbe 100644
--- a/sfx2/source/appl/fileobj.cxx
+++ b/sfx2/source/appl/fileobj.cxx
@@ -413,7 +413,7 @@ void SvFileObject::Edit(vcl::Window* pParent, sfx2::SvBaseLink* pLink, const Lin
                     sFile = aDlg.GetPath()
                         + OUStringLiteral1(sfx2::cTokenSeparator)
                         + OUStringLiteral1(sfx2::cTokenSeparator)
-                        + aDlg.GetCurrentFilter();
+                        + aDlg.GetDetectedFilter();
 
                     aEndEditLink.Call( sFile );
                 }
diff --git a/sfx2/source/appl/opengrf.cxx b/sfx2/source/appl/opengrf.cxx
index 0bb827edd1fc..9407c88dd96c 100644
--- a/sfx2/source/appl/opengrf.cxx
+++ b/sfx2/source/appl/opengrf.cxx
@@ -73,6 +73,7 @@ struct SvxOpenGrf_Impl
     SvxOpenGrf_Impl(const vcl::Window* pPreferredParent);
 
     sfx2::FileDialogHelper                  aFileDlg;
+    OUString sDetectedFilter;
     uno::Reference < XFilePickerControlAccess > xCtrlAcc;
 };
 
@@ -153,11 +154,15 @@ ErrCode SvxOpenGraphicDialog::Execute()
             }
             else
             {
-                // setup appropriate filter (so next time, it will work)
                 if( rFilter.GetImportFormatCount() )
                 {
-                    OUString  aFormatName(rFilter.GetImportFormatName(nFound));
-                    SetCurrentFilter(aFormatName);
+                    // store detected appropriate filter
+                    OUString aFormatName(rFilter.GetImportFormatName(nFound));
+                    SetDetectedFilter(aFormatName);
+                }
+                else
+                {
+                    SetDetectedFilter(mpImpl->aFileDlg.GetCurrentFilter());
                 }
 
                 return nImpRet;
@@ -234,28 +239,34 @@ bool SvxOpenGraphicDialog::IsAsLink() const
     return false;
 }
 
-
 ErrCode SvxOpenGraphicDialog::GetGraphic(Graphic& rGraphic) const
 {
     return mpImpl->aFileDlg.GetGraphic(rGraphic);
 }
 
-
 OUString SvxOpenGraphicDialog::GetPath() const
 {
     return mpImpl->aFileDlg.GetPath();
 }
 
-
 OUString SvxOpenGraphicDialog::GetCurrentFilter() const
 {
     return mpImpl->aFileDlg.GetCurrentFilter();
 }
 
+OUString SvxOpenGraphicDialog::GetDetectedFilter() const
+{
+    return mpImpl->sDetectedFilter;
+}
 
 void SvxOpenGraphicDialog::SetCurrentFilter(const OUString& rStr)
 {
     mpImpl->aFileDlg.SetCurrentFilter(rStr);
 }
 
+void SvxOpenGraphicDialog::SetDetectedFilter(const OUString& rStr)
+{
+    mpImpl->sDetectedFilter = rStr;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/shells/drawsh.cxx b/sw/source/uibase/shells/drawsh.cxx
index 5b3ecc18b3d3..f41ced6a011a 100644
--- a/sw/source/uibase/shells/drawsh.cxx
+++ b/sw/source/uibase/shells/drawsh.cxx
@@ -158,7 +158,7 @@ void SwDrawShell::InsertPictureFromFile(SdrObject& rObject)
                     pNewGrafObj->SetGraphicLink(
                         bAsLink ? aDlg.GetPath() : OUString(),
                         aReferer,
-                        bAsLink ? aDlg.GetCurrentFilter() : OUString());
+                        bAsLink ? aDlg.GetDetectedFilter() : OUString());
 
                     pResult = pNewGrafObj;
                 }


More information about the Libreoffice-commits mailing list