[Libreoffice-commits] core.git: Branch 'distro/cib/libreoffice-5-2' - filter/Library_pdffilter.mk filter/source filter/uiconfig

Katarina Behrens Katarina.Behrens at cib.de
Wed Dec 14 09:39:51 UTC 2016


Rebased ref, commits from common ancestor:
commit b435da72c6f1d950f2c1ddac8f6ba9073d186b54
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>


More information about the Libreoffice-commits mailing list