[Libreoffice-commits] core.git: Branch 'distro/cib/libreoffice-5-2' - 57 commits - accessibility/source cui/source desktop/source dictionaries download.lst editeng/source filter/Library_pdffilter.mk filter/source filter/uiconfig framework/Library_fwk.mk framework/source icon-themes/galaxy include/desktop include/editeng include/svtools include/svx include/vcl instsetoo_native/inc_common instsetoo_native/util officecfg/registry oox/source postprocess/CustomTarget_registry.mk reportdesign/source sal/textenc sc/source sd/qa sfx2/source shell/source starmath/qa starmath/source svtools/source svx/source sw/inc sw/qa sw/source tools/inc tools/source vcl/inc vcl/opengl vcl/qa vcl/source vcl/unx vcl/win writerfilter/source xmloff/source

Katarina Behrens Katarina.Behrens at cib.de
Wed Jan 11 12:35:43 UTC 2017


Rebased ref, commits from common ancestor:
commit eff1c5c35210865206ac7e827e86af037e479396
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Wed Apr 6 23:06:37 2016 +0200

    PDF export of cell formulas now configurable in UI
    
    Of course, only in Calc. I had to make filter/pdf depend
    on svxcore (because of ColorListBox) but little harm done,
    other filters in this dir depend on it already too
    
    Conflicts:
    	filter/source/pdf/impdialog.cxx
    	filter/source/pdf/impdialog.hxx
    	filter/uiconfig/ui/pdfgeneralpage.ui
    
    Change-Id: Id5bf99fdc738aea073bf5315e37ed5002ab0f926

diff --git a/filter/Library_pdffilter.mk b/filter/Library_pdffilter.mk
index 6de7d34..a3151ee 100644
--- a/filter/Library_pdffilter.mk
+++ b/filter/Library_pdffilter.mk
@@ -36,6 +36,7 @@ $(eval $(call gb_Library_use_custom_headers,pdffilter,\
 
 $(eval $(call gb_Library_use_libraries,pdffilter,\
 	svt \
+	svxcore \
 	sfx \
 	tk \
 	vcl \
diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx
index 432f9e5..82005e8 100644
--- a/filter/source/pdf/impdialog.cxx
+++ b/filter/source/pdf/impdialog.cxx
@@ -25,7 +25,12 @@
 #include <vcl/layout.hxx>
 #include <vcl/settings.hxx>
 #include <vcl/svapp.hxx>
+#include <sfx2/objsh.hxx>
 #include "sfx2/passwd.hxx"
+#include <sfx2/viewfrm.hxx>
+#include <svx/drawitem.hxx>
+#include <svx/svxids.hrc>
+#include <svx/xtable.hxx>
 #include "svtools/miscopt.hxx"
 
 #include "comphelper/storagehelper.hxx"
@@ -70,6 +75,7 @@ ImpPDFTabDialog::ImpPDFTabDialog(vcl::Window* pParent, Sequence< PropertyValue >
     mnGeneralPageId(0),
     mbIsPresentation( false ),
     mbIsWriter( false ),
+    mbIsSpreadsheet( false ),
 
     mbSelectionPresent( false ),
     mbUseCTLFont( false ),
@@ -79,6 +85,7 @@ ImpPDFTabDialog::ImpPDFTabDialog(vcl::Window* pParent, Sequence< PropertyValue >
     mnMaxImageResolution( 300 ),
     mbUseTaggedPDF( false ),
     mbExportNotes( true ),
+    mbExportFormulaAnnotation( false ),
     mbViewPDF( false ),
     mbExportNotesPages( false ),
     mbExportOnlyNotesPages( false ),
@@ -92,6 +99,7 @@ ImpPDFTabDialog::ImpPDFTabDialog(vcl::Window* pParent, Sequence< PropertyValue >
     mbExportBookmarks( true ),
     mbExportHiddenSlides ( false),
     mnOpenBookmarkLevels( -1 ),
+    mnAnnotColor( -1 ),
 
     mbHideViewerToolbar( false ),
     mbHideViewerMenubar( false ),
@@ -172,6 +180,8 @@ ImpPDFTabDialog::ImpPDFTabDialog(vcl::Window* pParent, Sequence< PropertyValue >
                 mbIsPresentation = true;
             if ( xInfo->supportsService( "com.sun.star.text.GenericTextDocument" ) )
                 mbIsWriter = true;
+            if ( xInfo->supportsService( "com.sun.star.sheet.SpreadsheetDocument" ) )
+                mbIsSpreadsheet = true;
         }
     }
     catch(const RuntimeException &)
@@ -194,6 +204,8 @@ ImpPDFTabDialog::ImpPDFTabDialog(vcl::Window* pParent, Sequence< PropertyValue >
         mbExportOnlyNotesPages = maConfigItem.ReadBool( "ExportOnlyNotesPages", false );
     }
     mbExportNotes = maConfigItem.ReadBool( "ExportNotes", false );
+    mbExportFormulaAnnotation = maConfigItem.ReadBool( "ExportFormulaAsAnnotation", false );
+    mnAnnotColor = maConfigItem.ReadInt32( "FormulaAnnotationHighlightColor", -1 );
     mbViewPDF = maConfigItem.ReadBool( "ViewPDFAfterExport", false );
 
     mbExportBookmarks = maConfigItem.ReadBool( "ExportBookmarks", true );
@@ -404,6 +416,7 @@ Sequence< PropertyValue > ImpPDFTabDialog::GetFilterData()
         maConfigItem.WriteBool( "ExportOnlyNotesPages", mbExportOnlyNotesPages );
     }
     maConfigItem.WriteBool( "ExportNotes", mbExportNotes );
+    maConfigItem.WriteBool( "ExportFormulaAsAnnotation", mbExportFormulaAnnotation );
     maConfigItem.WriteBool( "ViewPDFAfterExport", mbViewPDF );
 
     maConfigItem.WriteBool( "ExportBookmarks", mbExportBookmarks );
@@ -436,6 +449,7 @@ Sequence< PropertyValue > ImpPDFTabDialog::GetFilterData()
     maConfigItem.WriteInt32( "PageLayout", mnPageLayout );
     maConfigItem.WriteBool( "FirstPageOnLeft", mbFirstPageLeft );
     maConfigItem.WriteInt32( "OpenBookmarkLevels", mnOpenBookmarkLevels );
+    maConfigItem.WriteInt32( "FormulaAnnotationHighlightColor", mnAnnotColor );
 
     maConfigItem.WriteBool( "ExportLinksRelativeFsys", mbExportRelativeFsysLinks );
     maConfigItem.WriteInt32("PDFViewSelection", mnViewPDFMode );
@@ -524,6 +538,8 @@ ImpPDFTabGeneralPage::ImpPDFTabGeneralPage(vcl::Window* pParent, const SfxItemSe
     , mbExportFormFieldsUserSelection(false)
     , mbIsPresentation(false)
     , mbIsWriter(false)
+    , mbIsSpreadsheet(false)
+
     , mpaParent(nullptr)
 {
     get(mpRbAll, "all");
@@ -552,6 +568,11 @@ ImpPDFTabGeneralPage::ImpPDFTabGeneralPage(vcl::Window* pParent, const SfxItemSe
     get(mpCbExportNotes, "comments");
     get(mpCbExportNotesPages, "notes");
     get(mpCbExportOnlyNotesPages, "onlynotes");
+    get(mpFormulaFrame, "formulaframe");
+    get(mpCbExportFormulaAnnotations, "formulas");
+    get(mpFtAnnotColor, "annotation_label");
+    get(mpLbAnnotColor, "annotation_color");
+
     get(mpCbExportEmptyPages, "emptypages");
     get(mpCbExportPlaceholders, "exportplaceholders" );
     get(mpCbViewPDF, "viewpdf");
@@ -559,6 +580,7 @@ ImpPDFTabGeneralPage::ImpPDFTabGeneralPage(vcl::Window* pParent, const SfxItemSe
     get(mpCbWatermark, "watermark");
     get(mpFtWatermark, "watermarklabel");
     get(mpEdWatermark, "watermarkentry");
+    get(mpFtTransparent, "transparent");
 }
 
 
@@ -592,12 +614,17 @@ void ImpPDFTabGeneralPage::dispose()
     mpCbViewPDF.clear();
     mpCbExportNotesPages.clear();
     mpCbExportOnlyNotesPages.clear();
+    mpFormsFrame.clear();
+    mpCbExportFormulaAnnotations.clear();
+    mpFtAnnotColor.clear();
+    mpLbAnnotColor.clear();
     mpCbExportEmptyPages.clear();
     mpCbExportPlaceholders.clear();
     mpCbAddStream.clear();
     mpCbWatermark.clear();
-    mpFtWatermark.clear();
     mpEdWatermark.clear();
+    mpFtWatermark.clear();
+    mpFtTransparent.clear();
     mpaParent.clear();
     SfxTabPage::dispose();
 }
@@ -619,6 +646,7 @@ void ImpPDFTabGeneralPage::SetFilterConfigItem( ImpPDFTabDialog* paParent )
         mpRbSelection->SetToggleHdl( LINK( this, ImpPDFTabGeneralPage, ToggleSelectionHdl ) );
     mbIsPresentation = paParent->mbIsPresentation;
     mbIsWriter = paParent->mbIsWriter;
+    mbIsSpreadsheet = paParent->mbIsSpreadsheet;
 
     mpCbExportEmptyPages->Enable( mbIsWriter );
     mpCbExportPlaceholders->Enable( mbIsWriter );
@@ -695,6 +723,41 @@ void ImpPDFTabGeneralPage::SetFilterConfigItem( ImpPDFTabDialog* paParent )
         mpCbExportHiddenSlides->Show(false);
         mpCbExportHiddenSlides->Check(false);
     }
+    if ( mbIsSpreadsheet )
+    {
+       mpCbExportFormulaAnnotations->Show(true);
+       mpFtAnnotColor->Show(true);
+       mpLbAnnotColor->Show(true);
+
+       mpCbExportFormulaAnnotations->Check( paParent->mbExportFormulaAnnotation );
+       mpFormulaFrame->Enable( paParent->mbExportFormulaAnnotation );
+
+       SfxObjectShell* pDocSh = SfxObjectShell::Current();
+       XColorListRef pColorTable;
+
+       if ( pDocSh )
+       {
+           mpLbAnnotColor->InsertEntry( COL_TRANSPARENT, mpFtTransparent->GetText());
+
+           const SfxPoolItem*  pItem = pDocSh->GetItem( SID_COLOR_TABLE );
+           if ( pItem != nullptr )
+                   pColorTable = static_cast<const SvxColorListItem*>(pItem)->GetColorList();
+
+           if ( pColorTable.is() )
+           {
+               for ( long i = 0; i < pColorTable->Count(); i++ )
+               {
+                   XColorEntry* pEntry = pColorTable->GetColor(i);
+                   mpLbAnnotColor->InsertEntry( pEntry->GetColor(), pEntry->GetName() );
+               }
+           }
+
+           mpLbAnnotColor->SelectEntry( Color( paParent->mnAnnotColor) );
+       }
+
+       mpCbExportFormulaAnnotations->SetToggleHdl( LINK( this, ImpPDFTabGeneralPage, ToggleExportFormulaAnnotations ) );
+    }
+
     mpCbExportPlaceholders->Show(mbIsWriter);
     if( !mbIsWriter )
     {
@@ -728,6 +791,11 @@ void ImpPDFTabGeneralPage::GetFilterConfigItem( ImpPDFTabDialog* paParent )
     paParent->mbExportBookmarks = mpCbExportBookmarks->IsChecked();
     if ( mbIsPresentation )
         paParent->mbExportHiddenSlides = mpCbExportHiddenSlides->IsChecked();
+    if ( mbIsSpreadsheet )
+    {
+        paParent->mbExportFormulaAnnotation = mpCbExportFormulaAnnotations->IsChecked();
+        paParent->mnAnnotColor = mpLbAnnotColor->GetSelectEntryColor().GetColor();
+    }
 
     paParent->mbIsSkipEmptyPages = !mpCbExportEmptyPages->IsChecked();
     paParent->mbIsExportPlaceholders = mpCbExportPlaceholders->IsChecked();
@@ -934,6 +1002,10 @@ ImpPDFTabOpnFtrPage::ImpPDFTabOpnFtrPage(vcl::Window* pParent, const SfxItemSet&
     mpRbMagnZoom->SetToggleHdl( LINK( this, ImpPDFTabOpnFtrPage, ToggleRbMagnHdl ) );
 }
 
+IMPL_LINK_NOARG_TYPED(ImpPDFTabGeneralPage, ToggleExportFormulaAnnotations, CheckBox&, void)
+{
+    mpFormulaFrame->Enable(mpCbExportFormulaAnnotations->IsChecked());
+}
 
 ImpPDFTabOpnFtrPage::~ImpPDFTabOpnFtrPage()
 {
diff --git a/filter/source/pdf/impdialog.hxx b/filter/source/pdf/impdialog.hxx
index 99e9a0f..9fe8452 100644
--- a/filter/source/pdf/impdialog.hxx
+++ b/filter/source/pdf/impdialog.hxx
@@ -33,6 +33,7 @@
 #include <vcl/group.hxx>
 #include <vcl/pdfwriter.hxx>
 #include <vcl/FilterConfigItem.hxx>
+#include <svtools/ctrlbox.hxx>
 
 #include "pdffilter.hxx"
 
@@ -94,6 +95,7 @@ protected:
     // the following data are the configuration used throughout the dialog and pages
     bool                        mbIsPresentation;
     bool                        mbIsWriter;
+    bool                        mbIsSpreadsheet;
     bool                        mbSelectionPresent;
     bool                        mbUseCTLFont;
     bool                        mbUseLosslessCompression;
@@ -103,6 +105,7 @@ protected:
     bool                        mbUseTaggedPDF;
     sal_Int32                   mnPDFTypeSelection;
     bool                        mbExportNotes;
+    bool                        mbExportFormulaAnnotation;
     bool                        mbViewPDF;
     bool                        mbExportNotesPages;
     bool                        mbExportOnlyNotesPages;
@@ -116,6 +119,7 @@ protected:
     bool                        mbExportBookmarks;
     bool                        mbExportHiddenSlides;
     sal_Int32                   mnOpenBookmarkLevels;
+    sal_Int32                   mnAnnotColor;
 
     bool                        mbHideViewerToolbar;
     bool                        mbHideViewerMenubar;
@@ -219,6 +223,12 @@ class ImpPDFTabGeneralPage : public SfxTabPage
     VclPtr<CheckBox>             mpCbExportBookmarks;
     VclPtr<CheckBox>             mpCbExportHiddenSlides;
     VclPtr<CheckBox>             mpCbExportNotes;
+
+    VclPtr<VclContainer>         mpFormulaFrame;
+    VclPtr<CheckBox>             mpCbExportFormulaAnnotations;
+    VclPtr<FixedText>            mpFtAnnotColor;
+    VclPtr<ColorListBox>         mpLbAnnotColor;
+
     VclPtr<CheckBox>             mpCbViewPDF;
     VclPtr<CheckBox>             mpCbExportNotesPages;
     VclPtr<CheckBox>             mpCbExportOnlyNotesPages;
@@ -229,10 +239,12 @@ class ImpPDFTabGeneralPage : public SfxTabPage
 
     VclPtr<CheckBox>             mpCbWatermark;
     VclPtr<FixedText>            mpFtWatermark;
+    VclPtr<FixedText>            mpFtTransparent;
     VclPtr<Edit>                mpEdWatermark;
 
     bool                        mbIsPresentation;
     bool                        mbIsWriter;
+    bool                        mbIsSpreadsheet;
 
     VclPtr<ImpPDFTabDialog>     mpaParent;
 
@@ -244,6 +256,7 @@ class ImpPDFTabGeneralPage : public SfxTabPage
     DECL_LINK_TYPED( ToggleWatermarkHdl, CheckBox&, void );
     DECL_LINK_TYPED( ToggleAddStreamHdl, CheckBox&, void );
     DECL_LINK_TYPED( ToggleExportFormFieldsHdl, CheckBox&, void );
+    DECL_LINK_TYPED( ToggleExportFormulaAnnotations, CheckBox&, void );
     DECL_LINK_TYPED( ToggleExportNotesPagesHdl, CheckBox&, void );
 
     void                        TogglePagesHdl();
diff --git a/filter/uiconfig/ui/pdfgeneralpage.ui b/filter/uiconfig/ui/pdfgeneralpage.ui
index 836fd25..b652b1e 100644
--- a/filter/uiconfig/ui/pdfgeneralpage.ui
+++ b/filter/uiconfig/ui/pdfgeneralpage.ui
@@ -2,6 +2,7 @@
 <!-- Generated with glade 3.20.0 -->
 <interface>
   <requires lib="gtk+" version="3.0"/>
+  <requires lib="LibreOffice" version="1.0"/>
   <object class="GtkAdjustment" id="adjustment1">
     <property name="lower">1</property>
     <property name="upper">100</property>
@@ -689,6 +690,74 @@
                     <property name="top_attach">9</property>
                   </packing>
                 </child>
+                <child>
+                  <object class="GtkCheckButton" id="formulas">
+                    <property name="label" translatable="yes">Export cell formulas as annotations</property>
+                    <property name="visible">False</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="xalign">0</property>
+                    <property name="yalign">0.49000000953674316</property>
+                    <property name="draw_indicator">True</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">9</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkAlignment" id="formulaframe">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="left_padding">12</property>
+                    <child>
+                      <object class="GtkBox" id="box1">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <child>
+                          <object class="GtkLabel" id="annotation_label">
+                            <property name="visible">False</property>
+                            <property name="can_focus">False</property>
+                            <property name="halign">end</property>
+                            <property name="label" translatable="yes">Highlight color: </property>
+                            <property name="ellipsize">end</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="svtlo-ColorListBox" id="annotation_color">
+                            <property name="visible">False</property>
+                            <property name="can_focus">False</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">10</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="transparent">
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">Transparent</property>
+                    <property name="ellipsize">middle</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">13</property>
+                  </packing>
+                </child>
               </object>
             </child>
           </object>
commit 747fa363d59174324d367b94c6f6bb749db6523a
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Fri Mar 11 17:58:47 2016 +0100

    Make PDF export of cell formulas depend on configuration
    
    Change-Id: I0d1828cb93290313f578cf40b7cd021dedd6b5ed

diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index 2736855..75e468d 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -5203,6 +5203,20 @@
             </constraints>
             <value>0</value>
           </prop>
+	  <prop oor:name="ExportFormulaAsAnnotation" oor:type="xs:boolean" oor:nillable="false">
+            <info>
+              <desc>Specifies if cell formulas are exported to PDF as highlight annotations
+	      (in Calc documents only).</desc>
+            </info>
+            <value>false</value>
+          </prop>
+          <prop oor:name="FormulaAnnotationHighlightColor" oor:type="xs:int" oor:nillable="false">
+              <info>
+                <desc>Specifies colour used to highlight cells that have formula in exported PDF,
+		-1 if no highlight should be used (Calc documents only).</desc>
+              </info>
+              <value>-1</value>
+          </prop>
           <prop oor:name="AllowDuplicateFieldNames" oor:type="xs:boolean" oor:nillable="false">
             <info>
               <desc>Specifies whether multiple form fields exported are allowed
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index ce14e5f..074160a 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -45,6 +45,7 @@
 #include <vcl/pdfextoutdevdata.hxx>
 #include <vcl/settings.hxx>
 #include <o3tl/make_unique.hxx>
+#include <officecfg/Office/Common.hxx>
 
 #include "output.hxx"
 #include "document.hxx"
@@ -1479,6 +1480,7 @@ Rectangle ScOutputData::LayoutStrings(bool bPixelToLogic, bool bPaint, const ScA
                 "LayoutStrings: different MapUnits ?!?!" );
 
     vcl::PDFExtOutDevData* pPDFData = dynamic_cast< vcl::PDFExtOutDevData* >(mpDev->GetExtOutDevData() );
+    bool bExportFormulaAnnotation = officecfg::Office::Common::Filter::PDF::Export::ExportFormulaAsAnnotation::get();
 
     sc::IdleSwitch aIdleSwitch(*mpDoc, false);
     ScDrawStringsVars aVars( this, bPixelToLogic );
@@ -2148,7 +2150,7 @@ Rectangle ScOutputData::LayoutStrings(bool bPixelToLogic, bool bPaint, const ScA
                             Rectangle aURLRect( aURLStart, aVars.GetTextSize() );
                             if (bHasURL)
                                 lcl_DoHyperlinkResult(mpDev, aURLRect, aCell);
-                            else
+                            else if (bExportFormulaAnnotation)
                                 lcl_DoFormulaAnnotation(mpDev, aURLRect, aCell);
                         }
                     }
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index c054e73..b602abb 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -39,6 +39,7 @@
 #include <cppuhelper/implbase.hxx>
 #include <i18nlangtag/languagetag.hxx>
 #include <o3tl/numeric.hxx>
+#include <officecfg/Office/Common.hxx>
 #include <osl/file.hxx>
 #include <osl/thread.h>
 #include <rtl/crc.h>
@@ -4665,6 +4666,8 @@ bool PDFWriterImpl::emitNoteAnnotations()
 bool PDFWriterImpl::emitFormulaAnnotations()
 {
     int nFormulaNotes = m_aFormulaNotes.size();
+    sal_Int32 nColor = officecfg::Office::Common::Filter::PDF::Export::FormulaAnnotationHighlightColor::get();
+    Color aColor( nColor );
 
     for (int i = 0; i < nFormulaNotes; i++)
     {
@@ -4708,7 +4711,16 @@ bool PDFWriterImpl::emitFormulaAnnotations()
         aLine.append( "]" );
 
         aLine.append( "/F 4" );
-        aLine.append( "/C [1 1 0]");
+
+        if ( nColor == -1 )
+            aLine.append( "/C [0.63 0.63 0.63]/CA 0") ; // light grey-ish pop-up note, transparent highlight
+        else
+        {
+            aLine.append( "/C [");
+            appendColor( aColor, aLine);
+            aLine.append( "]/CA 1");
+        }
+
         aLine.append( "/Border [0 0 1]");
         aLine.append( "/Contents\n" );
         appendLiteralStringEncrypt( rFormulaNote.m_aContents.Contents, rFormulaNote.m_nObject, aLine );
commit e5ce87aaedc606687bb89816a533bf3778681258
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Tue Mar 8 11:41:26 2016 +0100

    Show cell formula as annotation in exported PDF
    
    Conflicts:
    	vcl/source/gdi/pdfextoutdevdata.cxx
    
    Change-Id: Idca8f6a27453a0f41566098a1720ee345eff3af6

diff --git a/include/vcl/pdfextoutdevdata.hxx b/include/vcl/pdfextoutdevdata.hxx
index 48fab90..63f71d5 100644
--- a/include/vcl/pdfextoutdevdata.hxx
+++ b/include/vcl/pdfextoutdevdata.hxx
@@ -325,6 +325,7 @@ public:
     or -1 in which case the current page is used
     */
     void CreateNote( const Rectangle& rRect, const PDFNote& rNote, sal_Int32 nPageNr = -1 );
+    void CreateFormulaAnnotation( const Rectangle& rRect, const PDFNote& rNote, sal_Int32 nPageNr = -1 );
 
     /** begin a new logical structure element
 
diff --git a/include/vcl/pdfwriter.hxx b/include/vcl/pdfwriter.hxx
index 8a95b6a..ac927fd 100644
--- a/include/vcl/pdfwriter.hxx
+++ b/include/vcl/pdfwriter.hxx
@@ -1058,6 +1058,7 @@ The following structure describes the permissions used in PDF security
     or -1 in which case the current page is used
     */
     void CreateNote( const Rectangle& rRect, const PDFNote& rNote, sal_Int32 nPageNr = -1 );
+    void CreateFormulaAnnotation( const Rectangle& rRect, const PDFNote& rNote, sal_Int32 nPageNr = -1 );
 
     /** begin a new logical structure element
 
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index fa6f402..ce14e5f 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -857,6 +857,33 @@ static void lcl_DoHyperlinkResult( OutputDevice* pDev, const Rectangle& rRect, S
     }
 }
 
+static void lcl_DoFormulaAnnotation( OutputDevice* pDev, const Rectangle& rRect, ScRefCellValue& rCell )
+{
+    vcl::PDFExtOutDevData* pPDFData = dynamic_cast< vcl::PDFExtOutDevData* >( pDev->GetExtOutDevData() );
+
+    ScFormulaCell* pFCell = rCell.mpFormula;
+
+    if (pFCell && pPDFData)
+    {
+        OUString aFormula;
+        pFCell->GetFormula( aFormula );
+
+        if ( !aFormula.isEmpty() )
+        {
+            const OUString aEquals("=");
+            OUString aAnnotation;
+            vcl::PDFNote aPDFNote;
+
+            // chop off leading '=', some PDF viewers don't like it
+            if ( aFormula.startsWith( aEquals ) )
+                 aAnnotation = aFormula.copy( 1, aFormula.getLength() - 1 );
+
+            aPDFNote.Contents = aAnnotation;
+            pPDFData->CreateFormulaAnnotation( rRect, aPDFNote);
+        }
+    }
+}
+
 void ScOutputData::SetSyntaxColor( vcl::Font* pFont, const ScRefCellValue& rCell )
 {
     switch (rCell.meType)
@@ -2114,11 +2141,15 @@ Rectangle ScOutputData::LayoutStrings(bool bPixelToLogic, bool bPaint, const ScA
                         }
 
                         // PDF: whole-cell hyperlink from formula?
-                        bool bHasURL = pPDFData && aCell.meType == CELLTYPE_FORMULA && aCell.mpFormula->IsHyperLinkCell();
-                        if (bPaint && bHasURL)
+                        bool bHasFormula = pPDFData && aCell.meType == CELLTYPE_FORMULA;
+                        bool bHasURL = bHasFormula && aCell.mpFormula->IsHyperLinkCell();
+                        if (bPaint && bHasFormula)
                         {
                             Rectangle aURLRect( aURLStart, aVars.GetTextSize() );
-                            lcl_DoHyperlinkResult(mpDev, aURLRect, aCell);
+                            if (bHasURL)
+                                lcl_DoHyperlinkResult(mpDev, aURLRect, aCell);
+                            else
+                                lcl_DoFormulaAnnotation(mpDev, aURLRect, aCell);
                         }
                     }
                 }
diff --git a/vcl/source/gdi/pdfextoutdevdata.cxx b/vcl/source/gdi/pdfextoutdevdata.cxx
index 811d618..9d8a404 100644
--- a/vcl/source/gdi/pdfextoutdevdata.cxx
+++ b/vcl/source/gdi/pdfextoutdevdata.cxx
@@ -36,6 +36,7 @@ struct PDFExtOutDevDataSync
     enum Action{    CreateNamedDest,
                     CreateDest,
                     CreateLink,
+                    CreateFormulaAnnotation,
                     SetLinkDest,
                     SetLinkURL,
                     RegisterDest,
@@ -83,6 +84,7 @@ struct GlobalSyncData
     std::deque< OUString >                 mParaOUStrings;
     std::deque< PDFWriter::DestAreaType >       mParaDestAreaTypes;
     std::deque< PDFNote >                       mParaPDFNotes;
+    std::deque< PDFNote >                       mParaFormulaNotes;
     std::deque< PDFWriter::PageTransition >     mParaPageTransitions;
     ::std::map< sal_Int32, PDFLinkDestination > mFutureDestinations;
 
@@ -251,6 +253,16 @@ void GlobalSyncData::PlayGlobalActions( PDFWriter& rWriter )
                 mParaPDFNotes.pop_front();
                 mParaInts.pop_front();
             }
+            case PDFExtOutDevDataSync::CreateFormulaAnnotation :
+            {
+                rWriter.Push( PushFlags::MAPMODE );
+                rWriter.SetMapMode( mParaMapModes.front() );
+                rWriter.CreateFormulaAnnotation( mParaRects.front(), mParaFormulaNotes.front(), mParaInts.front() );
+                mParaMapModes.pop_front();
+                mParaRects.pop_front();
+                mParaFormulaNotes.pop_front();
+                mParaInts.pop_front();
+            }
             break;
             case PDFExtOutDevDataSync::SetAutoAdvanceTime :
             {
@@ -502,6 +514,7 @@ bool PageSyncData::PlaySyncPageAct( PDFWriter& rWriter, sal_uInt32& rCurGDIMtfAc
             case PDFExtOutDevDataSync::SetOutlineItemText:
             case PDFExtOutDevDataSync::SetOutlineItemDest:
             case PDFExtOutDevDataSync::CreateNote:
+            case PDFExtOutDevDataSync::CreateFormulaAnnotation:
             case PDFExtOutDevDataSync::SetAutoAdvanceTime:
             case PDFExtOutDevDataSync::SetPageTransition:
                 break;
@@ -702,6 +715,14 @@ void PDFExtOutDevData::CreateNote( const Rectangle& rRect, const PDFNote& rNote,
     mpGlobalSyncData->mParaPDFNotes.push_back( rNote );
     mpGlobalSyncData->mParaInts.push_back( nPageNr == -1 ? mnPage : nPageNr );
 }
+void PDFExtOutDevData::CreateFormulaAnnotation( const Rectangle& rRect, const PDFNote& rNote, sal_Int32 nPageNr )
+{
+    mpGlobalSyncData->mActions.push_back( PDFExtOutDevDataSync::CreateFormulaAnnotation );
+    mpGlobalSyncData->mParaRects.push_back( rRect );
+    mpGlobalSyncData->mParaMapModes.push_back( mrOutDev.GetMapMode() );
+    mpGlobalSyncData->mParaFormulaNotes.push_back( rNote );
+    mpGlobalSyncData->mParaInts.push_back( nPageNr == -1 ? mnPage : nPageNr );
+}
 void PDFExtOutDevData::SetPageTransition( PDFWriter::PageTransition eType, sal_uInt32 nMilliSec )
 {
     mpGlobalSyncData->mActions.push_back( PDFExtOutDevDataSync::SetPageTransition );
diff --git a/vcl/source/gdi/pdfwriter.cxx b/vcl/source/gdi/pdfwriter.cxx
index 4ea9170..dda5e16 100644
--- a/vcl/source/gdi/pdfwriter.cxx
+++ b/vcl/source/gdi/pdfwriter.cxx
@@ -386,6 +386,11 @@ void PDFWriter::CreateNote( const Rectangle& rRect, const PDFNote& rNote, sal_In
     xImplementation->createNote( rRect, rNote, nPageNr );
 }
 
+void PDFWriter::CreateFormulaAnnotation( const Rectangle& rRect, const PDFNote& rNote, sal_Int32 nPageNr )
+{
+    xImplementation->createFormulaAnnotation( rRect, rNote, nPageNr );
+}
+
 sal_Int32 PDFWriter::BeginStructureElement( PDFWriter::StructElement eType, const OUString& rAlias )
 {
     return xImplementation->beginStructureElement( eType, rAlias );
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 458ecba..c054e73 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -4662,6 +4662,65 @@ bool PDFWriterImpl::emitNoteAnnotations()
     return true;
 }
 
+bool PDFWriterImpl::emitFormulaAnnotations()
+{
+    int nFormulaNotes = m_aFormulaNotes.size();
+
+    for (int i = 0; i < nFormulaNotes; i++)
+    {
+        const PDFNoteEntry &rFormulaNote = m_aFormulaNotes[i];
+
+        OStringBuffer aLine( 1024 );
+        aLine.append( rFormulaNote.m_nObject );
+        aLine.append( " 0 obj\n" );
+
+        aLine.append( "<</Type/Annot" );
+        aLine.append( "/Rect[" );
+
+        appendFixedInt( rFormulaNote.m_aRect.Left(), aLine );
+        aLine.append( ' ' );
+        appendFixedInt( rFormulaNote.m_aRect.Top(), aLine );
+        aLine.append( ' ' );
+        appendFixedInt( rFormulaNote.m_aRect.Right(), aLine );
+        aLine.append( ' ' );
+        appendFixedInt( rFormulaNote.m_aRect.Bottom(), aLine );
+        aLine.append( "]" );
+
+        aLine.append( "/Subtype/Highlight" );
+        aLine.append( "/QuadPoints[" );
+
+        appendFixedInt( rFormulaNote.m_aRect.Left(), aLine );
+        aLine.append( ' ' );
+        appendFixedInt( rFormulaNote.m_aRect.Top(), aLine );
+        aLine.append( ' ' );
+        appendFixedInt( rFormulaNote.m_aRect.Right(), aLine );
+        aLine.append( ' ' );
+        appendFixedInt( rFormulaNote.m_aRect.Top(), aLine );
+        aLine.append( ' ' );
+        appendFixedInt( rFormulaNote.m_aRect.Left(), aLine );
+        aLine.append( ' ' );
+        appendFixedInt( rFormulaNote.m_aRect.Bottom(), aLine );
+        aLine.append( ' ' );
+        appendFixedInt( rFormulaNote.m_aRect.Right(), aLine );
+        aLine.append( ' ' );
+        appendFixedInt( rFormulaNote.m_aRect.Bottom(), aLine );
+        aLine.append( ' ' );
+        aLine.append( "]" );
+
+        aLine.append( "/F 4" );
+        aLine.append( "/C [1 1 0]");
+        aLine.append( "/Border [0 0 1]");
+        aLine.append( "/Contents\n" );
+        appendLiteralStringEncrypt( rFormulaNote.m_aContents.Contents, rFormulaNote.m_nObject, aLine );
+        aLine.append( "\n" );
+
+        aLine.append( ">>\nendobj\n\n" );
+        CHECK_RETURN( writeBuffer( aLine.getStr(), aLine.getLength() ) );
+    }
+
+    return true;
+}
+
 Font PDFWriterImpl::replaceFont( const vcl::Font& rControlFont, const vcl::Font&  rAppSetFont )
 {
     bool bAdjustSize = false;
@@ -5575,6 +5634,7 @@ bool PDFWriterImpl::emitAnnotations()
 
     CHECK_RETURN( emitLinkAnnotations() );
     CHECK_RETURN( emitNoteAnnotations() );
+    CHECK_RETURN( emitFormulaAnnotations() );
     CHECK_RETURN( emitWidgetAnnotations() );
 
     return true;
@@ -12163,6 +12223,27 @@ void PDFWriterImpl::createNote( const Rectangle& rRect, const PDFNote& rNote, sa
     m_aPages[ nPageNr ].m_aAnnotations.push_back( m_aNotes.back().m_nObject );
 }
 
+void PDFWriterImpl::createFormulaAnnotation( const Rectangle& rRect, const PDFNote& rNote, sal_Int32 nPageNr )
+{
+    if( nPageNr < 0 )
+        nPageNr = m_nCurrentPage;
+
+    if( nPageNr < 0 || nPageNr >= (sal_Int32)m_aPages.size() )
+        return;
+
+    m_aFormulaNotes.push_back( PDFNoteEntry() );
+    m_aFormulaNotes.back().m_nObject       = createObject();
+    m_aFormulaNotes.back().m_aContents     = rNote;
+    m_aFormulaNotes.back().m_aRect         = rRect;
+    // convert to default user space now, since the mapmode may change
+    m_aPages[nPageNr].convertRect( m_aFormulaNotes.back().m_aRect );
+
+    // insert note to page's annotation list
+    m_aPages[ nPageNr ].m_aAnnotations.push_back( m_aFormulaNotes.back().m_nObject );
+
+    return;
+}
+
 sal_Int32 PDFWriterImpl::createLink( const Rectangle& rRect, sal_Int32 nPageNr )
 {
     if( nPageNr < 0 )
diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx
index c8ebcac..e645128 100644
--- a/vcl/source/gdi/pdfwriter_impl.hxx
+++ b/vcl/source/gdi/pdfwriter_impl.hxx
@@ -601,6 +601,7 @@ private:
     /* contains all notes set during PDF creation
      */
     std::vector<PDFNoteEntry>           m_aNotes;
+    std::vector<PDFNoteEntry>           m_aFormulaNotes;
     /* the root of the structure tree
      */
     std::vector<PDFStructureElement>    m_aStructure;
@@ -853,6 +854,8 @@ i12626
     bool emitLinkAnnotations();
     // write all notes
     bool emitNoteAnnotations();
+    // write cell formulas as annotations
+    bool emitFormulaAnnotations();
     // write the appearance streams of a widget
     bool emitAppearances( PDFWidget& rWidget, OStringBuffer& rAnnotDict );
     // clean up radio button "On" values
@@ -1196,6 +1199,7 @@ public:
 
     // notes
     void createNote( const Rectangle& rRect, const PDFNote& rNote, sal_Int32 nPageNr = -1 );
+    void createFormulaAnnotation( const Rectangle& rRect, const PDFNote& rNote, sal_Int32 nPageNr = -1 );
     // structure elements
     sal_Int32 beginStructureElement( PDFWriter::StructElement eType, const OUString& rAlias );
     void endStructureElement();
commit 29bc2177cd5834153f40884f615d4a6c9c70efa8
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Wed Feb 10 14:42:18 2016 +0100

    Branded images for msi installer
    
    The sizes are 122 x 234, 374 x 44 installed units respectively, according to
    http://msdn.microsoft.com/de-de/library/windows/desktop/aa369490%28v=vs.85%29.aspx
    
    it is 163x312, 499x58 pixels at 96 dpi. I bumped dpi to 120 and it still looks pixelated,
    but it's as good as it gets.
    
    For better results, we need different graphics, with less fine details given the very limited
    space
    
    Change-Id: I4a7eafed16fd79f377d27afa8151cfab614b464b

diff --git a/instsetoo_native/inc_common/windows/msi_templates/Binary/Banner.bmp b/instsetoo_native/inc_common/windows/msi_templates/Binary/Banner.bmp
index e267d49..471eea4 100644
Binary files a/instsetoo_native/inc_common/windows/msi_templates/Binary/Banner.bmp and b/instsetoo_native/inc_common/windows/msi_templates/Binary/Banner.bmp differ
diff --git a/instsetoo_native/inc_common/windows/msi_templates/Binary/Image.bmp b/instsetoo_native/inc_common/windows/msi_templates/Binary/Image.bmp
index b824ddf..2703670 100644
Binary files a/instsetoo_native/inc_common/windows/msi_templates/Binary/Image.bmp and b/instsetoo_native/inc_common/windows/msi_templates/Binary/Image.bmp differ
commit 10442abc643422ba3018b38e2959bfbf41edae2e
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Tue Feb 9 11:09:30 2016 +0100

    Branded application icons
    
    sadly, this doesn't replace Windows taskbar icon, that must be living somewhere
    else. It works on Linux though.
    
    Conflicts:
    	icon-themes/galaxy/res/main128.png
    	icon-themes/galaxy/res/mainapp_16.png
    	icon-themes/galaxy/res/mainapp_16_8.png
    	icon-themes/galaxy/res/mainapp_32.png
    	icon-themes/galaxy/res/mainapp_32_8.png
    	icon-themes/galaxy/res/mainapp_48_8.png
    
    Change-Id: I028fc68d96f02113622c5e1ec3ed830ac797be0b

diff --git a/icon-themes/galaxy/res/main128.png b/icon-themes/galaxy/res/main128.png
index 2779337..818b733 100644
Binary files a/icon-themes/galaxy/res/main128.png and b/icon-themes/galaxy/res/main128.png differ
diff --git a/icon-themes/galaxy/res/mainapp_16.png b/icon-themes/galaxy/res/mainapp_16.png
index 94abb95..13945ee 100644
Binary files a/icon-themes/galaxy/res/mainapp_16.png and b/icon-themes/galaxy/res/mainapp_16.png differ
diff --git a/icon-themes/galaxy/res/mainapp_16_8.png b/icon-themes/galaxy/res/mainapp_16_8.png
index 94abb95..13945ee 100644
Binary files a/icon-themes/galaxy/res/mainapp_16_8.png and b/icon-themes/galaxy/res/mainapp_16_8.png differ
diff --git a/icon-themes/galaxy/res/mainapp_32.png b/icon-themes/galaxy/res/mainapp_32.png
index 2c8a21f..c653935 100644
Binary files a/icon-themes/galaxy/res/mainapp_32.png and b/icon-themes/galaxy/res/mainapp_32.png differ
diff --git a/icon-themes/galaxy/res/mainapp_32_8.png b/icon-themes/galaxy/res/mainapp_32_8.png
index 2c8a21f..c653935 100644
Binary files a/icon-themes/galaxy/res/mainapp_32_8.png and b/icon-themes/galaxy/res/mainapp_32_8.png differ
diff --git a/icon-themes/galaxy/res/mainapp_48_8.png b/icon-themes/galaxy/res/mainapp_48_8.png
index cdebedf..562ea23 100644
Binary files a/icon-themes/galaxy/res/mainapp_48_8.png and b/icon-themes/galaxy/res/mainapp_48_8.png differ
commit adaa5c6c7c9b02be21a3625a8e97984337d05ac1
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Tue Feb 9 10:38:29 2016 +0100

    Point to CIB helpdesk
    
    it's pretty mean, b/c German translation (which I can't change) says the site
    is in English, while CIB site is in German only and can't be switched to other
    lang
    
    Change-Id: Ifbbb9e9d2bbee40998c07d1c68b61cd20d77dbc3

diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index bd26562..8ea1038 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -439,8 +439,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
         case SID_SEND_FEEDBACK:
         {
             OUString module = SfxHelp::GetCurrentModuleIdentifier();
-            OUString sURL("http://hub.libreoffice.org/send-feedback/?LOversion=" + utl::ConfigManager::getAboutBoxProductVersion() +
-                "&LOlocale=" + utl::ConfigManager::getLocale() + "&LOmodule=" + module.copy(module.lastIndexOf('.') + 1 )  );
+            OUString sURL("http://libreoffice.cib.de/support");
             try
             {
                 uno::Reference< css::system::XSystemShellExecute > xSystemShellExecute(
commit 89d3ce77d0bfd994bb77fc989ed10d9351ecb139
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Tue Feb 9 10:00:30 2016 +0100

    Point to CIB website
    
    this idiotic postprocess script hard-codes libreoffice.org for some reason, grr
    
    Change-Id: Ide1f19d4da9a437e01118e8baf74c0d1a8ca2e10

diff --git a/instsetoo_native/util/openoffice.lst.in b/instsetoo_native/util/openoffice.lst.in
index 5f51117..801293c 100644
--- a/instsetoo_native/util/openoffice.lst.in
+++ b/instsetoo_native/util/openoffice.lst.in
@@ -68,7 +68,7 @@ LibreOffice
             CHANGETARGETDIR 1
             PATCHCODEFILE ooo_patchcodes.txt
             STARTCENTER_ADDFEATURE_URL http://extensions.libreoffice.org/
-            STARTCENTER_INFO_URL https://www.libreoffice.org/
+            STARTCENTER_INFO_URL http://libreoffice.cib.de/
             STARTCENTER_TEMPLREP_URL http://templates.libreoffice.org/
             DICT_REPO_URL http://extensions.libreoffice.org/dictionaries/
             STARTCENTER_HIDE_EXTERNAL_LINKS 0
@@ -121,7 +121,7 @@ LibreOfficeDev
             CODEFILENAME codes_ooodev.txt
             LOCALUSERDIR $ORIGIN/..
             STARTCENTER_ADDFEATURE_URL http://extensions.libreoffice.org/
-            STARTCENTER_INFO_URL https://www.libreoffice.org/
+            STARTCENTER_INFO_URL http://libreoffice.cib.de/
             STARTCENTER_TEMPLREP_URL http://templates.libreoffice.org/
             DICT_REPO_URL http://extensions.libreoffice.org/dictionaries/
             STARTCENTER_HIDE_EXTERNAL_LINKS 0
@@ -163,7 +163,7 @@ LibreOffice_SDK
             CHANGETARGETDIR 1
             DONTUSESTARTMENUFOLDER 1
             STARTCENTER_ADDFEATURE_URL http://extensions.libreoffice.org/
-            STARTCENTER_INFO_URL https://www.libreoffice.org/
+            STARTCENTER_INFO_URL http://libreoffice.cib.de/
             STARTCENTER_TEMPLREP_URL http://templates.libreoffice.org/
             DICT_REPO_URL http://extensions.libreoffice.org/dictionaries/
             STARTCENTER_HIDE_EXTERNAL_LINKS 0
@@ -209,7 +209,7 @@ LibreOfficeDev_SDK
             CHANGETARGETDIR 1
             DONTUSESTARTMENUFOLDER 1
             STARTCENTER_ADDFEATURE_URL http://extensions.libreoffice.org/
-            STARTCENTER_INFO_URL https://www.libreoffice.org/
+            STARTCENTER_INFO_URL http://libreoffice.cib.de/
             STARTCENTER_TEMPLREP_URL http://templates.libreoffice.org/
             DICT_REPO_URL http://extensions.libreoffice.org/dictionaries/
             STARTCENTER_HIDE_EXTERNAL_LINKS 0
diff --git a/postprocess/CustomTarget_registry.mk b/postprocess/CustomTarget_registry.mk
index 6a9e2d1..8675d52 100644
--- a/postprocess/CustomTarget_registry.mk
+++ b/postprocess/CustomTarget_registry.mk
@@ -543,7 +543,7 @@ postprocess_main_SED := \
 	-e 's,$${PRODUCTVERSION},$(PRODUCTVERSION),g' \
 	-e 's,$${PRODUCTEXTENSION},.$(LIBO_VERSION_MICRO).$(LIBO_VERSION_PATCH)$(LIBO_VERSION_SUFFIX),g' \
 	-e 's,$${STARTCENTER_ADDFEATURE_URL},http://extensions.libreoffice.org/,g' \
-	-e 's,$${STARTCENTER_INFO_URL},https://www.libreoffice.org/,g' \
+	-e 's,$${STARTCENTER_INFO_URL},http://libreoffice.cib.de/,g' \
 	-e 's,$${STARTCENTER_HIDE_EXTERNAL_LINKS},0,g' \
 	-e 's,$${STARTCENTER_TEMPLREP_URL},http://templates.libreoffice.org/,g' \
 	-e 's,$${SYSTEM_LIBEXTTEXTCAT_DATA},$(SYSTEM_LIBEXTTEXTCAT_DATA),g' \
diff --git a/svtools/source/misc/langhelp.cxx b/svtools/source/misc/langhelp.cxx
index 16a3a1d..24b066a 100644
--- a/svtools/source/misc/langhelp.cxx
+++ b/svtools/source/misc/langhelp.cxx
@@ -16,6 +16,7 @@
 
 void localizeWebserviceURI( OUString& rURI )
 {
+    const OUString aPrefix = "?lang=";
     OUString aLang = Application::GetSettings().GetUILanguageTag().getLanguage();
     if ( aLang.equalsIgnoreAsciiCase("pt")
          && Application::GetSettings().GetUILanguageTag().getCountry().equalsIgnoreAsciiCase("br") )
@@ -30,6 +31,7 @@ void localizeWebserviceURI( OUString& rURI )
             aLang = "zh-tw";
     }
 
+    rURI += aPrefix;
     rURI += aLang;
 }
 
commit 73b8980aa136bfae85c6c348ea13ccc21078855f
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Mon Sep 21 13:47:57 2015 +0200

    CIB branding for start center
    
    Conflicts:
    	icon-themes/galaxy/sfx2/res/startcenter-logo.png
    
    Change-Id: I9887fded72131c7888d6e1b1165a778c8da2952d

diff --git a/icon-themes/galaxy/sfx2/res/logo.png b/icon-themes/galaxy/sfx2/res/logo.png
index 5d7e59c..1f215d3 100644
Binary files a/icon-themes/galaxy/sfx2/res/logo.png and b/icon-themes/galaxy/sfx2/res/logo.png differ
diff --git a/icon-themes/galaxy/sfx2/res/startcenter-logo.png b/icon-themes/galaxy/sfx2/res/startcenter-logo.png
index 78bc4eb..ef903fb 100644
Binary files a/icon-themes/galaxy/sfx2/res/startcenter-logo.png and b/icon-themes/galaxy/sfx2/res/startcenter-logo.png differ
diff --git a/icon-themes/galaxy/sfx2/res/startcenter-logo.svg b/icon-themes/galaxy/sfx2/res/startcenter-logo.svg
new file mode 100644
index 0000000..e1c80e5
--- /dev/null
+++ b/icon-themes/galaxy/sfx2/res/startcenter-logo.svg
@@ -0,0 +1,144 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:xlink="http://www.w3.org/1999/xlink"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   id="svg3360"
+   version="1.1"
+   inkscape:version="0.91 r13725"
+   width="368.00235"
+   height="116.34795"
+   viewBox="0 0 368.00235 116.34795"
+   sodipodi:docname="startcenter-logo.svg">
+  <metadata
+     id="metadata3366">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <defs
+     id="defs3364">
+    <clipPath
+       clipPathUnits="userSpaceOnUse"
+       id="clipPath3372">
+      <rect
+         style="fill:#ffd5d5"
+         id="rect3374"
+         width="368.00235"
+         height="116.34795"
+         x="2.077642"
+         y="105.41204" />
+    </clipPath>
+  </defs>
+  <sodipodi:namedview
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1"
+     objecttolerance="10"
+     gridtolerance="10"
+     guidetolerance="10"
+     inkscape:pageopacity="0"
+     inkscape:pageshadow="2"
+     inkscape:window-width="1920"
+     inkscape:window-height="1173"
+     id="namedview3362"
+     showgrid="false"
+     fit-margin-top="0"
+     fit-margin-left="0"
+     fit-margin-right="0"
+     fit-margin-bottom="0"
+     inkscape:zoom="0.96262974"
+     inkscape:cx="182.96235"
+     inkscape:cy="110.88"
+     inkscape:window-x="1911"
+     inkscape:window-y="-9"
+     inkscape:window-maximized="1"
+     inkscape:current-layer="svg3360" />
+  <image
+     width="370.07999"
+     height="221.75999"
+     preserveAspectRatio="none"
+     xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgIAAAE0CAYAAABejlvhAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz
+AAATOQAAEzkBj8JWAQAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAA2VSURB
+VHic7d17tJV1mcDx58ABEVkKjnhhLaTERhGJCW+V5n2p43U0Fa8BXijzlrryMs6k2aRLTYs0zBjN
+0WLQaTIgkTFRtPKaISZKyk1BFLnfDwcOzB/qck7vFhTOfvdxns/nz9+zOe/DX+e79tnvfuuGdu+1
+LgCAlNrUegEAoHaEAAAkJgQAIDEhAACJCQEASEwIAEBiQgAAEhMCAJCYEACAxIQAACQmBAAgMSEA
+AIkJAQBITAgAQGJCAAASEwIAkJgQAIDEhAAAJCYEACAxIQAAiQkBAEhMCABAYkIAABITAgCQmBAA
+gMSEAAAkJgQAIDEhAACJCQEASEwIAEBiQgAAEhMCAJCYEACAxIQAACQmBAAgMSEAAIkJAQBITAgA
+QGJCAAASEwIAkJgQAIDEhAAAJCYEACAxIQAAiQkBAEhMCABAYkIAABITAgCQmBAAgMSEAAAkJgQA
+IDEhAACJCQEASEwIAEBiQgAAEhMCAJCYEACAxIQAACQmBAAgMSEAAIkJAQBITAgAQGJCAAASEwIA
+kJgQAIDEhAAAJCYEACAxIQAAiQkBAEhMCABAYkIAABITAgCQmBAAgMSEAAAkJgQAIDEhAACJCQEA
+SEwIAEBiQgAAEhMCAJCYEACAxIQAACQmBAAgMSEAAIkJAQBITAgAQGJCAAASEwIAkJgQAIDEhAAA
+JCYEACAxIQAAiQkBAEhMCABAYkIAABITAgCQmBAAgMSEAAAkJgQAIDEhAACJCQEASEwIAEBiQgAA
+EhMCAJCYEACAxIQAACQmBAAgMSEAAIkJAQBITAgAQGJCAAASEwIAkJgQAIDEhAAAJCYEACAxIQAA
+iQkBAEhMCABAYkIAABITAgCQmBAAgMSEAAAkJgQAIDEhAACJCQEASEwIAEBiQgAAEhMCAJCYEACA
+xIQAACQmBAAgMSEAAIkJAQBITAgAQGJCAAASEwIAkJgQAIDEhAAAJCYEACAxIQAAiQkBAEhMCABA
+YkIAABITAgCQmBAAgMSEAAAkJgQAIDEhAACJCQEASEwIAEBiQgAAEhMCAJCYEACAxIQAACQmBAAg
+MSEAAIkJAQBITAgAQGJCAAASEwIAkJgQAIDEhAAAJCYEACAxIQAAiQkBAEhMCABAYkIAABITAgCQ
+mBAAgMSEAAAkJgQAIDEhAACJCQEASEwIAEBiQgAAEhMCAJCYEACAxIQAACQmBAAgMSEAAIkJAQBI
+TAgAQGJCAAASEwIAkJgQAIDEhAAAJCYEACAxIQAAiQkBAEhMCABAYkIAABITAgCQWH2tFwDg/7ft
+9+wXu5x4XGy21Za1XuVjWb1iRcz4n3Ex/ZHHNvjabvvsGbucdHy026Jji+6waNqMmDjsnli1aHGL
+/txK6oZ277Wu6lcBIKWufXrHCSNHRJv6trVe5RN7Ycgd8dwtt33kfNt/6BMnPDg86tpW5/82b9Kr
+8aujTop1a9dW5ed/wJ8GAKiazx528KcyAiIi9rj4vNjn8m995HzHg/avWgRERGzTu1d03ukzVfv5
+HxACAFRNfcfNa73CJul3weD48r98u+Js7kuTqn79+o4t+yeHSoQAAKxH38GD4sv/ennh/I1x42Pi
+sHvKX6iF+bAgAKUacfDRsXDKtFqvUdE2vXeNY4bfHR26dG523vfcgVG/+ebx5NXXRaz78KN1T33v
+pljTsCr2uPDrZa/aYrwjAADvmzdpcow+7axoWLCwMOt9Rv844PprIurqmp0/d/OQeGHIHWWt2OKE
+AAD8H/MmTY7fnHhmrJg7rzDb7fST44Abro26Ns1/fT53y23xpx/+pKwVW5QQAIC/sXDKtBh58sBY
+8e7cwmy3006qGAPP//An8cwNt5a1YosRAgBQwaKp02Jk/4GxfM67hVmvU0+MA2+8rhADE+7493jm
+hlvKWrFFCAEA+AiLpk6PUacMqhgDu/Y/IQ4ZcmPhuwQm3HFXPP39m8tacZMJAQBYj0VTp8eo/gNj
++TtzCrPPHXdUHDrkxsKXJr1458/jqe/dVNaKm0QIAMAGLJo2Ix484YxYOuutwmznY4+MQ398cyEG
+Jg67J5785+82u92wNRICAPAxLJ31Vow8aUAsmTmrMOt59BFx6G0/KMTApF/cH0+08hgQAgDwMS19
+a3aMPHlALHlzZmHW86jD49Dbb4k29c2/q++VXz4QT1x1bdUfHrSxhAAAfALL3no7RvYfGEveqBAD
+Rx4WRwz7cbRt377Z+SvD/yueuPKaVhkDQgAAPqH3YmBALJ7xZmHW45AD4/CfDSnEwKsj/jvGX/Gd
+VhcDQgAANsKy2e/Eb756RsXnJvQ4+IA4Ytht0XazzZqdT77/1zHu4iti7ZqmstbcICEAABtpxdx5
+Mar/wFj4+tTCbMeDvlIxBl4f+VCMu/jyVhMDQgAANsGKufNiZP+BseC1KYXZjgfuF/941+1R36FD
+s/Mpox+ORy/6dquIASEAAJto5bz5Mar/wFjw19cLs+777xtH3XtntNuiY7Pzqb8dG49ecFmsXbOm
+rDUrEgIA0AJWzl8Qo04ZFPMnv1aYdfviXnHkPT8txsCYR2LsuRdFU2NjWWsWCAEAaCEr5y+I0aee
+FfNf/Wth1m2fPeOo/7gz2nXaotn5G+PGx+++eWmsXb268G+aGhqqtusHhAAAtKCV8xfEyJMHxNyX
+Xi7Mdth7j4oxMP2Rx2Ls4IubvTMwb9LkWDh1etX3FQIA0MJWLV4So087O9598S+F2Q579Yuj7/tZ
+tO/Uqdn5G+PGx6+POyVeuvu++NOPhsbo08+OdU3V/zChEACAKli1ZGn89oxzYs6Elwqz7ff4Qhw7
+4u7YbKstm53PmzQ5/njtDfH8rbdHw4KFpewpBACgSt6LgXNjzp8nFmZdP797HDP8rtis81Y12OxD
+QgAAqqhx6fsx8MKLhVnXPr3jmOF3RYcunWuw2XuEAABUWeOyZTH69LNj9tPPFWZdd98tjhl+d81i
+QAgAQAlWr1gZYwadF2899Wxhtk3vXd+Lga27lL6XEACAkmwoBv7pV/dFx67blLqTEACAEq1Z2RBj
+Bp0Xs/7wdGHWZeed4rgH7omO23YtbR8hAAAlW7OyIR4+6/yY9funCrPOPXeK4+7/eWyx3bal7CIE
+AKAG1jQ0xMNnXxAzn/hDYda5505x+J1Doq5N9X9NCwEAqJE1DQ3x8DkXxpuP/74w265f39jqMztW
+fQchAAA11LRqVYw998KY/czzhVm7v/ka4moQAgBQY02NjRUfUlQGIQAAiQkBAEhMCABAYkIAABIT
+AgCQmBAAgNagrq4mlxUCAJCYEACAxIQAACQmBAAgMSEAAIkJAQBoDdw1AACUTQgAQGJCAAASEwIA
+kJgQAIDEhAAAJCYEAKAVqHP7IABQNiEAAIkJAQBITAgAQGJCAAASEwIAkJgQAIDWwO2DAEDZhAAA
+JCYEACAxIQAAiQkBAEhMCABAK+ChQwCQWIetu9TkukIAAFqBbT+/e+Fs7ZrVVb+uEACAGuvap3ds
+9dkehfPlb8+p+rWFAADUWN/BAwtnS2bOioaFi6p+bSEAADX0d7vtEjsffUThfMbvHi/l+kIAAGql
+ri72++7VUde2bfPzdevilV8+UMoKQgAAaqTv2V+LbvvsWTifMW58LHx9aik7CAEAqIGufXrHF6+6
+tHC+rqkpnrtpSGl7CAEAKFn7Tp3isKG3Rpt27Qqzl+8dEfMnv1baLkIAAEpU16ZNHPSDf4ste3Qv
+zJa8OTOevflHpe4jBACgRPtec1XsdORhhfN1TU3x2CVXxeply0vdRwgAQEn2uOgb0WfQ6RVnz940
+JN5+/s8lbyQEAKAUvU75aux92YUVZ9PHPhoTfnpXyRu9RwgAQJXtevLxsf/110ZUeMLgnAkvxbhL
+roxYt678xSKiviZXBYAkvnDeORVvE4yIWPDalHhowNdj9fIVJW/1ISEAAFVQ17ZtfOW6q6P3madU
+nC+b/U489LXBsWrR4pI3a04IAEAL67B1lzj4lu9Hj0MOrDhfOW9+jDp1UCyb/U65i1UgBACgBXX7
+0t5x6JAbY4vtt6s4XzJzVjx05uBYPP2NkjerTAgAQAtoU9829vzW+dHv/HOLDxF637sTX44xA78R
+K+cvKHm7jyYEAGATdT9gv9j3O1dEl8/1/MjXvPnYk/HINy+J1StWlrjZhgkBANgI9Zt3iB6HHBh9
+zxkQ2/Xru97Xvnzvf8Yfr70+1q5pKmm7j08IAFCqvS69IFYtWVLrNTZa2/bto1O3HWK7fn2jvkOH
+9b529bLlMf7Ka2LKqDElbffJCQEAStXz6CNqvUIp3nlhQjx+2dWxaNqMWq+yXkIAgOqp0bfl1VLD
+wkXx/K23x6T7RsS6tWtrvc4GCQEAqmb+5NdrvUJpGpcujUm/eCAmDB0WqxZ/ev70IQQAqJrXHhwd
+3b60V/z98cdGm/rKt9R9mq1atDjenfiXmDb20Zgyckw0LltW65U+sbqh3Xvle98GgFK1bd8+6jdf
+/wfrPm3Wrl7d6m4F3BjeEQCg6poaG6OpsbHWa1CBxxADQGJCAAASEwIAkJgQAIDEhAAAJCYEACAx
+IQAAiQkBAEhMCABAYkIAABITAgCQmBAAgMSEAAAkJgQAIDEhAACJCQEASEwIAEBiQgAAEvtfFz6z
+i6MwXbQAAAAASUVORK5CYII=
+"
+     id="image3368"
+     x="0"
+     y="0"
+     clip-path="url(#clipPath3372)"
+     transform="translate(-2.077642,-105.41204)" />
+</svg>
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index 32c3cd7..2736855 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -3588,14 +3588,14 @@
           <info>
             <desc>Specifies the background color of the start center.</desc>
           </info>
-          <value>14540253</value>
+          <value>9903402</value>
         </prop>
         <prop oor:name="StartCenterTextColor" oor:type="xs:int" oor:nillable="false">
           <!-- Default 3355443 = 0x333333 as specified in tdf#90452, comment 45 -->
           <info>
             <desc>Specifies the text color of the buttons in the start center.</desc>
           </info>
-          <value>3355443</value>
+          <value>15658734</value>
         </prop>
         <prop oor:name="StartCenterThumbnailsBackgroundColor" oor:type="xs:int" oor:nillable="false">
           <!-- Default 6710886 = 0x666666 as specified in tdf#90452, comment 45 -->
commit 6d1e4a8da6c3e6c46afa74c9c074e7cb1e70a7cb
Author: Thorsten Behrens <Thorsten.Behrens at CIB.de>
Date:   Fri Jan 6 02:47:23 2017 +0100

    libpng: update to release 1.6.28
    
    Change-Id: Ie22e5eb6656ef1d2e7903011ea72a1aa26d4da7c
    Reviewed-on: https://gerrit.libreoffice.org/32768
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/download.lst b/download.lst
index 700c4dd..3662491 100644
--- a/download.lst
+++ b/download.lst
@@ -125,8 +125,8 @@ export OWNCLOUD_ANDROID_LIB_TARBALL := owncloud-android-library-0.9.4-no-binary-
 export PAGEMAKER_MD5SUM := 5c4985a68be0b79d3f809da5e12b143c
 export PAGEMAKER_TARBALL := libpagemaker-0.0.3.tar.bz2
 export PIXMAN_TARBALL := c63f411b3ad147db2bcce1bf262a0e02-pixman-0.24.4.tar.bz2
-export PNG_MD5SUM := 65213080dd30a9b16193d9b83adc1ee9
-export PNG_TARBALL := libpng-1.6.24.tar.gz
+export PNG_MD5SUM := 897ccec1ebfb0922e83c2bfaa1be8748
+export PNG_TARBALL := libpng-1.6.28.tar.gz
 export POPPLER_MD5SUM := 38c758d84437378ec4f5aae9f875301d
 export POPPLER_TARBALL := poppler-0.46.0.tar.bz2
 export POSTGRESQL_TARBALL := c0b4799ea9850eae3ead14f0a60e9418-postgresql-9.2.1.tar.bz2
commit 69954cc174f10fbf511a1aa14cf784e54259861c
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Sep 13 10:42:16 2016 +0100

    Resolves: tdf#105096 add xdg-email as the default email route
    
    because xdg-email is apparently the only route
    that knows how to support adding an attachment
    to thunderbird
    
    (cherry picked from commit 5f58670b43e5284d9460b561e774175c7a2dd7ab)
    
    Change-Id: Ife1b56ccfe2434eb31ad67bef00f55197e96151e
    Reviewed-on: https://gerrit.libreoffice.org/32756
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/shell/source/unix/misc/senddoc.sh b/shell/source/unix/misc/senddoc.sh
index 169af25..4519e01 100755
--- a/shell/source/unix/misc/senddoc.sh
+++ b/shell/source/unix/misc/senddoc.sh
@@ -384,7 +384,9 @@ case `basename "$MAILER" | sed 's/-.*$//'` in
         # Try to be smart, and send the mail anyway, if we have the
         # possibility to do so.
 
-        if [ -n "$DESKTOP_LAUNCH" ]; then
+        if [ -x /usr/bin/xdg-email ] ; then
+            MAILER=/usr/bin/xdg-email
+        elif [ -n "$DESKTOP_LAUNCH" ]; then
             # http://lists.freedesktop.org/pipermail/xdg/2004-August/002873.html
             MAILER=${DESKTOP_LAUNCH}
         elif [ -n "$KDE_FULL_SESSION" -a -x /usr/bin/kde-open ] ; then
@@ -423,7 +425,11 @@ case `basename "$MAILER" | sed 's/-.*$//'` in
                     shift
                     ;;
                 --attach)
-                    MAILTO="${MAILTO:-}${MAILTO:+&}attachment="`echo "file://$2" | "${URI_ENCODE}"`
+                    if [ "$MAILER" = "/usr/bin/xdg-email" ]; then
+                        MAILTO="${MAILTO:-}${MAILTO:+&}attach="`echo "file://$2" | "${URI_ENCODE}"`
+                    else
+                        MAILTO="${MAILTO:-}${MAILTO:+&}attachment="`echo "file://$2" | "${URI_ENCODE}"`
+                    fi
                     shift
                     ;;
                 *)
commit f9c3998c2260995cccce060d1226b47ac2dc8c2d
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Thu Dec 29 00:52:09 2016 +0100

    process all outstanding events before shutdown, tdf#104969, tdf#104286, tdf#104399
    
    Change-Id: Id09c3dfdc94c430d5dcb2aebb017f17db80f17e6
    Reviewed-on: https://gerrit.libreoffice.org/32486
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    Reviewed-on: https://gerrit.libreoffice.org/32668
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/framework/source/services/desktop.cxx b/framework/source/services/desktop.cxx
index e464fe9..3e5f3a0 100644
--- a/framework/source/services/desktop.cxx
+++ b/framework/source/services/desktop.cxx
@@ -63,6 +63,7 @@
 #include <rtl/instance.hxx>
 #include <vcl/svapp.hxx>
 #include <desktop/crashreport.hxx>
+#include <vcl/scheduler.hxx>
 
 #include <tools/errinf.hxx>
 #include <unotools/configmgr.hxx>
@@ -315,6 +316,10 @@ sal_Bool SAL_CALL Desktop::terminate()
             /* UNSAFE AREA ------------------------------------------------------------------------------------- */
 
         impl_sendNotifyTerminationEvent();
+        {
+            SolarMutexGuard aGuard;
+            Scheduler::ProcessEventsToIdle();
+        }
 
         if(
             ( bAskQuickStart      ) &&
commit a5f5312de639048dac65da292f2b2dcc330cee15
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
Date:   Wed Dec 21 01:23:11 2016 +0000

    tdf#96218: MSO DOCX image incorrectly placed when using Alignment Position
    
    layoutInCell attribute should be ignored when we are not
    in a table.
    
    Reviewed-on: https://gerrit.libreoffice.org/32253
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>
    Tested-by: Tamás Zolnai <tamas.zolnai at collabora.com>
    (cherry picked from commit 36750bc977b3210b23b7822abd395b30a78af6f5)
    
    Conflicts:
    	sw/qa/extras/ooxmlimport/ooxmlimport.cxx
    
    Change-Id: Ieed29c690f8516f63d0956a4f0495500908a0d27
    Reviewed-on: https://gerrit.libreoffice.org/32266
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sw/qa/extras/ooxmlimport/data/tdf96218.docx b/sw/qa/extras/ooxmlimport/data/tdf96218.docx
new file mode 100644
index 0000000..a6a269f
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf96218.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 39ffc52..36e34cb 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -3275,6 +3275,14 @@ DECLARE_OOXMLIMPORT_TEST(testTdf82824, "tdf82824.docx")
     // This was text::TextContentAnchorType_AS_CHARACTER, <wp:anchor> wasn't handled on import for the chart.
     CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, getProperty<text::TextContentAnchorType>(getShape(1), "AnchorType"));
 }
+
+DECLARE_OOXMLIMPORT_TEST(testTdf96218, "tdf96218.docx")
+{
+    // Image had a bad position because layoutInCell attribute was not ignored
+    CPPUNIT_ASSERT(!getProperty<bool>(getShape(1), "IsFollowingTextFlow"));
+}
+
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index a46c6f6..789aebe 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3650,6 +3650,11 @@ bool DomainMapper::IsInHeaderFooter() const
     return m_pImpl->IsInHeaderFooter();
 }
 
+bool DomainMapper::IsInTable() const
+{
+    return m_pImpl->hasTableManager() && m_pImpl->getTableManager().isInCell();
+}
+
 bool DomainMapper::IsStyleSheetImport() const
 {
     return m_pImpl->IsStyleSheetImport();
diff --git a/writerfilter/source/dmapper/DomainMapper.hxx b/writerfilter/source/dmapper/DomainMapper.hxx
index 2abaf123..10220b9 100644
--- a/writerfilter/source/dmapper/DomainMapper.hxx
+++ b/writerfilter/source/dmapper/DomainMapper.hxx
@@ -114,6 +114,7 @@ public:
     css::uno::Reference<css::drawing::XShape> PopPendingShape();
 
     bool IsInHeaderFooter() const;
+    bool IsInTable() const;
     bool IsStyleSheetImport() const;
     /**
      @see DomainMapper_Impl::processDeferredCharacterProperties()
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx
index 79b46c7..dedda68 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -1262,7 +1262,7 @@ uno::Reference< text::XTextContent > GraphicImport::createGraphicObject( const b
                 }
                 xGraphicObjectProperties->setPropertyValue(getPropertyName( PROP_SURROUND ),
                     uno::makeAny(m_pImpl->nWrap));
-                if( m_pImpl->bLayoutInCell && m_pImpl->nWrap != text::WrapTextMode_THROUGHT )
+                if( m_pImpl->rDomainMapper.IsInTable() && m_pImpl->bLayoutInCell && m_pImpl->nWrap != text::WrapTextMode_THROUGHT )
                     xGraphicObjectProperties->setPropertyValue(getPropertyName( PROP_FOLLOW_TEXT_FLOW ),
                         uno::makeAny(true));
 
commit f84516a348ea8e05bbf89816505a6041e711ebfd
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Dec 22 13:35:31 2016 +0000

    Resolves: ofz#313 cbBmiSrc > getDIBV5HeaderSize
    
    Change-Id: I67fb67dc0a4cb609b8f1391c1eb6dd395755a933
    (cherry picked from commit 7485fc2a1484f31631f62f97e5c64c0ae74c6416)
    (cherry picked from commit 371f0f6770add78ae81e0f769d0490874bca353c)
    Reviewed-on: https://gerrit.libreoffice.org/32338
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/vcl/source/filter/wmf/enhwmf.cxx b/vcl/source/filter/wmf/enhwmf.cxx
index ebb42cf..9faca40 100644
--- a/vcl/source/filter/wmf/enhwmf.cxx
+++ b/vcl/source/filter/wmf/enhwmf.cxx
@@ -1252,13 +1252,22 @@ bool EnhWMFReader::ReadEnhWMF()
                     else
                     {
                         const sal_uInt32 nSourceSize = cbBmiSrc + cbBitsSrc + 14;
-                        if ( nSourceSize <= ( nEndPos - nStartPos ) )
+                        bool bSafeRead = nSourceSize <= (nEndPos - nStartPos);
+                        sal_uInt32 nDeltaToDIB5HeaderSize(0);
+                        const bool bReadAlpha(0x01 == aFunc.aAlphaFormat);
+                        if (bSafeRead && bReadAlpha)
                         {
                             // we need to read alpha channel data if AlphaFormat of BLENDFUNCTION is
                             // AC_SRC_ALPHA (==0x01). To read it, create a temp DIB-File which is ready
                             // for DIB-5 format
-                            const bool bReadAlpha(0x01 == aFunc.aAlphaFormat);
-                            const sal_uInt32 nDeltaToDIB5HeaderSize(bReadAlpha ? getDIBV5HeaderSize() - cbBmiSrc : 0);
+                            const sal_uInt32 nHeaderSize = getDIBV5HeaderSize();
+                            if (cbBmiSrc > nHeaderSize)
+                                bSafeRead = false;
+                            else
+                                nDeltaToDIB5HeaderSize = nHeaderSize - cbBmiSrc;
+                        }
+                        if (bSafeRead)
+                        {
                             const sal_uInt32 nTargetSize(cbBmiSrc + nDeltaToDIB5HeaderSize + cbBitsSrc + 14);
                             char* pBuf = new char[ nTargetSize ];
                             SvMemoryStream aTmp( pBuf, nTargetSize, StreamMode::READ | StreamMode::WRITE );
@@ -1277,7 +1286,7 @@ bool EnhWMFReader::ReadEnhWMF()
                             pWMF->Seek( nStart + offBmiSrc );
                             pWMF->Read( pBuf + 14, cbBmiSrc );
 
-                            if(bReadAlpha)
+                            if (bReadAlpha)
                             {
                                 // need to add values for all stuff that DIBV5Header is bigger
                                 // than DIBInfoHeader, all values are correctly initialized to zero,
commit f0241948bd5c68c50c380d9c38704da563a80ac4
Author: Winfried Donkers <winfrieddonkers at libreoffice.org>
Date:   Sat Dec 31 10:05:46 2016 +0100

    tdf#104981 Fix deficiencies with PERCENTRANK functions.
    
    Added constraint check for significance argument.
    Replced inproper use of log() with log10().
    Improved code efficiency a little bit.
    
    Change-Id: Ie918857e6a04ea9fcf18410f789d7252f9c1cfc8
    Reviewed-on: https://gerrit.libreoffice.org/32528
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Eike Rathke <erack at redhat.com>
    (cherry picked from commit facb4e69e4c75839df89969206403d2e97146dbd)
    Reviewed-on: https://gerrit.libreoffice.org/32724
    Tested-by: Eike Rathke <erack at redhat.com>

diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index 5a98900..3d80505 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -3538,6 +3538,11 @@ void ScInterpreter::ScPercentrank( bool bInclusive )
     if ( !MustHaveParamCount( nParamCount, 2, 3 ) )
         return;
     double fSignificance = ( nParamCount == 3 ? ::rtl::math::approxFloor( GetDouble() ) : 3.0 );
+    if ( fSignificance < 1.0 )
+    {
+        PushIllegalArgument();
+        return;
+    }
     double fNum = GetDouble();
     vector<double> aSortArray;
     GetSortArray( 1, aSortArray, nullptr, false, false );
@@ -3557,8 +3562,8 @@ void ScInterpreter::ScPercentrank( bool bInclusive )
                 fRes = GetPercentrank( aSortArray, fNum, bInclusive );
             if ( fRes != 0.0 )
             {
-                double fExp = ::rtl::math::approxFloor( log( fRes ) );
-                fRes = ::rtl::math::round( fRes * pow( 10, -fExp + fSignificance - 1 ) ) / pow( 10, -fExp + fSignificance - 1 );
+                double fExp = ::rtl::math::approxFloor( log10( fRes ) ) + 1.0 - fSignificance;
+                fRes = ::rtl::math::round( fRes * pow( 10, -fExp ) ) / pow( 10, -fExp );
             }
             PushDouble( fRes );
         }
commit 8fdb960a4fca24ae4ef3e9706218ca00cb7f4fd0
Author: Tor Lillqvist <tml at collabora.com>
Date:   Wed Jun 22 15:34:16 2016 +0300

    tdf#93124: The arbitrary number 100 seems to be too high, let's try 50
    
    The test fails on a tinderbox. Adding a temporary printf shows that
    the number there is 71.
    
    Change-Id: Ic8fbaab9e3d3434e20ba6aef5cc1acd66b5f4283
    (cherry picked from commit 9c07735a0160864c949ac27de1821d6967181516)
    Reviewed-on: https://gerrit.libreoffice.org/32693
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Michael Stahl <mstahl at redhat.com>

diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 0defbc4..49b7d25 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -1327,7 +1327,7 @@ void SdImportTest::testTdf93124()
                     ++nNonWhiteCount;
             }
         }
-        CPPUNIT_ASSERT_MESSAGE("Tdf93124: vertical alignment of text is incorrect!", nNonWhiteCount>100);
+        CPPUNIT_ASSERT_MESSAGE("Tdf93124: vertical alignment of text is incorrect!", nNonWhiteCount>50);
     }
     xDocShRef->DoClose();
 }
commit 441e79dc9e7a1ef8db30ed6a8dc0a5872ff3bf4b
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Tue Jun 7 18:07:43 2016 +0900

    sd: make test "testTdf93124" more robust
    
    Check that the bitmap ihas been exported and imported correctly
    instead of seg. fault.
    
    + use ScopedReadAccess
    
    Change-Id: Ib79b5beddef5dc4f7c3435bae94c2f6a26f8ac10
    (cherry picked from commit f08e1630ae56e6f3335a11020e6d2c33c4ce2863)
    Reviewed-on: https://gerrit.libreoffice.org/32692
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index b639c19..0defbc4 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -1310,18 +1310,25 @@ void SdImportTest::testTdf93124()
     SvFileStream aFileStream(aTempFile.GetURL(), StreamMode::READ);
     vcl::PNGReader aPNGReader(aFileStream);
     BitmapEx aBMPEx = aPNGReader.Read();
+
+    // make sure the bitmap is not empty and correct size (PNG export->import was successful)
+    CPPUNIT_ASSERT_EQUAL(Size(320, 180), aBMPEx.GetSizePixel());
     Bitmap aBMP = aBMPEx.GetBitmap();
-    BitmapReadAccess* pRead = aBMP.AcquireReadAccess();
-    int nNonWhiteCount = 0;
-    // The word "Top" should be in rectangle 34,4 - 76,30. If text alignment is wrong, the rectangle will be white.
-    for (long nX = 34; nX < (34 + 43); ++nX)
+    {
+        Bitmap::ScopedReadAccess pReadAccess(aBMP);
+        int nNonWhiteCount = 0;
+        // The word "Top" should be in rectangle 34,4 - 76,30. If text alignment is wrong, the rectangle will be white.
         for (long nY = 4; nY < (4 + 26); ++nY)
         {
-            const Color aColor = pRead->GetColor(nY, nX);
-            if ((aColor.GetRed() != 0xff) || (aColor.GetGreen() != 0xff) || (aColor.GetBlue() != 0xff))
-                ++nNonWhiteCount;
+            for (long nX = 34; nX < (34 + 43); ++nX)
+            {
+                const Color aColor = pReadAccess->GetColor(nY, nX);
+                if ((aColor.GetRed() != 0xff) || (aColor.GetGreen() != 0xff) || (aColor.GetBlue() != 0xff))
+                    ++nNonWhiteCount;
+            }
         }
-    CPPUNIT_ASSERT_MESSAGE("Tdf93124: vertical alignment of text is incorrect!", nNonWhiteCount>100);
+        CPPUNIT_ASSERT_MESSAGE("Tdf93124: vertical alignment of text is incorrect!", nNonWhiteCount>100);
+    }
     xDocShRef->DoClose();
 }
 
commit 28e1680182666c13599b744efca8e0ebd08706d5
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Jan 2 11:53:31 2017 +0000

    ofz#372 check if ImplSplit succeeded
    
    (cherry picked from commit 62a97e6a561ce65e88d4c537a1b82c336f012722)
    (cherry picked from commit 6431e2bff67e81b4aff4e3b52e67903e1cd566f3)
    
    Change-Id: I1e34295fe3ee5f77e787f583616d52fa92a0eca4
    Reviewed-on: https://gerrit.libreoffice.org/32640
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/tools/inc/poly.h b/tools/inc/poly.h
index f15f01f..3269efe 100644
--- a/tools/inc/poly.h
+++ b/tools/inc/poly.h
@@ -42,7 +42,7 @@ public:
 
     void            ImplSetSize( sal_uInt16 nSize, bool bResize = true );
     void            ImplCreateFlagArray();
-    void            ImplSplit( sal_uInt16 nPos, sal_uInt16 nSpace, ImplPolygon* pInitPoly = NULL );
+    bool            ImplSplit( sal_uInt16 nPos, sal_uInt16 nSpace, ImplPolygon* pInitPoly = NULL );
 };
 
 #define MAX_POLYGONS        ((sal_uInt16)0x3FF0)
diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx
index 519c9b4..266ac2d 100644
--- a/tools/source/generic/poly.cxx
+++ b/tools/source/generic/poly.cxx
@@ -212,11 +212,14 @@ void ImplPolygon::ImplSetSize( sal_uInt16 nNewSize, bool bResize )
     mnPoints   = nNewSize;
 }
 
-void ImplPolygon::ImplSplit( sal_uInt16 nPos, sal_uInt16 nSpace, ImplPolygon* pInitPoly )
+bool ImplPolygon::ImplSplit( sal_uInt16 nPos, sal_uInt16 nSpace, ImplPolygon* pInitPoly )
 {
     //Can't fit this in :-(, throw ?
     if (mnPoints + nSpace > USHRT_MAX)
-        return;
+    {
+        SAL_WARN("tools", "Polygon needs " << mnPoints + nSpace << " points, but only " << USHRT_MAX << " possible");
+        return false;
+    }
 
     const sal_uInt16    nNewSize = mnPoints + nSpace;
     const std::size_t   nSpaceSize = static_cast<std::size_t>(nSpace) * sizeof(Point);
@@ -272,6 +275,8 @@ void ImplPolygon::ImplSplit( sal_uInt16 nPos, sal_uInt16 nSpace, ImplPolygon* pI
         mpPointAry = pNewAry;
         mnPoints   = nNewSize;
     }
+
+    return true;
 }
 
 void ImplPolygon::ImplCreateFlagArray()
@@ -1473,8 +1478,8 @@ void Polygon::Insert( sal_uInt16 nPos, const Point& rPt )
     if( nPos >= mpImplPolygon->mnPoints )
         nPos = mpImplPolygon->mnPoints;
 
-    mpImplPolygon->ImplSplit( nPos, 1 );
-    mpImplPolygon->mpPointAry[ nPos ] = rPt;
+    if (mpImplPolygon->ImplSplit(nPos, 1))
+        mpImplPolygon->mpPointAry[ nPos ] = rPt;
 }
 
 void Polygon::Insert( sal_uInt16 nPos, const tools::Polygon& rPoly )
commit a6eecb4ee85148d8a6a1697d794f9f8acc3d1562
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Dec 19 11:15:06 2016 +0000

    Related: rhbz#1405521 abrt reported crash in dnd
    
    Change-Id: I8d8f9379d36dd3dd1a8973cd9f9c14860765630b
    Reviewed-on: https://gerrit.libreoffice.org/32178
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 6b6f002..5966c0d 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -2903,7 +2903,7 @@ void Edit::dragDropEnd( const css::datatransfer::dnd::DragSourceDropEvent& rDSDE
 {
     SolarMutexGuard aVclGuard;
 
-    if ( rDSDE.DropSuccess && ( rDSDE.DropAction & datatransfer::dnd::DNDConstants::ACTION_MOVE ) )
+    if (rDSDE.DropSuccess && (rDSDE.DropAction & datatransfer::dnd::DNDConstants::ACTION_MOVE) && mpDDInfo)
     {
         Selection aSel( mpDDInfo->aDndStartSel );
         if ( mpDDInfo->bDroppedInMe )
commit 1d45caa9a3a326a1947265feb02d7d0a378c75f3
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Dec 13 13:51:24 2016 +0000

    crashtesting: assert on loading certain rtf
    
    Change-Id: I17acf270f552571fec898e19fa2d000ec4c00df5
    (cherry picked from commit 82f25d5de546225548725e4056fdf1148fe605eb)
    Reviewed-on: https://gerrit.libreoffice.org/31979
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/sw/inc/ndarr.hxx b/sw/inc/ndarr.hxx
index 39078e7..f4c00d4 100644
--- a/sw/inc/ndarr.hxx
+++ b/sw/inc/ndarr.hxx
@@ -258,7 +258,7 @@ public:
                                 SwTextFormatColl* pTextColl,
                                 SwUndoTextToTable* pUndo = nullptr );
 
-    static SwNodeRange * ExpandRangeForTableBox(const SwNodeRange & rRange);
+    SwNodeRange * ExpandRangeForTableBox(const SwNodeRange & rRange);
 
     /// create a table from a vector of NodeRanges - API support
     SwTableNode* TextToTable( const TableRanges_t& rTableNodes,
diff --git a/sw/qa/core/data/rtf/fail/table-3.rtf b/sw/qa/core/data/rtf/fail/table-3.rtf
new file mode 100644
index 0000000..ea07218
Binary files /dev/null and b/sw/qa/core/data/rtf/fail/table-3.rtf differ
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 56a54575..889a513 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -1315,7 +1315,7 @@ SwNodeRange * SwNodes::ExpandRangeForTableBox(const SwNodeRange & rRange)
     }
 
     SwNode * pNode = &aIndex.GetNode();
-    while (pNode->IsEndNode())
+    while (pNode->IsEndNode() && aIndex < Count() - 1)
     {
         SwNode * pStartNode = pNode->StartOfSectionNode();
         SwNodeIndex aStartIndex(*pStartNode);
diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx
index bad069f..f87543c 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -1839,7 +1839,7 @@ void SwXText::Impl::ConvertCell(
     SwNodeRange aTmpRange(aStartCellPam.Start()->nNode,
                           aEndCellPam.End()->nNode);
     SwNodeRange * pCorrectedRange =
-        SwNodes::ExpandRangeForTableBox(aTmpRange);
+        m_pDoc->GetNodes().ExpandRangeForTableBox(aTmpRange);
 
     if (pCorrectedRange != nullptr)
     {
commit 03b6eff8ba1d7102608221e6bf94f581aba2ee9d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Dec 22 11:09:08 2016 +0000

    valgrind: stick 0 at end of successfully read data
    
    (cherry picked from commit 0dfc6f70ab53a773ee05664235d7c8927ab20f2c)
    (cherry picked from commit 3ea598f65bed096dbf4bda5fe4105b57c58b5310)
    
    Change-Id: Id79f68c9095ab313ac05d2c8b55df71788df81d3
    Reviewed-on: https://gerrit.libreoffice.org/32335
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/vcl/source/filter/wmf/winwmf.cxx b/vcl/source/filter/wmf/winwmf.cxx
index c4f7e78..0b7b207 100644
--- a/vcl/source/filter/wmf/winwmf.cxx
+++ b/vcl/source/filter/wmf/winwmf.cxx
@@ -886,7 +886,6 @@ void WMFReader::ReadRecordParams( sal_uInt16 nFunc )
         {
             Size aFontSize;
             char lfFaceName[LF_FACESIZE+1];
-            lfFaceName[LF_FACESIZE] = 0;
             sal_Int16 lfEscapement = 0;
             sal_Int16 lfOrientation = 0;
             sal_Int16 lfWeight = 0;
@@ -904,7 +903,8 @@ void WMFReader::ReadRecordParams( sal_uInt16 nFunc )
             pWMF->ReadUChar( aLogFont.lfClipPrecision );
             pWMF->ReadUChar( aLogFont.lfQuality );
             pWMF->ReadUChar( aLogFont.lfPitchAndFamily );
-            pWMF->Read( lfFaceName, LF_FACESIZE );
+            size_t nRet = pWMF->Read( lfFaceName, LF_FACESIZE );
+            lfFaceName[nRet] = 0;
             aLogFont.lfWidth = aFontSize.Width();
             aLogFont.lfHeight = aFontSize.Height();
             aLogFont.lfEscapement = lfEscapement;
commit 18c7f4fbb156455f74564d16ff807c2242ffe761
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Dec 22 10:51:39 2016 +0000

    Resolves: ofz#310: Sanitize 1 bit bitmap palette indexes too
    
    (cherry picked from commit b08e48166310ab8a53f06f4fee227a948416cf4a)
    (cherry picked from commit 3bff2da31ed580817f6b5b653f48727e38078af5)
    
    crashtesting: fix bmp->odg failure...
    
    id:000178,src:000000,op:havoc,rep:16.bmp
    id:000383,src:000047,op:flip2,pos:18,+cov.bmp
    id:000403,src:000047,op:arith32,pos:22,val:-33.bmp
    id:000317,src:000025,op:havoc,rep:8.bmp
    id:000119,src:000000,op:havoc,rep:16.bmp
    id:000167,src:000000,op:havoc,rep:8.bmp
    
    revealed since
    
    commit 81e3ca4f60e6ac0823c1233841c22a759cfe937f
    Author: Tor Lillqvist <tml at collabora.com>
    Date:   Tue Jun 21 10:34:21 2016 +0300
    
        Use real assert() instead of DBG_ASSERT()
    
    sanitize invalid palette entry indexes at the outer perimeter on initial load
    to try and avoid having to do it in all sort of places in the interior.
    
    we load the palette before getting here, so we should always know the palette size here
    
    (cherry picked from commit 92cee94a262a3a2f43c87bb940c50cb90a2ebd89)
    
    Change-Id: Ied2b71eb1c9088bbbff5fed97f7a04b43f4b4827
    Reviewed-on: https://gerrit.libreoffice.org/32333
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/vcl/source/gdi/dibtools.cxx b/vcl/source/gdi/dibtools.cxx
index 75e39e6..f45fa3d 100644
--- a/vcl/source/gdi/dibtools.cxx
+++ b/vcl/source/gdi/dibtools.cxx
@@ -331,6 +331,22 @@ bool ImplReadDIBPalette( SvStream& rIStm, BitmapWriteAccess& rAcc, bool bQuad )
     return( rIStm.GetError() == 0UL );
 }
 
+namespace
+{
+    sal_uInt8 SanitizePaletteIndex(sal_uInt8 nIndex, bool bHasPalette, sal_uInt16 nPaletteEntryCount)
+    {
+        if (bHasPalette && nIndex >= nPaletteEntryCount)
+        {
+            auto nSanitizedIndex = nIndex % nPaletteEntryCount;
+            SAL_WARN_IF(nIndex != nSanitizedIndex, "vcl", "invalid colormap index: "
+                        << static_cast<unsigned int>(nIndex) << ", colormap len is: "
+                        << nPaletteEntryCount);
+            nIndex = nSanitizedIndex;
+        }
+        return nIndex;
+    }
+}
+
 bool ImplDecodeRLE( sal_uInt8* pBuffer, DIBV5Header& rHeader, BitmapWriteAccess& rAcc, bool bRLE4 )
 {
     Scanline pRLE = pBuffer;
@@ -342,6 +358,8 @@ bool ImplDecodeRLE( sal_uInt8* pBuffer, DIBV5Header& rHeader, BitmapWriteAccess&
     sal_uLong       nX = 0UL;
     sal_uInt8       cTmp;
     bool        bEndDecoding = false;
+    const bool bHasPalette = rAcc.HasPalette();
+    const sal_uInt16 nPaletteEntryCount = rAcc.GetPaletteEntryCount();
 
     do
     {
@@ -367,10 +385,10 @@ bool ImplDecodeRLE( sal_uInt8* pBuffer, DIBV5Header& rHeader, BitmapWriteAccess&
                         cTmp = *pRLE++;
 
                         if( nX < nWidth )
-                            rAcc.SetPixelIndex( nY, nX++, cTmp >> 4 );
+                            rAcc.SetPixelIndex(nY, nX++, SanitizePaletteIndex(cTmp >> 4, bHasPalette, nPaletteEntryCount));
 
                         if( nX < nWidth )
-                            rAcc.SetPixelIndex( nY, nX++, cTmp & 0x0f );
+                            rAcc.SetPixelIndex(nY, nX++, SanitizePaletteIndex(cTmp & 0x0f, bHasPalette, nPaletteEntryCount));
                     }
 
                     if( nRunByte & 1 )
@@ -379,7 +397,7 @@ bool ImplDecodeRLE( sal_uInt8* pBuffer, DIBV5Header& rHeader, BitmapWriteAccess&
                             return false;
 
                         if( nX < nWidth )
-                            rAcc.SetPixelIndex( nY, nX++, *pRLE >> 4 );
+                            rAcc.SetPixelIndex(nY, nX++, SanitizePaletteIndex(*pRLE >> 4, bHasPalette, nPaletteEntryCount));
 
                         pRLE++;
                     }
@@ -400,7 +418,7 @@ bool ImplDecodeRLE( sal_uInt8* pBuffer, DIBV5Header& rHeader, BitmapWriteAccess&
                             return false;
 
                         if( nX < nWidth )
-                            rAcc.SetPixelIndex( nY, nX++, *pRLE );
+                            rAcc.SetPixelIndex(nY, nX++, SanitizePaletteIndex(*pRLE, bHasPalette, nPaletteEntryCount));
 
                         pRLE++;
                     }
@@ -447,19 +465,19 @@ bool ImplDecodeRLE( sal_uInt8* pBuffer, DIBV5Header& rHeader, BitmapWriteAccess&
                 for( sal_uLong i = 0UL; i < nRunByte; i++ )
                 {
                     if( nX < nWidth )
-                        rAcc.SetPixelIndex( nY, nX++, cTmp >> 4 );
+                        rAcc.SetPixelIndex(nY, nX++, SanitizePaletteIndex(cTmp >> 4, bHasPalette, nPaletteEntryCount));
 
                     if( nX < nWidth )
-                        rAcc.SetPixelIndex( nY, nX++, cTmp & 0x0f );
+                        rAcc.SetPixelIndex(nY, nX++, SanitizePaletteIndex(cTmp & 0x0f, bHasPalette, nPaletteEntryCount));
                 }
 
                 if( ( nCountByte & 1 ) && ( nX < nWidth ) )
-                    rAcc.SetPixelIndex( nY, nX++, cTmp >> 4 );
+                    rAcc.SetPixelIndex(nY, nX++, SanitizePaletteIndex(cTmp >> 4, bHasPalette, nPaletteEntryCount));
             }
             else
             {
                 for( sal_uLong i = 0UL; ( i < nCountByte ) && ( nX < nWidth ); i++ )
-                    rAcc.SetPixelIndex( nY, nX++, cTmp );
+                    rAcc.SetPixelIndex(nY, nX++, SanitizePaletteIndex(cTmp, bHasPalette, nPaletteEntryCount));
             }
         }
     }
@@ -481,10 +499,10 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r
     switch(rAcc.GetScanlineFormat())
     {
         case ScanlineFormat::N1BitMsbPal:
-        case ScanlineFormat::N4BitMsnPal:
-        case ScanlineFormat::N8BitPal:
         case ScanlineFormat::N24BitTcBgr:
         {
+            // we can't trust arbitrary-sourced index based formats to have correct indexes, so we exclude the pal formats
+            // from raw read and force checking their colormap indexes
             bNative = ( ( static_cast< bool >(rAcc.IsBottomUp()) != bTopDown ) && !bRLE && !bTCMask && ( rAcc.GetScanlineSize() == nAlignedWidth ) );
             break;
         }
@@ -496,7 +514,7 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r
     }
 
     // Read data
-    if(bNative)
+    if (bNative)
     {
         if (nAlignedWidth
             > std::numeric_limits<sal_Size>::max() / rHeader.nHeight)
@@ -520,7 +538,7 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r
             rIStm.ReadUInt32( nBMask );
         }
 
-        if(bRLE)
+        if (bRLE)
         {
             if(!rHeader.nSizeImage)
             {
@@ -550,6 +568,9 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r
             {
                 case 1:
                 {
+                    const bool bHasPalette = rAcc.HasPalette();
+                    const sal_uInt16 nPaletteEntryCount = rAcc.GetPaletteEntryCount();
+
                     for( ; nCount--; nY += nI )
                     {
                         sal_uInt8*  pTmp;
@@ -568,7 +589,8 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r
                                 cTmp = *pTmp++;
                             }
 
-                            rAcc.SetPixelIndex( nY, nX, (cTmp >> --nShift) & 1);
+                            auto nIndex = (cTmp >> --nShift) & 1;
+                            rAcc.SetPixelIndex(nY, nX, SanitizePaletteIndex(nIndex, bHasPalette, nPaletteEntryCount));
                         }
                     }
                 }
@@ -576,6 +598,9 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r
 
                 case 4:
                 {
+                    const bool bHasPalette = rAcc.HasPalette();
+                    const sal_uInt16 nPaletteEntryCount = rAcc.GetPaletteEntryCount();
+
                     for( ; nCount--; nY += nI )
                     {
                         sal_uInt8*  pTmp;
@@ -594,7 +619,8 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r
                                 cTmp = *pTmp++;
                             }
 
-                            rAcc.SetPixelIndex( nY, nX, (cTmp >> ( --nShift << 2UL ) ) & 0x0f);
+                            auto nIndex = (cTmp >> ( --nShift << 2UL ) ) & 0x0f;
+                            rAcc.SetPixelIndex(nY, nX, SanitizePaletteIndex(nIndex, bHasPalette, nPaletteEntryCount));
                         }
                     }
                 }
@@ -602,6 +628,9 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r
 
                 case 8:
                 {
+                    const bool bHasPalette = rAcc.HasPalette();
+                    const sal_uInt16 nPaletteEntryCount = rAcc.GetPaletteEntryCount();
+
                     for( ; nCount--; nY += nI )
                     {
                         sal_uInt8*  pTmp;
@@ -612,7 +641,10 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r
                         }
 
                         for( long nX = 0L; nX < nWidth; nX++ )
-                            rAcc.SetPixelIndex( nY, nX, *pTmp++ );
+                        {
+                            auto nIndex = *pTmp++;
+                            rAcc.SetPixelIndex(nY, nX, SanitizePaletteIndex(nIndex, bHasPalette, nPaletteEntryCount));
+                        }
                     }
                 }
                 break;
@@ -895,7 +927,7 @@ bool ImplReadDIBBody( SvStream& rIStm, Bitmap& rBmp, AlphaMask* pBmpAlpha, sal_u
         }
 
         // read palette
-        if(nColors)
+        if (nColors)
         {
             pAcc->SetPaletteEntryCount(nColors);
             ImplReadDIBPalette(*pIStm, *pAcc, aHeader.nSize != DIBCOREHEADERSIZE);
commit 74ce6ebe51027ecd742b651d095c455417595908
Author: Justin Luth <justin_luth at sil.org>
Date:   Sat Dec 24 12:00:21 2016 +0300

    tdf#81263 ww8par6: only use valid sal_uInt16 values for ULSpace
    
    VerticalOrient position returns a signed SwTwips number,
    but ULSpace uses unsigned int16, so negative numbers
    were creating huge margins.
    
    fixes commit 3755c87d0426a499d4755e82d8fbc77caa240764
    
    Change-Id: I23daea9a913ef73efc42a65e0adfc393eaf4e775
    Reviewed-on: https://gerrit.libreoffice.org/32400
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Justin Luth <justin_luth at sil.org>
    (cherry picked from commit 604cf7024fce29143150ab77b2f14b59a45e61eb)
    Reviewed-on: https://gerrit.libreoffice.org/32402
    Tested-by: Justin Luth <justin_luth at sil.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    (cherry picked from commit 70b3dd697cb248fb56830db691269fe9e78c57fb)
    Reviewed-on: https://gerrit.libreoffice.org/32648

diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index 06d3ebc..0a8e60c 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -2360,8 +2360,9 @@ bool SwWW8ImplReader::StartApo(const ApoTestResults &rApo,
                 if (aFlySet.HasItem(RES_VERT_ORIENT, &pItem))
                 {
                     const SwFormatVertOrient* pOrient = static_cast<const SwFormatVertOrient*>(pItem);
-                    if (pOrient->GetPos() != 0)
-                        pULSpaceItem->SetUpper(pOrient->GetPos());
+                    SwTwips nPos = pOrient->GetPos();
+                    if( 0 < nPos && nPos <= SAL_MAX_UINT16 )
+                        pULSpaceItem->SetUpper( sal_uInt16(nPos) );
                 }
             }
         }
commit bed818c5d5e92a0b189f25e18495fc205d949128
Author: Justin Luth <justin_luth at sil.org>
Date:   Mon Jan 2 17:50:26 2017 +0300

    tdf#104876 writerfilter: m_bTableSizeTypeInserted = false here
    
    fixes commit cbd0fbc287051f918e4adb32b3e9b58dfbf8059d
    which removed the insertion code with the explanation saying
      we should simply not do anything,
      and that'll lead to the right behavior,
      don't try to be smart and try to set TABLE_WIDTH here
    but still left the flag set, falsely indicating that the
    tableSizeType had been inserted.
    
    TODO: the table size still isn't correct.
    
    Reviewed-on: https://gerrit.libreoffice.org/32385
    Reviewed-by: Justin Luth <justin_luth at sil.org>
    Tested-by: Justin Luth <justin_luth at sil.org>
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    (cherry picked from commit e73c961a7fb23246dc4a9c27d7ed0808b9ba74b5)
    
    Change-Id: I0720083c992d1d03a5fe259d5b4b177a0c8108f8
    Reviewed-on: https://gerrit.libreoffice.org/32647
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Justin Luth <justin_luth at sil.org>

diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
index b558afd..39e8ffd 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
@@ -158,6 +158,7 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm)
                         {
                             pPropMap->setValue( TablePropertyMap::TABLE_WIDTH_TYPE, text::SizeType::FIX );
                             pPropMap->setValue( TablePropertyMap::TABLE_WIDTH, m_nTableWidth );
+                            m_bTableSizeTypeInserted = true;
                         }
                         else if( sal::static_int_cast<Id>(pMeasureHandler->getUnit()) == NS_ooxml::LN_Value_ST_TblWidth_pct )
                         {
@@ -166,6 +167,7 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm)
                                 nPercent = 100;
                             pPropMap->setValue( TablePropertyMap::TABLE_WIDTH_TYPE, text::SizeType::VARIABLE );
                             pPropMap->setValue( TablePropertyMap::TABLE_WIDTH, nPercent );
+                            m_bTableSizeTypeInserted = true;
                         }
                         else if( sal::static_int_cast<Id>(pMeasureHandler->getUnit()) == NS_ooxml::LN_Value_ST_TblWidth_auto )
                         {
@@ -193,9 +195,9 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm)
                                 // Set the width type of table with 'Auto' and set the width value to 0 (as per grid values)
                                 pPropMap->setValue( TablePropertyMap::TABLE_WIDTH_TYPE, text::SizeType::VARIABLE );
                                 pPropMap->setValue( TablePropertyMap::TABLE_WIDTH, 0 );
+                                m_bTableSizeTypeInserted = true;
                             }
                         }
-                        m_bTableSizeTypeInserted = true;
                     }
 #ifdef DEBUG_WRITERFILTER
                     pPropMap->dumpXml();
commit f420f4c2e84deb182e4f675c1a0d45bede110ff2
Author: Khaled Hosny <khaledhosny at eglug.org>
Date:   Sun Jan 1 19:44:25 2017 +0000

    Revert "tdf#103514: Always ignore bitmap fonts on Windows"
    
    This reverts commit e80621fb04093d5ab950485357f6058dcbaf8aaf.
    
    Lots of crashes related to this change, lets revert and see if we can fix it in 5.3:
    http://crashreport.libreoffice.org/stats/signature/ImplReleaseTempFonts(SalData%20&)
    
    Change-Id: I86b7d85fe1bfb7be28fbed7dc8957f71d1bedc55
    Reviewed-on: https://gerrit.libreoffice.org/32591
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 803817d..df406d4 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -69,6 +69,10 @@ inline int IntTimes256FromFixed(FIXED f)
     return nFixedTimes256;
 }
 
+// these variables can be static because they store system wide settings
+static bool bImplSalCourierScalable = false;
+static bool bImplSalCourierNew = false;
+
 // TODO: also support temporary TTC font files
 typedef std::map< OUString, FontAttributes > FontAttrMap;
 
@@ -419,13 +423,6 @@ LanguageType MapCharToLanguage( sal_UCS4 uChar )
     return LANGUAGE_DONTKNOW;
 }
 
-class WinPreMatchFontSubstititution
-:    public ImplPreMatchFontSubstitution
-{
-public:
-    bool FindFontSubstitute(FontSelectPattern&) const override;
-};
-
 class WinGlyphFallbackSubstititution
 :    public ImplGlyphFallbackFontSubstitution
 {
@@ -509,39 +506,6 @@ namespace
     }
 }
 
-// These are Win 3.1 bitmap fonts using "FON" font format
-// which is not supported with "Direct Write" so let's substitute them
-// with a font that is supported and always available.
-// Based on:
-// https://dxr.mozilla.org/mozilla-esr10/source/gfx/thebes/gfxDWriteFontList.cpp#1057
-static const std::map<OUString, OUString> aBitmapFontSubs =
-{
-    { "MS Sans Serif", "Microsoft Sans Serif" },
-    { "MS Serif",      "Times New Roman" },
-    { "Small Fonts",   "Arial" },
-    { "Courier",       "Courier New" },
-    { "Roman",         "Times New Roman" },
-    { "Script",        "Mistral" }
-};
-
-// TODO: See if Windows have API that we can use here to improve font fallback.
-bool WinPreMatchFontSubstititution::FindFontSubstitute(FontSelectPattern& rFontSelData) const
-{
-    if (rFontSelData.IsSymbolFont() || IsStarSymbol(rFontSelData.maSearchName))
-        return false;
-
-    for (const auto& aSub : aBitmapFontSubs)
-    {
-        if (rFontSelData.maSearchName == GetEnglishSearchFontName(aSub.first))
-        {
-            rFontSelData.maSearchName = aSub.second;
-            return true;
-        }
-    }
-
-    return false;
-}
-
 // find a fallback font for missing characters
 // TODO: should stylistic matches be searched and preferred?
 bool WinGlyphFallbackSubstititution::FindFontSubstitute( FontSelectPattern& rFontSelData, OUString& rMissingChars ) const
@@ -628,6 +592,9 @@ struct ImplEnumInfo
     LOGFONTA*           mpLogFontA;
     LOGFONTW*           mpLogFontW;
     UINT                mnPreferredCharSet;
+    bool                mbCourier;
+    bool                mbImplSalCourierScalable;
+    bool                mbImplSalCourierNew;
     bool                mbPrinter;
     int                 mnFontCount;
 };
@@ -1394,6 +1361,26 @@ HFONT WinSalGraphics::ImplDoSetFont( FontSelectPattern* i_pFont, float& o_rFontS
     LOGFONTW aLogFont;
     ImplGetLogFontFromFontSelect( getHDC(), i_pFont, aLogFont, true );
 
+    // on the display we prefer Courier New when Courier is a
+    // bitmap only font and we need to stretch or rotate it
+    if( mbScreen
+    &&  (i_pFont->mnWidth != 0
+      || i_pFont->mnOrientation != 0
+      || i_pFont->mpFontData == NULL
+      || (i_pFont->mpFontData->GetHeight() != i_pFont->mnHeight))
+    && !bImplSalCourierScalable
+    && bImplSalCourierNew
+    && (ImplSalWICompareAscii( aLogFont.lfFaceName, "Courier" ) == 0) )
+        lstrcpynW( aLogFont.lfFaceName, L"Courier New", 12 );
+
+    // Script and Roman are Win 3.1 bitmap fonts using "FON" font format
+    // which is not supported with "Direct Write" so let's substitute them
+    // with a font that is supported and always available.
+    if (ImplSalWICompareAscii(aLogFont.lfFaceName, "Script") == 0)
+        wcscpy(aLogFont.lfFaceName, L"Times New Roman");
+    if (ImplSalWICompareAscii(aLogFont.lfFaceName, "Roman") == 0)
+        wcscpy(aLogFont.lfFaceName, L"Times New Roman");
+
     // #i47675# limit font requests to MAXFONTHEIGHT
     // TODO: share MAXFONTHEIGHT font instance
     if( (-aLogFont.lfHeight <= MAXFONTHEIGHT)
@@ -1657,6 +1644,12 @@ int CALLBACK SalEnumFontsProcExW( const ENUMLOGFONTEXW* pLogFont,
         // Ignore vertical fonts
         if ( pLogFont->elfLogFont.lfFaceName[0] != '@' )
         {
+            if ( !pInfo->mbImplSalCourierNew )
+                pInfo->mbImplSalCourierNew = ImplSalWICompareAscii( pLogFont->elfLogFont.lfFaceName, "Courier New" ) == 0;
+            if ( !pInfo->mbImplSalCourierScalable )
+                pInfo->mbCourier = ImplSalWICompareAscii( pLogFont->elfLogFont.lfFaceName, "Courier" ) == 0;
+            else
+                pInfo->mbCourier = FALSE;
             OUString aName = OUString(reinterpret_cast<const sal_Unicode*>(pLogFont->elfLogFont.lfFaceName));
             pInfo->mpName = &aName;
             memcpy( pInfo->mpLogFontW->lfFaceName, pLogFont->elfLogFont.lfFaceName, (aName.getLength()+1)*sizeof( wchar_t ) );
@@ -1666,21 +1659,23 @@ int CALLBACK SalEnumFontsProcExW( const ENUMLOGFONTEXW* pLogFont,
             pInfo->mpLogFontW->lfFaceName[0] = '\0';
             pInfo->mpLogFontW->lfCharSet = DEFAULT_CHARSET;
             pInfo->mpName = NULL;
+            pInfo->mbCourier = FALSE;
         }
     }
     else
     {
-        // Ignore non-device font on printer.
-        if (pInfo->mbPrinter && !(nFontType & DEVICE_FONTTYPE))
-            return 1;
-
-        // Ignore non-scalable fonts.
-        if (nFontType & RASTER_FONTTYPE)
-            return 1;
+        // ignore non-scalable non-device font on printer
+        if( pInfo->mbPrinter )
+            if( (nFontType & RASTER_FONTTYPE) && !(nFontType & DEVICE_FONTTYPE) )
+                return 1;
 
         WinFontFace* pData = ImplLogMetricToDevFontDataW( pLogFont, &(pMetric->ntmTm), nFontType );
         pData->SetFontId( sal_IntPtr( pInfo->mnFontCount++ ) );
 
+        // knowing Courier to be scalable is nice
+        if( pInfo->mbCourier )
+            pInfo->mbImplSalCourierScalable |= pData->IsScalable();
+
         pInfo->mpList->Add( pData );
     }
 
@@ -1962,8 +1957,19 @@ void WinSalGraphics::GetDevFontList( PhysicalFontCollection* pFontCollection )
     aInfo.mpName        = NULL;
     aInfo.mpLogFontA    = NULL;
     aInfo.mpLogFontW    = NULL;
+    aInfo.mbCourier     = false;
     aInfo.mbPrinter     = mbPrinter;
     aInfo.mnFontCount   = 0;
+    if ( !mbPrinter )
+    {
+        aInfo.mbImplSalCourierScalable  = false;
+        aInfo.mbImplSalCourierNew       = false;
+    }
+    else
+    {
+        aInfo.mbImplSalCourierScalable  = true;
+        aInfo.mbImplSalCourierNew       = true;
+    }
 
     aInfo.mnPreferredCharSet = DEFAULT_CHARSET;
     DWORD nCP = GetACP();
@@ -1978,11 +1984,17 @@ void WinSalGraphics::GetDevFontList( PhysicalFontCollection* pFontCollection )
     EnumFontFamiliesExW( getHDC(), &aLogFont,
         (FONTENUMPROCW)SalEnumFontsProcExW, (LPARAM)(void*)&aInfo, 0 );
 
+    // check what Courier fonts are used on the screen, so to perhaps
+    // map Courier to CourierNew in SetFont()
+    if ( !mbPrinter )
+    {
+        bImplSalCourierScalable = aInfo.mbImplSalCourierScalable;
+        bImplSalCourierNew      = aInfo.mbImplSalCourierNew;
+    }
+
     // set glyph fallback hook
     static WinGlyphFallbackSubstititution aSubstFallback( getHDC() );
-    static WinPreMatchFontSubstititution aPreMatchFont;
     pFontCollection->SetFallbackHook( &aSubstFallback );
-    pFontCollection->SetPreMatchHook(&aPreMatchFont);
 }
 
 void WinSalGraphics::ClearDevFontCache()
commit fa2d2973ed860b682aa4a42e1c04b16215813fac
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Jan 1 17:26:44 2017 +0000

    ofz#358 SJIS_84 table mnLeadEnd is out by one
    
    sjis 82 and 83 correctly denote the last index available
    while 84 reports one past the last available index
    
    0x84BE is the last value to map, not 0x84BF
    
    Change-Id: Idcadc2d554ee59586f6e2f2775301fe69c94d55a

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list