1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_sw.hxx"
30 #include <hintids.hxx>
32 #include <tools/solar.h>
33 #include <comphelper/string.hxx>
34 #include <editeng/paperinf.hxx>
35 #include <svtools/filter.hxx>
36 #ifndef _GRAPH_HXX //autogen
37 #include <vcl/graph.hxx>
39 #include <editeng/fontitem.hxx>
40 #include <editeng/lrspitem.hxx>
41 #include <editeng/ulspitem.hxx>
42 #include <editeng/wghtitem.hxx>
43 #include <editeng/postitem.hxx>
44 #include <editeng/crsditem.hxx>
45 #ifndef _SVX_CNTRITEM_HXX //autogen
46 #include <editeng/cntritem.hxx>
48 #include <editeng/cmapitem.hxx>
49 #include <editeng/fhgtitem.hxx>
50 #include <editeng/udlnitem.hxx>
51 #include <editeng/wrlmitem.hxx>
52 #include <editeng/colritem.hxx>
53 #include <editeng/kernitem.hxx>
54 #include <editeng/escpitem.hxx>
55 #ifndef _SVX_TSTPITEM_HXX //autogen
56 #include <editeng/tstpitem.hxx>
58 #include <svl/urihelper.hxx>
59 #include <fmtfsize.hxx>
63 #include <pagedesc.hxx>
67 #include <docufld.hxx>
68 #include <ftninfo.hxx>
69 #include <section.hxx> // class SwSection
77 #include <statstr.hrc>
79 #if OSL_DEBUG_LEVEL > 1
83 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
84 #include <com/sun/star/document/XDocumentProperties.hpp>
86 #define MAX_FIELDLEN 64000
88 using namespace nsSwDocInfoSubType
;
91 ///////////////////////////////////////////////////////////////////////
93 // hier stehen die methoden operator<<, Out, Start und Stop mit
94 // folgender Bedeutung: wenn moeglich wird die information aus dem
97 // in die shell uebertragen. sind jedoch weitere parameter noetig
100 // gewaehlt. ist ein bereich zu kennzeichnen (zB bei attributen
101 // von/bis), heissen die methoden
103 // alle diese methoden stehen in diesem modul, das fuer den filter,
104 // jedoch nicht fuer den dumper noetig ist. und da alle regeln ihre
105 // ausnahme haben: hier stehen auch methoden, die aus anderen gruenden
106 // fuer den dumper sinnlos sind, zB wenn sie auf sv-strukturen beruhen
107 // wie zB GetFont() auf SvxFontItem.
110 /////////////////////////////////////////////////////////////// Manager
111 Ww1Shell
& operator <<(Ww1Shell
& rOut
, Ww1Manager
& This
)
113 // verhindern, das bei rekusivem aufruf dies mehrfach passiert:
116 { // der wird nur temporaer gebraucht:
117 This
.SetInStyle( TRUE
);
118 Ww1StyleSheet(This
.aFib
).Out(rOut
, This
);
119 This
.SetInStyle( FALSE
);
122 Ww1Assoc(This
.aFib
).Out(rOut
);
124 // dieser nicht, der ist bereits member:
126 // Jetzt entscheiden, wie Seitenvorlagen erzeugt werden
127 if (This
.GetSep().Count() <= 1)
128 rOut
.SetUseStdPageDesc();
130 // und jetzt das eigentliche dok:
131 sal_Unicode cUnknown
= ' ';
132 while (*This
.pSeek
< This
.pDoc
->Count())
134 // ausgabe des ProgressState nur, wenn im haupttext, da sonst
135 // nicht bestimmt werden kann, wie weit wir sind:
137 ::SetProgressState(This
.Where() * 100 / This
.pDoc
->Count(),
138 rOut
.GetDoc().GetDocShell());
139 // hier werden abwechselnd die attribute und die zeichen in die
140 // shell gepumpt. die positionen werden durch das lesen der
141 // zeichen aus dem manager hoch- gezaehlt. erst alle attribute:
142 This
.Out(rOut
, cUnknown
);
143 // das textdocument pDoc ist ein Ww1PlainText, dessen Out()
144 // methode solange ausgibt, bis entweder ein sonderzeichen
145 // auftaucht oder die anzahl der auszugebenden zeichen erreicht
147 cUnknown
= This
.pDoc
->Out(rOut
, *This
.pSeek
);
149 This
.SetStopAll(TRUE
);
150 This
.OutStop(rOut
, cUnknown
); // Damit die Attribute am Ende geschlossen
151 This
.SetStopAll(FALSE
); // werden
155 void Ww1Manager::OutStop(Ww1Shell
& rOut
, sal_Unicode cUnknown
)
157 // Bookmarks brauchen nicht beendet werden ???
159 pFld
->Stop(rOut
, *this, cUnknown
);
161 aFtn
.Stop(rOut
, *this, cUnknown
);
163 aChp
.Stop(rOut
, *this, cUnknown
);
165 aPap
.Stop(rOut
, *this, cUnknown
);
167 aSep
.Stop(rOut
, *this, cUnknown
);
170 void Ww1Manager::OutStart( Ww1Shell
& rOut
)
172 // alle attribute, die's brauchen beginnen
174 aSep
.Start(rOut
, *this);
176 aPap
.Start(rOut
, *this);
178 aChp
.Start(rOut
, *this);
180 aFtn
.Start(rOut
, *this);
182 pFld
->Start(rOut
, *this);
184 aBooks
.Start(rOut
, *this);
185 // bestimmen, wo das naechste Ereigniss ist:
186 ULONG ulEnd
= pDoc
->Count(); // spaetestens am textende
188 if (ulEnd
> aSep
.Where()) // naechster Sep vorher?
189 ulEnd
= aSep
.Where();
191 if (ulEnd
> aPap
.Where()) // naechster Pap vorher?
192 ulEnd
= aPap
.Where();
194 if (ulEnd
> aChp
.Where()) // naechster Chp vorher?
195 ulEnd
= aChp
.Where();
197 if (ulEnd
> aFtn
.Where()) // naechster Ftn vorher?
198 ulEnd
= aFtn
.Where();
200 if (ulEnd
> pFld
->Where()) // naechster Fld vorher?
201 ulEnd
= pFld
->Where();
203 if (ulEnd
> aBooks
.Where()) // naechster Bookmark vorher?
204 ulEnd
= aBooks
.Where();
205 *pSeek
= Where(); // momentane position
206 if (*pSeek
< ulEnd
) // sind wir bereits weiter?
210 void Ww1Manager::Out(Ww1Shell
& rOut
, sal_Unicode cUnknown
)
212 // Je nach modus wird hier mit feldern, fusznoten, zeichenattributen,
213 // absatzatributen und sektionen wie folgt verfahren: von allen wird
214 // zuallererst die stop-methoden gerufen. stellt das objekt fest, dasz
215 // etwas zu beenden ist (natuerlich nicht im ersten durchgang) beendet
216 // es dies, ansonsten ist der aufruf wirkungslos. dann werden
217 // unbehandelte sonderzeichen augegeben. das werden genauso alle
218 // start-methoden gerufen und danach per where festgestellt, an
219 // welcher stelle die naechste aktion zu erwarten ist.
221 // ist der manager in einem ge'push'ten mode, werden bestimmte
222 // elemente ausgeklammert. felder werden wiederum nur in besonderen
223 // faellen augeklammert, wenn naemlich bereiche ausgegeben werden, die
224 // keine felder enthalten koennen. charakterattribute und
225 // paragraphenattribute werden jedoch nie ausgeklammert. die if (1)
226 // wurden zur verdeutlichung der einheitlichkeit eingefuegt.
228 // Erstmal eine Sonderbehandlung fuer Tabellen:
229 // die wichtigen Attribute lassen sich am Besten vor Beendigung derselben
231 // Optimierung: Sie werden nur auf sinnvolle Werte gesetzt, wenn
232 // das 0x07-Zeiche ansteht.
234 BOOL bLIsTtp
= FALSE
;
235 BOOL bLHasTtp
= FALSE
;
236 if( cUnknown
== 0x07 )
242 OutStop( rOut
, cUnknown
); // Attrs ggfs. beenden
244 // meta-zeichen interpretieren:
245 if (!Ww1PlainText::IsChar(cUnknown
))
252 if (rOut
.IsInTable() && HasInTable() && !bLIsTtp
&& !bLHasTtp
)
253 rOut
.NextTableCell();
258 case 0x0a: // linefeed
259 rOut
.NextParagraph();
261 case 0x0b: // linebreak
262 if (rOut
.IsInTable())
263 // rOut.NextBand(); // war Stuss
268 case 0x0d: // carriage return
271 case 0x0c: // pagebreak
274 case 0x14: // sectionendchar
281 OutStart( rOut
); // Attrs ggfs. starten und Naechste Pos berechnen
284 SvxFontItem
Ww1Manager::GetFont(USHORT nFCode
)
286 return aFonts
.GetFont(nFCode
);
289 void Ww1Manager::Push0(Ww1PlainText
* _pDoc
, ULONG ulSeek
, Ww1Fields
* _pFld
)
291 DBG_ASSERT(!Pushed(), "Ww1Manager");
294 *pSeek
= pDoc
->Where();
300 // ulSeek ist der FC-Abstand zwischen Hauptest-Start und Sondertext-Start
301 // ulSeek2 ist der Offset dieses bestimmten Sondertextes im Sondertext-Bereich,
302 // also z.B. der Offset des speziellen K/F-Textes
303 void Ww1Manager::Push1(Ww1PlainText
* _pDoc
, ULONG ulSeek
, ULONG ulSeek2
,
306 DBG_ASSERT(!Pushed(), "Ww1Manager");
309 *pSeek
= pDoc
->Where();
310 aPap
.Push(ulSeek
+ ulSeek2
);
311 aChp
.Push(ulSeek
+ ulSeek2
);
313 _pFld
->Seek( ulSeek2
);
317 void Ww1Manager::Pop()
319 DBG_ASSERT(Pushed(), "Ww1Manager");
330 ///////////////////////////////////////////////////////////// Bookmarks
332 void Ww1Bookmarks::Out(Ww1Shell
& rOut
, Ww1Manager
& rMan
, USHORT
)
336 rOut
.SetBookEnd(GetHandle());
340 const String
& rName
= GetName();
341 if( rName
.EqualsAscii( "_Toc", 0, 4 ) ) // "_Toc*" ist ueberfluessig
344 if( rOut
.IsFlagSet( SwFltControlStack::HYPO
)
345 && rName
.EqualsIgnoreCaseAscii( "FORMULAR" ) )
348 // Fuer UEbersetzung Bookmark -> Variable setzen
350 if( nLen
> MAX_FIELDLEN
)
353 // Lese Inhalt des Bookmark
354 // geht vermulich auch ueber Ww1PlainText
355 String
aVal( rMan
.GetText().GetText( Where(), nLen
) );
357 // in 2 Schritten, da OS/2 zu doof ist
358 SwFltBookmark
aBook( rName
, aVal
, GetHandle(), FALSE
);
362 void Ww1Bookmarks::Start(Ww1Shell
& rOut
, Ww1Manager
& rMan
)
364 if (rMan
.Where() >= Where())
371 ///////////////////////////////////////////////////////////// Footnotes
372 void Ww1Footnotes::Start(Ww1Shell
& rOut
, Ww1Manager
& rMan
)
374 if (rMan
.Where() >= Where())
376 DBG_ASSERT(nPlcIndex
< Count(), "WwFootnotes");
379 DBG_ASSERT(c
==0x02, "Ww1Footnotes");
382 Ww1FtnText
* pText
= new Ww1FtnText(rMan
.GetFib());
383 // beginn des textes dieser fusznote:
384 ULONG start
= aText
.Where(nPlcIndex
);
387 ULONG count
= aText
.Where(nPlcIndex
+1) - start
;
388 pText
->SetCount(count
);
389 // fusznotenkennung sollte das erste byte sein
391 DBG_ASSERT(c
==0x02, "Ww1Footnotes");
392 count
--; // fuer das eben gelesene kenn-byte
393 // fusznoten mode beginnen:
394 rOut
.BeginFootnote();
396 rMan
.Push0(pText
, pText
->Offset(rMan
.GetFib()),
397 new Ww1FootnoteFields(rMan
.GetFib()));
407 void Ww1Footnotes::Stop(Ww1Shell
& /*rOut*/, Ww1Manager
& rMan
, sal_Unicode
& c
)
409 if (bStarted
&& rMan
.Where() > Where())
411 DBG_ASSERT(nPlcIndex
< Count(), "Ww1Footnotes");
412 // DBG_ASSERT(c==0x02, "Ww1Footnotes"); // scheint Stuss zu sein
418 //////////////////////////////////////////////////////////////// Fields
419 void Ww1Fields::Start(Ww1Shell
& rOut
, Ww1Manager
& rMan
)
421 if (rMan
.Where() >= Where()){
422 DBG_ASSERT(nPlcIndex
< Count(), "Ww1Fields");
423 if (GetData()->chGet() == 19)
430 void Ww1Fields::Stop( Ww1Shell
& rOut
, Ww1Manager
& rMan
, sal_Unicode
& c
)
432 if (rMan
.Where() >= Where())
434 DBG_ASSERT(nPlcIndex
< Count(), "Ww1Fields");
435 if (GetData()->chGet() != 19)
438 DBG_ASSERT(c
==21, "Ww1Fields");
442 // haben wir ein fertiges feld da, das eingefuegt werden soll?
447 // das macht der filter so, damit attribute die ueber das feld
448 // gelten auch wirklich eingelesen werden und dem feld
449 // zugeordnet werden.
457 enum WWDateTime
{ WW_DONTKNOW
= 0x0, WW_DATE
= 0x1, WW_TIME
= 0x2, WW_BOTH
= 0x3 };
459 static WWDateTime
GetTimeDatePara( const String
& rForm
,
460 SwTimeFormat
* pTime
= 0,
461 SwDateFormat
* pDate
= 0 )
463 WWDateTime eDT
= WW_BOTH
;
464 if( STRING_NOTFOUND
== rForm
.Search( 'H' )) // H -> 24h
469 else if( STRING_NOTFOUND
== rForm
.Search( 'H' )) // h -> 24h
476 eDT
= (WWDateTime
)( eDT
& ~(USHORT
)WW_TIME
);
479 xub_StrLen nDPos
= 0;
480 while( STRING_NOTFOUND
!= nDPos
)
482 nDPos
= rForm
.Search( 'M', nDPos
); // M -> Datum
485 sal_Unicode cPrev
= rForm
.GetChar( nDPos
- 1 );
486 // ignoriere dabei "AM", "aM", "PM", "pM"
487 if( 'a' != cPrev
&& 'A' != cPrev
&& 'p' != cPrev
&& 'P' != cPrev
)
493 if( STRING_NOTFOUND
!= nDPos
) // Monat -> Datum ?
495 static SwDateFormat __READONLY_DATA aDateA
[32] =
497 DFF_DMY
, DFF_DMMY
, DFF_DMYY
, DFF_DMMYY
,
498 DFF_DMMMY
, DFF_DMMMY
, DFF_DMMMYY
, DFF_DMMMYY
,
499 DFF_DDMMY
, DFF_DDMMY
, DFF_DDMMMYY
, DFF_DDMMMYY
,
500 DFF_DDMMMY
, DFF_DDMMMY
, DFF_DDMMMYY
, DFF_DDMMMYY
,
501 DFF_DDDMMMY
, DFF_DDDMMMY
, DFF_DDDMMMYY
, DFF_DDDMMMYY
,
502 DFF_DDDMMMY
, DFF_DDDMMMY
, DFF_DDDMMMYY
, DFF_DDDMMMYY
,
503 DFF_DDDMMMY
, DFF_DDDMMMY
, DFF_DDDMMMYY
, DFF_DDDMMMYY
,
504 DFF_DDDMMMY
, DFF_DDDMMMY
, DFF_DDDMMMYY
, DFF_DDDMMMYY
507 BOOL bHasDay
= STRING_NOTFOUND
!= rForm
.Search( 't' ) ||
508 STRING_NOTFOUND
!= rForm
.Search( 'T' ) ||
509 STRING_NOTFOUND
!= rForm
.Search( 'd' ) ||
510 STRING_NOTFOUND
!= rForm
.Search( 'D' );
512 BOOL bLongDayOfWeek
= STRING_NOTFOUND
!= rForm
.SearchAscii( "tttt" ) ||
513 STRING_NOTFOUND
!= rForm
.SearchAscii( "TTTT" ) ||
514 STRING_NOTFOUND
!= rForm
.SearchAscii( "dddd" ) ||
515 STRING_NOTFOUND
!= rForm
.SearchAscii( "DDDD" );
517 BOOL bDayOfWeek
= STRING_NOTFOUND
!= rForm
.SearchAscii( "ttt" ) ||
518 STRING_NOTFOUND
!= rForm
.SearchAscii( "TTT" ) ||
519 STRING_NOTFOUND
!= rForm
.SearchAscii( "ddd" ) ||
520 STRING_NOTFOUND
!= rForm
.SearchAscii( "DDD" );
522 // M, MM -> numeric month
523 // MMM, MMMM -> text. month
524 BOOL bLitMonth
= STRING_NOTFOUND
!= rForm
.SearchAscii( "MMM" );
525 // MMMM -> full month
526 BOOL bFullMonth
= STRING_NOTFOUND
!= rForm
.SearchAscii( "MMMM" );
527 // jj, JJ -> 2-col-year
528 // jjjj, JJJJ -> 4-col-year
529 BOOL bFullYear
= STRING_NOTFOUND
!= rForm
.SearchAscii( "jjj" ) ||
530 STRING_NOTFOUND
!= rForm
.SearchAscii( "JJJ" ) ||
531 STRING_NOTFOUND
!= rForm
.SearchAscii( "yyy" ) ||
532 STRING_NOTFOUND
!= rForm
.SearchAscii( "YYY" );
534 USHORT i
= ( bLitMonth
& 1 )
535 | ( ( bFullYear
& 1 ) << 1 )
536 | ( ( bFullMonth
& 1 ) << 2 )
537 | ( ( bDayOfWeek
& 1 ) << 3 )
538 | ( ( bLongDayOfWeek
& 1 ) << 4 );
541 if( !bHasDay
&& !bFullMonth
)
549 eDT
= (WWDateTime
)( eDT
& ~(USHORT
)WW_DATE
);
555 extern void sw3io_ConvertFromOldField( SwDoc
& rDoc
, USHORT
& rWhich
,
556 USHORT
& rSubType
, ULONG
&rFmt
,
559 void Ww1Fields::Out(Ww1Shell
& rOut
, Ww1Manager
& rMan
, USHORT nDepth
)
561 String sType
; // der typ als string
562 String sFormel
; // die formel
564 String sDTFormat
; // Datum / Zeit-Format
565 W1_FLD
* pData
= GetData(); // die an den plc gebunden daten
566 DBG_ASSERT(pData
->chGet()==19, "Ww1Fields"); // sollte beginn sein
570 DBG_ASSERT(c
==19, "Ww1Fields"); // sollte auch beginn sein
571 if (pData
->chGet()==19 && c
== 19)
574 c
= rMan
.Fill( aStr
, GetLength() );
575 DBG_ASSERT(Ww1PlainText::IsChar(c
), "Ww1Fields");
576 xub_StrLen pos
= aStr
.Search(' ');
577 // get type out of text
578 sType
= aStr
.Copy( 0, pos
);
579 aStr
.Erase( 0, pos
);
580 if ( pos
!= STRING_NOTFOUND
)
583 BYTE rbType
= pData
->fltGet();
585 // solange den formelteil einlesen, bis das feld entweder
586 // zuende ist oder der ergebnisteil beginnt. dabei koennen
587 // natuerlich neue felder beginnen (word unterstuetzt felder,
588 // die wiederum felder beinhalten).
591 if (pData
->chGet()==19) // nested field
593 Out(rOut
, rMan
, nDepth
+1);
595 DBG_ASSERT(c
==21, "Ww1PlainText");
596 sFormel
.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "Ww" ));
597 sFormel
+= String::CreateFromInt32( nPlcIndex
);
598 c
= rMan
.Fill(aStr
, GetLength());
599 DBG_ASSERT(Ww1PlainText::IsChar(c
), "Ww1PlainText");
603 while (pData
->chGet()==19);
605 // get format out of text
606 pos
= sFormel
.SearchAscii( "\\*" );
607 sFormat
= sFormel
.Copy( pos
);
608 sFormel
.Erase( pos
);
610 pos
= sFormel
.SearchAscii( "\\@" );
611 sDTFormat
= sFormel
.Copy( pos
);
612 sFormel
.Erase( pos
);
614 // der formelteil ist zuende, kommt ein ergebnisteil?
615 if( pData
->chGet() == 20 )
618 DBG_ASSERT(c
==20, "Ww1PlainText");
619 c
= rMan
.Fill(sErgebnis
, GetLength());
620 if (!Ww1PlainText::IsChar(c
))
621 sErgebnis
+= c
; //~ mdt: sonderzeichenbenhandlung
625 DBG_ASSERT(pData
->chGet()==21, "Ww1PlainText");
627 DBG_ASSERT(pField
==0, "Ww1PlainText");
634 // naja, aber info enthaelt alle moeglichkeiten, die auch direkt da sind
638 case 3: // bookmark reference
639 rOut
.ConvertUStr( sFormel
);
640 pField
= new SwGetRefField( (SwGetRefFieldType
*)
641 rOut
.GetSysFldType( RES_GETREFFLD
),
646 // pField = new SwGetExpField((SwGetExpFieldType*)
647 // rOut.GetSysFldType(RES_GETEXPFLD), sFormel, nsSwGetSetExpType::GSE_STRING);
649 // nsSwGetSetExpType::GSE_STRING, VVF_SYS);
651 case 6: // set command
653 pos
= aStr
.Search(' ');
654 String
aName( aStr
.Copy( 0, pos
));
659 rOut
.ConvertUStr( aName
);
660 SwFieldType
* pFT
= rOut
.GetDoc().InsertFldType(
661 SwSetExpFieldType( &rOut
.GetDoc(), aName
, nsSwGetSetExpType::GSE_STRING
) );
662 pField
= new SwSetExpField((SwSetExpFieldType
*)pFT
, aStr
);
663 ((SwSetExpField
*)pField
)->SetSubType( nsSwExtendedSubType::SUB_INVISIBLE
);
664 // Invisible macht in 378 AErger, soll aber demnaechst gehen
666 // das Ignorieren des Bookmarks ist nicht implementiert
671 pos
= aStr
.Search(' ');
672 String
aSubType( aStr
.Copy( 0, pos
));
675 rOut
.ConvertUStr( aSubType
);
678 // ganz grosze schiete: der typ 'info' kann einem der
679 // typen 15..31 entsprechen. er enthaelt als formel
680 // das eingentliche feld der doc-info.
681 // kein ';' benutzen mit folgendem macro:
682 #define IS(sd, se, t) \
683 if (aSubType.EqualsAscii( sd ) || aSubType.EqualsAscii( se)) \
687 // deutsche bez. englische bez. typ-code
688 IS("titel", "title", 15)
689 IS("thema", "subject", 16)
690 IS("autor", "author", 17)
691 IS("stichw?rter", "keywords", 18) //~ mdt: umlaut
692 IS("kommentar", "comment", 19)
693 IS("gespeichertvon", "lastrevisedby", 20)
694 IS("ertelldat", "creationdate", 21)
695 IS("speicherdat", "revisiondate", 22)
696 IS("druckdat", "printdate", 23)
697 IS("version", "revisionnumber", 24)
698 IS("zeit", "edittime", 25)
699 IS("anzseit", "numberofpages", 26)
700 IS("anzw?rter", "numberofwords", 27) //~ mdt: umlaut
701 IS("anzzeichen", "numberofchars", 28)
702 IS("dateiname", "filename", 29)
703 IS("vorlage", "templatename", 30)
711 pField
= new SwDocInfoField((SwDocInfoFieldType
*)
712 rOut
.GetSysFldType(RES_DOCINFOFLD
), DI_TITEL
, String(), 0);
715 pField
= new SwDocInfoField((SwDocInfoFieldType
*)
716 rOut
.GetSysFldType(RES_DOCINFOFLD
), DI_THEMA
, String(), 0);
719 pField
= new SwAuthorField((SwAuthorFieldType
*)
720 rOut
.GetSysFldType(RES_AUTHORFLD
), AF_NAME
);
723 pField
= new SwDocInfoField((SwDocInfoFieldType
*)
724 rOut
.GetSysFldType(RES_DOCINFOFLD
), DI_KEYS
, String(), 0);
727 pField
= new SwDocInfoField((SwDocInfoFieldType
*)
728 rOut
.GetSysFldType(RES_DOCINFOFLD
), DI_COMMENT
, String(), 0);
730 case 20: // last revised by
731 pField
= new SwDocInfoField((SwDocInfoFieldType
*)
732 rOut
.GetSysFldType(RES_DOCINFOFLD
), DI_CHANGE
|DI_SUB_AUTHOR
, String());
734 case 21: // creation date
735 case 22: // revision date
736 case 23: // print date
737 case 25:{// edit time
739 USHORT nReg
= 0; // RegInfoFormat, DefaultFormat fuer DocInfoFelder
744 case 21: nSub
= DI_CREATE
; nReg
= DI_SUB_DATE
; break;
745 case 23: nSub
= DI_PRINT
; nReg
= DI_SUB_DATE
; break;
746 case 22: nSub
= DI_CHANGE
; nReg
= DI_SUB_DATE
; break;
747 case 25: nSub
= DI_CHANGE
; nReg
= DI_SUB_TIME
; break;
749 switch( GetTimeDatePara( sDTFormat
) )
751 case WW_DATE
: nReg
= DI_SUB_DATE
; break;
752 case WW_TIME
: nReg
= DI_SUB_TIME
; break;
753 case WW_BOTH
: nReg
= DI_SUB_DATE
; break;
756 // WW_DONTKNOW -> Default bereits gesetzt
758 pField
= new SwDocInfoField((SwDocInfoFieldType
*)
759 rOut
.GetSysFldType(RES_DOCINFOFLD
), nSub
| nReg
, String());
762 case 24: // revision number
763 pField
= new SwDocInfoField((SwDocInfoFieldType
*)
764 rOut
.GetSysFldType(RES_DOCINFOFLD
), DI_DOCNO
, String(), 0);
766 case 26: // number of pages
767 pField
= new SwDocStatField((SwDocStatFieldType
*)
768 rOut
.GetSysFldType(RES_DOCSTATFLD
), DS_PAGE
, SVX_NUM_ARABIC
);
770 case 27: // number of words
771 pField
= new SwDocStatField((SwDocStatFieldType
*)
772 rOut
.GetSysFldType(RES_DOCSTATFLD
), DS_WORD
, SVX_NUM_ARABIC
);
774 case 28: // number of chars
775 pField
= new SwDocStatField((SwDocStatFieldType
*)
776 rOut
.GetSysFldType(RES_DOCSTATFLD
), DS_CHAR
, SVX_NUM_ARABIC
);
778 case 29: // file name
779 pField
= new SwFileNameField((SwFileNameFieldType
*)
780 rOut
.GetSysFldType(RES_FILENAMEFLD
));
782 case 30: // doc template name
783 pField
= new SwTemplNameField((SwTemplNameFieldType
*)
784 rOut
.GetSysFldType(RES_TEMPLNAMEFLD
), FF_NAME
);
788 SwDateFormat aDate
= DF_SSYS
;
789 SwTimeFormat aTime
= TF_SYSTEM
;
791 WWDateTime eDT
= GetTimeDatePara(sDTFormat
, &aTime
, &aDate
);
792 if( eDT
== WW_DONTKNOW
) // kein D/T-Formatstring
793 eDT
= ( rbType
== 32 ) ? WW_TIME
: WW_DATE
; // benutze ID
797 USHORT nWhich
= RES_DATEFLD
;
798 USHORT nSubType
= DATEFLD
;
799 ULONG nFormat
= aDate
;
800 sw3io_ConvertFromOldField( rOut
.GetDoc(),
801 nWhich
, nSubType
, nFormat
, 0x0110 );
802 pField
= new SwDateTimeField((SwDateTimeFieldType
*)
803 rOut
.GetSysFldType(RES_DATETIMEFLD
), DATEFLD
, nFormat
);
806 rOut
<< * pField
<< ' ';
807 // Mogel: direkt einfuegen und Space dahinter
811 USHORT nWhich
= RES_TIMEFLD
;
812 USHORT nSubType
= TIMEFLD
;
813 ULONG nFormat
= aTime
;
814 sw3io_ConvertFromOldField( rOut
.GetDoc(),
815 nWhich
, nSubType
, nFormat
, 0x0110 );
816 pField
= new SwDateTimeField((SwDateTimeFieldType
*)
817 rOut
.GetSysFldType(RES_DATETIMEFLD
), TIMEFLD
, nFormat
);
822 case 33: // current page
823 pField
= new SwPageNumberField((SwPageNumberFieldType
*)
824 rOut
.GetSysFldType(RES_PAGENUMBERFLD
), PG_RANDOM
, SVX_NUM_ARABIC
);
826 case 34: // evaluation exp
830 SwGetExpFieldType
* pFieldType
=
831 (SwGetExpFieldType
*)rOut
.GetSysFldType(RES_GETEXPFLD
);
832 DBG_ASSERT(pFieldType
!=0, "Ww1Fields");
834 pField
= new SwGetExpField(pFieldType
, sFormel
,
835 nsSwGetSetExpType::GSE_STRING
, VVF_SYS
);
839 String
aName( String::CreateFromAscii(
840 RTL_CONSTASCII_STRINGPARAM( "Ww" )));
841 aName
+= String::CreateFromInt32( nPlcIndex
);
842 SwFieldType
* pFT
= rOut
.GetDoc().GetFldType( RES_SETEXPFLD
, aName
, false);
845 SwSetExpFieldType
aS(&rOut
.GetDoc(), aName
, nsSwGetSetExpType::GSE_FORMULA
);
846 pFT
= rOut
.GetDoc().InsertFldType(aS
);
848 SwSetExpField
aFld((SwSetExpFieldType
*)pFT
, sFormel
);
849 aFld
.SetSubType(nsSwExtendedSubType::SUB_INVISIBLE
);
854 case 36: // print command, Einfuegendatei
856 pos
= aStr
.Search(' ');
857 String
aFName( aStr
.Copy( 0, pos
));
862 aFName
.SearchAndReplaceAscii( "\\\\", String( '\\' ));
864 // char* pBook = FindNextPara( pNext, 0 ); //!! Bookmark/Feld-Name
865 // //!! erstmal nicht
867 // ConvertFFileName( aPara, pFName ); //!! WW1 ????
868 aFName
= URIHelper::SmartRel2Abs(
869 INetURLObject(rOut
.GetBaseURL()), aFName
);
871 String
aName( String::CreateFromAscii(
872 RTL_CONSTASCII_STRINGPARAM( "WW" )));
873 SwSectionData
* pSection
= new SwSectionData( FILE_LINK_SECTION
,
874 rOut
.GetDoc().GetUniqueSectionName( &aStr
) );
875 pSection
->SetLinkFileName( aFName
);
876 pSection
->SetProtectFlag( true );
877 rOut
<< SwFltSection( pSection
);
878 rOut
.EndItem( RES_FLTR_SECTION
);
879 rOut
.NextParagraph();
882 pField
= new SwGetRefField(
883 (SwGetRefFieldType
*)rOut
.GetSysFldType(RES_GETREFFLD
),
884 sFormel
, 0, 0, REF_PAGE
);
886 case 38: // ask command
888 pos
= aStr
.Search(' ');
889 String
aName( aStr
.Copy( 0, pos
));
895 SwFieldType
* pFT
= rOut
.GetDoc().InsertFldType(
896 SwSetExpFieldType( &rOut
.GetDoc(), aName
, nsSwGetSetExpType::GSE_STRING
) );
897 pField
= new SwSetExpField((SwSetExpFieldType
*)pFT
, aStr
);
898 ((SwSetExpField
*)pField
)->SetInputFlag( TRUE
);
899 ((SwSetExpField
*)pField
)->SetSubType(nsSwExtendedSubType::SUB_INVISIBLE
);
900 // pField.SetPromptText( aQ ); //!! fehlt noch
901 // aFld.SetPar2( aDef ); //!! dito
902 // das Ignorieren des Bookmarks ist nicht implementiert
904 case 39: // fillin command
905 pField
= new SwInputField(
906 (SwInputFieldType
*)rOut
.GetSysFldType( RES_INPUTFLD
),
908 INP_TXT
, 0 ); // sichtbar ( geht z.Zt. nicht anders )
910 case 51: // macro button
912 pos
= aStr
.Search(' ');
913 String
aName( aStr
.Copy( 0, pos
));
916 if( !aName
.Len() || !aStr
.Len() )
918 aName
.InsertAscii( "StarOffice.Standard.Modul1.", 0 );
920 pField
= new SwMacroField( (SwMacroFieldType
*)
921 rOut
.GetSysFldType( RES_MACROFLD
),
925 case 55: // read tiff / or better: import anything
927 const sal_Unicode
* pFormel
= sFormel
.GetBuffer();
928 const sal_Unicode
* pDot
= 0;
930 while (*pFormel
!= '\0' && *pFormel
!= ' ')
932 // ab hier koennte eine extension kommen
936 // aha: wir waren bislang noch in dirs
937 if (*pFormel
== '\\')
940 if (pFormel
[1] == '\\')
943 if (*pFormel
!= '\0')
949 while( *pDot
!= '\0' && *pDot
!= ' ')
952 if( sExt
.EqualsIgnoreCaseAscii( ".tiff" )
953 || sExt
.EqualsIgnoreCaseAscii( ".bmp" )
954 || sExt
.EqualsIgnoreCaseAscii( ".gif" )
955 || sExt
.EqualsIgnoreCaseAscii( ".pcx" )
956 || sExt
.EqualsIgnoreCaseAscii( ".pic" ))
957 rOut
.AddGraphic( sName
);
966 DBG_ASSERT(FALSE
, "Ww1PlainText");
969 case 2: // possible bookmark
970 case 4: // index entry
972 case 5: // footnote ref
973 // pField = new SwGetRefField(
974 // (SwGetRefFieldType*)rDoc.GetSysFldType(RES_GETREFFLD),
975 // sFormel, REF_FOOTNOTE, 0, REF_BEGIN);
976 case 7: // if command
977 case 8: // create index
979 case 9: // table of contents entry
981 case 10: // style ref
984 case 13: // create table of contents
986 case 35: // literal text
988 case 40: // data command
989 case 41: // next command
990 case 42: // nextif command
991 case 43: // skipif command
992 case 44: // number of record
995 case 46: // dde auto ref
996 case 47: // glossary entry
997 case 48: // print char
998 case 49: // formula def
999 case 50: // goto button
1000 case 52: // auto number outline
1001 case 53: // auto number legal
1002 case 54: // auto number arabic
1006 if( bKnown
|| sErgebnis
.EqualsAscii( "\270" ))
1007 this->sErgebnis
.Erase();
1009 this->sErgebnis
= sErgebnis
;
1011 else // oops: we are terribly wrong: skip this
1015 ULONG
Ww1Fields::GetLength()
1017 // berechnet die laenge eines feldteiles. nicht mitgerechnet werden
1018 // die terminierenden zeichen im text (19, 20, 21) die beginn, trenner
1019 // und ende bedeuten.
1020 ULONG ulBeg
= Where();
1021 ULONG ulEnd
= Where(nPlcIndex
+1);
1022 DBG_ASSERT(ulBeg
<ulEnd
, "Ww1Fields");
1023 return (ulEnd
- ulBeg
) - 1;
1026 /////////////////////////////////////////////////////////////////// Sep
1027 void Ww1Sep::Start(Ww1Shell
& rOut
, Ww1Manager
& rMan
)
1029 if (rMan
.Where() >= Where())
1032 SwFrmFmt
&rFmt
= rOut
.GetPageDesc().GetMaster();
1033 W1_DOP
& rDOP
= rMan
.GetDop().GetDOP();
1034 rOut
.GetPageDesc().SetLandscape(rDOP
.fWideGet());
1035 SwFmtFrmSize
aSz(rFmt
.GetFrmSize());
1036 aSz
.SetWidth(rDOP
.xaPageGet());
1037 aSz
.SetHeight(rDOP
.yaPageGet());
1038 rFmt
.SetFmtAttr(aSz
);
1039 SvxLRSpaceItem
aLR(rDOP
.dxaLeftGet()+rDOP
.dxaGutterGet(),
1040 rDOP
.dxaRightGet(), 0, 0, RES_LR_SPACE
);
1041 rFmt
.SetFmtAttr(aLR
);
1042 SvxULSpaceItem
aUL(rDOP
.dyaTopGet(), rDOP
.dyaBottomGet(), RES_UL_SPACE
);
1043 rFmt
.SetFmtAttr(aUL
);
1044 // sobald wir mit dem lesen der zeichen soweit sind, wo sep's
1045 // momentanes attribut beginnt, wird dieses attribut eingefuegt.
1046 // diese methode ist bei den meisten start/stop methoden der
1047 // memberklassen des managers identisch.
1048 BYTE
* pByte
= GetData();
1049 Ww1SprmSep
aSprm(rFib
, SVBT32ToUInt32(pByte
+ 2));
1050 aSprm
.Start(rOut
, rMan
);
1051 aSprm
.Stop(rOut
, rMan
);
1053 aHdd
.Start(rOut
, rMan
);
1057 /////////////////////////////////////////////////////////////////// Pap
1058 void Ww1Pap::Start(Ww1Shell
& rOut
, Ww1Manager
& rMan
)
1060 if (rMan
.Where() >= Where())
1064 // bereitstellen der zu startenden attribute
1065 if (FillStart(pByte
, cb
))
1067 Ww1SprmPapx
aSprm(pByte
, cb
);
1069 aSprm
.Start(rOut
, rMan
);
1075 void Ww1Pap::Stop(Ww1Shell
& rOut
, Ww1Manager
& rMan
, sal_Unicode
&)
1077 if (rMan
.Where() >= Where() || rMan
.IsStopAll())
1081 if (FillStop(pByte
, cb
)){
1082 Ww1SprmPapx
aSprm(pByte
, cb
);
1083 aSprm
.Stop(rOut
, rMan
);
1085 DBG_ASSERT( !nPlcIndex
|| rMan
.IsStopAll(), "Pap-Attribut-Stop verloren" );
1086 // rMan.IsStopAll() ist nicht schoen.
1091 //////////////////////////////////////////////////////////////// W1_CHP
1093 // momentan laesst sich die ausgabe von W1CHPxen nicht nur per define
1096 void W1_CHP::Out(Ww1Shell
& rOut
, Ww1Manager
& rMan
)
1099 rOut
<< SvxWeightItem(
1100 rOut
.GetWeightBold()?WEIGHT_NORMAL
:WEIGHT_BOLD
, RES_CHRATR_WEIGHT
);
1102 rOut
<< SvxPostureItem(
1103 rOut
.GetPostureItalic()?ITALIC_NONE
:ITALIC_NORMAL
, RES_CHRATR_POSTURE
);
1105 rOut
<< SvxCrossedOutItem(
1106 rOut
.GetCrossedOut()?STRIKEOUT_NONE
:STRIKEOUT_SINGLE
, RES_CHRATR_CROSSEDOUT
);
1108 rOut
<< SvxContourItem(!rOut
.GetContour(), RES_CHRATR_CONTOUR
);
1109 if (fSmallCapsGet())
1110 rOut
<< SvxCaseMapItem(
1111 rOut
.GetCaseKapitaelchen()?SVX_CASEMAP_NOT_MAPPED
:SVX_CASEMAP_KAPITAELCHEN
, RES_CHRATR_CASEMAP
);
1113 rOut
<< SvxCaseMapItem(
1114 rOut
.GetCaseVersalien()?SVX_CASEMAP_NOT_MAPPED
:SVX_CASEMAP_VERSALIEN
, RES_CHRATR_CASEMAP
);
1116 rOut
<< SvxFontHeightItem(hpsGet() * 10, 100, RES_CHRATR_FONTSIZE
);
1120 rOut
<< SvxUnderlineItem(UNDERLINE_NONE
, RES_CHRATR_UNDERLINE
) <<
1121 SvxWordLineModeItem(FALSE
, RES_CHRATR_WORDLINEMODE
);
1123 default: DBG_ASSERT(FALSE
, "Chpx");
1125 rOut
<< SvxUnderlineItem(UNDERLINE_SINGLE
, RES_CHRATR_UNDERLINE
);
1128 rOut
<< SvxUnderlineItem(UNDERLINE_SINGLE
, RES_CHRATR_UNDERLINE
) <<
1129 SvxWordLineModeItem(TRUE
, RES_CHRATR_WORDLINEMODE
);
1132 rOut
<< SvxUnderlineItem(UNDERLINE_DOUBLE
, RES_CHRATR_UNDERLINE
);
1135 rOut
<< SvxUnderlineItem(UNDERLINE_DOTTED
, RES_CHRATR_UNDERLINE
);
1141 default: DBG_ASSERT(FALSE
, "Chpx");
1142 case 0: { rOut
.EndItem(RES_CHRATR_COLOR
); } break;
1143 case 1: { rOut
<< SvxColorItem(Color(COL_BLACK
), RES_CHRATR_COLOR
); } break;
1144 case 2: { rOut
<< SvxColorItem(Color(COL_LIGHTBLUE
), RES_CHRATR_COLOR
); } break;
1145 case 3: { rOut
<< SvxColorItem(Color(COL_LIGHTCYAN
), RES_CHRATR_COLOR
); } break;
1146 case 4: { rOut
<< SvxColorItem(Color(COL_LIGHTGREEN
), RES_CHRATR_COLOR
); } break;
1147 case 5: { rOut
<< SvxColorItem(Color(COL_LIGHTMAGENTA
), RES_CHRATR_COLOR
); } break;
1148 case 6: { rOut
<< SvxColorItem(Color(COL_LIGHTRED
), RES_CHRATR_COLOR
); } break;
1149 case 7: { rOut
<< SvxColorItem(Color(COL_YELLOW
), RES_CHRATR_COLOR
); } break;
1150 case 8: { rOut
<< SvxColorItem(Color(COL_WHITE
), RES_CHRATR_COLOR
); } break;
1153 short sQps
= qpsSpaceGet();
1156 rOut
<< SvxKerningItem(sQps
, RES_CHRATR_KERNING
);
1159 if (hpsPosGet() == 0)
1160 rOut
<< SvxEscapementItem(SVX_ESCAPEMENT_OFF
, 100, RES_CHRATR_ESCAPEMENT
);
1162 short sHps
= hpsPosGet();
1167 rOut
<< SvxEscapementItem(sHps
, 100, RES_CHRATR_ESCAPEMENT
);
1171 SvxFontItem
aFont(rMan
.GetFont(ftcGet()));
1176 /////////////////////////////////////////////////////////////////// Chp
1177 void Ww1Chp::Start(Ww1Shell
& rOut
, Ww1Manager
& rMan
)
1179 if (rMan
.Where() >= Where())
1182 if (FillStart(aChpx
))
1184 aChpx
.Out(rOut
, rMan
);
1185 if (aChpx
.fcPicGet())
1187 Ww1Picture
aPic(rMan
.GetFib().GetStream(),
1189 if (!aPic
.GetError())
1190 aPic
.Out(rOut
, rMan
);
1197 void Ww1Chp::Stop(Ww1Shell
& rOut
, Ww1Manager
& rMan
, sal_Unicode
&)
1199 if (rMan
.Where() >= Where())
1202 if (FillStop(aChpx
))
1204 // zuerst alle toggle-flags
1205 if (aChpx
.fBoldGet())
1206 rOut
.EndItem(RES_CHRATR_WEIGHT
);
1207 if (aChpx
.fItalicGet())
1208 rOut
.EndItem(RES_CHRATR_POSTURE
);
1209 if (aChpx
.fStrikeGet())
1210 rOut
.EndItem(RES_CHRATR_CROSSEDOUT
);
1211 if (aChpx
.fOutlineGet())
1212 rOut
.EndItem(RES_CHRATR_CONTOUR
);
1213 if (aChpx
.fSmallCapsGet() || aChpx
.fCapsGet())
1214 rOut
.EndItem(RES_CHRATR_CASEMAP
);
1215 // dann alle zahl-werte, diese haben flags, wenn sie gesetzt
1216 // sind..................
1217 if (aChpx
.fsHpsGet())
1218 rOut
.EndItem(RES_CHRATR_FONTSIZE
);
1219 if (aChpx
.fsKulGet())
1220 rOut
.EndItem(RES_CHRATR_UNDERLINE
)
1221 .EndItem(RES_CHRATR_WORDLINEMODE
);
1222 if (aChpx
.fsIcoGet())
1223 rOut
.EndItem(RES_CHRATR_COLOR
);
1224 if (aChpx
.fsSpaceGet())
1225 rOut
.EndItem(RES_CHRATR_KERNING
);
1226 if (aChpx
.fsPosGet())
1227 rOut
.EndItem(RES_CHRATR_ESCAPEMENT
);
1228 if (aChpx
.fsFtcGet())
1229 rOut
.EndItem(RES_CHRATR_FONT
);
1231 DBG_ASSERT( !nPlcIndex
, "Chp-Attribut-Stop verloren" );
1236 ///////////////////////////////////////////////////////////////// Style
1237 void Ww1Style::Out(Ww1Shell
& rOut
, Ww1Manager
& rMan
)
1239 // Zuerst Basis, damit Attribute des Basis-Styles erkannt werden
1240 // first: Base................................................
1241 if(pParent
->GetStyle(stcBase
).IsUsed() ) // Basis gueltig ?
1242 rOut
.BaseStyle(stcBase
);
1244 // next of all: CHP...............................................
1245 aChpx
.Out(rOut
, rMan
);
1246 // Last: PAP.......................................................
1248 pPapx
->Start(rOut
, rMan
);
1251 ////////////////////////////////////////////////////////// Ww1PlainText
1253 // die Out() methoden von plaintext fuer den filter geben eine anzahl
1254 // zeichen aus auf die shell, einen string oder einen char, wieviel
1255 // zeichen ausgegeben werden, bestimmt ulEnd, das das ende bestimmt,
1256 // bis zudem ausgegeben wird. ausserdem beenden die methoden die
1257 // ausgabe bei kontrollzeichen.
1258 // diese sind definiert durch MinChar. alle zeichen mit wert darunter
1259 // gelten als kontroll- zeichen. dafuer gibts die methode IsChar, die
1260 // zurueckgibt, ob es sich um ein standard zeichen handelt. kommt ein
1261 // solches zeichen, wird dieses zeichen zurueckgegeben und die methode
1262 // beendet, auch wenn ulEnd noch nicht erreicht wurde. bei nutzung
1263 // also beachten, dasz wenn !IsChar(Out(...)) gilt, ulEnd unter
1264 // umstaenden nicht erreicht wurde. dann wurde das kontrollzeichen
1265 // zwar (weg-)gelesen, jedoch noch nicht ausgegeben.
1267 sal_Unicode
Ww1PlainText::Out( Ww1Shell
& rOut
, ULONG
& ulEnd
)
1269 // gibt die zeichen bis ulEnd aus, es sei den es kommen sonderzeichen
1270 // die eine bedeutung haben wie absatzende oder seitenumbruch.
1271 if (ulEnd
> Count())
1273 while (ulSeek
< ulEnd
)
1275 sal_Unicode c
= (*this)[ulSeek
];
1277 if (Ww1PlainText::IsChar(c
))
1282 return Ww1PlainText::MinChar
;
1285 sal_Unicode
Ww1PlainText::Out( String
& rStr
, ULONG ulEnd
)
1287 // wie Out(Shell..., jedoch ausgabe auf einen string
1289 if (ulEnd
> Count())
1291 while (ulSeek
< ulEnd
)
1293 sal_Unicode c
= (*this)[ulSeek
];
1295 if( Ww1PlainText::IsChar(c
) )
1300 return Ww1PlainText::MinChar
;
1304 // hier eruebrigt sich ulEnd...oder?
1306 sal_Unicode
Ww1PlainText::Out( sal_Unicode
& rRead
)
1308 rRead
= (*this)[ulSeek
];
1313 /////////////////////////////////////////////////////////// Ww1SprmPapx
1315 void Ww1SprmPapx::Start(Ww1Shell
& rOut
, Ww1Manager
& rMan
)
1317 if( !rMan
.IsInStyle() ){ // Innerhalb Style gehts ueber die
1318 // normalen Attribute
1320 && !rOut
.IsInTable() // Nicht innerhalb Tabelle!
1321 && ( rMan
.HasPPc() || rMan
.HasPDxaAbs())){ // Fly-Start
1322 rOut
.BeginFly(); // eAnchor );
1324 if (!rOut
.IsInTable() && rMan
.HasInTable())
1328 rOut
.SetStyle(aPapx
.stcGet());
1330 Ww1Sprm::Start(rOut
, rMan
);
1333 void Ww1SprmPapx::Stop(Ww1Shell
& rOut
, Ww1Manager
& rMan
)
1335 Ww1Sprm::Stop(rOut
, rMan
);
1337 if( !rMan
.IsInStyle() ) // Innerhalb Style gehts ueber die
1338 { // normalen Attribute
1339 if (rOut
.IsInTable() &&( rMan
.IsStopAll() || !rMan
.HasInTable()))
1342 if( rOut
.IsInFly() &&
1344 || ( !rMan
.HasPPc() && !rMan
.HasPDxaAbs() // Fly-Ende
1345 && !rOut
.IsInTable()))) // Nicht innerhalb Tabelle!
1350 ///////////////////////////////////////////////////////////////// Fonts
1351 SvxFontItem
Ww1Fonts::GetFont(USHORT nFCode
)
1353 // erzeugen eine fonts im sw-sinne aus den word-strukturen
1354 FontFamily eFamily
= FAMILY_DONTKNOW
;
1356 FontPitch ePitch
= PITCH_DONTKNOW
;
1357 rtl_TextEncoding eCharSet
= RTL_TEXTENCODING_DONTKNOW
;
1360 // In the Winword 1.x format, the names of the first three fonts were
1361 // omitted from the table and assumed to be "Tms Rmn" (for ftc = 0),
1362 // "Symbol", and "Helv"
1364 eFamily
= FAMILY_ROMAN
;
1365 aName
.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "Tms Rmn" ));
1366 ePitch
= PITCH_VARIABLE
;
1367 eCharSet
= RTL_TEXTENCODING_MS_1252
;
1370 aName
.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "Symbol" ));
1371 ePitch
= PITCH_VARIABLE
;
1372 eCharSet
= RTL_TEXTENCODING_SYMBOL
;
1375 eFamily
= FAMILY_SWISS
;
1376 aName
.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "Helv" ));
1377 ePitch
= PITCH_VARIABLE
;
1378 eCharSet
= RTL_TEXTENCODING_MS_1252
;
1382 W1_FFN
* pF
= GetFFN(nFCode
- 3);
1385 // Fontname .........................................
1386 aName
= String( (sal_Char
*)pF
->szFfnGet(),
1387 RTL_TEXTENCODING_MS_1252
);
1388 // Pitch .............................................
1389 static FontPitch ePitchA
[] =
1391 PITCH_DONTKNOW
, PITCH_FIXED
, PITCH_VARIABLE
, PITCH_DONTKNOW
1393 ePitch
= ePitchA
[pF
->prgGet()];
1394 // CharSet ...........................................
1395 eCharSet
= RTL_TEXTENCODING_MS_1252
;
1396 if (aName
.EqualsIgnoreCaseAscii("Symbol")
1397 || aName
.EqualsIgnoreCaseAscii("Symbol Set")
1398 || aName
.EqualsIgnoreCaseAscii("Wingdings")
1399 || aName
.EqualsIgnoreCaseAscii("ITC Zapf Dingbats") )
1400 eCharSet
= RTL_TEXTENCODING_SYMBOL
;
1401 // FontFamily ........................................
1402 USHORT b
= pF
->ffGet();
1403 static FontFamily eFamilyA
[] =
1405 FAMILY_DONTKNOW
, FAMILY_ROMAN
, FAMILY_SWISS
, FAMILY_MODERN
,
1406 FAMILY_SCRIPT
, FAMILY_DECORATIVE
1408 if (b
< sizeof(eFamilyA
))
1409 eFamily
= eFamilyA
[b
];
1413 DBG_ASSERT(FALSE
, "WW1Fonts::GetFont: Nicht existenter Font !");
1414 eFamily
= FAMILY_SWISS
;
1415 aName
.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "Helv" ));
1416 ePitch
= PITCH_VARIABLE
;
1417 eCharSet
= RTL_TEXTENCODING_MS_1252
;
1423 if ( SwFltGetFlag( nFieldFlags
, SwFltControlStack::HYPO
)
1424 && ( aName
.EqualsIgnoreCaseAscii("Helv")
1425 || aName
.EqualsIgnoreCaseAscii("Helvetica") ) )
1427 aName
.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "Helvetica Neue" ));
1428 if (eFamily
==FAMILY_DONTKNOW
)
1429 eFamily
= FAMILY_SWISS
;
1433 // VCL matcht die Fonts selber
1434 // allerdings passiert bei Helv, Tms Rmn und System Monospaced
1435 // Scheisse, so dass diese ersetzt werden muessen.
1436 // Nach TH sollen diese durch feste Werte ersetzt werden,
1437 // also nicht ueber System::GetStandardFont, damit keine
1438 // Namenslisten auftauchen ( Dieses koennte den User verwirren )
1439 if( aName
.EqualsIgnoreCaseAscii("Helv"))
1441 aName
.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "Helvetica" ));
1442 if (eFamily
==FAMILY_DONTKNOW
)
1443 eFamily
= FAMILY_SWISS
;
1445 else if (aName
.EqualsIgnoreCaseAscii("Tms Rmn"))
1447 aName
.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "Times New Roman" ));
1448 if (eFamily
==FAMILY_DONTKNOW
)
1449 eFamily
= FAMILY_ROMAN
;
1451 else if (aName
.EqualsIgnoreCaseAscii("System Monospaced") )
1453 aName
.AssignAscii( RTL_CONSTASCII_STRINGPARAM( "Courier" ));
1454 ePitch
= PITCH_FIXED
;
1457 // nun koennen wir den font basteln: .........................
1458 return SvxFontItem(eFamily
, aName
, aEmptyStr
, ePitch
, eCharSet
, RES_CHRATR_FONT
);
1461 /////////////////////////////////////////////////////////////////// Dop
1462 void Ww1Dop::Out(Ww1Shell
& rOut
)
1465 // aDop.fWidowControlGet(); // keine Absatztrennung fuer einzelne Zeilen
1466 long nDefTabSiz
= aDop
.dxaTabGet();
1467 if (nDefTabSiz
< 56)
1470 // wir wollen genau einen DefaultTab
1471 SvxTabStopItem
aNewTab(1, USHORT(nDefTabSiz
), SVX_TAB_ADJUST_DEFAULT
, RES_PARATR_TABSTOP
);
1472 ((SvxTabStop
&)aNewTab
[0]).GetAdjustment() = SVX_TAB_ADJUST_DEFAULT
;
1473 rOut
.GetDoc().GetAttrPool().SetPoolDefaultItem( aNewTab
); //~ mdt: besser (GetDoc)
1475 SwFrmFmt
&rFmt
= rOut
.GetPageDesc().GetMaster();
1476 W1_DOP
& rDOP
= GetDOP();
1477 rOut
.GetPageDesc().SetLandscape(rDOP
.fWideGet());
1478 SwFmtFrmSize
aSz(rFmt
.GetFrmSize());
1479 aSz
.SetWidth(rDOP
.xaPageGet());
1480 aSz
.SetHeight(rDOP
.yaPageGet());
1481 rFmt
.SetFmtAttr(aSz
);
1482 SvxLRSpaceItem
aLR(rDOP
.dxaLeftGet()+rDOP
.dxaGutterGet(),
1483 rDOP
.dxaRightGet(), 0, 0, RES_LR_SPACE
);
1484 rFmt
.SetFmtAttr(aLR
);
1485 SvxULSpaceItem
aUL(rDOP
.dyaTopGet(), rDOP
.dyaBottomGet(), RES_UL_SPACE
);
1486 rFmt
.SetFmtAttr(aUL
);
1489 aInfo
= rOut
.GetDoc().GetFtnInfo(); // Copy-Ctor privat
1490 // wo positioniert ? ( 0 == Section, 1 == Page,
1491 // 2 == beim Text -> Page, 3 == Doc )
1492 switch( rDOP
.fpcGet() ){
1494 case 2: aInfo
.ePos
= FTNPOS_PAGE
; break;
1495 default: aInfo
.ePos
= FTNPOS_CHAPTER
; break;
1497 // aInfo.eNum = ( rDOP.fFtnRestartGet() ) ? FTNNUM_CHAPTER : FTNNUM_DOC;
1498 // Da Sw unter Chapter anscheinend was anderes versteht als PMW
1499 // hier also immer Doc !
1500 aInfo
.eNum
= FTNNUM_DOC
;
1501 // wie neu nummerieren ?
1502 // SW-UI erlaubt Nummer nur bei FTNNUM_DOC
1503 if( rDOP
.nFtnGet() > 0 && aInfo
.eNum
== FTNNUM_DOC
)
1504 aInfo
.nFtnOffset
= rDOP
.nFtnGet() - 1;
1505 rOut
.GetDoc().SetFtnInfo( aInfo
);
1509 ///////////////////////////////////////////////////////////////// Assoc
1510 void Ww1Assoc::Out(Ww1Shell
& rOut
)
1512 //~ mdt: fehlen: FileNext, Dot, DataDoc, HeaderDoc, Criteria1,
1513 // Criteria2, Criteria3, Criteria4, Criteria5, Criteria6, Criteria7
1514 SwDocShell
*pDocShell(rOut
.GetDoc().GetDocShell());
1515 DBG_ASSERT(pDocShell
, "no SwDocShell");
1517 uno::Reference
<document::XDocumentPropertiesSupplier
> xDPS(
1518 pDocShell
->GetModel(), uno::UNO_QUERY_THROW
);
1519 uno::Reference
<document::XDocumentProperties
> xDocProps(
1520 xDPS
->getDocumentProperties());
1521 DBG_ASSERT(xDocProps
.is(), "DocumentProperties is null");
1522 if (xDocProps
.is()) {
1523 xDocProps
->setTitle( GetStr(Title
) );
1524 xDocProps
->setSubject( GetStr(Subject
) );
1525 xDocProps
->setDescription( GetStr(Comments
) );
1526 xDocProps
->setKeywords(
1527 ::comphelper::string::convertCommaSeparated( GetStr(KeyWords
) ) );
1528 xDocProps
->setAuthor( GetStr(Author
) );
1529 xDocProps
->setModifiedBy( GetStr(LastRevBy
) );
1534 //////////////////////////////////////////////////////////// StyleSheet
1535 void Ww1StyleSheet::OutDefaults(Ww1Shell
& rOut
, Ww1Manager
& rMan
, USHORT stc
)
1539 rOut
<< SvxFontHeightItem(240, 100, RES_CHRATR_FONTSIZE
);
1540 rOut
<< SvxFontItem(rMan
.GetFont(2));
1542 case 223: // annotation reference
1543 rOut
<< SvxFontHeightItem(160, 100, RES_CHRATR_FONTSIZE
);
1545 case 224: // annotation text
1546 rOut
<< SvxFontHeightItem(200, 100, RES_CHRATR_FONTSIZE
);
1548 case 225: // table of contents 8
1549 case 226: // table of contents 7
1550 case 227: // table of contents 6
1551 case 228: // table of contents 5
1552 case 229: // table of contents 4
1553 case 230: // table of contents 3
1554 case 231: // table of contents 2
1555 case 232: // table of contents 1
1556 rOut
<< SvxLRSpaceItem(( 232 - stc
) * 720, 720, 0, 0, RES_LR_SPACE
);
1557 // Tabulatoren fehlen noch !
1559 case 233: // index 7
1560 case 234: // und index 6
1561 case 235: // und index 5
1562 case 236: // und index 4
1563 case 237: // und index 3
1564 case 238: // und index 2
1565 rOut
<< SvxLRSpaceItem(( 239 - stc
) * 360, 0, 0, 0, RES_LR_SPACE
);
1567 case 239: // index 1
1569 case 240: // line number
1571 case 241: // index heading
1574 case 243:{ // ... und header
1575 SvxTabStopItem
aAttr(RES_PARATR_TABSTOP
);
1576 SvxTabStop aTabStop
;
1577 aTabStop
.GetTabPos() = 4535; // 8 cm
1578 aTabStop
.GetAdjustment() = SVX_TAB_ADJUST_CENTER
;
1579 aAttr
.Insert( aTabStop
);
1580 aTabStop
.GetTabPos() = 9071; // 16 cm
1581 aTabStop
.GetAdjustment() = SVX_TAB_ADJUST_RIGHT
;
1582 aAttr
.Insert( aTabStop
);
1586 case 244: // footnote reference
1587 rOut
<< SvxFontHeightItem(160, 100, RES_CHRATR_FONTSIZE
);
1588 rOut
<< SvxEscapementItem(6 * 100 / 24, 100, RES_CHRATR_ESCAPEMENT
);
1590 case 245: // footnote text
1591 rOut
<< SvxFontHeightItem(200, 100, RES_CHRATR_FONTSIZE
);
1593 case 246: // heading 9
1594 case 247: // und heading 8
1595 case 248: // und heading 7
1596 rOut
<< SvxLRSpaceItem(720, 0, 0, 0, RES_LR_SPACE
);
1597 rOut
<< SvxPostureItem(
1598 rOut
.GetPostureItalic()?ITALIC_NONE
:ITALIC_NORMAL
, RES_CHRATR_POSTURE
);
1599 rOut
<< SvxFontHeightItem(200, 100, RES_CHRATR_FONTSIZE
);
1601 case 249: // heading 6
1602 rOut
<< SvxLRSpaceItem(720, 0, 0, 0, RES_LR_SPACE
);
1603 rOut
<< SvxUnderlineItem(UNDERLINE_SINGLE
, RES_CHRATR_UNDERLINE
);
1604 rOut
<< SvxFontHeightItem(200, 100, RES_CHRATR_FONTSIZE
);
1606 case 250: // heading 5
1607 rOut
<< SvxLRSpaceItem(720, 0, 0, 0, RES_LR_SPACE
);
1608 rOut
<< SvxWeightItem(rOut
.GetWeightBold()?WEIGHT_NORMAL
:WEIGHT_BOLD
, RES_CHRATR_WEIGHT
);
1609 rOut
<< SvxFontHeightItem(200, 100, RES_CHRATR_FONTSIZE
);
1611 case 251: // heading 4
1612 rOut
<< SvxLRSpaceItem(360, 0, 0, 0, RES_LR_SPACE
);
1613 rOut
<< SvxUnderlineItem(UNDERLINE_SINGLE
, RES_CHRATR_UNDERLINE
);
1614 rOut
<< SvxFontHeightItem(240, 100, RES_CHRATR_FONTSIZE
);
1616 case 252: // heading 3
1617 rOut
<< SvxLRSpaceItem(360, 0, 0, 0, RES_LR_SPACE
);
1618 rOut
<< SvxWeightItem(rOut
.GetWeightBold()?WEIGHT_NORMAL
:WEIGHT_BOLD
, RES_CHRATR_WEIGHT
);
1619 rOut
<< SvxFontHeightItem(240, 100, RES_CHRATR_FONTSIZE
);
1621 case 253: // heading 2
1622 rOut
<< SvxULSpaceItem(120, 0, RES_UL_SPACE
);
1623 rOut
<< SvxWeightItem(rOut
.GetWeightBold()?WEIGHT_NORMAL
:WEIGHT_BOLD
, RES_CHRATR_WEIGHT
);
1624 rOut
<< SvxFontHeightItem(240, 100, RES_CHRATR_FONTSIZE
);
1625 rOut
<< SvxFontItem(rMan
.GetFont(2));
1627 case 254: // heading 1
1628 rOut
<< SvxULSpaceItem(240, 0, RES_UL_SPACE
);
1629 rOut
<< SvxWeightItem(rOut
.GetWeightBold()?WEIGHT_NORMAL
:WEIGHT_BOLD
, RES_CHRATR_WEIGHT
);
1630 rOut
<< SvxUnderlineItem(UNDERLINE_SINGLE
, RES_CHRATR_UNDERLINE
);
1631 rOut
<< SvxFontHeightItem(240, 100, RES_CHRATR_FONTSIZE
);
1632 rOut
<< SvxFontItem(rMan
.GetFont(2));
1634 case 255: // Normal indent
1635 rOut
<< SvxLRSpaceItem(720, 0, 0, 0, RES_LR_SPACE
);
1638 rOut
<< SvxFontHeightItem(200, 100, RES_CHRATR_FONTSIZE
);
1640 default: // selbstdefiniert
1641 rOut
<< SvxFontHeightItem(200, 100, RES_CHRATR_FONTSIZE
);
1646 void Ww1StyleSheet::OutOne(Ww1Shell
& rOut
, Ww1Manager
& rMan
, USHORT stc
)
1648 const RES_POOL_COLLFMT_TYPE RES_NONE
= RES_POOLCOLL_DOC_END
;
1649 RES_POOL_COLLFMT_TYPE aType
= RES_NONE
;
1650 // aType = RES_POOLCOLL_JAKETADRESS; break;
1651 // aType = RES_POOLCOLL_LISTS_BEGIN; break;
1652 // aType = RES_POOLCOLL_SENDADRESS; break;
1653 // aType = RES_POOLCOLL_SIGNATURE; break;
1654 // aType = RES_POOLCOLL_TEXT_NEGIDENT; break;
1655 // aType = RES_POOLCOLL_TOX_IDXH; break;
1659 aType
= RES_POOLCOLL_TEXT
; break; //???
1660 case 223: // annotation reference
1662 case 224: // annotation text
1664 case 225: // table of contents 8
1665 aType
= RES_POOLCOLL_TOX_CNTNT8
; break;
1666 case 226: // table of contents 7
1667 aType
= RES_POOLCOLL_TOX_CNTNT7
; break;
1668 case 227: // table of contents 6
1669 aType
= RES_POOLCOLL_TOX_CNTNT6
; break;
1670 case 228: // table of contents 5
1671 aType
= RES_POOLCOLL_TOX_CNTNT5
; break;
1672 case 229: // table of contents 4
1673 aType
= RES_POOLCOLL_TOX_CNTNT4
; break;
1674 case 230: // table of contents 3
1675 aType
= RES_POOLCOLL_TOX_CNTNT3
; break;
1676 case 231: // table of contents 2
1677 aType
= RES_POOLCOLL_TOX_CNTNT2
; break;
1678 case 232: // table of contents 1
1679 aType
= RES_POOLCOLL_TOX_CNTNT1
; break;
1680 case 233: // index 7
1682 case 234: // index 6
1684 case 235: // index 5
1686 case 236: // index 4
1688 case 237: // index 3
1689 aType
= RES_POOLCOLL_TOX_IDX3
; break;
1690 case 238: // index 2
1691 aType
= RES_POOLCOLL_TOX_IDX2
; break;
1692 case 239: // index 1
1693 aType
= RES_POOLCOLL_TOX_IDX1
; break;
1694 case 240: // line number
1696 case 241: // index heading
1699 aType
= RES_POOLCOLL_FOOTER
; break;
1701 aType
= RES_POOLCOLL_HEADER
; break;
1702 case 244: // footnote reference
1704 case 245: // footnote text
1705 aType
= RES_POOLCOLL_FOOTNOTE
; break;
1706 case 246: // heading 9
1708 case 247: // heading 8
1710 case 248: // heading 7
1712 case 249: // heading 6
1714 case 250: // heading 5
1715 aType
= RES_POOLCOLL_HEADLINE5
; break;
1716 case 251: // heading 4
1717 aType
= RES_POOLCOLL_HEADLINE4
; break;
1718 case 252: // heading 3
1719 aType
= RES_POOLCOLL_HEADLINE3
; break;
1720 case 253: // heading 2
1721 aType
= RES_POOLCOLL_HEADLINE2
; break;
1722 case 254: // heading 1
1723 aType
= RES_POOLCOLL_HEADLINE1
; break;
1724 case 255: // Normal indent
1725 aType
= RES_POOLCOLL_TEXT_IDENT
; break;
1727 aType
= RES_POOLCOLL_STANDARD
; break;
1728 // aType = RES_POOLCOLL_TEXT; break; // Das ist "textkoerper"
1730 if (aType
== RES_NONE
)
1731 rOut
.BeginStyle(stc
, GetStyle(stc
).GetName() );
1733 rOut
.BeginStyle(stc
, aType
);
1734 OutDefaults(rOut
, rMan
, stc
);
1735 GetStyle(stc
).Out(rOut
, rMan
);
1737 // rMan.SetInApo(FALSE);
1739 // OutOneWithBase() liest einen Style mit OutOne() einen Style ein
1740 // Jedoch liest er, wenn noch nicht geschehen, den Basisstyle rekursiv ein
1741 void Ww1StyleSheet::OutOneWithBase(Ww1Shell
& rOut
, Ww1Manager
& rMan
,
1742 USHORT stc
, BYTE
* pbStopRecur
)
1744 // SH: lineares Einlesen ist Scheisse, da dann BasedOn nicht gesetzt
1745 // werden kann und ausserdem Toggle- und Modify-Attrs (z.B. Tabs ) nicht gehen.
1747 Ww1Style
& rSty
= GetStyle(stc
);
1748 USHORT nBase
= rSty
.GetnBase();
1750 && !rOut
.IsStyleImported( nBase
)
1751 && GetStyle(nBase
).IsUsed()
1752 && !pbStopRecur
[nBase
] ){
1754 pbStopRecur
[nBase
] = 1;
1755 OutOneWithBase( rOut
, rMan
, nBase
, pbStopRecur
); // Rekursiv
1757 OutOne( rOut
, rMan
, stc
);
1760 void Ww1StyleSheet::Out(Ww1Shell
& rOut
, Ww1Manager
& rMan
)
1763 BYTE bStopRecur
[256];
1764 memset( bStopRecur
, FALSE
, sizeof(bStopRecur
) );
1766 // 1. Durchlauf: Styles mit Basisstyles rekursiv
1767 for (stc
=0;stc
<Count();stc
++)
1768 if (GetStyle(stc
).IsUsed() && !rOut
.IsStyleImported( stc
) )
1769 OutOneWithBase( rOut
, rMan
, stc
, bStopRecur
);
1771 // 2. Durchlauf: Follow-Styles
1772 for (stc
=0;stc
<Count();stc
++){
1773 Ww1Style
& rSty
= GetStyle(stc
);
1774 if ( rSty
.IsUsed() ){
1775 USHORT nNext
= rSty
.GetnNext();
1776 if( nNext
!= stc
&& GetStyle(nNext
).IsUsed() )
1777 rOut
.NextStyle( stc
, nNext
);
1782 ////////////////////////////////////////////////////////////// Picture
1783 static ULONG
GuessPicSize(W1_PIC
* pPic
)
1785 USHORT maxx
= pPic
->mfp
.xExtGet();
1786 USHORT padx
= ((maxx
+ 7) / 8) * 8;
1787 USHORT maxy
= pPic
->mfp
.yExtGet();
1788 return 120L + (ULONG
)padx
* maxy
;
1792 // folgende methode schreibt eine windows-.BMP-datei aus einem
1793 // embeddeten bild in ww-1 dateien
1794 // gelesen wird 4-bit format, geschrieben jedoch 8-bit.
1796 void Ww1Picture::WriteBmp(SvStream
& rOut
)
1798 long nSize
= pPic
->lcbGet() - (sizeof(*pPic
)-sizeof(pPic
->rgb
));
1799 BYTE
* p
= pPic
->rgbGet();
1800 USHORT maxx
= pPic
->mfp
.xExtGet();
1801 USHORT padx
= ((maxx
+ 7) / 8) * 8;
1802 USHORT maxy
= pPic
->mfp
.yExtGet();
1804 /*USHORT unknown1 = SVBT16ToShort(p);*/ p
+= sizeof(SVBT16
); nSize
-= sizeof(SVBT16
);
1805 /*USHORT unknown2 = SVBT16ToShort(p);*/ p
+= sizeof(SVBT16
); nSize
-= sizeof(SVBT16
);
1806 #if OSL_DEBUG_LEVEL > 1
1807 USHORT x
= SVBT16ToShort(p
);
1810 p
+= sizeof(SVBT16
); nSize
-= sizeof(SVBT16
);
1811 #if OSL_DEBUG_LEVEL > 1
1812 USHORT y
= SVBT16ToShort(p
);
1815 p
+= sizeof(SVBT16
); nSize
-= sizeof(SVBT16
);
1816 #if OSL_DEBUG_LEVEL > 1
1817 USHORT planes
= SVBT16ToShort(p
);
1820 p
+= sizeof(SVBT16
); nSize
-= sizeof(SVBT16
);
1821 #if OSL_DEBUG_LEVEL > 1
1822 USHORT bitcount
= SVBT16ToShort(p
);
1825 p
+= sizeof(SVBT16
); nSize
-= sizeof(SVBT16
);
1827 #if OSL_DEBUG_LEVEL > 1
1828 DBG_ASSERT(x
==maxx
, "Ww1Picture");
1829 DBG_ASSERT(y
==maxy
, "Ww1Picture");
1830 DBG_ASSERT(planes
==1, "Ww1Picture");
1831 DBG_ASSERT(bitcount
==4, "Ww1Picture");
1834 DBG_ASSERT(16*3+padx
*maxy
/2==nSize
, "Ww1Picture");
1840 UInt32ToSVBT32(n, tmpLong); \
1841 if ((rOut.Write(tmpLong, sizeof(SVBT32))) != sizeof(SVBT32)) goto error;
1843 ShortToSVBT16(n, tmpShort); \
1844 if ((rOut.Write(tmpShort, sizeof(SVBT16))) != sizeof(SVBT16)) goto error;
1846 ByteToSVBT8(n, tmpByte); \
1847 if ((rOut.Write(tmpByte, sizeof(SVBT8))) != sizeof(SVBT8)) goto error;
1848 wByte('B'); wByte('M');
1849 wLong(54 + 4 * 16 + padx
* maxy
);
1864 for (i
=0;nSize
>0&&i
<16;i
++)
1868 nSize
-= sizeof(BYTE
);
1871 nSize
-= sizeof(BYTE
);
1874 nSize
-= sizeof(BYTE
);
1877 DBG_ASSERT(padx
*maxy
/2==nSize
, "Ww1Picture");
1881 BYTE
* pBuf
= new BYTE
[padx
];
1882 for (j
=0;nSize
>0&&j
<maxy
;j
++)
1885 for (i
=0;nSize
>0&&i
<maxx
;i
+=2)
1890 nSize
-= sizeof(BYTE
);
1896 nSize
-= sizeof(BYTE
);
1898 if(rOut
.Write(pBuf
, padx
) != padx
){
1906 for (j
=0;nSize
>0&&j
<maxy
;j
++)
1908 for (i
=0;nSize
>0&&i
<maxx
;i
+=2)
1913 nSize
-= sizeof(BYTE
);
1919 nSize
-= sizeof(BYTE
);
1923 DBG_ASSERT(nSize
==0, "Ww1Picture");
1933 void Ww1Picture::Out(Ww1Shell
& rOut
, Ww1Manager
& /*rMan*/)
1935 Graphic
* pGraphic
= 0;
1937 switch (mm
= pPic
->mfp
.mmGet())
1939 case 8: // embedded metafile
1941 SvMemoryStream
aOut(8192, 8192);
1942 aOut
.Write(pPic
->rgbGet(), pPic
->lcbGet() -
1943 (sizeof(*pPic
)-sizeof(pPic
->rgb
)));
1946 if (ReadWindowMetafile( aOut
, aWMF
, NULL
) && aWMF
.GetActionCount() > 0)
1948 aWMF
.SetPrefMapMode(MapMode(MAP_100TH_MM
));
1949 Size
aOldSiz(aWMF
.GetPrefSize());
1950 Size
aNewSiz(pPic
->mfp
.xExtGet(), pPic
->mfp
.yExtGet());
1951 Fraction
aFracX(aNewSiz
.Width(), aOldSiz
.Width());
1952 Fraction
aFracY(aNewSiz
.Height(), aOldSiz
.Height());
1953 aWMF
.Scale(aFracX
, aFracY
);
1954 aWMF
.SetPrefSize(aNewSiz
);
1955 pGraphic
= new Graphic(aWMF
);
1959 case 94: // embedded name SH:??? Was denn nun ? Embeddet oder Name ?
1960 case 98: // TIFF-Name
1962 String
aDir( (sal_Char
*)pPic
->rgbGet(),
1963 (USHORT
)(pPic
->lcbGet() - (sizeof(*pPic
)-sizeof(pPic
->rgb
))),
1964 RTL_TEXTENCODING_MS_1252
);
1965 //SvFileStream aOut(aDir, STREAM_READ|STREAM_WRITE|STREAM_TRUNC);
1966 rOut
.AddGraphic( aDir
);
1969 case 97: // embedded bitmap
1970 // case 99: // SH: bei meinem BspDoc 41738.doc auch embedded Bitmap,
1971 // aber leider anderes Format
1973 ULONG nSiz
= GuessPicSize(pPic
);
1974 SvMemoryStream
aOut(nSiz
, 8192);
1978 pGraphic
= new Graphic(aBmp
);
1981 DBG_ASSERT(pPic
->mfp
.mmGet() == 97, "Ww1Picture");
1987 ////////////////////////////////////////////////////////// HeaderFooter
1988 void Ww1HeaderFooter::Start(Ww1Shell
& rOut
, Ww1Manager
& rMan
)
1990 // wird sowieso nur bei SEPs aufgerufen, keine weitere pruefung
1995 switch (eHeaderFooterMode
)
2009 if (FillOddHeadL(begin
, end
))
2011 Ww1HddText
* pText
= new Ww1HddText(rMan
.GetFib());
2013 pText
->SetCount(end
-begin
);
2015 rMan
.Push1(pText
, pText
->Offset(rMan
.GetFib()), begin
,
2016 new Ww1HeaderFooterFields(rMan
.GetFib()));
2019 rOut
.EndHeaderFooter();
2030 if (FillOddFootL(begin
, end
))
2032 Ww1HddText
* pText
= new Ww1HddText(rMan
.GetFib());
2034 pText
->SetCount(end
-begin
);
2036 rMan
.Push1(pText
, pText
->Offset(rMan
.GetFib()), begin
,
2037 new Ww1HeaderFooterFields(rMan
.GetFib()));
2040 rOut
.EndHeaderFooter();
2053 void Ww1HeaderFooter::Stop(Ww1Shell
& rOut
, Ww1Manager
& rMan
, sal_Unicode
&)
2055 if (!rMan
.Pushed() && eHeaderFooterMode
!= None
2056 // && rMan.GetText().Where() >= rMan.GetText().Count()