Subversion Repositories eFlore/Applications.cel

Rev

Rev 1604 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1604 Rev 1605
Line 1332... Line 1332...
1332
    * temporary file, the default.
1332
    * temporary file, the default.
1333
    *
1333
    *
1334
    * @access private
1334
    * @access private
1335
    * @param string $data The binary data to append
1335
    * @param string $data The binary data to append
1336
    */
1336
    */
1337
    function _append($data)
1337
    function _append(&$data)
1338
    {
1338
    {
1339
        if ($this->_using_tmpfile) {
1339
        if ($this->_using_tmpfile) {
1340
            // Add CONTINUE records if necessary
1340
            // Add CONTINUE records if necessary
1341
            if (strlen($data) > $this->_limit) {
1341
            if (strlen($data) > $this->_limit) {
1342
                $data = $this->_addContinue($data);
1342
                $data = $this->_addContinue($data);
Line 1532... Line 1532...
1532
        $xl_double = pack("d",   $num);
1532
        $xl_double = pack("d",   $num);
1533
        if ($this->_byte_order) { // if it's Big Endian
1533
        if ($this->_byte_order) { // if it's Big Endian
1534
            $xl_double = strrev($xl_double);
1534
            $xl_double = strrev($xl_double);
1535
        }
1535
        }
Line -... Line 1536...
-
 
1536
 
1536
 
1537
		$data = $header . $data . $xl_double;
1537
        $this->_append($header.$data.$xl_double);
1538
        $this->_append($data);
1538
        return(0);
1539
        return(0);
Line 1539... Line 1540...
1539
    }
1540
    }
1540
 
1541
 
Line 1592... Line 1593...
1592
            $str_error = -3;
1593
            $str_error = -3;
1593
        }
1594
        }
Line 1594... Line 1595...
1594
 
1595
 
1595
        $header    = pack("vv",   $record, $length);
1596
        $header    = pack("vv",   $record, $length);
-
 
1597
        $data      = pack("vvvv", $row, $col, $xf, $strlen);
-
 
1598
 
1596
        $data      = pack("vvvv", $row, $col, $xf, $strlen);
1599
		$data = $header . $data . $str;
1597
        $this->_append($header . $data . $str);
1600
        $this->_append($data);
1598
        return($str_error);
1601
        return($str_error);
Line 1599... Line 1602...
1599
    }
1602
    }
1600
 
1603
 
Line 1664... Line 1667...
1664
        }
1667
        }
1665
        $this->_str_total++;
1668
        $this->_str_total++;
Line 1666... Line 1669...
1666
 
1669
 
1667
        $header    = pack('vv',   $record, $length);
1670
        $header    = pack('vv',   $record, $length);
-
 
1671
        $data      = pack('vvvV', $row, $col, $xf, $this->_str_table[$str]);
-
 
1672
		$data = $header . $data;
1668
        $data      = pack('vvvV', $row, $col, $xf, $this->_str_table[$str]);
1673
 
1669
        $this->_append($header.$data);
1674
		$this->_append($data);
1670
        return $str_error;
1675
        return $str_error;
Line 1671... Line 1676...
1671
    }
1676
    }
1672
 
1677
 
Line 1740... Line 1745...
1740
        }
1745
        }
Line 1741... Line 1746...
1741
 
1746
 
1742
        // Length for this record is no more than 2048 + 6
1747
        // Length for this record is no more than 2048 + 6
1743
        $length    = 0x0006 + min($note_length, 2048);
1748
        $length    = 0x0006 + min($note_length, 2048);
1744
        $header    = pack("vv",   $record, $length);
1749
        $header    = pack("vv",   $record, $length);
-
 
1750
        $data      = pack("vvv", $row, $col, $note_length) . substr($note, 0, 2048);
-
 
1751
		$data = $header . $data;
1745
        $data      = pack("vvv", $row, $col, $note_length);
1752
 
Line 1746... Line 1753...
1746
        $this->_append($header . $data . substr($note, 0, 2048));
1753
        $this->_append($data);
1747
 
1754
 
1748
        for ($i = $max_length; $i < $note_length; $i += $max_length) {
1755
        for ($i = $max_length; $i < $note_length; $i += $max_length) {
1749
            $chunk  = substr($note, $i, $max_length);
1756
            $chunk  = substr($note, $i, $max_length);
1750
            $length = 0x0006 + strlen($chunk);
1757
            $length = 0x0006 + strlen($chunk);
-
 
1758
            $header = pack("vv",   $record, $length);
-
 
1759
            $data   = pack("vvv", -1, 0, strlen($chunk)) . $chunk;
1751
            $header = pack("vv",   $record, $length);
1760
			$data = $header . $data;
1752
            $data   = pack("vvv", -1, 0, strlen($chunk));
1761
 
1753
            $this->_append($header.$data.$chunk);
1762
            $this->_append($data);
1754
        }
1763
        }
Line 1755... Line 1764...
1755
        return(0);
1764
        return(0);
Line 1803... Line 1812...
1803
            $this->_dim_colmax = $col;
1812
            $this->_dim_colmax = $col;
1804
        }
1813
        }
Line 1805... Line 1814...
1805
 
1814
 
1806
        $header    = pack("vv",  $record, $length);
1815
        $header    = pack("vv",  $record, $length);
-
 
1816
        $data      = pack("vvv", $row, $col, $xf);
-
 
1817
		$data = $header . $data;
1807
        $data      = pack("vvv", $row, $col, $xf);
1818
 
1808
        $this->_append($header . $data);
1819
        $this->_append($data);
1809
        return 0;
1820
        return 0;
Line 1810... Line 1821...
1810
    }
1821
    }
1811
 
1822
 
Line 1873... Line 1884...
1873
        $length     = 0x16 + $formlen;     // Length of the record data
1884
        $length     = 0x16 + $formlen;     // Length of the record data
Line 1874... Line 1885...
1874
 
1885
 
1875
        $header    = pack("vv",      $record, $length);
1886
        $header    = pack("vv",      $record, $length);
1876
        $data      = pack("vvvdvVv", $row, $col, $xf, $num,
1887
        $data      = pack("vvvdvVv", $row, $col, $xf, $num,
-
 
1888
                                     $grbit, $unknown, $formlen);
Line 1877... Line 1889...
1877
                                     $grbit, $unknown, $formlen);
1889
		$data = $header . $data . $formula;
1878
 
1890
 
1879
        $this->_append($header . $data . $formula);
1891
        $this->_append($data);
Line 1880... Line 1892...
1880
        return 0;
1892
        return 0;
1881
    }
1893
    }
Line 1994... Line 2006...
1994
 
2006
 
1995
        // Pack the header data
2007
        // Pack the header data
1996
        $header      = pack("vv",   $record, $length);
2008
        $header      = pack("vv",   $record, $length);
Line -... Line 2009...
-
 
2009
        $data        = pack("vvvv", $row1, $row2, $col1, $col2);
-
 
2010
 
1997
        $data        = pack("vvvv", $row1, $row2, $col1, $col2);
2011
		$data = $header . $data . $unknown1 . $options . $unknown2 . $url_len . $url;
1998
 
2012
 
1999
        // Write the packed data
-
 
2000
        $this->_append($header . $data .
-
 
2001
                       $unknown1 . $options .
2013
        // Write the packed data
2002
                       $unknown2 . $url_len . $url);
2014
        $this->_append($data);
Line 2003... Line 2015...
2003
        return($str_error);
2015
        return($str_error);
2004
    }
2016
    }
Line 2056... Line 2068...
2056
 
2068
 
2057
        // Pack the header data
2069
        // Pack the header data
2058
        $header      = pack("vv",   $record, $length);
2070
        $header      = pack("vv",   $record, $length);
Line -... Line 2071...
-
 
2071
        $data        = pack("vvvv", $row1, $row2, $col1, $col2);
-
 
2072
 
2059
        $data        = pack("vvvv", $row1, $row2, $col1, $col2);
2073
		$data = $header . $data . $unknown1 . $options . $url_len . $url;
2060
 
2074
 
2061
        // Write the packed data
-
 
2062
        $this->_append($header . $data .
-
 
2063
                       $unknown1 . $options .
2075
        // Write the packed data
2064
                       $url_len . $url);
2076
        $this->_append($data);
Line 2065... Line 2077...
2065
        return($str_error);
2077
        return($str_error);
2066
    }
2078
    }
Line 2193... Line 2205...
2193
                          $sheet        ;*/
2205
                          $sheet        ;*/
Line 2194... Line 2206...
2194
    
2206
    
2195
        // Pack the header data
2207
        // Pack the header data
2196
        $length   = strlen($data);
2208
        $length   = strlen($data);
-
 
2209
        $header   = pack("vv", $record, $length);
2197
        $header   = pack("vv", $record, $length);
2210
		$data = $header. $data;
2198
    
2211
 
2199
        // Write the packed data
2212
        // Write the packed data
2200
        $this->_append($header. $data);
2213
        $this->_append($data);
2201
        return($str_error);
2214
        return($str_error);
Line 2202... Line 2215...
2202
    }
2215
    }
Line 2256... Line 2269...
2256
        $grbit |= 0x0100;
2269
        $grbit |= 0x0100;
Line 2257... Line 2270...
2257
 
2270
 
2258
        $header   = pack("vv",       $record, $length);
2271
        $header   = pack("vv",       $record, $length);
2259
        $data     = pack("vvvvvvvv", $row, $colMic, $colMac, $miyRw,
2272
        $data     = pack("vvvvvvvv", $row, $colMic, $colMac, $miyRw,
-
 
2273
                                     $irwMac,$reserved, $grbit, $ixfe);
2260
                                     $irwMac,$reserved, $grbit, $ixfe);
2274
		$data = $header . $data;
2261
        $this->_append($header.$data);
2275
        $this->_append($data);
Line 2262... Line 2276...
2262
    }
2276
    }
2263
 
2277
 
2264
    /**
2278
    /**
Line 2342... Line 2356...
2342
            $rgbHdr       = 0x0040; // Row/column heading and gridline color index
2356
            $rgbHdr       = 0x0040; // Row/column heading and gridline color index
2343
            $zoom_factor_page_break = 0x0000;
2357
            $zoom_factor_page_break = 0x0000;
2344
            $zoom_factor_normal     = 0x0000;
2358
            $zoom_factor_normal     = 0x0000;
2345
            $data .= pack("vvvvV", $rgbHdr, 0x0000, $zoom_factor_page_break, $zoom_factor_normal, 0x00000000);
2359
            $data .= pack("vvvvV", $rgbHdr, 0x0000, $zoom_factor_page_break, $zoom_factor_normal, 0x00000000);
2346
        }
2360
        }
-
 
2361
		$data = $header.$data;
-
 
2362
 
2347
        $this->_append($header.$data);
2363
        $this->_append($data);
2348
    }
2364
    }
Line 2349... Line 2365...
2349
 
2365
 
2350
    /**
2366
    /**
2351
    * Write BIFF record DEFCOLWIDTH if COLINFO records are in use.
2367
    * Write BIFF record DEFCOLWIDTH if COLINFO records are in use.
Line 2462... Line 2478...
2462
        $header   = pack("vv",         $record, $length);
2478
        $header   = pack("vv",         $record, $length);
2463
        $data     = pack("CvvvvvvCC",  $pnn, $rwAct, $colAct,
2479
        $data     = pack("CvvvvvvCC",  $pnn, $rwAct, $colAct,
2464
                                       $irefAct, $cref,
2480
                                       $irefAct, $cref,
2465
                                       $rwFirst, $rwLast,
2481
                                       $rwFirst, $rwLast,
2466
                                       $colFirst, $colLast);
2482
                                       $colFirst, $colLast);
-
 
2483
		$data = $header . $data;
-
 
2484
 
2467
        $this->_append($header . $data);
2485
        $this->_append($data);
2468
    }
2486
    }
Line 2469... Line 2487...
2469
 
2487
 
2470
    /**
2488
    /**
2471
    * Store the MERGEDCELLS record for all ranges of merged cells
2489
    * Store the MERGEDCELLS record for all ranges of merged cells
Line 2484... Line 2502...
2484
            $length   = 2 + count($ranges) * 8; 
2502
            $length   = 2 + count($ranges) * 8; 
2485
            $header   = pack('vv', $record, $length);
2503
            $header   = pack('vv', $record, $length);
2486
            $data     = pack('v',  count($ranges));
2504
            $data     = pack('v',  count($ranges));
2487
            foreach($ranges as $range) 
2505
            foreach($ranges as $range) 
2488
              $data .= pack('vvvv', $range[0], $range[2], $range[1], $range[3]);
2506
              $data .= pack('vvvv', $range[0], $range[2], $range[1], $range[3]);
2489
            $string=$header.$data;
2507
            $string = $header . $data;
-
 
2508
 
2490
            $this->_append(&$string, true);
2509
            $this->_append($string);
2491
          }
2510
          }
2492
    }
2511
    }
Line 2493... Line 2512...
2493
 
2512
 
2494
    /**
2513
    /**
Line 2622... Line 2641...
2622
 
2641
 
Line 2623... Line 2642...
2623
        $this->_active_pane = $pnnAct; // Used in _storeSelection
2642
        $this->_active_pane = $pnnAct; // Used in _storeSelection
2624
 
2643
 
-
 
2644
        $header     = pack("vv",    $record, $length);
2625
        $header     = pack("vv",    $record, $length);
2645
        $data       = pack("vvvvv", $x, $y, $rwTop, $colLeft, $pnnAct);
2626
        $data       = pack("vvvvv", $x, $y, $rwTop, $colLeft, $pnnAct);
2646
		$data = $header . $data;
Line 2627... Line 2647...
2627
        $this->_append($header . $data);
2647
        $this->_append($data);
2628
    }
2648
    }
2629
 
2649
 
Line 2890... Line 2910...
2890
        }
2910
        }
Line 2891... Line 2911...
2891
 
2911
 
2892
        $header   = pack("vv",    $record, $length);
2912
        $header   = pack("vv",    $record, $length);
2893
        $data     = pack("vvvvv", $cref, $first_row, $last_row,
2913
        $data     = pack("vvvvv", $cref, $first_row, $last_row,
2894
                                  $first_col, $last_col);
-
 
-
 
2914
                                  $first_col, $last_col);
2895
 
2915
		$data = $header . $data;
2896
        $this->_append($header.$data);
2916
		$this->_append($data);
Line 2897... Line 2917...
2897
    }
2917
    }
2898
 
2918
 
2899
    /**
2919
    /**
Line 3208... Line 3228...
3208
        $cf          = 0x09;
3228
        $cf          = 0x09;
3209
        $env         = 0x01;
3229
        $env         = 0x01;
3210
        $lcb         = $size;
3230
        $lcb         = $size;
Line 3211... Line 3231...
3211
 
3231
 
-
 
3232
        $header      = pack("vvvvV", $record, $length, $cf, $env, $lcb);
3212
        $header      = pack("vvvvV", $record, $length, $cf, $env, $lcb);
3233
		$data = $header . $data;
3213
        $this->_append($header.$data);
3234
		$this->_append($data);
Line 3214... Line 3235...
3214
    }
3235
    }
3215
 
3236
 
3216
    /**
3237
    /**
Line 3443... Line 3464...
3443
        $data       .= pack("v", $cbPictFmla);
3464
        $data       .= pack("v", $cbPictFmla);
3444
        $data       .= pack("v", $Reserved4);
3465
        $data       .= pack("v", $Reserved4);
3445
        $data       .= pack("v", $grbit2);
3466
        $data       .= pack("v", $grbit2);
3446
        $data       .= pack("V", $Reserved5);
3467
        $data       .= pack("V", $Reserved5);
Line -... Line 3468...
-
 
3468
 
3447
 
3469
		$data = $header . $data;
3448
        $this->_append($header . $data);
3470
		$this->_append($data);
Line 3449... Line 3471...
3449
    }
3471
    }
3450
 
3472
 
3451
    /**
3473
    /**
Line 3551... Line 3573...
3551
        $record      = 0x00A0;               // Record identifier
3573
        $record      = 0x00A0;               // Record identifier
3552
        $length      = 0x0004;               // Bytes to follow
3574
        $length      = 0x0004;               // Bytes to follow
Line 3553... Line 3575...
3553
 
3575
 
3554
        $header      = pack("vv", $record, $length);
3576
        $header      = pack("vv", $record, $length);
-
 
3577
        $data        = pack("vv", $this->_zoom, 100);
3555
        $data        = pack("vv", $this->_zoom, 100);
3578
		$data = $header . $data;
3556
        $this->_append($header . $data);
3579
		$this->_append($data);
Line 3557... Line 3580...
3557
    }
3580
    }
3558
 
3581
 
3559
    /**
3582
    /**
Line 3581... Line 3604...
3581
        $objId       = 0xffffffff;  // Object identifier of drop down arrow object, or -1 if not visible
3604
        $objId       = 0xffffffff;  // Object identifier of drop down arrow object, or -1 if not visible
Line 3582... Line 3605...
3582
 
3605
 
3583
        $header      = pack('vv', $record, $length);
3606
        $header      = pack('vv', $record, $length);
3584
        $data        = pack('vVVVV', $grbit, $horPos, $verPos, $objId,
3607
        $data        = pack('vVVVV', $grbit, $horPos, $verPos, $objId,
-
 
3608
                                     count($this->_dv));
3585
                                     count($this->_dv));
3609
		$data = $header . $data;
Line 3586... Line 3610...
3586
        $this->_append($header.$data);
3610
		$this->_append($data);
3587
 
3611
 
3588
        $record = 0x01be;              // Record identifier
3612
        $record = 0x01be;              // Record identifier
3589
        foreach ($this->_dv as $dv) {
3613
        foreach ($this->_dv as $dv) {
-
 
3614
            $length = strlen($dv);      // Bytes to follow
3590
            $length = strlen($dv);      // Bytes to follow
3615
            $header = pack("vv", $record, $length);
3591
            $header = pack("vv", $record, $length);
3616
			$header .= $dv;
3592
            $this->_append($header . $dv);
3617
            $this->_append($header);
3593
        }
3618
        }
3594
    }
3619
    }