[Libreoffice-commits] core.git: Branch 'feature/glyphy' - 809 commits - accessibility/inc accessibility/source android/Bootstrap android/README android/source animations/source apple_remote/source avmedia/Library_avmedia.mk avmedia/Library_avmediaogl.mk avmedia/source basctl/inc basctl/source basebmp/source basebmp/test basegfx/inc basegfx/source basegfx/test basic/inc basic/qa basic/source binaryurp/source bin/find-unused-defines.awk bin/find-unused-typedefs.py bin/find-unused-typedefs.sh bin/lo-all-static-libs bin/rename-sw-abbreviations.sh bin/update_pch bin/update_pch_autotune.sh bin/update_pch_bisect bin/update_pch.sh bridges/inc bridges/Library_cpp_uno.mk bridges/source bridges/test canvas/Library_oglcanvas.mk canvas/source chart2/inc chart2/Library_chartcore.mk chart2/Library_chartopengl.mk chart2/source codemaker/source comphelper/inc comphelper/source compilerplugins/clang compilerplugins/Makefile.mk config_host.mk.in configmgr/inc configmgr/source configure.ac connectivity/CppunitTest_c onnectivity_commontools.mk connectivity/inc connectivity/Library_odbc.mk connectivity/source cppcanvas/inc cppcanvas/source cppuhelper/inc cppuhelper/qa cppuhelper/source cppuhelper/test cppu/qa cppu/source cpputools/source cui/inc cui/source cui/uiconfig dbaccess/inc dbaccess/source dbaccess/uiconfig desktop/CppunitTest_desktop_lib.mk desktop/inc desktop/Library_sofficeapp.mk desktop/qa desktop/source desktop/test desktop/unx desktop/win32 distro-configs/LibreOfficeLinux.conf distro-configs/LibreOfficeOpenBSD.conf download.lst drawinglayer/inc drawinglayer/source dtrans/source editeng/inc editeng/qa editeng/source embeddedobj/source embeddedobj/test embedserv/source eventattacher/source extensions/source extensions/test external/boost external/cairo external/clucene external/glyphy external/graphite external/libabw external/libcdr external/libcmis external/libebook external/libetonyek external/libexttextcat external/libfreehand external/libgltf external/liblangtag external/libmspub external/libmwaw external/libodfgen external/libpagemaker external/libpng external/librevenge external/libvisio external/libwps external/Mesa external/Module_external.mk external/neon external/nss external/poppler external/unixODBC extras/source filter/qa filter/source forms/inc forms/source formula/source fpicker/source framework/dtd framework/inc framework/Library_fwk.mk framework/source framework/util .gitignore helpcompiler/inc helpcompiler/source helpcontent2 hwpfilter/inc hwpfilter/source i18nlangtag/source i18npool/inc i18npool/source i18nutil/source icon-themes/breeze icon-themes/galaxy icon-themes/sifr icon-themes/tango idlc/inc idlc/source idl/inc idl/source include/avmedia include/basegfx include/basic include/canvas include/codemaker include/com include/comphelper include/connectivity include/cppu include/cppuhelper include/dbaccess include/drawinglayer include/editeng include/filter include/formula include/i18nlangtag include/i18nutil include/LibreOfficeKit include/lin guistic include/oox include/osl include/postwin.h include/prewin.h include/registry include/rtl include/sal include/salhelper include/sax include/sfx2 include/sot include/store include/svl include/svtools include/svx include/systools include/toolkit include/tools include/typelib include/ucbhelper include/uno include/unotools include/vbahelper include/vcl include/xmloff include/xmlreader include/xmlscript io/source io/test javaunohelper/source jurt/Library_jpipe.mk jvmaccess/source jvmfwk/plugins jvmfwk/source l10ntools/inc l10ntools/source libreofficekit/CppunitTest_libreofficekit_checkapi.mk libreofficekit/Module_libreofficekit.mk libreofficekit/qa libreofficekit/source lingucomponent/source linguistic/source linguistic/workben lotuswordpro/inc lotuswordpro/source Makefile.fetch mysqlc/source odk/examples offapi/com officecfg/CppunitTest_officecfg_cppheader_test.mk officecfg/Module_officecfg.mk officecfg/registry oox/inc oox/source opencl/source package/inc package/source pyuno/inc pyuno/source qadevOOo/Jar_OOoRunner.mk qadevOOo/objdsc qadevOOo/runner qadevOOo/tests readlicense_oo/license registry/source registry/tools remotebridges/source reportdesign/inc reportdesign/source reportdesign/uiconfig RepositoryExternal.mk rsc/inc rsc/source sal/cpprt sal/cppunittester salhelper/qa salhelper/source salhelper/test sal/inc sal/osl sal/qa sal/rtl sal/systools sal/textenc sal/workben sax/inc sax/qa sax/source sax/test scaddins/source sccomp/source sc/inc sc/Library_scqahelper.mk sc/Module_sc.mk sc/qa scripting/source sc/source sc/uiconfig sc/workben sdext/inc sdext/source sd/inc sd/Library_sd.mk sd/Library_sdui.mk sd/qa sd/sdi sd/source sd/uiconfig sd/util sd/xml setup_native/scripts setup_native/source sfx2/inc sfx2/Library_sfx.mk sfx2/qa sfx2/sdi sfx2/source sfx2/uiconfig shell/inc shell/source slideshow/inc slideshow/Library_OGLTrans.mk slideshow/Library_slideshow.mk slideshow/opengl slideshow/source smoketest/libtest.cxx smoketest/smoketest.cxx solenv/bin solenv/ gbuild soltools/cpp soltools/mkdepend sot/inc sot/Library_sot.mk sot/source starmath/inc starmath/source starmath/uiconfig stoc/source store/source svgio/inc svgio/source svl/inc svl/qa svl/source svl/unx svtools/inc svtools/qa svtools/source svx/Executable_gengal.mk svx/inc svx/Library_svxcore.mk svx/Library_svx.mk svx/sdi svx/source swext/mediawiki sw/inc sw/JunitTest_sw_complex.mk sw/Library_sw.mk sw/Module_sw.mk sw/qa sw/sdi sw/source sw/uiconfig sysui/desktop test/source testtools/source toolkit/source tools/inc tools/Library_tl.mk tools/qa tools/source translations ucbhelper/source ucb/source UnoControls/inc UnoControls/source unodevtools/source unoidl/source unotest/source unotools/inc unotools/source unoxml/inc unoxml/source unusedcode.easy uui/inc uui/source vbahelper/inc vbahelper/source vcl/android vcl/CppunitTest_vcl_bitmap_test.mk vcl/Executable_icontest.mk vcl/Executable_mtfdemo.mk vcl/Executable_ui-previewer.mk vcl/Executable_vcldemo.mk vcl/Executable_xid_fullscreen_o n_all_monitors.mk vcl/generic vcl/headless vcl/inc vcl/Library_vcl.mk vcl/Library_vclplug_gtk3.mk vcl/Library_vclplug_gtk.mk vcl/opengl vcl/osx vcl/qa vcl/quartz vcl/source vcl/StaticLibrary_glxtest.mk vcl/unx vcl/win vcl/workben winaccessibility/source windows/soffice.sln windows/soffice.vcxproj wizards/com wizards/source writerfilter/inc writerfilter/source writerperfect/inc writerperfect/qa writerperfect/source xmlhelp/source xmlhelp/util xmloff/inc xmloff/qa xmloff/source xmlreader/source xmlscript/inc xmlscript/source xmlsecurity/inc xmlsecurity/source

Tor Lillqvist tml at collabora.com
Wed Nov 18 21:33:11 PST 2015


Rebased ref, commits from common ancestor:
commit ec50ea6440a45e4949db3e0f6603813771ea63fa
Author: Tor Lillqvist <tml at collabora.com>
Date:   Wed Nov 18 15:12:30 2015 +0200

    Update GLyphy to match upstream
    
    Change-Id: Ia1fe3f5d44e2194f87f1b7655ee28148fb614e81

diff --git a/external/glyphy/UnpackedTarball_glyphy.mk b/external/glyphy/UnpackedTarball_glyphy.mk
index 43a603d..08512b9 100644
--- a/external/glyphy/UnpackedTarball_glyphy.mk
+++ b/external/glyphy/UnpackedTarball_glyphy.mk
@@ -14,6 +14,7 @@ $(eval $(call gb_UnpackedTarball_set_tarball,glyphy,$(GLYPHY_TARBALL)))
 $(eval $(call gb_UnpackedTarball_set_patchlevel,glyphy,1))
 
 $(eval $(call gb_UnpackedTarball_add_patches,glyphy,\
+	external/glyphy/glyphy-upstream.patch.1 \
 	external/glyphy/glyphy-windows.patch.1 \
 ))
 
diff --git a/external/glyphy/glyphy-upstream.patch.1 b/external/glyphy/glyphy-upstream.patch.1
new file mode 100644
index 0000000..f898918
--- /dev/null
+++ b/external/glyphy/glyphy-upstream.patch.1
@@ -0,0 +1,211 @@
+From d6d6c61c8d0e336c34ba3f5d9adbe923ffa1cbe3 Mon Sep 17 00:00:00 2001
+From: Behdad Esfahbod <behdad at behdad.org>
+Date: Thu, 6 Aug 2015 15:34:38 +0100
+Subject: [PATCH 2/6] Implement more robust winding-direction algorithm
+
+Fixes 'p' in Comic Sans Bold for example.  That font has many
+self-intersecting contours.  The one in 'p' was causing complete
+winding direction reversal using old algorithm.  Implement area-based
+algorithm.
+---
+ src/glyphy-outline.cc | 67 ++++++++++-----------------------------------------
+ 1 file changed, 13 insertions(+), 54 deletions(-)
+
+diff --git a/src/glyphy-outline.cc b/src/glyphy-outline.cc
+index 3543f3b..ef71247 100644
+--- a/src/glyphy-outline.cc
++++ b/src/glyphy-outline.cc
+@@ -55,65 +55,24 @@ winding (const glyphy_arc_endpoint_t *endpoints,
+   /*
+    * Algorithm:
+    *
+-   * - Find the lowest-x part of the contour,
+-   * - If the point is an endpoint:
+-   *   o compare the angle of the incoming and outgoing edges of that point
+-   *     to find out whether it's CW or CCW,
+-   * - Otherwise, compare the y of the two endpoints of the arc with lowest-x point.
+-   *
+-   * Note:
+-   *
+-   * We can use a simpler algorithm here: Act as if arcs are lines, then use the
+-   * triangle method to calculate the signed area of the contour and get the sign.
+-   * It should work for all cases we care about.  The only case failing would be
+-   * that of two endpoints and two arcs.  But we can even special-case that.
++   * - Approximate arcs with triangles passing through the mid- and end-points,
++   * - Calculate the area of the contour,
++   * - Return sign.
+    */
+ 
+-  unsigned int corner = 1;
+-  for (unsigned int i = 2; i < num_endpoints; i++)
+-    if (endpoints[i].p.x < endpoints[corner].p.x ||
+-	(endpoints[i].p.x == endpoints[corner].p.x &&
+-	 endpoints[i].p.y < endpoints[corner].p.y))
+-      corner = i;
+-
+-  double min_x = endpoints[corner].p.x;
+-  int winner = -1;
+-  Point p0 (0, 0);
+-  for (unsigned int i = 0; i < num_endpoints; i++) {
+-    const glyphy_arc_endpoint_t &endpoint = endpoints[i];
+-    if (endpoint.d == GLYPHY_INFINITY || endpoint.d == 0 /* arcs only, not lines */) {
+-      p0 = endpoint.p;
+-      continue;
+-    }
+-    Arc arc (p0, endpoint.p, endpoint.d);
+-    p0 = endpoint.p;
++  double area = 0;
++  for (unsigned int i = 1; i < num_endpoints; i++)
++  {
++    const glyphy_point_t &p0 = endpoints[i - 1].p;
++    const glyphy_point_t &p1 = endpoints[i].p;
++    double d = endpoints[i].d;
+ 
+-    Point c = arc.center ();
+-    double r = arc.radius ();
+-    if (c.x - r < min_x && arc.wedge_contains_point (c - Vector (r, 0))) {
+-      min_x = c.x - r;
+-      winner = i;
+-    }
+-  }
++    assert (d != GLYPHY_INFINITY);
+ 
+-  if (winner == -1)
+-  {
+-    // Corner is lowest-x.  Find the tangents of the two arcs connected to the
+-    // corner and compare the tangent angles to get contour direction.
+-    const glyphy_arc_endpoint_t ethis = endpoints[corner];
+-    const glyphy_arc_endpoint_t eprev = endpoints[corner - 1];
+-    const glyphy_arc_endpoint_t enext = endpoints[corner < num_endpoints - 1 ? corner + 1 : 1];
+-    double in  = (-Arc (eprev.p, ethis.p, ethis.d).tangents ().second).angle ();
+-    double out = (+Arc (ethis.p, enext.p, enext.d).tangents ().first ).angle ();
+-    return out > in;
++    area += p0.x*p1.y - p0.y*p1.x;
++    area -= .5 * d * ((p1.x-p0.x)*(p1.x-p0.x) + (p1.y-p0.y)*(p1.y-p0.y));
+   }
+-  else
+-  {
+-    // Easy.
+-    return endpoints[winner].d < 0;
+-  }
+-
+-  return false;
++  return area < 0;
+ }
+ 
+ 
+-- 
+2.5.0
+
+From 644c5bab6e7f0e5af8f42fa7a8075372716c66d3 Mon Sep 17 00:00:00 2001
+From: Behdad Esfahbod <behdad at behdad.org>
+Date: Thu, 6 Aug 2015 15:49:37 +0100
+Subject: [PATCH 3/6] Start handling fully-degenerate curves
+
+---
+ src/glyphy-arcs-bezier.hh | 7 +++++++
+ src/glyphy-geometry.hh    | 4 ++++
+ 2 files changed, 11 insertions(+)
+
+diff --git a/src/glyphy-arcs-bezier.hh b/src/glyphy-arcs-bezier.hh
+index ab729cb..32b7c8c 100644
+--- a/src/glyphy-arcs-bezier.hh
++++ b/src/glyphy-arcs-bezier.hh
+@@ -103,6 +103,13 @@ class ArcsBezierApproximatorSpringSystem
+ 					    double *perror,
+ 					    unsigned int max_segments = 100)
+   {
++    /* Handle fully-degenerate cases. */
++    Vector v1 (b.p1 - b.p0);
++    Vector v2 (b.p2 - b.p0);
++    Vector v3 (b.p3 - b.p0);
++    if (fabs (v1.cross(v2)) < GLYPHY_EPSILON && fabs (v2.cross(v3)) < GLYPHY_EPSILON)
++      ;//TODO
++
+     std::vector<double> t;
+     std::vector<double> e;
+     double max_e, min_e;
+diff --git a/src/glyphy-geometry.hh b/src/glyphy-geometry.hh
+index f5f6003..3c60856 100644
+--- a/src/glyphy-geometry.hh
++++ b/src/glyphy-geometry.hh
+@@ -99,6 +99,7 @@ struct Vector {
+   inline const Vector normal (void) const; /* ortho().normalized() */
+   inline double angle (void) const;
+ 
++  inline double cross (const Vector &other) const;
+   inline const Vector rebase (const Vector &bx, const Vector &by) const;
+   inline const Vector rebase (const Vector &bx) const;
+ 
+@@ -345,6 +346,9 @@ inline double Vector::angle (void) const {
+   return atan2 (dy, dx);
+ }
+ 
++inline double Vector::cross (const Vector &other) const {
++  return dx * other.dy - dy * other.dx;
++}
+ inline const Vector Vector::rebase (const Vector &bx,
+ 				    const Vector &by) const {
+   return Vector (*this * bx, *this * by);
+-- 
+2.5.0
+
+From 5667ab11a3d5f57bb89c4e8970d26b940d36964a Mon Sep 17 00:00:00 2001
+From: Behdad Esfahbod <behdad at behdad.org>
+Date: Thu, 6 Aug 2015 15:51:15 +0100
+Subject: [PATCH 4/6] Simplify winding()
+
+---
+ src/glyphy-outline.cc | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/glyphy-outline.cc b/src/glyphy-outline.cc
+index ef71247..7fded28 100644
+--- a/src/glyphy-outline.cc
++++ b/src/glyphy-outline.cc
+@@ -69,8 +69,8 @@ winding (const glyphy_arc_endpoint_t *endpoints,
+ 
+     assert (d != GLYPHY_INFINITY);
+ 
+-    area += p0.x*p1.y - p0.y*p1.x;
+-    area -= .5 * d * ((p1.x-p0.x)*(p1.x-p0.x) + (p1.y-p0.y)*(p1.y-p0.y));
++    area += Vector(p0).cross (Vector(p1));
++    area -= .5 * d * (Point(p1) - Point(p0)).len2 ();
+   }
+   return area < 0;
+ }
+-- 
+2.5.0
+
+From 16fa0a713295a76f3075e6732007dca2dd38d11e Mon Sep 17 00:00:00 2001
+From: Behdad Esfahbod <behdad at behdad.org>
+Date: Thu, 6 Aug 2015 16:00:19 +0100
+Subject: [PATCH 5/6] Better handle fully-degenerate curves
+
+---
+ src/glyphy-arcs-bezier.hh | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/src/glyphy-arcs-bezier.hh b/src/glyphy-arcs-bezier.hh
+index 32b7c8c..ac210c0 100644
+--- a/src/glyphy-arcs-bezier.hh
++++ b/src/glyphy-arcs-bezier.hh
+@@ -108,7 +108,14 @@ class ArcsBezierApproximatorSpringSystem
+     Vector v2 (b.p2 - b.p0);
+     Vector v3 (b.p3 - b.p0);
+     if (fabs (v1.cross(v2)) < GLYPHY_EPSILON && fabs (v2.cross(v3)) < GLYPHY_EPSILON)
+-      ;//TODO
++    {
++      /* Curve has no area.  If endpoints are NOT the same, replace with single
++       * line segment.  Otherwise fully skip. */
++      arcs.clear ();
++      if (b.p0 != b.p1)
++	arcs.push_back (Arc (b.p0, b.p1, 0));
++      return;
++    }
+ 
+     std::vector<double> t;
+     std::vector<double> e;
+-- 
+2.5.0
+
commit 9fec3fc0ca481a97fdd794e9f3cff6f96fd2b2d6
Author: Tor Lillqvist <tml at collabora.com>
Date:   Mon Nov 16 21:50:00 2015 +0200

    Avoid automake, patch also Makefile.in
    
    Change-Id: I3e52b0a86126f0937649db40cb716bcf3066381a

diff --git a/external/glyphy/glyphy-windows.patch.1 b/external/glyphy/glyphy-windows.patch.1
index 234df3f..8605c8c 100644
--- a/external/glyphy/glyphy-windows.patch.1
+++ b/external/glyphy/glyphy-windows.patch.1
@@ -538,6 +538,16 @@ index 004afd3..ecb76e0 100644
  	$(NULL)
  SHADERS = \
  	glyphy-common.glsl \
+--- a/src/Makefile.in
++++ b/src/Makefile.in
+@@ -32,6 +32,7 @@ libglyphy_la_SOURCES = \
+ PUBLICHEADERS = \
+ 	glyphy.h \
+ 	glyphy-freetype.h \
++	glyphy-windows.h \
+ 	$(NULL)
+ 
+ SHADERS = \
 diff --git a/src/glyphy-windows.h b/src/glyphy-windows.h
 new file mode 100755
 index 0000000..b3c11c8
commit c28b0699f935abc944730f725981d3755c218fe6
Author: Tor Lillqvist <tml at collabora.com>
Date:   Mon Nov 16 21:41:36 2015 +0200

    Update the GLyphy patch for Windows
    
    Make it match https://github.com/tml1024/glyphy (for which a pull
    request has been submitted).
    
    Change-Id: I7bce0ad711d018e8dd5b8da971e233c381d0dc83

diff --git a/external/glyphy/glyphy-windows.patch.1 b/external/glyphy/glyphy-windows.patch.1
index d5576ad..234df3f 100644
--- a/external/glyphy/glyphy-windows.patch.1
+++ b/external/glyphy/glyphy-windows.patch.1
@@ -1,19 +1,531 @@
-commit cfc3157868f691b70c2f0a6daa3c387ca6ef42a9 (HEAD -> master, origin/master, origin/HEAD)
-Author: Tor Lillqvist <tml at collabora.com>
-Date:   Tue Nov 10 00:20:42 2015 +0200
+From cfc3157868f691b70c2f0a6daa3c387ca6ef42a9 Mon Sep 17 00:00:00 2001
+From: Tor Lillqvist <tml at collabora.com>
+Date: Tue, 10 Nov 2015 00:20:42 +0200
+Subject: [PATCH 1/3] Port glyphy-demo to Windows
 
-    Port glyphy-demo to Windows
-    
-    You will need glew and freeglut to build and run it.
-    
-    I have a VS solution for glyphy-demo, but did not commit that as I did
-    not bother to do it "properly", with different projects for the
-    library and the demo executable, Release and Debug configurations etc.
+You will need glew and freeglut to build and run it.
+
+I have a VS solution for glyphy-demo, but did not commit that as I did
+not bother to do it "properly", with different projects for the
+library and the demo executable, Release and Debug configurations etc.
 ---
+ demo/demo-buffer.cc  |  11 ++++
+ demo/demo-common.h   |   6 ++
+ demo/demo-font.cc    | 131 +++++++++++++++++++++++++++++++++++---------
+ demo/demo-font.h     |  21 ++++++-
+ demo/demo-view.cc    |   3 +-
+ demo/glyphy-demo.cc  | 134 ++++++++++++++++++++++++++++++++++++++++++++-
  src/Makefile.am      |   1 +
  src/glyphy-windows.h | 152 +++++++++++++++++++++++++++++++++++++++++++++++++++
- 2 files changed, 153 insertions(+)
+ 8 files changed, 429 insertions(+), 30 deletions(-)
+ create mode 100755 src/glyphy-windows.h
 
+diff --git a/demo/demo-buffer.cc b/demo/demo-buffer.cc
+index 698f4ee..8ce5b34 100644
+--- a/demo/demo-buffer.cc
++++ b/demo/demo-buffer.cc
+@@ -106,7 +106,11 @@ demo_buffer_add_text (demo_buffer_t        *buffer,
+ 		      demo_font_t          *font,
+ 		      double                font_size)
+ {
++#ifndef _WIN32
+   FT_Face face = demo_font_get_face (font);
++#else
++  HDC hdc = demo_font_get_face (font);
++#endif
+   glyphy_point_t top_left = buffer->cursor;
+   buffer->cursor.y += font_size /* * font->ascent */;
+   unsigned int unicode;
+@@ -138,7 +142,14 @@ demo_buffer_add_text (demo_buffer_t        *buffer,
+       continue;
+     }
+ 
++#ifndef _WIN32
+     unsigned int glyph_index = FT_Get_Char_Index (face, unicode);
++#else
++    wchar_t wc = unicode; /* FIXME: What about non-BMP chars? */
++    WORD glyph_index;
++    if (GetGlyphIndicesW (hdc, &wc, 1, &glyph_index, GGI_MARK_NONEXISTING_GLYPHS) == GDI_ERROR)
++      die ("GetGlyphIndicesW failed");
++#endif
+     glyph_info_t gi;
+     demo_font_lookup_glyph (font, glyph_index, &gi);
+ 
+diff --git a/demo/demo-common.h b/demo/demo-common.h
+index dd0feb9..da56a88 100644
+--- a/demo/demo-common.h
++++ b/demo/demo-common.h
+@@ -44,6 +44,12 @@
+ #  define HAVE_GLUT 1
+ #endif
+ 
++#ifdef _WIN32
++#  define HAVE_GL 1
++#  define HAVE_GLEW 1
++#  define HAVE_GLUT 1
++#endif
++
+ /* Get Glew out of the way. */
+ #ifdef HAVE_GLEW
+ #  include <GL/glew.h>
+diff --git a/demo/demo-font.cc b/demo/demo-font.cc
+index 4ed4b53..b43b1e3 100644
+--- a/demo/demo-font.cc
++++ b/demo/demo-font.cc
+@@ -22,19 +22,30 @@
+ 
+ #include "demo-font.h"
+ 
++#ifndef _WIN32
+ #include <glyphy-freetype.h>
++#endif
+ 
+-#include <ext/hash_map>
+-
+-using namespace __gnu_cxx; /* This is ridiculous */
++#ifdef _WIN32
++#include <glyphy-windows.h>
++#endif
+ 
++#include <map>
++#include <vector>
+ 
+-typedef hash_map<unsigned int, glyph_info_t> glyph_cache_t;
++typedef std::map<unsigned int, glyph_info_t> glyph_cache_t;
+ 
+ struct demo_font_t {
+   unsigned int   refcount;
+ 
++#ifndef _WIN32
+   FT_Face        face;
++#endif
++
++#ifdef _WIN32
++  HDC            face; /* A memory DC that has the font instance selected into it */
++#endif
++
+   glyph_cache_t *glyph_cache;
+   demo_atlas_t  *atlas;
+   glyphy_arc_accumulator_t *acc;
+@@ -48,7 +59,13 @@ struct demo_font_t {
+ };
+ 
+ demo_font_t *
+-demo_font_create (FT_Face       face,
++demo_font_create (
++#ifndef _WIN32
++		  FT_Face       face,
++#endif
++#ifdef _WIN32
++		  HDC           face,
++#endif
+ 		  demo_atlas_t *atlas)
+ {
+   demo_font_t *font = (demo_font_t *) calloc (1, sizeof (demo_font_t));
+@@ -88,7 +105,12 @@ demo_font_destroy (demo_font_t *font)
+ }
+ 
+ 
++#ifndef _WIN32
+ FT_Face
++#endif
++#ifdef _WIN32
++HDC
++#endif
+ demo_font_get_face (demo_font_t *font)
+ {
+   return font->face;
+@@ -103,27 +125,28 @@ demo_font_get_atlas (demo_font_t *font)
+ 
+ static glyphy_bool_t
+ accumulate_endpoint (glyphy_arc_endpoint_t         *endpoint,
+-		     vector<glyphy_arc_endpoint_t> *endpoints)
++		     std::vector<glyphy_arc_endpoint_t> *endpoints)
+ {
+   endpoints->push_back (*endpoint);
+   return true;
+ }
+ 
+ static void
+-encode_ft_glyph (demo_font_t      *font,
+-		 unsigned int      glyph_index,
+-		 double            tolerance_per_em,
+-		 glyphy_rgba_t    *buffer,
+-		 unsigned int      buffer_len,
+-		 unsigned int     *output_len,
+-		 unsigned int     *nominal_width,
+-		 unsigned int     *nominal_height,
+-		 glyphy_extents_t *extents,
+-		 double           *advance)
++encode_glyph (demo_font_t      *font,
++	      unsigned int      glyph_index,
++	      double            tolerance_per_em,
++	      glyphy_rgba_t    *buffer,
++	      unsigned int      buffer_len,
++	      unsigned int     *output_len,
++	      unsigned int     *nominal_width,
++	      unsigned int     *nominal_height,
++	      glyphy_extents_t *extents,
++	      double           *advance)
+ {
+ /* Used for testing only */
+ #define SCALE  (1. * (1 << 0))
+ 
++#ifndef _WIN32
+   FT_Face face = font->face;
+   if (FT_Err_Ok != FT_Load_Glyph (face,
+ 				  glyph_index,
+@@ -141,7 +164,7 @@ encode_ft_glyph (demo_font_t      *font,
+   unsigned int upem = face->units_per_EM;
+   double tolerance = upem * tolerance_per_em; /* in font design units */
+   double faraway = double (upem) / (MIN_FONT_SIZE * M_SQRT2);
+-  vector<glyphy_arc_endpoint_t> endpoints;
++  std::vector<glyphy_arc_endpoint_t> endpoints;
+ 
+   glyphy_arc_accumulator_reset (font->acc);
+   glyphy_arc_accumulator_set_tolerance (font->acc, tolerance);
+@@ -151,6 +174,55 @@ encode_ft_glyph (demo_font_t      *font,
+ 
+   if (FT_Err_Ok != glyphy_freetype(outline_decompose) (&face->glyph->outline, font->acc))
+     die ("Failed converting glyph outline to arcs");
++#endif
++
++#ifdef _WIN32
++  HDC hdc = font->face;
++
++  GLYPHMETRICS glyph_metrics;
++  MAT2 matrix;
++
++  matrix.eM11.value = 1;
++  matrix.eM11.fract = 0;
++  matrix.eM12.value = 0;
++  matrix.eM12.fract = 0;
++  matrix.eM21.value = 0;
++  matrix.eM21.fract = 0;
++  matrix.eM22.value = 1;
++  matrix.eM22.fract = 0;
++
++  DWORD size = GetGlyphOutlineW (hdc, glyph_index, GGO_NATIVE|GGO_GLYPH_INDEX, &glyph_metrics, 0, NULL, &matrix);
++  if (size == GDI_ERROR)
++    die ("GetGlyphOutlineW failed");
++  std::vector<char> buf(size);
++  size = GetGlyphOutlineW (hdc, glyph_index, GGO_NATIVE|GGO_GLYPH_INDEX, &glyph_metrics, size, buf.data(), &matrix);
++  if (size == GDI_ERROR)
++    die ("GetGlyphOutlineW failed");
++
++  size = GetGlyphOutlineW (hdc, glyph_index, GGO_METRICS|GGO_GLYPH_INDEX, &glyph_metrics, 0, NULL, &matrix);
++  if (size == GDI_ERROR)
++    die ("GetGlyphOutlineW failed");
++
++  OUTLINETEXTMETRICW outline_text_metric;
++  if (!GetOutlineTextMetricsW (hdc, sizeof (OUTLINETEXTMETRICW), &outline_text_metric))
++    die ("GetOutlineTextMetricsW failed");
++
++  unsigned int upem = outline_text_metric.otmEMSquare;
++  double tolerance = upem * tolerance_per_em; /* in font design units */
++  double faraway = double (upem) / (MIN_FONT_SIZE * M_SQRT2);
++  std::vector<glyphy_arc_endpoint_t> endpoints;
++
++  fprintf(stderr, "upem=%u tolerance=%f faraway=%f\n", upem, tolerance, faraway);
++
++  glyphy_arc_accumulator_reset (font->acc);
++  glyphy_arc_accumulator_set_tolerance (font->acc, tolerance);
++  glyphy_arc_accumulator_set_callback (font->acc,
++				       (glyphy_arc_endpoint_accumulator_callback_t) accumulate_endpoint,
++				       &endpoints);
++
++  if (0 != glyphy_windows(outline_decompose) ((TTPOLYGONHEADER *) buf.data(), buf.size(), font->acc))
++    die ("Failed converting glyph outline to arcs");
++#endif
+ 
+   assert (glyphy_arc_accumulator_get_error (font->acc) <= tolerance);
+ 
+@@ -192,7 +264,14 @@ encode_ft_glyph (demo_font_t      *font,
+   glyphy_extents_scale (extents, 1. / upem, 1. / upem);
+   glyphy_extents_scale (extents, SCALE, SCALE);
+ 
++#ifndef _WIN32
+   *advance = face->glyph->metrics.horiAdvance / (double) upem;
++#endif
++
++#ifdef _WIN32
++  *advance = glyph_metrics.gmCellIncX / (double) upem; /* ??? */
++  fprintf(stderr, "======> Advance: %f\n", *advance);
++#endif
+ 
+   if (0)
+     LOGI ("gid%3u: endpoints%3d; err%3g%%; tex fetch%4.1f; mem%4.1fkb\n",
+@@ -217,15 +296,15 @@ _demo_font_upload_glyph (demo_font_t *font,
+   glyphy_rgba_t buffer[4096 * 16];
+   unsigned int output_len;
+ 
+-  encode_ft_glyph (font,
+-		   glyph_index,
+-		   TOLERANCE,
+-		   buffer, ARRAY_LEN (buffer),
+-		   &output_len,
+-		   &glyph_info->nominal_w,
+-		   &glyph_info->nominal_h,
+-		   &glyph_info->extents,
+-		   &glyph_info->advance);
++  encode_glyph (font,
++		glyph_index,
++		TOLERANCE,
++		buffer, ARRAY_LEN (buffer),
++		&output_len,
++		&glyph_info->nominal_w,
++		&glyph_info->nominal_h,
++		&glyph_info->extents,
++		&glyph_info->advance);
+ 
+   glyph_info->is_empty = glyphy_extents_is_empty (&glyph_info->extents);
+   if (!glyph_info->is_empty)
+diff --git a/demo/demo-font.h b/demo/demo-font.h
+index ddc45ed..d4e75ff 100644
+--- a/demo/demo-font.h
++++ b/demo/demo-font.h
+@@ -22,9 +22,17 @@
+ #include "demo-common.h"
+ #include "demo-atlas.h"
+ 
++#ifndef _WIN32
+ #include <ft2build.h>
+ #include FT_FREETYPE_H
++#endif
+ 
++#ifdef _WIN32
++#include <windows.h>
++#define DEFAULT_FONT "Calibri"
++#undef near
++#undef far
++#endif
+ 
+ typedef struct {
+   glyphy_extents_t extents;
+@@ -40,7 +48,13 @@ typedef struct {
+ typedef struct demo_font_t demo_font_t;
+ 
+ demo_font_t *
+-demo_font_create (FT_Face       face,
++demo_font_create (
++#ifndef _WIN32
++		  FT_Face       face,
++#endif
++#ifdef _WIN32
++		  HDC           hdc,
++#endif
+ 		  demo_atlas_t *atlas);
+ 
+ demo_font_t *
+@@ -50,7 +64,12 @@ void
+ demo_font_destroy (demo_font_t *font);
+ 
+ 
++#ifndef _WIN32
+ FT_Face
++#endif
++#ifdef _WIN32
++HDC
++#endif
+ demo_font_get_face (demo_font_t *font);
+ 
+ demo_atlas_t *
+diff --git a/demo/demo-view.cc b/demo/demo-view.cc
+index b60fc24..fee3e23 100644
+--- a/demo/demo-view.cc
++++ b/demo/demo-view.cc
+@@ -27,8 +27,9 @@ extern "C" {
+ #include "matrix4x4.h"
+ }
+ 
++#ifndef _WIN32
+ #include <sys/time.h>
+-
++#endif
+ 
+ struct demo_view_t {
+   unsigned int   refcount;
+diff --git a/demo/glyphy-demo.cc b/demo/glyphy-demo.cc
+index cf412cc..bc71dff 100644
+--- a/demo/glyphy-demo.cc
++++ b/demo/glyphy-demo.cc
+@@ -20,14 +20,15 @@
+ #include <config.h>
+ #endif
+ 
++#ifndef _WIN32
+ #include <libgen.h>
++#include <unistd.h>
++#endif
+ #include <stdio.h>
+ #include <string.h>
+-#include <unistd.h>
+ #include <ctype.h>
+ #include <stdlib.h>
+ 
+-
+ #include "demo-buffer.h"
+ #include "demo-font.h"
+ #include "demo-view.h"
+@@ -39,6 +40,90 @@ static demo_buffer_t *buffer;
+ #define WINDOW_W 700
+ #define WINDOW_H 700
+ 
++#ifdef _WIN32
++
++static int isroot(const char *path)
++{
++  return ((strlen(path) == 1 && path[0] == '/') ||
++	  (strlen(path) == 3 && isalpha(path[0]) && path[1] == ':' && (path[2] == '/' || path[2] == '\\')));
++}
++
++static char *basename(char *path)
++{
++  if (path == NULL || *path == '\0')
++    return ".";
++
++  while ((path[strlen(path)-1] == '/' ||
++	  path[strlen(path)-1] == '\\') &&
++	 !isroot(path))
++    path[strlen(path)-1] = '\0';
++
++  if (isroot(path))
++    return path;
++
++  char *slash = strrchr(path, '/');
++  char *backslash = strrchr(path, '\\');
++
++  if (slash != NULL && (backslash == NULL || backslash < slash))
++    return slash + 1;
++  else if (backslash != NULL && (slash == NULL || slash < backslash))
++    return backslash + 1;
++  else
++    return path;
++}
++
++static int opterr = 1;
++static int optind = 1;
++static int optopt;
++static char *optarg;
++
++static int getopt(int argc, char *argv[], char *opts)
++{
++    static int sp = 1;
++    int c;
++    char *cp;
++
++    if (sp == 1) {
++        if (optind >= argc ||
++            argv[optind][0] != '-' || argv[optind][1] == '\0')
++            return EOF;
++        else if (!strcmp(argv[optind], "--")) {
++            optind++;
++            return EOF;
++        }
++    }
++    optopt = c = argv[optind][sp];
++    if (c == ':' || !(cp = strchr(opts, c))) {
++        fprintf(stderr, ": illegal option -- %c\n", c);
++        if (argv[optind][++sp] == '\0') {
++            optind++;
++            sp = 1;
++        }
++        return '?';
++    }
++    if (*++cp == ':') {
++        if (argv[optind][sp+1] != '\0')
++            optarg = &argv[optind++][sp+1];
++        else if(++optind >= argc) {
++            fprintf(stderr, ": option requires an argument -- %c\n", c);
++            sp = 1;
++            return '?';
++        } else
++            optarg = argv[optind++];
++        sp = 1;
++    } else {
++        if (argv[optind][++sp] == '\0') {
++            sp = 1;
++            optind++;
++        }
++        optarg = NULL;
++    }
++
++    return c;
++}
++
++#endif
++
+ static void
+ reshape_func (int width, int height)
+ {
+@@ -161,6 +246,7 @@ main (int argc, char** argv)
+   vu = demo_view_create (st);
+   demo_view_print_help (vu);
+ 
++#ifndef _WIN32
+   FT_Library ft_library;
+   FT_Init_FreeType (&ft_library);
+   FT_Face ft_face;
+@@ -173,6 +259,42 @@ main (int argc, char** argv)
+   if (!ft_face)
+     die ("Failed to open font file");
+   demo_font_t *font = demo_font_create (ft_face, demo_glstate_get_atlas (st));
++#endif
++
++#ifdef _WIN32
++  HDC hdc = CreateCompatibleDC (GetDC (NULL));
++  if (hdc == NULL)
++    die ("GetDC or CreateCompatibleDC failed");
++
++  /* First create an instance of the font at size 10 to get the OUTLINETEXTMETRIC from which to get
++   * the font's em unit. Then, to get an unmodified not grid-fitted glyph outline, create it anew at
++   * that size. That is  as the doc for GetGlyphOutline() suggests.
++   */
++  HFONT hfont = CreateFontA(10, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_TT_ONLY_PRECIS, CLIP_DEFAULT_PRECIS, PROOF_QUALITY, FF_DONTCARE, font_path);
++  if (hfont == NULL)
++    die ("CreateFontA failed");
++
++  HFONT old_hfont = (HFONT) SelectObject (hdc, hfont);
++  if (old_hfont == NULL)
++    die ("SelectObject failed");
++
++  OUTLINETEXTMETRICW outline_text_metric;
++  if (!GetOutlineTextMetricsW (hdc, sizeof (OUTLINETEXTMETRICW), &outline_text_metric))
++    die ("GetOutlineTextMetricsW failed");
++
++  SelectObject (hdc, old_hfont);
++
++  hfont = CreateFontA (outline_text_metric.otmEMSquare, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, DEFAULT_CHARSET, OUT_TT_ONLY_PRECIS, CLIP_DEFAULT_PRECIS, PROOF_QUALITY, FF_DONTCARE, font_path);
++  if (hfont == NULL)
++    die ("CreateFontA failed");
++
++  old_hfont = (HFONT) SelectObject (hdc, hfont);
++  if (old_hfont == NULL)
++    die ("SelectObject failed");
++
++  demo_font_t *font = demo_font_create (hdc, demo_glstate_get_atlas (st));
++
++#endif
+ 
+   buffer = demo_buffer_create ();
+   glyphy_point_t top_left = {0, 0};
+@@ -187,8 +309,16 @@ main (int argc, char** argv)
+   demo_buffer_destroy (buffer);
+   demo_font_destroy (font);
+ 
++#ifndef _WIN32
+   FT_Done_Face (ft_face);
+   FT_Done_FreeType (ft_library);
++#endif
++
++#ifdef _WIN32
++  SelectObject (hdc, old_hfont);
++  DeleteObject (hfont);
++  DeleteDC (hdc);
++#endif
+ 
+   demo_view_destroy (vu);
+   demo_glstate_destroy (st);
 diff --git a/src/Makefile.am b/src/Makefile.am
 index 004afd3..ecb76e0 100644
 --- a/src/Makefile.am
@@ -184,3 +696,39 @@ index 0000000..b3c11c8
 +#ifdef __cplusplus
 +}
 +#endif
+-- 
+2.4.3
+
+From 6d4196a2dc59324d14d3d4d721929e851277da97 Mon Sep 17 00:00:00 2001
+From: Tor Lillqvist <tml at collabora.com>
+Date: Tue, 10 Nov 2015 13:35:17 +0200
+Subject: [PATCH 2/3] Bin leftover printf
+
+---
+ demo/demo-font.cc | 3 ---
+ 1 file changed, 3 deletions(-)
+
+diff --git a/demo/demo-font.cc b/demo/demo-font.cc
+index b43b1e3..c28778e 100644
+--- a/demo/demo-font.cc
++++ b/demo/demo-font.cc
+@@ -212,8 +212,6 @@ encode_glyph (demo_font_t      *font,
+   double faraway = double (upem) / (MIN_FONT_SIZE * M_SQRT2);
+   std::vector<glyphy_arc_endpoint_t> endpoints;
+ 
+-  fprintf(stderr, "upem=%u tolerance=%f faraway=%f\n", upem, tolerance, faraway);
+-
+   glyphy_arc_accumulator_reset (font->acc);
+   glyphy_arc_accumulator_set_tolerance (font->acc, tolerance);
+   glyphy_arc_accumulator_set_callback (font->acc,
+@@ -270,7 +268,6 @@ encode_glyph (demo_font_t      *font,
+ 
+ #ifdef _WIN32
+   *advance = glyph_metrics.gmCellIncX / (double) upem; /* ??? */
+-  fprintf(stderr, "======> Advance: %f\n", *advance);
+ #endif
+ 
+   if (0)
+-- 
+2.4.3
+
commit 8dd97e96012228ae7a754a81e20879914d209ab9
Author: Tor Lillqvist <tml at collabora.com>
Date:   Mon Nov 16 21:23:04 2015 +0200

    Link with GLyphy also for Windows
    
    (We don't actually use it yet for anything, though.)
    
    Change-Id: Id246a2a4853ba4d6dc09372b9cebcbb983363d36

diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 1d2ec56..61f3cd1 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -732,6 +732,12 @@ $(eval $(call gb_Library_use_system_win32_libs,vcl,\
 $(eval $(call gb_Library_add_nativeres,vcl,vcl/salsrc))
 endif
 
+ifeq ($(OS), WNT)
+$(eval $(call gb_Library_use_externals,vcl,\
+	glyphy \
+))
+endif
+
 ifeq ($(OS), $(filter LINUX %BSD SOLARIS, $(OS)))
 $(eval $(call gb_Library_add_libs,vcl,\
 	-lm $(DLOPEN_LIBS) \
commit c2df4e95acb4ebd9c83b06a859b80ccba6ab8ecf
Author: Tor Lillqvist <tml at collabora.com>
Date:   Mon Nov 16 20:48:50 2015 +0200

    Add ImplFontMetricData::mbTrueTypeFont
    
    Indicates that the font truly is a TrueType one (FT_IS_SFNT in
    FreeType, TMPF_TRUETYPE in Win32).
    
    Change-Id: Ic9dbf5e5239ae2ca597c454091fc36073a3b19cc

diff --git a/vcl/generic/glyphs/gcach_ftyp.cxx b/vcl/generic/glyphs/gcach_ftyp.cxx
index bef5477..2e874e5 100644
--- a/vcl/generic/glyphs/gcach_ftyp.cxx
+++ b/vcl/generic/glyphs/gcach_ftyp.cxx
@@ -636,7 +636,8 @@ void ServerFont::FetchFontMetric( ImplFontMetricData& rTo, long& rFactor ) const
 {
     static_cast<ImplFontAttributes&>(rTo) = mpFontInfo->GetFontAttributes();
 
-    rTo.mbScalableFont  = true;
+    rTo.mbScalableFont  = true; // FIXME: Shouldn't this check FT_IS_SCALABLE( maFaceFT )?
+    rTo.mbTrueTypeFont  = FT_IS_SFNT( maFaceFT ) != 0;
     rTo.mbDevice        = true;
     rTo.mbKernableFont  = FT_HAS_KERNING( maFaceFT ) != 0;
     rTo.mnOrientation = GetFontSelData().mnOrientation;
diff --git a/vcl/generic/print/genpspgraphics.cxx b/vcl/generic/print/genpspgraphics.cxx
index c0e214d..f1f9202 100644
--- a/vcl/generic/print/genpspgraphics.cxx
+++ b/vcl/generic/print/genpspgraphics.cxx
@@ -923,6 +923,7 @@ void GenPspGraphics::GetFontMetric( ImplFontMetricData *pMetric, int )
         static_cast<ImplFontAttributes&>(*pMetric) = aDFA;
         pMetric->mbDevice       = aDFA.mbDevice;
         pMetric->mbScalableFont = true;
+        pMetric->mbTrueTypeFont = false; // FIXME, needed?
 
         pMetric->mnOrientation  = m_pPrinterGfx->GetFontAngle();
         pMetric->mnSlant        = 0;
diff --git a/vcl/inc/outfont.hxx b/vcl/inc/outfont.hxx
index 9511f23..8eef436 100644
--- a/vcl/inc/outfont.hxx
+++ b/vcl/inc/outfont.hxx
@@ -173,6 +173,7 @@ public: // TODO: hide members behind accessor methods
     int                 meFamilyType;               // Font Family Type
     bool                mbDevice;                   // Flag for Device Fonts
     bool                mbScalableFont;
+    bool                mbTrueTypeFont;
     bool                mbKernableFont;
     bool                mbFullstopCentered;
 
diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx
index 2042618..a5882ca 100644
--- a/vcl/quartz/ctfonts.cxx
+++ b/vcl/quartz/ctfonts.cxx
@@ -136,6 +136,7 @@ void CoreTextStyle::GetFontMetric( ImplFontMetricData& rMetric ) const
 
     // all CoreText fonts are scalable
     rMetric.mbScalableFont = true;
+    rMetric.mbTrueTypeFont = true; // Not sure, but this field is used only for Windows so far
     rMetric.mbKernableFont = true;
 }
 
diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx
index 3686d71..8f443ce 100644
--- a/vcl/source/outdev/font.cxx
+++ b/vcl/source/outdev/font.cxx
@@ -1746,6 +1746,7 @@ ImplFontMetricData::ImplFontMetricData( const FontSelectPattern& rFontSelData )
     , mnMinKashida( 0 )
     , meFamilyType(FAMILY_DONTKNOW)
     , mbScalableFont(false)
+    , mbTrueTypeFont(false)
     , mbFullstopCentered(false)
     , mnUnderlineSize( 0 )
     , mnUnderlineOffset( 0 )
diff --git a/vcl/win/source/gdi/salgdi3.cxx b/vcl/win/source/gdi/salgdi3.cxx
index fbb3b87..9412799 100644
--- a/vcl/win/source/gdi/salgdi3.cxx
+++ b/vcl/win/source/gdi/salgdi3.cxx
@@ -1596,6 +1596,7 @@ void WinSalGraphics::GetFontMetric( ImplFontMetricData* pMetric, int nFallbackLe
     // device dependent font attributes
     pMetric->mbDevice       = (aWinMetric.tmPitchAndFamily & TMPF_DEVICE) != 0;
     pMetric->mbScalableFont = (aWinMetric.tmPitchAndFamily & (TMPF_VECTOR|TMPF_TRUETYPE)) != 0;
+    pMetric->mbTrueTypeFont = (aWinMetric.tmPitchAndFamily & TMPF_TRUETYPE) != 0;
     if( pMetric->mbScalableFont )
     {
         // check if there are kern pairs
commit ea387f661d41bcd7d892f75c8b663091a82be4f1
Author: Tor Lillqvist <tml at collabora.com>
Date:   Mon Nov 16 20:31:58 2015 +0200

    Add OpenGLContext::UseNoProgram()
    
    Will be useful in cases where there is some external library code that uses
    shaders outside of our OpenGLContext.
    
    Change-Id: I59c57e3225f55d13e69b6a9b7c0db1a7487c586d

diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx
index 28db7f9..fb09bd5 100644
--- a/include/vcl/opengl/OpenGLContext.hxx
+++ b/include/vcl/opengl/OpenGLContext.hxx
@@ -167,6 +167,7 @@ public:
     // retrieve a program from the cache or compile/link it
     OpenGLProgram*      GetProgram( const OUString& rVertexShader, const OUString& rFragmentShader, const OString& preamble = "" );
     OpenGLProgram*      UseProgram( const OUString& rVertexShader, const OUString& rFragmentShader, const OString& preamble = "" );
+    void                UseNoProgram();
 
     /// Is this GL context the current context ?
     bool isCurrent();
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index 0c58120..0378ac0 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -1732,4 +1732,14 @@ OpenGLProgram* OpenGLContext::UseProgram( const OUString& rVertexShader, const O
     return mpCurrentProgram;
 }
 
+void OpenGLContext::UseNoProgram()
+{
+    if( mpCurrentProgram == NULL )
+        return;
+
+    mpCurrentProgram = NULL;
+    glUseProgram( 0 );
+    CHECK_GL_ERROR();
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 64fa93458a70d2d19af9f050624944e685747d36
Author: Tor Lillqvist <tml at collabora.com>
Date:   Mon Nov 16 20:16:32 2015 +0200

    Use correct GLyphy library file name in the MSVC case
    
    Change-Id: I77b55e796c35d1a186fecfddc6a109ded7d54064

diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 50d5f04..42630d0 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -288,10 +288,15 @@ $(call gb_LinkTarget_set_include,$(1),\
 	$$(INCLUDE) \
 )
 
+ifeq ($(COM),MSC)
+$(call gb_LinkTarget_add_libs,$(1),\
+	$(call gb_UnpackedTarball_get_dir,glyphy)/src/.libs/libglyphy.lib \
+)
+else
 $(call gb_LinkTarget_add_libs,$(1),\
 	-L$(call gb_UnpackedTarball_get_dir,glyphy)/src/.libs -lglyphy \
 )
-
+endif
 endef
 
 endif # SYSTEM_GLYPHY
commit 189ac2c6ad6e2c03836befeaceee55950d2a1911
Author: Tor Lillqvist <tml at collabora.com>
Date:   Mon Nov 16 20:16:32 2015 +0200

    The GLyphy headers in its tarball are in "src", there is no "include"
    
    Change-Id: I77b55e796c35d1a186fecfddc6a109ded7d54064

diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 9c773f7..50d5f04 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -284,7 +284,7 @@ define gb_LinkTarget__use_glyphy
 $(call gb_LinkTarget_use_package,$(1),glyphy)
 
 $(call gb_LinkTarget_set_include,$(1),\
-	-I$(call gb_UnpackedTarball_get_dir,glyphy/include) \
+	-I$(call gb_UnpackedTarball_get_dir,glyphy/src) \
 	$$(INCLUDE) \
 )
 
commit a4ba84eb504bcff5063f3879ecab582ff57e9c87
Author: Tor Lillqvist <tml at collabora.com>
Date:   Tue Nov 10 12:08:22 2015 +0200

    Add glyphy-windows.h for feeding GLyphy Win32 font data
    
    Change-Id: Iba7ed7d0e889f151c0b3d27de49fd6f14ffcd112

diff --git a/external/glyphy/UnpackedTarball_glyphy.mk b/external/glyphy/UnpackedTarball_glyphy.mk
index 8e2244b..43a603d 100644
--- a/external/glyphy/UnpackedTarball_glyphy.mk
+++ b/external/glyphy/UnpackedTarball_glyphy.mk
@@ -13,4 +13,8 @@ $(eval $(call gb_UnpackedTarball_set_tarball,glyphy,$(GLYPHY_TARBALL)))
 
 $(eval $(call gb_UnpackedTarball_set_patchlevel,glyphy,1))
 
+$(eval $(call gb_UnpackedTarball_add_patches,glyphy,\
+	external/glyphy/glyphy-windows.patch.1 \
+))
+
 # vim: set noet sw=4 ts=4:
diff --git a/external/glyphy/glyphy-windows.patch.1 b/external/glyphy/glyphy-windows.patch.1
new file mode 100644
index 0000000..d5576ad
--- /dev/null
+++ b/external/glyphy/glyphy-windows.patch.1
@@ -0,0 +1,186 @@
+commit cfc3157868f691b70c2f0a6daa3c387ca6ef42a9 (HEAD -> master, origin/master, origin/HEAD)
+Author: Tor Lillqvist <tml at collabora.com>
+Date:   Tue Nov 10 00:20:42 2015 +0200
+
+    Port glyphy-demo to Windows
+    
+    You will need glew and freeglut to build and run it.
+    
+    I have a VS solution for glyphy-demo, but did not commit that as I did
+    not bother to do it "properly", with different projects for the
+    library and the demo executable, Release and Debug configurations etc.
+---
+ src/Makefile.am      |   1 +
+ src/glyphy-windows.h | 152 +++++++++++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 153 insertions(+)
+
+diff --git a/src/Makefile.am b/src/Makefile.am
+index 004afd3..ecb76e0 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -32,6 +32,7 @@ libglyphy_la_SOURCES = \
+ PUBLICHEADERS = \
+ 	glyphy.h \
+ 	glyphy-freetype.h \
++	glyphy-windows.h \
+ 	$(NULL)
+ SHADERS = \
+ 	glyphy-common.glsl \
+diff --git a/src/glyphy-windows.h b/src/glyphy-windows.h
+new file mode 100755
+index 0000000..b3c11c8
+--- /dev/null
++++ b/src/glyphy-windows.h
+@@ -0,0 +1,152 @@
++/*
++ * Copyright 2012 Google, Inc. All Rights Reserved.
++ *
++ * Licensed under the Apache License, Version 2.0 (the "License");
++ * you may not use this file except in compliance with the License.
++ * You may obtain a copy of the License at
++ *
++ *     http://www.apache.org/licenses/LICENSE-2.0
++ *
++ * Unless required by applicable law or agreed to in writing, software
++ * distributed under the License is distributed on an "AS IS" BASIS,
++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ * See the License for the specific language governing permissions and
++ * limitations under the License.
++ *
++ * Google Author(s): Behdad Esfahbod, Maysum Panju
++ */
++
++/* Intentionally doesn't have include guards */
++
++#include "glyphy.h"
++
++#include <windows.h>
++
++#ifdef __cplusplus
++extern "C" {
++#endif
++
++
++#ifndef GLYPHY_WINDOWS__PREFIX
++#define GLYPHY_WINDOWS_PREFIX glyphy_windows_
++#endif
++
++#ifndef glyphy_windows
++#define glyphy_windows(name) GLYPHY_PASTE (GLYPHY_WINDOWS_PREFIX, name)
++#endif
++
++static double fixed_to_double(FIXED f)
++{
++  return f.value + f.fract / double(0x10000);
++}
++
++static int
++glyphy_windows(move_to) (const POINTFX            *to,
++			 glyphy_arc_accumulator_t *acc)
++{
++  glyphy_point_t p1 = {fixed_to_double(to->x), fixed_to_double(to->y)};
++  glyphy_arc_accumulator_close_path (acc);
++  glyphy_arc_accumulator_move_to (acc, &p1);
++  return glyphy_arc_accumulator_successful (acc) ? 0 : -1;
++}
++
++static int
++glyphy_windows(line_to) (const POINTFX            *to,
++			 glyphy_arc_accumulator_t *acc)
++{
++  glyphy_point_t p1 = {fixed_to_double(to->x), fixed_to_double(to->y)};
++  glyphy_arc_accumulator_line_to (acc, &p1);
++  return glyphy_arc_accumulator_successful (acc) ? 0 : -1;
++}
++
++static int
++glyphy_windows(conic_to) (const POINTFX            *control,
++			  const glyphy_point_t     *p2,
++			  glyphy_arc_accumulator_t *acc)
++{
++  glyphy_point_t p1 = {fixed_to_double(control->x), fixed_to_double(control->y)};
++  glyphy_arc_accumulator_conic_to (acc, &p1, p2);
++  return glyphy_arc_accumulator_successful (acc) ? 0 : -1;
++}
++
++/* See https://support.microsoft.com/en-us/kb/87115 */
++
++static int
++glyphy_windows(outline_decompose) (const TTPOLYGONHEADER    *outline,
++				   size_t                    outline_size,
++				   glyphy_arc_accumulator_t *acc)
++{
++  const TTPOLYGONHEADER *polygon = outline;
++  const TTPOLYGONHEADER *outline_end = (const TTPOLYGONHEADER*) ((char *)outline + outline_size);
++
++  int polygon_count = 0;
++  while (polygon < outline_end)
++  {
++    if (((char *)polygon + polygon->cb) > (char *) outline_end)
++      die ("TTPOLYGONHEADER record too large for enclosing data");
++
++    assert(polygon->dwType == TT_POLYGON_TYPE);
++
++    if (glyphy_windows(move_to) (&polygon->pfxStart, acc) == -1)
++      return -1;
++
++    const TTPOLYCURVE *curve = (const TTPOLYCURVE*) (polygon + 1);
++    const TTPOLYCURVE *curve_end = (const TTPOLYCURVE*) ((char *)polygon + polygon->cb);
++    int curve_count = 0;
++    while (curve < curve_end)
++    {
++      if (((char *) &curve->apfx[curve->cpfx]) > (char *) curve_end)
++	die ("TTPOLYCURVE record too large for enclosing TTPOLYGONHEADER\n");
++
++      switch (curve->wType)
++      {
++      case TT_PRIM_LINE:
++	{
++	  int i;
++	  for (i = 0; i < curve->cpfx; i++) {
++	    if (glyphy_windows(line_to) (&curve->apfx[i], acc) == -1)
++	      return -1;
++	  }
++
++	  /* A final TT_PRIM_LINE in a contour automatically closes to the contour start */
++	  if ((const TTPOLYCURVE *) ((char *) &curve->apfx[curve->cpfx]) == curve_end)
++	    if (glyphy_windows(line_to) (&polygon->pfxStart, acc) == -1)
++	      return -1;
++	}
++	break;
++      case TT_PRIM_QSPLINE:
++	{
++	  int i = 0;
++	  while (i < curve->cpfx) {
++	    const POINTFX *control = &curve->apfx[i];
++	    i++;
++	    const POINTFX *p2 = &curve->apfx[i];
++	    glyphy_point_t p2pt = {fixed_to_double(p2->x), fixed_to_double(p2->y)};
++	    if (i == curve->cpfx - 1) {
++	      i++;
++	    } else {
++	      p2pt.x = (p2pt.x + fixed_to_double(control->x)) / 2;
++	      p2pt.y = (p2pt.y + fixed_to_double(control->y)) / 2;
++	    }
++	    if (glyphy_windows(conic_to) (control, &p2pt, acc) == -1)
++	      return -1;
++	  }
++	  /* If the last point of the contour was not the start point, draw a closing line to it */
++	  if ((const TTPOLYCURVE *) ((char *) &curve->apfx[curve->cpfx]) == curve_end)
++	    if (glyphy_windows(line_to) (&polygon->pfxStart, acc) == -1)
++	      return -1;
++	}
++	break;
++      default:
++	die ("Unexpected record in TTPOLYCURVE");
++      }
++      curve = (const TTPOLYCURVE *) ((char *) &curve->apfx[curve->cpfx]);
++    }
++    polygon = (const TTPOLYGONHEADER *) curve_end;
++  }
++  return 0;
++}
++
++#ifdef __cplusplus
++}
++#endif
commit f864c25ad121aaa4fe9410c7ba3fa0e1b16d6ea4
Author: Tor Lillqvist <tml at collabora.com>
Date:   Mon Nov 2 22:29:23 2015 +0200

    The glyphy configury takes no --enable/disable-debug option
    
    Change-Id: Id098945656c0d97a0fc11efb42a0d09efb3e5557

diff --git a/external/glyphy/ExternalProject_glyphy.mk b/external/glyphy/ExternalProject_glyphy.mk
index 463cb81..6243187 100644
--- a/external/glyphy/ExternalProject_glyphy.mk
+++ b/external/glyphy/ExternalProject_glyphy.mk
@@ -29,7 +29,6 @@ $(call gb_ExternalProject_get_state_target,glyphy,build) :
 			, \
 				--enable-shared --disable-static \
 			) \
-			$(if $(ENABLE_DEBUG),--enable-debug,--disable-debug) \
 			$(if $(filter MACOSX,$(OS)),--prefix=/@.__________________________________________________OOO) \
 			$(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \
 		&& $(if $(verbose),V=1) \
commit e9113218ae85603b6d4ca30cb74bc15dd8349f05
Author: Tor Lillqvist <tml at collabora.com>
Date:   Mon Nov 2 22:28:29 2015 +0200

    We (unintentionally?) build a static archive with MSVC
    
    Change-Id: Ief0ccec4b63e2ac767285f4c19175fa000eaad6c

diff --git a/external/glyphy/ExternalPackage_glyphy.mk b/external/glyphy/ExternalPackage_glyphy.mk
index cbae840..b4a32fc 100644
--- a/external/glyphy/ExternalPackage_glyphy.mk
+++ b/external/glyphy/ExternalPackage_glyphy.mk
@@ -13,6 +13,8 @@ $(eval $(call gb_ExternalPackage_use_external_project,glyphy,glyphy))
 
 ifeq ($(OS),MACOSX)
 $(eval $(call gb_ExternalPackage_add_file,glyphy,$(LIBO_LIB_FOLDER)/libglyphy.dylib,src/.libs/libglyphy.dylib))
+else ifeq ($(OS),WNT)
+# We build a static archive with MSVC, so nothing to add
 else ifeq ($(DISABLE_DYNLOADING),)
 $(eval $(call gb_ExternalPackage_add_file,glyphy,$(LIBO_LIB_FOLDER)/libglyphy.so.0,src/.libs/libglyphy.so.0.0.0))
 endif
commit 5174d4dd63be847d55c754f433b98efbbf589cc2
Author: Tor Lillqvist <tml at collabora.com>
Date:   Mon Nov 2 22:27:24 2015 +0200

    Need _USE_MATH_DEFINES with MSVC for M_PI_2
    
    Change-Id: Ieb7671480b88304a94066965d10d455865915090

diff --git a/external/glyphy/ExternalProject_glyphy.mk b/external/glyphy/ExternalProject_glyphy.mk
index 1eda015..463cb81 100644
--- a/external/glyphy/ExternalProject_glyphy.mk
+++ b/external/glyphy/ExternalProject_glyphy.mk
@@ -21,6 +21,7 @@ $(eval $(call gb_ExternalProject_use_externals,glyphy, \
 
 $(call gb_ExternalProject_get_state_target,glyphy,build) :
 	$(call gb_ExternalProject_run,build,\
+	    $(if $(filter MSC,$(COM)),CPPFLAGS=-D_USE_MATH_DEFINES) \
 		MAKE=$(MAKE) ./configure \
 			--with-pic \
 			$(if $(DISABLE_DYNLOADING), \
commit e85be2d400156a95c9b0401c994771d920e47132
Author: Tor Lillqvist <tml at collabora.com>
Date:   Mon Nov 2 18:14:10 2015 +0200

    Fix some thinkos or copy-paste mistakes for glyphy
    
    Change-Id: Ie008086c2a34081c9f50a61808b73b66eda58e2c

diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 64e48ac..9c773f7 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -272,14 +272,14 @@ endef
 
 endif # SYSTEM_GLEW
 
-$(eval $(call gb_Helper_register_packages_for_install,ooo,\
-	liborcus \
-))
-
-ifneq ($(SYSTEM_GLEW),)
+ifneq ($(SYSTEM_GLYPHY),)
 
 else # !SYSTEM_GLYPHY
 
+$(eval $(call gb_Helper_register_packages_for_install,ooo,\
+	glyphy \
+))
+
 define gb_LinkTarget__use_glyphy
 $(call gb_LinkTarget_use_package,$(1),glyphy)
 
@@ -294,7 +294,7 @@ $(call gb_LinkTarget_add_libs,$(1),\
 
 endef
 
-endif GLYPHY
+endif # SYSTEM_GLYPHY
 
 define gb_LinkTarget__use_iconv
 $(call gb_LinkTarget_add_libs,$(1),-liconv)
diff --git a/config_host.mk.in b/config_host.mk.in
index 26200a0..5ed3043 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -525,6 +525,7 @@ export SYSTEM_GENCCODE=@SYSTEM_GENCCODE@
 export SYSTEM_GENCMN=@SYSTEM_GENCMN@
 export SYSTEM_GLEW=@SYSTEM_GLEW@
 export SYSTEM_GLM=@SYSTEM_GLM@
+export SYSTEM_GLYPHY=@SYSTEM_GLYPHY@
 export SYSTEM_GRAPHITE=@SYSTEM_GRAPHITE@
 export SYSTEM_HARFBUZZ=@SYSTEM_HARFBUZZ@
 export SYSTEM_HSQLDB=@SYSTEM_HSQLDB@
diff --git a/external/Module_external.mk b/external/Module_external.mk
index 9daf548..7c78c7d 100644
--- a/external/Module_external.mk
+++ b/external/Module_external.mk
@@ -45,6 +45,7 @@ $(eval $(call gb_Module_add_moduledirs,external,\
 	$(call gb_Helper_optional,FREETYPE,freetype) \
 	$(call gb_Helper_optional,GLEW,glew) \
 	$(call gb_Helper_optional,GLM,glm) \
+	$(call gb_Helper_optional,GLYPHY,glyphy) \
 	$(call gb_Helper_optional,GRAPHITE,graphite) \
 	$(call gb_Helper_optional,HARFBUZZ,harfbuzz) \
 	$(call gb_Helper_optional,HSQLDB,hsqldb) \
diff --git a/external/glyphy/Module_glyphy.mk b/external/glyphy/Module_glyphy.mk
index 084c542..6228bba 100644
--- a/external/glyphy/Module_glyphy.mk
+++ b/external/glyphy/Module_glyphy.mk
@@ -9,7 +9,7 @@
 
 $(eval $(call gb_Module_Module,glyphy))
 
-$(eval $(call gb_Module_add_targets,liborcus,\
+$(eval $(call gb_Module_add_targets,glyphy,\
 	UnpackedTarball_glyphy \
 ))
 
commit 6f57fb1ac2cbfcafdabe100f42005d32808d64a4
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Wed Oct 14 15:06:55 2015 +0200

    link vcl against libglyphy
    
    Change-Id: I5b206f5d857d28acda82ce8ac53f835142f46da2

diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 42f53db..64e48ac 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -272,6 +272,30 @@ endef
 
 endif # SYSTEM_GLEW
 
+$(eval $(call gb_Helper_register_packages_for_install,ooo,\
+	liborcus \
+))
+
+ifneq ($(SYSTEM_GLEW),)
+
+else # !SYSTEM_GLYPHY
+
+define gb_LinkTarget__use_glyphy
+$(call gb_LinkTarget_use_package,$(1),glyphy)
+
+$(call gb_LinkTarget_set_include,$(1),\
+	-I$(call gb_UnpackedTarball_get_dir,glyphy/include) \
+	$$(INCLUDE) \
+)
+
+$(call gb_LinkTarget_add_libs,$(1),\
+	-L$(call gb_UnpackedTarball_get_dir,glyphy)/src/.libs -lglyphy \
+)
+
+endef
+
+endif GLYPHY
+
 define gb_LinkTarget__use_iconv
 $(call gb_LinkTarget_add_libs,$(1),-liconv)
 
diff --git a/external/glyphy/ExternalPackage_glyphy.mk b/external/glyphy/ExternalPackage_glyphy.mk
index 484590d..cbae840 100644
--- a/external/glyphy/ExternalPackage_glyphy.mk
+++ b/external/glyphy/ExternalPackage_glyphy.mk
@@ -11,4 +11,10 @@ $(eval $(call gb_ExternalPackage_ExternalPackage,glyphy,glyphy))
 
 $(eval $(call gb_ExternalPackage_use_external_project,glyphy,glyphy))
 
+ifeq ($(OS),MACOSX)
+$(eval $(call gb_ExternalPackage_add_file,glyphy,$(LIBO_LIB_FOLDER)/libglyphy.dylib,src/.libs/libglyphy.dylib))
+else ifeq ($(DISABLE_DYNLOADING),)
+$(eval $(call gb_ExternalPackage_add_file,glyphy,$(LIBO_LIB_FOLDER)/libglyphy.so.0,src/.libs/libglyphy.so.0.0.0))
+endif
+
 # vim: set noet sw=4 ts=4:
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 0da204a..1d2ec56 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -741,6 +741,10 @@ $(eval $(call gb_Library_add_libs,vcl,\
 	-lXext \
 ))
 
+$(eval $(call gb_Library_use_externals,vcl,\
+	glyphy \
+))
+
 $(eval $(call gb_Library_add_exception_objects,vcl,\
 	vcl/opengl/x11/X11DeviceInfo \
 ))
commit fca8c526e347361476b558fc86f89968a6c220cd
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Tue Oct 13 00:11:13 2015 +0200

    integrate glyphy into the build
    
    The used glyphy is not directly the upstream version. We currently use a
    patched version that allows to disable the build for the demos.
    
    Change-Id: Ic03355e1ea8fbc56e57afa4f90a55741fe9a563a

diff --git a/Makefile.fetch b/Makefile.fetch
index 10317b3..8b2da4e 100644
--- a/Makefile.fetch
+++ b/Makefile.fetch
@@ -130,6 +130,7 @@ $(WORKDIR)/download: $(BUILDDIR)/config_host.mk $(SRCDIR)/download.lst $(SRCDIR)
 		$(call fetch_Optional,FREETYPE,FREETYPE_TARBALL) \
 		$(call fetch_Optional,GLEW,GLEW_TARBALL) \
 		$(call fetch_Optional,GLM,GLM_TARBALL) \
+		$(call fetch_Optional,GLYPHY,GLYPHY_TARBALL) \
 		$(call fetch_Optional_pack,GOOGLE_DOCS_EXTENSION_PACK) \
 		$(call fetch_Optional,GRAPHITE,GRAPHITE_TARBALL) \
 		$(call fetch_Optional,HARFBUZZ,HARFBUZZ_TARBALL) \
diff --git a/configure.ac b/configure.ac
index f142a57..5ed6e0b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -8811,6 +8811,11 @@ AS_IF([test "$with_system_glew" = "yes"],
     [AC_DEFINE([HAVE_GLEW_1_12])])
 
 dnl ===================================================================
+dnl Check for system glyphy
+dnl ===================================================================
+libo_CHECK_SYSTEM_MODULE([glyphy], [GLYPHY], [glyphy >= 0.12.0], ["-I${WORKDIR}/UnpackedTarball/glyphy/include"])
+
+dnl ===================================================================
 dnl Check for system vigra
 dnl ===================================================================
 AC_MSG_CHECKING([which vigra to use])
diff --git a/download.lst b/download.lst
index 4b12005..471894e 100755
--- a/download.lst
+++ b/download.lst
@@ -52,6 +52,7 @@ export FREEHAND_TARBALL := libfreehand-0.1.1.tar.bz2
 export FREETYPE_TARBALL := dbf2caca1d3afd410a29217a9809d397-freetype-2.4.8.tar.bz2
 export GLEW_TARBALL := 3941e9cab2f4f9d8faee3e8d57ae7664-glew-1.12.0.zip
 export GLM_TARBALL := bae83fa5dc7f081768daace6e199adc3-glm-0.9.4.6-libreoffice.zip
+export GLYPHY_TARBALL := 5d303fb955beb9bf112267316ca9d021-glyphy-0.2.0.tar.bz2
 export GRAPHITE_TARBALL := 5c0c9ac0996fbb4a0e17780ff5441959-graphite2-minimal-1.3.4.tgz
 export HARFBUZZ_MD5SUM := 0e27e531f4c4acff601ebff0957755c2
 export HARFBUZZ_TARBALL := harfbuzz-0.9.40.tar.bz2
diff --git a/external/glyphy/ExternalPackage_glyphy.mk b/external/glyphy/ExternalPackage_glyphy.mk
new file mode 100644
index 0000000..484590d
--- /dev/null
+++ b/external/glyphy/ExternalPackage_glyphy.mk
@@ -0,0 +1,14 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_ExternalPackage_ExternalPackage,glyphy,glyphy))
+
+$(eval $(call gb_ExternalPackage_use_external_project,glyphy,glyphy))
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/glyphy/ExternalProject_glyphy.mk b/external/glyphy/ExternalProject_glyphy.mk
new file mode 100644
index 0000000..1eda015
--- /dev/null
+++ b/external/glyphy/ExternalProject_glyphy.mk
@@ -0,0 +1,38 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_ExternalProject_ExternalProject,glyphy))
+
+$(eval $(call gb_ExternalProject_use_autoconf,glyphy,build))
+
+$(eval $(call gb_ExternalProject_register_targets,glyphy,\
+	build \
+))
+
+$(eval $(call gb_ExternalProject_use_externals,glyphy, \
+    glew \
+))
+
+$(call gb_ExternalProject_get_state_target,glyphy,build) :
+	$(call gb_ExternalProject_run,build,\
+		MAKE=$(MAKE) ./configure \
+			--with-pic \
+			$(if $(DISABLE_DYNLOADING), \
+				--enable-static --disable-shared \
+			, \
+				--enable-shared --disable-static \
+			) \
+			$(if $(ENABLE_DEBUG),--enable-debug,--disable-debug) \
+			$(if $(filter MACOSX,$(OS)),--prefix=/@.__________________________________________________OOO) \
+			$(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \
+		&& $(if $(verbose),V=1) \
+		   $(MAKE) \
+	)
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/glyphy/Makefile b/external/glyphy/Makefile
new file mode 100644
index 0000000..e4968cf
--- /dev/null
+++ b/external/glyphy/Makefile
@@ -0,0 +1,7 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+
+module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
+
+include $(module_directory)/../../solenv/gbuild/partial_build.mk
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/glyphy/Module_glyphy.mk b/external/glyphy/Module_glyphy.mk
new file mode 100644
index 0000000..084c542
--- /dev/null
+++ b/external/glyphy/Module_glyphy.mk
@@ -0,0 +1,21 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_Module_Module,glyphy))
+
+$(eval $(call gb_Module_add_targets,liborcus,\
+	UnpackedTarball_glyphy \
+))
+
+$(eval $(call gb_Module_add_targets,glyphy,\
+	ExternalPackage_glyphy \
+	ExternalProject_glyphy \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/glyphy/UnpackedTarball_glyphy.mk b/external/glyphy/UnpackedTarball_glyphy.mk
new file mode 100644
index 0000000..8e2244b
--- /dev/null
+++ b/external/glyphy/UnpackedTarball_glyphy.mk
@@ -0,0 +1,16 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_UnpackedTarball_UnpackedTarball,glyphy))
+
+$(eval $(call gb_UnpackedTarball_set_tarball,glyphy,$(GLYPHY_TARBALL)))
+
+$(eval $(call gb_UnpackedTarball_set_patchlevel,glyphy,1))
+
+# vim: set noet sw=4 ts=4:
commit db5358764fdb1855ee6b401d6165ed65677bdfbe
Author: Philippe Jung <phil.jung at free.fr>
Date:   Wed Nov 18 23:54:29 2015 +0100

    Code cleanup for gerrit change 16723
    
    Simple code clean-up taking into account Maxim Monastirsky remarks.
    
    Change-Id: If6393851c3eb6fd8a460ef95ef88ccf3aed82e3e
    Reviewed-on: https://gerrit.libreoffice.org/20047
    Reviewed-by: Philippe Jung <phil.jung at free.fr>
    Tested-by: Philippe Jung <phil.jung at free.fr>

diff --git a/sd/source/ui/controller/displaymodecontroller.cxx b/sd/source/ui/controller/displaymodecontroller.cxx
index 9d37bd9..df86795 100644
--- a/sd/source/ui/controller/displaymodecontroller.cxx
+++ b/sd/source/ui/controller/displaymodecontroller.cxx
@@ -239,22 +239,8 @@ void DisplayModeToolbarMenu::SelectHdl(void * pControl)
     mrController.setToolboxItemImage( nImage );
 }
 
-OUString DisplayModeController_getImplementationName() throw (css::uno::RuntimeException)
-{
-    return OUString( "com.sun.star.comp.sd.DisplayModeController" );
-}
-
-Sequence< OUString >  DisplayModeController_getSupportedServiceNames() throw( RuntimeException )
-{
-    Sequence< OUString > aSNS( 1 );
-    aSNS.getArray()[0] = "com.sun.star.frame.ToolbarController";
-    return aSNS;
-}
-
-// class SlideLayoutController
-
-DisplayModeController::DisplayModeController( const Reference< uno::XComponentContext >& rxContext, const OUString& sCommandURL )
-: svt::PopupWindowController( rxContext, Reference< frame::XFrame >(), sCommandURL )
+DisplayModeController::DisplayModeController( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext )
+: svt::PopupWindowController( rxContext, Reference< frame::XFrame >(), OUString() )
 {
 }
 
@@ -262,6 +248,10 @@ void SAL_CALL DisplayModeController::initialize( const css::uno::Sequence< css::
         throw ( css::uno::Exception, css::uno::RuntimeException, std::exception )
 {
     svt::PopupWindowController::initialize( aArguments );
+    ToolBox* pToolBox = nullptr;
+    sal_uInt16 nId = 0;
+    if ( getToolboxId( nId, &pToolBox ) )
+        pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) | ToolBoxItemBits::DROPDOWNONLY );
     setToolboxItemImage( BMP_DISPLAYMODE_SLIDE );
 }
 
@@ -273,33 +263,33 @@ VclPtr<vcl::Window> DisplayModeController::createPopupWindow( vcl::Window* pPare
 void DisplayModeController::setToolboxItemImage( sal_uInt16 nImage )
 {
     sal_uInt16 nId;
-    ToolBox* pToolBox;
-    getToolboxId( nId, &pToolBox );
-
-    SdResId resId( nImage );
-    BitmapEx aBmp( resId );
-    int targetSize = (pToolBox->GetToolboxButtonSize() == TOOLBOX_BUTTONSIZE_LARGE) ? 32 : 16;
-    double scale = 1.0f;
-    Size size = aBmp.GetSizePixel();
-    if (size.Width() > targetSize)
-        scale = (double)targetSize / (double)size.Width();
-    if (size.Height() > targetSize)
-        scale = ::std::min( scale, (double)targetSize / (double)size.Height() );
-    aBmp.Scale( scale, scale );
-    pToolBox->SetItemImage( nId, Image( aBmp ) );
-
+    ToolBox* pToolBox = nullptr;
+    if (getToolboxId( nId, &pToolBox )) {
+        SdResId resId( nImage );
+        BitmapEx aBmp( resId );
+        int targetSize = (pToolBox->GetToolboxButtonSize() == TOOLBOX_BUTTONSIZE_LARGE) ? 32 : 16;
+        double scale = 1.0f;
+        Size size = aBmp.GetSizePixel();
+        if (size.Width() > targetSize)
+            scale = (double)targetSize / (double)size.Width();
+        if (size.Height() > targetSize)
+            scale = ::std::min( scale, (double)targetSize / (double)size.Height() );
+        aBmp.Scale( scale, scale );
+        pToolBox->SetItemImage( nId, Image( aBmp ) );
+    }
 }
 
 // XServiceInfo
 
 OUString SAL_CALL DisplayModeController::getImplementationName() throw( RuntimeException, std::exception )
 {
-    return DisplayModeController_getImplementationName();
+    return OUString( "com.sun.star.comp.sd.DisplayModeController" );;
 }
 
 Sequence< OUString > SAL_CALL DisplayModeController::getSupportedServiceNames(  ) throw( RuntimeException, std::exception )
 {
-    return DisplayModeController_getSupportedServiceNames();
+    css::uno::Sequence<OUString> aRet { "com.sun.star.frame.ToolbarController" };
+    return aRet;
 }
 
 }
@@ -309,7 +299,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface* SAL_CALL
 com_sun_star_comp_sd_DisplayModeController_get_implementation(::com::sun::star::uno::XComponentContext* context,
                                                               ::com::sun::star::uno::Sequence<css::uno::Any> const &)
 {
-    return cppu::acquire(new sd::DisplayModeController(context, ".uno:DisplayMode"));
+    return cppu::acquire(new sd::DisplayModeController(context));
 }
 
 
diff --git a/sd/source/ui/controller/displaymodecontroller.hxx b/sd/source/ui/controller/displaymodecontroller.hxx
index ff2f250..8167890 100644
--- a/sd/source/ui/controller/displaymodecontroller.hxx
+++ b/sd/source/ui/controller/displaymodecontroller.hxx
@@ -28,8 +28,7 @@ namespace sd
 class DisplayModeController : public svt::PopupWindowController
 {
 public:
-    DisplayModeController( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext,
-                           const OUString& sCommandURL );
+    DisplayModeController( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext );
 
     virtual VclPtr<vcl::Window> createPopupWindow( vcl::Window* pParent ) SAL_OVERRIDE;
 
diff --git a/sd/source/ui/view/drviewse.cxx b/sd/source/ui/view/drviewse.cxx
index 80b2bab..a293696 100644
--- a/sd/source/ui/view/drviewse.cxx
+++ b/sd/source/ui/view/drviewse.cxx
@@ -56,7 +56,6 @@
 #include <tools/urlobj.hxx>
 #include <svl/slstitm.hxx>
 #include <sfx2/ipclient.hxx>
-#include <sfx2/sidebar/Sidebar.hxx>
 #include <toolkit/helper/vclunohelper.hxx>
 #include <avmedia/mediawindow.hxx>
 #include <svl/urihelper.hxx>
commit f08d0142afbcb45c12604988022bb3da18be1d84
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Nov 18 17:01:13 2015 +0100

    Fix css.awt.XSystemDependentMenuPeer.getMenuHandle
    
    ...to return an ANY containing a 64-bit HYPER instead of a 32-bit LONG for
    SYSTEM_WIN32 (which covers both 32-bit and 64-bit versions of Windows), so that
    the HMENU value (which is effectively a void*) is not truncated for the 64-bit
    build.
    
    This should effectively be URE ABI compatible for the 32-bit build, as there the
    HYPER value will fit into 32 bits, so extracting a LONG from the ANY should
    still work.
    
    Change-Id: Ief3de5924f672e8f6bbe6df08c15439456ca036f
    Reviewed-on: https://gerrit.libreoffice.org/20045
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/embedserv/source/embed/docholder.cxx b/embedserv/source/embed/docholder.cxx
index e373986..a88b1ba 100644
--- a/embedserv/source/embed/docholder.cxx
+++ b/embedserv/source/embed/docholder.cxx
@@ -377,7 +377,7 @@ HRESULT DocumentHolder::InPlaceActivate(
                     uno::UNO_QUERY);
                 aAny = xSDMP->getMenuHandle(
                     aProcessIdent,lang::SystemDependent::SYSTEM_WIN32);
-                sal_Int32 tmp;
+                sal_Int64 tmp;
                 if( aAny >>= tmp )
                     m_nMenuHandle = HMENU(tmp);
                 m_xLayoutManager->hideElement(
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index 3f44ebe..5f2b85a 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -210,7 +210,8 @@ Any SAL_CALL MenuBarManager::getMenuHandle( const Sequence< sal_Int8 >& /*Proces
 #ifdef _WIN32
         if( SystemType == SystemDependent::SYSTEM_WIN32 )
         {
-            a <<= (long) aSystemMenuData.hMenu;
+            a <<= sal_Int64(
+                reinterpret_cast<sal_IntPtr>(aSystemMenuData.hMenu));
         }
 #else
         (void) SystemType;
commit f1132fd50a2c5c0e3de5656382b4cea1e826e520
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Nov 18 16:54:32 2015 +0100

    SystemMenuData::nSize is never read
    
    ...and of little use if all users of SystemMenuData agree on the definition in
    vcl/sysdata.hxx
    
    Change-Id: Id102a30074b611e3ad37ce69ce27c929f4505495
    Reviewed-on: https://gerrit.libreoffice.org/20044
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
    Tested-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index 346757a..3f44ebe 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -205,7 +205,6 @@ Any SAL_CALL MenuBarManager::getMenuHandle( const Sequence< sal_Int8 >& /*Proces
     if ( m_pVCLMenu )
     {
         SystemMenuData aSystemMenuData;
-        aSystemMenuData.nSize = sizeof( SystemMenuData );
 
         m_pVCLMenu->GetSystemMenuData( &aSystemMenuData );
 #ifdef _WIN32
diff --git a/include/vcl/sysdata.hxx b/include/vcl/sysdata.hxx
index 2c50797..5ae9947 100644
--- a/include/vcl/sysdata.hxx
+++ b/include/vcl/sysdata.hxx
@@ -120,7 +120,6 @@ struct SystemParentData
 
 struct SystemMenuData
 {
-    unsigned long   nSize;          // size in bytes of this structure
 #if defined( WNT )
     HMENU           hMenu;          // the menu handle of the menu bar
 #elif defined( MACOSX )
commit f53615de094a7ae3edf429a97a9fa562014ec480
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Nov 18 16:43:29 2015 +0100

    Don't wrongly redefine SystemMenuData
    
    ...with a long instead of a HMENU on WNT, so with a wrong size for 64-bit WNT.
    (And just ignore the comment that TRIES TO SHOUT AT ME!!!!!!!!!!!!!!!)
    
    Change-Id: Id02ef4d8a3818b58def067e8b52f29bac8676fe9
    Reviewed-on: https://gerrit.libreoffice.org/20043
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index 0c4553b..346757a 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -66,6 +66,7 @@
 #include <unotools/localfilehelper.hxx>
 #include <toolkit/helper/vclunohelper.hxx>
 #include <vcl/svapp.hxx>
+#include <vcl/sysdata.hxx>
 #include <vcl/window.hxx>
 #include <vcl/menu.hxx>
 #include <vcl/settings.hxx>
@@ -80,16 +81,6 @@
 #include <boost/noncopyable.hpp>
 #include <tools/urlobj.hxx>
 
-// Be careful removing this "bad" construct. There are serious problems
-// with #define STRICT and including windows.h. Changing this needs some
-// redesign on other projects, too. Especially sal/main.h which defines
-// HINSTANCE depending on STRICT!!!!!!!!!!!!!!!
-struct SystemMenuData
-{
-    unsigned long nSize;
-    long          hMenu;
-};
-
 using namespace ::cppu;
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
commit 78214c982e1fab18b9f6c694a3b56c520da1724d
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date:   Wed Nov 18 22:26:32 2015 +0200

    Revert "ToolBox: Remove unused methods"
    
    The ImplLoadRes method *is* used in
    ToolBox::ToolBox( vcl::Window* pParent, const ResId& rResId ).
    This change breaks the navigator panel, and therefore the
    JunitTest_toolkit_unoapi_1 test.
    
    This reverts commit 99648095012187ef284d0a9399a8e12878b2a370.

diff --git a/include/vcl/toolbox.hxx b/include/vcl/toolbox.hxx
index 13aff0f..81f6297 100644
--- a/include/vcl/toolbox.hxx
+++ b/include/vcl/toolbox.hxx
@@ -190,6 +190,7 @@ private:
     SAL_DLLPRIVATE void            ImplInit( vcl::Window* pParent, WinBits nStyle );
     using DockingWindow::ImplInitSettings;
     SAL_DLLPRIVATE void            ImplInitSettings( bool bFont, bool bForeground, bool bBackground );
+    SAL_DLLPRIVATE void            ImplLoadRes( const ResId& rResId );
     SAL_DLLPRIVATE ImplToolItem*   ImplGetItem( sal_uInt16 nId ) const;
     SAL_DLLPRIVATE bool            ImplCalcItem();
     SAL_DLLPRIVATE sal_uInt16      ImplCalcBreaks( long nWidth, long* pMaxLineWidth, bool bCalcHorz );
@@ -311,6 +312,8 @@ public:
     virtual void        Resizing( Size& rSize ) override;
     virtual Size        GetOptimalSize() const override;
 
+    void                InsertItem( const ResId& rResId,
+                                    sal_uInt16 nPos = TOOLBOX_APPEND );
     /// Insert a command (like '.uno:Save').
     virtual void        InsertItem( const OUString& rCommand,
                                     const css::uno::Reference<css::frame::XFrame>& rFrame,
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index b9ad577..01a7305 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -1540,6 +1540,61 @@ void ToolBox::ImplInitSettings(bool bFont, bool bForeground, bool bBackground)
     }
 }
 
+void ToolBox::ImplLoadRes( const ResId& rResId )
+{
+    ResMgr* pMgr = rResId.GetResMgr();
+    if( ! pMgr )
+        return;
+
+    DockingWindow::ImplLoadRes( rResId );
+
+    sal_uLong              nObjMask;
+
+    nObjMask = ReadLongRes();
+
+    if ( nObjMask & RSC_TOOLBOX_BUTTONTYPE )
+        SetButtonType( (ButtonType)ReadLongRes() );
+
+    if ( nObjMask & RSC_TOOLBOX_ALIGN )
+        SetAlign( (WindowAlign)ReadLongRes() );
+
+    if ( nObjMask & RSC_TOOLBOX_LINECOUNT )
+        SetLineCount( sal::static_int_cast<sal_uInt16>(ReadLongRes()) );
+
+    if ( nObjMask & RSC_TOOLBOX_CUSTOMIZE )
+    {
+        bool bCust = ReadShortRes();
+        EnableCustomize( bCust );
+    }
+
+    if ( nObjMask & RSC_TOOLBOX_MENUSTRINGS )
+    {
+        bool bCust = ReadShortRes();
+        EnableMenuStrings( bCust );
+    }
+
+    if ( nObjMask & RSC_TOOLBOX_FLOATLINES )
+        SetFloatingLines( ReadShortRes() );
+
+    if ( nObjMask & RSC_TOOLBOX_ITEMIMAGELIST )
+    {
+        maImageList = ImageList( ResId( static_cast<RSHEADER_TYPE*>(GetClassRes()), *pMgr ) );
+        IncrementRes( GetObjSizeRes( static_cast<RSHEADER_TYPE*>(GetClassRes()) ) );
+    }
+
+    if ( nObjMask & RSC_TOOLBOX_ITEMLIST )
+    {
+        sal_uLong nEle = ReadLongRes();
+
+        // insert item
+        for ( sal_uLong i = 0; i < nEle; i++ )
+        {
+            InsertItem( ResId( static_cast<RSHEADER_TYPE *>(GetClassRes()), *pMgr ) );
+            IncrementRes( GetObjSizeRes( static_cast<RSHEADER_TYPE *>(GetClassRes()) ) );
+        }
+    }
+}
+
 ToolBox::ToolBox( vcl::Window* pParent, WinBits nStyle ) :
     DockingWindow( WINDOW_TOOLBOX )
 {
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index 7833345..8899577 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -448,6 +448,96 @@ void ToolBox::Select()
         pWrapper->GetFloatingWindow()->EndPopupMode();
 }
 
+void ToolBox::InsertItem( const ResId& rResId, sal_uInt16 nPos )
+{
+    sal_uLong nObjMask;
+    bool      bImage = false;     // has image
+
+    // create item
+    ImplToolItem aItem;
+
+    GetRes( rResId.SetRT( RSC_TOOLBOXITEM ) );
+    nObjMask            = ReadLongRes();
+
+    if ( nObjMask & RSC_TOOLBOXITEM_ID )
+        aItem.mnId = sal::static_int_cast<sal_uInt16>(ReadLongRes());
+    else
+        aItem.mnId = 1;
+
+    if ( nObjMask & RSC_TOOLBOXITEM_TYPE )
+        aItem.meType = (ToolBoxItemType)ReadLongRes();
+
+    if ( nObjMask & RSC_TOOLBOXITEM_STATUS )
+        aItem.mnBits = (ToolBoxItemBits)ReadLongRes();
+
+    if( nObjMask & RSC_TOOLBOXITEM_HELPID )
+        aItem.maHelpId = ReadByteStringRes();
+
+    if ( nObjMask & RSC_TOOLBOXITEM_TEXT )
+    {
+        aItem.maText = ReadStringRes();
+        aItem.maText = ImplConvertMenuString( aItem.maText );
+    }
+    if ( nObjMask & RSC_TOOLBOXITEM_HELPTEXT )
+        aItem.maHelpText = ReadStringRes();
+
+    if ( nObjMask & RSC_TOOLBOXITEM_BITMAP )
+    {
+        Bitmap aBmp = Bitmap( ResId( static_cast<RSHEADER_TYPE*>(GetClassRes()), *rResId.GetResMgr() ) );
+        IncrementRes( GetObjSizeRes( static_cast<RSHEADER_TYPE*>(GetClassRes()) ) );
+        aItem.maImage = Image( aBmp, IMAGE_STDBTN_COLOR );
+        bImage = true;
+    }
+    if ( nObjMask & RSC_TOOLBOXITEM_IMAGE )
+    {
+        aItem.maImage = Image( ResId( static_cast<RSHEADER_TYPE*>(GetClassRes()), *rResId.GetResMgr() ) );
+        IncrementRes( GetObjSizeRes( static_cast<RSHEADER_TYPE*>(GetClassRes()) ) );
+        bImage = true;
+    }
+    if ( nObjMask & RSC_TOOLBOXITEM_DISABLE )
+        aItem.mbEnabled = ReadShortRes() == 0;
+
+    if ( nObjMask & RSC_TOOLBOXITEM_STATE )
+        aItem.meState   = (TriState)ReadLongRes();
+
+    if ( nObjMask & RSC_TOOLBOXITEM_HIDE )
+        aItem.mbVisible = ReadShortRes() == 0;
+
+    if ( nObjMask & RSC_TOOLBOXITEM_COMMAND )
+        aItem.maCommandStr = ReadStringRes();
+
+    // if no image is loaded, try to load one from the image list
+    if ( !bImage && aItem.mnId )
+        aItem.maImage = maImageList.GetImage( aItem.mnId );
+
+    // if this is a ButtonItem, check ID
+    bool bNewCalc;
+    if ( aItem.meType != ToolBoxItemType::BUTTON )
+    {
+        bNewCalc = false;
+        aItem.mnId = 0;
+    }
+    else
+    {
+        bNewCalc = true;
+
+        DBG_ASSERT( aItem.mnId, "ToolBox::InsertItem(): ItemId == 0" );
+        DBG_ASSERT( GetItemPos( aItem.mnId ) == TOOLBOX_ITEM_NOTFOUND,
+                    "ToolBox::InsertItem(): ItemId already exists" );
+    }
+
+    // create item and add to list
+    mpData->m_aItems.insert( (nPos < mpData->m_aItems.size()) ? mpData->m_aItems.begin()+nPos : mpData->m_aItems.end(), aItem );
+    mpData->ImplClearLayoutData();
+
+    // recalculate ToolBox and redraw
+    ImplInvalidate( bNewCalc );
+
+    // Notify
+    sal_uInt16 nNewPos = sal::static_int_cast<sal_uInt16>(( nPos == TOOLBOX_APPEND ) ? ( mpData->m_aItems.size() - 1 ) : nPos);
+    CallEventListeners( VCLEVENT_TOOLBOX_ITEMADDED, reinterpret_cast< void* >( nNewPos ) );
+}
+
 void ToolBox::InsertItem( sal_uInt16 nItemId, const Image& rImage,
                           ToolBoxItemBits nBits, sal_uInt16 nPos )
 {
commit eedcc2c45c09e3180061ae1dfa0eb9d64afc3f39
Author: Eike Rathke <erack at redhat.com>
Date:   Wed Nov 18 20:57:49 2015 +0100

    cosmetics
    
    Change-Id: Ic06bef4c80426b97a2613fe296ae0aa0ee55a215

diff --git a/formula/source/core/api/token.cxx b/formula/source/core/api/token.cxx
index 2716271..d46b02d 100644
--- a/formula/source/core/api/token.cxx
+++ b/formula/source/core/api/token.cxx
@@ -331,10 +331,10 @@ bool FormulaToken::TextEqual( const FormulaToken& rToken ) const
 
 
 
-sal_uInt8 FormulaByteToken::GetByte() const                       { return nByte; }
-void FormulaByteToken::SetByte( sal_uInt8 n )                     { nByte = n; }
-bool FormulaByteToken::IsInForceArray() const                { return bIsInForceArray; }
-void FormulaByteToken::SetInForceArray( bool b )             { bIsInForceArray = b; }
+sal_uInt8   FormulaByteToken::GetByte() const           { return nByte; }
+void        FormulaByteToken::SetByte( sal_uInt8 n )    { nByte = n; }
+bool        FormulaByteToken::IsInForceArray() const    { return bIsInForceArray; }
+void        FormulaByteToken::SetInForceArray( bool b ) { bIsInForceArray = b; }
 bool FormulaByteToken::operator==( const FormulaToken& r ) const
 {
     return FormulaToken::operator==( r ) && nByte == r.GetByte() &&
@@ -342,16 +342,16 @@ bool FormulaByteToken::operator==( const FormulaToken& r ) const
 }
 
 
-FormulaToken* FormulaFAPToken::GetFAPOrigToken() const { return pOrigToken.get(); }
+FormulaToken* FormulaFAPToken::GetFAPOrigToken() const  { return pOrigToken.get(); }
 bool FormulaFAPToken::operator==( const FormulaToken& r ) const
 {
     return FormulaByteToken::operator==( r ) && pOrigToken == r.GetFAPOrigToken();
 }
 
 
-short* FormulaJumpToken::GetJump() const                     { return pJump; }
-bool FormulaJumpToken::IsInForceArray() const                { return bIsInForceArray; }
-void FormulaJumpToken::SetInForceArray( bool b )             { bIsInForceArray = b; }
+short*  FormulaJumpToken::GetJump() const               { return pJump; }
+bool    FormulaJumpToken::IsInForceArray() const        { return bIsInForceArray; }
+void    FormulaJumpToken::SetInForceArray( bool b )     { bIsInForceArray = b; }
 bool FormulaJumpToken::operator==( const FormulaToken& r ) const
 {
     return FormulaToken::operator==( r ) && pJump[0] == r.GetJump()[0] &&
@@ -1686,9 +1686,9 @@ bool FormulaIndexToken::operator==( const FormulaToken& r ) const
     return FormulaToken::operator==( r ) && nIndex == r.GetIndex() &&
         mbGlobal == r.IsGlobal();
 }
-const OUString&   FormulaExternalToken::GetExternal() const    { return aExternal; }
-sal_uInt8            FormulaExternalToken::GetByte() const        { return nByte; }
-void            FormulaExternalToken::SetByte( sal_uInt8 n )      { nByte = n; }
+const OUString& FormulaExternalToken::GetExternal() const       { return aExternal; }
+sal_uInt8       FormulaExternalToken::GetByte() const           { return nByte; }
+void            FormulaExternalToken::SetByte( sal_uInt8 n )    { nByte = n; }
 bool FormulaExternalToken::operator==( const FormulaToken& r ) const
 {
     return FormulaToken::operator==( r ) && nByte == r.GetByte() &&
@@ -1696,8 +1696,8 @@ bool FormulaExternalToken::operator==( const FormulaToken& r ) const
 }
 
 
-sal_uInt16          FormulaErrorToken::GetError() const          { return nError; }
-void            FormulaErrorToken::SetError( sal_uInt16 nErr )   { nError = nErr; }
+sal_uInt16      FormulaErrorToken::GetError() const             { return nError; }
+void            FormulaErrorToken::SetError( sal_uInt16 nErr )  { nError = nErr; }
 bool FormulaErrorToken::operator==( const FormulaToken& r ) const
 {
     return FormulaToken::operator==( r ) &&
diff --git a/include/formula/token.hxx b/include/formula/token.hxx
index 2dd8f8c..f2a93b6 100644
--- a/include/formula/token.hxx
+++ b/include/formula/token.hxx
@@ -126,8 +126,8 @@ public:
             const_cast<FormulaToken*>(this)->Delete();
     }
 
-    inline oslInterlockedCount GetRef() const { return mnRefCnt; }
-    inline OpCode               GetOpCode() const       { return eOp; }
+    inline oslInterlockedCount GetRef() const       { return mnRefCnt; }
+    inline OpCode              GetOpCode() const    { return eOp; }
 
     /**
         Dummy methods to avoid switches and casts where possible,
@@ -150,23 +150,23 @@ public:
     virtual void                SetInForceArray( bool b );
     virtual double              GetDouble() const;
     virtual double&             GetDoubleAsReference();
-    virtual svl::SharedString GetString() const;
+    virtual svl::SharedString   GetString() const;
     virtual sal_uInt16          GetIndex() const;
     virtual void                SetIndex( sal_uInt16 n );
     virtual bool                IsGlobal() const;
     virtual void                SetGlobal( bool b );
     virtual short*              GetJump() const;
-    virtual const OUString&       GetExternal() const;
+    virtual const OUString&     GetExternal() const;
     virtual FormulaToken*       GetFAPOrigToken() const;
     virtual sal_uInt16          GetError() const;
     virtual void                SetError( sal_uInt16 );
 
-    virtual const ScSingleRefData*    GetSingleRef() const;
-    virtual ScSingleRefData*      GetSingleRef();
+    virtual const ScSingleRefData*  GetSingleRef() const;
+    virtual ScSingleRefData*        GetSingleRef();
     virtual const ScComplexRefData* GetDoubleRef() const;
     virtual ScComplexRefData*       GetDoubleRef();
-    virtual const ScSingleRefData*    GetSingleRef2() const;
-    virtual ScSingleRefData*      GetSingleRef2();
+    virtual const ScSingleRefData*  GetSingleRef2() const;
+    virtual ScSingleRefData*        GetSingleRef2();
     virtual const ScMatrix*     GetMatrix() const;
     virtual ScMatrix*           GetMatrix();
     virtual ScJumpMatrix*       GetJumpMatrix() const;
commit 270f8ea48b4d4cec8e1d6e37dd5147b8f4d74b34
Author: Eike Rathke <erack at redhat.com>
Date:   Wed Nov 18 20:40:56 2015 +0100

    rename FormulaToken HasForceArray to IsInForceArray
    
    ... to name it was it does and to distinguish from
    ScParameterClassification::HasForceArray(OpCode) which IS about a
    function having ForceArray parameters.
    
    Change-Id: I8af4e1d0353cdb5ad0a9b837ae0763dc77242734

diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index 421e829..c4ca443 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -2262,15 +2262,15 @@ void FormulaCompiler::ForceArrayOperator( FormulaTokenRef& rCurr )
     if (!(rCurr->GetOpCode() != ocPush && (rCurr->GetType() == svByte || rCurr->GetType() == svJump)))
         return;
 
-    if (pCurrentFactorToken->HasForceArray())
+    if (pCurrentFactorToken->IsInForceArray())
     {
-        rCurr->SetForceArray( true);
+        rCurr->SetInForceArray( true);
         return;
     }
 
     if (nCurrentFactorParam && IsForceArrayParameter( pCurrentFactorToken.get(),
                 static_cast<sal_uInt8>(nCurrentFactorParam - 1)))
-        rCurr->SetForceArray( true);
+        rCurr->SetInForceArray( true);
 }
 
 void FormulaCompiler::CheckSetForceArrayParameter( FormulaTokenRef& rCurr, sal_uInt8 nParam )
diff --git a/formula/source/core/api/token.cxx b/formula/source/core/api/token.cxx
index e7da2bd..2716271 100644
--- a/formula/source/core/api/token.cxx
+++ b/formula/source/core/api/token.cxx
@@ -174,15 +174,15 @@ void FormulaToken::SetByte( sal_uInt8 )
     SAL_WARN( "formula.core", "FormulaToken::SetByte: virtual dummy called" );
 }
 
-bool FormulaToken::HasForceArray() const
+bool FormulaToken::IsInForceArray() const
 {
     // ok to be called for any derived class
     return false;
 }
 
-void FormulaToken::SetForceArray( bool )
+void FormulaToken::SetInForceArray( bool )
 {
-    SAL_WARN( "formula.core", "FormulaToken::SetForceArray: virtual dummy called" );
+    SAL_WARN( "formula.core", "FormulaToken::SetInForceArray: virtual dummy called" );
 }
 
 double FormulaToken::GetDouble() const
@@ -333,12 +333,12 @@ bool FormulaToken::TextEqual( const FormulaToken& rToken ) const
 
 sal_uInt8 FormulaByteToken::GetByte() const                       { return nByte; }
 void FormulaByteToken::SetByte( sal_uInt8 n )                     { nByte = n; }
-bool FormulaByteToken::HasForceArray() const                 { return bHasForceArray; }
-void FormulaByteToken::SetForceArray( bool b )               { bHasForceArray = b; }
+bool FormulaByteToken::IsInForceArray() const                { return bIsInForceArray; }
+void FormulaByteToken::SetInForceArray( bool b )             { bIsInForceArray = b; }
 bool FormulaByteToken::operator==( const FormulaToken& r ) const
 {
     return FormulaToken::operator==( r ) && nByte == r.GetByte() &&
-        bHasForceArray == r.HasForceArray();
+        bIsInForceArray == r.IsInForceArray();
 }
 
 
@@ -350,13 +350,13 @@ bool FormulaFAPToken::operator==( const FormulaToken& r ) const
 
 
 short* FormulaJumpToken::GetJump() const                     { return pJump; }
-bool FormulaJumpToken::HasForceArray() const                 { return bHasForceArray; }
-void FormulaJumpToken::SetForceArray( bool b )               { bHasForceArray = b; }
+bool FormulaJumpToken::IsInForceArray() const                { return bIsInForceArray; }
+void FormulaJumpToken::SetInForceArray( bool b )             { bIsInForceArray = b; }
 bool FormulaJumpToken::operator==( const FormulaToken& r ) const
 {
     return FormulaToken::operator==( r ) && pJump[0] == r.GetJump()[0] &&
         memcmp( pJump+1, r.GetJump()+1, pJump[0] * sizeof(short) ) == 0 &&
-        bHasForceArray == r.HasForceArray();
+        bIsInForceArray == r.IsInForceArray();
 }
 FormulaJumpToken::~FormulaJumpToken()
 {
diff --git a/include/formula/token.hxx b/include/formula/token.hxx
index 23d9787..2dd8f8c 100644
--- a/include/formula/token.hxx
+++ b/include/formula/token.hxx
@@ -138,16 +138,16 @@ public:
           which of course is 0 on non-functions. FormulaByteToken and ScExternal do
           override it.
 
-        - HasForceArray() since also this is only used for operators and
-          functions and is 0 for other tokens.
+        - IsInForceArray() since also this is only used for operators and
+          functions and is false for other tokens.
 
         Any other non-overridden method pops up an assertion.
      */
 
     virtual sal_uInt8           GetByte() const;
     virtual void                SetByte( sal_uInt8 n );
-    virtual bool                HasForceArray() const;
-    virtual void                SetForceArray( bool b );
+    virtual bool                IsInForceArray() const;
+    virtual void                SetInForceArray( bool b );
     virtual double              GetDouble() const;
     virtual double&             GetDoubleAsReference();
     virtual svl::SharedString GetString() const;
@@ -207,30 +207,30 @@ class FORMULA_DLLPUBLIC FormulaByteToken : public FormulaToken
 {
 private:
             sal_uInt8           nByte;
-            bool                bHasForceArray;
+            bool                bIsInForceArray;
 protected:
                                 FormulaByteToken( OpCode e, sal_uInt8 n, StackVar v, bool b ) :
                                     FormulaToken( v,e ), nByte( n ),
-                                    bHasForceArray( b ) {}
+                                    bIsInForceArray( b ) {}
 public:
                                 FormulaByteToken( OpCode e, sal_uInt8 n, bool b ) :
                                     FormulaToken( svByte,e ), nByte( n ),
-                                    bHasForceArray( b ) {}
+                                    bIsInForceArray( b ) {}
                                 FormulaByteToken( OpCode e, sal_uInt8 n ) :
                                     FormulaToken( svByte,e ), nByte( n ),
-                                    bHasForceArray( false ) {}
+                                    bIsInForceArray( false ) {}
                                 FormulaByteToken( OpCode e ) :
                                     FormulaToken( svByte,e ), nByte( 0 ),
-                                    bHasForceArray( false ) {}
+                                    bIsInForceArray( false ) {}
                                 FormulaByteToken( const FormulaByteToken& r ) :
                                     FormulaToken( r ), nByte( r.nByte ),
-                                    bHasForceArray( r.bHasForceArray ) {}
+                                    bIsInForceArray( r.bIsInForceArray ) {}
 
     virtual FormulaToken*       Clone() const override { return new FormulaByteToken(*this); }
     virtual sal_uInt8           GetByte() const override;
     virtual void                SetByte( sal_uInt8 n ) override;
-    virtual bool                HasForceArray() const override;
-    virtual void                SetForceArray( bool b ) override;
+    virtual bool                IsInForceArray() const override;
+    virtual void                SetInForceArray( bool b ) override;
     virtual bool                operator==( const FormulaToken& rToken ) const override;
 
     DECL_FIXEDMEMPOOL_NEWDEL_DLL( FormulaByteToken )
@@ -365,18 +365,18 @@ class FORMULA_DLLPUBLIC FormulaJumpToken : public FormulaToken
 {
 private:
             short*              pJump;
-            bool                bHasForceArray;
+            bool                bIsInForceArray;
 public:
                                 FormulaJumpToken( OpCode e, short* p ) :
                                     FormulaToken( formula::svJump , e),
-                                    bHasForceArray( false)
+                                    bIsInForceArray( false)
                                 {
                                     pJump = new short[ p[0] + 1 ];
                                     memcpy( pJump, p, (p[0] + 1) * sizeof(short) );
                                 }
                                 FormulaJumpToken( const FormulaJumpToken& r ) :
                                     FormulaToken( r ),
-                                    bHasForceArray( r.bHasForceArray)
+                                    bIsInForceArray( r.bIsInForceArray)
                                 {
                                     pJump = new short[ r.pJump[0] + 1 ];
                                     memcpy( pJump, r.pJump, (r.pJump[0] + 1) * sizeof(short) );
@@ -385,8 +385,8 @@ public:
     virtual short*              GetJump() const override;
     virtual bool                operator==( const formula::FormulaToken& rToken ) const override;
     virtual FormulaToken*       Clone() const override { return new FormulaJumpToken(*this); }
-    virtual bool                HasForceArray() const override;
-    virtual void                SetForceArray( bool b ) override;
+    virtual bool                IsInForceArray() const override;
+    virtual void                SetInForceArray( bool b ) override;
 };
 
 
diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx
index c563323..3c8a12e 100644
--- a/sc/inc/compiler.hxx
+++ b/sc/inc/compiler.hxx
@@ -104,7 +104,7 @@ public:
         double      nValue;
         struct {
             sal_uInt8        cByte;
-            bool        bHasForceArray;
+            bool        bIsInForceArray;
         } sbyte;
     };
                 DECL_FIXEDMEMPOOL_NEWDEL( ScDoubleRawToken );
@@ -121,7 +121,7 @@ public:
         double       nValue;
         struct {
             sal_uInt8        cByte;
-            bool        bHasForceArray;
+            bool        bIsInForceArray;
         } sbyte;
         ScComplexRefData aRef;
         struct {
diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index c35248d..9bdb461 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -910,7 +910,7 @@ public:
 
 inline void ScInterpreter::MatrixDoubleRefToMatrix()
 {
-    if ( (bMatrixFormula || pCur->HasForceArray()) && GetStackType() == formula::svDoubleRef )
+    if ( (bMatrixFormula || pCur->IsInForceArray()) && GetStackType() == formula::svDoubleRef )
     {
         GetTokenMatrixMap();    // make sure it exists, create if not.
         PopDoubleRefPushMatrix();
@@ -919,7 +919,7 @@ inline void ScInterpreter::MatrixDoubleRefToMatrix()
 
 inline bool ScInterpreter::MatrixParameterConversion()
 {
-    if ( (bMatrixFormula || pCur->HasForceArray() || ScParameterClassification::HasForceArray( pCur->GetOpCode())) &&
+    if ( (bMatrixFormula || pCur->IsInForceArray() || ScParameterClassification::HasForceArray( pCur->GetOpCode())) &&
             !pJumpMatrix && sp > 0 )
         return ConvertMatrixParameters();
     return false;
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index a5f5982..d841422 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -1400,7 +1400,7 @@ bool ScInterpreter::ConvertMatrixParameters()
                             // has ForceArray or ReferenceOrForceArray
                             // parameter *somewhere else*) pick a normal
                             // position dependent implicit intersection later.
-                            (eType != ScParameterClassification::Value || bMatrixFormula || pCur->HasForceArray()))
+                            (eType != ScParameterClassification::Value || bMatrixFormula || pCur->IsInForceArray()))
                     {
                         SCCOL nCol1, nCol2;
                         SCROW nRow1, nRow2;
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index ea66456..7c43d37 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -252,7 +252,7 @@ void ScRawToken::SetOpCode( OpCode e )
         default:
             eType = svByte;
             sbyte.cByte = 0;
-            sbyte.bHasForceArray = false;
+            sbyte.bIsInForceArray = false;
     }
 }
 
@@ -381,7 +381,7 @@ FormulaToken* ScRawToken::CreateToken() const
     switch ( GetType() )
     {
         case svByte :
-            return new FormulaByteToken( eOp, sbyte.cByte, sbyte.bHasForceArray );
+            return new FormulaByteToken( eOp, sbyte.cByte, sbyte.bIsInForceArray );
         case svDouble :
             IF_NOT_OPCODE_ERROR( ocPush, FormulaDoubleToken);
             return new FormulaDoubleToken( nValue );
commit b1adb498bb0a5ff091c9d1d82332a4c43c57979b
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Nov 18 17:09:19 2015 +0100

    svl: replace some legacy SFX_ASSERT in SfxItemPool
    
    Almost all of these look obviously disastrous.
    
    Change-Id: I30e4e3039bafb10eaff4f2413b7a4aaae1f584c1

diff --git a/svl/source/items/itempool.cxx b/svl/source/items/itempool.cxx
index b0eb941..d8a19b9 100644
--- a/svl/source/items/itempool.cxx
+++ b/svl/source/items/itempool.cxx
@@ -107,7 +107,7 @@ const SfxPoolItem* SfxItemPool::GetPoolDefaultItem( sal_uInt16 nWhich ) const
         pRet = pImp->mpSecondary->GetPoolDefaultItem( nWhich );
     else
     {
-        SFX_ASSERT( false, nWhich, "unknown WhichId - cannot get pool default" );
+        assert(false && "unknown WhichId - cannot get pool default");
         pRet = nullptr;
     }
     return pRet;
@@ -277,8 +277,8 @@ void SfxItemPool::SetDefaults( SfxPoolItem **pDefaults )
                     "these are not static" );
         for ( sal_uInt16 n = 0; n <= pImp->mnEnd - pImp->mnStart; ++n )
         {
-            SFX_ASSERT( (*( pImp->ppStaticDefaults + n ))->Which() == n + pImp->mnStart,
-                        n + pImp->mnStart, "static defaults not sorted" );
+            assert(((*(pImp->ppStaticDefaults + n))->Which() == n + pImp->mnStart)
+                        && "static defaults not sorted" );
             (*( pImp->ppStaticDefaults + n ))->SetKind( SFX_ITEMS_STATICDEFAULT );
             DBG_ASSERT( !(pImp->maPoolItems[n]), "defaults with setitems with items?!" );
         }
@@ -339,8 +339,7 @@ void SfxItemPool::ReleaseDefaults
 
     for ( sal_uInt16 n = 0; n < nCount; ++n )
     {
-        SFX_ASSERT( IsStaticDefaultItem( *(pDefaults+n) ),
-                    n, "this is not a static Default" );
+        assert(IsStaticDefaultItem(*(pDefaults+n)));
         (*( pDefaults + n ))->SetRefCount( 0 );
         if ( bDelete )
             { delete *( pDefaults + n ); *(pDefaults + n) = nullptr; }
@@ -610,7 +609,7 @@ void SfxItemPool::SetPoolDefaultItem(const SfxPoolItem &rItem)
         pImp->mpSecondary->SetPoolDefaultItem(rItem);
     else
     {
-        SFX_ASSERT( false, rItem.Which(), "unknown WhichId - cannot set pool default" );
+        assert(false && "unknown WhichId - cannot set pool default");
     }
 }
 
@@ -634,7 +633,7 @@ void SfxItemPool::ResetPoolDefaultItem( sal_uInt16 nWhichId )
         pImp->mpSecondary->ResetPoolDefaultItem(nWhichId);
     else
     {
-        SFX_ASSERT( false, nWhichId, "unknown WhichId - cannot set pool default" );
+        assert(false && "unknown WhichId - cannot reset pool default");
     }
 }
 
@@ -659,18 +658,17 @@ const SfxPoolItem& SfxItemPool::Put( const SfxPoolItem& rItem, sal_uInt16 nWhich
     if ( USHRT_MAX == nIndex ||
          IsItemFlag_Impl( nIndex, SfxItemPoolFlags::NOT_POOLABLE ) )
     {
-        SFX_ASSERT( USHRT_MAX != nIndex || rItem.Which() != nWhich ||
-                    !IsDefaultItem(&rItem) || rItem.GetKind() == SFX_ITEMS_DELETEONIDLE,
-                    nWhich, "a non Pool Item is Defaul?!" );
+        assert((USHRT_MAX != nIndex || rItem.Which() != nWhich ||
+            !IsDefaultItem(&rItem) || rItem.GetKind() == SFX_ITEMS_DELETEONIDLE)
+                && "a non Pool Item is Default?!");
         SfxPoolItem *pPoolItem = rItem.Clone(pImp->mpMaster);
         pPoolItem->SetWhich(nWhich);
         AddRef( *pPoolItem );
         return *pPoolItem;
     }
 
-    SFX_ASSERT( !pImp->ppStaticDefaults ||
-                typeid(rItem) == typeid(GetDefaultItem(nWhich)), nWhich,
-                "SFxItemPool: wrong item type in Put" );
+    assert(!pImp->ppStaticDefaults ||
+            typeid(rItem) == typeid(GetDefaultItem(nWhich)));
 
     SfxPoolItemArray_Impl* pItemArr = pImp->maPoolItems[nIndex];
     if (!pItemArr)
@@ -741,18 +739,14 @@ const SfxPoolItem& SfxItemPool::Put( const SfxPoolItem& rItem, sal_uInt16 nWhich
     // 3. not found, so clone to insert into the pointer array.
     SfxPoolItem* pNewItem = rItem.Clone(pImp->mpMaster);
     pNewItem->SetWhich(nWhich);
-#ifdef DBG_UTIL
-    SFX_ASSERT( typeid(rItem) == typeid(*pNewItem), nWhich, "unequal types in Put(): no Clone()?" )
+    assert(typeid(rItem) == typeid(*pNewItem) && "SfxItemPool::Put(): unequal types, no Clone() override?");
     if (dynamic_cast<const SfxSetItem*>(&rItem) == nullptr)
     {
-        SFX_ASSERT( !IsItemFlag(nWhich, SfxItemPoolFlags::POOLABLE) ||
-                    rItem == *pNewItem,
-                    nWhich, "unequal items in Put(): no operator==?" );
-        SFX_ASSERT( !IsItemFlag(*pNewItem, SfxItemPoolFlags::POOLABLE) ||
-                    *pNewItem == rItem,
-                    nWhich, "unequal items in Put(): no operator==?" );
+        assert((!IsItemFlag(nWhich, SfxItemPoolFlags::POOLABLE) || rItem == *pNewItem)
+            && "SfxItemPool::Put(): unequal items: no operator== override?");
+        assert((!IsItemFlag(*pNewItem, SfxItemPoolFlags::POOLABLE) || *pNewItem == rItem)
+            && "SfxItemPool::Put(): unequal items: no operator== override?");
     }
-#endif
     AddRef( *pNewItem, pImp->nInitRefCount );
 
     // 4. finally insert into the pointer array
@@ -794,8 +788,7 @@ void SfxPoolItemArray_Impl::ReHash()
 
 void SfxItemPool::Remove( const SfxPoolItem& rItem )
 {
-    SFX_ASSERT( !IsPoolDefaultItem(&rItem), rItem.Which(),
-                "where's the Pool Default coming from here?" );
+    assert(!IsPoolDefaultItem(&rItem) && "cannot remove Pool Default");
 
     // Find correct Secondary Pool
     const sal_uInt16 nWhich = rItem.Which();
@@ -814,9 +807,8 @@ void SfxItemPool::Remove( const SfxPoolItem& rItem )
     sal_uInt16 nIndex = bSID ? USHRT_MAX : GetIndex_Impl(nWhich);
     if ( bSID || IsItemFlag_Impl( nIndex, SfxItemPoolFlags::NOT_POOLABLE ) )
     {
-        SFX_ASSERT( USHRT_MAX != nIndex ||
-                    !IsDefaultItem(&rItem), rItem.Which(),
-                    "a non Pool Item is Default?!" );
+        assert((USHRT_MAX != nIndex || !IsDefaultItem(&rItem)) &&
+                    "a non Pool Item is Default?!");
         if ( 0 == ReleaseRef(rItem) )
         {
             SfxPoolItem *pItem = &(SfxPoolItem &)rItem;
@@ -825,7 +817,7 @@ void SfxItemPool::Remove( const SfxPoolItem& rItem )
         return;
     }
 
-    SFX_ASSERT( rItem.GetRefCount(), rItem.Which(), "RefCount == 0, Remove impossible" );
+    assert(rItem.GetRefCount() && "RefCount == 0, Remove impossible");
 
     // Static Defaults are just there
     if ( rItem.GetKind() == SFX_ITEMS_STATICDEFAULT &&
@@ -834,7 +826,7 @@ void SfxItemPool::Remove( const SfxPoolItem& rItem )
 
     // Find Item in own Pool
     SfxPoolItemArray_Impl* pItemArr = pImp->maPoolItems[nIndex];
-    SFX_ASSERT( pItemArr, rItem.Which(), "removing Item not in Pool" );
+    assert(pItemArr && "removing Item not in Pool");
 
     SfxPoolItemArray_Impl::PoolItemPtrToIndexMap::iterator it;
     it = pItemArr->maPtrToIndex.find(const_cast<SfxPoolItem *>(&rItem));
@@ -849,7 +841,7 @@ void SfxItemPool::Remove( const SfxPoolItem& rItem )
             ReleaseRef( *p );
         else
         {
-            SFX_ASSERT( false, rItem.Which(), "removing Item without ref" );
+            assert(false && "removing Item without ref");
         }
 
         // FIXME: Hack, for as long as we have problems with the Outliner
@@ -869,7 +861,7 @@ void SfxItemPool::Remove( const SfxPoolItem& rItem )
     }
 
     // not found
-    SFX_ASSERT( false, rItem.Which(), "removing Item not in Pool" );
+    assert(false && "removing Item not in Pool");
 }
 
 
@@ -952,7 +944,7 @@ const SfxPoolItem *SfxItemPool::GetItem2(sal_uInt16 nWhich, sal_uInt32 nOfst) co
     {
         if ( pImp->mpSecondary )
             return pImp->mpSecondary->GetItem2( nWhich, nOfst );
-        SFX_ASSERT( false, nWhich, "unknown WhichId - cannot resolve surrogate" );
+        assert(false && "unknown WhichId - cannot resolve surrogate");
         return nullptr;
     }
 
@@ -973,7 +965,7 @@ sal_uInt32 SfxItemPool::GetItemCount2(sal_uInt16 nWhich) const
     {
         if ( pImp->mpSecondary )
             return pImp->mpSecondary->GetItemCount2( nWhich );
-        SFX_ASSERT( false, nWhich, "unknown WhichId - cannot resolve surrogate" );
+        assert(false && "unknown WhichId - cannot resolve surrogate");
         return 0;
     }
 
@@ -1010,7 +1002,7 @@ sal_uInt16 SfxItemPool::GetSlotId( sal_uInt16 nWhich, bool bDeep ) const
     {
         if ( pImp->mpSecondary && bDeep )

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list