Issue 18134

Summary: Implementing A Binary, hex, oct, etc. cell number format
Product: Calc Reporter: smerkley <srmerkley>
Component: formattingAssignee: AOO issues mailing list <issues>
Status: ACCEPTED --- QA Contact:
Severity: Trivial    
Priority: P5 (lowest) CC: issues
Version: OOo 3.3Keywords: rfe_eval_ok
Target Milestone: ---   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Latest Confirmation in: ---
Developer Difficulty: ---

Description smerkley 2003-08-11 15:20:33 UTC
I propose adding number format for cells that would allow the user to select
(for instance) a hex format for a cell and then be able to enter in a hex number
i.e. "FACE" and then be able to do calculations, lists, etc.  on it just as you
would a decimal number.
Comment 1 frank 2003-08-12 14:55:17 UTC
Hi Bettina,

1 4 u.

As we have functions to change e.g. a decimal to a hex number and vice
versa I think this is not of a high priority.

Frank
Comment 2 frank 2003-08-12 14:55:46 UTC
set the target
Comment 3 bettina.haberer 2003-12-04 17:25:14 UTC
Summary:Proposed is adding number format for cells that would allow
the user to select(for instance) a hex format for a cell and then be
able to enter in a hex numberi.e. "FACE" and then be able to do
calculations, lists, etc.  on it just as you would a decimal number.
Considered for Office later, changed priority.

Comment 4 orsonj 2005-04-30 18:48:33 UTC
I would like an 'IP Address' number format.  This can be stored internally as a
regular number (as I believe dates are) but displayed and entered as an ip
address (10.1.1.45)

Here is some sample C++ that does the conversions

#include <iostream>
#include <string>
using namespace std;

int main()
{

   unsigned long number = 0;
   int tmp = 0, dots = 0;
   string ip;

/*  Parse IP Address
 *  Algorithm summary:
 *  
 *  Browse over each character in the input.
 *  Build a number until a dot is encountered or the number goes out of range.
 *  Repeat until end of string
 *  If an invalid character is found, bail out.
 */
   cin >> ip;
   for (int i = 0, j = ip.length(); i < j; i++)
   {
//      cout << i << ": " << ip[i] << endl;
      if (ip[i] >= '0' && ip[i] <= '9')
      {
         tmp = tmp * 10 + (ip[i] - '0');
         if (tmp > 255)
         {
            cout << "parse error: value out of range\n";
            return 3;
         }
//         cout << "tmp: " << tmp << endl;
         continue;
      }
      if (ip[i] == '.')
      {
         number *= 256;
         number += tmp;
         tmp = 0;
         dots++;
//         cout << "number; " << number << endl;
         continue;
      }
      cout << "parse error on character " << i << "\n";
      return 1;
   }
   if (dots != 3)
   {
      cout << "parse error: incorrect format\n";
      return 2;
   }
   number *= 256;
   number += tmp;
   tmp = 0;
   cout << number << endl;

/*  Format IP Address
 *  Algorithm summary:
 *  
 *  Extract each portion of the number and display.
 *  
 *  I think there may be a better way to do this by shifting bits then mod 256
 */
//   cin >> number;
   tmp = (number - (number % 16777216)) / 16777216;
   cout << tmp << ".";
   number %= 16777216;
   tmp = (number - (number % 65536)) / 65536;
   cout << tmp << ".";
   number %= 65536;
   tmp = (number - (number % 256)) / 256;
   cout << tmp << ".";
   number %= 256;
   cout << number << endl;

   return 0;
}


I'm not sure if this is closely related enough to this issue or not.  Should I
file a new issue specific to ip addresses?
Comment 5 frank 2007-08-24 10:15:56 UTC
*** Issue 80985 has been marked as a duplicate of this issue. ***
Comment 6 smerkley 2008-03-18 22:35:35 UTC
 Is anything being done on this?  Someone set the status to "Started" but then
the milestone is simply "OOo Later".  I realize that it's not high priority, but
for those of us that use other numbering systems than decimal it would be very
nice.  Even if it was a case of having to hard set each cell to the numbering
system desired it would still be very beneficial.

  Thanks.
Comment 7 smerkley 2008-03-18 23:02:52 UTC
Sorry, I didn't mean to raise the priority level. (Not that I don't want it to
be, but I know it's low priority for most people)
Comment 8 smerkley 2008-10-30 20:17:35 UTC
Just checked this in OOo 3.0 (OOO300m9) Still would be nice to have.
Comment 9 bettina.haberer 2010-05-21 14:46:37 UTC
To grep the issues easier via "requirements" I put the issues currently lying on
my owner to the owner "requirements". 
Comment 10 smerkley 2011-02-28 16:24:33 UTC
  Just noting that it still isn't implemented in version 3.3.  It seems to me this could be a cool feature that shouldn't be so hard to implement.  I mean aren't these formats more like what computers use anyway?