diff options
Diffstat (limited to 'vcl/source/control/fixed.cxx')
-rw-r--r-- | vcl/source/control/fixed.cxx | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/vcl/source/control/fixed.cxx b/vcl/source/control/fixed.cxx index c5eb075a8e0d..6bf24d6fc8bc 100644 --- a/vcl/source/control/fixed.cxx +++ b/vcl/source/control/fixed.cxx @@ -17,15 +17,18 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <vcl/cvtgrf.hxx> #include <vcl/decoview.hxx> #include <vcl/event.hxx> #include <vcl/fixed.hxx> #include <vcl/settings.hxx> +#include <comphelper/base64.hxx> #include <comphelper/string.hxx> #include <sal/log.hxx> #include <controldata.hxx> #include <boost/property_tree/ptree.hpp> +#include <tools/stream.hxx> #define FIXEDLINE_TEXT_BORDER 4 @@ -970,4 +973,26 @@ bool FixedImage::set_property(const OString &rKey, const OUString &rValue) return true; } +boost::property_tree::ptree FixedImage::DumpAsPropertyTree() +{ + boost::property_tree::ptree aTree = Control::DumpAsPropertyTree(); + + aTree.put("type", "image"); + + if (!!maImage) + { + SvMemoryStream aOStm(6535, 6535); + if(GraphicConverter::Export(aOStm, maImage.GetBitmapEx(), ConvertDataFormat::PNG) == ERRCODE_NONE) + { + css::uno::Sequence<sal_Int8> aSeq( static_cast<sal_Int8 const *>(aOStm.GetData()), aOStm.Tell()); + OUStringBuffer aBuffer("data:image/png;base64,"); + ::comphelper::Base64::encode(aBuffer, aSeq); + aTree.put("image", aBuffer.makeStringAndClear()); + } + } + + return aTree; +} + + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |