[Libreoffice-commits] core.git: Branch 'feature/screenshotannotation' - cui/source
Katarina Behrens
Katarina.Behrens at cib.de
Wed Oct 19 07:48:56 UTC 2016
cui/source/dialogs/screenshotannotationdlg.cxx | 43 ++++++++++++++++++++++++-
1 file changed, 42 insertions(+), 1 deletion(-)
New commits:
commit 1a781466c679874d01c7a6badc7f941dfde354d9
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Tue Oct 18 19:29:00 2016 +0200
screenshot annotation: Display markup for embedding the image
Change-Id: I06fd744fabd66ee02123790718a899d9e0dcb6b7
diff --git a/cui/source/dialogs/screenshotannotationdlg.cxx b/cui/source/dialogs/screenshotannotationdlg.cxx
index e2a9b4c..d44806b 100644
--- a/cui/source/dialogs/screenshotannotationdlg.cxx
+++ b/cui/source/dialogs/screenshotannotationdlg.cxx
@@ -27,6 +27,8 @@
#include <com/sun/star/ui/dialogs/FilePicker.hpp>
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
+
+#include <comphelper/random.hxx>
#include <vcl/pngwrite.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <tools/urlobj.hxx>
@@ -40,6 +42,44 @@
using namespace com::sun::star;
+namespace
+{
+ OUString lcl_genRandom( const OUString &rId )
+ {
+ //FIXME: plus timestamp
+ unsigned int nRand = comphelper::rng::uniform_uint_distribution(0, 0xFFFF);
+ return OUString( rId + OUString::number( nRand ) );
+ }
+
+
+ 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 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 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;
+ }
+}
+
class ControlDataEntry
{
public:
@@ -205,7 +245,8 @@ ScreenshotAnnotationDlg_Impl::ScreenshotAnnotationDlg_Impl(
// copying content to clipboard is allowed
if (mpText)
{
- mpText->SetText("The quick brown fox jumps over the lazy dog :)");
+ OUString aHelpId = OStringToOUString( mrParentDialog.GetHelpId(), RTL_TEXTENCODING_UTF8 );
+ mpText->SetText( lcl_ParagraphWithImage( aHelpId) );
mpText->SetReadOnly(true);
}
More information about the Libreoffice-commits
mailing list