[Libreoffice-commits] core.git: Branch 'distro/cib/libreoffice-5-2' - 5 commits - filter/Library_pdffilter.mk filter/source filter/uiconfig icon-themes/galaxy include/vcl instsetoo_native/inc_common officecfg/registry sc/source vcl/source

Katarina Behrens Katarina.Behrens at cib.de
Fri Dec 9 01:00:34 UTC 2016


Rebased ref, commits from common ancestor:
commit 0fd4317b94c9f89460c0a6420ae32157f26a5eca
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..0f22432 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;
@@ -244,6 +254,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 0eb27ae4ae018d21fe712d95fa6cad7e6a461bf2
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 2bec9d28f15a944eb2fa4afb03165433f6532f99
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 319d9a928e37dc56ec8feb5d4744aabef9bb4eaf
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 cb3ad88d4640cec96849c7309e22e0ec0a601ba6
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


More information about the Libreoffice-commits mailing list