From 0d9917127f3cd164c74a5ba8ba0015d1f66bbb4f Mon Sep 17 00:00:00 2001 From: Christian Stimming Date: Sat, 14 Aug 2010 20:14:37 +0000 Subject: [PATCH] Bug #626403: Fix inconsistent formatting between stylesheets (Webkit vs. gtkhtml) Patch by Alex Aycinena: The 'default' stylesheet formats the balance sheet, cash flow, income statement and transaction reports properly under webkit but not under gtkhtml. The 'easy', 'footer', and 'technicolor' stylesheets are the reverse; that is, they format the balance sheet, cash flow, income statement and transaction reports properly under gtkhtml but not under webkit, except that the 'footer' stylesheet also has some formatting problems with gtkhtml as well. The attached patch file corrects these problems. Specifically: - styles that are missing in the 'footer' stylesheet (compared to 'easy') are added - the function 'gnc-html-engine-supports-css' is used in the 'default', 'easy', 'footer' and 'technicolor' stylesheets to provide styles for either webkit or gtkhtml - the taxtxf.scm report file is simplified to take advantage of these changes git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@19428 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/report/locale-specific/us/taxtxf.scm | 203 ++++++------------- src/report/stylesheets/stylesheet-easy.scm | 186 ++++++++++++----- src/report/stylesheets/stylesheet-fancy.scm | 187 ++++++++++++----- src/report/stylesheets/stylesheet-footer.scm | 179 ++++++++++++---- src/report/stylesheets/stylesheet-plain.scm | 180 +++++++++++----- 5 files changed, 607 insertions(+), 328 deletions(-) diff --git a/src/report/locale-specific/us/taxtxf.scm b/src/report/locale-specific/us/taxtxf.scm index 4a5cb46b08..d17ef0b8a1 100644 --- a/src/report/locale-specific/us/taxtxf.scm +++ b/src/report/locale-specific/us/taxtxf.scm @@ -434,14 +434,11 @@ 'attribute (list "cellspacing" "0") 'attribute (list "cellpadding" "0") 'attribute (list "width" "100%")) - (let ((total-amnt (if (gnc-html-engine-supports-css) - (if total-amount-neg? - (gnc:make-html-table-cell/markup - "number-cell-bot-neg" total) - (gnc:make-html-table-cell/markup - "number-cell-bot" total)) + (let ((total-amnt (if total-amount-neg? (gnc:make-html-table-cell/markup - "number-cell-bot" total))) + "number-cell-bot-neg" total) + (gnc:make-html-table-cell/markup + "number-cell-bot" total))) ) (gnc:html-table-append-row! amount-table total-amnt) ) @@ -808,13 +805,10 @@ tran-split splt-print-amnt)) (splt-amnt-anchor - (if (gnc-html-engine-supports-css) - (if (gnc-numeric-negative-p splt-print-amnt) - (gnc:make-html-table-cell/markup - "number-cell-bot-neg" splt-amnt-anchor) - (gnc:make-html-table-cell/markup - "number-cell-bot" splt-amnt-anchor)) - (gnc:make-html-table-cell/markup + (if (gnc-numeric-negative-p splt-print-amnt) + (gnc:make-html-table-cell/markup + "number-cell-bot-neg" splt-amnt-anchor) + (gnc:make-html-table-cell/markup "number-cell-bot" splt-amnt-anchor))) ) (gnc:html-table-append-row! @@ -842,17 +836,11 @@ (let* ((plug-amnt (gnc-numeric-add-fixed print-amnt (gnc-numeric-neg trans-rpt-currency-total))) - (plug-amnt (if (gnc-html-engine-supports-css) - (if (gnc-numeric-negative-p plug-amnt) - (gnc:make-html-table-cell/markup - "number-cell-bot-neg" - plug-amnt) - (gnc:make-html-table-cell/markup - "number-cell-bot" - plug-amnt)) + (plug-amnt (if (gnc-numeric-negative-p plug-amnt) (gnc:make-html-table-cell/markup - "number-cell-bot" - plug-amnt))) + "number-cell-bot-neg" plug-amnt) + (gnc:make-html-table-cell/markup + "number-cell-bot" plug-amnt))) ) (gnc:html-table-append-row! transfer-table (append @@ -1036,17 +1024,13 @@ 'attribute (list "cellpadding" "0") 'attribute (list "width" "100%")) (let ((beg-bal-amnt - (if (gnc-html-engine-supports-css) - (if beg-bal-neg? - (gnc:make-html-table-cell/markup + (if beg-bal-neg? + (gnc:make-html-table-cell/markup "number-cell-bot-neg" account-beg-amnt) - (gnc:make-html-table-cell/markup - "number-cell-bot" - account-beg-amnt)) (gnc:make-html-table-cell/markup - "number-cell-bot" - account-beg-amnt))) + "number-cell-bot" + account-beg-amnt))) ) (gnc:html-table-append-row! amount-table beg-bal-amnt) @@ -1283,14 +1267,11 @@ (let* ((splt-amnt-anchor (gnc:html-split-anchor split print-amnt)) (splt-amnt-anchor - (if (gnc-html-engine-supports-css) - (if (gnc-numeric-negative-p print-amnt) - (gnc:make-html-table-cell/markup - "number-cell-bot-neg" splt-amnt-anchor) - (gnc:make-html-table-cell/markup - "number-cell-bot" splt-amnt-anchor)) + (if (gnc-numeric-negative-p print-amnt) (gnc:make-html-table-cell/markup - "number-cell-bot" splt-amnt-anchor))) + "number-cell-bot-neg" splt-amnt-anchor) + (gnc:make-html-table-cell/markup + "number-cell-bot" splt-amnt-anchor))) ) (gnc:html-table-append-row! amount-table splt-amnt-anchor) @@ -2632,107 +2613,42 @@ #f) ;;end of if (begin ; else do tax report (if (gnc-html-engine-supports-css) - (if (eq? selected-style-sheet 'Default) - (begin ;; this is for webkit: default - (gnc:html-document-set-style! - doc "header-just-top" - 'tag "th" - 'attribute (list "class" "column-heading-left") - 'attribute (list "valign" "top")) + (begin ;; this is for webkit + (gnc:html-document-set-style! + doc "header-just-top" + 'tag "th" + 'attribute (list "class" "column-heading-left") + 'attribute (list "valign" "top")) - (gnc:html-document-set-style! - doc "header-just-bot" - 'tag "th" - 'attribute (list "class" "column-heading-left") - 'attribute (list "valign" "bottom")) + (gnc:html-document-set-style! + doc "header-just-bot" + 'tag "th" + 'attribute (list "class" "column-heading-left") + 'attribute (list "valign" "bottom")) - (gnc:html-document-set-style! - doc "tran-detail" - 'tag "tr" - 'attribute (list "class" "normal-row") - 'attribute (list "valign" "top")) + (gnc:html-document-set-style! + doc "tran-detail" + 'tag "tr" + 'attribute (list "class" "normal-row") + 'attribute (list "valign" "top")) - (gnc:html-document-set-style! - doc "tran-detail-shade" - 'tag "tr" - 'attribute (list "class" "alternate-row") - 'attribute (list "valign" "top")) + (gnc:html-document-set-style! + doc "tran-detail-shade" + 'tag "tr" + 'attribute (list "class" "alternate-row") + 'attribute (list "valign" "top")) - (gnc:html-document-set-style! - doc "number-cell-bot" - 'tag "td" - 'attribute (list "class" "number-cell") - 'attribute (list "valign" "bottom")) + (gnc:html-document-set-style! + doc "number-cell-bot" + 'tag "td" + 'attribute (list "class" "number-cell") + 'attribute (list "valign" "bottom")) - (gnc:html-document-set-style! - doc "number-cell-bot-neg" - 'tag "td" - 'attribute (list "class" "number-cell neg") - 'attribute (list "valign" "bottom")) - - (gnc:html-document-set-style! - doc "just-bot" - 'tag "td" - 'attribute (list "valign" "bottom")) - ) - (begin ;; this is for webkit: easy, footer, technicolor - (gnc:html-document-set-style! - doc "header-just-top" - 'tag "th" - 'attribute (list "class" "column-heading-left") - 'attribute (list "valign" "top")) - - (gnc:html-document-set-style! - doc "header-just-bot" - 'tag "th" - 'attribute (list "class" "column-heading-left") - 'attribute (list "valign" "bottom")) - - (gnc:html-document-set-style! - doc "column-heading-center" - 'tag "th" - 'attribute (list "class" "column-heading-center") - 'attribute (list "valign" "bottom")) - - (gnc:html-document-set-style! - doc "column-heading-right" - 'tag "th" - 'attribute (list "class" "column-heading-right") - 'attribute (list "valign" "bottom")) - - (gnc:html-document-set-style! - doc "tran-detail" - 'tag "tr" - 'attribute (list "valign" "top")) - - (gnc:html-document-set-style! - doc "tran-detail-shade" - 'tag "tr" - 'attribute (list "class" "alternate-row") - 'attribute (list "valign" "top")) - - (gnc:html-document-set-style! - doc "date-cell" - 'tag "td" - 'attribute (list "class" "date-cell")) - - (gnc:html-document-set-style! - doc "number-cell-bot" - 'tag "td" - 'attribute (list "class" "number-cell") - 'attribute (list "valign" "bottom")) - - (gnc:html-document-set-style! - doc "number-cell-bot-neg" - 'tag "td" - 'attribute (list "class" "number-cell neg") - 'attribute (list "valign" "bottom")) - - (gnc:html-document-set-style! - doc "just-bot" - 'tag "td" - 'attribute (list "valign" "bottom")) - ) + (gnc:html-document-set-style! + doc "number-cell-bot-neg" + 'tag "td" + 'attribute (list "class" "number-cell neg") + 'attribute (list "valign" "bottom")) ) (begin ;; this is for gtkhtml (gnc:html-document-set-style! @@ -2776,17 +2692,24 @@ 'attribute (list "nowrap" "nowrap") 'attribute (list "valign" "bottom")) + (gnc:html-document-set-style! + doc "number-cell-bot-neg" + 'tag "td" + 'attribute (list "align" "right") + 'attribute (list "nowrap" "nowrap") + 'attribute (list "valign" "bottom")) + (gnc:html-document-set-style! doc "date-cell" 'tag "td" 'attribute (list "nowrap" "nowrap")) - - (gnc:html-document-set-style! - doc "just-bot" - 'tag "td" - 'attribute (list "valign" "bottom")) )) + (gnc:html-document-set-style! + doc "just-bot" + 'tag "td" + 'attribute (list "valign" "bottom")) + (gnc:html-document-set-title! doc report-name) (gnc:html-document-add-object! diff --git a/src/report/stylesheets/stylesheet-easy.scm b/src/report/stylesheets/stylesheet-easy.scm index a8f3f9f0d0..ad3bd82d19 100644 --- a/src/report/stylesheets/stylesheet-easy.scm +++ b/src/report/stylesheets/stylesheet-easy.scm @@ -32,6 +32,7 @@ (use-modules (gnucash main)) ;; FIXME: delete after we finish modularizing. (use-modules (gnucash gnc-module)) +(gnc:module-load "gnucash/html" 0) ; added for 'gnc-html-engine-supports-css' (gnc:module-load "gnucash/report/report-system" 0) (define (easy-options) @@ -60,7 +61,7 @@ (opt-register (gnc:make-simple-boolean-option (N_ "General") - (N_ "Enable Links") "c" + (N_ "Enable Links") "d" (N_ "Enable hyperlinks in reports") #t)) @@ -164,7 +165,7 @@ (opt-register (gnc:make-number-range-option (N_ "Tables") - (N_ "Table cell padding") "b" (N_ "Space between table cells") + (N_ "Table cell padding") "b" (N_ "Space between table cell edge and content") 1 0 20 0 1)) (opt-register @@ -225,31 +226,143 @@ ;;;; ;;;; ;;;; - (gnc:html-document-set-style! - ssdoc "number-header" - 'tag "th" - 'attribute (list "align" "right")) -;;;; -;;;; -;;;; + (if (gnc-html-engine-supports-css) + (begin ;; this is for webkit + (gnc:html-document-set-style! + ssdoc "column-heading-left" + 'tag "th" + 'attribute (list "class" "column-heading-left")) - (gnc:html-document-set-style! - ssdoc "anchor-cell" - 'tag "td" - 'attribute (list "align" "left") - 'attribute (list "nowrap")) + (gnc:html-document-set-style! + ssdoc "column-heading-center" + 'tag "th" + 'attribute (list "class" "column-heading-center")) - (gnc:html-document-set-style! - ssdoc "number-cell" - 'tag "td" - 'attribute (list "align" "right") - 'attribute (list "nowrap")) + (gnc:html-document-set-style! + ssdoc "column-heading-right" + 'tag "th" + 'attribute (list "class" "column-heading-right")) - (gnc:html-document-set-style! - ssdoc "number-cell-neg" - 'tag "td" - 'attribute (list "align" "right") - 'attribute (list "nowrap")) + (gnc:html-document-set-style! + ssdoc "date-cell" + 'tag "td" + 'attribute (list "class" "date-cell")) + + (gnc:html-document-set-style! + ssdoc "anchor-cell" + 'tag "td" + 'attribute (list "class" "anchor-cell")) + + (gnc:html-document-set-style! + ssdoc "number-cell" + 'tag "td" + 'attribute (list "class" "number-cell")) + + (gnc:html-document-set-style! + ssdoc "number-cell-neg" + 'tag "td" + 'attribute (list "class" "number-cell neg")) + + (gnc:html-document-set-style! + ssdoc "number-header" + 'tag "th" + 'attribute (list "class" "number-header")) + + (gnc:html-document-set-style! + ssdoc "text-cell" + 'tag "td" + 'attribute (list "class" "text-cell")) + + (gnc:html-document-set-style! + ssdoc "total-number-cell" + 'tag '("td" "b") + 'attribute (list "class" "total-number-cell")) + + (gnc:html-document-set-style! + ssdoc "total-number-cell-neg" + 'tag '("td" "b") + 'attribute (list "class" "total-number-cell neg")) + + (gnc:html-document-set-style! + ssdoc "total-label-cell" + 'tag '("td" "b") + 'attribute (list "class" "total-label-cell")) + + (gnc:html-document-set-style! + ssdoc "centered-label-cell" + 'tag '("td" "b") + 'attribute (list "class" "centered-label-cell")) + ) + (begin ;; this is for gtkhtml + (gnc:html-document-set-style! + ssdoc "column-heading-left" + 'tag "th" + 'attribute (list "align" "left")) + + (gnc:html-document-set-style! + ssdoc "column-heading-center" + 'tag "th" + 'attribute (list "align" "center")) + + (gnc:html-document-set-style! + ssdoc "column-heading-right" + 'tag "th" + 'attribute (list "align" "right")) + + (gnc:html-document-set-style! + ssdoc "date-cell" + 'tag "td" + 'attribute (list "nowrap" "nowrap")) + + (gnc:html-document-set-style! + ssdoc "anchor-cell" + 'tag "td" + 'attribute (list "align" "left") + 'attribute (list "nowrap")) + + (gnc:html-document-set-style! + ssdoc "number-cell" + 'tag "td" + 'attribute (list "align" "right") + 'attribute (list "nowrap")) + + (gnc:html-document-set-style! + ssdoc "number-cell-neg" + 'tag "td" + 'attribute (list "align" "right") + 'attribute (list "nowrap")) + + (gnc:html-document-set-style! + ssdoc "number-header" + 'tag "th" + 'attribute (list "align" "right")) + + (gnc:html-document-set-style! + ssdoc "text-cell" + 'tag "td" + 'attribute (list "align" "left")) + + (gnc:html-document-set-style! + ssdoc "total-number-cell" + 'tag '("td" "b") + 'attribute (list "align" "right")) + + (gnc:html-document-set-style! + ssdoc "total-number-cell-neg" + 'tag '("td" "b") + 'attribute (list "align" "right")) + + (gnc:html-document-set-style! + ssdoc "total-label-cell" + 'tag '("td" "b") + 'attribute (list "align" "left")) + + (gnc:html-document-set-style! + ssdoc "centered-label-cell" + 'tag '("td" "b") + 'attribute (list "align" "center")) + ) + ) (if (and bgpixmap (not (string=? bgpixmap ""))) @@ -284,31 +397,6 @@ 'attribute (list "bgcolor" grand-total-color) 'tag "tr") - (gnc:html-document-set-style! - ssdoc "text-cell" - 'tag "td" - 'attribute (list "align" "left")) - - (gnc:html-document-set-style! - ssdoc "total-number-cell" - 'tag '("td" "b") - 'attribute (list "align" "right")) - - (gnc:html-document-set-style! - ssdoc "total-number-cell-neg" - 'tag '("td" "b") - 'attribute (list "align" "right")) - - (gnc:html-document-set-style! - ssdoc "total-label-cell" - 'tag '("td" "b") - 'attribute (list "align" "left")) - - (gnc:html-document-set-style! - ssdoc "centered-label-cell" - 'tag '("td" "b") - 'attribute (list "align" "center")) - ;; don't surround marked-up links with (if (not links?) (gnc:html-document-set-style! diff --git a/src/report/stylesheets/stylesheet-fancy.scm b/src/report/stylesheets/stylesheet-fancy.scm index f3a19bfc16..7079d10ef1 100644 --- a/src/report/stylesheets/stylesheet-fancy.scm +++ b/src/report/stylesheets/stylesheet-fancy.scm @@ -26,6 +26,7 @@ (use-modules (gnucash main)) ;; FIXME: delete after we finish modularizing. (use-modules (gnucash gnc-module)) +(gnc:module-load "gnucash/html" 0) ; added for 'gnc-html-engine-supports-css' (gnc:module-load "gnucash/report/report-system" 0) (define (fancy-options) @@ -54,7 +55,7 @@ (opt-register (gnc:make-simple-boolean-option (N_ "General") - (N_ "Enable Links") "c" + (N_ "Enable Links") "d" (N_ "Enable hyperlinks in reports") #t)) @@ -158,7 +159,7 @@ (opt-register (gnc:make-number-range-option (N_ "Tables") - (N_ "Table cell padding") "b" (N_ "Space between table cells") + (N_ "Table cell padding") "b" (N_ "Space between table cell edge and content") 1 0 20 0 1)) (opt-register @@ -220,30 +221,143 @@ ;;;; ;;;; ;;;; - (gnc:html-document-set-style! - ssdoc "number-header" - 'tag "th" - 'attribute (list "align" "right")) -;;;; -;;;; -;;;; - (gnc:html-document-set-style! - ssdoc "anchor-cell" - 'tag "td" - 'attribute (list "align" "left") - 'attribute (list "nowrap")) + (if (gnc-html-engine-supports-css) + (begin ;; this is for webkit + (gnc:html-document-set-style! + ssdoc "column-heading-left" + 'tag "th" + 'attribute (list "class" "column-heading-left")) - (gnc:html-document-set-style! - ssdoc "number-cell" - 'tag "td" - 'attribute (list "align" "right") - 'attribute (list "nowrap")) + (gnc:html-document-set-style! + ssdoc "column-heading-center" + 'tag "th" + 'attribute (list "class" "column-heading-center")) - (gnc:html-document-set-style! - ssdoc "number-cell-neg" - 'tag "td" - 'attribute (list "align" "right") - 'attribute (list "nowrap")) + (gnc:html-document-set-style! + ssdoc "column-heading-right" + 'tag "th" + 'attribute (list "class" "column-heading-right")) + + (gnc:html-document-set-style! + ssdoc "date-cell" + 'tag "td" + 'attribute (list "class" "date-cell")) + + (gnc:html-document-set-style! + ssdoc "anchor-cell" + 'tag "td" + 'attribute (list "class" "anchor-cell")) + + (gnc:html-document-set-style! + ssdoc "number-cell" + 'tag "td" + 'attribute (list "class" "number-cell")) + + (gnc:html-document-set-style! + ssdoc "number-cell-neg" + 'tag "td" + 'attribute (list "class" "number-cell neg")) + + (gnc:html-document-set-style! + ssdoc "number-header" + 'tag "th" + 'attribute (list "class" "number-header")) + + (gnc:html-document-set-style! + ssdoc "text-cell" + 'tag "td" + 'attribute (list "class" "text-cell")) + + (gnc:html-document-set-style! + ssdoc "total-number-cell" + 'tag '("td" "b") + 'attribute (list "class" "total-number-cell")) + + (gnc:html-document-set-style! + ssdoc "total-number-cell-neg" + 'tag '("td" "b") + 'attribute (list "class" "total-number-cell neg")) + + (gnc:html-document-set-style! + ssdoc "total-label-cell" + 'tag '("td" "b") + 'attribute (list "class" "total-label-cell")) + + (gnc:html-document-set-style! + ssdoc "centered-label-cell" + 'tag '("td" "b") + 'attribute (list "class" "centered-label-cell")) + ) + (begin ;; this is for gtkhtml + (gnc:html-document-set-style! + ssdoc "column-heading-left" + 'tag "th" + 'attribute (list "align" "left")) + + (gnc:html-document-set-style! + ssdoc "column-heading-center" + 'tag "th" + 'attribute (list "align" "center")) + + (gnc:html-document-set-style! + ssdoc "column-heading-right" + 'tag "th" + 'attribute (list "align" "right")) + + (gnc:html-document-set-style! + ssdoc "date-cell" + 'tag "td" + 'attribute (list "nowrap" "nowrap")) + + (gnc:html-document-set-style! + ssdoc "anchor-cell" + 'tag "td" + 'attribute (list "align" "left") + 'attribute (list "nowrap")) + + (gnc:html-document-set-style! + ssdoc "number-cell" + 'tag "td" + 'attribute (list "align" "right") + 'attribute (list "nowrap")) + + (gnc:html-document-set-style! + ssdoc "number-cell-neg" + 'tag "td" + 'attribute (list "align" "right") + 'attribute (list "nowrap")) + + (gnc:html-document-set-style! + ssdoc "number-header" + 'tag "th" + 'attribute (list "align" "right")) + + (gnc:html-document-set-style! + ssdoc "text-cell" + 'tag "td" + 'attribute (list "align" "left")) + + (gnc:html-document-set-style! + ssdoc "total-number-cell" + 'tag '("td" "b") + 'attribute (list "align" "right")) + + (gnc:html-document-set-style! + ssdoc "total-number-cell-neg" + 'tag '("td" "b") + 'attribute (list "align" "right")) + + (gnc:html-document-set-style! + ssdoc "total-label-cell" + 'tag '("td" "b") + 'attribute (list "align" "left")) + + (gnc:html-document-set-style! + ssdoc "centered-label-cell" + 'tag '("td" "b") + 'attribute (list "align" "center")) + ) + ) (if (and bgpixmap (not (string=? bgpixmap ""))) @@ -278,31 +392,6 @@ 'attribute (list "bgcolor" grand-total-color) 'tag "tr") - (gnc:html-document-set-style! - ssdoc "text-cell" - 'tag "td" - 'attribute (list "align" "left")) - - (gnc:html-document-set-style! - ssdoc "total-number-cell" - 'tag '("td" "b") - 'attribute (list "align" "right")) - - (gnc:html-document-set-style! - ssdoc "total-number-cell-neg" - 'tag '("td" "b") - 'attribute (list "align" "right")) - - (gnc:html-document-set-style! - ssdoc "total-label-cell" - 'tag '("td" "b") - 'attribute (list "align" "left")) - - (gnc:html-document-set-style! - ssdoc "centered-label-cell" - 'tag '("td" "b") - 'attribute (list "align" "center")) - ;; don't surround marked-up links with (if (not links?) (gnc:html-document-set-style! diff --git a/src/report/stylesheets/stylesheet-footer.scm b/src/report/stylesheets/stylesheet-footer.scm index 1ca60a31af..173bd2c0a5 100644 --- a/src/report/stylesheets/stylesheet-footer.scm +++ b/src/report/stylesheets/stylesheet-footer.scm @@ -37,6 +37,7 @@ (use-modules (gnucash main)) ;; FIXME: delete after we finish modularizing. (use-modules (gnucash gnc-module)) +(gnc:module-load "gnucash/html" 0) ; added for 'gnc-html-engine-supports-css' (gnc:module-load "gnucash/report/report-system" 0) (define (footer-options) @@ -177,7 +178,7 @@ (opt-register (gnc:make-number-range-option (N_ "Tables") - (N_ "Table cell padding") "b" (N_ "Space between table cells") + (N_ "Table cell padding") "b" (N_ "Space between table cell edge and content") 1 0 20 0 1)) (opt-register @@ -239,19 +240,143 @@ ;;;; ;;;; ;;;; - (gnc:html-document-set-style! - ssdoc "number-header" - 'tag "th" - 'attribute (list "align" "right")) -;;;; -;;;; -;;;; + (if (gnc-html-engine-supports-css) + (begin ;; this is for webkit + (gnc:html-document-set-style! + ssdoc "column-heading-left" + 'tag "th" + 'attribute (list "class" "column-heading-left")) - (gnc:html-document-set-style! - ssdoc "number-cell" - 'tag "td" - 'attribute (list "align" "right") - 'attribute (list "nowrap")) + (gnc:html-document-set-style! + ssdoc "column-heading-center" + 'tag "th" + 'attribute (list "class" "column-heading-center")) + + (gnc:html-document-set-style! + ssdoc "column-heading-right" + 'tag "th" + 'attribute (list "class" "column-heading-right")) + + (gnc:html-document-set-style! + ssdoc "date-cell" + 'tag "td" + 'attribute (list "class" "date-cell")) + + (gnc:html-document-set-style! + ssdoc "anchor-cell" + 'tag "td" + 'attribute (list "class" "anchor-cell")) + + (gnc:html-document-set-style! + ssdoc "number-cell" + 'tag "td" + 'attribute (list "class" "number-cell")) + + (gnc:html-document-set-style! + ssdoc "number-cell-neg" + 'tag "td" + 'attribute (list "class" "number-cell neg")) + + (gnc:html-document-set-style! + ssdoc "number-header" + 'tag "th" + 'attribute (list "class" "number-header")) + + (gnc:html-document-set-style! + ssdoc "text-cell" + 'tag "td" + 'attribute (list "class" "text-cell")) + + (gnc:html-document-set-style! + ssdoc "total-number-cell" + 'tag '("td" "b") + 'attribute (list "class" "total-number-cell")) + + (gnc:html-document-set-style! + ssdoc "total-number-cell-neg" + 'tag '("td" "b") + 'attribute (list "class" "total-number-cell neg")) + + (gnc:html-document-set-style! + ssdoc "total-label-cell" + 'tag '("td" "b") + 'attribute (list "class" "total-label-cell")) + + (gnc:html-document-set-style! + ssdoc "centered-label-cell" + 'tag '("td" "b") + 'attribute (list "class" "centered-label-cell")) + ) + (begin ;; this is for gtkhtml + (gnc:html-document-set-style! + ssdoc "column-heading-left" + 'tag "th" + 'attribute (list "align" "left")) + + (gnc:html-document-set-style! + ssdoc "column-heading-center" + 'tag "th" + 'attribute (list "align" "center")) + + (gnc:html-document-set-style! + ssdoc "column-heading-right" + 'tag "th" + 'attribute (list "align" "right")) + + (gnc:html-document-set-style! + ssdoc "date-cell" + 'tag "td" + 'attribute (list "nowrap" "nowrap")) + + (gnc:html-document-set-style! + ssdoc "anchor-cell" + 'tag "td" + 'attribute (list "align" "left") + 'attribute (list "nowrap")) + + (gnc:html-document-set-style! + ssdoc "number-cell" + 'tag "td" + 'attribute (list "align" "right") + 'attribute (list "nowrap")) + + (gnc:html-document-set-style! + ssdoc "number-cell-neg" + 'tag "td" + 'attribute (list "align" "right") + 'attribute (list "nowrap")) + + (gnc:html-document-set-style! + ssdoc "number-header" + 'tag "th" + 'attribute (list "align" "right")) + + (gnc:html-document-set-style! + ssdoc "text-cell" + 'tag "td" + 'attribute (list "align" "left")) + + (gnc:html-document-set-style! + ssdoc "total-number-cell" + 'tag '("td" "b") + 'attribute (list "align" "right")) + + (gnc:html-document-set-style! + ssdoc "total-number-cell-neg" + 'tag '("td" "b") + 'attribute (list "align" "right")) + + (gnc:html-document-set-style! + ssdoc "total-label-cell" + 'tag '("td" "b") + 'attribute (list "align" "left")) + + (gnc:html-document-set-style! + ssdoc "centered-label-cell" + 'tag '("td" "b") + 'attribute (list "align" "center")) + ) + ) (if (and bgpixmap (not (string=? bgpixmap ""))) @@ -286,26 +411,6 @@ 'attribute (list "bgcolor" grand-total-color) 'tag "tr") - (gnc:html-document-set-style! - ssdoc "text-cell" - 'tag "td" - 'attribute (list "align" "left")) - - (gnc:html-document-set-style! - ssdoc "total-number-cell" - 'tag '("td" "b") - 'attribute (list "align" "right")) - - (gnc:html-document-set-style! - ssdoc "total-label-cell" - 'tag '("td" "b") - 'attribute (list "align" "left")) - - (gnc:html-document-set-style! - ssdoc "centered-label-cell" - 'tag '("td" "b") - 'attribute (list "align" "center")) - ;; don't surround marked-up links with (if (not links?) (gnc:html-document-set-style! ssdoc "a" 'tag "")) @@ -358,7 +463,7 @@ (gnc:html-table-set-cell! t 0 0 (gnc:make-html-text - (gnc:html-markup-img logopixmap))))) + (gnc:html-markup-img (make-file-url logopixmap)))))) (if (and headpixmap (> (string-length headpixmap) 0)) (begin @@ -367,7 +472,7 @@ (gnc:make-html-text (string-append "
" - "" + "" "
"))) ) (gnc:html-table-set-cell! @@ -383,8 +488,8 @@ ; I think this is the correct place to put the footer (gnc:html-table-set-cell! t 3 headcolumn - (gnc:make-html-text footer-text)) - ssdoc))) + (gnc:make-html-text footer-text))) + ssdoc)) (gnc:define-html-style-sheet 'version 1 diff --git a/src/report/stylesheets/stylesheet-plain.scm b/src/report/stylesheets/stylesheet-plain.scm index 6ebc443801..037b45cbaa 100644 --- a/src/report/stylesheets/stylesheet-plain.scm +++ b/src/report/stylesheets/stylesheet-plain.scm @@ -31,6 +31,7 @@ (use-modules (srfi srfi-13)) (use-modules (srfi srfi-14)) +(gnc:module-load "gnucash/html" 0) ; added for 'gnc-html-engine-supports-css' (gnc:module-load "gnucash/report/report-system" 0) ;; plain style sheet @@ -71,7 +72,7 @@ (opt-register (gnc:make-number-range-option (N_ "Tables") - (N_ "Table cell padding") "b" (N_ "Space between table cell edge and cell content") + (N_ "Table cell padding") "b" (N_ "Space between table cell edge and content") 4 0 20 0 1)) (opt-register (gnc:make-number-range-option @@ -122,70 +123,143 @@ 'attribute (list "cellspacing" spacing) 'attribute (list "cellpadding" padding)) - (gnc:html-document-set-style! - ssdoc "date-cell" - 'tag "td" - 'attribute (list "class" "date-cell")) + (if (gnc-html-engine-supports-css) + (begin ;; this is for webkit + (gnc:html-document-set-style! + ssdoc "column-heading-left" + 'tag "th" + 'attribute (list "class" "column-heading-left")) - (gnc:html-document-set-style! - ssdoc "column-heading-left" - 'tag "th" - 'attribute (list "class" "column-heading-left")) + (gnc:html-document-set-style! + ssdoc "column-heading-center" + 'tag "th" + 'attribute (list "class" "column-heading-center")) - (gnc:html-document-set-style! - ssdoc "column-heading-center" - 'tag "th" - 'attribute (list "class" "column-heading-center")) + (gnc:html-document-set-style! + ssdoc "column-heading-right" + 'tag "th" + 'attribute (list "class" "column-heading-right")) - (gnc:html-document-set-style! - ssdoc "column-heading-right" - 'tag "th" - 'attribute (list "class" "column-heading-right")) + (gnc:html-document-set-style! + ssdoc "date-cell" + 'tag "td" + 'attribute (list "class" "date-cell")) - (gnc:html-document-set-style! - ssdoc "anchor-cell" - 'tag "td" - 'attribute (list "class" "anchor-cell")) + (gnc:html-document-set-style! + ssdoc "anchor-cell" + 'tag "td" + 'attribute (list "class" "anchor-cell")) - (gnc:html-document-set-style! - ssdoc "number-cell" - 'tag "td" - 'attribute (list "class" "number-cell")) + (gnc:html-document-set-style! + ssdoc "number-cell" + 'tag "td" + 'attribute (list "class" "number-cell")) - (gnc:html-document-set-style! - ssdoc "number-cell-neg" - 'tag "td" - 'attribute (list "class" "number-cell neg")) + (gnc:html-document-set-style! + ssdoc "number-cell-neg" + 'tag "td" + 'attribute (list "class" "number-cell neg")) - (gnc:html-document-set-style! - ssdoc "number-header" - 'tag "th" - 'attribute (list "class" "number-header")) + (gnc:html-document-set-style! + ssdoc "number-header" + 'tag "th" + 'attribute (list "class" "number-header")) - (gnc:html-document-set-style! - ssdoc "text-cell" - 'tag "td" - 'attribute (list "class" "text-cell")) + (gnc:html-document-set-style! + ssdoc "text-cell" + 'tag "td" + 'attribute (list "class" "text-cell")) - (gnc:html-document-set-style! - ssdoc "total-number-cell" - 'tag "td" - 'attribute (list "class" "total-number-cell")) + (gnc:html-document-set-style! + ssdoc "total-number-cell" + 'tag "td" + 'attribute (list "class" "total-number-cell")) - (gnc:html-document-set-style! - ssdoc "total-number-cell-neg" - 'tag "td" - 'attribute (list "class" "total-number-cell neg")) + (gnc:html-document-set-style! + ssdoc "total-number-cell-neg" + 'tag "td" + 'attribute (list "class" "total-number-cell neg")) - (gnc:html-document-set-style! - ssdoc "total-label-cell" - 'tag "td" - 'attribute (list "class" "total-label-cell")) + (gnc:html-document-set-style! + ssdoc "total-label-cell" + 'tag "td" + 'attribute (list "class" "total-label-cell")) - (gnc:html-document-set-style! - ssdoc "centered-label-cell" - 'tag "td" - 'attribute (list "class" "centered-label-cell")) + (gnc:html-document-set-style! + ssdoc "centered-label-cell" + 'tag "td" + 'attribute (list "class" "centered-label-cell")) + ) + (begin ;; this is for gtkhtml + (gnc:html-document-set-style! + ssdoc "column-heading-left" + 'tag "th" + 'attribute (list "align" "left")) + + (gnc:html-document-set-style! + ssdoc "column-heading-center" + 'tag "th" + 'attribute (list "align" "center")) + + (gnc:html-document-set-style! + ssdoc "column-heading-right" + 'tag "th" + 'attribute (list "align" "right")) + + (gnc:html-document-set-style! + ssdoc "date-cell" + 'tag "td" + 'attribute (list "nowrap" "nowrap")) + + (gnc:html-document-set-style! + ssdoc "anchor-cell" + 'tag "td" + 'attribute (list "align" "left") + 'attribute (list "nowrap")) + + (gnc:html-document-set-style! + ssdoc "number-cell" + 'tag "td" + 'attribute (list "align" "right") + 'attribute (list "nowrap")) + + (gnc:html-document-set-style! + ssdoc "number-cell-neg" + 'tag "td" + 'attribute (list "align" "right") + 'attribute (list "nowrap")) + + (gnc:html-document-set-style! + ssdoc "number-header" + 'tag "th" + 'attribute (list "align" "right")) + + (gnc:html-document-set-style! + ssdoc "text-cell" + 'tag "td" + 'attribute (list "align" "left")) + + (gnc:html-document-set-style! + ssdoc "total-number-cell" + 'tag "td" + 'attribute (list "align" "right")) + + (gnc:html-document-set-style! + ssdoc "total-number-cell-neg" + 'tag "td" + 'attribute (list "align" "right")) + + (gnc:html-document-set-style! + ssdoc "total-label-cell" + 'tag "td" + 'attribute (list "align" "left")) + + (gnc:html-document-set-style! + ssdoc "centered-label-cell" + 'tag "td" + 'attribute (list "align" "center")) + ) + ) (gnc:html-document-set-style! ssdoc "normal-row"