<html>
    <head>
      <base href="https://bugs.documentfoundation.org/">
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - FILEOPEN: User defined number format not applied to fields inside header or footer"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=133459#c10">Comment # 10</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - FILEOPEN: User defined number format not applied to fields inside header or footer"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=133459">bug 133459</a>
              from <span class="vcard"><a class="email" href="mailto:momonasmon@gmail.com" title="Maxim Monastirsky <momonasmon@gmail.com>"> <span class="fn">Maxim Monastirsky</span></a>
</span></b>
        <pre>What I found so far: The field code indeed seems to use automatic styles, with
one exception: During the import of <office:automatic-styles>, there is a
special code in the SvXMLImport::SetAutoStyles method that inserts already
existing number styles into automatic styles as well. But for this to happen,
the mnImportFlags member must include the SvXMLImportFlags::CONTENT flag.

For the fodt import, this method is called just once with mnImportFlags ==
SvXMLImportFlags::ALL. That's when the number style from <office:styles> is
inserted into automatic styles, and later consumed from there by the header
field.

But for odt, this method is called twice, because there is
<office:automatic-styles> in both styles.xml and content.xml:

- For styles.xml, it's called with mnImportFlags == (SvXMLImportFlags::STYLES |
SvXMLImportFlags::MASTERSTYLES | SvXMLImportFlags::AUTOSTYLES |
SvXMLImportFlags::FONTDECLS), so the number style isn't inserted into automatic
styles, and later can't be found by the header.

- For content.xml, it's finally called with mnImportFlags ==
(SvXMLImportFlags::AUTOSTYLES | SvXMLImportFlags::CONTENT |
SvXMLImportFlags::SCRIPTS | SvXMLImportFlags::FONTDECLS). But while the number
style is inserted, it has no use here, as the header is defined in styles.xml,
and was processed already.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>