summaryrefslogtreecommitdiff
path: root/cui/source/dialogs/screenshotannotationdlg.cxx
diff options
context:
space:
mode:
authorKatarina Behrens <Katarina.Behrens@cib.de>2016-10-18 19:29:00 +0200
committerKatarina Behrens <Katarina.Behrens@cib.de>2016-10-24 11:01:18 +0200
commit7c1cfa76871be9527dc9c2070d5dbdc1b55adbe5 (patch)
treee1087edb9995239fd98f4cf00fd1dab3519f71b2 /cui/source/dialogs/screenshotannotationdlg.cxx
parent30501b65e949dd20c475a063d1351b8013ff4b43 (diff)
screenshot annotation: Display markup for embedding the image
Change-Id: I06fd744fabd66ee02123790718a899d9e0dcb6b7
Diffstat (limited to 'cui/source/dialogs/screenshotannotationdlg.cxx')
-rw-r--r--cui/source/dialogs/screenshotannotationdlg.cxx45
1 files changed, 43 insertions, 2 deletions
diff --git a/cui/source/dialogs/screenshotannotationdlg.cxx b/cui/source/dialogs/screenshotannotationdlg.cxx
index 357e9b1da7a4..2f7c2d6a058a 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:
@@ -196,8 +236,9 @@ ScreenshotAnnotationDlg_Impl::ScreenshotAnnotationDlg_Impl(
// copying content to clipboard is allowed
if (mpText)
{
- mpText->SetText("The quick brown fox jumps over the lazy dog :)");
- mpText->SetReadOnly();
+ OUString aHelpId = OStringToOUString( mrParentDialog.GetHelpId(), RTL_TEXTENCODING_UTF8 );
+ mpText->SetText( lcl_ParagraphWithImage( aHelpId) );
+ mpText->SetReadOnly(true);
}
// set click handler for save button