LCOV - code coverage report
Current view: top level - sw/source/filter/ww1 - w1filter.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 1022 0.0 %
Date: 2012-08-25 Functions: 0 41 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 1945 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include <hintids.hxx>
      30                 :            : 
      31                 :            : #include <tools/solar.h>
      32                 :            : #include <comphelper/string.hxx>
      33                 :            : #include <editeng/paperinf.hxx>
      34                 :            : #include <svtools/filter.hxx>
      35                 :            : #include <vcl/graph.hxx>
      36                 :            : #include <editeng/fontitem.hxx>
      37                 :            : #include <editeng/lrspitem.hxx>
      38                 :            : #include <editeng/ulspitem.hxx>
      39                 :            : #include <editeng/wghtitem.hxx>
      40                 :            : #include <editeng/postitem.hxx>
      41                 :            : #include <editeng/crsditem.hxx>
      42                 :            : #include <editeng/cntritem.hxx>
      43                 :            : #include <editeng/cmapitem.hxx>
      44                 :            : #include <editeng/fhgtitem.hxx>
      45                 :            : #include <editeng/udlnitem.hxx>
      46                 :            : #include <editeng/wrlmitem.hxx>
      47                 :            : #include <editeng/colritem.hxx>
      48                 :            : #include <editeng/kernitem.hxx>
      49                 :            : #include <editeng/escpitem.hxx>
      50                 :            : #include <editeng/tstpitem.hxx>
      51                 :            : #include <svl/urihelper.hxx>
      52                 :            : #include <fmtfsize.hxx>
      53                 :            : #include <doc.hxx>
      54                 :            : #include <pam.hxx>
      55                 :            : #include <ndtxt.hxx>
      56                 :            : #include <pagedesc.hxx>
      57                 :            : #include <flddat.hxx>
      58                 :            : #include <reffld.hxx>
      59                 :            : #include <expfld.hxx>
      60                 :            : #include <docufld.hxx>
      61                 :            : #include <ftninfo.hxx>
      62                 :            : #include <section.hxx>          // class SwSection
      63                 :            : #include <fltini.hxx>
      64                 :            : #include <w1par.hxx>
      65                 :            : 
      66                 :            : #include <docsh.hxx>
      67                 :            : #include <swerror.h>
      68                 :            : #include <mdiexp.hxx>
      69                 :            : #include <statstr.hrc>
      70                 :            : #if OSL_DEBUG_LEVEL > 0
      71                 :            : #include <stdio.h>
      72                 :            : #endif
      73                 :            : 
      74                 :            : #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
      75                 :            : #include <com/sun/star/document/XDocumentProperties.hpp>
      76                 :            : 
      77                 :            : #define MAX_FIELDLEN 64000
      78                 :            : 
      79                 :            : using namespace nsSwDocInfoSubType;
      80                 :            : 
      81                 :            : 
      82                 :            : ///////////////////////////////////////////////////////////////////////
      83                 :            : //
      84                 :            : // hier stehen die methoden operator<<, Out, Start und Stop mit
      85                 :            : // folgender Bedeutung: wenn moeglich wird die information aus dem
      86                 :            : // dokument per
      87                 :            : //   operator<<()
      88                 :            : // in die shell uebertragen. sind jedoch weitere parameter noetig
      89                 :            : // wurde der name
      90                 :            : //   Out()
      91                 :            : // gewaehlt. ist ein bereich zu kennzeichnen (zB bei attributen
      92                 :            : // von/bis), heissen die methoden
      93                 :            : //   Start(), Stop()
      94                 :            : // alle diese methoden stehen in diesem modul, das fuer den filter,
      95                 :            : // jedoch nicht fuer den dumper noetig ist.  und da alle regeln ihre
      96                 :            : // ausnahme haben: hier stehen auch methoden, die aus anderen gruenden
      97                 :            : // fuer den dumper sinnlos sind, zB wenn sie auf sv-strukturen beruhen
      98                 :            : // wie zB GetFont() auf SvxFontItem.
      99                 :            : //
     100                 :            : 
     101                 :            : /////////////////////////////////////////////////////////////// Manager
     102                 :          0 : Ww1Shell& operator <<(Ww1Shell& rOut, Ww1Manager& This)
     103                 :            : {
     104                 :            :     // verhindern, das bei rekusivem aufruf dies mehrfach passiert:
     105         [ #  # ]:          0 :     if (!This.Pushed())
     106                 :            :     {
     107                 :            :         { // der wird nur temporaer gebraucht:
     108                 :          0 :             This.SetInStyle( sal_True );
     109         [ #  # ]:          0 :             Ww1StyleSheet(This.aFib).Out(rOut, This);
     110                 :          0 :             This.SetInStyle( sal_False );
     111                 :            :         }
     112                 :            :         { // dieser auch:
     113         [ #  # ]:          0 :             Ww1Assoc(This.aFib).Out(rOut);
     114                 :            :         }
     115                 :            :           // dieser nicht, der ist bereits member:
     116                 :          0 :         This.aDop.Out(rOut);
     117                 :            :           // Jetzt entscheiden, wie Seitenvorlagen erzeugt werden
     118         [ #  # ]:          0 :         if (This.GetSep().Count() <= 1)
     119                 :          0 :             rOut.SetUseStdPageDesc();
     120                 :            :     }
     121                 :            :     // und jetzt das eigentliche dok:
     122                 :          0 :     sal_Unicode cUnknown = ' ';
     123         [ #  # ]:          0 :     while (*This.pSeek < This.pDoc->Count())
     124                 :            :     {
     125                 :            :     // ausgabe des ProgressState nur, wenn im haupttext, da sonst
     126                 :            :     // nicht bestimmt werden kann, wie weit wir sind:
     127         [ #  # ]:          0 :         if (!This.Pushed())
     128                 :          0 :             ::SetProgressState(This.Where() * 100 / This.pDoc->Count(),
     129                 :          0 :              rOut.GetDoc().GetDocShell());
     130                 :            :     // hier werden abwechselnd die attribute und die zeichen in die
     131                 :            :     // shell gepumpt.  die positionen werden durch das lesen der
     132                 :            :     // zeichen aus dem manager hoch- gezaehlt.  erst alle attribute:
     133                 :          0 :         This.Out(rOut, cUnknown);
     134                 :            :     // das textdocument pDoc ist ein Ww1PlainText, dessen Out()
     135                 :            :     // methode solange ausgibt, bis entweder ein sonderzeichen
     136                 :            :     // auftaucht oder die anzahl der auszugebenden zeichen erreicht
     137                 :            :     // ist:
     138                 :          0 :         cUnknown = This.pDoc->Out(rOut, *This.pSeek);
     139                 :            :     }
     140                 :          0 :     This.SetStopAll(sal_True);
     141                 :          0 :     This.OutStop(rOut, cUnknown);   // Damit die Attribute am Ende geschlossen
     142                 :          0 :     This.SetStopAll(sal_False);         // werden
     143                 :          0 :     return rOut;
     144                 :            : }
     145                 :            : 
     146                 :          0 : void Ww1Manager::OutStop(Ww1Shell& rOut, sal_Unicode cUnknown)
     147                 :            : {
     148                 :            :                         // Bookmarks brauchen nicht beendet werden ???
     149         [ #  # ]:          0 :     if (pFld)
     150                 :          0 :         pFld->Stop(rOut, *this, cUnknown);
     151         [ #  # ]:          0 :     if (!Pushed())
     152                 :          0 :         aFtn.Stop(rOut, *this, cUnknown);
     153                 :            :     if (1)
     154                 :          0 :         aChp.Stop(rOut, *this, cUnknown);
     155                 :            :     if (1)
     156                 :          0 :         aPap.Stop(rOut, *this, cUnknown);
     157         [ #  # ]:          0 :     if (!Pushed())
     158                 :          0 :         aSep.Stop(rOut, *this, cUnknown);
     159                 :          0 : }
     160                 :            : 
     161                 :          0 : void Ww1Manager::OutStart( Ww1Shell& rOut )
     162                 :            : {
     163                 :            : // alle attribute, die's brauchen beginnen
     164         [ #  # ]:          0 :     if (!Pushed())
     165                 :          0 :         aSep.Start(rOut, *this);
     166                 :            :     if (1)
     167                 :          0 :         aPap.Start(rOut, *this);
     168                 :            :     if (1)
     169                 :          0 :         aChp.Start(rOut, *this);
     170         [ #  # ]:          0 :     if (!Pushed())
     171                 :          0 :         aFtn.Start(rOut, *this);
     172         [ #  # ]:          0 :     if (pFld)
     173                 :          0 :         pFld->Start(rOut, *this);
     174         [ #  # ]:          0 :     if (!Pushed())
     175                 :          0 :         aBooks.Start(rOut, *this);
     176                 :            : // bestimmen, wo das naechste Ereigniss ist:
     177                 :          0 :     sal_uLong ulEnd = pDoc->Count(); // spaetestens am textende
     178         [ #  # ]:          0 :     if (!Pushed())
     179         [ #  # ]:          0 :         if (ulEnd > aSep.Where()) // naechster Sep vorher?
     180                 :          0 :             ulEnd = aSep.Where();
     181                 :            :     if (1)
     182         [ #  # ]:          0 :         if (ulEnd > aPap.Where()) // naechster Pap vorher?
     183                 :          0 :             ulEnd = aPap.Where();
     184                 :            :     if (1)
     185         [ #  # ]:          0 :         if (ulEnd > aChp.Where()) // naechster Chp vorher?
     186                 :          0 :             ulEnd = aChp.Where();
     187         [ #  # ]:          0 :     if (!Pushed())
     188         [ #  # ]:          0 :         if (ulEnd > aFtn.Where()) // naechster Ftn vorher?
     189                 :          0 :             ulEnd = aFtn.Where();
     190         [ #  # ]:          0 :     if (pFld)
     191         [ #  # ]:          0 :         if (ulEnd > pFld->Where()) // naechster Fld vorher?
     192                 :          0 :             ulEnd = pFld->Where();
     193         [ #  # ]:          0 :     if (!Pushed())
     194         [ #  # ]:          0 :         if (ulEnd > aBooks.Where()) // naechster Bookmark vorher?
     195                 :          0 :             ulEnd = aBooks.Where();
     196                 :          0 :     *pSeek = Where(); // momentane position
     197         [ #  # ]:          0 :     if (*pSeek < ulEnd) // sind wir bereits weiter?
     198                 :          0 :         *pSeek = ulEnd;
     199                 :          0 : }
     200                 :            : 
     201                 :          0 : void Ww1Manager::Out(Ww1Shell& rOut, sal_Unicode cUnknown)
     202                 :            : {
     203                 :            : // Je nach modus wird hier mit feldern, fusznoten, zeichenattributen,
     204                 :            : // absatzatributen und sektionen wie folgt verfahren: von allen wird
     205                 :            : // zuallererst die stop-methoden gerufen. stellt das objekt fest, dasz
     206                 :            : // etwas zu beenden ist (natuerlich nicht im ersten durchgang) beendet
     207                 :            : // es dies, ansonsten ist der aufruf wirkungslos.  dann werden
     208                 :            : // unbehandelte sonderzeichen augegeben. das werden genauso alle
     209                 :            : // start-methoden gerufen und danach per where festgestellt, an
     210                 :            : // welcher stelle die naechste aktion zu erwarten ist.
     211                 :            : //
     212                 :            : // ist der manager in einem ge'push'ten mode, werden bestimmte
     213                 :            : // elemente ausgeklammert. felder werden wiederum nur in besonderen
     214                 :            : // faellen augeklammert, wenn naemlich bereiche ausgegeben werden, die
     215                 :            : // keine felder enthalten koennen. charakterattribute und
     216                 :            : // paragraphenattribute werden jedoch nie ausgeklammert. die if (1)
     217                 :            : // wurden zur verdeutlichung der einheitlichkeit eingefuegt.
     218                 :            : 
     219                 :            : // Erstmal eine Sonderbehandlung fuer Tabellen:
     220                 :            : // die wichtigen Attribute lassen sich am Besten vor Beendigung derselben
     221                 :            : // abfragen.
     222                 :            : // Optimierung: Sie werden nur auf sinnvolle Werte gesetzt, wenn
     223                 :            : // das 0x07-Zeiche ansteht.
     224                 :            : 
     225                 :          0 :     sal_Bool bLIsTtp = sal_False;
     226                 :          0 :     sal_Bool bLHasTtp = sal_False;
     227         [ #  # ]:          0 :     if( cUnknown == 0x07 )
     228                 :            :     {
     229                 :          0 :         bLIsTtp = IsInTtp();
     230                 :          0 :         bLHasTtp = HasTtp();
     231                 :            :     }
     232                 :            : 
     233                 :          0 :     OutStop( rOut, cUnknown );      // Attrs ggfs. beenden
     234                 :            : 
     235                 :            : // meta-zeichen interpretieren:
     236         [ #  # ]:          0 :     if (!Ww1PlainText::IsChar(cUnknown))
     237   [ #  #  #  #  :          0 :         switch (cUnknown)
             #  #  #  #  
                      # ]
     238                 :            :         {
     239                 :            :         case 0x02:
     240                 :            :             // dontknow
     241                 :          0 :         break;
     242                 :            :         case 0x07: // table
     243 [ #  # ][ #  # ]:          0 :             if (rOut.IsInTable() && HasInTable() && !bLIsTtp && !bLHasTtp)
         [ #  # ][ #  # ]
                 [ #  # ]
     244                 :          0 :                 rOut.NextTableCell();
     245                 :          0 :         break;
     246                 :            :         case 0x09: // tab
     247                 :          0 :             rOut.NextTab();
     248                 :          0 :         break;
     249                 :            :         case 0x0a: // linefeed
     250                 :          0 :             rOut.NextParagraph();
     251                 :          0 :         break;
     252                 :            :         case 0x0b: // linebreak
     253         [ #  # ]:          0 :             if (rOut.IsInTable())
     254                 :            :                 ;
     255                 :            :             else
     256                 :          0 :                 rOut.NextLine();
     257                 :          0 :         break;
     258                 :            :         case 0x0d: // carriage return
     259                 :            :             // ignore
     260                 :          0 :         break;
     261                 :            :         case 0x0c: // pagebreak
     262                 :          0 :             rOut.NextPage();
     263                 :          0 :         break;
     264                 :            :         case 0x14: // sectionendchar
     265                 :            :             // ignore here
     266                 :          0 :         break;
     267                 :            :         default:
     268                 :          0 :         break;
     269                 :            :         }
     270                 :            : 
     271                 :          0 :     OutStart( rOut );   // Attrs ggfs. starten und Naechste Pos berechnen
     272                 :          0 : }
     273                 :            : 
     274                 :          0 : SvxFontItem Ww1Manager::GetFont(sal_uInt16 nFCode)
     275                 :            : {
     276                 :          0 :     return aFonts.GetFont(nFCode);
     277                 :            : }
     278                 :            : 
     279                 :          0 : void Ww1Manager::Push0(Ww1PlainText* _pDoc, sal_uLong ulSeek, Ww1Fields* _pFld)
     280                 :            : {
     281                 :            :     OSL_ENSURE(!Pushed(), "Ww1Manager");
     282                 :          0 :     this->pDoc = _pDoc;
     283                 :          0 :     pSeek = new sal_uLong;
     284                 :          0 :     *pSeek = pDoc->Where();
     285                 :          0 :     aPap.Push(ulSeek);
     286                 :          0 :     aChp.Push(ulSeek);
     287                 :          0 :     this->pFld = _pFld;
     288                 :          0 : }
     289                 :            : 
     290                 :            : // ulSeek ist der FC-Abstand zwischen Hauptest-Start und Sondertext-Start
     291                 :            : // ulSeek2 ist der Offset dieses bestimmten Sondertextes im Sondertext-Bereich,
     292                 :            : // also z.B. der Offset des speziellen K/F-Textes
     293                 :          0 : void Ww1Manager::Push1(Ww1PlainText* _pDoc, sal_uLong ulSeek, sal_uLong ulSeek2,
     294                 :            :                        Ww1Fields* _pFld)
     295                 :            : {
     296                 :            :     OSL_ENSURE(!Pushed(), "Ww1Manager");
     297                 :          0 :     this->pDoc = _pDoc;
     298                 :          0 :     pSeek = new sal_uLong;
     299                 :          0 :     *pSeek = pDoc->Where();
     300                 :          0 :     aPap.Push(ulSeek + ulSeek2);
     301                 :          0 :     aChp.Push(ulSeek + ulSeek2);
     302         [ #  # ]:          0 :     if( _pFld )
     303                 :          0 :         _pFld->Seek( ulSeek2 );
     304                 :          0 :     this->pFld = _pFld;
     305                 :          0 : }
     306                 :            : 
     307                 :          0 : void Ww1Manager::Pop()
     308                 :            : {
     309                 :            :     OSL_ENSURE(Pushed(), "Ww1Manager");
     310                 :          0 :     delete pDoc;
     311                 :          0 :     pDoc = &aDoc;
     312                 :          0 :     delete pSeek;
     313                 :          0 :     pSeek = &ulDocSeek;
     314                 :          0 :     aChp.Pop();
     315                 :          0 :     aPap.Pop();
     316         [ #  # ]:          0 :     delete pFld;
     317                 :          0 :     pFld = &aFld;
     318                 :          0 : }
     319                 :            : 
     320                 :            : ///////////////////////////////////////////////////////////// Bookmarks
     321                 :            : 
     322                 :          0 : void Ww1Bookmarks::Out(Ww1Shell& rOut, Ww1Manager& rMan, sal_uInt16)
     323                 :            : {
     324         [ #  # ]:          0 :     if (GetIsEnd())
     325                 :            :     {
     326 [ #  # ][ #  # ]:          0 :         rOut.SetBookEnd(GetHandle());
     327                 :            :         return;
     328                 :            :     }
     329                 :            : 
     330         [ #  # ]:          0 :     const String & rName = GetName();
     331 [ #  # ][ #  # ]:          0 :     if( rName.EqualsAscii( "_Toc", 0, 4 ) ) // "_Toc*" ist ueberfluessig
     332                 :            :         return;
     333                 :            : 
     334 [ #  # ][ #  # ]:          0 :     if( rOut.IsFlagSet( SwFltControlStack::HYPO )
                 [ #  # ]
     335         [ #  # ]:          0 :         && rName.EqualsIgnoreCaseAscii( "FORMULAR" ) )
     336                 :          0 :         rOut.SetProtect();
     337                 :            : 
     338                 :            :     // Fuer UEbersetzung Bookmark -> Variable setzen
     339         [ #  # ]:          0 :     long nLen = Len();
     340         [ #  # ]:          0 :     if( nLen > MAX_FIELDLEN )
     341                 :          0 :         nLen = MAX_FIELDLEN;
     342                 :            : 
     343                 :            :     // Lese Inhalt des Bookmark
     344                 :            :     // geht vermulich auch ueber Ww1PlainText
     345 [ #  # ][ #  # ]:          0 :     String aVal( rMan.GetText().GetText( Where(), nLen ) );
     346                 :            : 
     347                 :            :     // in 2 Schritten, da OS/2 zu doof ist
     348 [ #  # ][ #  # ]:          0 :     SwFltBookmark aBook( rName, aVal, GetHandle(), sal_False );
     349 [ #  # ][ #  # ]:          0 :     rOut << aBook;
         [ #  # ][ #  # ]
                 [ #  # ]
     350                 :            : }
     351                 :            : 
     352                 :          0 : void Ww1Bookmarks::Start(Ww1Shell& rOut, Ww1Manager& rMan)
     353                 :            : {
     354         [ #  # ]:          0 :     if (rMan.Where() >= Where())
     355                 :            :     {
     356                 :          0 :         Out(rOut, rMan);
     357                 :          0 :         (*this)++;
     358                 :            :     }
     359                 :          0 : }
     360                 :            : 
     361                 :            : ///////////////////////////////////////////////////////////// Footnotes
     362                 :          0 : void Ww1Footnotes::Start(Ww1Shell& rOut, Ww1Manager& rMan)
     363                 :            : {
     364         [ #  # ]:          0 :     if (rMan.Where() >= Where())
     365                 :            :     {
     366                 :            :         OSL_ENSURE(nPlcIndex < Count(), "WwFootnotes");
     367                 :            :         sal_Unicode c;
     368         [ #  # ]:          0 :         rMan.Fill(c);
     369                 :            :         OSL_ENSURE(c==0x02, "Ww1Footnotes");
     370         [ #  # ]:          0 :         if (c==0x02)
     371                 :            :         {
     372 [ #  # ][ #  # ]:          0 :             Ww1FtnText* pText = new Ww1FtnText(rMan.GetFib());
     373                 :            :         // beginn des textes dieser fusznote:
     374         [ #  # ]:          0 :             sal_uLong start = aText.Where(nPlcIndex);
     375                 :          0 :             pText->Seek(start);
     376                 :            :         // laenge des textes
     377         [ #  # ]:          0 :             sal_uLong count = aText.Where(nPlcIndex+1) - start;
     378                 :          0 :             pText->SetCount(count);
     379                 :            :         // fusznotenkennung sollte das erste byte sein
     380         [ #  # ]:          0 :             pText->Out(c);
     381                 :            :             OSL_ENSURE(c==0x02, "Ww1Footnotes");
     382                 :          0 :             count--; // fuer das eben gelesene kenn-byte
     383                 :            :         // fusznoten mode beginnen:
     384         [ #  # ]:          0 :             rOut.BeginFootnote();
     385                 :          0 :             bStarted = sal_True;
     386                 :          0 :             rMan.Push0(pText, pText->Offset(rMan.GetFib()),
     387         [ #  # ]:          0 :              new Ww1FootnoteFields(rMan.GetFib()));
           [ #  #  #  # ]
     388         [ #  # ]:          0 :             rOut << rMan;
     389         [ #  # ]:          0 :             rMan.Pop();
     390         [ #  # ]:          0 :             rOut.EndFootnote();
     391                 :            :         }
     392                 :            :         else
     393                 :          0 :             (*this)++;
     394                 :            :     }
     395                 :          0 : }
     396                 :            : 
     397                 :          0 : void Ww1Footnotes::Stop(Ww1Shell& /*rOut*/, Ww1Manager& rMan, sal_Unicode& c)
     398                 :            : {
     399 [ #  # ][ #  # ]:          0 :     if (bStarted && rMan.Where() > Where())
                 [ #  # ]
     400                 :            :     {
     401                 :            :         OSL_ENSURE(nPlcIndex < Count(), "Ww1Footnotes");
     402                 :          0 :         c = ' ';
     403                 :          0 :         (*this)++;
     404                 :            :     }
     405                 :          0 : }
     406                 :            : 
     407                 :            : //////////////////////////////////////////////////////////////// Fields
     408                 :          0 : void Ww1Fields::Start(Ww1Shell& rOut, Ww1Manager& rMan)
     409                 :            : {
     410         [ #  # ]:          0 :     if (rMan.Where() >= Where()){
     411                 :            :         OSL_ENSURE(nPlcIndex < Count(), "Ww1Fields");
     412         [ #  # ]:          0 :         if (GetData()->chGet() == 19)
     413                 :          0 :             Out(rOut, rMan);
     414                 :            :         else
     415                 :          0 :             (*this)++; // ignore
     416                 :            :     }
     417                 :          0 : }
     418                 :            : 
     419                 :          0 : void Ww1Fields::Stop( Ww1Shell& rOut, Ww1Manager& rMan, sal_Unicode& c)
     420                 :            : {
     421         [ #  # ]:          0 :     if (rMan.Where() >= Where())
     422                 :            :     {
     423                 :            :         OSL_ENSURE(nPlcIndex < Count(), "Ww1Fields");
     424         [ #  # ]:          0 :         if (GetData()->chGet() != 19)
     425                 :            :         {
     426                 :          0 :             rMan.Fill( c );
     427                 :            :             OSL_ENSURE(c==21, "Ww1Fields");
     428                 :          0 :             (*this)++;
     429                 :          0 :             c = ' ';
     430         [ #  # ]:          0 :             if (pField)
     431                 :            :             // haben wir ein fertiges feld da, das  eingefuegt werden soll?
     432                 :            :             {
     433                 :          0 :                 rOut << *pField;
     434         [ #  # ]:          0 :                 delete pField;
     435                 :          0 :                 pField = 0;
     436                 :            :             // das macht der filter so, damit attribute die ueber das feld
     437                 :            :             // gelten auch wirklich eingelesen werden und dem feld
     438                 :            :             // zugeordnet werden.
     439                 :            :             }
     440         [ #  # ]:          0 :             if (sErgebnis.Len())
     441                 :          0 :                 rOut << sErgebnis;
     442                 :            :         }
     443                 :            :     }
     444                 :          0 : }
     445                 :            : 
     446                 :            : enum WWDateTime{ WW_DONTKNOW = 0x0, WW_DATE = 0x1, WW_TIME = 0x2, WW_BOTH = 0x3 };
     447                 :            : 
     448                 :          0 : static WWDateTime GetTimeDatePara( const String& rForm,
     449                 :            :                                     SwTimeFormat* pTime = 0,
     450                 :            :                                      SwDateFormat* pDate = 0 )
     451                 :            : {
     452                 :          0 :     WWDateTime eDT = WW_BOTH;
     453         [ #  # ]:          0 :     if( STRING_NOTFOUND == rForm.Search( 'H' ))         // H    -> 24h
     454                 :            :     {
     455         [ #  # ]:          0 :         if( pTime )
     456                 :          0 :             *pTime = TF_SSMM_24;
     457                 :            :     }
     458         [ #  # ]:          0 :     else if( STRING_NOTFOUND == rForm.Search( 'H' ))    // h    -> 24h
     459                 :            :     {
     460         [ #  # ]:          0 :         if( pTime )
     461                 :          0 :             *pTime = TF_SSMM_12;
     462                 :            :     }
     463                 :            :     else                                    // keine Zeit
     464                 :            :     {
     465                 :          0 :         eDT = (WWDateTime)( eDT & ~(sal_uInt16)WW_TIME );
     466                 :            :     }
     467                 :            : 
     468                 :          0 :     xub_StrLen nDPos = 0;
     469         [ #  # ]:          0 :     while( STRING_NOTFOUND != nDPos )
     470                 :            :     {
     471                 :          0 :         nDPos = rForm.Search( 'M', nDPos );     // M    -> Datum
     472         [ #  # ]:          0 :         if( !nDPos )
     473                 :          0 :             break;
     474                 :          0 :         sal_Unicode cPrev = rForm.GetChar( nDPos - 1 );
     475                 :            :         // ignoriere dabei "AM", "aM", "PM", "pM"
     476 [ #  # ][ #  # ]:          0 :         if( 'a' != cPrev && 'A' != cPrev && 'p' != cPrev && 'P' != cPrev )
         [ #  # ][ #  # ]
     477                 :          0 :             break;
     478                 :            :         // else search again
     479                 :          0 :         ++nDPos;
     480                 :            :     }
     481                 :            : 
     482         [ #  # ]:          0 :     if( STRING_NOTFOUND != nDPos )                  // Monat -> Datum ?
     483                 :            :     {
     484                 :            :         static SwDateFormat const aDateA[32] =
     485                 :            :         {
     486                 :            :             DFF_DMY, DFF_DMMY, DFF_DMYY, DFF_DMMYY,
     487                 :            :             DFF_DMMMY, DFF_DMMMY, DFF_DMMMYY, DFF_DMMMYY,
     488                 :            :             DFF_DDMMY, DFF_DDMMY, DFF_DDMMMYY, DFF_DDMMMYY,
     489                 :            :             DFF_DDMMMY, DFF_DDMMMY, DFF_DDMMMYY, DFF_DDMMMYY,
     490                 :            :             DFF_DDDMMMY, DFF_DDDMMMY, DFF_DDDMMMYY, DFF_DDDMMMYY,
     491                 :            :             DFF_DDDMMMY, DFF_DDDMMMY, DFF_DDDMMMYY, DFF_DDDMMMYY,
     492                 :            :             DFF_DDDMMMY, DFF_DDDMMMY, DFF_DDDMMMYY, DFF_DDDMMMYY,
     493                 :            :             DFF_DDDMMMY, DFF_DDDMMMY, DFF_DDDMMMYY, DFF_DDDMMMYY
     494                 :            :         };
     495                 :            : 
     496                 :          0 :         sal_Bool bHasDay = STRING_NOTFOUND != rForm.Search( 't' ) ||
     497                 :          0 :                        STRING_NOTFOUND != rForm.Search( 'T' ) ||
     498                 :          0 :                        STRING_NOTFOUND != rForm.Search( 'd' ) ||
     499 [ #  # ][ #  #  :          0 :                        STRING_NOTFOUND != rForm.Search( 'D' );
             #  #  #  # ]
     500                 :            : 
     501                 :          0 :         sal_Bool bLongDayOfWeek= STRING_NOTFOUND != rForm.SearchAscii( "tttt" ) ||
     502                 :          0 :                                STRING_NOTFOUND != rForm.SearchAscii( "TTTT" ) ||
     503                 :          0 :                                STRING_NOTFOUND != rForm.SearchAscii( "dddd" ) ||
     504 [ #  # ][ #  #  :          0 :                                STRING_NOTFOUND != rForm.SearchAscii( "DDDD" );
             #  #  #  # ]
     505                 :            : 
     506                 :          0 :         sal_Bool bDayOfWeek = STRING_NOTFOUND != rForm.SearchAscii( "ttt" ) ||
     507                 :          0 :                           STRING_NOTFOUND != rForm.SearchAscii( "TTT" ) ||
     508                 :          0 :                           STRING_NOTFOUND != rForm.SearchAscii( "ddd" ) ||
     509 [ #  # ][ #  #  :          0 :                           STRING_NOTFOUND != rForm.SearchAscii( "DDD" );
             #  #  #  # ]
     510                 :            : 
     511                 :            :                     //  M, MM -> numeric month
     512                 :            :                     //  MMM, MMMM -> text. month
     513                 :          0 :         sal_Bool bLitMonth = STRING_NOTFOUND != rForm.SearchAscii( "MMM" );
     514                 :            :                     //  MMMM -> full month
     515                 :          0 :         sal_Bool bFullMonth = STRING_NOTFOUND != rForm.SearchAscii( "MMMM" );
     516                 :            :                     //  jj, JJ -> 2-col-year
     517                 :            :                     //  jjjj, JJJJ -> 4-col-year
     518                 :          0 :         sal_Bool bFullYear = STRING_NOTFOUND != rForm.SearchAscii( "jjj" ) ||
     519                 :          0 :                          STRING_NOTFOUND != rForm.SearchAscii( "JJJ" ) ||
     520                 :          0 :                          STRING_NOTFOUND != rForm.SearchAscii( "yyy" ) ||
     521 [ #  # ][ #  #  :          0 :                          STRING_NOTFOUND != rForm.SearchAscii( "YYY" );
             #  #  #  # ]
     522                 :            : 
     523                 :            :         sal_uInt16 i = ( bLitMonth & 1 )
     524                 :            :                    | ( ( bFullYear & 1 ) << 1 )
     525                 :            :                    | ( ( bFullMonth & 1 ) << 2 )
     526                 :            :                    | ( ( bDayOfWeek & 1 ) << 3 )
     527                 :          0 :                    | ( ( bLongDayOfWeek & 1 ) << 4 );
     528         [ #  # ]:          0 :         if( pDate )
     529                 :            :         {
     530 [ #  # ][ #  # ]:          0 :             if( !bHasDay && !bFullMonth )
     531                 :          0 :                 *pDate = DFF_MY;
     532                 :            :             else
     533                 :          0 :                 *pDate = aDateA[i];
     534                 :            :         }
     535                 :            :     }
     536                 :            :     else
     537                 :            :     {
     538                 :          0 :         eDT = (WWDateTime)( eDT & ~(sal_uInt16)WW_DATE );
     539                 :            :     }
     540                 :          0 :     return eDT;
     541                 :            : }
     542                 :            : 
     543                 :            : 
     544                 :            : extern void sw3io_ConvertFromOldField( SwDoc& rDoc, sal_uInt16& rWhich,
     545                 :            :                                 sal_uInt16& rSubType, sal_uLong &rFmt,
     546                 :            :                                 sal_uInt16 nVersion );
     547                 :            : 
     548                 :          0 : void Ww1Fields::Out(Ww1Shell& rOut, Ww1Manager& rMan, sal_uInt16 nDepth)
     549                 :            : {
     550         [ #  # ]:          0 :     String sType; // der typ als string
     551         [ #  # ]:          0 :     String sFormel; // die formel
     552         [ #  # ]:          0 :     String sFormat;
     553         [ #  # ]:          0 :     String sDTFormat;   // Datum / Zeit-Format
     554         [ #  # ]:          0 :     W1_FLD* pData = GetData(); // die an den plc gebunden daten
     555                 :            :     OSL_ENSURE(pData->chGet()==19, "Ww1Fields"); // sollte beginn sein
     556                 :            : 
     557                 :            :     sal_Unicode c;
     558         [ #  # ]:          0 :     rMan.Fill( c );
     559                 :            :     OSL_ENSURE(c==19, "Ww1Fields"); // sollte auch beginn sein
     560 [ #  # ][ #  # ]:          0 :     if (pData->chGet()==19 && c == 19)
                 [ #  # ]
     561                 :            :     {
     562         [ #  # ]:          0 :         String aStr;
     563 [ #  # ][ #  # ]:          0 :         c = rMan.Fill( aStr, GetLength() );
     564                 :            :         OSL_ENSURE(Ww1PlainText::IsChar(c), "Ww1Fields");
     565         [ #  # ]:          0 :         xub_StrLen pos = aStr.Search(' ');
     566                 :            :         // get type out of text
     567 [ #  # ][ #  # ]:          0 :         sType = aStr.Copy( 0, pos );
                 [ #  # ]
     568         [ #  # ]:          0 :         aStr.Erase( 0, pos );
     569         [ #  # ]:          0 :         if ( pos != STRING_NOTFOUND )
     570         [ #  # ]:          0 :             aStr.Erase(0, 1);
     571         [ #  # ]:          0 :         sFormel += aStr;
     572                 :          0 :         sal_uInt8 rbType = pData->fltGet();
     573         [ #  # ]:          0 :         do {
     574                 :            :         // solange den formelteil einlesen, bis das feld entweder
     575                 :            :         // zuende ist oder der ergebnisteil beginnt. dabei koennen
     576                 :            :         // natuerlich neue felder beginnen (word unterstuetzt felder,
     577                 :            :         // die wiederum felder beinhalten).
     578                 :          0 :             (*this)++;
     579         [ #  # ]:          0 :             pData = GetData();
     580         [ #  # ]:          0 :             if (pData->chGet()==19) // nested field
     581                 :            :             {
     582         [ #  # ]:          0 :                 Out(rOut, rMan, nDepth+1);
     583         [ #  # ]:          0 :                 rMan.Fill(c);
     584                 :            :                 OSL_ENSURE(c==21, "Ww1PlainText");
     585         [ #  # ]:          0 :                 sFormel.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "Ww" ));
     586 [ #  # ][ #  # ]:          0 :                 sFormel += String::CreateFromInt32( nPlcIndex );
                 [ #  # ]
     587 [ #  # ][ #  # ]:          0 :                 c = rMan.Fill(aStr, GetLength());
     588                 :            :                 OSL_ENSURE(Ww1PlainText::IsChar(c), "Ww1PlainText");
     589         [ #  # ]:          0 :                 sFormel += aStr;
     590                 :            :             }
     591                 :            :         }
     592                 :          0 :         while (pData->chGet()==19);
     593                 :            : 
     594                 :            :         // get format out of text
     595         [ #  # ]:          0 :         pos = sFormel.SearchAscii( "\\*" );
     596 [ #  # ][ #  # ]:          0 :         sFormat = sFormel.Copy( pos );
                 [ #  # ]
     597         [ #  # ]:          0 :         sFormel.Erase( pos );
     598                 :            : 
     599         [ #  # ]:          0 :         pos = sFormel.SearchAscii( "\\@" );
     600 [ #  # ][ #  # ]:          0 :         sDTFormat = sFormel.Copy( pos );
                 [ #  # ]
     601         [ #  # ]:          0 :         sFormel.Erase( pos );
     602                 :            : 
     603                 :            :         // der formelteil ist zuende, kommt ein ergebnisteil?
     604         [ #  # ]:          0 :         if( pData->chGet() == 20 )
     605                 :            :         {
     606         [ #  # ]:          0 :             rMan.Fill( c );
     607                 :            :             OSL_ENSURE(c==20, "Ww1PlainText");
     608 [ #  # ][ #  # ]:          0 :             c = rMan.Fill(sErgebnis, GetLength());
     609         [ #  # ]:          0 :             if (!Ww1PlainText::IsChar(c))
     610         [ #  # ]:          0 :                 sErgebnis += c; //~ mdt: sonderzeichenbenhandlung
     611                 :          0 :             (*this)++;
     612         [ #  # ]:          0 :             pData = GetData();
     613                 :            :         }
     614                 :            :         OSL_ENSURE(pData->chGet()==21, "Ww1PlainText");
     615                 :          0 :         sal_Bool bKnown = sal_True;
     616                 :            :         OSL_ENSURE(pField==0, "Ww1PlainText");
     617         [ #  # ]:          0 :         if (pField != 0)
     618                 :            :         {
     619         [ #  # ]:          0 :             rOut << *pField;
     620 [ #  # ][ #  # ]:          0 :             delete pField;
     621                 :          0 :             pField = 0;
     622                 :            :         }
     623                 :            : // naja, aber info enthaelt alle moeglichkeiten, die auch direkt da sind
     624                 :            : oncemore:
     625   [ #  #  #  #  :          0 :         switch (rbType)
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
                   #  # ]
     626                 :            :         {
     627                 :            :         case 3: // bookmark reference
     628         [ #  # ]:          0 :             rOut.ConvertUStr( sFormel );
     629                 :            :             pField = new SwGetRefField( (SwGetRefFieldType*)
     630                 :          0 :                 rOut.GetSysFldType( RES_GETREFFLD ),
     631                 :            :                 sFormel,
     632                 :            :                 REF_BOOKMARK,
     633                 :            :                 0,
     634 [ #  # ][ #  # ]:          0 :                 REF_CONTENT );
                 [ #  # ]
     635                 :            : 
     636                 :          0 :         break;
     637                 :            :         case 6: // set command
     638                 :            :         {
     639         [ #  # ]:          0 :             pos = aStr.Search(' ');
     640         [ #  # ]:          0 :             String aName( aStr.Copy( 0, pos ));
     641         [ #  # ]:          0 :             aStr.Erase(0, pos );
     642         [ #  # ]:          0 :             aStr.Erase(0, 1);
     643         [ #  # ]:          0 :             if( !aName.Len() )
     644                 :            :                 break;
     645         [ #  # ]:          0 :             rOut.ConvertUStr( aName );
     646                 :          0 :             SwFieldType* pFT = rOut.GetDoc().InsertFldType(
     647 [ #  # ][ #  # ]:          0 :                 SwSetExpFieldType( &rOut.GetDoc(), aName, nsSwGetSetExpType::GSE_STRING ) );
                 [ #  # ]
     648 [ #  # ][ #  # ]:          0 :             pField = new SwSetExpField((SwSetExpFieldType*)pFT, aStr);
     649 [ #  # ][ #  # ]:          0 :             ((SwSetExpField*)pField)->SetSubType( nsSwExtendedSubType::SUB_INVISIBLE );
                 [ #  # ]
     650                 :            : // Invisible macht in 378 AErger, soll aber demnaechst gehen
     651                 :            : 
     652                 :            :             // das Ignorieren des Bookmarks ist nicht implementiert
     653                 :            :         }
     654                 :          0 :         break;
     655                 :            :         case 14: // info var
     656                 :            :         {
     657         [ #  # ]:          0 :             pos = aStr.Search(' ');
     658         [ #  # ]:          0 :             String aSubType( aStr.Copy( 0, pos ));
     659         [ #  # ]:          0 :             aStr.Erase(0, pos );
     660         [ #  # ]:          0 :             aStr.Erase(0, 1);
     661         [ #  # ]:          0 :             rOut.ConvertUStr( aSubType );
     662                 :            : 
     663                 :            : 
     664                 :            :             // ganz grosze schiete: der typ 'info' kann einem der
     665                 :            :             // typen 15..31 entsprechen. er enthaelt als formel
     666                 :            :             // das eingentliche feld der doc-info.
     667                 :            :             // kein ';' benutzen mit folgendem macro:
     668                 :            : #define IS(sd, se, t) \
     669                 :            :     if (aSubType.EqualsAscii( sd ) || aSubType.EqualsAscii( se)) \
     670                 :            :         rbType = t; \
     671                 :            :     else
     672                 :            : 
     673                 :            :             // deutsche bez.     englische bez.    typ-code
     674 [ #  # ][ #  # ]:          0 :             IS("titel",          "title",          15)
         [ #  # ][ #  # ]
                 [ #  # ]
     675 [ #  # ][ #  # ]:          0 :             IS("thema",          "subject",        16)
         [ #  # ][ #  # ]
                 [ #  # ]
     676 [ #  # ][ #  # ]:          0 :             IS("autor",          "author",         17)
         [ #  # ][ #  # ]
                 [ #  # ]
     677 [ #  # ][ #  # ]:          0 :             IS("stichw?rter",    "keywords",       18) //~ mdt: umlaut
         [ #  # ][ #  # ]
                 [ #  # ]
     678 [ #  # ][ #  # ]:          0 :             IS("kommentar",      "comment",        19)
         [ #  # ][ #  # ]
                 [ #  # ]
     679 [ #  # ][ #  # ]:          0 :             IS("gespeichertvon", "lastrevisedby",  20)
         [ #  # ][ #  # ]
                 [ #  # ]
     680 [ #  # ][ #  # ]:          0 :             IS("ertelldat",      "creationdate",   21)
         [ #  # ][ #  # ]
                 [ #  # ]
     681 [ #  # ][ #  # ]:          0 :             IS("speicherdat",    "revisiondate",   22)
         [ #  # ][ #  # ]
                 [ #  # ]
     682 [ #  # ][ #  # ]:          0 :             IS("druckdat",       "printdate",      23)
         [ #  # ][ #  # ]
                 [ #  # ]
     683 [ #  # ][ #  # ]:          0 :             IS("version",        "revisionnumber", 24)
         [ #  # ][ #  # ]
                 [ #  # ]
     684 [ #  # ][ #  # ]:          0 :             IS("zeit",           "edittime",       25)
         [ #  # ][ #  # ]
                 [ #  # ]
     685 [ #  # ][ #  # ]:          0 :             IS("anzseit",        "numberofpages",  26)
         [ #  # ][ #  # ]
                 [ #  # ]
     686 [ #  # ][ #  # ]:          0 :             IS("anzw?rter",      "numberofwords",  27) //~ mdt: umlaut
         [ #  # ][ #  # ]
                 [ #  # ]
     687 [ #  # ][ #  # ]:          0 :             IS("anzzeichen",     "numberofchars",  28)
         [ #  # ][ #  # ]
                 [ #  # ]
     688 [ #  # ][ #  # ]:          0 :             IS("dateiname",      "filename",       29)
         [ #  # ][ #  # ]
                 [ #  # ]
     689 [ #  # ][ #  # ]:          0 :             IS("vorlage",        "templatename",   30)
         [ #  # ][ #  # ]
                 [ #  # ]
     690                 :          0 :                 bKnown = sal_False;
     691                 :            : #undef IS
     692         [ #  # ]:          0 :             if (rbType != 14)
     693 [ #  # ][ #  # ]:          0 :                 goto oncemore;
     694                 :            :         }
     695                 :          0 :         break;
     696                 :            :         case 15: // title
     697                 :            :             pField = new SwDocInfoField((SwDocInfoFieldType*)
     698 [ #  # ][ #  # ]:          0 :              rOut.GetSysFldType(RES_DOCINFOFLD), DI_TITEL, String(), 0);
         [ #  # ][ #  # ]
                 [ #  # ]
     699                 :          0 :         break;
     700                 :            :         case 16: // subject
     701                 :            :             pField = new SwDocInfoField((SwDocInfoFieldType*)
     702 [ #  # ][ #  # ]:          0 :              rOut.GetSysFldType(RES_DOCINFOFLD), DI_THEMA, String(), 0);
         [ #  # ][ #  # ]
                 [ #  # ]
     703                 :          0 :         break;
     704                 :            :         case 17: // author
     705                 :            :             pField = new SwAuthorField((SwAuthorFieldType*)
     706 [ #  # ][ #  # ]:          0 :              rOut.GetSysFldType(RES_AUTHORFLD), AF_NAME );
                 [ #  # ]
     707                 :          0 :         break;
     708                 :            :         case 18: // keywords
     709                 :            :             pField = new SwDocInfoField((SwDocInfoFieldType*)
     710 [ #  # ][ #  # ]:          0 :              rOut.GetSysFldType(RES_DOCINFOFLD), DI_KEYS, String(), 0);
         [ #  # ][ #  # ]
                 [ #  # ]
     711                 :          0 :         break;
     712                 :            :         case 19: // comments
     713                 :            :             pField = new SwDocInfoField((SwDocInfoFieldType*)
     714 [ #  # ][ #  # ]:          0 :              rOut.GetSysFldType(RES_DOCINFOFLD), DI_COMMENT, String(), 0);
         [ #  # ][ #  # ]
                 [ #  # ]
     715                 :          0 :         break;
     716                 :            :         case 20: // last revised by
     717                 :            :             pField = new SwDocInfoField((SwDocInfoFieldType*)
     718 [ #  # ][ #  # ]:          0 :              rOut.GetSysFldType(RES_DOCINFOFLD), DI_CHANGE|DI_SUB_AUTHOR, String());
         [ #  # ][ #  # ]
                 [ #  # ]
     719                 :          0 :         break;
     720                 :            :         case 21: // creation date
     721                 :            :         case 22: // revision date
     722                 :            :         case 23: // print date
     723                 :            :         case 25:{// edit time
     724                 :            :                     sal_uInt16 nSub;
     725                 :          0 :                     sal_uInt16 nReg = 0;    // RegInfoFormat, DefaultFormat fuer DocInfoFelder
     726                 :            : 
     727   [ #  #  #  # ]:          0 :                     switch( rbType )
     728                 :            :                     {
     729                 :            :                         default:
     730                 :          0 :                         case 21: nSub = DI_CREATE;  nReg = DI_SUB_DATE; break;
     731                 :          0 :                         case 23: nSub = DI_PRINT;   nReg = DI_SUB_DATE; break;
     732                 :          0 :                         case 22: nSub = DI_CHANGE;  nReg = DI_SUB_DATE; break;
     733                 :          0 :                         case 25: nSub = DI_CHANGE;  nReg = DI_SUB_TIME; break;
     734                 :            :                     }
     735         [ #  # ]:          0 :                     switch( GetTimeDatePara( sDTFormat ) )
           [ #  #  #  # ]
     736                 :            :                     {
     737                 :          0 :                         case WW_DATE: nReg = DI_SUB_DATE; break;
     738                 :          0 :                         case WW_TIME: nReg = DI_SUB_TIME; break;
     739                 :          0 :                         case WW_BOTH: nReg = DI_SUB_DATE; break;
     740                 :            :                         default:
     741                 :          0 :                             break;
     742                 :            :                         // WW_DONTKNOW -> Default bereits gesetzt
     743                 :            :                     }
     744                 :            :                     pField = new SwDocInfoField((SwDocInfoFieldType*)
     745 [ #  # ][ #  # ]:          0 :                         rOut.GetSysFldType(RES_DOCINFOFLD), nSub | nReg, String());
         [ #  # ][ #  # ]
                 [ #  # ]
     746                 :            :                 }
     747                 :          0 :         break;
     748                 :            :         case 24: // revision number
     749                 :            :             pField = new SwDocInfoField((SwDocInfoFieldType*)
     750 [ #  # ][ #  # ]:          0 :              rOut.GetSysFldType(RES_DOCINFOFLD),  DI_DOCNO, String(), 0);
         [ #  # ][ #  # ]
                 [ #  # ]
     751                 :          0 :         break;
     752                 :            :         case 26: // number of pages
     753                 :            :             pField = new SwDocStatField((SwDocStatFieldType*)
     754 [ #  # ][ #  # ]:          0 :              rOut.GetSysFldType(RES_DOCSTATFLD), DS_PAGE, SVX_NUM_ARABIC);
                 [ #  # ]
     755                 :          0 :         break;
     756                 :            :         case 27: // number of words
     757                 :            :             pField = new SwDocStatField((SwDocStatFieldType*)
     758 [ #  # ][ #  # ]:          0 :              rOut.GetSysFldType(RES_DOCSTATFLD), DS_WORD, SVX_NUM_ARABIC);
                 [ #  # ]
     759                 :          0 :         break;
     760                 :            :         case 28: // number of chars
     761                 :            :             pField = new SwDocStatField((SwDocStatFieldType*)
     762 [ #  # ][ #  # ]:          0 :              rOut.GetSysFldType(RES_DOCSTATFLD), DS_CHAR, SVX_NUM_ARABIC);
                 [ #  # ]
     763                 :          0 :         break;
     764                 :            :         case 29: // file name
     765                 :            :             pField = new SwFileNameField((SwFileNameFieldType*)
     766 [ #  # ][ #  # ]:          0 :              rOut.GetSysFldType(RES_FILENAMEFLD));
                 [ #  # ]
     767                 :          0 :         break;
     768                 :            :         case 30: // doc template name
     769                 :            :             pField = new SwTemplNameField((SwTemplNameFieldType*)
     770 [ #  # ][ #  # ]:          0 :              rOut.GetSysFldType(RES_TEMPLNAMEFLD), FF_NAME);
                 [ #  # ]
     771                 :          0 :         break;
     772                 :            :         case 31:
     773                 :            :         case 32:{
     774                 :          0 :                     SwDateFormat aDate = DF_SSYS;
     775                 :          0 :                     SwTimeFormat aTime = TF_SYSTEM;
     776                 :            : 
     777         [ #  # ]:          0 :                     WWDateTime eDT = GetTimeDatePara(sDTFormat, &aTime, &aDate);
     778         [ #  # ]:          0 :                     if( eDT == WW_DONTKNOW )        // kein D/T-Formatstring
     779         [ #  # ]:          0 :                         eDT = ( rbType == 32 ) ? WW_TIME : WW_DATE;    // benutze ID
     780                 :            : 
     781         [ #  # ]:          0 :                     if( eDT & WW_DATE )
     782                 :            :                     {
     783                 :          0 :                         sal_uInt16 nWhich = RES_DATEFLD;
     784                 :          0 :                         sal_uInt16 nSubType = DATEFLD;
     785                 :          0 :                         sal_uLong nFormat = aDate;
     786                 :          0 :                         sw3io_ConvertFromOldField( rOut.GetDoc(),
     787         [ #  # ]:          0 :                             nWhich, nSubType, nFormat, 0x0110 );
     788                 :            :                         pField = new SwDateTimeField((SwDateTimeFieldType*)
     789 [ #  # ][ #  # ]:          0 :                             rOut.GetSysFldType(RES_DATETIMEFLD), DATEFLD, nFormat);
                 [ #  # ]
     790                 :            : 
     791         [ #  # ]:          0 :                         if( eDT == WW_BOTH )
     792 [ #  # ][ #  # ]:          0 :                             rOut << * pField << ' ';
     793                 :            :                                 // Mogel: direkt einfuegen und Space dahinter
     794                 :            :                     }
     795         [ #  # ]:          0 :                     if( eDT & WW_TIME )
     796                 :            :                     {
     797                 :          0 :                         sal_uInt16 nWhich = RES_TIMEFLD;
     798                 :          0 :                         sal_uInt16 nSubType = TIMEFLD;
     799                 :          0 :                         sal_uLong nFormat = aTime;
     800                 :          0 :                         sw3io_ConvertFromOldField( rOut.GetDoc(),
     801         [ #  # ]:          0 :                             nWhich, nSubType, nFormat, 0x0110 );
     802                 :            :                         pField = new SwDateTimeField((SwDateTimeFieldType*)
     803 [ #  # ][ #  # ]:          0 :                             rOut.GetSysFldType(RES_DATETIMEFLD), TIMEFLD, nFormat);
                 [ #  # ]
     804                 :            :                     }
     805                 :            : 
     806                 :            :                 }
     807                 :          0 :         break;
     808                 :            :         case 33: // current page
     809                 :            :             pField = new SwPageNumberField((SwPageNumberFieldType*)
     810 [ #  # ][ #  # ]:          0 :              rOut.GetSysFldType(RES_PAGENUMBERFLD), PG_RANDOM, SVX_NUM_ARABIC);
                 [ #  # ]
     811                 :          0 :         break;
     812                 :            :         case 34: // evaluation exp
     813                 :            :         {
     814         [ #  # ]:          0 :             if (nDepth == 0)
     815                 :            :             {
     816                 :            :                 SwGetExpFieldType* pFieldType =
     817         [ #  # ]:          0 :                  (SwGetExpFieldType*)rOut.GetSysFldType(RES_GETEXPFLD);
     818                 :            :                 OSL_ENSURE(pFieldType!=0, "Ww1Fields");
     819         [ #  # ]:          0 :                 if (pFieldType != 0)
     820                 :            :                     pField = new SwGetExpField(pFieldType, sFormel,
     821 [ #  # ][ #  # ]:          0 :                      nsSwGetSetExpType::GSE_STRING, VVF_SYS);
     822                 :            :             }
     823                 :            :             else // rekursion:
     824                 :            :             {
     825                 :          0 :                 rtl::OUString aName("Ww");
     826 [ #  # ][ #  # ]:          0 :                 aName += String::CreateFromInt32( nPlcIndex );
                 [ #  # ]
     827 [ #  # ][ #  # ]:          0 :                 SwFieldType* pFT = rOut.GetDoc().GetFldType( RES_SETEXPFLD, aName, false);
                 [ #  # ]
     828         [ #  # ]:          0 :                 if (pFT == 0)
     829                 :            :                 {
     830 [ #  # ][ #  # ]:          0 :                     SwSetExpFieldType aS(&rOut.GetDoc(), aName, nsSwGetSetExpType::GSE_FORMULA);
                 [ #  # ]
     831 [ #  # ][ #  # ]:          0 :                     pFT = rOut.GetDoc().InsertFldType(aS);
     832                 :            :                 }
     833         [ #  # ]:          0 :                 SwSetExpField aFld((SwSetExpFieldType*)pFT, sFormel);
     834         [ #  # ]:          0 :                 aFld.SetSubType(nsSwExtendedSubType::SUB_INVISIBLE);
     835 [ #  # ][ #  # ]:          0 :                 rOut << aFld;
     836                 :            :             }
     837                 :            :         }
     838                 :          0 :         break;
     839                 :            :         case 36: // print command, Einfuegendatei
     840                 :            :         {
     841         [ #  # ]:          0 :             pos = aStr.Search(' ');
     842         [ #  # ]:          0 :             String aFName( aStr.Copy( 0, pos ));
     843         [ #  # ]:          0 :             aStr.Erase(0, pos );
     844         [ #  # ]:          0 :             aStr.Erase(0, 1);
     845         [ #  # ]:          0 :             if( !aFName.Len() )
     846                 :            :                 break;
     847 [ #  # ][ #  # ]:          0 :             aFName.SearchAndReplaceAscii( "\\\\", rtl::OUString('\\') );
                 [ #  # ]
     848                 :            : 
     849                 :            :             aFName = URIHelper::SmartRel2Abs(
     850 [ #  # ][ #  # ]:          0 :                 INetURLObject(rOut.GetBaseURL()), aFName );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     851                 :            : 
     852                 :            :             SwSectionData * pSection = new SwSectionData( FILE_LINK_SECTION,
     853 [ #  # ][ #  # ]:          0 :                 rOut.GetDoc().GetUniqueSectionName( &aStr ) );
         [ #  # ][ #  # ]
     854         [ #  # ]:          0 :             pSection->SetLinkFileName( aFName );
     855                 :          0 :             pSection->SetProtectFlag( true );
     856 [ #  # ][ #  # ]:          0 :             rOut << SwFltSection( pSection );
                 [ #  # ]
     857         [ #  # ]:          0 :             rOut.EndItem( RES_FLTR_SECTION );
     858 [ #  # ][ #  # ]:          0 :             rOut.NextParagraph();
                 [ #  # ]
     859                 :            :         }
     860                 :            :         case 37: // page ref
     861                 :            :             pField = new SwGetRefField(
     862                 :          0 :              (SwGetRefFieldType*)rOut.GetSysFldType(RES_GETREFFLD),
     863 [ #  # ][ #  # ]:          0 :              sFormel, 0, 0, REF_PAGE);
                 [ #  # ]
     864                 :          0 :         break;
     865                 :            :         case 38: // ask command
     866                 :            :         {
     867         [ #  # ]:          0 :             pos = aStr.Search(' ');
     868         [ #  # ]:          0 :             String aName( aStr.Copy( 0, pos ));
     869         [ #  # ]:          0 :             aStr.Erase(0, pos );
     870         [ #  # ]:          0 :             aStr.Erase(0, 1);
     871         [ #  # ]:          0 :             if( !aName.Len() )
     872                 :            :                 break;
     873                 :            : 
     874                 :          0 :             SwFieldType* pFT = rOut.GetDoc().InsertFldType(
     875 [ #  # ][ #  # ]:          0 :                 SwSetExpFieldType( &rOut.GetDoc(), aName, nsSwGetSetExpType::GSE_STRING ) );
                 [ #  # ]
     876 [ #  # ][ #  # ]:          0 :             pField = new SwSetExpField((SwSetExpFieldType*)pFT, aStr );
     877                 :          0 :             ((SwSetExpField*)pField)->SetInputFlag( sal_True );
     878 [ #  # ][ #  # ]:          0 :             ((SwSetExpField*)pField)->SetSubType(nsSwExtendedSubType::SUB_INVISIBLE);
                 [ #  # ]
     879                 :            :         }
     880                 :            :         case 39: // fillin command
     881                 :            :             pField = new SwInputField(
     882                 :          0 :                 (SwInputFieldType*)rOut.GetSysFldType( RES_INPUTFLD ),
     883                 :            :                 aEmptyStr, sFormel,
     884 [ #  # ][ #  # ]:          0 :                 INP_TXT, 0 );       // sichtbar ( geht z.Zt. nicht anders )
                 [ #  # ]
     885                 :          0 :         break;
     886                 :            :         case 51: // macro button
     887                 :            :         {
     888         [ #  # ]:          0 :             pos = aStr.Search(' ');
     889         [ #  # ]:          0 :             String aName( aStr.Copy( 0, pos ));
     890         [ #  # ]:          0 :             aStr.Erase(0, pos );
     891         [ #  # ]:          0 :             aStr.Erase(0, 1);
     892 [ #  # ][ #  # ]:          0 :             if( !aName.Len() || !aStr.Len() )
                 [ #  # ]
     893                 :            :                 break;
     894         [ #  # ]:          0 :             aName.InsertAscii( "StarOffice.Standard.Modul1.", 0 );
     895                 :            : 
     896                 :            :             pField = new SwMacroField( (SwMacroFieldType*)
     897                 :          0 :                             rOut.GetSysFldType( RES_MACROFLD ),
     898 [ #  # ][ #  # ]:          0 :                             aName, aStr );
         [ #  # ][ #  # ]
                 [ #  # ]
     899                 :            :         }
     900                 :          0 :         break;
     901                 :            :         case 55: // read tiff / or better: import anything
     902                 :            :         {
     903                 :          0 :             const sal_Unicode* pFormel = sFormel.GetBuffer();
     904                 :          0 :             const sal_Unicode* pDot = 0;
     905         [ #  # ]:          0 :             String sName;
     906 [ #  # ][ #  # ]:          0 :             while (*pFormel != '\0' && *pFormel != ' ')
                 [ #  # ]
     907                 :            :             {
     908                 :            :                 // ab hier koennte eine extension kommen
     909         [ #  # ]:          0 :                 if (*pFormel == '.')
     910                 :          0 :                     pDot = pFormel;
     911                 :            :                 else
     912                 :            :                     // aha: wir waren bislang noch in dirs
     913         [ #  # ]:          0 :                     if (*pFormel == '\\')
     914                 :            :                     {
     915                 :          0 :                         pDot = 0;
     916         [ #  # ]:          0 :                         if (pFormel[1] == '\\')
     917                 :          0 :                             pFormel++;
     918                 :            :                     }
     919         [ #  # ]:          0 :                 if (*pFormel != '\0')
     920         [ #  # ]:          0 :                     sName += *pFormel++;
     921                 :            :             }
     922         [ #  # ]:          0 :             if( pDot )
     923                 :            :             {
     924         [ #  # ]:          0 :                 String sExt;
     925 [ #  # ][ #  # ]:          0 :                 while( *pDot != '\0' && *pDot != ' ')
                 [ #  # ]
     926         [ #  # ]:          0 :                     sExt += *pDot++;
     927                 :            : 
     928 [ #  # ][ #  # ]:          0 :                 if( sExt.EqualsIgnoreCaseAscii( ".tiff" )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     929         [ #  # ]:          0 :                  || sExt.EqualsIgnoreCaseAscii( ".bmp" )
     930         [ #  # ]:          0 :                  || sExt.EqualsIgnoreCaseAscii( ".gif" )
     931         [ #  # ]:          0 :                  || sExt.EqualsIgnoreCaseAscii( ".pcx" )
     932         [ #  # ]:          0 :                  || sExt.EqualsIgnoreCaseAscii( ".pic" ))
     933         [ #  # ]:          0 :                     rOut.AddGraphic( sName );
     934                 :            :                 else
     935         [ #  # ]:          0 :                     bKnown = sal_False;
     936                 :            :             }
     937                 :            :             else
     938         [ #  # ]:          0 :                 bKnown = sal_False;
     939                 :            :         }
     940                 :          0 :         break;
     941                 :            :         default: // unknown
     942                 :            :             OSL_ENSURE(sal_False, "Ww1PlainText");
     943                 :            :         // unsupported:
     944                 :            :         case 1: // unknown
     945                 :            :         case 2: // possible bookmark
     946                 :            :         case 4: // index entry
     947                 :            :         // wwpar5: 1351/1454
     948                 :            :         case 5: // footnote ref
     949                 :            :         case 7: // if command
     950                 :            :         case 8: // create index
     951                 :            :         // wwpar5: 1351/1454
     952                 :            :         case 9: // table of contents entry
     953                 :            :         // wwpar5: 1351/1454
     954                 :            :         case 10: // style ref
     955                 :            :         case 11: // doc ref
     956                 :            :         case 12: // seq ref
     957                 :            :         case 13: // create table of contents
     958                 :            :         // wwpar5: 1351/1454
     959                 :            :         case 35: // literal text
     960                 :            :         // print merge:
     961                 :            :         case 40: // data command
     962                 :            :         case 41: // next command
     963                 :            :         case 42: // nextif command
     964                 :            :         case 43: // skipif command
     965                 :            :         case 44: // number of record
     966                 :            :         //
     967                 :            :         case 45: // dde ref
     968                 :            :         case 46: // dde auto ref
     969                 :            :         case 47: // glossary entry
     970                 :            :         case 48: // print char
     971                 :            :         case 49: // formula def
     972                 :            :         case 50: // goto button
     973                 :            :         case 52: // auto number outline
     974                 :            :         case 53: // auto number legal
     975                 :            :         case 54: // auto number arabic
     976                 :          0 :             bKnown = sal_False;
     977                 :          0 :         break;
     978                 :            :         }
     979 [ #  # ][ #  # ]:          0 :         if( bKnown || sErgebnis.EqualsAscii( "\270" ))
         [ #  # ][ #  # ]
     980         [ #  # ]:          0 :             this->sErgebnis.Erase();
     981                 :            :         else
     982 [ #  # ][ #  # ]:          0 :             this->sErgebnis = sErgebnis;
     983                 :            :     }
     984                 :            :     else // oops: we are terribly wrong: skip this
     985 [ #  # ][ #  # ]:          0 :         (*this)++;
         [ #  # ][ #  # ]
     986                 :          0 : }
     987                 :            : 
     988                 :          0 : sal_uLong Ww1Fields::GetLength()
     989                 :            : {
     990                 :            : // berechnet die laenge eines feldteiles. nicht mitgerechnet werden
     991                 :            : // die terminierenden zeichen im text (19, 20, 21) die beginn, trenner
     992                 :            : // und ende bedeuten.
     993                 :          0 :     sal_uLong ulBeg = Where();
     994                 :          0 :     sal_uLong ulEnd = Where(nPlcIndex+1);
     995                 :            :     OSL_ENSURE(ulBeg<ulEnd, "Ww1Fields");
     996                 :          0 :     return (ulEnd - ulBeg) - 1;
     997                 :            : }
     998                 :            : 
     999                 :            : /////////////////////////////////////////////////////////////////// Sep
    1000                 :          0 : void Ww1Sep::Start(Ww1Shell& rOut, Ww1Manager& rMan)
    1001                 :            : {
    1002         [ #  # ]:          0 :     if (rMan.Where() >= Where())
    1003                 :            :     {
    1004         [ #  # ]:          0 :         rOut.NextSection();
    1005                 :          0 :         SwFrmFmt &rFmt = rOut.GetPageDesc().GetMaster();
    1006                 :          0 :         W1_DOP& rDOP = rMan.GetDop().GetDOP();
    1007                 :          0 :         rOut.GetPageDesc().SetLandscape(rDOP.fWideGet());
    1008 [ #  # ][ #  # ]:          0 :         SwFmtFrmSize aSz(rFmt.GetFrmSize());
    1009                 :          0 :         aSz.SetWidth(rDOP.xaPageGet());
    1010                 :          0 :         aSz.SetHeight(rDOP.yaPageGet());
    1011         [ #  # ]:          0 :         rFmt.SetFmtAttr(aSz);
    1012                 :          0 :         SvxLRSpaceItem aLR(rDOP.dxaLeftGet()+rDOP.dxaGutterGet(),
    1013         [ #  # ]:          0 :          rDOP.dxaRightGet(), 0, 0, RES_LR_SPACE);
    1014         [ #  # ]:          0 :         rFmt.SetFmtAttr(aLR);
    1015         [ #  # ]:          0 :         SvxULSpaceItem aUL(rDOP.dyaTopGet(), rDOP.dyaBottomGet(), RES_UL_SPACE);
    1016         [ #  # ]:          0 :         rFmt.SetFmtAttr(aUL);
    1017                 :            :     // sobald wir mit dem lesen der zeichen soweit sind, wo sep's
    1018                 :            :     // momentanes attribut beginnt, wird dieses attribut eingefuegt.
    1019                 :            :     // diese methode ist bei den meisten start/stop methoden der
    1020                 :            :     // memberklassen des managers identisch.
    1021         [ #  # ]:          0 :         sal_uInt8* pByte = GetData();
    1022         [ #  # ]:          0 :         Ww1SprmSep aSprm(rFib, SVBT32ToUInt32(pByte + 2));
    1023         [ #  # ]:          0 :         aSprm.Start(rOut, rMan);
    1024         [ #  # ]:          0 :         aSprm.Stop(rOut, rMan);
    1025                 :          0 :         (*this)++;
    1026 [ #  # ][ #  # ]:          0 :         aHdd.Start(rOut, rMan);
         [ #  # ][ #  # ]
                 [ #  # ]
    1027                 :            :     }
    1028                 :          0 : }
    1029                 :            : 
    1030                 :            : /////////////////////////////////////////////////////////////////// Pap
    1031                 :          0 : void Ww1Pap::Start(Ww1Shell& rOut, Ww1Manager& rMan)
    1032                 :            : {
    1033         [ #  # ]:          0 :     if (rMan.Where() >= Where())
    1034                 :            :     {
    1035                 :            :         sal_uInt8* pByte;
    1036                 :            :         sal_uInt16 cb;
    1037                 :            :     // bereitstellen der zu startenden attribute
    1038 [ #  # ][ #  # ]:          0 :         if (FillStart(pByte, cb))
    1039                 :            :         {
    1040         [ #  # ]:          0 :             Ww1SprmPapx aSprm(pByte, cb);
    1041                 :            :         // und ausgeben:
    1042 [ #  # ][ #  # ]:          0 :             aSprm.Start(rOut, rMan);
    1043                 :            :         }
    1044         [ #  # ]:          0 :         (*this)++;
    1045                 :            :     }
    1046                 :          0 : }
    1047                 :            : 
    1048                 :          0 : void Ww1Pap::Stop(Ww1Shell& rOut, Ww1Manager& rMan, sal_Unicode&)
    1049                 :            : {
    1050 [ #  # ][ #  # ]:          0 :     if (rMan.Where() >= Where() || rMan.IsStopAll())
                 [ #  # ]
    1051                 :            :     {
    1052                 :            :         sal_uInt8* pByte;
    1053                 :            :         sal_uInt16 cb;
    1054 [ #  # ][ #  # ]:          0 :         if (FillStop(pByte, cb)){
    1055         [ #  # ]:          0 :             Ww1SprmPapx aSprm(pByte, cb);
    1056 [ #  # ][ #  # ]:          0 :             aSprm.Stop(rOut, rMan);
    1057                 :            :         }else{
    1058                 :            :             OSL_ENSURE( !nPlcIndex || rMan.IsStopAll(), "Pap-Attribut-Stop verloren" );
    1059                 :            :         }
    1060                 :            :     }
    1061                 :          0 : }
    1062                 :            : 
    1063                 :            : //////////////////////////////////////////////////////////////// W1_CHP
    1064                 :            : //
    1065                 :            : // momentan laesst sich die ausgabe von W1CHPxen nicht nur per define
    1066                 :            : // loesen....
    1067                 :            : //
    1068                 :          0 : void W1_CHP::Out(Ww1Shell& rOut, Ww1Manager& rMan)
    1069                 :            : {
    1070         [ #  # ]:          0 :     if (fBoldGet())
    1071                 :            :         rOut << SvxWeightItem(
    1072 [ #  # ][ #  # ]:          0 :             rOut.GetWeightBold()?WEIGHT_NORMAL:WEIGHT_BOLD, RES_CHRATR_WEIGHT);
    1073         [ #  # ]:          0 :     if (fItalicGet())
    1074                 :            :         rOut << SvxPostureItem(
    1075 [ #  # ][ #  # ]:          0 :             rOut.GetPostureItalic()?ITALIC_NONE:ITALIC_NORMAL, RES_CHRATR_POSTURE);
    1076         [ #  # ]:          0 :     if (fStrikeGet())
    1077                 :            :         rOut << SvxCrossedOutItem(
    1078         [ #  # ]:          0 :             rOut.GetCrossedOut()?STRIKEOUT_NONE:STRIKEOUT_SINGLE, RES_CHRATR_CROSSEDOUT);
    1079         [ #  # ]:          0 :     if (fOutlineGet())
    1080         [ #  # ]:          0 :         rOut << SvxContourItem(!rOut.GetContour(), RES_CHRATR_CONTOUR);
    1081         [ #  # ]:          0 :     if (fSmallCapsGet())
    1082                 :            :         rOut << SvxCaseMapItem(
    1083 [ #  # ][ #  # ]:          0 :             rOut.GetCaseKapitaelchen()?SVX_CASEMAP_NOT_MAPPED:SVX_CASEMAP_KAPITAELCHEN, RES_CHRATR_CASEMAP);
    1084         [ #  # ]:          0 :     if (fCapsGet())
    1085                 :            :         rOut << SvxCaseMapItem(
    1086         [ #  # ]:          0 :             rOut.GetCaseVersalien()?SVX_CASEMAP_NOT_MAPPED:SVX_CASEMAP_VERSALIEN, RES_CHRATR_CASEMAP);
    1087         [ #  # ]:          0 :     if (fsHpsGet())
    1088         [ #  # ]:          0 :             rOut << SvxFontHeightItem(hpsGet() * 10, 100, RES_CHRATR_FONTSIZE);
    1089         [ #  # ]:          0 :     if (fsKulGet())
    1090   [ #  #  #  #  :          0 :         switch (kulGet()) {
                      # ]
    1091                 :            :         case 0: {
    1092 [ #  # ][ #  # ]:          0 :                     rOut << SvxUnderlineItem(UNDERLINE_NONE, RES_CHRATR_UNDERLINE) <<
                 [ #  # ]
    1093         [ #  # ]:          0 :                         SvxWordLineModeItem(sal_False, RES_CHRATR_WORDLINEMODE);
    1094                 :          0 :                 } break;
    1095                 :            :         default: OSL_ENSURE(sal_False, "Chpx");
    1096                 :            :         case 1: {
    1097         [ #  # ]:          0 :                     rOut << SvxUnderlineItem(UNDERLINE_SINGLE, RES_CHRATR_UNDERLINE);
    1098                 :          0 :                 } break;
    1099                 :            :         case 2: {
    1100 [ #  # ][ #  # ]:          0 :                     rOut << SvxUnderlineItem(UNDERLINE_SINGLE, RES_CHRATR_UNDERLINE) <<
                 [ #  # ]
    1101         [ #  # ]:          0 :                     SvxWordLineModeItem(sal_True, RES_CHRATR_WORDLINEMODE);
    1102                 :          0 :                 } break;
    1103                 :            :         case 3: {
    1104         [ #  # ]:          0 :                     rOut << SvxUnderlineItem(UNDERLINE_DOUBLE, RES_CHRATR_UNDERLINE);
    1105                 :          0 :                 } break;
    1106                 :            :         case 4: {
    1107         [ #  # ]:          0 :                     rOut << SvxUnderlineItem(UNDERLINE_DOTTED, RES_CHRATR_UNDERLINE);
    1108                 :          0 :                 } break;
    1109                 :            :         }
    1110                 :            : 
    1111         [ #  # ]:          0 :     if (fsIcoGet())
    1112   [ #  #  #  #  :          0 :         switch(icoGet()) {
             #  #  #  #  
                      # ]
    1113                 :            :         default: OSL_ENSURE(sal_False, "Chpx");
    1114                 :          0 :         case 0: { rOut.EndItem(RES_CHRATR_COLOR); } break;
    1115 [ #  # ][ #  # ]:          0 :         case 1: { rOut << SvxColorItem(Color(COL_BLACK), RES_CHRATR_COLOR); } break;
                 [ #  # ]
    1116 [ #  # ][ #  # ]:          0 :         case 2: { rOut << SvxColorItem(Color(COL_LIGHTBLUE), RES_CHRATR_COLOR); } break;
                 [ #  # ]
    1117 [ #  # ][ #  # ]:          0 :         case 3: { rOut << SvxColorItem(Color(COL_LIGHTCYAN), RES_CHRATR_COLOR); } break;
                 [ #  # ]
    1118 [ #  # ][ #  # ]:          0 :         case 4: { rOut << SvxColorItem(Color(COL_LIGHTGREEN), RES_CHRATR_COLOR); } break;
                 [ #  # ]
    1119 [ #  # ][ #  # ]:          0 :         case 5: { rOut << SvxColorItem(Color(COL_LIGHTMAGENTA), RES_CHRATR_COLOR); } break;
                 [ #  # ]
    1120 [ #  # ][ #  # ]:          0 :         case 6: { rOut << SvxColorItem(Color(COL_LIGHTRED), RES_CHRATR_COLOR); } break;
                 [ #  # ]
    1121 [ #  # ][ #  # ]:          0 :         case 7: { rOut << SvxColorItem(Color(COL_YELLOW), RES_CHRATR_COLOR); } break;
                 [ #  # ]
    1122 [ #  # ][ #  # ]:          0 :         case 8: { rOut << SvxColorItem(Color(COL_WHITE), RES_CHRATR_COLOR); } break;
                 [ #  # ]
    1123                 :            :         }
    1124         [ #  # ]:          0 :     if (fsSpaceGet()) {
    1125                 :          0 :         short sQps = qpsSpaceGet();
    1126         [ #  # ]:          0 :         if (sQps > 56)
    1127                 :          0 :             sQps = sQps - 64;
    1128         [ #  # ]:          0 :         rOut << SvxKerningItem(sQps, RES_CHRATR_KERNING);
    1129                 :            :     }
    1130         [ #  # ]:          0 :     if (fsPosGet()) {
    1131         [ #  # ]:          0 :         if (hpsPosGet() == 0)
    1132         [ #  # ]:          0 :             rOut << SvxEscapementItem(SVX_ESCAPEMENT_OFF, 100, RES_CHRATR_ESCAPEMENT);
    1133                 :            :         else {
    1134                 :          0 :             short sHps = hpsPosGet();
    1135         [ #  # ]:          0 :             if (sHps > 128)
    1136                 :          0 :                 sHps =  sHps - 256;
    1137                 :          0 :             sHps *= 100;
    1138                 :          0 :             sHps /= 24;
    1139         [ #  # ]:          0 :             rOut << SvxEscapementItem(sHps, 100, RES_CHRATR_ESCAPEMENT);
    1140                 :            :         }
    1141                 :            :     }
    1142         [ #  # ]:          0 :     if (fsFtcGet()) {
    1143         [ #  # ]:          0 :         SvxFontItem aFont(rMan.GetFont(ftcGet()));
    1144 [ #  # ][ #  # ]:          0 :         rOut << aFont;
    1145                 :            :     }
    1146                 :          0 : }
    1147                 :            : 
    1148                 :            : /////////////////////////////////////////////////////////////////// Chp
    1149                 :          0 : void Ww1Chp::Start(Ww1Shell& rOut, Ww1Manager& rMan)
    1150                 :            : {
    1151         [ #  # ]:          0 :     if (rMan.Where() >= Where())
    1152                 :            :     {
    1153                 :          0 :         W1_CHP aChpx;
    1154 [ #  # ][ #  # ]:          0 :         if (FillStart(aChpx))
    1155                 :            :         {
    1156         [ #  # ]:          0 :             aChpx.Out(rOut, rMan);
    1157         [ #  # ]:          0 :             if (aChpx.fcPicGet())
    1158                 :            :             {
    1159                 :          0 :                 Ww1Picture aPic(rMan.GetFib().GetStream(),
    1160         [ #  # ]:          0 :                  aChpx.fcPicGet());
    1161         [ #  # ]:          0 :                 if (!aPic.GetError())
    1162         [ #  # ]:          0 :                     aPic.Out(rOut, rMan);
    1163                 :            :             }
    1164                 :            :         }
    1165         [ #  # ]:          0 :         (*this)++;
    1166                 :            :     }
    1167                 :          0 : }
    1168                 :            : 
    1169                 :          0 : void Ww1Chp::Stop(Ww1Shell& rOut, Ww1Manager& rMan, sal_Unicode&)
    1170                 :            : {
    1171         [ #  # ]:          0 :     if (rMan.Where() >= Where())
    1172                 :            :     {
    1173                 :          0 :         W1_CHP aChpx;
    1174 [ #  # ][ #  # ]:          0 :         if (FillStop(aChpx))
    1175                 :            :         {
    1176                 :            :         // zuerst alle toggle-flags
    1177         [ #  # ]:          0 :             if (aChpx.fBoldGet())
    1178         [ #  # ]:          0 :                 rOut.EndItem(RES_CHRATR_WEIGHT);
    1179         [ #  # ]:          0 :             if (aChpx.fItalicGet())
    1180         [ #  # ]:          0 :                 rOut.EndItem(RES_CHRATR_POSTURE);
    1181         [ #  # ]:          0 :             if (aChpx.fStrikeGet())
    1182         [ #  # ]:          0 :                 rOut.EndItem(RES_CHRATR_CROSSEDOUT);
    1183         [ #  # ]:          0 :             if (aChpx.fOutlineGet())
    1184         [ #  # ]:          0 :                 rOut.EndItem(RES_CHRATR_CONTOUR);
    1185 [ #  # ][ #  # ]:          0 :             if (aChpx.fSmallCapsGet() || aChpx.fCapsGet())
                 [ #  # ]
    1186         [ #  # ]:          0 :                 rOut.EndItem(RES_CHRATR_CASEMAP);
    1187                 :            :         // dann alle zahl-werte, diese haben flags, wenn sie gesetzt
    1188                 :            :         // sind..................
    1189         [ #  # ]:          0 :             if (aChpx.fsHpsGet())
    1190         [ #  # ]:          0 :                 rOut.EndItem(RES_CHRATR_FONTSIZE);
    1191         [ #  # ]:          0 :             if (aChpx.fsKulGet())
    1192         [ #  # ]:          0 :                 rOut.EndItem(RES_CHRATR_UNDERLINE)
    1193         [ #  # ]:          0 :                     .EndItem(RES_CHRATR_WORDLINEMODE);
    1194         [ #  # ]:          0 :             if (aChpx.fsIcoGet())
    1195         [ #  # ]:          0 :                 rOut.EndItem(RES_CHRATR_COLOR);
    1196         [ #  # ]:          0 :             if (aChpx.fsSpaceGet())
    1197         [ #  # ]:          0 :                 rOut.EndItem(RES_CHRATR_KERNING);
    1198         [ #  # ]:          0 :             if (aChpx.fsPosGet())
    1199         [ #  # ]:          0 :                 rOut.EndItem(RES_CHRATR_ESCAPEMENT);
    1200         [ #  # ]:          0 :             if (aChpx.fsFtcGet())
    1201         [ #  # ]:          0 :                 rOut.EndItem(RES_CHRATR_FONT);
    1202                 :            :         }else{
    1203                 :            :             OSL_ENSURE( !nPlcIndex, "Chp-Attribut-Stop verloren" );
    1204                 :            :         }
    1205                 :            :     }
    1206                 :          0 : }
    1207                 :            : 
    1208                 :            : ///////////////////////////////////////////////////////////////// Style
    1209                 :          0 : void Ww1Style::Out(Ww1Shell& rOut, Ww1Manager& rMan)
    1210                 :            : {
    1211                 :            : // Zuerst Basis, damit Attribute des Basis-Styles erkannt werden
    1212                 :            : // first: Base................................................
    1213         [ #  # ]:          0 :     if(pParent->GetStyle(stcBase).IsUsed() )    // Basis gueltig ?
    1214                 :          0 :         rOut.BaseStyle(stcBase);
    1215                 :            : 
    1216                 :            : // next of all: CHP...............................................
    1217                 :          0 :     aChpx.Out(rOut, rMan);
    1218                 :            : // Last: PAP.......................................................
    1219         [ #  # ]:          0 :     if (pPapx)
    1220                 :          0 :         pPapx->Start(rOut, rMan);
    1221                 :          0 : }
    1222                 :            : 
    1223                 :            : ////////////////////////////////////////////////////////// Ww1PlainText
    1224                 :            : //
    1225                 :            : // die Out() methoden von plaintext fuer den filter geben eine anzahl
    1226                 :            : // zeichen aus auf die shell, einen string oder einen char, wieviel
    1227                 :            : // zeichen ausgegeben werden, bestimmt ulEnd, das das ende bestimmt,
    1228                 :            : // bis zudem ausgegeben wird. ausserdem beenden die methoden die
    1229                 :            : // ausgabe bei kontrollzeichen.
    1230                 :            : // diese sind definiert durch MinChar. alle zeichen mit wert darunter
    1231                 :            : // gelten als kontroll- zeichen. dafuer gibts die methode IsChar, die
    1232                 :            : // zurueckgibt, ob es sich um ein standard zeichen handelt. kommt ein
    1233                 :            : // solches zeichen, wird dieses zeichen zurueckgegeben und die methode
    1234                 :            : // beendet, auch wenn ulEnd noch nicht erreicht wurde. bei nutzung
    1235                 :            : // also beachten, dasz wenn !IsChar(Out(...)) gilt, ulEnd unter
    1236                 :            : // umstaenden nicht erreicht wurde. dann wurde das kontrollzeichen
    1237                 :            : // zwar (weg-)gelesen, jedoch noch nicht ausgegeben.
    1238                 :            : //
    1239                 :          0 : sal_Unicode Ww1PlainText::Out( Ww1Shell& rOut, sal_uLong& ulEnd )
    1240                 :            : {
    1241                 :            : // gibt die zeichen bis ulEnd aus, es sei den es kommen sonderzeichen
    1242                 :            : // die eine bedeutung haben wie absatzende oder seitenumbruch.
    1243         [ #  # ]:          0 :     if (ulEnd > Count())
    1244                 :          0 :         ulEnd = Count();
    1245         [ #  # ]:          0 :     while (ulSeek < ulEnd)
    1246                 :            :     {
    1247                 :          0 :         sal_Unicode c = (*this)[ulSeek];
    1248                 :          0 :         (*this)++;
    1249         [ #  # ]:          0 :         if (Ww1PlainText::IsChar(c))
    1250                 :          0 :             rOut << c;
    1251                 :            :         else
    1252                 :          0 :             return c;
    1253                 :            :     }
    1254                 :          0 :     return Ww1PlainText::MinChar;
    1255                 :            : }
    1256                 :            : 
    1257                 :          0 : sal_Unicode Ww1PlainText::Out( String& rStr, sal_uLong ulEnd )
    1258                 :            : {
    1259                 :            : // wie Out(Shell..., jedoch ausgabe auf einen string
    1260                 :          0 :     rStr.Erase();
    1261         [ #  # ]:          0 :     if (ulEnd > Count())
    1262                 :          0 :         ulEnd = Count();
    1263         [ #  # ]:          0 :     while (ulSeek < ulEnd)
    1264                 :            :     {
    1265                 :          0 :         sal_Unicode c = (*this)[ulSeek];
    1266                 :          0 :         (*this)++;
    1267         [ #  # ]:          0 :         if( Ww1PlainText::IsChar(c) )
    1268                 :          0 :             rStr += c;
    1269                 :            :         else
    1270                 :          0 :             return c;
    1271                 :            :     }
    1272                 :          0 :     return Ww1PlainText::MinChar;
    1273                 :            : }
    1274                 :            : 
    1275                 :            : //
    1276                 :            : // hier eruebrigt sich ulEnd...oder?
    1277                 :            : //
    1278                 :          0 : sal_Unicode Ww1PlainText::Out( sal_Unicode& rRead )
    1279                 :            : {
    1280                 :          0 :     rRead = (*this)[ulSeek];
    1281                 :          0 :     (*this)++;
    1282                 :          0 :     return rRead;
    1283                 :            : }
    1284                 :            : 
    1285                 :            : /////////////////////////////////////////////////////////// Ww1SprmPapx
    1286                 :            : 
    1287                 :          0 : void Ww1SprmPapx::Start(Ww1Shell& rOut, Ww1Manager& rMan)
    1288                 :            : {
    1289         [ #  # ]:          0 :     if( !rMan.IsInStyle() ){        // Innerhalb Style gehts ueber die
    1290                 :            :                                     // normalen Attribute
    1291   [ #  #  #  #  :          0 :         if (!rOut.IsInFly()
             #  #  #  # ]
                 [ #  # ]
    1292                 :          0 :             && !rOut.IsInTable()    // Nicht innerhalb Tabelle!
    1293                 :          0 :             && ( rMan.HasPPc() || rMan.HasPDxaAbs())){ // Fly-Start
    1294                 :          0 :             rOut.BeginFly();        // eAnchor );
    1295                 :            :         }
    1296 [ #  # ][ #  # ]:          0 :         if (!rOut.IsInTable() && rMan.HasInTable())
                 [ #  # ]
    1297                 :            :         {
    1298                 :          0 :             rOut.BeginTable();
    1299                 :            :         }
    1300                 :          0 :         rOut.SetStyle(aPapx.stcGet());
    1301                 :            :     }
    1302                 :          0 :     Ww1Sprm::Start(rOut, rMan);
    1303                 :          0 : }
    1304                 :            : 
    1305                 :          0 : void Ww1SprmPapx::Stop(Ww1Shell& rOut, Ww1Manager& rMan)
    1306                 :            : {
    1307                 :          0 :     Ww1Sprm::Stop(rOut, rMan);
    1308                 :            : 
    1309         [ #  # ]:          0 :     if( !rMan.IsInStyle() )         // Innerhalb Style gehts ueber die
    1310                 :            :     {                               // normalen Attribute
    1311 [ #  # ][ #  # ]:          0 :         if (rOut.IsInTable() &&( rMan.IsStopAll() || !rMan.HasInTable()))
         [ #  # ][ #  # ]
    1312                 :          0 :             rOut.EndTable();
    1313                 :            : 
    1314   [ #  #  #  #  :          0 :         if( rOut.IsInFly() &&
          #  #  #  #  #  
              # ][ #  # ]
    1315                 :          0 :             ( rMan.IsStopAll()
    1316                 :          0 :                 || ( !rMan.HasPPc() && !rMan.HasPDxaAbs()   // Fly-Ende
    1317                 :          0 :                     && !rOut.IsInTable())))     // Nicht innerhalb Tabelle!
    1318                 :          0 :             rOut.EndFly();
    1319                 :            :     }
    1320                 :          0 : }
    1321                 :            : 
    1322                 :            : ///////////////////////////////////////////////////////////////// Fonts
    1323                 :          0 : SvxFontItem Ww1Fonts::GetFont(sal_uInt16 nFCode)
    1324                 :            : {
    1325                 :            : // erzeugen eine fonts im sw-sinne aus den word-strukturen
    1326                 :          0 :     FontFamily eFamily = FAMILY_DONTKNOW;
    1327         [ #  # ]:          0 :     String aName;
    1328                 :          0 :     FontPitch ePitch = PITCH_DONTKNOW;
    1329                 :          0 :     rtl_TextEncoding eCharSet = RTL_TEXTENCODING_DONTKNOW;
    1330   [ #  #  #  # ]:          0 :     switch (nFCode)
    1331                 :            :     {
    1332                 :            : // In the Winword 1.x format, the names of the first three fonts were
    1333                 :            : // omitted from the table and assumed to be "Tms Rmn" (for ftc = 0),
    1334                 :            : // "Symbol", and "Helv"
    1335                 :            :     case 0:
    1336                 :          0 :          eFamily = FAMILY_ROMAN;
    1337         [ #  # ]:          0 :          aName.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "Tms Rmn" ));
    1338                 :          0 :          ePitch = PITCH_VARIABLE;
    1339                 :          0 :          eCharSet = RTL_TEXTENCODING_MS_1252;
    1340                 :          0 :     break;
    1341                 :            :     case 1:
    1342         [ #  # ]:          0 :          aName.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "Symbol" ));
    1343                 :          0 :          ePitch = PITCH_VARIABLE;
    1344                 :          0 :          eCharSet = RTL_TEXTENCODING_SYMBOL;
    1345                 :          0 :     break;
    1346                 :            :     case 2:
    1347                 :          0 :          eFamily = FAMILY_SWISS;
    1348         [ #  # ]:          0 :          aName.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "Helv" ));
    1349                 :          0 :          ePitch = PITCH_VARIABLE;
    1350                 :          0 :          eCharSet = RTL_TEXTENCODING_MS_1252;
    1351                 :          0 :     break;
    1352                 :            :     default:
    1353                 :            :     {
    1354         [ #  # ]:          0 :         W1_FFN* pF = GetFFN(nFCode - 3);
    1355         [ #  # ]:          0 :         if (pF != 0)
    1356                 :            :         {
    1357                 :            :         // Fontname .........................................
    1358                 :          0 :             aName = String( (sal_Char*)pF->szFfnGet(),
    1359 [ #  # ][ #  # ]:          0 :                             RTL_TEXTENCODING_MS_1252 );
                 [ #  # ]
    1360                 :            :         // Pitch .............................................
    1361                 :            :             static FontPitch ePitchA[] =
    1362                 :            :             {
    1363                 :            :                 PITCH_DONTKNOW, PITCH_FIXED, PITCH_VARIABLE, PITCH_DONTKNOW
    1364                 :            :             };
    1365                 :          0 :             ePitch = ePitchA[pF->prgGet()];
    1366                 :            :         // CharSet ...........................................
    1367                 :          0 :             eCharSet = RTL_TEXTENCODING_MS_1252;
    1368 [ #  # ][ #  # ]:          0 :             if (aName.EqualsIgnoreCaseAscii("Symbol")
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1369         [ #  # ]:          0 :              || aName.EqualsIgnoreCaseAscii("Symbol Set")
    1370         [ #  # ]:          0 :              || aName.EqualsIgnoreCaseAscii("Wingdings")
    1371         [ #  # ]:          0 :              || aName.EqualsIgnoreCaseAscii("ITC Zapf Dingbats") )
    1372                 :          0 :                 eCharSet = RTL_TEXTENCODING_SYMBOL;
    1373                 :            :         // FontFamily ........................................
    1374                 :          0 :             sal_uInt16 b = pF->ffGet();
    1375                 :            :             static FontFamily eFamilyA[] =
    1376                 :            :             {
    1377                 :            :                 FAMILY_DONTKNOW, FAMILY_ROMAN, FAMILY_SWISS, FAMILY_MODERN,
    1378                 :            :                 FAMILY_SCRIPT, FAMILY_DECORATIVE
    1379                 :            :             };
    1380         [ #  # ]:          0 :             if (b < (sizeof(eFamilyA)/sizeof(eFamilyA[0])))
    1381                 :          0 :                 eFamily = eFamilyA[b];
    1382                 :            :         }
    1383                 :            :         else
    1384                 :            :         {
    1385                 :            :             OSL_ENSURE(sal_False, "WW1Fonts::GetFont: Nicht existenter Font !");
    1386                 :          0 :             eFamily = FAMILY_SWISS;
    1387         [ #  # ]:          0 :              aName.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "Helv" ));
    1388                 :          0 :             ePitch = PITCH_VARIABLE;
    1389                 :          0 :             eCharSet = RTL_TEXTENCODING_MS_1252;
    1390                 :            :         }
    1391                 :            :     }
    1392                 :          0 :     break;
    1393                 :            :     }
    1394                 :            :             // Extrawurst Hypo
    1395 [ #  # ][ #  # ]:          0 :     if ( SwFltGetFlag( nFieldFlags, SwFltControlStack::HYPO )
         [ #  # ][ #  # ]
    1396         [ #  # ]:          0 :          && ( aName.EqualsIgnoreCaseAscii("Helv")
    1397         [ #  # ]:          0 :             || aName.EqualsIgnoreCaseAscii("Helvetica") ) )
    1398                 :            :     {
    1399         [ #  # ]:          0 :          aName.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "Helvetica Neue" ));
    1400         [ #  # ]:          0 :         if (eFamily==FAMILY_DONTKNOW)
    1401                 :          0 :             eFamily = FAMILY_SWISS;
    1402                 :            :     }
    1403                 :            :     else
    1404                 :            :     {
    1405                 :            :             // VCL matcht die Fonts selber
    1406                 :            :             // allerdings passiert bei Helv, Tms Rmn und System Monospaced
    1407                 :            :             // Scheisse, so dass diese ersetzt werden muessen.
    1408                 :            :             // Nach TH sollen diese durch feste Werte ersetzt werden,
    1409                 :            :             // also nicht ueber System::GetStandardFont, damit keine
    1410                 :            :             // Namenslisten auftauchen ( Dieses koennte den User verwirren )
    1411 [ #  # ][ #  # ]:          0 :         if( aName.EqualsIgnoreCaseAscii("Helv"))
    1412                 :            :         {
    1413         [ #  # ]:          0 :              aName.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "Helvetica" ));
    1414         [ #  # ]:          0 :             if (eFamily==FAMILY_DONTKNOW)
    1415                 :          0 :                 eFamily = FAMILY_SWISS;
    1416                 :            :         }
    1417 [ #  # ][ #  # ]:          0 :         else if (aName.EqualsIgnoreCaseAscii("Tms Rmn"))
    1418                 :            :         {
    1419         [ #  # ]:          0 :              aName.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "Times New Roman" ));
    1420         [ #  # ]:          0 :             if (eFamily==FAMILY_DONTKNOW)
    1421                 :          0 :                 eFamily = FAMILY_ROMAN;
    1422                 :            :         }
    1423 [ #  # ][ #  # ]:          0 :         else if (aName.EqualsIgnoreCaseAscii("System Monospaced") )
    1424                 :            :         {
    1425         [ #  # ]:          0 :              aName.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "Courier" ));
    1426                 :          0 :             ePitch = PITCH_FIXED;
    1427                 :            :         }
    1428                 :            :     }
    1429                 :            : // nun koennen wir den font basteln: .........................
    1430 [ #  # ][ #  # ]:          0 :     return SvxFontItem(eFamily, aName, aEmptyStr, ePitch, eCharSet, RES_CHRATR_FONT);
    1431                 :            : }
    1432                 :            : 
    1433                 :            : /////////////////////////////////////////////////////////////////// Dop
    1434                 :          0 : void Ww1Dop::Out(Ww1Shell& rOut)
    1435                 :            : {
    1436                 :            :     //~ mdt: fehlt
    1437                 :          0 :     long nDefTabSiz = aDop.dxaTabGet();
    1438         [ #  # ]:          0 :     if (nDefTabSiz < 56)
    1439                 :          0 :         nDefTabSiz = 709;
    1440                 :            : 
    1441                 :            :     // wir wollen genau einen DefaultTab
    1442         [ #  # ]:          0 :     SvxTabStopItem aNewTab(1, sal_uInt16(nDefTabSiz), SVX_TAB_ADJUST_DEFAULT, RES_PARATR_TABSTOP);
    1443         [ #  # ]:          0 :     ((SvxTabStop&)aNewTab[0]).GetAdjustment() = SVX_TAB_ADJUST_DEFAULT;
    1444         [ #  # ]:          0 :     rOut.GetDoc().GetAttrPool().SetPoolDefaultItem( aNewTab); //~ mdt: besser (GetDoc)
    1445                 :            : 
    1446                 :          0 :     SwFrmFmt &rFmt = rOut.GetPageDesc().GetMaster();
    1447                 :          0 :     W1_DOP& rDOP = GetDOP();
    1448                 :          0 :     rOut.GetPageDesc().SetLandscape(rDOP.fWideGet());
    1449 [ #  # ][ #  # ]:          0 :     SwFmtFrmSize aSz(rFmt.GetFrmSize());
    1450                 :          0 :     aSz.SetWidth(rDOP.xaPageGet());
    1451                 :          0 :     aSz.SetHeight(rDOP.yaPageGet());
    1452         [ #  # ]:          0 :     rFmt.SetFmtAttr(aSz);
    1453                 :          0 :     SvxLRSpaceItem aLR(rDOP.dxaLeftGet()+rDOP.dxaGutterGet(),
    1454         [ #  # ]:          0 :      rDOP.dxaRightGet(), 0, 0, RES_LR_SPACE);
    1455         [ #  # ]:          0 :     rFmt.SetFmtAttr(aLR);
    1456         [ #  # ]:          0 :     SvxULSpaceItem aUL(rDOP.dyaTopGet(), rDOP.dyaBottomGet(), RES_UL_SPACE);
    1457         [ #  # ]:          0 :     rFmt.SetFmtAttr(aUL);
    1458                 :            : 
    1459         [ #  # ]:          0 :     SwFtnInfo aInfo;
    1460         [ #  # ]:          0 :     aInfo = rOut.GetDoc().GetFtnInfo();     // Copy-Ctor privat
    1461                 :            :                 // wo positioniert ? ( 0 == Section, 1 == Page,
    1462                 :            :                 // 2 == beim Text -> Page, 3 == Doc  )
    1463         [ #  # ]:          0 :     switch( rDOP.fpcGet() ){
    1464                 :            :     case 1:
    1465                 :          0 :     case 2: aInfo.ePos = FTNPOS_PAGE; break;
    1466                 :          0 :     default: aInfo.ePos = FTNPOS_CHAPTER; break;
    1467                 :            :     }
    1468                 :            :     // Da Sw unter Chapter anscheinend was anderes versteht als PMW
    1469                 :            :     // hier also immer Doc !
    1470                 :          0 :     aInfo.eNum = FTNNUM_DOC;
    1471                 :            :                             // wie neu nummerieren ?
    1472                 :            :                             // SW-UI erlaubt Nummer nur bei FTNNUM_DOC
    1473 [ #  # ][ #  # ]:          0 :     if( rDOP.nFtnGet() > 0 && aInfo.eNum == FTNNUM_DOC )
                 [ #  # ]
    1474                 :          0 :         aInfo.nFtnOffset = rDOP.nFtnGet() - 1;
    1475 [ #  # ][ #  # ]:          0 :     rOut.GetDoc().SetFtnInfo( aInfo );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1476                 :            : 
    1477                 :          0 : }
    1478                 :            : 
    1479                 :            : ///////////////////////////////////////////////////////////////// Assoc
    1480                 :          0 : void Ww1Assoc::Out(Ww1Shell& rOut)
    1481                 :            : {
    1482                 :            : //~ mdt: fehlen: FileNext, Dot, DataDoc, HeaderDoc, Criteria1,
    1483                 :            : // Criteria2, Criteria3, Criteria4, Criteria5, Criteria6, Criteria7
    1484                 :          0 :     SwDocShell *pDocShell(rOut.GetDoc().GetDocShell());
    1485                 :            :     OSL_ENSURE(pDocShell, "no SwDocShell");
    1486         [ #  # ]:          0 :     if (pDocShell) {
    1487                 :            :         uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
    1488 [ #  # ][ #  # ]:          0 :             pDocShell->GetModel(), uno::UNO_QUERY_THROW);
    1489                 :            :         uno::Reference<document::XDocumentProperties> xDocProps(
    1490 [ #  # ][ #  # ]:          0 :             xDPS->getDocumentProperties());
    1491                 :            :         OSL_ENSURE(xDocProps.is(), "DocumentProperties is null");
    1492         [ #  # ]:          0 :         if (xDocProps.is()) {
    1493 [ #  # ][ #  # ]:          0 :             xDocProps->setTitle( GetStr(Title) );
         [ #  # ][ #  # ]
                 [ #  # ]
    1494 [ #  # ][ #  # ]:          0 :             xDocProps->setSubject( GetStr(Subject) );
         [ #  # ][ #  # ]
                 [ #  # ]
    1495 [ #  # ][ #  # ]:          0 :             xDocProps->setDescription( GetStr(Comments) );
         [ #  # ][ #  # ]
                 [ #  # ]
    1496         [ #  # ]:          0 :             xDocProps->setKeywords(
    1497 [ #  # ][ #  # ]:          0 :               ::comphelper::string::convertCommaSeparated( GetStr(KeyWords) ) );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1498 [ #  # ][ #  # ]:          0 :             xDocProps->setAuthor( GetStr(Author) );
         [ #  # ][ #  # ]
                 [ #  # ]
    1499 [ #  # ][ #  # ]:          0 :             xDocProps->setModifiedBy( GetStr(LastRevBy) );
         [ #  # ][ #  # ]
                 [ #  # ]
    1500                 :          0 :         }
    1501                 :            :     }
    1502                 :          0 : }
    1503                 :            : 
    1504                 :            : //////////////////////////////////////////////////////////// StyleSheet
    1505                 :          0 : void Ww1StyleSheet::OutDefaults(Ww1Shell& rOut, Ww1Manager& rMan, sal_uInt16 stc)
    1506                 :            : {
    1507   [ #  #  #  #  :          0 :     switch (stc){
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
                   #  # ]
    1508                 :            :     case 222: // Null
    1509         [ #  # ]:          0 :         rOut << SvxFontHeightItem(240, 100, RES_CHRATR_FONTSIZE);
    1510         [ #  # ]:          0 :         rOut << SvxFontItem(rMan.GetFont(2));
    1511                 :          0 :         break;
    1512                 :            :     case 223: // annotation reference
    1513         [ #  # ]:          0 :         rOut << SvxFontHeightItem(160, 100, RES_CHRATR_FONTSIZE);
    1514                 :          0 :         break;
    1515                 :            :     case 224: // annotation text
    1516         [ #  # ]:          0 :         rOut << SvxFontHeightItem(200, 100, RES_CHRATR_FONTSIZE);
    1517                 :          0 :         break;
    1518                 :            :     case 225: // table of contents 8
    1519                 :            :     case 226: // table of contents 7
    1520                 :            :     case 227: // table of contents 6
    1521                 :            :     case 228: // table of contents 5
    1522                 :            :     case 229: // table of contents 4
    1523                 :            :     case 230: // table of contents 3
    1524                 :            :     case 231: // table of contents 2
    1525                 :            :     case 232: // table of contents 1
    1526         [ #  # ]:          0 :         rOut << SvxLRSpaceItem(( 232 - stc ) * 720, 720, 0, 0, RES_LR_SPACE);
    1527                 :            :             // Tabulatoren fehlen noch !
    1528                 :          0 :         break;
    1529                 :            :     case 233: // index 7
    1530                 :            :     case 234: // und index 6
    1531                 :            :     case 235: // und index 5
    1532                 :            :     case 236: // und index 4
    1533                 :            :     case 237: // und index 3
    1534                 :            :     case 238: // und index 2
    1535         [ #  # ]:          0 :         rOut << SvxLRSpaceItem(( 239 - stc ) * 360, 0, 0, 0, RES_LR_SPACE);
    1536                 :          0 :         break;
    1537                 :            :     case 239: // index 1
    1538                 :          0 :         break;
    1539                 :            :     case 240: // line number
    1540                 :          0 :         break;
    1541                 :            :     case 241: // index heading
    1542                 :          0 :         break;
    1543                 :            :     case 242:  // footer
    1544                 :            :     case 243:{ // ... und header
    1545         [ #  # ]:          0 :             SvxTabStopItem aAttr(RES_PARATR_TABSTOP);
    1546         [ #  # ]:          0 :             SvxTabStop aTabStop;
    1547                 :          0 :             aTabStop.GetTabPos() = 4535;  // 8 cm
    1548                 :          0 :             aTabStop.GetAdjustment() = SVX_TAB_ADJUST_CENTER;
    1549         [ #  # ]:          0 :             aAttr.Insert( aTabStop );
    1550                 :          0 :             aTabStop.GetTabPos() = 9071;  // 16 cm
    1551                 :          0 :             aTabStop.GetAdjustment() = SVX_TAB_ADJUST_RIGHT;
    1552         [ #  # ]:          0 :             aAttr.Insert( aTabStop );
    1553 [ #  # ][ #  # ]:          0 :             rOut << aAttr;
    1554                 :            :         }
    1555                 :          0 :         break;
    1556                 :            :     case 244: // footnote reference
    1557         [ #  # ]:          0 :         rOut << SvxFontHeightItem(160, 100, RES_CHRATR_FONTSIZE);
    1558         [ #  # ]:          0 :         rOut << SvxEscapementItem(6 * 100 / 24, 100, RES_CHRATR_ESCAPEMENT);
    1559                 :          0 :         break;
    1560                 :            :     case 245: // footnote text
    1561         [ #  # ]:          0 :         rOut << SvxFontHeightItem(200, 100, RES_CHRATR_FONTSIZE);
    1562                 :          0 :         break;
    1563                 :            :     case 246: // heading 9
    1564                 :            :     case 247: // und heading 8
    1565                 :            :     case 248: // und heading 7
    1566         [ #  # ]:          0 :         rOut << SvxLRSpaceItem(720, 0, 0, 0, RES_LR_SPACE);
    1567                 :            :         rOut << SvxPostureItem(
    1568 [ #  # ][ #  # ]:          0 :                     rOut.GetPostureItalic()?ITALIC_NONE:ITALIC_NORMAL, RES_CHRATR_POSTURE);
    1569         [ #  # ]:          0 :         rOut << SvxFontHeightItem(200, 100, RES_CHRATR_FONTSIZE);
    1570                 :          0 :         break;
    1571                 :            :     case 249: // heading 6
    1572         [ #  # ]:          0 :         rOut << SvxLRSpaceItem(720, 0, 0, 0, RES_LR_SPACE);
    1573         [ #  # ]:          0 :         rOut << SvxUnderlineItem(UNDERLINE_SINGLE, RES_CHRATR_UNDERLINE);
    1574         [ #  # ]:          0 :         rOut << SvxFontHeightItem(200, 100, RES_CHRATR_FONTSIZE);
    1575                 :          0 :         break;
    1576                 :            :     case 250: // heading 5
    1577         [ #  # ]:          0 :         rOut << SvxLRSpaceItem(720, 0, 0, 0, RES_LR_SPACE);
    1578 [ #  # ][ #  # ]:          0 :         rOut << SvxWeightItem(rOut.GetWeightBold()?WEIGHT_NORMAL:WEIGHT_BOLD, RES_CHRATR_WEIGHT);
    1579         [ #  # ]:          0 :         rOut << SvxFontHeightItem(200, 100, RES_CHRATR_FONTSIZE);
    1580                 :          0 :         break;
    1581                 :            :     case 251: // heading 4
    1582         [ #  # ]:          0 :         rOut << SvxLRSpaceItem(360, 0, 0, 0, RES_LR_SPACE);
    1583         [ #  # ]:          0 :         rOut << SvxUnderlineItem(UNDERLINE_SINGLE, RES_CHRATR_UNDERLINE);
    1584         [ #  # ]:          0 :         rOut << SvxFontHeightItem(240, 100, RES_CHRATR_FONTSIZE);
    1585                 :          0 :         break;
    1586                 :            :     case 252: // heading 3
    1587         [ #  # ]:          0 :         rOut << SvxLRSpaceItem(360, 0, 0, 0, RES_LR_SPACE);
    1588 [ #  # ][ #  # ]:          0 :         rOut << SvxWeightItem(rOut.GetWeightBold()?WEIGHT_NORMAL:WEIGHT_BOLD, RES_CHRATR_WEIGHT);
    1589         [ #  # ]:          0 :         rOut << SvxFontHeightItem(240, 100, RES_CHRATR_FONTSIZE);
    1590                 :          0 :         break;
    1591                 :            :     case 253: // heading 2
    1592         [ #  # ]:          0 :         rOut << SvxULSpaceItem(120, 0, RES_UL_SPACE);
    1593 [ #  # ][ #  # ]:          0 :         rOut << SvxWeightItem(rOut.GetWeightBold()?WEIGHT_NORMAL:WEIGHT_BOLD, RES_CHRATR_WEIGHT);
    1594         [ #  # ]:          0 :         rOut << SvxFontHeightItem(240, 100, RES_CHRATR_FONTSIZE);
    1595         [ #  # ]:          0 :         rOut << SvxFontItem(rMan.GetFont(2));
    1596                 :          0 :         break;
    1597                 :            :     case 254: // heading 1
    1598         [ #  # ]:          0 :         rOut << SvxULSpaceItem(240, 0, RES_UL_SPACE);
    1599 [ #  # ][ #  # ]:          0 :         rOut << SvxWeightItem(rOut.GetWeightBold()?WEIGHT_NORMAL:WEIGHT_BOLD, RES_CHRATR_WEIGHT);
    1600         [ #  # ]:          0 :         rOut << SvxUnderlineItem(UNDERLINE_SINGLE, RES_CHRATR_UNDERLINE);
    1601         [ #  # ]:          0 :         rOut << SvxFontHeightItem(240, 100, RES_CHRATR_FONTSIZE);
    1602         [ #  # ]:          0 :         rOut << SvxFontItem(rMan.GetFont(2));
    1603                 :          0 :         break;
    1604                 :            :     case 255: // Normal indent
    1605         [ #  # ]:          0 :         rOut << SvxLRSpaceItem(720, 0, 0, 0, RES_LR_SPACE);
    1606                 :          0 :         break;
    1607                 :            :     case 0: // Normal
    1608         [ #  # ]:          0 :         rOut << SvxFontHeightItem(200, 100, RES_CHRATR_FONTSIZE);
    1609                 :          0 :         break;
    1610                 :            :     default: // selbstdefiniert
    1611         [ #  # ]:          0 :         rOut << SvxFontHeightItem(200, 100, RES_CHRATR_FONTSIZE);
    1612                 :          0 :         break;
    1613                 :            :     }
    1614                 :          0 : }
    1615                 :            : 
    1616                 :          0 : void Ww1StyleSheet::OutOne(Ww1Shell& rOut, Ww1Manager& rMan, sal_uInt16 stc)
    1617                 :            : {
    1618                 :          0 :     const RES_POOL_COLLFMT_TYPE RES_NONE = RES_POOLCOLL_DOC_END;
    1619                 :          0 :     RES_POOL_COLLFMT_TYPE aType = RES_NONE;
    1620                 :            : 
    1621   [ #  #  #  #  :          0 :     switch (stc)
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
                   #  # ]
    1622                 :            :     {
    1623                 :            :     case 222: // Null
    1624                 :          0 :         aType = RES_POOLCOLL_TEXT; break;   //???
    1625                 :            :     case 223: // annotation reference
    1626                 :          0 :         break;
    1627                 :            :     case 224: // annotation text
    1628                 :          0 :         break;
    1629                 :            :     case 225: // table of contents 8
    1630                 :          0 :         aType = RES_POOLCOLL_TOX_CNTNT8; break;
    1631                 :            :     case 226: // table of contents 7
    1632                 :          0 :         aType = RES_POOLCOLL_TOX_CNTNT7; break;
    1633                 :            :     case 227: // table of contents 6
    1634                 :          0 :         aType = RES_POOLCOLL_TOX_CNTNT6; break;
    1635                 :            :     case 228: // table of contents 5
    1636                 :          0 :         aType = RES_POOLCOLL_TOX_CNTNT5; break;
    1637                 :            :     case 229: // table of contents 4
    1638                 :          0 :         aType = RES_POOLCOLL_TOX_CNTNT4; break;
    1639                 :            :     case 230: // table of contents 3
    1640                 :          0 :         aType = RES_POOLCOLL_TOX_CNTNT3; break;
    1641                 :            :     case 231: // table of contents 2
    1642                 :          0 :         aType = RES_POOLCOLL_TOX_CNTNT2; break;
    1643                 :            :     case 232: // table of contents 1
    1644                 :          0 :         aType = RES_POOLCOLL_TOX_CNTNT1; break;
    1645                 :            :     case 233: // index 7
    1646                 :          0 :         break;
    1647                 :            :     case 234: // index 6
    1648                 :          0 :         break;
    1649                 :            :     case 235: // index 5
    1650                 :          0 :         break;
    1651                 :            :     case 236: // index 4
    1652                 :          0 :         break;
    1653                 :            :     case 237: // index 3
    1654                 :          0 :         aType = RES_POOLCOLL_TOX_IDX3; break;
    1655                 :            :     case 238: // index 2
    1656                 :          0 :         aType = RES_POOLCOLL_TOX_IDX2; break;
    1657                 :            :     case 239: // index 1
    1658                 :          0 :         aType = RES_POOLCOLL_TOX_IDX1; break;
    1659                 :            :     case 240: // line number
    1660                 :          0 :         break;
    1661                 :            :     case 241: // index heading
    1662                 :          0 :         break;
    1663                 :            :     case 242: // footer
    1664                 :          0 :         aType = RES_POOLCOLL_FOOTER; break;
    1665                 :            :     case 243: // header
    1666                 :          0 :         aType = RES_POOLCOLL_HEADER; break;
    1667                 :            :     case 244: // footnote reference
    1668                 :          0 :         break;
    1669                 :            :     case 245: // footnote text
    1670                 :          0 :         aType = RES_POOLCOLL_FOOTNOTE; break;
    1671                 :            :     case 246: // heading 9
    1672                 :          0 :         break;
    1673                 :            :     case 247: // heading 8
    1674                 :          0 :         break;
    1675                 :            :     case 248: // heading 7
    1676                 :          0 :         break;
    1677                 :            :     case 249: // heading 6
    1678                 :          0 :         break;
    1679                 :            :     case 250: // heading 5
    1680                 :          0 :         aType = RES_POOLCOLL_HEADLINE5; break;
    1681                 :            :     case 251: // heading 4
    1682                 :          0 :         aType = RES_POOLCOLL_HEADLINE4; break;
    1683                 :            :     case 252: // heading 3
    1684                 :          0 :         aType = RES_POOLCOLL_HEADLINE3; break;
    1685                 :            :     case 253: // heading 2
    1686                 :          0 :         aType = RES_POOLCOLL_HEADLINE2; break;
    1687                 :            :     case 254: // heading 1
    1688                 :          0 :         aType = RES_POOLCOLL_HEADLINE1; break;
    1689                 :            :     case 255: // Normal indent
    1690                 :          0 :         aType = RES_POOLCOLL_TEXT_IDENT; break;
    1691                 :            :     case 0: // Normal
    1692                 :          0 :         aType = RES_POOLCOLL_STANDARD; break;
    1693                 :            :     }
    1694         [ #  # ]:          0 :     if (aType == RES_NONE)
    1695                 :          0 :         rOut.BeginStyle(stc, GetStyle(stc).GetName() );
    1696                 :            :     else
    1697                 :          0 :         rOut.BeginStyle(stc, aType);
    1698                 :          0 :     OutDefaults(rOut, rMan, stc);
    1699                 :          0 :     GetStyle(stc).Out(rOut, rMan);
    1700                 :          0 :     rOut.EndStyle();
    1701                 :          0 : }
    1702                 :            : // OutOneWithBase() liest einen Style mit OutOne() einen Style ein
    1703                 :            : // Jedoch liest er, wenn noch nicht geschehen, den Basisstyle rekursiv ein
    1704                 :          0 : void Ww1StyleSheet::OutOneWithBase(Ww1Shell& rOut, Ww1Manager& rMan,
    1705                 :            :                                    sal_uInt16 stc, sal_uInt8* pbStopRecur )
    1706                 :            : {
    1707                 :            : // SH: lineares Einlesen ist Scheisse, da dann BasedOn nicht gesetzt
    1708                 :            : // werden kann und ausserdem Toggle- und Modify-Attrs (z.B. Tabs ) nicht gehen.
    1709                 :            : 
    1710                 :          0 :     Ww1Style& rSty = GetStyle(stc);
    1711                 :          0 :     sal_uInt16 nBase = rSty.GetnBase();
    1712 [ #  # ][ #  # ]:          0 :     if( nBase != stc
           [ #  #  #  #  
                   #  # ]
    1713                 :          0 :         && !rOut.IsStyleImported( nBase )
    1714                 :          0 :         && GetStyle(nBase).IsUsed()
    1715                 :          0 :         && !pbStopRecur[nBase] ){
    1716                 :            : 
    1717                 :          0 :         pbStopRecur[nBase] = 1;
    1718                 :          0 :         OutOneWithBase( rOut, rMan, nBase, pbStopRecur ); // Rekursiv
    1719                 :            :     }
    1720                 :          0 :     OutOne( rOut, rMan, stc );
    1721                 :          0 : }
    1722                 :            : 
    1723                 :          0 : void Ww1StyleSheet::Out(Ww1Shell& rOut, Ww1Manager& rMan)
    1724                 :            : {
    1725                 :            :     sal_uInt16 stc;
    1726                 :            :     sal_uInt8 bStopRecur[256];
    1727                 :          0 :     memset( bStopRecur, sal_False, sizeof(bStopRecur) );
    1728                 :            : 
    1729                 :            : // 1. Durchlauf: Styles mit Basisstyles rekursiv
    1730         [ #  # ]:          0 :     for (stc=0;stc<Count();stc++)
    1731 [ #  # ][ #  # ]:          0 :         if (GetStyle(stc).IsUsed() && !rOut.IsStyleImported( stc ) )
                 [ #  # ]
    1732         [ #  # ]:          0 :             OutOneWithBase( rOut, rMan, stc, bStopRecur );
    1733                 :            : 
    1734                 :            : // 2. Durchlauf: Follow-Styles
    1735         [ #  # ]:          0 :     for (stc=0;stc<Count();stc++){
    1736                 :          0 :         Ww1Style& rSty = GetStyle(stc);
    1737         [ #  # ]:          0 :         if ( rSty.IsUsed() ){
    1738                 :          0 :             sal_uInt16 nNext = rSty.GetnNext();
    1739 [ #  # ][ #  # ]:          0 :             if( nNext != stc && GetStyle(nNext).IsUsed() )
                 [ #  # ]
    1740         [ #  # ]:          0 :                 rOut.NextStyle( stc, nNext );
    1741                 :            :         }
    1742                 :            :     }
    1743                 :          0 : }
    1744                 :            : 
    1745                 :            : ////////////////////////////////////////////////////////////// Picture
    1746                 :          0 : static sal_uLong GuessPicSize(W1_PIC* pPic)
    1747                 :            : {
    1748                 :          0 :     sal_uInt16 maxx = pPic->mfp.xExtGet();
    1749                 :          0 :     sal_uInt16 padx = ((maxx + 7) / 8) * 8;
    1750                 :          0 :     sal_uInt16 maxy = pPic->mfp.yExtGet();
    1751                 :          0 :     return 120L + (sal_uLong)padx * maxy;
    1752                 :            : }
    1753                 :            : 
    1754                 :            : //
    1755                 :            : // folgende methode schreibt eine windows-.BMP-datei aus einem
    1756                 :            : // embeddeten bild in ww-1 dateien
    1757                 :            : // gelesen wird 4-bit format, geschrieben jedoch 8-bit.
    1758                 :            : //
    1759                 :          0 : void Ww1Picture::WriteBmp(SvStream& rOut)
    1760                 :            : {
    1761                 :          0 :     long nSize = pPic->lcbGet() - (sizeof(*pPic)-sizeof(pPic->rgb));
    1762                 :          0 :     sal_uInt8* p = pPic->rgbGet();
    1763                 :          0 :     sal_uInt16 maxx = pPic->mfp.xExtGet();
    1764                 :          0 :     sal_uInt16 padx = ((maxx + 7) / 8) * 8;
    1765                 :          0 :     sal_uInt16 maxy = pPic->mfp.yExtGet();
    1766                 :            : 
    1767                 :          0 :      p+= sizeof(SVBT16); nSize -= sizeof(SVBT16);
    1768                 :          0 :      p+= sizeof(SVBT16); nSize -= sizeof(SVBT16);
    1769                 :            : #if OSL_DEBUG_LEVEL > 0
    1770                 :            :     sal_uInt16 x = SVBT16ToShort(p);
    1771                 :            :     (void) x;
    1772                 :            : #endif
    1773                 :          0 :     p+= sizeof(SVBT16); nSize -= sizeof(SVBT16);
    1774                 :            : #if OSL_DEBUG_LEVEL > 0
    1775                 :            :     sal_uInt16 y = SVBT16ToShort(p);
    1776                 :            :     (void) y;
    1777                 :            : #endif
    1778                 :          0 :     p+= sizeof(SVBT16); nSize -= sizeof(SVBT16);
    1779                 :            : #if OSL_DEBUG_LEVEL > 0
    1780                 :            :     sal_uInt16 planes = SVBT16ToShort(p);
    1781                 :            :     (void) planes;
    1782                 :            : #endif
    1783                 :          0 :     p+= sizeof(SVBT16); nSize -= sizeof(SVBT16);
    1784                 :            : #if OSL_DEBUG_LEVEL > 0
    1785                 :            :     sal_uInt16 bitcount = SVBT16ToShort(p);
    1786                 :            :     (void) bitcount;
    1787                 :            : #endif
    1788                 :          0 :     p+= sizeof(SVBT16); nSize -= sizeof(SVBT16);
    1789                 :            : 
    1790                 :            : #if OSL_DEBUG_LEVEL > 0
    1791                 :            :     OSL_ENSURE(x==maxx, "Ww1Picture");
    1792                 :            :     OSL_ENSURE(y==maxy, "Ww1Picture");
    1793                 :            :     OSL_ENSURE(planes==1, "Ww1Picture");
    1794                 :            :     OSL_ENSURE(bitcount==4, "Ww1Picture");
    1795                 :            : #endif
    1796                 :            : 
    1797                 :            :     OSL_ENSURE(16*3+padx*maxy/2==nSize, "Ww1Picture");
    1798                 :            : 
    1799                 :            :     SVBT32 tmpLong;
    1800                 :            :     SVBT16 tmpShort;
    1801                 :            :     SVBT8 tmpByte;
    1802                 :            : #define wLong(n) \
    1803                 :            :     UInt32ToSVBT32(n, tmpLong); \
    1804                 :            :     if ((rOut.Write(tmpLong, sizeof(SVBT32))) != sizeof(SVBT32)) goto error;
    1805                 :            : #define wShort(n) \
    1806                 :            :     ShortToSVBT16(n, tmpShort); \
    1807                 :            :     if ((rOut.Write(tmpShort, sizeof(SVBT16))) != sizeof(SVBT16)) goto error;
    1808                 :            : #define wByte(n) \
    1809                 :            :     ByteToSVBT8(n, tmpByte); \
    1810                 :            :     if ((rOut.Write(tmpByte, sizeof(SVBT8))) != sizeof(SVBT8)) goto error;
    1811 [ #  # ][ #  # ]:          0 :     wByte('B'); wByte('M');
         [ #  # ][ #  # ]
    1812 [ #  # ][ #  # ]:          0 :     wLong(54 + 4 * 16 + padx * maxy);
    1813 [ #  # ][ #  # ]:          0 :     wLong(0);
    1814 [ #  # ][ #  # ]:          0 :     wLong(54 + 4 * 16);
    1815 [ #  # ][ #  # ]:          0 :     wLong(40);
    1816 [ #  # ][ #  # ]:          0 :     wLong(maxx);
    1817 [ #  # ][ #  # ]:          0 :     wLong(maxy);
    1818 [ #  # ][ #  # ]:          0 :     wShort(1);
    1819 [ #  # ][ #  # ]:          0 :     wShort(8);
    1820 [ #  # ][ #  # ]:          0 :     wLong(0);
    1821 [ #  # ][ #  # ]:          0 :     wLong(0);
    1822 [ #  # ][ #  # ]:          0 :     wLong(0);
    1823 [ #  # ][ #  # ]:          0 :     wLong(0);
    1824 [ #  # ][ #  # ]:          0 :     wLong(16);
    1825 [ #  # ][ #  # ]:          0 :     wLong(16);
    1826                 :            :     sal_uInt16 i;
    1827 [ #  # ][ #  # ]:          0 :     for (i=0;nSize>0&&i<16;i++)
                 [ #  # ]
    1828                 :            :     {
    1829 [ #  # ][ #  # ]:          0 :         wByte(*p);
    1830                 :          0 :         p++;
    1831                 :          0 :         nSize -= sizeof(sal_uInt8);
    1832 [ #  # ][ #  # ]:          0 :         wByte(*p);
    1833                 :          0 :         p++;
    1834                 :          0 :         nSize -= sizeof(sal_uInt8);
    1835 [ #  # ][ #  # ]:          0 :         wByte(*p);
    1836                 :          0 :         p++;
    1837                 :          0 :         nSize -= sizeof(sal_uInt8);
    1838 [ #  # ][ #  # ]:          0 :         wByte(0);
    1839                 :            :     }
    1840                 :            :     OSL_ENSURE(padx*maxy/2==nSize, "Ww1Picture");
    1841                 :            :     sal_uInt16 j;
    1842                 :            :     {
    1843         [ #  # ]:          0 :         sal_uInt8* pBuf = new sal_uInt8[padx];
    1844 [ #  # ][ #  # ]:          0 :         for (j=0;nSize>0&&j<maxy;j++)
                 [ #  # ]
    1845                 :            :         {
    1846                 :          0 :             sal_uInt8* q = pBuf;
    1847 [ #  # ][ #  # ]:          0 :             for (i=0;nSize>0&&i<maxx;i+=2)
                 [ #  # ]
    1848                 :            :             {
    1849                 :          0 :                 *q++ = *p>>4;
    1850                 :          0 :                 *q++ = *p&0xf;
    1851                 :          0 :                 p++;
    1852                 :          0 :                 nSize -= sizeof(sal_uInt8);
    1853                 :            :             }
    1854         [ #  # ]:          0 :             for (;i<padx;i+=2)
    1855                 :            :             {
    1856                 :          0 :                 *q++ = 0;
    1857                 :          0 :                 p++;
    1858                 :          0 :                 nSize -= sizeof(sal_uInt8);
    1859                 :            :             }
    1860 [ #  # ][ #  # ]:          0 :             if(rOut.Write(pBuf, padx) != padx){
    1861         [ #  # ]:          0 :                 delete [] pBuf;
    1862                 :          0 :                 goto error;
    1863                 :            :             }
    1864                 :            :         }
    1865         [ #  # ]:          0 :         delete [] pBuf;
    1866                 :            :     }
    1867                 :            :     OSL_ENSURE(nSize==0, "Ww1Picture");
    1868                 :            : #undef wLong
    1869                 :            : #undef wShort
    1870                 :            : #undef wByte
    1871         [ #  # ]:          0 :     rOut.Seek(0);
    1872                 :          0 :     return;
    1873                 :            : error:
    1874                 :            :     ;
    1875                 :            : }
    1876                 :            : 
    1877                 :          0 : void Ww1Picture::Out(Ww1Shell& rOut, Ww1Manager& /*rMan*/)
    1878                 :            : {
    1879                 :          0 :     Graphic* pGraphic = 0;
    1880                 :            :     sal_uInt16 mm;
    1881   [ #  #  #  # ]:          0 :     switch (mm = pPic->mfp.mmGet())
    1882                 :            :     {
    1883                 :            :     case 8: // embedded metafile
    1884                 :            :     {
    1885         [ #  # ]:          0 :         SvMemoryStream aOut(8192, 8192);
    1886                 :          0 :         aOut.Write(pPic->rgbGet(), pPic->lcbGet() -
    1887         [ #  # ]:          0 :          (sizeof(*pPic)-sizeof(pPic->rgb)));
    1888         [ #  # ]:          0 :         aOut.Seek(0);
    1889         [ #  # ]:          0 :         GDIMetaFile aWMF;
    1890 [ #  # ][ #  # ]:          0 :         if (ReadWindowMetafile( aOut, aWMF, NULL ) && aWMF.GetActionSize() > 0)
         [ #  # ][ #  # ]
                 [ #  # ]
    1891                 :            :         {
    1892 [ #  # ][ #  # ]:          0 :             aWMF.SetPrefMapMode(MapMode(MAP_100TH_MM));
                 [ #  # ]
    1893                 :          0 :             Size aOldSiz(aWMF.GetPrefSize());
    1894                 :          0 :             Size aNewSiz(pPic->mfp.xExtGet(), pPic->mfp.yExtGet());
    1895         [ #  # ]:          0 :             Fraction aFracX(aNewSiz.Width(), aOldSiz.Width());
    1896         [ #  # ]:          0 :             Fraction aFracY(aNewSiz.Height(), aOldSiz.Height());
    1897         [ #  # ]:          0 :             aWMF.Scale(aFracX, aFracY);
    1898                 :          0 :             aWMF.SetPrefSize(aNewSiz);
    1899 [ #  # ][ #  # ]:          0 :             pGraphic = new Graphic(aWMF);
    1900                 :            :         }
    1901 [ #  # ][ #  # ]:          0 :         break;
    1902                 :            :     }
    1903                 :            :     case 94: // embedded name SH:??? Was denn nun ? Embeddet oder Name ?
    1904                 :            :     case 98: // TIFF-Name
    1905                 :            :     {
    1906                 :          0 :         String aDir( (sal_Char*)pPic->rgbGet(),
    1907                 :          0 :                 (sal_uInt16)(pPic->lcbGet() - (sizeof(*pPic)-sizeof(pPic->rgb))),
    1908         [ #  # ]:          0 :                 RTL_TEXTENCODING_MS_1252 );
    1909                 :            : 
    1910 [ #  # ][ #  # ]:          0 :         rOut.AddGraphic( aDir );
    1911                 :            :     }
    1912                 :          0 :     break;
    1913                 :            :     case 97: // embedded bitmap
    1914                 :            :     {
    1915                 :          0 :         sal_uLong nSiz = GuessPicSize(pPic);
    1916         [ #  # ]:          0 :         SvMemoryStream aOut(nSiz, 8192);
    1917         [ #  # ]:          0 :         WriteBmp(aOut);
    1918         [ #  # ]:          0 :         Bitmap aBmp;
    1919         [ #  # ]:          0 :         aOut >> aBmp;
    1920 [ #  # ][ #  # ]:          0 :         pGraphic = new Graphic(aBmp);
         [ #  # ][ #  # ]
    1921                 :            :     }
    1922                 :            :     default:
    1923                 :            :         OSL_ENSURE(pPic->mfp.mmGet() == 97, "Ww1Picture");
    1924                 :            :     }
    1925         [ #  # ]:          0 :     if (pGraphic)
    1926                 :          0 :         rOut << *pGraphic;
    1927                 :          0 : }
    1928                 :            : 
    1929                 :            : ////////////////////////////////////////////////////////// HeaderFooter
    1930                 :          0 : void Ww1HeaderFooter::Start(Ww1Shell& rOut, Ww1Manager& rMan)
    1931                 :            : {
    1932                 :            : // wird sowieso nur bei SEPs aufgerufen, keine weitere pruefung
    1933                 :            : // noetig:
    1934         [ #  # ]:          0 :     if (!rMan.Pushed())
    1935                 :            :     {
    1936         [ #  # ]:          0 :         while ((*this)++)
    1937   [ #  #  #  #  :          0 :             switch (eHeaderFooterMode)
             #  #  #  #  
                      # ]
    1938                 :            :             {
    1939                 :            :             case FtnSep:
    1940                 :          0 :             break;
    1941                 :            :             case FtnFollowSep:
    1942                 :          0 :             break;
    1943                 :            :             case FtnNote:
    1944                 :          0 :             break;
    1945                 :            :             case EvenHeadL:
    1946                 :          0 :             break;
    1947                 :            :             case OddHeadL:
    1948                 :            :             {
    1949                 :          0 :                 sal_uLong begin = 0;
    1950                 :          0 :                 sal_uLong end = 0;
    1951 [ #  # ][ #  # ]:          0 :                 if (FillOddHeadL(begin, end))
    1952                 :            :                 {
    1953 [ #  # ][ #  # ]:          0 :                     Ww1HddText* pText = new Ww1HddText(rMan.GetFib());
    1954                 :          0 :                     pText->Seek(begin);
    1955                 :          0 :                     pText->SetCount(end-begin);
    1956         [ #  # ]:          0 :                     rOut.BeginHeader();
    1957                 :          0 :                     rMan.Push1(pText, pText->Offset(rMan.GetFib()), begin,
    1958         [ #  # ]:          0 :                      new Ww1HeaderFooterFields(rMan.GetFib()));
           [ #  #  #  # ]
    1959         [ #  # ]:          0 :                     rOut << rMan;
    1960         [ #  # ]:          0 :                     rMan.Pop();
    1961         [ #  # ]:          0 :                     rOut.EndHeaderFooter();
    1962                 :            :                     return;
    1963                 :            :                 }
    1964                 :            :             }
    1965                 :          0 :             break;
    1966                 :            :             case EvenFootL:
    1967                 :          0 :             break;
    1968                 :            :             case OddFootL:
    1969                 :            :             {
    1970                 :          0 :                 sal_uLong begin = 0;
    1971                 :          0 :                 sal_uLong end = 0;
    1972 [ #  # ][ #  # ]:          0 :                 if (FillOddFootL(begin, end))
    1973                 :            :                 {
    1974 [ #  # ][ #  # ]:          0 :                     Ww1HddText* pText = new Ww1HddText(rMan.GetFib());
    1975                 :          0 :                     pText->Seek(begin);
    1976                 :          0 :                     pText->SetCount(end-begin);
    1977         [ #  # ]:          0 :                     rOut.BeginFooter();
    1978                 :          0 :                     rMan.Push1(pText, pText->Offset(rMan.GetFib()), begin,
    1979         [ #  # ]:          0 :                      new Ww1HeaderFooterFields(rMan.GetFib()));
           [ #  #  #  # ]
    1980         [ #  # ]:          0 :                     rOut << rMan;
    1981         [ #  # ]:          0 :                     rMan.Pop();
    1982         [ #  # ]:          0 :                     rOut.EndHeaderFooter();
    1983                 :            :                     return;
    1984                 :            :                 }
    1985                 :            :             }
    1986                 :          0 :             break;
    1987                 :            :             case FirstHeadL:
    1988                 :          0 :             break;
    1989                 :            :             default:
    1990                 :          0 :             break;
    1991                 :            :             }
    1992                 :            :     }
    1993                 :            : }
    1994                 :            : 
    1995                 :          0 : void Ww1HeaderFooter::Stop(Ww1Shell& rOut, Ww1Manager& rMan, sal_Unicode&)
    1996                 :            : {
    1997 [ #  # ][ #  # ]:          0 :     if (!rMan.Pushed() && eHeaderFooterMode != None)
                 [ #  # ]
    1998                 :            :     {
    1999                 :          0 :         Start(rOut, rMan);
    2000                 :            :     }
    2001                 :          0 : }
    2002                 :            : 
    2003                 :            : 
    2004                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10