diff options
author | Daniel Rentz [dr] <daniel.rentz@oracle.com> | 2010-12-27 12:33:29 +0100 |
---|---|---|
committer | Daniel Rentz [dr] <daniel.rentz@oracle.com> | 2010-12-27 12:33:29 +0100 |
commit | 13871cc725c830c55f6fe61ae7570b474a5ff390 (patch) | |
tree | f0b18e0c6496cf4af92599bf69ddd09471aaf639 /sw/source | |
parent | 97078addc33a29e6384d3a6114f8803647035d67 (diff) | |
parent | e41098c7b4b08da66511301d834782effa50915d (diff) |
dr77: rebase to DEV300m96
Diffstat (limited to 'sw/source')
227 files changed, 8851 insertions, 13204 deletions
diff --git a/sw/source/core/SwNumberTree/makefile.mk b/sw/source/core/SwNumberTree/makefile.mk deleted file mode 100644 index d67a3f321a..0000000000 --- a/sw/source/core/SwNumberTree/makefile.mk +++ /dev/null @@ -1,50 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=SwNumberTree - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -# --- Files -------------------------------------------------------- - -SLOFILES = \ - $(SLO)$/SwNumberTree.obj \ - $(SLO)$/SwNodeNum.obj - -EXCEPTIONSFILES = \ - $(SLO)$/SwNumberTree.obj - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/core/access/makefile.mk b/sw/source/core/access/makefile.mk deleted file mode 100644 index 72871314f7..0000000000 --- a/sw/source/core/access/makefile.mk +++ /dev/null @@ -1,100 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=access - -# --- Settings ----------------------------------------------------- -#ENABLE_EXCEPTIONS=TRUE - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -# --- Files -------------------------------------------------------- - -SLOFILES = \ - $(SLO)$/acccell.obj \ - $(SLO)$/acccontext.obj \ - $(SLO)$/accdoc.obj \ - $(SLO)$/accembedded.obj \ - $(SLO)$/accfootnote.obj \ - $(SLO)$/accframe.obj \ - $(SLO)$/accframebase.obj \ - $(SLO)$/accfrmobj.obj \ - $(SLO)$/accfrmobjmap.obj \ - $(SLO)$/accfrmobjslist.obj \ - $(SLO)$/accgraphic.obj \ - $(SLO)$/accheaderfooter.obj \ - $(SLO)$/acchyperlink.obj \ - $(SLO)$/acchypertextdata.obj \ - $(SLO)$/accmap.obj \ - $(SLO)$/accnotextframe.obj \ - $(SLO)$/accpage.obj \ - $(SLO)$/accpara.obj \ - $(SLO)$/accportions.obj \ - $(SLO)$/accpreview.obj \ - $(SLO)$/accselectionhelper.obj \ - $(SLO)$/acctable.obj \ - $(SLO)$/acctextframe.obj \ - $(SLO)$/textmarkuphelper.obj \ - $(SLO)$/parachangetrackinginfo.obj - -EXCEPTIONSFILES= \ - $(SLO)$/acccell.obj \ - $(SLO)$/acccontext.obj \ - $(SLO)$/accdoc.obj \ - $(SLO)$/accembedded.obj \ - $(SLO)$/accfootnote.obj \ - $(SLO)$/accframe.obj \ - $(SLO)$/accframebase.obj \ - $(SLO)$/accfrmobj.obj \ - $(SLO)$/accfrmobjmap.obj \ - $(SLO)$/accfrmobjslist.obj \ - $(SLO)$/accgraphic.obj \ - $(SLO)$/accheaderfooter.obj \ - $(SLO)$/acchyperlink.obj \ - $(SLO)$/acchypertextdata.obj \ - $(SLO)$/accmap.obj \ - $(SLO)$/accnotextframe.obj \ - $(SLO)$/accpage.obj \ - $(SLO)$/accpara.obj \ - $(SLO)$/accportions.obj \ - $(SLO)$/accpreview.obj \ - $(SLO)$/accselectionhelper.obj \ - $(SLO)$/acctable.obj \ - $(SLO)$/acctextframe.obj \ - $(SLO)$/textmarkuphelper.obj \ - $(SLO)$/parachangetrackinginfo.obj - -# --- Targets ------------------------------------------------------- - - -.INCLUDE : target.mk - diff --git a/sw/source/core/attr/makefile.mk b/sw/source/core/attr/makefile.mk deleted file mode 100644 index a3827d4776..0000000000 --- a/sw/source/core/attr/makefile.mk +++ /dev/null @@ -1,55 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=attr - -AUTOSEG=true - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -# --- Files -------------------------------------------------------- - -SLOFILES = \ - $(SLO)$/calbck.obj \ - $(SLO)$/cellatr.obj \ - $(SLO)$/fmtfollowtextflow.obj \ - $(SLO)$/fmtwrapinfluenceonobjpos.obj \ - $(SLO)$/format.obj \ - $(SLO)$/hints.obj \ - $(SLO)$/swatrset.obj - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/core/bastyp/makefile.mk b/sw/source/core/bastyp/makefile.mk deleted file mode 100644 index 8333dabd5f..0000000000 --- a/sw/source/core/bastyp/makefile.mk +++ /dev/null @@ -1,79 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=bastyp - -AUTOSEG=true - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -# --- Files -------------------------------------------------------- - -CXXFILES = \ - bparr.cxx \ - breakit.cxx \ - calc.cxx \ - checkit.cxx \ - index.cxx \ - init.cxx \ - ring.cxx \ - swcache.cxx \ - swrect.cxx \ - swregion.cxx \ - swtypes.cxx \ - tabcol.cxx \ - SwSmartTagMgr.cxx - -SLOFILES = \ - $(SLO)$/bparr.obj \ - $(SLO)$/breakit.obj \ - $(SLO)$/calc.obj \ - $(SLO)$/checkit.obj \ - $(SLO)$/index.obj \ - $(SLO)$/init.obj \ - $(SLO)$/ring.obj \ - $(SLO)$/swcache.obj \ - $(SLO)$/swrect.obj \ - $(SLO)$/swregion.obj \ - $(SLO)$/swtypes.obj \ - $(SLO)$/tabcol.obj \ - $(SLO)$/SwSmartTagMgr.obj - -EXCEPTIONSFILES = \ - $(SLO)$/tabcol.obj - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/core/crsr/makefile.mk b/sw/source/core/crsr/makefile.mk deleted file mode 100644 index a2571901c0..0000000000 --- a/sw/source/core/crsr/makefile.mk +++ /dev/null @@ -1,83 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=crsr - -AUTOSEG=true - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -.IF "$(mydebug)" != "" -CDEFS+=-Dmydebug -.ENDIF - -# --- Files -------------------------------------------------------- - -EXCEPTIONSFILES= \ - $(SLO)$/crbm.obj \ - $(SLO)$/crsrsh.obj \ - $(SLO)$/bookmrk.obj \ - $(SLO)$/viscrs.obj - -SLOFILES = \ - $(SLO)$/BlockCursor.obj \ - $(SLO)$/bookmrk.obj \ - $(SLO)$/callnk.obj \ - $(SLO)$/crbm.obj \ - $(SLO)$/crsrsh.obj \ - $(SLO)$/crstrvl.obj \ - $(SLO)$/crstrvl1.obj \ - $(SLO)$/findattr.obj \ - $(SLO)$/findcoll.obj \ - $(SLO)$/findfmt.obj \ - $(SLO)$/findtxt.obj \ - $(SLO)$/pam.obj \ - $(SLO)$/paminit.obj \ - $(SLO)$/swcrsr.obj \ - $(SLO)$/trvlcol.obj \ - $(SLO)$/trvlfnfl.obj \ - $(SLO)$/trvlreg.obj \ - $(SLO)$/trvltbl.obj \ - $(SLO)$/unocrsr.obj \ - $(SLO)$/viscrs.obj \ - $(SLO)$/crossrefbookmark.obj - -.IF "$(mydebug)" != "" -SLOFILES += \ - $(SLO)$/pamio.obj -.ENDIF - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 50bc3ffdfa..eb2f4b417f 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -206,6 +206,7 @@ bool SwDoc::get(/*[in]*/ DocumentSettingId id) const case PURGE_OLE: return mbPurgeOLE; case KERN_ASIAN_PUNCTUATION: return mbKernAsianPunctuation; case DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT: return mbDoNotResetParaAttrsForNumFont; + case MATH_BASELINE_ALIGNMENT: return mbMathBaselineAlignment; default: ASSERT(false, "Invalid setting id"); } @@ -304,7 +305,7 @@ void SwDoc::set(/*[in]*/ DocumentSettingId id, /*[in]*/ bool value) case UNIX_FORCE_ZERO_EXT_LEADING: mbUnixForceZeroExtLeading = value; break; - case PROTECT_FORM: + case PROTECT_FORM: mbProtectForm = value; break; @@ -345,6 +346,9 @@ void SwDoc::set(/*[in]*/ DocumentSettingId id, /*[in]*/ bool value) case DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT: mbDoNotResetParaAttrsForNumFont = value; break; + case MATH_BASELINE_ALIGNMENT: + mbMathBaselineAlignment = value; + break; default: ASSERT(false, "Invalid setting id"); } @@ -630,6 +634,8 @@ void SwDoc::setJobsetup(/*[in]*/ const JobSetup &rJobSetup ) SwPrintData* SwDoc::getPrintData() const { + if(!pPrtData) + ((SwDoc*)this)->pPrtData = new SwPrintData; return pPrtData; } @@ -2395,6 +2401,54 @@ BOOL SwDoc::RemoveInvisibleContent() EndUndo( UNDO_UI_DELETE_INVISIBLECNTNT, NULL ); return bRet; } +/*-- 25.08.2010 14:18:12--------------------------------------------------- + + -----------------------------------------------------------------------*/ +BOOL SwDoc::HasInvisibleContent() const +{ + BOOL bRet = sal_False; + + SwClientIter aIter( *GetSysFldType( RES_HIDDENPARAFLD ) ); + if( aIter.First( TYPE( SwFmtFld ) ) ) + bRet = sal_True; + + // + // Search for any hidden paragraph (hidden text attribute) + // + if( ! bRet ) + { + for( ULONG n = GetNodes().Count(); !bRet && (n > 0); ) + { + SwTxtNode* pTxtNd = GetNodes()[ --n ]->GetTxtNode(); + if ( pTxtNd ) + { + SwPaM aPam( *pTxtNd, 0, *pTxtNd, pTxtNd->GetTxt().Len() ); + if( pTxtNd->HasHiddenCharAttribute( true ) || ( pTxtNd->HasHiddenCharAttribute( false ) ) ) + { + bRet = sal_True; + } + } + } + } + + if( ! bRet ) + { + const SwSectionFmts& rSectFmts = GetSections(); + USHORT n; + + for( n = rSectFmts.Count(); !bRet && (n > 0); ) + { + SwSectionFmt* pSectFmt = rSectFmts[ --n ]; + // don't add sections in Undo/Redo + if( !pSectFmt->IsInNodesArr()) + continue; + SwSection* pSect = pSectFmt->GetSection(); + if( pSect->IsHidden() ) + bRet = sal_True; + } + } + return bRet; +} /*-- 11.06.2004 08:34:04--------------------------------------------------- -----------------------------------------------------------------------*/ @@ -2509,26 +2563,17 @@ bool SwDoc::LinksUpdated() const } // embedded alle lokalen Links (Bereiche/Grafiken) -bool SwDoc::EmbedAllLinks() +::sfx2::SvBaseLink* lcl_FindNextRemovableLink( const ::sfx2::SvBaseLinks& rLinks, sfx2::LinkManager& rLnkMgr ) { - BOOL bRet = FALSE; - sfx2::LinkManager& rLnkMgr = GetLinkManager(); - const ::sfx2::SvBaseLinks& rLnks = rLnkMgr.GetLinks(); - if( rLnks.Count() ) + for( USHORT n = 0; n < rLinks.Count(); ++n ) { - BOOL bDoesUndo = DoesUndo(); - DoUndo( FALSE ); - - for( USHORT n = 0; n < rLnks.Count(); ++n ) + ::sfx2::SvBaseLink* pLnk = &(*rLinks[ n ]); + if( pLnk && + ( OBJECT_CLIENT_GRF == pLnk->GetObjType() || + OBJECT_CLIENT_FILE == pLnk->GetObjType() ) && + pLnk->ISA( SwBaseLink ) ) { - ::sfx2::SvBaseLink* pLnk = &(*rLnks[ n ]); - if( pLnk && - ( OBJECT_CLIENT_GRF == pLnk->GetObjType() || - OBJECT_CLIENT_FILE == pLnk->GetObjType() ) && - pLnk->ISA( SwBaseLink ) ) - { ::sfx2::SvBaseLinkRef xLink = pLnk; - USHORT nCount = rLnks.Count(); String sFName; rLnkMgr.GetDisplayNames( xLink, 0, &sFName, 0, 0 ); @@ -2536,20 +2581,33 @@ bool SwDoc::EmbedAllLinks() INetURLObject aURL( sFName ); if( INET_PROT_FILE == aURL.GetProtocol() || INET_PROT_CID == aURL.GetProtocol() ) - { - // dem Link sagen, das er aufgeloest wird! - xLink->Closed(); + return pLnk; + } + } + return 0; +} +bool SwDoc::EmbedAllLinks() +{ + BOOL bRet = FALSE; + sfx2::LinkManager& rLnkMgr = GetLinkManager(); + const ::sfx2::SvBaseLinks& rLinks = rLnkMgr.GetLinks(); + if( rLinks.Count() ) + { + BOOL bDoesUndo = DoesUndo(); + DoUndo( FALSE ); - // falls einer vergessen hat sich auszutragen - if( xLink.Is() ) - rLnkMgr.Remove( xLink ); + ::sfx2::SvBaseLink* pLnk = 0; + while( 0 != (pLnk = lcl_FindNextRemovableLink( rLinks, rLnkMgr ) ) ) + { + ::sfx2::SvBaseLinkRef xLink = pLnk; + // dem Link sagen, das er aufgeloest wird! + xLink->Closed(); - if( nCount != rLnks.Count() + 1 ) - n = 0; // wieder von vorne anfangen, es wurden - // mehrere Links entfernt - bRet = TRUE; - } - } + // falls einer vergessen hat sich auszutragen + if( xLink.Is() ) + rLnkMgr.Remove( xLink ); + + bRet = TRUE; } DelAllUndoObj(); diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx index b42b5f808e..3086529999 100644 --- a/sw/source/core/doc/doclay.cxx +++ b/sw/source/core/doc/doclay.cxx @@ -1474,7 +1474,10 @@ SwFlyFrmFmt* SwDoc::InsertLabel( const SwLabelType eType, const String &rTxt, co aTxt += ' '; } xub_StrLen nIdx = aTxt.Len(); - aTxt += rSeparator; + if( rTxt.Len() > 0 ) + { + aTxt += rSeparator; + } xub_StrLen nSepIdx = aTxt.Len(); aTxt += rTxt; diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index 4576a9da08..33819154ef 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -366,6 +366,7 @@ SwDoc::SwDoc() : mbUseFormerObjectPos = aOptions.IsUseObjectPositioning(); mbUseFormerTextWrapping = aOptions.IsUseOurTextWrapping(); mbConsiderWrapOnObjPos = aOptions.IsConsiderWrappingStyle(); + mbMathBaselineAlignment = false; // default for *old* documents is 'off' mbAddFlyOffsets = false; // hidden mbOldNumbering = false; // hidden mbUseHiResolutionVirtualDevice = true; // hidden diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx index 4c80d17be0..16ecb59377 100644 --- a/sw/source/core/doc/doctxm.cxx +++ b/sw/source/core/doc/doctxm.cxx @@ -2380,8 +2380,7 @@ Range SwTOXBaseSection::GetKeyRange(const String& rStr, const String& rStrReadin if( rIntl.IsEqual( sMyString, sMyStringReading, pBase->GetLocale(), sToCompare, sToCompareReading, rNew.GetLocale() ) && - pBase->GetLevel() == nLevel && - pBase->GetType() == TOX_SORT_CUSTOM ) + pBase->GetLevel() == nLevel ) break; } if(i == nMax) diff --git a/sw/source/core/doc/makefile.mk b/sw/source/core/doc/makefile.mk deleted file mode 100644 index 5a65b2de24..0000000000 --- a/sw/source/core/doc/makefile.mk +++ /dev/null @@ -1,92 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=doc - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -# --- Files -------------------------------------------------------- - -EXCEPTIONSFILES = \ - $(SLO)$/SwStyleNameMapper.obj \ - $(SLO)$/acmplwrd.obj \ - $(SLO)$/dbgoutsw.obj \ - $(SLO)$/doc.obj \ - $(SLO)$/docbm.obj \ - $(SLO)$/doccomp.obj \ - $(SLO)$/docdraw.obj \ - $(SLO)$/docedt.obj \ - $(SLO)$/docfmt.obj \ - $(SLO)$/docglbl.obj \ - $(SLO)$/docglos.obj \ - $(SLO)$/doclay.obj \ - $(SLO)$/docxforms.obj \ - $(SLO)$/docnew.obj \ - $(SLO)$/docnum.obj \ - $(SLO)$/docsort.obj \ - $(SLO)$/doctxm.obj \ - $(SLO)$/number.obj \ - $(SLO)$/swstylemanager.obj \ - $(SLO)$/tblcpy.obj \ - $(SLO)$/tblrwcl.obj \ - $(SLO)$/list.obj - -SLOFILES = $(EXCEPTIONSFILES) \ - $(SLO)$/docbasic.obj \ - $(SLO)$/docchart.obj \ - $(SLO)$/doccorr.obj \ - $(SLO)$/docdde.obj \ - $(SLO)$/docdesc.obj \ - $(SLO)$/docfld.obj \ - $(SLO)$/docfly.obj \ - $(SLO)$/docftn.obj \ - $(SLO)$/docredln.obj \ - $(SLO)$/docruby.obj \ - $(SLO)$/docstat.obj \ - $(SLO)$/extinput.obj \ - $(SLO)$/fmtcol.obj \ - $(SLO)$/ftnidx.obj \ - $(SLO)$/gctable.obj \ - $(SLO)$/lineinfo.obj \ - $(SLO)$/notxtfrm.obj \ - $(SLO)$/poolfmt.obj \ - $(SLO)$/sortopt.obj \ - $(SLO)$/swserv.obj \ - $(SLO)$/tblafmt.obj \ - $(SLO)$/visiturl.obj \ - $(SLO)$/htmltbl.obj - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx index 5d93e0371d..c5bcda08fe 100644 --- a/sw/source/core/doc/tblrwcl.cxx +++ b/sw/source/core/doc/tblrwcl.cxx @@ -2924,10 +2924,10 @@ BOOL lcl_InsOtherBox( SwTableLine* pLine, CR_SetBoxWidth& rParam, if( rParam.bLeft ? ((nDist + nWidth / 2 ) <= rParam.nSide && (TBLFIX_CHGABS != rParam.nMode || - n < rBoxes.Count() && + (n < rBoxes.Count() && (nDist + nWidth + rBoxes[ n+1 ]-> GetFrmFmt()->GetFrmSize().GetWidth() / 2) - > rParam.nSide )) + > rParam.nSide) )) : (nDist + nWidth / 2 ) > rParam.nSide ) { @@ -2989,10 +2989,10 @@ BOOL lcl_InsOtherBox( SwTableLine* pLine, CR_SetBoxWidth& rParam, if( nLowerDiff || (rParam.bLeft ? ((nDist + nWidth / 2 ) <= rParam.nSide && (TBLFIX_CHGABS != rParam.nMode || - n < rBoxes.Count() && + (n < rBoxes.Count() && (nDist + nWidth + rBoxes[ n+1 ]-> GetFrmFmt()->GetFrmSize().GetWidth() / 2) - > rParam.nSide )) + > rParam.nSide) )) : (nDist + nWidth / 2 ) > rParam.nSide )) { if( !nLowerDiff ) @@ -3113,7 +3113,7 @@ void lcl_ChgBoxSize( SwTableBox& rBox, CR_SetBoxWidth& rParam, const SwFmtFrmSize& rOldSz, USHORT& rDelWidth, SwTwips nDist ) { - long nDiff; + long nDiff = 0; BOOL bSetSize = FALSE; switch( rParam.nMode ) diff --git a/sw/source/core/docnode/makefile.mk b/sw/source/core/docnode/makefile.mk deleted file mode 100644 index d3e5df64b6..0000000000 --- a/sw/source/core/docnode/makefile.mk +++ /dev/null @@ -1,82 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=docnode - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -# --- Files -------------------------------------------------------- - -EXCEPTIONSFILES= \ - $(SLO)$/cancellablejob.obj \ - $(SLO)$/finalthreadmanager.obj \ - $(SLO)$/ndcopy.obj \ - $(SLO)$/ndtbl.obj \ - $(SLO)$/node.obj \ - $(SLO)$/observablethread.obj \ - $(SLO)$/retrieveinputstream.obj \ - $(SLO)$/retrievedinputstreamdata.obj \ - $(SLO)$/swbaslnk.obj \ - $(SLO)$/threadmanager.obj - -SLOFILES = \ - $(SLO)$/ndindex.obj \ - $(SLO)$/ndcopy.obj \ - $(SLO)$/ndnotxt.obj \ - $(SLO)$/ndnum.obj \ - $(SLO)$/ndsect.obj \ - $(SLO)$/ndtbl.obj \ - $(SLO)$/ndtbl1.obj \ - $(SLO)$/node.obj \ - $(SLO)$/node2lay.obj \ - $(SLO)$/nodes.obj \ - $(SLO)$/section.obj \ - $(SLO)$/swbaslnk.obj \ - $(SLO)$/retrievedinputstreamdata.obj \ - $(SLO)$/observablethread.obj \ - $(SLO)$/cancellablejob.obj \ - $(SLO)$/retrieveinputstream.obj \ - $(SLO)$/retrieveinputstreamconsumer.obj \ - $(SLO)$/threadlistener.obj \ - $(SLO)$/threadmanager.obj \ - $(SLO)$/swthreadmanager.obj \ - $(SLO)$/swthreadjoiner.obj \ - $(SLO)$/pausethreadstarting.obj \ - $(SLO)$/finalthreadmanager.obj - - -# --- Targets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/core/draw/dview.cxx b/sw/source/core/draw/dview.cxx index f709decc3e..d6189a6b82 100644 --- a/sw/source/core/draw/dview.cxx +++ b/sw/source/core/draw/dview.cxx @@ -32,6 +32,7 @@ #include <editeng/protitem.hxx> #include <svx/svdpagv.hxx> #include <svx/fmmodel.hxx> +#include <sot/exchange.hxx> #include "swtypes.hxx" #include "pagefrm.hxx" @@ -991,6 +992,14 @@ void SwDrawView::CheckPossibilities() bSzProtect |= ( embed::EmbedMisc::EMBED_NEVERRESIZE & xObj->getStatus( embed::Aspects::MSOLE_CONTENT ) ) ? TRUE : FALSE; // <-- + + // #i972: protect position if it is a Math object anchored 'as char' and baseline alignment is activated + SwDoc* pDoc = Imp().GetShell()->GetDoc(); + const bool bProtectMathPos = SotExchange::IsMath( xObj->getClassID() ) + && FLY_AS_CHAR == pFly->GetFmt()->GetAnchor().GetAnchorId() + && pDoc->get( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT ); + if (bProtectMathPos) + bMoveProtect = true; } } } @@ -1112,4 +1121,3 @@ const SdrMarkList& SwDrawView::GetMarkedObjectList() const - diff --git a/sw/source/core/draw/makefile.mk b/sw/source/core/draw/makefile.mk deleted file mode 100644 index a57b1b530e..0000000000 --- a/sw/source/core/draw/makefile.mk +++ /dev/null @@ -1,60 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=draw - -AUTOSEG=true - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - - -# --- Files -------------------------------------------------------- - -SLOFILES = \ - $(SLO)$/dview.obj \ - $(SLO)$/dcontact.obj \ - $(SLO)$/dflyobj.obj \ - $(SLO)$/drawdoc.obj \ - $(SLO)$/dobjfac.obj \ - $(SLO)$/dpage.obj - -EXCEPTIONSFILES= \ - $(SLO)$/dview.obj \ - $(SLO)$/dcontact.obj \ - $(SLO)$/drawdoc.obj - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/core/edit/edsect.cxx b/sw/source/core/edit/edsect.cxx index fa1c234c0a..82fcb3603a 100644 --- a/sw/source/core/edit/edsect.cxx +++ b/sw/source/core/edit/edsect.cxx @@ -143,8 +143,8 @@ BOOL SwEditShell::IsAnySectionInDoc( BOOL bChkReadOnly, BOOL bChkHidden, BOOL bC const SwSectionFmt* pFmt = rFmts[ n ]; if( pFmt->IsInNodesArr() && (bChkTOX || - (eTmpType = pFmt->GetSection()->GetType()) != TOX_CONTENT_SECTION - && TOX_HEADER_SECTION != eTmpType )) + ( (eTmpType = pFmt->GetSection()->GetType()) != TOX_CONTENT_SECTION + && TOX_HEADER_SECTION != eTmpType ) ) ) { const SwSection& rSect = *rFmts[ n ]->GetSection(); if( (!bChkReadOnly && !bChkHidden ) || diff --git a/sw/source/core/edit/makefile.mk b/sw/source/core/edit/makefile.mk deleted file mode 100644 index a7820b4058..0000000000 --- a/sw/source/core/edit/makefile.mk +++ /dev/null @@ -1,71 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=edit - -AUTOSEG=true - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -# --- Files -------------------------------------------------------- - -EXCEPTIONSFILES=\ - $(SLO)$/eddel.obj \ - $(SLO)$/edlingu.obj \ - $(SLO)$/edfldexp.obj \ - $(SLO)$/edtab.obj - -SLOFILES = \ - $(EXCEPTIONSFILES)\ - $(SLO)$/acorrect.obj \ - $(SLO)$/autofmt.obj \ - $(SLO)$/edatmisc.obj \ - $(SLO)$/edattr.obj \ - $(SLO)$/edfcol.obj \ - $(SLO)$/edfld.obj \ - $(SLO)$/edfmt.obj \ - $(SLO)$/edglbldc.obj \ - $(SLO)$/edglss.obj \ - $(SLO)$/editsh.obj \ - $(SLO)$/ednumber.obj \ - $(SLO)$/edredln.obj \ - $(SLO)$/edtox.obj \ - $(SLO)$/edundo.obj \ - $(SLO)$/edws.obj \ - $(SLO)$/edsect.obj - -# --- Targets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/core/except/dbgloop.cxx b/sw/source/core/except/dbgloop.cxx index 266a0817a2..e95c30bc34 100644 --- a/sw/source/core/except/dbgloop.cxx +++ b/sw/source/core/except/dbgloop.cxx @@ -28,9 +28,8 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" -#ifndef DBG_UTIL -#error Wer fummelt denn an den makefiles rum? -#endif +#ifdef DBG_UTIL + #include <tools/stream.hxx> #include "dbgloop.hxx" #include "errhdl.hxx" @@ -165,4 +164,5 @@ int main() } #endif +#endif // DBG_UTIL diff --git a/sw/source/core/except/errhdl.cxx b/sw/source/core/except/errhdl.cxx index a09d1c1f59..41ada4306d 100644 --- a/sw/source/core/except/errhdl.cxx +++ b/sw/source/core/except/errhdl.cxx @@ -27,6 +27,9 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" + +#ifdef DBG_UTIL + #define _ERRHDL_CXX @@ -129,4 +132,5 @@ void AssertFail( USHORT nErrorId, const sal_Char* pFileName, USHORT nLine ) AssertFail( pMsg, pFileName, nLine ); } +#endif // DBG_UTIL diff --git a/sw/source/core/except/makefile.mk b/sw/source/core/except/makefile.mk deleted file mode 100644 index 19450849b5..0000000000 --- a/sw/source/core/except/makefile.mk +++ /dev/null @@ -1,60 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=except - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk - -# hier kein PCH! -prjpch= -PRJPCH= - -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -# --- Files -------------------------------------------------------- - -CXXFILES = - -.IF "$(dbgutil)"!="" -CXXFILES += \ - errhdl.cxx \ - dbgloop.cxx - -SLOFILES += \ - $(SLO)$/errhdl.obj \ - $(SLO)$/dbgloop.obj -.ENDIF -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/core/fields/makefile.mk b/sw/source/core/fields/makefile.mk deleted file mode 100644 index 280fff6aae..0000000000 --- a/sw/source/core/fields/makefile.mk +++ /dev/null @@ -1,94 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=fields - -AUTOSEG=true - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -# --- Files -------------------------------------------------------- - -CXXFILES = \ - authfld.cxx \ - cellfml.cxx \ - chpfld.cxx \ - dbfld.cxx \ - ddefld.cxx \ - ddetbl.cxx \ - docufld.cxx \ - expfld.cxx \ - fldbas.cxx \ - flddat.cxx \ - flddropdown.cxx \ - scrptfld.cxx \ - macrofld.cxx \ - fldlst.cxx \ - postithelper.cxx \ - reffld.cxx \ - tblcalc.cxx \ - usrfld.cxx - - - -SLOFILES = \ - $(SLO)$/textapi.obj \ - $(SLO)$/authfld.obj \ - $(SLO)$/cellfml.obj \ - $(SLO)$/chpfld.obj \ - $(SLO)$/dbfld.obj \ - $(SLO)$/ddefld.obj \ - $(SLO)$/ddetbl.obj \ - $(SLO)$/docufld.obj \ - $(SLO)$/expfld.obj \ - $(SLO)$/fldbas.obj \ - $(SLO)$/flddat.obj \ - $(SLO)$/flddropdown.obj \ - $(SLO)$/fldlst.obj \ - $(SLO)$/scrptfld.obj \ - $(SLO)$/macrofld.obj \ - $(SLO)$/postithelper.obj \ - $(SLO)$/reffld.obj \ - $(SLO)$/tblcalc.obj \ - $(SLO)$/usrfld.obj - -EXCEPTIONSFILES = \ - $(SLO)$/flddropdown.obj \ - $(SLO)$/postithelper.obj \ - $(SLO)$/docufld.obj - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx index f220f409d6..7b965669ad 100644 --- a/sw/source/core/frmedt/fefly1.cxx +++ b/sw/source/core/frmedt/fefly1.cxx @@ -27,6 +27,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" + #include <hintids.hxx> #include <svl/itemiter.hxx> #include <svtools/imapobj.hxx> @@ -69,10 +70,15 @@ #include <fldbas.hxx> #include <fmtfld.hxx> #include <swundo.hxx> +#include <frame.hxx> +#include <notxtfrm.hxx> // --> OD 2006-03-06 #125892# #include <HandleAnchorNodeChg.hxx> // <-- #include <frmatr.hxx> +// --> 3.7.2010 #i972# +#include <ndole.hxx> +// <-- // --> OD 2009-12-29 #i89920# #include <fmtsrnd.hxx> #include <editeng/opaqitem.hxx> @@ -1522,6 +1528,12 @@ Size SwFEShell::RequestObjectResize( const SwRect &rRect, const uno::Reference < pFly->ChgRelPos( aTmp ); } } + + SwFlyFrmFmt *pFlyFrmFmt = pFly->GetFmt(); + ASSERT( pFlyFrmFmt, "fly frame format missing!" ); + if ( pFlyFrmFmt ) + pFlyFrmFmt->SetLastFlyFrmPrtRectPos( pFly->Prt().Pos() ); //stores the value of last Prt rect + EndAllAction(); return aResult; @@ -1587,6 +1599,20 @@ const String& SwFEShell::GetFlyName() const } +const uno::Reference < embed::XEmbeddedObject > SwFEShell::GetOleRef() const +{ + uno::Reference < embed::XEmbeddedObject > xObj; + SwFlyFrm * pFly = FindFlyFrm(); + if (pFly && pFly->Lower() && pFly->Lower()->IsNoTxtFrm()) + { + SwOLENode *pNd = ((SwNoTxtFrm*)pFly->Lower())->GetNode()->GetOLENode(); + if (pNd) + xObj = pNd->GetOLEObj().GetOleRef(); + } + return xObj; +} + + String SwFEShell::GetUniqueGrfName() const { return GetDoc()->GetUniqueGrfName(); @@ -2153,4 +2179,93 @@ void SwFEShell::SetObjDescription( const String& rDescription ) } } } -// <-- + + +void SwFEShell::AlignFormulaToBaseline( const uno::Reference < embed::XEmbeddedObject >& xObj, SwFlyFrm * pFly ) +{ +#if OSL_DEBUG_LEVEL > 1 + SvGlobalName aCLSID( xObj->getClassID() ); + const bool bStarMath = ( SotExchange::IsMath( aCLSID ) != 0 ); + ASSERT( bStarMath, "AlignFormulaToBaseline should only be called for Math objects" ); + + if ( !bStarMath ) + return; +#endif + + if (!pFly) + pFly = FindFlyFrm( xObj ); + ASSERT( pFly , "No fly frame!" ); + SwFrmFmt * pFrmFmt = pFly ? pFly->GetFmt() : 0; + + // baseline to baseline alignment should only be applied to formulas anchored as char + if ( pFly && pFrmFmt && FLY_AS_CHAR == pFrmFmt->GetAnchor().GetAnchorId() ) + { + // get baseline from Math object + uno::Any aBaseline; + if( svt::EmbeddedObjectRef::TryRunningState( xObj ) ) + { + uno::Reference < beans::XPropertySet > xSet( xObj->getComponent(), uno::UNO_QUERY ); + if ( xSet.is() ) + { + try + { + aBaseline = xSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BaseLine") ) ); + } + catch ( uno::Exception& ) + { + ASSERT( FALSE , "Baseline could not be retrieved from Starmath!" ); + } + } + } + + sal_Int32 nBaseline = ::comphelper::getINT32(aBaseline); + const MapMode aSourceMapMode( MAP_100TH_MM ); + const MapMode aTargetMapMode( MAP_TWIP ); + nBaseline = OutputDevice::LogicToLogic( nBaseline, aSourceMapMode.GetMapUnit(), aTargetMapMode.GetMapUnit() ); + + ASSERT( nBaseline > 0, "Wrong value of Baseline while retrieving from Starmath!" ); + //nBaseline must be moved by aPrt position + const SwFlyFrmFmt *pFlyFrmFmt = pFly->GetFmt(); + ASSERT( pFlyFrmFmt, "fly frame format missing!" ); + if ( pFlyFrmFmt ) + nBaseline += pFlyFrmFmt->GetLastFlyFrmPrtRectPos().Y(); + + const SwFmtVertOrient &rVert = pFrmFmt->GetVertOrient(); + SwFmtVertOrient aVert( rVert ); + aVert.SetPos( -nBaseline ); + aVert.SetVertOrient( com::sun::star::text::VertOrientation::NONE ); + + pFrmFmt->LockModify(); + pFrmFmt->SetFmtAttr( aVert ); + pFrmFmt->UnlockModify(); + pFly->InvalidatePos(); + } +} + + +void SwFEShell::AlignAllFormulasToBaseline() +{ + StartAllAction(); + + SwStartNode *pStNd; + SwNodeIndex aIdx( *GetNodes().GetEndOfAutotext().StartOfSectionNode(), 1 ); + while ( 0 != (pStNd = aIdx.GetNode().GetStartNode()) ) + { + ++aIdx; + SwOLENode *pOleNode = dynamic_cast< SwOLENode * >( &aIdx.GetNode() ); + if ( pOleNode ) + { + const uno::Reference < embed::XEmbeddedObject > & xObj( pOleNode->GetOLEObj().GetOleRef() ); + if (xObj.is()) + { + SvGlobalName aCLSID( xObj->getClassID() ); + if ( SotExchange::IsMath( aCLSID ) ) + AlignFormulaToBaseline( xObj ); + } + } + + aIdx.Assign( *pStNd->EndOfSectionNode(), + 1 ); + } + + EndAllAction(); +} diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx index af73e87a7d..4ee15110bd 100644 --- a/sw/source/core/frmedt/feshview.cxx +++ b/sw/source/core/frmedt/feshview.cxx @@ -27,7 +27,9 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" + #include <com/sun/star/embed/EmbedMisc.hpp> + #include "hintids.hxx" #include <svx/sdrobjectfilter.hxx> @@ -48,9 +50,9 @@ #include <svx/svdpage.hxx> #include <svx/svdpagv.hxx> -#ifndef _POOLFMT_HRC +#include <IDocumentSettingAccess.hxx> +#include <cmdid.h> #include <poolfmt.hrc> // fuer InitFldTypes -#endif #include <frmfmt.hxx> #include <frmatr.hxx> #include <fmtfsize.hxx> @@ -1475,10 +1477,12 @@ const SdrObject* SwFEShell::GetBestObject( BOOL bNext, USHORT /*GOTOOBJ_...*/ eT break; } - if( (bNext? (aPos.Y() < aCurPos.Y()) : // nur unter mir + if( ( + (bNext? (aPos.Y() < aCurPos.Y()) : // nur unter mir (aPos.Y() > aCurPos.Y())) && // " reverse (bNext? (aBestPos.Y() > aCurPos.Y()) : // naeher drunter - (aBestPos.Y() < aCurPos.Y())) || // " reverse + (aBestPos.Y() < aCurPos.Y())) + ) || // " reverse (aBestPos.Y() == aCurPos.Y() && (bNext? (aBestPos.X() > aCurPos.X()) : // weiter links (aBestPos.X() < aCurPos.X())))) // " reverse @@ -2573,26 +2577,32 @@ BYTE SwFEShell::IsSelObjProtected( USHORT eType ) const nChk |= ( pObj->IsMoveProtect() ? FLYPROTECT_POS : 0 ) | ( pObj->IsResizeProtect()? FLYPROTECT_SIZE : 0 ); - if( FLYPROTECT_CONTENT & eType && pObj->ISA(SwVirtFlyDrawObj) ) + if( pObj->ISA(SwVirtFlyDrawObj) ) { SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm(); - if ( pFly->GetFmt()->GetProtect().IsCntntProtected() ) + if ( (FLYPROTECT_CONTENT & eType) && pFly->GetFmt()->GetProtect().IsCntntProtected() ) nChk |= FLYPROTECT_CONTENT; if ( pFly->Lower() && pFly->Lower()->IsNoTxtFrm() ) { SwOLENode *pNd = ((SwCntntFrm*)pFly->Lower())->GetNode()->GetOLENode(); - if ( pNd ) + uno::Reference < embed::XEmbeddedObject > xObj( pNd ? pNd->GetOLEObj().GetOleRef() : 0 ); + if ( xObj.is() ) { - uno::Reference < embed::XEmbeddedObject > xObj = pNd->GetOLEObj().GetOleRef(); - // TODO/LATER: use correct aspect - if ( xObj.is() && - embed::EmbedMisc::EMBED_NEVERRESIZE & xObj->getStatus( embed::Aspects::MSOLE_CONTENT ) ) + const bool bNeverResize = (embed::EmbedMisc::EMBED_NEVERRESIZE & xObj->getStatus( embed::Aspects::MSOLE_CONTENT )); + if ( (FLYPROTECT_CONTENT & eType) && bNeverResize ) { nChk |= FLYPROTECT_SIZE; nChk |= FLYPROTECT_FIXED; } + + // set FLYPROTECT_POS if it is a Math object anchored 'as char' and baseline alignment is activated + const bool bProtectMathPos = SotExchange::IsMath( xObj->getClassID() ) + && FLY_AS_CHAR == pFly->GetFmt()->GetAnchor().GetAnchorId() + && pDoc->get( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT ); + if ((FLYPROTECT_POS & eType) && bProtectMathPos) + nChk |= FLYPROTECT_POS; } } } diff --git a/sw/source/core/frmedt/makefile.mk b/sw/source/core/frmedt/makefile.mk deleted file mode 100644 index 45344a44f5..0000000000 --- a/sw/source/core/frmedt/makefile.mk +++ /dev/null @@ -1,76 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=frmedt - -AUTOSEG=true - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - - -.IF "$(mydebug)" != "" -CDEFS+=-Dmydebug -.ENDIF - -# --- Files -------------------------------------------------------- - -CXXFILES = \ - fecopy.cxx \ - fedesc.cxx \ - fefly1.cxx \ - feflyole.cxx \ - feshview.cxx \ - fetab.cxx \ - fews.cxx \ - tblsel.cxx - - - -SLOFILES = $(EXCEPTIONSFILES) \ - $(SLO)$/fedesc.obj \ - $(SLO)$/feflyole.obj \ - $(SLO)$/feshview.obj \ - $(SLO)$/fetab.obj \ - -EXCEPTIONSFILES=\ - $(SLO)$/tblsel.obj \ - $(SLO)$/fecopy.obj \ - $(SLO)$/fefly1.obj \ - $(SLO)$/fews.obj - - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx index 0dd2e17c17..bba4674c77 100644 --- a/sw/source/core/frmedt/tblsel.cxx +++ b/sw/source/core/frmedt/tblsel.cxx @@ -1746,8 +1746,8 @@ void lcl_FindStartEndCol( const SwLayoutFrm *&rpStart, (!pTmp->IsCellFrm() || ( ( ! bRTL && (pTmp->Frm().*fnRect->fnGetLeft)() < nSX && (pTmp->Frm().*fnRect->fnGetRight)()< nSX2 ) || - bRTL && (pTmp->Frm().*fnRect->fnGetLeft)() > nSX && - (pTmp->Frm().*fnRect->fnGetRight)()> nSX2 ) ) ) + ( bRTL && (pTmp->Frm().*fnRect->fnGetLeft)() > nSX && + (pTmp->Frm().*fnRect->fnGetRight)()> nSX2 ) ) ) ) pTmp = pTmp->GetNextLayoutLeaf(); if ( pTmp ) diff --git a/sw/source/core/graphic/makefile.mk b/sw/source/core/graphic/makefile.mk deleted file mode 100644 index bb637de666..0000000000 --- a/sw/source/core/graphic/makefile.mk +++ /dev/null @@ -1,53 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=graphic - -AUTOSEG=true - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -# --- Files -------------------------------------------------------- - -SLOFILES = \ - $(SLO)$/grfatr.obj \ - $(SLO)$/ndgrf.obj - -EXCEPTIONSFILES= \ - $(SLO)$/ndgrf.obj - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/core/inc/flyfrm.hxx b/sw/source/core/inc/flyfrm.hxx index 5734a0b1e3..2dcfcf614f 100644 --- a/sw/source/core/inc/flyfrm.hxx +++ b/sw/source/core/inc/flyfrm.hxx @@ -28,9 +28,9 @@ #define SW_FLYFRM_HXX #include "layfrm.hxx" +#include "frmfmt.hxx" class SwPageFrm; -class SwFlyFrmFmt; class SwFmtFrmSize; struct SwCrsrMoveState; class SwBorderAttrs; @@ -284,5 +284,11 @@ public: @author OD */ virtual bool IsFormatPossible() const; + + // overwriting "SwFrmFmt *SwLayoutFrm::GetFmt" to provide the correct derived return type. + // (This is in order to skip on the otherwise necessary casting of the result to + // 'SwFlyFrmFmt *' after calls to this function. The casting is now done in this function.) + virtual const SwFlyFrmFmt *GetFmt() const; + virtual SwFlyFrmFmt *GetFmt(); }; #endif diff --git a/sw/source/core/inc/layfrm.hxx b/sw/source/core/inc/layfrm.hxx index 16744a335f..d827a71f95 100644 --- a/sw/source/core/inc/layfrm.hxx +++ b/sw/source/core/inc/layfrm.hxx @@ -124,9 +124,9 @@ public: // <-- BOOL IsAnLower( const SwFrm * ) const; - const SwFrmFmt *GetFmt() const { return (const SwFrmFmt*)GetDep(); } - SwFrmFmt *GetFmt() { return (SwFrmFmt*)GetDep(); } - void SetFrmFmt( SwFrmFmt* ); + virtual const SwFrmFmt *GetFmt() const; + virtual SwFrmFmt *GetFmt(); + void SetFrmFmt( SwFrmFmt* ); //Verschieben der Ftns aller Lower - ab dem StartCntnt. //TRUE wenn mindestens eine Ftn verschoben wurde. diff --git a/sw/source/core/inc/makefile.mk b/sw/source/core/inc/makefile.mk deleted file mode 100644 index 1b35ca4954..0000000000 --- a/sw/source/core/inc/makefile.mk +++ /dev/null @@ -1,26 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* diff --git a/sw/source/core/layout/dbg_lay.cxx b/sw/source/core/layout/dbg_lay.cxx index 4f53e680bc..d1599af163 100644 --- a/sw/source/core/layout/dbg_lay.cxx +++ b/sw/source/core/layout/dbg_lay.cxx @@ -28,6 +28,8 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" +#ifdef DBG_UTIL + /* -----------------08.01.99 14:55------------------- * Und hier die Beschreibung: * @@ -863,4 +865,5 @@ void SwFrmChangesLeave::Leave() SwProtocol::Record( pFrm, PROT_FRMCHANGES, 0, &aFrm ); } +#endif // DBG_UTIL diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index 7b09b9983e..58efef39b4 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -1273,6 +1273,7 @@ void SwFlyFrm::ChgRelPos( const Point &rNewPos ) aHori.SetPos( nTmpX ); aSet.Put( aHori ); } + SetCurrRelPos( rNewPos ); pFmt->GetDoc()->SetAttr( aSet, *pFmt ); } } @@ -2851,3 +2852,14 @@ bool SwFlyFrm::IsFormatPossible() const return SwAnchoredObject::IsFormatPossible() && !IsLocked() && !IsColLocked(); } + +const SwFlyFrmFmt * SwFlyFrm::GetFmt() const +{ + return static_cast< const SwFlyFrmFmt * >( GetDep() ); +} + +SwFlyFrmFmt * SwFlyFrm::GetFmt() +{ + return static_cast< SwFlyFrmFmt * >( GetDep() ); +} + diff --git a/sw/source/core/layout/flyincnt.cxx b/sw/source/core/layout/flyincnt.cxx index 7956827165..e6a9c1472e 100644 --- a/sw/source/core/layout/flyincnt.cxx +++ b/sw/source/core/layout/flyincnt.cxx @@ -358,3 +358,4 @@ void SwFlyInCntFrm::MakeAll() } Unlock(); } + diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx index 73e7032cf6..303be382ad 100644 --- a/sw/source/core/layout/layact.cxx +++ b/sw/source/core/layout/layact.cxx @@ -1077,7 +1077,7 @@ static bool lcl_IsInvaLay( const SwFrm *pFrm, long nBottom ) { if ( !pFrm->IsValid() || - (pFrm->IsCompletePaint() && pFrm->Frm().Top() < nBottom) + (pFrm->IsCompletePaint() && ( pFrm->Frm().Top() < nBottom ) ) ) { return true; diff --git a/sw/source/core/layout/makefile.mk b/sw/source/core/layout/makefile.mk deleted file mode 100644 index 076069b513..0000000000 --- a/sw/source/core/layout/makefile.mk +++ /dev/null @@ -1,114 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=layout - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -.IF "$(mydebug)" != "" -CDEFS+=-Dmydebug -.ENDIF - -.IF "$(madebug)" != "" -CDEFS+=-DDEBUG -.ENDIF - -# --- Files -------------------------------------------------------- - -EXCEPTIONSFILES = \ - $(SLO)$/anchoreddrawobject.obj \ - $(SLO)$/flycnt.obj \ - $(SLO)$/layact.obj \ - $(SLO)$/laycache.obj \ - $(SLO)$/layouter.obj \ - $(SLO)$/movedfwdfrmsbyobjpos.obj \ - $(SLO)$/newfrm.obj \ - $(SLO)$/objectformatter.obj \ - $(SLO)$/objstmpconsiderwrapinfl.obj \ - $(SLO)$/paintfrm.obj \ - $(SLO)$/softpagebreak.obj \ - $(SLO)$/sortedobjsimpl.obj \ - $(SLO)$/pagechg.obj - - -SLOFILES = \ - $(SLO)$/atrfrm.obj \ - $(SLO)$/anchoredobject.obj \ - $(SLO)$/anchoreddrawobject.obj \ - $(SLO)$/calcmove.obj \ - $(SLO)$/colfrm.obj \ - $(SLO)$/findfrm.obj \ - $(SLO)$/flowfrm.obj \ - $(SLO)$/fly.obj \ - $(SLO)$/flycnt.obj \ - $(SLO)$/flyincnt.obj \ - $(SLO)$/flylay.obj \ - $(SLO)$/flypos.obj \ - $(SLO)$/frmtool.obj \ - $(SLO)$/ftnfrm.obj \ - $(SLO)$/hffrm.obj \ - $(SLO)$/layact.obj \ - $(SLO)$/laycache.obj \ - $(SLO)$/layouter.obj \ - $(SLO)$/movedfwdfrmsbyobjpos.obj \ - $(SLO)$/newfrm.obj \ - $(SLO)$/objectformatter.obj \ - $(SLO)$/objectformattertxtfrm.obj \ - $(SLO)$/objectformatterlayfrm.obj \ - $(SLO)$/objstmpconsiderwrapinfl.obj \ - $(SLO)$/pagechg.obj \ - $(SLO)$/pagedesc.obj \ - $(SLO)$/paintfrm.obj \ - $(SLO)$/sectfrm.obj \ - $(SLO)$/softpagebreak.obj \ - $(SLO)$/sortedobjs.obj \ - $(SLO)$/sortedobjsimpl.obj \ - $(SLO)$/ssfrm.obj \ - $(SLO)$/swselectionlist.obj \ - $(SLO)$/tabfrm.obj \ - $(SLO)$/trvlfrm.obj \ - $(SLO)$/unusedf.obj \ - $(SLO)$/virtoutp.obj \ - $(SLO)$/wsfrm.obj - -.IF "$(dbgutil)"!="" -SLOFILES += \ - $(SLO)$/dbg_lay.obj -.ENDIF - - -# --- Targets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 886fafedc8..d64663dc56 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -520,7 +520,7 @@ void SwLineRects::ConnectEdges( OutputDevice *pOut ) if ( rL2.GetTab() != rL1.GetTab() || rL2.IsPainted() || rL2.IsLocked() || - bVert == rL2.Height() > rL2.Width() ) + (bVert == (rL2.Height() > rL2.Width())) ) continue; long nL2a, nL2b, nL2c, nL2d; @@ -694,7 +694,7 @@ void SwSubsRects::RemoveSuperfluousSubsidiaryLines( const SwLineRects &rRects ) if ( rLine.IsLocked () ) continue; - if ( !bVerticalSubs == rLine.Height() > rLine.Width() ) //gleiche Ausrichtung? + if ( (!bVerticalSubs == (rLine.Height() > rLine.Width())) ) //gleiche Ausrichtung? continue; if ( aSubsRect.IsOver( rLine ) ) @@ -899,7 +899,7 @@ void SwSubsRects::PaintSubsidiary( OutputDevice *pOut, SwLineRect &rLk = operator[](k); if ( rLi.SSize() == rLk.SSize() ) { - if ( bVerticalSubs == rLk.Height() > rLk.Width() ) + if ( (bVerticalSubs == (rLk.Height() > rLk.Width())) ) { if ( bVerticalSubs ) { @@ -6251,7 +6251,7 @@ void SwLayoutFrm::PaintSubsidiaryLines( const SwPageFrm *pPage, void SwPageFrm::RefreshExtraData( const SwRect &rRect ) const { const SwLineNumberInfo &rInfo = GetFmt()->GetDoc()->GetLineNumberInfo(); - BOOL bLineInFly = rInfo.IsPaintLineNumbers() && rInfo.IsCountInFlys() + BOOL bLineInFly = (rInfo.IsPaintLineNumbers() && rInfo.IsCountInFlys()) || (sal_Int16)SW_MOD()->GetRedlineMarkPos() != text::HoriOrientation::NONE; SwRect aRect( rRect ); diff --git a/sw/source/core/layout/ssfrm.cxx b/sw/source/core/layout/ssfrm.cxx index b9a6365435..2f0bb91e7b 100644 --- a/sw/source/core/layout/ssfrm.cxx +++ b/sw/source/core/layout/ssfrm.cxx @@ -414,6 +414,19 @@ SwFrm::~SwFrm() #endif } +/*************************************************************************/ + +const SwFrmFmt * SwLayoutFrm::GetFmt() const +{ + return static_cast< const SwFlyFrmFmt * >( GetDep() ); +} + +SwFrmFmt * SwLayoutFrm::GetFmt() +{ + return static_cast< SwFlyFrmFmt * >( GetDep() ); +} + + /************************************************************************* |* |* SwLayoutFrm::SetFrmFmt() diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx index 5ff8118f11..dbf96220e6 100644 --- a/sw/source/core/layout/trvlfrm.cxx +++ b/sw/source/core/layout/trvlfrm.cxx @@ -581,8 +581,8 @@ const SwCntntFrm * MA_FASTCALL lcl_MissProtectedFrames( const SwCntntFrm *pCnt, if ( !pCell || ( ( bInReadOnly || !pCell->GetFmt()->GetProtect().IsCntntProtected() ) && ( !bMissHeadline || !lcl_IsInRepeatedHeadline( pCell ) ) && - ( !bMissFollowFlowLine || !pCell->IsInFollowFlowRow() ) ) && - !pCell->IsCoveredCell() ) + ( !bMissFollowFlowLine || !pCell->IsInFollowFlowRow() ) && + !pCell->IsCoveredCell() ) ) bProtect = FALSE; else pCnt = (*fnNxtPrv)( pCnt ); @@ -701,14 +701,14 @@ BOOL MA_FASTCALL lcl_UpDown( SwPaM *pPam, const SwCntntFrm *pStart, const long nPrtLeft = bRTL ? (pTable->*fnRect->fnGetPrtRight)() : (pTable->*fnRect->fnGetPrtLeft)(); - if ( bRTL != nX < nPrtLeft ) + if ( (bRTL != (nX < nPrtLeft)) ) nX = nPrtLeft; else { const long nPrtRight = bRTL ? (pTable->*fnRect->fnGetPrtLeft)() : (pTable->*fnRect->fnGetPrtRight)(); - if ( bRTL != nX > nPrtRight ) + if ( (bRTL != (nX > nPrtRight)) ) nX = nPrtRight; } } @@ -2308,12 +2308,14 @@ void SwRootFrm::CalcFrmRects( SwShellCrsr &rCrsr, BOOL bIsTblMode ) (aTmp.*fnRectX->fnSetTop)( nTmp ); if( (aEndRect.*fnRectX->fnGetTop)() != (pEnd2Pos->aPortion.*fnRectX->fnGetTop)() ) - if( bPorR2L ) - (aTmp.*fnRectX->fnSetLeft)( - (pEnd2Pos->aPortion.*fnRectX->fnGetLeft)() ); - else - (aTmp.*fnRectX->fnSetRight)( - (pEnd2Pos->aPortion.*fnRectX->fnGetRight)() ); + { + if( bPorR2L ) + (aTmp.*fnRectX->fnSetLeft)( + (pEnd2Pos->aPortion.*fnRectX->fnGetLeft)() ); + else + (aTmp.*fnRectX->fnSetRight)( + (pEnd2Pos->aPortion.*fnRectX->fnGetRight)() ); + } aTmp.Intersection( aEndFrm ); Sub( aRegion, aTmp ); } diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx index f710de93c9..938753d923 100644 --- a/sw/source/core/layout/wsfrm.cxx +++ b/sw/source/core/layout/wsfrm.cxx @@ -3125,7 +3125,7 @@ void SwLayoutFrm::ChgLowersProp( const Size& rOldSize ) // Finally adjust the columns if width is set to auto // Possible optimisation: execute this code earlier in this function and // return??? - if ( ( bVert && bHeightChgd || ! bVert && bWidthChgd ) && + if ( ( (bVert && bHeightChgd) || (! bVert && bWidthChgd) ) && Lower()->IsColumnFrm() ) { // get column attribute diff --git a/sw/source/core/makefile.mk b/sw/source/core/makefile.mk deleted file mode 100644 index 2701445fb8..0000000000 --- a/sw/source/core/makefile.mk +++ /dev/null @@ -1,110 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. -PRJNAME=sw - -TARGET=core - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -.IF "$(CALLTARGETS)"=="core" -RC_SUBDIRS= -.ENDIF - -# --- Files -------------------------------------------------------- - - -SUBLIBS1= \ - $(SLB)$/access.lib \ - $(SLB)$/graphic.lib \ - $(SLB)$/para.lib \ - $(SLB)$/attr.lib \ - $(SLB)$/edit.lib \ - $(SLB)$/crsr.lib \ - $(SLB)$/view.lib - - -SUBLIBS2= \ - $(SLB)$/draw.lib \ - $(SLB)$/sw3io.lib \ - $(SLB)$/swg.lib \ - $(SLB)$/layout.lib \ - $(SLB)$/text.lib \ - $(SLB)$/doc.lib \ - $(SLB)$/txtnode.lib - -SUBLIBS3= \ - $(SLB)$/docnode.lib \ - $(SLB)$/unocore.lib \ - $(SLB)$/objectpositioning.lib \ - $(SLB)$/SwNumberTree.lib \ - $(SLB)$/tablecore.lib - -.IF "$(dbgutil)"!="" -SUBLIBS3+= \ - $(SLB)$/except.lib -.ENDIF - -SUBLIBS4= \ - $(SLB)$/frmedt.lib \ - $(SLB)$/ole.lib \ - $(SLB)$/fields.lib \ - $(SLB)$/tox.lib \ - $(SLB)$/undo.lib \ - $(SLB)$/bastyp.lib -#------------------------------------------------------------------------- - -################################################################ - -LIB1TARGET=$(SLB)$/core1.lib -LIB1FILES= \ - $(SUBLIBS1) - -LIB2TARGET=$(SLB)$/core2.lib -LIB2FILES= \ - $(SUBLIBS2) - -LIB3TARGET=$(SLB)$/core3.lib -LIB3FILES= \ - $(SUBLIBS3) - -LIB4TARGET=$(SLB)$/core4.lib -LIB4FILES= \ - $(SUBLIBS4) - -.INCLUDE : target.mk - -################################################################ - -#------------------------------------------------------------------------- - - diff --git a/sw/source/core/objectpositioning/ascharanchoredobjectposition.cxx b/sw/source/core/objectpositioning/ascharanchoredobjectposition.cxx index f8b2db9b55..6d42785291 100644 --- a/sw/source/core/objectpositioning/ascharanchoredobjectposition.cxx +++ b/sw/source/core/objectpositioning/ascharanchoredobjectposition.cxx @@ -455,3 +455,4 @@ sal_uInt8 SwAsCharAnchoredObjectPosition::GetLineAlignment() const { return mnLineAlignment; } + diff --git a/sw/source/core/objectpositioning/makefile.mk b/sw/source/core/objectpositioning/makefile.mk deleted file mode 100644 index 4192414d9b..0000000000 --- a/sw/source/core/objectpositioning/makefile.mk +++ /dev/null @@ -1,59 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=objectpositioning - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -.IF "$(mydebug)" != "" -CDEFS+=-Dmydebug -.ENDIF - -.IF "$(madebug)" != "" -CDEFS+=-DDEBUG -.ENDIF - -# --- Files -------------------------------------------------------- - -SLOFILES = \ - $(SLO)$/anchoredobjectposition.obj \ - $(SLO)$/ascharanchoredobjectposition.obj \ - $(SLO)$/tolayoutanchoredobjectposition.obj \ - $(SLO)$/tocntntanchoredobjectposition.obj \ - $(SLO)$/environmentofanchoredobject.obj - -# --- Targets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/core/ole/makefile.mk b/sw/source/core/ole/makefile.mk deleted file mode 100644 index 8aaf9ed419..0000000000 --- a/sw/source/core/ole/makefile.mk +++ /dev/null @@ -1,55 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=ole - -AUTOSEG=true - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -# --- Files -------------------------------------------------------- - -CXXFILES = \ - ndole.cxx - -SLOFILES = \ - $(SLO)$/ndole.obj - -EXCEPTIONSFILES = \ - $(SLO)$/ndole.obj - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/core/ole/ndole.cxx b/sw/source/core/ole/ndole.cxx index a901d3c7c7..479842ce5a 100644 --- a/sw/source/core/ole/ndole.cxx +++ b/sw/source/core/ole/ndole.cxx @@ -781,7 +781,7 @@ BOOL SwOLEObj::IsOleRef() const return xOLERef.is(); } -uno::Reference < embed::XEmbeddedObject > SwOLEObj::GetOleRef() +const uno::Reference < embed::XEmbeddedObject > SwOLEObj::GetOleRef() { if( !xOLERef.is() ) { @@ -1016,3 +1016,4 @@ void SwOLELRUCache::RemoveObj( SwOLEObj& rObj ) if( !Count() ) DELETEZ( pOLELRU_Cache ); } + diff --git a/sw/source/core/para/makefile.mk b/sw/source/core/para/makefile.mk deleted file mode 100644 index 7005bf0e98..0000000000 --- a/sw/source/core/para/makefile.mk +++ /dev/null @@ -1,54 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=para - -AUTOSEG=true - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -# --- Files -------------------------------------------------------- - -CXXFILES = \ - paratr.cxx - - - -SLOFILES = \ - $(SLO)$/paratr.obj - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/core/sw3io/makefile.mk b/sw/source/core/sw3io/makefile.mk deleted file mode 100644 index 01a50f5df7..0000000000 --- a/sw/source/core/sw3io/makefile.mk +++ /dev/null @@ -1,49 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=sw3io - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -# --- Files -------------------------------------------------------- - -SLOFILES = \ - $(SLO)$/swacorr.obj \ - $(SLO)$/sw3convert.obj - - -# --- Targets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/core/swg/makefile.mk b/sw/source/core/swg/makefile.mk deleted file mode 100644 index c7aa25ec5d..0000000000 --- a/sw/source/core/swg/makefile.mk +++ /dev/null @@ -1,62 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=swg - -#ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -# --- Files -------------------------------------------------------- -SLOFILES = \ - $(SLO)$/swblocks.obj \ - $(SLO)$/SwXMLBlockImport.obj \ - $(SLO)$/SwXMLSectionList.obj \ - $(SLO)$/SwXMLBlockExport.obj \ - $(SLO)$/SwXMLBlockListContext.obj \ - $(SLO)$/SwXMLTextBlocks.obj \ - $(SLO)$/SwXMLTextBlocks1.obj - -EXCEPTIONSFILES = \ - $(SLO)$/SwXMLBlockImport.obj \ - $(SLO)$/SwXMLSectionList.obj \ - $(SLO)$/SwXMLBlockExport.obj \ - $(SLO)$/SwXMLBlockListContext.obj \ - $(SLO)$/SwXMLTextBlocks.obj \ - $(SLO)$/SwXMLTextBlocks1.obj - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/core/table/makefile.mk b/sw/source/core/table/makefile.mk deleted file mode 100644 index d63101e30a..0000000000 --- a/sw/source/core/table/makefile.mk +++ /dev/null @@ -1,48 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=tablecore -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -# --- Files -------------------------------------------------------- - -SLOFILES = \ - $(SLO)$/swtable.obj \ - $(SLO)$/swnewtable.obj - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx index 9144738a68..2ede651d6d 100644 --- a/sw/source/core/table/swtable.cxx +++ b/sw/source/core/table/swtable.cxx @@ -2410,7 +2410,7 @@ void SwTableBoxFmt::Modify( SfxPoolItem* pOld, SfxPoolItem* pNew ) BOOL bNewIsTxtFmt = pNumFmtr->IsTextFormat( nNewFmt ) || NUMBERFORMAT_TEXT == nNewFmt; - if( !bNewIsTxtFmt && nOldFmt != nNewFmt || pNewFml ) + if( (!bNewIsTxtFmt && nOldFmt != nNewFmt) || pNewFml ) { BOOL bChgTxt = TRUE; double fVal = 0; diff --git a/sw/source/core/text/frmcrsr.cxx b/sw/source/core/text/frmcrsr.cxx index 343efedd4d..e165346c54 100644 --- a/sw/source/core/text/frmcrsr.cxx +++ b/sw/source/core/text/frmcrsr.cxx @@ -780,7 +780,7 @@ sal_Bool SwTxtFrm::RightMargin(SwPaM *pPam, sal_Bool bAPI) const if( aLine.GetCurr()->GetLen() && CH_BREAK == aInf.GetTxt().GetChar( nRightMargin - 1 ) ) --nRightMargin; - if( !bAPI && (aLine.GetNext() || pFrm->GetFollow()) ) + else if( !bAPI && (aLine.GetNext() || pFrm->GetFollow()) ) { while( nRightMargin > aLine.GetStart() && ' ' == aInf.GetTxt().GetChar( nRightMargin - 1 ) ) diff --git a/sw/source/core/text/makefile.mk b/sw/source/core/text/makefile.mk deleted file mode 100644 index 0076a17487..0000000000 --- a/sw/source/core/text/makefile.mk +++ /dev/null @@ -1,119 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=text - -AUTOSEG=true - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -.IF "$(mydebug)" != "" -CDEFS+=-Dmydebug -.ENDIF - -.IF "$(ENABLE_GRAPHITE)" == "TRUE" -CFLAGS+=-DENABLE_GRAPHITE -.ENDIF -# --- Files -------------------------------------------------------- - -SLOFILES = \ - $(SLO)$/atrstck.obj \ - $(SLO)$/EnhancedPDFExportHelper.obj \ - $(SLO)$/frmcrsr.obj \ - $(SLO)$/frmform.obj \ - $(SLO)$/frminf.obj \ - $(SLO)$/frmpaint.obj \ - $(SLO)$/guess.obj \ - $(SLO)$/inftxt.obj \ - $(SLO)$/itradj.obj \ - $(SLO)$/itratr.obj \ - $(SLO)$/itrcrsr.obj \ - $(SLO)$/itrform2.obj \ - $(SLO)$/itrpaint.obj \ - $(SLO)$/itrtxt.obj \ - $(SLO)$/porexp.obj \ - $(SLO)$/porfld.obj \ - $(SLO)$/porfly.obj \ - $(SLO)$/porglue.obj \ - $(SLO)$/porlay.obj \ - $(SLO)$/porlin.obj \ - $(SLO)$/pormulti.obj \ - $(SLO)$/porref.obj \ - $(SLO)$/porrst.obj \ - $(SLO)$/portox.obj \ - $(SLO)$/portxt.obj \ - $(SLO)$/redlnitr.obj \ - $(SLO)$/txtcache.obj \ - $(SLO)$/txtdrop.obj \ - $(SLO)$/txtfld.obj \ - $(SLO)$/txtfly.obj \ - $(SLO)$/txtfrm.obj \ - $(SLO)$/txtftn.obj \ - $(SLO)$/txthyph.obj \ - $(SLO)$/txtinit.obj \ - $(SLO)$/txtpaint.obj \ - $(SLO)$/txttab.obj \ - $(SLO)$/widorp.obj \ - $(SLO)$/blink.obj \ - $(SLO)$/noteurl.obj \ - $(SLO)$/SwGrammarMarkUp.obj \ - $(SLO)$/wrong.obj - -.IF "$(dbgutil)"!="" -SLOFILES += \ - $(SLO)$/txtio.obj -.ENDIF - -EXCEPTIONSFILES = \ - $(SLO)$/EnhancedPDFExportHelper.obj \ - $(SLO)$/inftxt.obj \ - $(SLO)$/itradj.obj \ - $(SLO)$/itrcrsr.obj \ - $(SLO)$/porlay.obj \ - $(SLO)$/pormulti.obj \ - $(SLO)$/SwGrammarMarkUp.obj \ - $(SLO)$/txtfly.obj \ - $(SLO)$/wrong.obj - - -.IF "$(CPUNAME)" == "SPARC" -.IF "$(OS)" == "NETBSD" -NOOPTFILES = \ - $(SLO)$/txtftn.obj -.ENDIF -.ENDIF - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/core/text/txtio.cxx b/sw/source/core/text/txtio.cxx index c226e0d538..c7f80c35b0 100644 --- a/sw/source/core/text/txtio.cxx +++ b/sw/source/core/text/txtio.cxx @@ -28,10 +28,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" - -#ifndef DBG_UTIL -#error Wer fummelt denn an den makefiles? -#endif +#ifdef DBG_UTIL #include "viewsh.hxx" // IsDbg() #include "viewopt.hxx" // IsDbg() @@ -946,4 +943,5 @@ SvStream &SwDropPortion::operator<<( SvStream &rOs ) const //$ ostream #endif /* OSL_DEBUG_LEVEL */ +#endif // DBG_UTIL diff --git a/sw/source/core/tox/makefile.mk b/sw/source/core/tox/makefile.mk deleted file mode 100644 index 60de374491..0000000000 --- a/sw/source/core/tox/makefile.mk +++ /dev/null @@ -1,57 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=tox - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -.IF "$(mydebug)" != "" -CDEFS+=-Dmydebug -.ENDIF - -# --- Files -------------------------------------------------------- - -SLOFILES = \ - $(SLO)$/tox.obj \ - $(SLO)$/toxhlp.obj \ - $(SLO)$/txmsrt.obj - -EXCEPTIONSFILES= \ - $(SLO)$/toxhlp.obj \ - $(SLO)$/tox.obj - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/core/txtnode/makefile.mk b/sw/source/core/txtnode/makefile.mk deleted file mode 100644 index f03f96c426..0000000000 --- a/sw/source/core/txtnode/makefile.mk +++ /dev/null @@ -1,86 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=txtnode - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -.IF "$(mydebug)" != "" -CDEFS+=-Dmydebug -.ENDIF - -# --- Files -------------------------------------------------------- - -SLOFILES = \ - $(SLO)$/atrfld.obj \ - $(SLO)$/atrflyin.obj \ - $(SLO)$/atrftn.obj \ - $(SLO)$/atrref.obj \ - $(SLO)$/atrtox.obj \ - $(SLO)$/chrfmt.obj \ - $(SLO)$/fmtatr2.obj \ - $(SLO)$/fntcap.obj \ - $(SLO)$/fntcache.obj \ - $(SLO)$/swfntcch.obj \ - $(SLO)$/SwGrammarContact.obj \ - $(SLO)$/modeltoviewhelper.obj \ - $(SLO)$/ndhints.obj \ - $(SLO)$/ndtxt.obj \ - $(SLO)$/swfont.obj \ - $(SLO)$/thints.obj \ - $(SLO)$/txatbase.obj \ - $(SLO)$/txatritr.obj \ - $(SLO)$/txtatr2.obj \ - $(SLO)$/txtedt.obj - - -EXCEPTIONSFILES = \ - $(SLO)$/fmtatr2.obj \ - $(SLO)$/atrtox.obj \ - $(SLO)$/atrflyin.obj \ - $(SLO)$/docnew.obj \ - $(SLO)$/fntcache.obj \ - $(SLO)$/ndtxt.obj \ - $(SLO)$/thints.obj \ - $(SLO)$/txtedt.obj - - -.IF "$(dbutil)" != "" -OFILES+=$(SLO)$/dbchratr.$(QBJX) -.ENDIF - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/core/undo/makefile.mk b/sw/source/core/undo/makefile.mk deleted file mode 100644 index 35771fa444..0000000000 --- a/sw/source/core/undo/makefile.mk +++ /dev/null @@ -1,87 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=undo - -AUTOSEG=true - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -# --- Files -------------------------------------------------------- - -SRS1NAME=$(TARGET) -SRC1FILES = \ - undo.src - -EXCEPTIONSFILES = \ - $(SLO)$/SwRewriter.obj \ - $(SLO)$/unattr.obj \ - $(SLO)$/undobj.obj \ - $(SLO)$/undraw.obj \ - $(SLO)$/unnum.obj \ - $(SLO)$/unovwr.obj \ - $(SLO)$/untbl.obj - -SLOFILES = \ - $(SLO)$/SwRewriter.obj \ - $(SLO)$/SwUndoField.obj \ - $(SLO)$/SwUndoPageDesc.obj \ - $(SLO)$/SwUndoFmt.obj \ - $(SLO)$/SwUndoTOXChange.obj \ - $(SLO)$/docundo.obj \ - $(SLO)$/rolbck.obj \ - $(SLO)$/unattr.obj \ - $(SLO)$/unbkmk.obj \ - $(SLO)$/undel.obj \ - $(SLO)$/undobj.obj \ - $(SLO)$/undobj1.obj \ - $(SLO)$/undoflystrattr.obj \ - $(SLO)$/undraw.obj \ - $(SLO)$/unfmco.obj \ - $(SLO)$/unins.obj \ - $(SLO)$/unmove.obj \ - $(SLO)$/unnum.obj \ - $(SLO)$/unoutl.obj \ - $(SLO)$/unovwr.obj \ - $(SLO)$/unredln.obj \ - $(SLO)$/unsect.obj \ - $(SLO)$/unsort.obj \ - $(SLO)$/unspnd.obj \ - $(SLO)$/untbl.obj \ - $(SLO)$/untblk.obj - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/core/undo/undo.src b/sw/source/core/undo/undo.src index 4ad1e70b78..928c38e494 100644 --- a/sw/source/core/undo/undo.src +++ b/sw/source/core/undo/undo.src @@ -394,7 +394,7 @@ String STR_UNDO_SETRUBYATTR { Text [ en-US ] = "Ruby Setting"; }; -#102505# +// #102505# String STR_UNDO_TMPAUTOCORR { Text [ en-US ] = "AutoCorrect" ; diff --git a/sw/source/core/unocore/makefile.mk b/sw/source/core/unocore/makefile.mk deleted file mode 100644 index 09e6371ada..0000000000 --- a/sw/source/core/unocore/makefile.mk +++ /dev/null @@ -1,124 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=unocore - -# --- Settings ----------------------------------------------------- -#ENABLE_EXCEPTIONS=TRUE - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -# --- Files -------------------------------------------------------- -EXCEPTIONSFILES= \ - $(SLO)$/swunohelper.obj\ - $(SLO)$/SwXTextDefaults.obj\ - $(SLO)$/unobkm.obj\ - $(SLO)$/unochart.obj\ - $(SLO)$/unoevent.obj\ - $(SLO)$/unocrsrhelper.obj\ - $(SLO)$/unoevtlstnr.obj\ - $(SLO)$/unoftn.obj\ - $(SLO)$/unorefmk.obj\ - $(SLO)$/unosect.obj\ - $(SLO)$/unosett.obj\ - $(SLO)$/unocoll.obj\ - $(SLO)$/unodraw.obj\ - $(SLO)$/unofield.obj\ - $(SLO)$/unoframe.obj\ - $(SLO)$/unoidx.obj\ - $(SLO)$/unoobj.obj\ - $(SLO)$/unoobj2.obj\ - $(SLO)$/unoparagraph.obj\ - $(SLO)$/unoport.obj\ - $(SLO)$/unoredline.obj\ - $(SLO)$/unoredlines.obj\ - $(SLO)$/unosrch.obj\ - $(SLO)$/unostyle.obj\ - $(SLO)$/unotbl.obj \ - $(SLO)$/unoflatpara.obj\ - $(SLO)$/unotextmarkup.obj\ - $(SLO)$/TextCursorHelper.obj \ - $(SLO)$/unotext.obj - -.IF "$(GUI)$(COM)$(CPU)" == "WNTMSCI" -EXCEPTIONSNOOPTFILES =$(SLO)$/unoportenum.obj -.ELSE -EXCEPTIONSFILES +=$(SLO)$/unoportenum.obj -.ENDIF - - -SRS1NAME=$(TARGET) -SRC1FILES = \ - unocore.src - -SLOFILES = \ - $(SLO)$/swunohelper.obj\ - $(SLO)$/SwXTextDefaults.obj\ - $(SLO)$/unoportenum.obj\ - $(SLO)$/unobkm.obj\ - $(SLO)$/unochart.obj\ - $(SLO)$/unoevent.obj\ - $(SLO)$/unocrsrhelper.obj\ - $(SLO)$/unoevtlstnr.obj\ - $(SLO)$/unoftn.obj\ - $(SLO)$/unorefmk.obj\ - $(SLO)$/unosect.obj\ - $(SLO)$/unosett.obj\ - $(SLO)$/unocoll.obj\ - $(SLO)$/unodraw.obj\ - $(SLO)$/unofield.obj\ - $(SLO)$/unoframe.obj\ - $(SLO)$/unoidx.obj\ - $(SLO)$/unoobj.obj\ - $(SLO)$/unoobj2.obj\ - $(SLO)$/unoparagraph.obj\ - $(SLO)$/unoport.obj\ - $(SLO)$/unoredline.obj\ - $(SLO)$/unoredlines.obj\ - $(SLO)$/unosrch.obj\ - $(SLO)$/unostyle.obj\ - $(SLO)$/unotbl.obj \ - $(SLO)$/unoflatpara.obj\ - $(SLO)$/unotextmarkup.obj\ - $(SLO)$/TextCursorHelper.obj \ - $(SLO)$/unotext.obj\ - $(SLO)$/unomap.obj\ - $(SLO)$/unoprnms.obj\ - $(SLO)$/XMLRangeHelper.obj - - - -# --- Targets ------------------------------------------------------- - - -.INCLUDE : target.mk - diff --git a/sw/source/core/unocore/unosrch.cxx b/sw/source/core/unocore/unosrch.cxx index 3038865007..b36fd80d18 100644 --- a/sw/source/core/unocore/unosrch.cxx +++ b/sw/source/core/unocore/unosrch.cxx @@ -185,7 +185,17 @@ void SwSearchProperties_Impl::FillItemSet(SfxItemSet& rSet, sal_Bool bIsValueSea *pContourItem = 0, *pCharColorItem = 0, *pCasemapItem = 0, - *pBrushItem = 0; + *pBrushItem = 0, + *pFontCJKItem = 0, + *pFontSizeCJKItem = 0, + *pCJKLangItem = 0, + *pCJKPostureItem = 0, + *pCJKWeightItem = 0, + *pFontCTLItem = 0, + *pFontSizeCTLItem = 0, + *pCTLLangItem = 0, + *pCTLPostureItem = 0, + *pCTLWeightItem = 0; PropertyEntryVector_t::const_iterator aIt = aPropertyEntries.begin(); for(sal_uInt32 i = 0; i < nArrLen; i++, ++aIt) @@ -370,6 +380,56 @@ void SwSearchProperties_Impl::FillItemSet(SfxItemSet& rSet, sal_Bool bIsValueSea pWLineItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone(); pTempItem = pWLineItem; break; + case RES_CHRATR_CJK_FONT: + if(!pFontCJKItem ) + pFontCJKItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone(); + pTempItem = pFontCJKItem; + break; + case RES_CHRATR_CJK_FONTSIZE: + if(!pFontSizeCJKItem ) + pFontSizeCJKItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone(); + pTempItem = pFontSizeCJKItem; + break; + case RES_CHRATR_CJK_LANGUAGE: + if(!pCJKLangItem ) + pCJKLangItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone(); + pTempItem = pCJKLangItem; + break; + case RES_CHRATR_CJK_POSTURE: + if(!pCJKPostureItem ) + pCJKPostureItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone(); + pTempItem = pCJKPostureItem; + break; + case RES_CHRATR_CJK_WEIGHT: + if(!pCJKWeightItem ) + pCJKWeightItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone(); + pTempItem = pCJKWeightItem; + break; + case RES_CHRATR_CTL_FONT: + if(!pFontCTLItem ) + pFontCTLItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone(); + pTempItem = pFontCTLItem; + break; + case RES_CHRATR_CTL_FONTSIZE: + if(!pFontSizeCTLItem ) + pFontSizeCTLItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone(); + pTempItem = pFontSizeCTLItem; + break; + case RES_CHRATR_CTL_LANGUAGE: + if(!pCTLLangItem ) + pCTLLangItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone(); + pTempItem = pCTLLangItem; + break; + case RES_CHRATR_CTL_POSTURE: + if(!pCTLPostureItem ) + pCTLPostureItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone(); + pTempItem = pCTLPostureItem; + break; + case RES_CHRATR_CTL_WEIGHT: + if(!pCTLWeightItem ) + pCTLWeightItem = rSet.GetPool()->GetDefaultItem(aIt->nWID).Clone(); + pTempItem = pCTLWeightItem; + break; } if(pTempItem) { diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index a93d84296a..d924b4e3dd 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -1894,8 +1894,8 @@ void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, if( pCharStyleNames[i] != SwXNumberingRules::GetInvalidStyle() && ((pCharStyleNames[i].Len() && !pFmt->GetCharFmt()) || - pCharStyleNames[i].Len() && - pFmt->GetCharFmt()->GetName() != pCharStyleNames[i] )) + (pCharStyleNames[i].Len() && + pFmt->GetCharFmt()->GetName() != pCharStyleNames[i]) )) { SwCharFmt* pCharFmt = 0; @@ -1927,8 +1927,8 @@ void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry, //jetzt nochmal fuer Fonts if(pBulletFontNames[i] != SwXNumberingRules::GetInvalidStyle() && ((pBulletFontNames[i].Len() && !pFmt->GetBulletFont()) || - pBulletFontNames[i].Len() && - pFmt->GetBulletFont()->GetName() != pBulletFontNames[i] )) + (pBulletFontNames[i].Len() && + pFmt->GetBulletFont()->GetName() != pBulletFontNames[i]) )) { const SvxFontListItem* pFontListItem = (const SvxFontListItem* )pDoc->GetDocShell() @@ -3609,8 +3609,8 @@ MakeObject: { const SwPageDesc& rDesc = aBase.GetOldPageDesc(); const SwFrmFmt* pFrmFmt = 0; - sal_Bool bShare = bHeader && rDesc.IsHeaderShared()|| - !bHeader && rDesc.IsFooterShared(); + sal_Bool bShare = (bHeader && rDesc.IsHeaderShared())|| + (!bHeader && rDesc.IsFooterShared()); // TextLeft returns the left content if there is one, // Text and TextRight return the master content. // TextRight does the same as Text and is for diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index c173e0f41b..9232343b9c 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -700,7 +700,7 @@ void lcl_SetTblSeparators(const uno::Any& rVal, SwTable* pTable, SwTableBox* pBo { aCols[i] = pArray[i].Position; if(pArray[i].IsVisible == aCols.IsHidden(i) || - !bRow && aCols.IsHidden(i) || + (!bRow && aCols.IsHidden(i)) || long(aCols[i] - long(nLastValue)) < 0 || UNO_TABLE_COLUMN_SUM < aCols[i] ) { @@ -3428,10 +3428,10 @@ void SwXTextTable::setPropertyValue(const OUString& rPropertyName, const SwFrmFmt* pBoxFmt = pBox->GetFrmFmt(); const SvxBoxItem& rBox = pBoxFmt->GetBox(); if( - aTableBorderDistances.IsLeftDistanceValid && nLeftDistance != rBox.GetDistance( BOX_LINE_LEFT ) || - aTableBorderDistances.IsRightDistanceValid && nRightDistance != rBox.GetDistance( BOX_LINE_RIGHT ) || - aTableBorderDistances.IsTopDistanceValid && nTopDistance != rBox.GetDistance( BOX_LINE_TOP ) || - aTableBorderDistances.IsBottomDistanceValid && nBottomDistance != rBox.GetDistance( BOX_LINE_BOTTOM )) + (aTableBorderDistances.IsLeftDistanceValid && nLeftDistance != rBox.GetDistance( BOX_LINE_LEFT )) || + (aTableBorderDistances.IsRightDistanceValid && nRightDistance != rBox.GetDistance( BOX_LINE_RIGHT )) || + (aTableBorderDistances.IsTopDistanceValid && nTopDistance != rBox.GetDistance( BOX_LINE_TOP )) || + (aTableBorderDistances.IsBottomDistanceValid && nBottomDistance != rBox.GetDistance( BOX_LINE_BOTTOM ))) { SvxBoxItem aSetBox( rBox ); SwFrmFmt* pSetBoxFmt = pBox->ClaimFrmFmt(); @@ -3744,7 +3744,7 @@ void SwXTextTable::setName(const OUString& rName) throw( uno::RuntimeException ) vos::OGuard aGuard(Application::GetSolarMutex()); SwFrmFmt* pFmt = GetFrmFmt(); String sNewTblName(rName); - if(!pFmt && !bIsDescriptor || + if((!pFmt && !bIsDescriptor) || !sNewTblName.Len() || STRING_NOTFOUND != sNewTblName.Search('.') || STRING_NOTFOUND != sNewTblName.Search(' ') ) diff --git a/sw/source/core/view/makefile.mk b/sw/source/core/view/makefile.mk deleted file mode 100755 index 0ac0e0d106..0000000000 --- a/sw/source/core/view/makefile.mk +++ /dev/null @@ -1,61 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=view -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -# --- Files -------------------------------------------------------- - -SLOFILES = \ - $(SLO)$/vdraw.obj \ - $(SLO)$/viewimp.obj \ - $(SLO)$/viewsh.obj \ - $(SLO)$/pagepreviewlayout.obj \ - $(SLO)$/printdata.obj \ - $(SLO)$/viewpg.obj \ - $(SLO)$/vnew.obj \ - $(SLO)$/vprint.obj - - - -EXCEPTIONSFILES = \ - $(SLO)$/pagepreviewlayout.obj - - -# --- Targets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/filter/ascii/ascatr.cxx b/sw/source/filter/ascii/ascatr.cxx index 4d52488de5..7595072658 100644 --- a/sw/source/filter/ascii/ascatr.cxx +++ b/sw/source/filter/ascii/ascatr.cxx @@ -205,8 +205,8 @@ static Writer& OutASC_SwTxtNode( Writer& rWrt, SwCntntNode& rNode ) } while( nStrPos < nEnde ); if( !bLastNd || - ( !rWrt.bWriteClipboardDoc && !rWrt.bASCII_NoLastLineEnd ) - && !nStrPos && nEnde == nNodeEnde ) + ( ( !rWrt.bWriteClipboardDoc && !rWrt.bASCII_NoLastLineEnd ) + && !nStrPos && nEnde == nNodeEnde ) ) rWrt.Strm().WriteUnicodeOrByteText( ((SwASCWriter&)rWrt).GetLineEnd()); return rWrt; diff --git a/sw/source/filter/ascii/makefile.mk b/sw/source/filter/ascii/makefile.mk deleted file mode 100644 index e2bd2bef25..0000000000 --- a/sw/source/filter/ascii/makefile.mk +++ /dev/null @@ -1,56 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=ascii - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -# --- Files -------------------------------------------------------- - -CXXFILES = \ - ascatr.cxx \ - parasc.cxx \ - wrtasc.cxx - - - -SLOFILES = \ - $(SLO)$/ascatr.obj \ - $(SLO)$/parasc.obj \ - $(SLO)$/wrtasc.obj - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/filter/basflt/makefile.mk b/sw/source/filter/basflt/makefile.mk deleted file mode 100644 index 7713d12657..0000000000 --- a/sw/source/filter/basflt/makefile.mk +++ /dev/null @@ -1,58 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=basflt - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -.IF "$(mydebug)" != "" -CDEFS+=-Dmydebug -.ENDIF - -# --- Files -------------------------------------------------------- - -SLOFILES = \ - $(SLO)$/docfact.obj \ - $(SLO)$/fltini.obj \ - $(SLO)$/shellio.obj \ - $(SLO)$/iodetect.obj - -EXCEPTIONSFILES = \ - $(SLO)$/fltini.obj \ - $(SLO)$/iodetect.obj - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/filter/html/htmlctxt.cxx b/sw/source/filter/html/htmlctxt.cxx index d8fd133f43..04e84b7322 100644 --- a/sw/source/filter/html/htmlctxt.cxx +++ b/sw/source/filter/html/htmlctxt.cxx @@ -192,7 +192,7 @@ void SwHTMLParser::SplitAttrTab( const SwPosition& rNewPos ) nOldEndCnt = pPam->GetPoint()->nContent.GetIndex(); } - if( RES_PARATR_BEGIN <= nWhich && bMoveBack || + if( (RES_PARATR_BEGIN <= nWhich && bMoveBack) || pAttr->GetSttParaIdx() < pOldEndPara->GetIndex() || (pAttr->GetSttPara() == *pOldEndPara && pAttr->GetSttCnt() != nOldEndCnt) ) diff --git a/sw/source/filter/html/htmlform.cxx b/sw/source/filter/html/htmlform.cxx index 06d9e29ca8..833e91caa9 100644 --- a/sw/source/filter/html/htmlform.cxx +++ b/sw/source/filter/html/htmlform.cxx @@ -1351,7 +1351,7 @@ void SwHTMLParser::NewForm( sal_Bool bAppend ) { const HTMLOption *pOption = (*pHTMLOptions)[--i]; ScriptType eScriptType2 = eDfltScriptType; - sal_uInt16 nEvent; + sal_uInt16 nEvent = 0; sal_Bool bSetEvent = sal_False; switch( pOption->GetToken() ) @@ -1525,7 +1525,7 @@ void SwHTMLParser::InsertInput() { const HTMLOption *pOption = (*pHTMLOptions)[--i]; ScriptType eScriptType2 = eDfltScriptType; - sal_uInt16 nEvent; + sal_uInt16 nEvent = 0; sal_Bool bSetEvent = sal_False; switch( pOption->GetToken() ) @@ -2017,7 +2017,7 @@ void SwHTMLParser::NewTextArea() { const HTMLOption *pOption = (*pHTMLOptions)[--i]; ScriptType eScriptType2 = eDfltScriptType; - sal_uInt16 nEvent; + sal_uInt16 nEvent = 0; sal_Bool bSetEvent = sal_False; switch( pOption->GetToken() ) @@ -2308,7 +2308,7 @@ void SwHTMLParser::NewSelect() { const HTMLOption *pOption = (*pHTMLOptions)[--i]; ScriptType eScriptType2 = eDfltScriptType; - sal_uInt16 nEvent; + sal_uInt16 nEvent = 0; sal_Bool bSetEvent = sal_False; switch( pOption->GetToken() ) diff --git a/sw/source/filter/html/htmltabw.cxx b/sw/source/filter/html/htmltabw.cxx index f7b577ca7d..02af8c2702 100644 --- a/sw/source/filter/html/htmltabw.cxx +++ b/sw/source/filter/html/htmltabw.cxx @@ -70,6 +70,7 @@ #endif #include <viewopt.hxx> #endif +#include <sal/types.h> //#define MAX_DEPTH (USHRT_MAX) #define MAX_DEPTH (3) @@ -98,7 +99,7 @@ class SwHTMLWrtTable : public SwWriteTable sal_Bool bTop, sal_Bool bBottom, sal_Bool bLeft, sal_Bool bRight ); public: - SwHTMLWrtTable( const SwTableLines& rLines, long nWidth, sal_uInt16 nBWidth, + SwHTMLWrtTable( const SwTableLines& rLines, long nWidth, sal_uInt32 nBWidth, sal_Bool bRel, USHORT nNumOfRowsToRepeat, sal_uInt16 nLeftSub=0, sal_uInt16 nRightSub=0 ); SwHTMLWrtTable( const SwHTMLTableLayout *pLayoutInfo ); @@ -111,7 +112,7 @@ public: SwHTMLWrtTable::SwHTMLWrtTable( const SwTableLines& rLines, long nWidth, - sal_uInt16 nBWidth, sal_Bool bRel, USHORT nNumOfRowsToRepeat, + sal_uInt32 nBWidth, sal_Bool bRel, USHORT nNumOfRowsToRepeat, sal_uInt16 nLSub, sal_uInt16 nRSub ) : SwWriteTable( rLines, nWidth, nBWidth, bRel, MAX_DEPTH, nLSub, nRSub, nNumOfRowsToRepeat ) { @@ -337,7 +338,7 @@ void SwHTMLWrtTable::OutTableCell( SwHTMLWriter& rWrt, #ifndef PURE_HTML long nWidth = 0; - sal_uInt16 nPrcWidth = USHRT_MAX; + sal_uInt32 nPrcWidth = ULONG_MAX; if( bOutWidth ) { if( bLayoutExport ) @@ -471,7 +472,9 @@ void SwHTMLWrtTable::OutTableCell( SwHTMLWriter& rWrt, } else { - sal_uInt16 nTWidth, nBWidth, nLSub, nRSub; + sal_uInt16 nTWidth; + sal_uInt32 nBWidth; + sal_uInt16 nLSub, nRSub; if( HasRelWidths() ) { nTWidth = 100; @@ -845,7 +848,7 @@ void SwHTMLWrtTable::Write( SwHTMLWriter& rWrt, sal_Int16 eAlign, ByteString sOutStr( '<' ); sOutStr += OOO_STRING_SVTOOLS_HTML_col; - sal_uInt16 nWidth; + sal_uInt32 nWidth; sal_Bool bRel; if( bLayoutExport ) { diff --git a/sw/source/filter/html/makefile.mk b/sw/source/filter/html/makefile.mk deleted file mode 100644 index 495a415d02..0000000000 --- a/sw/source/filter/html/makefile.mk +++ /dev/null @@ -1,85 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=html - - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -.IF "$(mydebug)" != "" -CDEFS=$(CDEFS) -Dmydebug -.ENDIF - -# --- Files -------------------------------------------------------- - -SLOFILES = \ - $(SLO)$/css1atr.obj \ - $(SLO)$/css1kywd.obj \ - $(SLO)$/htmlatr.obj \ - $(SLO)$/htmlbas.obj \ - $(SLO)$/htmlcss1.obj \ - $(SLO)$/htmlctxt.obj \ - $(SLO)$/htmldraw.obj \ - $(SLO)$/htmlfld.obj \ - $(SLO)$/htmlfldw.obj \ - $(SLO)$/htmlfly.obj \ - $(SLO)$/htmlflyt.obj \ - $(SLO)$/htmlform.obj \ - $(SLO)$/htmlforw.obj \ - $(SLO)$/htmlftn.obj \ - $(SLO)$/htmlgrin.obj \ - $(SLO)$/htmlnum.obj \ - $(SLO)$/htmlplug.obj \ - $(SLO)$/htmlsect.obj \ - $(SLO)$/htmltab.obj \ - $(SLO)$/htmltabw.obj \ - $(SLO)$/parcss1.obj \ - $(SLO)$/svxcss1.obj \ - $(SLO)$/swhtml.obj \ - $(SLO)$/wrthtml.obj \ - $(SLO)$/SwAppletImpl.obj \ - -EXCEPTIONSFILES = \ - $(SLO)$/htmlatr.obj \ - $(SLO)$/htmlfld.obj \ - $(SLO)$/htmlgrin.obj \ - $(SLO)$/htmlplug.obj \ - $(SLO)$/htmlsect.obj \ - $(SLO)$/swhtml.obj \ - $(SLO)$/wrthtml.obj - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/filter/inc/makefile.mk b/sw/source/filter/inc/makefile.mk deleted file mode 100644 index 1b35ca4954..0000000000 --- a/sw/source/filter/inc/makefile.mk +++ /dev/null @@ -1,26 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* diff --git a/sw/source/filter/inc/wrtswtbl.hxx b/sw/source/filter/inc/wrtswtbl.hxx index f97a68c840..03e7f13231 100644 --- a/sw/source/filter/inc/wrtswtbl.hxx +++ b/sw/source/filter/inc/wrtswtbl.hxx @@ -61,7 +61,7 @@ class SwWriteTableCell long nHeight; // fixe/Mindest-Hoehe der Zeile - USHORT nWidthOpt; // Breite aus Option; + sal_uInt32 nWidthOpt; // Breite aus Option; USHORT nRow; // Start-Zeile USHORT nCol; // Start-Spalte @@ -99,7 +99,7 @@ public: nWidthOpt = nWidth; bPrcWidthOpt = bPrc; } - USHORT GetWidthOpt() const { return nWidthOpt; } + sal_uInt32 GetWidthOpt() const { return nWidthOpt; } BOOL HasPrcWidthOpt() const { return bPrcWidthOpt; } }; @@ -180,9 +180,9 @@ SV_DECL_PTRARR_SORT_DEL( SwWriteTableRows, SwWriteTableRowPtr, 5, 5 ) class SwWriteTableCol { - USHORT nPos; // End Position der Spalte + sal_uInt32 nPos; // End Position der Spalte - USHORT nWidthOpt; + sal_uInt32 nWidthOpt; BOOL bRelWidthOpt : 1; BOOL bOutWidth : 1; // Spaltenbreite ausgeben? @@ -191,9 +191,9 @@ public: BOOL bLeftBorder : 1; // Welche Umrandungen sind da? BOOL bRightBorder : 1; - SwWriteTableCol( USHORT nPosition ); + SwWriteTableCol( sal_uInt32 nPosition ); - USHORT GetPos() const { return nPos; } + sal_uInt32 GetPos() const { return nPos; } void SetLeftBorder( BOOL bBorder ) { bLeftBorder = bBorder; } BOOL HasLeftBorder() const { return bLeftBorder; } @@ -207,11 +207,11 @@ public: inline int operator==( const SwWriteTableCol& rCol ) const; inline int operator<( const SwWriteTableCol& rCol ) const; - void SetWidthOpt( USHORT nWidth, BOOL bRel ) + void SetWidthOpt( sal_uInt32 nWidth, BOOL bRel ) { nWidthOpt = nWidth; bRelWidthOpt = bRel; } - USHORT GetWidthOpt() const { return nWidthOpt; } + sal_uInt32 GetWidthOpt() const { return nWidthOpt; } BOOL HasRelWidthOpt() const { return bRelWidthOpt; } }; @@ -248,14 +248,14 @@ protected: USHORT nBorder; // Dicke der ausseren Umrandung USHORT nInnerBorder; // Dicke der inneren Umrandung - USHORT nBaseWidth; // Bezugsgroesse fur Breiten SwFmtFrmSize + sal_uInt32 nBaseWidth; // Bezugsgroesse fur Breiten SwFmtFrmSize USHORT nHeadEndRow; // letzte Zeile des Tabellen-Kopfes USHORT nLeftSub; USHORT nRightSub; - long nTabWidth; // Absolute/Relative Breite der Tabelle + sal_uInt32 nTabWidth; // Absolute/Relative Breite der Tabelle BOOL bRelWidths : 1; // Breiten relativ ausgeben? BOOL bUseLayoutHeights : 1; // Layout zur Hoehenbestimmung nehmen? @@ -271,16 +271,16 @@ protected: virtual BOOL ShouldExpandSub( const SwTableBox *pBox, BOOL bExpandedBefore, USHORT nDepth ) const; - void CollectTableRowsCols( long nStartRPos, USHORT nStartCPos, + void CollectTableRowsCols( long nStartRPos, sal_uInt32 nStartCPos, long nParentLineHeight, - USHORT nParentLineWidth, + sal_uInt32 nParentLineWidth, const SwTableLines& rLines, USHORT nDepth ); void FillTableRowsCols( long nStartRPos, USHORT nStartRow, - USHORT nStartCPos, USHORT nStartCol, + sal_uInt32 nStartCPos, USHORT nStartCol, long nParentLineHeight, - USHORT nParentLineWidth, + sal_uInt32 nParentLineWidth, const SwTableLines& rLines, const SvxBrushItem* pLineBrush, USHORT nDepth, @@ -292,14 +292,14 @@ protected: USHORT nRowSpan, USHORT nColSpan, USHORT &rTopBorder, USHORT &rBottomBorder ); - USHORT GetBaseWidth() const { return nBaseWidth; } + sal_uInt32 GetBaseWidth() const { return nBaseWidth; } BOOL HasRelWidths() const { return bRelWidths; } public: - static long GetBoxWidth( const SwTableBox *pBox ); + static sal_uInt32 GetBoxWidth( const SwTableBox *pBox ); - USHORT GetRawWidth( USHORT nCol, USHORT nColSpan ) const; + sal_uInt32 GetRawWidth( USHORT nCol, USHORT nColSpan ) const; USHORT GetAbsWidth( USHORT nCol, USHORT nColSpan ) const; USHORT GetRelWidth( USHORT nCol, USHORT nColSpan ) const; USHORT GetPrcWidth( USHORT nCol, USHORT nColSpan ) const; @@ -317,7 +317,7 @@ protected: public: - SwWriteTable( const SwTableLines& rLines, long nWidth, USHORT nBWidth, + SwWriteTable( const SwTableLines& rLines, long nWidth, sal_uInt32 nBWidth, BOOL bRel, USHORT nMaxDepth = USHRT_MAX, USHORT nLeftSub=0, USHORT nRightSub=0, sal_uInt32 nNumOfRowsToRepeat=0 ); SwWriteTable( const SwHTMLTableLayout *pLayoutInfo ); diff --git a/sw/source/filter/makefile.mk b/sw/source/filter/makefile.mk deleted file mode 100644 index c2b343eb8b..0000000000 --- a/sw/source/filter/makefile.mk +++ /dev/null @@ -1,67 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. - -PRJNAME=sw -TARGET=filter - -.IF "$(CALLTARGETS)"=="filter" -RC_SUBDIRS= -.ENDIF - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -# --- Files -------------------------------------------------------- - - -SUBLIBS= \ - $(SLB)$/ascii.lib \ - $(SLB)$/basflt.lib \ - $(SLB)$/html.lib \ - $(SLB)$/writer.lib \ - $(SLB)$/ww1.lib \ - $(SLB)$/xml.lib - -# ----------------------------------------------------------- - - -################################################################ - -LIB1TARGET=$(SLB)$/filter.lib -LIB1FILES= \ - $(SUBLIBS) - -.INCLUDE : target.mk - -################################################################ - - diff --git a/sw/source/filter/rtf/makefile.mk b/sw/source/filter/rtf/makefile.mk deleted file mode 100644 index 5be61050a5..0000000000 --- a/sw/source/filter/rtf/makefile.mk +++ /dev/null @@ -1,66 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=rtf - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -MAKING_LIBMSWORD=TRUE -.INCLUDE : $(PRJ)$/inc$/sw.mk - -.IF "$(mydebug)" != "" -CDEFS=$(CDEFS) -Dmydebug -.ENDIF - -# --- Files -------------------------------------------------------- - -EXCEPTIONSFILES= \ - $(SLO)$/rtffly.obj \ - $(SLO)$/rtfnum.obj \ - $(SLO)$/rtftbl.obj \ - $(SLO)$/swparrtf.obj \ - $(SLO)$/wrtrtf.obj - - -SLOFILES = \ - $(SLO)$/rtfatr.obj \ - $(SLO)$/rtffld.obj \ - $(SLO)$/rtffly.obj \ - $(SLO)$/rtfnum.obj \ - $(SLO)$/rtftbl.obj \ - $(SLO)$/swparrtf.obj \ - $(SLO)$/wrtrtf.obj - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/filter/rtf/rtfatr.cxx b/sw/source/filter/rtf/rtfatr.cxx deleted file mode 100644 index 77f3cafb61..0000000000 --- a/sw/source/filter/rtf/rtfatr.cxx +++ /dev/null @@ -1,4356 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sw.hxx" -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */ - -/* - * Dieses File enthaelt alle Ausgabe-Funktionen des RTF-Writers; - * fuer alle Nodes, Attribute, Formate und Chars. - */ -#include <hintids.hxx> - -#include <com/sun/star/i18n/ScriptType.hdl> -#include <vcl/cvtgrf.hxx> -#include <svl/urihelper.hxx> -#include <svl/stritem.hxx> -#include <svtools/rtfkeywd.hxx> -#include <svl/whiter.hxx> -#include <svtools/rtfout.hxx> -#include <svl/itemiter.hxx> -#include <editeng/fontitem.hxx> -#include <editeng/hyznitem.hxx> -#include <editeng/tstpitem.hxx> -#include <editeng/lspcitem.hxx> -#include <editeng/langitem.hxx> -#include <editeng/keepitem.hxx> -#include <editeng/udlnitem.hxx> -#include <editeng/shaditem.hxx> -#include <editeng/cmapitem.hxx> -#include <editeng/brshitem.hxx> -#include <editeng/protitem.hxx> -#include <editeng/opaqitem.hxx> -#include <editeng/ulspitem.hxx> -#include <editeng/prntitem.hxx> -#include <editeng/colritem.hxx> -#include <editeng/escpitem.hxx> -#include <editeng/fhgtitem.hxx> -#include <editeng/spltitem.hxx> -#include <editeng/adjitem.hxx> -#include <editeng/lrspitem.hxx> -#include <editeng/boxitem.hxx> -#include <editeng/crsditem.hxx> -#include <editeng/cntritem.hxx> -#include <editeng/postitem.hxx> -#include <editeng/shdditem.hxx> -#include <editeng/wghtitem.hxx> -#include <editeng/wrlmitem.hxx> -#include <editeng/emphitem.hxx> -#include <editeng/twolinesitem.hxx> -#include <editeng/charscaleitem.hxx> -#include <editeng/charrotateitem.hxx> -#include <editeng/charreliefitem.hxx> -#include <svx/xoutbmp.hxx> -#include <editeng/paravertalignitem.hxx> -#include <editeng/hngpnctitem.hxx> -#include <editeng/scriptspaceitem.hxx> -#include <editeng/forbiddenruleitem.hxx> -#include <editeng/frmdiritem.hxx> -#include <editeng/charhiddenitem.hxx> -#include <unotools/charclass.hxx> -#include <reffld.hxx> -#include <frmatr.hxx> -#include <charatr.hxx> -#include <fmtfsize.hxx> -#include <fmtpdsc.hxx> -#include <fmtfld.hxx> -#include <fmtflcnt.hxx> -#include <fmtftn.hxx> -#include <fchrfmt.hxx> -#include <fmtautofmt.hxx> -#include <fmtcntnt.hxx> -#include <fmthdft.hxx> -#include <fmtclds.hxx> -#include <txtftn.hxx> -#include <fmtsrnd.hxx> -#include <fmtanchr.hxx> -#include <charfmt.hxx> -#include <fmtinfmt.hxx> -#include <txtinet.hxx> -#include <doc.hxx> -#include <docary.hxx> -#include <ndtxt.hxx> -#include <pam.hxx> -#include <paratr.hxx> -#include <fldbas.hxx> // fuer SwField ... -#include <wrtrtf.hxx> -#include <rtf.hxx> // fuer SwPictureType -#include <ndgrf.hxx> -#include <grfatr.hxx> -#include <docufld.hxx> -#include <flddat.hxx> -#include <pagedesc.hxx> // fuer SwPageDesc ... -#include <swtable.hxx> // fuer SwPageDesc ... -#include <docsh.hxx> -#include <swrect.hxx> -#include <section.hxx> -#include <wrtswtbl.hxx> -#include <htmltbl.hxx> -#include <fmtclbl.hxx> -#include <breakit.hxx> -#include <fmtruby.hxx> -#include <txtatr.hxx> -#include <fltini.hxx> -#include <fmtrowsplt.hxx> - -/* - * um nicht immer wieder nach einem Update festzustellen, das irgendwelche - * Hint-Ids dazugekommen sind, wird hier definiert, die Groesse der Tabelle - * definiert und mit der akt. verglichen. Bei unterschieden wird der - * Compiler schon meckern. - * - * diese Section und die dazugeherigen Tabellen muessen in folgenden Files - * gepflegt werden: rtf\rtfatr.cxx, sw6\sw6atr.cxx, w4w\w4watr.cxx - */ -#if !defined(UNX) && !defined(MSC) && !defined(PPC) && !defined(CSET) && !defined(__MWERKS__) && !defined(WTC) && !defined(__MINGW32__) && !defined(OS2) - -#define ATTRFNTAB_SIZE 130 -#if ATTRFNTAB_SIZE != POOLATTR_END - POOLATTR_BEGIN -#error Attribut-Tabelle ist ungueltigt. Wurden neue Hint-IDs zugefuegt ?? -#endif - -#ifdef FORMAT_TABELLE -// da sie nicht benutzt wird! -#define FORMATTAB_SIZE 7 -#if FORMATTAB_SIZE != RES_FMT_END - RES_FMT_BEGIN -#error Format-Tabelle ist ungueltigt. Wurden neue Hint-IDs zugefuegt ?? -#endif -#endif - -#define NODETAB_SIZE 3 -#if NODETAB_SIZE != RES_NODE_END - RES_NODE_BEGIN -#error Node-Tabelle ist ungueltigt. Wurden neue Hint-IDs zugefuegt ?? -#endif - -#endif - -#ifdef WNT -// ueber xoutbmp.hxx wird das winuser.h angezogen. Dort gibt es ein -// define GetProp das mit unserem SvxEscapement kollidiert! -#undef GetProp -#endif - - -using namespace com::sun::star; - -//----------------------------------------------------------------------- - -static Writer& OutRTF_SwFmtCol( Writer& rWrt, const SfxPoolItem& rHt ); - -//----------------------------------------------------------------------- - -SvStream& OutComment( Writer& rWrt, const sal_Char* pStr ) -{ - return (rWrt.Strm() << '{' << OOO_STRING_SVTOOLS_RTF_IGNORE << pStr); -} - -SvStream& OutComment( Writer& rWrt, const char* pStr, BOOL bSetFlag ) -{ - // setze Flag, damit bei der Ausgabe von Attributen zu erkennen, - // ob ueberhaupt etwas ausgegeben wurde. - ((SwRTFWriter&)rWrt).bOutFmtAttr = bSetFlag; - return (rWrt.Strm() << '{' << OOO_STRING_SVTOOLS_RTF_IGNORE << pStr); -} - -Writer& OutRTF_AsByteString( Writer& rWrt, const String& rStr, rtl_TextEncoding eEncoding) -{ - ByteString sOutStr( rStr, eEncoding ); - rWrt.Strm() << sOutStr.GetBuffer(); - return rWrt; -} - -void OutRTF_SfxItemSet( SwRTFWriter& rWrt, const SfxItemSet& rSet, - BOOL bDeep ) -{ - bool bFrameDirOut=false; - bool bAdjustOut=false; - // erst die eigenen Attribute ausgeben - SvPtrarr aAsian( 0, 5 ), aCmplx( 0, 5 ), aLatin( 0, 5 ); - - const SfxItemPool& rPool = *rSet.GetPool(); - SfxWhichIter aIter( rSet ); - const SfxPoolItem* pItem; - FnAttrOut pOut; - USHORT nWhich = aIter.FirstWhich(); - while( nWhich ) - { - if( SFX_ITEM_SET == rSet.GetItemState( nWhich, bDeep, &pItem )) - { - pOut = aRTFAttrFnTab[ nWhich - RES_CHRATR_BEGIN]; - if( pOut && - ( *pItem != rPool.GetDefaultItem( nWhich ) - || ( rSet.GetParent() && - *pItem != rSet.GetParent()->Get( nWhich ) ) - || ( rWrt.GetAttrSet() && - *pItem != rWrt.GetAttrSet()->Get( nWhich ) ) - ) ) - ; - else - pOut = 0; - } - else if( !bDeep ) - pOut = 0; - else if( 0 != ( pItem = rPool.GetPoolDefaultItem( nWhich )) ) - pOut = aRTFAttrFnTab[ nWhich - RES_CHRATR_BEGIN]; - else - pOut = 0; - - if (!pOut && bDeep) - { - switch( nWhich ) - { - case RES_CHRATR_FONTSIZE: - case RES_CHRATR_CJK_FONTSIZE: - case RES_CHRATR_CTL_FONTSIZE: - case RES_CHRATR_LANGUAGE: - case RES_CHRATR_CJK_LANGUAGE: - case RES_CHRATR_CTL_LANGUAGE: - pItem = &rPool.GetDefaultItem( nWhich ); - pOut = aRTFAttrFnTab[ nWhich - RES_CHRATR_BEGIN]; - break; - default: - break; - } - } - - if( pOut ) - { - void* pVoidItem = (void*)pItem; - switch( nWhich ) - { - case RES_CHRATR_FONT: - case RES_CHRATR_FONTSIZE: - case RES_CHRATR_LANGUAGE: - case RES_CHRATR_POSTURE: - case RES_CHRATR_WEIGHT: - aLatin.Insert( pVoidItem, aLatin.Count() ); - pOut = 0; - break; - - case RES_CHRATR_CJK_FONT: - case RES_CHRATR_CJK_FONTSIZE: - case RES_CHRATR_CJK_LANGUAGE: - case RES_CHRATR_CJK_POSTURE: - case RES_CHRATR_CJK_WEIGHT: - aAsian.Insert( pVoidItem, aAsian.Count() ); - pOut = 0; - break; - - case RES_CHRATR_CTL_FONT: - case RES_CHRATR_CTL_FONTSIZE: - case RES_CHRATR_CTL_LANGUAGE: - case RES_CHRATR_CTL_POSTURE: - case RES_CHRATR_CTL_WEIGHT: - aCmplx.Insert( pVoidItem, aCmplx.Count() ); - pOut = 0; - break; - - case RES_FRAMEDIR: - bFrameDirOut=true; - break; - case RES_PARATR_ADJUST: - bAdjustOut=true; - break; - } - } - - if (pOut) - (*pOut)( rWrt, *pItem ); - nWhich = aIter.NextWhich(); - } - - //If rtlpar set and no following alignment. And alignment is not rtl then - //output alignment - if (bFrameDirOut && !bAdjustOut && !rWrt.pFlyFmt && !rWrt.bOutPageDesc) - { - pOut = aRTFAttrFnTab[ static_cast< USHORT >(RES_PARATR_ADJUST) - RES_CHRATR_BEGIN]; - if (pOut) - (*pOut)(rWrt, rSet.Get(RES_PARATR_ADJUST)); - } - if (rWrt.pFlyFmt && !rWrt.bOutPageDesc && !bFrameDirOut) - { - pOut = aRTFAttrFnTab[ static_cast< USHORT >(RES_FRAMEDIR) - RES_CHRATR_BEGIN]; - if (pOut) - (*pOut)(rWrt, rSet.Get(RES_FRAMEDIR)); - } - - if (aAsian.Count() || aCmplx.Count() || aLatin.Count()) - { - SvPtrarr* aArr[4]; - switch (rWrt.GetCurrScriptType()) - { - case i18n::ScriptType::LATIN: - aArr[ 0 ] = &aCmplx; - aArr[ 1 ] = &aAsian; - aArr[ 2 ] = &aLatin; - aArr[ 3 ] = &aLatin; - break; - - case i18n::ScriptType::ASIAN: - aArr[ 0 ] = &aCmplx; - aArr[ 1 ] = &aLatin; - aArr[ 2 ] = &aLatin; - aArr[ 3 ] = &aAsian; - break; - - case i18n::ScriptType::COMPLEX: - aArr[ 0 ] = &aLatin; - aArr[ 1 ] = &aLatin; - aArr[ 2 ] = &aAsian; - aArr[ 3 ] = &aCmplx; - break; - - default: - return ; - } - - //The final entry is the one that is actually in use - //so it uses e.g. \b \i \fs, the others are not in - //use and so are "associated". Both asian and western - //are ltr runs, with asian being the dbch varient - //and western being the loch/hich varient - bool bOutLTOR = true; - bool bLowLTOR = false; - for( int nArrCnt = 0; nArrCnt < 4; ++nArrCnt ) - { - SvPtrarr* pCurArr = aArr[ nArrCnt ]; - if (pCurArr->Count()) - { - bool bInUse = (aArr[nArrCnt] == aArr[3]); - rWrt.SetAssociatedFlag(!bInUse); - if (pCurArr == &aLatin) - { - if (bOutLTOR) - { - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_LTRCH; - bOutLTOR = false; - } - - if (bLowLTOR) - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_LOCH; - else - { - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_HICH; - bLowLTOR = true; - } - } - else if( pCurArr == &aAsian ) - { - if( bOutLTOR ) - { - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_LTRCH; - bOutLTOR = false; - } - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_DBCH; - } - else - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_RTLCH; - - for (USHORT n = 0; n < pCurArr->Count(); ++n) - { - pItem = (const SfxPoolItem*)(*pCurArr)[ n ]; - pOut = aRTFAttrFnTab[ pItem->Which() - RES_CHRATR_BEGIN]; - (*pOut)( rWrt, *pItem ); - } - } - } - } -} - -// fuer die Formate muesste eine einzige Ausgabe-Funktion genuegen ! -/* - * Formate wie folgt ausgeben: - * - gebe alle Attribute vom Format aus - */ - -bool SwFmtToSet(SwRTFWriter& rWrt, const SwFmt& rFmt, SfxItemSet &rSet) -{ - bool bOutItemSet = true; - rSet.SetParent(rFmt.GetAttrSet().GetParent()); - - switch( rFmt.Which() ) - { - case RES_CONDTXTFMTCOLL: - case RES_TXTFMTCOLL: - { - USHORT nId = rWrt.GetId( (const SwTxtFmtColl&)rFmt ); - if (0 == nId ) - return false; // Default-TextStyle nicht ausgeben !! - - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_S; - rWrt.OutULong( nId ); - rWrt.bOutFmtAttr = TRUE; -// BYTE nLvl = ((const SwTxtFmtColl&)rFmt).GetOutlineLevel(); //#outline level,zhaojianwei -// if( MAXLEVEL > nLvl ) -// { - if(((const SwTxtFmtColl&)rFmt).IsAssignedToListLevelOfOutlineStyle()) - { - int nLvl = ((const SwTxtFmtColl&)rFmt).GetAssignedOutlineStyleLevel(); //<-end,zhaojianwei - USHORT nNumId = rWrt.GetNumRuleId( - *rWrt.pDoc->GetOutlineNumRule() ); - if( USHRT_MAX != nNumId ) - { - BYTE nWWLvl = 8 >= nLvl ? static_cast<BYTE>(nLvl) : 8; - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_LS; - rWrt.OutULong( nNumId ); - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_ILVL; rWrt.OutULong( nWWLvl ); - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_OUTLINELEVEL; rWrt.OutULong( nWWLvl ); - if( nWWLvl != nLvl ) // RTF-kennt nur 9 Ebenen - { - OutComment( rWrt, OOO_STRING_SVTOOLS_RTF_SOUTLVL ); - rWrt.OutULong( nLvl ) << '}'; - } - } - - const SwNumFmt* pNFmt = &rWrt.pDoc->GetOutlineNumRule()->Get( static_cast<USHORT>(nLvl) ); - if( pNFmt->GetAbsLSpace() ) - { - SfxItemSet aSet( *rFmt.GetAttrSet().GetPool(), - rFmt.GetAttrSet().GetRanges() ); - aSet.SetParent( &rFmt.GetAttrSet() ); - SvxLRSpaceItem aLR( (SvxLRSpaceItem&)aSet.Get( RES_LR_SPACE ) ); - - aLR.SetTxtLeft( aLR.GetTxtLeft() + pNFmt->GetAbsLSpace() ); - aLR.SetTxtFirstLineOfst( pNFmt->GetFirstLineOffset() ); - - aSet.Put(aLR); - rSet.Put(aSet); - bOutItemSet = false; - } - } - } - break; - case RES_CHRFMT: - { - USHORT nId = rWrt.GetId( (const SwCharFmt&)rFmt ); - if (0 == nId) - return false; // Default-CharStyle nicht ausgeben !! - - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_IGNORE << OOO_STRING_SVTOOLS_RTF_CS; - rWrt.OutULong( nId ); - rWrt.bOutFmtAttr = TRUE; - } - break; - -// case RES_GRFFMTCOLL: -// ????? - } - - if (bOutItemSet) - rSet.Put(rFmt.GetAttrSet()); - - return true; -} - -Writer& OutRTF_SwFmt(Writer& rWrt, const SwFmt& rFmt) -{ - SwRTFWriter & rRTFWrt = (SwRTFWriter&)rWrt; - - SfxItemSet aSet(*rFmt.GetAttrSet().GetPool(), - rFmt.GetAttrSet().GetRanges() ); - if (SwFmtToSet(rRTFWrt, rFmt, aSet)) - OutRTF_SfxItemSet(rRTFWrt, aSet, TRUE); - - return rWrt; -} - -void OutRTF_SwFlyFrmFmt( SwRTFWriter& rRTFWrt ) -{ - // ist der aktuelle Absatz in einem freifliegenden Rahmen ? Dann - // muessen noch die Attribute dafuer ausgegeben werden. - ASSERT( rRTFWrt.pFlyFmt, "wo ist das Fly-Format?" ); - - if( rRTFWrt.bOutFmtAttr ) - { - rRTFWrt.Strm() << ' '; - rRTFWrt.bOutFmtAttr = false; - } - // gebe erstmal alle RTF-Spezifischen Attribute aus - rRTFWrt.bRTFFlySyntax = TRUE; - OutRTF_SwFmt( rRTFWrt, *rRTFWrt.pFlyFmt ); - - // dann gebe alle eigenen Attribute aus - { - // dazu erzeuge einen temp strstream, um festzustellen ob es - // ueberhaupt eigene Attribute gibt ! - SvMemoryStream aTmpStrm; - SvStream* pSaveStrm = &rRTFWrt.Strm(); - rRTFWrt.SetStream( &aTmpStrm ); - - rRTFWrt.bRTFFlySyntax = false; - OutRTF_SwFmt( rRTFWrt, *rRTFWrt.pFlyFmt ); - - rRTFWrt.SetStream( pSaveStrm ); // Stream-Pointer wieder zurueck - - if ( aTmpStrm.GetEndOfData() ) // gibt es SWG spezifische Attribute? - { - aTmpStrm.Seek( 0L ); - rRTFWrt.Strm() << '{' << OOO_STRING_SVTOOLS_RTF_IGNORE << aTmpStrm << '}'; - } - } -// rRTFWrt.pFlyFmt = 0; // wieder zuruecksetzen !! -} - -/* Ausgabe der Nodes */ - -/* - * Ausgabe der Texte-Attribute: - * Die Text-Attribute sind in einem VarArray nach ihren Start-Positionen - * sortiert. Fuer den RTF-Writer ist aber auch das Ende von Bedeutung. - * Darum die Idee, sobald im SwpHints-Array ein Attribut mit der Start- - * Position gefunden wurde, in einem Sortierten-Array die Endposition - * zu speichern. Sobald der Writer die Position erreicht hat, wird die - * schliessende Klammer ausgegeben und die Position aus dem Sort.Array - * geloescht. - * 15.3.93: Es reicht leider nicht aus nur Start und End zuspeichern, denn - * im SwpHints Array stehen sie nicht nach Ende sortiert, so dass - * Attribute die falsche schliessende Klammer bekommen. (z.B - * Bold von 0..3, dann folgt Underline von 0..4. Dann bekommt Underline - * die schliessende Klammer von Bold !!) - * Also muessen erst alle Attribute einer Position gesammelt, nach - * Ende sortiert und dann erst ausgegeben werden. - */ - -SV_DECL_PTRARR( SfxPoolItems, SfxPoolItem*, 4, 4 ) -class RTFEndPosLst; - -class SttEndPos -{ - // falls mehrere Attribute den gleichen Bereich umspannen, sammeln - SfxPoolItems aArr; - xub_StrLen nStart, nEnd; - - SttEndPos( const SttEndPos & rSEPos ); - -public: - SttEndPos( const SfxPoolItem& rAttr, xub_StrLen nStt, xub_StrLen nEnd ); - ~SttEndPos(); - - xub_StrLen GetStart() const { return nStart; } - xub_StrLen GetEnd() const { return nEnd; } - - const SfxPoolItems& GetAttrs() const { return aArr; } - void AddAttr( const SfxPoolItem& rAttr ); - BOOL HasScriptChange() const; -}; - - -SV_DECL_PTRARR_DEL( _EndPosLst, SttEndPos*, 5, 5 ) -SV_IMPL_PTRARR( _EndPosLst, SttEndPos* ) - -class RTFEndPosLst : private _EndPosLst -{ - const SwTxtNode& rNode; - SwRTFWriter& rWrt; - RTFEndPosLst* pOldPosLst; - xub_StrLen nCurPos; - USHORT nCurScript; - -public: - using _EndPosLst::Count; - using _EndPosLst::operator[]; - using _EndPosLst::DeleteAndDestroy; - - RTFEndPosLst( SwRTFWriter& rWrt, const SwTxtNode& rNd, xub_StrLen nStart ); - ~RTFEndPosLst(); - - USHORT GetCurScript() const { return nCurScript; } - BOOL MatchScriptToId( USHORT nId ) const; - int Insert( const SfxPoolItem& rAttr, xub_StrLen nStt, xub_StrLen nEnd ); - - void OutAttrs( xub_StrLen nStrPos ); - void EndAttrs( xub_StrLen nStrPos ); - void OutScriptChange( xub_StrLen nStrPos ); - - const SfxPoolItem* HasItem( USHORT nWhich ) const; - const SfxPoolItem& GetItem( USHORT nWhich ) const; - void OutFontAttrs(const SfxPoolItem &rItem); - void OutFontAttrs(USHORT nScript, bool bRTL); - - SfxItemPool& GetPool() {return *rNode.GetSwAttrSet().GetPool(); } -}; - - -SttEndPos::SttEndPos( const SfxPoolItem& rAttr, - xub_StrLen nStt, xub_StrLen nEd ) - : nStart( nStt ), nEnd( nEd ) -{ - AddAttr( rAttr ); -} - -SttEndPos::~SttEndPos() -{ - for( USHORT n = 0, nCount = aArr.Count(); n < nCount; ++n ) - if( RES_FLTRATTR_BEGIN <= aArr[ n ]->Which() ) - delete aArr[ n ]; -} - -BOOL SttEndPos::HasScriptChange() const -{ - for( USHORT n = 0, nCount = aArr.Count(); n < nCount; ++n ) - if( RES_FLTR_SCRIPTTYPE == aArr[ n ]->Which() ) - return TRUE; - return FALSE; -} - -void SttEndPos::AddAttr( const SfxPoolItem& rAttr ) -{ - const SfxPoolItem* pI = &rAttr; - aArr.Insert(pI, aArr.Count()); -} - -RTFEndPosLst::RTFEndPosLst(SwRTFWriter& rWriter, const SwTxtNode& rNd, - xub_StrLen nStart) - : rNode(rNd), rWrt(rWriter), nCurPos(STRING_NOTFOUND) -{ - pOldPosLst = rWrt.pCurEndPosLst; - rWrt.pCurEndPosLst = this; - - using namespace sw::util; - CharRuns aCharRuns(GetPseudoCharRuns(rNd, nStart)); - cCharRunIter aEnd = aCharRuns.end(); - xub_StrLen nSttPos = nStart; - for (cCharRunIter aI = aCharRuns.begin(); aI != aEnd; ++aI) - { - if (nSttPos != aI->mnEndPos) - { - SfxPoolItem* pChg = new SfxUInt32Item(RES_FLTR_SCRIPTTYPE, - (sal_uInt32(aI->mnScript) << 16) | static_cast<sal_uInt32>(aI->mbRTL)); - Insert(*pChg, nSttPos, aI->mnEndPos); - nSttPos = aI->mnEndPos; - } - } -} - -RTFEndPosLst::~RTFEndPosLst() -{ - rWrt.pCurEndPosLst = pOldPosLst; -} - -int RTFEndPosLst::Insert( const SfxPoolItem& rAttr, xub_StrLen nStt, - xub_StrLen nEnd ) -{ - if (rAttr.Which() == RES_TXTATR_INETFMT) - return false; - - if( nStt == nEnd ) - return false; - - USHORT nPos; - for( nPos = 0; nPos < Count(); ++nPos ) - { - SttEndPos* pTmp = GetObject( nPos ); - if( pTmp->GetStart() == nStt && pTmp->GetEnd() == nEnd ) - { - pTmp->AddAttr( rAttr ); - return false; // schon vorhanden - } - if( nEnd < pTmp->GetEnd() ) - { - SttEndPos* pNew = new SttEndPos( rAttr, nStt, nEnd ); - _EndPosLst::C40_INSERT( SttEndPos, pNew, nPos ); - return TRUE; - } - } - - SttEndPos* pNew = new SttEndPos( rAttr, nStt, nEnd ); - _EndPosLst::C40_INSERT( SttEndPos, pNew, nPos ); - return TRUE; -} - -void RTFEndPosLst::OutScriptChange( xub_StrLen nStrPos ) -{ - SttEndPos* pStt; - for( USHORT n = 0, nEnd = Count(); n < nEnd; ++n ) - if( nStrPos == (pStt = GetObject( n ))->GetStart()) - { - if( pStt->HasScriptChange() ) - OutAttrs( nStrPos ); - break; - } -} - -void RTFEndPosLst::OutAttrs( xub_StrLen nStrPos ) -{ - SttEndPos* pStt; - nCurPos = nStrPos; - for( USHORT n = Count(); n ; ) - if( nStrPos == (pStt = (*this)[ --n ])->GetStart() ) - { - rWrt.Strm() << '{'; - for( USHORT i = 0; i < pStt->GetAttrs().Count(); ++i ) - { - const SfxPoolItem* pItem = pStt->GetAttrs()[i]; - if( RES_FLTR_SCRIPTTYPE == pItem->Which() ) - OutFontAttrs(*pItem); - else - Out( aRTFAttrFnTab, *pItem, rWrt ); - } - } - - nCurPos = STRING_NOTFOUND; -} - -//Just a little decoding hack for the RES_FLTR_SCRIPTTYPE thing -void RTFEndPosLst::OutFontAttrs(const SfxPoolItem &rItem) -{ - sal_uInt32 nValue = ((const SfxUInt32Item&)rItem).GetValue(); - sal_uInt16 nScript = static_cast<sal_uInt16>(nValue >> 16); - bool bBiDi = nValue & 0x1; - OutFontAttrs(nScript, bBiDi); -} - -void RTFEndPosLst::OutFontAttrs(USHORT nScript, bool bRTL) -{ - // script change, write the correct attributes: - // start first with the Fontname - - rWrt.bOutFmtAttr = TRUE; - nCurScript = nScript; - rWrt.SetCurrScriptType( nScript ); - rWrt.SetAssociatedFlag(false); - - // the font MUST be at the first position !!! - static const USHORT aLatinIds[] = - { - RES_CHRATR_FONT, - RES_CHRATR_FONTSIZE, RES_CHRATR_LANGUAGE, - RES_CHRATR_POSTURE, RES_CHRATR_WEIGHT, - 0 - }; - static const USHORT aAsianIds[] = - { - RES_CHRATR_CJK_FONT, - RES_CHRATR_CJK_FONTSIZE, RES_CHRATR_CJK_LANGUAGE, - RES_CHRATR_CJK_POSTURE, RES_CHRATR_CJK_WEIGHT, - 0 - }; - static const USHORT aCmplxIds[] = - { - RES_CHRATR_CTL_FONT, - RES_CHRATR_CTL_FONTSIZE, RES_CHRATR_CTL_LANGUAGE, - RES_CHRATR_CTL_POSTURE, RES_CHRATR_CTL_WEIGHT, - 0 - }; - - /* - You would have thought that - rWrt.Strm() << (bRTL ? OOO_STRING_SVTOOLS_RTF_RTLCH : OOO_STRING_SVTOOLS_RTF_LTRCH); would be sufficent here , - but looks like word needs to see the other directional token to be - satisified that all is kosher, otherwise it seems in ver 2003 to go and - semi-randomlyly stick strike through about the place. Perhaps - strikethrough is some ms developers "something is wrong signal" debugging - code that we're triggering ? - */ - if (bRTL) - { - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_LTRCH; - rWrt.Strm() << ' '; - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_RTLCH; - } - else - { - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_RTLCH; - rWrt.Strm() << ' '; - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_LTRCH; - } - - // size/weight/posture optional - const USHORT* pIdArr = 0; - ByteString sOut; - switch (nScript) - { - default: //fall through - ASSERT(pIdArr, "unknown script, strange"); - case i18n::ScriptType::LATIN: - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_LOCH; - pIdArr = aLatinIds; - break; - case i18n::ScriptType::ASIAN: - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_DBCH; - pIdArr = aAsianIds; - break; - case i18n::ScriptType::COMPLEX: - pIdArr = aCmplxIds; - break; - } - - for (const USHORT* pId = pIdArr; *pId; ++pId) - { - if (FnAttrOut pOut = aRTFAttrFnTab[ *pId - RES_CHRATR_BEGIN]) - { - const SfxPoolItem* pItem = HasItem(*pId); - if (!pItem) - pItem = &GetPool().GetDefaultItem(*pId); - (*pOut)(rWrt, *pItem); - } - } -} - -void RTFEndPosLst::EndAttrs( xub_StrLen nStrPos ) -{ - xub_StrLen nClipStart=STRING_MAXLEN; - bool bClosed=false; - SttEndPos* pSEPos; - while( 0 != Count() && 0 != (pSEPos = GetObject( 0 )) && - ( STRING_MAXLEN == nStrPos || nStrPos == pSEPos->GetEnd() )) - { - const SfxPoolItems& rAttrs = pSEPos->GetAttrs(); - for( USHORT nAttr = rAttrs.Count(); nAttr; ) - { - switch( rAttrs[ --nAttr ]->Which() ) - { - case RES_TXTATR_CJK_RUBY: - rWrt.Strm() << ")}{" << OOO_STRING_SVTOOLS_RTF_FLDRSLT << " }}"; - break; - } - } - - rWrt.Strm() << '}'; // end of all attributes from this position - if (pSEPos->GetStart() < nClipStart) - nClipStart = pSEPos->GetStart(); - bClosed=true; - DeleteAndDestroy( 0, 1 ); - } - - if (bClosed) - { - //If there are open ranges whose start is before this point, and whose - //start is after the cliping start then they have been closed whether - //we wanted this or not. So accept that fact and then restart then - //again - USHORT nSize = Count(); - while (nSize > 0) - { - pSEPos = GetObject(--nSize); - if ( pSEPos->GetStart() < nStrPos && - pSEPos->GetStart() >= nClipStart) - { - rWrt.Strm() << '}'; - } - } - - nSize = Count(); - USHORT n = 0; - while (n < nSize) - { - SttEndPos* pStt = (*this)[n++]; - if (pStt->GetStart() < nStrPos && pStt->GetStart() >= nClipStart) - { - rWrt.Strm() << '{'; - for( USHORT i = 0; i < pStt->GetAttrs().Count(); ++i ) - { - const SfxPoolItem* pItem = pStt->GetAttrs()[i]; - if( RES_FLTR_SCRIPTTYPE == pItem->Which() ) - OutFontAttrs(*pItem); - else - Out( aRTFAttrFnTab, *pItem, rWrt ); - } - } - } - } -} - -BOOL RTFEndPosLst::MatchScriptToId( USHORT nWhich ) const -{ - BOOL bRet = false; - switch( nWhich ) - { - case RES_CHRATR_FONT: - case RES_CHRATR_FONTSIZE: - case RES_CHRATR_LANGUAGE: - case RES_CHRATR_POSTURE: - case RES_CHRATR_WEIGHT: - bRet = nCurScript == i18n::ScriptType::LATIN; - break; - case RES_CHRATR_CJK_FONT: - case RES_CHRATR_CJK_FONTSIZE: - case RES_CHRATR_CJK_LANGUAGE: - case RES_CHRATR_CJK_POSTURE: - case RES_CHRATR_CJK_WEIGHT: - bRet = nCurScript == i18n::ScriptType::ASIAN; - break; - case RES_CHRATR_CTL_FONT: - case RES_CHRATR_CTL_FONTSIZE: - case RES_CHRATR_CTL_LANGUAGE: - case RES_CHRATR_CTL_POSTURE: - case RES_CHRATR_CTL_WEIGHT: - bRet = nCurScript == i18n::ScriptType::COMPLEX; - break; - } - return bRet; -} - -const SfxPoolItem& RTFEndPosLst::GetItem( USHORT nWhich ) const -{ - const SfxPoolItem* pItem = HasItem( nWhich ); - if( !pItem ) - pItem = &rNode.GetSwAttrSet().GetPool()->GetDefaultItem( nWhich ); - return *pItem; -} - -const SfxPoolItem* RTFEndPosLst::HasItem( USHORT nWhich ) const -{ - const SfxPoolItem* pItem; - if( RES_TXTATR_END > nWhich ) - { - // it's a character/text attribute so look into the item array - for( USHORT n = Count(); n; ) - { - SttEndPos* pTmp = GetObject( --n ); - for( USHORT i = pTmp->GetAttrs().Count(); i; ) - { - pItem = pTmp->GetAttrs()[ --i ]; - if( pItem->Which() == nWhich ) - return pItem; - - // look into the charfmt? - if( RES_TXTATR_CHARFMT == pItem->Which() && - ((SwFmtCharFmt*) pItem)->GetCharFmt() && - SFX_ITEM_SET == ((SwFmtCharFmt*) pItem)->GetCharFmt()-> - GetItemState( nWhich, TRUE, &pItem )) - return pItem; - } - } - } - - if( SFX_ITEM_SET != rNode.GetSwAttrSet().GetItemState( - nWhich, TRUE, &pItem )) - pItem = 0; - return pItem; -} - -const SfxPoolItem& SwRTFWriter::GetItem( USHORT nWhich ) const -{ - if( pCurEndPosLst ) - return pCurEndPosLst->GetItem( nWhich ); - if( pAttrSet ) - return pAttrSet->Get( nWhich ); - - return pDoc->GetAttrPool().GetDefaultItem( nWhich ); -} - -static void OutSvxFrmDir(SwRTFWriter& rRTFWrt, const SfxPoolItem& rHt ) -{ - // write it only for pasgedesc's - not for frames - SvxFrameDirectionItem aItem((const SvxFrameDirectionItem&)rHt); - USHORT nVal = 0; - const sal_Char* pStr = 0; - bool bRTL = false; - - if (rRTFWrt.pFlyFmt) - aItem.SetValue(rRTFWrt.TrueFrameDirection(*rRTFWrt.pFlyFmt)); - - switch (aItem.GetValue()) - { - case FRMDIR_ENVIRONMENT: - ASSERT(0, "Not expected to see FRMDIR_ENVIRONMENT here"); - break; - case FRMDIR_VERT_TOP_RIGHT: - nVal = 1; - pStr = OOO_STRING_SVTOOLS_RTF_FRMTXTBRLV; - break; - case FRMDIR_HORI_RIGHT_TOP: - bRTL = true; -// nVal = 3; -// A val of three isn't working as expected in word :-( so leave it -// as normal ltr 0 textflow with rtl sect property, neither does -// the frame textflow -// pStr = OOO_STRING_SVTOOLS_RTF_FRMTXTBRL; - break; - case FRMDIR_VERT_TOP_LEFT: - nVal = 4; - pStr = OOO_STRING_SVTOOLS_RTF_FRMTXLRTBV; - break; - } - - if( rRTFWrt.pFlyFmt && rRTFWrt.bRTFFlySyntax && pStr ) - { - rRTFWrt.Strm() << pStr; - rRTFWrt.bOutFmtAttr = TRUE; - } - else if( rRTFWrt.bOutPageDesc) - { - if (nVal) - { - rRTFWrt.Strm() << OOO_STRING_SVTOOLS_RTF_STEXTFLOW; - rRTFWrt.OutULong( nVal ); - } - if (bRTL) - rRTFWrt.Strm() << OOO_STRING_SVTOOLS_RTF_RTLSECT; - rRTFWrt.bOutFmtAttr = TRUE; - } - else if (!rRTFWrt.pFlyFmt && !rRTFWrt.bOutPageDesc) - { - rRTFWrt.Strm() << (bRTL ? OOO_STRING_SVTOOLS_RTF_RTLPAR : OOO_STRING_SVTOOLS_RTF_LTRPAR); - rRTFWrt.bOutFmtAttr = TRUE; - } -} - -void OutRTF_SwRTL(SwRTFWriter& rWrt, const SwTxtNode *pNd) -{ - if (!pNd) - return; - SvxFrameDirection eDir = FRMDIR_ENVIRONMENT; - if (const SvxFrameDirectionItem* pItem = (const SvxFrameDirectionItem*) - pNd->GetSwAttrSet().GetItem(RES_FRAMEDIR)) - { - eDir = static_cast<SvxFrameDirection>(pItem->GetValue()); - } - if (eDir == FRMDIR_ENVIRONMENT) - { - SwPosition aPos(*pNd); - eDir = - static_cast<SvxFrameDirection>(rWrt.pDoc->GetTextDirection(aPos)); - } - OutSvxFrmDir(rWrt, SvxFrameDirectionItem(eDir, RES_FRAMEDIR)); -} - -static Writer& OutRTF_SwTxtINetFmt( Writer& rWrt, const SfxPoolItem& rHt ) -{ - const SwFmtINetFmt& rURL = (const SwFmtINetFmt&)rHt; - SwRTFWriter& rRTFWrt = (SwRTFWriter&)rWrt; - if( rURL.GetValue().Len() ) - { - rWrt.Strm() << '{' << OOO_STRING_SVTOOLS_RTF_FIELD << '{' << OOO_STRING_SVTOOLS_RTF_IGNORE - << OOO_STRING_SVTOOLS_RTF_FLDINST << " HYPERLINK "; - - String sURL( rURL.GetValue() ); - if( INET_MARK_TOKEN != sURL.GetChar(0) ) - { - INetURLObject aTmp( URIHelper::simpleNormalizedMakeRelative(rWrt.GetBaseURL(), - sURL)); - - - sURL = aTmp.GetURLNoMark( INetURLObject::DECODE_UNAMBIGUOUS); -/* if( INET_PROT_FILE == aTmp.GetProtocol() ) - { - // WW97 wollen keine FILE-URL haben, sondern einen normalen - // Dateinamen. Aber ab WW2000 kennen sie FileURLs. - sURL = aTmp.GetFull(); - } -*/ rWrt.Strm() << '\"'; - RTFOutFuncs::Out_String( rWrt.Strm(), sURL, rRTFWrt.eCurrentEncoding, - rRTFWrt.bWriteHelpFmt ) << "\" "; - sURL = aTmp.GetMark(); - } - - if( sURL.Len() ) - { - rWrt.Strm() << "\\\\l \""; - sURL.Erase( 0, 1 ); - RTFOutFuncs::Out_String( rWrt.Strm(), sURL, rRTFWrt.eCurrentEncoding, - rRTFWrt.bWriteHelpFmt ) << "\" "; - } - - if( rURL.GetTargetFrame().Len() ) - { - rWrt.Strm() << "\\\\t \""; - RTFOutFuncs::Out_String( rWrt.Strm(), rURL.GetTargetFrame(), - rRTFWrt.eDefaultEncoding, rRTFWrt.bWriteHelpFmt ) << "\" "; - } - - rWrt.Strm() << "}{" << OOO_STRING_SVTOOLS_RTF_FLDRSLT << ' '; - rRTFWrt.bOutFmtAttr = false; - - // und dann noch die Attributierung ausgeben - const SwCharFmt* pFmt; - const SwTxtINetFmt* pTxtAtr = rURL.GetTxtINetFmt(); - if( pTxtAtr && 0 != ( pFmt = pTxtAtr->GetCharFmt() )) - OutRTF_SwFmt( rWrt, *pFmt ); - } - return rWrt; -} - -void HandleHyperlinks(Writer& rWrt, const SwpHints* pTxtAttrs, xub_StrLen nPos ) -{ - USHORT nCount = pTxtAttrs ? pTxtAttrs->Count() : 0; - for(USHORT i = 0; i < nCount; ++i ) - { - const SwTxtAttr* pHt = (*pTxtAttrs)[i]; - const SfxPoolItem &rItem = pHt->GetAttr(); - if (rItem.Which() == RES_TXTATR_INETFMT) - { - const xub_StrLen* pEnd; - if (nPos == *pHt->GetStart()) - OutRTF_SwTxtINetFmt(rWrt, rItem); - if (0 != ( pEnd = pHt->GetEnd() ) && nPos == *pEnd) - { - // Hyperlinks werden als Felder geschrieben, aber der - // "FieldResult" // steht als Text im TextNode. Also muss bei - // diesen Attributen am // Ende 2 Klammern stehen! - rWrt.Strm() << "}}"; - } - } - } -} - -static Writer& OutRTF_SwTxtNode( Writer& rWrt, SwCntntNode& rNode ) -{ - SwTxtNode * pNd = &((SwTxtNode&)rNode); - SwRTFWriter & rRTFWrt = (SwRTFWriter&)rWrt; - xub_StrLen nStrPos = rRTFWrt.pCurPam->GetPoint()->nContent.GetIndex(); - RTFEndPosLst aEndPosLst( rRTFWrt, *pNd, nStrPos ); - USHORT nAttrPos = 0; - - const String& rStr = pNd->GetTxt(); - xub_StrLen nEnde = rStr.Len(); - if( rRTFWrt.pCurPam->GetPoint()->nNode == rRTFWrt.pCurPam->GetMark()->nNode ) - nEnde = Min( nEnde, rRTFWrt.pCurPam->GetMark()->nContent.GetIndex() ); - - int bNewFmts = rRTFWrt.GetAttrSet() != &pNd->GetSwAttrSet(); - if( bNewFmts ) - { - // harte Attributierung am Node und am Vorgaenger ? - const SfxItemSet* pNdSet = pNd->GetpSwAttrSet(); - if( pNdSet && rRTFWrt.GetAttrSet() && rRTFWrt.bAutoAttrSet && - pNdSet->GetParent() == rRTFWrt.GetAttrSet()->GetParent() && - pNdSet->Count() == rRTFWrt.GetAttrSet()->Count() ) - { - // die beiden Parents sind gleich, dann teste doch mal die - // Attribute im Set - - int bEqual = TRUE; - if( pNdSet->Count() ) - { - SfxItemIter aIter( *rRTFWrt.GetAttrSet() ); - const SfxPoolItem *pItem, *pCurr = aIter.GetCurItem(); - while( TRUE ) - { - if( SFX_ITEM_SET != pNdSet->GetItemState( pCurr->Which(), - false, &pItem ) || *pItem != *pCurr ) - { - bEqual = false; - break; - } - - if( aIter.IsAtEnd() ) - break; - pCurr = aIter.NextItem(); - } - } - if (bEqual) - bNewFmts = false; - } - rRTFWrt.SetAttrSet( &pNd->GetSwAttrSet() ); - rRTFWrt.bAutoAttrSet = 0 != pNdSet; - } - - // Flag zuruecksetzen, damit nach der Ausgabe der Collection - // getestet werden kann, ob noch ein Blank auszugeben ist - rRTFWrt.bOutFmtAttr = false; - - // in der Ausgabe eines Flys? Dann vorm ausgeben der AbsatzAttribute - // den Format-Pointer auf 0 setzen! - const SwFlyFrmFmt* pSaveFmt = rRTFWrt.pFlyFmt; - - SfxItemSet aMergedSet(rRTFWrt.pDoc->GetAttrPool(), POOLATTR_BEGIN, - POOLATTR_END-1); - bool bDeep = false; - - if( rRTFWrt.bWriteAll ) - { - rRTFWrt.Strm() << OOO_STRING_SVTOOLS_RTF_PARD << OOO_STRING_SVTOOLS_RTF_PLAIN << ' '; // alle Attribute zuruecksetzen - if( rRTFWrt.bOutTable ) - rRTFWrt.Strm() << OOO_STRING_SVTOOLS_RTF_INTBL; - - // ist der aktuelle Absatz in einem freifliegenden Rahmen ? Dann - // muessen noch die Attribute dafuer ausgegeben werden. - if( pSaveFmt ) - { - OutRTF_SwFlyFrmFmt( rRTFWrt ); - rRTFWrt.pFlyFmt = 0; - } - - rRTFWrt.OutListNum( *pNd ); - OutRTF_SwRTL(rRTFWrt, pNd); - SwFmtToSet(rRTFWrt, pNd->GetAnyFmtColl(), aMergedSet); - bDeep = true; - } - else if( !rRTFWrt.bWriteAll && rRTFWrt.bFirstLine ) - { - OutRTF_SwRTL(rRTFWrt, pNd); - SwFmtToSet(rRTFWrt, pNd->GetAnyFmtColl(), aMergedSet); - bDeep = true; - } - - // gibt es harte Attributierung ? - if( bNewFmts && pNd->HasSwAttrSet()) - { - rRTFWrt.pFlyFmt = 0; - - const SfxItemSet& rNdSet = pNd->GetSwAttrSet(); - - const SwNumRule* pRule = pNd->GetNumRule(); - // --> OD 2008-03-19 #refactorlists# - if ( pRule && pNd->IsInList() ) - // <-- - { - // --> OD 2008-03-18 #refactorlists# - ASSERT( pNd->GetActualListLevel() >= 0 && pNd->GetActualListLevel() < MAXLEVEL, - "<OutRTF_SwTxtNode(..)> - text node does not have valid list level. Serious defect -> please inform OD" ); - // <-- - BYTE nLvl = static_cast< BYTE >(pNd->GetActualListLevel()); - const SwNumFmt* pFmt = pRule->GetNumFmt( nLvl ); - if( !pFmt ) - pFmt = &pRule->Get( nLvl ); - - SfxItemSet aSet( rNdSet ); - SvxLRSpaceItem aLR( (SvxLRSpaceItem&)rNdSet.Get( RES_LR_SPACE ) ); - - aLR.SetTxtLeft( aLR.GetTxtLeft() + pFmt->GetAbsLSpace() ); - if( MAXLEVEL > pNd->GetActualListLevel() ) - aLR.SetTxtFirstLineOfst( pFmt->GetFirstLineOffset() ); - else - aSet.ClearItem( RES_PARATR_NUMRULE ); - aSet.Put( aLR ); - aMergedSet.Put(aSet); - } - else - aMergedSet.Put(rNdSet); - } - - SwTxtNode *txtNode=rNode.GetTxtNode(); - if (txtNode!=NULL && !txtNode->IsNumbered()) - { - aMergedSet.ClearItem(RES_PARATR_NUMRULE); - } - OutRTF_SfxItemSet(rRTFWrt, aMergedSet, bDeep); - - rRTFWrt.pFlyFmt = pSaveFmt; - - rRTFWrt.bTxtAttr = true; - // erstmal den Start berichtigen. D.h. wird nur ein Teil vom Satz - // ausgegeben, so muessen auch da die Attribute stimmen!! - const SwTxtAttr * pHt = 0; - USHORT nCntAttr = pNd->HasHints() ? pNd->GetSwpHints().Count() : 0; - if( nCntAttr && nStrPos > *( pHt = pNd->GetSwpHints()[ 0 ] )->GetStart() ) - { - // Ok, es gibt vorher Attribute, die ausgegeben werden muessen - do { - nAttrPos++; - if( RES_TXTATR_FIELD == pHt->Which() ) // Felder nicht - continue; // ausgeben - - if( pHt->GetEnd() ) - { - xub_StrLen nHtEnd = *pHt->GetEnd(), nHtStt = *pHt->GetStart(); - if( !rRTFWrt.bWriteAll && nHtEnd <= nStrPos ) - continue; - - // leere Hints am Anfang nicht beachten, oder ?? - if( nHtEnd == nHtStt ) - continue; - - // Attribut in die Liste aufnehemen - if( !rRTFWrt.bWriteAll ) - { - if( nHtStt < nStrPos ) nHtStt = nStrPos; - if( nHtEnd >= nEnde ) nHtEnd = nEnde; - } - aEndPosLst.Insert( pHt->GetAttr(), nHtStt, nHtEnd ); - continue; - // aber nicht ausgeben, das erfolgt spaeter !! - } - Out( aRTFAttrFnTab, pHt->GetAttr(), rRTFWrt ); - - } while( nAttrPos < nCntAttr && nStrPos > - *( pHt = pNd->GetSwpHints()[ nAttrPos ] )->GetStart() ); - - // dann gebe mal alle gesammelten Attribute von der String-Pos aus - aEndPosLst.OutAttrs( nStrPos ); - } - - if( rRTFWrt.bOutFmtAttr && - ( nAttrPos < nCntAttr ? *pHt->GetStart() != nStrPos : TRUE )) - rRTFWrt.Strm() << ' '; - - // das Flag gibt an, ob das SwTxtFld am Ende vom Absatz steht. Denn - // dann ist vor dem Absatzumbruch die schliessende Klammer auszugeben - xub_StrLen nChrCnt = 0; - for( ; nStrPos <= nEnde; nStrPos++ ) - { - rRTFWrt.bOutFmtAttr = false; - if( nStrPos != nEnde && aEndPosLst.Count() ) - aEndPosLst.EndAttrs( nStrPos ); - - // versuche nach ungefaehr 255 Zeichen eine neue Zeile zu beginnen - if( nChrCnt != ( nStrPos & 0xff00 )) - { - rWrt.Strm() << SwRTFWriter::sNewLine; - nChrCnt = nStrPos & 0xff00; - } - - if( nAttrPos < nCntAttr && *pHt->GetStart() == nStrPos - && nStrPos != nEnde ) - { - do { - BOOL bEmpty = false; - if( pHt->GetEnd() ) - { - if (false == (bEmpty = *pHt->GetEnd() == nStrPos)) - { - aEndPosLst.Insert( pHt->GetAttr(), nStrPos, - *pHt->GetEnd() ); - continue; - } - rRTFWrt.Strm() << '{'; - } - Out( aRTFAttrFnTab, pHt->GetAttr(), rRTFWrt ); - if( bEmpty ) - { - rRTFWrt.Strm() << '}'; - rRTFWrt.bOutFmtAttr = false; - } - } while( ++nAttrPos < nCntAttr && nStrPos == - *( pHt = pNd->GetSwpHints()[ nAttrPos ] )->GetStart() ); - - // dann gebe mal alle gesammelten Attribute von der String-Pos aus - aEndPosLst.OutAttrs( nStrPos ); - - } - else - aEndPosLst.OutScriptChange( nStrPos ); - - HandleHyperlinks(rWrt, pNd->GetpSwpHints(), nStrPos); - - if( rRTFWrt.bOutFmtAttr ) - rRTFWrt.Strm() << ' '; - - rRTFWrt.OutBookmarks( nStrPos ); - - rRTFWrt.OutRedline( nStrPos); - - if (nStrPos != nEnde) - { - RTFOutFuncs::Out_String(rWrt.Strm(), String(rStr.GetChar(nStrPos)), - rRTFWrt.eCurrentEncoding, rRTFWrt.bWriteHelpFmt); - } - } - - rRTFWrt.bTxtAttr = false; - - // noch eine schliesende Klammer da ?? - if( aEndPosLst.Count() ) - aEndPosLst.EndAttrs( USHRT_MAX ); - - // wenn bis zum Ende vom Node, dann auch das AbsatzEnde ausgeben - if( rRTFWrt.pCurPam->GetMark()->nNode.GetIndex() == - rRTFWrt.pCurPam->GetPoint()->nNode.GetIndex() ) - { - if( pNd->Len() != rRTFWrt.pCurPam->GetMark()->nContent.GetIndex() ) - return rWrt; - - if( rRTFWrt.bOutTable ) - { - rRTFWrt.Strm() << SwRTFWriter::sNewLine; - return rWrt; - } - } - - rRTFWrt.Strm() << SwRTFWriter::sNewLine << OOO_STRING_SVTOOLS_RTF_PAR << ' '; - return rRTFWrt; -} - -bool IsEMF(const sal_uInt8 *pGraphicAry, unsigned long nSize) -{ - if (pGraphicAry && (nSize > 0x2c )) - { - // check the magic number - if ( - (pGraphicAry[0x28] == 0x20 ) && (pGraphicAry[0x29] == 0x45) && - (pGraphicAry[0x2a] == 0x4d ) && (pGraphicAry[0x2b] == 0x46) - ) - { - //emf detected - return true; - } - } - return false; -} - -bool StripMetafileHeader(const sal_uInt8 *&rpGraphicAry, unsigned long &rSize) -{ - if (rpGraphicAry && (rSize > 0x22)) - { - if ( - (rpGraphicAry[0] == 0xd7) && (rpGraphicAry[1] == 0xcd) && - (rpGraphicAry[2] == 0xc6) && (rpGraphicAry[3] == 0x9a) - ) - { // we have to get rid of the metafileheader - rpGraphicAry += 22; - rSize -= 22; - return true; - } - } - return false; -} - -void ExportPICT(const Size &rOrig, const Size &rRendered, const Size &rMapped, - const SwCropGrf &rCr, const char *pBLIPType, const sal_uInt8 *pGraphicAry, - unsigned long nSize, SwRTFWriter &rWrt) -{ - bool bIsWMF = (pBLIPType && !strcmp(pBLIPType, OOO_STRING_SVTOOLS_RTF_WMETAFILE)) ? true : false; - if (pBLIPType && nSize && pGraphicAry) - { - rWrt.Strm() << '{' << OOO_STRING_SVTOOLS_RTF_PICT; - - long nXCroppedSize = rOrig.Width()-(rCr.GetLeft() + rCr.GetRight()); - long nYCroppedSize = rOrig.Height()-(rCr.GetTop() + rCr.GetBottom()); - /* #127543#: Graphic with a zero height or width, typically copied from webpages, caused - crashes. */ - if( !nXCroppedSize ) - nXCroppedSize = 100; - if( !nYCroppedSize ) - nYCroppedSize = 100; - - //Given the original size and taking cropping into account - //first, how much has the original been scaled to get the - //final rendered size - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_PICSCALEX; - rWrt.OutLong((100 * rRendered.Width()) / nXCroppedSize); - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_PICSCALEY; - rWrt.OutLong((100 * rRendered.Height()) / nYCroppedSize); - - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_PICCROPL; - rWrt.OutLong(rCr.GetLeft()); - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_PICCROPR; - rWrt.OutLong(rCr.GetRight()); - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_PICCROPT; - rWrt.OutLong(rCr.GetTop()); - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_PICCROPB; - rWrt.OutLong(rCr.GetBottom()); - - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_PICW; - rWrt.OutLong(rMapped.Width()); - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_PICH; - rWrt.OutLong(rMapped.Height()); - - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_PICWGOAL; - rWrt.OutLong(rOrig.Width()); - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_PICHGOAL; - rWrt.OutLong(rOrig.Height()); - - rWrt.Strm() << pBLIPType; - if (bIsWMF) - { - rWrt.OutLong(8); - StripMetafileHeader(pGraphicAry, nSize); - } - rWrt.Strm() << SwRTFWriter::sNewLine; - - sal_uInt32 nBreak = 0; - for (sal_uInt32 nI = 0; nI < nSize; ++nI) - { - ByteString sNo = ByteString::CreateFromInt32(pGraphicAry[nI], 16); - if (sNo.Len() < 2) - rWrt.Strm() << '0'; - rWrt.Strm() << sNo.GetBuffer(); - if (++nBreak == 64) - { - rWrt.Strm() << SwRTFWriter::sNewLine; - nBreak = 0; - } - } - - rWrt.Strm() << '}'; - } -} - -static Writer& OutRTF_SwGrfNode(Writer& rWrt, SwCntntNode & rNode) -{ - SwRTFWriter & rRTFWrt = (SwRTFWriter&)rWrt; - SwGrfNode &rNd = (SwGrfNode&)rNode; - - // ist der aktuelle Absatz in einem freifliegenden Rahmen ? Dann - // muessen noch die Attribute dafuer ausgegeben werden. - if (rRTFWrt.pFlyFmt && !ExportAsInline(*rRTFWrt.pFlyFmt)) - OutRTF_SwFlyFrmFmt(rRTFWrt); //"classic" positioning and size export - -#if 1 - SvMemoryStream aStream; - const sal_uInt8* pGraphicAry = 0; - sal_uInt32 nSize = 0; - - Graphic aGraphic(rNd.GetGrf()); - - // If there is no graphic there is not much point in parsing it - if(aGraphic.GetType()==GRAPHIC_NONE) - return rRTFWrt; - - GfxLink aGraphicLink; - const sal_Char* pBLIPType = 0; - if (aGraphic.IsLink()) - { - aGraphicLink = aGraphic.GetLink(); - nSize = aGraphicLink.GetDataSize(); - pGraphicAry = aGraphicLink.GetData(); - switch (aGraphicLink.GetType()) - { - case GFX_LINK_TYPE_NATIVE_JPG: - pBLIPType = OOO_STRING_SVTOOLS_RTF_JPEGBLIP; - break; - case GFX_LINK_TYPE_NATIVE_PNG: - pBLIPType = OOO_STRING_SVTOOLS_RTF_PNGBLIP; - case GFX_LINK_TYPE_NATIVE_WMF: - pBLIPType = - IsEMF(pGraphicAry, nSize) ? OOO_STRING_SVTOOLS_RTF_EMFBLIP : OOO_STRING_SVTOOLS_RTF_WMETAFILE; - break; - default: - break; - } - } - - GraphicType eGraphicType = aGraphic.GetType(); - if (!pGraphicAry) - { - if (ERRCODE_NONE == GraphicConverter::Export(aStream, aGraphic, - (eGraphicType == GRAPHIC_BITMAP) ? CVT_PNG : CVT_WMF)) - { - pBLIPType = (eGraphicType == GRAPHIC_BITMAP) ? - OOO_STRING_SVTOOLS_RTF_PNGBLIP : OOO_STRING_SVTOOLS_RTF_WMETAFILE; - aStream.Seek(STREAM_SEEK_TO_END); - nSize = aStream.Tell(); - pGraphicAry = (sal_uInt8*)aStream.GetData(); - } - } - - Size aMapped(eGraphicType == GRAPHIC_BITMAP ? aGraphic.GetSizePixel() : aGraphic.GetPrefSize()); - - const SwCropGrf &rCr = (const SwCropGrf &)rNd.GetAttr(RES_GRFATR_CROPGRF); - - //Get original size in twips - Size aSize(sw::util::GetSwappedInSize(rNd)); - Size aRendered(aSize); - if (rRTFWrt.pFlyFmt) - { - const SwFmtFrmSize& rS = rRTFWrt.pFlyFmt->GetFrmSize(); - aRendered.Width() = rS.GetWidth(); - aRendered.Height() = rS.GetHeight(); - } - - /* - If the graphic is not of type WMF then we will have to store two - graphics, one in the native format wrapped in shppict, and the other in - the wmf format wrapped in nonshppict, so as to keep wordpad happy. If its - a wmf already then we don't need any such wrapping - */ - bool bIsWMF = (pBLIPType && !strcmp(pBLIPType, OOO_STRING_SVTOOLS_RTF_WMETAFILE)) ? true : false; - if (!bIsWMF) - OutComment(rRTFWrt, OOO_STRING_SVTOOLS_RTF_SHPPICT); - - if (pBLIPType) - ExportPICT(aSize, aRendered, aMapped, rCr, pBLIPType, pGraphicAry, nSize, rRTFWrt); - else - { - aStream.Seek(0); - GraphicConverter::Export(aStream, aGraphic, CVT_WMF); - pBLIPType = OOO_STRING_SVTOOLS_RTF_WMETAFILE; - aStream.Seek(STREAM_SEEK_TO_END); - nSize = aStream.Tell(); - pGraphicAry = (sal_uInt8*)aStream.GetData(); - - ExportPICT(aSize, aRendered, aMapped, rCr, pBLIPType, pGraphicAry, nSize, - rRTFWrt); - } - - if (!bIsWMF) - { - rRTFWrt.Strm() << '}' << '{' << OOO_STRING_SVTOOLS_RTF_NONSHPPICT; - - aStream.Seek(0); - GraphicConverter::Export(aStream, aGraphic, CVT_WMF); - pBLIPType = OOO_STRING_SVTOOLS_RTF_WMETAFILE; - aStream.Seek(STREAM_SEEK_TO_END); - nSize = aStream.Tell(); - pGraphicAry = (sal_uInt8*)aStream.GetData(); - - ExportPICT(aSize, aRendered, aMapped, rCr, pBLIPType, pGraphicAry, nSize, - rRTFWrt); - - rRTFWrt.Strm() << '}'; - } - - - rRTFWrt.Strm() << SwRTFWriter::sNewLine; -#else - rRTFWrt.Strm() << "{{"; - - // damit die eigenen Grafik-Attribute nach der PICT / import Anweisung - // stehen, muessen die am Anfang ausgegeben werden. - rRTFWrt.bOutFmtAttr = false; - OutRTF_SwFmt( rRTFWrt, *pNd->GetFmtColl() ); - - if( rRTFWrt.bOutFmtAttr ) // wurde ueberhaupt ein Attrribut - rRTFWrt.Strm() << "}{"; // ausgegeben ?? - - String aGrfNm; - const SwMirrorGrf& rMirror = pNd->GetSwAttrSet().GetMirrorGrf(); - if( !pNd->IsLinkedFile() || RES_MIRROR_GRAPH_DONT != rMirror.GetValue() ) - { - USHORT nErr = 1; - // Grafik als File-Referenz speichern (als JPEG-Grafik speichern) - // but only if we save into a file and have a URL - if( rWrt.GetOrigFileName() ) - { - aGrfNm = *rWrt.GetOrigFileName(); - pNd->SwapIn( TRUE ); - ULONG nFlags = XOUTBMP_USE_NATIVE_IF_POSSIBLE; - switch( rMirror.GetValue() ) - { - case RES_MIRROR_GRAPH_VERT: nFlags = XOUTBMP_MIRROR_HORZ; break; - case RES_MIRROR_GRAPH_HOR: nFlags = XOUTBMP_MIRROR_VERT; break; - case RES_MIRROR_GRAPH_BOTH: - nFlags = XOUTBMP_MIRROR_VERT | XOUTBMP_MIRROR_HORZ; - break; - } - - Size aMM100Size; - Size* pMM100Size = 0; - if( rRTFWrt.pFlyFmt ) - { - const SwFmtFrmSize& rSize = rRTFWrt.pFlyFmt->GetFrmSize(); - aMM100Size = OutputDevice::LogicToLogic( rSize.GetSize(), - MapMode( MAP_TWIP ), MapMode( MAP_100TH_MM )); - pMM100Size = &aMM100Size; - } - - nErr = XOutBitmap::WriteGraphic( pNd->GetGrf(), aGrfNm, - String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "JPG" )), - nFlags, pMM100Size ); - } - if( nErr ) // fehlerhaft, da ist nichts auszugeben - { - rRTFWrt.Strm() << "}}"; - return rWrt; - } - } - else - pNd->GetFileFilterNms( &aGrfNm, 0 ); - - // MIB->JP: Warum erst AbsToRel und dann das URL-Objekt? So - // kommt bei relativierbaren URLs als Protokoll "unknown" raus. - // Ist das Absicht? - aGrfNm = INetURLObject::AbsToRel( aGrfNm, INetURLObject::WAS_ENCODED, - INetURLObject::DECODE_UNAMBIGUOUS); - INetURLObject aUrl( aGrfNm ); - if( aUrl.GetProtocol() == INET_PROT_FILE ) - aGrfNm = aUrl.PathToFileName(); - - // Bitmap als File-Referenz speichern - rRTFWrt.Strm() << OOO_STRING_SVTOOLS_RTF_FIELD << OOO_STRING_SVTOOLS_RTF_FLDPRIV; - OutComment( rRTFWrt, OOO_STRING_SVTOOLS_RTF_FLDINST ) << "{\\\\import "; - RTFOutFuncs::Out_String( rWrt.Strm(), aGrfNm, rRTFWrt.eDefaultEncoding, - rRTFWrt.bWriteHelpFmt ); - rRTFWrt.Strm() << "}}{" << OOO_STRING_SVTOOLS_RTF_FLDRSLT << " }}"; - rRTFWrt.Strm() << '}' << SwRTFWriter::sNewLine; -#endif - return rRTFWrt; -} - -static Writer& OutRTF_SwOLENode( Writer& rWrt, SwCntntNode & /*rNode*/ ) -{ - SwRTFWriter & rRTFWrt = (SwRTFWriter&)rWrt; - - // ist der aktuelle Absatz in einem freifliegenden Rahmen ? Dann - // muessen noch die Attribute dafuer ausgegeben werden. - if( rRTFWrt.pFlyFmt ) - OutRTF_SwFlyFrmFmt( rRTFWrt ); - - rWrt.Strm() << SwRTFWriter::sNewLine << OOO_STRING_SVTOOLS_RTF_PAR; - return rWrt; -} - -static void OutTBLBorderLine(SwRTFWriter& rWrt, const SvxBorderLine* pLine, - const sal_Char* pStr) -{ - ByteString sLineStr; - if( pLine->GetInWidth() ) - { - // doppelte Linie - sLineStr = OOO_STRING_SVTOOLS_RTF_BRDRDB; - switch( pLine->GetInWidth() ) - { - case DEF_LINE_WIDTH_0: - ( sLineStr += OOO_STRING_SVTOOLS_RTF_BRDRW ) += "15"; - break; - case DEF_LINE_WIDTH_1: - ( sLineStr += OOO_STRING_SVTOOLS_RTF_BRDRW ) += "30"; - break; - case DEF_LINE_WIDTH_2: - case DEF_LINE_WIDTH_3: - ( sLineStr += OOO_STRING_SVTOOLS_RTF_BRDRW ) += "45"; - break; - } - } - else - { - // einfache Linie - if( DEF_LINE_WIDTH_1 >= pLine->GetOutWidth() ) - (( sLineStr = OOO_STRING_SVTOOLS_RTF_BRDRS ) += OOO_STRING_SVTOOLS_RTF_BRDRW ) += - ByteString::CreateFromInt32( pLine->GetOutWidth() ); - else - (( sLineStr = OOO_STRING_SVTOOLS_RTF_BRDRTH ) += OOO_STRING_SVTOOLS_RTF_BRDRW ) += - ByteString::CreateFromInt32( pLine->GetOutWidth() / 2 ); - } - - rWrt.Strm() << pStr << sLineStr.GetBuffer() << OOO_STRING_SVTOOLS_RTF_BRDRCF; - rWrt.OutULong( rWrt.GetId( pLine->GetColor() ) ); -} - -static void OutBorderLine(SwRTFWriter& rWrt, const SvxBorderLine* pLine, - const sal_Char* pStr, USHORT nDist) -{ - OutTBLBorderLine(rWrt, pLine, pStr); - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_BRSP; - rWrt.OutULong( nDist ); -} - -static void OutSwTblBorder(SwRTFWriter& rWrt, const SvxBoxItem& rBox, - const SvxBoxItem *pDefault) -{ - static const USHORT aBorders[] = - { - BOX_LINE_TOP, BOX_LINE_LEFT, BOX_LINE_BOTTOM, BOX_LINE_RIGHT - }; -#ifdef __MINGW32__ - static const char* aBorderNames[] __attribute__((section(".data"))) = -#else - static const char* aBorderNames[] = -#endif - { - OOO_STRING_SVTOOLS_RTF_CLBRDRT, OOO_STRING_SVTOOLS_RTF_CLBRDRL, OOO_STRING_SVTOOLS_RTF_CLBRDRB, OOO_STRING_SVTOOLS_RTF_CLBRDRR - }; - //Yes left and top are swapped with eachother for cell padding! Because - //that's what the thunderingly annoying rtf export/import word xp does. -#ifdef __MINGW32__ - static const char* aCellPadNames[] __attribute__((section(".data"))) = -#else - static const char* aCellPadNames[] = -#endif - { - OOO_STRING_SVTOOLS_RTF_CLPADL, OOO_STRING_SVTOOLS_RTF_CLPADT, OOO_STRING_SVTOOLS_RTF_CLPADB, OOO_STRING_SVTOOLS_RTF_CLPADR - }; -#ifdef __MINGW32__ - static const char* aCellPadUnits[] __attribute__((section(".data"))) = -#else - static const char* aCellPadUnits[] = -#endif - { - OOO_STRING_SVTOOLS_RTF_CLPADFL, OOO_STRING_SVTOOLS_RTF_CLPADFT, OOO_STRING_SVTOOLS_RTF_CLPADFB, OOO_STRING_SVTOOLS_RTF_CLPADFR - }; - for (int i = 0; i < 4; ++i) - { - if (const SvxBorderLine* pLn = rBox.GetLine(aBorders[i])) - OutTBLBorderLine(rWrt, pLn, aBorderNames[i]); - if (!pDefault || pDefault->GetDistance(aBorders[i]) != - rBox.GetDistance(aBorders[i])) - { - rWrt.Strm() << aCellPadUnits[i]; - rWrt.OutULong(3); - rWrt.Strm() << aCellPadNames[i]; - rWrt.OutULong(rBox.GetDistance(aBorders[i])); - } - } -} - -static void OutSwTblBackground( SwRTFWriter& rWrt, const SvxBrushItem& rBack ) -{ - if( !rBack.GetColor().GetTransparency() ) - { - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_CLCBPAT; - rWrt.OutULong( rWrt.GetId( rBack.GetColor() ) ); - } -} - - -Writer& OutRTF_SwTblNode(Writer& rWrt, const SwTableNode & rNode) -{ - SwRTFWriter & rRTFWrt = (SwRTFWriter&)rWrt; - const SwTable& rTbl = rNode.GetTable(); - SwTwips nPageSize = 0, nTblOffset = 0; - const bool bNewTableModel = rTbl.IsNewModel(); - -/* -//!!!!!!!!!!!!! for clipboard create any view if the table is complex !!! - if( rTbl.IsTblComplex() ) - { - // then we have to create any layout - SFX_APP()->CreateViewFrame( *xDocSh, 0, TRUE ); - } -*/ - - const SwFrmFmt *pFmt = rTbl.GetFrmFmt(); - ASSERT(pFmt, "Impossible"); - { - Point aPt; - SwRect aRect( pFmt->FindLayoutRect( false, &aPt )); - if( aRect.IsEmpty() ) - { - // dann besorge mal die Seitenbreite ohne Raender !! - const SwFrmFmt* pFrmFmt = rRTFWrt.pFlyFmt ? rRTFWrt.pFlyFmt : - const_cast<const SwDoc *>(rWrt.pDoc) - ->GetPageDesc(0).GetPageFmtOfNode(rNode, false); - - aRect = pFrmFmt->FindLayoutRect( TRUE ); - if( 0 == ( nPageSize = aRect.Width() )) - { - const SvxLRSpaceItem& rLR = pFrmFmt->GetLRSpace(); - nPageSize = pFrmFmt->GetFrmSize().GetWidth() - - rLR.GetLeft() - rLR.GetRight(); - } - } - else - nPageSize = aRect.Width(); - } - - SwTwips nTblSz = pFmt->GetFrmSize().GetWidth(); - - ByteString aTblAdjust( OOO_STRING_SVTOOLS_RTF_TRQL ); - switch (pFmt->GetHoriOrient().GetHoriOrient()) - { - case text::HoriOrientation::CENTER: - aTblAdjust = OOO_STRING_SVTOOLS_RTF_TRQC; - break; - case text::HoriOrientation::RIGHT: - aTblAdjust = OOO_STRING_SVTOOLS_RTF_TRQR; - break; - case text::HoriOrientation::NONE: - case text::HoriOrientation::LEFT_AND_WIDTH: - { - const SvxLRSpaceItem& rLRSp = pFmt->GetLRSpace(); - nTblOffset = rLRSp.GetLeft(); - nPageSize -= (nTblOffset + rLRSp.GetRight()); - aTblAdjust += OOO_STRING_SVTOOLS_RTF_TRLEFT; - aTblAdjust += ByteString::CreateFromInt32( nTblOffset ); - } - break; - default: - break; - } - - if (rRTFWrt.TrueFrameDirection(*pFmt) == FRMDIR_HORI_RIGHT_TOP) - aTblAdjust += OOO_STRING_SVTOOLS_RTF_RTLROW; - - // ist die Tabelle wesentlich (PageSize + 10%) groesser als die Seite, - // dann sind die Box-Breiten relative Angaben. - BOOL bRelBoxSize = TRUE /*ALWAYS relativ (nPageSize + ( nPageSize / 10 )) < nTblSz*/; - - SwWriteTable* pTableWrt; - const SwHTMLTableLayout *pLayout = rTbl.GetHTMLTableLayout(); - if( pLayout && pLayout->IsExportable() ) - pTableWrt = new SwWriteTable( pLayout ); - else - pTableWrt = new SwWriteTable(rTbl.GetTabLines(), (USHORT)nPageSize, - (USHORT)nTblSz, false); - - // rCols are the array of all cols of the table - const SwWriteTableCols& rCols = pTableWrt->GetCols(); - USHORT nColCnt = rCols.Count(); - SwWriteTableCellPtr* pBoxArr = new SwWriteTableCellPtr[ nColCnt ]; - USHORT* pRowSpans = new USHORT[ nColCnt ]; - memset( pBoxArr, 0, sizeof( pBoxArr[0] ) * nColCnt ); - memset( pRowSpans, 0, sizeof( pRowSpans[0] ) * nColCnt ); - const SwWriteTableRows& rRows = pTableWrt->GetRows(); - for( USHORT nLine = 0; nLine < rRows.Count(); ++nLine ) - { - USHORT nBox; - - const SwWriteTableRow *pRow = rRows[ nLine ]; - const SwWriteTableCells& rCells = pRow->GetCells(); - - BOOL bFixRowHeight = false; - - USHORT nBoxes = rCells.Count(); - if (nColCnt < nBoxes) - nBoxes = nColCnt; - - for( nColCnt = 0, nBox = 0; nBox < rCells.Count() && nColCnt < nBoxes; ++nColCnt ) - { - SwWriteTableCell* pCell = rCells[ nBox ]; - const bool bProcessCoveredCell = bNewTableModel && 0 == pCell->GetRowSpan(); - - if( !pRowSpans[ nColCnt ] || bProcessCoveredCell ) - { - // set new BoxPtr - nBox++; - pBoxArr[ nColCnt ] = pCell; - if ( !bProcessCoveredCell ) - pRowSpans[ nColCnt ] = pCell->GetRowSpan(); - for( USHORT nCellSpan = pCell->GetColSpan(), nCS = 1; - nCS < nCellSpan; ++nCS, ++nColCnt ) - { - ASSERT( nColCnt+1 < rCols.Count(), "More colspan than columns" ); - if( nColCnt+1 < rCols.Count() ) // robust against wrong colspans - { - pBoxArr[ nColCnt+1 ] = pBoxArr[ nColCnt ]; - pRowSpans[ nColCnt+1 ] = pRowSpans[ nColCnt ]; - } - } - } - if( 1 != pRowSpans[ nColCnt ] && !bNewTableModel ) - bFixRowHeight = TRUE; - } - - for( ; nColCnt < rCols.Count() && pRowSpans[ nColCnt ]; ++nColCnt ) - bFixRowHeight = TRUE; - - nColCnt = rCols.Count(); // A wrong cellspan-value could cause a nColCnt > rCols.Count() - - // Start Tabellendefinition - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_TROWD << aTblAdjust.GetBuffer(); - - if( rTbl.GetRowsToRepeat() > nLine ) - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_TRHDR; - - const SwTableLine* pLine = pBoxArr[ 0 ]->GetBox()->GetUpper(); - // Zeilenhoehe ausgeben - long nHeight = 0; - if( bFixRowHeight && rWrt.pDoc->GetRootFrm() ) - { - nHeight = -pRow->GetPos(); //neg. => abs. height! - if( nLine ) - nHeight += rRows[ nLine - 1 ]->GetPos(); - } - else - { - const SwFmtFrmSize& rLSz = pLine->GetFrmFmt()->GetFrmSize(); - if( ATT_VAR_SIZE != rLSz.GetHeightSizeType() && rLSz.GetHeight() ) - nHeight = ATT_MIN_SIZE == rLSz.GetHeightSizeType() - ? rLSz.GetHeight() - : -rLSz.GetHeight(); - } - - //The rtf default is to allow a row to break, so if we are not - //splittable export TRKEEP - const SwFrmFmt *pLineFmt = pLine ? pLine->GetFrmFmt() : 0; - if (!pLineFmt || pLineFmt->GetRowSplit().GetValue() == 0) - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_TRKEEP; - - if( nHeight ) - { - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_TRRH; - rWrt.OutLong( nHeight ); - } - - const SvxBoxItem *pDefaultBox = 0; - if (nColCnt) - { - pDefaultBox = &(pBoxArr[0]->GetBox()->GetFrmFmt()->GetBox()); - - static const USHORT aBorders[] = - { - BOX_LINE_TOP, BOX_LINE_LEFT, BOX_LINE_BOTTOM, BOX_LINE_RIGHT - }; -#ifdef __MINGW32__ - static const char* aRowPadNames[] __attribute__((section(".data"))) = -#else - static const char* aRowPadNames[] = -#endif - { - OOO_STRING_SVTOOLS_RTF_TRPADDT, OOO_STRING_SVTOOLS_RTF_TRPADDL, OOO_STRING_SVTOOLS_RTF_TRPADDB, OOO_STRING_SVTOOLS_RTF_TRPADDR - }; - static const char* aRowPadUnits[] = - { - OOO_STRING_SVTOOLS_RTF_TRPADDFT, OOO_STRING_SVTOOLS_RTF_TRPADDFL, OOO_STRING_SVTOOLS_RTF_TRPADDFB, OOO_STRING_SVTOOLS_RTF_TRPADDFR - }; - for (int i = 0; i < 4; ++i) - { - rWrt.Strm() << aRowPadUnits[i]; - rWrt.OutULong(3); - rWrt.Strm() << aRowPadNames[i]; - rWrt.OutULong(pDefaultBox->GetDistance(aBorders[i])); - } - } - - // Breite der Boxen ausgeben - SwTwips nSz = 0, nCalc; - for( nBox = 0; nBox < nColCnt; ++nBox ) - { - SwWriteTableCell* pCell = pBoxArr[ nBox ]; - if( (nBox && pBoxArr[ nBox-1 ] == pBoxArr[ nBox ]) || (pCell == NULL) ) - continue; - - const SwFrmFmt& rFmt = *pCell->GetBox()->GetFrmFmt(); - if( 1 < pCell->GetRowSpan() || 0 == pCell->GetRowSpan() ) - rWrt.Strm() << ( pCell->GetRowSpan() == pRowSpans[ nBox ] - ? OOO_STRING_SVTOOLS_RTF_CLVMGF - : OOO_STRING_SVTOOLS_RTF_CLVMRG ); - - const SfxPoolItem* pItem; - if (SFX_ITEM_SET == rFmt.GetAttrSet().GetItemState(RES_BOX, TRUE, - &pItem)) - { - OutSwTblBorder(rRTFWrt, (SvxBoxItem&)*pItem, pDefaultBox); - } - -// RTF kennt Schattierung in unserem Sinne nicht! -// if( SFX_ITEM_SET == pBoxFmt->GetAttrSet().GetItemState( -// RES_SHADOW, TRUE, &pItem ) ) -// OutSwTblShadow( rRTFWrt, *pItem ); - - if( SFX_ITEM_SET == rFmt.GetAttrSet().GetItemState( - RES_BACKGROUND, TRUE, &pItem ) - || 0 != ( pItem = pCell->GetBackground() ) - || 0 != ( pItem = pRow->GetBackground() ) ) - OutSwTblBackground( rRTFWrt, (SvxBrushItem&)*pItem ); - - if( SFX_ITEM_SET == rFmt.GetAttrSet().GetItemState( - RES_VERT_ORIENT, TRUE, &pItem ) ) - switch( ((SwFmtVertOrient*)pItem)->GetVertOrient() ) - { - case text::VertOrientation::CENTER: rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_CLVERTALC; break; - case text::VertOrientation::BOTTOM: rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_CLVERTALB; break; - default: rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_CLVERTALT; break; - } - - const SwFmtFrmSize& rLSz = rFmt.GetFrmSize(); - nSz += rLSz.GetWidth(); - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_CELLX; - - nCalc = nSz; - if( bRelBoxSize ) - { - nCalc *= nPageSize; - nCalc /= nTblSz; - } - rWrt.OutLong( nTblOffset + nCalc ); - } - - // Inhalt der Boxen ausgeben - rWrt.Strm() << SwRTFWriter::sNewLine << OOO_STRING_SVTOOLS_RTF_PARD << OOO_STRING_SVTOOLS_RTF_INTBL; - for( nBox = 0; nBox < nBoxes; ++nBox ) - { - SwWriteTableCell * pCell = pBoxArr[nBox]; - - if( (nBox && pBoxArr[ nBox-1 ] == pBoxArr[ nBox ]) || pCell == NULL) - continue; - - if( pCell->GetRowSpan() == pRowSpans[ nBox ] ) - { - // new Box - const SwStartNode* pSttNd = pCell->GetBox()->GetSttNd(); - RTFSaveData aSaveData( rRTFWrt, - pSttNd->GetIndex()+1, pSttNd->EndOfSectionIndex() ); - rRTFWrt.bOutTable = TRUE; - rRTFWrt.Out_SwDoc( rRTFWrt.pCurPam ); - } - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_CELL; - } - - // das wars mit der Line - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_ROW << OOO_STRING_SVTOOLS_RTF_PARD << ' '; - - for( nBox = 0; nBox < nColCnt; ++nBox ) - --pRowSpans[ nBox ]; - } - - delete pTableWrt; - delete[] pBoxArr; - delete[] pRowSpans; - - // Pam hinter die Tabelle verschieben - rRTFWrt.pCurPam->GetPoint()->nNode = *rNode.EndOfSectionNode(); - rRTFWrt.SetAttrSet( 0 ); - - return rWrt; -} - -Writer& OutRTF_SwSectionNode( Writer& rWrt, SwSectionNode& rNode ) -{ - SwRTFWriter & rRTFWrt = (SwRTFWriter&)rWrt; - const SwSection& rSect = rNode.GetSection(); - - // folgt dahinter noch ein SectionNode? Dann wird erst die innere - // Section aktiv. Hier wird die Verschachtelung aufgebrochen, weil - // RTF das nicht kennt - BOOL bPgDscWrite = false; - { - SwNodeIndex aIdx( rNode, 1 ); - const SwNode& rNd = aIdx.GetNode(); - if( rNd.IsSectionNode() /*&& CONTENT_SECTION == - aIdx.GetNode().GetSectionNode()->GetSection().GetType()*/ ) - return rWrt; - - // falls als erstes Position ein Content- oder Tabellen-Node steht, - // dann kann dieser einen PageDesc gesetzt haben und der muss vor - // der Bereichsbeschreibung geschrieben werden! - // Umgekehrt muss im OutBreaks dann - if( rNd.IsCntntNode() ) - { - bPgDscWrite = rRTFWrt.OutBreaks( ((SwCntntNode&)rNd).GetSwAttrSet() ); - rRTFWrt.bIgnoreNextPgBreak = TRUE; - } - else if( rNd.IsTableNode() ) - { - bPgDscWrite = rRTFWrt.OutBreaks( ((SwTableNode&)rNd).GetTable(). - GetFrmFmt()->GetAttrSet() ); - rRTFWrt.bIgnoreNextPgBreak = TRUE; - } - } - - -// if( CONTENT_SECTION == rSect.GetType() ) - { - // als fortlaufenden Abschnittwechsel heraus schreiben - if( !bPgDscWrite ) - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_SECT << OOO_STRING_SVTOOLS_RTF_SBKNONE; - //JP 19.03.99 - es muss fuer den Import auf jedenfall das Cols - // Token geschrieben werden. Sonst kann nicht erkannt - // werden, wann ein PageDesc & eine Section gueltig ist - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_COLS << '1'; - rRTFWrt.bOutFmtAttr = TRUE; - const SfxPoolItem* pItem; - const SwFrmFmt *pFmt = rSect.GetFmt(); - ASSERT(pFmt, "Impossible"); - const SfxItemSet& rSet = pFmt->GetAttrSet(); - if( SFX_ITEM_SET == rSet.GetItemState( RES_COL, false, &pItem )) - OutRTF_SwFmtCol( rWrt, *pItem ); - else - { - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_COLS << '1' << OOO_STRING_SVTOOLS_RTF_COLSX; - rWrt.OutULong(709); - } - - if( SFX_ITEM_SET == rSet.GetItemState( RES_COLUMNBALANCE, - false, &pItem ) && ((SwFmtNoBalancedColumns*)pItem)->GetValue() ) - OutComment( rWrt, OOO_STRING_SVTOOLS_RTF_BALANCEDCOLUMN ) << '}'; - - if (FRMDIR_HORI_RIGHT_TOP == rRTFWrt.TrueFrameDirection(*pFmt)) - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_RTLSECT; - else - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_LTRSECT; - - rWrt.Strm() << SwRTFWriter::sNewLine; - } - - return rWrt; -} - - -/* File CHRATR.HXX: */ - -static Writer& OutRTF_SwFont( Writer& rWrt, const SfxPoolItem& rHt ) -{ - /* trage den Font in die Font-Liste vom Writer ein und gebe hier nur - * die entsprechende Nummer aus. Der Font wird spaeter ueber diese - * Tabelle im RTF-Dokument referenziert. - */ - SwRTFWriter& rRTFWrt = (SwRTFWriter&)rWrt; - - if( !rRTFWrt.bTxtAttr || - ( rRTFWrt.GetEndPosLst() && - rRTFWrt.GetEndPosLst()->MatchScriptToId( rHt.Which() ) )) - { - rRTFWrt.bOutFmtAttr = true; - const SvxFontItem&rFont = (const SvxFontItem&)rHt; - bool bAssoc = rRTFWrt.IsAssociatedFlag(); - /* - #109522# - Word is a bit of a silly bugger of a program when its comes to symbol - font useage. If a symbol font is actually being used, i.e. exported - here with bTxtAttr true then both AF and F must be set to the same - value - */ - if (rRTFWrt.bTxtAttr && (rFont.GetCharSet() == RTL_TEXTENCODING_SYMBOL)) - { - const sal_Char* pCmd = !bAssoc ? OOO_STRING_SVTOOLS_RTF_AF : OOO_STRING_SVTOOLS_RTF_F; - rWrt.Strm() << pCmd; - } - const sal_Char* pCmd = bAssoc ? OOO_STRING_SVTOOLS_RTF_AF : OOO_STRING_SVTOOLS_RTF_F; - rWrt.Strm() << pCmd; - rWrt.OutULong(rRTFWrt.GetId(rFont)); - rRTFWrt.eCurrentEncoding = rtl_getTextEncodingFromWindowsCharset(sw::ms::rtl_TextEncodingToWinCharset(rFont.GetCharSet())); - } - return rWrt; -} - -static Writer& OutRTF_SwPosture( Writer& rWrt, const SfxPoolItem& rHt ) -{ - SwRTFWriter& rRTFWrt = (SwRTFWriter&)rWrt; - - if( !rRTFWrt.bTxtAttr || - ( rRTFWrt.GetEndPosLst() && - rRTFWrt.GetEndPosLst()->MatchScriptToId( rHt.Which() ) )) - { - if (rRTFWrt.IsAssociatedFlag() && rHt.Which() == RES_CHRATR_CJK_POSTURE) - { - /* - #i21422# - Sadly in word rtf we can't retain CJK italic when we are not - exporting asian text as it doesn't have a seperate italic for - western and asian. - */ - return rWrt; - } - - const FontItalic nPosture = ((const SvxPostureItem&)rHt).GetPosture(); - int bTxtOut = rRTFWrt.bTxtAttr && ITALIC_NONE == nPosture; - if( ITALIC_NORMAL == nPosture || bTxtOut ) - { - rRTFWrt.bOutFmtAttr = TRUE; - const sal_Char* pCmd = rRTFWrt.IsAssociatedFlag() ? OOO_STRING_SVTOOLS_RTF_AI : OOO_STRING_SVTOOLS_RTF_I; - rWrt.Strm() << pCmd; - } - if( bTxtOut ) - rWrt.Strm() << '0'; // wieder abschalten - } - return rWrt; -} - - -static Writer& OutRTF_SwWeight( Writer& rWrt, const SfxPoolItem& rHt ) -{ - SwRTFWriter& rRTFWrt = (SwRTFWriter&)rWrt; - if( !rRTFWrt.bTxtAttr || - ( rRTFWrt.GetEndPosLst() && - rRTFWrt.GetEndPosLst()->MatchScriptToId( rHt.Which() ) )) - { - if (rRTFWrt.IsAssociatedFlag() && rHt.Which() == RES_CHRATR_CJK_WEIGHT) - { - /* - #i21422# - Sadly in word rtf we can't retain CJK bold when we are not - exporting asian text as it doesn't have a seperate bold for western - and asian. - */ - return rWrt; - } - - const FontWeight nBold = ((const SvxWeightItem&)rHt).GetWeight(); - int bTxtOut = rRTFWrt.bTxtAttr && WEIGHT_NORMAL == nBold; - if( WEIGHT_BOLD == nBold || bTxtOut ) - { - rRTFWrt.bOutFmtAttr = TRUE; - const sal_Char* pCmd = rRTFWrt.IsAssociatedFlag() ? OOO_STRING_SVTOOLS_RTF_AB : OOO_STRING_SVTOOLS_RTF_B; - rWrt.Strm() << pCmd; - } - if( bTxtOut ) - rWrt.Strm() << '0'; - } - return rWrt; -} - -static Writer& OutRTF_SwEmphasisMark( Writer& rWrt, const SfxPoolItem& rHt ) -{ - SwRTFWriter& rRTFWrt = (SwRTFWriter&)rWrt; - const sal_Char* pStr; - switch( ((const SvxEmphasisMarkItem&)rHt).GetEmphasisMark()) - { - case EMPHASISMARK_NONE: pStr = OOO_STRING_SVTOOLS_RTF_ACCNONE; break; - case EMPHASISMARK_SIDE_DOTS: pStr = OOO_STRING_SVTOOLS_RTF_ACCCOMMA; break; - default: pStr = OOO_STRING_SVTOOLS_RTF_ACCDOT; break; - } - - rRTFWrt.bOutFmtAttr = TRUE; - rWrt.Strm() << pStr; - return rWrt; -} - -static Writer& OutRTF_SwTwoInOne( Writer& rWrt, const SfxPoolItem& rHt ) -{ - if( ((SvxTwoLinesItem&)rHt).GetValue() ) - { - SwRTFWriter& rRTFWrt = (SwRTFWriter&)rWrt; - - sal_Unicode cStart = ((SvxTwoLinesItem&)rHt).GetStartBracket(); - sal_Unicode cEnd = ((SvxTwoLinesItem&)rHt).GetStartBracket(); - - USHORT nType; - if( !cStart && !cEnd ) - nType = 0; - else if( '{' == cStart || '}' == cEnd ) - nType = 4; - else if( '<' == cStart || '>' == cEnd ) - nType = 3; - else if( '[' == cStart || ']' == cEnd ) - nType = 2; - else // all other kind of brackets - nType = 1; - - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_TWOINONE; - rWrt.OutULong( nType ); - rRTFWrt.bOutFmtAttr = TRUE; - } - return rWrt; -} - -static Writer& OutRTF_SwCharRotate( Writer& rWrt, const SfxPoolItem& rHt ) -{ - SwRTFWriter& rRTFWrt = (SwRTFWriter&)rWrt; - rRTFWrt.bOutFmtAttr = TRUE; - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_HORZVERT; - rWrt.OutLong( ((SvxCharRotateItem&)rHt).IsFitToLine() ? 1 : 0 ); - return rWrt; -} -static Writer& OutRTF_SwCharScaleW( Writer& rWrt, const SfxPoolItem& rHt ) -{ - SwRTFWriter& rRTFWrt = (SwRTFWriter&)rWrt; - rRTFWrt.bOutFmtAttr = TRUE; - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_CHARSCALEX; - rWrt.OutLong( ((SvxCharScaleWidthItem&)rHt).GetValue() ); - return rWrt; -} - -static Writer& OutRTF_SwCharRelief(Writer& rWrt, const SfxPoolItem& rHt) -{ - SwRTFWriter& rRTFWrt = (SwRTFWriter&)rWrt; - const SvxCharReliefItem& rAttr = (const SvxCharReliefItem&)rHt; - const sal_Char* pStr; - switch (rAttr.GetValue()) - { - case RELIEF_EMBOSSED: - pStr = OOO_STRING_SVTOOLS_RTF_EMBO; - break; - case RELIEF_ENGRAVED: - pStr = OOO_STRING_SVTOOLS_RTF_IMPR; - break; - default: - pStr = 0; - break; - } - - if (pStr) - { - rRTFWrt.bOutFmtAttr = TRUE; - rWrt.Strm() << pStr; - } - return rWrt; -} - - -static Writer& OutRTF_SwChrBckgrnd( Writer& rWrt, const SfxPoolItem& rHt ) -{ - SwRTFWriter& rRTFWrt = (SwRTFWriter&)rWrt; - const SvxBrushItem& rBack = (const SvxBrushItem&)rHt; - if( !rBack.GetColor().GetTransparency() ) - { - ByteString sOut( OOO_STRING_SVTOOLS_RTF_CHCBPAT ); - sOut += ByteString::CreateFromInt32( - rRTFWrt.GetId( rBack.GetColor() )); - - rRTFWrt.bOutFmtAttr = TRUE; - rWrt.Strm() << sOut.GetBuffer(); - } - return rWrt; -} - -static Writer& OutRTF_SwShadowed( Writer& rWrt, const SfxPoolItem& rHt ) -{ - SwRTFWriter& rRTFWrt = (SwRTFWriter&)rWrt; - const BOOL bShadow = ((const SvxShadowedItem&)rHt).GetValue(); - int bTxtOut = rRTFWrt.bTxtAttr && !bShadow; - if( bShadow || bTxtOut ) - { - rRTFWrt.bOutFmtAttr = TRUE; - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_SHAD; - } - if( bTxtOut ) - rWrt.Strm() << '0'; - return rWrt; -} - - - -static Writer& OutRTF_SwContour( Writer& rWrt, const SfxPoolItem& rHt ) -{ - SwRTFWriter& rRTFWrt = (SwRTFWriter&)rWrt; - const BOOL bContour = ((const SvxContourItem&)rHt).GetValue(); - int bTxtOut = rRTFWrt.bTxtAttr && !bContour; - if( bContour || bTxtOut ) - { - rRTFWrt.bOutFmtAttr = TRUE; - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_OUTL; - } - if( bTxtOut ) - rWrt.Strm() << '0'; - return rWrt; -} - -static Writer& OutRTF_SwCrossedOut( Writer& rWrt, const SfxPoolItem& rHt ) -{ - SwRTFWriter& rRTFWrt = (SwRTFWriter&)rWrt; - const FontStrikeout nStrike = ((const SvxCrossedOutItem&)rHt).GetStrikeout(); - int bTxtOut = rRTFWrt.bTxtAttr && STRIKEOUT_NONE == nStrike; - - if( (STRIKEOUT_NONE != nStrike && STRIKEOUT_DONTKNOW != nStrike) || bTxtOut ) - { - rRTFWrt.bOutFmtAttr = TRUE; - if( STRIKEOUT_DOUBLE == nStrike ) - { - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_STRIKED; - if( !bTxtOut ) - rWrt.Strm() << '1'; - } - else - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_STRIKE; - } - if( bTxtOut ) - rWrt.Strm() << '0'; - return rWrt; -} - - - -static Writer& OutRTF_SwCaseMap( Writer& rWrt, const SfxPoolItem& rHt ) -{ - SwRTFWriter& rRTFWrt = (SwRTFWriter&)rWrt; - switch( ((const SvxCaseMapItem&)rHt).GetValue() ) - { - case SVX_CASEMAP_KAPITAELCHEN: - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_SCAPS; - break; - - case SVX_CASEMAP_VERSALIEN: - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_CAPS; - break; - - case SVX_CASEMAP_NOT_MAPPED: - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_CAPS << '0' << OOO_STRING_SVTOOLS_RTF_SCAPS << '0'; // beide aus !! - break; - - default: - return rWrt; - } - - rRTFWrt.bOutFmtAttr = TRUE; - return rWrt; -} - - -static Writer& OutRTF_SwUnderline( Writer& rWrt, const SfxPoolItem& rHt ) -{ - const char* pStr = 0; - switch( ((const SvxUnderlineItem&)rHt).GetLineStyle() ) - { - case UNDERLINE_SINGLE: - pStr = OOO_STRING_SVTOOLS_RTF_UL; - break; - case UNDERLINE_DOUBLE: - pStr = OOO_STRING_SVTOOLS_RTF_ULDB; - break; - case UNDERLINE_NONE: - pStr = OOO_STRING_SVTOOLS_RTF_ULNONE; - break; - case UNDERLINE_DOTTED: - pStr = OOO_STRING_SVTOOLS_RTF_ULD; - break; - case UNDERLINE_DASH: - pStr = OOO_STRING_SVTOOLS_RTF_ULDASH; - break; - case UNDERLINE_DASHDOT: - pStr = OOO_STRING_SVTOOLS_RTF_ULDASHD; - break; - case UNDERLINE_DASHDOTDOT: - pStr = OOO_STRING_SVTOOLS_RTF_ULDASHDD; - break; - case UNDERLINE_BOLD: - pStr = OOO_STRING_SVTOOLS_RTF_ULTH; - break; - case UNDERLINE_WAVE: - pStr = OOO_STRING_SVTOOLS_RTF_ULWAVE; - break; - case UNDERLINE_BOLDDOTTED: - pStr = OOO_STRING_SVTOOLS_RTF_ULTHD; - break; - case UNDERLINE_BOLDDASH: - pStr = OOO_STRING_SVTOOLS_RTF_ULTHDASH; - break; - case UNDERLINE_LONGDASH: - pStr = OOO_STRING_SVTOOLS_RTF_ULLDASH; - break; - case UNDERLINE_BOLDLONGDASH: - pStr = OOO_STRING_SVTOOLS_RTF_ULTHLDASH; - break; - case UNDERLINE_BOLDDASHDOT: - pStr = OOO_STRING_SVTOOLS_RTF_ULTHDASHD; - break; - case UNDERLINE_BOLDDASHDOTDOT: - pStr = OOO_STRING_SVTOOLS_RTF_ULTHDASHDD; - break; - case UNDERLINE_BOLDWAVE: - pStr = OOO_STRING_SVTOOLS_RTF_ULHWAVE; - break; - case UNDERLINE_DOUBLEWAVE: - pStr = OOO_STRING_SVTOOLS_RTF_ULULDBWAVE; - break; - default: - break; - } - - if( pStr ) - { - SwRTFWriter& rRTFWrt = (SwRTFWriter&)rWrt; - - if( UNDERLINE_SINGLE == ((const SvxUnderlineItem&)rHt).GetLineStyle() - && ((SvxWordLineModeItem&)rRTFWrt.GetItem( - RES_CHRATR_WORDLINEMODE )).GetValue() ) - pStr = OOO_STRING_SVTOOLS_RTF_ULW; - - rRTFWrt.Strm() << pStr; - rRTFWrt.bOutFmtAttr = TRUE; - - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_ULC; - rWrt.OutULong( rRTFWrt.GetId(((const SvxUnderlineItem&)rHt).GetColor()) ); - - } - - return rWrt; -} - - - -static Writer& OutRTF_SwOverline( Writer& rWrt, const SfxPoolItem& rHt ) -{ - const char* pStr = 0; - switch( ((const SvxOverlineItem&)rHt).GetLineStyle() ) - { - case UNDERLINE_SINGLE: - pStr = OOO_STRING_SVTOOLS_RTF_OL; - break; - case UNDERLINE_DOUBLE: - pStr = OOO_STRING_SVTOOLS_RTF_OLDB; - break; - case UNDERLINE_NONE: - pStr = OOO_STRING_SVTOOLS_RTF_OLNONE; - break; - case UNDERLINE_DOTTED: - pStr = OOO_STRING_SVTOOLS_RTF_OLD; - break; - case UNDERLINE_DASH: - pStr = OOO_STRING_SVTOOLS_RTF_OLDASH; - break; - case UNDERLINE_DASHDOT: - pStr = OOO_STRING_SVTOOLS_RTF_OLDASHD; - break; - case UNDERLINE_DASHDOTDOT: - pStr = OOO_STRING_SVTOOLS_RTF_OLDASHDD; - break; - case UNDERLINE_BOLD: - pStr = OOO_STRING_SVTOOLS_RTF_OLTH; - break; - case UNDERLINE_WAVE: - pStr = OOO_STRING_SVTOOLS_RTF_OLWAVE; - break; - case UNDERLINE_BOLDDOTTED: - pStr = OOO_STRING_SVTOOLS_RTF_OLTHD; - break; - case UNDERLINE_BOLDDASH: - pStr = OOO_STRING_SVTOOLS_RTF_OLTHDASH; - break; - case UNDERLINE_LONGDASH: - pStr = OOO_STRING_SVTOOLS_RTF_OLLDASH; - break; - case UNDERLINE_BOLDLONGDASH: - pStr = OOO_STRING_SVTOOLS_RTF_OLTHLDASH; - break; - case UNDERLINE_BOLDDASHDOT: - pStr = OOO_STRING_SVTOOLS_RTF_OLTHDASHD; - break; - case UNDERLINE_BOLDDASHDOTDOT: - pStr = OOO_STRING_SVTOOLS_RTF_OLTHDASHDD; - break; - case UNDERLINE_BOLDWAVE: - pStr = OOO_STRING_SVTOOLS_RTF_OLHWAVE; - break; - case UNDERLINE_DOUBLEWAVE: - pStr = OOO_STRING_SVTOOLS_RTF_OLOLDBWAVE; - break; - default: - break; - } - - if( pStr ) - { - SwRTFWriter& rRTFWrt = (SwRTFWriter&)rWrt; - if ( rRTFWrt.bNonStandard ) - { - if( UNDERLINE_SINGLE == ((const SvxOverlineItem&)rHt).GetLineStyle() - && ((SvxWordLineModeItem&)rRTFWrt.GetItem( - RES_CHRATR_WORDLINEMODE )).GetValue() ) - pStr = OOO_STRING_SVTOOLS_RTF_OLW; - - rRTFWrt.Strm() << pStr; - rRTFWrt.bOutFmtAttr = TRUE; - - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_OLC; - rWrt.OutULong( rRTFWrt.GetId(((const SvxOverlineItem&)rHt).GetColor()) ); - } - - } - - return rWrt; -} - - - -static Writer& OutRTF_SwLanguage( Writer& rWrt, const SfxPoolItem& rHt ) -{ - SwRTFWriter& rRTFWrt = (SwRTFWriter&)rWrt; - if( !rRTFWrt.bTxtAttr || - ( rRTFWrt.GetEndPosLst() && - rRTFWrt.GetEndPosLst()->MatchScriptToId( rHt.Which() ) )) - { - - rRTFWrt.bOutFmtAttr = TRUE; - const sal_Char* p = RES_CHRATR_CJK_LANGUAGE == rHt.Which() - ? OOO_STRING_SVTOOLS_RTF_LANGFE : OOO_STRING_SVTOOLS_RTF_LANG; - rWrt.Strm() << p; - rWrt.OutULong( ((const SvxLanguageItem&)rHt).GetLanguage() ); - } - return rWrt; -} - - - -static Writer& OutRTF_SwEscapement( Writer& rWrt, const SfxPoolItem& rHt ) -{ - SwRTFWriter& rRTFWrt = (SwRTFWriter&)rWrt; - const SvxEscapementItem& rEsc = (const SvxEscapementItem&)rHt; - const char * pUpDn; - - SwTwips nH = ((SvxFontHeightItem&)rRTFWrt.GetItem( - RES_CHRATR_FONTSIZE )).GetHeight(); - - if( 0 < rEsc.GetEsc() ) - pUpDn = OOO_STRING_SVTOOLS_RTF_UP; - else if( 0 > rEsc.GetEsc() ) - { - pUpDn = OOO_STRING_SVTOOLS_RTF_DN; - nH = -nH; // den negativen Wert herrausrechnen - } - else - return rWrt; - - // prozentuale Veraenderung speichern ! - short nEsc = rEsc.GetEsc(); - short nProp = rEsc.GetProp() * 100; - if( DFLT_ESC_AUTO_SUPER == nEsc ) - { - nEsc = 100 - rEsc.GetProp(); - ++nProp; - } - else if( DFLT_ESC_AUTO_SUB == nEsc ) - { - nEsc = - 100 + rEsc.GetProp(); - ++nProp; - } - - OutComment( rWrt, OOO_STRING_SVTOOLS_RTF_UPDNPROP, TRUE ); - rWrt.OutULong( nProp ) << '}' << pUpDn; - - /* - * berechne aus der akt. FontSize und dem ProzentWert die Verschiebung, - * wobei im RTF File 1/2 Points stehen muessen, waehrend intern - * mit Twips gerechnet wird. - * Formel : (FontSize * 1/20 ) pts x * 2 - * ----------------------- = ------------ - * 100% Escapement - */ - - rWrt.OutULong( ( (long( nEsc ) * nH) + 500L ) / 1000L ); - // 500L zum Aufrunden !! - return rWrt; -} - - - -static Writer& OutRTF_SwSize( Writer& rWrt, const SfxPoolItem& rHt ) -{ - SwRTFWriter& rRTFWrt = (SwRTFWriter&)rWrt; - if( !rRTFWrt.bTxtAttr || - ( rRTFWrt.GetEndPosLst() && - rRTFWrt.GetEndPosLst()->MatchScriptToId( rHt.Which() ) )) - { - if ( - rRTFWrt.IsAssociatedFlag() && - rHt.Which() == RES_CHRATR_CJK_FONTSIZE - ) - { - /* - #i21422# - Sadly in word rtf we can't retain CJK fontsize when we are not - exporting asian text as it doesn't have a seperate fontsize for - western and asian. - */ - return rWrt; - } - - rRTFWrt.bOutFmtAttr = TRUE; - - const sal_Char* pCmd = rRTFWrt.IsAssociatedFlag() ? OOO_STRING_SVTOOLS_RTF_AFS : OOO_STRING_SVTOOLS_RTF_FS; - rWrt.Strm() << pCmd; - rWrt.OutULong( ((const SvxFontHeightItem&)rHt).GetHeight() / 10 ); - } - return rWrt; -} - - - -static Writer& OutRTF_SwColor( Writer& rWrt, const SfxPoolItem& rHt ) -{ - SwRTFWriter& rRTFWrt = (SwRTFWriter&)rWrt; - /* trage die Color in die Color-Liste vom Writer ein und gebe hier nur - * die entsprechende Nummer aus. Die Color wird spaeter ueber diese - * Tabelle im RTF-Dokument referenziert. - */ - rRTFWrt.bOutFmtAttr = TRUE; - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_CF; - rWrt.OutULong( rRTFWrt.GetId( ((const SvxColorItem&)rHt).GetValue() )); - return rWrt; -} - -static Writer& OutRTF_SvxCharHiddenItem(Writer& rWrt, const SfxPoolItem& rHt) -{ - SwRTFWriter& rRTFWrt = (SwRTFWriter&)rWrt; - rRTFWrt.bOutFmtAttr = true; - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_V; - if (!((const SvxCharHiddenItem&)rHt).GetValue()) - rWrt.OutULong(0); - return rWrt; -} - -extern void sw3io_ConvertToOldField( const SwField* pFld, USHORT& rWhich, - ULONG& rFmt, ULONG nFFVersion ); - -static Writer& OutRTF_SwField( Writer& rWrt, const SfxPoolItem& rHt ) -{ - SwFmtFld & rFld = (SwFmtFld&)rHt; - SwRTFWriter& rRTFWrt = (SwRTFWriter&)rWrt; - - const SwField* pFld = rFld.GetFld(); - - ByteString aFldStt( '{' ); - ((((aFldStt += OOO_STRING_SVTOOLS_RTF_FIELD) += '{' ) += OOO_STRING_SVTOOLS_RTF_IGNORE) += OOO_STRING_SVTOOLS_RTF_FLDINST) += ' '; - switch( pFld->GetTyp()->Which() ) - { - case RES_COMBINED_CHARS: - { - /* - We need a font size to fill in the defaults, if these are overridden - (as they generally are) by character properties then those properties - win. - - The fontsize that is used in MS for determing the defaults is always - the CJK fontsize even if the text is not in that language, in OOo the - largest fontsize used in the field is the one we should take, but - whatever we do, word will actually render using the fontsize set for - CJK text. Nevertheless we attempt to guess whether the script is in - asian or western text based up on the first character and use the - font size of that script as our default. - */ - const String& rFldPar1 = pFld->GetPar1(); - USHORT nScript; - if( pBreakIt->GetBreakIter().is() ) - nScript = pBreakIt->GetBreakIter()->getScriptType( rFldPar1, 0); - else - nScript = i18n::ScriptType::ASIAN; - - long nHeight = ((SvxFontHeightItem&)rRTFWrt.GetItem( - GetWhichOfScript(RES_CHRATR_FONTSIZE, nScript ))).GetHeight(); - nHeight = (nHeight + 10) / 20; //Font Size in points; - - /* - Divide the combined char string into its up and down part. Get the - font size and fill in the defaults as up == half the font size and - down == a fifth the font size - */ - xub_StrLen nAbove = (rFldPar1.Len()+1)/2; - rWrt.Strm() << aFldStt.GetBuffer() << "EQ \\\\o (\\\\s\\\\up "; - rWrt.OutLong( nHeight/2 ) << '('; - RTFOutFuncs::Out_String( rWrt.Strm(), rFldPar1.Copy(0,nAbove), - rRTFWrt.eDefaultEncoding, rRTFWrt.bWriteHelpFmt ); - rWrt.Strm() << "), \\\\s\\\\do "; - rWrt.OutLong( nHeight/5 ) << '('; - RTFOutFuncs::Out_String( rWrt.Strm(), rFldPar1.Copy( nAbove ), - rRTFWrt.eDefaultEncoding, rRTFWrt.bWriteHelpFmt ) - << "))"; - } - break; - - case RES_DBFLD: - aFldStt += "MERGEFIELD "; - // kein break !! - case RES_USERFLD: - rWrt.Strm() << aFldStt.GetBuffer(); - RTFOutFuncs::Out_String( rWrt.Strm(), pFld->GetTyp()->GetName(), - rRTFWrt.eDefaultEncoding, rRTFWrt.bWriteHelpFmt ); - break; - case RES_GETREFFLD: - { - BYTE nFldTyp = 0; - rWrt.Strm() << aFldStt.GetBuffer() << " REF "; - const SwGetRefField& rRFld = *(SwGetRefField*)pFld; - switch( pFld->GetSubType() ) - { - case REF_SETREFATTR: - case REF_BOOKMARK: - RTFOutFuncs::Out_String( rWrt.Strm(), rRFld.GetSetRefName(), - rRTFWrt.eDefaultEncoding, rRTFWrt.bWriteHelpFmt ); - nFldTyp = 3; - break; - } - - if( nFldTyp ) - { - switch( pFld->GetFormat() ) - { - case REF_PAGE_PGDESC: - case REF_PAGE: - rWrt.Strm() << "SEITEN"; - nFldTyp = 37; - break; - case REF_UPDOWN: - rWrt.Strm() << " \\p"; - nFldTyp = 3; - break; - case REF_CHAPTER: - rWrt.Strm() << " \\n"; - break; - case REF_ONLYNUMBER: - case REF_ONLYCAPTION: - case REF_ONLYSEQNO: - break; - // default: - // case REF_CONTENT: - } - rWrt.Strm() << " \\\\h "; // insert hyperlink - } - } - break; -// case RES_CHAPTERFLD: -// rWrt.Strm() << ' '; -// break; - case RES_PAGENUMBERFLD: - rWrt.Strm() << aFldStt.GetBuffer() << "\\\\page"; - { - char __READONLY_DATA - sNType0[] = "ALPHABETIC", /* CHARS_UPPER_LETTER*/ - sNType1[] = "alphabetic", /* CHARS_LOWER_LETTER*/ - sNType2[] = "ROMAN", /* ROMAN_UPPER */ - sNType3[] = "roman", /* ROMAN_LOWER */ - sNType4[] = "ARABIC"; /* ARABIC */ - - const char* pFmtStr = 0; - switch( pFld->GetFormat() ) - { - case SVX_NUM_CHARS_UPPER_LETTER: - case SVX_NUM_CHARS_UPPER_LETTER_N: pFmtStr = sNType0; break; - case SVX_NUM_CHARS_LOWER_LETTER: - case SVX_NUM_CHARS_LOWER_LETTER_N: pFmtStr = sNType1; break; - case SVX_NUM_ROMAN_UPPER: pFmtStr = sNType2; break; - case SVX_NUM_ROMAN_LOWER: pFmtStr = sNType3; break; - case SVX_NUM_ARABIC: pFmtStr = sNType4; break; - } - - if( pFmtStr ) - rWrt.Strm() << "\\\\* " << pFmtStr; - } - break; - case RES_FILENAMEFLD: - rWrt.Strm() << aFldStt.GetBuffer() << "\\\\filename "; - break; - case RES_DBNAMEFLD: - { - rWrt.Strm() << aFldStt.GetBuffer() << "\\\\data "; - SwDBData aData = rWrt.pDoc->GetDBData(); - String sOut(aData.sDataSource); - sOut += DB_DELIM; - sOut += (String)aData.sCommand; - RTFOutFuncs::Out_String( rWrt.Strm(), sOut, - rRTFWrt.eDefaultEncoding, rRTFWrt.bWriteHelpFmt ); - } - break; - case RES_AUTHORFLD: - rWrt.Strm() << aFldStt.GetBuffer() << "\\\\author "; - break; - - case RES_HIDDENTXTFLD: - if( TYP_CONDTXTFLD == ((SwHiddenTxtField*)pFld)->GetSubType() ) - RTFOutFuncs::Out_String( rWrt.Strm(), - pFld->ExpandField(true), - rRTFWrt.eDefaultEncoding, rRTFWrt.bWriteHelpFmt ); - else - { - rWrt.Strm() << '{' << OOO_STRING_SVTOOLS_RTF_V << ' '; - OutRTF_AsByteString( rWrt, pFld->GetPar2(), rRTFWrt.eDefaultEncoding ).Strm() - << '}' << SwRTFWriter::sNewLine; - } - return rWrt; // nicht bis zum Ende, kein RTF-Feld !! - - case RES_DATETIMEFLD: - if (!(pFld->GetSubType() & FIXEDFLD)) - { - USHORT nWhich = RES_DATETIMEFLD; - ULONG nFmt = pFld->GetFormat(); - sw3io_ConvertToOldField(pFld, nWhich, nFmt, SOFFICE_FILEFORMAT_40 ); - if (pFld->GetSubType() & DATEFLD) - { - rWrt.Strm() << aFldStt.GetBuffer() << "\\\\date \\\\@\""; - switch( nFmt ) - { - case DF_SSYS: rWrt.Strm() << "tt.MM.yy"; break; - case DF_LSYS: rWrt.Strm() << "tttt, t. MMMM yyyy"; break; - case DF_SHORT: rWrt.Strm() << "tt.MM.yy"; break; - case DF_SCENT: rWrt.Strm() << "tt.MM.yyyy"; break; - case DF_LMON: rWrt.Strm() << "t. MMM yyyy"; break; - case DF_LMONTH: rWrt.Strm() << "t. MMMM yyyy"; break; - case DF_LDAYMON: rWrt.Strm() << "ttt, t. MMMM yyyy"; break; - case DF_LDAYMONTH: rWrt.Strm() << "tttt, t. MMMM yyyy"; break; - } - } - else - { - rWrt.Strm() << aFldStt.GetBuffer() << "\\\\date \\\\@\""; - switch( nFmt ) - { - case TF_SSMM_24: rWrt.Strm() << "HH:mm"; break; - case TF_SSMM_12: rWrt.Strm() << "hh:mm"; break; // ??? - case TF_SYSTEM: rWrt.Strm() << "HH:mm"; break; - } - } - rWrt.Strm() << '\"'; - break; - } - // Kein break: in default-Zweig laufen! - - default: - { - aFldStt.Erase(); - - // JP 20.07.95: warum nicht das Expandierte rausschreiben ? - sal_Char cCh; - rWrt.Strm().SeekRel(-1); - rWrt.Strm() >> cCh; - if( ' ' != cCh ) // vorweg immer einen Trenner - rWrt.Strm() << ' '; - RTFOutFuncs::Out_String( rWrt.Strm(), - pFld->ExpandField(true), - rRTFWrt.eDefaultEncoding, rRTFWrt.bWriteHelpFmt ); - } - break; - } - - if( aFldStt.Len() ) - { - rWrt.Strm() << "}{" << OOO_STRING_SVTOOLS_RTF_FLDRSLT << ' '; - RTFOutFuncs::Out_String( rWrt.Strm(), - pFld->ExpandField(true), - rRTFWrt.eDefaultEncoding, rRTFWrt.bWriteHelpFmt ); - rWrt.Strm() << "}}"; - rRTFWrt.bOutFmtAttr = FALSE; - } - - return rWrt; -} - -static Writer& OutRTF_SwFlyCntnt( Writer& rWrt, const SfxPoolItem& rHt ) -{ - SwFrmFmt* pFmt = ((SwFmtFlyCnt&)rHt).GetFrmFmt(); - if (RES_DRAWFRMFMT != pFmt->Which()) - { - ((SwRTFWriter&)rWrt).OutRTFFlyFrms( *((SwFlyFrmFmt*)pFmt) ); - ((SwRTFWriter&)rWrt).bOutFmtAttr = false; - } - return rWrt; -} - -static Writer& OutRTF_SwFtn( Writer& rWrt, const SfxPoolItem& rHt ) -{ - const SwFmtFtn& rFtn = (const SwFmtFtn&)rHt; - SwRTFWriter& rRTFWrt = (SwRTFWriter&)rWrt; - - do { // middle-check-loop - if( !rFtn.GetTxtFtn() || !rFtn.GetTxtFtn()->GetStartNode() ) - break; // es gibt keine Kopf-/Fusszeile/Fussnote - - // Hole vom Node und vom letzten Node die Position in der Section - ULONG nStart = rFtn.GetTxtFtn()->GetStartNode()->GetIndex()+1, - nEnd = rWrt.pDoc->GetNodes()[ nStart-1 ]->EndOfSectionIndex(); - - // kein Bereich also kein gueltiger Node - if( nStart >= nEnd ) - break; - - rWrt.Strm() << '{' << OOO_STRING_SVTOOLS_RTF_SUPER << ' '; - if( !rFtn.GetNumStr().Len() ) - { - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_CHFTN; - OutComment( rWrt, OOO_STRING_SVTOOLS_RTF_FOOTNOTE ); - if( rFtn.IsEndNote() ) - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_FTNALT; - rWrt.Strm() << ' ' << OOO_STRING_SVTOOLS_RTF_CHFTN; - } - else - { - OutRTF_AsByteString( rWrt, rFtn.GetNumStr(), rRTFWrt.eDefaultEncoding ); - OutComment( rWrt, OOO_STRING_SVTOOLS_RTF_FOOTNOTE ); - if( rFtn.IsEndNote() ) - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_FTNALT; - rWrt.Strm() << ' '; - OutRTF_AsByteString( rWrt, rFtn.GetNumStr(), rRTFWrt.eDefaultEncoding ); - } - RTFSaveData aSaveData( rRTFWrt, nStart, nEnd ); - // damit kein \par ausgegeben wird !! - rRTFWrt.pCurPam->GetMark()->nContent++; - rRTFWrt.Out_SwDoc( rRTFWrt.pCurPam ); - - rWrt.Strm() << "}}" << SwRTFWriter::sNewLine; - rRTFWrt.bOutFmtAttr = FALSE; - - } while( FALSE ); - return rWrt; -} - -static Writer& OutRTF_SwTxtCharFmt( Writer& rWrt, const SfxPoolItem& rHt ) -{ - const SwFmtCharFmt& rChrFmt = (const SwFmtCharFmt&)rHt; - const SwCharFmt* pFmt = rChrFmt.GetCharFmt(); - - if( pFmt ) - OutRTF_SwFmt( rWrt, *pFmt ); - return rWrt; -} - -static Writer& OutRTF_SwTxtAutoFmt( Writer& rWrt, const SfxPoolItem& rHt ) -{ - const SwFmtAutoFmt& rAutoFmt = (const SwFmtAutoFmt&)rHt; - const boost::shared_ptr<SfxItemSet> pSet = rAutoFmt.GetStyleHandle(); - - if( pSet.get() ) - { - SwRTFWriter & rRTFWrt = (SwRTFWriter&)rWrt; - OutRTF_SfxItemSet( rRTFWrt, *pSet.get(), FALSE ); - } - return rWrt; -} - -static Writer& OutRTF_SwTxtRuby( Writer& rWrt, const SfxPoolItem& rHt ) -{ - SwRTFWriter& rRTFWrt = (SwRTFWriter&)rWrt; - const SwFmtRuby& rRuby = (const SwFmtRuby&)rHt; - const SwTxtRuby* pRubyTxt = rRuby.GetTxtRuby(); - const SwTxtNode* pNd; - - if( !pRubyTxt || 0 == (pNd = pRubyTxt->GetpTxtNode() )) - return rWrt; - - sal_Char cDirective = 0, cJC = '0'; - switch( rRuby.GetAdjustment() ) - { - case 0: cJC = '3'; cDirective = 'l'; break; - case 2: cJC = '4'; cDirective = 'r'; break; - case 3: cJC = '1'; cDirective = 'd'; break; - case 4: cJC = '2'; cDirective = 'd'; break; - case 1: break; //defaults to 0 - default: - ASSERT( FALSE, "Unhandled Ruby justication code" ); - break; - } - - /* - MS needs to know the name and size of the font used in the ruby item, - but we coud have written it in a mixture of asian and western - scripts, and each of these can be a different font and size than the - other, so we make a guess based upon the first character of the text, - defaulting to asian. - */ - USHORT nScript; - if( pBreakIt->GetBreakIter().is() ) - nScript = pBreakIt->GetBreakIter()->getScriptType( rRuby.GetText(), 0); - else - nScript = i18n::ScriptType::ASIAN; - - const SwCharFmt* pFmt = pRubyTxt->GetCharFmt(); - const SvxFontItem *pFont; - long nHeight; - - if( pFmt ) - { - const SwAttrSet& rSet = pFmt->GetAttrSet(); - pFont = &(const SvxFontItem&)rSet.Get( GetWhichOfScript( - RES_CHRATR_FONT, nScript )); - - nHeight = ((SvxFontHeightItem&)rSet.Get( - GetWhichOfScript( RES_CHRATR_FONTSIZE, nScript ))).GetHeight(); - } - else - { - /*Get document defaults if no formatting on ruby text*/ - const SfxItemPool *pPool = pNd->GetSwAttrSet().GetPool(); - pFont = &(const SvxFontItem&)pPool->GetDefaultItem( - GetWhichOfScript( RES_CHRATR_FONT, nScript )); - - nHeight = ((SvxFontHeightItem&)pPool->GetDefaultItem( - GetWhichOfScript( RES_CHRATR_FONTSIZE, nScript ))).GetHeight(); - } - ( nHeight += 5 ) /= 10; - - // don't change " EQ " to any other without changing the code in RTFFLD.CXX - rWrt.Strm() << '{' << OOO_STRING_SVTOOLS_RTF_FIELD << '{' << OOO_STRING_SVTOOLS_RTF_IGNORE << OOO_STRING_SVTOOLS_RTF_FLDINST - << " EQ \\\\* jc" << cJC - << " \\\\* \"Font:"; - RTFOutFuncs::Out_String( rWrt.Strm(), pFont->GetFamilyName(), - rRTFWrt.eDefaultEncoding, rRTFWrt.bWriteHelpFmt ); - rWrt.Strm() << "\" \\\\* hps"; - rWrt.OutLong( nHeight ); - rWrt.Strm() << " \\\\o"; - if( cDirective ) - rWrt.Strm() << "\\\\a" << cDirective; - rWrt.Strm() << "(\\\\s\\\\up "; - - if( pBreakIt->GetBreakIter().is() ) - nScript = pBreakIt->GetBreakIter()->getScriptType( pNd->GetTxt(), - *pRubyTxt->GetStart() ); - else - nScript = i18n::ScriptType::ASIAN; - - const SwAttrSet& rSet = pNd->GetSwAttrSet(); - nHeight = ((SvxFontHeightItem&)rSet.Get( - GetWhichOfScript( RES_CHRATR_FONTSIZE, nScript ))).GetHeight(); - (nHeight += 10) /= 20-1; - rWrt.OutLong( nHeight ) << '('; - - if( pFmt ) - { - rWrt.Strm() << '{'; - OutRTF_SwFmt( rWrt, *pFmt ); - if( rRTFWrt.bOutFmtAttr ) - rWrt.Strm() << ' '; - } - RTFOutFuncs::Out_String( rWrt.Strm(), rRuby.GetText(), - rRTFWrt.eDefaultEncoding, rRTFWrt.bWriteHelpFmt ); - if( pFmt ) - rWrt.Strm() << '}'; - - rWrt.Strm() << "),"; - rRTFWrt.bOutFmtAttr = FALSE; - - return rWrt; -} - - -/* File FRMATR.HXX */ - -static Writer& OutRTF_SwFrmSize( Writer& rWrt, const SfxPoolItem& rHt ) -{ - SwRTFWriter& rRTFWrt = (SwRTFWriter&)rWrt; - const SwFmtFrmSize& rSz = (const SwFmtFrmSize&)rHt; - if( rRTFWrt.pFlyFmt ) // wird das FlyFrmFmt ausgegeben ? - { - if( !rRTFWrt.bRTFFlySyntax ) - return rWrt; - - if( rSz.GetWidth() ) - { - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_ABSW; - rWrt.OutLong( rSz.GetWidth() ); - rRTFWrt.bOutFmtAttr = TRUE; - } - - if( rSz.GetHeight() ) - { - long nH = rSz.GetHeight(); - if( ATT_FIX_SIZE == rSz.GetHeightSizeType() ) - nH = -nH; - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_ABSH; - rWrt.OutLong( nH ); - rRTFWrt.bOutFmtAttr = TRUE; - } - } - else if( rRTFWrt.bOutPageDesc ) - { - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_PGWSXN; - rWrt.OutLong( rSz.GetWidth() ); - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_PGHSXN; - rWrt.OutLong( rSz.GetHeight() ); - rRTFWrt.bOutFmtAttr = TRUE; - } - return rWrt; -} - -static Writer& OutRTF_SwFmtLRSpace( Writer& rWrt, const SfxPoolItem& rHt ) -{ - SwRTFWriter& rRTFWrt = (SwRTFWriter&)rWrt; - const SvxLRSpaceItem & rLR = (const SvxLRSpaceItem&) rHt; - if( !rRTFWrt.pFlyFmt ) - { - if( rRTFWrt.bOutPageDesc ) - { - if( rLR.GetLeft() ) - { - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_MARGLSXN; - rWrt.OutLong( rLR.GetLeft() ); - rRTFWrt.bOutFmtAttr = TRUE; - } - if( rLR.GetRight() ) - { - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_MARGRSXN; - rWrt.OutLong( rLR.GetRight() ); - rRTFWrt.bOutFmtAttr = TRUE; - } - } - else - { - rRTFWrt.bOutFmtAttr = TRUE; - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_LI; - rWrt.OutLong( rLR.GetTxtLeft() ) << OOO_STRING_SVTOOLS_RTF_RI; - rWrt.OutLong( rLR.GetRight() ); - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_LIN; - rWrt.OutLong( rLR.GetTxtLeft() ) << OOO_STRING_SVTOOLS_RTF_RIN; - rWrt.OutLong( rLR.GetRight() ); - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_FI; - rWrt.OutLong( rLR.GetTxtFirstLineOfst() ); - } - } - else if( rLR.GetLeft() == rLR.GetRight() && rRTFWrt.bRTFFlySyntax ) - { - rRTFWrt.bOutFmtAttr = TRUE; - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_DFRMTXTX; - rWrt.OutLong( rLR.GetLeft() ); - } - return rWrt; -} - -static Writer& OutRTF_SwFmtULSpace( Writer& rWrt, const SfxPoolItem& rHt ) -{ - SwRTFWriter& rRTFWrt = (SwRTFWriter&)rWrt; - const SvxULSpaceItem & rUL = (const SvxULSpaceItem&) rHt; - if( rRTFWrt.pFlyFmt ) - { - if( rUL.GetUpper() == rUL.GetLower() && rRTFWrt.bRTFFlySyntax ) - { - rRTFWrt.bOutFmtAttr = TRUE; - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_DFRMTXTY; - rWrt.OutLong( rUL.GetLower() ); - } - } - else - { - const char* p; - USHORT nValue = rUL.GetUpper(); - if( rRTFWrt.bOutPageDesc ) - { - p = OOO_STRING_SVTOOLS_RTF_MARGTSXN; - if( !rRTFWrt.bOutPageDescTbl ) - { - SwRect aRect; - const SwFmtHeader* pHdr; - if( SFX_ITEM_SET == rRTFWrt.pAktPageDesc->GetMaster(). - GetItemState( RES_HEADER, FALSE, - (const SfxPoolItem**)&pHdr ) && pHdr->IsActive() ) - { - aRect = pHdr->GetHeaderFmt()->FindLayoutRect( FALSE ); - if( aRect.Height() ) - nValue = nValue + static_cast< USHORT >(aRect.Height()); - else - { - const SwFmtFrmSize& rSz = pHdr->GetHeaderFmt()->GetFrmSize(); - if( ATT_VAR_SIZE != rSz.GetHeightSizeType() ) - nValue = nValue + static_cast< USHORT >(rSz.GetHeight()); - else - nValue = nValue + 274; // defaulten fuer 12pt Schrift - nValue = nValue + pHdr->GetHeaderFmt()->GetULSpace().GetLower(); - } - } - } - } - else - p = OOO_STRING_SVTOOLS_RTF_SB; - - if( rRTFWrt.bOutPageDesc || nValue ) - { - rRTFWrt.bOutFmtAttr = TRUE; - rWrt.Strm() << p; - rWrt.OutLong( nValue ); - } - - - nValue = rUL.GetLower(); - if( rRTFWrt.bOutPageDesc ) - { - p = OOO_STRING_SVTOOLS_RTF_MARGBSXN; - if( !rRTFWrt.bOutPageDescTbl ) - { - SwRect aRect; - const SwFmtFooter* pFtr; - if( SFX_ITEM_SET == rRTFWrt.pAktPageDesc->GetMaster(). - GetItemState( RES_FOOTER, FALSE, - (const SfxPoolItem**)&pFtr ) && pFtr->IsActive() ) - { - aRect = pFtr->GetFooterFmt()->FindLayoutRect( FALSE ); - if( aRect.Height() ) - nValue = nValue + static_cast< USHORT >(aRect.Height()); - else - { - const SwFmtFrmSize& rSz = pFtr->GetFooterFmt()->GetFrmSize(); - if( ATT_VAR_SIZE != rSz.GetHeightSizeType() ) - nValue = nValue + static_cast< USHORT >(rSz.GetHeight()); - else - nValue += 274; // defaulten fuer 12pt Schrift - nValue = nValue + pFtr->GetFooterFmt()->GetULSpace().GetUpper(); - } - } - } - } - else - p = OOO_STRING_SVTOOLS_RTF_SA; - - if( rRTFWrt.bOutPageDesc || nValue ) - { - rRTFWrt.bOutFmtAttr = TRUE; - rWrt.Strm() << p; - rWrt.OutLong( nValue ); - } - } - return rWrt; -} - -// Header-Footer werden auch vom RTF-Writer direkt gerufen, also kein static! - - -Writer& OutRTF_SwFmtHeader( Writer& rWrt, const SfxPoolItem& rHt ) -{ - const SwFmtHeader& rHd = (const SwFmtHeader&)rHt; - if( !rHd.IsActive() ) // nicht aktiv, dann nichts weiter ausgeben - return rWrt; - - // hole einen Node zu dem Request - SwStartNode *pSttNode = 0; - const SwFmtCntnt& rCntnt = rHd.GetHeaderFmt()->GetCntnt(); - if( rCntnt.GetCntntIdx() ) - pSttNode = rCntnt.GetCntntIdx()->GetNode().GetStartNode(); - - do { // middle-check-loop - if( !pSttNode ) - break; // es gibt keine Kopf-/Fusszeile/Fussnote - - SwRTFWriter& rRTFWrt = (SwRTFWriter&)rWrt; - - // Hole vom Node und vom letzten Node die Position in der Section - ULONG nStart = pSttNode->GetIndex() + 1, - nEnd = pSttNode->EndOfSectionIndex(); - - // kein Bereich also kein gueltiger Node - if( nStart >= nEnd ) - break; - ASSERT( rRTFWrt.pAktPageDesc, "Header-Attribut ohne PageDesc" ); - - const sal_Char * pHdNm = OOO_STRING_SVTOOLS_RTF_HEADER; - rWrt.Strm() << pHdNm << 'y'; - if( rRTFWrt.bOutPageDescTbl ) - { - // hole die Ober-/Unterkanten vom Header - const SvxULSpaceItem& rUL = rHd.GetHeaderFmt()->GetULSpace(); - const SvxLRSpaceItem& rLR = rHd.GetHeaderFmt()->GetLRSpace(); - const SwFmtFrmSize& rSz = rHd.GetHeaderFmt()->GetFrmSize(); - - rWrt.OutLong( rUL.GetUpper() ); - OutComment( rWrt, pHdNm ) << "yb"; - rWrt.OutLong( rUL.GetLower() ) << pHdNm << "xl"; - rWrt.OutLong( rLR.GetLeft() ) << pHdNm << "xr"; - rWrt.OutLong( rLR.GetRight() ) << pHdNm << "yh"; - rWrt.OutLong( ATT_FIX_SIZE == rSz.GetHeightSizeType() - ? -rSz.GetHeight() - : rSz.GetHeight() ) << '}'; - } - else - rWrt.OutLong( rRTFWrt.pAktPageDesc->GetMaster(). - GetULSpace().GetUpper() ); - - // wird nicht die PageDesc-Tabelle ausgegeben und gibt es einen - // Nachfolger, dann handelt es sich um die "1.Seite" nach RTF. - sal_Char cTyp = 0; - if( rRTFWrt.pAktPageDesc->GetFollow() && - rRTFWrt.pAktPageDesc->GetFollow() != rRTFWrt.pAktPageDesc ) - { - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_TITLEPG; //i13107 - cTyp = 'f'; // dann FirstPage-Header - } - else if( !rRTFWrt.pAktPageDesc->IsHeaderShared() ) - { - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_FACINGP; //i13107 - cTyp = rRTFWrt.bOutLeftHeadFoot ? 'l' : 'r'; - } - - rWrt.Strm() << '{'<< pHdNm; - if( cTyp ) rWrt.Strm() << cTyp; - rWrt.Strm() << ' '; - - { - RTFSaveData aSaveData( rRTFWrt, nStart, nEnd ); - rRTFWrt.Out_SwDoc( rRTFWrt.pCurPam ); - } - - rWrt.Strm() << '}' << SwRTFWriter::sNewLine; - - } while( FALSE ); - return rWrt; -} -// Header-Footer werden auch vom RTF-Writer direkt gerufen, also kein static! - - -Writer& OutRTF_SwFmtFooter( Writer& rWrt, const SfxPoolItem& rHt ) -{ - const SwFmtFooter& rFt = (const SwFmtFooter&)rHt; - if( !rFt.IsActive() ) // nicht aktiv, dann nichts weiter ausgeben - return rWrt; - - SwStartNode *pSttNode = 0; - const SwFmtCntnt& rCntnt = rFt.GetFooterFmt()->GetCntnt(); - if( rCntnt.GetCntntIdx() ) - pSttNode = rCntnt.GetCntntIdx()->GetNode().GetStartNode(); - - do { // middle-check-loop - if( !pSttNode ) - break; // es gibt keine Kopf-/Fusszeile/Fussnote - - SwRTFWriter& rRTFWrt = (SwRTFWriter&)rWrt; - - // Hole vom Node und vom letzten Node die Position in der Section - ULONG nStart = pSttNode->GetIndex()+1, - nEnd = pSttNode->EndOfSectionIndex(); - - // kein Bereich also kein gueltiger Node - if( nStart >= nEnd ) - break; - ASSERT( rRTFWrt.pAktPageDesc, "Footer-Attribut ohne PageDesc" ); - - const sal_Char * pFtNm = OOO_STRING_SVTOOLS_RTF_FOOTER; - rWrt.Strm() << pFtNm << 'y'; - if( rRTFWrt.bOutPageDescTbl ) - { - // hole die Ober-/Unterkanten vom Footer - const SvxULSpaceItem& rUL = rFt.GetFooterFmt()->GetULSpace(); - const SvxLRSpaceItem& rLR = rFt.GetFooterFmt()->GetLRSpace(); - const SwFmtFrmSize& rSz = rFt.GetFooterFmt()->GetFrmSize(); - - rWrt.OutLong( rUL.GetLower() ); - OutComment( rWrt, pFtNm ) << "yt"; - rWrt.OutLong( rUL.GetUpper() ) << pFtNm << "xl"; - rWrt.OutLong( rLR.GetLeft() ) << pFtNm << "xr"; - rWrt.OutLong( rLR.GetRight() ) << pFtNm << "yh"; - rWrt.OutLong( ATT_FIX_SIZE == rSz.GetHeightSizeType() - ? -rSz.GetHeight() - : rSz.GetHeight() ) << '}'; - } - else - rWrt.OutLong( rRTFWrt.pAktPageDesc->GetMaster(). - GetULSpace().GetLower() ); - - // wird nicht die PageDesc-Tabelle ausgegeben und gibt es einen - // Nachfolger, dann handelt es sich um die "1.Seite" nach RTF. - sal_Char cTyp = 0; - if( !rRTFWrt.bOutPageDesc && rRTFWrt.pAktPageDesc->GetFollow() && - rRTFWrt.pAktPageDesc->GetFollow() != rRTFWrt.pAktPageDesc ) - { - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_TITLEPG; //i13107 - cTyp = 'f'; // dann FirstPage-Header - } - else if( !rRTFWrt.pAktPageDesc->IsFooterShared() ) - { - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_FACINGP; //i13107 - cTyp = rRTFWrt.bOutLeftHeadFoot ? 'l' : 'r'; - } - - rWrt.Strm() << '{'<< pFtNm; - if( cTyp ) rWrt.Strm() << cTyp; - rWrt.Strm() << ' '; - - { - RTFSaveData aSaveData( rRTFWrt, nStart, nEnd ); - rRTFWrt.Out_SwDoc( rRTFWrt.pCurPam ); - } - - rWrt.Strm() << '}' << SwRTFWriter::sNewLine; - - } while( FALSE ); - return rWrt; -} - -static Writer& OutRTF_SwFmtPrint( Writer& rWrt, const SfxPoolItem& rHt ) -{ - SwRTFWriter& rRTFWrt = (SwRTFWriter&)rWrt; - if( !rRTFWrt.bRTFFlySyntax && !((const SvxPrintItem&)rHt).GetValue() ) - { - rRTFWrt.bOutFmtAttr = TRUE; - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_FLYPRINT; - } - return rWrt; -} - - -static Writer& OutRTF_SwFmtOpaque( Writer& rWrt, const SfxPoolItem& rHt ) -{ - SwRTFWriter& rRTFWrt = (SwRTFWriter&)rWrt; - if( !rRTFWrt.bRTFFlySyntax && !((const SvxOpaqueItem&)rHt).GetValue() ) - { - rRTFWrt.bOutFmtAttr = TRUE; - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_FLYOPAQUE; - } - return rWrt; -} - - -static Writer& OutRTF_SwFmtProtect( Writer& rWrt, const SfxPoolItem& rHt ) -{ - SwRTFWriter& rRTFWrt = (SwRTFWriter&)rWrt; - if( !rRTFWrt.bRTFFlySyntax ) - { - const SvxProtectItem & rFlyProtect = (const SvxProtectItem&) rHt; - RTFProtect aP( rFlyProtect.IsCntntProtected(), - rFlyProtect.IsSizeProtected(), - rFlyProtect.IsPosProtected() ); - rRTFWrt.bOutFmtAttr = TRUE; - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_FLYPRTCTD; - rWrt.OutULong( aP.GetValue() ); - } - return rWrt; -} - - -static Writer& OutRTF_SwFmtSurround( Writer& rWrt, const SfxPoolItem& rHt ) -{ - const SwFmtSurround& rFlySurround = (const SwFmtSurround&) rHt; - SwRTFWriter& rRTFWrt = (SwRTFWriter&)rWrt; - if( rRTFWrt.bRTFFlySyntax ) - { - if( SURROUND_NONE == rFlySurround.GetSurround() ) - { - rRTFWrt.bOutFmtAttr = TRUE; - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_NOWRAP; - } - } - else - { - SwSurround eSurround = rFlySurround.GetSurround(); - BOOL bGold = SURROUND_IDEAL == eSurround; - if( bGold ) - eSurround = SURROUND_PARALLEL; - RTFSurround aMC( bGold, static_cast< BYTE >(eSurround) ); - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_FLYMAINCNT; - rWrt.OutULong( aMC.GetValue() ); - rRTFWrt.bOutFmtAttr = TRUE; - } - return rWrt; -} - -static Writer& OutRTF_SwFmtVertOrient ( Writer& rWrt, const SfxPoolItem& rHt ) -{ - const SwFmtVertOrient& rFlyVert = (const SwFmtVertOrient&) rHt; - RTFVertOrient aVO( static_cast< USHORT >(rFlyVert.GetVertOrient()), static_cast< USHORT >(rFlyVert.GetRelationOrient()) ); - SwRTFWriter& rRTFWrt = (SwRTFWriter&)rWrt; - - if( rRTFWrt.bRTFFlySyntax && rRTFWrt.pFlyFmt ) - { - rRTFWrt.bOutFmtAttr = TRUE; - const char* pOrient; - RndStdIds eAnchor = rRTFWrt.pFlyFmt->GetAnchor().GetAnchorId(); - sal_Int16 eOrient = rFlyVert.GetRelationOrient(); - if (FLY_AT_PAGE == eAnchor) - { - if( text::RelOrientation::PAGE_FRAME == eOrient || text::RelOrientation::FRAME == eOrient ) - pOrient = OOO_STRING_SVTOOLS_RTF_PVPG; - else - pOrient = OOO_STRING_SVTOOLS_RTF_PVMRG; - } - else - pOrient = OOO_STRING_SVTOOLS_RTF_PVPARA; - rWrt.Strm() << pOrient; - - switch (rFlyVert.GetVertOrient()) - { - case text::VertOrientation::TOP: - case text::VertOrientation::LINE_TOP: - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_POSYT; - break; - case text::VertOrientation::BOTTOM: - case text::VertOrientation::LINE_BOTTOM: - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_POSYB; - break; - case text::VertOrientation::CENTER: - case text::VertOrientation::LINE_CENTER: - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_POSYC; - break; - case text::VertOrientation::NONE: - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_POSY; - rWrt.OutULong(rFlyVert.GetPos()); - break; - default: - break; - } - } - else if( !rRTFWrt.bRTFFlySyntax ) - { - rRTFWrt.bOutFmtAttr = TRUE; - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_FLYVERT; - rWrt.OutULong( aVO.GetValue() ); - } - - return rWrt; -} - -static Writer& OutRTF_SwFmtHoriOrient( Writer& rWrt, const SfxPoolItem& rHt ) -{ - const SwFmtHoriOrient& rFlyHori = (const SwFmtHoriOrient&) rHt; - RTFHoriOrient aHO( static_cast< USHORT >(rFlyHori.GetHoriOrient()), - static_cast< USHORT >(rFlyHori.GetRelationOrient()) ); - - SwRTFWriter& rRTFWrt = (SwRTFWriter&)rWrt; - if( rRTFWrt.bRTFFlySyntax && rRTFWrt.pFlyFmt ) - { - rRTFWrt.bOutFmtAttr = TRUE; - const char* pS; - RndStdIds eAnchor = rRTFWrt.pFlyFmt->GetAnchor().GetAnchorId(); - sal_Int16 eOrient = rFlyHori.GetRelationOrient(); - if (FLY_AT_PAGE == eAnchor) - { - if( text::RelOrientation::PAGE_FRAME == eOrient || text::RelOrientation::FRAME == eOrient ) - pS = OOO_STRING_SVTOOLS_RTF_PHPG; - else - pS = OOO_STRING_SVTOOLS_RTF_PHMRG; - } - else - pS = OOO_STRING_SVTOOLS_RTF_PHCOL; - rWrt.Strm() << pS; - - pS = 0; - switch(rFlyHori.GetHoriOrient()) - { - case text::HoriOrientation::RIGHT: - pS = rFlyHori.IsPosToggle() ? OOO_STRING_SVTOOLS_RTF_POSXO : OOO_STRING_SVTOOLS_RTF_POSXR; - break; - case text::HoriOrientation::LEFT: - pS = rFlyHori.IsPosToggle() ? OOO_STRING_SVTOOLS_RTF_POSXI : OOO_STRING_SVTOOLS_RTF_POSXL; - break; - case text::HoriOrientation::CENTER: - pS = OOO_STRING_SVTOOLS_RTF_POSXC; - break; - case text::HoriOrientation::NONE: - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_POSX; - rWrt.OutULong( rFlyHori.GetPos() ); - break; - default: - break; - } - if (pS) - rWrt.Strm() << pS; - } - else - { - rRTFWrt.bOutFmtAttr = TRUE; - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_FLYHORZ; - rWrt.OutULong( aHO.GetValue() ); - } - return rWrt; -} - -static Writer& OutRTF_SwFmtAnchor( Writer& rWrt, const SfxPoolItem& rHt ) -{ - SwRTFWriter& rRTFWrt = (SwRTFWriter&)rWrt; - if( !rRTFWrt.bRTFFlySyntax ) - { - const SwFmtAnchor& rAnchor = (const SwFmtAnchor&) rHt; - USHORT nId = static_cast< USHORT >(rAnchor.GetAnchorId()); - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_FLYANCHOR; - rWrt.OutULong( nId ); - rRTFWrt.bOutFmtAttr = TRUE; - switch( nId ) - { - case FLY_AT_PAGE: - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_FLYPAGE; - rWrt.OutULong( rAnchor.GetPageNum() ); - break; - case FLY_AT_PARA: - case FLY_AS_CHAR: - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_FLYCNTNT; - break; - } - } - return rWrt; -} - - - -static Writer& OutRTF_SwFmtBackground( Writer& rWrt, const SfxPoolItem& rHt ) -{ - SwRTFWriter& rRTFWrt = (SwRTFWriter&)rWrt; - // wird das FlyFrmFmt ausgegeben, dann Background nur ausgeben, wenn - // RTF-Syntax gesetzt ist ! - if( !rRTFWrt.pFlyFmt || !rRTFWrt.bRTFFlySyntax ) - { - const SvxBrushItem& rBack = (const SvxBrushItem&)rHt; - if( !rBack.GetColor().GetTransparency() ) - { - ByteString sOut( OOO_STRING_SVTOOLS_RTF_CBPAT ); - sOut += ByteString::CreateFromInt32( - rRTFWrt.GetId( rBack.GetColor() )); - - if( rRTFWrt.pFlyFmt || rRTFWrt.bOutPageDesc ) - { - rWrt.Strm() << '{' << sOut.GetBuffer() << '}'; - } - else - { - rRTFWrt.bOutFmtAttr = TRUE; - rWrt.Strm() << sOut.GetBuffer(); - } - } - } - return rWrt; -} - - -static Writer& OutRTF_SwFmtShadow( Writer& rWrt, const SfxPoolItem& rHt ) -{ - SwRTFWriter& rRTFWrt = (SwRTFWriter&)rWrt; - // wird das FlyFrmFmt ausgegeben, dann Schatten nur ausgeben, wenn - // nicht RTF-Syntax gesetzt ist ! - if( rRTFWrt.pFlyFmt && rRTFWrt.bRTFFlySyntax ) - return rWrt; - - const SvxShadowItem& rShadow = (const SvxShadowItem&)rHt; - // FALSE wegen schliessender Klammer !! - OutComment( rWrt, OOO_STRING_SVTOOLS_RTF_SHADOW, FALSE ); - rWrt.OutULong( rShadow.GetLocation() ) << OOO_STRING_SVTOOLS_RTF_SHDWDIST; - rWrt.OutULong( rShadow.GetWidth() ) << OOO_STRING_SVTOOLS_RTF_SHDWSTYLE; - const Color& rColor = rShadow.GetColor(); - rWrt.OutULong( rColor.GetTransparency() ? SW_SV_BRUSH_NULL : SW_SV_BRUSH_SOLID ); - rWrt.OutULong( rRTFWrt.GetId( rColor ) ) << OOO_STRING_SVTOOLS_RTF_SHDWFCOL; - rWrt.OutULong( 0 ) << '}'; - return rWrt; -} - - -static void OutBorderLine( SwRTFWriter& rWrt, const SvxBorderLine* pLine, - const char* pStr ) -{ - rWrt.Strm() << pStr << OOO_STRING_SVTOOLS_RTF_BRDLNCOL; - rWrt.OutULong( rWrt.GetId( pLine->GetColor() ) ) << OOO_STRING_SVTOOLS_RTF_BRDLNIN; - rWrt.OutULong( pLine->GetInWidth() ) << OOO_STRING_SVTOOLS_RTF_BRDLNOUT; - rWrt.OutULong( pLine->GetOutWidth() ) << OOO_STRING_SVTOOLS_RTF_BRDLNDIST; - rWrt.OutULong( pLine->GetDistance() ); -} - - -static Writer& OutRTF_SwFmtBox( Writer& rWrt, const SfxPoolItem& rHt ) -{ - SwRTFWriter& rRTFWrt = (SwRTFWriter&)rWrt; - - const SvxBoxItem& rBox = (const SvxBoxItem&)rHt; - - static USHORT __READONLY_DATA aBorders[] = { - BOX_LINE_TOP, BOX_LINE_LEFT, BOX_LINE_BOTTOM, BOX_LINE_RIGHT }; - static const sal_Char* __READONLY_DATA aBorderNames[] = { - OOO_STRING_SVTOOLS_RTF_BRDRT, OOO_STRING_SVTOOLS_RTF_BRDRL, OOO_STRING_SVTOOLS_RTF_BRDRB, OOO_STRING_SVTOOLS_RTF_BRDRR }; - - USHORT nDist = rBox.GetDistance(); - - // wird das FlyFrmFmt ausgegeben, dann Border nur ausgeben, wenn - // nicht RTF-Syntax gesetzt ist! - if( rRTFWrt.pFlyFmt && rRTFWrt.bRTFFlySyntax ) - { -/* -RTF kennt keine Rahmen Umrandung! - // die normale RTF-Definition - if( rBox.GetTop() && rBox.GetBottom() && - rBox.GetLeft() && rBox.GetRight() && - *rBox.GetTop() == *rBox.GetBottom() && - *rBox.GetTop() == *rBox.GetLeft() && - *rBox.GetTop() == *rBox.GetRight() ) - OutBorderLine( rRTFWrt, rBox.GetTop(), OOO_STRING_SVTOOLS_RTF_BOX, nDist ); - else - { - OUT_BRDLINE( rBox.GetTop(), OOO_STRING_SVTOOLS_RTF_BRDRT, nDist ); - OUT_BRDLINE( rBox.GetBottom(), OOO_STRING_SVTOOLS_RTF_BRDRB, nDist ); - OUT_BRDLINE( rBox.GetLeft(), OOO_STRING_SVTOOLS_RTF_BRDRL, nDist ); - OUT_BRDLINE( rBox.GetRight(), OOO_STRING_SVTOOLS_RTF_BRDRR, nDist ); - } -*/ - return rWrt; - } - else if( !rRTFWrt.pFlyFmt ) - { - // erst die normale RTF-Definition, dann unsere eigene - if( rBox.GetTop() && rBox.GetBottom() && - rBox.GetLeft() && rBox.GetRight() && - *rBox.GetTop() == *rBox.GetBottom() && - *rBox.GetTop() == *rBox.GetLeft() && - *rBox.GetTop() == *rBox.GetRight() && - nDist == rBox.GetDistance( BOX_LINE_TOP ) && - nDist == rBox.GetDistance( BOX_LINE_LEFT ) && - nDist == rBox.GetDistance( BOX_LINE_BOTTOM ) && - nDist == rBox.GetDistance( BOX_LINE_RIGHT )) - OutBorderLine( rRTFWrt, rBox.GetTop(), OOO_STRING_SVTOOLS_RTF_BOX, nDist ); - else - { - const USHORT* pBrd = aBorders; - const sal_Char** pBrdNms = (const sal_Char**)aBorderNames; - for(int i = 0; i < 4; ++i, ++pBrd, ++pBrdNms) - { - if (const SvxBorderLine* pLn = rBox.GetLine(*pBrd)) - { - OutBorderLine(rRTFWrt, pLn, *pBrdNms, - rBox.GetDistance(*pBrd)); - } - } - } - } - - const USHORT* pBrd = aBorders; - const sal_Char** pBrdNms = (const sal_Char**)aBorderNames; - for( int i = 0; i < 4; ++i, ++pBrd, ++pBrdNms ) - { - const SvxBorderLine* pLn = rBox.GetLine( *pBrd ); - if( pLn ) - { - rWrt.Strm() << '{' << OOO_STRING_SVTOOLS_RTF_IGNORE; - OutBorderLine( rRTFWrt, pLn, *pBrdNms ); - rWrt.Strm() << '}' << OOO_STRING_SVTOOLS_RTF_BRSP; - rWrt.OutULong( rBox.GetDistance( *pBrd )); - } - } - - rRTFWrt.bOutFmtAttr = FALSE; - return rWrt; -} - -static Writer& OutRTF_SwFmtCol( Writer& rWrt, const SfxPoolItem& rHt ) -{ - SwRTFWriter& rRTFWrt = ((SwRTFWriter&)rWrt); - if( rRTFWrt.pFlyFmt && rRTFWrt.bRTFFlySyntax ) - return rWrt; - - const SwFmtCol& rCol = (const SwFmtCol&)rHt; - const SwColumns& rColumns = rCol.GetColumns(); - - USHORT nCols = rColumns.Count(); - if( 1 < nCols ) - { - // dann besorge mal die Seitenbreite ohne Raender !! - const SwFrmFmt* pFmt; - - if( rRTFWrt.pFlyFmt ) - pFmt = rRTFWrt.pFlyFmt; - else if( rRTFWrt.pAktPageDesc ) - pFmt = &rRTFWrt.pAktPageDesc->GetMaster(); - else - pFmt = &const_cast<const SwDoc *>(rWrt.pDoc) - ->GetPageDesc(0).GetMaster(); - - const SvxLRSpaceItem& rLR = pFmt->GetLRSpace(); - - USHORT nPageSize = static_cast< USHORT >( pFmt->GetFrmSize().GetWidth() - - rLR.GetLeft() - rLR.GetRight() ); - - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_COLS; - rWrt.OutLong( nCols ); - - if( rCol.IsOrtho() ) - { - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_COLSX; - rWrt.OutLong( rCol.GetGutterWidth( TRUE ) ); - } - else - for( USHORT n = 0; n < nCols; ) - { - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_COLNO; - rWrt.OutLong( n+1 ); - - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_COLW; - rWrt.OutLong( rCol.CalcPrtColWidth( n, nPageSize ) ); - if( ++n != nCols ) - { - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_COLSR; - rWrt.OutLong( rColumns[ n-1 ]->GetRight() + - rColumns[ n ]->GetLeft() ); - } - } - ((SwRTFWriter&)rWrt).bOutFmtAttr = TRUE; - } - return rWrt; -} - -static Writer& OutRTF_SvxFmtKeep( Writer& rWrt, const SfxPoolItem& rHt ) -{ - const SvxFmtKeepItem& rItem = (const SvxFmtKeepItem&)rHt; - if( rItem.GetValue() ) - { - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_KEEPN; - ((SwRTFWriter&)rWrt).bOutFmtAttr = TRUE; - } - return rWrt; -} - -static Writer& OutRTF_SvxFrmDir( Writer& rWrt, const SfxPoolItem& rHt ) -{ - SwRTFWriter& rRTFWrt = ((SwRTFWriter&)rWrt); - if (rRTFWrt.pFlyFmt || rRTFWrt.bOutPageDesc) - OutSvxFrmDir(rRTFWrt, rHt); - return rWrt; -} - -/* File GRFATR.HXX */ - -static Writer& OutRTF_SwMirrorGrf( Writer& rWrt, const SfxPoolItem& rHt ) -{ - const SwMirrorGrf & rMirror = (const SwMirrorGrf&)rHt; - if( RES_MIRROR_GRAPH_DONT == rMirror.GetValue() ) - return rWrt; - - ((SwRTFWriter&)rWrt).bOutFmtAttr = TRUE; - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_IGNORE << OOO_STRING_SVTOOLS_RTF_GRFMIRROR; - rWrt.OutULong( rMirror.GetValue() ); - return rWrt; -} - -static Writer& OutRTF_SwCropGrf( Writer& rWrt, const SfxPoolItem& rHt ) -{ - const SwCropGrf & rCrop = (const SwCropGrf&)rHt; - ByteString aStr; - if( rCrop.GetLeft() ) - ( aStr += OOO_STRING_SVTOOLS_RTF_PICCROPL ) += - ByteString::CreateFromInt32( (short)rCrop.GetLeft() ); - if( rCrop.GetRight() ) - ( aStr += OOO_STRING_SVTOOLS_RTF_PICCROPR ) += - ByteString::CreateFromInt32( (short)rCrop.GetRight() ); - if( rCrop.GetTop() ) - ( aStr += OOO_STRING_SVTOOLS_RTF_PICCROPT ) += - ByteString::CreateFromInt32( (short)rCrop.GetTop() ); - if( rCrop.GetBottom() ) - ( aStr += OOO_STRING_SVTOOLS_RTF_PICCROPB ) += - ByteString::CreateFromInt32( (short)rCrop.GetBottom() ); - if( aStr.Len() ) - { - ((SwRTFWriter&)rWrt).bOutFmtAttr = TRUE; - rWrt.Strm() << aStr.GetBuffer(); - } - return rWrt; -} - - - -/* File PARATR.HXX */ - -static Writer& OutRTF_SwLineSpacing( Writer& rWrt, const SfxPoolItem& rHt ) -{ - const SvxLineSpacingItem &rLs = (const SvxLineSpacingItem&)rHt; - - switch (rLs.GetLineSpaceRule()) - { - default: - break; - case SVX_LINE_SPACE_AUTO: - case SVX_LINE_SPACE_FIX: - case SVX_LINE_SPACE_MIN: - { - ((SwRTFWriter&)rWrt).bOutFmtAttr = TRUE; - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_SL; - sal_Char cMult = '0'; - switch (rLs.GetInterLineSpaceRule()) - { - case SVX_INTER_LINE_SPACE_FIX: - // unser Durchschuss gibt es aber nicht in WW - also wie - // kommt man an die MaxLineHeight heran? - rWrt.OutLong((short)rLs.GetInterLineSpace()); - break; - case SVX_INTER_LINE_SPACE_PROP: - rWrt.OutLong((240L * rLs.GetPropLineSpace()) / 100L); - cMult = '1'; - break; - default: - if (SVX_LINE_SPACE_FIX == rLs.GetLineSpaceRule()) - rWrt.Strm() << '-'; - rWrt.OutLong( rLs.GetLineHeight() ); - break; - } - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_SLMULT << cMult; - } - break; - } - return rWrt; -} - -static Writer& OutRTF_SwAdjust( Writer& rWrt, const SfxPoolItem& rHt ) -{ - const SvxAdjustItem & rAdjust = ((const SvxAdjustItem&)rHt); - ByteString aAttr( "\\q" ); - switch( rAdjust.GetAdjust() ) - { - case SVX_ADJUST_LEFT: aAttr += 'l'; break; - case SVX_ADJUST_RIGHT: aAttr += 'r'; break; - case SVX_ADJUST_BLOCKLINE: - case SVX_ADJUST_BLOCK: aAttr += 'j'; break; - case SVX_ADJUST_CENTER: aAttr += 'c'; break; - - default: - return rWrt; // kein gueltiges Attriut, also returnen - } - ((SwRTFWriter&)rWrt).bOutFmtAttr = TRUE; - rWrt.Strm() << aAttr.GetBuffer(); - return rWrt; -} - -static Writer& OutRTF_SvxFmtSplit( Writer& rWrt, const SfxPoolItem& rHt ) -{ - const SvxFmtSplitItem& rItem = (const SvxFmtSplitItem&)rHt; - if( !rItem.GetValue() ) - { - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_KEEP; - ((SwRTFWriter&)rWrt).bOutFmtAttr = TRUE; - } - return rWrt; -} - -static Writer& OutRTF_SwTabStop( Writer& rWrt, const SfxPoolItem& rHt ) -{ - SwRTFWriter& rRTFWrt = (SwRTFWriter&)rWrt; - const SvxTabStopItem & rTStops = (const SvxTabStopItem&)rHt; - long nOffset = ((SvxLRSpaceItem&)rRTFWrt.GetItem( RES_LR_SPACE )).GetTxtLeft(); - for( USHORT n = 0; n < rTStops.Count(); n++ ) - { - const SvxTabStop & rTS = rTStops[ n ]; - if( SVX_TAB_ADJUST_DEFAULT != rTS.GetAdjustment() ) - { - BOOL bOutDecimal = TRUE; - const char* pFill = 0; - switch( rTS.GetFill() ) - { - case cDfltFillChar: - break; - - case '.': pFill = OOO_STRING_SVTOOLS_RTF_TLDOT; break; - case '_': pFill = OOO_STRING_SVTOOLS_RTF_TLUL; break; - case '-': pFill = OOO_STRING_SVTOOLS_RTF_TLTH; break; - case '=': pFill = OOO_STRING_SVTOOLS_RTF_TLEQ; break; - default: - if( !rRTFWrt.bWriteHelpFmt ) - { - OutComment( rWrt, OOO_STRING_SVTOOLS_RTF_TLSWG, FALSE ); - rWrt.OutULong( (((USHORT)rTS.GetFill()) << 8 ) + - rTS.GetDecimal() ) - << '}'; - bOutDecimal = FALSE; - } - } - if( pFill ) - rWrt.Strm() << pFill; - - if( !rRTFWrt.bWriteHelpFmt && bOutDecimal && - rTS.GetDecimal() != ((SvxTabStopItem&)*GetDfltAttr( - RES_PARATR_TABSTOP ))[ 0 ].GetDecimal() ) - { - OutComment( rWrt, OOO_STRING_SVTOOLS_RTF_TLSWG, FALSE ); - rWrt.OutULong( (((USHORT)rTS.GetFill()) << 8 ) + - rTS.GetDecimal() ) << '}'; - } - - const sal_Char* pAdjStr = 0; - switch (rTS.GetAdjustment()) - { - case SVX_TAB_ADJUST_RIGHT: - pAdjStr = OOO_STRING_SVTOOLS_RTF_TQR; - break; - case SVX_TAB_ADJUST_DECIMAL: - pAdjStr = OOO_STRING_SVTOOLS_RTF_TQDEC; - break; - case SVX_TAB_ADJUST_CENTER: - pAdjStr = OOO_STRING_SVTOOLS_RTF_TQC; - break; - default: - break; - } - if (pAdjStr) - rWrt.Strm() << pAdjStr; - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_TX; - rWrt.OutLong(rTS.GetTabPos() + nOffset); - } - } - rRTFWrt.bOutFmtAttr = TRUE; - return rWrt; -} - -static Writer& OutRTF_SwHypenZone( Writer& rWrt, const SfxPoolItem& rHt ) -{ - if( !((SwRTFWriter&)rWrt).bWriteHelpFmt ) - { - const SvxHyphenZoneItem& rAttr = (const SvxHyphenZoneItem&)rHt; - USHORT nFlags = rAttr.IsHyphen() ? 1 : 0; - if( rAttr.IsPageEnd() ) nFlags += 2; - - OutComment( rWrt, OOO_STRING_SVTOOLS_RTF_HYPHEN, FALSE ); - rWrt.OutULong( nFlags ) << OOO_STRING_SVTOOLS_RTF_HYPHLEAD; - rWrt.OutULong( rAttr.GetMinLead() ) << OOO_STRING_SVTOOLS_RTF_HYPHTRAIL; - rWrt.OutULong( rAttr.GetMinTrail() ) << OOO_STRING_SVTOOLS_RTF_HYPHMAX; - rWrt.OutULong( rAttr.GetMaxHyphens() ) << '}'; - } - return rWrt; -} - -static Writer& OutRTF_SwNumRule( Writer& rWrt, const SfxPoolItem& rHt ) -{ - SwRTFWriter& rRTFWrt = (SwRTFWriter&)rWrt; - if( !rRTFWrt.bOutListNumTxt ) - { - const SwNumRuleItem& rAttr = (const SwNumRuleItem&)rHt; - USHORT nId; - if( rAttr.GetValue().Len() && - USHRT_MAX != (nId = rRTFWrt.GetId( rAttr ) )) - { - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_LS; - rWrt.OutULong( nId ); - rRTFWrt.bOutFmtAttr = TRUE; - } - } - return rWrt; -} - -static Writer& OutRTF_SwScriptSpace( Writer& rWrt, const SfxPoolItem& rHt ) -{ - if( ((const SvxScriptSpaceItem&)rHt).GetValue() ) - { - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_ASPALPHA; - ((SwRTFWriter&)rWrt).bOutFmtAttr = TRUE; - } - return rWrt; -} -static Writer& OutRTF_SwHangPunctuation( Writer& rWrt, const SfxPoolItem& rHt ) -{ - if( !((const SvxHangingPunctuationItem&)rHt).GetValue() ) - { - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_NOOVERFLOW; - ((SwRTFWriter&)rWrt).bOutFmtAttr = TRUE; - } - return rWrt; -} -static Writer& OutRTF_SwForbiddenRule( Writer& rWrt, const SfxPoolItem& rHt ) -{ - if( !((const SvxForbiddenRuleItem&)rHt).GetValue() ) - { - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_NOCWRAP; - ((SwRTFWriter&)rWrt).bOutFmtAttr = TRUE; - } - return rWrt; -} - -static Writer& OutRTF_SwFontAlign( Writer& rWrt, const SfxPoolItem& rHt ) -{ - SwRTFWriter& rRTFWrt = (SwRTFWriter&)rWrt; - const SvxParaVertAlignItem & rAttr = (const SvxParaVertAlignItem &)rHt; - const char* pStr; - switch ( rAttr.GetValue() ) - { - case SvxParaVertAlignItem::TOP: pStr = OOO_STRING_SVTOOLS_RTF_FAHANG; break; - case SvxParaVertAlignItem::BOTTOM: pStr = OOO_STRING_SVTOOLS_RTF_FAVAR; break; - case SvxParaVertAlignItem::CENTER: pStr = OOO_STRING_SVTOOLS_RTF_FACENTER; break; - case SvxParaVertAlignItem::BASELINE: pStr = OOO_STRING_SVTOOLS_RTF_FAROMAN; break; - -// case SvxParaVertAlignItem::AUTOMATIC: - default: pStr = OOO_STRING_SVTOOLS_RTF_FAAUTO; break; - } - rWrt.Strm() << pStr; - rRTFWrt.bOutFmtAttr = TRUE; - return rWrt; -} - -/* - * lege hier die Tabellen fuer die RTF-Funktions-Pointer auf - * die Ausgabe-Funktionen an. - * Es sind lokale Strukturen, die nur innerhalb der RTF-DLL - * bekannt sein muessen. - */ - -SwAttrFnTab aRTFAttrFnTab = { -/* RES_CHRATR_CASEMAP */ OutRTF_SwCaseMap, -/* RES_CHRATR_CHARSETCOLOR */ 0, -/* RES_CHRATR_COLOR */ OutRTF_SwColor, -/* RES_CHRATR_CONTOUR */ OutRTF_SwContour, -/* RES_CHRATR_CROSSEDOUT */ OutRTF_SwCrossedOut, -/* RES_CHRATR_ESCAPEMENT */ OutRTF_SwEscapement, -/* RES_CHRATR_FONT */ OutRTF_SwFont, -/* RES_CHRATR_FONTSIZE */ OutRTF_SwSize, -/* RES_CHRATR_KERNING */ 0, // NOT USED!! OutRTF_SwKerning, -/* RES_CHRATR_LANGUAGE */ OutRTF_SwLanguage, -/* RES_CHRATR_POSTURE */ OutRTF_SwPosture, -/* RES_CHRATR_PROPORTIONALFONTSIZE*/0, -/* RES_CHRATR_SHADOWED */ OutRTF_SwShadowed, -/* RES_CHRATR_UNDERLINE */ OutRTF_SwUnderline, -/* RES_CHRATR_WEIGHT */ OutRTF_SwWeight, -/* RES_CHRATR_WORDLINEMODE */ 0, // Neu: Wortweises Unter-/Durchstreichen -/* RES_CHRATR_AUTOKERN */ 0, // Neu: Automatisches Pairkerning -/* RES_CHRATR_BLINK */ 0, // Neu: Blinkender Text -/* RES_CHRATR_NOHYPHEN */ 0, // Neu: nicht trennen -/* RES_CHRATR_NOLINEBREAK */ 0, // Neu: nicht umbrechen -/* RES_CHRATR_BACKGROUND */ OutRTF_SwChrBckgrnd, // Neu: Zeichenhintergrund -/* RES_CHRATR_CJK_FONT */ OutRTF_SwFont, -/* RES_CHRATR_CJK_FONTSIZE */ OutRTF_SwSize, -/* RES_CHRATR_CJK_LANGUAGE */ OutRTF_SwLanguage, -/* RES_CHRATR_CJK_POSTURE */ OutRTF_SwPosture, -/* RES_CHRATR_CJK_WEIGHT */ OutRTF_SwWeight, -/* RES_CHRATR_CTL_FONT */ OutRTF_SwFont, -/* RES_CHRATR_CTL_FONTSIZE */ OutRTF_SwSize, -/* RES_CHRATR_CTL_LANGUAGE */ OutRTF_SwLanguage, -/* RES_CHRATR_CTL_POSTURE */ OutRTF_SwPosture, -/* RES_CHRATR_CTL_WEIGHT */ OutRTF_SwWeight, -/* RES_CHRATR_ROTATE */ OutRTF_SwCharRotate, -/* RES_CHRATR_EMPHASIS_MARK */ OutRTF_SwEmphasisMark, -/* RES_CHRATR_TWO_LINES */ OutRTF_SwTwoInOne, -/* RES_CHRATR_SCALEW */ OutRTF_SwCharScaleW, -/* RES_CHRATR_RELIEF */ OutRTF_SwCharRelief, -/* RES_CHRATR_HIDDEN */ OutRTF_SvxCharHiddenItem, -/* RES_CHRATR_OVERLINE */ OutRTF_SwOverline, -/* RES_CHRATR_DUMMY1 */ 0, -/* RES_CHRATR_DUMMY2 */ 0, - -/* RES_TXTATR_REFMARK */ 0, // NOT USED!! OutRTF_SwRefMark, -/* RES_TXTATR_TOXMARK */ 0, // NOT USED!! OutRTF_SwTOXMark, -/* RES_TXTATR_META */ 0, -/* RES_TXTATR_METAFIELD */ 0, -/* RES_TXTATR_AUTOFMT */ OutRTF_SwTxtAutoFmt, -/* RES_TXTATR_INETFMT */ OutRTF_SwTxtINetFmt, -/* RES_TXTATR_CHARFMT */ OutRTF_SwTxtCharFmt, -/* RES_TXTATR_CJK_RUBY */ OutRTF_SwTxtRuby, -/* RES_TXTATR_UNKNOWN_CONTAINER */ 0, -/* RES_TXTATR_DUMMY5 */ 0, - -/* RES_TXTATR_FIELD */ OutRTF_SwField, -/* RES_TXTATR_FLYCNT */ OutRTF_SwFlyCntnt, -/* RES_TXTATR_FTN */ OutRTF_SwFtn, -/* RES_TXTATR_DUMMY4 */ 0, -/* RES_TXTATR_DUMMY3 */ 0, -/* RES_TXTATR_DUMMY1 */ 0, // Dummy: -/* RES_TXTATR_DUMMY2 */ 0, // Dummy: - -/* RES_PARATR_LINESPACING */ OutRTF_SwLineSpacing, -/* RES_PARATR_ADJUST */ OutRTF_SwAdjust, -/* RES_PARATR_SPLIT */ OutRTF_SvxFmtSplit, -/* RES_PARATR_WIDOWS */ 0, // NOT USED!! OutRTF_SwWidows, -/* RES_PARATR_ORPHANS */ 0, // NOT USED!! OutRTF_SwOrphans, -/* RES_PARATR_TABSTOP */ OutRTF_SwTabStop, -/* RES_PARATR_HYPHENZONE*/ OutRTF_SwHypenZone, -/* RES_PARATR_DROP */ 0, -/* RES_PARATR_REGISTER */ 0, // neu: Registerhaltigkeit -/* RES_PARATR_NUMRULE */ OutRTF_SwNumRule, -/* RES_PARATR_SCRIPTSPACE */ OutRTF_SwScriptSpace, -/* RES_PARATR_HANGINGPUNCTUATION */ OutRTF_SwHangPunctuation, -/* RES_PARATR_FORBIDDEN_RULE*/ OutRTF_SwForbiddenRule, -/* RES_PARATR_VERTALIGN */ OutRTF_SwFontAlign, -/* RES_PARATR_SNAPTOGRID*/ 0, // new -/* RES_PARATR_CONNECT_TO_BORDER */ 0, // new -/* RES_PARATR_OUTLINELEVEL */ 0, // new - outlinelevel - -/* RES_PARATR_LIST_ID */ 0, // new -/* RES_PARATR_LIST_LEVEL */ 0, // new -/* RES_PARATR_LIST_ISRESTART */ 0, // new -/* RES_PARATR_LIST_RESTARTVALUE */ 0, // new -/* RES_PARATR_LIST_ISCOUNTED */ 0, // new - -/* RES_FILL_ORDER */ 0, // NOT USED!! OutRTF_SwFillOrder, -/* RES_FRM_SIZE */ OutRTF_SwFrmSize, -/* RES_PAPER_BIN */ 0, // NOT USED!! OutRTF_SwFmtPaperBin, -/* RES_LR_SPACE */ OutRTF_SwFmtLRSpace, -/* RES_UL_SPACE */ OutRTF_SwFmtULSpace, -/* RES_PAGEDESC */ 0, -/* RES_BREAK */ 0, -/* RES_CNTNT */ 0, -/* RES_HEADER */ OutRTF_SwFmtHeader, -/* RES_FOOTER */ OutRTF_SwFmtFooter, -/* RES_PRINT */ OutRTF_SwFmtPrint, -/* RES_OPAQUE */ OutRTF_SwFmtOpaque, -/* RES_PROTECT */ OutRTF_SwFmtProtect, -/* RES_SURROUND */ OutRTF_SwFmtSurround, -/* RES_VERT_ORIENT */ OutRTF_SwFmtVertOrient, -/* RES_HORI_ORIENT */ OutRTF_SwFmtHoriOrient, -/* RES_ANCHOR */ OutRTF_SwFmtAnchor, -/* RES_BACKGROUND */ OutRTF_SwFmtBackground, -/* RES_BOX */ OutRTF_SwFmtBox, -/* RES_SHADOW */ OutRTF_SwFmtShadow, -/* RES_FRMMACRO */ 0, // NOT USED!! OutRTF_SwFmtFrmMacro, -/* RES_COL */ OutRTF_SwFmtCol, -/* RES_KEEP */ OutRTF_SvxFmtKeep, -/* RES_URL */ 0, // URL -/* RES_EDIT_IN_READONLY */ 0, -/* RES_LAYOUT_SPLIT */ 0, -/* RES_FRMATR_DUMMY1 */ 0, // Dummy: -/* RES_FRMATR_DUMMY2 */ 0, // Dummy: -/* RES_AUTO_STYLE */ 0, // Dummy: -/* RES_FRMATR_DUMMY4 */ 0, // Dummy: -/* RES_FRMATR_DUMMY5 */ 0, // Dummy: -/* RES_FRMATR_DUMMY6 */ 0, // Dummy: -/* RES_FRAMEDIR*/ OutRTF_SvxFrmDir, -/* RES_FRMATR_DUMMY8 */ 0, // Dummy: -/* RES_FRMATR_DUMMY9 */ 0, // Dummy: -/* RES_FOLLOW_TEXT_FLOW */ 0, -/* RES_WRAP_INFLUENCE_ON_OBJPOS */ 0, -/* RES_FRMATR_DUMMY2 */ 0, // Dummy: -/* RES_AUTO_STYLE */ 0, // Dummy: -/* RES_FRMATR_DUMMY4 */ 0, // Dummy: -/* RES_FRMATR_DUMMY5 */ 0, // Dummy: - -/* RES_GRFATR_MIRRORGRF */ OutRTF_SwMirrorGrf, -/* RES_GRFATR_CROPGRF */ OutRTF_SwCropGrf, -/* RES_GRFATR_ROTATION */ 0, -/* RES_GRFATR_LUMINANCE */ 0, -/* RES_GRFATR_CONTRAST */ 0, -/* RES_GRFATR_CHANNELR */ 0, -/* RES_GRFATR_CHANNELG */ 0, -/* RES_GRFATR_CHANNELB */ 0, -/* RES_GRFATR_GAMMA */ 0, -/* RES_GRFATR_INVERT */ 0, -/* RES_GRFATR_TRANSPARENCY */ 0, -/* RES_GRFATR_DRWAMODE */ 0, -/* RES_GRFATR_DUMMY1 */ 0, -/* RES_GRFATR_DUMMY2 */ 0, -/* RES_GRFATR_DUMMY3 */ 0, -/* RES_GRFATR_DUMMY4 */ 0, -/* RES_GRFATR_DUMMY5 */ 0, - -/* RES_BOXATR_FORMAT */ 0, -/* RES_BOXATR_FORMULA */ 0, -/* RES_BOXATR_VALUE */ 0, - -/* RES_UNKNOWNATR_CONTAINER */ 0 -}; - -SwNodeFnTab aRTFNodeFnTab = { -/* RES_TXTNODE */ OutRTF_SwTxtNode, -/* RES_GRFNODE */ OutRTF_SwGrfNode, -/* RES_OLENODE */ OutRTF_SwOLENode -}; - -/* vi:set tabstop=4 shiftwidth=4 expandtab: */ diff --git a/sw/source/filter/rtf/rtffly.cxx b/sw/source/filter/rtf/rtffly.cxx index 260762fbf2..d1d8efcac0 100644 --- a/sw/source/filter/rtf/rtffly.cxx +++ b/sw/source/filter/rtf/rtffly.cxx @@ -61,6 +61,7 @@ #include <txtflcnt.hxx> #include <fmtflcnt.hxx> #include <fltini.hxx> +#include <unoframe.hxx> #include <deque> #include <map> #include <utility> @@ -1293,7 +1294,7 @@ void SwRTFParser::InsPicture( const String& rGrfNm, const Graphic* pGrf, aFlySet.Put(aSurroundItem); } - SwFrmFmt* pFlyFmt = pDoc->Insert( *pPam, + SwFlyFrmFmt* pFlyFmt = pDoc->Insert( *pPam, rGrfNm, aEmptyStr, // Name der Graphic !! pGrf, &aFlySet, // Attribute fuer den FlyFrm @@ -1305,6 +1306,26 @@ void SwRTFParser::InsPicture( const String& rGrfNm, const Graphic* pGrf, _SetPictureSize( *pGrfNd, pPos->nNode, (SfxItemSet&)pFlyFmt->GetAttrSet(), pPicType ); + if( pPicType ) + { + PictPropertyNameValuePairs::const_iterator aIt = pPicType->aPropertyPairs.begin(); + PictPropertyNameValuePairs::const_iterator aEnd = pPicType->aPropertyPairs.end(); + while( aIt != aEnd) + { + if( aIt->first.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM( "wzDescription") )) + { + SwXFrame::GetOrCreateSdrObject( pFlyFmt ); + pDoc->SetFlyFrmDescription( *(pFlyFmt), aIt->second ); + } + else if( aIt->first.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM( "wzName") )) + { + SwXFrame::GetOrCreateSdrObject( pFlyFmt ); + pDoc->SetFlyFrmTitle( *(pFlyFmt), aIt->second ); + } + ++aIt; + } + } + } if( pGrfAttrSet ) diff --git a/sw/source/filter/rtf/rtfnum.cxx b/sw/source/filter/rtf/rtfnum.cxx index dc942259ca..5da220f0db 100644 --- a/sw/source/filter/rtf/rtfnum.cxx +++ b/sw/source/filter/rtf/rtfnum.cxx @@ -47,7 +47,6 @@ #include <fltini.hxx> #include <swtypes.hxx> #include <swparrtf.hxx> -#include <wrtrtf.hxx> #include <ndtxt.hxx> #include <doc.hxx> #include <docary.hxx> @@ -1126,332 +1125,3 @@ BOOL lcl_IsExportNumRule( const SwNumRule& rRule, BYTE* pEnd = 0 ) *pEnd = nEnd; return nLvl != nEnd; } - -void SwRTFWriter::OutRTFListTab() -{ - ByteString sOverrideList; - USHORT nId = 1, nTmplId = 1, n; - - // prepare the NodeNum to generate the NumString - SwNumberTree::tNumberVector aNumVector; - for( n = 0; n < MAXLEVEL; ++n ) - aNumVector.push_back(n); - BYTE aNumLvlPos[ MAXLEVEL ]; - - if( !pNumRuleTbl ) - BuildNumRuleTbl(); - - for( n = 0; n < pNumRuleTbl->Count(); ++n ) - { - const SwNumRule* pRule = (*pNumRuleTbl)[ n ]; - - // mit der ersten Rule wird auch die ListTable geschrieben - if( !sOverrideList.Len() ) - OutComment( *this, OOO_STRING_SVTOOLS_RTF_LISTTABLE ); - - Strm() << '{' << OOO_STRING_SVTOOLS_RTF_LIST << OOO_STRING_SVTOOLS_RTF_LISTTEMPLATEID; - OutULong( nTmplId ); - ByteString sTmp; - - if( pRule->IsContinusNum() ) - Strm() << OOO_STRING_SVTOOLS_RTF_LISTSIMPLE; - - BYTE nLvl, nEnd; - lcl_IsExportNumRule( *pRule, &nEnd ); - - for( nLvl = 0; nLvl < nEnd; ++nLvl ) - { - const SwNumFmt& rFmt = pRule->Get( nLvl ); - Strm() << sNewLine; - if( nLvl > 8 ) // RTF-kennt nur 9 Ebenen - OutComment( *this, OOO_STRING_SVTOOLS_RTF_SOUTLVL ); - - Strm() << '{' << OOO_STRING_SVTOOLS_RTF_LISTLEVEL << OOO_STRING_SVTOOLS_RTF_LEVELNFC; - - USHORT nVal = 0; - switch( rFmt.GetNumberingType() ) - { - case SVX_NUM_ROMAN_UPPER: nVal = 1; break; - case SVX_NUM_ROMAN_LOWER: nVal = 2; break; - case SVX_NUM_CHARS_UPPER_LETTER: - case SVX_NUM_CHARS_UPPER_LETTER_N: nVal = 3; break; - case SVX_NUM_CHARS_LOWER_LETTER: - case SVX_NUM_CHARS_LOWER_LETTER_N: nVal = 4; break; - - case SVX_NUM_BITMAP: - case SVX_NUM_CHAR_SPECIAL: nVal = 23; break; - } - OutLong( nVal ) << OOO_STRING_SVTOOLS_RTF_LEVELJC; - - switch( rFmt.GetNumAdjust() ) - { - case SVX_ADJUST_CENTER: nVal = 1; break; - case SVX_ADJUST_RIGHT: nVal = 2; break; - default: nVal = 0; break; - } - OutLong( nVal ) << OOO_STRING_SVTOOLS_RTF_LEVELSTARTAT; - OutLong( rFmt.GetStart() ) - << OOO_STRING_SVTOOLS_RTF_LEVELFOLLOW << "0{" << OOO_STRING_SVTOOLS_RTF_LEVELTEXT << ' '; - - BOOL bWriteBulletFont = FALSE; - memset( aNumLvlPos, 0, MAXLEVEL ); - if( SVX_NUM_CHAR_SPECIAL == rFmt.GetNumberingType() || - SVX_NUM_BITMAP == rFmt.GetNumberingType() ) - { - Strm() << "\\'01"; - ByteString sNo( ByteString::CreateFromInt32( rFmt.GetBulletChar())); - Strm() << "\\u" << sNo.GetBuffer() << " ?"; - bWriteBulletFont = TRUE; - } - else if( SVX_NUM_NUMBER_NONE == rFmt.GetNumberingType() ) - { - String sOut( rFmt.GetPrefix() ); sOut += rFmt.GetSuffix(); - if( sOut.Len() ) - { - Strm() << "\\'"; - OutHex( sOut.Len() ); - RTFOutFuncs::Out_String( Strm(), sOut, - eDefaultEncoding, bWriteHelpFmt ); - } - } - else - { - memset( aNumLvlPos, 0, MAXLEVEL ); - BYTE* pLvlPos = aNumLvlPos; - // --> OD 2005-11-18 #128056# - // correction of refactoring done by cws swnumtree: - // - the numbering string has to be restrict to the level - // currently working on. - String sNumStr( pRule->MakeNumString( aNumVector, FALSE, TRUE, nLvl )); - // <-- - - // now search the nums in the string - for( BYTE i = 0; i <= nLvl; ++i ) - { - String sSrch( String::CreateFromInt32( i )); - xub_StrLen nFnd = sNumStr.Search( sSrch ); - if( STRING_NOTFOUND != nFnd ) - { - *pLvlPos = (BYTE)(nFnd + rFmt.GetPrefix().Len() + 1 ); - ++pLvlPos; - sNumStr.SetChar( nFnd, (sal_Unicode)i ); - } - } - - Strm() << "\\'"; - OutHex( sNumStr.Len() + rFmt.GetPrefix().Len() + - rFmt.GetSuffix().Len() ); - - if( rFmt.GetPrefix().Len() ) - RTFOutFuncs::Out_String( Strm(), rFmt.GetPrefix(), - eDefaultEncoding, bWriteHelpFmt ); - - - for( xub_StrLen x = 0; x < sNumStr.Len(); ++x ) - if( sNumStr.GetChar( x ) < 0x20 || - sNumStr.GetChar( x ) > 0xFF ) - { - Strm() << "\\'"; OutHex( sNumStr.GetChar( x ) ); - } - else - Strm() << (sal_Char)sNumStr.GetChar( x ); - - if( rFmt.GetSuffix().Len() ) - RTFOutFuncs::Out_String( Strm(), rFmt.GetSuffix(), - eDefaultEncoding, bWriteHelpFmt ); - } - - // write the levelnumbers - Strm() << ";}{" << OOO_STRING_SVTOOLS_RTF_LEVELNUMBERS; - for( BYTE i = 0; i <= nLvl && aNumLvlPos[ i ]; ++i ) - { - Strm() << "\\'"; OutHex( aNumLvlPos[ i ] ); - } - Strm() << ";}"; - - if( rFmt.GetCharFmt() ) - Out_SfxItemSet( aRTFAttrFnTab, *this, - rFmt.GetCharFmt()->GetAttrSet(), TRUE ); - - if( bWriteBulletFont ) - { - Strm() << OOO_STRING_SVTOOLS_RTF_F; - const Font* pFont = rFmt.GetBulletFont(); - if( !pFont ) - // --> OD 2006-06-27 #b6440955# - pFont = &numfunc::GetDefBulletFont(); - // <-- - OutULong( GetId( *pFont )); - } - - Strm() << OOO_STRING_SVTOOLS_RTF_FI; - OutLong( rFmt.GetFirstLineOffset() ) << OOO_STRING_SVTOOLS_RTF_LI; - OutLong( rFmt.GetAbsLSpace() ); - - Strm() << '}'; - - if( nLvl > 8 ) // RTF-kennt nur 9 Ebenen - Strm() << '}'; - } - - if( !pRule->IsAutoRule() ) - { - Strm() << '{' << OOO_STRING_SVTOOLS_RTF_LISTNAME << ' '; - RTFOutFuncs::Out_String( Strm(), pRule->GetName(), eDefaultEncoding, - bWriteHelpFmt ) << ";}" ; - } - Strm() << OOO_STRING_SVTOOLS_RTF_LISTID; - OutULong( nId ) << '}' << sNewLine; - - sTmp = '{'; - ((((((( sTmp += OOO_STRING_SVTOOLS_RTF_LISTOVERRIDE ) += - OOO_STRING_SVTOOLS_RTF_LISTID ) += ByteString::CreateFromInt32( nId )) += - OOO_STRING_SVTOOLS_RTF_LISTOVERRIDECOUNT ) += '0' ) += - OOO_STRING_SVTOOLS_RTF_LS ) += ByteString::CreateFromInt32( n )) += '}'; - sOverrideList += sTmp; - - ++nId, ++nTmplId; - } - - if( sOverrideList.Len() ) - Strm() << "}{" << OOO_STRING_SVTOOLS_RTF_LISTOVERRIDETABLE - << sOverrideList.GetBuffer() << '}' << sNewLine; -} - -USHORT SwRTFWriter::GetId( const SwNumRuleItem& rItem ) const -{ - USHORT n, nId = USHRT_MAX; - if( !pNumRuleTbl ) - { - SwRTFWriter* pThis = (SwRTFWriter*)this; - pThis->BuildNumRuleTbl(); - } - const String& rNm = rItem.GetValue(); - for( n = pNumRuleTbl->Count(); n; ) - if( (*pNumRuleTbl)[ --n ]->GetName() == rNm ) - { - nId = n; - break; - } - - return nId; -} - -USHORT SwRTFWriter::GetNumRuleId( const SwNumRule& rRule ) -{ - if( !pNumRuleTbl ) - BuildNumRuleTbl(); - SwNumRulePtr pR = (SwNumRulePtr)&rRule; - return pNumRuleTbl->GetPos( pR ); -} - -void SwRTFWriter::BuildNumRuleTbl() -{ - const SwNumRuleTbl& rListTbl = pDoc->GetNumRuleTbl(); - if( !pNumRuleTbl ) - pNumRuleTbl = new SwNumRuleTbl( (BYTE)rListTbl.Count() ); - for( USHORT n = rListTbl.Count()+1; n; ) - { - SwNumRule* pRule; - --n; - if( n == rListTbl.Count() ) - pRule = (SwNumRule*)pDoc->GetOutlineNumRule(); - else - { - pRule = rListTbl[ n ]; - if( !pDoc->IsUsed( *pRule )) - continue; - } - - if( lcl_IsExportNumRule( *pRule )) - pNumRuleTbl->Insert( pRule, pNumRuleTbl->Count() ); - } -} - -BOOL SwRTFWriter::OutListNum( const SwTxtNode& rNd ) -{ - BOOL bRet = FALSE; - const SwNumRule* pRule = rNd.GetNumRule(); - - // --> OD 2008-03-18 #refactorlists# -// if( pRule && MAXLEVEL > rNd.GetActualListLevel() ) - if( pRule && rNd.IsInList() ) - // <-- - { - // --> OD 2008-03-18 #refactorlists# - ASSERT( rNd.GetActualListLevel() >= 0 && rNd.GetActualListLevel() < MAXLEVEL, - "<SwRTFWriter::OutListNum(..)> - text node does not have valid list level. Serious defect -> please inform OD" ); - // <-- - - bOutFmtAttr = FALSE; - bOutListNumTxt = TRUE; - bRet = TRUE; - - const bool bExportNumRule = USHRT_MAX != GetNumRuleId( *pRule ); - const BYTE nLvl = static_cast< BYTE >(rNd.GetActualListLevel()); - const SwNumFmt* pFmt = pRule->GetNumFmt( nLvl ); - if( !pFmt ) - pFmt = &pRule->Get( nLvl ); - - const SfxItemSet& rNdSet = rNd.GetSwAttrSet(); - - SfxItemSet aSet( *rNdSet.GetPool(), rNdSet.GetRanges() ); - aSet.SetParent( &rNdSet ); - SvxLRSpaceItem aLR( (SvxLRSpaceItem&)rNdSet.Get( RES_LR_SPACE ) ); - aLR.SetTxtLeft( aLR.GetTxtLeft() + pFmt->GetAbsLSpace() ); - - aLR.SetTxtFirstLineOfst( pFmt->GetFirstLineOffset() ); - if ( bExportNumRule ) - Strm() << '{' << OOO_STRING_SVTOOLS_RTF_LISTTEXT << OOO_STRING_SVTOOLS_RTF_PARD << OOO_STRING_SVTOOLS_RTF_PLAIN << ' '; - - aSet.Put( aLR ); - Out_SfxItemSet( aRTFAttrFnTab, *this, aSet, TRUE ); - - if( pFmt->GetCharFmt() ) - Out_SfxItemSet( aRTFAttrFnTab, *this, - pFmt->GetCharFmt()->GetAttrSet(), TRUE ); - - { - String sTxt; - if( SVX_NUM_CHAR_SPECIAL == pFmt->GetNumberingType() || SVX_NUM_BITMAP == pFmt->GetNumberingType() ) - sTxt = pFmt->GetBulletChar(); - else - sTxt = rNd.GetNumString(); - - if( bOutFmtAttr ) - { - Strm() << ' '; - bOutFmtAttr = FALSE; - } - - if (sTxt.Len()) - { - RTFOutFuncs::Out_String(Strm(), sTxt, eDefaultEncoding, - bWriteHelpFmt); - } - - if( bExportNumRule ) - { - if( OUTLINE_RULE != pRule->GetRuleType() ) - { - Strm() << OOO_STRING_SVTOOLS_RTF_TAB << '}' << OOO_STRING_SVTOOLS_RTF_ILVL; - if( nLvl > 8 ) // RTF-kennt nur 9 Ebenen - { - OutULong( 8 ); - OutComment( *this, OOO_STRING_SVTOOLS_RTF_SOUTLVL ); - OutULong( nLvl ) << '}'; - } - else - OutULong( nLvl ); - Strm() << ' '; - } - else - Strm() << OOO_STRING_SVTOOLS_RTF_TAB << '}'; - } - else if( sTxt.Len() ) - Strm() << OOO_STRING_SVTOOLS_RTF_TAB; - } - bOutListNumTxt = FALSE; - } - return bRet; -} diff --git a/sw/source/filter/rtf/swparrtf.cxx b/sw/source/filter/rtf/swparrtf.cxx index c1d5b6ca2c..4f9b38f93c 100644 --- a/sw/source/filter/rtf/swparrtf.cxx +++ b/sw/source/filter/rtf/swparrtf.cxx @@ -179,6 +179,12 @@ ULONG RtfReader::Read( SwDoc &rDoc, const String& rBaseURL, SwPaM &rPam, const S return nRet; } +ULONG RtfReader::Read(SvStream* pStream, SwDoc& rDoc, const String& rBaseURL, SwPaM& rPam) +{ + pStrm = pStream; + return Read(rDoc, rBaseURL, rPam, rBaseURL); +} + SwRTFParser::SwRTFParser(SwDoc* pD, uno::Reference<document::XDocumentProperties> i_xDocProps, const SwPaM& rCrsr, SvStream& rIn, const String& rBaseURL, @@ -1369,6 +1375,7 @@ void SwRTFParser::ReadShapeObject() String shpTxt; bool bshpTxt=false; int txflTextFlow=0; + ::rtl::OUString sDescription, sName; while (level>0 && IsParserWorking()) @@ -1426,7 +1433,14 @@ void SwRTFParser::ReadShapeObject() { txflTextFlow=aToken.ToInt32(); } - + else if (sn.EqualsAscii("wzDescription")) + { + sDescription = aToken; + } + else if(sn.EqualsAscii("wzName")) + { + sName = aToken; + } } break; case RTF_PICT: @@ -1452,6 +1466,7 @@ void SwRTFParser::ReadShapeObject() } SkipToken(-1); + SdrObject* pSdrObject = 0; switch(shapeType) { case 202: /* Text Box */ @@ -1471,6 +1486,7 @@ void SwRTFParser::ReadShapeObject() const Rectangle aRect(FRound(aRange.getMinX()), FRound(aRange.getMinY()), FRound(aRange.getMaxX()), FRound(aRange.getMaxY())); SdrRectObj* pStroke = new SdrRectObj(aRect); + pSdrObject = pStroke; pStroke->SetSnapRect(aRect); pDoc->GetOrCreateDrawModel(); // create model InsertShpObject(pStroke, this->nZOrder++); @@ -1518,6 +1534,7 @@ void SwRTFParser::ReadShapeObject() aLine.append(aPointRightBottom); SdrPathObj* pStroke = new SdrPathObj(OBJ_PLIN, ::basegfx::B2DPolyPolygon(aLine)); + pSdrObject = pStroke; //pStroke->SetSnapRect(aRect); InsertShpObject(pStroke, this->nZOrder++); @@ -1538,11 +1555,17 @@ void SwRTFParser::ReadShapeObject() const Rectangle aRect(FRound(aRange.getMinX()), FRound(aRange.getMinY()), FRound(aRange.getMaxX()), FRound(aRange.getMaxY())); SdrRectObj* pStroke = new SdrGrafObj(aGrf); + pSdrObject = pStroke; pStroke->SetSnapRect(aRect); InsertShpObject(pStroke, this->nZOrder++); } } + if( pSdrObject ) + { + pSdrObject->SetDescription(sDescription); + pSdrObject->SetTitle(sName); + } } extern void sw3io_ConvertFromOldField( SwDoc& rDoc, USHORT& rWhich, @@ -1605,14 +1628,29 @@ void SwRTFParser::NextToken( int nToken ) switch( nToken ) { case RTF_FOOTNOTE: + { //We can only insert a footnote if we're not inside a footnote. e.g. //#i7713# - if (!mbIsFootnote) + + // in insert mode it's also possible to be inside of a footnote! + bool bInsertIntoFootnote = false; + if( !IsNewDoc() ) + { + SwStartNode* pSttNode = pPam->GetNode()->StartOfSectionNode(); + while(pSttNode && pSttNode->IsSectionNode()) + { + pSttNode = pSttNode->StartOfSectionNode(); + } + if( SwFootnoteStartNode == pSttNode->GetStartNodeType() ) + bInsertIntoFootnote = true; + } + if (!mbIsFootnote && !bInsertIntoFootnote) { ReadHeaderFooter( nToken ); SkipToken( -1 ); // Klammer wieder zurueck } - break; + } + break; case RTF_SWG_PRTDATA: ReadPrtData(); break; @@ -3603,7 +3641,7 @@ void SwRTFParser::ReadHeaderFooter( int nToken, SwPageDesc* pPageDesc ) // wurde an der Position ein Escapement aufgespannt, so entferne // das jetzt. Fussnoten sind bei uns immer hochgestellt. - SvxRTFItemStackTypePtr pTmp = aSaveStack.back(); + SvxRTFItemStackTypePtr pTmp = aSaveStack.empty() ? 0 : aSaveStack.back(); if( pTmp && pTmp->GetSttNodeIdx() == pPam->GetPoint()->nNode.GetIndex() && pTmp->GetSttCnt() == nPos ) diff --git a/sw/source/filter/rtf/swparrtf.hxx b/sw/source/filter/rtf/swparrtf.hxx index 4c8373f759..a547e29086 100644 --- a/sw/source/filter/rtf/swparrtf.hxx +++ b/sw/source/filter/rtf/swparrtf.hxx @@ -76,6 +76,8 @@ struct SvxRTFPictureType; class RtfReader: public Reader { virtual ULONG Read( SwDoc &, const String& rBaseURL, SwPaM &,const String &); +public: + virtual ULONG Read( SvStream* pStrm, SwDoc &, const String& rBaseURL, SwPaM &); }; class SwNodeIdx : public SvxNodeIdx diff --git a/sw/source/filter/rtf/wrtrtf.cxx b/sw/source/filter/rtf/wrtrtf.cxx deleted file mode 100644 index c9a67deeb5..0000000000 --- a/sw/source/filter/rtf/wrtrtf.cxx +++ /dev/null @@ -1,1810 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_sw.hxx" -#include <stdlib.h> -#include <hintids.hxx> - -#include <comphelper/string.hxx> -#include <tools/stream.hxx> -#include <tools/datetime.hxx> -#include <unotools/fontcvt.hxx> -#include <rtl/tencinfo.h> -#include <svtools/rtfkeywd.hxx> -#include <svtools/rtfout.hxx> -#include <editeng/paperinf.hxx> -#include <editeng/fontitem.hxx> -#include <editeng/shaditem.hxx> -#include <editeng/brshitem.hxx> -#include <editeng/colritem.hxx> -#include <editeng/boxitem.hxx> -#include <editeng/tstpitem.hxx> -#include <editeng/ulspitem.hxx> -#include <editeng/lrspitem.hxx> -#include <editeng/frmdiritem.hxx> -#include <editeng/udlnitem.hxx> -#include <fmtpdsc.hxx> -#include <fmtcntnt.hxx> -#include <fmtfsize.hxx> -#include <fmthdft.hxx> -#include <frmatr.hxx> -#include <fmtanchr.hxx> -#include <docary.hxx> -#include <pam.hxx> -#include <doc.hxx> -#include <paratr.hxx> -#include <fldbas.hxx> -#include <ndtxt.hxx> -#include <wrtrtf.hxx> -#include <flypos.hxx> -#include <IMark.hxx> -#include <pagedesc.hxx> // fuer SwPageDesc... -#include <ftninfo.hxx> -#include <charfmt.hxx> -#include <SwStyleNameMapper.hxx> -#include <section.hxx> -#include <swtable.hxx> // fuer SwPageDesc ... -#include <swmodule.hxx> -#include <swerror.h> -#include <mdiexp.hxx> // ...Percent() -#include <statstr.hrc> // ResId fuer Statusleiste -#include <docsh.hxx> - -#include <com/sun/star/document/XDocumentProperties.hpp> -#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> - - -#if defined(UNX) -const sal_Char SwRTFWriter::sNewLine = '\012'; -#else -const sal_Char __FAR_DATA SwRTFWriter::sNewLine[] = "\015\012"; -#endif - - - -SwRTFWriter::SwRTFWriter( const String& rFltName, const String & rBaseURL ) : - eDefaultEncoding( - rtl_getTextEncodingFromWindowsCharset( - sw::ms::rtl_TextEncodingToWinCharset(DEF_ENCODING))), - eCurrentEncoding(eDefaultEncoding) -{ - SetBaseURL( rBaseURL ); - // schreibe Win-RTF-HelpFileFmt - bWriteHelpFmt = 'W' == rFltName.GetChar( 0 ); - // schreibe nur Gliederungs Absaetze - bOutOutlineOnly = 'O' == rFltName.GetChar( 0 ); - // enable non-standard tags for cut and paste - bNonStandard = '\0' == rFltName.GetChar( 0 ); -} - - -SwRTFWriter::~SwRTFWriter() -{} - - -ULONG SwRTFWriter::WriteStream() -{ - bOutPageAttr = bOutSection = TRUE; - - bOutStyleTab = bOutTable = bOutPageDesc = bOutPageDescTbl = - bAutoAttrSet = bOutListNumTxt = bOutLeftHeadFoot = bIgnoreNextPgBreak = - bTxtAttr = bAssociated = FALSE; - - nCurScript = 1; // latin - ask the doc?? - - nCurRedline = USHRT_MAX; - if(pDoc->GetRedlineTbl().Count()) - nCurRedline = 0; - - - pCurEndPosLst = 0; - nBkmkTabPos = -1; - pAktPageDesc = 0; - pAttrSet = 0; - pFlyFmt = 0; // kein FlyFrmFormat gesetzt - - pColTbl = new RTFColorTbl; - pNumRuleTbl = 0; - - BYTE nSz = (BYTE)Min( pDoc->GetSpzFrmFmts()->Count(), USHORT(255) ); - SwPosFlyFrms aFlyPos( nSz, nSz ); - - //Abkuerzung wenn nur Gliederung ausgegeben werden soll, und keine - //Gliederungsabsaetze ausserhalb des Body stehen. - if ( bOutOutlineOnly && - pDoc->GetNodes().GetOutLineNds().Count() && - pDoc->GetNodes().GetOutLineNds()[0]->GetIndex() > - pDoc->GetNodes().GetEndOfExtras().GetIndex() ) - { - nAktFlyPos = 0; - pFlyPos = 0; - MakeHeader(); - - const SwOutlineNodes &rOutLine = pDoc->GetNodes().GetOutLineNds(); - for ( USHORT i = 0; i < rOutLine.Count(); ++i ) - { - const SwNode *pNd = pDoc->GetNodes()[*rOutLine[i]]; - ASSERT( pNd->IsCntntNode(), "Outlinenode and no CntNode!?" ); - - SwCntntNode* pCNd = (SwCntntNode*)pNd; - - // erfrage den aktuellen PageDescriptor. - const SwPageDesc* pTmp = pCNd->GetSwAttrSet().GetPageDesc().GetPageDesc(); - if( pTmp ) - pAktPageDesc = pTmp; - pCurPam->GetPoint()->nContent.Assign( pCNd, 0 ); - Out( aRTFNodeFnTab, *pCNd, *this ); - } - } - else - { - long nMaxNode = pDoc->GetNodes().Count(); - - if( bShowProgress ) - ::StartProgress( STR_STATSTR_W4WWRITE, 0, nMaxNode, pDoc->GetDocShell() ); - - // Tabelle am Doc.-Anfang beachten - { - SwTableNode * pTNd = pCurPam->GetNode()->FindTableNode(); - if( pTNd && bWriteAll ) - { - // mit dem TabellenNode anfangen !! - pCurPam->GetPoint()->nNode = *pTNd; - - if( bWriteOnlyFirstTable ) - pCurPam->GetMark()->nNode = *pTNd->EndOfSectionNode(); - } - } - - // Tabelle fuer die freifliegenden Rahmen erzeugen, aber nur wenn - // das gesamte Dokument geschrieben wird - nAktFlyPos = 0; - pDoc->GetAllFlyFmts( aFlyPos, bWriteAll ? 0 : pOrigPam ); - - // sollten nur Rahmen vorhanden sein? - // (Moeglich, wenn eine Rahmen-Selektion ins Clipboard - // gestellt wurde) - if( bWriteAll && - // keine Laenge - *pCurPam->GetPoint() == *pCurPam->GetMark() && - // Rahmen vorhanden - pDoc->GetSpzFrmFmts()->Count() && !aFlyPos.Count() && - // nur ein Node im Array - pDoc->GetNodes().GetEndOfExtras().GetIndex() + 3 == - pDoc->GetNodes().GetEndOfContent().GetIndex() && - // und genau der ist selektiert - pDoc->GetNodes().GetEndOfContent().GetIndex() - 1 == - pCurPam->GetPoint()->nNode.GetIndex() ) - { - // dann den Inhalt vom Rahmen ausgeben. - // dieser steht immer an Position 0 !! - SwFrmFmt* pFmt = (*pDoc->GetSpzFrmFmts())[ 0 ]; - const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx(); - if( pIdx ) - { - SwPosFlyFrm* pFPos = new SwPosFlyFrm( pCurPam->GetPoint()->nNode, - pFmt, aFlyPos.Count() ); - aFlyPos.Insert( pFPos ); - } - } - - pFlyPos = &aFlyPos; - - // schreibe die StyleTabelle, allgemeine Angaben,Header/Footer/Footnotes - MakeHeader(); - - Out_SwDoc( pOrigPam ); - - if( bShowProgress ) - ::EndProgress( pDoc->GetDocShell() ); - } - - Strm() << '}'; - - // loesche die Tabelle mit den freifliegenden Rahmen - for( USHORT i = aFlyPos.Count(); i > 0; ) - delete aFlyPos[ --i ]; - - pFlyPos = 0; - delete pColTbl; - if( pNumRuleTbl ) - { - // don't destroy the numrule pointers in the DTOR. - pNumRuleTbl->Remove( 0, pNumRuleTbl->Count() ); - delete pNumRuleTbl; - } - delete pRedlAuthors; - - // schreibe Win-RTF-HelpFileFmt - bOutOutlineOnly = bWriteHelpFmt = FALSE; - pAttrSet = 0; - - return 0; -} - - -void SwRTFWriter::Out_SwDoc( SwPaM* pPam ) -{ - BOOL bSaveWriteAll = bWriteAll; // sichern - // suche die naechste Bookmark-Position aus der Bookmark-Tabelle - nBkmkTabPos = bWriteAll ? FindPos_Bkmk( *pCurPam->GetPoint() ) : -1; - - // gebe alle Bereiche des Pams in das RTF-File aus. - do { - bWriteAll = bSaveWriteAll; - bFirstLine = TRUE; - - // suche den ersten am Pam-auszugebenen FlyFrame - // fehlt noch: - - while( pCurPam->GetPoint()->nNode < pCurPam->GetMark()->nNode || - (pCurPam->GetPoint()->nNode == pCurPam->GetMark()->nNode && - pCurPam->GetPoint()->nContent.GetIndex() <= pCurPam->GetMark()->nContent.GetIndex()) ) - { - SwNode& rNd = pCurPam->GetPoint()->nNode.GetNode(); - - if( &rNd == &pDoc->GetNodes().GetEndOfContent() ) - break; - - if( rNd.IsCntntNode() ) - { - SwCntntNode& rCNd = (SwCntntNode&)rNd; - - OutBreaks( rCNd.GetSwAttrSet() ); - OutFlyFrm(); - - if( !bFirstLine ) - pCurPam->GetPoint()->nContent.Assign( &rCNd, 0 ); - - if( !bOutOutlineOnly || - //( rCNd.IsTxtNode() && NO_NUMBERING != //#outline level,removed by zhaojianwei - //((SwTxtNode&)rCNd).GetTxtColl()->GetOutlineLevel() )) - ( rCNd.IsTxtNode() && //->add by zhaojianwei - ((SwTxtNode&)rCNd).GetTxtColl()->IsAssignedToListLevelOfOutlineStyle()))//<-end,zhaojianwei - Out( aRTFNodeFnTab, rCNd, *this ); - - } - else if( !bOutOutlineOnly ) - { - if (rNd.IsTableNode()) - { - bool bAllOk = false; - if (const SwTableNode *pNd = rNd.GetTableNode()) - { - if (const SwFrmFmt *pFmt = pNd->GetTable().GetFrmFmt()) - { - OutBreaks(pFmt->GetAttrSet()); - bAllOk = true; - } - OutRTF_SwTblNode(*this, *pNd); - } - ASSERT(bAllOk, "Unexpected missing properties from tables"); - } - else if( rNd.IsSectionNode() ) - { - OutBreaks( ((SwSectionNode&)rNd).GetSection().GetFmt() - ->GetAttrSet() ); - OutRTF_SwSectionNode( *this, (SwSectionNode&)rNd ); - } - else if( rNd.IsEndNode() ) - CheckEndNodeForSection( rNd ); - } - - ULONG nPos = pCurPam->GetPoint()->nNode++; // Bewegen - - if( bShowProgress ) - ::SetProgressState( nPos, pDoc->GetDocShell() ); // Wie weit ? - - /* sollen nur die Selectierten Bereiche gesichert werden, so - * duerfen nur die vollstaendigen Nodes gespeichert werde, - * d.H. der 1. und n. Node teilweise, der 2. bis n-1. Node - * vollstaendig. (vollstaendig heisst mit allen Formaten! ) - */ - bWriteAll = bSaveWriteAll || - pCurPam->GetPoint()->nNode != pCurPam->GetMark()->nNode; - bFirstLine = FALSE; - } - } while( CopyNextPam( &pPam ) ); // bis alle PaM's bearbeitet - - bWriteAll = bSaveWriteAll; // wieder auf alten Wert zurueck -} - - -// schreibe die StyleTabelle, algemeine Angaben,Header/Footer/Footnotes - - -void SwRTFWriter::MakeHeader() -{ - // baue den Vorspann wie Header, ColorTbl, FontTbl - Strm() << '{' << OOO_STRING_SVTOOLS_RTF_RTF << '1' - << OOO_STRING_SVTOOLS_RTF_ANSI; - if( bWriteAll ) - { - Strm() << OOO_STRING_SVTOOLS_RTF_DEFF; - OutULong( GetId( (SvxFontItem&)pDoc->GetAttrPool().GetDefaultItem( - RES_CHRATR_FONT ) )); - } - // JP 13.02.2001 - if this not exist, MS don't understand our ansi - // characters (0x80-0xff). - Strm() << "\\adeflang1025"; - - OutRTFFontTab(); - OutRTFColorTab(); - OutRTFStyleTab(); - OutRTFListTab(); - OutRTFRevTab(); - - Strm() << SwRTFWriter::sNewLine; // ein Trenner - - // wenn teilweise ausgegeben wird, die globalen Daten nicht speichern - if( !bWriteAll ) - return; - - // Ausgeben der Doc-Info/-Statistik - OutDocInfoStat(); - - // einige globale Daten Schreiben - { // Default-TabSize - const SvxTabStopItem& rTabs = (const SvxTabStopItem&) - pDoc->GetAttrPool().GetDefaultItem( RES_PARATR_TABSTOP ); - Strm() << OOO_STRING_SVTOOLS_RTF_DEFTAB; - OutLong( rTabs[0].GetTabPos() ); - if ( !pDoc->get(IDocumentSettingAccess::USE_VIRTUAL_DEVICE) ) - Strm() << OOO_STRING_SVTOOLS_RTF_LYTPRTMET; - } - - // PageDescriptor ausgeben (??nur wenn das gesamte Dokument??) - OutPageDesc(); - - // gebe die Groesse und die Raender der Seite aus - if( pDoc->GetPageDescCnt() ) - { - //JP 06.04.99: Bug 64361 - suche den ersten SwFmtPageDesc. Ist - // keiner gesetzt, so ist der Standard gueltig - const SwFmtPageDesc* pSttPgDsc = 0; - { - const SwNode& rSttNd = *pDoc->GetNodes()[ - pDoc->GetNodes().GetEndOfExtras().GetIndex() + 2 ]; - const SfxItemSet* pSet = 0; - - if( rSttNd.IsCntntNode() ) - pSet = &rSttNd.GetCntntNode()->GetSwAttrSet(); - else if( rSttNd.IsTableNode() ) - pSet = &rSttNd.GetTableNode()->GetTable(). - GetFrmFmt()->GetAttrSet(); - else if( rSttNd.IsSectionNode() ) - pSet = &rSttNd.GetSectionNode()->GetSection(). - GetFmt()->GetAttrSet(); - - if( pSet ) - { - USHORT nPosInDoc; - pSttPgDsc = (SwFmtPageDesc*)&pSet->Get( RES_PAGEDESC ); - if( !pSttPgDsc->GetPageDesc() ) - pSttPgDsc = 0; - else if( pDoc->FindPageDescByName( pSttPgDsc-> - GetPageDesc()->GetName(), &nPosInDoc )) - { - // FALSE wegen schliessender Klammer !! - OutComment( *this, OOO_STRING_SVTOOLS_RTF_PGDSCNO, FALSE ); - OutULong( nPosInDoc ) << '}'; - } - } - } - const SwPageDesc& rPageDesc = pSttPgDsc ? *pSttPgDsc->GetPageDesc() - : const_cast<const SwDoc *>(pDoc)->GetPageDesc( 0 ); - const SwFrmFmt &rFmtPage = rPageDesc.GetMaster(); - - { - if( rPageDesc.GetLandscape() ) - Strm() << OOO_STRING_SVTOOLS_RTF_LANDSCAPE; - - const SwFmtFrmSize& rSz = rFmtPage.GetFrmSize(); - // Clipboard-Dokument wird immer ohne Drucker angelegt, so ist - // der Std.PageDesc immer aug LONG_MAX !! Mappe dann auf DIN A4 - if( LONG_MAX == rSz.GetHeight() || LONG_MAX == rSz.GetWidth() ) - { - Strm() << OOO_STRING_SVTOOLS_RTF_PAPERH; - Size a4 = SvxPaperInfo::GetPaperSize(PAPER_A4); - OutULong( a4.Height() ) << OOO_STRING_SVTOOLS_RTF_PAPERW; - OutULong( a4.Width() ); - } - else - { - Strm() << OOO_STRING_SVTOOLS_RTF_PAPERH; - OutULong( rSz.GetHeight() ) << OOO_STRING_SVTOOLS_RTF_PAPERW; - OutULong( rSz.GetWidth() ); - } - } - - { - const SvxLRSpaceItem& rLR = rFmtPage.GetLRSpace(); - Strm() << OOO_STRING_SVTOOLS_RTF_MARGL; - OutLong( rLR.GetLeft() ) << OOO_STRING_SVTOOLS_RTF_MARGR; - OutLong( rLR.GetRight() ); - } - - { - const SvxULSpaceItem& rUL = rFmtPage.GetULSpace(); - Strm() << OOO_STRING_SVTOOLS_RTF_MARGT; - OutLong( rUL.GetUpper() ) << OOO_STRING_SVTOOLS_RTF_MARGB; - OutLong( rUL.GetLower() ); - } - - Strm() << OOO_STRING_SVTOOLS_RTF_SECTD << OOO_STRING_SVTOOLS_RTF_SBKNONE; - OutRTFPageDescription( rPageDesc, FALSE, TRUE ); // Changed bCheckForFirstPage to TRUE so headers - // following title page are correctly added - i13107 - if( pSttPgDsc ) - { - bIgnoreNextPgBreak = TRUE; - pAktPageDesc = &rPageDesc; - } - } - - - { - // schreibe die Fussnoten- und Endnoten-Info raus - const SwFtnInfo& rFtnInfo = pDoc->GetFtnInfo(); - - const char* pOut = FTNPOS_CHAPTER == rFtnInfo.ePos - ? OOO_STRING_SVTOOLS_RTF_ENDDOC - : OOO_STRING_SVTOOLS_RTF_FTNBJ; - Strm() << pOut << OOO_STRING_SVTOOLS_RTF_FTNSTART; - OutLong( rFtnInfo.nFtnOffset + 1 ); - - switch( rFtnInfo.eNum ) - { - case FTNNUM_PAGE: pOut = OOO_STRING_SVTOOLS_RTF_FTNRSTPG; break; - case FTNNUM_DOC: pOut = OOO_STRING_SVTOOLS_RTF_FTNRSTCONT; break; -// case FTNNUM_CHAPTER: - default: pOut = OOO_STRING_SVTOOLS_RTF_FTNRESTART; break; - } - Strm() << pOut; - - switch( rFtnInfo.aFmt.GetNumberingType() ) - { - case SVX_NUM_CHARS_LOWER_LETTER: - case SVX_NUM_CHARS_LOWER_LETTER_N: pOut = OOO_STRING_SVTOOLS_RTF_FTNNALC; break; - case SVX_NUM_CHARS_UPPER_LETTER: - case SVX_NUM_CHARS_UPPER_LETTER_N: pOut = OOO_STRING_SVTOOLS_RTF_FTNNAUC; break; - case SVX_NUM_ROMAN_LOWER: pOut = OOO_STRING_SVTOOLS_RTF_FTNNRLC; break; - case SVX_NUM_ROMAN_UPPER: pOut = OOO_STRING_SVTOOLS_RTF_FTNNRUC; break; - case SVX_NUM_CHAR_SPECIAL: pOut = OOO_STRING_SVTOOLS_RTF_FTNNCHI; break; -// case SVX_NUM_ARABIC: - default: pOut = OOO_STRING_SVTOOLS_RTF_FTNNAR; break; - } - Strm() << pOut; - - - const SwEndNoteInfo& rEndNoteInfo = pDoc->GetEndNoteInfo(); - - Strm() << OOO_STRING_SVTOOLS_RTF_AENDDOC << OOO_STRING_SVTOOLS_RTF_AFTNRSTCONT - << OOO_STRING_SVTOOLS_RTF_AFTNSTART; - OutLong( rEndNoteInfo.nFtnOffset + 1 ); - - switch( rEndNoteInfo.aFmt.GetNumberingType() ) - { - case SVX_NUM_CHARS_LOWER_LETTER: - case SVX_NUM_CHARS_LOWER_LETTER_N: pOut = OOO_STRING_SVTOOLS_RTF_AFTNNALC; break; - case SVX_NUM_CHARS_UPPER_LETTER: - case SVX_NUM_CHARS_UPPER_LETTER_N: pOut = OOO_STRING_SVTOOLS_RTF_AFTNNAUC; break; - case SVX_NUM_ROMAN_LOWER: pOut = OOO_STRING_SVTOOLS_RTF_AFTNNRLC; break; - case SVX_NUM_ROMAN_UPPER: pOut = OOO_STRING_SVTOOLS_RTF_AFTNNRUC; break; - case SVX_NUM_CHAR_SPECIAL: pOut = OOO_STRING_SVTOOLS_RTF_AFTNNCHI; break; -// case SVX_NUM_ARABIC: - default: pOut = OOO_STRING_SVTOOLS_RTF_AFTNNAR; break; - } - Strm() << pOut; - } - - if( pDoc->_GetDBDesc().sDataSource.getLength() ) - { - // stelle erstmal fest, ob ueberhaupt Datenbankfelder benutzt werden! - const SwFldTypes* pTypes = pDoc->GetFldTypes(); - for( USHORT nCnt = pTypes->Count(); nCnt >= INIT_FLDTYPES; ) - if( RES_DBFLD == (*pTypes)[ --nCnt ]->Which() && - (*pTypes)[ nCnt ]->GetDepends() ) - { - Strm() << '{' << OOO_STRING_SVTOOLS_RTF_FIELD; - OutComment( *this, OOO_STRING_SVTOOLS_RTF_FLDINST ) << " DATA "; - SwDBData aData = pDoc->GetDBData(); - String sOut(aData.sDataSource); - sOut += DB_DELIM; - sOut += (String)aData.sCommand; - RTFOutFuncs::Out_String( Strm(), sOut, - eDefaultEncoding, bWriteHelpFmt ); - Strm() << "}{" << OOO_STRING_SVTOOLS_RTF_FLDRSLT << " }}"; - break; - } - } - - pAttrSet = 0; - - Strm() << SwRTFWriter::sNewLine; // ein Trenner -} - -void SwRTFWriter::OutInfoDateTime( const sal_Char* i_pStr, - const util::DateTime& i_rDT ) -{ - Strm() << '{' << i_pStr << OOO_STRING_SVTOOLS_RTF_YR; - OutLong( Strm(), i_rDT.Year ) << OOO_STRING_SVTOOLS_RTF_MO; - OutLong( Strm(), i_rDT.Month ) << OOO_STRING_SVTOOLS_RTF_DY; - OutLong( Strm(), i_rDT.Day ) << OOO_STRING_SVTOOLS_RTF_HR; - OutLong( Strm(), i_rDT.Hours ) << OOO_STRING_SVTOOLS_RTF_MIN; - OutLong( Strm(), i_rDT.Minutes ) << '}'; -} - -bool CharsetSufficient(const String &rString, rtl_TextEncoding eChrSet) -{ - const sal_uInt32 nFlags = - RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR | - RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR; - rtl::OString sDummy; - rtl::OUString sStr(rString); - return sStr.convertToString(&sDummy, eChrSet, nFlags); -} - -void SwRTFWriter::OutUnicodeSafeRecord(const sal_Char *pToken, - const String &rContent) -{ - if (rContent.Len()) - { - bool bNeedUnicodeWrapper = !CharsetSufficient(rContent, eDefaultEncoding); - - if (bNeedUnicodeWrapper) - Strm() << '{' << OOO_STRING_SVTOOLS_RTF_UPR; - - Strm() << '{' << pToken << ' '; - OutRTF_AsByteString(*this, rContent, eDefaultEncoding); - Strm() << '}'; - - if (bNeedUnicodeWrapper) - { - OutComment(*this, OOO_STRING_SVTOOLS_RTF_UD); - Strm() << '{' << pToken << ' '; - RTFOutFuncs::Out_String(Strm(), rContent, eDefaultEncoding, - bWriteHelpFmt); - Strm() << "}}}"; - } - - } -} - -void SwRTFWriter::OutDocInfoStat() -{ - Strm() << '{' << OOO_STRING_SVTOOLS_RTF_INFO; - - SwDocShell *pDocShell(pDoc->GetDocShell()); - uno::Reference<document::XDocumentProperties> xDocProps; - if (pDocShell) { - uno::Reference<document::XDocumentPropertiesSupplier> xDPS( - pDocShell->GetModel(), uno::UNO_QUERY_THROW); - xDocProps.set(xDPS->getDocumentProperties()); - } - - // may be null (in case of copying) - if (xDocProps.is()) - { - OutUnicodeSafeRecord(OOO_STRING_SVTOOLS_RTF_TITLE, xDocProps->getTitle()); - OutUnicodeSafeRecord(OOO_STRING_SVTOOLS_RTF_SUBJECT, xDocProps->getSubject()); - - OutUnicodeSafeRecord(OOO_STRING_SVTOOLS_RTF_KEYWORDS, - ::comphelper::string::convertCommaSeparated(xDocProps->getKeywords())); - OutUnicodeSafeRecord(OOO_STRING_SVTOOLS_RTF_DOCCOMM, xDocProps->getDescription()); - - OutUnicodeSafeRecord(OOO_STRING_SVTOOLS_RTF_AUTHOR, xDocProps->getAuthor() ); - OutInfoDateTime(OOO_STRING_SVTOOLS_RTF_CREATIM, xDocProps->getCreationDate()); - - OutUnicodeSafeRecord(OOO_STRING_SVTOOLS_RTF_AUTHOR, xDocProps->getModifiedBy() ); - OutInfoDateTime(OOO_STRING_SVTOOLS_RTF_REVTIM, xDocProps->getModificationDate()); - - OutInfoDateTime(OOO_STRING_SVTOOLS_RTF_PRINTIM, xDocProps->getPrintDate()); - - } - - // fuer interne Zwecke - Versionsnummer rausschreiben - Strm() << '{' << OOO_STRING_SVTOOLS_RTF_COMMENT << " StarWriter}{" << OOO_STRING_SVTOOLS_RTF_VERN; - OutLong( Strm(), SUPD*10 ) << '}'; - - Strm() << '}'; -} - -static void InsColor( RTFColorTbl& rTbl, const Color& rCol ) -{ - for( size_t n = 0; n < rTbl.size(); ++n ) - if( rTbl[n] == rCol ) - return; // already exists, return - - if ( COL_AUTO == rCol.GetColor() ) - { - rTbl.push_front( rCol ); - } - else - { - rTbl.push_back( rCol ); - } -} - -static void InsColorLine( RTFColorTbl& rTbl, const SvxBoxItem& rBox ) -{ - const SvxBorderLine* pLine = 0; - - if( rBox.GetTop() ) - InsColor( rTbl, (pLine = rBox.GetTop())->GetColor() ); - if( rBox.GetBottom() && pLine != rBox.GetBottom() ) - InsColor( rTbl, (pLine = rBox.GetBottom())->GetColor() ); - if( rBox.GetLeft() && pLine != rBox.GetLeft() ) - InsColor( rTbl, (pLine = rBox.GetLeft())->GetColor() ); - if( rBox.GetRight() && pLine != rBox.GetRight() ) - InsColor( rTbl, rBox.GetRight()->GetColor() ); -} - -void SwRTFWriter::OutRTFColorTab() -{ - ASSERT( pColTbl, "Where's table color?" ); - - // Build the color table from all attributes. The Colors - // included and registered in the pool are on. - size_t n; - sal_uInt32 nMaxItem; - const SfxItemPool& rPool = pDoc->GetAttrPool(); - - // the character - Color attribute - { - const SvxColorItem* pCol = (const SvxColorItem*)GetDfltAttr( - RES_CHRATR_COLOR ); - InsColor( *pColTbl, pCol->GetValue() ); - if( 0 != ( pCol = (const SvxColorItem*)rPool.GetPoolDefaultItem( - RES_CHRATR_COLOR ) )) - InsColor( *pColTbl, pCol->GetValue() ); - nMaxItem = rPool.GetItemCount2(RES_CHRATR_COLOR); - for( n = 0; n < nMaxItem; ++n ) - { - if( 0 != (pCol = (const SvxColorItem*)rPool.GetItem2( - RES_CHRATR_COLOR, n ) ) ) - InsColor( *pColTbl, pCol->GetValue() ); - } - - const SvxUnderlineItem* pUnder = (const SvxUnderlineItem*)GetDfltAttr( RES_CHRATR_UNDERLINE ); - InsColor( *pColTbl, pUnder->GetColor() ); - nMaxItem = rPool.GetItemCount2(RES_CHRATR_UNDERLINE); - for( n = 0; n < nMaxItem;n++) - { - if( 0 != (pUnder = (const SvxUnderlineItem*)rPool.GetItem2( RES_CHRATR_UNDERLINE, n ) ) ) - InsColor( *pColTbl, pUnder->GetColor() ); - - } - - const SvxOverlineItem* pOver = (const SvxOverlineItem*)GetDfltAttr( RES_CHRATR_OVERLINE ); - InsColor( *pColTbl, pOver->GetColor() ); - nMaxItem = rPool.GetItemCount2(RES_CHRATR_OVERLINE); - for( n = 0; n < nMaxItem;n++) - { - if( 0 != (pOver = (const SvxOverlineItem*)rPool.GetItem2( RES_CHRATR_OVERLINE, n ) ) ) - InsColor( *pColTbl, pOver->GetColor() ); - - } - - } - - // das Frame Hintergrund - Attribut - static const USHORT aBrushIds[] = { - RES_BACKGROUND, RES_CHRATR_BACKGROUND, 0 }; - - for( const USHORT* pIds = aBrushIds; *pIds; ++pIds ) - { - const SvxBrushItem* pBkgrd = (const SvxBrushItem*)GetDfltAttr( *pIds ); - InsColor( *pColTbl, pBkgrd->GetColor() ); - if( 0 != ( pBkgrd = (const SvxBrushItem*)rPool.GetPoolDefaultItem( - *pIds ) )) - { - InsColor( *pColTbl, pBkgrd->GetColor() ); - } - nMaxItem = rPool.GetItemCount2( *pIds ); - for( n = 0; n < nMaxItem; ++n ) - if( 0 != (pBkgrd = (const SvxBrushItem*)rPool.GetItem2( - *pIds , n ) )) - { - InsColor( *pColTbl, pBkgrd->GetColor() ); - } - } - - // das Frame Schatten - Attribut - { - const SvxShadowItem* pShadow = (const SvxShadowItem*)GetDfltAttr( - RES_SHADOW ); - InsColor( *pColTbl, pShadow->GetColor() ); - if( 0 != ( pShadow = (const SvxShadowItem*)rPool.GetPoolDefaultItem( - RES_SHADOW ) )) - { - InsColor( *pColTbl, pShadow->GetColor() ); - } - nMaxItem = rPool.GetItemCount2(RES_SHADOW); - for( n = 0; n < nMaxItem; ++n ) - if( 0 != (pShadow = (const SvxShadowItem*)rPool.GetItem2( - RES_SHADOW, n ) ) ) - { - InsColor( *pColTbl, pShadow->GetColor() ); - } - } - - // das Frame Umrandungs - Attribut - { - // Box muesste noch gemacht werden, aber default nie eine Line gesetzt! - const SvxBoxItem* pBox; - if( 0 != ( pBox = (const SvxBoxItem*)rPool.GetPoolDefaultItem( - RES_BOX ) )) - InsColorLine( *pColTbl, *pBox ); - nMaxItem = rPool.GetItemCount2(RES_BOX); - for( n = 0; n < nMaxItem; ++n ) - if( 0 != (pBox = (const SvxBoxItem*)rPool.GetItem2( RES_BOX, n ) )) - InsColorLine( *pColTbl, *pBox ); - } - - // und raus damit - Strm() << SwRTFWriter::sNewLine << '{' << OOO_STRING_SVTOOLS_RTF_COLORTBL; - - for( n = 0; n < pColTbl->size(); n++ ) - { - const Color& rCol = (*pColTbl)[ n ]; - if( n || COL_AUTO != rCol.GetColor() ) - { - Strm() << OOO_STRING_SVTOOLS_RTF_RED; - OutULong( rCol.GetRed() ) << OOO_STRING_SVTOOLS_RTF_GREEN; - OutULong( rCol.GetGreen() ) << OOO_STRING_SVTOOLS_RTF_BLUE; - OutULong( rCol.GetBlue() ); - } - Strm() << ';'; - } - Strm() << '}'; -} - -bool FontCharsetSufficient(const String &rFntNm, const String &rAltNm, - rtl_TextEncoding eChrSet) -{ - bool bRet = CharsetSufficient(rFntNm, eChrSet); - if (bRet) - bRet = CharsetSufficient(rAltNm, eChrSet); - return bRet; -} - -static void _OutFont( SwRTFWriter& rWrt, const SvxFontItem& rFont, USHORT nNo ) -{ - rWrt.Strm() << '{' << OOO_STRING_SVTOOLS_RTF_F; - - const char* pStr = OOO_STRING_SVTOOLS_RTF_FNIL; - switch (rFont.GetFamily()) - { - case FAMILY_ROMAN: - pStr = OOO_STRING_SVTOOLS_RTF_FROMAN; - break; - case FAMILY_SWISS: - pStr = OOO_STRING_SVTOOLS_RTF_FSWISS; - break; - case FAMILY_MODERN: - pStr = OOO_STRING_SVTOOLS_RTF_FMODERN; - break; - case FAMILY_SCRIPT: - pStr = OOO_STRING_SVTOOLS_RTF_FSCRIPT; - break; - case FAMILY_DECORATIVE: - pStr = OOO_STRING_SVTOOLS_RTF_FDECOR; - break; - default: - break; - } - rWrt.OutULong(nNo) << pStr << OOO_STRING_SVTOOLS_RTF_FPRQ; - - USHORT nVal = 0; - switch (rFont.GetPitch()) - { - case PITCH_FIXED: - nVal = 1; - break; - case PITCH_VARIABLE: - nVal = 2; - break; - default: - nVal = 0; - break; - } - rWrt.OutULong(nVal); - - sw::util::FontMapExport aRes(rFont.GetFamilyName()); - - /* - #i10538# - In rtf the fontname is in the fontcharset, so if that isn't possible - then bump the charset up to unicode - */ - sal_uInt8 nChSet = 0; - rtl_TextEncoding eChrSet = rFont.GetCharSet(); - nChSet = sw::ms::rtl_TextEncodingToWinCharset(eChrSet); - eChrSet = rtl_getTextEncodingFromWindowsCharset(nChSet); - if (!FontCharsetSufficient(aRes.msPrimary, aRes.msSecondary, eChrSet)) - { - eChrSet = RTL_TEXTENCODING_UNICODE; - nChSet = sw::ms::rtl_TextEncodingToWinCharset(eChrSet); - eChrSet = rtl_getTextEncodingFromWindowsCharset(nChSet); - } - - rWrt.Strm() << OOO_STRING_SVTOOLS_RTF_FCHARSET; - rWrt.OutULong( nChSet ); - rWrt.Strm() << ' '; - if (aRes.HasDistinctSecondary()) - { - RTFOutFuncs::Out_Fontname(rWrt.Strm(), aRes.msPrimary, eChrSet, - rWrt.bWriteHelpFmt); - OutComment(rWrt, OOO_STRING_SVTOOLS_RTF_FALT) << ' '; - RTFOutFuncs::Out_Fontname(rWrt.Strm(), aRes.msSecondary, eChrSet, - rWrt.bWriteHelpFmt) << '}'; - } - else - { - RTFOutFuncs::Out_Fontname(rWrt.Strm(), aRes.msPrimary, eChrSet, - rWrt.bWriteHelpFmt); - } - rWrt.Strm() << ";}"; -} - -void SwRTFWriter::OutRTFFontTab() -{ - USHORT n = 0; - const SfxItemPool& rPool = pDoc->GetAttrPool(); - const SvxFontItem* pFont = (const SvxFontItem*)GetDfltAttr(RES_CHRATR_FONT); - - Strm() << SwRTFWriter::sNewLine << '{' << OOO_STRING_SVTOOLS_RTF_FONTTBL; - _OutFont( *this, *pFont, n++ ); - - pFont = (const SvxFontItem*)rPool.GetPoolDefaultItem(RES_CHRATR_FONT); - if (pFont) - _OutFont(*this, *pFont, n++); - - PutNumFmtFontsInAttrPool(); - PutCJKandCTLFontsInAttrPool(); - - sal_uInt32 nMaxItem = rPool.GetItemCount2(RES_CHRATR_FONT); - for (sal_uInt32 nGet = 0; nGet < nMaxItem; ++nGet) - { - pFont = (const SvxFontItem*)rPool.GetItem2(RES_CHRATR_FONT, nGet); - if (pFont) - _OutFont(*this, *pFont, n++); - } - - Strm() << '}'; -} - -void RTF_WrtRedlineAuthor::Write(Writer &rWrt) -{ - SwRTFWriter & rRTFWrt = (SwRTFWriter&)rWrt; - - rRTFWrt.Strm() << '{' << OOO_STRING_SVTOOLS_RTF_IGNORE << OOO_STRING_SVTOOLS_RTF_REVTBL << ' '; - typedef std::vector<String>::iterator myiter; - - for(std::vector<String>::iterator aIter = maAuthors.begin(); aIter != maAuthors.end(); ++aIter) - { - rRTFWrt.Strm() << '{'; - // rWrt.bWriteHelpFmt - RTFOutFuncs::Out_String( rRTFWrt.Strm(), *aIter, rRTFWrt.eDefaultEncoding, rRTFWrt.bWriteHelpFmt ) << ";}"; - } - rRTFWrt.Strm() << '}' << SwRTFWriter::sNewLine; -} - -bool SwRTFWriter::OutRTFRevTab() -{ - // Writes the revision author table - int nRevAuthors = pDoc->GetRedlineTbl().Count(); - - pRedlAuthors = new RTF_WrtRedlineAuthor; - // RTF always seems to use Unknown as the default first entry - String sUnknown(RTL_CONSTASCII_STRINGPARAM("Unknown")); - pRedlAuthors->AddName(sUnknown); - - if (nRevAuthors < 1) - return false; - - // pull out all the redlines and make a vector of all the author names - for( USHORT i = 0; i < pDoc->GetRedlineTbl().Count(); ++i ) - { - const SwRedline* pRedl = pDoc->GetRedlineTbl()[ i ]; - const String sAuthor = SW_MOD()->GetRedlineAuthor( pRedl->GetAuthor() ); - pRedlAuthors->AddName(sAuthor); - } - - pRedlAuthors->Write(*this); - return true; -} - -//Takashi Ono for CJK -const rtl::OUString SwRTFWriter::XlateFmtName( const rtl::OUString &rName, SwGetPoolIdFromName eFlags ) -{ -#define RES_NONE RES_POOLCOLL_DOC_END - - static const RES_POOL_COLLFMT_TYPE aArr[]={ - RES_POOLCOLL_STANDARD, RES_POOLCOLL_HEADLINE1, RES_POOLCOLL_HEADLINE2, - RES_POOLCOLL_HEADLINE3, RES_POOLCOLL_HEADLINE4, RES_POOLCOLL_HEADLINE5, - RES_POOLCOLL_HEADLINE6, RES_POOLCOLL_HEADLINE7, RES_POOLCOLL_HEADLINE8, - RES_POOLCOLL_HEADLINE9, - - RES_POOLCOLL_TOX_IDX1, RES_POOLCOLL_TOX_IDX2, RES_POOLCOLL_TOX_IDX3, - RES_NONE, RES_NONE, RES_NONE, RES_NONE, RES_NONE, RES_NONE, - RES_POOLCOLL_TOX_CNTNT1, - - RES_POOLCOLL_TOX_CNTNT2, RES_POOLCOLL_TOX_CNTNT3, RES_POOLCOLL_TOX_CNTNT4, - RES_POOLCOLL_TOX_CNTNT5, RES_POOLCOLL_TOX_CNTNT6, RES_POOLCOLL_TOX_CNTNT7, - RES_POOLCOLL_TOX_CNTNT8, RES_POOLCOLL_TOX_CNTNT9, - RES_POOLCOLL_TEXT_IDENT, RES_POOLCOLL_FOOTNOTE, - - RES_NONE, RES_POOLCOLL_HEADER, RES_POOLCOLL_FOOTER, RES_POOLCOLL_TOX_IDXH, - RES_POOLCOLL_LABEL, RES_POOLCOLL_TOX_ILLUSH, RES_POOLCOLL_JAKETADRESS, RES_POOLCOLL_SENDADRESS, - RES_NONE, RES_NONE, - - RES_NONE, RES_NONE, RES_NONE, RES_POOLCOLL_ENDNOTE, RES_POOLCOLL_TOX_AUTHORITIESH, RES_NONE, RES_NONE, - RES_POOLCOLL_BUL_LEVEL1, RES_POOLCOLL_BUL_LEVEL1, RES_POOLCOLL_NUM_LEVEL1, - - RES_POOLCOLL_BUL_LEVEL2, RES_POOLCOLL_BUL_LEVEL3, RES_POOLCOLL_BUL_LEVEL4, RES_POOLCOLL_BUL_LEVEL5, - RES_POOLCOLL_BUL_LEVEL2, RES_POOLCOLL_BUL_LEVEL3, RES_POOLCOLL_BUL_LEVEL4, RES_POOLCOLL_BUL_LEVEL5, - RES_POOLCOLL_NUM_LEVEL2, RES_POOLCOLL_NUM_LEVEL3, RES_POOLCOLL_NUM_LEVEL4, RES_POOLCOLL_NUM_LEVEL5, - - RES_POOLCOLL_DOC_TITEL, RES_NONE, RES_POOLCOLL_SIGNATURE, RES_NONE, - RES_POOLCOLL_TEXT, RES_POOLCOLL_TEXT_MOVE, RES_NONE, RES_NONE, - - RES_NONE, RES_NONE, RES_NONE, RES_NONE, RES_POOLCOLL_DOC_SUBTITEL }; - - static const sal_Char *stiName[] = { - "Normal", "heading 1", "heading 2", - "heading 3", "heading 4", "heading 5", - "heading 6", "heading 7", "heading 8", - "heading 9", - - "index 1", "index 2", "index 3", - "index 4", "index 5", "index 6", - "index 7", "index 8", "index 9", - - "toc 1", "toc 2", "toc 3", - "toc 4", "toc 5", "toc 6", - "toc 7", "toc 8", "toc 9", - "Normal Indent", "footnote text", - - "annotation text", "header", "footer", "index heading", - "caption", "table of figures", "envelope address", "envelope return", - "footnote reference", "annotation reference", - - "line number", "page number", "endnote reference", "endnote text", "table of authorities", "macro", "toa heading", - "List", "List Bullet", "List Number", - - "List 2", "List 3", "List 4", "List 5", - "List Bullet 2", "List Bullet 3", "List Bullet 4", "List Bullet 5", - "List Number 2", "List Number 3", "List Number 4", "List Number 5", - - "Title", "Closing", "Signature", "Default Paragraph Font", - "Body Text", "Body Text Indent", "List Continue", - - "List Continue 2", "List Continue 3", "List Continue 4", "List Continue 5", "Message Header", "Subtitle"}; - - ASSERT( ( sizeof( aArr ) / sizeof( RES_POOL_COLLFMT_TYPE ) == 75 ), - "Style-UEbersetzungstabelle hat falsche Groesse" ); - ASSERT( ( sizeof( stiName ) / sizeof( *stiName ) == 75 ), - "Style-UEbersetzungstabelle hat falsche Groesse" ); - - sal_uInt16 idcol = ::SwStyleNameMapper::GetPoolIdFromUIName( rName, eFlags ); - if (idcol==USHRT_MAX) //#i40770# user defined style names get lost - return rName; - - for (size_t i = 0; i < sizeof( aArr ) / sizeof( *aArr ); i++) - { - if ( idcol == aArr[i] ) - { - return rtl::OUString::createFromAscii(stiName[i]); - } - } - return ::SwStyleNameMapper::GetProgName( idcol, String() ); -} - -void SwRTFWriter::OutRTFStyleTab() -{ - USHORT n; - - // das 0-Style ist das Default, wird nie ausgegeben !! - USHORT nArrLen = pDoc->GetTxtFmtColls()->Count(); - if( nArrLen <= 1 && pDoc->GetCharFmts()->Count() <= 1 ) - return; - - bOutStyleTab = TRUE; - Strm() << SwRTFWriter::sNewLine << '{' << OOO_STRING_SVTOOLS_RTF_STYLESHEET; - - // das Default-TextStyle wird nicht mit ausgegeben !! - for( n = 1; n < nArrLen; ++n ) - { - const SwTxtFmtColl* pColl = (*pDoc->GetTxtFmtColls())[ n ]; - pAttrSet = &pColl->GetAttrSet(); - - Strm() << '{'; - // gebe Attribute aus - OutRTF_SwFmt( *this, *pColl ); - - if( pColl->DerivedFrom() ) - // suche die Id vom "Parent" Format - for( USHORT nBasedOn=1; nBasedOn < nArrLen; nBasedOn++) - if( (*pDoc->GetTxtFmtColls())[ nBasedOn ] == - pColl->DerivedFrom() ) - { - // die Ableitung vom Format - Strm() << OOO_STRING_SVTOOLS_RTF_SBASEDON; - OutULong( nBasedOn ); - break; - } - - if( pColl == &pColl->GetNextTxtFmtColl() ) - { - Strm() << OOO_STRING_SVTOOLS_RTF_SNEXT; - OutULong( n ); - } - else - // suche die Id vom "Naechsten" Format - for( USHORT nNext=1; nNext < nArrLen; nNext++) - if( (*pDoc->GetTxtFmtColls())[ nNext ] == - &pColl->GetNextTxtFmtColl() ) - { - // die Ableitung vom Format - Strm() << OOO_STRING_SVTOOLS_RTF_SNEXT; - OutULong( nNext ); - break; - } - - //if( NO_NUMBERING != pColl->GetOutlineLevel() )//#outline level,zhaojianwei - if(pColl->IsAssignedToListLevelOfOutlineStyle())//<-end,zhaojianwei - { - Strm() << '{' << OOO_STRING_SVTOOLS_RTF_IGNORE << OOO_STRING_SVTOOLS_RTF_SOUTLVL; - //OutULong( pColl->GetOutlineLevel() ) << '}';//#outline level,zhaojianwei - OutULong( pColl->GetAssignedOutlineStyleLevel() ) << '}';//<-end,zhaojianwei - } - - Strm() << ' '; - RTFOutFuncs::Out_String( Strm(), XlateFmtName( pColl->GetName(), nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL ), eDefaultEncoding, - bWriteHelpFmt ) << ";}" << SwRTFWriter::sNewLine; - } - - USHORT nChrArrLen = pDoc->GetCharFmts()->Count(); - for( n = 1; n < nChrArrLen; ++n ) - { - const SwCharFmt* pFmt = (*pDoc->GetCharFmts())[ n ]; - pAttrSet = &pFmt->GetAttrSet(); - - Strm() << '{'; - // gebe Attribute aus - OutRTF_SwFmt( *this, *pFmt ); - - if( pFmt->DerivedFrom() ) - // suche die Id vom "Parent" Format - for( USHORT nBasedOn=1; nBasedOn < nChrArrLen; nBasedOn++) - if( (*pDoc->GetCharFmts())[ nBasedOn ] == - pFmt->DerivedFrom() ) - { - // die Ableitung vom Format - Strm() << OOO_STRING_SVTOOLS_RTF_SBASEDON; - OutULong( nArrLen + nBasedOn ); - break; - } - - Strm() << ' '; - RTFOutFuncs::Out_String( Strm(), XlateFmtName( pFmt->GetName(), nsSwGetPoolIdFromName::GET_POOLID_CHRFMT ), eDefaultEncoding, - bWriteHelpFmt ) << ";}" << SwRTFWriter::sNewLine; - } - - Strm() << '}'; - bOutStyleTab = FALSE; -} - -bool ExportAsInline(const SwFlyFrmFmt& rFlyFrmFmt) -{ - //if not an inline element (hack in our limitations here as to only - //graphics like this!!!! - return rFlyFrmFmt.GetAnchor().GetAnchorId() == FLY_AS_CHAR; -} - -void SwRTFWriter::OutRTFFlyFrms(const SwFlyFrmFmt& rFlyFrmFmt) -{ - // ein FlyFrame wurde erkannt, gebe erstmal den aus - - // Hole vom Node und vom letzten Node die Position in der Section - const SwFmtCntnt& rFlyCntnt = rFlyFrmFmt.GetCntnt(); - - ULONG nStt = rFlyCntnt.GetCntntIdx()->GetIndex()+1; - ULONG nEnd = pDoc->GetNodes()[ nStt - 1 ]->EndOfSectionIndex(); - - if( nStt >= nEnd ) // kein Bereich, also kein gueltiger Node - return; - - if (!ExportAsInline(rFlyFrmFmt)) - Strm() << SwRTFWriter::sNewLine << OOO_STRING_SVTOOLS_RTF_PARD << OOO_STRING_SVTOOLS_RTF_PLAIN; - //If we are only exporting an inline graphic/object then we - //only need the its pFlyFmt for the duration of exporting it - //for floating objects its a little more complex at the moment - const SwFlyFrmFmt *pOldFlyFmt = pFlyFmt; - pFlyFmt = &rFlyFrmFmt; - - { - RTFSaveData aSaveData( *this, nStt, nEnd ); - Out_SwDoc( pCurPam ); - } - - if (!ExportAsInline(rFlyFrmFmt)) - Strm() << OOO_STRING_SVTOOLS_RTF_PARD << SwRTFWriter::sNewLine; -//#i46098#: else - pFlyFmt = pOldFlyFmt; -} - - - -void SwRTFWriter::OutRedline( xub_StrLen nCntntPos ) -{ - const SwRedline *pCurRedline = 0; - USHORT nCount = pDoc->GetRedlineTbl().Count(); - - if (nCurRedline < nCount) - { - pCurRedline = pDoc->GetRedlineTbl()[nCurRedline]; - if(pCurRedline) - { - const SwPosition* pStartPos = pCurRedline->Start(); - const SwPosition* pEndPos = pStartPos == pCurRedline->GetPoint() - ? pCurRedline->GetMark() - : pCurRedline->GetPoint(); - - USHORT nStart = pStartPos->nContent.GetIndex(); - USHORT nEnd = pEndPos->nContent.GetIndex(); - - ULONG nCurPam = pCurPam->GetPoint()->nNode.GetIndex(); - ULONG nStartIndex = pStartPos->nNode.GetIndex(); - ULONG nEndIndex = pEndPos->nNode.GetIndex(); - const String& rStr = pCurPam->GetNode()->GetTxtNode()->GetTxt(); - xub_StrLen nEnde = rStr.Len(); - - bool bSpanRedline = (nCurPam >= nStartIndex) && (nCurPam <= nEndIndex) && (nStartIndex != nEndIndex); - - if ((bSpanRedline && nCntntPos == 0) || - (nStartIndex == nCurPam && nStart == nCntntPos)) - { - // We are at the start of a redline just need to find out which type - Strm() << '{'; - if(pCurRedline->GetType() == nsRedlineType_t::REDLINE_INSERT) - { - Strm() << OOO_STRING_SVTOOLS_RTF_REVISED; - Strm() << OOO_STRING_SVTOOLS_RTF_REVAUTH; - String sName = SW_MOD()->GetRedlineAuthor(pCurRedline->GetAuthor()); - OutLong( pRedlAuthors->AddName(sName) ); - Strm() << OOO_STRING_SVTOOLS_RTF_REVDTTM; - OutLong( sw::ms::DateTime2DTTM(pCurRedline->GetTimeStamp()) ); - Strm() << ' '; - } - else if(pCurRedline->GetType() == nsRedlineType_t::REDLINE_DELETE) - { - Strm() << OOO_STRING_SVTOOLS_RTF_DELETED; - Strm() << OOO_STRING_SVTOOLS_RTF_REVAUTHDEL; - String sDelName = SW_MOD()->GetRedlineAuthor(pCurRedline->GetAuthor()); - OutLong( pRedlAuthors->AddName(sDelName) ); - Strm() << OOO_STRING_SVTOOLS_RTF_REVDTTMDEL; - OutLong( sw::ms::DateTime2DTTM(pCurRedline->GetTimeStamp()) ); - Strm() << ' '; - } - } - - // this is either then of the end of the node or the end of the redline - // time to close off this one - if( (bSpanRedline && nCntntPos == nEnde) || - (nEndIndex == nCurPam && nEnd == nCntntPos) ) - { - Strm() << '}'; - } - - // We have come to the end of a redline move to the next one - // and use resursion to see if another redline starts here - if (nEndIndex == nCurPam && nEnd == nCntntPos) - { - nCurRedline++; - OutRedline(nCntntPos); - } - } - } -} - -void SwRTFWriter::OutBookmarks( xub_StrLen nCntntPos) -{ - IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess(); - if (-1 == nBkmkTabPos) - return; - - const ::sw::mark::IMark* pBookmark = (pMarkAccess->getMarksBegin() + nBkmkTabPos)->get(); - if(!pBookmark) - return; - - const SwPosition* pStartPos = &pBookmark->GetMarkStart(); - const SwPosition* pEndPos = &pBookmark->GetMarkEnd(); - - ASSERT(pStartPos && pEndPos, "Impossible"); - if (!(pStartPos && pEndPos)) - return; - - if (pStartPos->nNode.GetIndex() == pCurPam->GetPoint()->nNode.GetIndex() && - pStartPos->nContent.GetIndex() == nCntntPos) - { - // zur Zeit umspannt das SwBookmark keinen Bereich also kann - // es hier vollstaendig ausgegeben werden. - - // erst die SWG spezifischen Daten: - const ::sw::mark::IBookmark* const pAsBookmark = dynamic_cast< const ::sw::mark::IBookmark* >(pBookmark); - if(pAsBookmark && (pAsBookmark->GetShortName().getLength() || pAsBookmark->GetKeyCode().GetCode())) - { - OutComment( *this, OOO_STRING_SVTOOLS_RTF_BKMKKEY ); - OutULong( ( pAsBookmark->GetKeyCode().GetCode() | - pAsBookmark->GetKeyCode().GetModifier() )); - if( !pAsBookmark->GetShortName().getLength() ) - Strm() << " " ; - else - { - Strm() << ' '; - OutRTF_AsByteString( *this, pAsBookmark->GetShortName(), eDefaultEncoding ); - } - Strm() << '}'; - } - OutComment( *this, OOO_STRING_SVTOOLS_RTF_BKMKSTART ) << ' '; - RTFOutFuncs::Out_String( Strm(), pBookmark->GetName(), - eDefaultEncoding, bWriteHelpFmt ) << '}'; - } - - if (pEndPos->nNode.GetIndex() == pCurPam->GetPoint()->nNode.GetIndex() && - pEndPos->nContent.GetIndex() == nCntntPos) - { - // zur Zeit umspannt das SwBookmark keinen Bereich also kann - // es hier vollstaendig ausgegeben werden. - - // erst die SWG spezifischen Daten: - const ::sw::mark::IBookmark* const pAsBookmark = dynamic_cast< const ::sw::mark::IBookmark* >(pBookmark); - if(pAsBookmark && (pAsBookmark->GetShortName().getLength() || pAsBookmark->GetKeyCode().GetCode())) - { - OutComment( *this, OOO_STRING_SVTOOLS_RTF_BKMKKEY ); - OutULong( ( pAsBookmark->GetKeyCode().GetCode() | - pAsBookmark->GetKeyCode().GetModifier() )); - if( !pAsBookmark->GetShortName().getLength() ) - Strm() << " " ; - else - { - Strm() << ' '; - OutRTF_AsByteString( *this, pAsBookmark->GetShortName(), eDefaultEncoding ); - } - Strm() << '}'; - } - OutComment( *this, OOO_STRING_SVTOOLS_RTF_BKMKEND ) << ' '; - - { - ::rtl::OUString aEmpty; - ::rtl::OUString & rBookmarkName = aEmpty; - - if (pAsBookmark) - rBookmarkName = pAsBookmark->GetName(); - - RTFOutFuncs::Out_String( Strm(), rBookmarkName, - eDefaultEncoding, bWriteHelpFmt ) << '}'; - } - - if(++nBkmkTabPos >= pMarkAccess->getMarksCount()) - nBkmkTabPos = -1; - else - pBookmark = (pMarkAccess->getMarksBegin() + nBkmkTabPos)->get(); - } -} - -void SwRTFWriter::OutFlyFrm() -{ - USHORT n; - - if( !pFlyPos ) - return; - - // gebe alle freifliegenden Rahmen die sich auf den akt. Absatz - // und evt. auf das aktuelle Zeichen beziehen, aus. - - // suche nach dem Anfang der FlyFrames - for( n = 0; n < pFlyPos->Count() && - (*pFlyPos)[n]->GetNdIndex().GetIndex() < - pCurPam->GetPoint()->nNode.GetIndex(); ++n ) - ; - if( n < pFlyPos->Count() ) - while( n < pFlyPos->Count() && - pCurPam->GetPoint()->nNode.GetIndex() == - (*pFlyPos)[n]->GetNdIndex().GetIndex() ) - { - // den Array-Iterator weiterschalten, damit nicht doppelt - // ausgegeben wird !! - OutRTFFlyFrms( (const SwFlyFrmFmt&)(*pFlyPos)[n++]->GetFmt() ); - } -} - - -USHORT SwRTFWriter::GetId( const Color& rColor ) const -{ - ASSERT( pColTbl, "Where's color table?" ); - for( size_t n = 0; n < pColTbl->size(); n++ ) - if( rColor == (*pColTbl)[ n ] ) - return n; - - ASSERT( FALSE, "Color not exists in the pColTbl table" ); - return 0; -} - -USHORT SwRTFWriter::GetId( const SvxFontItem& rFont ) const -{ - const SfxItemPool& rPool = pDoc->GetAttrPool(); - const SvxFontItem* pFont = (const SvxFontItem*)GetDfltAttr( RES_CHRATR_FONT ); - if( rFont == *pFont ) - return 0; - - USHORT n = 1; - if( 0 != ( pFont = (const SvxFontItem*)rPool.GetPoolDefaultItem( - RES_CHRATR_FONT ))) - { - if( rFont == *pFont ) - return 1; - ++n; - } - - sal_uInt32 nMaxItem = rPool.GetItemCount2( RES_CHRATR_FONT ); - for( sal_uInt32 nGet = 0; nGet < nMaxItem; ++nGet ) - if( 0 != (pFont = (const SvxFontItem*)rPool.GetItem2( - RES_CHRATR_FONT, nGet )) ) - { - if( rFont == *pFont ) - return n; - ++n; - } - - ASSERT( FALSE, "Font nicht in der Tabelle" ); - return 0; -} - -USHORT SwRTFWriter::GetId( const Font& rFont ) const -{ - return GetId( SvxFontItem( rFont.GetFamily(), rFont.GetName(), - rFont.GetStyleName(), rFont.GetPitch(), - rFont.GetCharSet(), - RES_CHRATR_FONT ) ); -} - -USHORT SwRTFWriter::GetId( const SwTxtFmtColl& rColl ) const -{ - // suche das angegebene Format - const SvPtrarr & rArr = *pDoc->GetTxtFmtColls(); - for( USHORT n = 0; n < rArr.Count(); n++ ) - if( (SwTxtFmtColl*)rArr[ n ] == &rColl ) - return n; - ASSERT( FALSE, "TextCollection nicht in der Tabelle" ); - return 0; -} - -USHORT SwRTFWriter::GetId( const SwCharFmt& rFmt ) const -{ - // suche das angegebene Format - const SvPtrarr & rArr = *pDoc->GetCharFmts(); - for( USHORT n = 0; n < rArr.Count(); n++ ) - if( (SwCharFmt*)rArr[ n ] == &rFmt ) - return n + pDoc->GetTxtFmtColls()->Count(); - ASSERT( FALSE, "CharDFFormat nicht in der Tabelle" ); - return 0; -} - -void SwRTFWriter::OutPageDesc() -{ - // Ausgabe der Page-Descriptoren - USHORT nSize = pDoc->GetPageDescCnt(); - if( !nSize ) - return; - - Strm() << SwRTFWriter::sNewLine; // ein Trenner - bOutPageDesc = bOutPageDescTbl = TRUE; - OutComment( *this, OOO_STRING_SVTOOLS_RTF_PGDSCTBL ); - for( USHORT n = 0; n < nSize; ++n ) - { - const SwPageDesc& rPageDesc = - const_cast<const SwDoc*>(pDoc)->GetPageDesc( n ); - - Strm() << SwRTFWriter::sNewLine << '{' << OOO_STRING_SVTOOLS_RTF_PGDSC; - OutULong( n ) << OOO_STRING_SVTOOLS_RTF_PGDSCUSE; - OutULong( rPageDesc.ReadUseOn() ); - - OutRTFPageDescription( rPageDesc, FALSE, FALSE ); - - // suche den Folge-PageDescriptor: - USHORT i = nSize; - while( i ) - if( rPageDesc.GetFollow() == - &const_cast<const SwDoc *>(pDoc)->GetPageDesc( --i ) ) - break; - Strm() << OOO_STRING_SVTOOLS_RTF_PGDSCNXT; - OutULong( i ) << ' '; - RTFOutFuncs::Out_String( Strm(), XlateFmtName( rPageDesc.GetName(), nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC ), eDefaultEncoding, - bWriteHelpFmt ) << ";}"; - } - Strm() << '}' << SwRTFWriter::sNewLine; - bOutPageDesc = bOutPageDescTbl = FALSE; -} - -void SwRTFWriter::OutRTFBorder(const SvxBorderLine* aLine, const USHORT nSpace ) -{ - // M.M. This function writes out border lines in RTF similar to what - // WW8_BRC SwWW8Writer::TranslateBorderLine does in the winword filter - // Eventually it would be nice if all this functionality was in the one place - int nDistance = aLine->GetDistance(); - int nOutWidth = aLine->GetOutWidth(); - int nInWidth = aLine->GetInWidth(); - int nWidth = aLine->GetOutWidth(); - - if(nDistance == 0) // Single Line - Strm() << OOO_STRING_SVTOOLS_RTF_BRDRS; - else // Double Line - { - if(nOutWidth == nInWidth) - Strm() << OOO_STRING_SVTOOLS_RTF_BRDRDB; - else if (nOutWidth > nInWidth) - Strm() << OOO_STRING_SVTOOLS_RTF_BRDRTNTHSG; - else if (nOutWidth < nInWidth) - Strm() << OOO_STRING_SVTOOLS_RTF_BRDRTHTNSG; - } - Strm() << OOO_STRING_SVTOOLS_RTF_BRDRW; - OutULong(nWidth); - - Strm() << OOO_STRING_SVTOOLS_RTF_BRSP; - OutULong(nSpace); -} - -void SwRTFWriter::OutRTFBorders(SvxBoxItem aBox) -{ - const SvxBorderLine *pLine = aBox.GetTop(); - if(pLine) - { - Strm() << OOO_STRING_SVTOOLS_RTF_PGBRDRT; - OutRTFBorder(pLine, aBox.GetDistance(BOX_LINE_TOP)); - } - - pLine = aBox.GetBottom(); - if(pLine) - { - Strm() << OOO_STRING_SVTOOLS_RTF_PGBRDRB; - OutRTFBorder(pLine, aBox.GetDistance(BOX_LINE_BOTTOM)); - } - - pLine = aBox.GetRight(); - if(pLine) - { - Strm() << OOO_STRING_SVTOOLS_RTF_PGBRDRR; - OutRTFBorder(pLine, aBox.GetDistance(BOX_LINE_LEFT)); - } - - pLine = aBox.GetLeft(); - if(pLine) - { - Strm() << OOO_STRING_SVTOOLS_RTF_PGBRDRL; - OutRTFBorder(pLine, aBox.GetDistance(BOX_LINE_RIGHT)); - } -} - -void SwRTFWriter::OutRTFPageDescription( const SwPageDesc& rPgDsc, - BOOL bWriteReset, - BOOL bCheckForFirstPage ) -{ - // jetzt noch den Teil fuer alle anderen Applikationen: - const SwPageDesc *pSave = pAktPageDesc; - bool bOldOut = bOutPageDesc; - bool bOldHDFT = bOutLeftHeadFoot; - - // falls es einen Follow gibt, - pAktPageDesc = &rPgDsc; - if( bCheckForFirstPage && pAktPageDesc->GetFollow() && - pAktPageDesc->GetFollow() != pAktPageDesc ) - pAktPageDesc = pAktPageDesc->GetFollow(); - - bOutPageDesc = TRUE; - bOutLeftHeadFoot = FALSE; - - if( bWriteReset ) - { - if( bFirstLine && bWriteAll && - pCurPam->GetPoint()->nNode == pOrigPam->Start()->nNode ) - Strm() << OOO_STRING_SVTOOLS_RTF_SECTD << OOO_STRING_SVTOOLS_RTF_SBKNONE; - else - Strm() << OOO_STRING_SVTOOLS_RTF_SECT << OOO_STRING_SVTOOLS_RTF_SECTD; - } - - if( pAktPageDesc->GetLandscape() ) - Strm() << OOO_STRING_SVTOOLS_RTF_LNDSCPSXN; - - const SwFmt *pFmt = &pAktPageDesc->GetMaster(); //GetLeft(); - OutRTF_SwFmt( *this, *pFmt ); - - SvxBoxItem aBox = pFmt->GetAttrSet().GetBox(); - OutRTFBorders(pFmt->GetAttrSet().GetBox()); - - // falls es gesharte Heaer/Footer gibt, so gebe diese auch noch aus - if ( - (nsUseOnPage::PD_MIRROR & pAktPageDesc->GetUseOn()) && - (!pAktPageDesc->IsFooterShared() || !pAktPageDesc->IsHeaderShared()) - ) - { - bOutLeftHeadFoot = TRUE; - const SfxPoolItem* pHt; - if( !pAktPageDesc->IsHeaderShared() && - SFX_ITEM_SET == pAktPageDesc->GetLeft().GetAttrSet(). - GetItemState( RES_HEADER, FALSE, &pHt )) - OutRTF_SwFmtHeader( *this, *pHt ); - - if( !pAktPageDesc->IsFooterShared() && - SFX_ITEM_SET == pAktPageDesc->GetLeft().GetAttrSet(). - GetItemState( RES_FOOTER, FALSE, &pHt )) - OutRTF_SwFmtFooter( *this, *pHt ); - bOutLeftHeadFoot = FALSE; - } - - if( pAktPageDesc != &rPgDsc ) - { - pAktPageDesc = &rPgDsc; - Strm() << OOO_STRING_SVTOOLS_RTF_TITLEPG; - - // die Header/Footer der 1. Seite ausgeben - const SfxPoolItem* pHt; - if( SFX_ITEM_SET == pAktPageDesc->GetMaster().GetAttrSet(). - GetItemState( RES_HEADER, FALSE, &pHt )) - OutRTF_SwFmtHeader( *this, *pHt ); - - if( SFX_ITEM_SET == pAktPageDesc->GetMaster().GetAttrSet(). - GetItemState( RES_FOOTER, FALSE, &pHt )) - OutRTF_SwFmtFooter( *this, *pHt ); - } - - pAktPageDesc = pSave; - bOutPageDesc = bOldOut; - bOutLeftHeadFoot = bOldHDFT; -} - -BOOL SwRTFWriter::OutBreaks( const SfxItemSet& rSet ) -{ - // dann nie Seitenumbrueche ausgeben - BOOL bPgDscWrite = FALSE; - - if( !bOutOutlineOnly && bOutPageAttr && !bIgnoreNextPgBreak) - { - const SfxPoolItem *pItem; - if( SFX_ITEM_SET == rSet.GetItemState( RES_PAGEDESC, TRUE, &pItem ) - && ((SwFmtPageDesc*)pItem)->GetPageDesc() ) - { - const SwFmtPageDesc& rPgDsc = *(SwFmtPageDesc*)pItem; - for( USHORT nPos = pDoc->GetPageDescCnt(); nPos; ) - if( &const_cast<const SwDoc *>(pDoc) - ->GetPageDesc( --nPos ) == rPgDsc.GetPageDesc() ) - { - pAktPageDesc = ((SwFmtPageDesc*)pItem)->GetPageDesc(); - // FALSE wegen schliessender Klammer !! - OutComment( *this, OOO_STRING_SVTOOLS_RTF_PGDSCNO, FALSE ); - OutULong( nPos ) << '}'; - - // nicht weiter, in Styles gibts keine SectionControls !! - if( !bOutStyleTab ) - OutRTFPageDescription( *rPgDsc.GetPageDesc(), - TRUE, TRUE ); - bPgDscWrite = TRUE; - break; - } - } - else if( SFX_ITEM_SET == rSet.GetItemState( RES_BREAK, TRUE, &pItem ) ) - { - const SvxFmtBreakItem &rBreak = *(SvxFmtBreakItem*)pItem; - if( bWriteHelpFmt ) - { - if( SVX_BREAK_PAGE_BEFORE == rBreak.GetBreak() || - SVX_BREAK_PAGE_AFTER == rBreak.GetBreak() || - SVX_BREAK_PAGE_BOTH == rBreak.GetBreak() ) - { - bOutFmtAttr = true; - Strm() << OOO_STRING_SVTOOLS_RTF_PAGE; - } - } - else - { - switch( rBreak.GetBreak() ) - { - case SVX_BREAK_COLUMN_BEFORE: - case SVX_BREAK_COLUMN_AFTER: - case SVX_BREAK_COLUMN_BOTH: - break; - case SVX_BREAK_PAGE_BEFORE: - bOutFmtAttr = true; - Strm() << OOO_STRING_SVTOOLS_RTF_PAGE; - break; - case SVX_BREAK_PAGE_AFTER: - OutComment(*this, OOO_STRING_SVTOOLS_RTF_PGBRK, false) << "0}"; - break; - case SVX_BREAK_PAGE_BOTH: - OutComment(*this, OOO_STRING_SVTOOLS_RTF_PGBRK, false) << "1}"; - break; - default: - break; - } - } - } - } - bIgnoreNextPgBreak = false; - return bPgDscWrite; -} - - -void SwRTFWriter::CheckEndNodeForSection( const SwNode& rNd ) -{ - const SwSectionNode* pSectNd = rNd.StartOfSectionNode()->GetSectionNode(); - if( pSectNd /*&& CONTENT_SECTION == pSectNd->GetSection().GetType()*/ ) - { - const SwSectionFmt* pSectFmt = pSectNd->GetSection().GetFmt(); - - // diese Section hatte den akt. Abschnitt bestimmt - // wer bestimmt den nachsten?? - SwNodeIndex aIdx( rNd, 1 ); - pSectNd = aIdx.GetNode().GetSectionNode(); - if( !( ( pSectNd || (aIdx.GetNode().IsEndNode() && - 0 != ( pSectNd = aIdx.GetNode().StartOfSectionNode()->GetSectionNode() )) ) - /*&& CONTENT_SECTION == pSectNd->GetSection().GetType()*/ )) - { - // wer bestimmt denn nun den neuen Abschnitt? - // PageDesc oder eine uebergeordnete Section? - SwSection* pParent = pSectFmt->GetParentSection(); -// while( pParent /*&& CONTENT_SECTION != pParent->GetType()*/ ) -// pParent = pParent->GetParent(); - - if( pParent /*&& CONTENT_SECTION == pParent->GetType()*/ ) - OutRTF_SwSectionNode( *this, *pParent-> - GetFmt()->GetSectionNode( TRUE ) ); - else - { - if (! bOutPageDesc) - { - Strm() << OOO_STRING_SVTOOLS_RTF_SECT << OOO_STRING_SVTOOLS_RTF_SECTD << OOO_STRING_SVTOOLS_RTF_SBKNONE; - OutRTFPageDescription( ( pAktPageDesc - ? *pAktPageDesc - : const_cast<const SwDoc *>(pDoc) - ->GetPageDesc(0) ), - FALSE, TRUE ); - Strm() << SwRTFWriter::sNewLine; - } - } - } - // else - // weiter machen, der naechste definiert den neuen Abschnitt - } -} - -// Struktur speichert die aktuellen Daten des Writers zwischen, um -// einen anderen Dokument-Teil auszugeben, wie z.B. Header/Footer -RTFSaveData::RTFSaveData( SwRTFWriter& rWriter, ULONG nStt, ULONG nEnd ) - : rWrt( rWriter ), - pOldPam( rWrt.pCurPam ), pOldEnd( rWrt.GetEndPaM() ), - pOldFlyFmt( rWrt.pFlyFmt ), pOldPageDesc( rWrt.pAktPageDesc ), - pOldAttrSet( rWrt.GetAttrSet() ) -{ - bOldWriteAll = rWrt.bWriteAll; - bOldOutTable = rWrt.bOutTable; - bOldOutPageAttr = rWrt.bOutPageAttr; - bOldAutoAttrSet = rWrt.bAutoAttrSet; - bOldOutSection = rWrt.bOutSection; - - rWrt.pCurPam = rWrt.NewSwPaM( *rWrt.pDoc, nStt, nEnd ); - - // Tabelle in Sonderbereichen erkennen - if( nStt != rWrt.pCurPam->GetMark()->nNode.GetIndex() && - rWrt.pDoc->GetNodes()[ nStt ]->IsTableNode() ) - rWrt.pCurPam->GetMark()->nNode = nStt; - - rWrt.SetEndPaM( rWrt.pCurPam ); - rWrt.pCurPam->Exchange( ); - rWrt.bWriteAll = TRUE; - rWrt.bOutTable = FALSE; - rWrt.bOutPageAttr = FALSE; - rWrt.SetAttrSet( 0 ); - rWrt.bAutoAttrSet = FALSE; - rWrt.bOutSection = FALSE; -} - - -RTFSaveData::~RTFSaveData() -{ - delete rWrt.pCurPam; // Pam wieder loeschen - - rWrt.pCurPam = pOldPam; - rWrt.SetEndPaM( pOldEnd ); - rWrt.bWriteAll = bOldWriteAll; - rWrt.bOutTable = bOldOutTable; - rWrt.pFlyFmt = pOldFlyFmt; - rWrt.pAktPageDesc = pOldPageDesc; - rWrt.SetAttrSet( pOldAttrSet ); - rWrt.bAutoAttrSet = bOldAutoAttrSet; - rWrt.bOutPageAttr = bOldOutPageAttr; - rWrt.bOutSection = bOldOutSection; -} - -extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL ExportRTF( const String& rFltName, const String& rBaseURL, WriterRef& xRet ) -{ - xRet = new SwRTFWriter( rFltName, rBaseURL ); -} - -short SwRTFWriter::GetCurrentPageDirection() const -{ - const SwFrmFmt &rFmt = pAktPageDesc - ? pAktPageDesc->GetMaster() - : const_cast<const SwDoc *>(pDoc) - ->GetPageDesc(0).GetMaster(); - const SvxFrameDirectionItem* pItem = &rFmt.GetFrmDir(); - - if (!pItem) - { - pItem = (const SvxFrameDirectionItem*) - &pDoc->GetAttrPool().GetDefaultItem(RES_FRAMEDIR); - } - return pItem->GetValue(); -} - -short SwRTFWriter::TrueFrameDirection(const SwFrmFmt &rFlyFmt) const -{ - const SwFrmFmt *pFlyFmt2 = &rFlyFmt; - const SvxFrameDirectionItem* pItem = 0; - while (pFlyFmt2) - { - pItem = &pFlyFmt2->GetFrmDir(); - if (FRMDIR_ENVIRONMENT == pItem->GetValue()) - { - pItem = 0; - const SwFmtAnchor* pAnchor = &pFlyFmt2->GetAnchor(); - if ((FLY_AT_PAGE != pAnchor->GetAnchorId()) && - pAnchor->GetCntntAnchor() ) - { - pFlyFmt2 = pAnchor->GetCntntAnchor()->nNode. - GetNode().GetFlyFmt(); - } - else - pFlyFmt2 = 0; - } - else - pFlyFmt2 = 0; - } - - short nRet; - if (pItem) - nRet = pItem->GetValue(); - else - nRet = GetCurrentPageDirection(); - - ASSERT(nRet != FRMDIR_ENVIRONMENT, "leaving with environment direction"); - return nRet; -} - -/* vi:set tabstop=4 shiftwidth=4 expandtab: */ diff --git a/sw/source/filter/rtf/wrtrtf.hxx b/sw/source/filter/rtf/wrtrtf.hxx deleted file mode 100644 index 2cf11d16e7..0000000000 --- a/sw/source/filter/rtf/wrtrtf.hxx +++ /dev/null @@ -1,254 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#ifndef _WRTRTF_HXX -#define _WRTRTF_HXX - -#include <shellio.hxx> -#include <wrt_fn.hxx> -#include "../inc/msfilter.hxx" -#include <deque> - -#include <com/sun/star/util/DateTime.hpp> - -// einige Forward Deklarationen -class Color; -class Font; -class SvPtrarr; -class SwFmt; -class SwFlyFrmFmt; -class SwPosFlyFrms; -class SwPageDesc; -class SwTableNode; -class SwTxtFmtColl; -class SwNumRule; -class SwNumRuleTbl; -class DateTime; -class RTFEndPosLst; -class SvxBorderLine; - -extern SwAttrFnTab aRTFAttrFnTab; -extern SwNodeFnTab aRTFNodeFnTab; - -// the default text encoding for the export, if it doesn't fit unicode will -// be used -#define DEF_ENCODING RTL_TEXTENCODING_ASCII_US - -typedef std::deque<Color> RTFColorTbl; - -class RTF_WrtRedlineAuthor : public sw::util::WrtRedlineAuthor -{ - public: - virtual void Write(Writer &rWrt); -}; - -// der RTF-Writer - -class SwRTFWriter : public Writer -{ - friend class RTFEndPosLst; - - SvPtrarr* pFontRemoveLst; - RTFColorTbl* pColTbl; - SwPosFlyFrms* pFlyPos; // Pointer auf die aktuelle "FlyFrmTabelle" - RTFEndPosLst* pCurEndPosLst; - const SfxItemSet* pAttrSet; // akt. Format/Collection vom Node - // fuer den Zugriff auf einige Attribute - // z.B. Font-Size, LR-Space,.. - SwNumRuleTbl* pNumRuleTbl; // list of all exported numrules - RTF_WrtRedlineAuthor *pRedlAuthors; - - USHORT nAktFlyPos; // Index auf das naechste "FlyFrmFmt" - void OutRTFColorTab(); - void OutRTFFontTab(); - const rtl::OUString XlateFmtName( const rtl::OUString &rName, SwGetPoolIdFromName eFlags ); - void OutRTFStyleTab(); - void OutRTFListTab(); - bool OutRTFRevTab(); - - void MakeHeader(); - void OutUnicodeSafeRecord(const sal_Char *pToken, - const String &rContent); - void OutDocInfoStat(); - void OutInfoDateTime( const sal_Char*, - const ::com::sun::star::util::DateTime& ); - void CheckEndNodeForSection( const SwNode& rNd ); - - void BuildNumRuleTbl(); - - - -public: - // --- public Member -------------------------------------------------- - - USHORT nCurRedline; - - - const SwFlyFrmFmt* pFlyFmt; // liegt der Node in einem FlyFrame, - // ist das Format gesetzt, sonst 0 - const SwPageDesc* pAktPageDesc; // aktuell gesetzter PageDesc. - sal_Int32 nBkmkTabPos; // akt. Position in der Bookmark-Tabelle - USHORT nCurScript; // actual scripttype - rtl_TextEncoding eDefaultEncoding; - rtl_TextEncoding eCurrentEncoding; - -#if defined(UNX) - static const sal_Char sNewLine; // nur \012 oder \015 -#else - static const sal_Char __FAR_DATA sNewLine[]; // \015\012 -#endif - - - BOOL bFirstLine : 1; // wird die 1. Zeile ausgegeben ? - BOOL bOutFmtAttr : 1; // TRUE: beim Schreiben eines Formates - // existierte mindestens ein Attribut - BOOL bRTFFlySyntax : 1; // gebe nur original RTFSyntax aus - // (nur fuer die fliegenden Rahmen) - BOOL bOutPageDesc: 1; // gebe einen PageDescriptor aus - BOOL bOutPageDescTbl: 1; // gebe die PageDescriptor-Tabelle aus - BOOL bOutTable : 1; // gebe eine Tabelle aus - BOOL bTxtAttr : 1; // werden TextAttribute ausgegeben ? - BOOL bWriteHelpFmt : 1; // schreibe Win-RTF-HelpFileFmt - BOOL bOutStyleTab : 1; // gebe die StyleSheet-Tabelle aus - BOOL bOutPageAttr : 1; // PageDescAttribut ausgeben? - BOOL bAutoAttrSet : 1; // TRUE: pAttrSet ist harte Attributierung - // FALSE: pAttrSet ist vom Format/Collection - BOOL bOutOutlineOnly : 1; // TRUE: nur Gliederungs-Absaetze schreiben - BOOL bOutListNumTxt : 1; // TRUE: der ListNumText wird ausgegeben - BOOL bOutLeftHeadFoot : 1; // gebe vom PageDesc. den linkten - // Header/Footer aus - BOOL bOutSection : 1; // TRUE: Section PageDesc ausgeben - BOOL bIgnoreNextPgBreak : 1; // TRUE: naechsten PageDesc/Break ignorieren - BOOL bAssociated : 1; // use associated tokens - - BOOL bNonStandard : 1; // use non-standard tags (for cut and paste) - - // --- public Methoden ------------------------------------------------ - - SwRTFWriter( const String& rFilterName, const String& rBaseURL ); - virtual ~SwRTFWriter(); - virtual ULONG WriteStream(); - - void Out_SwDoc( SwPaM* ); // schreibe den makierten Bereich - - // gebe die evt. an der akt. Position stehenden FlyFrame aus. - void OutFlyFrm(); - void OutRTFFlyFrms( const SwFlyFrmFmt& ); - // gebe alle an der Position stehenden Bookmarks aus - void OutBookmarks( xub_StrLen nCntntPos ); - // gebe die PageDesc-Daten im normalen RTF-Format aus - void OutRTFPageDescription( const SwPageDesc&, BOOL , BOOL ); - void OutRTFBorders( SvxBoxItem aBox ); - void OutRTFBorder( const SvxBorderLine* aLine, const USHORT nSpace ); - BOOL OutBreaks( const SfxItemSet& rSet ); - void OutRedline( xub_StrLen nCntntPos ); - - // gebe die PageDescriptoren aus - USHORT GetId( const Color& ) const; - USHORT GetId( const SvxFontItem& ) const; - USHORT GetId( const Font& ) const; - USHORT GetId( const SwTxtFmtColl& ) const; - USHORT GetId( const SwCharFmt& ) const; - USHORT GetId( const SwNumRuleItem& rItem ) const; - - void OutPageDesc(); - - BOOL OutListNum( const SwTxtNode& rNd ); - USHORT GetNumRuleId( const SwNumRule& rRule ); - - // fuer RTFSaveData - SwPaM* GetEndPaM() { return pOrigPam; } - void SetEndPaM( SwPaM* pPam ) { pOrigPam = pPam; } - - const SfxPoolItem& GetItem( USHORT nWhich ) const; - - const SfxItemSet* GetAttrSet() const { return pAttrSet; } - void SetAttrSet( const SfxItemSet* p ) { pAttrSet = p; } - - const RTFEndPosLst* GetEndPosLst() const { return pCurEndPosLst; } - - void SetAssociatedFlag( BOOL b ) { bAssociated = b; } - BOOL IsAssociatedFlag() const { return bAssociated; } - - void SetCurrScriptType( USHORT n ) { nCurScript = n; } - USHORT GetCurrScriptType() const { return nCurScript; } - - short TrueFrameDirection(const SwFrmFmt &rFlyFmt) const; - short GetCurrentPageDirection() const; -}; - - -// Struktur speichert die aktuellen Daten des Writers zwischen, um -// einen anderen Dokument-Teil auszugeben, wie z.B. Header/Footer -// Mit den beiden USHORTs im CTOR wird ein neuer PaM erzeugt und auf -// die Position im Dokument gesetzt. -// Im Destructor werden alle Daten wieder restauriert und der angelegte -// Pam wieder geloescht. - -struct RTFSaveData -{ - SwRTFWriter& rWrt; - SwPaM* pOldPam, *pOldEnd; - const SwFlyFrmFmt* pOldFlyFmt; - const SwPageDesc* pOldPageDesc; - const SfxItemSet* pOldAttrSet; // akt. Attribute vom Node - - BOOL bOldWriteAll : 1; - BOOL bOldOutTable : 1; - BOOL bOldOutPageAttr : 1; - BOOL bOldAutoAttrSet : 1; - BOOL bOldOutSection : 1; - - RTFSaveData( SwRTFWriter&, ULONG nStt, ULONG nEnd ); - ~RTFSaveData(); -}; - - -// einige Funktions-Deklarationen -Writer& OutRTF_AsByteString( Writer& rWrt, const String& rStr, rtl_TextEncoding eEncoding); -Writer& OutRTF_SwFmt( Writer& rWrt, const SwFmt& ); -Writer& OutRTF_SwTblNode(Writer& , const SwTableNode&); -Writer& OutRTF_SwSectionNode( Writer& , SwSectionNode & ); - - -// Augabe von RTF-Bitmaps (steht im File "wrtpict.cxx") -//struct SvxRTFPictureType; -//class Bitmap; -//USHORT WriteRTFPict( const SwPictureType&, Bitmap&, SvStream& ); - -// Ausagbe von Footer-/Headers -Writer& OutRTF_SwFmtHeader( Writer& , const SfxPoolItem& ); -Writer& OutRTF_SwFmtFooter( Writer& , const SfxPoolItem& ); - -// Kommentar und zusaetzlichen String ausgeben -SvStream& OutComment( Writer& rWrt, const sal_Char* pStr ); - // zusaetzlich das bOutFmtAttr-Flag manipulieren -SvStream& OutComment( Writer& rWrt, const sal_Char* pStr, BOOL bSetFlag ); -bool ExportAsInline(const SwFlyFrmFmt& rFlyFrmFmt); - -#endif // _WRTRTF_HXX - - diff --git a/sw/source/filter/writer/makefile.mk b/sw/source/filter/writer/makefile.mk deleted file mode 100644 index d08caa9eb4..0000000000 --- a/sw/source/filter/writer/makefile.mk +++ /dev/null @@ -1,54 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=writer - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -# --- Files -------------------------------------------------------- - -CXXFILES = \ - writer.cxx \ - wrt_fn.cxx \ - wrtswtbl.cxx - -SLOFILES = \ - $(SLO)$/writer.obj \ - $(SLO)$/wrt_fn.obj \ - $(SLO)$/wrtswtbl.obj - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/filter/writer/wrtswtbl.cxx b/sw/source/filter/writer/wrtswtbl.cxx index a2eb11638d..ef33d356e6 100644 --- a/sw/source/filter/writer/wrtswtbl.cxx +++ b/sw/source/filter/writer/wrtswtbl.cxx @@ -92,7 +92,7 @@ SwWriteTableCell *SwWriteTableRow::AddCell( const SwTableBox *pBox, //----------------------------------------------------------------------- -SwWriteTableCol::SwWriteTableCol(USHORT nPosition) +SwWriteTableCol::SwWriteTableCol(sal_uInt32 nPosition) : nPos(nPosition), nWidthOpt(0), bRelWidthOpt(false), bOutWidth(true), bLeftBorder(true), bRightBorder(true) { @@ -100,13 +100,13 @@ SwWriteTableCol::SwWriteTableCol(USHORT nPosition) //----------------------------------------------------------------------- -long SwWriteTable::GetBoxWidth( const SwTableBox *pBox ) +sal_uInt32 SwWriteTable::GetBoxWidth( const SwTableBox *pBox ) { const SwFrmFmt *pFmt = pBox->GetFrmFmt(); const SwFmtFrmSize& aFrmSize= (const SwFmtFrmSize&)pFmt->GetFmtAttr( RES_FRM_SIZE ); - return aFrmSize.GetSize().Width(); + return sal::static_int_cast<sal_uInt32>(aFrmSize.GetSize().Width()); } long SwWriteTable::GetLineHeight( const SwTableLine *pLine ) @@ -306,9 +306,9 @@ USHORT SwWriteTable::MergeBoxBorders( const SwTableBox *pBox, } -USHORT SwWriteTable::GetRawWidth( USHORT nCol, USHORT nColSpan ) const +sal_uInt32 SwWriteTable::GetRawWidth( USHORT nCol, USHORT nColSpan ) const { - USHORT nWidth = aCols[nCol+nColSpan-1]->GetPos(); + sal_uInt32 nWidth = aCols[nCol+nColSpan-1]->GetPos(); if( nCol > 0 ) nWidth = nWidth - aCols[nCol-1]->GetPos(); @@ -352,7 +352,7 @@ USHORT SwWriteTable::GetRightSpace( USHORT nCol, USHORT nColSpan ) const USHORT SwWriteTable::GetAbsWidth( USHORT nCol, USHORT nColSpan ) const { - long nWidth = GetRawWidth( nCol, nColSpan ); + sal_uInt32 nWidth = GetRawWidth( nCol, nColSpan ); if( nBaseWidth != nTabWidth ) { nWidth *= nTabWidth; @@ -419,9 +419,9 @@ BOOL SwWriteTable::ShouldExpandSub(const SwTableBox *pBox, BOOL /*bExpandedBefor } void SwWriteTable::CollectTableRowsCols( long nStartRPos, - USHORT nStartCPos, + sal_uInt32 nStartCPos, long nParentLineHeight, - USHORT nParentLineWidth, + sal_uInt32 nParentLineWidth, const SwTableLines& rLines, USHORT nDepth ) { @@ -429,7 +429,7 @@ void SwWriteTable::CollectTableRowsCols( long nStartRPos, USHORT nLines = rLines.Count(); #ifdef DBG_UTIL - USHORT nEndCPos = 0; + sal_uInt32 nEndCPos = 0; #endif long nRPos = nStartRPos; @@ -484,16 +484,16 @@ void SwWriteTable::CollectTableRowsCols( long nStartRPos, const SwTableBoxes& rBoxes = pLine->GetTabBoxes(); USHORT nBoxes = rBoxes.Count(); - USHORT nCPos = nStartCPos; + sal_uInt32 nCPos = nStartCPos; for( USHORT nBox=0; nBox<nBoxes; nBox++ ) { const SwTableBox *pBox = rBoxes[nBox]; - USHORT nOldCPos = nCPos; + sal_uInt32 nOldCPos = nCPos; if( nBox < nBoxes-1 || (nParentLineWidth==0 && nLine==0) ) { - nCPos = nCPos + (USHORT)GetBoxWidth( pBox ); + nCPos = nCPos + GetBoxWidth( pBox ); SwWriteTableCol *pCol = new SwWriteTableCol( nCPos ); USHORT nCol; @@ -512,7 +512,7 @@ void SwWriteTable::CollectTableRowsCols( long nStartRPos, else { #ifdef DBG_UTIL - USHORT nCheckPos = nCPos + (USHORT)GetBoxWidth( pBox ); + sal_uInt32 nCheckPos = nCPos + GetBoxWidth( pBox ); if( !nEndCPos ) { nEndCPos = nCheckPos; @@ -550,9 +550,9 @@ void SwWriteTable::CollectTableRowsCols( long nStartRPos, void SwWriteTable::FillTableRowsCols( long nStartRPos, USHORT nStartRow, - USHORT nStartCPos, USHORT nStartCol, + sal_uInt32 nStartCPos, USHORT nStartCol, long nParentLineHeight, - USHORT nParentLineWidth, + sal_uInt32 nParentLineWidth, const SwTableLines& rLines, const SvxBrushItem* pParentBrush, USHORT nDepth, @@ -655,7 +655,7 @@ void SwWriteTable::FillTableRowsCols( long nStartRPos, USHORT nStartRow, } USHORT nBoxes = rBoxes.Count(); - USHORT nCPos = nStartCPos; + sal_uInt32 nCPos = nStartCPos; USHORT nCol = nStartCol; for( USHORT nBox=0; nBox<nBoxes; nBox++ ) @@ -663,10 +663,10 @@ void SwWriteTable::FillTableRowsCols( long nStartRPos, USHORT nStartRow, const SwTableBox *pBox = rBoxes[nBox]; // Position der letzten ueberdeckten Spalte ermitteln - USHORT nOldCPos = nCPos; + sal_uInt32 nOldCPos = nCPos; if( nBox < nBoxes-1 || (nParentLineWidth==0 && nLine==0) ) { - nCPos = nCPos + (USHORT)GetBoxWidth( pBox ); + nCPos = nCPos + GetBoxWidth( pBox ); if( nBox==nBoxes-1 ) nParentLineWidth = nCPos - nStartCPos; } @@ -768,7 +768,7 @@ void SwWriteTable::FillTableRowsCols( long nStartRPos, USHORT nStartRow, } SwWriteTable::SwWriteTable(const SwTableLines& rLines, long nWidth, - USHORT nBWidth, BOOL bRel, USHORT nMaxDepth, USHORT nLSub, USHORT nRSub, sal_uInt32 nNumOfRowsToRepeat) + sal_uInt32 nBWidth, BOOL bRel, USHORT nMaxDepth, USHORT nLSub, USHORT nRSub, sal_uInt32 nNumOfRowsToRepeat) : nBorderColor((UINT32)-1), nCellSpacing(0), nCellPadding(0), nBorder(0), nInnerBorder(0), nBaseWidth(nBWidth), nHeadEndRow(USHRT_MAX), nLeftSub(nLSub), nRightSub(nRSub), nTabWidth(nWidth), bRelWidths(bRel), @@ -779,7 +779,7 @@ SwWriteTable::SwWriteTable(const SwTableLines& rLines, long nWidth, bColsOption(false), bColTags(true), bLayoutExport(false), bCollectBorderWidth(true) { - USHORT nParentWidth = nBaseWidth + nLeftSub + nRightSub; + sal_uInt32 nParentWidth = nBaseWidth + nLeftSub + nRightSub; // Erstmal die Tabellen-Struktur festlegen. Hinter der Tabelle ist in // jedem Fall eine Spalte zu Ende diff --git a/sw/source/filter/ww1/makefile.mk b/sw/source/filter/ww1/makefile.mk deleted file mode 100644 index 4f751cbaea..0000000000 --- a/sw/source/filter/ww1/makefile.mk +++ /dev/null @@ -1,94 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=ww1 - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -.IF "$(mydebug)" != "" -CDEFS=$(CDEFS) -Dmydebug -.ENDIF - -# --- Files -------------------------------------------------------- - -EXCEPTIONSFILES= \ - $(SLO)$/w1filter.obj \ - $(SLO)$/fltshell.obj - -SLOFILES = \ - $(SLO)$/w1par.obj \ - $(SLO)$/w1class.obj \ - $(SLO)$/w1filter.obj \ - $(SLO)$/w1sprm.obj \ - $(SLO)$/fltshell.obj \ - - -# --- Targets ------------------------------------------------------- - -.INCLUDE : target.mk - -run: alltar - -#copy all relevant files to a backupdir -bak: - copy ..\inc\fltshell.hxx backup - copy *.?xx backup - copy makefile* backup - copy vcs.cfg backup - copy ..\..\..\dump1\src\dump1.cxx backup - copy ..\..\..\dump1\src\makefile backup\makefile.dmp - copy ..\..\..\WNTMSCI\bin\makefile backup\makefile.bin - copy ..\..\..\UTIL\makefile backup\makefile.utl - copy s:\solenv\inc\wnt.mak backup - -# remove this filter from libs to avoid annoying effects -upgrade: - attrib -r *.?xx - attrib -r makefile.* - del ..\..\..\WNMSCI\LIB\ww1.lib - del ..\..\..\WNMSCI\DBO\w1*.obj - del ..\..\..\WNMSCI\DBO\fltshell.obj - del ..\..\..\WNMSCI\MISC - lib /nologo /REMOVE:..\..\..\WNTMSCI\obj\fltshell.obj /out:..\..\..\WNTMSCI\LIB\filter.lib ..\..\..\WNTMSCI\LIB\filter.lib - lib /nologo /REMOVE:..\..\..\WNTMSCI\obj\w1sprm.obj /out:..\..\..\WNTMSCI\LIB\filter.lib ..\..\..\WNTMSCI\LIB\filter.lib - lib /nologo /REMOVE:..\..\..\WNTMSCI\obj\w1filter.obj /out:..\..\..\WNTMSCI\LIB\filter.lib ..\..\..\WNTMSCI\LIB\filter.lib - lib /nologo /REMOVE:..\..\..\WNTMSCI\obj\w1class.obj /out:..\..\..\WNTMSCI\LIB\filter.lib ..\..\..\WNTMSCI\LIB\filter.lib - lib /nologo /REMOVE:..\..\..\WNTMSCI\obj\w1par.obj /out:..\..\..\WNTMSCI\LIB\filter.lib ..\..\..\WNTMSCI\LIB\filter.lib - copy backup\makefile.bin ..\..\..\WNTMSCI\bin\makefile - diff backup\makefile.utl ..\..\..\UTIL\makefile - diff s:\solenv\inc\wnt.mak backup - -zip: bak - pkzip c:\temp\ww1 backup\*.* - diff --git a/sw/source/filter/ww8/README-rtf.txt b/sw/source/filter/ww8/README-rtf.txt new file mode 100644 index 0000000000..2ae4872311 --- /dev/null +++ b/sw/source/filter/ww8/README-rtf.txt @@ -0,0 +1,227 @@ + +--------------------------------------------------------------------- + +Summary of new features in RtfExport + +--------------------------------------------------------------------- + +Miklos Vajna + +<vmiklos@frugalware.org> +--------------------------------------------------------------------- + +Table of Contents + +1. Introduction + + 1.1. Terminology + 1.2. General + +2. List if fixed bugs +3. List of new features + + 3.1. Nested tables + 3.2. Character properties + 3.3. Sections + 3.4. Graphics + 3.5. Bookmarks + 3.6. Fields + 3.7. Drawing + 3.8. Form fields + 3.9. OLE objects + +4. Changes in the source code outside RTF + + +--------------------------------------------------------------------- + +1. Introduction + +--------------------------------------------------------------------- + +The biggest difference is that the new exporter is an UNO component, +and it?s based on the MSWord base classes, the vision here is that +this way much less code can achieve the same set of features, +reducing the amount of duplicated code. + + +1.1. Terminology + +-------------- + + * The "MSO OK, OOo KO" and similar abbreviations describe if the + given new feature is supported by the OOo RTF importer or it can + be tested using Microsoft Office. + * RtfExport refers to the new UNO-based exporter, RtfWriter refers + to the old built-in one. + + +1.2. General + +-------------- + +RtfWriter sometimes created documents where the first { is closed in +the middle of the document. MSO ignores this problem, but OOo stops +parsing the rest of the document if this happens, in other words +everything after such a bug is ignored. This can be reproduced by for +example parprops.odt, but it?s triggered in several other cases as +well. RtfExport has no automatic prevention for this, either - but +during development I primarily test the output with OOo, so hopefully +the bug will pop up less frequently. + + +--------------------------------------------------------------------- + +2. List if fixed bugs + +--------------------------------------------------------------------- + + * http://www.openoffice.org/issues/show_bug.cgi?id=51469 postit + fields + * http://www.openoffice.org/issues/show_bug.cgi?id=66619 page + margins + * http://www.openoffice.org/issues/show_bug.cgi?id=69856 page + numbers + * http://www.openoffice.org/issues/show_bug.cgi?id=81569 { and } in + document title + * http://www.openoffice.org/issues/show_bug.cgi?id=84703 redlines + * http://www.openoffice.org/issues/show_bug.cgi?id=91166 russian + chars + * http://www.openoffice.org/issues/show_bug.cgi?id=92673 bookmarks + across tables + * http://www.openoffice.org/issues/show_bug.cgi?id=100507 ole + object export + * http://www.openoffice.org/issues/show_bug.cgi?id=103993 same as # + 81569 just for doc comments + * http://www.openoffice.org/issues/show_bug.cgi?id=106677 + listoverride index starts at zero + * http://www.openoffice.org/issues/show_bug.cgi?id=38344 enhanced + character space + + +--------------------------------------------------------------------- + +3. List of new features + +--------------------------------------------------------------------- + + +3.1. Nested tables + +-------------- + +This was new in Word2000 and it?s now supported by RtfExport (MSO OK, +OOo KO) + + +3.2. Character properties + +-------------- + +The followings are now supported: + + * blinking (MSO OK, OOo KO) + * expanded spacing (MSO OK, OOo OK) + * pair kerning (MSO OK, OOo OK) + + +3.3. Sections + +-------------- + +RtfExport writes: + + * column breaks (MSO OK, OOo OK) + * special breaks (when the next page should be an odd or an even + page; MSO OK, OOo KO) + * the write-protected property of sections is experted properly + (MSO OK, OOo KO) + * better page numbers (inherited type from page styles, restarts; + MSO OK, OOo KO) + * line numbering (MSO OK, OOo KO) + + +3.4. Graphics + +-------------- + +PNG graphics are exported in WMF format as well, so that not only MSO +and OOo can display graphics from the output document, but Wordpad as +well. + + +3.5. Bookmarks + +-------------- + +Implicit bookmarks like reference to a footnote did not work in OOo +(one got an Error: Reference source not found message when opening +the result), this now works as expected. (MSO OK - the importer +previously autocorrected this as well, OO OK) + + +3.6. Fields + +-------------- + + * Table of contents is now written as a field, so it?s properly + read-only (MSO OK, OOo KO) + * Postit comments are now exported. (MSO OK, OOo KO) + + +3.7. Drawing + +-------------- + +Drawing objects for Word 97 through Word 2007 (shapes) are now +implemented: + + * basic shapes (rectangle, ellipse, etc.) + * lines, including free-form ones + * texts, including vertical ones and their (paragraph and + character) formatting + +(MSO OK, OOo KO) + + +3.8. Form fields + +-------------- + +All types supported by the RTF format are exported, namely: + + * text boxes + * check boxes + * list boxes + +(MSO OK, OOo KO) + + +3.9. OLE objects + +-------------- + +Their result is exported as a picture - RtfWriter did not export +anything. (MSO OK, OOo OK) + +For math, the native data is written as well, so you can edit the +object, too. (MSO OK, OOo KO) + + +--------------------------------------------------------------------- + +4. Changes in the source code outside RTF + +--------------------------------------------------------------------- + +These are refactorings I needed for RTF. To my best knowledge they do +not change the output of other filters from a user?s point of view. + + * The code that splits runs according to bookmarks is moved from + DocxExport to MSWordExportBase + * WW8_SdrAttrIter has been refactored to MSWord_SdrAttrIter + * MSWordExportBase::SubstituteBullet can avoid replacing bullets + * wwFontHelper::InitFontTable can really load all fonts + * An obvious typo in WW8AttributeOutput::CharTwoLines has been + fixed + diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx index 7f1f4ba1ff..013a493280 100644 --- a/sw/source/filter/ww8/docxexport.cxx +++ b/sw/source/filter/ww8/docxexport.cxx @@ -117,131 +117,6 @@ bool DocxExport::CollapseScriptsforWordOk( USHORT nScript, USHORT nWhich ) return true; } -bool DocxExport::GetBookmarks( const SwTxtNode& rNd, xub_StrLen nStt, - xub_StrLen nEnd, IMarkVector& rArr ) -{ - IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess(); - ULONG nNd = rNd.GetIndex( ); - - const sal_Int32 nMarks = pMarkAccess->getMarksCount(); - for ( sal_Int32 i = 0; i < nMarks; i++ ) - { - IMark* pMark = ( pMarkAccess->getMarksBegin() + i )->get(); - - // Only keep the bookmarks starting or ending in this node - if ( pMark->GetMarkStart().nNode == nNd || - pMark->GetMarkEnd().nNode == nNd ) - { - xub_StrLen nBStart = pMark->GetMarkStart().nContent.GetIndex(); - xub_StrLen nBEnd = pMark->GetMarkEnd().nContent.GetIndex(); - - // Keep only the bookmars starting or ending in the snippet - bool bIsStartOk = ( nBStart >= nStt ) && ( nBStart <= nEnd ); - bool bIsEndOk = ( nBEnd >= nStt ) && ( nBEnd <= nEnd ); - - if ( bIsStartOk || bIsEndOk ) - rArr.push_back( pMark ); - } - } - return ( rArr.size() > 0 ); -} - -class CompareMarksEnd : public std::binary_function < const IMark *, const IMark *, bool > -{ -public: - inline bool operator() ( const IMark * pOneB, const IMark * pTwoB ) const - { - xub_StrLen nOEnd = pOneB->GetMarkEnd().nContent.GetIndex(); - xub_StrLen nTEnd = pTwoB->GetMarkEnd().nContent.GetIndex(); - - return nOEnd < nTEnd; - } -}; - -bool DocxExport::NearestBookmark( xub_StrLen& rNearest ) -{ - bool bHasBookmark = false; - - if ( m_rSortedMarksStart.size( ) > 0 ) - { - IMark* pMarkStart = m_rSortedMarksStart.front(); - rNearest = pMarkStart->GetMarkStart().nContent.GetIndex(); - bHasBookmark = true; - } - - if ( m_rSortedMarksEnd.size( ) > 0 ) - { - IMark* pMarkEnd = m_rSortedMarksEnd[0]; - if ( !bHasBookmark ) - rNearest = pMarkEnd->GetMarkEnd().nContent.GetIndex(); - else - rNearest = std::min( rNearest, pMarkEnd->GetMarkEnd().nContent.GetIndex() ); - bHasBookmark = true; - } - - return bHasBookmark; -} - -xub_StrLen DocxExport::GetNextPos( SwAttrIter* pAttrIter, const SwTxtNode& rNode, xub_StrLen nAktPos ) -{ - // Get the bookmarks for the normal run - xub_StrLen nNextPos = MSWordExportBase::GetNextPos( pAttrIter, rNode, nAktPos ); - - GetSortedBookmarks( rNode, nAktPos, nNextPos - nAktPos ); - - xub_StrLen nNextBookmark = nNextPos; - NearestBookmark( nNextPos ); - - return std::min( nNextPos, nNextBookmark ); -} - -void DocxExport::UpdatePosition( SwAttrIter* pAttrIter, xub_StrLen nAktPos, xub_StrLen nEnd ) -{ - xub_StrLen nNextPos; - - // either no bookmark, or it is not at the current position - if ( !NearestBookmark( nNextPos ) || nNextPos > nAktPos ) - { - MSWordExportBase::UpdatePosition( pAttrIter, nAktPos, nEnd ); - } -} - -void DocxExport::GetSortedBookmarks( const SwTxtNode& rNode, xub_StrLen nAktPos, xub_StrLen nLen ) -{ - IMarkVector aMarksStart; - if ( GetBookmarks( rNode, nAktPos, nAktPos + nLen, aMarksStart ) ) - { - IMarkVector aSortedEnd; - IMarkVector aSortedStart; - for ( IMarkVector::const_iterator it = aMarksStart.begin(), end = aMarksStart.end(); - it < end; ++it ) - { - IMark* pMark = (*it); - - // Remove the positions egals to the current pos - xub_StrLen nStart = pMark->GetMarkStart().nContent.GetIndex(); - xub_StrLen nEnd = pMark->GetMarkEnd().nContent.GetIndex(); - - if ( nStart > nAktPos ) - aSortedStart.push_back( pMark ); - - if ( nEnd > nAktPos ) - aSortedEnd.push_back( pMark ); - } - - // Sort the bookmarks by end position - std::sort( aSortedEnd.begin(), aSortedEnd.end(), CompareMarksEnd() ); - - m_rSortedMarksStart.swap( aSortedStart ); - m_rSortedMarksEnd.swap( aSortedEnd ); - } - else - { - m_rSortedMarksStart.clear( ); - m_rSortedMarksEnd.clear( ); - } -} - void DocxExport::AppendBookmarks( const SwTxtNode& rNode, xub_StrLen nAktPos, xub_StrLen nLen ) { std::vector< OUString > aStarts; diff --git a/sw/source/filter/ww8/docxexport.hxx b/sw/source/filter/ww8/docxexport.hxx index 06d39a68d7..df385be268 100644 --- a/sw/source/filter/ww8/docxexport.hxx +++ b/sw/source/filter/ww8/docxexport.hxx @@ -76,11 +76,6 @@ class DocxExport : public MSWordExportBase /// Footer counter. sal_Int32 m_nFooters; - /// Used to split the runs according to the bookmarks start and ends - typedef std::vector< ::sw::mark::IMark* > IMarkVector; - IMarkVector m_rSortedMarksStart; - IMarkVector m_rSortedMarksEnd; - /// Exporter of the VML shapes. oox::vml::VMLExport *m_pVMLExport; @@ -162,24 +157,7 @@ protected: const SwFmtPageDesc* pNewPgDescFmt = 0, const SwPageDesc* pNewPgDesc = 0 ); - /// Get the next position in the text node to output - virtual xub_StrLen GetNextPos( SwAttrIter* pAttrIter, const SwTxtNode& rNode, xub_StrLen nAktPos ); - - /// Update the information for GetNextPos(). - virtual void UpdatePosition( SwAttrIter* pAttrIter, xub_StrLen nAktPos, xub_StrLen nEnd ); - private: - /// Find the nearest bookmark from the current position. - /// - /// Returns false when there is no bookmark. - bool NearestBookmark( xub_StrLen& rNearest ); - - void GetSortedBookmarks( const SwTxtNode& rNd, xub_StrLen nAktPos, - xub_StrLen nLen ); - - bool GetBookmarks( const SwTxtNode& rNd, xub_StrLen nStt, xub_StrLen nEnd, - IMarkVector& rArr ); - /// Setup pStyles and write styles.xml void InitStyles(); diff --git a/sw/source/filter/ww8/docxexportfilter.cxx b/sw/source/filter/ww8/docxexportfilter.cxx index 1fbbf83aa1..15acf1a691 100644 --- a/sw/source/filter/ww8/docxexportfilter.cxx +++ b/sw/source/filter/ww8/docxexportfilter.cxx @@ -26,6 +26,8 @@ ************************************************************************/ #include "docxexportfilter.hxx" +#include "rtfexportfilter.hxx" +#include "rtfimportfilter.hxx" #include "docxexport.hxx" #include <docsh.hxx> @@ -133,6 +135,7 @@ SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* /* pRegistryKey */ ) { + OSL_TRACE("%s, pImplName is '%s'", OSL_THIS_FUNC, pImplName); uno::Reference< lang::XSingleServiceFactory > xFactory; void* pRet = 0; @@ -145,6 +148,22 @@ SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* pImplN DocxExport_getImplementationName(), DocxExport_createInstance, DocxExport_getSupportedServiceNames() ) ); + } else if ( rtl_str_compare( pImplName, IMPL_NAME_RTFEXPORT ) == 0 ) { + const OUString aServiceName( OUString::createFromAscii( IMPL_NAME_RTFEXPORT ) ); + + xFactory = uno::Reference< lang::XSingleServiceFactory >( ::cppu::createSingleFactory( + reinterpret_cast< lang::XMultiServiceFactory* >( pServiceManager ), + RtfExport_getImplementationName(), + RtfExport_createInstance, + RtfExport_getSupportedServiceNames() ) ); + } else if ( rtl_str_compare( pImplName, IMPL_NAME_RTFIMPORT ) == 0 ) { + const OUString aServiceName( OUString::createFromAscii( IMPL_NAME_RTFIMPORT ) ); + + xFactory = uno::Reference< lang::XSingleServiceFactory >( ::cppu::createSingleFactory( + reinterpret_cast< lang::XMultiServiceFactory* >( pServiceManager ), + RtfImport_getImplementationName(), + RtfImport_createInstance, + RtfImport_getSupportedServiceNames() ) ); } if ( xFactory.is() ) diff --git a/sw/source/filter/ww8/dump/makefile.mk b/sw/source/filter/ww8/dump/makefile.mk deleted file mode 100644 index 695eddc9d1..0000000000 --- a/sw/source/filter/ww8/dump/makefile.mk +++ /dev/null @@ -1,122 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=. - -PRJNAME=DUMP8 -TARGET=dump8 - -# --- Settings --------------------------------------------------- - -.INCLUDE : settings.mk - -CXXFILES= dump8.cxx dump8a.cxx ww8dout.cxx ww8darr.cxx ww8scan.cxx msvbasic.cxx - -OBJFILES= $(OBJ)$/dump8.obj $(OBJ)$/dump8a.obj $(OBJ)$/ww8dout.obj \ - $(OBJ)$/ww8darr.obj $(OBJ)$/ww8scan.obj $(OBJ)$/msvbasic.obj - - -.IF "$(depend)" == "" - -CFLAGS+= -DDUMP - -# --- DUMP8 EXE -------------------------------------------------------- - -# IENV=$(IENV);..\RES - -APP1TARGET=$(PRJNAME) - -# RESLIB1NAME=vu -# RESLIB1SRSFILES=$(SRS)$/main.srs - -APP1LIBS=$(LIB1TARGET) - -.IF "$(GUI)" == "WNT" -APP1STDLIBS= $(SVTOOLLIB) $(SVLLIB) $(TOOLSLIB) $(SVLIB) $(SVMEMLIB) $(SO2LIB) -# irtl.lib -.IF "$(SO3)" == "" -APP1STDLIBS+= sdstor.lib -.ELSE -APP1STDLIBS+= $(SOTLIB) -.ENDIF -.IF "$(COMEX)"=="10" -APP1STDLIBS+= $(OLE32LIB) $(OLEAUT32LIB) $(UUIDLIB) $(SHELL32LIB) $(ADVAPI32LIB) libci.lib -.ELSE -APP1STDLIBS+= $(OLE32LIB) $(OLEAUT32LIB) $(UUIDLIB) $(SHELL32LIB) $(ADVAPI32LIB) libci.lib msvcirt.lib -.ENDIF -.ELSE -.IF "$(GUI)" == "OS2" -APP1STDLIBS=sdstor.lib $(SO2LIB) $(SVTOOLLIB) $(SVLIB) tools.lib $(SVMEMLIB) $(SVXLIB) -.ELSE -APP1STDLIBS=$(SVTOOLLIB) tools.lib $(SVLIB) $(SVMEMLIB) sdstor.lib $(SO2LIB) $(SVXLIB) -APP1STDLIBS+= ole2 compobj storage shell -.ENDIF -.ENDIF -.IF "$(GUI)"=="WNT" -APP1DEPN= $(L)$/svtool.lib $(L)$/itools.lib $(SVLIBDEPEND) $(L)$/svmem.lib $(L)$/so2.lib -.ELSE -APP1DEPN= $(L)$/svtool.lib $(L)$/tools.lib $(SVLIBDEPEND) $(L)$/svmem.lib $(L)$/so2.lib -.ENDIF -APP1OBJS= $(OBJ)$/dump8.obj $(OBJ)$/dump8a.obj $(OBJ)$/ww8dout.obj \ - $(OBJ)$/ww8darr.obj $(OBJ)$/ww8scan.obj $(OBJ)/msvbasic.obj - -APP1DEF= $(MISC)$/$(PRJNAME).def - - -#------------------------------------------------------------------------- -# OS/2 -#------------------------------------------------------------------------- - -.IF "$(GUI)" == "OS2" - -ALL: \ - $(SRS)$/main.srs \ - ALLTAR - -$(MISC)$/$(PRJNAME).def: makefile - echo NAME VIEWER WINDOWAPI >$@ - echo DESCRIPTION 'Storage Viewer (C)1995 STAR DIVISION GmbH' >>$@ - echo EXETYPE OS2 >>$@ - echo PROTMODE >>$@ - echo STUB 'OS2STUB.EXE' >>$@ - echo CODE LOADONCALL >>$@ - echo DATA PRELOAD MULTIPLE >>$@ - echo HEAPSIZE 4096 >>$@ - echo STACKSIZE 30000 >>$@ - -.ENDIF # GUI == OS2 - -#------------------------------------------------------------------------- -# Windows NT -#------------------------------------------------------------------------- - -# --- Targets ----------------------------------------------------------- - -.ENDIF - -.INCLUDE : target.mk - diff --git a/sw/source/filter/ww8/makefile.mk b/sw/source/filter/ww8/makefile.mk deleted file mode 100644 index b25887e3e2..0000000000 --- a/sw/source/filter/ww8/makefile.mk +++ /dev/null @@ -1,105 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=ww8 - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -MAKING_LIBMSWORD=TRUE -.INCLUDE : $(PRJ)$/inc$/sw.mk - -.IF "$(mydebug)" != "" -CDEFS=$(CDEFS) -Dmydebug -.ENDIF - -# --- Files -------------------------------------------------------- - -EXCEPTIONSFILES = \ - $(SLO)$/wrtww8gr.obj \ - $(SLO)$/ww8par2.obj \ - $(SLO)$/ww8par3.obj \ - $(SLO)$/ww8par5.obj \ - $(SLO)$/tracer.obj \ - $(SLO)$/fields.obj \ - $(SLO)$/styles.obj \ - $(SLO)$/ww8graf.obj \ - $(SLO)$/ww8graf2.obj \ - $(SLO)$/wrtw8esh.obj \ - $(SLO)$/wrtw8nds.obj \ - $(SLO)$/wrtw8num.obj \ - $(SLO)$/wrtw8sty.obj \ - $(SLO)$/wrtww8.obj \ - $(SLO)$/ww8atr.obj \ - $(SLO)$/ww8par.obj \ - $(SLO)$/ww8par6.obj \ - $(SLO)$/writerhelper.obj \ - $(SLO)$/writerwordglue.obj \ - $(SLO)$/ww8scan.obj \ - $(SLO)$/WW8TableInfo.obj \ - $(SLO)$/WW8FFData.obj \ - $(SLO)$/WW8Sttbf.obj \ - $(SLO)$/WW8FibData.obj - - -SLOFILES = \ - $(SLO)$/wrtw8esh.obj \ - $(SLO)$/wrtw8nds.obj \ - $(SLO)$/wrtw8num.obj \ - $(SLO)$/wrtw8sty.obj \ - $(SLO)$/wrtww8.obj \ - $(SLO)$/wrtww8gr.obj \ - $(SLO)$/ww8atr.obj \ - $(SLO)$/ww8graf.obj \ - $(SLO)$/ww8graf2.obj \ - $(SLO)$/ww8par.obj \ - $(SLO)$/ww8par2.obj \ - $(SLO)$/ww8par3.obj \ - $(SLO)$/ww8par4.obj \ - $(SLO)$/ww8par5.obj \ - $(SLO)$/ww8par6.obj \ - $(SLO)$/ww8glsy.obj \ - $(SLO)$/tracer.obj \ - $(SLO)$/fields.obj \ - $(SLO)$/styles.obj \ - $(SLO)$/ww8scan.obj \ - $(SLO)$/writerhelper.obj \ - $(SLO)$/writerwordglue.obj \ - $(SLO)$/WW8TableInfo.obj \ - $(SLO)$/WW8FFData.obj \ - $(SLO)$/WW8Sttbf.obj \ - $(SLO)$/WW8FibData.obj - - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx new file mode 100644 index 0000000000..09b2bbabcd --- /dev/null +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -0,0 +1,3447 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * Copyright 2010 Miklos Vajna. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "rtfattributeoutput.hxx" +#include "rtfexport.hxx" +#include "rtfsdrexport.hxx" +#include "writerwordglue.hxx" +#include "wrtww8.hxx" +#include "ww8par.hxx" +#include "fmtcntnt.hxx" +#include "fmtsrnd.hxx" +#include "fchrfmt.hxx" +#include "tgrditem.hxx" +#include "fmtruby.hxx" +#include "charfmt.hxx" +#include "breakit.hxx" + +#include <i18npool/mslangid.hxx> + +#include <hintids.hxx> + +#include <svl/poolitem.hxx> +#include <svtools/rtfkeywd.hxx> + +#include <editeng/fontitem.hxx> +#include <editeng/tstpitem.hxx> +#include <editeng/adjitem.hxx> +#include <editeng/spltitem.hxx> +#include <editeng/widwitem.hxx> +#include <editeng/lspcitem.hxx> +#include <editeng/keepitem.hxx> +#include <editeng/shaditem.hxx> +#include <editeng/brshitem.hxx> +#include <editeng/postitem.hxx> +#include <editeng/wghtitem.hxx> +#include <editeng/kernitem.hxx> +#include <editeng/crsditem.hxx> +#include <editeng/cmapitem.hxx> +#include <editeng/wrlmitem.hxx> +#include <editeng/udlnitem.hxx> +#include <editeng/langitem.hxx> +#include <editeng/escpitem.hxx> +#include <editeng/fhgtitem.hxx> +#include <editeng/colritem.hxx> +#include <editeng/hyznitem.hxx> +#include <editeng/brkitem.hxx> +#include <editeng/lrspitem.hxx> +#include <editeng/ulspitem.hxx> +#include <editeng/boxitem.hxx> +#include <editeng/cntritem.hxx> +#include <editeng/shdditem.hxx> +#include <editeng/akrnitem.hxx> +#include <editeng/pbinitem.hxx> +#include <editeng/emphitem.hxx> +#include <editeng/twolinesitem.hxx> +#include <editeng/charscaleitem.hxx> +#include <editeng/charrotateitem.hxx> +#include <editeng/charreliefitem.hxx> +#include <editeng/paravertalignitem.hxx> +#include <editeng/pgrditem.hxx> +#include <editeng/frmdiritem.hxx> +#include <editeng/blnkitem.hxx> +#include <editeng/charhiddenitem.hxx> +#include <svx/svdmodel.hxx> +#include <svx/svdobj.hxx> +#include <svx/fmglob.hxx> +#include <svx/svdouno.hxx> +#include <filter/msfilter/msoleexp.hxx> + +#include <docufld.hxx> +#include <flddropdown.hxx> +#include <format.hxx> +#include <fmtclds.hxx> +#include <fmtinfmt.hxx> +#include <fmtfld.hxx> +#include <fmtfsize.hxx> +#include <fmtftn.hxx> +#include <fmtrowsplt.hxx> +#include <fmtline.hxx> +#include <fmtanchr.hxx> +#include <frmfmt.hxx> +#include <frmatr.hxx> +#include <ftninfo.hxx> +#include <htmltbl.hxx> +#include <ndgrf.hxx> +#include <ndtxt.hxx> +#include <node.hxx> +#include <pagedesc.hxx> +#include <paratr.hxx> +#include <swmodule.hxx> +#include <swtable.hxx> +#include <txtftn.hxx> +#include <txtinet.hxx> +#include <numrule.hxx> +#include <grfatr.hxx> +#include <ndole.hxx> +#include <lineinfo.hxx> +#include <rtf.hxx> + +#include <rtl/strbuf.hxx> +#include <rtl/ustrbuf.hxx> +#include <rtl/ustring.hxx> + +#include <tools/color.hxx> + +#include <vcl/cvtgrf.hxx> + +#include <com/sun/star/i18n/ScriptType.hdl> +#include <com/sun/star/drawing/XShape.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/chart2/XChartDocument.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/container/XNamed.hpp> + +#include <osl/diagnose.h> + +using rtl::OString; +using rtl::OStringBuffer; +using rtl::OUString; +using rtl::OUStringBuffer; +using rtl::OUStringToOString; + +using namespace nsSwDocInfoSubType; +using namespace nsFieldFlags; +using namespace sw::util; +using namespace ::com::sun::star; + +static OString OutTBLBorderLine(RtfExport &rExport, const SvxBorderLine* pLine, const sal_Char* pStr) +{ + OStringBuffer aRet; + aRet.append(pStr); + if( pLine->GetInWidth() ) + { + // double line + aRet.append(OOO_STRING_SVTOOLS_RTF_BRDRDB); + switch( pLine->GetInWidth() ) + { + case DEF_LINE_WIDTH_0: + aRet.append(OOO_STRING_SVTOOLS_RTF_BRDRW "15"); + break; + case DEF_LINE_WIDTH_1: + aRet.append(OOO_STRING_SVTOOLS_RTF_BRDRW "30"); + break; + case DEF_LINE_WIDTH_2: + case DEF_LINE_WIDTH_3: + aRet.append(OOO_STRING_SVTOOLS_RTF_BRDRW "45"); + break; + } + } + else + { + // single line + if( DEF_LINE_WIDTH_1 >= pLine->GetOutWidth() ) + aRet.append(OOO_STRING_SVTOOLS_RTF_BRDRS OOO_STRING_SVTOOLS_RTF_BRDRW).append((sal_Int32)pLine->GetOutWidth()); + else + aRet.append(OOO_STRING_SVTOOLS_RTF_BRDRTH OOO_STRING_SVTOOLS_RTF_BRDRW).append((sal_Int32)pLine->GetOutWidth() / 2); + } + + aRet.append(OOO_STRING_SVTOOLS_RTF_BRDRCF); + aRet.append((sal_Int32)rExport.GetColor(pLine->GetColor())); + return aRet.makeStringAndClear(); +} + +static OString OutBorderLine(RtfExport &rExport, const SvxBorderLine* pLine, + const sal_Char* pStr, USHORT nDist) +{ + OStringBuffer aRet; + aRet.append(OutTBLBorderLine(rExport, pLine, pStr)); + aRet.append(OOO_STRING_SVTOOLS_RTF_BRSP); + aRet.append((sal_Int32)nDist); + return aRet.makeStringAndClear(); +} + +static OString OutBorderLine( RtfExport &rExport, const SvxBorderLine* pLine, + const char* pStr ) +{ + OStringBuffer aRet; + aRet.append(pStr); + aRet.append(OOO_STRING_SVTOOLS_RTF_BRDLNCOL); + aRet.append((sal_Int32)rExport.GetColor( pLine->GetColor() ) ); + aRet.append(OOO_STRING_SVTOOLS_RTF_BRDLNIN); + aRet.append((sal_Int32)pLine->GetInWidth()); + aRet.append(OOO_STRING_SVTOOLS_RTF_BRDLNOUT); + aRet.append((sal_Int32)pLine->GetOutWidth()); + aRet.append(OOO_STRING_SVTOOLS_RTF_BRDLNDIST); + aRet.append((sal_Int32)pLine->GetDistance()); + return aRet.makeStringAndClear(); +} + +void RtfAttributeOutput::RTLAndCJKState( bool bIsRTL, sal_uInt16 nScript ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + /* + You would have thought that + m_rExport.Strm() << (bIsRTL ? OOO_STRING_SVTOOLS_RTF_RTLCH : OOO_STRING_SVTOOLS_RTF_LTRCH); would be sufficent here , + but looks like word needs to see the other directional token to be + satisified that all is kosher, otherwise it seems in ver 2003 to go and + semi-randomlyly stick strike through about the place. Perhaps + strikethrough is some ms developers "something is wrong signal" debugging + code that we're triggering ? + */ + if (bIsRTL) { + m_aStylesEnd.append(OOO_STRING_SVTOOLS_RTF_LTRCH); + m_aStylesEnd.append(' '); + m_aStylesEnd.append(OOO_STRING_SVTOOLS_RTF_RTLCH); + } else { + m_aStylesEnd.append(OOO_STRING_SVTOOLS_RTF_RTLCH); + m_aStylesEnd.append(' '); + m_aStylesEnd.append(OOO_STRING_SVTOOLS_RTF_LTRCH); + } + + switch (nScript) { + case i18n::ScriptType::LATIN: + m_aStylesEnd.append(OOO_STRING_SVTOOLS_RTF_LOCH); + break; + case i18n::ScriptType::ASIAN: + m_aStylesEnd.append(OOO_STRING_SVTOOLS_RTF_DBCH); + break; + case i18n::ScriptType::COMPLEX: + /* noop */ + break; + default: + /* should not happen? */ + break; + } +} + +void RtfAttributeOutput::StartParagraph( ww8::WW8TableNodeInfo::Pointer_t pTextNodeInfo ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + // Output table/table row/table cell starts if needed + if ( pTextNodeInfo.get() ) + { + sal_uInt32 nRow = pTextNodeInfo->getRow(); + sal_uInt32 nCell = pTextNodeInfo->getCell(); + + // New cell/row? + if ( m_nTableDepth > 0 && !m_bTableCellOpen ) + { + ww8::WW8TableNodeInfoInner::Pointer_t pDeepInner( pTextNodeInfo->getInnerForDepth( m_nTableDepth ) ); + OSL_ENSURE( pDeepInner, "TableNodeInfoInner not found"); + if ( pDeepInner && pDeepInner->getCell() == 0 ) + StartTableRow( pDeepInner ); + + StartTableCell( pDeepInner ); + } + + if ( nRow == 0 && nCell == 0 ) + { + // Do we have to start the table? + // [If we are at the rigth depth already, it means that we + // continue the table cell] + sal_uInt32 nCurrentDepth = pTextNodeInfo->getDepth(); + + if ( nCurrentDepth > m_nTableDepth ) + { + // Start all the tables that begin here + for ( sal_uInt32 nDepth = m_nTableDepth + 1; nDepth <= pTextNodeInfo->getDepth(); ++nDepth ) + { + ww8::WW8TableNodeInfoInner::Pointer_t pInner( pTextNodeInfo->getInnerForDepth( nDepth ) ); + + m_bLastTable = (nDepth == pTextNodeInfo->getDepth()); + StartTable( pInner ); + StartTableRow( pInner ); + StartTableCell( pInner ); + } + + m_nTableDepth = nCurrentDepth; + } + } + } + + OSL_ENSURE(m_aRun.getLength() == 0, "m_aRun is not empty"); +} + +void RtfAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pTextNodeInfoInner ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + FinishTableRowCell( pTextNodeInfoInner ); + + OStringBuffer aParagraph; + + aParagraph.append(m_aRun.makeStringAndClear()); + aParagraph.append(m_aAfterRuns.makeStringAndClear()); + if (m_bTblAfterCell) + m_bTblAfterCell = false; + else + { + aParagraph.append(m_rExport.sNewLine); + aParagraph.append(OOO_STRING_SVTOOLS_RTF_PAR); + aParagraph.append(' '); + } + if (m_nColBreakNeeded) + { + aParagraph.append(OOO_STRING_SVTOOLS_RTF_COLUMN); + m_nColBreakNeeded = false; + } + + if (!m_bBufferSectionHeaders) + m_rExport.Strm() << aParagraph.makeStringAndClear(); + else + m_aSectionHeaders.append(aParagraph.makeStringAndClear()); +} + +void RtfAttributeOutput::EmptyParagraph() +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + m_rExport.Strm() << m_rExport.sNewLine << OOO_STRING_SVTOOLS_RTF_PAR << ' '; +} + +void RtfAttributeOutput::StartParagraphProperties( const SwTxtNode& rNode ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + OSL_ENSURE(m_aStyles.getLength() == 0, "m_aStyles is not empty"); + + // output page/section breaks + SwNodeIndex aNextIndex( rNode, 1 ); + m_rExport.Strm() << m_aSectionBreaks.makeStringAndClear(); + m_bBufferSectionBreaks = true; + + // output section headers / footers + if (!m_bBufferSectionHeaders) + m_rExport.Strm() << m_aSectionHeaders.makeStringAndClear(); + + if ( aNextIndex.GetNode().IsTxtNode() ) + { + const SwTxtNode* pTxtNode = static_cast< SwTxtNode* >( &aNextIndex.GetNode() ); + m_rExport.OutputSectionBreaks( pTxtNode->GetpSwAttrSet(), *pTxtNode ); + } + else if ( aNextIndex.GetNode().IsTableNode() ) + { + const SwTableNode* pTableNode = static_cast< SwTableNode* >( &aNextIndex.GetNode() ); + const SwFrmFmt *pFmt = pTableNode->GetTable().GetFrmFmt(); + m_rExport.OutputSectionBreaks( &(pFmt->GetAttrSet()), *pTableNode ); + } + m_bBufferSectionBreaks = false; + + OStringBuffer aPar; + if (!m_rExport.bRTFFlySyntax) + { + aPar.append(OOO_STRING_SVTOOLS_RTF_PARD); + aPar.append(OOO_STRING_SVTOOLS_RTF_PLAIN); + aPar.append(' '); + } + if (!m_bBufferSectionHeaders) + m_rExport.Strm() << aPar.makeStringAndClear(); + else + m_aSectionHeaders.append(aPar.makeStringAndClear()); +} + +void RtfAttributeOutput::EndParagraphProperties() +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + m_aStyles.append(m_aStylesEnd.makeStringAndClear()); + m_rExport.Strm() << m_aStyles.makeStringAndClear(); +} + +void RtfAttributeOutput::StartRun( const SwRedlineData* pRedlineData ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + m_aRun.append('{'); + + // if there is some redlining in the document, output it + Redline( pRedlineData ); + + OSL_ENSURE(m_aRunText.getLength() == 0, "m_aRunText is not empty"); +} + +void RtfAttributeOutput::EndRun() +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + m_aRun.append(m_rExport.sNewLine); + m_aRun.append(m_aRunText.makeStringAndClear()); + m_aRun.append('}'); +} + +void RtfAttributeOutput::StartRunProperties() +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + OSL_ENSURE(m_aStyles.getLength() == 0, "m_aStyles is not empty"); +} + +void RtfAttributeOutput::EndRunProperties( const SwRedlineData* /*pRedlineData*/ ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + m_aStyles.append(m_aStylesEnd.makeStringAndClear()); + m_aRun.append(m_aStyles.makeStringAndClear()); +} + +void RtfAttributeOutput::RunText( const String& rText, rtl_TextEncoding eCharSet ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + RawText( rText, 0, eCharSet ); +} + +OStringBuffer& RtfAttributeOutput::RunText() +{ + return m_aRunText; +} + +OStringBuffer& RtfAttributeOutput::Styles() +{ + return m_aStyles; +} + +void RtfAttributeOutput::RawText( const String& rText, bool /*bForceUnicode*/, rtl_TextEncoding eCharSet ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + m_aRunText.append(m_rExport.OutString(rText, eCharSet)); +} + +void RtfAttributeOutput::StartRuby( const SwTxtNode& /*rNode*/, const SwFmtRuby& /*rRuby*/ ) +{ + OSL_TRACE("TODO: %s", OSL_THIS_FUNC); +} + +void RtfAttributeOutput::EndRuby() +{ + OSL_TRACE("TODO: %s", OSL_THIS_FUNC); +} + +bool RtfAttributeOutput::StartURL( const String& rUrl, const String& rTarget ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + m_aStyles.append('{'); + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_FIELD); + m_aStyles.append('{'); + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_IGNORE); + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_FLDINST); + m_aStyles.append(" HYPERLINK "); + + String sURL( rUrl ); + if( sURL.Len() ) + { + m_aStyles.append("\""); + m_aStyles.append(m_rExport.OutString( sURL, m_rExport.eCurrentEncoding)); + m_aStyles.append("\" "); + } + + if( rTarget.Len() ) + { + m_aStyles.append("\\\\t \""); + m_aStyles.append(m_rExport.OutString( rTarget, m_rExport.eCurrentEncoding)); + m_aStyles.append("\" "); + } + + m_aStyles.append("}"); + return true; +} + +bool RtfAttributeOutput::EndURL() +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + // close the fldrslt group + m_aRunText.append('}'); + // close the field group + m_aRunText.append('}'); + return true; +} + +void RtfAttributeOutput::FieldVanish( const String& /*rTxt*/, ww::eField /*eType*/ ) +{ + OSL_TRACE("TODO: %s", OSL_THIS_FUNC); +} + +void RtfAttributeOutput::Redline( const SwRedlineData* pRedline ) +{ + if (!pRedline) + return; + + OSL_TRACE("%s", OSL_THIS_FUNC); + + if (pRedline->GetType() == nsRedlineType_t::REDLINE_INSERT) + { + m_aRun.append(OOO_STRING_SVTOOLS_RTF_REVISED); + m_aRun.append(OOO_STRING_SVTOOLS_RTF_REVAUTH); + m_aRun.append((sal_Int32)m_rExport.GetRedline(SW_MOD()->GetRedlineAuthor(pRedline->GetAuthor()))); + m_aRun.append(OOO_STRING_SVTOOLS_RTF_REVDTTM); + } + else if(pRedline->GetType() == nsRedlineType_t::REDLINE_DELETE) + { + m_aRun.append(OOO_STRING_SVTOOLS_RTF_DELETED); + m_aRun.append(OOO_STRING_SVTOOLS_RTF_REVAUTHDEL); + m_aRun.append((sal_Int32)m_rExport.GetRedline(SW_MOD()->GetRedlineAuthor(pRedline->GetAuthor()))); + m_aRun.append(OOO_STRING_SVTOOLS_RTF_REVDTTMDEL); + } + m_aRun.append((sal_Int32)sw::ms::DateTime2DTTM(pRedline->GetTimeStamp())); + m_aRun.append(' '); +} + +void RtfAttributeOutput::FormatDrop( const SwTxtNode& /*rNode*/, const SwFmtDrop& /*rSwFmtDrop*/, USHORT /*nStyle*/, ww8::WW8TableNodeInfo::Pointer_t /*pTextNodeInfo*/, ww8::WW8TableNodeInfoInner::Pointer_t /*pTextNodeInfoInner*/ ) +{ + OSL_TRACE("TODO: %s", OSL_THIS_FUNC); +} + +void RtfAttributeOutput::ParagraphStyle( USHORT nStyle ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + OString *pStyle = m_rExport.GetStyle(nStyle); + OStringBuffer aStyle; + aStyle.append(OOO_STRING_SVTOOLS_RTF_S); + aStyle.append((sal_Int32)nStyle); + if (pStyle) + aStyle.append(pStyle->getStr()); + if (!m_bBufferSectionHeaders) + m_rExport.Strm() << aStyle.makeStringAndClear(); + else + m_aSectionHeaders.append(aStyle.makeStringAndClear()); +} + +void RtfAttributeOutput::TableInfoCell( ww8::WW8TableNodeInfoInner::Pointer_t /*pTableTextNodeInfoInner*/ ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_INTBL); + if ( m_nTableDepth > 1 ) + { + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_ITAP); + m_aStyles.append((sal_Int32)m_nTableDepth); + } + m_bWroteCellInfo = true; +} + +void RtfAttributeOutput::TableInfoRow( ww8::WW8TableNodeInfoInner::Pointer_t /*pTableTextNodeInfo*/ ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + /* noop */ +} + +void RtfAttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + if ( !m_pTableWrt ) + InitTableHelper( pTableTextNodeInfoInner ); + + const SwTableBox *pTblBox = pTableTextNodeInfoInner->getTableBox( ); + SwFrmFmt *pFmt = pTblBox->GetFrmFmt( ); + + m_aRowDefs.append(OOO_STRING_SVTOOLS_RTF_TROWD); + TableOrientation( pTableTextNodeInfoInner ); + TableBidi( pTableTextNodeInfoInner ); + TableHeight( pTableTextNodeInfoInner ); + TableCanSplit( pTableTextNodeInfoInner ); + + // Cell margins + const SvxBoxItem& rBox = pFmt->GetBox( ); + static const USHORT aBorders[] = + { + BOX_LINE_TOP, BOX_LINE_LEFT, BOX_LINE_BOTTOM, BOX_LINE_RIGHT + }; + + static const char* aRowPadNames[] = + { + OOO_STRING_SVTOOLS_RTF_TRPADDT, OOO_STRING_SVTOOLS_RTF_TRPADDL, OOO_STRING_SVTOOLS_RTF_TRPADDB, OOO_STRING_SVTOOLS_RTF_TRPADDR + }; + + static const char* aRowPadUnits[] = + { + OOO_STRING_SVTOOLS_RTF_TRPADDFT, OOO_STRING_SVTOOLS_RTF_TRPADDFL, OOO_STRING_SVTOOLS_RTF_TRPADDFB, OOO_STRING_SVTOOLS_RTF_TRPADDFR + }; + + for (int i = 0; i < 4; ++i) + { + m_aRowDefs.append(aRowPadUnits[i]); + m_aRowDefs.append((sal_Int32)3); + m_aRowDefs.append(aRowPadNames[i]); + m_aRowDefs.append((sal_Int32)rBox.GetDistance(aBorders[i])); + } + + // The cell-dependent properties + const SwWriteTableRows& aRows = m_pTableWrt->GetRows( ); + SwWriteTableRow *pRow = aRows[ pTableTextNodeInfoInner->getRow( ) ]; + SwTwips nSz = 0; + Point aPt; + SwRect aRect( pFmt->FindLayoutRect( false, &aPt )); + SwTwips nPageSize = aRect.Width(); + SwTwips nTblSz = pFmt->GetFrmSize().GetWidth(); + for( USHORT i = 0; i < pRow->GetCells().Count(); i++ ) + { + SwWriteTableCell *pCell = pRow->GetCells( )[ i ]; + const SwFrmFmt *pCellFmt = pCell->GetBox()->GetFrmFmt(); + + pTableTextNodeInfoInner->setCell( i ); + TableCellProperties(pTableTextNodeInfoInner); + + // Right boundary: this can't be in TableCellProperties as the old + // value of nSz is needed. + nSz += pCellFmt->GetFrmSize().GetWidth(); + m_aRowDefs.append(OOO_STRING_SVTOOLS_RTF_CELLX); + SwTwips nCalc = nSz; + nCalc *= nPageSize; + nCalc /= nTblSz; + m_aRowDefs.append( (sal_Int32)(pFmt->GetLRSpace().GetLeft() + nCalc) ); + } +} + +void RtfAttributeOutput::TableDefaultBorders( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + /* + * The function name is a bit misleading: given that we write borders + * before each row, we just have borders, not default ones. Additionally, + * this function actually writes borders for a specific cell only and is + * called for each cell. + */ + + const SwTableBox *pTblBox = pTableTextNodeInfoInner->getTableBox( ); + SwFrmFmt *pFmt = pTblBox->GetFrmFmt( ); + const SvxBoxItem& rDefault = pFmt->GetBox( ); + const SwWriteTableRows& aRows = m_pTableWrt->GetRows( ); + SwWriteTableRow *pRow = aRows[ pTableTextNodeInfoInner->getRow( ) ]; + SwWriteTableCell *pCell = pRow->GetCells( )[ pTableTextNodeInfoInner->getCell( ) ]; + const SwFrmFmt *pCellFmt = pCell->GetBox()->GetFrmFmt(); + const SfxPoolItem* pItem; + if (SFX_ITEM_SET == pCellFmt->GetAttrSet().GetItemState(RES_BOX, TRUE, &pItem)) + { + const SvxBoxItem& rBox = (SvxBoxItem&)*pItem; + static const USHORT aBorders[] = + { + BOX_LINE_TOP, BOX_LINE_LEFT, BOX_LINE_BOTTOM, BOX_LINE_RIGHT + }; + static const char* aBorderNames[] = + { + OOO_STRING_SVTOOLS_RTF_CLBRDRT, OOO_STRING_SVTOOLS_RTF_CLBRDRL, OOO_STRING_SVTOOLS_RTF_CLBRDRB, OOO_STRING_SVTOOLS_RTF_CLBRDRR + }; + //Yes left and top are swapped with eachother for cell padding! Because + //that's what the thunderingly annoying rtf export/import word xp does. + static const char* aCellPadNames[] = + { + OOO_STRING_SVTOOLS_RTF_CLPADL, OOO_STRING_SVTOOLS_RTF_CLPADT, OOO_STRING_SVTOOLS_RTF_CLPADB, OOO_STRING_SVTOOLS_RTF_CLPADR + }; + static const char* aCellPadUnits[] = + { + OOO_STRING_SVTOOLS_RTF_CLPADFL, OOO_STRING_SVTOOLS_RTF_CLPADFT, OOO_STRING_SVTOOLS_RTF_CLPADFB, OOO_STRING_SVTOOLS_RTF_CLPADFR + }; + for (int i = 0; i < 4; ++i) + { + if (const SvxBorderLine* pLn = rBox.GetLine(aBorders[i])) + m_aRowDefs.append(OutTBLBorderLine(m_rExport, pLn, aBorderNames[i])); + if (rDefault.GetDistance(aBorders[i]) != + rBox.GetDistance(aBorders[i])) + { + m_aRowDefs.append(aCellPadUnits[i]); + m_aRowDefs.append((sal_Int32)3); + m_aRowDefs.append(aCellPadNames[i]); + m_aRowDefs.append((sal_Int32)rBox.GetDistance(aBorders[i])); + } + } + } +} + +void RtfAttributeOutput::TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + const SwWriteTableRows& aRows = m_pTableWrt->GetRows( ); + SwWriteTableRow *pRow = aRows[ pTableTextNodeInfoInner->getRow( ) ]; + SwWriteTableCell *pCell = pRow->GetCells( )[ pTableTextNodeInfoInner->getCell( ) ]; + const SwFrmFmt *pCellFmt = pCell->GetBox()->GetFrmFmt(); + const SfxPoolItem* pItem; + if( SFX_ITEM_SET == pCellFmt->GetAttrSet().GetItemState( + RES_BACKGROUND, TRUE, &pItem )) + { + const SvxBrushItem& rBack = (SvxBrushItem&)*pItem; + if( !rBack.GetColor().GetTransparency() ) + { + m_aRowDefs.append(OOO_STRING_SVTOOLS_RTF_CLCBPAT); + m_aRowDefs.append((sal_Int32)m_rExport.GetColor(rBack.GetColor())); + } + } +} + +void RtfAttributeOutput::TableHeight( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox(); + const SwTableLine * pTabLine = pTabBox->GetUpper(); + const SwFrmFmt * pLineFmt = pTabLine->GetFrmFmt(); + const SwFmtFrmSize& rLSz = pLineFmt->GetFrmSize(); + + if ( ATT_VAR_SIZE != rLSz.GetHeightSizeType() && rLSz.GetHeight() ) + { + sal_Int32 nHeight = 0; + + switch ( rLSz.GetHeightSizeType() ) + { + case ATT_FIX_SIZE: nHeight = -rLSz.GetHeight(); break; + case ATT_MIN_SIZE: nHeight = rLSz.GetHeight(); break; + default: break; + } + + if ( nHeight ) + { + m_aRowDefs.append(OOO_STRING_SVTOOLS_RTF_TRRH); + m_aRowDefs.append(nHeight); + } + } +} + +void RtfAttributeOutput::TableCanSplit( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + const SwTableBox * pTabBox = pTableTextNodeInfoInner->getTableBox(); + const SwTableLine * pTabLine = pTabBox->GetUpper(); + const SwFrmFmt * pLineFmt = pTabLine->GetFrmFmt(); + const SwFmtRowSplit& rSplittable = pLineFmt->GetRowSplit( ); + + // The rtf default is to allow a row to break + if (rSplittable.GetValue() == 0) + m_aRowDefs.append(OOO_STRING_SVTOOLS_RTF_TRKEEP); +} + +void RtfAttributeOutput::TableBidi( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + const SwTable * pTable = pTableTextNodeInfoInner->getTable(); + const SwFrmFmt * pFrmFmt = pTable->GetFrmFmt(); + + if ( m_rExport.TrueFrameDirection( *pFrmFmt ) != FRMDIR_HORI_RIGHT_TOP ) + m_aRowDefs.append(OOO_STRING_SVTOOLS_RTF_LTRROW); + else + m_aRowDefs.append(OOO_STRING_SVTOOLS_RTF_RTLROW); +} + +void RtfAttributeOutput::TableVerticalCell( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + const SwWriteTableRows& aRows = m_pTableWrt->GetRows( ); + SwWriteTableRow *pRow = aRows[ pTableTextNodeInfoInner->getRow( ) ]; + SwWriteTableCell *pCell = pRow->GetCells( )[ pTableTextNodeInfoInner->getCell( ) ]; + const SwFrmFmt *pCellFmt = pCell->GetBox()->GetFrmFmt(); + const SfxPoolItem* pItem; + + // vertical merges + if (pCell->GetRowSpan() > 1) + m_aRowDefs.append(OOO_STRING_SVTOOLS_RTF_CLVMGF); + else if (pCell->GetRowSpan() == 0) + m_aRowDefs.append(OOO_STRING_SVTOOLS_RTF_CLVMRG); + + // vertical alignment + if( SFX_ITEM_SET == pCellFmt->GetAttrSet().GetItemState( + RES_VERT_ORIENT, TRUE, &pItem ) ) + switch( ((SwFmtVertOrient*)pItem)->GetVertOrient() ) + { + case text::VertOrientation::CENTER: m_aRowDefs.append(OOO_STRING_SVTOOLS_RTF_CLVERTALC); break; + case text::VertOrientation::BOTTOM: m_aRowDefs.append(OOO_STRING_SVTOOLS_RTF_CLVERTALB); break; + default: m_aRowDefs.append(OOO_STRING_SVTOOLS_RTF_CLVERTALT); break; + } +} + +void RtfAttributeOutput::TableNodeInfo( ww8::WW8TableNodeInfo::Pointer_t /*pNodeInfo*/ ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + /* noop */ +} + +void RtfAttributeOutput::TableNodeInfoInner( ww8::WW8TableNodeInfoInner::Pointer_t pNodeInfoInner ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + // This is called when the nested table ends in a cell, and there's no + // paragraph benhind that; so we must check for the ends of cell, rows, + // and tables + // ['true' to write an empty paragraph, MS Word insists on that] + FinishTableRowCell( pNodeInfoInner, true ); +} + +void RtfAttributeOutput::TableOrientation( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + const SwTable *pTable = pTableTextNodeInfoInner->getTable(); + SwFrmFmt *pFmt = pTable->GetFrmFmt( ); + + OStringBuffer aTblAdjust( OOO_STRING_SVTOOLS_RTF_TRQL ); + switch (pFmt->GetHoriOrient().GetHoriOrient()) + { + case text::HoriOrientation::CENTER: + aTblAdjust.setLength(0); + aTblAdjust.append(OOO_STRING_SVTOOLS_RTF_TRQC); + break; + case text::HoriOrientation::RIGHT: + aTblAdjust.setLength(0); + aTblAdjust.append(OOO_STRING_SVTOOLS_RTF_TRQR); + break; + case text::HoriOrientation::NONE: + case text::HoriOrientation::LEFT_AND_WIDTH: + aTblAdjust.append(OOO_STRING_SVTOOLS_RTF_TRLEFT); + aTblAdjust.append((sal_Int32)pFmt->GetLRSpace().GetLeft()); + break; + default: + break; + } + + m_aRowDefs.append(aTblAdjust.makeStringAndClear()); +} + +void RtfAttributeOutput::TableSpacing( ww8::WW8TableNodeInfoInner::Pointer_t /*pTableTextNodeInfoInner*/ ) +{ + OSL_TRACE("TODO: %s", OSL_THIS_FUNC); +} + +void RtfAttributeOutput::TableRowEnd( sal_uInt32 /*nDepth*/ ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + /* noop, see EndTableRow() */ +} + +/* + * Our private table methods. + */ + +void RtfAttributeOutput::InitTableHelper( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + sal_uInt32 nPageSize = 0; + bool bRelBoxSize = false; + + // Create the SwWriteTable instance to use col spans + GetTablePageSize( pTableTextNodeInfoInner.get(), nPageSize, bRelBoxSize ); + + const SwTable* pTable = pTableTextNodeInfoInner->getTable( ); + const SwFrmFmt *pFmt = pTable->GetFrmFmt( ); + SwTwips nTblSz = pFmt->GetFrmSize( ).GetWidth( ); + + const SwHTMLTableLayout *pLayout = pTable->GetHTMLTableLayout(); + if( pLayout && pLayout->IsExportable() ) + m_pTableWrt = new SwWriteTable( pLayout ); + else + m_pTableWrt = new SwWriteTable( pTable->GetTabLines(), (USHORT)nPageSize, + (USHORT)nTblSz, false); +} + +void RtfAttributeOutput::StartTable( ww8::WW8TableNodeInfoInner::Pointer_t /*pTableTextNodeInfoInner*/ ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + // To trigger calling InitTableHelper() + delete m_pTableWrt, m_pTableWrt = NULL; +} + +void RtfAttributeOutput::StartTableRow( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner ) +{ + sal_uInt32 nCurrentDepth = pTableTextNodeInfoInner->getDepth(); + OSL_TRACE("%s, (depth is %d)", OSL_THIS_FUNC, (int)nCurrentDepth); + + TableDefinition(pTableTextNodeInfoInner); + + if (!m_bLastTable) + m_aTables.push_back(m_aRowDefs.makeStringAndClear()); + + // We'll write the table definition for nested tables later + if ( nCurrentDepth > 1 ) + return; + m_rExport.Strm() << m_aRowDefs.makeStringAndClear(); +} + +void RtfAttributeOutput::StartTableCell( ww8::WW8TableNodeInfoInner::Pointer_t /*pTableTextNodeInfoInner*/ ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + m_bTableCellOpen = true; +} + +void RtfAttributeOutput::TableCellProperties( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + TableDefaultBorders(pTableTextNodeInfoInner); + TableBackgrounds(pTableTextNodeInfoInner); + TableVerticalCell(pTableTextNodeInfoInner); +} + +void RtfAttributeOutput::EndTableCell( ) +{ + OSL_TRACE("%s, (depth is %d)", OSL_THIS_FUNC, (int)m_nTableDepth); + + if (!m_bWroteCellInfo) + { + m_aAfterRuns.append(OOO_STRING_SVTOOLS_RTF_INTBL); + m_aAfterRuns.append(OOO_STRING_SVTOOLS_RTF_ITAP); + m_aAfterRuns.append((sal_Int32)m_nTableDepth); + } + if ( m_nTableDepth > 1 ) + m_aAfterRuns.append(OOO_STRING_SVTOOLS_RTF_NESTCELL); + else + m_aAfterRuns.append(OOO_STRING_SVTOOLS_RTF_CELL); + + m_bTableCellOpen = false; + m_bTblAfterCell = true; + m_bWroteCellInfo = false; +} + +void RtfAttributeOutput::EndTableRow( ) +{ + OSL_TRACE("%s, (depth is %d)", OSL_THIS_FUNC, (int)m_nTableDepth); + + if ( m_nTableDepth > 1 ) + { + m_aAfterRuns.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_NESTTABLEPROPRS); + if (m_aRowDefs.getLength() > 0) + m_aAfterRuns.append(m_aRowDefs.makeStringAndClear()); + else if (m_aTables.size() > 0) + { + m_aAfterRuns.append(m_aTables.back()); + m_aTables.pop_back(); + } + m_aAfterRuns.append(OOO_STRING_SVTOOLS_RTF_NESTROW "}" "{" OOO_STRING_SVTOOLS_RTF_NONESTTABLES OOO_STRING_SVTOOLS_RTF_PAR "}"); + } + else + { + if (m_aTables.size() > 0) + { + m_aAfterRuns.append(m_aTables.back()); + m_aTables.pop_back(); + } + m_aAfterRuns.append(OOO_STRING_SVTOOLS_RTF_ROW); + } +} + +void RtfAttributeOutput::EndTable() +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + if ( m_nTableDepth > 0 ) { + m_nTableDepth--; + delete m_pTableWrt, m_pTableWrt = NULL; + } + + // We closed the table; if it is a nested table, the cell that contains it + // still continues + m_bTableCellOpen = true; + + // Cleans the table helper + delete m_pTableWrt, m_pTableWrt = NULL; +} + +void RtfAttributeOutput::FinishTableRowCell( ww8::WW8TableNodeInfoInner::Pointer_t pInner, bool /*bForceEmptyParagraph*/ ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + if ( pInner.get() ) + { + // Where are we in the table + sal_uInt32 nRow = pInner->getRow( ); + + const SwTable *pTable = pInner->getTable( ); + const SwTableLines& rLines = pTable->GetTabLines( ); + USHORT nLinesCount = rLines.Count( ); + + if ( pInner->isEndOfCell() ) + EndTableCell(); + + // This is a line end + if ( pInner->isEndOfLine() ) + EndTableRow(); + + // This is the end of the table + if ( pInner->isEndOfLine( ) && ( nRow + 1 ) == nLinesCount ) + EndTable(); + } +} + +void RtfAttributeOutput::StartStyles() +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + m_rExport.Strm() << m_rExport.sNewLine << '{' << OOO_STRING_SVTOOLS_RTF_COLORTBL; + m_rExport.OutColorTable(); + OSL_ENSURE(m_aStylesheet.getLength() == 0, "m_aStylesheet is not empty"); + m_aStylesheet.append(m_rExport.sNewLine); + m_aStylesheet.append('{'); + m_aStylesheet.append(OOO_STRING_SVTOOLS_RTF_STYLESHEET); +} + +void RtfAttributeOutput::EndStyles( USHORT /*nNumberOfStyles*/ ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + m_rExport.Strm() << '}'; + m_rExport.Strm() << m_aStylesheet.makeStringAndClear(); + m_rExport.Strm() << '}'; +} + +void RtfAttributeOutput::DefaultStyle( USHORT /*nStyle*/ ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + /* noop, the default style is always 0 in RTF */ +} + +void RtfAttributeOutput::StartStyle( const String& rName, bool bPapFmt, + USHORT nBase, USHORT nNext, USHORT /*nWwId*/, USHORT nId ) +{ + OSL_TRACE("%s, rName = '%s'", OSL_THIS_FUNC, + OUStringToOString( OUString( rName ), m_rExport.eCurrentEncoding ).getStr()); + + m_aStylesheet.append('{'); + if (bPapFmt) + m_aStylesheet.append(OOO_STRING_SVTOOLS_RTF_S); + else + m_aStylesheet.append( OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_CS); + m_aStylesheet.append( (sal_Int32)nId ); + + if ( nBase != 0x0FFF ) + { + m_aStylesheet.append(OOO_STRING_SVTOOLS_RTF_SBASEDON); + m_aStylesheet.append((sal_Int32)nBase); + } + + m_aStylesheet.append(OOO_STRING_SVTOOLS_RTF_SNEXT); + m_aStylesheet.append((sal_Int32)nNext); + + m_rStyleName = rName; + m_nStyleId = nId; +} + +void RtfAttributeOutput::EndStyle() +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + m_aStyles.append(m_aStylesEnd.makeStringAndClear()); + OString aStyles = m_aStyles.makeStringAndClear(); + m_rExport.InsStyle(m_nStyleId, aStyles); + m_aStylesheet.append(aStyles); + m_aStylesheet.append(' '); + m_aStylesheet.append(OUStringToOString( OUString( m_rStyleName ), m_rExport.eCurrentEncoding )); + m_aStylesheet.append(";}"); + m_aStylesheet.append(m_rExport.sNewLine); +} + +void RtfAttributeOutput::StartStyleProperties( bool /*bParProp*/, USHORT /*nStyle*/ ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + /* noop */ +} + +void RtfAttributeOutput::EndStyleProperties( bool /*bParProp*/ ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + /* noop */ +} + +void RtfAttributeOutput::OutlineNumbering( BYTE nLvl, const SwNumFmt& /*rNFmt*/, const SwFmt& /*rFmt*/ ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + if ( nLvl >= WW8ListManager::nMaxLevel ) + nLvl = WW8ListManager::nMaxLevel - 1; + + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_ILVL); + m_aStyles.append((sal_Int32)nLvl); + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_OUTLINELEVEL); + m_aStyles.append((sal_Int32)nLvl); +} + +void RtfAttributeOutput::PageBreakBefore( bool bBreak ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + if (bBreak) + { + m_rExport.Strm() << OOO_STRING_SVTOOLS_RTF_PAGEBB; + } +} + +void RtfAttributeOutput::SectionBreak( BYTE nC, const WW8_SepInfo* pSectionInfo ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + switch (nC) + { + case msword::ColumnBreak: + m_nColBreakNeeded = true; + break; + case msword::PageBreak: + if ( pSectionInfo ) + m_rExport.SectionProperties( *pSectionInfo ); + break; + } +} + +void RtfAttributeOutput::StartSection() +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + m_aSectionBreaks.append(OOO_STRING_SVTOOLS_RTF_SECT OOO_STRING_SVTOOLS_RTF_SECTD); + if (!m_bBufferSectionBreaks) + m_rExport.Strm() << m_aSectionBreaks.makeStringAndClear(); +} + +void RtfAttributeOutput::EndSection() +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + /* + * noop, \sect must go to StartSection or Word won't notice multiple + * columns... + */ +} + +void RtfAttributeOutput::SectionFormProtection( bool bProtected ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + m_aSectionBreaks.append(OOO_STRING_SVTOOLS_RTF_SECTUNLOCKED); + m_aSectionBreaks.append((sal_Int32)!bProtected); +} + +void RtfAttributeOutput::SectionLineNumbering( ULONG /*nRestartNo*/, const SwLineNumberInfo& rLnNumInfo ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + m_rExport.Strm() << OOO_STRING_SVTOOLS_RTF_LINEMOD; + m_rExport.OutLong(rLnNumInfo.GetCountBy()); + m_rExport.Strm() << OOO_STRING_SVTOOLS_RTF_LINEX; + m_rExport.OutLong(rLnNumInfo.GetPosFromLeft()); + if (!rLnNumInfo.IsRestartEachPage()) + m_rExport.Strm() << OOO_STRING_SVTOOLS_RTF_LINECONT; +} + +void RtfAttributeOutput::SectionTitlePage() +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + /* + * noop, handled in RtfExport::WriteHeaderFooter() + */ +} + +void RtfAttributeOutput::SectionPageBorders( const SwFrmFmt* pFmt, const SwFrmFmt* /*pFirstPageFmt*/ ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + const SvxBoxItem& rBox = pFmt->GetBox(); + const SvxBorderLine *pLine = rBox.GetTop(); + if(pLine) + m_aSectionBreaks.append(OutBorderLine( m_rExport, pLine, + OOO_STRING_SVTOOLS_RTF_PGBRDRT, + rBox.GetDistance(BOX_LINE_TOP) )); + pLine = rBox.GetBottom(); + if(pLine) + m_aSectionBreaks.append(OutBorderLine( m_rExport, pLine, + OOO_STRING_SVTOOLS_RTF_PGBRDRB, + rBox.GetDistance(BOX_LINE_BOTTOM) )); + pLine = rBox.GetLeft(); + if(pLine) + m_aSectionBreaks.append(OutBorderLine( m_rExport, pLine, + OOO_STRING_SVTOOLS_RTF_PGBRDRL, + rBox.GetDistance(BOX_LINE_LEFT) )); + pLine = rBox.GetRight(); + if(pLine) + m_aSectionBreaks.append(OutBorderLine( m_rExport, pLine, + OOO_STRING_SVTOOLS_RTF_PGBRDRR, + rBox.GetDistance(BOX_LINE_RIGHT) )); +} + +void RtfAttributeOutput::SectionBiDi( bool bBiDi ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + m_rExport.Strm() << (bBiDi ? OOO_STRING_SVTOOLS_RTF_RTLSECT : OOO_STRING_SVTOOLS_RTF_LTRSECT); +} + +void RtfAttributeOutput::SectionPageNumbering( USHORT nNumType, USHORT nPageRestartNumber ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + if (nPageRestartNumber > 0) + { + m_aSectionBreaks.append(OOO_STRING_SVTOOLS_RTF_PGNSTARTS); + m_aSectionBreaks.append((sal_Int32)nPageRestartNumber); + m_aSectionBreaks.append(OOO_STRING_SVTOOLS_RTF_PGNRESTART); + } + + const char* pStr = 0; + switch ( nNumType ) + { + case SVX_NUM_CHARS_UPPER_LETTER: + case SVX_NUM_CHARS_UPPER_LETTER_N: pStr = OOO_STRING_SVTOOLS_RTF_PGNUCLTR; break; + case SVX_NUM_CHARS_LOWER_LETTER: + case SVX_NUM_CHARS_LOWER_LETTER_N: pStr = OOO_STRING_SVTOOLS_RTF_PGNLCLTR; break; + case SVX_NUM_ROMAN_UPPER: pStr = OOO_STRING_SVTOOLS_RTF_PGNUCRM; break; + case SVX_NUM_ROMAN_LOWER: pStr = OOO_STRING_SVTOOLS_RTF_PGNLCRM; break; + + case SVX_NUM_ARABIC: pStr = OOO_STRING_SVTOOLS_RTF_PGNDEC; break; + } + if (pStr) + m_aSectionBreaks.append(pStr); +} + +void RtfAttributeOutput::SectionType( BYTE nBreakCode ) +{ + OSL_TRACE("%s, nBreakCode = %d", OSL_THIS_FUNC, nBreakCode); + + /* + * break code: 0 No break, 1 New column + * 2 New page, 3 Even page, 4 Odd page + */ + const char* sType = NULL; + switch ( nBreakCode ) + { + case 1: sType = OOO_STRING_SVTOOLS_RTF_SBKCOL; break; + case 2: sType = OOO_STRING_SVTOOLS_RTF_SBKPAGE; break; + case 3: sType = OOO_STRING_SVTOOLS_RTF_SBKEVEN; break; + case 4: sType = OOO_STRING_SVTOOLS_RTF_SBKODD; break; + default: sType = OOO_STRING_SVTOOLS_RTF_SBKNONE; break; + } + m_aSectionBreaks.append(sType); + if (!m_bBufferSectionBreaks) + m_rExport.Strm() << m_aSectionBreaks.makeStringAndClear(); +} + +void RtfAttributeOutput::NumberingDefinition( USHORT nId, const SwNumRule &/*rRule*/ ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + m_rExport.Strm() << '{' << OOO_STRING_SVTOOLS_RTF_LISTOVERRIDE; + m_rExport.Strm() << OOO_STRING_SVTOOLS_RTF_LISTID; + m_rExport.OutULong(nId); + m_rExport.Strm() << OOO_STRING_SVTOOLS_RTF_LISTOVERRIDECOUNT << '0'; + m_rExport.Strm() << OOO_STRING_SVTOOLS_RTF_LS; + m_rExport.OutULong(nId) << '}'; +} + +void RtfAttributeOutput::StartAbstractNumbering( USHORT nId ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + m_rExport.Strm() << '{' << OOO_STRING_SVTOOLS_RTF_LIST << OOO_STRING_SVTOOLS_RTF_LISTTEMPLATEID; + m_rExport.OutULong( nId ); + m_nListId = nId; +} + +void RtfAttributeOutput::EndAbstractNumbering() +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + m_rExport.Strm() << OOO_STRING_SVTOOLS_RTF_LISTID; + m_rExport.OutULong( m_nListId ) << '}' << m_rExport.sNewLine; +} + +void RtfAttributeOutput::NumberingLevel( BYTE nLevel, + USHORT nStart, + USHORT nNumberingType, + SvxAdjust eAdjust, + const BYTE * pNumLvlPos, + BYTE /*nFollow*/, + const wwFont * pFont, + const SfxItemSet * pOutSet, + sal_Int16 nIndentAt, + sal_Int16 nFirstLineIndex, + sal_Int16 /*nListTabPos*/, + const String &rNumberingString ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + m_rExport.Strm() << m_rExport.sNewLine; + if( nLevel > 8 ) // RTF knows only 9 levels + m_rExport.Strm() << OOO_STRING_SVTOOLS_RTF_IGNORE << OOO_STRING_SVTOOLS_RTF_SOUTLVL; + + m_rExport.Strm() << '{' << OOO_STRING_SVTOOLS_RTF_LISTLEVEL; + + USHORT nVal = 0; + switch( nNumberingType ) + { + case SVX_NUM_ROMAN_UPPER: nVal = 1; break; + case SVX_NUM_ROMAN_LOWER: nVal = 2; break; + case SVX_NUM_CHARS_UPPER_LETTER: + case SVX_NUM_CHARS_UPPER_LETTER_N: nVal = 3; break; + case SVX_NUM_CHARS_LOWER_LETTER: + case SVX_NUM_CHARS_LOWER_LETTER_N: nVal = 4; break; + + case SVX_NUM_BITMAP: + case SVX_NUM_CHAR_SPECIAL: nVal = 23; break; + } + m_rExport.Strm() << OOO_STRING_SVTOOLS_RTF_LEVELNFC; + m_rExport.OutULong( nVal ); + + switch( eAdjust ) + { + case SVX_ADJUST_CENTER: nVal = 1; break; + case SVX_ADJUST_RIGHT: nVal = 2; break; + default: nVal = 0; break; + } + m_rExport.Strm() << OOO_STRING_SVTOOLS_RTF_LEVELJC; + m_rExport.OutULong( nVal ); + + m_rExport.Strm() << OOO_STRING_SVTOOLS_RTF_LEVELSTARTAT; + m_rExport.OutULong( nStart ); + + m_rExport.Strm() << OOO_STRING_SVTOOLS_RTF_LEVELFOLLOW << "0"; + + // leveltext group + m_rExport.Strm() << '{' << OOO_STRING_SVTOOLS_RTF_LEVELTEXT << ' '; + + if( SVX_NUM_CHAR_SPECIAL == nNumberingType || + SVX_NUM_BITMAP == nNumberingType ) + { + m_rExport.Strm() << "\\'01"; + sal_Unicode cChar = rNumberingString.GetChar(0); + m_rExport.Strm() << "\\u"; + m_rExport.OutULong(cChar); + m_rExport.Strm() << " ?"; + } + else + { + m_rExport.Strm() << "\\'" << m_rExport.OutHex( rNumberingString.Len(), 2 ); + m_rExport.Strm() << m_rExport.OutString( rNumberingString, m_rExport.eDefaultEncoding ); + } + + m_rExport.Strm() << ";}"; + + // write the levelnumbers + m_rExport.Strm() << "{" << OOO_STRING_SVTOOLS_RTF_LEVELNUMBERS; + for( BYTE i = 0; i <= nLevel && pNumLvlPos[ i ]; ++i ) + { + m_rExport.Strm() << "\\'" << m_rExport.OutHex(pNumLvlPos[ i ], 2).getStr(); + } + m_rExport.Strm() << ";}"; + + if( pOutSet ) + { + if (pFont) + { + m_rExport.Strm() << OOO_STRING_SVTOOLS_RTF_F; + m_rExport.OutULong(m_rExport.maFontHelper.GetId(*pFont)); + } + m_rExport.OutputItemSet( *pOutSet, false, true, i18n::ScriptType::LATIN, m_rExport.mbExportModeRTF ); + m_rExport.Strm() << m_aStyles.makeStringAndClear(); + } + + m_rExport.Strm() << OOO_STRING_SVTOOLS_RTF_FI; + m_rExport.OutLong( nFirstLineIndex ) << OOO_STRING_SVTOOLS_RTF_LI; + m_rExport.OutLong( nIndentAt ); + + m_rExport.Strm() << '}'; + if( nLevel > 8 ) + m_rExport.Strm() << '}'; +} + +void RtfAttributeOutput::WriteField_Impl( const SwField* pFld, ww::eField /*eType*/, const String& rFldCmd, BYTE /*nMode*/ ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + // NEEDSWORK this has beeen tested only with page numbers + m_aRunText.append("{" OOO_STRING_SVTOOLS_RTF_FIELD); + m_aRunText.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FLDINST " "); + m_aRunText.append(m_rExport.OutString(rFldCmd, m_rExport.eCurrentEncoding)); + m_aRunText.append("}{" OOO_STRING_SVTOOLS_RTF_FLDRSLT " "); + if (pFld) + m_aRunText.append(m_rExport.OutString(pFld->ExpandField(true), m_rExport.eDefaultEncoding)); + m_aRunText.append("}}"); +} + +void RtfAttributeOutput::WriteBookmarks_Impl( std::vector< rtl::OUString >& rStarts, std::vector< rtl::OUString >& rEnds ) +{ + for ( std::vector< OUString >::const_iterator it = rStarts.begin(), end = rStarts.end(); it < end; ++it ) + { + m_aRun.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_BKMKSTART " "); + m_aRun.append(m_rExport.OutString(*it, m_rExport.eCurrentEncoding)); + m_aRun.append('}'); + } + rStarts.clear(); + + for ( std::vector< OUString >::const_iterator it = rEnds.begin(), end = rEnds.end(); it < end; ++it ) + { + m_aRun.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_BKMKEND " "); + m_aRun.append(m_rExport.OutString(*it, m_rExport.eCurrentEncoding)); + m_aRun.append('}'); + } + rEnds.clear(); +} + +void RtfAttributeOutput::WriteHeaderFooter_Impl( const SwFrmFmt& rFmt, bool bHeader, const sal_Char* pStr ) +{ + OStringBuffer aSectionBreaks = m_aSectionBreaks; + m_aSectionBreaks.setLength(0); + OStringBuffer aRun = m_aRun; + m_aRun.setLength(0); + + m_aSectionHeaders.append(bHeader ? OOO_STRING_SVTOOLS_RTF_HEADERY : OOO_STRING_SVTOOLS_RTF_FOOTERY); + m_aSectionHeaders.append((sal_Int32)m_rExport.pAktPageDesc->GetMaster().GetULSpace().GetUpper()); + m_aSectionHeaders.append('{'); + m_aSectionHeaders.append(pStr); + m_bBufferSectionHeaders = true; + m_rExport.WriteHeaderFooterText(rFmt, bHeader); + m_bBufferSectionHeaders = false; + m_aSectionHeaders.append('}'); + + m_aSectionBreaks = aSectionBreaks; + m_aRun = aRun; +} + +void RtfAttributeOutput::OutputFlyFrame_Impl( const sw::Frame& rFrame, const Point& /*rNdTopLeft*/ ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + const SwNode *pNode = rFrame.GetContent(); + const SwGrfNode *pGrfNode = pNode ? pNode->GetGrfNode() : 0; + + switch ( rFrame.GetWriterType() ) + { + case sw::Frame::eTxtBox: + OSL_ENSURE(m_aRunText.getLength() == 0, "m_aRunText is not empty"); + m_rExport.mpParentFrame = &rFrame; + m_rExport.bOutFlyFrmAttrs = m_rExport.bRTFFlySyntax = true; + m_rExport.OutputFormat( rFrame.GetFrmFmt(), false, false, true ); + m_rExport.Strm() << m_aRunText.makeStringAndClear(); + m_rExport.Strm() << m_aStyles.makeStringAndClear(); + m_rExport.bOutFlyFrmAttrs = m_rExport.bRTFFlySyntax = false; + m_rExport.Strm() << "{" OOO_STRING_SVTOOLS_RTF_IGNORE; + m_rExport.OutputFormat( rFrame.GetFrmFmt(), false, false, true ); + m_rExport.Strm() << m_aRunText.makeStringAndClear(); + m_rExport.Strm() << m_aStyles.makeStringAndClear(); + m_rExport.Strm() << '}'; + + { + /* + * Save m_aRun as we should not loose the opening brace. + * OTOH, just drop the contents of m_aRunText in case something + * would be there, causing a problem later. + */ + OString aSave = m_aRun.makeStringAndClear(); + m_rExport.bRTFFlySyntax = true; + + const SwFrmFmt& rFrmFmt = rFrame.GetFrmFmt( ); + const SwNodeIndex* pNodeIndex = rFrmFmt.GetCntnt().GetCntntIdx(); + ULONG nStt = pNodeIndex ? pNodeIndex->GetIndex()+1 : 0; + ULONG nEnd = pNodeIndex ? pNodeIndex->GetNode().EndOfSectionIndex() : 0; + m_rExport.SaveData( nStt, nEnd ); + m_rExport.mpParentFrame = &rFrame; + m_rExport.WriteText( ); + m_rExport.RestoreData(); + + m_rExport.Strm() << OOO_STRING_SVTOOLS_RTF_PARD; + m_rExport.bRTFFlySyntax = false; + m_aRun.append(aSave); + m_aRunText.setLength(0); + } + + m_rExport.mpParentFrame = NULL; + m_rExport.Strm() << RtfExport::sNewLine; + break; + case sw::Frame::eGraphic: + if (!rFrame.IsInline()) + { + m_rExport.mpParentFrame = &rFrame; + m_rExport.bRTFFlySyntax = true; + m_rExport.OutputFormat( rFrame.GetFrmFmt(), false, false, true ); + m_rExport.bRTFFlySyntax = false; + m_aRunText.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE); + m_rExport.OutputFormat( rFrame.GetFrmFmt(), false, false, true ); + m_aRunText.append('}'); + m_rExport.mpParentFrame = NULL; + } + + if ( pGrfNode ) + FlyFrameGraphic( dynamic_cast<const SwFlyFrmFmt*>( &rFrame.GetFrmFmt() ), *pGrfNode, rFrame.GetLayoutSize() ); + break; + case sw::Frame::eDrawing: + { + const SdrObject* pSdrObj = rFrame.GetFrmFmt().FindRealSdrObject(); + if ( pSdrObj ) + { + bool bSwapInPage = false; + if ( !pSdrObj->GetPage() ) + { + if ( SdrModel* pModel = m_rExport.pDoc->GetDrawModel() ) + { + if ( SdrPage *pPage = pModel->GetPage( 0 ) ) + { + bSwapInPage = true; + const_cast< SdrObject* >( pSdrObj )->SetPage( pPage ); + } + } + } + + m_aRunText.append("{" OOO_STRING_SVTOOLS_RTF_FIELD "{"); + m_aRunText.append(OOO_STRING_SVTOOLS_RTF_IGNORE); + m_aRunText.append(OOO_STRING_SVTOOLS_RTF_FLDINST); + m_aRunText.append(" SHAPE "); + m_aRunText.append("}" "{" OOO_STRING_SVTOOLS_RTF_FLDRSLT); + + m_rExport.SdrExporter().AddSdrObject( *pSdrObj ); + + m_aRunText.append('}'); + m_aRunText.append('}'); + + if ( bSwapInPage ) + const_cast< SdrObject* >( pSdrObj )->SetPage( 0 ); + } + } + break; + case sw::Frame::eFormControl: + { + const SwFrmFmt &rFrmFmt = rFrame.GetFrmFmt(); + const SdrObject *pObject = rFrmFmt.FindRealSdrObject(); + + m_aRun.append("{" OOO_STRING_SVTOOLS_RTF_FIELD); + m_aRun.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FLDINST); + + if (pObject && pObject->GetObjInventor() == FmFormInventor) + { + if (SdrUnoObj *pFormObj = PTR_CAST(SdrUnoObj,pObject)) + { + uno::Reference< awt::XControlModel > xControlModel = + pFormObj->GetUnoControlModel(); + uno::Reference< lang::XServiceInfo > xInfo(xControlModel, uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xPropSet(xControlModel, uno::UNO_QUERY); + uno::Reference<beans::XPropertySetInfo> xPropSetInfo = xPropSet->getPropertySetInfo(); + OUString sName; + if (xInfo->supportsService(C2U("com.sun.star.form.component.CheckBox"))) + { + + m_aRun.append(OUStringToOString(OUString(FieldString(ww::eFORMCHECKBOX)), m_rExport.eCurrentEncoding)); + m_aRun.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FORMFIELD "{"); + m_aRun.append(OOO_STRING_SVTOOLS_RTF_FFTYPE "1"); // 1 = checkbox + // checkbox size in half points, this seems to be always 20, see WW8Export::DoCheckBox() + m_aRun.append(OOO_STRING_SVTOOLS_RTF_FFHPS "20"); + + OUString aStr; + sName = C2U("Name"); + if (xPropSetInfo->hasPropertyByName(sName)) + { + xPropSet->getPropertyValue(sName) >>= aStr; + m_aRun.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFNAME " "); + m_aRun.append(OUStringToOString(aStr, m_rExport.eCurrentEncoding)); + m_aRun.append('}'); + } + + sName = C2U("HelpText"); + if (xPropSetInfo->hasPropertyByName(sName)) + { + xPropSet->getPropertyValue(sName) >>= aStr; + m_aRun.append(OOO_STRING_SVTOOLS_RTF_FFOWNHELP); + m_aRun.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFHELPTEXT " "); + m_aRun.append(OUStringToOString(aStr, m_rExport.eCurrentEncoding)); + m_aRun.append('}'); + } + + sName = C2U("HelpF1Text"); + if (xPropSetInfo->hasPropertyByName(sName)) + { + xPropSet->getPropertyValue(sName) >>= aStr; + m_aRun.append(OOO_STRING_SVTOOLS_RTF_FFOWNSTAT); + m_aRun.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFSTATTEXT " "); + m_aRun.append(OUStringToOString(aStr, m_rExport.eCurrentEncoding)); + m_aRun.append('}'); + } + + sal_Int16 nTemp = 0; + xPropSet->getPropertyValue(C2U("DefaultState")) >>= nTemp; + m_aRun.append(OOO_STRING_SVTOOLS_RTF_FFDEFRES); + m_aRun.append((sal_Int32)nTemp); + xPropSet->getPropertyValue(C2U("State")) >>= nTemp; + m_aRun.append(OOO_STRING_SVTOOLS_RTF_FFRES); + m_aRun.append((sal_Int32)nTemp); + + m_aRun.append("}}"); + + // field result is empty, ffres already contains the form result + m_aRun.append("}{" OOO_STRING_SVTOOLS_RTF_FLDRSLT " "); + } + else if (xInfo->supportsService(C2U("com.sun.star.form.component.TextField"))) + { + OStringBuffer aBuf; + OString aStr; + OUString aTmp; + const sal_Char* pStr; + + m_aRun.append(OUStringToOString(OUString(FieldString(ww::eFORMTEXT)), m_rExport.eCurrentEncoding)); + m_aRun.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_DATAFIELD " "); + for (int i = 0; i < 8; i++) aBuf.append((sal_Char)0x00); + xPropSet->getPropertyValue(C2U("Name")) >>= aTmp; + aStr = OUStringToOString(aTmp, m_rExport.eCurrentEncoding); + aBuf.append((sal_Char)aStr.getLength()); + aBuf.append(aStr); + aBuf.append((sal_Char)0x00); + xPropSet->getPropertyValue(C2U("DefaultText")) >>= aTmp; + aStr = OUStringToOString(aTmp, m_rExport.eCurrentEncoding); + aBuf.append((sal_Char)aStr.getLength()); + aBuf.append(aStr); + for (int i = 0; i < 11; i++) aBuf.append((sal_Char)0x00); + aStr = aBuf.makeStringAndClear(); + pStr = aStr.getStr(); + for (int i = 0; i < aStr.getLength(); i++, pStr++) + m_aRun.append(m_rExport.OutHex(*pStr, 2)); + m_aRun.append('}'); + m_aRun.append("}{" OOO_STRING_SVTOOLS_RTF_FLDRSLT " "); + xPropSet->getPropertyValue(C2U("Text")) >>= aTmp; + m_aRun.append(OUStringToOString(aTmp, m_rExport.eCurrentEncoding)); + m_aRun.append('}'); + m_aRun.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FORMFIELD "{"); + sName = C2U("HelpText"); + if (xPropSetInfo->hasPropertyByName(sName)) + { + xPropSet->getPropertyValue(sName) >>= aTmp; + m_aRun.append(OOO_STRING_SVTOOLS_RTF_FFOWNHELP); + m_aRun.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFHELPTEXT " "); + m_aRun.append(OUStringToOString(aTmp, m_rExport.eCurrentEncoding)); + m_aRun.append('}'); + } + + sName = C2U("HelpF1Text"); + if (xPropSetInfo->hasPropertyByName(sName)) + { + xPropSet->getPropertyValue(sName) >>= aTmp; + m_aRun.append(OOO_STRING_SVTOOLS_RTF_FFOWNSTAT); + m_aRun.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFSTATTEXT " "); + m_aRun.append(OUStringToOString(aTmp, m_rExport.eCurrentEncoding)); + m_aRun.append('}'); + } + m_aRun.append("}"); + } + else if (xInfo->supportsService(C2U("com.sun.star.form.component.ListBox"))) + { + OUString aStr; + uno::Sequence<sal_Int16> aIntSeq; + uno::Sequence<OUString> aStrSeq; + + m_aRun.append(OUStringToOString(OUString(FieldString(ww::eFORMDROPDOWN)), m_rExport.eCurrentEncoding)); + m_aRun.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FORMFIELD "{"); + m_aRun.append(OOO_STRING_SVTOOLS_RTF_FFTYPE "2"); // 2 = list + m_aRun.append(OOO_STRING_SVTOOLS_RTF_FFHASLISTBOX); + + xPropSet->getPropertyValue(C2U("DefaultSelection")) >>= aIntSeq; + if( aIntSeq.getLength() ) + { + m_aRun.append(OOO_STRING_SVTOOLS_RTF_FFDEFRES); + // a dropdown list can have only one 'selected item by default' + m_aRun.append((sal_Int32)aIntSeq[0]); + } + + xPropSet->getPropertyValue(C2U("SelectedItems")) >>= aIntSeq; + if( aIntSeq.getLength() ) + { + m_aRun.append(OOO_STRING_SVTOOLS_RTF_FFRES); + // a dropdown list can have only one 'currently selected item' + m_aRun.append((sal_Int32)aIntSeq[0]); + } + + sName = C2U("Name"); + if (xPropSetInfo->hasPropertyByName(sName)) + { + xPropSet->getPropertyValue(sName) >>= aStr; + m_aRun.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFNAME " "); + m_aRun.append(OUStringToOString(aStr, m_rExport.eCurrentEncoding)); + m_aRun.append('}'); + } + + sName = C2U("HelpText"); + if (xPropSetInfo->hasPropertyByName(sName)) + { + xPropSet->getPropertyValue(sName) >>= aStr; + m_aRun.append(OOO_STRING_SVTOOLS_RTF_FFOWNHELP); + m_aRun.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFHELPTEXT " "); + m_aRun.append(OUStringToOString(aStr, m_rExport.eCurrentEncoding)); + m_aRun.append('}'); + } + + sName = C2U("HelpF1Text"); + if (xPropSetInfo->hasPropertyByName(sName)) + { + xPropSet->getPropertyValue(sName) >>= aStr; + m_aRun.append(OOO_STRING_SVTOOLS_RTF_FFOWNSTAT); + m_aRun.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFSTATTEXT " "); + m_aRun.append(OUStringToOString(aStr, m_rExport.eCurrentEncoding)); + m_aRun.append('}'); + } + + + xPropSet->getPropertyValue(C2U("StringItemList")) >>= aStrSeq; + sal_uInt32 nListItems = aStrSeq.getLength(); + for (sal_uInt32 i = 0; i < nListItems; i++) + m_aRun.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFL " ") + .append(OUStringToOString(aStrSeq[i], m_rExport.eCurrentEncoding)).append('}'); + + m_aRun.append("}}"); + + // field result is empty, ffres already contains the form result + m_aRun.append("}{" OOO_STRING_SVTOOLS_RTF_FLDRSLT " "); + } + else + OSL_TRACE("%s unhandled form control: '%s'", OSL_THIS_FUNC, + OUStringToOString(xInfo->getImplementationName(), m_rExport.eCurrentEncoding).getStr()); + m_aRun.append('}'); + } + } + + m_aRun.append('}'); + } + break; + case sw::Frame::eOle: + { + const SwFrmFmt &rFrmFmt = rFrame.GetFrmFmt(); + const SdrObject *pSdrObj = rFrmFmt.FindRealSdrObject(); + if ( pSdrObj ) + { + SwNodeIndex aIdx(*rFrmFmt.GetCntnt().GetCntntIdx(), 1); + SwOLENode& rOLENd = *aIdx.GetNode().GetOLENode(); + FlyFrameOLE(dynamic_cast<const SwFlyFrmFmt*>( &rFrmFmt ), rOLENd, rFrame.GetLayoutSize()); + } + } + break; + default: + OSL_TRACE("%s: unknown type (%d)", OSL_THIS_FUNC, rFrame.GetWriterType()); + break; + } +} + +void RtfAttributeOutput::CharCaseMap( const SvxCaseMapItem& rCaseMap ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + switch ( rCaseMap.GetValue() ) + { + case SVX_CASEMAP_KAPITAELCHEN: + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_SCAPS); + break; + case SVX_CASEMAP_VERSALIEN: + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_CAPS); + break; + default: // Something that rtf does not support + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_SCAPS); + m_aStyles.append((sal_Int32)0); + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_CAPS); + m_aStyles.append((sal_Int32)0); + break; + } +} + +void RtfAttributeOutput::CharColor( const SvxColorItem& rColor ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + const Color aColor( rColor.GetValue() ); + + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_CF); + m_aStyles.append( (sal_Int32)m_rExport.GetColor( aColor )); +} + +void RtfAttributeOutput::CharContour( const SvxContourItem& rContour ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_OUTL); + if ( !rContour.GetValue() ) + m_aStyles.append((sal_Int32)0); +} + +void RtfAttributeOutput::CharCrossedOut( const SvxCrossedOutItem& rCrossedOut ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + switch ( rCrossedOut.GetStrikeout() ) + { + case STRIKEOUT_NONE: + if (!m_bStrikeDouble) + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_STRIKE); + else + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_STRIKED); + m_aStyles.append((sal_Int32)0); + break; + case STRIKEOUT_DOUBLE: + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_STRIKED); + m_aStyles.append((sal_Int32)1); + break; + default: + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_STRIKE); + break; + } +} + +void RtfAttributeOutput::CharEscapement( const SvxEscapementItem& rEsc ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + const char * pUpDn; + + SwTwips nH = ((SvxFontHeightItem&)m_rExport.GetItem( RES_CHRATR_FONTSIZE )).GetHeight(); + + if( 0 < rEsc.GetEsc() ) + pUpDn = OOO_STRING_SVTOOLS_RTF_UP; + else if( 0 > rEsc.GetEsc() ) + { + pUpDn = OOO_STRING_SVTOOLS_RTF_DN; + nH = -nH; + } + else + return; + + short nEsc = rEsc.GetEsc(); + short nProp = rEsc.GetProp() * 100; + if( DFLT_ESC_AUTO_SUPER == nEsc ) + { + nEsc = 100 - rEsc.GetProp(); + ++nProp; + } + else if( DFLT_ESC_AUTO_SUB == nEsc ) + { + nEsc = - 100 + rEsc.GetProp(); + ++nProp; + } + + m_aStyles.append('{'); + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_IGNORE); + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_UPDNPROP); + m_aStyles.append( (sal_Int32)nProp ); + m_aStyles.append('}'); + m_aStyles.append(pUpDn); + + /* + * Calculate the act. FontSize and the percentage of the displacement; + * RTF file expects half points, while internally it's in twips. + * Formally : (FontSize * 1/20 ) pts x * 2 + * ----------------------- = ------------ + * 100% Escapement + */ + + m_aStyles.append( (sal_Int32) ( (long( nEsc ) * nH) + 500L ) / 1000L ); + // 500L to round !! +} + +void RtfAttributeOutput::CharFont( const SvxFontItem& rFont) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + m_aStylesEnd.append(OOO_STRING_SVTOOLS_RTF_LOCH); + m_aStylesEnd.append(OOO_STRING_SVTOOLS_RTF_F); + m_aStylesEnd.append((sal_Int32)m_rExport.maFontHelper.GetId(rFont)); + m_rExport.eCurrentEncoding = rtl_getTextEncodingFromWindowsCharset(sw::ms::rtl_TextEncodingToWinCharset(rFont.GetCharSet())); +} + +void RtfAttributeOutput::CharFontSize( const SvxFontHeightItem& rFontSize) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + switch ( rFontSize.Which() ) + { + case RES_CHRATR_FONTSIZE: + m_aStylesEnd.append(OOO_STRING_SVTOOLS_RTF_FS); + m_aStylesEnd.append((sal_Int32)(rFontSize.GetHeight() / 10 )); + break; + case RES_CHRATR_CJK_FONTSIZE: + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_FS); + m_aStyles.append((sal_Int32)(rFontSize.GetHeight() / 10 )); + break; + case RES_CHRATR_CTL_FONTSIZE: + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_AFS); + m_aStyles.append((sal_Int32)(rFontSize.GetHeight() / 10 )); + break; + } +} + +void RtfAttributeOutput::CharKerning( const SvxKerningItem& rKerning ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + // in quater points then in twips + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_EXPND); + m_aStyles.append((sal_Int32)(rKerning.GetValue() / 5)); + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_EXPNDTW); + m_aStyles.append((sal_Int32)(rKerning.GetValue())); +} + +void RtfAttributeOutput::CharLanguage( const SvxLanguageItem& rLanguage ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + switch (rLanguage.Which()) + { + case RES_CHRATR_LANGUAGE: + m_aStylesEnd.append(OOO_STRING_SVTOOLS_RTF_LANG); + m_aStylesEnd.append((sal_Int32)rLanguage.GetLanguage()); + break; + case RES_CHRATR_CJK_LANGUAGE: + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_LANGFE); + m_aStyles.append((sal_Int32)rLanguage.GetLanguage()); + break; + case RES_CHRATR_CTL_LANGUAGE: + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_LANG); + m_aStyles.append((sal_Int32)rLanguage.GetLanguage()); + break; + } +} + +void RtfAttributeOutput::CharPosture( const SvxPostureItem& rPosture ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_I); + if ( rPosture.GetPosture() == ITALIC_NONE ) + m_aStyles.append((sal_Int32)0); +} + +void RtfAttributeOutput::CharShadow( const SvxShadowedItem& rShadow ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_SHAD); + if ( !rShadow.GetValue() ) + m_aStyles.append((sal_Int32)0); +} + +void RtfAttributeOutput::CharUnderline( const SvxUnderlineItem& rUnderline ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + const char* pStr = 0; + const SfxPoolItem* pItem = m_rExport.HasItem( RES_CHRATR_WORDLINEMODE ); + bool bWord = false; + if (pItem) + bWord = ((const SvxWordLineModeItem*)pItem)->GetValue() ? true : false; + switch(rUnderline.GetLineStyle() ) + { + case UNDERLINE_SINGLE: + pStr = bWord ? OOO_STRING_SVTOOLS_RTF_ULW : OOO_STRING_SVTOOLS_RTF_UL; + break; + case UNDERLINE_DOUBLE: + pStr = OOO_STRING_SVTOOLS_RTF_ULDB; + break; + case UNDERLINE_NONE: + pStr = OOO_STRING_SVTOOLS_RTF_ULNONE; + break; + case UNDERLINE_DOTTED: + pStr = OOO_STRING_SVTOOLS_RTF_ULD; + break; + case UNDERLINE_DASH: + pStr = OOO_STRING_SVTOOLS_RTF_ULDASH; + break; + case UNDERLINE_DASHDOT: + pStr = OOO_STRING_SVTOOLS_RTF_ULDASHD; + break; + case UNDERLINE_DASHDOTDOT: + pStr = OOO_STRING_SVTOOLS_RTF_ULDASHDD; + break; + case UNDERLINE_BOLD: + pStr = OOO_STRING_SVTOOLS_RTF_ULTH; + break; + case UNDERLINE_WAVE: + pStr = OOO_STRING_SVTOOLS_RTF_ULWAVE; + break; + case UNDERLINE_BOLDDOTTED: + pStr = OOO_STRING_SVTOOLS_RTF_ULTHD; + break; + case UNDERLINE_BOLDDASH: + pStr = OOO_STRING_SVTOOLS_RTF_ULTHDASH; + break; + case UNDERLINE_LONGDASH: + pStr = OOO_STRING_SVTOOLS_RTF_ULLDASH; + break; + case UNDERLINE_BOLDLONGDASH: + pStr = OOO_STRING_SVTOOLS_RTF_ULTHLDASH; + break; + case UNDERLINE_BOLDDASHDOT: + pStr = OOO_STRING_SVTOOLS_RTF_ULTHDASHD; + break; + case UNDERLINE_BOLDDASHDOTDOT: + pStr = OOO_STRING_SVTOOLS_RTF_ULTHDASHDD; + break; + case UNDERLINE_BOLDWAVE: + pStr = OOO_STRING_SVTOOLS_RTF_ULHWAVE; + break; + case UNDERLINE_DOUBLEWAVE: + pStr = OOO_STRING_SVTOOLS_RTF_ULULDBWAVE; + break; + default: + break; + } + + if( pStr ) + { + m_aStyles.append(pStr); + // NEEDSWORK looks like here rUnderline.GetColor() is always black, + // even if the color in the odt is for example green... + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_ULC); + m_aStyles.append( (sal_Int32)m_rExport.GetColor(rUnderline.GetColor()) ); + } +} + +void RtfAttributeOutput::CharWeight( const SvxWeightItem& rWeight ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_B); + if ( rWeight.GetWeight() != WEIGHT_BOLD ) + m_aStyles.append((sal_Int32)0); +} + +void RtfAttributeOutput::CharAutoKern( const SvxAutoKernItem& rAutoKern) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_KERNING); + m_aStyles.append((sal_Int32) (rAutoKern.GetValue() ? 1 : 0)); +} + +void RtfAttributeOutput::CharAnimatedText( const SvxBlinkItem& rBlink ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_ANIMTEXT); + m_aStyles.append((sal_Int32) (rBlink.GetValue() ? 2 : 0)); +} + +void RtfAttributeOutput::CharBackground( const SvxBrushItem& rBrush ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + if( !rBrush.GetColor().GetTransparency() ) + { + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_CHCBPAT); + m_aStyles.append((sal_Int32)m_rExport.GetColor(rBrush.GetColor())); + } +} + +void RtfAttributeOutput::CharFontCJK( const SvxFontItem& rFont ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_HICH); + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_AF); + m_aStyles.append((sal_Int32)m_rExport.maFontHelper.GetId(rFont)); +} + +void RtfAttributeOutput::CharFontSizeCJK( const SvxFontHeightItem& rFontSize ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + CharFontSize( rFontSize ); +} + +void RtfAttributeOutput::CharLanguageCJK( const SvxLanguageItem& rLanguageItem ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + CharLanguage( rLanguageItem ); +} + +void RtfAttributeOutput::CharPostureCJK( const SvxPostureItem& rPosture ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_I); + if ( rPosture.GetPosture() == ITALIC_NONE ) + m_aStyles.append((sal_Int32)0); +} + +void RtfAttributeOutput::CharWeightCJK( const SvxWeightItem& rWeight ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_B); + if ( rWeight.GetWeight() != WEIGHT_BOLD ) + m_aStyles.append((sal_Int32)0); +} + +void RtfAttributeOutput::CharFontCTL( const SvxFontItem& rFont ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_DBCH); + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_AF); + m_aStyles.append((sal_Int32)m_rExport.maFontHelper.GetId(rFont)); +} + +void RtfAttributeOutput::CharFontSizeCTL( const SvxFontHeightItem& rFontSize ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + CharFontSize( rFontSize ); +} + +void RtfAttributeOutput::CharLanguageCTL( const SvxLanguageItem& rLanguageItem ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + CharLanguage( rLanguageItem ); +} + +void RtfAttributeOutput::CharPostureCTL( const SvxPostureItem& rPosture) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_AI); + if ( rPosture.GetPosture() == ITALIC_NONE ) + m_aStyles.append((sal_Int32)0); +} + +void RtfAttributeOutput::CharWeightCTL( const SvxWeightItem& rWeight ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_AB); + if ( rWeight.GetWeight() != WEIGHT_BOLD ) + m_aStyles.append((sal_Int32)0); +} + +void RtfAttributeOutput::CharRotate( const SvxCharRotateItem& rRotate) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_HORZVERT); + m_aStyles.append((sal_Int32)(rRotate.IsFitToLine() ? 1 : 0)); +} + +void RtfAttributeOutput::CharEmphasisMark( const SvxEmphasisMarkItem& rEmphasisMark ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + const sal_Char* pStr; + switch( rEmphasisMark.GetEmphasisMark()) + { + case EMPHASISMARK_NONE: pStr = OOO_STRING_SVTOOLS_RTF_ACCNONE; break; + case EMPHASISMARK_SIDE_DOTS: pStr = OOO_STRING_SVTOOLS_RTF_ACCCOMMA; break; + default: pStr = OOO_STRING_SVTOOLS_RTF_ACCDOT; break; + } + m_aStyles.append(pStr); +} + +void RtfAttributeOutput::CharTwoLines( const SvxTwoLinesItem& rTwoLines ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + if( rTwoLines.GetValue() ) + { + sal_Unicode cStart = rTwoLines.GetStartBracket(); + sal_Unicode cEnd = rTwoLines.GetEndBracket(); + + USHORT nType; + if( !cStart && !cEnd ) + nType = 0; + else if( '{' == cStart || '}' == cEnd ) + nType = 4; + else if( '<' == cStart || '>' == cEnd ) + nType = 3; + else if( '[' == cStart || ']' == cEnd ) + nType = 2; + else // all other kind of brackets + nType = 1; + + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_TWOINONE); + m_aStyles.append((sal_Int32)nType); + } +} + +void RtfAttributeOutput::CharScaleWidth( const SvxCharScaleWidthItem& rScaleWidth ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_CHARSCALEX); + m_aStyles.append((sal_Int32)rScaleWidth.GetValue()); +} + +void RtfAttributeOutput::CharRelief( const SvxCharReliefItem& rRelief ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + const sal_Char* pStr; + switch (rRelief.GetValue()) + { + case RELIEF_EMBOSSED: + pStr = OOO_STRING_SVTOOLS_RTF_EMBO; + break; + case RELIEF_ENGRAVED: + pStr = OOO_STRING_SVTOOLS_RTF_IMPR; + break; + default: + pStr = 0; + break; + } + + if (pStr) + m_aStyles.append(pStr); +} + +void RtfAttributeOutput::CharHidden( const SvxCharHiddenItem& rHidden ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_V); + if ( !rHidden.GetValue() ) + m_aStyles.append((sal_Int32)0); +} + +void RtfAttributeOutput::TextINetFormat( const SwFmtINetFmt& rURL ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + if( rURL.GetValue().Len() ) + { + const SwCharFmt* pFmt; + const SwTxtINetFmt* pTxtAtr = rURL.GetTxtINetFmt(); + + m_aStyles.append("{" OOO_STRING_SVTOOLS_RTF_FLDRSLT " "); + if( pTxtAtr && 0 != ( pFmt = pTxtAtr->GetCharFmt() )) + { + USHORT nStyle = m_rExport.GetId( *pFmt ); + OString* pString = m_rExport.GetStyle(nStyle); + if (pString) + m_aStyles.append(*pString); + } + } +} + +void RtfAttributeOutput::TextCharFormat( const SwFmtCharFmt& rCharFmt ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + USHORT nStyle = m_rExport.GetId( *rCharFmt.GetCharFmt() ); + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_CS); + m_aStyles.append((sal_Int32)nStyle); + OString* pString = m_rExport.GetStyle(nStyle); + if (pString) + m_aStyles.append(*pString); +} + +void RtfAttributeOutput::WriteTextFootnoteNumStr(const SwFmtFtn& rFootnote) +{ + if (!rFootnote.GetNumStr().Len()) + m_aRun.append(OOO_STRING_SVTOOLS_RTF_CHFTN); + else + m_aRun.append(m_rExport.OutString(rFootnote.GetNumStr(), m_rExport.eCurrentEncoding)); +} + +void RtfAttributeOutput::TextFootnote_Impl( const SwFmtFtn& rFootnote ) +{ + OSL_TRACE("%s start", OSL_THIS_FUNC); + + m_aRun.append("{" OOO_STRING_SVTOOLS_RTF_SUPER " "); + WriteTextFootnoteNumStr(rFootnote); + m_aRun.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FOOTNOTE); + if( rFootnote.IsEndNote() ) + m_aRun.append(OOO_STRING_SVTOOLS_RTF_FTNALT); + m_aRun.append(' '); + WriteTextFootnoteNumStr(rFootnote); + + /* + * The footnote contains a whole paragraph, so we have to: + * 1) Reset, then later restore the contents of our run buffer. + * 2) Buffer the output of the whole paragraph, as we do so for section headers already. + */ + const SwNodeIndex* pIndex = rFootnote.GetTxtFtn()->GetStartNode(); + OStringBuffer aRun = m_aRun; + m_aRun.setLength(0); + m_bBufferSectionHeaders = true; + m_rExport.WriteSpecialText( pIndex->GetIndex() + 1, + pIndex->GetNode().EndOfSectionIndex(), + !rFootnote.IsEndNote() ? TXT_FTN : TXT_EDN); + m_bBufferSectionHeaders = false; + m_aRun = aRun; + m_aRun.append(m_aSectionHeaders.makeStringAndClear()); + + m_aRun.append("}"); + m_aRun.append("}"); + + OSL_TRACE("%s end", OSL_THIS_FUNC); +} + +void RtfAttributeOutput::ParaLineSpacing_Impl( short nSpace, short nMulti ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_SL); + m_aStyles.append((sal_Int32)nSpace); + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_SLMULT); + m_aStyles.append((sal_Int32)nMulti); + +} + +void RtfAttributeOutput::ParaAdjust( const SvxAdjustItem& rAdjust ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + switch ( rAdjust.GetAdjust() ) + { + case SVX_ADJUST_LEFT: + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_QL); + break; + case SVX_ADJUST_RIGHT: + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_QR); + break; + case SVX_ADJUST_BLOCKLINE: + case SVX_ADJUST_BLOCK: + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_QJ); + break; + case SVX_ADJUST_CENTER: + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_QC); + break; + default: + break; + } +} + +void RtfAttributeOutput::ParaSplit( const SvxFmtSplitItem& rSplit ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + if( !rSplit.GetValue() ) + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_KEEP); +} + +void RtfAttributeOutput::ParaWidows( const SvxWidowsItem& rWidows ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + if (rWidows.GetValue()) + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_WIDCTLPAR); + else + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_NOWIDCTLPAR); +} + +void RtfAttributeOutput::ParaTabStop( const SvxTabStopItem& rTabStop ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + long nOffset = ((SvxLRSpaceItem&)m_rExport.GetItem( RES_LR_SPACE )).GetTxtLeft(); + for( USHORT n = 0; n < rTabStop.Count(); n++ ) + { + const SvxTabStop & rTS = rTabStop[ n ]; + if( SVX_TAB_ADJUST_DEFAULT != rTS.GetAdjustment() ) + { + const char* pFill = 0; + switch( rTS.GetFill() ) + { + case cDfltFillChar: + break; + + case '.': pFill = OOO_STRING_SVTOOLS_RTF_TLDOT; break; + case '_': pFill = OOO_STRING_SVTOOLS_RTF_TLUL; break; + case '-': pFill = OOO_STRING_SVTOOLS_RTF_TLTH; break; + case '=': pFill = OOO_STRING_SVTOOLS_RTF_TLEQ; break; + default: + break; + } + if( pFill ) + m_aStyles.append(pFill); + + const sal_Char* pAdjStr = 0; + switch (rTS.GetAdjustment()) + { + case SVX_TAB_ADJUST_RIGHT: + pAdjStr = OOO_STRING_SVTOOLS_RTF_TQR; + break; + case SVX_TAB_ADJUST_DECIMAL: + pAdjStr = OOO_STRING_SVTOOLS_RTF_TQDEC; + break; + case SVX_TAB_ADJUST_CENTER: + pAdjStr = OOO_STRING_SVTOOLS_RTF_TQC; + break; + default: + break; + } + if (pAdjStr) + m_aStyles.append(pAdjStr); + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_TX); + m_aStyles.append((sal_Int32)(rTS.GetTabPos() + nOffset)); + } + else + { + m_aTabStop.append( OOO_STRING_SVTOOLS_RTF_DEFTAB ); + m_aTabStop.append( (sal_Int32)rTabStop[0].GetTabPos() ); + } + } +} + +void RtfAttributeOutput::ParaHyphenZone( const SvxHyphenZoneItem& rHyphenZone ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + sal_Int32 nFlags = rHyphenZone.IsHyphen() ? 1 : 0; + if( rHyphenZone.IsPageEnd() ) + nFlags += 2; + m_aStyles.append('{'); + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_IGNORE); + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_HYPHEN); + m_aStyles.append((sal_Int32)nFlags); + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_HYPHLEAD); + m_aStyles.append((sal_Int32)rHyphenZone.GetMinLead()); + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_HYPHTRAIL); + m_aStyles.append((sal_Int32)rHyphenZone.GetMinTrail()); + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_HYPHMAX); + m_aStyles.append((sal_Int32)rHyphenZone.GetMaxHyphens()); + m_aStyles.append('}'); +} + +void RtfAttributeOutput::ParaNumRule_Impl( const SwTxtNode* pTxtNd, sal_Int32 nLvl, sal_Int32 nNumId ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + if ( USHRT_MAX == nNumId || 0 == nNumId || 0 == pTxtNd) + return; + + const SwNumRule* pRule = pTxtNd->GetNumRule(); + + // --> OD 2008-03-18 #refactorlists# + // if( pRule && MAXLEVEL > pTxtNd->GetActualListLevel() ) + if( pRule && pTxtNd->IsInList() ) + // <-- + { + // --> OD 2008-03-18 #refactorlists# + ASSERT( pTxtNd->GetActualListLevel() >= 0 && pTxtNd->GetActualListLevel() < MAXLEVEL, + "<SwRTFWriter::OutListNum(..)> - text node does not have valid list level. Serious defect -> please inform OD" ); + // <-- + + const bool bExportNumRule = USHRT_MAX != nNumId; + const SwNumFmt* pFmt = pRule->GetNumFmt( nLvl ); + if( !pFmt ) + pFmt = &pRule->Get( nLvl ); + + const SfxItemSet& rNdSet = pTxtNd->GetSwAttrSet(); + + if ( bExportNumRule ) { + m_aStyles.append('{'); + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_LISTTEXT); + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_PARD); + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_PLAIN); + m_aStyles.append(' '); + } + + SvxLRSpaceItem aLR( (SvxLRSpaceItem&)rNdSet.Get( RES_LR_SPACE ) ); + aLR.SetTxtLeft( aLR.GetTxtLeft() + pFmt->GetIndentAt() ); + aLR.SetTxtFirstLineOfst( pFmt->GetFirstLineOffset() ); + + USHORT nStyle = m_rExport.GetId( *pFmt->GetCharFmt() ); + OString* pString = m_rExport.GetStyle(nStyle); + if (pString) + m_aStyles.append(*pString); + + { + String sTxt; + if( SVX_NUM_CHAR_SPECIAL == pFmt->GetNumberingType() || SVX_NUM_BITMAP == pFmt->GetNumberingType() ) + sTxt = pFmt->GetBulletChar(); + else + sTxt = pTxtNd->GetNumString(); + + m_aStyles.append(' '); + + if (sTxt.Len()) + { + m_aStyles.append(m_rExport.OutString(sTxt, m_rExport.eDefaultEncoding)); + } + + if( bExportNumRule ) + { + if( OUTLINE_RULE != pRule->GetRuleType() ) + { + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_TAB); + m_aStyles.append('}'); + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_ILVL); + if( nLvl > 8 ) // RTF knows only 9 levels + { + m_aStyles.append((sal_Int32)8); + m_aStyles.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_SOUTLVL); + m_aStyles.append((sal_Int32)nLvl); + m_aStyles.append('}'); + } + else + m_aStyles.append((sal_Int32)nLvl); + } + else + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_TAB "}"); + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_LS); + m_aStyles.append((sal_Int32)m_rExport.GetId(*pRule)+1); + m_aStyles.append(' '); + } + else if( sTxt.Len() ) + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_TAB); + } + FormatLRSpace(aLR); + } +} + +void RtfAttributeOutput::ParaScriptSpace( const SfxBoolItem& rScriptSpace ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + if (!rScriptSpace.GetValue( )) + return; + switch ( rScriptSpace.Which( ) ) + { + case RES_PARATR_SCRIPTSPACE: + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_ASPALPHA); + break; + /* Is this needed? + case RES_PARATR_HANGINGPUNCTUATION: + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_NOOVERFLOW); + break; + case RES_PARATR_FORBIDDEN_RULES: + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_NOCWRAP); + break;*/ + default: + break; + } +} + +void RtfAttributeOutput::ParaVerticalAlign( const SvxParaVertAlignItem& rAlign ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + const char* pStr; + switch ( rAlign.GetValue() ) + { + case SvxParaVertAlignItem::TOP: pStr = OOO_STRING_SVTOOLS_RTF_FAHANG; break; + case SvxParaVertAlignItem::BOTTOM: pStr = OOO_STRING_SVTOOLS_RTF_FAVAR; break; + case SvxParaVertAlignItem::CENTER: pStr = OOO_STRING_SVTOOLS_RTF_FACENTER; break; + case SvxParaVertAlignItem::BASELINE: pStr = OOO_STRING_SVTOOLS_RTF_FAROMAN; break; + // default == SvxParaVertAlignItem::AUTOMATIC + default: pStr = OOO_STRING_SVTOOLS_RTF_FAAUTO; break; + } + m_aStyles.append(pStr); +} + +void RtfAttributeOutput::ParaSnapToGrid( const SvxParaGridItem& /*rGrid*/ ) +{ + OSL_TRACE("TODO: %s", OSL_THIS_FUNC); +} + +void RtfAttributeOutput::FormatFrameSize( const SwFmtFrmSize& rSize ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + if ( m_rExport.bOutFlyFrmAttrs && m_rExport.bRTFFlySyntax ) + { + if( rSize.GetWidth() ) + { + m_aRunText.append(OOO_STRING_SVTOOLS_RTF_ABSW); + m_aRunText.append((sal_Int32)rSize.GetWidth()); + } + + if( rSize.GetHeight() ) + { + long nH = rSize.GetHeight(); + if( ATT_FIX_SIZE == rSize.GetHeightSizeType() ) + nH = -nH; + m_aRunText.append(OOO_STRING_SVTOOLS_RTF_ABSH); + m_aRunText.append((sal_Int32)nH); + } + } + else if (m_rExport.bOutPageDescs) + { + m_aSectionBreaks.append(OOO_STRING_SVTOOLS_RTF_PGWSXN); + m_aSectionBreaks.append((sal_Int32)rSize.GetWidth()); + m_aSectionBreaks.append(OOO_STRING_SVTOOLS_RTF_PGHSXN); + m_aSectionBreaks.append((sal_Int32)rSize.GetHeight()); + if (!m_bBufferSectionBreaks) + m_rExport.Strm() << m_aSectionBreaks.makeStringAndClear(); + } +} + +void RtfAttributeOutput::FormatPaperBin( const SvxPaperBinItem& ) +{ + OSL_TRACE("TODO: %s", OSL_THIS_FUNC); +} + +void RtfAttributeOutput::FormatLRSpace( const SvxLRSpaceItem& rLRSpace ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + if ( !m_rExport.bOutFlyFrmAttrs ) + { + if( m_rExport.bOutPageDescs ) + { + if( rLRSpace.GetLeft() ) + { + m_aSectionBreaks.append(OOO_STRING_SVTOOLS_RTF_MARGLSXN); + m_aSectionBreaks.append((sal_Int32)rLRSpace.GetLeft()); + } + if( rLRSpace.GetRight() ) + { + m_aSectionBreaks.append(OOO_STRING_SVTOOLS_RTF_MARGRSXN); + m_aSectionBreaks.append((sal_Int32)rLRSpace.GetRight()); + } + if (!m_bBufferSectionBreaks) + m_rExport.Strm() << m_aSectionBreaks.makeStringAndClear(); + } + else + { + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_LI); + m_aStyles.append( (sal_Int32) rLRSpace.GetTxtLeft() ); + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_RI); + m_aStyles.append( (sal_Int32) rLRSpace.GetRight() ); + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_LIN); + m_aStyles.append( (sal_Int32) rLRSpace.GetTxtLeft() ); + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_RIN); + m_aStyles.append( (sal_Int32) rLRSpace.GetRight() ); + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_FI); + m_aStyles.append( (sal_Int32) rLRSpace.GetTxtFirstLineOfst() ); + } + } + else if (rLRSpace.GetLeft() == rLRSpace.GetRight() && m_rExport.bRTFFlySyntax) + { + m_rExport.Strm() << OOO_STRING_SVTOOLS_RTF_DFRMTXTX; + m_rExport.OutLong( rLRSpace.GetLeft() ); + } +} + +void RtfAttributeOutput::FormatULSpace( const SvxULSpaceItem& rULSpace ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + if ( !m_rExport.bOutFlyFrmAttrs ) + { + if( m_rExport.bOutPageDescs ) + { + + ASSERT( m_rExport.GetCurItemSet(), "Impossible" ); + if ( !m_rExport.GetCurItemSet() ) + return; + + HdFtDistanceGlue aDistances( *m_rExport.GetCurItemSet() ); + + if ( aDistances.HasHeader() ) + { + if( aDistances.dyaTop ) + { + m_aSectionBreaks.append(OOO_STRING_SVTOOLS_RTF_MARGTSXN); + m_aSectionBreaks.append((sal_Int32)aDistances.dyaTop); + } + m_aSectionBreaks.append(OOO_STRING_SVTOOLS_RTF_HEADERY); + m_aSectionBreaks.append((sal_Int32)aDistances.dyaHdrTop); + } + + if( aDistances.HasFooter() ) + { + if( aDistances.dyaBottom ) + { + m_aSectionBreaks.append(OOO_STRING_SVTOOLS_RTF_MARGBSXN); + m_aSectionBreaks.append((sal_Int32)aDistances.dyaBottom); + } + m_aSectionBreaks.append(OOO_STRING_SVTOOLS_RTF_FOOTERY); + m_aSectionBreaks.append((sal_Int32)aDistances.dyaHdrBottom); + } + if (!m_bBufferSectionBreaks) + m_rExport.Strm() << m_aSectionBreaks.makeStringAndClear(); + } + else + { + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_SB); + m_aStyles.append( (sal_Int32) rULSpace.GetUpper() ); + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_SA); + m_aStyles.append( (sal_Int32) rULSpace.GetLower() ); + } + } + else if (rULSpace.GetUpper() == rULSpace.GetLower() && m_rExport.bRTFFlySyntax) + { + m_rExport.Strm() << OOO_STRING_SVTOOLS_RTF_DFRMTXTY; + m_rExport.OutLong( rULSpace.GetLower() ); + } +} + +void RtfAttributeOutput::FormatSurround( const SwFmtSurround& rSurround ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + if ( m_rExport.bOutFlyFrmAttrs && !m_rExport.bRTFFlySyntax ) + { + SwSurround eSurround = rSurround.GetSurround(); + BOOL bGold = SURROUND_IDEAL == eSurround; + if( bGold ) + eSurround = SURROUND_PARALLEL; + RTFSurround aMC( bGold, static_cast< BYTE >(eSurround) ); + m_aRunText.append(OOO_STRING_SVTOOLS_RTF_FLYMAINCNT); + m_aRunText.append( (sal_Int32) aMC.GetValue() ); + } +} + +void RtfAttributeOutput::FormatVertOrientation( const SwFmtVertOrient& rFlyVert ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + if ( m_rExport.bOutFlyFrmAttrs && m_rExport.bRTFFlySyntax ) + { + m_aRunText.append(OOO_STRING_SVTOOLS_RTF_PVPARA); + + switch (rFlyVert.GetVertOrient()) + { + case text::VertOrientation::TOP: + case text::VertOrientation::LINE_TOP: + m_aRunText.append(OOO_STRING_SVTOOLS_RTF_POSYT); + break; + case text::VertOrientation::BOTTOM: + case text::VertOrientation::LINE_BOTTOM: + m_aRunText.append(OOO_STRING_SVTOOLS_RTF_POSYB); + break; + case text::VertOrientation::CENTER: + case text::VertOrientation::LINE_CENTER: + m_aRunText.append(OOO_STRING_SVTOOLS_RTF_POSYC); + break; + case text::VertOrientation::NONE: + m_aRunText.append(OOO_STRING_SVTOOLS_RTF_POSY); + m_aRunText.append((sal_Int32)rFlyVert.GetPos()); + break; + default: + break; + } + } + else if ( !m_rExport.bRTFFlySyntax ) + { + RTFVertOrient aVO( static_cast< USHORT >(rFlyVert.GetVertOrient()), static_cast< USHORT >(rFlyVert.GetRelationOrient()) ); + m_aRunText.append(OOO_STRING_SVTOOLS_RTF_FLYVERT); + m_aRunText.append((sal_Int32)aVO.GetValue()); + } +} + +void RtfAttributeOutput::FormatHorizOrientation( const SwFmtHoriOrient& rFlyHori ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + if ( m_rExport.bOutFlyFrmAttrs && m_rExport.bRTFFlySyntax ) + { + m_aRunText.append(OOO_STRING_SVTOOLS_RTF_PHCOL); + + const char* pS = 0; + switch(rFlyHori.GetHoriOrient()) + { + case text::HoriOrientation::RIGHT: + pS = rFlyHori.IsPosToggle() ? OOO_STRING_SVTOOLS_RTF_POSXO : OOO_STRING_SVTOOLS_RTF_POSXR; + break; + case text::HoriOrientation::LEFT: + pS = rFlyHori.IsPosToggle() ? OOO_STRING_SVTOOLS_RTF_POSXI : OOO_STRING_SVTOOLS_RTF_POSXL; + break; + case text::HoriOrientation::CENTER: + pS = OOO_STRING_SVTOOLS_RTF_POSXC; + break; + case text::HoriOrientation::NONE: + m_aRunText.append(OOO_STRING_SVTOOLS_RTF_POSX); + m_aRunText.append((sal_Int32)rFlyHori.GetPos()); + break; + default: + break; + } + if (pS) + m_aRunText.append(pS); + } else if ( !m_rExport.bRTFFlySyntax ) + { + RTFHoriOrient aHO( static_cast< USHORT >(rFlyHori.GetHoriOrient()), + static_cast< USHORT >(rFlyHori.GetRelationOrient()) ); + m_aRunText.append(OOO_STRING_SVTOOLS_RTF_FLYHORZ); + m_aRunText.append((sal_Int32)aHO.GetValue()); + } +} + +void RtfAttributeOutput::FormatAnchor( const SwFmtAnchor& rAnchor ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + if ( !m_rExport.bRTFFlySyntax ) + { + USHORT nId = static_cast< USHORT >(rAnchor.GetAnchorId()); + m_aRunText.append(OOO_STRING_SVTOOLS_RTF_FLYANCHOR); + m_aRunText.append((sal_Int32)nId); + switch( nId ) + { + case FLY_AT_PAGE: + m_aRunText.append(OOO_STRING_SVTOOLS_RTF_FLYPAGE); + m_aRunText.append((sal_Int32)rAnchor.GetPageNum()); + break; + case FLY_AT_PARA: + case FLY_AS_CHAR: + m_aRunText.append(OOO_STRING_SVTOOLS_RTF_FLYCNTNT); + break; + } + } +} + +void RtfAttributeOutput::FormatBackground( const SvxBrushItem& rBrush ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + if( !rBrush.GetColor().GetTransparency() ) + { + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_CBPAT); + m_aStyles.append((sal_Int32)m_rExport.GetColor(rBrush.GetColor())); + } +} + +void RtfAttributeOutput::FormatBox( const SvxBoxItem& rBox ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + static USHORT __READONLY_DATA aBorders[] = { + BOX_LINE_TOP, BOX_LINE_LEFT, BOX_LINE_BOTTOM, BOX_LINE_RIGHT }; + static const sal_Char* aBorderNames[] = { + OOO_STRING_SVTOOLS_RTF_BRDRT, OOO_STRING_SVTOOLS_RTF_BRDRL, OOO_STRING_SVTOOLS_RTF_BRDRB, OOO_STRING_SVTOOLS_RTF_BRDRR }; + + USHORT nDist = rBox.GetDistance(); + + if ( m_rExport.bRTFFlySyntax ) + return; + + if( rBox.GetTop() && rBox.GetBottom() && + rBox.GetLeft() && rBox.GetRight() && + *rBox.GetTop() == *rBox.GetBottom() && + *rBox.GetTop() == *rBox.GetLeft() && + *rBox.GetTop() == *rBox.GetRight() && + nDist == rBox.GetDistance( BOX_LINE_TOP ) && + nDist == rBox.GetDistance( BOX_LINE_LEFT ) && + nDist == rBox.GetDistance( BOX_LINE_BOTTOM ) && + nDist == rBox.GetDistance( BOX_LINE_RIGHT )) + m_aSectionBreaks.append(OutBorderLine( m_rExport, rBox.GetTop(), OOO_STRING_SVTOOLS_RTF_BOX, nDist )); + else + { + const USHORT* pBrd = aBorders; + const sal_Char** pBrdNms = (const sal_Char**)aBorderNames; + for(int i = 0; i < 4; ++i, ++pBrd, ++pBrdNms) + { + if (const SvxBorderLine* pLn = rBox.GetLine(*pBrd)) + { + m_aSectionBreaks.append(OutBorderLine(m_rExport, pLn, *pBrdNms, + rBox.GetDistance(*pBrd))); + } + } + } + + const USHORT* pBrd = aBorders; + const sal_Char** pBrdNms = (const sal_Char**)aBorderNames; + for( int i = 0; i < 4; ++i, ++pBrd, ++pBrdNms ) + { + const SvxBorderLine* pLn = rBox.GetLine( *pBrd ); + if( pLn ) + { + m_aSectionBreaks.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE); + m_aSectionBreaks.append(OutBorderLine( m_rExport, pLn, *pBrdNms )); + m_aSectionBreaks.append("}" OOO_STRING_SVTOOLS_RTF_BRSP); + m_aSectionBreaks.append((sal_Int32)rBox.GetDistance( *pBrd )); + } + } + + if (!m_bBufferSectionBreaks) + m_aStyles.append(m_aSectionBreaks.makeStringAndClear()); +} + +void RtfAttributeOutput::FormatColumns_Impl( USHORT nCols, const SwFmtCol& rCol, bool bEven, SwTwips nPageSize ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + m_rExport.Strm() << OOO_STRING_SVTOOLS_RTF_COLS; + m_rExport.OutLong( nCols ); + + if( bEven ) + { + m_rExport.Strm() << OOO_STRING_SVTOOLS_RTF_COLSX; + m_rExport.OutLong( rCol.GetGutterWidth( TRUE ) ); + } + else + { + const SwColumns & rColumns = rCol.GetColumns( ); + for( USHORT n = 0; n < nCols; ) + { + m_rExport.Strm() << OOO_STRING_SVTOOLS_RTF_COLNO; + m_rExport.OutLong( n+1 ); + + m_rExport.Strm() << OOO_STRING_SVTOOLS_RTF_COLW; + m_rExport.OutLong( rCol.CalcPrtColWidth( n, nPageSize ) ); + + if( ++n != nCols ) + { + m_rExport.Strm() << OOO_STRING_SVTOOLS_RTF_COLSR; + m_rExport.OutLong( rColumns[ n-1 ]->GetRight() + + rColumns[ n ]->GetLeft() ); + } + } + } +} + +void RtfAttributeOutput::FormatKeep( const SvxFmtKeepItem& rItem ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + if( rItem.GetValue() ) + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_KEEPN); +} + +void RtfAttributeOutput::FormatTextGrid( const SwTextGridItem& /*rGrid*/ ) +{ + OSL_TRACE("TODO: %s", OSL_THIS_FUNC); +} + +void RtfAttributeOutput::FormatLineNumbering( const SwFmtLineNumber& rNumbering ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + if ( !rNumbering.IsCount( ) ) + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_NOLINE); +} + +void RtfAttributeOutput::FormatFrameDirection( const SvxFrameDirectionItem& rDirection ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + if (!m_rExport.bOutPageDescs) + { + if (rDirection.GetValue() == FRMDIR_HORI_RIGHT_TOP) + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_RTLPAR); + else + m_aStyles.append(OOO_STRING_SVTOOLS_RTF_LTRPAR); + } +} + +void RtfAttributeOutput::WriteExpand( const SwField* /*pFld*/ ) +{ + OSL_TRACE("TODO: %s", OSL_THIS_FUNC); +} + +void RtfAttributeOutput::RefField( const SwField& /*rFld*/, const String& /*rRef*/ ) +{ + OSL_TRACE("TODO: %s", OSL_THIS_FUNC); +} + +void RtfAttributeOutput::HiddenField( const SwField& /*rFld*/ ) +{ + OSL_TRACE("TODO: %s", OSL_THIS_FUNC); +} + +void RtfAttributeOutput::SetField( const SwField& /*rFld*/, ww::eField /*eType*/, const String& /*rCmd*/ ) +{ + OSL_TRACE("TODO: %s", OSL_THIS_FUNC); +} + +void RtfAttributeOutput::PostitField( const SwField* pFld ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + const SwPostItField& rPFld = *(SwPostItField*)pFld; + + m_aRunText.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_ATNID " "); + m_aRunText.append(OUStringToOString(OUString(rPFld.GetPar1()), m_rExport.eCurrentEncoding)); + m_aRunText.append("}"); + m_aRunText.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_ATNAUTHOR " "); + m_aRunText.append(OUStringToOString(OUString(rPFld.GetPar1()), m_rExport.eCurrentEncoding)); + m_aRunText.append("}"); + m_aRunText.append(OOO_STRING_SVTOOLS_RTF_CHATN); + + m_aRunText.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_ANNOTATION); + m_aRunText.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_ATNDATE " "); + m_aRunText.append((sal_Int32)sw::ms::DateTime2DTTM(rPFld.GetDate())); + m_aRunText.append('}'); + m_aRunText.append(OUStringToOString(OUString(rPFld.GetTxt()), m_rExport.eCurrentEncoding)); + m_aRunText.append('}'); +} + +bool RtfAttributeOutput::DropdownField( const SwField* /*pFld*/ ) +{ + // this is handled in OutputFlyFrame_Impl() + return true; +} + +RtfAttributeOutput::RtfAttributeOutput( RtfExport &rExport ) + : m_rExport( rExport ), + m_pTableWrt( NULL ), + m_bTableCellOpen( false ), + m_nTableDepth( 0 ), + m_bTblAfterCell( false ), + m_nColBreakNeeded( false ), + m_bBufferSectionBreaks( false ), + m_bBufferSectionHeaders( false ), + m_bLastTable( true ), + m_bWroteCellInfo( false ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); +} + +RtfAttributeOutput::~RtfAttributeOutput() +{ + OSL_TRACE("%s", OSL_THIS_FUNC); +} + +MSWordExportBase& RtfAttributeOutput::GetExport() +{ + return m_rExport; +} + +// These are used by wwFont::WriteRtf() + +/// Start the font. +void RtfAttributeOutput::StartFont( const String& rFamilyName ) const +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + m_rExport.Strm() << OUStringToOString( OUString( rFamilyName ), m_rExport.eCurrentEncoding ).getStr(); +} + +/// End the font. +void RtfAttributeOutput::EndFont() const +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + m_rExport.Strm() << ";}"; +} + +/// Alternate name for the font. +void RtfAttributeOutput::FontAlternateName( const String& rName ) const +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + m_rExport.Strm() << '{' << OOO_STRING_SVTOOLS_RTF_IGNORE << OOO_STRING_SVTOOLS_RTF_FALT << ' '; + m_rExport.Strm() << OUStringToOString( OUString( rName ), m_rExport.eCurrentEncoding ) << '}'; +} + +/// Font charset. +void RtfAttributeOutput::FontCharset( sal_uInt8 nCharSet ) const +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + m_rExport.Strm() << OOO_STRING_SVTOOLS_RTF_FCHARSET; + m_rExport.OutULong( nCharSet ); + m_rExport.Strm() << ' '; +} + +/// Font family. +void RtfAttributeOutput::FontFamilyType( FontFamily eFamily, const wwFont &rFont ) const +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + m_rExport.Strm() << '{' << OOO_STRING_SVTOOLS_RTF_F; + + const char* pStr = OOO_STRING_SVTOOLS_RTF_FNIL; + switch (eFamily) + { + case FAMILY_ROMAN: + pStr = OOO_STRING_SVTOOLS_RTF_FROMAN; + break; + case FAMILY_SWISS: + pStr = OOO_STRING_SVTOOLS_RTF_FSWISS; + break; + case FAMILY_MODERN: + pStr = OOO_STRING_SVTOOLS_RTF_FMODERN; + break; + case FAMILY_SCRIPT: + pStr = OOO_STRING_SVTOOLS_RTF_FSCRIPT; + break; + case FAMILY_DECORATIVE: + pStr = OOO_STRING_SVTOOLS_RTF_FDECOR; + break; + default: + break; + } + m_rExport.OutULong(m_rExport.maFontHelper.GetId(rFont)) << pStr; +} + +/// Font pitch. +void RtfAttributeOutput::FontPitchType( FontPitch ePitch ) const +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + m_rExport.Strm() << OOO_STRING_SVTOOLS_RTF_FPRQ; + + USHORT nVal = 0; + switch (ePitch) + { + case PITCH_FIXED: + nVal = 1; + break; + case PITCH_VARIABLE: + nVal = 2; + break; + default: + break; + } + m_rExport.OutULong(nVal); +} + +static bool IsEMF(const sal_uInt8 *pGraphicAry, unsigned long nSize) +{ + if (pGraphicAry && (nSize > 0x2c )) + { + // check the magic number + if ( + (pGraphicAry[0x28] == 0x20 ) && (pGraphicAry[0x29] == 0x45) && + (pGraphicAry[0x2a] == 0x4d ) && (pGraphicAry[0x2b] == 0x46) + ) + { + //emf detected + return true; + } + } + return false; +} + +static bool StripMetafileHeader(const sal_uInt8 *&rpGraphicAry, unsigned long &rSize) +{ + if (rpGraphicAry && (rSize > 0x22)) + { + if ( + (rpGraphicAry[0] == 0xd7) && (rpGraphicAry[1] == 0xcd) && + (rpGraphicAry[2] == 0xc6) && (rpGraphicAry[3] == 0x9a) + ) + { // we have to get rid of the metafileheader + rpGraphicAry += 22; + rSize -= 22; + return true; + } + } + return false; +} + +static OString WriteHex(const sal_uInt8* pData, sal_uInt32 nSize, sal_uInt32 nLimit = 64) +{ + OStringBuffer aRet; + + sal_uInt32 nBreak = 0; + for (sal_uInt32 i = 0; i < nSize; i++) + { + OString sNo = OString::valueOf(sal_Int32(pData[i]), 16); + if (sNo.getLength() < 2) + aRet.append('0'); + aRet.append(sNo); + if (++nBreak == nLimit) + { + aRet.append(RtfExport::sNewLine); + nBreak = 0; + } + } + + return aRet.makeStringAndClear(); +} + +static OString WriteHex(sal_Int32 nNum) +{ + return WriteHex((sal_uInt8*)&nNum, sizeof(sal_Int32)); +} + +static OString WriteHex(OString sString) +{ + OStringBuffer aRet; + + aRet.append(WriteHex(sString.getLength()+1)); + aRet.append(WriteHex((sal_uInt8*)sString.getStr(), sString.getLength()+1)); + + return aRet.makeStringAndClear(); +} + +void lcl_AppendSP( OStringBuffer& rBuffer, + const char cName[], + const ::rtl::OUString& rValue, + const RtfExport& rExport ) +{ + rBuffer.append( "{" OOO_STRING_SVTOOLS_RTF_SP "{" ); // "{\sp{" + rBuffer.append( OOO_STRING_SVTOOLS_RTF_SN " " );//" \sn " + rBuffer.append( cName ); //"PropName" + rBuffer.append( "}{" OOO_STRING_SVTOOLS_RTF_SV " " ); +// "}{ \sv " + rBuffer.append( rExport.OutString( rValue, rExport.eCurrentEncoding ) ); + rBuffer.append( "}}" ); +} + +static OString ExportPICT( const SwFlyFrmFmt* pFlyFrmFmt, const Size &rOrig, const Size &rRendered, const Size &rMapped, + const SwCropGrf &rCr, const char *pBLIPType, const sal_uInt8 *pGraphicAry, + unsigned long nSize, const RtfExport& rExport ) +{ + OStringBuffer aRet; + bool bIsWMF = (const char *)pBLIPType == (const char *)OOO_STRING_SVTOOLS_RTF_WMETAFILE ? true : false; + if (pBLIPType && nSize && pGraphicAry) + { + aRet.append("{" OOO_STRING_SVTOOLS_RTF_PICT); + + if( pFlyFrmFmt ) + { + String sDescription = pFlyFrmFmt->GetObjDescription(); + //write picture properties - wzDescription at first + //looks like: "{\*\picprop{\sp{\sn PropertyName}{\sv PropertyValue}}}" + aRet.append( "{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_PICPROP );//"{\*\picprop + lcl_AppendSP( aRet, "wzDescription", sDescription, rExport ); + String sName = pFlyFrmFmt->GetObjTitle(); + lcl_AppendSP( aRet, "wzName", sName, rExport ); + aRet.append( "}" ); //"}" + } + + long nXCroppedSize = rOrig.Width()-(rCr.GetLeft() + rCr.GetRight()); + long nYCroppedSize = rOrig.Height()-(rCr.GetTop() + rCr.GetBottom()); + /* #127543#: Graphic with a zero height or width, typically copied from webpages, caused + crashes. */ + if( !nXCroppedSize ) + nXCroppedSize = 100; + if( !nYCroppedSize ) + nYCroppedSize = 100; + + //Given the original size and taking cropping into account + //first, how much has the original been scaled to get the + //final rendered size + aRet.append(OOO_STRING_SVTOOLS_RTF_PICSCALEX); + aRet.append((sal_Int32)((100 * rRendered.Width()) / nXCroppedSize)); + aRet.append(OOO_STRING_SVTOOLS_RTF_PICSCALEY); + aRet.append((sal_Int32)((100 * rRendered.Height()) / nYCroppedSize)); + + aRet.append(OOO_STRING_SVTOOLS_RTF_PICCROPL); + aRet.append((sal_Int32)rCr.GetLeft()); + aRet.append(OOO_STRING_SVTOOLS_RTF_PICCROPR); + aRet.append((sal_Int32)rCr.GetRight()); + aRet.append(OOO_STRING_SVTOOLS_RTF_PICCROPT); + aRet.append((sal_Int32)rCr.GetTop()); + aRet.append(OOO_STRING_SVTOOLS_RTF_PICCROPB); + aRet.append((sal_Int32)rCr.GetBottom()); + + aRet.append(OOO_STRING_SVTOOLS_RTF_PICW); + aRet.append((sal_Int32)rMapped.Width()); + aRet.append(OOO_STRING_SVTOOLS_RTF_PICH); + aRet.append((sal_Int32)rMapped.Height()); + + aRet.append(OOO_STRING_SVTOOLS_RTF_PICWGOAL); + aRet.append((sal_Int32)rOrig.Width()); + aRet.append(OOO_STRING_SVTOOLS_RTF_PICHGOAL); + aRet.append((sal_Int32)rOrig.Height()); + + aRet.append(pBLIPType); + if (bIsWMF) + { + aRet.append((sal_Int32)8); + StripMetafileHeader(pGraphicAry, nSize); + } + aRet.append(RtfExport::sNewLine); + aRet.append(WriteHex(pGraphicAry, nSize)); + aRet.append('}'); + } + return aRet.makeStringAndClear(); +} + +void RtfAttributeOutput::FlyFrameOLEData( SwOLENode& rOLENode ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + uno::Reference < embed::XEmbeddedObject > xObj(const_cast<SwOLENode&>(rOLENode).GetOLEObj().GetOleRef()); + sal_Int64 nAspect = rOLENode.GetAspect(); + svt::EmbeddedObjectRef aObjRef( xObj, nAspect ); + SvGlobalName aObjName(aObjRef->getClassID()); + + if (SotExchange::IsMath(aObjName)) + { + // ObjectHeader + m_aRunText.append(WriteHex(0x00000501)); // OLEVersion + m_aRunText.append(WriteHex(0x00000002)); // FormatID + m_aRunText.append(WriteHex(OString("Equation.3"))); // ClassName + m_aRunText.append(WriteHex(0x00000000)); // TopicName + m_aRunText.append(WriteHex(0x00000000)); // ItemName + + // NativeData + SvMemoryStream *pStream = new SvMemoryStream; + SvStorage* pStorage = new SvStorage(*pStream); + m_rExport.pOLEExp->ExportOLEObject( aObjRef, *pStorage ); + pStream->Seek(STREAM_SEEK_TO_END); + sal_uInt32 nNativeDataSize = pStream->Tell(); + const sal_uInt8* pNativeData = (sal_uInt8*)pStream->GetData(); + m_aRunText.append(WriteHex(nNativeDataSize)); + m_aRunText.append(RtfExport::sNewLine); + m_aRunText.append(WriteHex(pNativeData, nNativeDataSize, 126)); + m_aRunText.append(RtfExport::sNewLine); + delete pStream; + + // MetaFilePresentationObject + pStream = new SvMemoryStream; + Graphic* pGraphic = rOLENode.GetGraphic(); + if (GraphicConverter::Export(*pStream, *pGraphic, CVT_WMF) != ERRCODE_NONE) + OSL_ENSURE(false, "failed to export the presentation data"); + pStream->Seek(STREAM_SEEK_TO_END); + sal_uInt32 nPresentationDataSize = pStream->Tell(); + const sal_uInt8* pPresentationData = (sal_uInt8*)pStream->GetData(); + m_aRunText.append(WriteHex(pPresentationData, nPresentationDataSize, 126)); + } +} + +void RtfAttributeOutput::FlyFrameOLE( const SwFlyFrmFmt* pFlyFrmFmt, SwOLENode& rOLENode, const Size& rSize ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + SvMemoryStream aStream; + const sal_uInt8* pGraphicAry = 0; + sal_uInt32 nSize = 0; + Graphic* pGraphic = rOLENode.GetGraphic(); + + Size aSize(sw::util::GetSwappedInSize(rOLENode)); + Size aRendered(aSize); + aRendered.Width() = rSize.Width(); + aRendered.Height() = rSize.Height(); + Size aMapped(pGraphic->GetPrefSize()); + const SwCropGrf &rCr = (const SwCropGrf &)rOLENode.GetAttr(RES_GRFATR_CROPGRF); + const sal_Char* pBLIPType = OOO_STRING_SVTOOLS_RTF_WMETAFILE; + + if (GraphicConverter::Export(aStream, *pGraphic, CVT_WMF) != ERRCODE_NONE) + OSL_ENSURE(false, "failed to export the graphic"); + aStream.Seek(STREAM_SEEK_TO_END); + nSize = aStream.Tell(); + pGraphicAry = (sal_uInt8*)aStream.GetData(); + + m_aRunText.append("{" OOO_STRING_SVTOOLS_RTF_OBJECT OOO_STRING_SVTOOLS_RTF_OBJEMB); + + // export the object data in the appropriate format; RTF requires the usage of the OLE 1.0 format + m_aRunText.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_OBJDATA " "); + FlyFrameOLEData(rOLENode); + m_aRunText.append("}{" OOO_STRING_SVTOOLS_RTF_RESULT); + + SwTwips nHeight = aSize.Height(); + nHeight/=20; //nHeight was in twips, want it in half points, but then half of total height. + long nFontHeight = ((const SvxFontHeightItem&)m_rExport.GetItem(RES_CHRATR_FONTSIZE)).GetHeight(); + nHeight-=nFontHeight/20; + m_aRunText.append("{" OOO_STRING_SVTOOLS_RTF_DN).append(nHeight); + m_aRunText.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_SHPPICT); + m_aRunText.append(ExportPICT( pFlyFrmFmt, aSize, aRendered, aMapped, rCr, pBLIPType, pGraphicAry, nSize, m_rExport )); + m_aRunText.append("}}}}"); +} + +void RtfAttributeOutput::FlyFrameGraphic( const SwFlyFrmFmt* pFlyFrmFmt, const SwGrfNode& rGrfNode, const Size& rSize ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + SvMemoryStream aStream; + const sal_uInt8* pGraphicAry = 0; + sal_uInt32 nSize = 0; + + Graphic aGraphic(rGrfNode.GetGrf()); + + // If there is no graphic there is not much point in parsing it + if(aGraphic.GetType()==GRAPHIC_NONE) + return; + + GfxLink aGraphicLink; + const sal_Char* pBLIPType = 0; + if (aGraphic.IsLink()) + { + aGraphicLink = aGraphic.GetLink(); + nSize = aGraphicLink.GetDataSize(); + pGraphicAry = aGraphicLink.GetData(); + switch (aGraphicLink.GetType()) + { + case GFX_LINK_TYPE_NATIVE_JPG: + pBLIPType = OOO_STRING_SVTOOLS_RTF_JPEGBLIP; + break; + case GFX_LINK_TYPE_NATIVE_PNG: + pBLIPType = OOO_STRING_SVTOOLS_RTF_PNGBLIP; + break; + case GFX_LINK_TYPE_NATIVE_WMF: + pBLIPType = + IsEMF(pGraphicAry, nSize) ? OOO_STRING_SVTOOLS_RTF_EMFBLIP : OOO_STRING_SVTOOLS_RTF_WMETAFILE; + break; + default: + break; + } + } + + GraphicType eGraphicType = aGraphic.GetType(); + if (!pGraphicAry) + { + if (ERRCODE_NONE == GraphicConverter::Export(aStream, aGraphic, + (eGraphicType == GRAPHIC_BITMAP) ? CVT_PNG : CVT_WMF)) + { + pBLIPType = (eGraphicType == GRAPHIC_BITMAP) ? + OOO_STRING_SVTOOLS_RTF_PNGBLIP : OOO_STRING_SVTOOLS_RTF_WMETAFILE; + aStream.Seek(STREAM_SEEK_TO_END); + nSize = aStream.Tell(); + pGraphicAry = (sal_uInt8*)aStream.GetData(); + } + } + + Size aMapped(eGraphicType == GRAPHIC_BITMAP ? aGraphic.GetSizePixel() : aGraphic.GetPrefSize()); + + const SwCropGrf &rCr = (const SwCropGrf &)rGrfNode.GetAttr(RES_GRFATR_CROPGRF); + + //Get original size in twips + Size aSize(sw::util::GetSwappedInSize(rGrfNode)); + Size aRendered(aSize); + aRendered.Width() = rSize.Width(); + aRendered.Height() = rSize.Height(); + + /* + If the graphic is not of type WMF then we will have to store two + graphics, one in the native format wrapped in shppict, and the other in + the wmf format wrapped in nonshppict, so as to keep wordpad happy. If its + a wmf already then we don't need any such wrapping + */ + bool bIsWMF = (const sal_Char*)pBLIPType == (const sal_Char*)OOO_STRING_SVTOOLS_RTF_WMETAFILE ? true : false; + if (!bIsWMF) + m_aRunText.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_SHPPICT); + + if (pBLIPType) + m_aRunText.append(ExportPICT( pFlyFrmFmt, aSize, aRendered, aMapped, rCr, pBLIPType, pGraphicAry, nSize, m_rExport)); + else + { + aStream.Seek(0); + GraphicConverter::Export(aStream, aGraphic, CVT_WMF); + pBLIPType = OOO_STRING_SVTOOLS_RTF_WMETAFILE; + aStream.Seek(STREAM_SEEK_TO_END); + nSize = aStream.Tell(); + pGraphicAry = (sal_uInt8*)aStream.GetData(); + + m_aRunText.append(ExportPICT(pFlyFrmFmt, aSize, aRendered, aMapped, rCr, pBLIPType, pGraphicAry, nSize, m_rExport )); + } + + if (!bIsWMF) + { + m_aRunText.append("}" "{" OOO_STRING_SVTOOLS_RTF_NONSHPPICT); + + aStream.Seek(0); + GraphicConverter::Export(aStream, aGraphic, CVT_WMF); + pBLIPType = OOO_STRING_SVTOOLS_RTF_WMETAFILE; + aStream.Seek(STREAM_SEEK_TO_END); + nSize = aStream.Tell(); + pGraphicAry = (sal_uInt8*)aStream.GetData(); + + m_aRunText.append(ExportPICT(pFlyFrmFmt, aSize, aRendered, aMapped, rCr, pBLIPType, pGraphicAry, nSize, m_rExport )); + + m_aRunText.append('}'); + } + + m_aRunText.append(m_rExport.sNewLine); +} + +/* vi:set shiftwidth=4 expandtab: */ diff --git a/sw/source/filter/ww8/rtfattributeoutput.hxx b/sw/source/filter/ww8/rtfattributeoutput.hxx new file mode 100644 index 0000000000..0d153b843f --- /dev/null +++ b/sw/source/filter/ww8/rtfattributeoutput.hxx @@ -0,0 +1,590 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * Copyright 2010 Miklos Vajna. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _RTFATTRIBUTEOUTPUT_HXX_ +#define _RTFATTRIBUTEOUTPUT_HXX_ + +#include <set> +#include "attributeoutputbase.hxx" +#include "fields.hxx" + +#include <vcl/vclenum.hxx> + +#include <fldbas.hxx> +#include <rtl/strbuf.hxx> + +#include <vector> + +class RtfExport; + +class SwGrfNode; +class SwOLENode; +class SdrObject; +class SwFlyFrmFmt; + +class RtfAttributeOutput : public AttributeOutputBase +{ +public: + /// Export the state of RTL/CJK. + virtual void RTLAndCJKState( bool bIsRTL, sal_uInt16 nScript ); + + /// Start of the paragraph. + virtual void StartParagraph( ww8::WW8TableNodeInfo::Pointer_t pTextNodeInfo ); + + /// End of the paragraph. + virtual void EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pTextNodeInfoInner ); + + /// Empty paragraph. + virtual void EmptyParagraph(); + + /// Called before we start outputting the attributes. + virtual void StartParagraphProperties( const SwTxtNode& rNode ); + + /// Called after we end outputting the attributes. + virtual void EndParagraphProperties(); + + /// Start of the text run. + virtual void StartRun( const SwRedlineData* pRedlineData ); + + /// End of the text run. + virtual void EndRun(); + + /// Called before we start outputting the attributes. + virtual void StartRunProperties(); + + /// Called after we end outputting the attributes. + virtual void EndRunProperties( const SwRedlineData* pRedlineData ); + + /// Output text (inside a run). + virtual void RunText( const String& rText, rtl_TextEncoding eCharSet = RTL_TEXTENCODING_UTF8 ); + + // Access to (anyway) private buffers, used by the sdr exporter + rtl::OStringBuffer& RunText(); + rtl::OStringBuffer& Styles(); + + /// Output text (without markup). + virtual void RawText( const String& rText, bool bForceUnicode, rtl_TextEncoding eCharSet ); + + /// Output ruby start. + virtual void StartRuby( const SwTxtNode& rNode, const SwFmtRuby& rRuby ); + + /// Output ruby end. + virtual void EndRuby(); + + /// Output URL start. + virtual bool StartURL( const String& rUrl, const String& rTarget ); + + /// Output URL end. + virtual bool EndURL(); + + virtual void FieldVanish( const String& rTxt, ww::eField eType ); + + /// Output redlining. + /// + /// The common attribute that can be among the run properties. + virtual void Redline( const SwRedlineData* pRedline ); + + virtual void FormatDrop( const SwTxtNode& rNode, const SwFmtDrop& rSwFmtDrop, USHORT nStyle, ww8::WW8TableNodeInfo::Pointer_t pTextNodeInfo, ww8::WW8TableNodeInfoInner::Pointer_t pTextNodeInfoInner ); + + /// Output style. + virtual void ParagraphStyle( USHORT nStyle ); + + virtual void TableInfoCell( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner ); + + virtual void TableInfoRow( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner ); + + virtual void TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner ); + + virtual void TableDefaultBorders( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner ); + + virtual void TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner ); + + virtual void TableHeight( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner ); + + virtual void TableCanSplit( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner ); + + virtual void TableBidi( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner ); + + virtual void TableVerticalCell( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner ); + + virtual void TableNodeInfo( ww8::WW8TableNodeInfo::Pointer_t pNodeInfo ); + + virtual void TableNodeInfoInner( ww8::WW8TableNodeInfoInner::Pointer_t pNodeInfoInner ); + + virtual void TableOrientation( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner ); + + virtual void TableSpacing( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner ); + + virtual void TableRowEnd( sal_uInt32 nDepth ); + + /// Start of the styles table. + virtual void StartStyles(); + + /// End of the styles table. + virtual void EndStyles( USHORT nNumberOfStyles ); + + /// Write default style. + virtual void DefaultStyle( USHORT nStyle ); + + /// Start of a style in the styles table. + virtual void StartStyle( const String& rName, bool bPapFmt, + USHORT nBase, USHORT nNext, USHORT nWwId, USHORT nId ); + + /// End of a style in the styles table. + virtual void EndStyle(); + + /// Start of (paragraph or run) properties of a style. + virtual void StartStyleProperties( bool bParProp, USHORT nStyle ); + + /// End of (paragraph or run) properties of a style. + virtual void EndStyleProperties( bool bParProp ); + + /// Numbering rule and Id. + virtual void OutlineNumbering( BYTE nLvl, const SwNumFmt &rNFmt, const SwFmt &rFmt ); + + /// Page break + /// As a paragraph property - the paragraph should be on the next page. + virtual void PageBreakBefore( bool bBreak ); + + /// Write a section break + /// msword::ColumnBreak or msword::PageBreak + virtual void SectionBreak( BYTE nC, const WW8_SepInfo* pSectionInfo = NULL ); + + /// Start of the section properties. + virtual void StartSection(); + + /// End of the section properties. + virtual void EndSection(); + + /// Protection of forms. + virtual void SectionFormProtection( bool bProtected ); + + /// Numbering of the lines in the document. + virtual void SectionLineNumbering( ULONG nRestartNo, const SwLineNumberInfo& rLnNumInfo ); + + /// Has different headers/footers for the title page. + virtual void SectionTitlePage(); + + /// Description of the page borders. + virtual void SectionPageBorders( const SwFrmFmt* pFmt, const SwFrmFmt* pFirstPageFmt ); + + /// Columns populated from right/numbers on the right side? + virtual void SectionBiDi( bool bBiDi ); + + /// The style of the page numbers. + /// + /// nPageRestartNumberr being 0 means no restart. + virtual void SectionPageNumbering( USHORT nNumType, USHORT nPageRestartNumber ); + + /// The type of breaking. + virtual void SectionType( BYTE nBreakCode ); + + /// Definition of a numbering instance. + virtual void NumberingDefinition( USHORT nId, const SwNumRule &rRule ); + + /// Start of the abstract numbering definition instance. + virtual void StartAbstractNumbering( USHORT nId ); + + /// End of the abstract numbering definition instance. + virtual void EndAbstractNumbering(); + + /// All the numbering level information. + virtual void NumberingLevel( BYTE nLevel, + USHORT nStart, + USHORT nNumberingType, + SvxAdjust eAdjust, + const BYTE *pNumLvlPos, + BYTE nFollow, + const wwFont *pFont, + const SfxItemSet *pOutSet, + sal_Int16 nIndentAt, + sal_Int16 nFirstLineIndex, + sal_Int16 nListTabPos, + const String &rNumberingString ); + + void WriteField_Impl( const SwField* pFld, ww::eField eType, const String& rFldCmd, BYTE nMode ); + void WriteBookmarks_Impl( std::vector< rtl::OUString >& rStarts, std::vector< rtl::OUString >& rEnds ); + void WriteHeaderFooter_Impl( const SwFrmFmt& rFmt, bool bHeader, const sal_Char* pStr ); + +protected: + /// Output frames - the implementation. + virtual void OutputFlyFrame_Impl( const sw::Frame& rFmt, const Point& rNdTopLeft ); + + /// Sfx item Sfx item RES_CHRATR_CASEMAP + virtual void CharCaseMap( const SvxCaseMapItem& rCaseMap ); + + /// Sfx item Sfx item RES_CHRATR_COLOR + virtual void CharColor( const SvxColorItem& rColor); + + /// Sfx item Sfx item RES_CHRATR_CONTOUR + virtual void CharContour( const SvxContourItem& rContour ); + + /// Sfx item RES_CHRATR_CROSSEDOUT + virtual void CharCrossedOut( const SvxCrossedOutItem& rCrossedOut ); + + /// Sfx item RES_CHRATR_ESCAPEMENT + virtual void CharEscapement( const SvxEscapementItem& rEscapement ); + + /// Sfx item RES_CHRATR_FONT + virtual void CharFont( const SvxFontItem& rFont ); + + /// Sfx item RES_CHRATR_FONTSIZE + virtual void CharFontSize( const SvxFontHeightItem& rFontSize ); + + /// Sfx item RES_CHRATR_KERNING + virtual void CharKerning( const SvxKerningItem& rKerning ); + + /// Sfx item RES_CHRATR_LANGUAGE + virtual void CharLanguage( const SvxLanguageItem& rLanguage ); + + /// Sfx item RES_CHRATR_POSTURE + virtual void CharPosture( const SvxPostureItem& rPosture ); + + /// Sfx item RES_CHRATR_SHADOWED + virtual void CharShadow( const SvxShadowedItem& rShadow ); + + /// Sfx item RES_CHRATR_UNDERLINE + virtual void CharUnderline( const SvxUnderlineItem& rUnderline ); + + /// Sfx item RES_CHRATR_WEIGHT + virtual void CharWeight( const SvxWeightItem& rWeight ); + + /// Sfx item RES_CHRATR_AUTOKERN + virtual void CharAutoKern( const SvxAutoKernItem& ); + + /// Sfx item RES_CHRATR_BLINK + virtual void CharAnimatedText( const SvxBlinkItem& rBlink ); + + /// Sfx item RES_CHRATR_BACKGROUND + virtual void CharBackground( const SvxBrushItem& rBrush ); + + /// Sfx item RES_CHRATR_CJK_FONT + virtual void CharFontCJK( const SvxFontItem& rFont ); + + /// Sfx item RES_CHRATR_CJK_FONTSIZE + virtual void CharFontSizeCJK( const SvxFontHeightItem& rFontSize ); + + /// Sfx item RES_CHRATR_CJK_LANGUAGE + virtual void CharLanguageCJK( const SvxLanguageItem& rLanguageItem ); + + /// Sfx item RES_CHRATR_CJK_POSTURE + virtual void CharPostureCJK( const SvxPostureItem& rPosture ); + + /// Sfx item RES_CHRATR_CJK_WEIGHT + virtual void CharWeightCJK( const SvxWeightItem& rWeight ); + + /// Sfx item RES_CHRATR_CTL_FONT + virtual void CharFontCTL( const SvxFontItem& rFont ); + + /// Sfx item RES_CHRATR_CTL_FONTSIZE + virtual void CharFontSizeCTL( const SvxFontHeightItem& rFontSize ); + + /// Sfx item RES_CHRATR_CTL_LANGUAGE + virtual void CharLanguageCTL( const SvxLanguageItem& rLanguageItem ); + + /// Sfx item RES_CHRATR_CTL_POSTURE + virtual void CharPostureCTL( const SvxPostureItem& rWeight ); + + /// Sfx item RES_CHRATR_CTL_WEIGHT + virtual void CharWeightCTL( const SvxWeightItem& rWeight ); + + /// Sfx item RES_CHRATR_ROTATE + virtual void CharRotate( const SvxCharRotateItem& rRotate ); + + /// Sfx item RES_CHRATR_EMPHASIS_MARK + virtual void CharEmphasisMark( const SvxEmphasisMarkItem& rEmphasisMark ); + + /// Sfx item RES_CHRATR_TWO_LINES + virtual void CharTwoLines( const SvxTwoLinesItem& rTwoLines ); + + /// Sfx item RES_CHRATR_SCALEW + virtual void CharScaleWidth( const SvxCharScaleWidthItem& rScaleWidth ); + + /// Sfx item RES_CHRATR_RELIEF + virtual void CharRelief( const SvxCharReliefItem& rRelief); + + /// Sfx item RES_CHRATR_HIDDEN + virtual void CharHidden( const SvxCharHiddenItem& rHidden ); + + /// Sfx item RES_TXTATR_INETFMT + virtual void TextINetFormat( const SwFmtINetFmt& ); + + /// Sfx item RES_TXTATR_CHARFMT + virtual void TextCharFormat( const SwFmtCharFmt& ); + + /// Sfx item RES_TXTATR_FTN + virtual void TextFootnote_Impl( const SwFmtFtn& ); + + /// Sfx item RES_PARATR_LINESPACING + virtual void ParaLineSpacing_Impl( short nSpace, short nMulti ); + + /// Sfx item RES_PARATR_ADJUST + virtual void ParaAdjust( const SvxAdjustItem& rAdjust ); + + /// Sfx item RES_PARATR_SPLIT + virtual void ParaSplit( const SvxFmtSplitItem& rSplit ); + + /// Sfx item RES_PARATR_WIDOWS + virtual void ParaWidows( const SvxWidowsItem& rWidows ); + + /// Sfx item RES_PARATR_TABSTOP + virtual void ParaTabStop( const SvxTabStopItem& rTabStop ); + + /// Sfx item RES_PARATR_HYPHENZONE + virtual void ParaHyphenZone( const SvxHyphenZoneItem& ); + + /// Sfx item RES_PARATR_NUMRULE + virtual void ParaNumRule_Impl( const SwTxtNode *pTxtNd, sal_Int32 nLvl, sal_Int32 nNumId ); + + /// Sfx item RES_PARATR_SCRIPTSPACE + virtual void ParaScriptSpace( const SfxBoolItem& ); + + /// Sfx item RES_PARATR_VERTALIGN + virtual void ParaVerticalAlign( const SvxParaVertAlignItem& rAlign ); + + /// Sfx item RES_PARATR_SNAPTOGRID + virtual void ParaSnapToGrid( const SvxParaGridItem& ); + + /// Sfx item RES_FRM_SIZE + virtual void FormatFrameSize( const SwFmtFrmSize& ); + + /// Sfx item RES_PAPER_BIN + virtual void FormatPaperBin( const SvxPaperBinItem& ); + + /// Sfx item RES_LR_SPACE + virtual void FormatLRSpace( const SvxLRSpaceItem& rLRSpace ); + + /// Sfx item RES_UL_SPACE + virtual void FormatULSpace( const SvxULSpaceItem& rULSpace ); + + /// Sfx item RES_SURROUND + virtual void FormatSurround( const SwFmtSurround& ); + + /// Sfx item RES_VERT_ORIENT + virtual void FormatVertOrientation( const SwFmtVertOrient& ); + + /// Sfx item RES_HORI_ORIENT + virtual void FormatHorizOrientation( const SwFmtHoriOrient& ); + + /// Sfx item RES_ANCHOR + virtual void FormatAnchor( const SwFmtAnchor& ); + + /// Sfx item RES_BACKGROUND + virtual void FormatBackground( const SvxBrushItem& ); + + /// Sfx item RES_BOX + virtual void FormatBox( const SvxBoxItem& ); + + /// Sfx item RES_COL + virtual void FormatColumns_Impl( USHORT nCols, const SwFmtCol & rCol, bool bEven, SwTwips nPageSize ); + + /// Sfx item RES_KEEP + virtual void FormatKeep( const SvxFmtKeepItem& ); + + /// Sfx item RES_TEXTGRID + virtual void FormatTextGrid( const SwTextGridItem& ); + + /// Sfx item RES_LINENUMBER + virtual void FormatLineNumbering( const SwFmtLineNumber& ); + + /// Sfx item RES_FRAMEDIR + virtual void FormatFrameDirection( const SvxFrameDirectionItem& ); + + /// Write the expanded field + virtual void WriteExpand( const SwField* pFld ); + + virtual void RefField( const SwField& rFld, const String& rRef ); + virtual void HiddenField( const SwField& rFld ); + virtual void SetField( const SwField& rFld, ww::eField eType, const String& rCmd ); + virtual void PostitField( const SwField* pFld ); + virtual bool DropdownField( const SwField* pFld ); + + /// Reference to the export, where to get the data from + RtfExport &m_rExport; + +private: + + /// Output graphic fly frames. + void FlyFrameGraphic( const SwFlyFrmFmt* pFlyFrmFmt, const SwGrfNode& rGrfNode, const Size& rSize ); + void FlyFrameOLE( const SwFlyFrmFmt* pFlyFrmFmt, SwOLENode& rOLENode, const Size& rSize ); + void FlyFrameOLEData( SwOLENode& rOLENode ); + + /* + * Table methods. + */ + + void InitTableHelper( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner ); + + void StartTable( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner ); + + void StartTableRow( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner ); + + void StartTableCell( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner ); + + void TableCellProperties( ww8::WW8TableNodeInfoInner::Pointer_t pTableTextNodeInfoInner ); + + void EndTableCell( ); + + void EndTableRow( ); + + void EndTable(); + + /// End cell, row, and even the entire table if necessary. + void FinishTableRowCell( ww8::WW8TableNodeInfoInner::Pointer_t pInner, bool bForceEmptyParagraph = false ); + + void WriteTextFootnoteNumStr(const SwFmtFtn& rFootnote); + + /* + * Current style name and its ID. + */ + String m_rStyleName; + USHORT m_nStyleId; + /* + * Current list ID. + */ + USHORT m_nListId; + /* + * This is needed because the call order is: run text, run properties, paragraph properties. + * What we need is the opposite. + */ + rtl::OStringBuffer m_aRun; + rtl::OStringBuffer m_aRunText; + /* + * This is written after runs. + */ + rtl::OStringBuffer m_aAfterRuns; + /* + * Same for colors and stylesheets: first we just want to output colors, + * need to buffer the stylesheet table to output it after the color one. + */ + rtl::OStringBuffer m_aStylesheet; + /* + * This one just holds the style commands in the current style. + */ + rtl::OStringBuffer m_aStyles; + /* + * This is the same as m_aStyles but the conents of it is written last. + */ + rtl::OStringBuffer m_aStylesEnd; + + /* + * We just get a "end of strike" mark at the end of strike, store here what to finish: single or double strike. + */ + bool m_bStrikeDouble; + + /* + * The current table helper. + */ + SwWriteTable *m_pTableWrt; + + /* + * Remember if we are in an open cell, or not. + */ + bool m_bTableCellOpen; + + /* + * Remember the current table depth. + */ + sal_uInt32 m_nTableDepth; + + /* + * Remember if we wrote a \cell or not. + */ + bool m_bTblAfterCell; + + /* + * For late output of row definitions. + */ + rtl::OStringBuffer m_aRowDefs; + + /* + * Is a column break needed after the next \par? + */ + bool m_nColBreakNeeded; + + /* + * If section breaks should be buffered to m_aSectionBreaks + */ + bool m_bBufferSectionBreaks; + rtl::OStringBuffer m_aSectionBreaks; + + /* + * If section headers (and footers) should be buffered to + * m_aSectionHeaders. + */ + bool m_bBufferSectionHeaders; + rtl::OStringBuffer m_aSectionHeaders; + + /* + * Support for starting multiple tables at the same cell. + * If the current table is the last started one. + */ + bool m_bLastTable; + /* + * List of already started but not yet defined tables (need to be defined + * after the nested tables). + */ + std::vector< rtl::OString > m_aTables; + /* + * If cell info is already output. + */ + bool m_bWroteCellInfo; + +public: + RtfAttributeOutput( RtfExport &rExport ); + + virtual ~RtfAttributeOutput(); + + /// Return the right export class. + virtual MSWordExportBase& GetExport(); + + rtl::OStringBuffer m_aTabStop; + + // These are used by wwFont::WriteRtf() + /// Start the font. + void StartFont( const String& rFamilyName ) const; + + /// End the font. + void EndFont() const; + + /// Alternate name for the font. + void FontAlternateName( const String& rName ) const; + + /// Font charset. + void FontCharset( sal_uInt8 nCharSet ) const; + + /// Font family. + void FontFamilyType( FontFamily eFamily, const wwFont &rFont ) const; + + /// Font pitch. + void FontPitchType( FontPitch ePitch ) const; +}; + +#endif // _RTFATTRIBUTEOUTPUT_HXX_ + +/* vi:set shiftwidth=4 expandtab: */ diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx new file mode 100644 index 0000000000..8f70fcf7bf --- /dev/null +++ b/sw/source/filter/ww8/rtfexport.cxx @@ -0,0 +1,1275 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * Copyright 2010 Miklos Vajna. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "rtfexport.hxx" +#include "rtfexportfilter.hxx" +#include "rtfsdrexport.hxx" + +#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> +#include <com/sun/star/document/XDocumentProperties.hpp> +#include <com/sun/star/i18n/ScriptType.hdl> +#include <com/sun/star/frame/XModel.hpp> + +#include <map> +#include <algorithm> +#include <iostream> +#include <iomanip> +#include <string> +#include <sstream> + +#include <IMark.hxx> +#include <docsh.hxx> +#include <ndtxt.hxx> +#include <wrtww8.hxx> +#include <fltini.hxx> +#include <fmtline.hxx> +#include <fmtpdsc.hxx> +#include <frmfmt.hxx> +#include <section.hxx> +#include <pagedesc.hxx> +#include <swtable.hxx> +#include <fmtfsize.hxx> +#include <frmatr.hxx> +#include <ftninfo.hxx> +#include <fmthdft.hxx> +#include <editeng/fontitem.hxx> +#include <editeng/colritem.hxx> +#include <editeng/udlnitem.hxx> +#include <editeng/boxitem.hxx> +#include <editeng/brshitem.hxx> +#include <editeng/shaditem.hxx> +#include <editeng/lrspitem.hxx> +#include <editeng/ulspitem.hxx> +#include <editeng/paperinf.hxx> +#include <editeng/protitem.hxx> + +#include <docary.hxx> +#include <numrule.hxx> +#include <charfmt.hxx> +#include <lineinfo.hxx> +#include <swmodule.hxx> + +#include "ww8par.hxx" +#include "ww8scan.hxx" + +#include <comphelper/string.hxx> +#include <rtl/ustrbuf.hxx> +#include <vcl/font.hxx> +#include <svtools/rtfkeywd.hxx> +#include <unotools/configmgr.hxx> + +using namespace ::comphelper; +using namespace ::com::sun::star; + +using rtl::OString; +using rtl::OUString; +using rtl::OStringBuffer; +using rtl::OUStringBuffer; + +using sw::mark::IMark; + +#if defined(UNX) +const sal_Char RtfExport::sNewLine = '\012'; +#else +const sal_Char __FAR_DATA RtfExport::sNewLine[] = "\015\012"; +#endif + +// the default text encoding for the export, if it doesn't fit unicode will +// be used +#define DEF_ENCODING RTL_TEXTENCODING_ASCII_US + +AttributeOutputBase& RtfExport::AttrOutput() const +{ + return *m_pAttrOutput; +} + +MSWordSections& RtfExport::Sections() const +{ + return *m_pSections; +} + +RtfSdrExport& RtfExport::SdrExporter() const +{ + return *m_pSdrExport; +} + +bool RtfExport::CollapseScriptsforWordOk( USHORT nScript, USHORT nWhich ) +{ + // FIXME is this actually true for rtf? - this is copied from DOCX + if ( nScript == i18n::ScriptType::ASIAN ) + { + // for asian in ww8, there is only one fontsize + // and one fontstyle (posture/weight) + switch ( nWhich ) + { + case RES_CHRATR_FONTSIZE: + case RES_CHRATR_POSTURE: + case RES_CHRATR_WEIGHT: + return false; + default: + break; + } + } + else if ( nScript != i18n::ScriptType::COMPLEX ) + { + // for western in ww8, there is only one fontsize + // and one fontstyle (posture/weight) + switch ( nWhich ) + { + case RES_CHRATR_CJK_FONTSIZE: + case RES_CHRATR_CJK_POSTURE: + case RES_CHRATR_CJK_WEIGHT: + return false; + default: + break; + } + } + return true; +} + +void RtfExport::AppendBookmarks( const SwTxtNode& rNode, xub_StrLen nAktPos, xub_StrLen nLen ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + std::vector< OUString > aStarts; + std::vector< OUString > aEnds; + + IMarkVector aMarks; + if ( GetBookmarks( rNode, nAktPos, nAktPos + nLen, aMarks ) ) + { + for ( IMarkVector::const_iterator it = aMarks.begin(), end = aMarks.end(); + it < end; ++it ) + { + IMark* pMark = (*it); + xub_StrLen nStart = pMark->GetMarkStart().nContent.GetIndex(); + xub_StrLen nEnd = pMark->GetMarkEnd().nContent.GetIndex(); + + if ( nStart == nAktPos ) + aStarts.push_back( pMark->GetName() ); + + if ( nEnd == nAktPos ) + aEnds.push_back( pMark->GetName() ); + } + } + + m_pAttrOutput->WriteBookmarks_Impl( aStarts, aEnds ); +} + +void RtfExport::AppendBookmark( const OUString& rName, bool /*bSkip*/ ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + std::vector<OUString> aStarts; + std::vector<OUString> aEnds; + + aStarts.push_back(rName); + aEnds.push_back(rName); + + m_pAttrOutput->WriteBookmarks_Impl(aStarts, aEnds); +} + +void RtfExport::WriteChar( sal_Unicode ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + /* WriteChar() has nothing to do for rtf. */ +} + +static bool IsExportNumRule( const SwNumRule& rRule, BYTE* pEnd = 0 ) +{ + BYTE nEnd = MAXLEVEL; + while( nEnd-- && !rRule.GetNumFmt( nEnd )) + ; + ++nEnd; + + const SwNumFmt* pNFmt; + BYTE nLvl; + + for( nLvl = 0; nLvl < nEnd; ++nLvl ) + if( SVX_NUM_NUMBER_NONE != ( pNFmt = &rRule.Get( nLvl )) + ->GetNumberingType() || pNFmt->GetPrefix().Len() || + (pNFmt->GetSuffix().Len() && pNFmt->GetSuffix() != aDotStr )) + break; + + if( pEnd ) + *pEnd = nEnd; + return nLvl != nEnd; +} + +void RtfExport::BuildNumbering() +{ + const SwNumRuleTbl& rListTbl = pDoc->GetNumRuleTbl(); + + for( USHORT n = rListTbl.Count()+1; n; ) + { + SwNumRule* pRule; + --n; + if( n == rListTbl.Count() ) + pRule = (SwNumRule*)pDoc->GetOutlineNumRule(); + else + { + pRule = rListTbl[ n ]; + if( !pDoc->IsUsed( *pRule )) + continue; + } + + if( IsExportNumRule( *pRule )) + GetId( *pRule ); + } +} + +void RtfExport::WriteNumbering() +{ + OSL_TRACE("%s start", OSL_THIS_FUNC); + + if ( !pUsedNumTbl ) + return; // no numbering is used + + Strm() << '{' << OOO_STRING_SVTOOLS_RTF_IGNORE << OOO_STRING_SVTOOLS_RTF_LISTTABLE; + AbstractNumberingDefinitions(); + Strm() << '}'; + + Strm() << '{' << OOO_STRING_SVTOOLS_RTF_LISTOVERRIDETABLE; + NumberingDefinitions(); + Strm() << '}'; + + OSL_TRACE("%s end", OSL_THIS_FUNC); +} + +void RtfExport::WriteRevTab() +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + int nRevAuthors = pDoc->GetRedlineTbl().Count(); + + if (nRevAuthors < 1) + return; + + // RTF always seems to use Unknown as the default first entry + String sUnknown(RTL_CONSTASCII_USTRINGPARAM("Unknown")); + GetRedline(sUnknown); + + for( USHORT i = 0; i < pDoc->GetRedlineTbl().Count(); ++i ) + { + const SwRedline* pRedl = pDoc->GetRedlineTbl()[ i ]; + + GetRedline(SW_MOD()->GetRedlineAuthor(pRedl->GetAuthor())); + } + + // Now write the table + Strm() << '{' << OOO_STRING_SVTOOLS_RTF_IGNORE << OOO_STRING_SVTOOLS_RTF_REVTBL << ' '; + for(USHORT i = 0; i < m_aRedlineTbl.size(); ++i) + { + const String* pAuthor = GetRedline(i); + Strm() << '{'; + if (pAuthor) + Strm() << OutString(*pAuthor, eDefaultEncoding); + Strm() << ";}"; + } + Strm() << '}' << sNewLine; +} + +void RtfExport::WriteHeadersFooters( BYTE nHeadFootFlags, + const SwFrmFmt& rFmt, const SwFrmFmt& rLeftFmt, const SwFrmFmt& rFirstPageFmt, BYTE /*nBreakCode*/ ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + // headers + if ( nHeadFootFlags & nsHdFtFlags::WW8_HEADER_EVEN ) + WriteHeaderFooter( rLeftFmt, true, OOO_STRING_SVTOOLS_RTF_HEADERL ); + + if ( nHeadFootFlags & nsHdFtFlags::WW8_HEADER_ODD ) + WriteHeaderFooter( rFmt, true, OOO_STRING_SVTOOLS_RTF_HEADER ); + + if ( nHeadFootFlags & nsHdFtFlags::WW8_HEADER_FIRST ) + WriteHeaderFooter( rFirstPageFmt, true, OOO_STRING_SVTOOLS_RTF_HEADERF ); + + // footers + if ( nHeadFootFlags & nsHdFtFlags::WW8_FOOTER_EVEN ) + WriteHeaderFooter( rLeftFmt, false, OOO_STRING_SVTOOLS_RTF_FOOTERL ); + + if ( nHeadFootFlags & nsHdFtFlags::WW8_FOOTER_ODD ) + WriteHeaderFooter( rFmt, false, OOO_STRING_SVTOOLS_RTF_FOOTER ); + + if ( nHeadFootFlags & nsHdFtFlags::WW8_FOOTER_FIRST ) + WriteHeaderFooter( rFirstPageFmt, false, OOO_STRING_SVTOOLS_RTF_FOOTERF ); +} + +void RtfExport::OutputField( const SwField* pFld, ww::eField eFldType, const String& rFldCmd, BYTE nMode ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + m_pAttrOutput->WriteField_Impl( pFld, eFldType, rFldCmd, nMode ); +} + +void RtfExport::WriteFormData( const ::sw::mark::IFieldmark& /*rFieldmark*/ ) +{ + OSL_TRACE("TODO: %s", OSL_THIS_FUNC); +} + +void RtfExport::WriteHyperlinkData( const ::sw::mark::IFieldmark& /*rFieldmark*/ ) +{ + OSL_TRACE("TODO: %s", OSL_THIS_FUNC); +} + +void RtfExport::DoComboBox(const rtl::OUString& /*rName*/, + const rtl::OUString& /*rHelp*/, + const rtl::OUString& /*rToolTip*/, + const rtl::OUString& /*rSelected*/, + uno::Sequence<rtl::OUString>& /*rListItems*/) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + // this is handled in RtfAttributeOutput::OutputFlyFrame_Impl +} + +void RtfExport::DoFormText(const SwInputField* pFld ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + ::rtl::OUString sResult = pFld->ExpandField(pDoc->IsClipBoard()); + ::rtl::OUString sHelp( pFld->GetHelp() ); + ::rtl::OUString sName = pFld->GetPar2(); + ::rtl::OUString sStatus = pFld->GetToolTip(); + m_pAttrOutput->RunText().append("{" OOO_STRING_SVTOOLS_RTF_FIELD "{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FLDINST "{ FORMTEXT }"); + m_pAttrOutput->RunText().append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FORMFIELD " {" OOO_STRING_SVTOOLS_RTF_FFTYPE "0" ); + if( sHelp.getLength() ) + m_pAttrOutput->RunText().append( OOO_STRING_SVTOOLS_RTF_FFOWNHELP ); + if( sStatus.getLength() ) + m_pAttrOutput->RunText().append( OOO_STRING_SVTOOLS_RTF_FFOWNSTAT ); + m_pAttrOutput->RunText().append( OOO_STRING_SVTOOLS_RTF_FFTYPETXT "0" ); + + if( sName.getLength() ) + m_pAttrOutput->RunText().append( "{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFNAME " ").append( OutString( sName, eDefaultEncoding )).append( "}" ); + if( sHelp.getLength() ) + m_pAttrOutput->RunText().append( "{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFHELPTEXT " ").append( OutString( sHelp, eDefaultEncoding )).append( "}" ); + m_pAttrOutput->RunText().append( "{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFDEFTEXT " ").append( OutString( sResult, eDefaultEncoding )).append( "}" ); + if( sStatus.getLength() ) + m_pAttrOutput->RunText().append( "{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_FFSTATTEXT " ").append( OutString( sStatus, eDefaultEncoding )).append( "}"); + m_pAttrOutput->RunText().append( "}}}{" OOO_STRING_SVTOOLS_RTF_FLDRSLT " " ); + m_pAttrOutput->RunText().append( OutString( sResult, eDefaultEncoding )).append( "}}" ); +} + +ULONG RtfExport::ReplaceCr( BYTE ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + // Completely unused for Rtf export... only here for code sharing + // purpose with binary export + + return 0; +} + +void RtfExport::WriteFonts() +{ + Strm() << sNewLine << '{' << OOO_STRING_SVTOOLS_RTF_FONTTBL; + maFontHelper.WriteFontTable( *m_pAttrOutput ); + Strm() << '}'; +} + +void RtfExport::WriteStyles() +{ + OSL_TRACE("%s start", OSL_THIS_FUNC); + pStyles->OutputStylesTable(); + OSL_TRACE("%s end", OSL_THIS_FUNC); +} + +void RtfExport::WriteMainText() +{ + OSL_TRACE("%s start", OSL_THIS_FUNC); + pCurPam->GetPoint()->nNode = pDoc->GetNodes().GetEndOfContent().StartOfSectionNode()->GetIndex(); + WriteText(); + OSL_TRACE("%s end", OSL_THIS_FUNC); +} + +void RtfExport::WriteInfo() +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + Strm() << '{' << OOO_STRING_SVTOOLS_RTF_INFO; + + SwDocShell *pDocShell(pDoc->GetDocShell()); + uno::Reference<document::XDocumentProperties> xDocProps; + if (pDocShell) { + uno::Reference<document::XDocumentPropertiesSupplier> xDPS( + pDocShell->GetModel(), uno::UNO_QUERY); + xDocProps.set(xDPS->getDocumentProperties()); + } + + if (xDocProps.is()) { + OutUnicode(OOO_STRING_SVTOOLS_RTF_TITLE, xDocProps->getTitle()); + OutUnicode(OOO_STRING_SVTOOLS_RTF_SUBJECT, xDocProps->getSubject()); + + OutUnicode(OOO_STRING_SVTOOLS_RTF_KEYWORDS, + ::comphelper::string::convertCommaSeparated(xDocProps->getKeywords())); + OutUnicode(OOO_STRING_SVTOOLS_RTF_DOCCOMM, xDocProps->getDescription()); + + OutUnicode(OOO_STRING_SVTOOLS_RTF_AUTHOR, xDocProps->getAuthor()); + OutDateTime(OOO_STRING_SVTOOLS_RTF_CREATIM, xDocProps->getCreationDate()); + + OutUnicode(OOO_STRING_SVTOOLS_RTF_AUTHOR,xDocProps->getModifiedBy()); + OutDateTime(OOO_STRING_SVTOOLS_RTF_REVTIM, xDocProps->getModificationDate()); + + OutDateTime(OOO_STRING_SVTOOLS_RTF_PRINTIM, xDocProps->getPrintDate()); + } + + Strm() << '{' << OOO_STRING_SVTOOLS_RTF_COMMENT << " "; + OUString sProduct; + utl::ConfigManager::GetDirectConfigProperty(utl::ConfigManager::PRODUCTNAME) >>= sProduct; + Strm() << OUStringToOString( sProduct, eCurrentEncoding) << "}{" << OOO_STRING_SVTOOLS_RTF_VERN; + OutULong( SUPD*10 ) << '}'; + Strm() << '}'; +} + +void RtfExport::WritePageDescTable() +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + // Write page descriptions (page styles) + USHORT nSize = pDoc->GetPageDescCnt(); + if( !nSize ) + return; + + Strm() << sNewLine; // a separator + bOutPageDescs = TRUE; + Strm() << '{' << OOO_STRING_SVTOOLS_RTF_IGNORE << OOO_STRING_SVTOOLS_RTF_PGDSCTBL; + for( USHORT n = 0; n < nSize; ++n ) + { + const SwPageDesc& rPageDesc = + const_cast<const SwDoc*>(pDoc)->GetPageDesc( n ); + + Strm() << sNewLine << '{' << OOO_STRING_SVTOOLS_RTF_PGDSC; + OutULong( n ) << OOO_STRING_SVTOOLS_RTF_PGDSCUSE; + OutULong( rPageDesc.ReadUseOn() ); + + OutPageDescription( rPageDesc, FALSE, FALSE ); + + // search for the next page description + USHORT i = nSize; + while( i ) + if( rPageDesc.GetFollow() == + &const_cast<const SwDoc *>(pDoc)->GetPageDesc( --i ) ) + break; + Strm() << OOO_STRING_SVTOOLS_RTF_PGDSCNXT; + OutULong( i ) << ' '; + Strm() << OutString( rPageDesc.GetName(), eDefaultEncoding) << ";}"; + } + Strm() << '}' << sNewLine; + bOutPageDescs = FALSE; +} + +void RtfExport::ExportDocument_Impl() +{ +#ifdef DEBUG + // MSWordExportBase::WriteText and others write debug messages to std::clog + // which is not interesting while debugging RtfExport + std::ostringstream aOss; + std::streambuf *pOldBuf = std::clog.rdbuf(aOss.rdbuf()); +#endif + + // Make the header + Strm() << '{' << OOO_STRING_SVTOOLS_RTF_RTF << '1' + << OOO_STRING_SVTOOLS_RTF_ANSI; + Strm() << OOO_STRING_SVTOOLS_RTF_DEFF; + OutULong( maFontHelper.GetId( (SvxFontItem&)pDoc->GetAttrPool().GetDefaultItem( + RES_CHRATR_FONT ) )); + // If this not exist, MS don't understand our ansi characters (0x80-0xff). + Strm() << "\\adeflang1025"; + + // Font table + WriteFonts(); + + pStyles = new MSWordStyles( *this ); + // Color and stylesheet table + WriteStyles(); + + // List table + BuildNumbering(); + WriteNumbering(); + + WriteRevTab(); + + WriteInfo(); + // Default TabSize + Strm() << m_pAttrOutput->m_aTabStop.makeStringAndClear() << sNewLine; + // Page description + WritePageDescTable(); + + // Enable form protection by default if needed, as there is no switch to + // enable it on a per-section basis. OTOH don't always enable it as it + // breaks moving of drawings - so write it only in case there is really a + // protected section in the document. + { + const SfxItemPool& rPool = pDoc->GetAttrPool(); + sal_uInt32 const nMaxItem = rPool.GetItemCount2(RES_PROTECT); + for (sal_uInt32 n = 0; n < nMaxItem; ++n) + { + const SvxProtectItem* pProtect = (const SvxProtectItem*)rPool.GetItem2(RES_PROTECT, n); + if (pProtect && pProtect->IsCntntProtected()) + { + Strm() << OOO_STRING_SVTOOLS_RTF_FORMPROT; + break; + } + } + } + + // enable form field shading + Strm() << OOO_STRING_SVTOOLS_RTF_FORMSHADE; + + // size and empty margins of the page + if( pDoc->GetPageDescCnt() ) + { + //JP 06.04.99: Bug 64361 - Seeking the first SwFmtPageDesc. If + // no set, the default is valid + const SwFmtPageDesc* pSttPgDsc = 0; + { + const SwNode& rSttNd = *pDoc->GetNodes()[ + pDoc->GetNodes().GetEndOfExtras().GetIndex() + 2 ]; + const SfxItemSet* pSet = 0; + + if( rSttNd.IsCntntNode() ) + pSet = &rSttNd.GetCntntNode()->GetSwAttrSet(); + else if( rSttNd.IsTableNode() ) + pSet = &rSttNd.GetTableNode()->GetTable(). + GetFrmFmt()->GetAttrSet(); + else if( rSttNd.IsSectionNode() ) + pSet = &rSttNd.GetSectionNode()->GetSection(). + GetFmt()->GetAttrSet(); + + if( pSet ) + { + USHORT nPosInDoc; + pSttPgDsc = (SwFmtPageDesc*)&pSet->Get( RES_PAGEDESC ); + if( !pSttPgDsc->GetPageDesc() ) + pSttPgDsc = 0; + else if( pDoc->FindPageDescByName( pSttPgDsc-> + GetPageDesc()->GetName(), &nPosInDoc )) + { + Strm() << '{' << OOO_STRING_SVTOOLS_RTF_IGNORE << OOO_STRING_SVTOOLS_RTF_PGDSCNO; + OutULong( nPosInDoc ) << '}'; + } + } + } + const SwPageDesc& rPageDesc = pSttPgDsc ? *pSttPgDsc->GetPageDesc() + : const_cast<const SwDoc *>(pDoc)->GetPageDesc( 0 ); + const SwFrmFmt &rFmtPage = rPageDesc.GetMaster(); + + { + if( rPageDesc.GetLandscape() ) + Strm() << OOO_STRING_SVTOOLS_RTF_LANDSCAPE; + + const SwFmtFrmSize& rSz = rFmtPage.GetFrmSize(); + // Clipboard document is always created without a printer, then + // the size will be always LONG_MAX! Solution then is to use A4 + if( LONG_MAX == rSz.GetHeight() || LONG_MAX == rSz.GetWidth() ) + { + Strm() << OOO_STRING_SVTOOLS_RTF_PAPERH; + Size a4 = SvxPaperInfo::GetPaperSize(PAPER_A4); + OutULong( a4.Height() ) << OOO_STRING_SVTOOLS_RTF_PAPERW; + OutULong( a4.Width() ); + } + else + { + Strm() << OOO_STRING_SVTOOLS_RTF_PAPERH; + OutULong( rSz.GetHeight() ) << OOO_STRING_SVTOOLS_RTF_PAPERW; + OutULong( rSz.GetWidth() ); + } + } + + { + const SvxLRSpaceItem& rLR = rFmtPage.GetLRSpace(); + Strm() << OOO_STRING_SVTOOLS_RTF_MARGL; + OutLong( rLR.GetLeft() ) << OOO_STRING_SVTOOLS_RTF_MARGR; + OutLong( rLR.GetRight() ); + } + + { + const SvxULSpaceItem& rUL = rFmtPage.GetULSpace(); + Strm() << OOO_STRING_SVTOOLS_RTF_MARGT; + OutLong( rUL.GetUpper() ) << OOO_STRING_SVTOOLS_RTF_MARGB; + OutLong( rUL.GetLower() ); + } + + Strm() << OOO_STRING_SVTOOLS_RTF_SECTD << OOO_STRING_SVTOOLS_RTF_SBKNONE; + // All sections are unlocked by default + Strm() << OOO_STRING_SVTOOLS_RTF_SECTUNLOCKED; + OutLong(1); + OutPageDescription( rPageDesc, FALSE, TRUE ); // Changed bCheckForFirstPage to TRUE so headers + // following title page are correctly added - i13107 + if( pSttPgDsc ) + { + pAktPageDesc = &rPageDesc; + } + } + + // line numbering + const SwLineNumberInfo& rLnNumInfo = pDoc->GetLineNumberInfo(); + if ( rLnNumInfo.IsPaintLineNumbers() ) + AttrOutput().SectionLineNumbering( 0, rLnNumInfo ); + + { + // write the footnotes and endnotes-out Info + const SwFtnInfo& rFtnInfo = pDoc->GetFtnInfo(); + + const char* pOut = FTNPOS_CHAPTER == rFtnInfo.ePos + ? OOO_STRING_SVTOOLS_RTF_ENDDOC + : OOO_STRING_SVTOOLS_RTF_FTNBJ; + Strm() << pOut << OOO_STRING_SVTOOLS_RTF_FTNSTART; + OutLong( rFtnInfo.nFtnOffset + 1 ); + + switch( rFtnInfo.eNum ) + { + case FTNNUM_PAGE: pOut = OOO_STRING_SVTOOLS_RTF_FTNRSTPG; break; + case FTNNUM_DOC: pOut = OOO_STRING_SVTOOLS_RTF_FTNRSTCONT; break; + // case FTNNUM_CHAPTER: + default: pOut = OOO_STRING_SVTOOLS_RTF_FTNRESTART; break; + } + Strm() << pOut; + + switch( rFtnInfo.aFmt.GetNumberingType() ) + { + case SVX_NUM_CHARS_LOWER_LETTER: + case SVX_NUM_CHARS_LOWER_LETTER_N: pOut = OOO_STRING_SVTOOLS_RTF_FTNNALC; break; + case SVX_NUM_CHARS_UPPER_LETTER: + case SVX_NUM_CHARS_UPPER_LETTER_N: pOut = OOO_STRING_SVTOOLS_RTF_FTNNAUC; break; + case SVX_NUM_ROMAN_LOWER: pOut = OOO_STRING_SVTOOLS_RTF_FTNNRLC; break; + case SVX_NUM_ROMAN_UPPER: pOut = OOO_STRING_SVTOOLS_RTF_FTNNRUC; break; + case SVX_NUM_CHAR_SPECIAL: pOut = OOO_STRING_SVTOOLS_RTF_FTNNCHI; break; + // case SVX_NUM_ARABIC: + default: pOut = OOO_STRING_SVTOOLS_RTF_FTNNAR; break; + } + Strm() << pOut; + + + const SwEndNoteInfo& rEndNoteInfo = pDoc->GetEndNoteInfo(); + + Strm() << OOO_STRING_SVTOOLS_RTF_AENDDOC << OOO_STRING_SVTOOLS_RTF_AFTNRSTCONT + << OOO_STRING_SVTOOLS_RTF_AFTNSTART; + OutLong( rEndNoteInfo.nFtnOffset + 1 ); + + switch( rEndNoteInfo.aFmt.GetNumberingType() ) + { + case SVX_NUM_CHARS_LOWER_LETTER: + case SVX_NUM_CHARS_LOWER_LETTER_N: pOut = OOO_STRING_SVTOOLS_RTF_AFTNNALC; break; + case SVX_NUM_CHARS_UPPER_LETTER: + case SVX_NUM_CHARS_UPPER_LETTER_N: pOut = OOO_STRING_SVTOOLS_RTF_AFTNNAUC; break; + case SVX_NUM_ROMAN_LOWER: pOut = OOO_STRING_SVTOOLS_RTF_AFTNNRLC; break; + case SVX_NUM_ROMAN_UPPER: pOut = OOO_STRING_SVTOOLS_RTF_AFTNNRUC; break; + case SVX_NUM_CHAR_SPECIAL: pOut = OOO_STRING_SVTOOLS_RTF_AFTNNCHI; break; + // case SVX_NUM_ARABIC: + default: pOut = OOO_STRING_SVTOOLS_RTF_AFTNNAR; break; + } + Strm() << pOut; + } + + Strm() << sNewLine; + + // Init sections + m_pSections = new MSWordSections( *this ); + + WriteMainText(); + + Strm() << '}'; + +#ifdef DEBUG + std::clog.rdbuf(pOldBuf); +#endif +} + +void RtfExport::PrepareNewPageDesc( const SfxItemSet* pSet, + const SwNode& rNd, const SwFmtPageDesc* pNewPgDescFmt, + const SwPageDesc* pNewPgDesc ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + const SwSectionFmt* pFmt = GetSectionFormat( rNd ); + const ULONG nLnNm = GetSectionLineNo( pSet, rNd ); + + OSL_ENSURE( pNewPgDescFmt || pNewPgDesc, "Neither page desc format nor page desc provided." ); + + if ( pNewPgDescFmt ) + m_pSections->AppendSection( *pNewPgDescFmt, rNd, pFmt, nLnNm ); + else if ( pNewPgDesc ) + m_pSections->AppendSection( pNewPgDesc, rNd, pFmt, nLnNm ); + + AttrOutput().SectionBreak( msword::PageBreak, m_pSections->CurrentSectionInfo() ); +} + +bool RtfExport::DisallowInheritingOutlineNumbering( const SwFmt& rFmt ) +{ + bool bRet( false ); + + OSL_TRACE("%s", OSL_THIS_FUNC); + + if (SFX_ITEM_SET != rFmt.GetItemState(RES_PARATR_NUMRULE, false)) + { + if (const SwFmt *pParent = rFmt.DerivedFrom()) + { + if (((const SwTxtFmtColl*)pParent)->IsAssignedToListLevelOfOutlineStyle()) + { + // Level 9 disables the outline + Strm() << OOO_STRING_SVTOOLS_RTF_LEVEL << 9; + + bRet = true; + } + } + } + + return bRet; +} + +void RtfExport::OutputGrfNode( const SwGrfNode& ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + /* noop, see RtfAttributeOutput::FlyFrameGraphic */ +} + +void RtfExport::OutputOLENode( const SwOLENode& ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + /* noop, see RtfAttributeOutput::FlyFrameOLE */ +} + +void RtfExport::AppendSection( const SwPageDesc* pPageDesc, const SwSectionFmt* pFmt, ULONG nLnNum ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + m_pSections->AppendSection( pPageDesc, pFmt, nLnNum ); + AttrOutput().SectionBreak( msword::PageBreak, m_pSections->CurrentSectionInfo() ); +} + +RtfExport::RtfExport( RtfExportFilter *pFilter, SwDoc *pDocument, SwPaM *pCurrentPam, SwPaM *pOriginalPam, Writer* pWriter ) + : MSWordExportBase( pDocument, pCurrentPam, pOriginalPam ), + m_pFilter( pFilter ), + m_pWriter( pWriter ), + m_pAttrOutput( NULL ), + m_pSections( NULL ), + m_pSdrExport( NULL ), + eDefaultEncoding( + rtl_getTextEncodingFromWindowsCharset( + sw::ms::rtl_TextEncodingToWinCharset(DEF_ENCODING))), + eCurrentEncoding(eDefaultEncoding), + bRTFFlySyntax(false) +{ + mbExportModeRTF = true; + // the attribute output for the document + m_pAttrOutput = new RtfAttributeOutput( *this ); + // that just causes problems for RTF + bSubstituteBullets = false; + // needed to have a complete font table + maFontHelper.bLoadAllFonts = true; + // the related SdrExport + m_pSdrExport = new RtfSdrExport( *this ); + + if (!m_pWriter) + m_pWriter = &m_pFilter->m_aWriter; +} + +RtfExport::~RtfExport() +{ + delete m_pAttrOutput, m_pAttrOutput = NULL; + delete m_pSdrExport, m_pSdrExport = NULL; +} + +SvStream& RtfExport::Strm() +{ + return m_pWriter->Strm(); +} + +SvStream& RtfExport::OutULong( ULONG nVal ) +{ + return m_pWriter->OutULong( Strm(), nVal ); +} + +SvStream& RtfExport::OutLong( long nVal ) +{ + return m_pWriter->OutLong( Strm(), nVal ); +} + +void RtfExport::OutUnicode(const sal_Char *pToken, const String &rContent) +{ + if (rContent.Len()) + { + Strm() << '{' << pToken << ' '; + Strm() << OutString( rContent, eCurrentEncoding ).getStr(); + Strm() << '}'; + } +} + +OString RtfExport::OutHex(ULONG nHex, BYTE nLen) +{ + sal_Char aNToABuf[] = "0000000000000000"; + + OSL_ENSURE( nLen < sizeof(aNToABuf), "nLen is too big" ); + if( nLen >= sizeof(aNToABuf) ) + nLen = (sizeof(aNToABuf)-1); + + // Set pointer to the buffer end + sal_Char* pStr = aNToABuf + (sizeof(aNToABuf)-1); + for( BYTE n = 0; n < nLen; ++n ) + { + *(--pStr) = (sal_Char)(nHex & 0xf ) + 48; + if( *pStr > '9' ) + *pStr += 39; + nHex >>= 4; + } + return OString(pStr); +} + +OString RtfExport::OutChar(sal_Unicode c, int *pUCMode, rtl_TextEncoding eDestEnc) +{ + OStringBuffer aBuf; + const sal_Char* pStr = 0; + // 0x0b instead of \n, etc because of the replacements in SwAttrIter::GetSnippet() + switch (c) + { + case 0x0b: + // hard line break + pStr = OOO_STRING_SVTOOLS_RTF_LINE; + break; + case '\t': + pStr = OOO_STRING_SVTOOLS_RTF_TAB; + break; + case '\\': + case '}': + case '{': + aBuf.append('\\'); + aBuf.append((sal_Char)c); + break; + case 0xa0: + // non-breaking space + pStr = "\\~"; + break; + case 0x1e: + // non-breaking hyphen + pStr = "\\_"; + break; + case 0x1f: + // optional hyphen + pStr = "\\-"; + break; + default: + if (c >= ' ' && c <= '~') + aBuf.append((sal_Char)c); + else { + //If we can't convert to the dest encoding, or if + //its an uncommon multibyte sequence which most + //readers won't be able to handle correctly, then + //If we can't convert to the dest encoding, then + //export as unicode + OUString sBuf(&c, 1); + OString sConverted; + sal_uInt32 nFlags = + RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR | + RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR; + bool bWriteAsUnicode = !(sBuf.convertToString(&sConverted, + eDestEnc, nFlags)) + || (RTL_TEXTENCODING_UTF8==eDestEnc); // #i43933# do not export UTF-8 chars in RTF; + if (bWriteAsUnicode) + sBuf.convertToString(&sConverted, + eDestEnc, OUSTRING_TO_OSTRING_CVTFLAGS); + const sal_Int32 nLen = sConverted.getLength(); + + if (bWriteAsUnicode && pUCMode) + { + // then write as unicode - character + if (*pUCMode != nLen) + { + aBuf.append("\\uc"); + aBuf.append((sal_Int32)nLen); + // #i47831# add an additional whitespace, so that "document whitespaces" are not ignored. + aBuf.append(' '); + *pUCMode = nLen; + } + aBuf.append("\\u"); + aBuf.append((sal_Int32)c); + } + + for (sal_Int32 nI = 0; nI < nLen; ++nI) + { + aBuf.append("\\'"); + aBuf.append(OutHex(sConverted.getStr()[nI], 2)); + } + } + } + if (pStr) { + aBuf.append(pStr); + aBuf.append(' '); + } + return aBuf.makeStringAndClear(); +} + +OString RtfExport::OutString(const String &rStr, rtl_TextEncoding eDestEnc) +{ + OSL_TRACE("%s, rStr = '%s'", OSL_THIS_FUNC, + OUStringToOString( OUString( rStr ), eDestEnc ).getStr()); + OStringBuffer aBuf; + int nUCMode = 1; + for (xub_StrLen n = 0; n < rStr.Len(); ++n) + aBuf.append(OutChar(rStr.GetChar(n), &nUCMode, eDestEnc)); + if (nUCMode != 1) { + aBuf.append(OOO_STRING_SVTOOLS_RTF_UC); + aBuf.append((sal_Int32)1); + aBuf.append(" "); // #i47831# add an additional whitespace, so that "document whitespaces" are not ignored.; + } + return aBuf.makeStringAndClear(); +} + +void RtfExport::OutDateTime(const sal_Char* pStr, const util::DateTime& rDT ) +{ + Strm() << '{' << pStr << OOO_STRING_SVTOOLS_RTF_YR; + OutULong( rDT.Year ) << OOO_STRING_SVTOOLS_RTF_MO; + OutULong( rDT.Month ) << OOO_STRING_SVTOOLS_RTF_DY; + OutULong( rDT.Day ) << OOO_STRING_SVTOOLS_RTF_HR; + OutULong( rDT.Hours ) << OOO_STRING_SVTOOLS_RTF_MIN; + OutULong( rDT.Minutes ) << '}'; +} + +USHORT RtfExport::GetColor( const Color& rColor ) const +{ + for (RtfColorTbl::const_iterator it=m_aColTbl.begin() ; it != m_aColTbl.end(); it++ ) + if ((*it).second == rColor) { + OSL_TRACE("%s returning %d (%d,%d,%d)", OSL_THIS_FUNC, (*it).first, rColor.GetRed(), rColor.GetGreen(), rColor.GetBlue()); + return (*it).first; + } + OSL_ENSURE( FALSE, "No such Color in m_aColTbl!" ); + return 0; +} + +void RtfExport::InsColor( const Color& rCol ) +{ + USHORT n; + for (RtfColorTbl::iterator it=m_aColTbl.begin() ; it != m_aColTbl.end(); it++ ) + if ((*it).second == rCol) + return; // Already in the table + if (rCol.GetColor() == COL_AUTO) + n = 0; + else + { + n = m_aColTbl.size(); + // Fix for the case when first a !COL_AUTO gets inserted as #0, then + // gets overwritten by COL_AUTO + if (!n) + n++; + } + m_aColTbl.insert(std::pair<USHORT,Color>( n, rCol )); +} + +void RtfExport::InsColorLine( const SvxBoxItem& rBox ) +{ + const SvxBorderLine* pLine = 0; + + if( rBox.GetTop() ) + InsColor( (pLine = rBox.GetTop())->GetColor() ); + if( rBox.GetBottom() && pLine != rBox.GetBottom() ) + InsColor( (pLine = rBox.GetBottom())->GetColor() ); + if( rBox.GetLeft() && pLine != rBox.GetLeft() ) + InsColor( (pLine = rBox.GetLeft())->GetColor() ); + if( rBox.GetRight() && pLine != rBox.GetRight() ) + InsColor( rBox.GetRight()->GetColor() ); +} +void RtfExport::OutColorTable() +{ + // Build the table from rPool since the colors provided to + // RtfAttributeOutput callbacks are too late. + sal_uInt32 nMaxItem; + const SfxItemPool& rPool = pDoc->GetAttrPool(); + + // char color + { + const SvxColorItem* pCol = (const SvxColorItem*)GetDfltAttr( + RES_CHRATR_COLOR ); + InsColor( pCol->GetValue() ); + if( 0 != ( pCol = (const SvxColorItem*)rPool.GetPoolDefaultItem( + RES_CHRATR_COLOR ) )) + InsColor( pCol->GetValue() ); + nMaxItem = rPool.GetItemCount2(RES_CHRATR_COLOR); + for (sal_uInt32 n = 0; n < nMaxItem; ++n) + { + if( 0 != (pCol = (const SvxColorItem*)rPool.GetItem2( + RES_CHRATR_COLOR, n ) ) ) + InsColor( pCol->GetValue() ); + } + + const SvxUnderlineItem* pUnder = (const SvxUnderlineItem*)GetDfltAttr( RES_CHRATR_UNDERLINE ); + InsColor( pUnder->GetColor() ); + nMaxItem = rPool.GetItemCount2(RES_CHRATR_UNDERLINE); + for (sal_uInt32 n = 0; n < nMaxItem; ++n) + { + if( 0 != (pUnder = (const SvxUnderlineItem*)rPool.GetItem2( RES_CHRATR_UNDERLINE, n ) ) ) + InsColor( pUnder->GetColor() ); + + } + + const SvxOverlineItem* pOver = (const SvxOverlineItem*)GetDfltAttr( RES_CHRATR_OVERLINE ); + InsColor( pOver->GetColor() ); + nMaxItem = rPool.GetItemCount2(RES_CHRATR_OVERLINE); + for (sal_uInt32 n = 0; n < nMaxItem; ++n) + { + if( 0 != (pOver = (const SvxOverlineItem*)rPool.GetItem2( RES_CHRATR_OVERLINE, n ) ) ) + InsColor( pOver->GetColor() ); + + } + + } + + // background color + static const USHORT aBrushIds[] = { + RES_BACKGROUND, RES_CHRATR_BACKGROUND, 0 }; + + for( const USHORT* pIds = aBrushIds; *pIds; ++pIds ) + { + const SvxBrushItem* pBkgrd = (const SvxBrushItem*)GetDfltAttr( *pIds ); + InsColor( pBkgrd->GetColor() ); + if( 0 != ( pBkgrd = (const SvxBrushItem*)rPool.GetPoolDefaultItem( + *pIds ) )) + { + InsColor( pBkgrd->GetColor() ); + } + nMaxItem = rPool.GetItemCount2( *pIds ); + for (sal_uInt32 n = 0; n < nMaxItem; ++n) + { + if( 0 != (pBkgrd = (const SvxBrushItem*)rPool.GetItem2( + *pIds , n ) )) + { + InsColor( pBkgrd->GetColor() ); + } + } + } + + // shadow color + { + const SvxShadowItem* pShadow = (const SvxShadowItem*)GetDfltAttr( + RES_SHADOW ); + InsColor( pShadow->GetColor() ); + if( 0 != ( pShadow = (const SvxShadowItem*)rPool.GetPoolDefaultItem( + RES_SHADOW ) )) + { + InsColor( pShadow->GetColor() ); + } + nMaxItem = rPool.GetItemCount2(RES_SHADOW); + for (sal_uInt32 n = 0; n < nMaxItem; ++n) + { + if( 0 != (pShadow = (const SvxShadowItem*)rPool.GetItem2( + RES_SHADOW, n ) ) ) + { + InsColor( pShadow->GetColor() ); + } + } + } + + // frame border color + { + const SvxBoxItem* pBox; + if( 0 != ( pBox = (const SvxBoxItem*)rPool.GetPoolDefaultItem( + RES_BOX ) )) + InsColorLine( *pBox ); + nMaxItem = rPool.GetItemCount2(RES_BOX); + for (sal_uInt32 n = 0; n < nMaxItem; ++n) + { + if( 0 != (pBox = (const SvxBoxItem*)rPool.GetItem2( RES_BOX, n ) )) + InsColorLine( *pBox ); + } + } + + for (size_t n = 0; n < m_aColTbl.size(); ++n) + { + const Color& rCol = m_aColTbl[ n ]; + if( n || COL_AUTO != rCol.GetColor() ) + { + Strm() << OOO_STRING_SVTOOLS_RTF_RED; + OutULong( rCol.GetRed() ) << OOO_STRING_SVTOOLS_RTF_GREEN; + OutULong( rCol.GetGreen() ) << OOO_STRING_SVTOOLS_RTF_BLUE; + OutULong( rCol.GetBlue() ); + } + Strm() << ';'; + } +} + +void RtfExport::InsStyle( USHORT nId, const OString& rStyle ) +{ + m_aStyTbl.insert(std::pair<USHORT,OString>(nId, rStyle) ); +} + +OString* RtfExport::GetStyle( USHORT nId ) +{ + std::map<USHORT,OString>::iterator i = m_aStyTbl.find(nId); + if (i != m_aStyTbl.end()) + return &i->second; + return NULL; +} + +USHORT RtfExport::GetRedline( const String& rAuthor ) +{ + std::map<String,USHORT>::iterator i = m_aRedlineTbl.find(rAuthor); + if (i != m_aRedlineTbl.end()) + return i->second; + else + { + int nId = m_aRedlineTbl.size(); + m_aRedlineTbl.insert(std::pair<String,USHORT>(rAuthor,nId)); + return nId; + } +} + +const String* RtfExport::GetRedline( USHORT nId ) +{ + for(std::map<String,USHORT>::iterator aIter = m_aRedlineTbl.begin(); aIter != m_aRedlineTbl.end(); ++aIter) + if ((*aIter).second == nId) + return &(*aIter).first; + return NULL; +} + +void RtfExport::OutPageDescription( const SwPageDesc& rPgDsc, BOOL bWriteReset, BOOL bCheckForFirstPage ) +{ + OSL_TRACE("%s start", OSL_THIS_FUNC); + const SwPageDesc *pSave = pAktPageDesc; + + pAktPageDesc = &rPgDsc; + if( bCheckForFirstPage && pAktPageDesc->GetFollow() && + pAktPageDesc->GetFollow() != pAktPageDesc ) + pAktPageDesc = pAktPageDesc->GetFollow(); + + if( bWriteReset ) + { + if( pCurPam->GetPoint()->nNode == pOrigPam->Start()->nNode ) + Strm() << OOO_STRING_SVTOOLS_RTF_SECTD << OOO_STRING_SVTOOLS_RTF_SBKNONE; + else + Strm() << OOO_STRING_SVTOOLS_RTF_SECT << OOO_STRING_SVTOOLS_RTF_SECTD; + } + + if( pAktPageDesc->GetLandscape() ) + Strm() << OOO_STRING_SVTOOLS_RTF_LNDSCPSXN; + + const SwFmt *pFmt = &pAktPageDesc->GetMaster(); //GetLeft(); + bOutPageDescs = true; + OutputFormat(*pFmt, true, false); + bOutPageDescs = false; + + // normal header / footer (without a style) + const SfxPoolItem* pItem; + if( pAktPageDesc->GetLeft().GetAttrSet().GetItemState( RES_HEADER, FALSE, + &pItem ) == SFX_ITEM_SET) + WriteHeaderFooter(*pItem, true); + if( pAktPageDesc->GetLeft().GetAttrSet().GetItemState( RES_FOOTER, FALSE, + &pItem ) == SFX_ITEM_SET) + WriteHeaderFooter(*pItem, false); + + // title page + if( pAktPageDesc != &rPgDsc ) + { + pAktPageDesc = &rPgDsc; + Strm() << OOO_STRING_SVTOOLS_RTF_TITLEPG; + if( pAktPageDesc->GetMaster().GetAttrSet().GetItemState( RES_HEADER, + FALSE, &pItem ) == SFX_ITEM_SET ) + WriteHeaderFooter(*pItem, true); + if( pAktPageDesc->GetMaster().GetAttrSet().GetItemState( RES_FOOTER, + FALSE, &pItem ) == SFX_ITEM_SET ) + WriteHeaderFooter(*pItem, false); + } + + // numbering type + AttrOutput().SectionPageNumbering(pAktPageDesc->GetNumType().GetNumberingType(), 0); + + pAktPageDesc = pSave; + //bOutPageDesc = bOldOut; + OSL_TRACE("%s end", OSL_THIS_FUNC); +} + +void RtfExport::WriteHeaderFooter(const SfxPoolItem& rItem, bool bHeader) +{ + if (bHeader) + { + const SwFmtHeader& rHeader = (const SwFmtHeader&)rItem; + if (!rHeader.IsActive()) + return; + } + else + { + const SwFmtFooter& rFooter = (const SwFmtFooter&)rItem; + if (!rFooter.IsActive()) + return; + } + + OSL_TRACE("%s start", OSL_THIS_FUNC); + + const sal_Char* pStr = (bHeader ? OOO_STRING_SVTOOLS_RTF_HEADER : OOO_STRING_SVTOOLS_RTF_FOOTER); + /* is this a title page? */ + if( pAktPageDesc->GetFollow() && pAktPageDesc->GetFollow() != pAktPageDesc ) + { + Strm() << OOO_STRING_SVTOOLS_RTF_TITLEPG; + pStr = (bHeader ? OOO_STRING_SVTOOLS_RTF_HEADERF : OOO_STRING_SVTOOLS_RTF_FOOTERF); + } + Strm() << '{' << pStr; + WriteHeaderFooterText(pAktPageDesc->GetMaster(), bHeader); + Strm() << '}'; + + OSL_TRACE("%s end", OSL_THIS_FUNC); +} + +void RtfExport::WriteHeaderFooter(const SwFrmFmt& rFmt, bool bHeader, const sal_Char* pStr) +{ + OSL_TRACE("%s start", OSL_THIS_FUNC); + + m_pAttrOutput->WriteHeaderFooter_Impl( rFmt, bHeader, pStr ); + + OSL_TRACE("%s end", OSL_THIS_FUNC); +} + +class SwRTFWriter : public Writer +{ + public: + SwRTFWriter( const String& rFilterName, const String& rBaseURL ); + virtual ~SwRTFWriter(); + virtual ULONG WriteStream(); +}; + +SwRTFWriter::SwRTFWriter( const String& /*rFltName*/, const String & rBaseURL ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + SetBaseURL( rBaseURL ); +} + +SwRTFWriter::~SwRTFWriter() +{} + +ULONG SwRTFWriter::WriteStream() +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + RtfExport aExport( NULL, pDoc, new SwPaM( *pCurPam->End(), *pCurPam->Start() ), pCurPam, this ); + aExport.ExportDocument( true ); + return 0; +} + +extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL ExportRTF( const String& rFltName, const String& rBaseURL, WriterRef& xRet ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + xRet = new SwRTFWriter( rFltName, rBaseURL ); +} + +/* vi:set shiftwidth=4 expandtab: */ diff --git a/sw/source/filter/ww8/rtfexport.hxx b/sw/source/filter/ww8/rtfexport.hxx new file mode 100644 index 0000000000..9b866f673d --- /dev/null +++ b/sw/source/filter/ww8/rtfexport.hxx @@ -0,0 +1,212 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * Copyright 2010 Miklos Vajna. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _RTFEXPORT_HXX_ +#define _RTFEXPORT_HXX_ + +#include <set> +#include "rtfattributeoutput.hxx" +#include "wrtww8.hxx" + +#include <rtl/ustring.hxx> + +#include <cstdio> +#include <map> + +class RtfExportFilter; +class RtfSdrExport; +typedef std::map<USHORT,Color> RtfColorTbl; +typedef std::map<USHORT,rtl::OString> RtfStyleTbl; +typedef std::map<String,USHORT> RtfRedlineTbl; +class SwNode; +class SwEndNode; +class SwTableNode; +class SwTxtNode; +class SwGrfNode; +class SwOLENode; +class SwSectionNode; +class SwNumRuleTbl; + +namespace com { namespace sun { namespace star { + namespace frame { class XModel; } +} } } + +/// The class that does all the actual RTF export-related work. +class RtfExport : public MSWordExportBase +{ + /// Pointer to the filter that owns us. + RtfExportFilter *m_pFilter; + Writer* m_pWriter; + + /// Attribute output for document. + RtfAttributeOutput *m_pAttrOutput; + + /// Sections/headers/footers + MSWordSections *m_pSections; + + RtfSdrExport *m_pSdrExport; + +public: + /// Access to the attribute output class. + virtual AttributeOutputBase& AttrOutput() const; + + /// Access to the sections/headers/footres. + virtual MSWordSections& Sections() const; + + /// Access to the Rtf Sdr exporter. + virtual RtfSdrExport& SdrExporter() const; + + /// Hack, unfortunately necessary at some places for now. + virtual bool HackIsWW8OrHigher() const { return false; } + + /// Guess the script (asian/western). + virtual bool CollapseScriptsforWordOk( USHORT nScript, USHORT nWhich ); + + virtual void AppendBookmarks( const SwTxtNode& rNode, xub_StrLen nAktPos, xub_StrLen nLen ); + + virtual void AppendBookmark( const rtl::OUString& rName, bool bSkip = false ); + + virtual void WriteCR( ww8::WW8TableNodeInfoInner::Pointer_t /*pTableTextNodeInfoInner = ww8::WW8TableNodeInfoInner::Pointer_t()*/ ) { /* no-op for rtf, most probably should not even be in MSWordExportBase */ } + virtual void WriteChar( sal_Unicode ); + + /// Write the numbering table. + virtual void WriteNumbering(); + + /// Write the revision table. + virtual void WriteRevTab(); + + /// Output the actual headers and footers. + virtual void WriteHeadersFooters( BYTE nHeadFootFlags, + const SwFrmFmt& rFmt, const SwFrmFmt& rLeftFmt, const SwFrmFmt& rFirstPageFmt, BYTE nBreakCode ); + + /// Write the field + virtual void OutputField( const SwField* pFld, ww::eField eFldType, + const String& rFldCmd, BYTE nMode = nsFieldFlags::WRITEFIELD_ALL ); + + /// Write the data of the form field + virtual void WriteFormData( const ::sw::mark::IFieldmark& rFieldmark ); + virtual void WriteHyperlinkData( const ::sw::mark::IFieldmark& rFieldmark ); + + virtual void DoComboBox(const rtl::OUString &rName, + const rtl::OUString &rHelp, + const rtl::OUString &ToolTip, + const rtl::OUString &rSelected, + com::sun::star::uno::Sequence<rtl::OUString> &rListItems); + + virtual void DoFormText(const SwInputField * pFld); + + virtual ULONG ReplaceCr( BYTE nChar ); + +protected: + /// Format-dependant part of the actual export. + virtual void ExportDocument_Impl(); + + virtual void SectionBreaksAndFrames( const SwTxtNode& /*rNode*/ ) {} + + /// Get ready for a new section. + virtual void PrepareNewPageDesc( const SfxItemSet* pSet, + const SwNode& rNd, + const SwFmtPageDesc* pNewPgDescFmt = 0, + const SwPageDesc* pNewPgDesc = 0 ); + + /// Return value indicates if an inherited outline numbering is suppressed. + virtual bool DisallowInheritingOutlineNumbering(const SwFmt &rFmt); + + /// Output SwGrfNode + virtual void OutputGrfNode( const SwGrfNode& ); + + /// Output SwOLENode + virtual void OutputOLENode( const SwOLENode& ); + + virtual void AppendSection( const SwPageDesc *pPageDesc, const SwSectionFmt* pFmt, ULONG nLnNum ); + +public: + /// Pass the pDocument, pCurrentPam and pOriginalPam to the base class. + RtfExport( RtfExportFilter *pFilter, SwDoc *pDocument, + SwPaM *pCurrentPam, SwPaM *pOriginalPam, Writer* pWriter ); + + /// Destructor. + virtual ~RtfExport(); + +#if defined(UNX) + static const sal_Char sNewLine; // \012 or \015 +#else + static const sal_Char __FAR_DATA sNewLine[]; // \015\012 +#endif + + rtl_TextEncoding eDefaultEncoding; + rtl_TextEncoding eCurrentEncoding; + /// This is used by OutputFlyFrame_Impl() to control the written syntax + bool bRTFFlySyntax; + + BOOL m_bOutStyleTab : 1; + SvStream& Strm(); + SvStream& OutULong( ULONG nVal ); + SvStream& OutLong( long nVal ); + void OutUnicode(const sal_Char *pToken, const String &rContent); + void OutDateTime(const sal_Char* pStr, const util::DateTime& rDT ); + static rtl::OString OutChar(sal_Unicode c, int *pUCMode, rtl_TextEncoding eDestEnc); + static rtl::OString OutString(const String &rStr, rtl_TextEncoding eDestEnc); + static rtl::OString OutHex(ULONG nHex, BYTE nLen); + void OutPageDescription( const SwPageDesc& rPgDsc, BOOL bWriteReset, BOOL bCheckForFirstPage ); + + USHORT GetColor( const Color& rColor ) const; + void InsColor( const Color& rCol ); + void InsColorLine( const SvxBoxItem& rBox ); + void OutColorTable(); + USHORT GetRedline( const String& rAuthor ); + const String* GetRedline( USHORT nId ); + + void InsStyle( USHORT nId, const rtl::OString& rStyle ); + rtl::OString* GetStyle( USHORT nId ); + +private: + /// No copying. + RtfExport( const RtfExport& ); + + /// No copying. + RtfExport& operator=( const RtfExport& ); + + void WriteFonts(); + void WriteStyles(); + void WriteMainText(); + void WriteInfo(); + /// Writes the writer-specific \pgdsctbl group. + void WritePageDescTable(); + /// This is necessary to have the numbering table ready before the main text is being processed. + void BuildNumbering(); + void WriteHeaderFooter(const SfxPoolItem& rItem, bool bHeader); + void WriteHeaderFooter(const SwFrmFmt& rFmt, bool bHeader, const sal_Char* pStr); + + RtfColorTbl m_aColTbl; + RtfStyleTbl m_aStyTbl; + RtfRedlineTbl m_aRedlineTbl; +}; + +#endif // _RTFEXPORT_HXX_ +/* vi:set shiftwidth=4 expandtab: */ diff --git a/sw/source/filter/ww8/rtfexportfilter.cxx b/sw/source/filter/ww8/rtfexportfilter.cxx new file mode 100644 index 0000000000..2a4fb03522 --- /dev/null +++ b/sw/source/filter/ww8/rtfexportfilter.cxx @@ -0,0 +1,188 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * Copyright 2010 Miklos Vajna. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <rtfexportfilter.hxx> +#include <rtfexport.hxx> +#include <rtfimportfilter.hxx> + +#include <docsh.hxx> +#include <doc.hxx> +#include <pam.hxx> +#include <unotxdoc.hxx> + +#include <cppuhelper/factory.hxx> +#include <comphelper/mediadescriptor.hxx> +#include <unotools/ucbstreamhelper.hxx> + +using namespace ::comphelper; +using namespace ::com::sun::star; +using ::rtl::OUString; + +RtfExportFilter::RtfExportFilter( const uno::Reference< lang::XMultiServiceFactory >& xMSF) : + m_xMSF( xMSF ) +{ +} + +RtfExportFilter::~RtfExportFilter() +{ +} + +sal_Bool RtfExportFilter::filter( const uno::Sequence< beans::PropertyValue >& aDescriptor ) + throw (uno::RuntimeException) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + MediaDescriptor aMediaDesc = aDescriptor; + ::uno::Reference< io::XStream > xStream = + aMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_STREAMFOROUTPUT(), uno::Reference< io::XStream >() ); + m_pStream = utl::UcbStreamHelper::CreateStream( xStream, sal_True ); + m_aWriter.SetStream(m_pStream); + + // get SwDoc* + uno::Reference< uno::XInterface > xIfc( m_xSrcDoc, uno::UNO_QUERY ); + SwXTextDocument *pTxtDoc = dynamic_cast< SwXTextDocument * >( xIfc.get() ); + if ( !pTxtDoc ) { + return sal_False; + } + + SwDoc *pDoc = pTxtDoc->GetDocShell()->GetDoc(); + if ( !pDoc ) { + return sal_False; + } + + // get SwPaM* + // we get SwPaM for the entire document; copy&paste is handled internally, not via UNO + SwPaM aPam( pDoc->GetNodes().GetEndOfContent() ); + aPam.SetMark(); + aPam.Move( fnMoveBackward, fnGoDoc ); + + SwPaM *pCurPam = new SwPaM( *aPam.End(), *aPam.Start() ); + + // export the document + // (in a separate block so that it's destructed before the commit) + { + RtfExport aExport( this, pDoc, pCurPam, &aPam, NULL ); + aExport.ExportDocument( true ); + } + + // delete the pCurPam + if ( pCurPam ) + { + while ( pCurPam->GetNext() != pCurPam ) + delete pCurPam->GetNext(); + delete pCurPam; + } + delete m_pStream; + + return sal_True; +} + + +void RtfExportFilter::cancel( ) throw (uno::RuntimeException) +{ +} + +void RtfExportFilter::setSourceDocument( const uno::Reference< lang::XComponent >& xDoc ) + throw (lang::IllegalArgumentException, uno::RuntimeException) +{ + m_xSrcDoc = xDoc; +} + +////////////////////////////////////////////////////////////////////////// +// UNO helpers +////////////////////////////////////////////////////////////////////////// + +OUString RtfExport_getImplementationName() +{ + return OUString( RTL_CONSTASCII_USTRINGPARAM( IMPL_NAME_RTFEXPORT ) ); +} + +uno::Sequence< OUString > SAL_CALL RtfExport_getSupportedServiceNames() throw() +{ + const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.ExportFilter" ) ); + const uno::Sequence< OUString > aSeq( &aServiceName, 1 ); + return aSeq; +} + +uno::Reference< uno::XInterface > SAL_CALL RtfExport_createInstance(const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception ) +{ + return (cppu::OWeakObject*) new RtfExportFilter( rSMgr ); +} +#ifdef __cplusplus +extern "C" +{ +#endif + +SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ ) +{ + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; +} + +// ------------------------ +// - component_getFactory - +// ------------------------ + +SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* /* pRegistryKey */ ) +{ + OSL_TRACE("%s, pImplName is '%s'", OSL_THIS_FUNC, pImplName); + uno::Reference< lang::XSingleServiceFactory > xFactory; + void* pRet = 0; + + if ( rtl_str_compare( pImplName, IMPL_NAME_RTFEXPORT ) == 0 ) { + const OUString aServiceName( OUString::createFromAscii( IMPL_NAME_RTFEXPORT ) ); + + xFactory = uno::Reference< lang::XSingleServiceFactory >( ::cppu::createSingleFactory( + reinterpret_cast< lang::XMultiServiceFactory* >( pServiceManager ), + RtfExport_getImplementationName(), + RtfExport_createInstance, + RtfExport_getSupportedServiceNames() ) ); + } + else if ( rtl_str_compare( pImplName, IMPL_NAME_RTFIMPORT ) == 0 ) { + const OUString aServiceName( OUString::createFromAscii( IMPL_NAME_RTFIMPORT ) ); + + xFactory = uno::Reference< lang::XSingleServiceFactory >( ::cppu::createSingleFactory( + reinterpret_cast< lang::XMultiServiceFactory* >( pServiceManager ), + RtfImport_getImplementationName(), + RtfImport_createInstance, + RtfImport_getSupportedServiceNames() ) ); + } + + if ( xFactory.is() ) + { + xFactory->acquire(); + pRet = xFactory.get(); + } + + return pRet; +} + +#ifdef __cplusplus +} +#endif + +/* vi:set shiftwidth=4 expandtab: */ diff --git a/sw/source/filter/ww8/rtfexportfilter.hxx b/sw/source/filter/ww8/rtfexportfilter.hxx new file mode 100644 index 0000000000..e3ccc3a9d3 --- /dev/null +++ b/sw/source/filter/ww8/rtfexportfilter.hxx @@ -0,0 +1,85 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * Copyright 2010 Miklos Vajna. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _RTFEXPORTFILTER_HXX_ +#define _RTFEXPORTFILTER_HXX_ + +#include <com/sun/star/document/XFilter.hpp> +#include <com/sun/star/document/XExporter.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <cppuhelper/implbase2.hxx> +#include <tools/stream.hxx> +#include <shellio.hxx> + +// This is just here so that we don't have to copy&paste its string format methods +class RtfWriter : public Writer +{ +protected: + ULONG WriteStream() { return 0; } +}; + +/// The physical access to the RTF document (for writing). +class RtfExportFilter : public cppu::WeakImplHelper2 +< + com::sun::star::document::XFilter, + com::sun::star::document::XExporter +> +{ +protected: + ::com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xMSF; + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > m_xSrcDoc; + SvStream* m_pStream; +public: + RtfExportFilter( const ::com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xMSF ); + virtual ~RtfExportFilter(); + + // XFilter + virtual sal_Bool SAL_CALL filter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL cancel( ) + throw (::com::sun::star::uno::RuntimeException); + + // XExporter + virtual void SAL_CALL setSourceDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc ) + throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + + RtfWriter m_aWriter; +}; + +::rtl::OUString RtfExport_getImplementationName(); +::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL RtfExport_getSupportedServiceNames() + throw(); +::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL RtfExport_createInstance( + const ::com::sun::star::uno::Reference< + com::sun::star::lang::XMultiServiceFactory > &xMSF) + throw( ::com::sun::star::uno::Exception ); + +#define IMPL_NAME_RTFEXPORT "com.sun.star.comp.Writer.RtfExport" + +#endif // _RTFEXPORTFILTER_HXX_ +/* vi:set shiftwidth=4 expandtab: */ diff --git a/sw/source/filter/ww8/rtfimportfilter.cxx b/sw/source/filter/ww8/rtfimportfilter.cxx new file mode 100644 index 0000000000..d44a42db4f --- /dev/null +++ b/sw/source/filter/ww8/rtfimportfilter.cxx @@ -0,0 +1,137 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * Copyright 2010 Miklos Vajna. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "rtfimportfilter.hxx" +#include "../rtf/swparrtf.hxx" + +#include <docsh.hxx> +#include <doc.hxx> +#include <pam.hxx> +#include <unotxdoc.hxx> +#include <swerror.h> + +#include <cppuhelper/factory.hxx> +#include <comphelper/mediadescriptor.hxx> +#include <unotools/ucbstreamhelper.hxx> + +#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/XComponentLoader.hpp> + +using namespace ::comphelper; +using namespace ::com::sun::star; +using ::rtl::OUString; +using rtl::OUStringToOString; + +RtfImportFilter::RtfImportFilter( const uno::Reference< lang::XMultiServiceFactory >& xMSF) : + m_xMSF( xMSF ) +{ +} + +RtfImportFilter::~RtfImportFilter() +{ +} + +sal_Bool RtfImportFilter::filter( const uno::Sequence< beans::PropertyValue >& aDescriptor ) + throw (uno::RuntimeException) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + MediaDescriptor aMediaDesc = aDescriptor; + ::uno::Reference< io::XInputStream > xInputStream = + aMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_INPUTSTREAM(), uno::Reference< io::XInputStream >() ); + SvStream* pStream = utl::UcbStreamHelper::CreateStream( xInputStream, sal_True ); + if (!pStream) + return sal_False; + + // get SwDoc* + uno::Reference< uno::XInterface > xIfc( m_xDstDoc, uno::UNO_QUERY ); + SwXTextDocument *pTxtDoc = dynamic_cast< SwXTextDocument * >( xIfc.get() ); + if (!pTxtDoc) + return sal_False; + SwDoc *pDoc = pTxtDoc->GetDocShell()->GetDoc(); + if (!pDoc) + return sal_False; + + // get SwPaM* + // NEEDSWORK should we care about partial imports? For now we just import + // the whole document + SwPaM aPam( pDoc->GetNodes().GetEndOfContent() ); + aPam.SetMark(); + aPam.Move( fnMoveBackward, fnGoDoc ); + SwPaM *pCurPam = new SwPaM( *aPam.End(), *aPam.Start() ); + + String aURL; + OUString sTemp; + for ( sal_Int32 i = 0; i < aDescriptor.getLength(); i++ ) + { + if( aDescriptor[i].Name == OUString(RTL_CONSTASCII_USTRINGPARAM("URL")) ) + { + aDescriptor[i].Value >>= sTemp; + aURL = sTemp; + } + } + + RtfReader aReader; + sal_Bool bRet = aReader.Read(pStream, *pDoc, aURL, *pCurPam) == 0; + delete pStream; + return bRet; +} + + +void RtfImportFilter::cancel( ) throw (uno::RuntimeException) +{ +} + +void RtfImportFilter::setTargetDocument( const uno::Reference< lang::XComponent >& xDoc ) + throw (lang::IllegalArgumentException, uno::RuntimeException) +{ + m_xDstDoc = xDoc; +} + +////////////////////////////////////////////////////////////////////////// +// UNO helpers +////////////////////////////////////////////////////////////////////////// + +OUString RtfImport_getImplementationName() +{ + return OUString( RTL_CONSTASCII_USTRINGPARAM( IMPL_NAME_RTFIMPORT ) ); +} + +uno::Sequence< OUString > SAL_CALL RtfImport_getSupportedServiceNames() throw() +{ + const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.ImportFilter" ) ); + const uno::Sequence< OUString > aSeq( &aServiceName, 1 ); + return aSeq; +} + +uno::Reference< uno::XInterface > SAL_CALL RtfImport_createInstance(const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception ) +{ + return (cppu::OWeakObject*) new RtfImportFilter( rSMgr ); +} + +/* vi:set shiftwidth=4 expandtab: */ diff --git a/sw/source/filter/ww8/rtfimportfilter.hxx b/sw/source/filter/ww8/rtfimportfilter.hxx new file mode 100644 index 0000000000..9026d63573 --- /dev/null +++ b/sw/source/filter/ww8/rtfimportfilter.hxx @@ -0,0 +1,75 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * Copyright 2010 Miklos Vajna. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _RTFIMPORTFILTER_HXX_ +#define _RTFIMPORTFILTER_HXX_ + +#include <com/sun/star/document/XFilter.hpp> +#include <com/sun/star/document/XImporter.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <cppuhelper/implbase2.hxx> +#include <tools/stream.hxx> +#include <shellio.hxx> + +/// The physical access to the RTF document (for reading). +class RtfImportFilter : public cppu::WeakImplHelper2 +< + com::sun::star::document::XFilter, + com::sun::star::document::XImporter +> +{ +protected: + ::com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xMSF; + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > m_xDstDoc; +public: + RtfImportFilter( const ::com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xMSF ); + virtual ~RtfImportFilter(); + + // XFilter + virtual sal_Bool SAL_CALL filter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL cancel( ) + throw (::com::sun::star::uno::RuntimeException); + + // XImporter + virtual void SAL_CALL setTargetDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc ) + throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); +}; + +::rtl::OUString RtfImport_getImplementationName(); +::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL RtfImport_getSupportedServiceNames() + throw(); +::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL RtfImport_createInstance( + const ::com::sun::star::uno::Reference< + com::sun::star::lang::XMultiServiceFactory > &xMSF) + throw( ::com::sun::star::uno::Exception ); + +#define IMPL_NAME_RTFIMPORT "com.sun.star.comp.Writer.RtfImport" + +#endif // _RTFIMPORTFILTER_HXX_ +/* vi:set shiftwidth=4 expandtab: */ diff --git a/sw/source/filter/ww8/rtfsdrexport.cxx b/sw/source/filter/ww8/rtfsdrexport.cxx new file mode 100644 index 0000000000..9953ffb871 --- /dev/null +++ b/sw/source/filter/ww8/rtfsdrexport.cxx @@ -0,0 +1,586 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * Copyright 2010 Miklos Vajna. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "rtfsdrexport.hxx" +#include "rtfexport.hxx" +#include "writerhelper.hxx" + +#include <com/sun/star/i18n/ScriptType.hdl> +#include <osl/diagnose.h> +#include <rtl/strbuf.hxx> +#include <rtl/ustring.hxx> +#include <svl/itemiter.hxx> +#include <svtools/rtfkeywd.hxx> +#include <editeng/editdata.hxx> +#include <editeng/editobj.hxx> +#include <editeng/flditem.hxx> +#include <editeng/fontitem.hxx> +#include <svx/svdotext.hxx> +#include <tools/stream.hxx> +#include <breakit.hxx> + +using rtl::OString; +using rtl::OStringBuffer; +using rtl::OUString; +using rtl::OUStringBuffer; +using namespace sw::util; + +/// Implementation of an empty stream that silently succeeds, but does nothing. +/// +/// In fact, this is a hack. The right solution is to abstract EscherEx to be +/// able to work without SvStream; but at the moment it is better to live with +/// this I guess. +class SvNullStream : public SvStream +{ +protected: + virtual sal_Size GetData( void* pData, sal_Size nSize ) { memset( pData, 0, nSize ); return nSize; } + virtual sal_Size PutData( const void*, sal_Size nSize ) { return nSize; } + virtual sal_Size SeekPos( sal_Size nPos ) { return nPos; } + virtual void SetSize( sal_Size ) {} + virtual void FlushData() {} + +public: + SvNullStream() : SvStream() {} + virtual ~SvNullStream() {} +}; + +RtfSdrExport::RtfSdrExport( RtfExport &rExport ) + : EscherEx( EscherExGlobalRef( new EscherExGlobal ), *( new SvNullStream )), + m_rExport( rExport ), + m_rAttrOutput( (RtfAttributeOutput&)m_rExport.AttrOutput() ), + m_nShapeType( ESCHER_ShpInst_Nil ), + m_pShapeStyle( new OStringBuffer( 200 ) ), + m_pShapeTypeWritten( new bool[ ESCHER_ShpInst_COUNT ] ) +{ + mnGroupLevel = 1; + memset( m_pShapeTypeWritten, 0, ESCHER_ShpInst_COUNT * sizeof( bool ) ); +} + +RtfSdrExport::~RtfSdrExport() +{ + delete mpOutStrm, mpOutStrm = NULL; + delete m_pShapeStyle, m_pShapeStyle = NULL; + delete[] m_pShapeTypeWritten, m_pShapeTypeWritten = NULL; +} + +void RtfSdrExport::OpenContainer( UINT16 nEscherContainer, int nRecInstance ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + EscherEx::OpenContainer( nEscherContainer, nRecInstance ); + + if ( nEscherContainer == ESCHER_SpContainer ) + { + m_nShapeType = ESCHER_ShpInst_Nil; + if ( m_pShapeStyle->getLength() ) + m_pShapeStyle->makeStringAndClear(); + m_pShapeStyle->ensureCapacity( 200 ); + m_aShapeProps.clear(); + } +} + +void RtfSdrExport::CloseContainer() +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + if ( mRecTypes.back() == ESCHER_SpContainer ) + { + // write the shape now when we have all the info + sal_Int32 nShapeElement = StartShape(); + EndShape( nShapeElement ); + + // cleanup + m_nShapeType = ESCHER_ShpInst_Nil; + } + + EscherEx::CloseContainer(); +} + +UINT32 RtfSdrExport::EnterGroup( const String& /*rShapeName*/, const Rectangle* /*pRect*/ ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + return GenerateShapeId(); +} + +void RtfSdrExport::LeaveGroup() +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + /* noop */ +} + +void RtfSdrExport::AddShape( UINT32 nShapeType, UINT32 nShapeFlags, UINT32 /*nShapeId*/ ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + m_nShapeType = nShapeType; + m_nShapeFlags = nShapeFlags; +} + +inline sal_uInt16 impl_GetUInt16( const sal_uInt8* &pVal ) +{ + sal_uInt16 nRet = *pVal++; + nRet += ( *pVal++ ) << 8; + return nRet; +} + +inline sal_Int32 impl_GetPointComponent( const sal_uInt8* &pVal, sal_uInt16 nPointSize ) +{ + sal_Int32 nRet = 0; + if ( ( nPointSize == 0xfff0 ) || ( nPointSize == 4 ) ) + { + sal_uInt16 nUnsigned = *pVal++; + nUnsigned += ( *pVal++ ) << 8; + + nRet = sal_Int16( nUnsigned ); + } + else if ( nPointSize == 8 ) + { + sal_uInt32 nUnsigned = *pVal++; + nUnsigned += ( *pVal++ ) << 8; + nUnsigned += ( *pVal++ ) << 16; + nUnsigned += ( *pVal++ ) << 24; + + nRet = nUnsigned; + } + + return nRet; +} + +void RtfSdrExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + if ( m_nShapeType == ESCHER_ShpInst_Nil ) + return; + + if ( m_nShapeType == ESCHER_ShpInst_Line ) + AddLineDimensions( rRect ); + else + AddRectangleDimensions( *m_pShapeStyle, rRect ); + + // properties + const EscherProperties &rOpts = rProps.GetOpts(); + for ( EscherProperties::const_iterator it = rOpts.begin(); it != rOpts.end(); ++it ) + { + sal_uInt16 nId = ( it->nPropId & 0x0FFF ); + + switch ( nId ) + { + case ESCHER_Prop_WrapText: + { + int nWrapType = 0; + switch ( it->nPropValue ) + { + case ESCHER_WrapSquare: nWrapType = 2; break; + case ESCHER_WrapByPoints: nWrapType = 4; break; + case ESCHER_WrapNone: nWrapType = 3; break; + case ESCHER_WrapTopBottom: nWrapType = 1; break; + case ESCHER_WrapThrough: nWrapType = 5; break; + } + if ( nWrapType ) + m_pShapeStyle->append(OOO_STRING_SVTOOLS_RTF_SHPWR).append((sal_Int32)nWrapType); + } + break; + case ESCHER_Prop_fillColor: + m_aShapeProps.insert(std::pair<OString,OString>(OString("fillColor"), OString::valueOf(sal_Int32(it->nPropValue)))); + break; + case ESCHER_Prop_fillBackColor: + m_aShapeProps.insert(std::pair<OString,OString>(OString("fillBackColor"), OString::valueOf(sal_Int32(it->nPropValue)))); + break; + case ESCHER_Prop_AnchorText: + m_aShapeProps.insert(std::pair<OString,OString>(OString("anchorText"), OString::valueOf(sal_Int32(it->nPropValue)))); + break; + case ESCHER_Prop_fNoFillHitTest: + if (it->nPropValue) + m_aShapeProps.insert(std::pair<OString,OString>(OString("fNoFillHitTest"), OString::valueOf(sal_Int32(1)))); + break; + case ESCHER_Prop_fNoLineDrawDash: + // for some reason the value is set to 0x90000 if lines are switched off + if( it->nPropValue == 0x90000 ) + m_aShapeProps.insert(std::pair<OString,OString>(OString("fLine"), OString::valueOf(sal_Int32(0)))); + break; + case ESCHER_Prop_lineColor: + m_aShapeProps.insert(std::pair<OString,OString>(OString("lineColor"), OString::valueOf(sal_Int32(it->nPropValue)))); + break; + case ESCHER_Prop_lineBackColor: + m_aShapeProps.insert(std::pair<OString,OString>(OString("lineBackColor"), OString::valueOf(sal_Int32(it->nPropValue)))); + break; + case ESCHER_Prop_lineJoinStyle: + m_aShapeProps.insert(std::pair<OString,OString>(OString("lineJoinStyle"), OString::valueOf(sal_Int32(it->nPropValue)))); + break; + case ESCHER_Prop_fshadowObscured: + if (it->nPropValue) + m_aShapeProps.insert(std::pair<OString,OString>(OString("fshadowObscured"), OString::valueOf(sal_Int32(1)))); + break; + case ESCHER_Prop_geoLeft: + case ESCHER_Prop_geoTop: + { + sal_uInt32 nLeft = 0, nTop = 0; + + if ( nId == ESCHER_Prop_geoLeft ) + { + nLeft = it->nPropValue; + rProps.GetOpt( ESCHER_Prop_geoTop, nTop ); + } + else + { + nTop = it->nPropValue; + rProps.GetOpt( ESCHER_Prop_geoLeft, nLeft ); + } + + m_aShapeProps.insert(std::pair<OString,OString>(OString("geoLeft"), + OString::valueOf(sal_Int32(sal_Int32( nLeft ))))); + m_aShapeProps.insert(std::pair<OString,OString>(OString("geoTop"), + OString::valueOf(sal_Int32(sal_Int32( nTop ))))); + } + break; + + case ESCHER_Prop_geoRight: + case ESCHER_Prop_geoBottom: + { + sal_uInt32 nLeft = 0, nRight = 0, nTop = 0, nBottom = 0; + rProps.GetOpt( ESCHER_Prop_geoLeft, nLeft ); + rProps.GetOpt( ESCHER_Prop_geoTop, nTop ); + + if ( nId == ESCHER_Prop_geoRight ) + { + nRight = it->nPropValue; + rProps.GetOpt( ESCHER_Prop_geoBottom, nBottom ); + } + else + { + nBottom = it->nPropValue; + rProps.GetOpt( ESCHER_Prop_geoRight, nRight ); + } + + m_aShapeProps.insert(std::pair<OString,OString>(OString("geoRight"), + OString::valueOf(sal_Int32(sal_Int32( nRight ) - sal_Int32( nLeft ))))); + m_aShapeProps.insert(std::pair<OString,OString>(OString("geoBottom"), + OString::valueOf(sal_Int32(sal_Int32( nBottom ) - sal_Int32( nTop ))))); + } + break; + case ESCHER_Prop_pVertices: + case ESCHER_Prop_pSegmentInfo: + { + EscherPropSortStruct aVertices; + EscherPropSortStruct aSegments; + + if ( rProps.GetOpt( ESCHER_Prop_pVertices, aVertices ) && + rProps.GetOpt( ESCHER_Prop_pSegmentInfo, aSegments ) ) + { + const sal_uInt8 *pVerticesIt = aVertices.pBuf + 6; + const sal_uInt8 *pSegmentIt = aSegments.pBuf; + + OStringBuffer aSegmentInfo( 512 ); + OStringBuffer aVerticies( 512 ); + + sal_uInt16 nPointSize = aVertices.pBuf[4] + ( aVertices.pBuf[5] << 8 ); + + // number of segments + sal_uInt16 nSegments = impl_GetUInt16( pSegmentIt ); + sal_Int32 nVertices = 0; + aSegmentInfo.append("2;").append((sal_Int32)nSegments); + pSegmentIt += 4; + + for ( ; nSegments; --nSegments ) + { + sal_uInt16 nSeg = impl_GetUInt16( pSegmentIt ); + aSegmentInfo.append(';').append((sal_Int32)nSeg); + switch ( nSeg ) + { + case 0x0001: // lineto + case 0x4000: // moveto + { + sal_Int32 nX = impl_GetPointComponent( pVerticesIt, nPointSize ); + sal_Int32 nY = impl_GetPointComponent( pVerticesIt, nPointSize ); + aVerticies.append( ";(" ).append( nX ).append( "," ).append( nY ).append( ")" ); + nVertices ++; + } + break; + case 0x2001: // curveto + { + for (int i = 0; i < 3; i++) + { + sal_Int32 nX = impl_GetPointComponent( pVerticesIt, nPointSize ); + sal_Int32 nY = impl_GetPointComponent( pVerticesIt, nPointSize ); + aVerticies.append( ";(" ).append( nX ).append( "," ).append( nY ).append( ")" ); + nVertices ++; + } + } + break; + case 0xb300: + case 0xac00: + case 0xaa00: // nofill + case 0xab00: // nostroke + case 0x6001: // close + case 0x8000: // end + break; + default: + OSL_TRACE("%s: unhandled segment '%x' in the path", OSL_THIS_FUNC, nSeg); + break; + } + } + + if (aVerticies.getLength() ) + { + // We know the number of vertices at the end only, so we have to prepend them here. + OStringBuffer aBuf; + aBuf.append("8;").append((sal_Int32)nVertices); + aBuf.append(aVerticies.makeStringAndClear()); + m_aShapeProps.insert(std::pair<OString,OString>(OString("pVerticies"), aBuf.makeStringAndClear())); + } + if ( aSegmentInfo.getLength() ) + m_aShapeProps.insert(std::pair<OString,OString>(OString("pSegmentInfo"), aSegmentInfo.makeStringAndClear())); + } + else + OSL_TRACE("%s: unhandled shape path, missing either pVertices or pSegmentInfo", OSL_THIS_FUNC); + } + break; + case ESCHER_Prop_shapePath: + // noop, we use pSegmentInfo instead + break; + case ESCHER_Prop_fFillOK: + if (!it->nPropValue) + m_aShapeProps.insert(std::pair<OString,OString>(OString("fFillOK"), OString::valueOf(sal_Int32(0)))); + break; + case ESCHER_Prop_dxTextLeft: + m_aShapeProps.insert(std::pair<OString,OString>(OString("dxTextLeft"), OString::valueOf(sal_Int32(it->nPropValue)))); + break; + case ESCHER_Prop_dyTextTop: + m_aShapeProps.insert(std::pair<OString,OString>(OString("dyTextTop"), OString::valueOf(sal_Int32(it->nPropValue)))); + break; + case ESCHER_Prop_dxTextRight: + m_aShapeProps.insert(std::pair<OString,OString>(OString("dxTextRight"), OString::valueOf(sal_Int32(it->nPropValue)))); + break; + case ESCHER_Prop_dyTextBottom: + m_aShapeProps.insert(std::pair<OString,OString>(OString("dyTextBottom"), OString::valueOf(sal_Int32(it->nPropValue)))); + break; + case ESCHER_Prop_FitTextToShape: + // Size text to fit shape size: not supported by RTF + break; + case ESCHER_Prop_adjustValue: + m_aShapeProps.insert(std::pair<OString,OString>(OString("adjustValue"), OString::valueOf(sal_Int32(it->nPropValue)))); + break; + case ESCHER_Prop_txflTextFlow: + m_aShapeProps.insert(std::pair<OString,OString>(OString("txflTextFlow"), OString::valueOf(sal_Int32(it->nPropValue)))); + break; + default: + OSL_TRACE("%s: unhandled property: %d (value: %d)", OSL_THIS_FUNC, nId, it->nPropValue); + break; + } + } +} + +void RtfSdrExport::AddLineDimensions( const Rectangle& rRectangle ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + // We get the position relative to (the current?) character + m_aShapeProps.insert(std::pair<OString,OString>(OString("posrelh"), OString::valueOf(sal_Int32(3)))); + + switch ( m_nShapeFlags & 0xC0 ) + { + case 0x40: + m_aShapeProps.insert(std::pair<OString,OString>(OString("fFlipV"), OString::valueOf(sal_Int32(1)))); + break; + case 0x80: + m_aShapeProps.insert(std::pair<OString,OString>(OString("fFlipH"), OString::valueOf(sal_Int32(1)))); + break; + case 0xC0: + m_aShapeProps.insert(std::pair<OString,OString>(OString("fFlipV"), OString::valueOf(sal_Int32(1)))); + m_aShapeProps.insert(std::pair<OString,OString>(OString("fFlipH"), OString::valueOf(sal_Int32(1)))); + break; + } + + // the actual dimensions + m_pShapeStyle->append(OOO_STRING_SVTOOLS_RTF_SHPLEFT).append(rRectangle.Left()); + m_pShapeStyle->append(OOO_STRING_SVTOOLS_RTF_SHPTOP).append(rRectangle.Top()); + m_pShapeStyle->append(OOO_STRING_SVTOOLS_RTF_SHPRIGHT).append(rRectangle.Right()); + m_pShapeStyle->append(OOO_STRING_SVTOOLS_RTF_SHPBOTTOM).append(rRectangle.Bottom()); +} + +void RtfSdrExport::AddRectangleDimensions( rtl::OStringBuffer& rBuffer, const Rectangle& rRectangle ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + // We get the position relative to (the current?) character + m_aShapeProps.insert(std::pair<OString,OString>(OString("posrelh"), OString::valueOf(sal_Int32(3)))); + + rBuffer.append(OOO_STRING_SVTOOLS_RTF_SHPLEFT).append(rRectangle.Left()); + rBuffer.append(OOO_STRING_SVTOOLS_RTF_SHPTOP).append(rRectangle.Top()); + rBuffer.append(OOO_STRING_SVTOOLS_RTF_SHPRIGHT).append(rRectangle.Right()); + rBuffer.append(OOO_STRING_SVTOOLS_RTF_SHPBOTTOM).append(rRectangle.Bottom()); +} + +void RtfSdrExport::AddShapeAttribute( sal_Int32 /*nAttribute*/, const rtl::OString& /*rValue*/ ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + /* noop */ +} + +extern const char* pShapeTypes[]; + +void lcl_AppendSP( ::rtl::OStringBuffer& rRunText, const char cName[], const ::rtl::OString& rValue) +{ + rRunText.append('{').append(OOO_STRING_SVTOOLS_RTF_SP) + .append('{').append(OOO_STRING_SVTOOLS_RTF_SN " ").append(cName).append('}') + .append('{').append(OOO_STRING_SVTOOLS_RTF_SV " ").append(rValue).append('}') + .append('}'); +} +sal_Int32 RtfSdrExport::StartShape() +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + if ( m_nShapeType == ESCHER_ShpInst_Nil ) + return -1; + + m_aShapeProps.insert(std::pair<OString,OString>(OString("shapeType"), OString::valueOf(sal_Int32(m_nShapeType)))); + + m_rAttrOutput.RunText().append('{').append(OOO_STRING_SVTOOLS_RTF_SHP); + m_rAttrOutput.RunText().append('{').append(OOO_STRING_SVTOOLS_RTF_IGNORE).append(OOO_STRING_SVTOOLS_RTF_SHPINST); + + m_rAttrOutput.RunText().append(m_pShapeStyle->makeStringAndClear()); + // Ignore \shpbxpage, \shpbxmargin, and \shpbxcolumn, in favor of the posrelh property. + m_rAttrOutput.RunText().append(OOO_STRING_SVTOOLS_RTF_SHPBXIGNORE); + // Ignore \shpbypage, \shpbymargin, and \shpbycolumn, in favor of the posrelh property. + m_rAttrOutput.RunText().append(OOO_STRING_SVTOOLS_RTF_SHPBYIGNORE); + + for(std::map<OString,OString>::reverse_iterator i = m_aShapeProps.rbegin(); i != m_aShapeProps.rend(); i++) + lcl_AppendSP(m_rAttrOutput.RunText(), (*i).first, (*i).second ); + + lcl_AppendSP(m_rAttrOutput.RunText(), "wzDescription", RtfExport::OutString( m_pSdrObject->GetDescription(), m_rExport.eCurrentEncoding)); + lcl_AppendSP(m_rAttrOutput.RunText(), "wzName", RtfExport::OutString( m_pSdrObject->GetTitle(), m_rExport.eCurrentEncoding)); + + // now check if we have some text + const SdrTextObj* pTxtObj = PTR_CAST(SdrTextObj, m_pSdrObject); + if (pTxtObj) + { + const OutlinerParaObject* pParaObj = 0; + bool bOwnParaObj = false; + + /* + #i13885# + When the object is actively being edited, that text is not set into + the objects normal text object, but lives in a seperate object. + */ + if (pTxtObj->IsTextEditActive()) + { + pParaObj = pTxtObj->GetEditOutlinerParaObject(); + bOwnParaObj = true; + } + else + { + pParaObj = pTxtObj->GetOutlinerParaObject(); + } + + if( pParaObj ) + { + // this is reached only in case some text is attached to the shape + WriteOutliner(*pParaObj); + if( bOwnParaObj ) + delete pParaObj; + } + } + + return m_nShapeType; +} + +void RtfSdrExport::WriteOutliner(const OutlinerParaObject& rParaObj) +{ + OSL_TRACE("%s start", OSL_THIS_FUNC); + + const EditTextObject& rEditObj = rParaObj.GetTextObject(); + MSWord_SdrAttrIter aAttrIter( m_rExport, rEditObj, TXT_HFTXTBOX ); + + USHORT nPara = rEditObj.GetParagraphCount(); + + m_rAttrOutput.RunText().append('{').append(OOO_STRING_SVTOOLS_RTF_SHPTXT).append(' '); + for (USHORT n = 0; n < nPara; ++n) + { + if( n ) + aAttrIter.NextPara( n ); + + rtl_TextEncoding eChrSet = aAttrIter.GetNodeCharSet(); + + String aStr( rEditObj.GetText( n )); + xub_StrLen nAktPos = 0; + xub_StrLen nEnd = aStr.Len(); + + aAttrIter.OutParaAttr(false); + m_rAttrOutput.RunText().append(m_rAttrOutput.Styles().makeStringAndClear()); + + do { + xub_StrLen nNextAttr = aAttrIter.WhereNext(); + rtl_TextEncoding eNextChrSet = aAttrIter.GetNextCharSet(); + + if( nNextAttr > nEnd ) + nNextAttr = nEnd; + + aAttrIter.OutAttr( nAktPos ); + m_rAttrOutput.RunText().append('{').append(m_rAttrOutput.Styles().makeStringAndClear()).append(m_rExport.sNewLine); + bool bTxtAtr = aAttrIter.IsTxtAttr( nAktPos ); + if( !bTxtAtr ) + { + String aOut( aStr.Copy( nAktPos, nNextAttr - nAktPos ) ); + m_rAttrOutput.RunText().append( m_rExport.OutString( aOut, eChrSet ) ); + } + + m_rAttrOutput.RunText().append('}'); + + nAktPos = nNextAttr; + eChrSet = eNextChrSet; + aAttrIter.NextPos(); + } + while( nAktPos < nEnd ); + } + m_rAttrOutput.RunText().append(OOO_STRING_SVTOOLS_RTF_PAR).append('}'); + + OSL_TRACE("%s end", OSL_THIS_FUNC); +} + +void RtfSdrExport::EndShape( sal_Int32 nShapeElement ) +{ + OSL_TRACE("%s", OSL_THIS_FUNC); + + if ( nShapeElement >= 0 ) + { + // end of the shape + m_rAttrOutput.RunText().append('}').append('}'); + } +} + +UINT32 RtfSdrExport::AddSdrObject( const SdrObject& rObj ) +{ + m_pSdrObject = &rObj; + return EscherEx::AddSdrObject(rObj); +} + +/* vi:set shiftwidth=4 expandtab: */ diff --git a/sw/source/filter/ww8/rtfsdrexport.hxx b/sw/source/filter/ww8/rtfsdrexport.hxx new file mode 100644 index 0000000000..775e348eef --- /dev/null +++ b/sw/source/filter/ww8/rtfsdrexport.hxx @@ -0,0 +1,115 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * Copyright 2010 Miklos Vajna. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _RTFSdrEXPORT_HXX_ +#define _RTFSdrEXPORT_HXX_ + +#include <filter/msfilter/escherex.hxx> +#include <editeng/outlobj.hxx> +#include <rtl/strbuf.hxx> + +#include <map> + +class RtfExport; +class RtfAttributeOutput; + +class RtfSdrExport : public EscherEx +{ + RtfExport &m_rExport; + + RtfAttributeOutput &m_rAttrOutput; + + const SdrObject* m_pSdrObject; + + /// Remember the shape type. + sal_uInt32 m_nShapeType; + + /// Remember the shape flags. + sal_uInt32 m_nShapeFlags; + + /// Remember style, the most important shape attribute ;-) + rtl::OStringBuffer *m_pShapeStyle; + + std::map<rtl::OString,rtl::OString> m_aShapeProps; + + /// Remember which shape types we had already written. + bool *m_pShapeTypeWritten; + +public: + RtfSdrExport( RtfExport &rExport ); + virtual ~RtfSdrExport(); + + /// Export the sdr object as Sdr. + /// + /// Call this when you need to export the object as Sdr in RTF. + UINT32 AddSdrObject( const SdrObject& rObj ); + +protected: + /// Add an attribute to the generated shape element. + /// + /// This should be called from within StartShape() to ensure that the + /// added attribute is preserved. + void AddShapeAttribute( sal_Int32 nAttribute, const rtl::OString& sValue ); + + /// Start the shape for which we just collected the information. + /// + /// Returns the element's tag number, -1 means we wrote nothing. + using EscherEx::StartShape; + virtual sal_Int32 StartShape(); + + /// End the shape. + /// + /// The parameter is just what we got from StartShape(). + using EscherEx::EndShape; + virtual void EndShape( sal_Int32 nShapeElement ); + + virtual void Commit( EscherPropertyContainer& rProps, const Rectangle& rRect ); + +private: + + virtual void OpenContainer( UINT16 nEscherContainer, int nRecInstance = 0 ); + virtual void CloseContainer(); + + using EscherEx::EnterGroup; + virtual UINT32 EnterGroup( const String& rShapeName, const Rectangle* pBoundRect = 0 ); + virtual void LeaveGroup(); + + virtual void AddShape( UINT32 nShapeType, UINT32 nShapeFlags, UINT32 nShapeId = 0 ); + +private: + /// Add starting and ending point of a line to the m_pShapeAttrList. + void AddLineDimensions( const Rectangle& rRectangle ); + + /// Add position and size to the OStringBuffer. + void AddRectangleDimensions( rtl::OStringBuffer& rBuffer, const Rectangle& rRectangle ); + + void WriteOutliner(const OutlinerParaObject& rParaObj); +}; + +#endif // _RTFSdrEXPORT_HXX_ +/* vi:set shiftwidth=4 expandtab: */ diff --git a/sw/source/filter/ww8/writerhelper.cxx b/sw/source/filter/ww8/writerhelper.cxx index 652d8a4a12..2680ca7690 100644 --- a/sw/source/filter/ww8/writerhelper.cxx +++ b/sw/source/filter/ww8/writerhelper.cxx @@ -466,9 +466,21 @@ namespace sw } //SetLayer boilerplate end - void GetPoolItems(const SfxItemSet &rSet, PoolItems &rItems) + void GetPoolItems(const SfxItemSet &rSet, PoolItems &rItems, bool bExportParentItemSet ) { - if (rSet.Count()) + if( bExportParentItemSet ) + { + USHORT nTotal = rSet.TotalCount(); + for( USHORT nItem =0; nItem < nTotal; ++nItem ) + { + const SfxPoolItem* pItem = 0; + if( SFX_ITEM_SET == rSet.GetItemState( rSet.GetWhichByPos( nItem ), true, &pItem ) ) + { + rItems[pItem->Which()] = pItem; + } + } + } + else if( rSet.Count()) { SfxItemIter aIter(rSet); if (const SfxPoolItem *pItem = aIter.GetCurItem()) diff --git a/sw/source/filter/ww8/writerhelper.hxx b/sw/source/filter/ww8/writerhelper.hxx index 94ea0bf08d..1606d0d0df 100644 --- a/sw/source/filter/ww8/writerhelper.hxx +++ b/sw/source/filter/ww8/writerhelper.hxx @@ -590,7 +590,7 @@ namespace sw @author <a href="mailto:cmc@openoffice.org">Caolán McNamara</a> */ - void GetPoolItems(const SfxItemSet &rSet, PoolItems &rItems); + void GetPoolItems(const SfxItemSet &rSet, PoolItems &rItems, bool bExportParentItemSet ); const SfxPoolItem *SearchPoolItems(const PoolItems &rItems, sal_uInt16 eType); diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index 70f5ab5a89..a573d9a6b7 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -812,49 +812,7 @@ void WW8Export::AppendFlyInFlys(const sw::Frame& rFrmFmt, OutputField(0, ww::eSHAPE, aEmptyStr, WRITEFIELD_CLOSE); } -class WW8_SdrAttrIter : public MSWordAttrIter -{ -private: - const EditTextObject* pEditObj; - const SfxItemPool* pEditPool; - EECharAttribArray aTxtAtrArr; - SvPtrarr aChrTxtAtrArr; - SvUShorts aChrSetArr; - USHORT nPara; - xub_StrLen nAktSwPos; - xub_StrLen nTmpSwPos; // fuer HasItem() - rtl_TextEncoding eNdChrSet; - USHORT nScript; - BYTE mnTyp; - - xub_StrLen SearchNext( xub_StrLen nStartPos ); - void SetCharSet(const EECharAttrib& rTxtAttr, bool bStart); - - //No copying - WW8_SdrAttrIter(const WW8_SdrAttrIter&); - WW8_SdrAttrIter& operator=(const WW8_SdrAttrIter&); -public: - WW8_SdrAttrIter( WW8Export& rWr, const EditTextObject& rEditObj, - BYTE nType ); - void NextPara( USHORT nPar ); - void OutParaAttr(bool bCharAttr); - void OutEEField(const SfxPoolItem& rHt); - - bool IsTxtAttr(xub_StrLen nSwPos); - - void NextPos() { nAktSwPos = SearchNext( nAktSwPos + 1 ); } - - void OutAttr( xub_StrLen nSwPos ); - virtual const SfxPoolItem* HasTextItem( USHORT nWhich ) const; - virtual const SfxPoolItem& GetItem( USHORT nWhich ) const; - bool OutAttrWithRange(xub_StrLen nPos); - xub_StrLen WhereNext() const { return nAktSwPos; } - rtl_TextEncoding GetNextCharSet() const; - rtl_TextEncoding GetNodeCharSet() const { return eNdChrSet; } -}; - - -WW8_SdrAttrIter::WW8_SdrAttrIter( WW8Export& rWr, +MSWord_SdrAttrIter::MSWord_SdrAttrIter( MSWordExportBase& rWr, const EditTextObject& rEditObj, BYTE nTyp ) : MSWordAttrIter( rWr ), pEditObj(&rEditObj), pEditPool(0), aTxtAtrArr( 0, 4 ), aChrTxtAtrArr( 0, 4 ), aChrSetArr( 0, 4 ), @@ -863,7 +821,7 @@ WW8_SdrAttrIter::WW8_SdrAttrIter( WW8Export& rWr, NextPara( 0 ); } -void WW8_SdrAttrIter::NextPara( USHORT nPar ) +void MSWord_SdrAttrIter::NextPara( USHORT nPar ) { nPara = nPar; // Attributwechsel an Pos 0 wird ignoriert, da davon ausgegangen @@ -886,7 +844,7 @@ void WW8_SdrAttrIter::NextPara( USHORT nPar ) nAktSwPos = SearchNext( 1 ); } -rtl_TextEncoding WW8_SdrAttrIter::GetNextCharSet() const +rtl_TextEncoding MSWord_SdrAttrIter::GetNextCharSet() const { if( aChrSetArr.Count() ) return (rtl_TextEncoding)aChrSetArr[ aChrSetArr.Count() - 1 ]; @@ -894,7 +852,7 @@ rtl_TextEncoding WW8_SdrAttrIter::GetNextCharSet() const } // der erste Parameter in SearchNext() liefert zurueck, ob es ein TxtAtr ist. -xub_StrLen WW8_SdrAttrIter::SearchNext( xub_StrLen nStartPos ) +xub_StrLen MSWord_SdrAttrIter::SearchNext( xub_StrLen nStartPos ) { xub_StrLen nPos; xub_StrLen nMinPos = STRING_MAXLEN; @@ -933,7 +891,7 @@ xub_StrLen WW8_SdrAttrIter::SearchNext( xub_StrLen nStartPos ) return nMinPos; } -void WW8_SdrAttrIter::SetCharSet(const EECharAttrib& rAttr, bool bStart) +void MSWord_SdrAttrIter::SetCharSet(const EECharAttrib& rAttr, bool bStart) { void* p = 0; rtl_TextEncoding eChrSet; @@ -963,7 +921,7 @@ void WW8_SdrAttrIter::SetCharSet(const EECharAttrib& rAttr, bool bStart) } } -void WW8_SdrAttrIter::OutEEField(const SfxPoolItem& rHt) +void MSWord_SdrAttrIter::OutEEField(const SfxPoolItem& rHt) { const SvxFieldItem &rField = (const SvxFieldItem &)rHt; const SvxFieldData *pFld = rField.GetField(); @@ -982,7 +940,7 @@ void WW8_SdrAttrIter::OutEEField(const SfxPoolItem& rHt) } } -void WW8_SdrAttrIter::OutAttr( xub_StrLen nSwPos ) +void MSWord_SdrAttrIter::OutAttr( xub_StrLen nSwPos ) { OutParaAttr(true); @@ -1039,7 +997,7 @@ void WW8_SdrAttrIter::OutAttr( xub_StrLen nSwPos ) } } -bool WW8_SdrAttrIter::IsTxtAttr(xub_StrLen nSwPos) +bool MSWord_SdrAttrIter::IsTxtAttr(xub_StrLen nSwPos) { for (USHORT i = 0; i < aTxtAtrArr.Count(); ++i) { @@ -1064,7 +1022,7 @@ bool WW8_SdrAttrIter::IsTxtAttr(xub_StrLen nSwPos) // Attribut-Anfangposition fragen kann. // Es koennen nur Attribute mit Ende abgefragt werden. // Es wird mit bDeep gesucht -const SfxPoolItem* WW8_SdrAttrIter::HasTextItem(USHORT nWhich) const +const SfxPoolItem* MSWord_SdrAttrIter::HasTextItem(USHORT nWhich) const { const SfxPoolItem* pRet = 0; nWhich = sw::hack::TransformWhichBetweenPools(*pEditPool, @@ -1089,7 +1047,7 @@ const SfxPoolItem* WW8_SdrAttrIter::HasTextItem(USHORT nWhich) const return pRet; } -const SfxPoolItem& WW8_SdrAttrIter::GetItem( USHORT nWhich ) const +const SfxPoolItem& MSWord_SdrAttrIter::GetItem( USHORT nWhich ) const { using sw::hack::GetSetWhichFromSwDocWhich; const SfxPoolItem* pRet = HasTextItem(nWhich); @@ -1103,7 +1061,7 @@ const SfxPoolItem& WW8_SdrAttrIter::GetItem( USHORT nWhich ) const return *pRet; } -void WW8_SdrAttrIter::OutParaAttr(bool bCharAttr) +void MSWord_SdrAttrIter::OutParaAttr(bool bCharAttr) { SfxItemSet aSet( pEditObj->GetParaAttribs( nPara )); if( aSet.Count() ) @@ -1176,7 +1134,7 @@ void WW8Export::WriteOutliner(const OutlinerParaObject& rParaObj, BYTE nTyp) { bool bAnyWrite = false; const EditTextObject& rEditObj = rParaObj.GetTextObject(); - WW8_SdrAttrIter aAttrIter( *this, rEditObj, nTyp ); + MSWord_SdrAttrIter aAttrIter( *this, rEditObj, nTyp ); USHORT nPara = rEditObj.GetParagraphCount(); BYTE bNul = 0; diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index d22decdf9a..8099c3037f 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -540,7 +540,7 @@ void SwAttrIter::OutAttr( xub_StrLen nSwPos ) ClearOverridesFromSet( *pCharFmtItem, aExportSet ); sw::PoolItems aExportItems; - GetPoolItems( aExportSet, aExportItems ); + GetPoolItems( aExportSet, aExportItems, false ); sw::cPoolItemIter aEnd = aRangeItems.end(); for ( sw::cPoolItemIter aI = aRangeItems.begin(); aI != aEnd; ++aI ) @@ -1646,14 +1646,136 @@ void WW8AttributeOutput::FormatDrop( const SwTxtNode& rNode, const SwFmtDrop &rS m_rWW8Export.pO->Remove( 0, m_rWW8Export.pO->Count() ); } -xub_StrLen MSWordExportBase::GetNextPos( SwAttrIter* aAttrIter, const SwTxtNode& /*rNode*/, xub_StrLen /*nAktPos*/ ) +xub_StrLen MSWordExportBase::GetNextPos( SwAttrIter* aAttrIter, const SwTxtNode& rNode, xub_StrLen nAktPos ) { - return aAttrIter->WhereNext(); + // Get the bookmarks for the normal run + xub_StrLen nNextPos = aAttrIter->WhereNext(); + + GetSortedBookmarks( rNode, nAktPos, nNextPos - nAktPos ); + + xub_StrLen nNextBookmark = nNextPos; + NearestBookmark( nNextPos, nAktPos, false ); + + return std::min( nNextPos, nNextBookmark ); +} + +void MSWordExportBase::UpdatePosition( SwAttrIter* aAttrIter, xub_StrLen nAktPos, xub_StrLen /*nEnd*/ ) +{ + xub_StrLen nNextPos; + + // go to next attribute if no bookmark is found of if the bookmark is behind the next attribute position + bool bNextBookmark = NearestBookmark( nNextPos, nAktPos, true ); + if( !bNextBookmark || nNextPos < aAttrIter->WhereNext() ) + aAttrIter->NextPos(); +} + +bool MSWordExportBase::GetBookmarks( const SwTxtNode& rNd, xub_StrLen nStt, + xub_StrLen nEnd, IMarkVector& rArr ) +{ + IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess(); + ULONG nNd = rNd.GetIndex( ); + + const sal_Int32 nMarks = pMarkAccess->getMarksCount(); + for ( sal_Int32 i = 0; i < nMarks; i++ ) + { + IMark* pMark = ( pMarkAccess->getMarksBegin() + i )->get(); + + // Only keep the bookmarks starting or ending in this node + if ( pMark->GetMarkStart().nNode == nNd || + pMark->GetMarkEnd().nNode == nNd ) + { + xub_StrLen nBStart = pMark->GetMarkStart().nContent.GetIndex(); + xub_StrLen nBEnd = pMark->GetMarkEnd().nContent.GetIndex(); + + // Keep only the bookmars starting or ending in the snippet + bool bIsStartOk = ( nBStart >= nStt ) && ( nBStart <= nEnd ); + bool bIsEndOk = ( nBEnd >= nStt ) && ( nBEnd <= nEnd ); + + if ( bIsStartOk || bIsEndOk ) + rArr.push_back( pMark ); + } + } + return ( rArr.size() > 0 ); } -void MSWordExportBase::UpdatePosition( SwAttrIter* aAttrIter, xub_StrLen /*nAktPos*/, xub_StrLen /*nEnd*/ ) +class CompareMarksEnd : public std::binary_function < const IMark *, const IMark *, bool > { - aAttrIter->NextPos(); +public: + inline bool operator() ( const IMark * pOneB, const IMark * pTwoB ) const + { + xub_StrLen nOEnd = pOneB->GetMarkEnd().nContent.GetIndex(); + xub_StrLen nTEnd = pTwoB->GetMarkEnd().nContent.GetIndex(); + + return nOEnd < nTEnd; + } +}; + +bool MSWordExportBase::NearestBookmark( xub_StrLen& rNearest, const xub_StrLen nAktPos, bool bNextPositionOnly ) +{ + bool bHasBookmark = false; + + if ( m_rSortedMarksStart.size( ) > 0 ) + { + IMark* pMarkStart = m_rSortedMarksStart.front(); + xub_StrLen nNext = pMarkStart->GetMarkStart().nContent.GetIndex(); + if( !bNextPositionOnly || (nNext > nAktPos )) + { + rNearest = nNext; + bHasBookmark = true; + } + } + + if ( m_rSortedMarksEnd.size( ) > 0 ) + { + IMark* pMarkEnd = m_rSortedMarksEnd[0]; + xub_StrLen nNext = pMarkEnd->GetMarkEnd().nContent.GetIndex(); + if( !bNextPositionOnly || nNext > nAktPos ) + { + if ( !bHasBookmark ) + rNearest = nNext; + else + rNearest = std::min( rNearest, nNext ); + bHasBookmark = true; + } + } + + return bHasBookmark; +} + +void MSWordExportBase::GetSortedBookmarks( const SwTxtNode& rNode, xub_StrLen nAktPos, xub_StrLen nLen ) +{ + IMarkVector aMarksStart; + if ( GetBookmarks( rNode, nAktPos, nAktPos + nLen, aMarksStart ) ) + { + IMarkVector aSortedEnd; + IMarkVector aSortedStart; + for ( IMarkVector::const_iterator it = aMarksStart.begin(), end = aMarksStart.end(); + it < end; ++it ) + { + IMark* pMark = (*it); + + // Remove the positions egals to the current pos + xub_StrLen nStart = pMark->GetMarkStart().nContent.GetIndex(); + xub_StrLen nEnd = pMark->GetMarkEnd().nContent.GetIndex(); + + if ( nStart > nAktPos && ( pMark->GetMarkStart().nNode == rNode.GetIndex()) ) + aSortedStart.push_back( pMark ); + + if ( nEnd > nAktPos && nEnd <= ( nAktPos + nLen ) && (pMark->GetMarkEnd().nNode == rNode.GetIndex()) ) + aSortedEnd.push_back( pMark ); + } + + // Sort the bookmarks by end position + std::sort( aSortedEnd.begin(), aSortedEnd.end(), CompareMarksEnd() ); + + m_rSortedMarksStart.swap( aSortedStart ); + m_rSortedMarksEnd.swap( aSortedEnd ); + } + else + { + m_rSortedMarksStart.clear( ); + m_rSortedMarksEnd.clear( ); + } } void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode ) @@ -2188,7 +2310,7 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode ) pOutFmtNode = &rNode; // Pap-Attrs, so script is not necessary - OutputItemSet( *pNewSet, true, false, i18n::ScriptType::LATIN); + OutputItemSet( *pNewSet, true, false, i18n::ScriptType::LATIN, false); pStyAttr = 0; pOutFmtNode = pOldMod; diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx index 2ed01f48a8..0fc020a84b 100644 --- a/sw/source/filter/ww8/wrtw8num.cxx +++ b/sw/source/filter/ww8/wrtw8num.cxx @@ -268,7 +268,7 @@ void WW8AttributeOutput::NumberingLevel( BYTE /*nLevel*/, m_rWW8Export.InsUInt16( nFontID ); } - m_rWW8Export.OutputItemSet( *pOutSet, false, true, i18n::ScriptType::LATIN ); + m_rWW8Export.OutputItemSet( *pOutSet, false, true, i18n::ScriptType::LATIN, m_rWW8Export.mbExportModeRTF ); m_rWW8Export.pO = pOldpO; } @@ -721,6 +721,9 @@ void MSWordExportBase::SubstituteBullet( String& rNumStr, StarSymbolToMSMultiFont *pConvert = 0; FontFamily eFamily = FAMILY_DECORATIVE; + if (!bSubstituteBullets) + return; + if (!pConvert) { pConvert = CreateStarSymbolToMSMultiFont(); diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index 651c09e0ae..0d995f7266 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -79,6 +79,7 @@ #include "ww8par.hxx" #include "ww8attributeoutput.hxx" #include "docxattributeoutput.hxx" +#include "rtfattributeoutput.hxx" using namespace sw::util; using namespace nsHdFtFlags; @@ -713,6 +714,17 @@ void wwFont::WriteDocx( const DocxAttributeOutput* rAttrOutput ) const } #endif +void wwFont::WriteRtf( const RtfAttributeOutput* rAttrOutput ) const +{ + rAttrOutput->FontFamilyType( meFamily, *this ); + rAttrOutput->FontPitchType( mePitch ); + rAttrOutput->FontCharset( sw::ms::rtl_TextEncodingToWinCharset( meChrSet ) ); + rAttrOutput->StartFont( msFamilyNm ); + if ( mbAlt ) + rAttrOutput->FontAlternateName( msAltNm ); + rAttrOutput->EndFont(); +} + bool operator<(const wwFont &r1, const wwFont &r2) { int nRet = memcmp(r1.maWW8_FFN, r2.maWW8_FFN, sizeof(r1.maWW8_FFN)); @@ -765,6 +777,24 @@ void wwFontHelper::InitFontTable(bool bWrtWW8,const SwDoc& rDoc) GetId(wwFont(pFont->GetFamilyName(), pFont->GetPitch(), pFont->GetFamily(), pFont->GetCharSet(),bWrtWW8)); } + + if (!bLoadAllFonts) + return; + + const USHORT aTypes[] = { RES_CHRATR_FONT, RES_CHRATR_CJK_FONT, RES_CHRATR_CTL_FONT, 0 }; + for (const USHORT* pId = aTypes; *pId; ++pId) + { + sal_uInt32 const nMaxItem = rPool.GetItemCount2( *pId ); + for (sal_uInt32 nGet = 0; nGet < nMaxItem; ++nGet) + { + pFont = (const SvxFontItem*)rPool.GetItem2( *pId, nGet ); + if (0 != pFont) + { + GetId(wwFont(pFont->GetFamilyName(), pFont->GetPitch(), + pFont->GetFamily(), pFont->GetCharSet(),bWrtWW8)); + } + } + } } USHORT wwFontHelper::GetId(const Font& rFont) @@ -839,6 +869,14 @@ void wwFontHelper::WriteFontTable( const DocxAttributeOutput& rAttrOutput ) } #endif +void wwFontHelper::WriteFontTable( const RtfAttributeOutput& rAttrOutput ) +{ + ::std::vector<const wwFont *> aFontList( AsVector() ); + + ::std::for_each( aFontList.begin(), aFontList.end(), + ::std::bind2nd( ::std::mem_fun( &wwFont::WriteRtf ), &rAttrOutput ) ); +} + /* */ WW8_WrPlc0::WW8_WrPlc0( ULONG nOffset ) diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 5fabb02e21..df03d35eb0 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -112,6 +112,8 @@ #include "dbgoutsw.hxx" #include <sfx2/docfile.hxx> +#include <sfx2/request.hxx> +#include <sfx2/frame.hxx> #include <svl/stritem.hxx> #include <unotools/tempfile.hxx> #include <filter/msfilter/mscodec.hxx> @@ -2995,20 +2997,54 @@ void MSWordExportBase::ExportDocument( bool bWriteAll ) pDoc->SetRedlineMode( (RedlineMode_t)(mnRedlineMode) ); } -String SwWW8Writer::GetPassword() +bool SwWW8Writer::InitStd97CodecUpdateMedium( ::msfilter::MSCodec_Std97& rCodec ) { - String sUniPassword; + uno::Sequence< beans::NamedValue > aEncryptionData; + if ( mpMedium ) { - SfxItemSet* pSet = mpMedium->GetItemSet(); + SFX_ITEMSET_ARG( mpMedium->GetItemSet(), pEncryptionDataItem, SfxUnoAnyItem, SID_ENCRYPTIONDATA, sal_False ); + if ( pEncryptionDataItem && ( pEncryptionDataItem->GetValue() >>= aEncryptionData ) && !rCodec.InitCodec( aEncryptionData ) ) + { + OSL_ENSURE( false, "Unexpected EncryptionData!" ); + aEncryptionData.realloc( 0 ); + } + + if ( !aEncryptionData.getLength() ) + { + // try to generate the encryption data based on password + SFX_ITEMSET_ARG( mpMedium->GetItemSet(), pPasswordItem, SfxStringItem, SID_PASSWORD, sal_False ); + if ( pPasswordItem && pPasswordItem->GetValue().Len() && pPasswordItem->GetValue().Len() <= 15 ) + { + // Generate random number with a seed of time as salt. + TimeValue aTime; + osl_getSystemTime( &aTime ); + rtlRandomPool aRandomPool = rtl_random_createPool (); + rtl_random_addBytes ( aRandomPool, &aTime, 8 ); - const SfxPoolItem* pPasswordItem = NULL; - if ( pSet && SFX_ITEM_SET == pSet->GetItemState( SID_PASSWORD, sal_True, &pPasswordItem ) ) - if( pPasswordItem != NULL ) - sUniPassword = ( (const SfxStringItem*)pPasswordItem )->GetValue(); + sal_uInt8 pDocId[ 16 ]; + rtl_random_getBytes( aRandomPool, pDocId, 16 ); + + rtl_random_destroyPool( aRandomPool ); + + sal_Unicode aPassword[16]; + memset( aPassword, 0, sizeof( aPassword ) ); + for ( xub_StrLen nChar = 0; nChar < pPasswordItem->GetValue().Len(); ++nChar ) + aPassword[nChar] = pPasswordItem->GetValue().GetChar(nChar); + + rCodec.InitKey( aPassword, pDocId ); + aEncryptionData = rCodec.GetEncryptionData(); + + mpMedium->GetItemSet()->Put( SfxUnoAnyItem( SID_ENCRYPTIONDATA, uno::makeAny( aEncryptionData ) ) ); + } + } + + if ( aEncryptionData.getLength() ) + mpMedium->GetItemSet()->ClearItem( SID_PASSWORD ); } - return sUniPassword; + // nonempty encryption data means hier that the codec was successfuly initialized + return ( aEncryptionData.getLength() != 0 ); } void WW8Export::ExportDocument_Impl() @@ -3042,8 +3078,6 @@ void WW8Export::ExportDocument_Impl() Strm().SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN ); - String sUniPassword( GetWriter().GetPassword() ); - utl::TempFile aTempMain; aTempMain.EnableKillingFile(); utl::TempFile aTempTable; @@ -3051,13 +3085,10 @@ void WW8Export::ExportDocument_Impl() utl::TempFile aTempData; aTempData.EnableKillingFile(); - bool bEncrypt = false; - - xub_StrLen nLen = sUniPassword.Len(); - if ( nLen > 0 && nLen <= 15) // Password has been set + msfilter::MSCodec_Std97 aCtx; + bool bEncrypt = m_pWriter ? m_pWriter->InitStd97CodecUpdateMedium( aCtx ) : false; + if ( bEncrypt ) { - bEncrypt =true; - GetWriter().SetStream( aTempMain.GetStream( STREAM_READWRITE | STREAM_SHARE_DENYWRITE ) ); @@ -3121,24 +3152,6 @@ void WW8Export::ExportDocument_Impl() if ( bEncrypt ) { - // Generate random number with a seed of time as salt. - TimeValue aTime; - osl_getSystemTime( &aTime ); - rtlRandomPool aRandomPool = rtl_random_createPool (); - rtl_random_addBytes ( aRandomPool, &aTime, 8 ); - - sal_uInt8 aDocId[ 16 ] = {0}; - rtl_random_getBytes( aRandomPool, aDocId, 16 ); - - rtl_random_destroyPool( aRandomPool ); - - sal_Unicode aPassword[16] = {0}; - for (xub_StrLen nChar = 0; nChar < nLen; ++nChar ) - aPassword[nChar] = sUniPassword.GetChar(nChar); - - msfilter::MSCodec_Std97 aCtx; - aCtx.InitKey(aPassword, aDocId); - SvStream *pStrmTemp, *pTableStrmTemp, *pDataStrmTemp; pStrmTemp = &xWwStrm; pTableStrmTemp = &xTableStrm; @@ -3155,11 +3168,14 @@ void WW8Export::ExportDocument_Impl() sal_uInt32 nEncType = 0x10001; *pTableStrmTemp << nEncType; - sal_uInt8 pSaltData[16] = {0}; - sal_uInt8 pSaltDigest[16] = {0}; - aCtx.GetEncryptKey( aDocId, pSaltData, pSaltDigest ); + sal_uInt8 pDocId[16]; + aCtx.GetDocId( pDocId ); + + sal_uInt8 pSaltData[16]; + sal_uInt8 pSaltDigest[16]; + aCtx.GetEncryptKey( pDocId, pSaltData, pSaltDigest ); - pTableStrmTemp->Write( aDocId, 16 ); + pTableStrmTemp->Write( pDocId, 16 ); pTableStrmTemp->Write( pSaltData, 16 ); pTableStrmTemp->Write( pSaltDigest, 16 ); @@ -3371,7 +3387,8 @@ MSWordExportBase::MSWordExportBase( SwDoc *pDocument, SwPaM *pCurrentPam, SwPaM mpTableInfo(new ww8::WW8TableInfo()), nUniqueList(0), mnHdFtIndex(0), pAktPageDesc(0), pPapPlc(0), pChpPlc(0), pChpIter(0), pStyles( NULL ), - bHasHdr(false), bHasFtr(false), + bHasHdr(false), bHasFtr(false), bSubstituteBullets(true), + mbExportModeRTF( false ), pDoc( pDocument ), pCurPam( pCurrentPam ), pOrigPam( pOriginalPam ) diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index 43211a962e..e397c7420b 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -35,6 +35,7 @@ #define _SVSTDARR_ULONGS #include <svl/svstdarr.hxx> #endif +#include <editeng/editdata.hxx> #include <map> #include <vector> @@ -52,9 +53,15 @@ #include <expfld.hxx> // einige Forward Deklarationen +namespace msfilter +{ + class MSCodec_Std97; +} + class SwAttrIter; class AttributeOutputBase; class DocxAttributeOutput; +class RtfAttributeOutput; class BitmapPalette; class SwEscherEx; class DateTime; @@ -296,6 +303,7 @@ public: #ifdef DOCX void WriteDocx( const DocxAttributeOutput* rAttrOutput ) const; #endif + void WriteRtf( const RtfAttributeOutput* rAttrOutput ) const; rtl::OUString GetFamilyName() const { return rtl::OUString( msFamilyNm ); } friend bool operator < (const wwFont &r1, const wwFont &r2); }; @@ -311,7 +319,7 @@ private: ::std::vector< const wwFont* > AsVector() const; public: - wwFontHelper() : mbWrtWW8(false) {} + wwFontHelper() : mbWrtWW8(false), bLoadAllFonts(false) {} /// rDoc used only to get the initial standard font(s) in use. void InitFontTable(bool bWrtWW8, const SwDoc& rDoc); USHORT GetId(const Font& rFont); @@ -321,6 +329,10 @@ public: #ifdef DOCX void WriteFontTable( const DocxAttributeOutput& rAttrOutput ); #endif + void WriteFontTable( const RtfAttributeOutput& rAttrOutput ); + + /// If true, all fonts are loaded before processing the document. + BYTE bLoadAllFonts: 1; }; class DrawObj @@ -539,6 +551,9 @@ public: BYTE bEndAtTxtEnd : 1; // true: all END at Textend BYTE bHasHdr : 1; BYTE bHasFtr : 1; + BYTE bSubstituteBullets : 1; // true: SubstituteBullet() gets called + + bool mbExportModeRTF; SwDoc *pDoc; SwPaM *pCurPam, *pOrigPam; @@ -546,6 +561,11 @@ public: /// Stack to remember the nesting (see MSWordSaveData for more) ::std::stack< MSWordSaveData > maSaveData; + /// Used to split the runs according to the bookmarks start and ends + typedef std::vector< ::sw::mark::IMark* > IMarkVector; + IMarkVector m_rSortedMarksStart; + IMarkVector m_rSortedMarksEnd; + public: /// The main function to export the document. void ExportDocument( bool bWriteAll ); @@ -584,7 +604,7 @@ public: void AppendWordBookmark( const String& rName ); /// Use OutputItem() on an item set according to the parameters. - void OutputItemSet( const SfxItemSet& rSet, bool bPapFmt, bool bChpFmt, USHORT nScript ); + void OutputItemSet( const SfxItemSet& rSet, bool bPapFmt, bool bChpFmt, USHORT nScript, bool bExportParentItemSet ); short GetDefaultFrameDirection( ) const; @@ -785,6 +805,17 @@ protected: /// One of OutputTextNode(), OutputGrfNode(), or OutputOLENode() void OutputContentNode( const SwCntntNode& ); + /// Find the nearest bookmark from the current position. + /// + /// Returns false when there is no bookmark. + bool NearestBookmark( xub_StrLen& rNearest, const xub_StrLen nAktPos, bool bNextPositionOnly ); + + void GetSortedBookmarks( const SwTxtNode& rNd, xub_StrLen nAktPos, + xub_StrLen nLen ); + + bool GetBookmarks( const SwTxtNode& rNd, xub_StrLen nStt, xub_StrLen nEnd, + IMarkVector& rArr ); + public: MSWordExportBase( SwDoc *pDocument, SwPaM *pCurrentPam, SwPaM *pOriginalPam ); virtual ~MSWordExportBase(); @@ -855,7 +886,7 @@ public: static void WriteString_xstz(SvStream& rStrm, const String& rStr, bool bAddZero); - String GetPassword(); + bool InitStd97CodecUpdateMedium( ::msfilter::MSCodec_Std97& rCodec ); using StgWriter::Write; virtual ULONG Write( SwPaM&, SfxMedium&, const String* = 0 ); @@ -1350,6 +1381,47 @@ public: virtual const SfxPoolItem& GetItem( USHORT nWhich ) const = 0; }; +class MSWord_SdrAttrIter : public MSWordAttrIter +{ +private: + const EditTextObject* pEditObj; + const SfxItemPool* pEditPool; + EECharAttribArray aTxtAtrArr; + SvPtrarr aChrTxtAtrArr; + SvUShorts aChrSetArr; + USHORT nPara; + xub_StrLen nAktSwPos; + xub_StrLen nTmpSwPos; // for HasItem() + rtl_TextEncoding eNdChrSet; + USHORT nScript; + BYTE mnTyp; + + xub_StrLen SearchNext( xub_StrLen nStartPos ); + void SetCharSet(const EECharAttrib& rTxtAttr, bool bStart); + + //No copying + MSWord_SdrAttrIter(const MSWord_SdrAttrIter&); + MSWord_SdrAttrIter& operator=(const MSWord_SdrAttrIter&); +public: + MSWord_SdrAttrIter( MSWordExportBase& rWr, const EditTextObject& rEditObj, + BYTE nType ); + void NextPara( USHORT nPar ); + void OutParaAttr(bool bCharAttr); + void OutEEField(const SfxPoolItem& rHt); + + bool IsTxtAttr(xub_StrLen nSwPos); + + void NextPos() { nAktSwPos = SearchNext( nAktSwPos + 1 ); } + + void OutAttr( xub_StrLen nSwPos ); + virtual const SfxPoolItem* HasTextItem( USHORT nWhich ) const; + virtual const SfxPoolItem& GetItem( USHORT nWhich ) const; + bool OutAttrWithRange(xub_StrLen nPos); + xub_StrLen WhereNext() const { return nAktSwPos; } + rtl_TextEncoding GetNextCharSet() const; + rtl_TextEncoding GetNodeCharSet() const { return eNdChrSet; } +}; + /// Class to collect and output the styles table. class MSWordStyles { diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 024ba63e4a..67e9dd64b1 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -271,20 +271,21 @@ void MSWordExportBase::ExportPoolItemsToCHP( sw::PoolItems &rItems, USHORT nScri * - gebe die Attribute aus; ohne Parents! */ -void MSWordExportBase::OutputItemSet( const SfxItemSet& rSet, bool bPapFmt, bool bChpFmt, USHORT nScript ) +void MSWordExportBase::OutputItemSet( const SfxItemSet& rSet, bool bPapFmt, bool bChpFmt, USHORT nScript, + bool bExportParentItemSet ) { - if ( rSet.Count() ) + if( bExportParentItemSet || rSet.Count() ) { const SfxPoolItem* pItem; pISet = &rSet; // fuer Doppel-Attribute // If frame dir is set, but not adjust, then force adjust as well - if ( bPapFmt && SFX_ITEM_SET == rSet.GetItemState( RES_FRAMEDIR, false ) ) + if ( bPapFmt && SFX_ITEM_SET == rSet.GetItemState( RES_FRAMEDIR, bExportParentItemSet ) ) { // No explicit adjust set ? - if ( SFX_ITEM_SET != rSet.GetItemState( RES_PARATR_ADJUST, false ) ) + if ( SFX_ITEM_SET != rSet.GetItemState( RES_PARATR_ADJUST, bExportParentItemSet ) ) { - if ( 0 != ( pItem = rSet.GetItem( RES_PARATR_ADJUST ) ) ) + if ( 0 != ( pItem = rSet.GetItem( RES_PARATR_ADJUST, bExportParentItemSet ) ) ) { // then set the adjust used by the parent format AttrOutput().OutputItem( *pItem ); @@ -292,7 +293,7 @@ void MSWordExportBase::OutputItemSet( const SfxItemSet& rSet, bool bPapFmt, bool } } - if ( bPapFmt && SFX_ITEM_SET == rSet.GetItemState( RES_PARATR_NUMRULE, false, &pItem ) ) + if ( bPapFmt && SFX_ITEM_SET == rSet.GetItemState( RES_PARATR_NUMRULE, bExportParentItemSet, &pItem ) ) { AttrOutput().OutputItem( *pItem ); @@ -307,7 +308,7 @@ void MSWordExportBase::OutputItemSet( const SfxItemSet& rSet, bool bPapFmt, bool } sw::PoolItems aItems; - GetPoolItems( rSet, aItems ); + GetPoolItems( rSet, aItems, bExportParentItemSet ); if ( bChpFmt ) ExportPoolItemsToCHP(aItems, nScript); @@ -783,7 +784,7 @@ void MSWordExportBase::OutputFormat( const SwFmt& rFmt, bool bPapFmt, bool bChpF aSet.Put( aLR ); CorrectTabStopInSet( aSet, rNFmt.GetAbsLSpace() ); OutputItemSet( aSet, bPapFmt, bChpFmt, - i18n::ScriptType::LATIN); + i18n::ScriptType::LATIN, mbExportModeRTF); bCallOutSet = false; } } @@ -801,7 +802,7 @@ void MSWordExportBase::OutputFormat( const SwFmt& rFmt, bool bPapFmt, bool bChpF ItemGet<SvxLRSpaceItem>(aSet, RES_LR_SPACE)); aSet.Put( aLR ); OutputItemSet( aSet, bPapFmt, bChpFmt, - com::sun::star::i18n::ScriptType::LATIN); + com::sun::star::i18n::ScriptType::LATIN, mbExportModeRTF); bCallOutSet = false; } // <-- @@ -841,7 +842,7 @@ void MSWordExportBase::OutputFormat( const SwFmt& rFmt, bool bPapFmt, bool bChpF bOutFlyFrmAttrs = true; //script doesn't matter if not exporting chp OutputItemSet(aSet, true, false, - i18n::ScriptType::LATIN); + i18n::ScriptType::LATIN, mbExportModeRTF); bOutFlyFrmAttrs = false; bCallOutSet = false; @@ -855,7 +856,7 @@ void MSWordExportBase::OutputFormat( const SwFmt& rFmt, bool bPapFmt, bool bChpF if( bCallOutSet ) OutputItemSet( rFmt.GetAttrSet(), bPapFmt, bChpFmt, - i18n::ScriptType::LATIN); + i18n::ScriptType::LATIN, mbExportModeRTF); pOutFmtNode = pOldMod; } @@ -3340,7 +3341,7 @@ void WW8AttributeOutput::CharTwoLines( const SvxTwoLinesItem& rTwoLines ) m_rWW8Export.pO->Insert( (BYTE)0x02, m_rWW8Export.pO->Count() ); sal_Unicode cStart = rTwoLines.GetStartBracket(); - sal_Unicode cEnd = rTwoLines.GetStartBracket(); + sal_Unicode cEnd = rTwoLines.GetEndBracket(); /* As per usual we have problems. We can have seperate left and right brackets diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 04341abb38..1dca422c48 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -29,16 +29,20 @@ #include "precompiled_sw.hxx" /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */ -#include <hash_set> #include <com/sun/star/embed/ElementModes.hpp> #include <com/sun/star/embed/XStorage.hpp> + +#include <hash_set> #include <unotools/ucbstreamhelper.hxx> #include <tools/solar.h> #include <rtl/tencinfo.h> +#include <rtl/random.h> #include <sot/storage.hxx> #include <sfx2/docinf.hxx> #include <sfx2/docfile.hxx> +#include <sfx2/request.hxx> +#include <sfx2/frame.hxx> #include <tools/urlobj.hxx> #include <unotools/tempfile.hxx> #include <svtools/sfxecode.hxx> @@ -107,6 +111,7 @@ #include <com/sun/star/i18n/ForbiddenCharacters.hpp> #include <comphelper/extract.hxx> +#include <comphelper/sequenceashashmap.hxx> #include <fltini.hxx> #include <algorithm> @@ -3575,7 +3580,7 @@ void wwSectionManager::InsertSegments() bool bThisAndNextAreCompatible = (aNext != aEnd) ? ((aIter->GetPageWidth() == aNext->GetPageWidth()) && (aIter->GetPageHeight() == aNext->GetPageHeight()) && (aIter->IsLandScape() == aNext->IsLandScape())) : true; - if ((aNext != aEnd && aNext->IsContinous() && bThisAndNextAreCompatible) || bProtected) + if (((aNext != aEnd && aNext->IsContinous() && bThisAndNextAreCompatible) || bProtected)) { bIgnoreCols = true; if ((aIter->NoCols() > 1) || bProtected) @@ -4344,6 +4349,90 @@ namespace return aPassw; } + uno::Sequence< beans::NamedValue > InitXorWord95Codec( ::msfilter::MSCodec_XorWord95& rCodec, SfxMedium& rMedium, WW8Fib* pWwFib ) + { + uno::Sequence< beans::NamedValue > aEncryptionData; + SFX_ITEMSET_ARG( rMedium.GetItemSet(), pEncryptionData, SfxUnoAnyItem, SID_ENCRYPTIONDATA, sal_False ); + if ( pEncryptionData && ( pEncryptionData->GetValue() >>= aEncryptionData ) && !rCodec.InitCodec( aEncryptionData ) ) + aEncryptionData.realloc( 0 ); + + if ( !aEncryptionData.getLength() ) + { + String sUniPassword = QueryPasswordForMedium( rMedium ); + + ByteString sPassword(sUniPassword, WW8Fib::GetFIBCharset( pWwFib->chseTables ) ); + + xub_StrLen nLen = sPassword.Len(); + if( nLen <= 15 ) + { + sal_uInt8 pPassword[16]; + memset( pPassword, 0, sizeof( pPassword ) ); + + for (xub_StrLen nChar = 0; nChar < sPassword.Len(); ++nChar ) + pPassword[nChar] = sPassword.GetChar(nChar); + + rCodec.InitKey( pPassword ); + aEncryptionData = rCodec.GetEncryptionData(); + + // the export supports RC4 algorithm only, so we have to generate the related EncryptionData as well, + // so that Save can export the document without asking for a password; + // as result there will be EncryptionData for both algorithms in the MediaDescriptor + ::msfilter::MSCodec_Std97 aCodec97; + + // Generate random number with a seed of time as salt. + TimeValue aTime; + osl_getSystemTime( &aTime ); + rtlRandomPool aRandomPool = rtl_random_createPool(); + rtl_random_addBytes ( aRandomPool, &aTime, 8 ); + + sal_uInt8 pDocId[ 16 ]; + rtl_random_getBytes( aRandomPool, pDocId, 16 ); + + rtl_random_destroyPool( aRandomPool ); + + sal_uInt16 pStd97Pass[16]; + memset( pStd97Pass, 0, sizeof( pStd97Pass ) ); + for (xub_StrLen nChar = 0; nChar < nLen; ++nChar ) + pStd97Pass[nChar] = sUniPassword.GetChar(nChar); + + aCodec97.InitKey( pStd97Pass, pDocId ); + + // merge the EncryptionData, there should be no conflicts + ::comphelper::SequenceAsHashMap aEncryptionHash( aEncryptionData ); + aEncryptionHash.update( ::comphelper::SequenceAsHashMap( aCodec97.GetEncryptionData() ) ); + aEncryptionHash >> aEncryptionData; + } + } + + return aEncryptionData; + } + + uno::Sequence< beans::NamedValue > InitStd97Codec( ::msfilter::MSCodec_Std97& rCodec, sal_uInt8 pDocId[16], SfxMedium& rMedium ) + { + uno::Sequence< beans::NamedValue > aEncryptionData; + SFX_ITEMSET_ARG( rMedium.GetItemSet(), pEncryptionData, SfxUnoAnyItem, SID_ENCRYPTIONDATA, sal_False ); + if ( pEncryptionData && ( pEncryptionData->GetValue() >>= aEncryptionData ) && !rCodec.InitCodec( aEncryptionData ) ) + aEncryptionData.realloc( 0 ); + + if ( !aEncryptionData.getLength() ) + { + String sUniPassword = QueryPasswordForMedium( rMedium ); + + xub_StrLen nLen = sUniPassword.Len(); + if ( nLen <= 15 ) + { + sal_Unicode pPassword[16]; + memset( pPassword, 0, sizeof( pPassword ) ); + for (xub_StrLen nChar = 0; nChar < nLen; ++nChar ) + pPassword[nChar] = sUniPassword.GetChar(nChar); + + rCodec.InitKey( pPassword, pDocId ); + aEncryptionData = rCodec.GetEncryptionData(); + } + } + + return aEncryptionData; + } } ULONG SwWW8ImplReader::LoadThroughDecryption(SwPaM& rPaM ,WW8Glossary *pGloss) @@ -4397,31 +4486,22 @@ ULONG SwWW8ImplReader::LoadThroughDecryption(SwPaM& rPaM ,WW8Glossary *pGloss) if (bDecrypt) { nErrRet = ERRCODE_SVX_WRONGPASS; - switch (eAlgo) + SfxMedium* pMedium = mpDocShell->GetMedium(); + + if ( pMedium ) { - default: - nErrRet = ERRCODE_SVX_READ_FILTER_CRYPT; - break; - case XOR: + switch (eAlgo) { - String sUniPassword = - QueryPasswordForMedium(*(mpDocShell->GetMedium())); - - ByteString sPassword(sUniPassword, - WW8Fib::GetFIBCharset(pWwFib->chseTables)); - - xub_StrLen nLen = sPassword.Len(); - // DR: do not cut a wrong (too long) password - if( nLen <= 15 ) + default: + nErrRet = ERRCODE_SVX_READ_FILTER_CRYPT; + break; + case XOR: { - sal_uInt8 aPassword[16] = {0}; - - for (xub_StrLen nChar = 0; nChar < sPassword.Len(); ++nChar ) - aPassword[nChar] = sPassword.GetChar(nChar); - msfilter::MSCodec_XorWord95 aCtx; - aCtx.InitKey(aPassword); - if (aCtx.VerifyKey(pWwFib->nKey, pWwFib->nHash)) + uno::Sequence< beans::NamedValue > aEncryptionData = InitXorWord95Codec( aCtx, *pMedium, pWwFib ); + + // if initialization has failed the EncryptionData should be empty + if ( aEncryptionData.getLength() && aCtx.VerifyKey( pWwFib->nKey, pWwFib->nHash ) ) { nErrRet = 0; pTempMain = MakeTemp(aDecryptMain); @@ -4453,22 +4533,15 @@ ULONG SwWW8ImplReader::LoadThroughDecryption(SwPaM& rPaM ,WW8Glossary *pGloss) DecryptXOR(aCtx, *pDataStream, aDecryptData); pDataStream = &aDecryptData; } + + pMedium->GetItemSet()->ClearItem( SID_PASSWORD ); + pMedium->GetItemSet()->Put( SfxUnoAnyItem( SID_ENCRYPTIONDATA, uno::makeAny( aEncryptionData ) ) ); } } - } - break; - case RC4: - { - String sUniPassword = - QueryPasswordForMedium(*(mpDocShell->GetMedium())); - - xub_StrLen nLen = sUniPassword.Len(); - // DR: do not cut a wrong (too long) password - if (nLen <= 15) + break; + case RC4: { - sal_Unicode aPassword[16] = {0}; - for (xub_StrLen nChar = 0; nChar < nLen; ++nChar ) - aPassword[nChar] = sUniPassword.GetChar(nChar); + msfilter::MSCodec_Std97 aCtx; sal_uInt8 aDocId[ 16 ]; pTableStream->Read(aDocId, 16); @@ -4477,9 +4550,9 @@ ULONG SwWW8ImplReader::LoadThroughDecryption(SwPaM& rPaM ,WW8Glossary *pGloss) sal_uInt8 aSaltHash[ 16 ]; pTableStream->Read(aSaltHash, 16); - msfilter::MSCodec_Std97 aCtx; - aCtx.InitKey(aPassword, aDocId); - if (aCtx.VerifyKey(aSaltData, aSaltHash)) + // if initialization has failed the EncryptionData should be empty + uno::Sequence< beans::NamedValue > aEncryptionData = InitStd97Codec( aCtx, aDocId, *pMedium ); + if ( aEncryptionData.getLength() && aCtx.VerifyKey( aSaltData, aSaltHash ) ) { nErrRet = 0; @@ -4498,17 +4571,13 @@ ULONG SwWW8ImplReader::LoadThroughDecryption(SwPaM& rPaM ,WW8Glossary *pGloss) DecryptRC4(aCtx, *pDataStream, aDecryptData); pDataStream = &aDecryptData; } - SfxMedium* pMedium = mpDocShell->GetMedium(); - if ( pMedium ) - { - SfxItemSet* pSet = pMedium->GetItemSet(); - if ( pSet ) - pSet->Put( SfxStringItem(SID_PASSWORD, sUniPassword) ); - } + + pMedium->GetItemSet()->ClearItem( SID_PASSWORD ); + pMedium->GetItemSet()->Put( SfxUnoAnyItem( SID_ENCRYPTIONDATA, uno::makeAny( aEncryptionData ) ) ); } } + break; } - break; } if (nErrRet == 0) @@ -4919,7 +4988,14 @@ ULONG WW8Reader::Read(SwDoc &rDoc, const String& rBaseURL, SwPaM &rPam, const St } SwWW8ImplReader* pRdr = new SwWW8ImplReader(nVersion, pStg, pIn, rDoc, rBaseURL, bNew); - nRet = pRdr->LoadDoc( rPam ); + try + { + nRet = pRdr->LoadDoc( rPam ); + } + catch( const std::exception& ) + { + nRet = ERR_WW8_NO_WW8_FILE_ERR; + } delete pRdr; if( refStrm.Is() ) diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index 36ef485a45..0784a182d5 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -892,11 +892,18 @@ void WW8SprmIter::SetSprms(const BYTE* pSprms_, long nLen_) const BYTE* WW8SprmIter::operator ++( int ) { - if (nRemLen > 0) + if (nRemLen > 0 ) { - pSprms += nAktSize; - nRemLen -= nAktSize; - UpdateMyMembers(); + if( nRemLen >= nAktSize ) + { + pSprms += nAktSize; + nRemLen -= nAktSize; + UpdateMyMembers(); + } + else + { + throw( ::std::exception() ); + } } return pSprms; } @@ -3247,6 +3254,8 @@ void WW8PLCFx_Cp_FKP::GetSprms(WW8PLCFxDesc* p) Otherwise our cool fastsave algorithm can be brought to bear on the problem. */ + if( !pPieceIter ) + return; ULONG nOldPos = pPieceIter->GetIdx(); bool bOk = pPieceIter->SeekPos(nOrigCp); pPieceIter->SetIdx( nOldPos ); diff --git a/sw/source/filter/xml/makefile.mk b/sw/source/filter/xml/makefile.mk deleted file mode 100644 index c1191fe3fa..0000000000 --- a/sw/source/filter/xml/makefile.mk +++ /dev/null @@ -1,94 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=xml - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -.IF "$(mydebug)" != "" -CDEFS=$(CDEFS) -Dmydebug -.ENDIF - -# --- Files -------------------------------------------------------- - -SLOFILES = \ - $(SLO)$/swxml.obj \ - $(SLO)$/xmlimp.obj \ - $(SLO)$/wrtxml.obj \ - $(SLO)$/xmlexp.obj \ - $(SLO)$/xmltext.obj \ - $(SLO)$/xmltexte.obj \ - $(SLO)$/xmltexti.obj \ - $(SLO)$/xmltbli.obj \ - $(SLO)$/xmltble.obj \ - $(SLO)$/xmlfmt.obj \ - $(SLO)$/xmlfmte.obj \ - $(SLO)$/xmlmeta.obj \ - $(SLO)$/xmlscript.obj \ - $(SLO)$/xmlitemm.obj \ - $(SLO)$/xmlitemi.obj \ - $(SLO)$/xmliteme.obj \ - $(SLO)$/xmlithlp.obj \ - $(SLO)$/xmlbrsh.obj \ - $(SLO)$/xmlfonte.obj \ - $(SLO)$/XMLRedlineImportHelper.obj \ - $(SLO)$/xmlitem.obj \ - $(SLO)$/xmlitmpr.obj \ - $(SLO)$/xmlimpit.obj \ - $(SLO)$/xmlexpit.obj - -EXCEPTIONSFILES= \ - $(SLO)$/swxml.obj \ - $(SLO)$/xmlimp.obj \ - $(SLO)$/wrtxml.obj \ - $(SLO)$/xmlexp.obj \ - $(SLO)$/xmltext.obj \ - $(SLO)$/xmltexti.obj \ - $(SLO)$/xmltexte.obj \ - $(SLO)$/xmltbli.obj \ - $(SLO)$/xmltble.obj \ - $(SLO)$/xmlfmt.obj \ - $(SLO)$/xmlfmte.obj \ - $(SLO)$/xmlmeta.obj \ - $(SLO)$/xmlscript.obj \ - $(SLO)$/xmlitemi.obj \ - $(SLO)$/xmliteme.obj \ - $(SLO)$/xmlithlp.obj \ - $(SLO)$/xmlbrsh.obj \ - $(SLO)$/xmlfonte.obj \ - $(SLO)$/XMLRedlineImportHelper.obj - -# --- Targets ------------------------------------------------------- - -.INCLUDE : target.mk diff --git a/sw/source/filter/xml/xmltble.cxx b/sw/source/filter/xml/xmltble.cxx index 857d8db90e..99c2902571 100644 --- a/sw/source/filter/xml/xmltble.cxx +++ b/sw/source/filter/xml/xmltble.cxx @@ -82,7 +82,7 @@ class SwXMLTableColumn_Impl : public SwWriteTableCol public: - SwXMLTableColumn_Impl( sal_uInt16 nPosition ) : + SwXMLTableColumn_Impl( sal_uInt32 nPosition ) : SwWriteTableCol( nPosition ), nRelWidth( 0UL ) {}; @@ -137,7 +137,7 @@ SwXMLTableLines_Impl::SwXMLTableLines_Impl( const SwTableLines& rLines ) : nWidth( 0UL ) { #ifdef DBG_UTIL - sal_uInt16 nEndCPos = 0U; + sal_uInt32 nEndCPos = 0U; #endif sal_uInt16 nLines = rLines.Count(); sal_uInt16 nLine; @@ -147,14 +147,14 @@ SwXMLTableLines_Impl::SwXMLTableLines_Impl( const SwTableLines& rLines ) : const SwTableBoxes& rBoxes = pLine->GetTabBoxes(); sal_uInt16 nBoxes = rBoxes.Count(); - sal_uInt16 nCPos = 0U; + sal_uInt32 nCPos = 0U; for( sal_uInt16 nBox=0U; nBox<nBoxes; nBox++ ) { const SwTableBox *pBox = rBoxes[nBox]; if( nBox < nBoxes-1U || nWidth==0UL ) { - nCPos = nCPos + (sal_uInt16)SwWriteTable::GetBoxWidth( pBox ); + nCPos = nCPos + SwWriteTable::GetBoxWidth( pBox ); SwXMLTableColumn_Impl *pCol = new SwXMLTableColumn_Impl( nCPos ); @@ -171,8 +171,8 @@ SwXMLTableLines_Impl::SwXMLTableLines_Impl( const SwTableLines& rLines ) : else { #ifdef DBG_UTIL - sal_uInt16 nCheckPos = - nCPos + (sal_uInt16)SwWriteTable::GetBoxWidth( pBox ); + sal_uInt32 nCheckPos = + nCPos + SwWriteTable::GetBoxWidth( pBox ); if( !nEndCPos ) { nEndCPos = nCheckPos; @@ -186,9 +186,9 @@ SwXMLTableLines_Impl::SwXMLTableLines_Impl( const SwTableLines& rLines ) : */ } #endif - nCPos = (sal_uInt16)nWidth; + nCPos = nWidth; #ifdef DBG_UTIL - SwXMLTableColumn_Impl aCol( (sal_uInt16)nWidth ); + SwXMLTableColumn_Impl aCol( nWidth ); ASSERT( aCols.Seek_Entry(&aCol), "couldn't find last column" ); ASSERT( SwXMLTableColumn_Impl(nCheckPos) == SwXMLTableColumn_Impl(nCPos), @@ -602,13 +602,13 @@ void SwXMLExport::ExportTableLinesAutoStyles( const SwTableLines& rLines, // pass 2: export column styles { const SwXMLTableColumns_Impl& rCols = pLines->GetColumns(); - sal_uInt16 nCPos = 0U; + sal_uInt32 nCPos = 0U; sal_uInt16 nColumns = rCols.Count(); for( sal_uInt16 nColumn=0U; nColumn<nColumns; nColumn++ ) { SwXMLTableColumn_Impl *pColumn = rCols[nColumn]; - sal_uInt16 nOldCPos = nCPos; + sal_uInt32 nOldCPos = nCPos; nCPos = pColumn->GetPos(); sal_uInt32 nWidth = nCPos - nOldCPos; @@ -634,7 +634,7 @@ void SwXMLExport::ExportTableLinesAutoStyles( const SwTableLines& rLines, nColAbsWidth += (nBaseWidth/2UL); nColAbsWidth /= nBaseWidth; } - pColumn->SetWidthOpt( (sal_uInt16)nColAbsWidth, sal_False ); + pColumn->SetWidthOpt( nColAbsWidth, sal_False ); } ULONG nExpPos = 0; @@ -678,16 +678,16 @@ void SwXMLExport::ExportTableLinesAutoStyles( const SwTableLines& rLines, const SwTableBoxes& rBoxes = pLine->GetTabBoxes(); sal_uInt16 nBoxes = rBoxes.Count(); - sal_uInt16 nCPos = 0U; + sal_uInt32 nCPos = 0U; sal_uInt16 nCol = 0U; for( sal_uInt16 nBox=0U; nBox<nBoxes; nBox++ ) { SwTableBox *pBox = rBoxes[nBox]; if( nBox < nBoxes-1U ) - nCPos = nCPos + (sal_uInt16)SwWriteTable::GetBoxWidth( pBox ); + nCPos = nCPos + SwWriteTable::GetBoxWidth( pBox ); else - nCPos = (sal_uInt16)pLines->GetWidth(); + nCPos = pLines->GetWidth(); // Und ihren Index @@ -959,7 +959,7 @@ void SwXMLExport::ExportTableLine( const SwTableLine& rLine, const SwTableBoxes& rBoxes = rLine.GetTabBoxes(); sal_uInt16 nBoxes = rBoxes.Count(); - sal_uInt16 nCPos = 0U; + sal_uInt32 nCPos = 0U; sal_uInt16 nCol = 0U; for( sal_uInt16 nBox=0U; nBox<nBoxes; nBox++ ) { @@ -975,9 +975,9 @@ void SwXMLExport::ExportTableLine( const SwTableLine& rLine, } if( nBox < nBoxes-1U ) - nCPos = nCPos + (sal_uInt16)SwWriteTable::GetBoxWidth( pBox ); + nCPos = nCPos + SwWriteTable::GetBoxWidth( pBox ); else - nCPos = (sal_uInt16)rLines.GetWidth(); + nCPos = rLines.GetWidth(); // Und ihren Index const sal_uInt16 nOldCol = nCol; diff --git a/sw/source/ui/app/appopt.cxx b/sw/source/ui/app/appopt.cxx index a248ac8aff..ae6e4720b2 100644 --- a/sw/source/ui/app/appopt.cxx +++ b/sw/source/ui/app/appopt.cxx @@ -27,19 +27,15 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" -#include <hintids.hxx> -#ifndef _CMDID_H -#include <cmdid.h> // Funktion-Ids -#endif - -#include <com/sun/star/i18n/ScriptType.hpp> #define _SVSTDARR_STRINGSDTOR #include <svl/svstdarr.hxx> -#ifndef _MSGBOX_HXX //autogen +#include <com/sun/star/i18n/ScriptType.hpp> + +#include <hintids.hxx> +#include <cmdid.h> // Funktion-Ids #include <vcl/msgbox.hxx> -#endif #include <svl/eitem.hxx> #include <sfx2/request.hxx> #include <sfx2/app.hxx> @@ -47,9 +43,7 @@ #include <svx/htmlmode.hxx> #include <sfx2/bindings.hxx> #include <editeng/brshitem.hxx> -#ifndef _SVX_TSTPITEM_HXX //autogen #include <editeng/tstpitem.hxx> -#endif #include <svx/optgrid.hxx> #include <svx/svxdlg.hxx> #include <svx/dialogs.hrc> @@ -59,37 +53,25 @@ #include <optcomp.hxx> #include <edtwin.hxx> #include <swmodule.hxx> -#ifndef _VIEW_HXX #include <view.hxx> -#endif +#include <doc.hxx> #include <wrtsh.hxx> -#ifndef IDOCUMENTDEVICEACCESS_HXX_INCLUDED #include <IDocumentDeviceAccess.hxx> -#endif #include <uitool.hxx> #include <initui.hxx> // fuer ::GetGlossaries() #include <fldbas.hxx> //fuer UpdateFields -#ifndef _WVIEW_HXX #include <wview.hxx> -#endif #include <cfgitems.hxx> #include <prtopt.hxx> -#ifndef _PVIEW_HXX #include <pview.hxx> -#endif #include <usrpref.hxx> -#ifndef _MODCFG_HXX #include <modcfg.hxx> -#endif #include <glosdoc.hxx> #include <uiitems.hxx> #include <editeng/langitem.hxx> #include <unotools/lingucfg.hxx> #include <editeng/unolingu.hxx> - -#ifndef _GLOBALS_HRC #include <globals.hrc> -#endif #include <globals.h> // globale Konstanten z.B. #include <svl/slstitm.hxx> #include "swabstdlg.hxx" @@ -334,8 +316,7 @@ void SwModule::ApplyItemSet( USHORT nId, const SfxItemSet& rSet ) /*--------------------------------------------------------------------- Seite Dokumentansicht auswerten -----------------------------------------------------------------------*/ - if( SFX_ITEM_SET == rSet.GetItemState( - FN_PARAM_DOCDISP, FALSE, &pItem )) + if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_DOCDISP, FALSE, &pItem )) { const SwDocDisplayItem* pDocDispItem = (const SwDocDisplayItem*)pItem; @@ -364,23 +345,20 @@ void SwModule::ApplyItemSet( USHORT nId, const SfxItemSet& rSet ) Elemente - Item auswerten -----------------------------------------------------------------------*/ - if( SFX_ITEM_SET == rSet.GetItemState( - FN_PARAM_ELEM, FALSE, &pItem ) ) + if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_ELEM, FALSE, &pItem ) ) { const SwElemItem* pElemItem = (const SwElemItem*)pItem; pElemItem->FillViewOptions( aViewOpt ); } - if( SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_METRIC, - FALSE, &pItem ) ) + if( SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_METRIC, FALSE, &pItem ) ) { SFX_APP()->SetOptions(rSet); const SfxUInt16Item* pMetricItem = (const SfxUInt16Item*)pItem; ::SetDfltMetric((FieldUnit)pMetricItem->GetValue(), !bTextDialog); } - if( SFX_ITEM_SET == rSet.GetItemState(FN_HSCROLL_METRIC, - FALSE, &pItem ) ) + if( SFX_ITEM_SET == rSet.GetItemState(FN_HSCROLL_METRIC, FALSE, &pItem ) ) { const SfxUInt16Item* pMetricItem = (const SfxUInt16Item*)pItem; FieldUnit eUnit = (FieldUnit)pMetricItem->GetValue(); @@ -389,8 +367,7 @@ void SwModule::ApplyItemSet( USHORT nId, const SfxItemSet& rSet ) pAppView->ChangeTabMetric(eUnit); } - if( SFX_ITEM_SET == rSet.GetItemState(FN_VSCROLL_METRIC, - FALSE, &pItem ) ) + if( SFX_ITEM_SET == rSet.GetItemState(FN_VSCROLL_METRIC, FALSE, &pItem ) ) { const SfxUInt16Item* pMetricItem = (const SfxUInt16Item*)pItem; FieldUnit eUnit = (FieldUnit)pMetricItem->GetValue(); @@ -399,8 +376,7 @@ void SwModule::ApplyItemSet( USHORT nId, const SfxItemSet& rSet ) pAppView->ChangeVLinealMetric(eUnit); } - if( SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_DEFTABSTOP, - FALSE, &pItem ) ) + if( SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_DEFTABSTOP, FALSE, &pItem ) ) { USHORT nTabDist = ((const SfxUInt16Item*)pItem)->GetValue(); pPref->SetDefTab(nTabDist); @@ -427,8 +403,7 @@ void SwModule::ApplyItemSet( USHORT nId, const SfxItemSet& rSet ) Seite Rastereinstellungen auswerten ----------------------------------------------------------------------*/ - if( SFX_ITEM_SET == rSet.GetItemState( - SID_ATTR_GRID_OPTIONS, FALSE, &pItem )) + if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_GRID_OPTIONS, FALSE, &pItem )) { const SvxGridItem* pGridItem = (const SvxGridItem*)pItem; @@ -458,8 +433,7 @@ void SwModule::ApplyItemSet( USHORT nId, const SfxItemSet& rSet ) // Writer Drucker Zusatzeinstellungen auswerten //---------------------------------------------------------------------------- - if( SFX_ITEM_SET == rSet.GetItemState( - FN_PARAM_ADDPRINTER, FALSE, &pItem )) + if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_ADDPRINTER, FALSE, &pItem )) { SwPrintOptions* pOpt = GetPrtOptions(!bTextDialog); if (pOpt) @@ -473,16 +447,25 @@ void SwModule::ApplyItemSet( USHORT nId, const SfxItemSet& rSet ) } - if( SFX_ITEM_SET == rSet.GetItemState( - FN_PARAM_SHADOWCURSOR, FALSE, &pItem )) + if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_SHADOWCURSOR, FALSE, &pItem )) { ((SwShadowCursorItem*)pItem)->FillViewOptions( aViewOpt ); if(pBindings) pBindings->Invalidate(FN_SHADOWCURSOR); } - if( SFX_ITEM_SET == rSet.GetItemState( - FN_PARAM_CRSR_IN_PROTECTED, FALSE, &pItem )) + if( pAppView ) + { + SwWrtShell &rWrtSh = pAppView->GetWrtShell(); + const bool bAlignFormulas = rWrtSh.GetDoc()->get( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT ); + pPref->SetAlignMathObjectsToBaseline( bAlignFormulas ); + + // don't align formulas in documents that are currently loading + if (bAlignFormulas && !rWrtSh.GetDoc()->IsInReading()) + rWrtSh.AlignAllFormulasToBaseline(); + } + + if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_CRSR_IN_PROTECTED, FALSE, &pItem )) { aViewOpt.SetCursorInProtectedArea(((const SfxBoolItem*)pItem)->GetValue()); } @@ -510,8 +493,7 @@ void SwModule::ApplyItemSet( USHORT nId, const SfxItemSet& rSet ) } #endif // dann an der akt. View und Shell die entsp. Elemente setzen - ApplyUsrPref( aViewOpt, pAppView, - bTextDialog? VIEWOPT_DEST_TEXT : VIEWOPT_DEST_WEB); + ApplyUsrPref( aViewOpt, pAppView, bTextDialog? VIEWOPT_DEST_TEXT : VIEWOPT_DEST_WEB); } /* -----------------12.02.99 12:28------------------- * @@ -609,6 +591,15 @@ SfxTabPage* SwModule::CreateTabPage( USHORT nId, Window* pParent, const SfxItemS if ( fnCreatePage ) pRet = (*fnCreatePage)( pParent, rSet ); } + if (pRet && (nId == RID_SW_TP_OPTSHDWCRSR || nId == RID_SW_TP_HTML_OPTSHDWCRSR)) + { + SwView* pCurrView = GetView(); + if(pCurrView) + { + aSet.Put( SwWrtShellItem( SID_WRT_SHELL, pCurrView->GetWrtShellPtr() ) ); + pRet->PageCreated(aSet); + } + } } break; #ifdef DBG_UTIL @@ -653,5 +644,3 @@ SfxTabPage* SwModule::CreateTabPage( USHORT nId, Window* pParent, const SfxItemS return pRet; } - - diff --git a/sw/source/ui/app/docsh.cxx b/sw/source/ui/app/docsh.cxx index 7eb83ecbf6..751e4412c3 100644 --- a/sw/source/ui/app/docsh.cxx +++ b/sw/source/ui/app/docsh.cxx @@ -209,23 +209,7 @@ Reader* SwDocShell::StartConvertFrom(SfxMedium& rMedium, SwReader** ppRdr, return 0; } } - if(rMedium.IsStorage()) - { - //SvStorageRef aStor( rMedium.GetStorage() ); - const SfxItemSet* pSet = rMedium.GetItemSet(); - const SfxPoolItem *pItem; - if(pSet && SFX_ITEM_SET == pSet->GetItemState(SID_PASSWORD, TRUE, &pItem)) - { - DBG_ASSERT(pItem->IsA( TYPE(SfxStringItem) ), "Fehler Parametertype"); - comphelper::OStorageHelper::SetCommonStoragePassword( rMedium.GetStorage(), ((const SfxStringItem *)pItem)->GetValue() ); - } - // Fuer's Dokument-Einfuegen noch die FF-Version, wenn's der - // eigene Filter ist. - ASSERT( /*pRead != ReadSw3 || */pRead != ReadXML || pFlt->GetVersion(), - "Am Filter ist keine FF-Version gesetzt" ); - //if( (pRead == ReadSw3 || pRead == ReadXML) && pFlt->GetVersion() ) - // aStor->SetVersion( (long)pFlt->GetVersion() ); - } + // #i30171# set the UpdateDocMode at the SwDocShell SFX_ITEMSET_ARG( rMedium.GetItemSet(), pUpdateDocItem, SfxUInt16Item, SID_UPDATEDOCMODE, sal_False); nUpdateDocMode = pUpdateDocItem ? pUpdateDocItem->GetValue() : document::UpdateDocMode::NO_UPDATE; @@ -1147,6 +1131,23 @@ void SwDocShell::GetState(SfxItemSet& rSet) rSet.Put( SvxFontListItem( pFontList, SID_ATTR_CHAR_FONTLIST ) ); } break; + case SID_MAIL_PREPAREEXPORT: + { + //check if linked content or possibly hidden content is available + //pDoc->UpdateFlds( NULL, false ); + sfx2::LinkManager& rLnkMgr = pDoc->GetLinkManager(); + const ::sfx2::SvBaseLinks& rLnks = rLnkMgr.GetLinks(); + sal_Bool bRet = sal_False; + if( rLnks.Count() ) + bRet = sal_True; + else + { + //sections with hidden flag, hidden character attribute, hidden paragraph/text or conditional text fields + bRet = pDoc->HasInvisibleContent(); + } + rSet.Put( SfxBoolItem( nWhich, bRet ) ); + } + break; default: DBG_ASSERT(!this,"Hier darfst Du nicht hinein!"); diff --git a/sw/source/ui/app/docsh2.cxx b/sw/source/ui/app/docsh2.cxx index 587b83aa51..3f1884987f 100644 --- a/sw/source/ui/app/docsh2.cxx +++ b/sw/source/ui/app/docsh2.cxx @@ -324,7 +324,7 @@ USHORT SwDocShell::PrepareClose( BOOL bUI, BOOL bForBrowsing ) } #endif return nRet; -} +} /*-------------------------------------------------------------------- Beschreibung: Organizer @@ -1209,7 +1209,19 @@ void SwDocShell::Execute(SfxRequest& rReq) } break; - case SID_MAIL_EXPORT_FINISHED: + case SID_MAIL_PREPAREEXPORT: + { + //pWrtShell is not set in page preview + if(pWrtShell) + pWrtShell->StartAllAction(); + pDoc->UpdateFlds( NULL, false ); + pDoc->EmbedAllLinks(); + pDoc->RemoveInvisibleContent(); + if(pWrtShell) + pWrtShell->EndAllAction(); + } + break; + case SID_MAIL_EXPORT_FINISHED: { if(pWrtShell) pWrtShell->StartAllAction(); diff --git a/sw/source/ui/app/docshini.cxx b/sw/source/ui/app/docshini.cxx index 4b0e3575a6..f9ee757b23 100644 --- a/sw/source/ui/app/docshini.cxx +++ b/sw/source/ui/app/docshini.cxx @@ -336,6 +336,12 @@ sal_Bool SwDocShell::InitNew( const uno::Reference < embed::XStorage >& xStor ) pColl->SetFmtAttr( aFontHeight ); } } + + // the default for documents created via 'File/New' should be 'on' + // (old documents, where this property was not yet implemented, will get the + // value 'false' in the SwDoc c-tor) + pDoc->set( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT, + SW_MOD()->GetUsrPref( bWeb )->IsAlignMathObjectsToBaseline() ); } /* #106748# If the default frame direction of a document is RTL @@ -823,4 +829,3 @@ void SwDocShell::SubInitNew() IDocumentDeviceAccess* SwDocShell::getIDocumentDeviceAccess() { return pDoc; } const IDocumentSettingAccess* SwDocShell::getIDocumentSettingAccess() const { return pDoc; } IDocumentChartDataProviderAccess* SwDocShell::getIDocumentChartDataProviderAccess() { return pDoc; } - diff --git a/sw/source/ui/app/makefile.mk b/sw/source/ui/app/makefile.mk deleted file mode 100644 index 88f9ff9d63..0000000000 --- a/sw/source/ui/app/makefile.mk +++ /dev/null @@ -1,101 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=app - -LIBTARGET=NO - -# future: DEMO\... - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -# --- Files -------------------------------------------------------- - -SRS1NAME=$(TARGET) -SRC1FILES =\ - app.src \ - mn.src \ - error.src - - -SLOFILES = \ - $(SLO)$/appenv.obj \ - $(SLO)$/apphdl.obj \ - $(SLO)$/applab.obj \ - $(SLO)$/appopt.obj \ - $(SLO)$/docsh.obj \ - $(SLO)$/docsh2.obj \ - $(SLO)$/docshdrw.obj \ - $(SLO)$/docshini.obj \ - $(SLO)$/docst.obj \ - $(SLO)$/docstyle.obj \ - $(SLO)$/mainwn.obj \ - $(SLO)$/swmodule.obj \ - $(SLO)$/swmodul1.obj \ - $(SLO)$/swdll.obj \ - $(SLO)$/swwait.obj - -EXCEPTIONSFILES= \ - $(SLO)$/docsh.obj \ - $(SLO)$/docst.obj \ - $(SLO)$/docshini.obj \ - $(SLO)$/swmodule.obj \ - $(SLO)$/swmodul1.obj \ - $(SLO)$/apphdl.obj \ - $(SLO)$/docsh2.obj - -LIB1TARGET= $(SLB)$/app.lib - -LIB1OBJFILES= \ - $(SLO)$/appenv.obj \ - $(SLO)$/apphdl.obj \ - $(SLO)$/applab.obj \ - $(SLO)$/appopt.obj \ - $(SLO)$/docsh.obj \ - $(SLO)$/docsh2.obj \ - $(SLO)$/docshdrw.obj \ - $(SLO)$/docshini.obj \ - $(SLO)$/docst.obj \ - $(SLO)$/docstyle.obj \ - $(SLO)$/mainwn.obj \ - $(SLO)$/swmodul1.obj \ - $(SLO)$/swwait.obj - - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk - -$(SRS)$/app.srs: $(SOLARINCDIR)$/svx$/globlmn.hrc - diff --git a/sw/source/ui/app/mn.src b/sw/source/ui/app/mn.src index a25143e5fa..efaf278ada 100644 --- a/sw/source/ui/app/mn.src +++ b/sw/source/ui/app/mn.src @@ -25,10 +25,351 @@ * ************************************************************************/ +#include <svx/dialogs.hrc> +#include <svx/globlmn.hrc> +#include "cmdid.h" +#include "app.hrc" +#include "globals.hrc" +#include "helpid.h" +#include "popup.hrc" +/* --------------------- F O R M A T --------------------------------- */ + +#define SEPARATOR MenuItem { Separator = TRUE; } + +//define for ITEM_FORMAT_NUMBERING +#define DEFINE_SLOTID_FOR_NUMBER_BULLETS FN_NUMBER_BULLETS +#define MN_NUMBERING ITEM_FORMAT_NUMBERING + +#define MN_TXT\ + MenuItem\ + {\ + ITEM_FORMAT_CHAR_DLG\ + };\ + MenuItem\ + {\ + ITEM_FORMAT_PARA_DLG\ + };\ + MenuItem\ + {\ + Identifier = FN_FORMAT_PAGE_DLG ; \ + HelpId = CMD_FN_FORMAT_PAGE_DLG ; \ + Text [ en-US ] = "Pa~ge..." ; \ + }; -#include "swmn.hrc" -#include "helpid.h" + +#define MN_TEXT_ATTR\ + MenuItem\ + {\ + ITEM_FORMAT_ATTR_CHAR_FONT\ + };\ + MenuItem\ + {\ + ITEM_FORMAT_ATTR_CHAR_FONTHEIGHT\ + };\ + MenuItem\ + {\ + Identifier = MN_FORMAT_STYLE ; \ + Command = ".uno:StyleMenu" ; \ + Text [ en-US ] = "St~yle" ; \ + SubMenu = Menu\ + {\ + ItemList = \ + {\ + MenuItem\ + {\ + ITEM_FORMAT_ATTR_CHAR_WEIGHT\ + };\ + MenuItem\ + {\ + ITEM_FORMAT_ATTR_CHAR_POSTURE\ + };\ + MenuItem\ + {\ + ITEM_FORMAT_ATTR_CHAR_OVERLINE\ + };\ + MenuItem\ + {\ + ITEM_FORMAT_ATTR_CHAR_UNDERLINE\ + };\ + MenuItem\ + {\ + ITEM_FORMAT_ATTR_CHAR_STRIKEOUT\ + };\ + MenuItem\ + {\ + ITEM_FORMAT_ATTR_CHAR_SHADOWED\ + };\ + MenuItem\ + {\ + ITEM_FORMAT_ATTR_CHAR_CONTOUR\ + };\ + SEPARATOR ; \ + MenuItem\ + {\ + Identifier = FN_SET_SUPER_SCRIPT ; \ + HelpId = CMD_FN_SET_SUPER_SCRIPT ; \ + Text [ en-US ] = "Superscript" ; \ + };\ + MenuItem\ + {\ + Identifier = FN_SET_SUB_SCRIPT ; \ + HelpId = CMD_FN_SET_SUB_SCRIPT ; \ + Text [ en-US ] = "Subscript" ; \ + };\ + };\ + };\ + };\ + MenuItem\ + {\ + Identifier = MN_FORMAT_ALGN ; \ + Command = ".uno:AlignTextMenu" ; \ + Text [ en-US ] = "A~lignment" ; \ + SubMenu = Menu\ + {\ + ItemList = \ + {\ + MenuItem\ + {\ + RadioCheck = TRUE ; \ + ITEM_FORMAT_ATTR_PARA_ADJUST_LEFT\ + };\ + MenuItem\ + {\ + RadioCheck = TRUE ; \ + ITEM_FORMAT_ATTR_PARA_ADJUST_RIGHT\ + };\ + MenuItem\ + {\ + RadioCheck = TRUE ; \ + ITEM_FORMAT_ATTR_PARA_ADJUST_CENTER\ + };\ + MenuItem\ + {\ + Identifier = SID_ATTR_PARA_ADJUST_BLOCK ; \ + HelpId = CMD_SID_ATTR_PARA_ADJUST_BLOCK ; \ + RadioCheck = TRUE ; \ + Text [ en-US ] = "Justified" ; \ + };\ + };\ + };\ + };\ + MenuItem\ + {\ + Identifier = MN_FORMAT_LINESPACE ; \ + Command = ".uno:LineSpacingMenu" ; \ + Text [ en-US ] = "Line Spacing" ; \ + _MenuItemFlags = MIB_RADIOCHECK ; \ + SubMenu = Menu\ + {\ + ItemList = \ + {\ + MenuItem\ + {\ + RadioCheck = TRUE ; \ + ITEM_FORMAT_PARA_LINESPACE_10\ + };\ + MenuItem\ + {\ + RadioCheck = TRUE ; \ + ITEM_FORMAT_PARA_LINESPACE_15\ + };\ + MenuItem\ + {\ + RadioCheck = TRUE ; \ + ITEM_FORMAT_PARA_LINESPACE_20\ + };\ + };\ + };\ + }; + +/* --------------------- M E N U --------------------------------- */ + +/* + + +The application menu bar resource has become obsolete. You can now find the menu bar at the following +location: <project>/uiconfig/[swriter|sweb|sglobal]/menubar/menubar.xml + + +*/ + +/* --------------------- D O C U M E N T -------------------------- */ + + +#define _MN_EDIT_FIELD \ + MenuItem \ + { \ + Identifier = FN_EDIT_FIELD ; \ + HelpId = CMD_FN_EDIT_FIELD ; \ + Text [ en-US ] = "Fields..." ; \ + }; +#define _MN_EDIT_FOOTNOTE \ + MenuItem \ + { \ + Identifier = FN_EDIT_FOOTNOTE ; \ + HelpId = CMD_FN_EDIT_FOOTNOTE ; \ + Text [ en-US ] = "Footnote/Endnote~..." ; \ + }; + #define _MN_EDIT_IDX_ENTRY_DLG \ + MenuItem \ + { \ + Identifier = FN_EDIT_IDX_ENTRY_DLG ; \ + HelpId = CMD_FN_EDIT_IDX_ENTRY_DLG ; \ + Text [ en-US ] = "Inde~x Entry..." ; \ + }; + +#define _MN_EDIT_REDLINE \ + MenuItem \ + { \ + Identifier = FN_REDLINE_ACCEPT_DIRECT; \ + HelpId = CMD_FN_REDLINE_ACCEPT_DIRECT ; \ + Text [ en-US ] = "Accept Change" ; \ + };\ + MenuItem \ + { \ + Identifier = FN_REDLINE_REJECT_DIRECT ; \ + HelpId = CMD_FN_REDLINE_REJECT_DIRECT ; \ + Text [ en-US ] = "Reject Change" ; \ + }; \ + SEPARATOR ; +#define _MN_EDIT_BIB_ENTRY_DLG \ + MenuItem \ + { \ + Identifier = FN_EDIT_AUTH_ENTRY_DLG ; \ + HelpId = CMD_FN_EDIT_AUTH_ENTRY_DLG ; \ + Text [ en-US ] = "~Bibliography Entry..."; \ + }; \ + SEPARATOR ; + +#define _MN_EDIT_OPEN_HYPERLINK \ + MenuItem \ + { \ + ITEM_OPEN_HYPERLINK \ + };\ + MenuItem \ + { \ + Identifier = FN_EDIT_HYPERLINK ; \ + HelpId = CMD_FN_EDIT_HYPERLINK ; \ + Text [ en-US ] = "Edit Hyperlink..."; \ + }; \ + MenuItem \ + { \ + Identifier = FN_COPY_HYPERLINK_LOCATION; \ + HelpId = CMD_FN_COPY_HYPERLINK_LOCATION; \ + Text [ en-US ] = "Copy Hyperlink ~Location"; \ + }; \ + MenuItem \ + { \ + Identifier = FN_REMOVE_HYPERLINK ; \ + HelpId = CMD_FN_REMOVE_HYPERLINK ; \ + Text [ en-US ] = "Remo~ve Hyperlink"; \ + }; + +#define _MN_EDIT_OPEN_SMARTTAGMENU \ + MenuItem \ + { \ + ITEM_OPEN_SMARTTAGMENU \ + }; + +#define _MN_EDIT__HYPERLINK \ + MenuItem\ + {\ + Identifier = FN_EDIT_HYPERLINK ; \ + HelpId = CMD_FN_EDIT_HYPERLINK ; \ + Text [ en-US ] = "~Edit Hyperlink" ; \ + }; + +#define _DEFAULT_TEXT_EDIT_ELEMENTS \ + _MN_EDIT_FIELD \ + _MN_EDIT_FOOTNOTE \ + _MN_EDIT_IDX_ENTRY_DLG \ + _MN_EDIT_BIB_ENTRY_DLG \ + _MN_EDIT_REDLINE \ + MenuItem \ + { \ + ITEM_POPUP_TEMPLATE_EDIT \ + }; \ + SEPARATOR ; \ + _MN_EDIT_OPEN_HYPERLINK \ + _MN_EDIT_OPEN_SMARTTAGMENU + + +#define MN_RESET\ + MenuItem\ + {\ + Identifier = FN_FORMAT_RESET ; \ + HelpId = CMD_FN_FORMAT_RESET ; \ + Text [ en-US ] = "~Default Formatting" ; \ + }; + +#define _NUMBERING_RELATED_MENU \ + SEPARATOR ; \ + MenuItem \ + { \ + Identifier = FN_NUMBER_NEWSTART; \ + HelpId = CMD_FN_NUMBER_NEWSTART; \ + Text[ en-US ] = "Restart Numbering"; \ + }; \ + MenuItem \ + { \ + Identifier = FN_NUM_CONTINUE; \ + HelpId = CMD_FN_NUM_CONTINUE; \ + Text[ en-US ] = "Continue previous numbering"; \ + }; \ + MenuItem \ + { \ + Identifier = FN_NUM_BULLET_UP; \ + HelpId = CMD_FN_NUM_BULLET_UP; \ + Text[ en-US ] = "Up One Level"; \ + }; \ + MenuItem \ + { \ + Identifier = FN_NUM_BULLET_DOWN; \ + HelpId = CMD_FN_NUM_BULLET_DOWN; \ + Text[ en-US ] = "Down One Level"; \ + }; + +#define BASE_TEXT_POPUPMENU_BEGIN \ +{ \ + ItemList = \ + { \ + MN_RESET \ + _NUMBERING_RELATED_MENU \ + SEPARATOR ; \ + MN_TEXT_ATTR \ + SEPARATOR ; \ + MN_TXT \ + MN_NUMBERING \ + ITEM_TRANSLITERATE_MENU \ + SEPARATOR ; + +// not in Writer/Web +#define BASE_TEXT_POPUPMENU_NOWEB \ + MenuItem \ + { \ + Identifier = FN_UPDATE_CUR_TOX ; \ + HelpId = CMD_FN_UPDATE_CUR_TOX ; \ + Text [ en-US ] = "~Update Index/Table"; \ + }; \ + MenuItem \ + { \ + Identifier = FN_EDIT_CURRENT_TOX; \ + HelpId = CMD_FN_EDIT_CURRENT_TOX; \ + Text [ en-US ] = "~Edit Index/Table"; \ + }; \ + MenuItem \ + { \ + Identifier = FN_REMOVE_CUR_TOX; \ + HelpId = CMD_FN_REMOVE_CUR_TOX; \ + Text [ en-US ] = "Delete Index/Table"; \ + }; \ + SEPARATOR ; + +#define BASE_TEXT_POPUPMENU_END \ + _DEFAULT_TEXT_EDIT_ELEMENTS \ + }; \ +}; /*------------------------------------------------------------------------ Beschreibung: Menu Window @@ -430,14 +771,14 @@ MenuItem\ {\ Identifier = FN_REPLY ;\ - HelpId = CMD_FN_DELETE_NOTE ;\ + HelpID = CMD_FN_REPLY ;\ Text [ en-US ] = "Reply" ;\ };\ SEPARATOR ; \ MenuItem\ {\ - Identifier = FN_DELETE_NOTE ;\ - HelpId = CMD_FN_DELETE_NOTE ;\ + Identifier = FN_DELETE_COMMENT ;\ + HelpID = CMD_FN_DELETE_COMMENT ;\ Text [ en-US ] = "Delete ~Comment" ;\ };\ MenuItem\ diff --git a/sw/source/ui/cctrl/makefile.mk b/sw/source/ui/cctrl/makefile.mk deleted file mode 100644 index 33ba83f34d..0000000000 --- a/sw/source/ui/cctrl/makefile.mk +++ /dev/null @@ -1,59 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=cctrl - -AUTOSEG=true - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -# --- Files -------------------------------------------------------- - -CXXFILES = \ - actctrl.cxx \ - popbox.cxx \ - swlbox.cxx - -SLOFILES = \ - $(SLO)$/actctrl.obj \ - $(SLO)$/popbox.obj \ - $(SLO)$/swlbox.obj - -EXCEPTIONSFILES = \ - $(SLO)$/popbox.obj - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/ui/chrdlg/break.cxx b/sw/source/ui/chrdlg/break.cxx index fbc2e0cd8c..ce476cebed 100644 --- a/sw/source/ui/chrdlg/break.cxx +++ b/sw/source/ui/chrdlg/break.cxx @@ -200,7 +200,7 @@ SwBreakDlg::SwBreakDlg( Window *pParent, SwWrtShell &rS ) : } String aFmtName; - for(i = RES_POOLPAGE_BEGIN; i <= RES_POOLPAGE_REGISTER; ++i) + for(i = RES_POOLPAGE_BEGIN; i < RES_POOLPAGE_END; ++i) if(LISTBOX_ENTRY_NOTFOUND == aPageCollBox.GetEntryPos( aFmtName = SwStyleNameMapper::GetUIName( i, aFmtName ))) ::InsertStringSorted(aFmtName, aPageCollBox, 1 ); diff --git a/sw/source/ui/chrdlg/makefile.mk b/sw/source/ui/chrdlg/makefile.mk deleted file mode 100644 index 6b05d0fbfb..0000000000 --- a/sw/source/ui/chrdlg/makefile.mk +++ /dev/null @@ -1,72 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=chrdlg -LIBTARGET=NO - -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -# --- Files -------------------------------------------------------- - -SRS1NAME=$(TARGET) -SRC1FILES = \ - swbreak.src \ - chardlg.src \ - chrdlg.src \ - drpcps.src \ - ccoll.src \ - paradlg.src \ - numpara.src - -SLOFILES = \ - $(SLO)$/break.obj \ - $(SLO)$/chardlg.obj \ - $(SLO)$/drpcps.obj \ - $(SLO)$/ccoll.obj \ - $(SLO)$/swuiccoll.obj \ - $(SLO)$/pardlg.obj \ - $(SLO)$/tblnumfm.obj \ - $(SLO)$/numpara.obj - -LIB1TARGET = $(SLB)$/$(TARGET).lib - -LIB1OBJFILES = \ - $(SLO)$/ccoll.obj - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/ui/chrdlg/swuiccoll.cxx b/sw/source/ui/chrdlg/swuiccoll.cxx index 7fb20bf3f8..f5e8c1e4ef 100644 --- a/sw/source/ui/chrdlg/swuiccoll.cxx +++ b/sw/source/ui/chrdlg/swuiccoll.cxx @@ -109,7 +109,7 @@ SwCondCollPage::SwCondCollPage(Window *pParent, const SfxItemSet &rSet) aStyleLB.SetSelectHdl( LINK(this, SwCondCollPage, SelectHdl)); aFilterLB.SetSelectHdl( LINK(this, SwCondCollPage, SelectHdl)); - aTbLinks.SetWindowBits(WB_HSCROLL|WB_CLIPCHILDREN); + aTbLinks.SetStyle(aTbLinks.GetStyle()|WB_HSCROLL|WB_CLIPCHILDREN); aTbLinks.SetSelectionMode( SINGLE_SELECTION ); aTbLinks.SetTabs( &nTabs[0], MAP_APPFONT ); aTbLinks.Resize(); // OS: Hack fuer richtige Selektion diff --git a/sw/source/ui/config/cfgitems.cxx b/sw/source/ui/config/cfgitems.cxx index 352819a184..6fa2666579 100644 --- a/sw/source/ui/config/cfgitems.cxx +++ b/sw/source/ui/config/cfgitems.cxx @@ -458,4 +458,3 @@ int SwTestItem::operator==( const SfxPoolItem& rAttr ) const #endif - diff --git a/sw/source/ui/config/mailconfigpage.cxx b/sw/source/ui/config/mailconfigpage.cxx index e8752bd08f..c48a8b64fe 100644 --- a/sw/source/ui/config/mailconfigpage.cxx +++ b/sw/source/ui/config/mailconfigpage.cxx @@ -330,7 +330,7 @@ SwTestAccountSettingsDialog::SwTestAccountSettingsDialog(SwMailConfigPage* pPare m_aStatusLB.SetHelpId(HID_MM_TESTACCOUNTSETTINGS_TLB); static long nTabs[] = {2, 0, aSz.Width()/2 }; - m_aStatusLB.SetWindowBits( WB_SORT | WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP ); + m_aStatusLB.SetStyle( m_aStatusLB.GetStyle() | WB_SORT | WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP ); m_aStatusLB.SetSelectionMode( SINGLE_SELECTION ); m_aStatusLB.SetTabs(&nTabs[0], MAP_PIXEL); short nEntryHeight = m_aStatusLB.GetEntryHeight(); diff --git a/sw/source/ui/config/makefile.mk b/sw/source/ui/config/makefile.mk deleted file mode 100644 index 4b8ed01ca9..0000000000 --- a/sw/source/ui/config/makefile.mk +++ /dev/null @@ -1,87 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=config -LIBTARGET=NO -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -# --- Files -------------------------------------------------------- -IMGLST_SRS=$(SRS)$/config.srs -BMP_IN=$(PRJ)$/win/imglst - -SRS1NAME=$(TARGET) -SRC1FILES = \ - mailconfigpage.src \ - optdlg.src \ - optload.src \ - optcomp.src \ - redlopt.src - -EXCEPTIONSFILES = \ - $(SLO)$/mailconfigpage.obj \ - $(SLO)$/optcomp.obj \ - $(SLO)$/optload.obj - -SLOFILES = \ - $(EXCEPTIONSFILES) \ - $(SLO)$/barcfg.obj \ - $(SLO)$/caption.obj \ - $(SLO)$/cfgitems.obj \ - $(SLO)$/dbconfig.obj \ - $(SLO)$/fontcfg.obj \ - $(SLO)$/modcfg.obj \ - $(SLO)$/optpage.obj \ - $(SLO)$/prtopt.obj \ - $(SLO)$/uinums.obj \ - $(SLO)$/usrpref.obj \ - $(SLO)$/viewopt.obj - -LIB1TARGET= $(SLB)$/$(TARGET).lib - -LIB1OBJFILES = \ - $(SLO)$/barcfg.obj \ - $(SLO)$/caption.obj \ - $(SLO)$/cfgitems.obj \ - $(SLO)$/dbconfig.obj \ - $(SLO)$/fontcfg.obj \ - $(SLO)$/modcfg.obj \ - $(SLO)$/prtopt.obj \ - $(SLO)$/uinums.obj \ - $(SLO)$/usrpref.obj \ - $(SLO)$/viewopt.obj - -# --- Targets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/ui/config/optcomp.cxx b/sw/source/ui/config/optcomp.cxx index 53603031e1..0dbd938359 100644 --- a/sw/source/ui/config/optcomp.cxx +++ b/sw/source/ui/config/optcomp.cxx @@ -152,7 +152,7 @@ SwCompatibilityOptPage::SwCompatibilityOptPage( Window* pParent, const SfxItemSe pEntry->SetUserData( (void*)(ULONG)nResId ); } } - m_aOptionsLB.SetWindowBits( m_aOptionsLB.GetStyle() | WB_HSCROLL | WB_HIDESELECTION ); + m_aOptionsLB.SetStyle( m_aOptionsLB.GetStyle() | WB_HSCROLL | WB_HIDESELECTION ); m_aOptionsLB.SetHighlightRange(); FreeResource(); diff --git a/sw/source/ui/config/optdlg.hrc b/sw/source/ui/config/optdlg.hrc index 31f2e7041f..d58d1b6ac4 100644 --- a/sw/source/ui/config/optdlg.hrc +++ b/sw/source/ui/config/optdlg.hrc @@ -30,7 +30,7 @@ #define FL_NOPRINT 2 #define FL_WINDOW 3 -#define CB_GRF 1 +#define CB_GRF 1 #define CB_TBL 2 #define CB_DRWFAST 3 #define CB_FIELD 4 @@ -39,10 +39,10 @@ #define CB_SPACE 7 #define CB_HSPACE 8 #define CB_SHYPH 9 -#define CB_FLD_HIDDEN 10 +#define CB_FLD_HIDDEN 10 #define CB_BREAK 11 #define CB_ANY_RULER 12 -#define CB_CROSS 14 +#define CB_CROSS 14 #define CB_HSCROLL 15 #define CB_VSCROLL 16 #define CB_HRULER 17 @@ -50,7 +50,7 @@ #define FL_LINE 22 #define CB_POSTIT 23 #define CB_VRULER_RIGHT 24 -#define CB_BIGHANDLE 25 +#define CB_BIGHANDLE 25 #define FL_SETTINGS 26 #define LB_METRIC 27 @@ -191,7 +191,7 @@ #define FL_TABLE_SEPARATOR 139 #define CB_PROSPECT_RTL 140 -#define FL_SHDWCRSFLAG 1 +#define FL_SHDWCRSFLAG 1 #define CB_SHDWCRSONOFF 2 #define FL_SHDWCRSMODE 3 #define FT_SHDWCRSFILLMODE 4 @@ -201,5 +201,8 @@ #define RB_SHDWCRSFILLSPACE 8 #define CB_ALLOW_IN_PROT 12 #define FL_CRSR_OPT 13 -#define FL_SEPARATOR_SHDW 14 +#define FL_SEPARATOR_SHDW 14 +#define FL_LAYOUT_OPTIONS 15 +#define CB_MATH_BASELINE_ALIGNMENT 16 + diff --git a/sw/source/ui/config/optdlg.src b/sw/source/ui/config/optdlg.src index 9f7b76401b..bd7133612a 100644 --- a/sw/source/ui/config/optdlg.src +++ b/sw/source/ui/config/optdlg.src @@ -1021,6 +1021,18 @@ TabPage TP_OPTSHDWCRSR Group = TRUE ; Text [ en-US ] = "Enable"; }; + FixedLine FL_LAYOUT_OPTIONS + { + Pos = MAP_APPFONT ( 6 , 133 ) ; + Size = MAP_APPFONT ( 118 , 8 ) ; + Text [ en-US ] = "Layout assistance"; + }; + CheckBox CB_MATH_BASELINE_ALIGNMENT + { + Pos = MAP_APPFONT ( 12 , 144 ) ; + Size = MAP_APPFONT ( 236 , 10 ) ; + Text [ en-US ] = "Math baseline alignment"; + }; }; diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx index 9907d16191..126cc68852 100644 --- a/sw/source/ui/config/optpage.cxx +++ b/sw/source/ui/config/optpage.cxx @@ -32,22 +32,15 @@ #undef SW_DLLIMPLEMENTATION #endif -#include <hintids.hxx> -#include <cmdid.h> -#include <vcl/svapp.hxx> +#ifndef _SVSTDARR_HXX #define _SVSTDARR_STRINGSDTOR #include <svl/svstdarr.hxx> -#include <svl/cjkoptions.hxx> -#include <svtools/ctrltool.hxx> -#include <svl/eitem.hxx> -#include <svx/htmlmode.hxx> -#include <sfx2/printer.hxx> -#include <sfx2/bindings.hxx> -#include <svx/xtable.hxx> -#include <editeng/fhgtitem.hxx> -#include <editeng/fontitem.hxx> -#include <editeng/langitem.hxx> -#include <svx/dlgutil.hxx> +#endif + +#include <optpage.hxx> +#include <doc.hxx> +#include <hintids.hxx> +#include <cmdid.h> #include <fmtcol.hxx> #include <charatr.hxx> #include <swtypes.hxx> @@ -57,11 +50,10 @@ #include <swmodule.hxx> #include <wrtsh.hxx> #include <uitool.hxx> -#include <cfgitems.hxx> //Items fuer Sw-Seiten +#include <cfgitems.hxx> #include <poolfmt.hxx> #include <uiitems.hxx> #include <initui.hxx> -#include <optpage.hxx> #include <printdata.hxx> #include <modcfg.hxx> #include <srcview.hxx> @@ -71,13 +63,26 @@ #include <config.hrc> #include <redlopt.hrc> #include <optdlg.hrc> -#include <svx/strarray.hxx> -#include <svl/slstitm.hxx> -#include <sfx2/request.hxx> #include <swwrtshitem.hxx> +#include <unomid.h> + +#include <editeng/fhgtitem.hxx> +#include <editeng/fontitem.hxx> +#include <editeng/langitem.hxx> +#include <sfx2/request.hxx> +#include <sfx2/printer.hxx> +#include <sfx2/bindings.hxx> +#include <svl/slstitm.hxx> #include <svl/ctloptions.hxx> +#include <svl/eitem.hxx> +#include <svl/cjkoptions.hxx> +#include <svtools/ctrltool.hxx> +#include <svx/htmlmode.hxx> +#include <svx/xtable.hxx> +#include <svx/dlgutil.hxx> +#include <svx/strarray.hxx> +#include <vcl/svapp.hxx> -#include <unomid.h> using namespace ::com::sun::star; @@ -1488,6 +1493,7 @@ IMPL_LINK(SwTableOptionsTabPage, CheckBoxHdl, CheckBox*, EMPTYARG) aRepeatHeaderCB.Enable(aHeaderCB.IsChecked()); return 0; } + void SwTableOptionsTabPage::PageCreated (SfxAllItemSet aSet) { SFX_ITEMSET_ARG (&aSet,pWrtSh,SwWrtShellItem,SID_WRT_SHELL,sal_False); @@ -1525,15 +1531,17 @@ SwShdwCrsrOptionsTabPage::SwShdwCrsrOptionsTabPage( Window* pParent, aFillTabRB( this, SW_RES( RB_SHDWCRSFILLTAB )), aFillSpaceRB( this, SW_RES( RB_SHDWCRSFILLSPACE )), aCrsrOptFL ( this, SW_RES( FL_CRSR_OPT)), - aCrsrInProtCB( this, SW_RES( CB_ALLOW_IN_PROT )) + aCrsrInProtCB( this, SW_RES( CB_ALLOW_IN_PROT )), + m_aLayoutOptionsFL( this, SW_RES( FL_LAYOUT_OPTIONS ) ), + m_aMathBaselineAlignmentCB( this, SW_RES( CB_MATH_BASELINE_ALIGNMENT ) ), + m_pWrtShell( NULL ) { FreeResource(); const SfxPoolItem* pItem = 0; - SwShadowCursorItem aOpt; + SwShadowCursorItem aOpt; if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_SHADOWCURSOR, FALSE, &pItem )) aOpt = *(SwShadowCursorItem*)pItem; - aOnOffCB.Check( aOpt.IsOn() ); BYTE eMode = aOpt.GetMode(); @@ -1578,6 +1586,15 @@ SfxTabPage* SwShdwCrsrOptionsTabPage::Create( Window* pParent, const SfxItemSet& return new SwShdwCrsrOptionsTabPage( pParent, rSet ); } + +void SwShdwCrsrOptionsTabPage::PageCreated( SfxAllItemSet aSet ) +{ + SFX_ITEMSET_ARG (&aSet,pWrtSh,SwWrtShellItem,SID_WRT_SHELL,sal_False); + if (pWrtSh) + SetWrtShell(pWrtSh->GetValue()); +} + + BOOL SwShdwCrsrOptionsTabPage::FillItemSet( SfxItemSet& rSet ) { SwShadowCursorItem aOpt; @@ -1603,6 +1620,10 @@ BOOL SwShdwCrsrOptionsTabPage::FillItemSet( SfxItemSet& rSet ) bRet = TRUE; } + m_pWrtShell->GetDoc()->set( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT, + m_aMathBaselineAlignmentCB.IsChecked() ); + bRet |= m_aMathBaselineAlignmentCB.IsChecked() != m_aMathBaselineAlignmentCB.GetSavedValue(); + if( aCrsrInProtCB.IsChecked() != aCrsrInProtCB.GetSavedValue()) { rSet.Put(SfxBoolItem(FN_PARAM_CRSR_IN_PROTECTED, aCrsrInProtCB.IsChecked())); @@ -1636,11 +1657,10 @@ BOOL SwShdwCrsrOptionsTabPage::FillItemSet( SfxItemSet& rSet ) void SwShdwCrsrOptionsTabPage::Reset( const SfxItemSet& rSet ) { const SfxPoolItem* pItem = 0; - SwShadowCursorItem aOpt; + SwShadowCursorItem aOpt; if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_SHADOWCURSOR, FALSE, &pItem )) aOpt = *(SwShadowCursorItem*)pItem; - aOnOffCB.Check( aOpt.IsOn() ); BYTE eMode = aOpt.GetMode(); @@ -1649,6 +1669,9 @@ void SwShdwCrsrOptionsTabPage::Reset( const SfxItemSet& rSet ) aFillTabRB.Check( FILL_TAB == eMode ); aFillSpaceRB.Check( FILL_SPACE == eMode ); + m_aMathBaselineAlignmentCB.Check( m_pWrtShell->GetDoc()->get( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT ) ); + m_aMathBaselineAlignmentCB.SaveValue(); + if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_CRSR_IN_PROTECTED, FALSE, &pItem )) aCrsrInProtCB.Check(((const SfxBoolItem*)pItem)->GetValue()); aCrsrInProtCB.SaveValue(); @@ -2593,4 +2616,3 @@ IMPL_LINK_INLINE_END( SwTestTabPage, AutoClickHdl, CheckBox *, EMPTYARG ) #endif - diff --git a/sw/source/ui/config/usrpref.cxx b/sw/source/ui/config/usrpref.cxx index 2571361b6d..46cd317ed1 100644 --- a/sw/source/ui/config/usrpref.cxx +++ b/sw/source/ui/config/usrpref.cxx @@ -245,27 +245,29 @@ Sequence<OUString> SwLayoutViewConfig::GetPropertyNames() { static const char* aPropNames[] = { - "Line/Guide", // 0 - "Line/SimpleControlPoint", // 1 - "Line/LargeControlPoint", // 2 - "Window/HorizontalScroll", // 3 - "Window/VerticalScroll", // 4 - "Window/ShowRulers", // 5 - "Window/HorizontalRuler", // 6 - "Window/VerticalRuler", // 7 - "Window/HorizontalRulerUnit", // 8 - "Window/VerticalRulerUnit", // 9 - "Window/SmoothScroll", //10 - "Zoom/Value", //11 - "Zoom/Type", //12 - "Other/MeasureUnit", //13 - "Other/TabStop", //14 - "Window/IsVerticalRulerRight", //15 - "ViewLayout/Columns", //16 - "ViewLayout/BookMode", //17 - "Other/IsSquaredPageMode" //18 + "Line/Guide", // 0 + "Line/SimpleControlPoint", // 1 + "Line/LargeControlPoint", // 2 + "Window/HorizontalScroll", // 3 + "Window/VerticalScroll", // 4 + "Window/ShowRulers", // 5 + "Window/HorizontalRuler", // 6 + "Window/VerticalRuler", // 7 + "Window/HorizontalRulerUnit", // 8 + "Window/VerticalRulerUnit", // 9 + "Window/SmoothScroll", //10 + "Zoom/Value", //11 + "Zoom/Type", //12 + "Other/IsAlignMathObjectsToBaseline", //13 + "Other/MeasureUnit", //14 + // below properties are not available in WriterWeb + "Other/TabStop", //15 + "Window/IsVerticalRulerRight", //16 + "ViewLayout/Columns", //17 + "ViewLayout/BookMode", //18 + "Other/IsSquaredPageMode" //19 }; - const int nCount = bWeb ? 14 : 19; + const int nCount = bWeb ? 15 : 20; Sequence<OUString> aNames(nCount); OUString* pNames = aNames.getArray(); for(int i = 0; i < nCount; i++) @@ -302,39 +304,38 @@ void SwLayoutViewConfig::Commit() for(int nProp = 0; nProp < aNames.getLength(); nProp++) { - sal_Bool bSet; + Any &rVal = pValues[nProp]; switch(nProp) { - case 0: bSet = rParent.IsCrossHair(); break;// "Line/Guide", - case 1: bSet = rParent.IsSolidMarkHdl(); break;// "Line/SimpleControlPoint", - case 2: bSet = rParent.IsBigMarkHdl(); break;// "Line/LargeControlPoint", - case 3: bSet = rParent.IsViewHScrollBar(); break;// "Window/HorizontalScroll", - case 4: bSet = rParent.IsViewVScrollBar(); break;// "Window/VerticalScroll", - case 5: bSet = rParent.IsViewAnyRuler(); break; // "Window/ShowRulers" + case 0: rVal <<= (sal_Bool) rParent.IsCrossHair(); break; // "Line/Guide", + case 1: rVal <<= (sal_Bool) rParent.IsSolidMarkHdl(); break; // "Line/SimpleControlPoint", + case 2: rVal <<= (sal_Bool) rParent.IsBigMarkHdl(); break; // "Line/LargeControlPoint", + case 3: rVal <<= (sal_Bool) rParent.IsViewHScrollBar(); break; // "Window/HorizontalScroll", + case 4: rVal <<= (sal_Bool) rParent.IsViewVScrollBar(); break; // "Window/VerticalScroll", + case 5: rVal <<= (sal_Bool) rParent.IsViewAnyRuler(); break; // "Window/ShowRulers" // #i14593# use IsView*Ruler(TRUE) instead of IsView*Ruler() // this preserves the single ruler states even if "Window/ShowRulers" is off - case 6: bSet = rParent.IsViewHRuler(TRUE); break;// "Window/HorizontalRuler", - case 7: bSet = rParent.IsViewVRuler(TRUE); break;// "Window/VerticalRuler", + case 6: rVal <<= (sal_Bool) rParent.IsViewHRuler(TRUE); break; // "Window/HorizontalRuler", + case 7: rVal <<= (sal_Bool) rParent.IsViewVRuler(TRUE); break; // "Window/VerticalRuler", case 8: if(rParent.bIsHScrollMetricSet) - pValues[nProp] <<= (sal_Int32)rParent.eHScrollMetric; // "Window/HorizontalRulerUnit" + rVal <<= (sal_Int32)rParent.eHScrollMetric; // "Window/HorizontalRulerUnit" break; case 9: if(rParent.bIsVScrollMetricSet) - pValues[nProp] <<= (sal_Int32)rParent.eVScrollMetric; // "Window/VerticalRulerUnit" + rVal <<= (sal_Int32)rParent.eVScrollMetric; // "Window/VerticalRulerUnit" break; - case 10: bSet = rParent.IsSmoothScroll(); break;// "Window/SmoothScroll", - case 11: pValues[nProp] <<= (sal_Int32)rParent.GetZoom(); break;// "Zoom/Value", - case 12: pValues[nProp] <<= (sal_Int32)rParent.GetZoomType(); break;// "Zoom/Type", - case 13: pValues[nProp] <<= (sal_Int32)rParent.GetMetric(); break;// "Other/MeasureUnit", - case 14: pValues[nProp] <<= static_cast<sal_Int32>(TWIP_TO_MM100(rParent.GetDefTab())); break;// "Other/TabStop", - case 15: bSet = rParent.IsVRulerRight(); break;// "Window/IsVerticalRulerRight", - case 16: pValues[nProp] <<= (sal_Int32)rParent.GetViewLayoutColumns(); break;// "ViewLayout/Columns", - case 17: bSet = rParent.IsViewLayoutBookMode(); break;// "ViewLayout/BookMode", - case 18: bSet = rParent.IsSquaredPageMode(); break;// "Other/IsSquaredPageMode", + case 10: rVal <<= (sal_Bool) rParent.IsSmoothScroll(); break; // "Window/SmoothScroll", + case 11: rVal <<= (sal_Int32)rParent.GetZoom(); break; // "Zoom/Value", + case 12: rVal <<= (sal_Int32)rParent.GetZoomType(); break; // "Zoom/Type", + case 13: rVal <<= (sal_Bool) rParent.IsAlignMathObjectsToBaseline(); break; // "Other/IsAlignMathObjectsToBaseline" + case 14: rVal <<= (sal_Int32)rParent.GetMetric(); break; // "Other/MeasureUnit", + case 15: rVal <<= static_cast<sal_Int32>(TWIP_TO_MM100(rParent.GetDefTab())); break;// "Other/TabStop", + case 16: rVal <<= (sal_Bool) rParent.IsVRulerRight(); break; // "Window/IsVerticalRulerRight", + case 17: rVal <<= (sal_Int32)rParent.GetViewLayoutColumns(); break; // "ViewLayout/Columns", + case 18: rVal <<= (sal_Bool) rParent.IsViewLayoutBookMode(); break; // "ViewLayout/BookMode", + case 19: rVal <<= (sal_Bool) rParent.IsSquaredPageMode(); break; // "Other/IsSquaredPageMode", } - if(nProp < 8 || nProp == 10 || nProp == 15 || nProp == 17 || nProp == 18 ) - pValues[nProp].setValue(&bSet, ::getBooleanCppuType()); } PutProperties(aNames, aValues); } @@ -353,7 +354,11 @@ void SwLayoutViewConfig::Load() { if(pValues[nProp].hasValue()) { - sal_Bool bSet = nProp < 8 || nProp == 10 || nProp == 17 || nProp == 18 ? *(sal_Bool*)pValues[nProp].getValue() : sal_False; + sal_Int32 nInt32Val = 0; + sal_Bool bSet = sal_False; + pValues[nProp] >>= nInt32Val; + pValues[nProp] >>= bSet; + switch(nProp) { case 0: rParent.SetCrossHair(bSet); break;// "Line/Guide", @@ -367,58 +372,25 @@ void SwLayoutViewConfig::Load() case 8: { rParent.bIsHScrollMetricSet = sal_True; - sal_Int32 nUnit = 0; - pValues[nProp] >>= nUnit; - rParent.eHScrollMetric = ((FieldUnit)nUnit); // "Window/HorizontalRulerUnit" + rParent.eHScrollMetric = ((FieldUnit)nInt32Val); // "Window/HorizontalRulerUnit" } break; case 9: { rParent.bIsVScrollMetricSet = sal_True; - sal_Int32 nUnit = 0; - pValues[nProp] >>= nUnit; - rParent.eVScrollMetric = ((FieldUnit)nUnit); // "Window/VerticalRulerUnit" + rParent.eVScrollMetric = ((FieldUnit)nInt32Val); // "Window/VerticalRulerUnit" } break; case 10: rParent.SetSmoothScroll(bSet); break;// "Window/SmoothScroll", - case 11: - { - sal_Int32 nVal = 0; - pValues[nProp] >>= nVal; - rParent.SetZoom( static_cast< USHORT >(nVal) ); - } - break;// "Zoom/Value", - case 12: - { - sal_Int32 nVal = 0; - pValues[nProp] >>= nVal; - rParent.SetZoomType( static_cast< SvxZoomType >(nVal) ); - } - break;// "Zoom/Type", - case 13: - { - sal_Int32 nUnit = 0; - pValues[nProp] >>= nUnit; - rParent.SetMetric((FieldUnit)nUnit, TRUE); - } - break;// "Other/MeasureUnit", - case 14: - { - sal_Int32 nTab = 0; - pValues[nProp] >>= nTab; - rParent.SetDefTab(MM100_TO_TWIP(nTab), TRUE); - } - break;// "Other/TabStop", - case 15: rParent.SetVRulerRight(bSet); break;// "Window/IsVerticalRulerRight", - case 16: - { - sal_Int32 nColumns = 0; - pValues[nProp] >>= nColumns; - rParent.SetViewLayoutColumns( static_cast<USHORT>(nColumns) ); - } - break;// "ViewLayout/Columns", - case 17: rParent.SetViewLayoutBookMode(bSet); break;// "ViewLayout/BookMode", - case 18: rParent.SetDefaultPageMode(bSet,TRUE); break;// "Other/IsSquaredPageMode", + case 11: rParent.SetZoom( static_cast< USHORT >(nInt32Val) ); break;// "Zoom/Value", + case 12: rParent.SetZoomType( static_cast< SvxZoomType >(nInt32Val) ); break;// "Zoom/Type", + case 13: rParent.SetAlignMathObjectsToBaseline(bSet); break;// "Other/IsAlignMathObjectsToBaseline" + case 14: rParent.SetMetric((FieldUnit)nInt32Val, TRUE); break;// "Other/MeasureUnit", + case 15: rParent.SetDefTab(MM100_TO_TWIP(nInt32Val), TRUE); break;// "Other/TabStop", + case 16: rParent.SetVRulerRight(bSet); break;// "Window/IsVerticalRulerRight", + case 17: rParent.SetViewLayoutColumns( static_cast<USHORT>(nInt32Val) ); break;// "ViewLayout/Columns", + case 18: rParent.SetViewLayoutBookMode(bSet); break;// "ViewLayout/BookMode", + case 19: rParent.SetDefaultPageMode(bSet,TRUE); break;// "Other/IsSquaredPageMode", } } } diff --git a/sw/source/ui/dbui/addresslistdialog.cxx b/sw/source/ui/dbui/addresslistdialog.cxx index c543cf702c..4ddc467655 100644 --- a/sw/source/ui/dbui/addresslistdialog.cxx +++ b/sw/source/ui/dbui/addresslistdialog.cxx @@ -219,7 +219,7 @@ SwAddressListDialog::SwAddressListDialog(SwMailMergeAddressBlockPage* pParent) : m_aListLB.SetHelpId(HID_MM_ADDRESSLIST_TLB); static long nTabs[] = {2, 0, aSz.Width()/2 }; - m_aListLB.SetWindowBits( WB_SORT | WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP ); + m_aListLB.SetStyle( m_aListLB.GetStyle() | WB_SORT | WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP ); m_aListLB.SetSelectionMode( SINGLE_SELECTION ); m_aListLB.SetTabs(&nTabs[0], MAP_PIXEL); m_aOK.SetClickHdl( LINK( this, SwAddressListDialog, OKHdl_Impl)); diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx index 4a3b133798..052b48ba71 100644 --- a/sw/source/ui/dbui/dbmgr.cxx +++ b/sw/source/ui/dbui/dbmgr.cxx @@ -134,6 +134,7 @@ #include <memory> #include <vector> #include <unomid.h> +#include <section.hxx> using namespace ::osl; using namespace ::svx; @@ -842,6 +843,23 @@ void lcl_CopyFollowPageDesc( } } +void lcl_RemoveSectionLinks( SwWrtShell& rWorkShell ) +{ + //reset all links of the sections of synchronized labels + USHORT nSections = rWorkShell.GetSectionFmtCount(); + for( USHORT nSection = 0; nSection < nSections; ++nSection ) + { + SwSectionData aSectionData( *rWorkShell.GetSectionFmt( nSection ).GetSection() ); + if( aSectionData.GetType() == FILE_LINK_SECTION ) + { + aSectionData.SetType( CONTENT_SECTION ); + aSectionData.SetLinkFileName( String() ); + rWorkShell.UpdateSection( nSection, aSectionData ); + } + } + rWorkShell.SetLabelDoc( sal_False ); +} + BOOL SwNewDBMgr::MergeMailFiles(SwWrtShell* pSourceShell, const SwMergeDescriptor& rMergeDescriptor) { @@ -1082,6 +1100,10 @@ BOOL SwNewDBMgr::MergeMailFiles(SwWrtShell* pSourceShell, // copy created file into the target document rWorkShell.ConvertFieldsToText(); rWorkShell.SetNumberingRestart(); + if( bSynchronizedDoc ) + { + lcl_RemoveSectionLinks( rWorkShell ); + } // insert the document into the target document rWorkShell.SttEndDoc(FALSE); @@ -2931,7 +2953,10 @@ sal_Int32 SwNewDBMgr::MergeDocuments( SwMailMergeConfigItem& rMMConfig, rWorkShell.RemoveInvisibleContent(); rWorkShell.ConvertFieldsToText(); rWorkShell.SetNumberingRestart(); - + if( bSynchronizedDoc ) + { + lcl_RemoveSectionLinks( rWorkShell ); + } // insert the document into the target document rWorkShell.SttEndDoc(FALSE); diff --git a/sw/source/ui/dbui/dbtree.cxx b/sw/source/ui/dbui/dbtree.cxx index 4b31760592..ba6c6bd225 100644 --- a/sw/source/ui/dbui/dbtree.cxx +++ b/sw/source/ui/dbui/dbtree.cxx @@ -260,7 +260,7 @@ void SwDBTreeList::InitTreeList() if(!pImpl->HasContext() && pImpl->GetWrtShell()) return; SetSelectionMode(SINGLE_SELECTION); - SetWindowBits(WB_HASLINES|WB_CLIPCHILDREN|WB_SORT|WB_HASBUTTONS|WB_HASBUTTONSATROOT|WB_HSCROLL); + SetStyle(GetStyle()|WB_HASLINES|WB_CLIPCHILDREN|WB_SORT|WB_HASBUTTONS|WB_HASBUTTONSATROOT|WB_HSCROLL); // Font nicht setzen, damit der Font des Controls uebernommen wird! SetSpaceBetweenEntries(0); SetNodeBitmaps( aImageList.GetImage(IMG_COLLAPSE), diff --git a/sw/source/ui/dbui/mailmergechildwindow.cxx b/sw/source/ui/dbui/mailmergechildwindow.cxx index e03b129034..94fd53a80f 100644 --- a/sw/source/ui/dbui/mailmergechildwindow.cxx +++ b/sw/source/ui/dbui/mailmergechildwindow.cxx @@ -418,7 +418,7 @@ SwSendMailDialog::SwSendMailDialog(Window *pParent, SwMailMergeConfigItem& rConf m_aStatusLB.SetHelpId(HID_MM_MAILSTATUS_TLB); static long nTabs[] = {3, 0, nPos1, aSz.Width() }; - m_aStatusLB.SetWindowBits( WB_SORT | WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP ); + m_aStatusLB.SetStyle( m_aStatusLB.GetStyle() | WB_SORT | WB_HSCROLL | WB_CLIPCHILDREN | WB_TABSTOP ); m_aStatusLB.SetSelectionMode( SINGLE_SELECTION ); m_aStatusLB.SetTabs(&nTabs[0], MAP_PIXEL); m_aStatusLB.SetSpaceBetweenEntries(3); diff --git a/sw/source/ui/dbui/makefile.mk b/sw/source/ui/dbui/makefile.mk deleted file mode 100644 index c2477b02ca..0000000000 --- a/sw/source/ui/dbui/makefile.mk +++ /dev/null @@ -1,122 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=dbui -LIBTARGET=no -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -# --- Files -------------------------------------------------------- -IMGLST_SRS=$(SRS)$/dbui.srs -BMP_IN=$(PRJ)$/win/imglst - - -SRS1NAME=$(TARGET) -SRC1FILES = \ - addresslistdialog.src \ - createaddresslistdialog.src \ - customizeaddresslistdialog.src \ - dbinsdlg.src \ - dbui.src \ - dbtablepreviewdialog.src \ - mailmergechildwindow.src \ - mailmergewizard.src \ - mmdocselectpage.src \ - mmlayoutpage.src \ - mmoutputpage.src \ - mmoutputtypepage.src \ - mmaddressblockpage.src \ - mmgreetingspage.src \ - mmmergepage.src \ - mmpreparemergepage.src \ - selectdbtabledialog.src \ - -EXCEPTIONSFILES= \ - $(SLO)$/addresslistdialog.obj \ - $(SLO)$/createaddresslistdialog.obj \ - $(SLO)$/customizeaddresslistdialog.obj \ - $(SLO)$/dbinsdlg.obj \ - $(SLO)$/dbmgr.obj \ - $(SLO)$/dbtablepreviewdialog.obj \ - $(SLO)$/dbtree.obj \ - $(SLO)$/maildispatcher.obj \ - $(SLO)$/mailmergechildwindow.obj \ - $(SLO)$/mailmergehelper.obj \ - $(SLO)$/mmaddressblockpage.obj \ - $(SLO)$/mmconfigitem.obj \ - $(SLO)$/mmlayoutpage.obj \ - $(SLO)$/mmgreetingspage.obj \ - $(SLO)$/mmoutputpage.obj - -SLOFILES = \ - $(SLO)$/addresslistdialog.obj \ - $(SLO)$/createaddresslistdialog.obj \ - $(SLO)$/customizeaddresslistdialog.obj \ - $(SLO)$/dbinsdlg.obj \ - $(SLO)$/dbmgr.obj \ - $(SLO)$/dbtree.obj \ - $(SLO)$/dbtablepreviewdialog.obj \ - $(SLO)$/maildispatcher.obj \ - $(SLO)$/mailmergehelper.obj \ - $(SLO)$/mailmergewizard.obj \ - $(SLO)$/mailmergechildwindow.obj \ - $(SLO)$/mmconfigitem.obj \ - $(SLO)$/mmdocselectpage.obj \ - $(SLO)$/mmlayoutpage.obj \ - $(SLO)$/mmoutputpage.obj \ - $(SLO)$/mmoutputtypepage.obj \ - $(SLO)$/mmaddressblockpage.obj \ - $(SLO)$/mmgreetingspage.obj \ - $(SLO)$/mmmergepage.obj \ - $(SLO)$/mmpreparemergepage.obj \ - $(SLO)$/dbui.obj \ - $(SLO)$/selectdbtabledialog.obj \ - $(SLO)$/swdbtoolsclient.obj - - -LIB1TARGET = $(SLB)$/$(TARGET).lib - -LIB1OBJFILES = \ - $(SLO)$/dbmgr.obj \ - $(SLO)$/dbtree.obj \ - $(SLO)$/dbui.obj \ - $(SLO)$/maildispatcher.obj \ - $(SLO)$/mailmergehelper.obj \ - $(SLO)$/mailmergechildwindow.obj \ - $(SLO)$/mmconfigitem.obj \ - $(SLO)$/swdbtoolsclient.obj - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx index eae0c6112f..8d32644b12 100644 --- a/sw/source/ui/dbui/mmaddressblockpage.cxx +++ b/sw/source/ui/dbui/mmaddressblockpage.cxx @@ -1453,7 +1453,7 @@ DDListBox::DDListBox(SwCustomizeAddressBlockDialog* pParent, const ResId rResId) SvTreeListBox(pParent, rResId), m_pParentDialog(pParent) { - SetWindowBits( /*WB_HASBUTTONS|WB_HASBUTTONSATROOT|*/ + SetStyle( GetStyle() | /*WB_HASBUTTONS|WB_HASBUTTONSATROOT|*/ WB_CLIPCHILDREN ); // SetSpaceBetweenEntries(3); SetSelectionMode( SINGLE_SELECTION ); diff --git a/sw/source/ui/dbui/mmoutputpage.cxx b/sw/source/ui/dbui/mmoutputpage.cxx index 9ede2af8a0..a8beecdc98 100644 --- a/sw/source/ui/dbui/mmoutputpage.cxx +++ b/sw/source/ui/dbui/mmoutputpage.cxx @@ -1106,8 +1106,6 @@ IMPL_LINK(SwMailMergeOutputPage, SendDocumentsHdl_Impl, PushButton*, pButton) if(nRet != RET_OK && nRet != RET_YES) return 0; } - //create the send dialog - SwSendMailDialog* pDlg = new SwSendMailDialog( pButton, rConfigItem ); //add the documents sal_uInt32 nBegin = 0; sal_uInt32 nEnd = 0; @@ -1133,7 +1131,26 @@ IMPL_LINK(SwMailMergeOutputPage, SendDocumentsHdl_Impl, PushButton*, pButton) switch( nDocType ) { case MM_DOCTYPE_OOO : break; - case MM_DOCTYPE_PDF : bIsPDF = true; break; + case MM_DOCTYPE_PDF : bIsPDF = true; + { + //the method SwIOSystemGetFilterOfFormat( ) returns the template filter + //because it uses the same user data :-( + SfxFilterMatcher aMatcher( pFilterContainer->GetName() ); + SfxFilterMatcherIter aIter( &aMatcher ); + const SfxFilter* pFilter = aIter.First(); + String sFilterMime( String::CreateFromAscii( "application/pdf" )); + while ( pFilter ) + { + if( pFilter->GetMimeType() == sFilterMime && pFilter->CanExport() ) + { + pSfxFlt = pFilter; + break; + } + pFilter = aIter.Next(); + } + + } + break; case MM_DOCTYPE_WORD: { //the method SwIOSystemGetFilterOfFormat( ) returns the template filter @@ -1239,6 +1256,8 @@ IMPL_LINK(SwMailMergeOutputPage, SendDocumentsHdl_Impl, PushButton*, pButton) uno::Reference< frame::XStorable > xStore( pTargetView->GetDocShell()->GetModel(), uno::UNO_QUERY); xStore->storeToURL( sTargetTempURL, aValues ); + //create the send dialog + SwSendMailDialog* pDlg = new SwSendMailDialog( pButton, rConfigItem ); pDlg->SetDocumentCount( nEnd ); pDlg->ShowDialog(); //help to force painting the dialog diff --git a/sw/source/ui/dbui/selectdbtabledialog.cxx b/sw/source/ui/dbui/selectdbtabledialog.cxx index 51277a1fed..049b99e611 100644 --- a/sw/source/ui/dbui/selectdbtabledialog.cxx +++ b/sw/source/ui/dbui/selectdbtabledialog.cxx @@ -109,7 +109,7 @@ SwSelectDBTableDialog::SwSelectDBTableDialog(Window* pParent, static long nTabs[] = {3, 0, aSz.Width()/2, aSz.Width() }; m_aTableLB.SetTabs(&nTabs[0], MAP_PIXEL); m_aTableLB.SetHelpId(HID_MM_SELECTDBTABLEDDIALOG_LISTBOX); - m_aTableLB.SetWindowBits( WB_CLIPCHILDREN ); + m_aTableLB.SetStyle( m_aTableLB.GetStyle() | WB_CLIPCHILDREN ); m_aTableLB.SetSpaceBetweenEntries(3); m_aTableLB.SetSelectionMode( SINGLE_SELECTION ); m_aTableLB.SetDragDropMode( 0 ); diff --git a/sw/source/ui/dialog/makefile.mk b/sw/source/ui/dialog/makefile.mk deleted file mode 100644 index 758ea00fcb..0000000000 --- a/sw/source/ui/dialog/makefile.mk +++ /dev/null @@ -1,99 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=dialog -LIBTARGET=no - -# future: DEMO\dialog.srs - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -# --- Files -------------------------------------------------------- - -SRS1NAME=$(TARGET) -SRC1FILES = \ - abstract.src \ - ascfldlg.src \ - dialog.src \ - docstdlg.src \ - regionsw.src \ - wordcountdialog.src - -EXCEPTIONSFILES = \ - $(SLO)$/SwSpellDialogChildWindow.obj - -SLOFILES = \ - $(SLO)$/abstract.obj \ - $(SLO)$/addrdlg.obj \ - $(SLO)$/ascfldlg.obj \ - $(SLO)$/docstdlg.obj \ - $(SLO)$/macassgn.obj \ - $(SLO)$/SwSpellDialogChildWindow.obj \ - $(SLO)$/regionsw.obj \ - $(SLO)$/uiregionsw.obj \ - $(SLO)$/swabstdlg.obj \ - $(SLO)$/swuiexp.obj \ - $(SLO)$/swwrtshitem.obj \ - $(SLO)$/swdialmgr.obj \ - $(SLO)$/wordcountdialog.obj \ - $(SLO)$/swdlgfact.obj - -LIB1TARGET = $(SLB)$/$(TARGET).lib - -LIB1OBJFILES = \ - $(SLO)$/regionsw.obj \ - $(SLO)$/swabstdlg.obj \ - $(SLO)$/SwSpellDialogChildWindow.obj \ - $(SLO)$/swwrtshitem.obj - -# $(SLO)$/macassgn.obj \ - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk -$(INCCOM)$/swuilib.hxx: makefile.mk -.IF "$(GUI)"=="UNX" - $(RM) $@ - echo \#define DLL_NAME \"libswui$(DLLPOSTFIX)$(DLLPOST)\" >$@ -.ELSE - echo \#define DLL_NAME \"swui$(DLLPOSTFIX)$(DLLPOST)\" >$@ -.ENDIF - -$(SLO)$/swabstdlg.obj : $(INCCOM)$/swuilib.hxx - - - - - - - diff --git a/sw/source/ui/dialog/swabstdlg.cxx b/sw/source/ui/dialog/swabstdlg.cxx index 2214dc5608..2e092a07f7 100644 --- a/sw/source/ui/dialog/swabstdlg.cxx +++ b/sw/source/ui/dialog/swabstdlg.cxx @@ -29,10 +29,10 @@ #include "precompiled_sw.hxx" #include "swabstdlg.hxx" -#include "swuilib.hxx" #include <osl/module.hxx> #include <tools/string.hxx> +#include <vcl/unohelp.hxx> typedef SwAbstractDialogFactory* (__LOADONCALLAPI *SwFuncPtrCreateDialogFactory)(); @@ -42,7 +42,8 @@ SwAbstractDialogFactory* SwAbstractDialogFactory::Create() { SwFuncPtrCreateDialogFactory fp = 0; static ::osl::Module aDialogLibrary; - if ( aDialogLibrary.is() || aDialogLibrary.loadRelative( &thisModule, String( RTL_CONSTASCII_USTRINGPARAM( DLL_NAME ) ) ) ) + static const ::rtl::OUString sLibName(::vcl::unohelper::CreateLibraryName("swui", TRUE)); + if ( aDialogLibrary.is() || aDialogLibrary.loadRelative( &thisModule, String( sLibName ) ) ) fp = ( SwAbstractDialogFactory* (__LOADONCALLAPI*)() ) aDialogLibrary.getFunctionSymbol( ::rtl::OUString::createFromAscii("CreateDialogFactory") ); if ( fp ) diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx index f31e35e05a..3793d6c57f 100644 --- a/sw/source/ui/dialog/swdlgfact.hxx +++ b/sw/source/ui/dialog/swdlgfact.hxx @@ -582,5 +582,3 @@ struct SwDialogsResMgr }; #endif - - diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx index 440457f0b1..01c8abcbbe 100644 --- a/sw/source/ui/dialog/uiregionsw.cxx +++ b/sw/source/ui/dialog/uiregionsw.cxx @@ -432,7 +432,7 @@ SwEditRegionDlg::SwEditRegionDlg( Window* pParent, SwWrtShell& rWrtSh ) aTree.SetHelpId(HID_REGION_TREE); aTree.SetSelectionMode( MULTIPLE_SELECTION ); - aTree.SetWindowBits(WB_HASBUTTONSATROOT|WB_CLIPCHILDREN|WB_HSCROLL); + aTree.SetStyle(aTree.GetStyle()|WB_HASBUTTONSATROOT|WB_CLIPCHILDREN|WB_HSCROLL); aTree.SetSpaceBetweenEntries(0); if(bWeb) diff --git a/sw/source/ui/dochdl/makefile.mk b/sw/source/ui/dochdl/makefile.mk deleted file mode 100644 index 48400052f5..0000000000 --- a/sw/source/ui/dochdl/makefile.mk +++ /dev/null @@ -1,65 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=dochdl -LIBTARGET=no -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -# --- Files -------------------------------------------------------- - -SRS1NAME=$(TARGET) -SRC1FILES = \ - dochdl.src \ - selglos.src - -SLOFILES = \ - $(SLO)$/gloshdl.obj \ - $(SLO)$/selglos.obj \ - $(SLO)$/swdtflvr.obj - -EXCEPTIONSFILES = \ - $(SLO)$/swdtflvr.obj - -# $(SLO)$/dataex.obj \ - -LIB1TARGET = $(SLB)$/$(TARGET).lib - -LIB1OBJFILES = \ - $(SLO)$/gloshdl.obj \ - $(SLO)$/swdtflvr.obj - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/ui/docvw/AnnotationMenuButton.cxx b/sw/source/ui/docvw/AnnotationMenuButton.cxx index 6022a4646a..c49c689851 100644 --- a/sw/source/ui/docvw/AnnotationMenuButton.cxx +++ b/sw/source/ui/docvw/AnnotationMenuButton.cxx @@ -85,20 +85,13 @@ void AnnotationMenuButton::MouseButtonDown( const MouseEvent& rMEvt ) if ( mrSidebarWin.IsReadOnly() ) { pButtonPopup->EnableItem( FN_REPLY, false ); - pButtonPopup->EnableItem( FN_DELETE_NOTE, false ); + pButtonPopup->EnableItem( FN_DELETE_COMMENT, false ); pButtonPopup->EnableItem( FN_DELETE_NOTE_AUTHOR, false ); pButtonPopup->EnableItem( FN_DELETE_ALL_NOTES, false ); } else { - if ( mrSidebarWin.IsProtected() ) - { - pButtonPopup->EnableItem( FN_DELETE_NOTE, false ); - } - else - { - pButtonPopup->EnableItem( FN_DELETE_NOTE, true ); - } + pButtonPopup->EnableItem( FN_DELETE_COMMENT, !mrSidebarWin.IsProtected() ); pButtonPopup->EnableItem( FN_DELETE_NOTE_AUTHOR, true ); pButtonPopup->EnableItem( FN_DELETE_ALL_NOTES, true ); } diff --git a/sw/source/ui/docvw/SidebarWin.cxx b/sw/source/ui/docvw/SidebarWin.cxx index ea95d1d0d3..8ce45ae318 100644 --- a/sw/source/ui/docvw/SidebarWin.cxx +++ b/sw/source/ui/docvw/SidebarWin.cxx @@ -935,7 +935,6 @@ void SwSidebarWin::ExecuteCommand(USHORT nSlot) break; } case FN_DELETE_COMMENT: - case FN_DELETE_NOTE: //Delete(); // do not kill the parent of our open popup menu mnEventId = Application::PostUserEvent( LINK( this, SwSidebarWin, DeleteHdl), 0 ); diff --git a/sw/source/ui/docvw/makefile.mk b/sw/source/ui/docvw/makefile.mk deleted file mode 100644 index a2914b2f86..0000000000 --- a/sw/source/ui/docvw/makefile.mk +++ /dev/null @@ -1,69 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=docvw -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -# --- Files -------------------------------------------------------- - -SRS1NAME=$(TARGET) -SRC1FILES = \ - access.src \ - docvw.src \ - annotation.src - -SLOFILES = \ - $(SLO)$/edtdd.obj \ - $(SLO)$/edtwin.obj \ - $(SLO)$/edtwin2.obj \ - $(SLO)$/edtwin3.obj \ - $(SLO)$/romenu.obj \ - $(SLO)$/srcedtw.obj \ - $(SLO)$/PostItMgr.obj \ - $(SLO)$/frmsidebarwincontainer.obj \ - $(SLO)$/AnchorOverlayObject.obj \ - $(SLO)$/ShadowOverlayObject.obj \ - $(SLO)$/SidebarWin.obj \ - $(SLO)$/SidebarWinAcc.obj \ - $(SLO)$/AnnotationWin.obj \ - $(SLO)$/AnnotationMenuButton.obj \ - $(SLO)$/SidebarTxtControl.obj \ - $(SLO)$/SidebarTxtControlAcc.obj - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/ui/envelp/envlop1.cxx b/sw/source/ui/envelp/envlop1.cxx index 12b0f1f38f..2c68ee52a6 100644 --- a/sw/source/ui/envelp/envlop1.cxx +++ b/sw/source/ui/envelp/envlop1.cxx @@ -103,9 +103,9 @@ void SwEnvPreview::Paint(const Rectangle &) USHORT nPageW = (USHORT) Max(rItem.lWidth, rItem.lHeight), nPageH = (USHORT) Min(rItem.lWidth, rItem.lHeight); - float fx = static_cast< float >(GetOutputSizePixel().Width () / nPageW), - fy = static_cast< float >(GetOutputSizePixel().Height() / nPageH), - f = static_cast< float >(0.8 * ( fx < fy ? fx : fy )); + float fx = (float)GetOutputSizePixel().Width () / (float)nPageW, + fy = (float)GetOutputSizePixel().Height() / (float)nPageH, + f = 0.8f * ( fx < fy ? fx : fy ); Color aBack = rSettings.GetWindowColor( ); Color aFront = SwViewOption::GetFontColor(); diff --git a/sw/source/ui/envelp/label1.cxx b/sw/source/ui/envelp/label1.cxx index 05c2cf90be..a9f6af7ba6 100644 --- a/sw/source/ui/envelp/label1.cxx +++ b/sw/source/ui/envelp/label1.cxx @@ -724,7 +724,7 @@ SwVisitingCardPage::SwVisitingCardPage(Window* pParent, const SfxItemSet& rSet) pExampleFrame(0) { FreeResource(); - aAutoTextLB.SetWindowBits( WB_HSCROLL ); + aAutoTextLB.SetStyle( aAutoTextLB.GetStyle() | WB_HSCROLL ); aAutoTextLB.SetSpaceBetweenEntries(0); aAutoTextLB.SetSelectionMode( SINGLE_SELECTION ); aAutoTextLB.SetHelpId(HID_BUSINESS_CARD_CONTENT); diff --git a/sw/source/ui/envelp/mailmrge.cxx b/sw/source/ui/envelp/mailmrge.cxx index a80438afe8..76595d5543 100644 --- a/sw/source/ui/envelp/mailmrge.cxx +++ b/sw/source/ui/envelp/mailmrge.cxx @@ -779,7 +779,7 @@ bool SwMailMergeDlg::ExecQryShell() m_aSelection.realloc(nEnd - nStart + 1); Any* pSelection = m_aSelection.getArray(); - for (sal_Int32 i = nStart; i != nEnd; ++i, ++pSelection) + for (sal_Int32 i = nStart; i <= nEnd; ++i, ++pSelection) *pSelection <<= i; } else if (aAllRB.IsChecked() ) diff --git a/sw/source/ui/envelp/makefile.mk b/sw/source/ui/envelp/makefile.mk deleted file mode 100644 index 3010601b0a..0000000000 --- a/sw/source/ui/envelp/makefile.mk +++ /dev/null @@ -1,80 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=envelp -LIBTARGET=no -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -# --- Files -------------------------------------------------------- - -SRS1NAME=$(TARGET) -SRC1FILES =\ - envelp.src \ - envfmt.src \ - envlop.src \ - envprt.src \ - label.src \ - labfmt.src \ - labprt.src \ - mailmrge.src - -SLOFILES = \ - $(SLO)$/envfmt.obj \ - $(SLO)$/envimg.obj \ - $(SLO)$/envlop1.obj \ - $(SLO)$/envprt.obj \ - $(SLO)$/labelcfg.obj \ - $(SLO)$/label1.obj \ - $(SLO)$/labelexp.obj \ - $(SLO)$/labfmt.obj \ - $(SLO)$/labprt.obj \ - $(SLO)$/labimg.obj \ - $(SLO)$/mailmrge.obj \ - $(SLO)$/syncbtn.obj - -EXCEPTIONSFILES= \ - $(SLO)$/labelexp.obj \ - $(SLO)$/mailmrge.obj - -LIB1TARGET = $(SLB)$/$(TARGET).lib - -LIB1OBJFILES = \ - $(SLO)$/envimg.obj \ - $(SLO)$/labelcfg.obj \ - $(SLO)$/labimg.obj \ - $(SLO)$/syncbtn.obj -# --- Targets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/ui/fldui/changedb.cxx b/sw/source/ui/fldui/changedb.cxx index bd35309e68..17759f7a3b 100644 --- a/sw/source/ui/fldui/changedb.cxx +++ b/sw/source/ui/fldui/changedb.cxx @@ -115,7 +115,7 @@ SwChangeDBDlg::SwChangeDBDlg(SwView& rVw) : aAddDBPB.SetClickHdl(LINK(this, SwChangeDBDlg, AddDBHdl)); aUsedDBTLB.SetSelectionMode(MULTIPLE_SELECTION); - aUsedDBTLB.SetWindowBits(WB_HASLINES|WB_CLIPCHILDREN|WB_SORT|WB_HASBUTTONS|WB_HASBUTTONSATROOT|WB_HSCROLL); + aUsedDBTLB.SetStyle(aUsedDBTLB.GetStyle()|WB_HASLINES|WB_CLIPCHILDREN|WB_SORT|WB_HASBUTTONS|WB_HASBUTTONSATROOT|WB_HSCROLL); aUsedDBTLB.SetSpaceBetweenEntries(0); aUsedDBTLB.SetNodeBitmaps( aImageList.GetImage(IMG_COLLAPSE), diff --git a/sw/source/ui/fldui/flddinf.cxx b/sw/source/ui/fldui/flddinf.cxx index dabb6b91e5..9243037bb2 100644 --- a/sw/source/ui/fldui/flddinf.cxx +++ b/sw/source/ui/fldui/flddinf.cxx @@ -89,7 +89,7 @@ SwFldDokInfPage::SwFldDokInfPage(Window* pWindow, const SfxItemSet& rCoreSet ) : aTypeTLB.SetHelpId(HID_FIELD_DINF_TYPE); aTypeTLB.SetSelectionMode(SINGLE_SELECTION); - aTypeTLB.SetWindowBits(WB_HASLINES|WB_CLIPCHILDREN|WB_SORT|WB_HASBUTTONS|WB_HASBUTTONSATROOT|WB_HSCROLL); + aTypeTLB.SetStyle(aTypeTLB.GetStyle()|WB_HASLINES|WB_CLIPCHILDREN|WB_SORT|WB_HASBUTTONS|WB_HASBUTTONSATROOT|WB_HSCROLL); // Font nicht setzen, damit der Font des Controls uebernommen wird! // Sonst bei falschem Font Bug an OV. aTypeTLB.SetSpaceBetweenEntries(0); diff --git a/sw/source/ui/fldui/fldref.cxx b/sw/source/ui/fldui/fldref.cxx index 10ee25b477..5b7b70b5f9 100644 --- a/sw/source/ui/fldui/fldref.cxx +++ b/sw/source/ui/fldui/fldref.cxx @@ -124,7 +124,7 @@ SwFldRefPage::SwFldRefPage(Window* pParent, const SfxItemSet& rCoreSet ) : // --> OD 2007-11-21 #i83479# aSelectionToolTipLB.SetSelectHdl( LINK(this, SwFldRefPage, SubTypeHdl) ); aSelectionToolTipLB.SetDoubleClickHdl( LINK(this, SwFldRefPage, InsertHdl) ); - aSelectionToolTipLB.SetWindowBits( aSelectionToolTipLB.GetWindowBits() | WB_HSCROLL ); + aSelectionToolTipLB.SetStyle( aSelectionToolTipLB.GetStyle() | WB_HSCROLL ); aSelectionToolTipLB.SetSpaceBetweenEntries(1); aSelectionToolTipLB.SetHighlightRange(); // <-- diff --git a/sw/source/ui/fldui/makefile.mk b/sw/source/ui/fldui/makefile.mk deleted file mode 100644 index ee9dbff9cf..0000000000 --- a/sw/source/ui/fldui/makefile.mk +++ /dev/null @@ -1,94 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. -LIBTARGET=no -PRJNAME=sw -TARGET=fldui - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -# --- Files -------------------------------------------------------- - -SRS1NAME=$(TARGET) -SRC1FILES = \ - changedb.src \ - DropDownFieldDialog.src\ - flddb.src \ - flddinf.src \ - flddok.src \ - fldfunc.src \ - fldref.src \ - fldtdlg.src \ - fldui.src \ - fldvar.src \ - javaedit.src \ - inpdlg.src - -SLOFILES = \ - $(SLO)$/changedb.obj \ - $(SLO)$/DropDownFieldDialog.obj \ - $(SLO)$/flddb.obj \ - $(SLO)$/flddinf.obj \ - $(SLO)$/flddok.obj \ - $(SLO)$/fldedt.obj \ - $(SLO)$/fldfunc.obj \ - $(SLO)$/fldmgr.obj \ - $(SLO)$/fldpage.obj \ - $(SLO)$/fldref.obj \ - $(SLO)$/fldtdlg.obj \ - $(SLO)$/fldvar.obj \ - $(SLO)$/javaedit.obj \ - $(SLO)$/inpdlg.obj \ - $(SLO)$/fldwrap.obj \ - $(SLO)$/xfldui.obj \ - $(SLO)$/FldRefTreeListBox.obj - - -EXCEPTIONSFILES = \ - $(SLO)$/fldtdlg.obj \ - $(SLO)$/fldedt.obj \ - $(SLO)$/flddinf.obj \ - $(SLO)$/xfldui.obj - -LIB1TARGET = $(SLB)$/$(TARGET).lib - -LIB1OBJFILES = \ - $(SLO)$/fldmgr.obj \ - $(SLO)$/fldwrap.obj \ - $(SLO)$/xfldui.obj - -# $(SLO)$/DropDownFieldDialog.obj \ - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/ui/fmtui/fmtui.src b/sw/source/ui/fmtui/fmtui.src deleted file mode 100644 index 2f68cbdc56..0000000000 --- a/sw/source/ui/fmtui/fmtui.src +++ /dev/null @@ -1,88 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -#include "fmtui.hrc" -#include "globals.hrc" - -String STR_FMT_STD -{ - Text [ en-US ] = "(none)" ; -}; -String STR_TEMPLATE_WILDCARD -{ - TEXT = "*.vor" ; -}; - //String STR_NONAME //!! VB - //{ - // TEXT = "Unbenannt "; - // TEXT [English] = "Noname "; - // TEXT [norwegian] = "Noname "; - // TEXT [italian] = "Senza nome"; - // TEXT [portuguese_brazilian] = "Semnome "; - // TEXT [portuguese] = "Semnome "; - // TEXT [finnish] = "Nimetön "; - // TEXT [danish] = "Intet navn"; - // TEXT [french] = "Sansnom "; - // TEXT [swedish] = "Namnlös"; - // TEXT [dutch] = "Naamloos"; - // TEXT [spanish] = "Sin nombre "; - // TEXT [english_us] = "Noname "; - //}; -String STR_OVERWRITE -{ - /* ### ACHTUNG: Neuer Text in Resource? Wollen Sie die Vorlage wirklich überschreiben? : Wollen Sie die Vorlage wirklich ³berschreiben? */ - Text [ en-US ] = "\nAre you sure you want to delete this template?" ; -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/sw/source/ui/fmtui/makefile.mk b/sw/source/ui/fmtui/makefile.mk deleted file mode 100644 index 37ad48df00..0000000000 --- a/sw/source/ui/fmtui/makefile.mk +++ /dev/null @@ -1,51 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=fmtui -LIBTARGET=NO -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -# --- Files -------------------------------------------------------- - -SRS1NAME=$(TARGET) -SRC1FILES = \ - tmpdlg.src - -SLOFILES = \ - $(SLO)$/tmpdlg.obj - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/ui/fmtui/tmpdlg.cxx b/sw/source/ui/fmtui/tmpdlg.cxx index 644565b9bb..5193dd736f 100644 --- a/sw/source/ui/fmtui/tmpdlg.cxx +++ b/sw/source/ui/fmtui/tmpdlg.cxx @@ -41,7 +41,7 @@ #endif #include <vcl/msgbox.hxx> #include <sfx2/viewfrm.hxx> -#include <svx/hdft2.hxx> +#include <svx/hdft.hxx> #include <editeng/flstitem.hxx> #include <svx/htmlmode.hxx> #include <svtools/htmlcfg.hxx> diff --git a/sw/source/ui/frmdlg/cption.cxx b/sw/source/ui/frmdlg/cption.cxx index 5e7167b6bc..d226f4760c 100644 --- a/sw/source/ui/frmdlg/cption.cxx +++ b/sw/source/ui/frmdlg/cption.cxx @@ -382,6 +382,7 @@ IMPL_LINK(SwCaptionDialog, CaptionHdl, PushButton*, EMPTYARG) void SwCaptionDialog::DrawSample() { String aStr; + String sCaption = aTextEdit.GetText(); // Nummer String sFldTypeName = aCategoryBox.GetText(); @@ -436,9 +437,12 @@ void SwCaptionDialog::DrawSample() } } - aStr += aSepEdit.GetText(); + if( sCaption.Len() > 0 ) + { + aStr += aSepEdit.GetText(); + } } - aStr += aTextEdit.GetText(); + aStr += sCaption; // do preview! aPrevWin.SetPreviewText( aStr ); } diff --git a/sw/source/ui/frmdlg/frmdlg.cxx b/sw/source/ui/frmdlg/frmdlg.cxx index 413845f1eb..52280136a8 100644 --- a/sw/source/ui/frmdlg/frmdlg.cxx +++ b/sw/source/ui/frmdlg/frmdlg.cxx @@ -93,7 +93,8 @@ SwFrmDlg::SwFrmDlg( SfxViewFrame* pViewFrame, aTmp += *pStr; aTmp += ')'; } - AddTabPage(TP_FRM_STD, SwFrmPage::Create, 0); + + AddTabPage(TP_FRM_STD, SwFrmPage::Create, 0); AddTabPage(TP_FRM_ADD, SwFrmAddPage::Create, 0); AddTabPage(TP_FRM_WRAP, SwWrapTabPage::Create, 0); AddTabPage(TP_FRM_URL, SwFrmURLPage::Create, 0); @@ -217,3 +218,4 @@ void SwFrmDlg::PageCreated( USHORT nId, SfxTabPage &rPage ) break; } } + diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx index 8d371558d4..50e9754450 100644 --- a/sw/source/ui/frmdlg/frmpage.cxx +++ b/sw/source/ui/frmdlg/frmpage.cxx @@ -677,7 +677,10 @@ SwFrmPage::SwFrmPage ( Window *pParent, const SfxItemSet &rSet ) : nOldV(text::VertOrientation::TOP), nOldVRel(text::RelOrientation::PRINT_AREA), pVMap( 0 ), - pHMap( 0 ) + pHMap( 0 ), + m_bAllowVertPositioning( true ), + m_bIsMathOLE( false ), + m_bIsMathBaselineAlignment( true ) { FreeResource(); SetExchangeSupport(); @@ -782,9 +785,17 @@ void SwFrmPage::Reset( const SfxItemSet &rSet ) SetMetric( aAtHorzPosED, aMetric ); SetMetric( aAtVertPosED, aMetric ); + const SfxPoolItem* pItem = NULL; const SwFmtAnchor& rAnchor = (const SwFmtAnchor&)rSet.Get(RES_ANCHOR); + if (SFX_ITEM_SET == rSet.GetItemState(FN_OLE_IS_MATH, FALSE, &pItem)) + m_bIsMathOLE = ((const SfxBoolItem*)pItem)->GetValue(); + if (SFX_ITEM_SET == rSet.GetItemState(FN_MATH_BASELINE_ALIGNMENT, FALSE, &pItem)) + m_bIsMathBaselineAlignment = ((const SfxBoolItem*)pItem)->GetValue(); + EnableVerticalPositioning( !(m_bIsMathOLE && m_bIsMathBaselineAlignment + && FLY_AS_CHAR == rAnchor.GetAnchorId()) ); + if (bFormat) { // Bei Formaten keine Ankerbearbeitung @@ -812,7 +823,6 @@ void SwFrmPage::Reset( const SfxItemSet &rSet ) if ( nDlgType == DLG_FRM_GRF || nDlgType == DLG_FRM_OLE ) { ASSERT(pSh , "shell not found"); - const SfxPoolItem* pItem; //OS: nur fuer die Variante Einfuegen/Grafik/Eigenschaften if(SFX_ITEM_SET == rSet.GetItemState(FN_PARAM_GRF_REALSIZE, FALSE, &pItem)) aGrfSize = ((const SvxSizeItem*)pItem)->GetSize(); @@ -1280,8 +1290,8 @@ void SwFrmPage::InitPos(RndStdIds eId, if ( nY != LONG_MAX ) aAtVertPosED.SetValue( aAtVertPosED.Normalize(nY), FUNIT_TWIP ); } - aAtVertPosFT.Enable( bEnable ); - aAtVertPosED.Enable( bEnable ); + aAtVertPosFT.Enable( bEnable && m_bAllowVertPositioning ); + aAtVertPosED.Enable( bEnable && m_bAllowVertPositioning ); UpdateExample(); } @@ -1488,8 +1498,10 @@ ULONG SwFrmPage::FillRelLB( const FrmMap* _pMap, } } - _rLB.Enable(_rLB.GetEntryCount() != 0); - _rFT.Enable(_rLB.GetEntryCount() != 0); + const bool bEnable = _rLB.GetEntryCount() != 0 + && (&_rLB != &aVertRelationLB || m_bAllowVertPositioning); + _rLB.Enable( bEnable ); + _rFT.Enable( bEnable ); RelHdl(&_rLB); @@ -1850,6 +1862,10 @@ IMPL_LINK( SwFrmPage, AnchorTypeHdl, RadioButton *, EMPTYARG ) PosHdl(&aHorizontalDLB); PosHdl(&aVerticalDLB); } + + EnableVerticalPositioning( !(m_bIsMathOLE && m_bIsMathBaselineAlignment + && FLY_AS_CHAR == eId) ); + return 0; } @@ -1875,7 +1891,7 @@ IMPL_LINK( SwFrmPage, PosHdl, ListBox *, pLB ) } else { - BOOL bEnable = text::VertOrientation::NONE == nAlign; + BOOL bEnable = text::VertOrientation::NONE == nAlign && m_bAllowVertPositioning; aAtVertPosED.Enable( bEnable ); aAtVertPosFT.Enable( bEnable ); } @@ -2304,6 +2320,19 @@ void SwFrmPage::SetFormatUsed(BOOL bFmt) } } + +void SwFrmPage::EnableVerticalPositioning( bool bEnable ) +{ + m_bAllowVertPositioning = bEnable; + aVerticalFT.Enable( bEnable ); + aVerticalDLB.Enable( bEnable ); + aAtVertPosFT.Enable( bEnable ); + aAtVertPosED.Enable( bEnable ); + aVertRelationFT.Enable( bEnable ); + aVertRelationLB.Enable( bEnable ); +} + + /*-------------------------------------------------------------------- Beschreibung: --------------------------------------------------------------------*/ @@ -3246,4 +3275,3 @@ IMPL_LINK(SwFrmAddPage, ChainModifyHdl, ListBox*, pBox) } return 0; } - diff --git a/sw/source/ui/frmdlg/makefile.mk b/sw/source/ui/frmdlg/makefile.mk deleted file mode 100644 index a7addb0b94..0000000000 --- a/sw/source/ui/frmdlg/makefile.mk +++ /dev/null @@ -1,79 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=frmdlg -LIBTARGET=no - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -# --- Files -------------------------------------------------------- - -SRS1NAME=$(TARGET) -SRC1FILES = \ - column.src \ - cption.src \ - frmpage.src \ - frmui.src \ - wrap.src - -SLOFILES = \ - $(SLO)$/colmgr.obj \ - $(SLO)$/column.obj \ - $(SLO)$/colex.obj \ - $(SLO)$/cption.obj \ - $(SLO)$/frmdlg.obj \ - $(SLO)$/frmmgr.obj \ - $(SLO)$/frmpage.obj \ - $(SLO)$/pattern.obj \ - $(SLO)$/uiborder.obj \ - $(SLO)$/wrap.obj - -EXCEPTIONSFILES = \ - $(SLO)$/frmpage.obj \ - $(SLO)$/cption.obj - -LIB1TARGET = $(SLB)$/$(TARGET).lib - -LIB1OBJFILES = \ - $(SLO)$/colmgr.obj \ - $(SLO)$/colex.obj \ - $(SLO)$/frmmgr.obj - - - - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/ui/globdoc/makefile.mk b/sw/source/ui/globdoc/makefile.mk deleted file mode 100644 index d75eb7af88..0000000000 --- a/sw/source/ui/globdoc/makefile.mk +++ /dev/null @@ -1,51 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=globdoc - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -# --- Files -------------------------------------------------------- - -SRS1NAME=$(TARGET) -SRC1FILES = \ - globdoc.src - -SLOFILES = \ - $(SLO)$/globdoc.obj - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/ui/inc/column.hxx b/sw/source/ui/inc/column.hxx index 7da371213a..3bf10d86a7 100644 --- a/sw/source/ui/inc/column.hxx +++ b/sw/source/ui/inc/column.hxx @@ -49,7 +49,7 @@ #endif #include <vcl/timer.hxx> #ifndef _IMAGEBTN_HXX //autogen -#include <vcl/imagebtn.hxx> +#include <vcl/button.hxx> #endif #include <svtools/ctrlbox.hxx> #include <svtools/valueset.hxx> diff --git a/sw/source/ui/inc/envlop.hxx b/sw/source/ui/inc/envlop.hxx index 0e9f584734..6fddc3819d 100644 --- a/sw/source/ui/inc/envlop.hxx +++ b/sw/source/ui/inc/envlop.hxx @@ -45,7 +45,7 @@ #endif #ifndef _IMAGEBTN_HXX //autogen -#include <vcl/imagebtn.hxx> +#include <vcl/button.hxx> #endif #include "envimg.hxx" diff --git a/sw/source/ui/inc/fldedt.hxx b/sw/source/ui/inc/fldedt.hxx index 118cabd3e1..25290b2cc2 100644 --- a/sw/source/ui/inc/fldedt.hxx +++ b/sw/source/ui/inc/fldedt.hxx @@ -27,7 +27,7 @@ #ifndef _FLDEDT_HXX #define _FLDEDT_HXX #include <sfx2/basedlgs.hxx> -#include <vcl/imagebtn.hxx> +#include <vcl/button.hxx> class SwView; class SwWrtShell; diff --git a/sw/source/ui/inc/frmdlg.hxx b/sw/source/ui/inc/frmdlg.hxx index fa39f4b293..43be092b58 100644 --- a/sw/source/ui/inc/frmdlg.hxx +++ b/sw/source/ui/inc/frmdlg.hxx @@ -41,6 +41,7 @@ class SwFrmDlg : public SfxTabDialog BOOL m_bFormat; BOOL m_bNew; BOOL m_bHTMLMode; + bool m_bEnableVertPos; const SfxItemSet& m_rSet; USHORT m_nDlgType; SwWrtShell* m_pWrtShell; diff --git a/sw/source/ui/inc/frmpage.hxx b/sw/source/ui/inc/frmpage.hxx index a858c23199..1f097d1c29 100644 --- a/sw/source/ui/inc/frmpage.hxx +++ b/sw/source/ui/inc/frmpage.hxx @@ -28,27 +28,17 @@ #ifndef _FRMPAGE_HXX #define _FRMPAGE_HXX -#ifndef _FIXED_HXX //autogen #include <vcl/fixed.hxx> -#endif -#ifndef _BUTTON_HXX //autogen #include <vcl/button.hxx> -#endif -#ifndef _LSTBOX_HXX //autogen #include <vcl/lstbox.hxx> -#endif -#ifndef _FIELD_HXX //autogen #include <vcl/field.hxx> -#endif #include <sfx2/tabdlg.hxx> #include <svx/swframeposstrings.hxx> #include <swtypes.hxx> #include <bmpwin.hxx> #include <svx/swframeexample.hxx> #include <prcntfld.hxx> -#ifndef _GLOBALS_HRC #include <globals.hrc> -#endif namespace sfx2{class FileDialogHelper;} @@ -142,6 +132,10 @@ class SwFrmPage: public SfxTabPage FrmMap* pVMap; FrmMap* pHMap; + bool m_bAllowVertPositioning; + bool m_bIsMathOLE; + bool m_bIsMathBaselineAlignment; + virtual void ActivatePage(const SfxItemSet& rSet); virtual int DeactivatePage(SfxItemSet *pSet); @@ -205,6 +199,7 @@ public: void SetFormatUsed(BOOL bFmt); void SetFrmType(USHORT nType) { nDlgType = nType; } inline BOOL IsInGraficMode( void ) { return nDlgType == DLG_FRM_GRF || nDlgType == DLG_FRM_OLE; } + void EnableVerticalPositioning( bool bEnable ); }; class SwGrfExtPage: public SfxTabPage diff --git a/sw/source/ui/inc/javaedit.hxx b/sw/source/ui/inc/javaedit.hxx index 7eadaa7c34..606e3f26bc 100644 --- a/sw/source/ui/inc/javaedit.hxx +++ b/sw/source/ui/inc/javaedit.hxx @@ -44,7 +44,7 @@ #endif #ifndef _IMAGEBTN_HXX //autogen -#include <vcl/imagebtn.hxx> +#include <vcl/button.hxx> #endif class SwWrtShell; diff --git a/sw/source/ui/inc/makefile.mk b/sw/source/ui/inc/makefile.mk deleted file mode 100644 index cb9b968dcc..0000000000 --- a/sw/source/ui/inc/makefile.mk +++ /dev/null @@ -1,42 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=uiinc - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# --- Files -------------------------------------------------------- - -LOCALIZE_ME=swmn_tmpl.hrc toolbox_tmpl.hrc - -.INCLUDE : target.mk - diff --git a/sw/source/ui/inc/optpage.hxx b/sw/source/ui/inc/optpage.hxx index 60e15f866b..fa0af2e473 100644 --- a/sw/source/ui/inc/optpage.hxx +++ b/sw/source/ui/inc/optpage.hxx @@ -353,6 +353,12 @@ class SwShdwCrsrOptionsTabPage : public SfxTabPage FixedLine aCrsrOptFL; CheckBox aCrsrInProtCB; + FixedLine m_aLayoutOptionsFL; + CheckBox m_aMathBaselineAlignmentCB; + + SwWrtShell * m_pWrtShell; + + SwShdwCrsrOptionsTabPage( Window* pParent, const SfxItemSet& rSet ); ~SwShdwCrsrOptionsTabPage(); @@ -362,6 +368,9 @@ public: virtual BOOL FillItemSet( SfxItemSet& rSet ); virtual void Reset( const SfxItemSet& rSet ); + + void SetWrtShell( SwWrtShell * pSh ) { m_pWrtShell = pSh; } + virtual void PageCreated( SfxAllItemSet aSet ); }; /*----------------------------------------------------------------------- @@ -498,5 +507,3 @@ private: }; #endif //PRODUCT #endif - - diff --git a/sw/source/ui/inc/split.hxx b/sw/source/ui/inc/split.hxx index d058276c54..834da1e995 100644 --- a/sw/source/ui/inc/split.hxx +++ b/sw/source/ui/inc/split.hxx @@ -38,7 +38,7 @@ #endif #ifndef _IMAGEBTN_HXX //autogen -#include <vcl/imagebtn.hxx> +#include <vcl/button.hxx> #endif #ifndef _BUTTON_HXX //autogen diff --git a/sw/source/ui/inc/swmn_tmpl.hrc b/sw/source/ui/inc/swmn_tmpl.hrc deleted file mode 100644 index 911309c8a5..0000000000 --- a/sw/source/ui/inc/swmn_tmpl.hrc +++ /dev/null @@ -1,379 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _SWMN_HRC -#define _SWMN_HRC - -#include <svx/dialogs.hrc> -#include <svx/globlmn.hrc> -#include "cmdid.h" -#include "app.hrc" -#include "globals.hrc" -#include "helpid.h" -#include "popup.hrc" -//#include "cfgid.h" - -/* --------------------- F O R M A T --------------------------------- */ - -#define SEPARATOR MenuItem { Separator = TRUE; } - -//define for ITEM_FORMAT_NUMBERING -#define DEFINE_SLOTID_FOR_NUMBER_BULLETS FN_NUMBER_BULLETS -#define MN_NUMBERING ITEM_FORMAT_NUMBERING - -#define MN_TXT\ - MenuItem\ - {\ - ITEM_FORMAT_CHAR_DLG\ - };\ - MenuItem\ - {\ - ITEM_FORMAT_PARA_DLG\ - };\ - MenuItem\ - {\ - Identifier = FN_FORMAT_PAGE_DLG ; \ - HelpId = CMD_FN_FORMAT_PAGE_DLG ; \ - Text [ en-US ] = "Pa~ge..." ; \ - }; - - -#define MN_TEXT_ATTR\ - MenuItem\ - {\ - ITEM_FORMAT_ATTR_CHAR_FONT\ - };\ - MenuItem\ - {\ - ITEM_FORMAT_ATTR_CHAR_FONTHEIGHT\ - };\ - MenuItem\ - {\ - Identifier = MN_FORMAT_STYLE ; \ - Command = ".uno:StyleMenu" ; \ - Text [ en-US ] = "St~yle" ; \ - SubMenu = Menu\ - {\ - ItemList = \ - {\ - MenuItem\ - {\ - ITEM_FORMAT_ATTR_CHAR_WEIGHT\ - };\ - MenuItem\ - {\ - ITEM_FORMAT_ATTR_CHAR_POSTURE\ - };\ - MenuItem\ - {\ - ITEM_FORMAT_ATTR_CHAR_OVERLINE\ - };\ - MenuItem\ - {\ - ITEM_FORMAT_ATTR_CHAR_UNDERLINE\ - };\ - MenuItem\ - {\ - ITEM_FORMAT_ATTR_CHAR_STRIKEOUT\ - };\ - MenuItem\ - {\ - ITEM_FORMAT_ATTR_CHAR_SHADOWED\ - };\ - MenuItem\ - {\ - ITEM_FORMAT_ATTR_CHAR_CONTOUR\ - };\ - SEPARATOR ; \ - MenuItem\ - {\ - Identifier = FN_SET_SUPER_SCRIPT ; \ - HelpId = CMD_FN_SET_SUPER_SCRIPT ; \ - Text [ en-US ] = "Superscript" ; \ - };\ - MenuItem\ - {\ - Identifier = FN_SET_SUB_SCRIPT ; \ - HelpId = CMD_FN_SET_SUB_SCRIPT ; \ - Text [ en-US ] = "Subscript" ; \ - };\ - };\ - };\ - };\ - MenuItem\ - {\ - Identifier = MN_FORMAT_ALGN ; \ - Command = ".uno:AlignTextMenu" ; \ - Text [ en-US ] = "A~lignment" ; \ - SubMenu = Menu\ - {\ - ItemList = \ - {\ - MenuItem\ - {\ - RadioCheck = TRUE ; \ - ITEM_FORMAT_ATTR_PARA_ADJUST_LEFT\ - };\ - MenuItem\ - {\ - RadioCheck = TRUE ; \ - ITEM_FORMAT_ATTR_PARA_ADJUST_RIGHT\ - };\ - MenuItem\ - {\ - RadioCheck = TRUE ; \ - ITEM_FORMAT_ATTR_PARA_ADJUST_CENTER\ - };\ - MenuItem\ - {\ - Identifier = SID_ATTR_PARA_ADJUST_BLOCK ; \ - HelpId = CMD_SID_ATTR_PARA_ADJUST_BLOCK ; \ - RadioCheck = TRUE ; \ - Text [ en-US ] = "Justified" ; \ - };\ - };\ - };\ - };\ - MenuItem\ - {\ - Identifier = MN_FORMAT_LINESPACE ; \ - Command = ".uno:LineSpacingMenu" ; \ - Text [ en-US ] = "Line Spacing" ; \ - _MenuItemFlags = MIB_RADIOCHECK ; \ - SubMenu = Menu\ - {\ - ItemList = \ - {\ - MenuItem\ - {\ - RadioCheck = TRUE ; \ - ITEM_FORMAT_PARA_LINESPACE_10\ - };\ - MenuItem\ - {\ - RadioCheck = TRUE ; \ - ITEM_FORMAT_PARA_LINESPACE_15\ - };\ - MenuItem\ - {\ - RadioCheck = TRUE ; \ - ITEM_FORMAT_PARA_LINESPACE_20\ - };\ - };\ - };\ - }; - -/* --------------------- M E N U --------------------------------- */ - -/* - - -The application menu bar resource has become obsolete. You can now find the menu bar at the following -location: <project>/uiconfig/[swriter|sweb|sglobal]/menubar/menubar.xml - - -*/ - -/* --------------------- D O C U M E N T -------------------------- */ - - -#define _MN_EDIT_FIELD \ - MenuItem \ - { \ - Identifier = FN_EDIT_FIELD ; \ - HelpId = CMD_FN_EDIT_FIELD ; \ - Text [ en-US ] = "Fields..." ; \ - }; -#define _MN_EDIT_FOOTNOTE \ - MenuItem \ - { \ - Identifier = FN_EDIT_FOOTNOTE ; \ - HelpId = CMD_FN_EDIT_FOOTNOTE ; \ - Text [ en-US ] = "Footnote/Endnote~..." ; \ - }; - #define _MN_EDIT_IDX_ENTRY_DLG \ - MenuItem \ - { \ - Identifier = FN_EDIT_IDX_ENTRY_DLG ; \ - HelpId = CMD_FN_EDIT_IDX_ENTRY_DLG ; \ - Text [ en-US ] = "Inde~x Entry..." ; \ - }; - -#define _MN_EDIT_REDLINE \ - MenuItem \ - { \ - Identifier = FN_REDLINE_ACCEPT_DIRECT; \ - HelpId = CMD_FN_REDLINE_ACCEPT_DIRECT ; \ - Text [ en-US ] = "Accept Change" ; \ - };\ - MenuItem \ - { \ - Identifier = FN_REDLINE_REJECT_DIRECT ; \ - HelpId = CMD_FN_REDLINE_REJECT_DIRECT ; \ - Text [ en-US ] = "Reject Change" ; \ - }; \ - SEPARATOR ; -#define _MN_EDIT_BIB_ENTRY_DLG \ - MenuItem \ - { \ - Identifier = FN_EDIT_AUTH_ENTRY_DLG ; \ - HelpId = CMD_FN_EDIT_AUTH_ENTRY_DLG ; \ - Text [ en-US ] = "~Bibliography Entry..."; \ - }; \ - SEPARATOR ; - -#define _MN_EDIT_OPEN_HYPERLINK \ - MenuItem \ - { \ - ITEM_OPEN_HYPERLINK \ - };\ - MenuItem \ - { \ - Identifier = FN_EDIT_HYPERLINK ; \ - HelpId = CMD_FN_EDIT_HYPERLINK ; \ - Text [ en-US ] = "Edit Hyperlink..."; \ - }; \ - MenuItem \ - { \ - Identifier = FN_COPY_HYPERLINK_LOCATION; \ - HelpId = CMD_FN_COPY_HYPERLINK_LOCATION; \ - Text [ en-US ] = "Copy Hyperlink ~Location"; \ - }; \ - MenuItem \ - { \ - Identifier = FN_REMOVE_HYPERLINK ; \ - HelpId = CMD_FN_REMOVE_HYPERLINK ; \ - Text [ en-US ] = "Remo~ve Hyperlink"; \ - }; - -#define _MN_EDIT_OPEN_SMARTTAGMENU \ - MenuItem \ - { \ - ITEM_OPEN_SMARTTAGMENU \ - }; - -#define _MN_EDIT__HYPERLINK \ - MenuItem\ - {\ - Identifier = FN_EDIT_HYPERLINK ; \ - HelpId = CMD_FN_EDIT_HYPERLINK ; \ - Text [ en-US ] = "~Edit Hyperlink" ; \ - }; - -#define _DEFAULT_TEXT_EDIT_ELEMENTS \ - _MN_EDIT_FIELD \ - _MN_EDIT_FOOTNOTE \ - _MN_EDIT_IDX_ENTRY_DLG \ - _MN_EDIT_BIB_ENTRY_DLG \ - _MN_EDIT_REDLINE \ - MenuItem \ - { \ - ITEM_POPUP_TEMPLATE_EDIT \ - }; \ - SEPARATOR ; \ - _MN_EDIT_OPEN_HYPERLINK \ - _MN_EDIT_OPEN_SMARTTAGMENU - - -#define MN_RESET\ - MenuItem\ - {\ - Identifier = FN_FORMAT_RESET ; \ - HelpId = CMD_FN_FORMAT_RESET ; \ - Text [ en-US ] = "~Default Formatting" ; \ - }; - -#define _NUMBERING_RELATED_MENU \ - SEPARATOR ; \ - MenuItem \ - { \ - Identifier = FN_NUMBER_NEWSTART; \ - HelpId = CMD_FN_NUMBER_NEWSTART; \ - Text[ en-US ] = "Restart Numbering"; \ - }; \ - MenuItem \ - { \ - Identifier = FN_NUM_CONTINUE; \ - HelpId = CMD_FN_NUM_CONTINUE; \ - Text[ en-US ] = "Continue previous numbering"; \ - }; \ - MenuItem \ - { \ - Identifier = FN_NUM_BULLET_UP; \ - HelpId = CMD_FN_NUM_BULLET_UP; \ - Text[ en-US ] = "Up One Level"; \ - }; \ - MenuItem \ - { \ - Identifier = FN_NUM_BULLET_DOWN; \ - HelpId = CMD_FN_NUM_BULLET_DOWN; \ - Text[ en-US ] = "Down One Level"; \ - }; - -#define BASE_TEXT_POPUPMENU_BEGIN \ -{ \ - ItemList = \ - { \ - MN_RESET \ - _NUMBERING_RELATED_MENU \ - SEPARATOR ; \ - MN_TEXT_ATTR \ - SEPARATOR ; \ - MN_TXT \ - MN_NUMBERING \ - ITEM_TRANSLITERATE_MENU \ - SEPARATOR ; - -// not in Writer/Web -#define BASE_TEXT_POPUPMENU_NOWEB \ - MenuItem \ - { \ - Identifier = FN_UPDATE_CUR_TOX ; \ - HelpId = CMD_FN_UPDATE_CUR_TOX ; \ - Text [ en-US ] = "~Update Index/Table"; \ - }; \ - MenuItem \ - { \ - Identifier = FN_EDIT_CURRENT_TOX; \ - HelpId = CMD_FN_EDIT_CURRENT_TOX; \ - Text [ en-US ] = "~Edit Index/Table"; \ - }; \ - MenuItem \ - { \ - Identifier = FN_REMOVE_CUR_TOX; \ - HelpId = CMD_FN_REMOVE_CUR_TOX; \ - Text [ en-US ] = "Delete Index/Table"; \ - }; \ - SEPARATOR ; - -#define BASE_TEXT_POPUPMENU_END \ - _DEFAULT_TEXT_EDIT_ELEMENTS \ - }; \ -}; - -#endif - diff --git a/sw/source/ui/inc/swuicnttab.hxx b/sw/source/ui/inc/swuicnttab.hxx index 5bb247187d..6038f4a2de 100644 --- a/sw/source/ui/inc/swuicnttab.hxx +++ b/sw/source/ui/inc/swuicnttab.hxx @@ -163,6 +163,8 @@ class SwTOXSelectTabPage : public SfxTabPage // PushButton aChapterDlgPB; //#outline level,removed by zhaojianwei CheckBox aAddStylesCB; PushButton aAddStylesPB; + Point aAddStylesPosDef; + Point aAddStylesPosUser; //user CheckBox aFromTablesCB; CheckBox aFromFramesCB; diff --git a/sw/source/ui/inc/swuiidxmrk.hxx b/sw/source/ui/inc/swuiidxmrk.hxx index de05db1b82..cef3fa83cf 100644 --- a/sw/source/ui/inc/swuiidxmrk.hxx +++ b/sw/source/ui/inc/swuiidxmrk.hxx @@ -52,7 +52,7 @@ #endif #ifndef _IMAGEBTN_HXX //autogen -#include <vcl/imagebtn.hxx> +#include <vcl/button.hxx> #endif #include <sfx2/childwin.hxx> #include "toxe.hxx" diff --git a/sw/source/ui/inc/toolbox_tmpl.hrc b/sw/source/ui/inc/toolbox.hrc index 8c73a70c60..8c73a70c60 100644 --- a/sw/source/ui/inc/toolbox_tmpl.hrc +++ b/sw/source/ui/inc/toolbox.hrc diff --git a/sw/source/ui/inc/usrpref.hxx b/sw/source/ui/inc/usrpref.hxx index 9f3f3e4f39..21b3e64405 100644 --- a/sw/source/ui/inc/usrpref.hxx +++ b/sw/source/ui/inc/usrpref.hxx @@ -147,6 +147,8 @@ class SwMasterUsrPref : public SwViewOption sal_Int32 nDefTab; //default tab stop distance sal_Bool bIsSquaredPageMode; //default page mode for text grid + sal_Bool bIsAlignMathObjectsToBaseline; + SwContentViewConfig aContentConfig; SwLayoutViewConfig aLayoutConfig; SwGridConfig aGridConfig; @@ -271,6 +273,13 @@ public: aLayoutConfig.SetModified(); } + sal_Bool IsAlignMathObjectsToBaseline() const { return bIsAlignMathObjectsToBaseline; } + void SetAlignMathObjectsToBaseline( sal_Bool bVal, sal_Bool bNoModify = sal_False ) + { + bIsAlignMathObjectsToBaseline = bVal; + if(!bNoModify) + aLayoutConfig.SetModified(); + } }; #endif diff --git a/sw/source/ui/inc/workctrl.hxx b/sw/source/ui/inc/workctrl.hxx index 6996ea1109..f6f878aa15 100644 --- a/sw/source/ui/inc/workctrl.hxx +++ b/sw/source/ui/inc/workctrl.hxx @@ -31,7 +31,7 @@ #include <vcl/toolbox.hxx> #include <svtools/stdctrl.hxx> #ifndef _IMAGEBTN_HXX //autogen -#include <vcl/imagebtn.hxx> +#include <vcl/button.hxx> #endif class PopupMenu; diff --git a/sw/source/ui/inc/wrap.hxx b/sw/source/ui/inc/wrap.hxx index 47486064e6..16bda288f8 100644 --- a/sw/source/ui/inc/wrap.hxx +++ b/sw/source/ui/inc/wrap.hxx @@ -31,7 +31,7 @@ #include <sfx2/basedlgs.hxx> #ifndef _IMAGEBTN_HXX //autogen -#include <vcl/imagebtn.hxx> +#include <vcl/button.hxx> #endif #ifndef _BUTTON_HXX //autogen diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx index 5d9a390600..b8ba8bb65a 100644 --- a/sw/source/ui/index/cnttab.cxx +++ b/sw/source/ui/index/cnttab.cxx @@ -828,7 +828,7 @@ SwAddStylesDlg_Impl::SwAddStylesDlg_Impl(Window* pParent, rHB.Show(); SwIndexTreeLB& rTLB = aHeaderTree.GetTreeListBox(); - rTLB.SetWindowBits(WB_CLIPCHILDREN|WB_SORT); + rTLB.SetStyle(rTLB.GetStyle()|WB_CLIPCHILDREN|WB_SORT); //aStylesTLB.SetSelectHdl(LINK(this, SwAddStylesDlg_Impl, SelectHdl)); rTLB.GetModel()->SetSortMode(SortAscending); for(i = 0; i < MAXLEVEL; ++i) @@ -1523,7 +1523,19 @@ IMPL_LINK(SwTOXSelectTabPage, TOXTypeHdl, ListBox*, pBox) //aAddStylesPB.SetPosPixel(aPos); //} //else if( nType & TO_ILLUSTRATION )//<-removed end. - if( nType & TO_ILLUSTRATION ) //add by zhaojianwei + // initialize button positions + + //#i111993# add styles button has two different positions + if( !aAddStylesPosDef.X() ) + { + aAddStylesPosDef = ( aAddStylesPB.GetPosPixel() ); + // move left! + Point aPos(aAddStylesPosDef); + aPos.X() -= 2 * aAddStylesPB.GetSizePixel().Width(); + aAddStylesPosUser = aPos; + } + + if( nType & TO_ILLUSTRATION ) //add by zhaojianwei aCaptionSequenceLB.SelectEntry( SwStyleNameMapper::GetUIName( RES_POOLCOLL_LABEL_ABB, aEmptyStr )); else if( nType & TO_TABLE ) @@ -1532,11 +1544,11 @@ IMPL_LINK(SwTOXSelectTabPage, TOXTypeHdl, ListBox*, pBox) else if( nType & TO_USER ) { aAddStylesCB.SetText(sAddStyleUser); - // move left! - Point aPos(aAddStylesPB.GetPosPixel()); - // aPos.X() = aChapterDlgPB.GetPosPixel().X(); - aPos.X() -= 2 * aAddStylesPB.GetSizePixel().Width(); - aAddStylesPB.SetPosPixel(aPos); + aAddStylesPB.SetPosPixel(aAddStylesPosUser); + } + else if( nType & TO_CONTENT ) + { + aAddStylesPB.SetPosPixel(aAddStylesPosDef); } aCollectSameCB.Show( 0 != (nType & TO_INDEX) ); @@ -1826,8 +1838,8 @@ void SwTOXEdit::KeyInput( const KeyEvent& rKEvt ) { const Selection& rSel = GetSelection(); sal_uInt16 nTextLen = GetText().Len(); - if(rSel.A() == rSel.B() && - !rSel.A() || rSel.A() == nTextLen ) + if( (rSel.A() == rSel.B() && + !rSel.A() ) || rSel.A() == nTextLen ) { sal_Bool bCall = sal_False; KeyCode aCode = rKEvt.GetKeyCode(); @@ -2124,7 +2136,7 @@ SwTOXEntryTabPage::SwTOXEntryTabPage(Window* pParent, const SfxItemSet& rAttrSet FreeResource(); sLevelStr = aLevelFT.GetText(); - aLevelLB.SetWindowBits( WB_HSCROLL ); + aLevelLB.SetStyle( aLevelLB.GetStyle() | WB_HSCROLL ); aLevelLB.SetSpaceBetweenEntries(0); aLevelLB.SetSelectionMode( SINGLE_SELECTION ); aLevelLB.SetHighlightRange(); // select full width @@ -3804,8 +3816,8 @@ IMPL_LINK(SwTokenWindow, EditResize, Edit*, pEdit) IMPL_LINK(SwTokenWindow, NextItemHdl, SwTOXEdit*, pEdit) { sal_uInt16 nPos = (sal_uInt16)aControlList.GetPos(pEdit); - if(nPos && !pEdit->IsNextControl() || - nPos < aControlList.Count() - 1 && pEdit->IsNextControl()) + if( (nPos && !pEdit->IsNextControl()) || + (nPos < aControlList.Count() - 1 && pEdit->IsNextControl())) { aControlList.Seek(nPos); Control* pNextPrev = pEdit->IsNextControl() ? aControlList.Next() : aControlList.Prev(); @@ -3840,8 +3852,8 @@ IMPL_LINK(SwTokenWindow, TbxFocusHdl, SwTOXEdit*, pEdit) IMPL_LINK(SwTokenWindow, NextItemBtnHdl, SwTOXButton*, pBtn ) { sal_uInt16 nPos = (sal_uInt16)aControlList.GetPos(pBtn); - if(nPos && !pBtn->IsNextControl() || - nPos < aControlList.Count() - 1 && pBtn->IsNextControl()) + if( (nPos && !pBtn->IsNextControl()) || + (nPos < aControlList.Count() - 1 && pBtn->IsNextControl())) { aControlList.Seek(nPos); sal_Bool bNext = pBtn->IsNextControl(); diff --git a/sw/source/ui/index/makefile.mk b/sw/source/ui/index/makefile.mk deleted file mode 100644 index 647b579e53..0000000000 --- a/sw/source/ui/index/makefile.mk +++ /dev/null @@ -1,68 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=index -LIBTARGET=NO -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -# --- Files -------------------------------------------------------- - -SRS1NAME=$(TARGET) -SRC1FILES = \ - cnttab.src \ - idxmrk.src \ - multmrk.src - -EXCEPTIONSFILES = \ - $(SLO)$/cnttab.obj \ - $(SLO)$/cntex.obj - -SLOFILES = \ - $(SLO)$/cnttab.obj \ - $(SLO)$/cntex.obj \ - $(SLO)$/idxmrk.obj \ - $(SLO)$/swuiidxmrk.obj \ - $(SLO)$/multmrk.obj \ - $(SLO)$/toxmgr.obj - -LIB1TARGET= $(SLB)$/$(TARGET).lib - -LIB1OBJFILES = \ - $(SLO)$/idxmrk.obj \ - $(SLO)$/toxmgr.obj - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/ui/lingu/makefile.mk b/sw/source/ui/lingu/makefile.mk deleted file mode 100644 index 617910a610..0000000000 --- a/sw/source/ui/lingu/makefile.mk +++ /dev/null @@ -1,56 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=lingu - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -# --- Files -------------------------------------------------------- - -EXCEPTIONSFILES= \ - $(SLO)$/olmenu.obj \ - -SLOFILES = \ - $(SLO)$/hyp.obj \ - $(SLO)$/olmenu.obj \ - $(SLO)$/sdrhhcwrap.obj \ - $(SLO)$/hhcwrp.obj - -SRS1NAME=$(TARGET) -SRC1FILES = \ - olmenu.src - -# --- Targets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/ui/makefile.mk b/sw/source/ui/makefile.mk deleted file mode 100644 index b331a2a007..0000000000 --- a/sw/source/ui/makefile.mk +++ /dev/null @@ -1,101 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. - -PRJNAME=sw -TARGET=ui - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -.IF "$(GUI)" != "OS2" -.IF "$(GUI)" != "WNT" -.IF "$(COM)" != "BLC" -.IF "$(COM)" != "WTC" -LIBFLAGS=/NOI /NOE /PAGE:256 -.ENDIF -.ENDIF -.ENDIF -.ENDIF - -# --- Files -------------------------------------------------------- - -# andere Label als Verzeichnisnamen fuer VC++/NT - -SUBLIBS1= \ - $(SLB)$/app.lib \ - $(SLB)$/cctrl.lib \ - $(SLB)$/chrdlg.lib \ - $(SLB)$/config.lib \ - $(SLB)$/dbui.lib \ - $(SLB)$/dialog.lib \ - $(SLB)$/dochdl.lib \ - $(SLB)$/docvw.lib \ - $(SLB)$/envelp.lib \ - $(SLB)$/fldui.lib \ - $(SLB)$/frmdlg.lib \ - $(SLB)$/globdoc.lib - -SUBLIBS2= \ - $(SLB)$/index.lib \ - $(SLB)$/lingu.lib \ - $(SLB)$/misc.lib \ - $(SLB)$/ribbar.lib \ - $(SLB)$/shells.lib \ - $(SLB)$/smartmenu.lib \ - $(SLB)$/table.lib \ - $(SLB)$/unoidl.lib \ - $(SLB)$/utlui.lib \ - $(SLB)$/web.lib \ - $(SLB)$/uiview.lib \ - $(SLB)$/wrtsh.lib - -# ----------------------------------------------------------- - -################################################################ - -LIB1TARGET=$(SLB)$/ui1.lib -LIB1FILES= \ - $(SUBLIBS1) - -LIB2TARGET=$(SLB)$/ui2.lib -LIB2FILES= \ - $(SUBLIBS2) - -.INCLUDE : target.mk - -################################################################ - -kill: - @$(RM) $(SLB)$/ui.lst - @$(RM) $(SLB)$/ui.lib - - diff --git a/sw/source/ui/misc/docfnote.cxx b/sw/source/ui/misc/docfnote.cxx index b6f075b6b4..9c6b18a831 100644 --- a/sw/source/ui/misc/docfnote.cxx +++ b/sw/source/ui/misc/docfnote.cxx @@ -265,7 +265,7 @@ void SwEndNoteOptionPage::Reset( const SfxItemSet& ) } // Seite - for( i = RES_POOLPAGE_BEGIN; i <= RES_POOLPAGE_LANDSCAPE; ++i ) + for( i = RES_POOLPAGE_BEGIN; i < RES_POOLPAGE_END; ++i ) aPageTemplBox.InsertEntry(SwStyleNameMapper::GetUIName( i, aEmptyStr )); USHORT nCount = pSh->GetPageDescCnt(); diff --git a/sw/source/ui/misc/glosbib.cxx b/sw/source/ui/misc/glosbib.cxx index 5374ddd2e2..ddb966aad2 100644 --- a/sw/source/ui/misc/glosbib.cxx +++ b/sw/source/ui/misc/glosbib.cxx @@ -107,7 +107,7 @@ SwGlossaryGroupDlg::SwGlossaryGroupDlg(Window * pParent, aGroupTLB.SetHelpId(HID_GLOS_GROUP_TREE); aGroupTLB.SetTabs( &nTabs[0], MAP_APPFONT ); - aGroupTLB.SetWindowBits(WB_HSCROLL|WB_CLIPCHILDREN|WB_SORT); + aGroupTLB.SetStyle(aGroupTLB.GetStyle()|WB_HSCROLL|WB_CLIPCHILDREN|WB_SORT); aGroupTLB.SetSelectHdl(LINK(this, SwGlossaryGroupDlg, SelectHdl)); aGroupTLB.GetModel()->SetSortMode(SortAscending); aNewPB.SetClickHdl(LINK(this, SwGlossaryGroupDlg, NewHdl)); diff --git a/sw/source/ui/misc/glosdoc.cxx b/sw/source/ui/misc/glosdoc.cxx index 8c13ab80fd..11b50fde12 100644 --- a/sw/source/ui/misc/glosdoc.cxx +++ b/sw/source/ui/misc/glosdoc.cxx @@ -523,7 +523,7 @@ void SwGlossaries::UpdateGlosPath(sal_Bool bFull) aDirArr.DeleteAndDestroy(0, aDirArr.Count()); if(!nTokenCount || - m_sErrPath.Len() && (bPathChanged || m_sOldErrPath != m_sErrPath) ) + (m_sErrPath.Len() && (bPathChanged || m_sOldErrPath != m_sErrPath)) ) { m_sOldErrPath = m_sErrPath; // Falscher Pfad, d.h. AutoText-Verzeichnis existiert nicht diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx index faec81b639..b5c137a4e5 100644 --- a/sw/source/ui/misc/glossary.cxx +++ b/sw/source/ui/misc/glossary.cxx @@ -294,7 +294,7 @@ SwGlossaryDlg::SwGlossaryDlg(SfxViewFrame* pViewFrame, aInsertBtn.Enable(sal_False); aNameED.GrabFocus(); aCategoryBox.SetHelpId(HID_MD_GLOS_CATEGORY); - aCategoryBox.SetWindowBits(WB_HASBUTTONS|WB_HASBUTTONSATROOT|WB_HSCROLL|WB_VSCROLL|WB_CLIPCHILDREN|WB_SORT); + aCategoryBox.SetStyle(aCategoryBox.GetStyle()|WB_HASBUTTONS|WB_HASBUTTONSATROOT|WB_HSCROLL|WB_VSCROLL|WB_CLIPCHILDREN|WB_SORT); aCategoryBox.GetModel()->SetSortMode(SortAscending); aCategoryBox.SetHighlightRange(); // ueber volle Breite selektieren aCategoryBox.SetNodeDefaultImages( ); diff --git a/sw/source/ui/misc/makefile.mk b/sw/source/ui/misc/makefile.mk deleted file mode 100644 index 72d9f80aec..0000000000 --- a/sw/source/ui/misc/makefile.mk +++ /dev/null @@ -1,96 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=misc -LIBTARGET=no -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -# --- Files -------------------------------------------------------- - -SRS1NAME=$(TARGET) -SRC1FILES=\ - bookmark.src \ - docfnote.src \ - glossary.src \ - glosbib.src \ - insfnote.src \ - insrule.src \ - linenum.src \ - num.src \ - numberingtypelistbox.src \ - outline.src \ - pgfnote.src \ - pggrid.src \ - redlndlg.src \ - srtdlg.src - -EXCEPTIONSFILES = \ - $(SLO)$/glossary.obj \ - $(SLO)$/glosdoc.obj \ - $(SLO)$/glshell.obj \ - $(SLO)$/numberingtypelistbox.obj \ - $(SLO)$/outline.obj \ - $(SLO)$/redlndlg.obj - - -SLOFILES = \ - $(SLO)$/bookmark.obj \ - $(SLO)$/docfnote.obj \ - $(SLO)$/glosbib.obj \ - $(SLO)$/glosdoc.obj \ - $(SLO)$/glossary.obj \ - $(SLO)$/glshell.obj \ - $(SLO)$/insfnote.obj \ - $(SLO)$/insrule.obj \ - $(SLO)$/linenum.obj \ - $(SLO)$/num.obj \ - $(SLO)$/numberingtypelistbox.obj \ - $(SLO)$/outline.obj \ - $(SLO)$/pgfnote.obj \ - $(SLO)$/pggrid.obj \ - $(SLO)$/redlndlg.obj \ - $(SLO)$/swmodalredlineacceptdlg.obj \ - $(SLO)$/srtdlg.obj - -LIB1TARGET = $(SLB)$/$(TARGET).lib - -LIB1OBJFILES = \ - $(SLO)$/glosdoc.obj \ - $(SLO)$/glshell.obj \ - $(SLO)$/numberingtypelistbox.obj \ - $(SLO)$/redlndlg.obj - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/ui/misc/outline.cxx b/sw/source/ui/misc/outline.cxx index d0bc7b5b38..ed3343129b 100644 --- a/sw/source/ui/misc/outline.cxx +++ b/sw/source/ui/misc/outline.cxx @@ -617,8 +617,8 @@ void SwOutlineSettingsTabPage::Update() bSameSuffix &= aNumFmtArr[i]->GetSuffix() == aNumFmtArr[0]->GetSuffix(); bSameComplete &= aNumFmtArr[i]->GetIncludeUpperLevels() == aNumFmtArr[0]->GetIncludeUpperLevels(); const SwCharFmt* pFmt = aNumFmtArr[i]->GetCharFmt(); - bSameCharFmt &= !pFirstFmt && !pFmt - || pFirstFmt && pFmt && pFmt->GetName() == pFirstFmt->GetName(); + bSameCharFmt &= (!pFirstFmt && !pFmt) + || (pFirstFmt && pFmt && pFmt->GetName() == pFirstFmt->GetName()); } } CheckForStartValue_Impl(aNumFmtArr[0]->GetNumberingType()); diff --git a/sw/source/ui/misc/redlndlg.cxx b/sw/source/ui/misc/redlndlg.cxx index e2b7e6a151..2947edfcee 100644 --- a/sw/source/ui/misc/redlndlg.cxx +++ b/sw/source/ui/misc/redlndlg.cxx @@ -273,7 +273,7 @@ SwRedlineAcceptDlg::SwRedlineAcceptDlg(Dialog *pParent, BOOL bAutoFmt) : pActLB->SelectEntryPos(0); - pTable->SetWindowBits(WB_HASLINES|WB_CLIPCHILDREN|WB_HASBUTTONS|WB_HASBUTTONSATROOT|WB_HSCROLL); + pTable->SetStyle(pTable->GetStyle()|WB_HASLINES|WB_CLIPCHILDREN|WB_HASBUTTONS|WB_HASBUTTONSATROOT|WB_HSCROLL); pTable->SetNodeDefaultImages(); pTable->SetSelectionMode(MULTIPLE_SELECTION); pTable->SetHighlightRange(1); diff --git a/sw/source/ui/ribbar/makefile.mk b/sw/source/ui/ribbar/makefile.mk deleted file mode 100644 index 2adb59eec1..0000000000 --- a/sw/source/ui/ribbar/makefile.mk +++ /dev/null @@ -1,70 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=ribbar - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -# --- Files -------------------------------------------------------- - -SRS1NAME=$(TARGET) -SRC1FILES = \ - tbxanchr.src \ - inputwin.src \ - workctrl.src - -EXCEPTIONSFILES = \ - $(SLO)$/tblctrl.obj \ - $(SLO)$/tbxanchr.obj \ - $(SLO)$/workctrl.obj - -SLOFILES = \ - $(SLO)$/inputwin.obj \ - $(SLO)$/tbxanchr.obj \ - $(SLO)$/conrect.obj \ - $(SLO)$/conform.obj \ - $(SLO)$/conpoly.obj \ - $(SLO)$/conarc.obj \ - $(SLO)$/concustomshape.obj \ - $(SLO)$/dselect.obj \ - $(SLO)$/drawbase.obj \ - $(SLO)$/tblctrl.obj \ - $(SLO)$/workctrl.obj - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk - -$(SRS)$/ribbar.srs: $(SOLARINCDIR)$/svx$/globlmn.hrc - diff --git a/sw/source/ui/shells/annotsh.cxx b/sw/source/ui/shells/annotsh.cxx index 3486fd06a8..bd465c6dd1 100755 --- a/sw/source/ui/shells/annotsh.cxx +++ b/sw/source/ui/shells/annotsh.cxx @@ -1010,7 +1010,6 @@ void SwAnnotationShell::NoteExec(SfxRequest &rReq) case FN_REPLY: case FN_POSTIT: case FN_DELETE_COMMENT: - case FN_DELETE_NOTE: if ( pPostItMgr->HasActiveSidebarWin() ) pPostItMgr->GetActiveSidebarWin()->ExecuteCommand(nSlot); break; @@ -1058,24 +1057,15 @@ void SwAnnotationShell::GetNoteState(SfxItemSet &rSet) switch( nSlotId ) { case FN_POSTIT: - case FN_DELETE_NOTE: case FN_DELETE_NOTE_AUTHOR: case FN_DELETE_ALL_NOTES: case FN_HIDE_NOTE: case FN_HIDE_NOTE_AUTHOR: case FN_HIDE_ALL_NOTES: - { - if ( !pPostItMgr || - !pPostItMgr->HasActiveAnnotationWin() ) - { - rSet.DisableItem(nWhich); - } - break; - } case FN_DELETE_COMMENT: { if ( !pPostItMgr || - !pPostItMgr->HasActiveSidebarWin() /*HasActiveRedCommentWin()*/ ) + !pPostItMgr->HasActiveAnnotationWin() ) { rSet.DisableItem(nWhich); } @@ -1108,7 +1098,7 @@ void SwAnnotationShell::GetNoteState(SfxItemSet &rSet) if (pPostItMgr->HasActiveSidebarWin()) { if ( (pPostItMgr->GetActiveSidebarWin()->IsProtected()) && - ( (nSlotId==FN_DELETE_NOTE) || (nSlotId==FN_REPLY) ) ) + ( (nSlotId==FN_DELETE_COMMENT) || (nSlotId==FN_REPLY) ) ) rSet.DisableItem( nWhich ); } nWhich = aIter.NextWhich(); diff --git a/sw/source/ui/shells/basesh.cxx b/sw/source/ui/shells/basesh.cxx index 025403cc08..ee845c932b 100644 --- a/sw/source/ui/shells/basesh.cxx +++ b/sw/source/ui/shells/basesh.cxx @@ -1080,6 +1080,14 @@ void SwBaseShell::Execute(SfxRequest &rReq) rSh.SetFlyFrmAttr(aSet); } + // if new anchor is 'as char' and it is a Math object and the usual + // pre-conditions are met then align the formula to the baseline of the text + const uno::Reference < embed::XEmbeddedObject > xObj( rSh.GetOleRef() ); + const bool bDoMathBaselineAlignment = xObj.is() && SotExchange::IsMath( xObj->getClassID() ) + && FLY_AS_CHAR == eSet && rSh.GetDoc()->get( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT ); + if (bDoMathBaselineAlignment) + rSh.AlignFormulaToBaseline( xObj ); + USHORT nHtmlMode = ::GetHtmlMode(GetView().GetDocShell()); if( nHtmlMode ) { diff --git a/sw/source/ui/shells/frmsh.cxx b/sw/source/ui/shells/frmsh.cxx index b2dfee2fa4..5c63a56da7 100644 --- a/sw/source/ui/shells/frmsh.cxx +++ b/sw/source/ui/shells/frmsh.cxx @@ -52,7 +52,7 @@ #include <vcl/msgbox.hxx> // <-- - +#include <doc.hxx> #include <fmturl.hxx> #include <fmtclds.hxx> #include <fmtcnct.hxx> @@ -78,6 +78,7 @@ #include <helpid.h> #include <cmdid.h> +#include <cfgitems.hxx> #include <globals.hrc> #include <popup.hrc> #include <shells.hrc> @@ -408,14 +409,13 @@ void SwFrameShell::Execute(SfxRequest &rReq) SID_HTML_MODE, SID_HTML_MODE, FN_SET_FRM_ALT_NAME, FN_SET_FRM_ALT_NAME, FN_PARAM_CHAIN_PREVIOUS, FN_PARAM_CHAIN_NEXT, + FN_OLE_IS_MATH, FN_OLE_IS_MATH, + FN_MATH_BASELINE_ALIGNMENT, FN_MATH_BASELINE_ALIGNMENT, 0); const SwViewOption* pVOpt = rSh.GetViewOptions(); if(nSel & nsSelectionType::SEL_OLE) - { - aSet.Put(SfxBoolItem(FN_KEEP_ASPECT_RATIO, - pVOpt->IsKeepRatio())); - } + aSet.Put( SfxBoolItem(FN_KEEP_ASPECT_RATIO, pVOpt->IsKeepRatio()) ); aSet.Put(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(GetView().GetDocShell()))); aSet.Put(SfxStringItem(FN_SET_FRM_NAME, rSh.GetFlyName())); if( nSel & nsSelectionType::SEL_OLE ) @@ -446,6 +446,12 @@ void SwFrameShell::Execute(SfxRequest &rReq) if (rSize.GetHeightPercent() && rSize.GetHeightPercent() != 0xff) rSize.SetHeight(rSh.GetAnyCurRect(RECT_FLY_EMBEDDED).Height()); + // disable vertical positioning for Math Objects anchored 'as char' if baseline alignment is activated + aSet.Put( SfxBoolItem( FN_MATH_BASELINE_ALIGNMENT, + rSh.GetDoc()->get( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT ) ) ); + const uno::Reference < embed::XEmbeddedObject > xObj( rSh.GetOleRef() ); + aSet.Put( SfxBoolItem( FN_OLE_IS_MATH, xObj.is() && SotExchange::IsMath( xObj->getClassID() ) ) ); + UINT16 nDefPage = 0; if(pArgs && pArgs->GetItemState(FN_FORMAT_FRAME_DLG, FALSE, &pItem) == SFX_ITEM_SET) nDefPage = ((SfxUInt16Item *)pItem)->GetValue(); @@ -711,7 +717,7 @@ void SwFrameShell::GetState(SfxItemSet& rSet) case FN_FRAME_ALIGN_HORZ_LEFT: if ( (eFrmType & FRMTYPE_FLY_INCNT) || bProtect || - (nWhich == FN_FRAME_ALIGN_HORZ_CENTER || nWhich == SID_OBJECT_ALIGN_CENTER)&& bHtmlMode ) + ((nWhich == FN_FRAME_ALIGN_HORZ_CENTER || nWhich == SID_OBJECT_ALIGN_CENTER)&& bHtmlMode) ) rSet.DisableItem( nWhich ); break; case FN_FRAME_ALIGN_VERT_ROW_TOP: @@ -721,7 +727,7 @@ void SwFrameShell::GetState(SfxItemSet& rSet) case FN_FRAME_ALIGN_VERT_CHAR_CENTER: case FN_FRAME_ALIGN_VERT_CHAR_BOTTOM: if ( !(eFrmType & FRMTYPE_FLY_INCNT) || bProtect - || bHtmlMode && FN_FRAME_ALIGN_VERT_CHAR_BOTTOM == nWhich ) + || (bHtmlMode && FN_FRAME_ALIGN_VERT_CHAR_BOTTOM == nWhich) ) rSet.DisableItem( nWhich ); break; @@ -732,7 +738,7 @@ void SwFrameShell::GetState(SfxItemSet& rSet) case FN_FRAME_ALIGN_VERT_TOP: case FN_FRAME_ALIGN_VERT_CENTER: case FN_FRAME_ALIGN_VERT_BOTTOM: - if ( bProtect || bHtmlMode && eFrmType & FRMTYPE_FLY_ATCNT) + if ( bProtect || (bHtmlMode && eFrmType & FRMTYPE_FLY_ATCNT) ) rSet.DisableItem( nWhich ); else { @@ -1146,3 +1152,4 @@ void SwFrameShell::StateInsert(SfxItemSet &rSet) if ((nSel & nsSelectionType::SEL_GRF) || (nSel & nsSelectionType::SEL_OLE)) rSet.DisableItem(FN_INSERT_FRAME); } + diff --git a/sw/source/ui/shells/makefile.mk b/sw/source/ui/shells/makefile.mk deleted file mode 100644 index dce62a2c93..0000000000 --- a/sw/source/ui/shells/makefile.mk +++ /dev/null @@ -1,94 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=shells - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -# --- Files -------------------------------------------------------- - -SRS1NAME=$(TARGET) -SRC1FILES = \ - shells.src - -SLOFILES = \ - $(SLO)$/langhelper.obj \ - $(SLO)$/annotsh.obj \ - $(SLO)$/basesh.obj \ - $(SLO)$/beziersh.obj \ - $(SLO)$/drawdlg.obj \ - $(SLO)$/drawsh.obj \ - $(SLO)$/drformsh.obj \ - $(SLO)$/drwbassh.obj \ - $(SLO)$/drwtxtex.obj \ - $(SLO)$/drwtxtsh.obj \ - $(SLO)$/frmsh.obj \ - $(SLO)$/grfsh.obj \ - $(SLO)$/grfshex.obj \ - $(SLO)$/mediash.obj \ - $(SLO)$/listsh.obj \ - $(SLO)$/olesh.obj \ - $(SLO)$/slotadd.obj \ - $(SLO)$/tabsh.obj \ - $(SLO)$/textdrw.obj \ - $(SLO)$/textfld.obj \ - $(SLO)$/textglos.obj \ - $(SLO)$/textidx.obj \ - $(SLO)$/textsh.obj \ - $(SLO)$/textsh1.obj \ - $(SLO)$/textsh2.obj \ - $(SLO)$/txtattr.obj \ - $(SLO)$/txtcrsr.obj \ - $(SLO)$/txtnum.obj - -EXCEPTIONSFILES = \ - $(SLO)$/basesh.obj \ - $(SLO)$/annotsh.obj \ - $(SLO)$/drwtxtsh.obj \ - $(SLO)$/textsh.obj \ - $(SLO)$/textsh2.obj \ - $(SLO)$/grfshex.obj \ - $(SLO)$/drawsh.obj \ - $(SLO)$/drwtxtsh.obj \ - $(SLO)$/frmsh.obj \ - $(SLO)$/drwtxtex.obj \ - $(SLO)$/slotadd.obj \ - $(SLO)$/textsh1.obj - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk - -$(SRS)$/shells.srs: $(SOLARINCDIR)$/svx$/globlmn.hrc - diff --git a/sw/source/ui/shells/tabsh.cxx b/sw/source/ui/shells/tabsh.cxx index 486737089d..9d4a860e18 100644 --- a/sw/source/ui/shells/tabsh.cxx +++ b/sw/source/ui/shells/tabsh.cxx @@ -220,7 +220,7 @@ static SwTableRep* lcl_TableParamToItemSet( SfxItemSet& rSet, SwWrtShell &rSh ) // Tabellenvariante, wenn mehrere Tabellenzellen selektiert rSh.GetCrsr(); //Damit GetCrsrCnt() auch das Richtige liefert - aBoxInfo.SetTable (rSh.IsTableMode() && rSh.GetCrsrCnt() > 1 || + aBoxInfo.SetTable ((rSh.IsTableMode() && rSh.GetCrsrCnt() > 1) || !bTableSel); // Abstandsfeld immer anzeigen aBoxInfo.SetDist ((BOOL) TRUE); @@ -663,7 +663,7 @@ void SwTableShell::Execute(SfxRequest &rReq) else aCoreSet.InvalidateItem( RES_BACKGROUND ); - if ( !pDlg && rReq.GetArgs() || pDlg->Execute() == RET_OK ) + if ( (!pDlg && rReq.GetArgs()) || pDlg->Execute() == RET_OK ) { const SfxItemSet* pOutSet = pDlg ? pDlg->GetOutputItemSet() : rReq.GetArgs(); if ( pDlg ) @@ -1330,9 +1330,9 @@ void SwTableShell::GetState(SfxItemSet &rSet) case FN_TABLE_VERT_BOTTOM: { USHORT nAlign = rSh.GetBoxAlign(); - BOOL bSet = nSlot == FN_TABLE_VERT_NONE && nAlign == text::VertOrientation::NONE|| - nSlot == FN_TABLE_VERT_CENTER && nAlign == text::VertOrientation::CENTER || - nSlot == FN_TABLE_VERT_BOTTOM && nAlign == text::VertOrientation::BOTTOM; + BOOL bSet = (nSlot == FN_TABLE_VERT_NONE && nAlign == text::VertOrientation::NONE) || + (nSlot == FN_TABLE_VERT_CENTER && nAlign == text::VertOrientation::CENTER) || + (nSlot == FN_TABLE_VERT_BOTTOM && nAlign == text::VertOrientation::BOTTOM); rSet.Put(SfxBoolItem(nSlot, bSet)); } break; @@ -1342,9 +1342,9 @@ void SwTableShell::GetState(SfxItemSet &rSet) case FN_TABLE_MODE_VARIABLE : { TblChgMode nMode = rSh.GetTblChgMode(); - BOOL bSet = nSlot == FN_TABLE_MODE_FIX && nMode == TBLFIX_CHGABS || - nSlot == FN_TABLE_MODE_FIX_PROP && nMode == TBLFIX_CHGPROP || - nSlot == FN_TABLE_MODE_VARIABLE && nMode == TBLVAR_CHGABS; + BOOL bSet = (nSlot == FN_TABLE_MODE_FIX && nMode == TBLFIX_CHGABS) || + (nSlot == FN_TABLE_MODE_FIX_PROP && nMode == TBLFIX_CHGPROP) || + (nSlot == FN_TABLE_MODE_VARIABLE && nMode == TBLVAR_CHGABS); rSet.Put(SfxBoolItem(nSlot, bSet)); } break; diff --git a/sw/source/ui/shells/textfld.cxx b/sw/source/ui/shells/textfld.cxx index 7bef6d5265..1c1efba2cd 100644 --- a/sw/source/ui/shells/textfld.cxx +++ b/sw/source/ui/shells/textfld.cxx @@ -313,7 +313,7 @@ void SwTextShell::ExecField(SfxRequest &rReq) rReq.Ignore(); } break; - case FN_DELETE_NOTE: + case FN_DELETE_COMMENT: if ( GetView().GetPostItMgr() && GetView().GetPostItMgr()->HasActiveSidebarWin() ) { @@ -622,7 +622,7 @@ void SwTextShell::StateField( SfxItemSet &rSet ) { switch (nWhich) { - case FN_DELETE_NOTE: + case FN_DELETE_COMMENT: case FN_DELETE_NOTE_AUTHOR: case FN_DELETE_ALL_NOTES: case FN_HIDE_NOTE: @@ -634,7 +634,7 @@ void SwTextShell::StateField( SfxItemSet &rSet ) rSet.InvalidateItem( nWhich ); else if ( !pPostItMgr->HasActiveSidebarWin() ) { - rSet.InvalidateItem( FN_DELETE_NOTE ); + rSet.InvalidateItem( FN_DELETE_COMMENT ); rSet.InvalidateItem( FN_HIDE_NOTE ); } } diff --git a/sw/source/ui/shells/textsh.cxx b/sw/source/ui/shells/textsh.cxx index 0326473a08..8117200882 100644 --- a/sw/source/ui/shells/textsh.cxx +++ b/sw/source/ui/shells/textsh.cxx @@ -627,16 +627,18 @@ void SwTextShell::ExecInsert(SfxRequest &rReq) DBG_ASSERT(pDlg, "Dialogdiet fail!"); if(pDlg->Execute() && pDlg->GetOutputItemSet()) { - GetShell().LockPaint(); - GetShell().StartAllAction(); - GetShell().StartUndo(UNDO_INSERT); + //local variable necessary at least after call of .AutoCaption() because this could be deleted at this point + SwWrtShell& rShell = GetShell(); + rShell.LockPaint(); + rShell.StartAllAction(); + rShell.StartUndo(UNDO_INSERT); const SfxItemSet* pOutSet = pDlg->GetOutputItemSet(); aMgr.SetAttrSet(*pOutSet); // beim ClickToEditFeld erst die Selektion loeschen - if( GetShell().IsInClickToEdit() ) - GetShell().DelRight(); + if( rShell.IsInClickToEdit() ) + rShell.DelRight(); aMgr.InsertFlyFrm(); @@ -647,8 +649,8 @@ void SwTextShell::ExecInsert(SfxRequest &rReq) //FN_INSERT_FRAME USHORT nAnchor = (USHORT)aMgr.GetAnchor(); rReq.AppendItem(SfxUInt16Item(nSlot, nAnchor)); - rReq.AppendItem(SfxPointItem(FN_PARAM_1, GetShell().GetObjAbsPos())); - rReq.AppendItem(SvxSizeItem(FN_PARAM_2, GetShell().GetObjSize())); + rReq.AppendItem(SfxPointItem(FN_PARAM_1, rShell.GetObjAbsPos())); + rReq.AppendItem(SvxSizeItem(FN_PARAM_2, rShell.GetObjSize())); rReq.Done(); } @@ -659,10 +661,10 @@ void SwTextShell::ExecInsert(SfxRequest &rReq) aRewriter.AddRule(UNDO_ARG1, SW_RES(STR_FRAME)); - GetShell().EndUndo(UNDO_INSERT, &aRewriter); + rShell.EndUndo(UNDO_INSERT, &aRewriter); } - GetShell().EndAllAction(); - GetShell().UnlockPaint(); + rShell.EndAllAction(); + rShell.UnlockPaint(); } DELETEZ(pDlg); @@ -900,7 +902,7 @@ void SwTextShell::StateInsert( SfxItemSet &rSet ) } break; case FN_INSERT_HRULER : - if(rSh.IsReadOnlyAvailable() && rSh.HasReadonlySel() || bCrsrInHidden ) + if((rSh.IsReadOnlyAvailable() && rSh.HasReadonlySel()) || bCrsrInHidden ) rSet.DisableItem(nWhich); break; case FN_FORMAT_COLUMN : diff --git a/sw/source/ui/shells/textsh1.cxx b/sw/source/ui/shells/textsh1.cxx index 8640319d7f..63d767fe24 100644 --- a/sw/source/ui/shells/textsh1.cxx +++ b/sw/source/ui/shells/textsh1.cxx @@ -1743,8 +1743,8 @@ void SwTextShell::ChangeHeaderOrFooter( if( !rStyleName.Len() || rStyleName == sTmp ) { if( bShowWarning && !bOn && GetActiveView() && GetActiveView() == &GetView() && - (bHeader && aDesc.GetMaster().GetHeader().IsActive() || - !bHeader && aDesc.GetMaster().GetFooter().IsActive())) + ((bHeader && aDesc.GetMaster().GetHeader().IsActive()) || + (!bHeader && aDesc.GetMaster().GetFooter().IsActive()))) { bShowWarning = FALSE; //Actions have to be closed while the dialog is showing diff --git a/sw/source/ui/shells/txtattr.cxx b/sw/source/ui/shells/txtattr.cxx index 10547000c5..0993657adc 100644 --- a/sw/source/ui/shells/txtattr.cxx +++ b/sw/source/ui/shells/txtattr.cxx @@ -119,8 +119,8 @@ void SwTextShell::ExecCharAttr(SfxRequest &rReq) eEscape = nWhich == FN_SET_SUPER_SCRIPT ? SVX_ESCAPEMENT_SUPERSCRIPT: SVX_ESCAPEMENT_SUBSCRIPT; - if( nWhich == FN_SET_SUB_SCRIPT && nTmpEsc < 0 || - nWhich == FN_SET_SUPER_SCRIPT && nTmpEsc > 0 ) + if( (nWhich == FN_SET_SUB_SCRIPT && nTmpEsc < 0) || + (nWhich == FN_SET_SUPER_SCRIPT && nTmpEsc > 0) ) eEscape = SVX_ESCAPEMENT_OFF; SfxBindings& rBind = GetView().GetViewFrame()->GetBindings(); diff --git a/sw/source/ui/smartmenu/makefile.mk b/sw/source/ui/smartmenu/makefile.mk deleted file mode 100644 index 1950430cf3..0000000000 --- a/sw/source/ui/smartmenu/makefile.mk +++ /dev/null @@ -1,53 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=smartmenu - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -# --- Files -------------------------------------------------------- - -EXCEPTIONSFILES = \ - $(SLO)$/stmenu.obj - -SLOFILES = \ - $(SLO)$/stmenu.obj - -SRS1NAME=$(TARGET) -SRC1FILES = \ - stmenu.src - -# --- Targets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/ui/table/makefile.mk b/sw/source/ui/table/makefile.mk deleted file mode 100644 index 8b2ba850d1..0000000000 --- a/sw/source/ui/table/makefile.mk +++ /dev/null @@ -1,81 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=table -LIBTARGET=no -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -# --- Files -------------------------------------------------------- - -EXCEPTIONSFILES= \ - $(SLO)$/chartins.obj\ - -SRS1NAME=$(TARGET) -SRC1FILES = \ - colwd.src \ - convert.src \ - chartins.src \ - instable.src \ - mergetbl.src \ - rowht.src \ - splittbl.src \ - table.src \ - tabledlg.src \ - tautofmt.src - -SLOFILES = \ - $(SLO)$/colwd.obj \ - $(SLO)$/convert.obj \ - $(SLO)$/chartins.obj \ - $(SLO)$/instable.obj \ - $(SLO)$/mergetbl.obj \ - $(SLO)$/rowht.obj \ - $(SLO)$/splittbl.obj \ - $(SLO)$/tabledlg.obj \ - $(SLO)$/tablemgr.obj \ - $(SLO)$/swtablerep.obj \ - $(SLO)$/tautofmt.obj - -LIB1TARGET = $(SLB)$/$(TARGET).lib - -LIB1OBJFILES = \ - $(SLO)$/chartins.obj \ - $(SLO)$/swtablerep.obj \ - $(SLO)$/tablemgr.obj - - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/ui/table/tabledlg.cxx b/sw/source/ui/table/tabledlg.cxx index 53eb804c59..8578dc3b99 100644 --- a/sw/source/ui/table/tabledlg.cxx +++ b/sw/source/ui/table/tabledlg.cxx @@ -1643,7 +1643,7 @@ void SwTextFlowPage::Reset( const SfxItemSet& rSet ) } String aFmtName; - for(i = RES_POOLPAGE_BEGIN; i <= RES_POOLPAGE_REGISTER; ++i) + for(i = RES_POOLPAGE_BEGIN; i < RES_POOLPAGE_END; ++i) if( LISTBOX_ENTRY_NOTFOUND == aPageCollLB.GetEntryPos( aFmtName = SwStyleNameMapper::GetUIName( i, aFmtName ) )) aPageCollLB.InsertEntry( aFmtName ); diff --git a/sw/source/ui/table/tablepg.hxx b/sw/source/ui/table/tablepg.hxx index f4b00f5062..ea40fec677 100644 --- a/sw/source/ui/table/tablepg.hxx +++ b/sw/source/ui/table/tablepg.hxx @@ -31,7 +31,7 @@ #include <vcl/fixed.hxx> #endif #ifndef _IMAGEBTN_HXX //autogen -#include <vcl/imagebtn.hxx> +#include <vcl/button.hxx> #endif #ifndef _LSTBOX_HXX //autogen #include <vcl/lstbox.hxx> diff --git a/sw/source/ui/uiview/makefile.mk b/sw/source/ui/uiview/makefile.mk deleted file mode 100644 index 337ee85da5..0000000000 --- a/sw/source/ui/uiview/makefile.mk +++ /dev/null @@ -1,90 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=uiview - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -# --- Files -------------------------------------------------------- - -SRS1NAME=$(TARGET) -SRC1FILES = \ - view.src \ - pview.src - -EXCEPTIONSFILES= \ - $(SLO)$/formatclipboard.obj \ - $(SLO)$/srcview.obj \ - $(SLO)$/swcli.obj \ - $(SLO)$/uivwimp.obj \ - $(SLO)$/view.obj \ - $(SLO)$/view0.obj \ - $(SLO)$/view1.obj \ - $(SLO)$/view2.obj \ - $(SLO)$/viewdraw.obj \ - $(SLO)$/viewport.obj \ - $(SLO)$/viewprt.obj \ - $(SLO)$/viewsrch.obj \ - $(SLO)$/viewling.obj \ - $(SLO)$/viewmdi.obj \ - -SLOFILES = \ - $(SLO)$/view0.obj \ - $(SLO)$/view.obj \ - $(SLO)$/view1.obj \ - $(SLO)$/view2.obj \ - $(SLO)$/viewcoll.obj \ - $(SLO)$/viewdlg2.obj \ - $(SLO)$/viewdlg.obj \ - $(SLO)$/viewdraw.obj \ - $(SLO)$/viewling.obj \ - $(SLO)$/viewmdi.obj \ - $(SLO)$/pview.obj \ - $(SLO)$/viewport.obj \ - $(SLO)$/viewstat.obj \ - $(SLO)$/viewtab.obj \ - $(SLO)$/viewprt.obj \ - $(SLO)$/viewsrch.obj \ - $(SLO)$/scroll.obj \ - $(SLO)$/swcli.obj \ - $(SLO)$/srcview.obj \ - $(SLO)$/uivwimp.obj \ - $(SLO)$/formatclipboard.obj - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk - -$(SRS)$/uiview.srs: $(SOLARINCDIR)$/svx$/globlmn.hrc - diff --git a/sw/source/ui/uiview/pview.cxx b/sw/source/ui/uiview/pview.cxx index f798aafcb1..f2f5a8a550 100644 --- a/sw/source/ui/uiview/pview.cxx +++ b/sw/source/ui/uiview/pview.cxx @@ -92,7 +92,6 @@ using namespace ::com::sun::star; - SFX_IMPL_NAMED_VIEWFACTORY(SwPagePreView, "PrintPreview") { SFX_VIEW_REGISTRATION(SwDocShell); diff --git a/sw/source/ui/uiview/srcview.cxx b/sw/source/ui/uiview/srcview.cxx index 47067385dc..7276bb2ab1 100644 --- a/sw/source/ui/uiview/srcview.cxx +++ b/sw/source/ui/uiview/srcview.cxx @@ -49,6 +49,8 @@ #include <svl/whiter.hxx> #include <unotools/saveopt.hxx> #include <svtools/transfer.hxx> +#include <svtools/svtools.hrc> +#include <svtools/svtdata.hxx> #include <svx/svxids.hrc> #include <svtools/htmlcfg.hxx> #include <sfx2/app.hxx> @@ -123,14 +125,11 @@ using ::com::sun::star::util::SearchOptions; #define BMARGPRN 1000 #define BORDERPRN 300 - - SFX_IMPL_NAMED_VIEWFACTORY(SwSrcView, "SourceView") { SFX_VIEW_REGISTRATION(SwWebDocShell); } - SFX_IMPL_INTERFACE( SwSrcView, SfxViewShell, SW_RES(0) ) { SFX_POPUPMENU_REGISTRATION(SW_RES(MN_SRCVIEW_POPUPMENU)); @@ -561,7 +560,7 @@ void SwSrcView::GetState(SfxItemSet& rSet) nCount = rMgr.GetUndoActionCount(); if(nCount) { - String aStr(ResId( STR_UNDO, *SFX_APP()->GetSfxResManager() ));; + String aStr(SvtResId( STR_UNDO));; aStr += rMgr.GetUndoActionComment(--nCount); rSet.Put(SfxStringItem(nWhich, aStr)); } @@ -573,7 +572,7 @@ void SwSrcView::GetState(SfxItemSet& rSet) nCount = rMgr.GetRedoActionCount(); if(nCount) { - String aStr(ResId( STR_REDO, *SFX_APP()->GetSfxResManager() ));; + String aStr(SvtResId( STR_REDO));; aStr += rMgr.GetRedoActionComment(--nCount); rSet.Put(SfxStringItem(nWhich,aStr)); } diff --git a/sw/source/ui/uiview/swcli.cxx b/sw/source/ui/uiview/swcli.cxx index 996ab9b235..f3e8b6f2c5 100644 --- a/sw/source/ui/uiview/swcli.cxx +++ b/sw/source/ui/uiview/swcli.cxx @@ -27,16 +27,17 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" -#include <com/sun/star/embed/NoVisualAreaSizeException.hpp> +#include <com/sun/star/embed/NoVisualAreaSizeException.hpp> #include <wrtsh.hxx> +#include <doc.hxx> #include <swtypes.hxx> -#ifndef _VIEW_HXX #include <view.hxx> -#endif #include <edtwin.hxx> #include <swcli.hxx> +#include <cmdid.h> +#include <cfgitems.hxx> #include <toolkit/helper/vclunohelper.hxx> @@ -169,3 +170,18 @@ void SwOleClient::MakeVisible() const SwWrtShell &rSh = ((SwView*)GetViewShell())->GetWrtShell(); rSh.MakeObjVisible( GetObject() ); } + +// --> #i972# +void SwOleClient::FormatChanged() +{ + const uno::Reference < embed::XEmbeddedObject >& xObj( GetObject() ); + SwView * pView = dynamic_cast< SwView * >( GetViewShell() ); + if ( pView && xObj.is() && SotExchange::IsMath( xObj->getClassID() ) ) + { + SwWrtShell & rWrtSh = pView->GetWrtShell(); + if (rWrtSh.GetDoc()->get( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT )) + rWrtSh.AlignFormulaToBaseline( xObj ); + } +} +// <-- + diff --git a/sw/source/ui/uiview/view.cxx b/sw/source/ui/uiview/view.cxx index 3ed611eac3..6000f8a977 100644 --- a/sw/source/ui/uiview/view.cxx +++ b/sw/source/ui/uiview/view.cxx @@ -1179,8 +1179,8 @@ bool lcl_IsOwnDocument( SwView& rView ) String Created = xDocProps->getAuthor(); String Changed = xDocProps->getModifiedBy(); String FullName = SW_MOD()->GetUserOptions().GetFullName(); - return FullName.Len() && - (Changed.Len() && Changed == FullName ) || + return (FullName.Len() && + (Changed.Len() && Changed == FullName )) || (!Changed.Len() && Created.Len() && Created == FullName ); } diff --git a/sw/source/ui/uiview/view0.cxx b/sw/source/ui/uiview/view0.cxx index 98b9589afa..0f99832662 100644 --- a/sw/source/ui/uiview/view0.cxx +++ b/sw/source/ui/uiview/view0.cxx @@ -104,7 +104,6 @@ using ::rtl::OUString; #include <unomid.h> - SFX_IMPL_NAMED_VIEWFACTORY(SwView, "Default") { if ( SvtModuleOptions().IsWriter() ) diff --git a/sw/source/ui/uiview/viewtab.cxx b/sw/source/ui/uiview/viewtab.cxx index d80233ef3e..c7049866d5 100644 --- a/sw/source/ui/uiview/viewtab.cxx +++ b/sw/source/ui/uiview/viewtab.cxx @@ -529,7 +529,7 @@ void SwView::ExecTabWin( SfxRequest& rReq ) aUL.SetLower( (USHORT)aLongULSpace.GetLower() ); aDesc.GetMaster().SetFmtAttr( aUL ); - if( bHead && pHeaderFmt || !bHead && pFooterFmt ) + if( (bHead && pHeaderFmt) || (!bHead && pFooterFmt) ) { SwFmtFrmSize aSz( bHead ? pHeaderFmt->GetFrmSize() : pFooterFmt->GetFrmSize() ); @@ -694,7 +694,7 @@ void SwView::ExecTabWin( SfxRequest& rReq ) SvxColumnItem aColItem((const SvxColumnItem&)rReq. GetArgs()->Get(nSlot)); - if( bSetTabColFromDoc || !bSect && rSh.GetTableFmt() ) + if( bSetTabColFromDoc || (!bSect && rSh.GetTableFmt()) ) { ASSERT(aColItem.Count(), "ColDesc ist leer!!"); @@ -826,7 +826,7 @@ void SwView::ExecTabWin( SfxRequest& rReq ) SvxColumnItem aColItem((const SvxColumnItem&)rReq. GetArgs()->Get(nSlot)); - if( bSetTabColFromDoc || !bSect && rSh.GetTableFmt() ) + if( bSetTabColFromDoc || (!bSect && rSh.GetTableFmt()) ) { ASSERT(aColItem.Count(), "ColDesc ist leer!!"); @@ -1078,8 +1078,8 @@ void SwView::StateTabWin(SfxItemSet& rSet) (nSelType & nsSelectionType::SEL_FRM) || (nSelType & nsSelectionType::SEL_OLE) || SFX_ITEM_AVAILABLE > aCoreSet.GetItemState(RES_LR_SPACE)|| - !bVerticalWriting && (SID_ATTR_TABSTOP_VERTICAL == nWhich)|| - bVerticalWriting && (RES_PARATR_TABSTOP == nWhich) + (!bVerticalWriting && (SID_ATTR_TABSTOP_VERTICAL == nWhich))|| + (bVerticalWriting && (RES_PARATR_TABSTOP == nWhich)) ) rSet.DisableItem( nWhich ); else @@ -1106,8 +1106,8 @@ void SwView::StateTabWin(SfxItemSet& rSet) nSelType & nsSelectionType::SEL_FRM || nSelType & nsSelectionType::SEL_OLE || nFrmType == FRMTYPE_DRAWOBJ || - !bVerticalWriting && (SID_ATTR_PARA_LRSPACE_VERTICAL == nWhich)|| - bVerticalWriting && (SID_ATTR_PARA_LRSPACE == nWhich) + (!bVerticalWriting && (SID_ATTR_PARA_LRSPACE_VERTICAL == nWhich))|| + (bVerticalWriting && (SID_ATTR_PARA_LRSPACE == nWhich)) ) { rSet.DisableItem(nWhich); @@ -1282,9 +1282,9 @@ void SwView::StateTabWin(SfxItemSet& rSet) BOOL bTableVertical = bHasTable && rSh.IsTableVertical(); - if((SID_RULER_BORDERS_VERTICAL == nWhich) && + if( ( (SID_RULER_BORDERS_VERTICAL == nWhich) && ((bHasTable && !bTableVertical)|| - (!bVerticalWriting && !bFrmSelection && !bHasTable ) || (bFrmSelection && !bFrameHasVerticalColumns)) || + (!bVerticalWriting && !bFrmSelection && !bHasTable ) || (bFrmSelection && !bFrameHasVerticalColumns)) ) || ((SID_RULER_BORDERS == nWhich) && ((bHasTable && bTableVertical)|| (bVerticalWriting && !bFrmSelection&& !bHasTable) || bFrameHasVerticalColumns))) @@ -1501,8 +1501,8 @@ void SwView::StateTabWin(SfxItemSet& rSet) BOOL bFrameRTL; BOOL bFrameHasVerticalColumns = rSh.IsFrmVertical(FALSE, bFrameRTL) && bFrmSelection; - if((SID_RULER_ROWS == nWhich) && - ((!bVerticalWriting && !bFrmSelection) || (bFrmSelection && !bFrameHasVerticalColumns)) || + if( ( (SID_RULER_ROWS == nWhich) && + ((!bVerticalWriting && !bFrmSelection) || (bFrmSelection && !bFrameHasVerticalColumns)) ) || ((SID_RULER_ROWS_VERTICAL == nWhich) && ((bVerticalWriting && !bFrmSelection) || bFrameHasVerticalColumns))) rSet.DisableItem(nWhich); diff --git a/sw/source/ui/uno/SwXDocumentSettings.cxx b/sw/source/ui/uno/SwXDocumentSettings.cxx index 36b7d7afd6..b19a36cba5 100644 --- a/sw/source/ui/uno/SwXDocumentSettings.cxx +++ b/sw/source/ui/uno/SwXDocumentSettings.cxx @@ -123,7 +123,8 @@ enum SwDocumentSettingsPropertyHandles // --> OD 2008-06-05 #i89181# HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST, // <-- - HANDLE_MODIFYPASSWORDINFO + HANDLE_MODIFYPASSWORDINFO, + HANDLE_MATH_BASELINE_ALIGNMENT }; MasterPropertySetInfo * lcl_createSettingsInfo() @@ -178,6 +179,7 @@ MasterPropertySetInfo * lcl_createSettingsInfo() // --> OD 2008-06-05 #i89181# { RTL_CONSTASCII_STRINGPARAM("TabAtLeftIndentForParagraphsInList"), HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST, CPPUTYPE_BOOLEAN, 0, 0}, { RTL_CONSTASCII_STRINGPARAM("ModifyPasswordInfo"), HANDLE_MODIFYPASSWORDINFO, CPPUTYPE_PROPERTYVALUE, 0, 0}, + { RTL_CONSTASCII_STRINGPARAM("MathBaselineAlignment"), HANDLE_MATH_BASELINE_ALIGNMENT, CPPUTYPE_BOOLEAN, 0, 0}, /* * As OS said, we don't have a view when we need to set this, so I have to @@ -686,6 +688,12 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf uno::Reference< uno::XInterface >() ); } break; + case HANDLE_MATH_BASELINE_ALIGNMENT: + { + sal_Bool bTmp = *(sal_Bool*)rValue.getValue(); + mpDoc->set( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT, bTmp ); + } + break; default: throw UnknownPropertyException(); } @@ -1018,6 +1026,12 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf rValue <<= mpDocSh->GetModifyPasswordInfo(); } break; + case HANDLE_MATH_BASELINE_ALIGNMENT: + { + sal_Bool bTmp = mpDoc->get( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT ); + rValue.setValue( &bTmp, ::getBooleanCppuType() ); + } + break; default: throw UnknownPropertyException(); diff --git a/sw/source/ui/uno/makefile.mk b/sw/source/ui/uno/makefile.mk deleted file mode 100644 index ac4b6dde69..0000000000 --- a/sw/source/ui/uno/makefile.mk +++ /dev/null @@ -1,81 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=unoidl -ENABLE_EXCEPTIONS=TRUE -LIBTARGET=no - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -.IF "$(DVO_XFORMS)" != "" -CDEFS+=-DDVO_XFORMS -.ENDIF - -# --- Files -------------------------------------------------------- - -SLO1FILES = \ - $(SLO)$/unodefaults.obj\ - $(SLO)$/unodispatch.obj\ - $(SLO)$/unotxdoc.obj\ - $(SLO)$/unoatxt.obj \ - $(SLO)$/unomailmerge.obj \ - $(SLO)$/unomod.obj \ - $(SLO)$/unotxvw.obj \ - $(SLO)$/dlelstnr.obj \ - $(SLO)$/unofreg.obj \ - $(SLO)$/SwXDocumentSettings.obj \ - $(SLO)$/SwXFilterOptions.obj\ - $(SLO)$/RefreshListenerContainer.obj \ - $(SLO)$/unomodule.obj \ - $(SLO)$/unodoc.obj - -SLO2FILES = \ - $(SLO)$/swdetect.obj \ - $(SLO)$/swdet2.obj \ - $(SLO)$/detreg.obj - -SLOFILES = \ - $(SLO1FILES) \ - $(SLO2FILES) - -LIB1TARGET = \ - $(SLB)$/$(TARGET).lib - -LIB1OBJFILES = \ - $(SLO1FILES) - -# --- Targets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/ui/uno/swdetect.cxx b/sw/source/ui/uno/swdetect.cxx index 5bbf2bdf07..f9de3acaba 100644 --- a/sw/source/ui/uno/swdetect.cxx +++ b/sw/source/ui/uno/swdetect.cxx @@ -278,18 +278,17 @@ SwFilterDetect::~SwFilterDetect() if ( !bRepairPackage ) { // ask the user whether he wants to try to repair - RequestPackageReparation* pRequest = new RequestPackageReparation( aDocumentTitle ); - uno::Reference< task::XInteractionRequest > xRequest ( pRequest ); - xInteraction->handle( xRequest ); - bRepairAllowed = pRequest->isApproved(); + RequestPackageReparation aRequest( aDocumentTitle ); + xInteraction->handle( aRequest.GetRequest() ); + bRepairAllowed = aRequest.isApproved(); } if ( !bRepairAllowed ) { // repair either not allowed or not successful - NotifyBrokenPackage* pNotifyRequest = new NotifyBrokenPackage( aDocumentTitle ); - uno::Reference< task::XInteractionRequest > xRequest ( pNotifyRequest ); - xInteraction->handle( xRequest ); + // repair either not allowed or not successful + NotifyBrokenPackage aNotifyRequest( aDocumentTitle ); + xInteraction->handle( aNotifyRequest.GetRequest() ); rtl::Reference< ::comphelper::OIHWrapNoFilterDialog > xHandler = new ::comphelper::OIHWrapNoFilterDialog( xInteraction ); if ( nIndexOfInteractionHandler != -1 ) diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index 0804516f39..7752e74d28 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -83,7 +83,6 @@ #include <globals.hrc> #include <unomid.h> #include <unotools/printwarningoptions.hxx> - #include <com/sun/star/util/SearchOptions.hpp> #include <com/sun/star/lang/ServiceNotRegisteredException.hpp> #include <com/sun/star/lang/DisposedException.hpp> @@ -948,7 +947,7 @@ SwUnoCrsr* SwXTextDocument::FindAny(const Reference< util::XSearchDescriptor > RES_CHRATR_BEGIN, RES_CHRATR_END-1, RES_PARATR_BEGIN, RES_PARATR_END-1, RES_FRMATR_BEGIN, RES_FRMATR_END-1, - RES_TXTATR_INETFMT, RES_TXTATR_INETFMT, + RES_TXTATR_INETFMT, RES_TXTATR_CHARFMT, 0); pSearch->FillSearchItemSet(aSearch); BOOL bCancel; diff --git a/sw/source/ui/utlui/content.cxx b/sw/source/ui/utlui/content.cxx index 418d9ace33..8a70c351ff 100644 --- a/sw/source/ui/utlui/content.cxx +++ b/sw/source/ui/utlui/content.cxx @@ -952,6 +952,7 @@ SwContentTree::SwContentTree(Window* pParent, const ResId& rResId) : aUpdTimer.SetTimeout(1000); Clear(); EnableContextMenuHandling(); + SetStyle( GetStyle() | WB_QUICK_SEARCH ); } /*************************************************************************** @@ -2070,7 +2071,7 @@ void SwContentTree::ExecCommand(sal_uInt16 nCmd, sal_Bool bModifier) SvLBoxEntry* pFirstEntry = FirstSelected(); if (pFirstEntry && lcl_IsContent(pFirstEntry)) { - if(bIsRoot && nRootType == CONTENT_TYPE_OUTLINE || + if((bIsRoot && nRootType == CONTENT_TYPE_OUTLINE) || ((SwContent*)pFirstEntry->GetUserData())->GetParent()->GetType() == CONTENT_TYPE_OUTLINE) { @@ -2088,8 +2089,8 @@ void SwContentTree::ExecCommand(sal_uInt16 nCmd, sal_Bool bModifier) if( nMove ) { short nDir = nCmd == FN_ITEM_UP ? -1 : 1; - if( !bModifier && (nDir == -1 && nActPos > 0 || - nDir == 1 && nActPos < GetEntryCount() - 2 ) ) + if( !bModifier && ((nDir == -1 && nActPos > 0) || + (nDir == 1 && nActPos < GetEntryCount() - 2 )) ) { pShell->MoveOutlinePara( nDir ); //Cursor wieder an die aktuelle Position setzen @@ -2761,8 +2762,8 @@ sal_Bool SwContentTree::Select( SvLBoxEntry* pEntry, sal_Bool bSelect ) sal_Bool bEnable = sal_False; SvLBoxEntry* pParentEntry = GetParent(pEntry); if(!bIsLastReadOnly && (!IsVisible() || - (bIsRoot && nRootType == CONTENT_TYPE_OUTLINE && pParentEntry || - lcl_IsContent(pEntry) && ((SwContentType*)pParentEntry->GetUserData())->GetType() == CONTENT_TYPE_OUTLINE))) + ((bIsRoot && nRootType == CONTENT_TYPE_OUTLINE && pParentEntry) || + (lcl_IsContent(pEntry) && ((SwContentType*)pParentEntry->GetUserData())->GetType() == CONTENT_TYPE_OUTLINE)))) bEnable = sal_True; SwNavigationPI* pNavi = GetParentWindow(); pNavi->aContentToolBox.EnableItem(FN_ITEM_UP , bEnable); diff --git a/sw/source/ui/utlui/makefile.mk b/sw/source/ui/utlui/makefile.mk deleted file mode 100644 index cded61eee3..0000000000 --- a/sw/source/ui/utlui/makefile.mk +++ /dev/null @@ -1,79 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=utlui - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -# --- Files -------------------------------------------------------- - - -SRS1NAME=$(TARGET) -SRC1FILES = \ - initui.src \ - gloslst.src \ - navipi.src \ - poolfmt.src \ - attrdesc.src \ - unotools.src \ - utlui.src - -EXCEPTIONSFILES= \ - $(SLO)$/bookctrl.obj \ - $(SLO)$/glbltree.obj \ - $(SLO)$/navipi.obj \ - $(SLO)$/unotools.obj \ - $(SLO)$/content.obj \ - $(SLO)$/swrenamexnameddlg.obj - -SLOFILES = $(EXCEPTIONSFILES) \ - $(SLO)$/condedit.obj \ - $(SLO)$/gloslst.obj \ - $(SLO)$/initui.obj \ - $(SLO)$/navicfg.obj \ - $(SLO)$/numfmtlb.obj \ - $(SLO)$/prcntfld.obj \ - $(SLO)$/textcontrolcombo.obj \ - $(SLO)$/tmplctrl.obj \ - $(SLO)$/uitool.obj \ - $(SLO)$/uiitems.obj \ - $(SLO)$/attrdesc.obj \ - $(SLO)$/shdwcrsr.obj \ - $(SLO)$/zoomctrl.obj \ - $(SLO)$/viewlayoutctrl.obj - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/ui/utlui/navipi.cxx b/sw/source/ui/utlui/navipi.cxx index a6ee436e38..9f27fd34e3 100644 --- a/sw/source/ui/utlui/navipi.cxx +++ b/sw/source/ui/utlui/navipi.cxx @@ -868,7 +868,7 @@ SwNavigationPI::SwNavigationPI( SfxBindings* _pBindings, ((SfxDockingWindow*)pParent)->SetOutputSizePixel(aMinSize); aContentTree.SetPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y ); - aContentTree.SetWindowBits( WB_HASBUTTONS|WB_HASBUTTONSATROOT| + aContentTree.SetStyle( aContentTree.GetStyle()|WB_HASBUTTONS|WB_HASBUTTONSATROOT| WB_CLIPCHILDREN|WB_HSCROLL|WB_FORCE_MAKEVISIBLE ); aContentTree.SetSpaceBetweenEntries(3); aContentTree.SetSelectionMode( SINGLE_SELECTION ); @@ -882,7 +882,7 @@ SwNavigationPI::SwNavigationPI( SfxBindings* _pBindings, // TreeListBox fuer Globaldokument aGlobalTree.SetPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y ); aGlobalTree.SetSelectionMode( MULTIPLE_SELECTION ); - aGlobalTree.SetWindowBits( WB_HASBUTTONS|WB_HASBUTTONSATROOT| + aGlobalTree.SetStyle( aGlobalTree.GetStyle()|WB_HASBUTTONS|WB_HASBUTTONSATROOT| WB_CLIPCHILDREN|WB_HSCROLL ); Size aGlblSize(aGlobalToolBox.CalcWindowSizePixel()); aGlobalToolBox.SetSizePixel(aGlblSize); diff --git a/sw/source/ui/vba/makefile.mk b/sw/source/ui/vba/makefile.mk deleted file mode 100644 index b6d0d79942..0000000000 --- a/sw/source/ui/vba/makefile.mk +++ /dev/null @@ -1,108 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=vbaswobj -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk -DLLPRE = - -.IF "$(ENABLE_VBA)"!="YES" -dummy: - @echo "not building vba..." -.ENDIF - -INCPRE=$(INCCOM)$/$(TARGET) -CDEFS+=-DVBA_OOBUILD_HACK -# ------------------------------------------------------------------ - -SLOFILES= \ - $(SLO)$/vbaglobals.obj \ - $(SLO)$/vbaapplication.obj \ - $(SLO)$/vbadocument.obj \ - $(SLO)$/vbawindow.obj \ - $(SLO)$/vbasystem.obj \ - $(SLO)$/vbarangehelper.obj \ - $(SLO)$/vbarange.obj \ - $(SLO)$/vbabookmark.obj \ - $(SLO)$/vbabookmarks.obj \ - $(SLO)$/vbavariable.obj \ - $(SLO)$/vbavariables.obj \ - $(SLO)$/vbaview.obj \ - $(SLO)$/wordvbahelper.obj \ - $(SLO)$/service.obj \ - $(SLO)$/vbadocumentproperties.obj \ - $(SLO)$/vbapane.obj \ - $(SLO)$/vbapanes.obj \ - $(SLO)$/vbaoptions.obj \ - $(SLO)$/vbaselection.obj \ - $(SLO)$/vbatemplate.obj \ - $(SLO)$/vbaparagraphformat.obj \ - $(SLO)$/vbaautotextentry.obj \ - $(SLO)$/vbaparagraph.obj \ - $(SLO)$/vbafind.obj \ - $(SLO)$/vbareplacement.obj \ - $(SLO)$/vbastyle.obj \ - $(SLO)$/vbastyles.obj \ - $(SLO)$/vbafont.obj \ - $(SLO)$/vbapalette.obj \ - $(SLO)$/vbainformationhelper.obj \ - $(SLO)$/vbatable.obj \ - $(SLO)$/vbatables.obj \ - $(SLO)$/vbafield.obj \ - $(SLO)$/vbaborders.obj \ - $(SLO)$/vbadocuments.obj \ - $(SLO)$/vbaheaderfooter.obj \ - $(SLO)$/vbaheaderfooterhelper.obj \ - $(SLO)$/vbaaddin.obj \ - $(SLO)$/vbaaddins.obj \ - $(SLO)$/vbadialogs.obj \ - $(SLO)$/vbadialog.obj \ - $(SLO)$/vbawrapformat.obj \ - $(SLO)$/vbapagesetup.obj \ - $(SLO)$/vbasection.obj \ - $(SLO)$/vbasections.obj \ - $(SLO)$/vbaeventshelper.obj \ - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk - -ALLTAR : \ - $(MISC)$/$(TARGET).don \ - -$(SLOFILES) : $(MISC)$/$(TARGET).don - -$(MISC)$/$(TARGET).don : $(SOLARBINDIR)$/oovbaapi.rdb - +$(CPPUMAKER) -O$(INCCOM)$/$(TARGET) -BUCR $(SOLARBINDIR)$/oovbaapi.rdb -X$(SOLARBINDIR)$/types.rdb && echo > $@ - echo $@ - diff --git a/sw/source/ui/vba/service.cxx b/sw/source/ui/vba/service.cxx index 3fe4f316df..6e607e861e 100644 --- a/sw/source/ui/vba/service.cxx +++ b/sw/source/ui/vba/service.cxx @@ -59,14 +59,14 @@ extern sdecl::ServiceDecl const serviceDecl; extern "C" { - void SAL_CALL component_getImplementationEnvironment( + SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) { OSL_TRACE("In component_getImplementationEnv"); *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } - void * SAL_CALL component_getFactory( + SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( const sal_Char * pImplName, lang::XMultiServiceFactory * pServiceManager, registry::XRegistryKey * pRegistryKey ) { @@ -77,3 +77,4 @@ extern "C" return pRet; } } + diff --git a/sw/source/ui/vba/vbadocuments.cxx b/sw/source/ui/vba/vbadocuments.cxx index 094dde4c0d..5ea30844e8 100644 --- a/sw/source/ui/vba/vbadocuments.cxx +++ b/sw/source/ui/vba/vbadocuments.cxx @@ -120,7 +120,7 @@ SwVbaDocuments::Add( const uno::Any& Template, const uno::Any& /*NewTemplate*/, { return Open( sFileName, uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any(), uno::Any()); } - uno::Reference <text::XTextDocument> xTextDoc( VbaDocumentsBase::Add() , uno::UNO_QUERY_THROW ); + uno::Reference <text::XTextDocument> xTextDoc( createDocument() , uno::UNO_QUERY_THROW ); if( xTextDoc.is() ) return getDocument( mxContext, xTextDoc, Application() ); @@ -131,7 +131,7 @@ SwVbaDocuments::Add( const uno::Any& Template, const uno::Any& /*NewTemplate*/, void SAL_CALL SwVbaDocuments::Close( const uno::Any& /*SaveChanges*/, const uno::Any& /*OriginalFormat*/, const uno::Any& /*RouteDocument*/ ) throw (uno::RuntimeException) { - VbaDocumentsBase::Close(); + closeDocuments(); } // #TODO# #FIXME# can any of the unused params below be used? @@ -150,7 +150,7 @@ SwVbaDocuments::Open( const ::rtl::OUString& Filename, const uno::Any& /*Confirm uno::Sequence< beans::PropertyValue > sProps(0); - uno::Reference <text::XTextDocument> xSpreadDoc( VbaDocumentsBase::Open( Filename, ReadOnly, sProps ), uno::UNO_QUERY_THROW ); + uno::Reference <text::XTextDocument> xSpreadDoc( openDocument( Filename, ReadOnly, sProps ), uno::UNO_QUERY_THROW ); uno::Any aRet = getDocument( mxContext, xSpreadDoc, Application() ); uno::Reference< word::XDocument > xDocument( aRet, uno::UNO_QUERY ); if ( xDocument.is() ) @@ -158,26 +158,7 @@ SwVbaDocuments::Open( const ::rtl::OUString& Filename, const uno::Any& /*Confirm return aRet; } - // VbaDocumentsBase / XDocumentsBase (to avoid warning C4266 for hiding function on wntmsci) -uno::Any SAL_CALL -SwVbaDocuments::Add() throw (uno::RuntimeException) -{ - return VbaDocumentsBase::Add(); -} - -void SAL_CALL -SwVbaDocuments::Close( ) throw (uno::RuntimeException) -{ - VbaDocumentsBase::Close(); -} - -uno::Any SAL_CALL -SwVbaDocuments::Open( const ::rtl::OUString& Filename, const uno::Any& ReadOnly, const uno::Sequence< beans::PropertyValue >& rProps ) throw (uno::RuntimeException) -{ - return VbaDocumentsBase::Open( Filename, ReadOnly, rProps ); -} - -rtl::OUString& +rtl::OUString& SwVbaDocuments::getServiceImplName() { static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("SwVbaDocuments") ); diff --git a/sw/source/ui/vba/vbadocuments.hxx b/sw/source/ui/vba/vbadocuments.hxx index 7f1c89510e..a7d977594e 100644 --- a/sw/source/ui/vba/vbadocuments.hxx +++ b/sw/source/ui/vba/vbadocuments.hxx @@ -56,11 +56,6 @@ public: virtual css::uno::Any SAL_CALL Add( const css::uno::Any& Template, const css::uno::Any& NewTemplate, const css::uno::Any& DocumentType, const css::uno::Any& Visible ) throw (css::uno::RuntimeException); virtual css::uno::Any SAL_CALL Open( const ::rtl::OUString& Filename, const css::uno::Any& ConfirmConversions, const css::uno::Any& ReadOnly, const css::uno::Any& AddToRecentFiles, const css::uno::Any& PasswordDocument, const css::uno::Any& PasswordTemplate, const css::uno::Any& Revert, const css::uno::Any& WritePasswordDocument, const css::uno::Any& WritePasswordTemplate, const css::uno::Any& Format, const css::uno::Any& Encoding, const css::uno::Any& Visible, const css::uno::Any& OpenAndRepair, const css::uno::Any& DocumentDirection, const css::uno::Any& NoEncodingDialog, const css::uno::Any& XMLTransform ) throw (css::uno::RuntimeException); virtual void SAL_CALL Close( const css::uno::Any& SaveChanges, const css::uno::Any& OriginalFormat, const css::uno::Any& RouteDocument ) throw (css::uno::RuntimeException); - - // VbaDocumentsBase / XDocumentsBase (to avoid warning C4266 for hiding function on wntmsci) - virtual css::uno::Any SAL_CALL Add() throw (css::uno::RuntimeException); - virtual void SAL_CALL Close( ) throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL Open( const ::rtl::OUString& Filename, const css::uno::Any& ReadOnly, const css::uno::Sequence< css::beans::PropertyValue >& rProps ) throw (css::uno::RuntimeException); }; #endif /* SW_VBA_DOCUMENTS_HXX */ diff --git a/sw/source/ui/vba/vbaeventshelper.cxx b/sw/source/ui/vba/vbaeventshelper.cxx index abe4abb6e7..b2270b009c 100755 --- a/sw/source/ui/vba/vbaeventshelper.cxx +++ b/sw/source/ui/vba/vbaeventshelper.cxx @@ -50,11 +50,6 @@ SwVbaEventsHelper::~SwVbaEventsHelper() { } -bool SwVbaEventsHelper::implEventsEnabled() throw (uno::RuntimeException) -{ - return true; -} - bool SwVbaEventsHelper::implPrepareEvent( EventQueue& rEventQueue, const EventHandlerInfo& rInfo, const uno::Sequence< uno::Any >& /*rArgs*/ ) throw (uno::RuntimeException) { diff --git a/sw/source/ui/vba/vbaeventshelper.hxx b/sw/source/ui/vba/vbaeventshelper.hxx index af1c06c034..7f951bdaa4 100755 --- a/sw/source/ui/vba/vbaeventshelper.hxx +++ b/sw/source/ui/vba/vbaeventshelper.hxx @@ -41,7 +41,6 @@ public: virtual ~SwVbaEventsHelper(); protected: - virtual bool implEventsEnabled() throw (css::uno::RuntimeException); virtual bool implPrepareEvent( EventQueue& rEventQueue, const EventHandlerInfo& rInfo, const css::uno::Sequence< css::uno::Any >& rArgs ) throw (css::uno::RuntimeException); virtual css::uno::Sequence< css::uno::Any > implBuildArgumentList( const EventHandlerInfo& rInfo, const css::uno::Sequence< css::uno::Any >& rArgs ) throw (css::lang::IllegalArgumentException); virtual void implPostProcessEvent( EventQueue& rEventQueue, const EventHandlerInfo& rInfo, bool bSuccess, bool bCancel ) throw (css::uno::RuntimeException); diff --git a/sw/source/ui/web/makefile.mk b/sw/source/ui/web/makefile.mk deleted file mode 100644 index 2b1eb7590b..0000000000 --- a/sw/source/ui/web/makefile.mk +++ /dev/null @@ -1,59 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=web - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -# --- Files -------------------------------------------------------- - -SRS1NAME=$(TARGET) -SRC1FILES = \ - web.src - -SLOFILES = \ - $(SLO)$/wformsh.obj \ - $(SLO)$/wgrfsh.obj \ - $(SLO)$/wlistsh.obj \ - $(SLO)$/wolesh.obj \ - $(SLO)$/wtabsh.obj \ - $(SLO)$/wfrmsh.obj \ - $(SLO)$/wtextsh.obj \ - $(SLO)$/wdocsh.obj \ - $(SLO)$/wview.obj - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/ui/web/web.src b/sw/source/ui/web/web.src index b647d83311..01fcf69716 100644 --- a/sw/source/ui/web/web.src +++ b/sw/source/ui/web/web.src @@ -25,15 +25,10 @@ * ************************************************************************/ -#ifndef _SVX_SVXIDS_HRC #include <svx/svxids.hrc> -#endif #include "globals.hrc" #include "cmdid.h" #include "web.hrc" -#include "swmn.hrc" -#define ACC_SW_WEB -#include "toolbox.hrc" #include "helpid.h" #include "cfgid.h" @@ -84,10 +79,5 @@ String RID_WEBOLE_TOOLBOX { Text [ en-US ] = "Object/Web" ; }; -/************************************************************************* -*************************************************************************/ -Menu MN_WEB_TEXT_POPUPMENU - BASE_TEXT_POPUPMENU_BEGIN - BASE_TEXT_POPUPMENU_END diff --git a/sw/source/ui/web/wtextsh.cxx b/sw/source/ui/web/wtextsh.cxx index 6f9aadb2f5..9da051913d 100644 --- a/sw/source/ui/web/wtextsh.cxx +++ b/sw/source/ui/web/wtextsh.cxx @@ -68,7 +68,7 @@ SFX_IMPL_INTERFACE(SwWebTextShell, SwBaseShell, SW_RES(STR_SHELLNAME_WEBTEXT)) { - SFX_POPUPMENU_REGISTRATION(SW_RES(MN_WEB_TEXT_POPUPMENU)); + SFX_POPUPMENU_REGISTRATION(SW_RES(MN_TEXT_POPUPMENU)); SFX_OBJECTBAR_REGISTRATION(SFX_OBJECTBAR_OBJECT, SW_RES(RID_TEXT_TOOLBOX)); SFX_CHILDWINDOW_REGISTRATION(FN_EDIT_FORMULA); SFX_CHILDWINDOW_REGISTRATION(FN_INSERT_FIELD); diff --git a/sw/source/ui/web/wview.cxx b/sw/source/ui/web/wview.cxx index 8fa1fc0bb7..4a0f2506c2 100644 --- a/sw/source/ui/web/wview.cxx +++ b/sw/source/ui/web/wview.cxx @@ -98,7 +98,6 @@ SFX_IMPL_NAMED_VIEWFACTORY(SwWebView, "Default") SFX_VIEW_REGISTRATION(SwWebDocShell); } - SFX_IMPL_INTERFACE( SwWebView, SwView, SW_RES(RID_WEBTOOLS_TOOLBOX) ) { SFX_CHILDWINDOW_REGISTRATION(SfxTemplateDialogWrapper::GetChildWindowId()); diff --git a/sw/source/ui/wrtsh/makefile.mk b/sw/source/ui/wrtsh/makefile.mk deleted file mode 100644 index baeb3acd25..0000000000 --- a/sw/source/ui/wrtsh/makefile.mk +++ /dev/null @@ -1,62 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/..$/.. - -PRJNAME=sw -TARGET=wrtsh - -# --- Settings ----------------------------------------------------- - -.INCLUDE : $(PRJ)$/inc$/swpre.mk -.INCLUDE : settings.mk -.INCLUDE : $(PRJ)$/inc$/sw.mk - -# --- Files -------------------------------------------------------- - -SRS1NAME=$(TARGET) -SRC1FILES = \ - wrtsh.src - -SLOFILES = \ - $(SLO)$/move.obj \ - $(SLO)$/select.obj \ - $(SLO)$/wrtsh1.obj \ - $(SLO)$/wrtsh2.obj \ - $(SLO)$/wrtsh3.obj \ - $(SLO)$/wrtsh4.obj \ - $(SLO)$/delete.obj \ - $(SLO)$/wrtundo.obj - -EXCEPTIONSFILES = \ - $(SLO)$/wrtsh1.obj \ - $(SLO)$/wrtsh2.obj - -# --- Tagets ------------------------------------------------------- - -.INCLUDE : target.mk - diff --git a/sw/source/ui/wrtsh/wrtsh1.cxx b/sw/source/ui/wrtsh/wrtsh1.cxx index 701646f5cd..3e0a2c8ce7 100644 --- a/sw/source/ui/wrtsh/wrtsh1.cxx +++ b/sw/source/ui/wrtsh/wrtsh1.cxx @@ -27,6 +27,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" + #include <com/sun/star/container/XChild.hpp> #include <com/sun/star/embed/XVisualObject.hpp> #include <com/sun/star/embed/EmbedMisc.hpp> @@ -42,9 +43,7 @@ #include <svx/svdview.hxx> #include <sot/factory.hxx> #include <svl/itemiter.hxx> -#ifndef _SOUND_HXX //autogen #include <vcl/sound.hxx> -#endif #include <tools/bigint.hxx> #include <sot/storage.hxx> #include <svtools/insdlg.hxx> @@ -60,28 +59,21 @@ #include <vcl/graph.hxx> #include <sfx2/printer.hxx> #include <unotools/charclass.hxx> - #include <comphelper/storagehelper.hxx> #include <svx/svxdlg.hxx> #include <svx/extrusionbar.hxx> #include <svx/fontworkbar.hxx> +#include <frmfmt.hxx> #include <fmtftn.hxx> #include <fmtpdsc.hxx> -#ifndef _WDOCSH_HXX #include <wdocsh.hxx> -#endif -#ifndef _BASESH_HXX #include <basesh.hxx> -#endif #include <swmodule.hxx> #include <wrtsh.hxx> -#ifndef _VIEW_HXX #include <view.hxx> -#endif #include <uitool.hxx> -#ifndef _CMDID_H #include <cmdid.h> -#endif +#include <cfgitems.hxx> #include <pagedesc.hxx> #include <frmmgr.hxx> #include <shellio.hxx> @@ -89,9 +81,7 @@ #include <swundo.hxx> // fuer Undo-Ids #include <swcli.hxx> #include <poolfmt.hxx> -#ifndef _WVIEW_HXX #include <wview.hxx> -#endif #include <edtwin.hxx> #include <fmtcol.hxx> #include <swtable.hxx> @@ -100,15 +90,12 @@ #include <swdtflvr.hxx> #include <crsskip.hxx> #include <doc.hxx> -#ifndef _WRTSH_HRC #include <wrtsh.hrc> -#endif #include <SwStyleNameMapper.hxx> #include <sfx2/request.hxx> #include <paratr.hxx> #include <ndtxt.hxx> #include <editeng/acorrcfg.hxx> -//#include <svx/acorrcfg.hxx> #include <IMark.hxx> // -> #111827# @@ -609,6 +596,11 @@ BOOL SwWrtShell::InsertOleObject( const svt::EmbeddedObjectRef& xRef, SwFlyFrmFm aFrmMgr.SetSize( aSz ); SwFlyFrmFmt *pFmt = SwFEShell::InsertObject( xRef, &aFrmMgr.GetAttrSet() ); + // --> #i972# + if ( bStarMath && pDoc->get( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT ) ) + AlignFormulaToBaseline( xRef.GetObject() ); + // <-- + if (pFlyFrmFmt) *pFlyFrmFmt = pFmt; @@ -769,6 +761,8 @@ void SwWrtShell::CalcAndSetScale( svt::EmbeddedObjectRef& xObj, if ( (embed::EmbedMisc::EMBED_ACTIVATEIMMEDIATELY & nMisc) || bLinkingChart // TODO/LATER: ResizeOnPrinterChange //|| SVOBJ_MISCSTATUS_RESIZEONPRINTERCHANGE & xObj->GetMiscStatus() + || nMisc & embed::EmbedMisc::EMBED_NEVERRESIZE // non-resizable objects need to be + // set the size back by this method ) { pCli = new SwOleClient( &GetView(), &GetView().GetEditWin(), xObj ); @@ -879,6 +873,17 @@ void SwWrtShell::CalcAndSetScale( svt::EmbeddedObjectRef& xObj, if ( bUseObjectSize ) { + // --> this moves non-resizable object so that when adding borders the baseline remains the same + const SwFlyFrmFmt *pFlyFrmFmt = dynamic_cast< const SwFlyFrmFmt * >( GetFlyFrmFmt() ); + ASSERT( pFlyFrmFmt, "Could not find fly frame." ); + if ( pFlyFrmFmt ) + { + const Point &rPoint = pFlyFrmFmt->GetLastFlyFrmPrtRectPos(); + SwRect aRect( pFlyPrtRect ? *pFlyPrtRect + : GetAnyCurRect( RECT_FLY_PRT_EMBEDDED, 0, xObj.GetObject() )); + aArea += rPoint - aRect.Pos(); // adjust area by diff of printing area position in order to keep baseline alignment correct. + } + // <-- aArea.Width ( _aVisArea.Width() ); aArea.Height( _aVisArea.Height() ); RequestObjectResize( aArea, xObj.GetObject() ); @@ -1864,3 +1869,4 @@ String SwWrtShell::GetSelDescr() const return aResult; } + diff --git a/sw/source/ui/wrtsh/wrtundo.cxx b/sw/source/ui/wrtsh/wrtundo.cxx index 7ea609d14e..c5c085b8ec 100644 --- a/sw/source/ui/wrtsh/wrtundo.cxx +++ b/sw/source/ui/wrtsh/wrtundo.cxx @@ -37,10 +37,10 @@ #include <wrtsh.hxx> #include <swundo.hxx> // fuer Undo-Ids #include <swdtflvr.hxx> - -#ifndef _WRTSH_HRC +#include <svtools/svtdata.hxx> +#include <svtools/svtools.hrc> +#include <svtools/svtdata.hxx> #include <wrtsh.hrc> -#endif #include <sfx2/sfx.hrc> @@ -128,7 +128,7 @@ String SwWrtShell::GetDoString( DoType eDoType ) const default:;//prevent warning } - aStr.Insert( String(ResId( nResStr, *SFX_APP()->GetSfxResManager())), 0 ); + aStr.Insert( String( SvtResId( nResStr)), 0 ); aStr += aUndoStr; return aStr; @@ -172,7 +172,7 @@ String SwWrtShell::GetRepeatString() const if (aUndoStr.Len() > 0) { - aStr.Insert( ResId( STR_REPEAT, *SFX_APP()->GetSfxResManager()), 0 ); + aStr.Insert( SvtResId( STR_REPEAT ), 0 ); aStr += aUndoStr; } |