[Libreoffice-commits] core.git: Branch 'feature/dialog-screenshots' - 2 commits - sc/qa sc/source

Katarina Behrens Katarina.Behrens at cib.de
Wed Jun 29 10:52:05 UTC 2016


 sc/qa/unit/screenshots/screenshots.cxx |   46 +++++++++++++++++++++++++++++++--
 sc/source/ui/attrdlg/scdlgfact.hxx     |   10 +++++++
 2 files changed, 54 insertions(+), 2 deletions(-)

New commits:
commit 6d0683068981f3f0d9c69a647ab31062351b5238
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Wed Jun 29 12:49:58 2016 +0200

    Support creating screenshots of tab dialogs
    
    try that with ScAttrDlg first
    
    Change-Id: Id84f5940ca3de9788446f2e513fa3991f31a2d5a

diff --git a/sc/qa/unit/screenshots/screenshots.cxx b/sc/qa/unit/screenshots/screenshots.cxx
index 68d2814..46a5af2 100644
--- a/sc/qa/unit/screenshots/screenshots.cxx
+++ b/sc/qa/unit/screenshots/screenshots.cxx
@@ -24,6 +24,7 @@
 #include <sfx2/dispatch.hxx>
 #include <sfx2/viewfrm.hxx>
 #include <svl/srchitem.hxx>
+#include <svx/numinf.hxx>
 #include <vcl/pngwrite.hxx>
 
 #include <tabvwsh.hxx>
@@ -36,6 +37,7 @@
 #include <reffact.hxx>
 #include <scui_def.hxx>
 #include <impex.hxx>
+#include <patattr.hxx>
 
 #include <sc.hrc>
 #include <scresid.hxx>
@@ -98,6 +100,7 @@ private:
     ScAbstractDialogFactory* pFact;
 
     std::unique_ptr<ScImportStringStream> pStream;
+    std::unique_ptr<SfxItemSet> pItemSet;
 };
 
 ScScreenshotTest::ScScreenshotTest()
@@ -250,6 +253,26 @@ VclAbstractDialog* ScScreenshotTest::createDialogByID( sal_uInt32 nID )
             pReturnDialog = pFact->CreateScImportAsciiDlg( OUString(), pStream.get(), SC_PASTETEXT );
             break;
         }
+        case 14:
+        {
+            ScViewData& rViewData = pViewShell->GetViewData();
+            ScDocument *pDoc = rViewData.GetDocument();
+
+            const ScPatternAttr *pAttr = pViewShell->GetSelectionPattern();
+            std::unique_ptr<SvxNumberInfoItem> pNumberInfoItem;
+
+            pItemSet.reset( new SfxItemSet( pAttr->GetItemSet() ) );
+            pItemSet->Put( SfxUInt32Item( ATTR_VALUE_FORMAT,
+                           pAttr->GetNumberFormat( pDoc->GetFormatTable() ) ) );
+
+            pNumberInfoItem.reset( pViewShell->MakeNumberInfoItem(pDoc, &rViewData) );
+
+            pItemSet->MergeRange( SID_ATTR_NUMBERFORMAT_INFO, SID_ATTR_NUMBERFORMAT_INFO );
+            pItemSet->Put(*pNumberInfoItem );
+
+            pReturnDialog = pFact->CreateScAttrDlg( pViewShell->GetDialogParent(), pItemSet.get() );
+            break;
+        }
            //ScopedVclPtrInstance<ScShareDocumentDlg> pDlg14( pViewShell->GetDialogParent(), &rViewData );
             //ScopedVclPtrInstance<ScTableProtectionDlg> pDlg16(pViewShell->GetDialogParent());
         default:
@@ -286,14 +309,33 @@ void ScScreenshotTest::saveScreenshot( VclAbstractDialog& rDialog )
 
 void ScScreenshotTest::dumpDialogToPath( VclAbstractDialog& rDialog )
 {
-    saveScreenshot( rDialog );
+   const std::vector<OString> aPageDescriptions(rDialog.getAllPageUIXMLDescriptions());
+
+   if (aPageDescriptions.size())
+   {
+      for (sal_uInt32 a(0); a < aPageDescriptions.size(); a++)
+      {
+          if (rDialog.selectPageByUIXMLDescription(aPageDescriptions[a]))
+          {
+              saveScreenshot( rDialog );
+          }
+          else
+          {
+              CPPUNIT_ASSERT(false);
+          }
+      }
+   }
+   else
+   {
+      saveScreenshot( rDialog );
+   }
 }
 
 void ScScreenshotTest::testOpeningModalDialogs()
 {
     initializeWithDoc("empty.ods");
 
-    const sal_uInt32 nDialogs = 14;
+    const sal_uInt32 nDialogs = 15;
 
     for ( sal_uInt32 i = 0; i < nDialogs; i++ )
     {
commit 4c407b625f82ec64ceed729e59ca284a1e5a65d3
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Wed Jun 29 12:46:48 2016 +0200

    sc dialog factory screenshot interface also for tab dialogs
    
    Change-Id: Ia1f67a161cfadbf2b71d3647c50e1c0a4b24ae8d

diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx
index 159eafc..19cc0f3 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -65,6 +65,8 @@ public:                                             \
                      {}                             \
     virtual         ~Class();                       \
     virtual short   Execute() override ;            \
+    std::vector<OString> getAllPageUIXMLDescriptions() const; \
+    bool selectPageByUIXMLDescription(const OString& rUIXMLDescription) override; \
     virtual Bitmap  createScreenshot() const override; \
     virtual OString GetScreenshotId() const; \
 
@@ -86,6 +88,14 @@ short Class::Execute()                              \
 {                                                   \
     return pDlg->Execute();                         \
 }                                                   \
+std::vector<OString> Class::getAllPageUIXMLDescriptions() const \
+{                                                   \
+    return pDlg->getAllPageUIXMLDescriptions();     \
+}                                                   \
+bool Class::selectPageByUIXMLDescription(const OString& rUIXMLDescription) \
+{                                                   \
+   return pDlg->selectPageByUIXMLDescription(rUIXMLDescription);  \
+}                                                   \
 Bitmap Class::createScreenshot() const              \
 {                                                   \
     return pDlg->createScreenshot();                \


More information about the Libreoffice-commits mailing list