[Libreoffice-commits] core.git: Branch 'feature/screenshotannotation' - 2 commits - cui/source

Katarina Behrens Katarina.Behrens at cib.de
Mon Oct 24 20:08:00 UTC 2016


Rebased ref, commits from common ancestor:
commit 7e1ddc5b7c07c3b9d2c5528954355362ce3391f1
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Mon Oct 24 21:58:38 2016 +0200

    screenshot annotation: More readable markup
    
    this should placate clang too
    
    Change-Id: Ida2cceebd5870b5896fb125e51e4cb67ad253d92

diff --git a/cui/source/dialogs/screenshotannotationdlg.cxx b/cui/source/dialogs/screenshotannotationdlg.cxx
index 53a0cc9..cd0591d 100644
--- a/cui/source/dialogs/screenshotannotationdlg.cxx
+++ b/cui/source/dialogs/screenshotannotationdlg.cxx
@@ -54,38 +54,45 @@ namespace
 
     OUString lcl_AltDescr()
     {
-        OUString aRet = OUString("<alt xml-lang=en-US ") + OUString("id=") + lcl_genRandom("alt_id") + OUString(">") +
-                        OUString(" ") + //FIXME real dialog title or something
-                        OUString("</alt>");
-        return aRet;
+        OUString aTempl = OUString("<alt xml-lang=en-US id=%1>"
+                                   " " //FIXME real dialog title or something
+                                  "</alt>");
+        aTempl = aTempl.replaceFirst( "%1", lcl_genRandom("alt_id") );
+
+        return aTempl;
     }
 
     OUString lcl_Image( const OUString& rScreenshotId )
     {
-        OUString aRet = OUString("<image id=") + lcl_genRandom( "img_id" ) +
-                        OUString(" src=media/screenshots/") + rScreenshotId + OUString(".png")
-                        + OUString(">") + //FIXME width + height
-                        lcl_AltDescr() +
-                        OUString("</image>");
-        return aRet;
+        OUString aTempl = OUString("<image id=%1 src=media/screenshots/%2.png>" //FIXME width + height
+                                    "%3"
+                                   "</image>");
+        aTempl = aTempl.replaceFirst( "%1", lcl_genRandom("img_id") );
+        aTempl = aTempl.replaceFirst( "%2", rScreenshotId );
+        aTempl = aTempl.replaceFirst( "%3", lcl_AltDescr() );
+
+        return aTempl;
     }
 
     OUString lcl_ParagraphWithImage( const OUString& rScreenshotId )
     {
-        OUString aRet = OUString("<paragraph id=") + lcl_genRandom( "par_id" ) +
-                        OUString(" role=\"paragraph\" xml-lang=en-US>") +
-                        lcl_Image( rScreenshotId ) +
-                        OUString("</paragraph>");
-        return aRet;
+        OUString aTempl = OUString( "<paragraph id=%1 role=\"paragraph\" xml-lang=en-US>%2"
+                                    "</paragraph>"  SAL_NEWLINE_STRING );
+        aTempl = aTempl.replaceFirst( "%1", lcl_genRandom("par_id") );
+        aTempl = aTempl.replaceFirst( "%2", lcl_Image(rScreenshotId) );
+
+        return aTempl;
     }
 
     OUString lcl_Bookmark( const OUString& rWidgetId )
     {
-        OUString aRet = "<!-- Bookmark for widget " + rWidgetId + " -->"  + SAL_NEWLINE_STRING;
-        aRet += OUString("<bookmark xml-lang=en-US branch=hid/") + rWidgetId + OUString(" ") +
-                        lcl_genRandom( "bm_id" ) + OUString(" localize=false") +
-                        OUString("</bookmark>") + SAL_NEWLINE_STRING;
-        return aRet;
+        OUString aTempl = "<!-- Bookmark for widget %1 -->" SAL_NEWLINE_STRING
+                          "<bookmark xml-lang=en-US branch=hid/%2 %3 localize=false </bookmark>" SAL_NEWLINE_STRING;
+        aTempl = aTempl.replaceFirst( "%1", rWidgetId );
+        aTempl = aTempl.replaceFirst( "%2", rWidgetId );
+        aTempl = aTempl.replaceFirst( "%3", lcl_genRandom("bm_id") );
+
+        return aTempl;
     }
 }
 
commit 4044419c29c5df19defcc06ad170c8f6d329b0b3
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Mon Oct 24 15:16:37 2016 +0200

    screenshot annotation: put back removed fields
    
    I hate you loplugin !!!
    
    Change-Id: I01067b04005a59b7ecb10a5a72ab6090b7f040a8

diff --git a/cui/source/dialogs/screenshotannotationdlg.cxx b/cui/source/dialogs/screenshotannotationdlg.cxx
index ca56d1f..53a0cc9 100644
--- a/cui/source/dialogs/screenshotannotationdlg.cxx
+++ b/cui/source/dialogs/screenshotannotationdlg.cxx
@@ -92,8 +92,11 @@ namespace
 class ControlDataEntry
 {
 public:
-    ControlDataEntry(const basegfx::B2IRange& rB2IRange)
-        : maB2IRange(rB2IRange)
+    ControlDataEntry(
+        const vcl::Window& rControl,
+        const basegfx::B2IRange& rB2IRange)
+        : mrControl(rControl),
+        maB2IRange(rB2IRange)
     {
     }
 
@@ -105,6 +108,7 @@ public:
     const OString GetHelpId() const { return mrControl.GetHelpId(); }
 
 private:
+    const vcl::Window&  mrControl;
     basegfx::B2IRange   maB2IRange;
 };
 
@@ -251,7 +255,7 @@ ScreenshotAnnotationDlg_Impl::ScreenshotAnnotationDlg_Impl(
         OUString aHelpId = OStringToOUString( mrParentDialog.GetHelpId(), RTL_TEXTENCODING_UTF8 );
         maMainMarkupText = lcl_ParagraphWithImage( aHelpId);
         mpText->SetText( maMainMarkupText );
-        mpText->SetReadOnly(true);
+        mpText->SetReadOnly();
     }
 
     // set click handler for save button
@@ -275,7 +279,7 @@ void ScreenshotAnnotationDlg_Impl::CollectChildren(
 
         if (!aCurrentRange.isEmpty())
         {
-            rControlDataCollection.push_back(ControlDataEntry(aCurrentRange));
+            rControlDataCollection.push_back(ControlDataEntry(rCurrent, aCurrentRange));
         }
 
         for (sal_uInt16 a(0); a < rCurrent.GetChildCount(); a++)


More information about the Libreoffice-commits mailing list