Files
libreoffice/sw/source/core/docnode/ndtbl1.cxx

1596 lines
57 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2000-09-18 23:08:29 +00:00
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2000-09-18 23:08:29 +00:00
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
2000-09-18 23:08:29 +00:00
*
* OpenOffice.org - a multi-platform office productivity suite
2000-09-18 23:08:29 +00:00
*
* This file is part of OpenOffice.org.
2000-09-18 23:08:29 +00:00
*
* 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.
2000-09-18 23:08:29 +00:00
*
* 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).
2000-09-18 23:08:29 +00:00
*
* 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.
2000-09-18 23:08:29 +00:00
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
2000-09-18 23:08:29 +00:00
#ifdef WTC
#define private public
#endif
#include "hintids.hxx"
#include <editeng/lrspitem.hxx>
#include <editeng/boxitem.hxx>
#include <editeng/brshitem.hxx>
#include <editeng/frmdiritem.hxx>
2000-09-18 23:08:29 +00:00
#include <fmtornt.hxx>
#include <fmtfsize.hxx>
#include <fmtlsplt.hxx>
#include <fmtrowsplt.hxx>
2000-09-18 23:08:29 +00:00
#include <tabcol.hxx>
#include <frmatr.hxx>
#include <cellfrm.hxx>
#include <tabfrm.hxx>
#include <cntfrm.hxx>
#include <txtfrm.hxx>
#include <svx/svxids.hrc>
2000-09-18 23:08:29 +00:00
#include "doc.hxx"
#include "pam.hxx"
#include "swcrsr.hxx"
#include "viscrs.hxx"
#include "swtable.hxx"
#include "htmltbl.hxx"
#include "tblsel.hxx"
#include "swtblfmt.hxx"
#include "docary.hxx"
#include "ndindex.hxx"
#include "undobj.hxx"
using namespace ::com::sun::star;
2000-09-18 23:08:29 +00:00
extern void ClearFEShellTabCols();
//siehe auch swtable.cxx
#define COLFUZZY 20L
inline BOOL IsSame( long nA, long nB ) { return Abs(nA-nB) <= COLFUZZY; }
class SwTblFmtCmp
{
public:
SwFrmFmt *pOld,
*pNew;
INT16 nType;
SwTblFmtCmp( SwFrmFmt *pOld, SwFrmFmt *pNew, INT16 nType );
static SwFrmFmt *FindNewFmt( SvPtrarr &rArr, SwFrmFmt*pOld, INT16 nType );
static void Delete( SvPtrarr &rArr );
};
SwTblFmtCmp::SwTblFmtCmp( SwFrmFmt *pO, SwFrmFmt *pN, INT16 nT )
: pOld ( pO ), pNew ( pN ), nType( nT )
{
}
SwFrmFmt *SwTblFmtCmp::FindNewFmt( SvPtrarr &rArr, SwFrmFmt *pOld, INT16 nType )
{
for ( USHORT i = 0; i < rArr.Count(); ++i )
{
SwTblFmtCmp *pCmp = (SwTblFmtCmp*)rArr[i];
if ( pCmp->pOld == pOld && pCmp->nType == nType )
return pCmp->pNew;
}
return 0;
}
void SwTblFmtCmp::Delete( SvPtrarr &rArr )
{
for ( USHORT i = 0; i < rArr.Count(); ++i )
delete (SwTblFmtCmp*)rArr[i];
}
void lcl_GetStartEndCell( const SwCursor& rCrsr,
SwLayoutFrm *&prStart, SwLayoutFrm *&prEnd )
{
OSL_ENSURE( rCrsr.GetCntntNode() && rCrsr.GetCntntNode( FALSE ),
2000-09-18 23:08:29 +00:00
"Tabselection nicht auf Cnt." );
Point aPtPos, aMkPos;
CWS-TOOLING: integrate CWS odfmetadata2 2009-06-22 11:48:36 +0200 mst r273206 : - connectivity/source/drivers/mozab/mozillasrc/MNSInclude.hxx: + add "include ustrbuf.hxx" to work around warning caused by solaris <sys/kstat.h> declaring a global "long l ;" 2009-06-19 14:25:25 +0200 mst r273159 : - scp2/source/ooo/file_library_ooo.scp: + fix MinGW build 2009-06-08 12:52:33 +0200 mst r272727 : - redland/raptor-1.4.18.patch.mingw, redland/raptor/makefile.mk: + disable parsers that do not build on MinGW (thanks for patch by tono) 2009-05-15 17:31:07 +0200 mst r271957 : fix typos 2009-05-15 17:28:57 +0200 mst r271956 : #i101965# - offapi/com/sun/star/text/TextPortion: + add missing properties: SoftPageBreak, DocumentIndexMark, ReferenceMark, Footnote, TextField + fix read-only status of properties: Bookmark, IsStart, IsCollapsed - offapi/type_reference/{typelibrary_history.txt,types.rdb}: + update reference types.rdb 2009-05-07 14:41:38 +0200 mst r271669 : - sw/inc/{fmtftn.hxx,unocoll.hxx,doc.hxx,editsh.hxx,ftninfo.hxx}, sw/source/core/layout/{flowfrm.cxx,ftnfrm.cxx}, sw/source/core/doc/docftn.cxx, sw/source/core/edit/edattr.cxx, sw/source/core/txtnode/atrftn.cxx, sw/source/core/unocore/unocoll.cxx, sw/source/ui/fldui/fldref.cxx: + fix warning ... the hard way + also fix signature of SwDoc::SetCurFtn 2009-05-05 19:52:55 +0200 mst r271556 : - sw/inc/undobj.hxx: + make some members const 2009-05-05 19:34:40 +0200 mst r271555 : - sw/inc/rolbck.hxx, sw/source/core/undo/rolbck.cxx: + make some members const 2009-05-05 19:13:14 +0200 mst r271553 : - sw/inc/{undobj.hxx,rolbck.hxx}, sw/source/core/undo/{unbkmk.cxx,rolbck.cxx}: + fix rebase merge error + rename SwHstryBookmark to SwHistoryBookmark + clean up SwUndoBookmark 2009-05-05 19:05:53 +0200 mst r271552 : - sw/source/core/unocore/unoportenum.cxx: + fix annoying assertion 2009-05-05 15:34:48 +0200 mst r271522 : CWS-TOOLING: rebase CWS odfmetadata2 to trunk@271427 (milestone: DEV300:m47) 2009-05-04 12:37:01 +0200 mst r271444 : trivial 2009-04-22 13:30:37 +0200 mst r271102 : - sfx2/inc/sfx2/dinfdlg.hxx: + trivial change 2009-04-21 16:46:58 +0200 mst r271043 : - sw/inc/hintids.hxx: + introduce some predicates for the various hints, and use them 2009-04-21 16:19:03 +0200 mst r271041 : - sw/inc/undobj.hxx, sw/source/core/doc/{docfly.cxx,docfmt.cxx,docftn.cxx,doctxm.cxx}, sw/source/core/undo/{unattr.cxx,unins.cxx}: + clean up unattr.cxx: remove/fix casts, prefix members, use auto_ptr, etc. 2009-04-21 15:34:23 +0200 mst r271039 : - sw/inc/{rolbck.hxx,undobj.hxx}, sw/source/core/doc/docfmt.cxx, sw/source/core/txtnode/{thints.cxx,txtedt.cxx}, sw/source/core/undo/{rolbck.cxx,undel.cxx,undobj.cxx,unins.cxx,unmove.cxx, unovwr.cxx,unsect.cxx,unspnd.cxx,untbl.cxx,untblk.cxx,unattr.cxx}: + clean up SwHistory, SwRegHistory and SwHistoryHint etc.: remove/fix casts, prefix members, remove wrong const annotations, use auto_ptr, remove unused members, etc. 2009-04-20 19:17:36 +0200 mst r271013 : - sw/inc/ndhints.hxx, sw/source/core/text/{itrtxt.cxx,txtftn.cxx,itratr.cxx,porfly.cxx, txtfrm.cxx,txtdrop.cxx,frmform.cxx}, sw/source/core/txtnode/{ndtxt.cxx,ndhints.cxx,thints.cxx,txtedt.cxx}, sw/source/core/edit/acorrect.cxx, sw/source/core/doc/{docedt.cxx,docfmt.cxx}, sw/source/filter/html/swhtml.cxx: + clean up SwHintsArray and its subclasses: remove/fix casts, prefix members 2009-04-20 18:42:07 +0200 mst r271007 : - sw/source/core/text/txtio.cxx, sw/source/core/edit/edattr.cxx, sw/source/core/undo/rolbck.cxx: + remove JP_NEWCORE dead code 2009-04-20 18:38:09 +0200 mst r271006 : - sw/source/core/unocore/unochart.cxx: + silence unxlngi warning (debug=t) 2009-04-20 16:36:13 +0200 mst r270991 : - sfx2/inc/sfx2/dinfdlg.hxx, sfx2/source/dialog/dinfdlg.cxx, sfx2/source/doc/objserv.cxx, sw/source/ui/fldui/flddinf.hxx: + trivial cleanups 2009-04-20 15:28:52 +0200 mst r270990 : - sfx2/inc/sfx2/dinfdlg.hxx, sfx2/source/dialog/dinfdlg.cxx, sfx2/source/doc/objserv.cxx: + fix bug: replaying a macro with a DocumentInfoItem removes all user-defined properties 2009-03-10 15:08:20 +0100 mst r269273 : - sfx2/source/doc/Metadatable.cxx: + add missing SolarMutex guards 2009-03-10 14:46:29 +0100 mst r269272 : - unoxml/source/rdf/librdf_repository.cxx: + never free rdf_world because that would call libxm2 xmlCleanupParser (and, to add insult to injury, other libxml2 functions later...) 2009-03-06 19:02:44 +0100 mst r269041 : argh! undo... 2009-03-06 19:00:58 +0100 mst r269040 : fix #i99931# - sw/source/ui/uno/unomod.cxx: + SwXViewSettings::_getSingleValue returns uninitialized memory for the ZoomType property if the value is PAGE_WIDTH_EXACT 2009-03-06 18:59:28 +0100 mst r269039 : - sw/inc/ndtxt.hxx, sw/source/core/txtnode/ndtxt.cxx, sw/source/core/unocore/unoportenum.cxx: + fix some more wntmsci12 warnings... 2009-03-06 18:56:46 +0100 mst r269038 : - sd/source/ui/slidesorter/model/SlsPageEnumerationProvider.cxx: + work around spurious warning on unxsoli4 debug=t 2009-03-05 14:02:01 +0100 mst r268902 : - sw/inc/txatbase.hxx: + back to c-style casts, they also compile on wntmsci12... 2009-03-05 10:23:25 +0100 mst r268882 : - comphelper/inc/comphelper/processfactory.hxx, comphelper/source/processfactory/processfactory.cxx: + revert change of return type of comphelper_getProcessComponentContext to Reference: does not build on wntmsci12 2009-03-04 19:08:09 +0100 mst r268861 : - sw/source/core/txtnode/{atrtox.cxx,ndtxt.cxx}: + fix initialization 2009-03-04 14:37:30 +0100 mst r268831 : - solenv/inc/target.mk: + fix CLASSPATH so complex tests run (fix by sb) 2009-03-04 14:36:30 +0100 mst r268830 : - sw/inc/unoobj.hxx, sw/source/core/unocore/{unoparagraph.cxx,unoobj.cxx,unoobj2.cxx}: + SwXParaFrameEnumeration constructor now takes SwPaM, not SwUnoCrsr + move SwParaSelection into unoparagraph.cxx, as it is only used there + bugfix: replace SwUnoCrsrs on stack with SwCursors 2009-03-04 14:34:46 +0100 mst r268829 : - sw/inc/pam.hxx, sw/source/core/crsr/pam.cxx, sw/source/core/edit/eddel.cxx, sw/source/core/doc/docredln.cxx, sw/source/core/undo/{untbl.cxx,undel.cxx}, sw/source/filter/rtf/swparrtf.cxx: + clean up SwPaM: prefix members + new constructor SwPosition(SwCntntNode&, xub_StrLen) + fix several broken SwPosition and SwPaM constructors + SwPam::DeleteMark now actually resets the unused position to default 2009-03-02 12:07:09 +0100 mst r268646 : - sw/inc/fmtcol.hxx: + fix annoying warning (gcc 4) 2009-03-02 12:06:27 +0100 mst r268645 : - odk/util/check.pl, odk/examples/DevelopersGuide/Text/TextDocuments.java: + rename module from FieldMaster to fieldmaster 2009-02-27 19:49:56 +0100 mst r268614 : - sfx2/inc/sfx2/Metadatable.hxx, sfx2/prj/d.lst, sfx2/source/doc/{Metadatable.cxx,makefile.mk}, sw/inc/{SwMetadatable.hxx,unoobj.hxx,undobj.hxx,ndtxt.hxx}, sw/source/core/doc/{SwMetadatable.cxx,makefile.mk,docnew.cxx}, sw/source/core/undo/{untbl.cxx,unins.cxx}, sw/source/core/unocore/unoparagraph.cxx, sw/source/ui/app/docsh.cxx: + move Metadatable implementation from sw to sfx2 2009-02-27 17:58:55 +0100 mst r268608 : - sw/inc/{SwMetadatable.hxx,undobj.hxx}, sw/source/core/doc/SwMetadatable.cxx, sw/source/core/undo/{untbl.cxx,unins.cxx,undel.cxx}: + CreateUndo now returns an opaque MetadatableUndo object 2009-02-27 13:15:44 +0100 mst r268587 : - sw/inc/ndtxt.hxx, sw/source/core/doc/docfmt.cxx, sw/source/core/text/{itratr.cxx,porlay.cxx}, sw/source/core/txtnode/{txtedt.cxx,ndtxt.cxx,thints.cxx}: + clean up SwTxtNode: fix casts, prefix members + factor out inline function SwTxtNode::TryDeleteSwpHints() 2009-02-27 13:14:30 +0100 mst r268586 : - svx/inc/svx/emphitem.hxx: + fix borken header guard 2009-02-27 13:13:56 +0100 mst r268585 : - sfx2/source/bastyp/progress.cxx: + fix use of compiler specific macro 2009-02-27 11:00:32 +0100 mst r268564 : - sw/inc/{txatbase.hxx,txtatr.hxx,txtinet.hxx,txtfld.hxx,txtftn.hxx, txtflcnt.hxx,txttxmrk.hxx,txtrfmrk.hxx}, sw/source/core/txtnode/{atrtox.cxx,atrref.cxx,atrflyin.cxx,atrftn.cxx, txtatr2.cxx,txatbase.cxx,atrfld.cxx,txtedt.cxx}, sw/source/core/text/atrstck.cxx, sw/source/core/access/acchyperlink.cxx, sw/source/core/doc/visiturl.cxx, sw/source/ui/wrtsh/wrtsh2.cxx: + clean up SwTxtAttr and its subclasses: remove/fix casts, prefix members + SwTxtINetFmt: remove unused member bColor - sw/source/core/text/txtfld.cxx: + move SwTxtFld methods to atrfld.cxx 2009-02-27 10:58:44 +0100 mst r268563 : - sfx2/inc/sfx2/sfxbasemodel.hxx: + don't privately inherit BaseMutex, ScModelObj wants to access it 2009-02-27 10:58:02 +0100 mst r268562 : - xmloff/source/core/{RDFaExportHelper.cxx,RDFaImportHelper.cxx}: + arrrgh!!! someone thought it would be a good idea to have 2 different versions of boost in external! and they're NOT compatible!!! insert an ugly fragile hack that maybe works with both... 2009-02-26 17:42:26 +0100 mst r268544 : - comphelper/inc/comphelper/storagehelper.hxx. sfx2/source/doc/DocumentMetadataAccess.cxx: + someone made IsValidZipEntryFileName a static method and didn't tell me 2009-02-26 15:52:56 +0100 mst r268529 : redland: split up patches 2009-02-26 13:17:56 +0100 mst r268509 : migration of cws odfmetadata2 from CVS (resync to m42): module sw #i95863# - sw/inc/segdefs{,_}.hxx: + remove obsolete files - sw/source/ui/inc/itemdef.hxx: + remove itemdef.hxx - sw/source/ui/app/[apphdl.cxx,docsh.cxx}, sw/source/ui/misc/glshell.cxx, sw/source/ui/shells/*.cxx, sw/source/ui/uiview/*.cxx, sw/source/ui/web/*.cxx: + use sfx2/msg.hxx instead of itemdef.hxx - sw/source/core/edit/eddel.cxx: + @ JP: SwEditShell::Replace: you're right, deleting the text to be replaced first, and then inserting a space, and then replacing that space is unnecessary. whew, i'm so happy that we finally answered that question after 11 years. - sw/inc/edimp.hxx: + remove FOREACHCURSOR_START, FOREACHCURSOR_END - sw/inc/{swcrsr.hxx,unocrsr.hxx,viscrs.hxx}, sw/source/core/crsr/{crsrsh.cxx,swcrsr.cxx,trvlreg.cxx,trvltbl.cxx, unocrsr.cxx,viscrs.cxx}, sw/source/core/doc/{docbm.cxx,doccorr.cxx}, sw/source/core/docnode/{ndtbl.cxx,ndtbl1.cxx}, sw/source/core/edit/editsh.cxx, sw/source/core/frmedt/{fefly1.cxx,fetab.cxx,tblsel.cxx}, sw/source/core/layout/trvlfrm.cxx, sw/source/core/unocore/{unochart.cxx,unoobj2.cxx,unoparagraph.cxx, unoportenum.cxx,unotbl.cxx}, sw/source/core/view/vprint.cxx: + remove the hideous virtual operator SwFooCursor* + make SwCursor::IsReadOnlyAvailable() virtual + make SwUnoCrsr::Clone() virtual + refactor SwCursor methods IsSelOver(), LeftRight(), UpDown(), GotoTable(): replace dynamic_cast<...>(this) with new virtual methods 2009-02-26 13:14:58 +0100 mst r268508 : migration of cws odfmetadata2 from CVS (resync to m42): module sw - sw/source/filter/xml/swxml.cxx: + XMLReader::Read: load RDF metadata of the ODF document - sw/source/filter/xml/wrtxml.cxx: + SwXMLWriter::_Write: write RDF metadata of the ODF document if ODF >= 1.2 #i90620#: import xml:id in text tables (does not actually work yet) - sw/source/filter/xml/xmltbli{.hxx,.cxx}: + SwXMLTableCellAttrTokens,aTableCellAttrTokenMap: add XML_TOK_TABLE_XMLID + SwXMLTableCellContext_Impl::SwXMLTableCellContext_Impl: attribute xml:id + SwXMLTableCellContext_Impl::CreateChildContext: attribute xml:id + SwXMLTableColContext_Impl::SwXMLTableColContext_Impl: attribute xml:id + SwXMLTableContext::SwXMLTableContext: attribute xml:id fix #i98530# - sw/inc/unoport.hxx, sw/source/core/unocore/unoport.cxx: + SwXTextPortion: make constructor params const& - sw/source/core/unocore/unoportenum.cxx: + refactor to remove some code duplication + fix bug: paragraph w/out hints: bookmark before frame gets lost #i97274# handle invalid tables - sw/source/core/layout/tabfrm.cxx, sw/source/filter/xml/xmltbli.cxx: + SwXMLTableContext::MakeTable(): check that the table actually contains cells, and abort (removing the inserted table nodes) if not 2009-02-26 13:11:48 +0100 mst r268507 : migration of cws odfmetadata2 from CVS (resync to m42): module sw refactor SwXTextRange and SwXParagraph - sw/inc/unoobj.hxx, sw/source/core/unocore/unoobj2.cxx: + remove 3 constructors of SwXTextRange + new method SwXTextRange::CreateParentXText + refactor SwXTextRange::CreateTextRangeFromPosition and SwXTextRange::getText - sw/inc/unoobj.hxx, sw/source/core/unocore/unoparagraph.cxx: + SwXParagraph no longer uses a cursor; it registers directly at SwTxtNode + replace SwXParagraph::GetCrsr with SwXParagraph::GetTxtNode - sw/source/core/unocore/unotext.cxx, sw/source/ui/uno/unotxvw.cxx: + adapt to new SwXParagraph #i90620# - sw/inc/SwMetadatable.hxx, sw/source/core/doc/SwMetadatable.cxx: + new files: base classes sw::Metadatable and sw::MetadatableMixin; also, 2 implementations of IXmlIdRegistry: sw::XmlIdRegistryDocument and sw::XmlIdRegistryClipboard + setMetadataReference: handle empty stream name as auto-detect - sw/source/core/doc/makefile.mk: + add SwMetadatable add a XmlIdRegistry to SwDoc - sw/inc/doc.hxx: + SwDoc: add member m_pXmlIdRegistry, method GetXmlIdRegistry() - sw/source/core/doc/docnew.cxx: + initialize XmlIdRegistry in SwDoc::GetXmlIdRegistry, not in constructor, because the constructor is not told whether the SwDoc is a clipboard - sw/inc/docsh.hxx, sw/source/ui/app/docsh.cxx: + SwDocShell: override GetXmlIdRegistry() #i91563#: make the SwTxtNode metadatable - sw/inc/ndtxt.hxx + SwTxtNode inherits sw::Metadatable - sw/inc/unoobj.hxx, sw/source/core/unocore/unoparagraph.cxx: + SwXParagraph inherits sw::MetadatableMixin #i91563#: handle SwTxtNode's metadata for delete - sw/source/core/txtnode/ndtxt.cxx: + SwTxtNode::SplitCntntNode: handle XmlId + SwTxtNode::JoinNext: merge XmlIds - sw/source/core/doc/docedt.cxx: + lcl_GetJoinFlags: document postcondition + SwDoc::Delete: remove XmlId only if SwTxtNode _becomes_ empty #i91563#: handle SwTxtNode's metadata for delete with undo - sw/inc/undobj.hxx + SwUndoDelete: new members m_pMetadataUndoStart, m_pMetadataUndoEnd - sw/source/core/undo/undel.cxx: + SwUndoDelete::SaveCntnt: save XmlIds for start and end SwTxtNode + SwUndoDelete::SaveCntnt: remove XmlId only if SwTxtNode _becomes_ empty + SwUndoDelete::Undo: restore saved XmlIds for start and end SwTxtNode - sw/source/core/docnode/ndcopy.cxx: + SwTxtNode::MakeCopy: register copy at XmlIdRegistry #i91563#: handle SwTxtNode's metadata for find/replace with undo - sw/source/core/undo/unins.cxx: + _UnReplaceData: rename members: add prefix m_ + _UnReplaceData: new members m_pMetadataUndoStart, m_pMetadataUndoEnd + _UnReplaceData::_UnReplaceData: save XmlIds for start and end SwTxtNode + _UnReplaceData::Undo: restore saved XmlIds for start and end SwTxtNode #i91563#: handle SwTxtNode's metadata for table-to-text with undo - sw/source/core/undo/untbl.cxx: + SwTblToTxtSave: rename members: add prefix m_ + SwTblToTxtSave: new members m_pMetadataUndoStart, m_pMetadataUndoEnd + SwTblToTxtSave::SwTblToTxtSave: save XmlIds for start and end SwTxtNode + SwTblToTxtSave::SwTblToTxtSave, SwNodes::UndoTableToText: always store the index of the first SwTxtNode in the cell, instead of the index of the first SwTxtNode in case of the first cell in a row, and the cell start node in other cases + SwNodes::UndoTableToText: restore saved XmlIds for start and end SwTxtNode - sw/source/core/docnode/ndtbl.cxx: + lcl_DelBox: simplify for refactored start index handling in SwTblToTxtSave 2009-02-26 13:02:28 +0100 mst r268505 : migration of cws odfmetadata2 from CVS (resync to m42): module sd - sd/source/ui/table/tableobjectbar.cxx,sd/source/ui/view/*.cxx: + remove invocations of SFX_DECL_TYPE - sd/source/ui/slideshow/SlideShowRestarter.cxx, sd/source/ui/toolpanel/LayoutMenu.cxx, sd/source/ui/unoidl/DrawController.cxx, sd/source/ui/view/{ViewShellBase.cxx,ViewTabBar.cxx,frmview.cxx}: + fix abuses of comphelper_getProcessComponentContext (missing release) 2009-02-26 13:01:24 +0100 mst r268504 : migration of cws odfmetadata2 from CVS (resync to m42): module starmath - starmath/source/document.cxx: + don't touch SfxObjectShell's privates 2009-02-26 13:00:37 +0100 mst r268503 : migration of cws odfmetadata2 from CVS (resync to m42): module sfx2 #i90620# - sfx2/inc/sfx2/XmlIdRegistry.hxx: + new file: interfaces sfx2::IXmlIdRegistry and sfx2::IXmlIdRegistrySupplier and a couple of utility functions - sfx2/inc/sfx2/DocumentMetadataAccess.hxx, sfx2/source/doc/DocumentMetadataAccess.cxx: + new class sfx2::DocumentMetadataAccess, implements XDocumentMetadataAccess + the URI of the DocumentMetadataAccess is now the URI from which the document was loaded; for a new document, use a vnd.sun.star.tdoc URI + add new function sfx2::createBaseURI() + prevent using reserved file names + try not to recurse into embedded subdocuments - sfx2/source/doc/makefile.mk: + add DocumentMetadataAccess - sfx2/util/makefile.mk: + link libsfx2 against libxml2 (needed for xmlValidateNCName) - sfx2/source/doc/makefile.mk: + add LIBXML_CFLAGS to CFLAGS - sfx2/prj/build.lst: + add dependence on libxml2 - sfx2/prj/d.lst: + add XmlIdRegistry.hxx, DocumentMetadataAccess.hxx - sfx2/inc/sfx2/objsh.hxx, sfx2/source/doc/objxtor.cxx: + make SfxObjectShell's members private + new method SfxObjectShell::GetAutoStyleFilterIndex + SfxObjectShell inherits sfx2::IXmlIdRegistrySupplier - sfx2/source/dialog/templdlg.cxx, sfx2/source/doc/sfxbasemodel.cxx: + don't touch SfxObjectShell's privates - sfx2/inc/sfx2/sfxbasemodel.hxx, sfx2/source/doc/sfxbasemodel.cxx: + SfxBaseModel inherits BaseMutex instead of IMPL_SfxBaseModel_MutexContainer + SfxBaseModel implements additional interface XDocumentMetadataAccess + IMPL_SfxBaseModel_DataContainer has new member: a sfx2::DocumentMetadataAccess + implementation of XDocumentMetadataAccess forwards to the sfx2::DocumentMetadataAccess member - sfx2/qa/complex/DocumentMetadataAccessTest.java, sfx2/qa/complex/{tests.sce,makefile.mk}, sfx2/qa/complex/testdocuments/TESTRDFA.odt: + add complex test: DocumentMetadataAccessTest + add RDFa test document #i95863# - sfx2/inc/sfx2/dinfdlg.hxx, sfx2/source/dialog/dinfdlg.cxx: + refactor SfxDocumentItem so it no longer requires a XDocumentInfo + move struct CustomProperty to implementation file + remove class SfxDocumentUserPage + QueryValue,PutValue: remove MID_DOCINFO_FIELD* - sfx2/source/doc/objserv.cxx: + adapt to SfxDocumentItem change - sfx2/inc/sfx2/sfx.hrc, sfx2/sdi/sfxslots.sdi, sfx2/inc/sfx2/msg.hxx: + remove MID_DOCINFO_FIELD* + put all invocations of SFX_DECL_TYPE in msg.hxx, and undef SFX_DECL_TYPE - sfx2/source/doc/objxtor.cxx: + fix abuses of comphelper_getProcessComponentContext (missing release) - sfx2/source/doc/docfile.cxx: + SfxMedium::SfxMedium: don't dereference NULL, throw exception instead - sfx2/source/doc/objstor.cxx: + SfxObjectShell::DoLoad: fix bug: DocumentBaseURI is not initialized 2009-02-26 12:58:07 +0100 mst r268502 : migration of cws odfmetadata2 from CVS (resync to m42): module xmloff #i90620#: implement RDFa import (interface change) - xmloff/inc/xmloff/xmlimp.hxx. xmloff/source/core/xmlimp.cxx: + make SvXMLImport::GetAbsoluteReference() const + add SvXMLImport::GetComponentContext() + SvXMLImport::_InitCtor(): add RDFa namespace + add SvXMLImport::AddRDFa() + SvXMLImport::endDocument() inserts RDFa into document repository - xmloff/inc/xmloff/xmltoken.hxx, xmloff/source/core/xmltoken.cxx: + new tokens for RDFa: XML_ABOUT, XML_DATATYPE - xmloff/inc/RDFaImportHelper.hxx, xmloff/source/core/RDFaImportHelper.cxx: + new class RDFaImportHelper + adapt the code to the bleak reality of broken C++ implementations + handle empty xhtml:about attributes properly, which are actually valid relative URIs + work around broken SvXMLImport::GetAbsoluteReference - xmloff/source/core/makefile.mk: + add RDFaImportHelper.cxx #i90620#: implement RDFa export - xmloff/inc/xmloff/xmlexp.hxx, xmloff/source/core/xmlexp.cxx: + add SvXMLExport::EnsureNamespace(), and a stack of namespace maps + add SvXMLExport::GetComponentContext() + add SvXMLExport::AddAttributesRDFa() - xmloff/inc/RDFaExportHelper.hxx, xmloff/source/core/RDFaExportHelper.cxx: + new class RDFaExportHelper + don't use std::map::data_type, which is actually called std::map::mapped_type by libstdc++ - xmloff/source/core/makefile.mk: + add RDFaExportHelper.cxx #i91563# - xmloff/inc/xmloff/txtimp.hxx, xmloff/source/text/txtimp.cxx: + XMLTextPAttrTokens: add RDFa tokens - xmloff/source/text/txtparai{.hxx,.cxx}: + import RDFa for text:p - xmloff/source/text/txtparae.cxx: + export RDFa for text:p interface change: use XHTML namespace instead of RDFA - xmloff/inc/xmlnmspe.hxx, xmloff/inc/xmloff/xmltoken.hxx, xmloff/source/core/{xmltoken.cxx,xmlimp.cxx,xmlexp.cxx,RDFaExportHelper.cxx}, xmloff/source/text/txtimp.cxx: + use XHTML namespace instead of RDFA #i91565#, #i91566#: (preliminary) import for text:meta, text:meta-field - xmloff/source/text/txtparai.cxx: + new class XMLMetaImportContextBase with subclasses to import text:meta and text:meta-field - xmloff/source/text/XMLTextMarkImportContext.cxx: + change XMLTextMarkImportContext::CreateAndInsertMark to handle marks with no name (text:meta) #i91565#, #i91566#: (preliminary) export for text:meta, text:meta-field - xmloff/inc/txtflde.hxx, xmloff/source/text/txtflde.cxx: + add FIELD_ID_META to FieldIdEnum + new method XMLTextFieldExport::ExportMetaField() + change XMLTextFieldExport::ExportField{,AutoStyle,Helper} to take additional parameter for progress bar - xmloff/inc/xmloff/txtparae.hxx, xmloff/source/text/txtparae.cxx: + make XMLTextParagraphExport::exportTextRangeEnumeration() public + new method XMLTextParagraphExport::exportMeta() #i90620# - xmloff/inc/xmloff/xmlimp.hxx, xmloff/source/core/xmlimp.cxx, xmloff/inc/xmloff/xmlexp.hxx, xmloff/source/core/xmlexp.cxx: + rename SvXML{Im,Ex}port::GetStreamPath() to GetStreamName() + fix xml:id {im,ex}port for embedded documents and non-packages + adapt to API change: XMetadatable #i90620# GRDDL - xmloff/inc/xmlnmspe.hxx, xmloff/inc/xmloff/xmltoken.hxx, xmloff/source/core/{xmltoken.cxx,xmlexp.cxx}: + add GRDDL namespace + add token XML_TRANSFORMATION + add grddl:transformation attribute to root elements for meta.xml, content.xml and styles.xml 2009-02-26 12:54:40 +0100 mst r268501 : migration of cws odfmetadata2 from CVS (resync to m42): module unoxml #i90620# - unoxml/source/rdf/librdf_repository.cxx: + librdf_Repository::importGraph: allocate buffer sized length of stream + switch from one librdf_world per repository to a single static world because redland has global variables with a brain-damaged life-cycle... + exportGraph: use new raptor 1.4.18 feature to disable writing an xml:base attribute in RDF/XML files - unoxml/source/rdf/librdf_repository.cxx: unoxml/qa/complex/RDFRepositoryTest.java: + adapt to predicate is URI change + adapt to RDFa API change + adapt to API change: RDFa has multiple predicates... + adapt to API change: XMetadatable derives from XURI + allow xhtml:datatype without xhtml:content + adapt to API change: attribute MetadataReference is StringPair - unoxml/source/rdf/CURI.cxx: + add some more URI constants 2009-02-26 12:53:32 +0100 mst r268500 : migration of cws odfmetadata2 from CVS (resync to m42): module package - package/inc/ImplValidCharacters.hxx: + remove (moved to comphelper) 2009-02-26 12:52:49 +0100 mst r268499 : migration of cws odfmetadata2 from CVS (resync to m42): module comphelper - comphelper/inc/comphelper/processfactory.hxx, comphelper/source/processfactory/processfactory.cxx: + add getProcessComponentContext() + change return type of comphelper_getProcessComponentContext to Reference - comphelper/inc/comphelper/stl_types.hxx: + add OUStringBufferAppender + add algorithm intersperse - comphelper/source/misc/string.cxx: + rewrite convertCommaSeparated with intersperse and OUStringBufferAppender - comphelper/inc/comphelper/stlunosequence.hxx: + fix bug: begin() on empty sequence != end() 2009-02-26 12:50:47 +0100 mst r268498 : migration of cws odfmetadata2 from CVS (resync to m42): module offapi #i96209# - offapi/com/sun/star/text/fieldmaster/*.idl: + rename module from FieldMaster to fieldmaster - offapi/type_reference/{typelibrary_history.txt,types.rdb}: + update reference types.rdb #i90620# - offapi/com/sun/star/rdf/{XMetadatable.idl,XDocumentMetadataAccess.idl}: + API change: XMetadatable derives from XURI + API change: replace XmlId (string) with MetadataReference (StringPair) - offapi/com/sun/star/rdf/{Statement.idl,XDocumentRepository.idl, XNamedGraph.idl,XRepository.idl}: + the predicate of a statement is a URI, not a Resource - offapi/com/sun/star/rdf/XDocumentMetadataAccess.idl: + rename: s/Package/Document/ + remove uuid + remove everything related to mapping + graph names are now generated from base URI and file names + load methods: improve error handling with XInteractionHandler - offapi/com/sun/star/rdf/XDocumentRepository.idl: + change: RDFa permits using multiple predicates in one attribute + setStatementRDFa: subject is now XResource, object is now XMetadatable - offapi/com/sun/star/rdf/URIs.idl: + add some more URI constants - offapi/com/sun/star/rdf: + fix @since tags and replace <method> with <member> 2009-02-26 12:47:24 +0100 mst r268497 : migration of cws odfmetadata2 from CVS (resync to m42): module redland fix #i93768# - redland/raptor-1.4.17.patch, redland/raptor/makefile.mk: + disable GRDDL parser to prevent call to libxslt xsltSetDefaultSecurityPrefs, which breaks xmlhelp - redland/raptor/makefile.mk, redland/raptor-1.4.17.patch, redland/raptor-1.4.18.patch: + upgrade raptor to 1.4.18 + deactivate serializer for RSS/Atom (does not build) - redland/rasqal/makefile.mk, redland/rasqal-0.9.15.patch, redland/rasqal-0.9.16.patch, + upgrade rasqal to 0.9.16 - redland/redland/makefile.mk, redland/redland-1.0.7.patch, redland/redland-1.0.8.patch: + upgrade redland to 1.0.8 - redland/redlandversion.mk: + the librasqal SONAME has changed
2009-07-02 09:05:03 +00:00
const SwShellCrsr* pShCrsr = dynamic_cast<const SwShellCrsr*>(&rCrsr);
2000-09-18 23:08:29 +00:00
if( pShCrsr )
{
aPtPos = pShCrsr->GetPtPos();
aMkPos = pShCrsr->GetMkPos();
}
// robust:
SwCntntNode* pPointNd = rCrsr.GetCntntNode();
SwCntntNode* pMarkNd = rCrsr.GetCntntNode(FALSE);
SwFrm* pPointFrm = pPointNd ? pPointNd->GetFrm( &aPtPos ) : 0;
SwFrm* pMarkFrm = pMarkNd ? pMarkNd->GetFrm( &aMkPos ) : 0;
prStart = pPointFrm ? pPointFrm->GetUpper() : 0;
prEnd = pMarkFrm ? pMarkFrm->GetUpper() : 0;
2000-09-18 23:08:29 +00:00
}
BOOL lcl_GetBoxSel( const SwCursor& rCursor, SwSelBoxes& rBoxes,
BOOL bAllCrsr = FALSE )
{
CWS-TOOLING: integrate CWS odfmetadata2 2009-06-22 11:48:36 +0200 mst r273206 : - connectivity/source/drivers/mozab/mozillasrc/MNSInclude.hxx: + add "include ustrbuf.hxx" to work around warning caused by solaris <sys/kstat.h> declaring a global "long l ;" 2009-06-19 14:25:25 +0200 mst r273159 : - scp2/source/ooo/file_library_ooo.scp: + fix MinGW build 2009-06-08 12:52:33 +0200 mst r272727 : - redland/raptor-1.4.18.patch.mingw, redland/raptor/makefile.mk: + disable parsers that do not build on MinGW (thanks for patch by tono) 2009-05-15 17:31:07 +0200 mst r271957 : fix typos 2009-05-15 17:28:57 +0200 mst r271956 : #i101965# - offapi/com/sun/star/text/TextPortion: + add missing properties: SoftPageBreak, DocumentIndexMark, ReferenceMark, Footnote, TextField + fix read-only status of properties: Bookmark, IsStart, IsCollapsed - offapi/type_reference/{typelibrary_history.txt,types.rdb}: + update reference types.rdb 2009-05-07 14:41:38 +0200 mst r271669 : - sw/inc/{fmtftn.hxx,unocoll.hxx,doc.hxx,editsh.hxx,ftninfo.hxx}, sw/source/core/layout/{flowfrm.cxx,ftnfrm.cxx}, sw/source/core/doc/docftn.cxx, sw/source/core/edit/edattr.cxx, sw/source/core/txtnode/atrftn.cxx, sw/source/core/unocore/unocoll.cxx, sw/source/ui/fldui/fldref.cxx: + fix warning ... the hard way + also fix signature of SwDoc::SetCurFtn 2009-05-05 19:52:55 +0200 mst r271556 : - sw/inc/undobj.hxx: + make some members const 2009-05-05 19:34:40 +0200 mst r271555 : - sw/inc/rolbck.hxx, sw/source/core/undo/rolbck.cxx: + make some members const 2009-05-05 19:13:14 +0200 mst r271553 : - sw/inc/{undobj.hxx,rolbck.hxx}, sw/source/core/undo/{unbkmk.cxx,rolbck.cxx}: + fix rebase merge error + rename SwHstryBookmark to SwHistoryBookmark + clean up SwUndoBookmark 2009-05-05 19:05:53 +0200 mst r271552 : - sw/source/core/unocore/unoportenum.cxx: + fix annoying assertion 2009-05-05 15:34:48 +0200 mst r271522 : CWS-TOOLING: rebase CWS odfmetadata2 to trunk@271427 (milestone: DEV300:m47) 2009-05-04 12:37:01 +0200 mst r271444 : trivial 2009-04-22 13:30:37 +0200 mst r271102 : - sfx2/inc/sfx2/dinfdlg.hxx: + trivial change 2009-04-21 16:46:58 +0200 mst r271043 : - sw/inc/hintids.hxx: + introduce some predicates for the various hints, and use them 2009-04-21 16:19:03 +0200 mst r271041 : - sw/inc/undobj.hxx, sw/source/core/doc/{docfly.cxx,docfmt.cxx,docftn.cxx,doctxm.cxx}, sw/source/core/undo/{unattr.cxx,unins.cxx}: + clean up unattr.cxx: remove/fix casts, prefix members, use auto_ptr, etc. 2009-04-21 15:34:23 +0200 mst r271039 : - sw/inc/{rolbck.hxx,undobj.hxx}, sw/source/core/doc/docfmt.cxx, sw/source/core/txtnode/{thints.cxx,txtedt.cxx}, sw/source/core/undo/{rolbck.cxx,undel.cxx,undobj.cxx,unins.cxx,unmove.cxx, unovwr.cxx,unsect.cxx,unspnd.cxx,untbl.cxx,untblk.cxx,unattr.cxx}: + clean up SwHistory, SwRegHistory and SwHistoryHint etc.: remove/fix casts, prefix members, remove wrong const annotations, use auto_ptr, remove unused members, etc. 2009-04-20 19:17:36 +0200 mst r271013 : - sw/inc/ndhints.hxx, sw/source/core/text/{itrtxt.cxx,txtftn.cxx,itratr.cxx,porfly.cxx, txtfrm.cxx,txtdrop.cxx,frmform.cxx}, sw/source/core/txtnode/{ndtxt.cxx,ndhints.cxx,thints.cxx,txtedt.cxx}, sw/source/core/edit/acorrect.cxx, sw/source/core/doc/{docedt.cxx,docfmt.cxx}, sw/source/filter/html/swhtml.cxx: + clean up SwHintsArray and its subclasses: remove/fix casts, prefix members 2009-04-20 18:42:07 +0200 mst r271007 : - sw/source/core/text/txtio.cxx, sw/source/core/edit/edattr.cxx, sw/source/core/undo/rolbck.cxx: + remove JP_NEWCORE dead code 2009-04-20 18:38:09 +0200 mst r271006 : - sw/source/core/unocore/unochart.cxx: + silence unxlngi warning (debug=t) 2009-04-20 16:36:13 +0200 mst r270991 : - sfx2/inc/sfx2/dinfdlg.hxx, sfx2/source/dialog/dinfdlg.cxx, sfx2/source/doc/objserv.cxx, sw/source/ui/fldui/flddinf.hxx: + trivial cleanups 2009-04-20 15:28:52 +0200 mst r270990 : - sfx2/inc/sfx2/dinfdlg.hxx, sfx2/source/dialog/dinfdlg.cxx, sfx2/source/doc/objserv.cxx: + fix bug: replaying a macro with a DocumentInfoItem removes all user-defined properties 2009-03-10 15:08:20 +0100 mst r269273 : - sfx2/source/doc/Metadatable.cxx: + add missing SolarMutex guards 2009-03-10 14:46:29 +0100 mst r269272 : - unoxml/source/rdf/librdf_repository.cxx: + never free rdf_world because that would call libxm2 xmlCleanupParser (and, to add insult to injury, other libxml2 functions later...) 2009-03-06 19:02:44 +0100 mst r269041 : argh! undo... 2009-03-06 19:00:58 +0100 mst r269040 : fix #i99931# - sw/source/ui/uno/unomod.cxx: + SwXViewSettings::_getSingleValue returns uninitialized memory for the ZoomType property if the value is PAGE_WIDTH_EXACT 2009-03-06 18:59:28 +0100 mst r269039 : - sw/inc/ndtxt.hxx, sw/source/core/txtnode/ndtxt.cxx, sw/source/core/unocore/unoportenum.cxx: + fix some more wntmsci12 warnings... 2009-03-06 18:56:46 +0100 mst r269038 : - sd/source/ui/slidesorter/model/SlsPageEnumerationProvider.cxx: + work around spurious warning on unxsoli4 debug=t 2009-03-05 14:02:01 +0100 mst r268902 : - sw/inc/txatbase.hxx: + back to c-style casts, they also compile on wntmsci12... 2009-03-05 10:23:25 +0100 mst r268882 : - comphelper/inc/comphelper/processfactory.hxx, comphelper/source/processfactory/processfactory.cxx: + revert change of return type of comphelper_getProcessComponentContext to Reference: does not build on wntmsci12 2009-03-04 19:08:09 +0100 mst r268861 : - sw/source/core/txtnode/{atrtox.cxx,ndtxt.cxx}: + fix initialization 2009-03-04 14:37:30 +0100 mst r268831 : - solenv/inc/target.mk: + fix CLASSPATH so complex tests run (fix by sb) 2009-03-04 14:36:30 +0100 mst r268830 : - sw/inc/unoobj.hxx, sw/source/core/unocore/{unoparagraph.cxx,unoobj.cxx,unoobj2.cxx}: + SwXParaFrameEnumeration constructor now takes SwPaM, not SwUnoCrsr + move SwParaSelection into unoparagraph.cxx, as it is only used there + bugfix: replace SwUnoCrsrs on stack with SwCursors 2009-03-04 14:34:46 +0100 mst r268829 : - sw/inc/pam.hxx, sw/source/core/crsr/pam.cxx, sw/source/core/edit/eddel.cxx, sw/source/core/doc/docredln.cxx, sw/source/core/undo/{untbl.cxx,undel.cxx}, sw/source/filter/rtf/swparrtf.cxx: + clean up SwPaM: prefix members + new constructor SwPosition(SwCntntNode&, xub_StrLen) + fix several broken SwPosition and SwPaM constructors + SwPam::DeleteMark now actually resets the unused position to default 2009-03-02 12:07:09 +0100 mst r268646 : - sw/inc/fmtcol.hxx: + fix annoying warning (gcc 4) 2009-03-02 12:06:27 +0100 mst r268645 : - odk/util/check.pl, odk/examples/DevelopersGuide/Text/TextDocuments.java: + rename module from FieldMaster to fieldmaster 2009-02-27 19:49:56 +0100 mst r268614 : - sfx2/inc/sfx2/Metadatable.hxx, sfx2/prj/d.lst, sfx2/source/doc/{Metadatable.cxx,makefile.mk}, sw/inc/{SwMetadatable.hxx,unoobj.hxx,undobj.hxx,ndtxt.hxx}, sw/source/core/doc/{SwMetadatable.cxx,makefile.mk,docnew.cxx}, sw/source/core/undo/{untbl.cxx,unins.cxx}, sw/source/core/unocore/unoparagraph.cxx, sw/source/ui/app/docsh.cxx: + move Metadatable implementation from sw to sfx2 2009-02-27 17:58:55 +0100 mst r268608 : - sw/inc/{SwMetadatable.hxx,undobj.hxx}, sw/source/core/doc/SwMetadatable.cxx, sw/source/core/undo/{untbl.cxx,unins.cxx,undel.cxx}: + CreateUndo now returns an opaque MetadatableUndo object 2009-02-27 13:15:44 +0100 mst r268587 : - sw/inc/ndtxt.hxx, sw/source/core/doc/docfmt.cxx, sw/source/core/text/{itratr.cxx,porlay.cxx}, sw/source/core/txtnode/{txtedt.cxx,ndtxt.cxx,thints.cxx}: + clean up SwTxtNode: fix casts, prefix members + factor out inline function SwTxtNode::TryDeleteSwpHints() 2009-02-27 13:14:30 +0100 mst r268586 : - svx/inc/svx/emphitem.hxx: + fix borken header guard 2009-02-27 13:13:56 +0100 mst r268585 : - sfx2/source/bastyp/progress.cxx: + fix use of compiler specific macro 2009-02-27 11:00:32 +0100 mst r268564 : - sw/inc/{txatbase.hxx,txtatr.hxx,txtinet.hxx,txtfld.hxx,txtftn.hxx, txtflcnt.hxx,txttxmrk.hxx,txtrfmrk.hxx}, sw/source/core/txtnode/{atrtox.cxx,atrref.cxx,atrflyin.cxx,atrftn.cxx, txtatr2.cxx,txatbase.cxx,atrfld.cxx,txtedt.cxx}, sw/source/core/text/atrstck.cxx, sw/source/core/access/acchyperlink.cxx, sw/source/core/doc/visiturl.cxx, sw/source/ui/wrtsh/wrtsh2.cxx: + clean up SwTxtAttr and its subclasses: remove/fix casts, prefix members + SwTxtINetFmt: remove unused member bColor - sw/source/core/text/txtfld.cxx: + move SwTxtFld methods to atrfld.cxx 2009-02-27 10:58:44 +0100 mst r268563 : - sfx2/inc/sfx2/sfxbasemodel.hxx: + don't privately inherit BaseMutex, ScModelObj wants to access it 2009-02-27 10:58:02 +0100 mst r268562 : - xmloff/source/core/{RDFaExportHelper.cxx,RDFaImportHelper.cxx}: + arrrgh!!! someone thought it would be a good idea to have 2 different versions of boost in external! and they're NOT compatible!!! insert an ugly fragile hack that maybe works with both... 2009-02-26 17:42:26 +0100 mst r268544 : - comphelper/inc/comphelper/storagehelper.hxx. sfx2/source/doc/DocumentMetadataAccess.cxx: + someone made IsValidZipEntryFileName a static method and didn't tell me 2009-02-26 15:52:56 +0100 mst r268529 : redland: split up patches 2009-02-26 13:17:56 +0100 mst r268509 : migration of cws odfmetadata2 from CVS (resync to m42): module sw #i95863# - sw/inc/segdefs{,_}.hxx: + remove obsolete files - sw/source/ui/inc/itemdef.hxx: + remove itemdef.hxx - sw/source/ui/app/[apphdl.cxx,docsh.cxx}, sw/source/ui/misc/glshell.cxx, sw/source/ui/shells/*.cxx, sw/source/ui/uiview/*.cxx, sw/source/ui/web/*.cxx: + use sfx2/msg.hxx instead of itemdef.hxx - sw/source/core/edit/eddel.cxx: + @ JP: SwEditShell::Replace: you're right, deleting the text to be replaced first, and then inserting a space, and then replacing that space is unnecessary. whew, i'm so happy that we finally answered that question after 11 years. - sw/inc/edimp.hxx: + remove FOREACHCURSOR_START, FOREACHCURSOR_END - sw/inc/{swcrsr.hxx,unocrsr.hxx,viscrs.hxx}, sw/source/core/crsr/{crsrsh.cxx,swcrsr.cxx,trvlreg.cxx,trvltbl.cxx, unocrsr.cxx,viscrs.cxx}, sw/source/core/doc/{docbm.cxx,doccorr.cxx}, sw/source/core/docnode/{ndtbl.cxx,ndtbl1.cxx}, sw/source/core/edit/editsh.cxx, sw/source/core/frmedt/{fefly1.cxx,fetab.cxx,tblsel.cxx}, sw/source/core/layout/trvlfrm.cxx, sw/source/core/unocore/{unochart.cxx,unoobj2.cxx,unoparagraph.cxx, unoportenum.cxx,unotbl.cxx}, sw/source/core/view/vprint.cxx: + remove the hideous virtual operator SwFooCursor* + make SwCursor::IsReadOnlyAvailable() virtual + make SwUnoCrsr::Clone() virtual + refactor SwCursor methods IsSelOver(), LeftRight(), UpDown(), GotoTable(): replace dynamic_cast<...>(this) with new virtual methods 2009-02-26 13:14:58 +0100 mst r268508 : migration of cws odfmetadata2 from CVS (resync to m42): module sw - sw/source/filter/xml/swxml.cxx: + XMLReader::Read: load RDF metadata of the ODF document - sw/source/filter/xml/wrtxml.cxx: + SwXMLWriter::_Write: write RDF metadata of the ODF document if ODF >= 1.2 #i90620#: import xml:id in text tables (does not actually work yet) - sw/source/filter/xml/xmltbli{.hxx,.cxx}: + SwXMLTableCellAttrTokens,aTableCellAttrTokenMap: add XML_TOK_TABLE_XMLID + SwXMLTableCellContext_Impl::SwXMLTableCellContext_Impl: attribute xml:id + SwXMLTableCellContext_Impl::CreateChildContext: attribute xml:id + SwXMLTableColContext_Impl::SwXMLTableColContext_Impl: attribute xml:id + SwXMLTableContext::SwXMLTableContext: attribute xml:id fix #i98530# - sw/inc/unoport.hxx, sw/source/core/unocore/unoport.cxx: + SwXTextPortion: make constructor params const& - sw/source/core/unocore/unoportenum.cxx: + refactor to remove some code duplication + fix bug: paragraph w/out hints: bookmark before frame gets lost #i97274# handle invalid tables - sw/source/core/layout/tabfrm.cxx, sw/source/filter/xml/xmltbli.cxx: + SwXMLTableContext::MakeTable(): check that the table actually contains cells, and abort (removing the inserted table nodes) if not 2009-02-26 13:11:48 +0100 mst r268507 : migration of cws odfmetadata2 from CVS (resync to m42): module sw refactor SwXTextRange and SwXParagraph - sw/inc/unoobj.hxx, sw/source/core/unocore/unoobj2.cxx: + remove 3 constructors of SwXTextRange + new method SwXTextRange::CreateParentXText + refactor SwXTextRange::CreateTextRangeFromPosition and SwXTextRange::getText - sw/inc/unoobj.hxx, sw/source/core/unocore/unoparagraph.cxx: + SwXParagraph no longer uses a cursor; it registers directly at SwTxtNode + replace SwXParagraph::GetCrsr with SwXParagraph::GetTxtNode - sw/source/core/unocore/unotext.cxx, sw/source/ui/uno/unotxvw.cxx: + adapt to new SwXParagraph #i90620# - sw/inc/SwMetadatable.hxx, sw/source/core/doc/SwMetadatable.cxx: + new files: base classes sw::Metadatable and sw::MetadatableMixin; also, 2 implementations of IXmlIdRegistry: sw::XmlIdRegistryDocument and sw::XmlIdRegistryClipboard + setMetadataReference: handle empty stream name as auto-detect - sw/source/core/doc/makefile.mk: + add SwMetadatable add a XmlIdRegistry to SwDoc - sw/inc/doc.hxx: + SwDoc: add member m_pXmlIdRegistry, method GetXmlIdRegistry() - sw/source/core/doc/docnew.cxx: + initialize XmlIdRegistry in SwDoc::GetXmlIdRegistry, not in constructor, because the constructor is not told whether the SwDoc is a clipboard - sw/inc/docsh.hxx, sw/source/ui/app/docsh.cxx: + SwDocShell: override GetXmlIdRegistry() #i91563#: make the SwTxtNode metadatable - sw/inc/ndtxt.hxx + SwTxtNode inherits sw::Metadatable - sw/inc/unoobj.hxx, sw/source/core/unocore/unoparagraph.cxx: + SwXParagraph inherits sw::MetadatableMixin #i91563#: handle SwTxtNode's metadata for delete - sw/source/core/txtnode/ndtxt.cxx: + SwTxtNode::SplitCntntNode: handle XmlId + SwTxtNode::JoinNext: merge XmlIds - sw/source/core/doc/docedt.cxx: + lcl_GetJoinFlags: document postcondition + SwDoc::Delete: remove XmlId only if SwTxtNode _becomes_ empty #i91563#: handle SwTxtNode's metadata for delete with undo - sw/inc/undobj.hxx + SwUndoDelete: new members m_pMetadataUndoStart, m_pMetadataUndoEnd - sw/source/core/undo/undel.cxx: + SwUndoDelete::SaveCntnt: save XmlIds for start and end SwTxtNode + SwUndoDelete::SaveCntnt: remove XmlId only if SwTxtNode _becomes_ empty + SwUndoDelete::Undo: restore saved XmlIds for start and end SwTxtNode - sw/source/core/docnode/ndcopy.cxx: + SwTxtNode::MakeCopy: register copy at XmlIdRegistry #i91563#: handle SwTxtNode's metadata for find/replace with undo - sw/source/core/undo/unins.cxx: + _UnReplaceData: rename members: add prefix m_ + _UnReplaceData: new members m_pMetadataUndoStart, m_pMetadataUndoEnd + _UnReplaceData::_UnReplaceData: save XmlIds for start and end SwTxtNode + _UnReplaceData::Undo: restore saved XmlIds for start and end SwTxtNode #i91563#: handle SwTxtNode's metadata for table-to-text with undo - sw/source/core/undo/untbl.cxx: + SwTblToTxtSave: rename members: add prefix m_ + SwTblToTxtSave: new members m_pMetadataUndoStart, m_pMetadataUndoEnd + SwTblToTxtSave::SwTblToTxtSave: save XmlIds for start and end SwTxtNode + SwTblToTxtSave::SwTblToTxtSave, SwNodes::UndoTableToText: always store the index of the first SwTxtNode in the cell, instead of the index of the first SwTxtNode in case of the first cell in a row, and the cell start node in other cases + SwNodes::UndoTableToText: restore saved XmlIds for start and end SwTxtNode - sw/source/core/docnode/ndtbl.cxx: + lcl_DelBox: simplify for refactored start index handling in SwTblToTxtSave 2009-02-26 13:02:28 +0100 mst r268505 : migration of cws odfmetadata2 from CVS (resync to m42): module sd - sd/source/ui/table/tableobjectbar.cxx,sd/source/ui/view/*.cxx: + remove invocations of SFX_DECL_TYPE - sd/source/ui/slideshow/SlideShowRestarter.cxx, sd/source/ui/toolpanel/LayoutMenu.cxx, sd/source/ui/unoidl/DrawController.cxx, sd/source/ui/view/{ViewShellBase.cxx,ViewTabBar.cxx,frmview.cxx}: + fix abuses of comphelper_getProcessComponentContext (missing release) 2009-02-26 13:01:24 +0100 mst r268504 : migration of cws odfmetadata2 from CVS (resync to m42): module starmath - starmath/source/document.cxx: + don't touch SfxObjectShell's privates 2009-02-26 13:00:37 +0100 mst r268503 : migration of cws odfmetadata2 from CVS (resync to m42): module sfx2 #i90620# - sfx2/inc/sfx2/XmlIdRegistry.hxx: + new file: interfaces sfx2::IXmlIdRegistry and sfx2::IXmlIdRegistrySupplier and a couple of utility functions - sfx2/inc/sfx2/DocumentMetadataAccess.hxx, sfx2/source/doc/DocumentMetadataAccess.cxx: + new class sfx2::DocumentMetadataAccess, implements XDocumentMetadataAccess + the URI of the DocumentMetadataAccess is now the URI from which the document was loaded; for a new document, use a vnd.sun.star.tdoc URI + add new function sfx2::createBaseURI() + prevent using reserved file names + try not to recurse into embedded subdocuments - sfx2/source/doc/makefile.mk: + add DocumentMetadataAccess - sfx2/util/makefile.mk: + link libsfx2 against libxml2 (needed for xmlValidateNCName) - sfx2/source/doc/makefile.mk: + add LIBXML_CFLAGS to CFLAGS - sfx2/prj/build.lst: + add dependence on libxml2 - sfx2/prj/d.lst: + add XmlIdRegistry.hxx, DocumentMetadataAccess.hxx - sfx2/inc/sfx2/objsh.hxx, sfx2/source/doc/objxtor.cxx: + make SfxObjectShell's members private + new method SfxObjectShell::GetAutoStyleFilterIndex + SfxObjectShell inherits sfx2::IXmlIdRegistrySupplier - sfx2/source/dialog/templdlg.cxx, sfx2/source/doc/sfxbasemodel.cxx: + don't touch SfxObjectShell's privates - sfx2/inc/sfx2/sfxbasemodel.hxx, sfx2/source/doc/sfxbasemodel.cxx: + SfxBaseModel inherits BaseMutex instead of IMPL_SfxBaseModel_MutexContainer + SfxBaseModel implements additional interface XDocumentMetadataAccess + IMPL_SfxBaseModel_DataContainer has new member: a sfx2::DocumentMetadataAccess + implementation of XDocumentMetadataAccess forwards to the sfx2::DocumentMetadataAccess member - sfx2/qa/complex/DocumentMetadataAccessTest.java, sfx2/qa/complex/{tests.sce,makefile.mk}, sfx2/qa/complex/testdocuments/TESTRDFA.odt: + add complex test: DocumentMetadataAccessTest + add RDFa test document #i95863# - sfx2/inc/sfx2/dinfdlg.hxx, sfx2/source/dialog/dinfdlg.cxx: + refactor SfxDocumentItem so it no longer requires a XDocumentInfo + move struct CustomProperty to implementation file + remove class SfxDocumentUserPage + QueryValue,PutValue: remove MID_DOCINFO_FIELD* - sfx2/source/doc/objserv.cxx: + adapt to SfxDocumentItem change - sfx2/inc/sfx2/sfx.hrc, sfx2/sdi/sfxslots.sdi, sfx2/inc/sfx2/msg.hxx: + remove MID_DOCINFO_FIELD* + put all invocations of SFX_DECL_TYPE in msg.hxx, and undef SFX_DECL_TYPE - sfx2/source/doc/objxtor.cxx: + fix abuses of comphelper_getProcessComponentContext (missing release) - sfx2/source/doc/docfile.cxx: + SfxMedium::SfxMedium: don't dereference NULL, throw exception instead - sfx2/source/doc/objstor.cxx: + SfxObjectShell::DoLoad: fix bug: DocumentBaseURI is not initialized 2009-02-26 12:58:07 +0100 mst r268502 : migration of cws odfmetadata2 from CVS (resync to m42): module xmloff #i90620#: implement RDFa import (interface change) - xmloff/inc/xmloff/xmlimp.hxx. xmloff/source/core/xmlimp.cxx: + make SvXMLImport::GetAbsoluteReference() const + add SvXMLImport::GetComponentContext() + SvXMLImport::_InitCtor(): add RDFa namespace + add SvXMLImport::AddRDFa() + SvXMLImport::endDocument() inserts RDFa into document repository - xmloff/inc/xmloff/xmltoken.hxx, xmloff/source/core/xmltoken.cxx: + new tokens for RDFa: XML_ABOUT, XML_DATATYPE - xmloff/inc/RDFaImportHelper.hxx, xmloff/source/core/RDFaImportHelper.cxx: + new class RDFaImportHelper + adapt the code to the bleak reality of broken C++ implementations + handle empty xhtml:about attributes properly, which are actually valid relative URIs + work around broken SvXMLImport::GetAbsoluteReference - xmloff/source/core/makefile.mk: + add RDFaImportHelper.cxx #i90620#: implement RDFa export - xmloff/inc/xmloff/xmlexp.hxx, xmloff/source/core/xmlexp.cxx: + add SvXMLExport::EnsureNamespace(), and a stack of namespace maps + add SvXMLExport::GetComponentContext() + add SvXMLExport::AddAttributesRDFa() - xmloff/inc/RDFaExportHelper.hxx, xmloff/source/core/RDFaExportHelper.cxx: + new class RDFaExportHelper + don't use std::map::data_type, which is actually called std::map::mapped_type by libstdc++ - xmloff/source/core/makefile.mk: + add RDFaExportHelper.cxx #i91563# - xmloff/inc/xmloff/txtimp.hxx, xmloff/source/text/txtimp.cxx: + XMLTextPAttrTokens: add RDFa tokens - xmloff/source/text/txtparai{.hxx,.cxx}: + import RDFa for text:p - xmloff/source/text/txtparae.cxx: + export RDFa for text:p interface change: use XHTML namespace instead of RDFA - xmloff/inc/xmlnmspe.hxx, xmloff/inc/xmloff/xmltoken.hxx, xmloff/source/core/{xmltoken.cxx,xmlimp.cxx,xmlexp.cxx,RDFaExportHelper.cxx}, xmloff/source/text/txtimp.cxx: + use XHTML namespace instead of RDFA #i91565#, #i91566#: (preliminary) import for text:meta, text:meta-field - xmloff/source/text/txtparai.cxx: + new class XMLMetaImportContextBase with subclasses to import text:meta and text:meta-field - xmloff/source/text/XMLTextMarkImportContext.cxx: + change XMLTextMarkImportContext::CreateAndInsertMark to handle marks with no name (text:meta) #i91565#, #i91566#: (preliminary) export for text:meta, text:meta-field - xmloff/inc/txtflde.hxx, xmloff/source/text/txtflde.cxx: + add FIELD_ID_META to FieldIdEnum + new method XMLTextFieldExport::ExportMetaField() + change XMLTextFieldExport::ExportField{,AutoStyle,Helper} to take additional parameter for progress bar - xmloff/inc/xmloff/txtparae.hxx, xmloff/source/text/txtparae.cxx: + make XMLTextParagraphExport::exportTextRangeEnumeration() public + new method XMLTextParagraphExport::exportMeta() #i90620# - xmloff/inc/xmloff/xmlimp.hxx, xmloff/source/core/xmlimp.cxx, xmloff/inc/xmloff/xmlexp.hxx, xmloff/source/core/xmlexp.cxx: + rename SvXML{Im,Ex}port::GetStreamPath() to GetStreamName() + fix xml:id {im,ex}port for embedded documents and non-packages + adapt to API change: XMetadatable #i90620# GRDDL - xmloff/inc/xmlnmspe.hxx, xmloff/inc/xmloff/xmltoken.hxx, xmloff/source/core/{xmltoken.cxx,xmlexp.cxx}: + add GRDDL namespace + add token XML_TRANSFORMATION + add grddl:transformation attribute to root elements for meta.xml, content.xml and styles.xml 2009-02-26 12:54:40 +0100 mst r268501 : migration of cws odfmetadata2 from CVS (resync to m42): module unoxml #i90620# - unoxml/source/rdf/librdf_repository.cxx: + librdf_Repository::importGraph: allocate buffer sized length of stream + switch from one librdf_world per repository to a single static world because redland has global variables with a brain-damaged life-cycle... + exportGraph: use new raptor 1.4.18 feature to disable writing an xml:base attribute in RDF/XML files - unoxml/source/rdf/librdf_repository.cxx: unoxml/qa/complex/RDFRepositoryTest.java: + adapt to predicate is URI change + adapt to RDFa API change + adapt to API change: RDFa has multiple predicates... + adapt to API change: XMetadatable derives from XURI + allow xhtml:datatype without xhtml:content + adapt to API change: attribute MetadataReference is StringPair - unoxml/source/rdf/CURI.cxx: + add some more URI constants 2009-02-26 12:53:32 +0100 mst r268500 : migration of cws odfmetadata2 from CVS (resync to m42): module package - package/inc/ImplValidCharacters.hxx: + remove (moved to comphelper) 2009-02-26 12:52:49 +0100 mst r268499 : migration of cws odfmetadata2 from CVS (resync to m42): module comphelper - comphelper/inc/comphelper/processfactory.hxx, comphelper/source/processfactory/processfactory.cxx: + add getProcessComponentContext() + change return type of comphelper_getProcessComponentContext to Reference - comphelper/inc/comphelper/stl_types.hxx: + add OUStringBufferAppender + add algorithm intersperse - comphelper/source/misc/string.cxx: + rewrite convertCommaSeparated with intersperse and OUStringBufferAppender - comphelper/inc/comphelper/stlunosequence.hxx: + fix bug: begin() on empty sequence != end() 2009-02-26 12:50:47 +0100 mst r268498 : migration of cws odfmetadata2 from CVS (resync to m42): module offapi #i96209# - offapi/com/sun/star/text/fieldmaster/*.idl: + rename module from FieldMaster to fieldmaster - offapi/type_reference/{typelibrary_history.txt,types.rdb}: + update reference types.rdb #i90620# - offapi/com/sun/star/rdf/{XMetadatable.idl,XDocumentMetadataAccess.idl}: + API change: XMetadatable derives from XURI + API change: replace XmlId (string) with MetadataReference (StringPair) - offapi/com/sun/star/rdf/{Statement.idl,XDocumentRepository.idl, XNamedGraph.idl,XRepository.idl}: + the predicate of a statement is a URI, not a Resource - offapi/com/sun/star/rdf/XDocumentMetadataAccess.idl: + rename: s/Package/Document/ + remove uuid + remove everything related to mapping + graph names are now generated from base URI and file names + load methods: improve error handling with XInteractionHandler - offapi/com/sun/star/rdf/XDocumentRepository.idl: + change: RDFa permits using multiple predicates in one attribute + setStatementRDFa: subject is now XResource, object is now XMetadatable - offapi/com/sun/star/rdf/URIs.idl: + add some more URI constants - offapi/com/sun/star/rdf: + fix @since tags and replace <method> with <member> 2009-02-26 12:47:24 +0100 mst r268497 : migration of cws odfmetadata2 from CVS (resync to m42): module redland fix #i93768# - redland/raptor-1.4.17.patch, redland/raptor/makefile.mk: + disable GRDDL parser to prevent call to libxslt xsltSetDefaultSecurityPrefs, which breaks xmlhelp - redland/raptor/makefile.mk, redland/raptor-1.4.17.patch, redland/raptor-1.4.18.patch: + upgrade raptor to 1.4.18 + deactivate serializer for RSS/Atom (does not build) - redland/rasqal/makefile.mk, redland/rasqal-0.9.15.patch, redland/rasqal-0.9.16.patch, + upgrade rasqal to 0.9.16 - redland/redland/makefile.mk, redland/redland-1.0.7.patch, redland/redland-1.0.8.patch: + upgrade redland to 1.0.8 - redland/redlandversion.mk: + the librasqal SONAME has changed
2009-07-02 09:05:03 +00:00
const SwTableCursor* pTblCrsr =
dynamic_cast<const SwTableCursor*>(&rCursor);
2000-09-18 23:08:29 +00:00
if( pTblCrsr )
::GetTblSelCrs( *pTblCrsr, rBoxes );
else
{
const SwPaM *pCurPam = &rCursor, *pSttPam = pCurPam;
do {
const SwNode* pNd = pCurPam->GetNode()->FindTableBoxStartNode();
if( pNd )
{
SwTableBox* pBox = (SwTableBox*)pNd->FindTableNode()->GetTable().
GetTblBox( pNd->GetIndex() );
rBoxes.Insert( pBox );
}
} while( bAllCrsr &&
pSttPam != ( pCurPam = (SwPaM*)pCurPam->GetNext()) );
}
return 0 != rBoxes.Count();
}
/***********************************************************************
#* Class : SwDoc
#* Methoden : SetRowHeight(), GetRowHeight()
#***********************************************************************/
//Die Zeilenhoehe wird ausgehend von der Selektion ermittelt/gesetzt.
//Ausgehend von jeder Zelle innerhalb der Selektion werden nach oben alle
//Zeilen abgeklappert, die oberste Zeile erhaelt den gewuenschten Wert alle
//tieferliegenden Zeilen einen entsprechenden Wert der sich aus der
//Relation der alten und neuen Groesse der obersten Zeile und ihrer
//eigenen Groesse ergiebt.
//Alle veraenderten Zeilen erhalten ggf. ein eigenes FrmFmt.
//Natuerlich darf jede Zeile nur einmal angefasst werden.
inline void InsertLine( SvPtrarr& rLineArr, SwTableLine* pLine )
{
if( USHRT_MAX == rLineArr.GetPos( pLine ) )
rLineArr.Insert( pLine, rLineArr.Count() );
2000-09-18 23:08:29 +00:00
}
//-----------------------------------------------------------------------------
BOOL lcl_IsAnLower( const SwTableLine *pLine, const SwTableLine *pAssumed )
{
const SwTableLine *pTmp = pAssumed->GetUpper() ?
pAssumed->GetUpper()->GetUpper() : 0;
while ( pTmp )
{
if ( pTmp == pLine )
return TRUE;
pTmp = pTmp->GetUpper() ? pTmp->GetUpper()->GetUpper() : 0;
}
return FALSE;
}
//-----------------------------------------------------------------------------
struct LinesAndTable
{
SvPtrarr &rLines;
const SwTable &rTable;
BOOL bInsertLines;
LinesAndTable( SvPtrarr &rL, const SwTable &rTbl ) :
rLines( rL ), rTable( rTbl ), bInsertLines( TRUE ) {}
};
BOOL _FindLine( const _FndLine*& rpLine, void* pPara );
BOOL _FindBox( const _FndBox*& rpBox, void* pPara )
{
if ( rpBox->GetLines().Count() )
{
((LinesAndTable*)pPara)->bInsertLines = TRUE;
((_FndBox*)rpBox)->GetLines().ForEach( _FindLine, pPara );
if ( ((LinesAndTable*)pPara)->bInsertLines )
{
const SwTableLines &rLines = rpBox->GetBox()
? rpBox->GetBox()->GetTabLines()
: ((LinesAndTable*)pPara)->rTable.GetTabLines();
if ( rpBox->GetLines().Count() == rLines.Count() )
{
for ( USHORT i = 0; i < rLines.Count(); ++i )
::InsertLine( ((LinesAndTable*)pPara)->rLines,
(SwTableLine*)rLines[i] );
}
else
((LinesAndTable*)pPara)->bInsertLines = FALSE;
}
}
else if ( rpBox->GetBox() )
::InsertLine( ((LinesAndTable*)pPara)->rLines,
(SwTableLine*)rpBox->GetBox()->GetUpper() );
return TRUE;
}
BOOL _FindLine( const _FndLine*& rpLine, void* pPara )
{
((_FndLine*)rpLine)->GetBoxes().ForEach( _FindBox, pPara );
return TRUE;
}
void lcl_CollectLines( SvPtrarr &rArr, const SwCursor& rCursor, bool bRemoveLines )
2000-09-18 23:08:29 +00:00
{
//Zuerst die selektierten Boxen einsammeln.
SwSelBoxes aBoxes;
if( !::lcl_GetBoxSel( rCursor, aBoxes ))
return ;
//Die selektierte Struktur kopieren.
const SwTable &rTable = aBoxes[0]->GetSttNd()->FindTableNode()->GetTable();
LinesAndTable aPara( rArr, rTable );
_FndBox aFndBox( 0, 0 );
{
_FndPara aTmpPara( aBoxes, &aFndBox );
((SwTableLines&)rTable.GetTabLines()).ForEach( &_FndLineCopyCol, &aTmpPara );
}
//Diejenigen Lines einsammeln, die nur selektierte Boxen enthalten.
2000-09-18 23:08:29 +00:00
const _FndBox *pTmp = &aFndBox;
::_FindBox( pTmp, &aPara );
// Remove lines, that have a common superordinate row.
// (Not for row split)
if ( bRemoveLines )
2000-09-18 23:08:29 +00:00
{
for ( USHORT i = 0; i < rArr.Count(); ++i )
2000-09-18 23:08:29 +00:00
{
SwTableLine *pUpLine = (SwTableLine*)rArr[i];
for ( USHORT k = 0; k < rArr.Count(); ++k )
2000-09-18 23:08:29 +00:00
{
if ( k != i && ::lcl_IsAnLower( pUpLine, (SwTableLine*)rArr[k] ) )
{
rArr.Remove( k );
if ( k <= i )
--i;
--k;
}
2000-09-18 23:08:29 +00:00
}
}
}
}
//-----------------------------------------------------------------------------
void lcl_ProcessRowAttr( SvPtrarr& rFmtCmp, SwTableLine* pLine, const SfxPoolItem& rNew )
{
SwFrmFmt *pNewFmt;
if ( 0 != (pNewFmt = SwTblFmtCmp::FindNewFmt( rFmtCmp, pLine->GetFrmFmt(), 0 )))
pLine->ChgFrmFmt( (SwTableLineFmt*)pNewFmt );
else
{
SwFrmFmt *pOld = pLine->GetFrmFmt();
SwFrmFmt *pNew = pLine->ClaimFrmFmt();
pNew->SetFmtAttr( rNew );
rFmtCmp.Insert( new SwTblFmtCmp( pOld, pNew, 0 ), rFmtCmp.Count());
}
}
//-----------------------------------------------------------------------------
2000-09-18 23:08:29 +00:00
void lcl_ProcessBoxSize( SvPtrarr &rFmtCmp, SwTableBox *pBox, const SwFmtFrmSize &rNew );
void lcl_ProcessRowSize( SvPtrarr &rFmtCmp, SwTableLine *pLine, const SwFmtFrmSize &rNew )
{
lcl_ProcessRowAttr( rFmtCmp, pLine, rNew );
2000-09-18 23:08:29 +00:00
SwTableBoxes &rBoxes = pLine->GetTabBoxes();
for ( USHORT i = 0; i < rBoxes.Count(); ++i )
::lcl_ProcessBoxSize( rFmtCmp, rBoxes[i], rNew );
}
//-----------------------------------------------------------------------------
void lcl_ProcessBoxSize( SvPtrarr &rFmtCmp, SwTableBox *pBox, const SwFmtFrmSize &rNew )
{
SwTableLines &rLines = pBox->GetTabLines();
if ( rLines.Count() )
{
SwFmtFrmSize aSz( rNew );
aSz.SetHeight( rNew.GetHeight() ? rNew.GetHeight() / rLines.Count() : 0 );
for ( USHORT i = 0; i < rLines.Count(); ++i )
::lcl_ProcessRowSize( rFmtCmp, rLines[i], aSz );
}
}
//-----------------------------------------------------------------------------
/******************************************************************************
* void SwDoc::SetRowSplit()
******************************************************************************/
void SwDoc::SetRowSplit( const SwCursor& rCursor, const SwFmtRowSplit &rNew )
{
SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode();
if( pTblNd )
{
SvPtrarr aRowArr( 25, 50 ); //Zum sammeln Lines.
::lcl_CollectLines( aRowArr, rCursor, false );
if( aRowArr.Count() )
{
if( DoesUndo() )
{
ClearRedo();
AppendUndo( new SwUndoAttrTbl( *pTblNd ));
}
SvPtrarr aFmtCmp( Max( BYTE(255), BYTE(aRowArr.Count()) ), 255 );
for( USHORT i = 0; i < aRowArr.Count(); ++i )
::lcl_ProcessRowAttr( aFmtCmp, (SwTableLine*)aRowArr[i], rNew );
SwTblFmtCmp::Delete( aFmtCmp );
SetModified();
}
}
}
/******************************************************************************
* SwTwips SwDoc::GetRowSplit() const
******************************************************************************/
void SwDoc::GetRowSplit( const SwCursor& rCursor, SwFmtRowSplit *& rpSz ) const
{
rpSz = 0;
SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode();
if( pTblNd )
{
SvPtrarr aRowArr( 25, 50 ); //Zum sammeln der Lines.
::lcl_CollectLines( aRowArr, rCursor, false );
if( aRowArr.Count() )
{
rpSz = &(SwFmtRowSplit&)((SwTableLine*)aRowArr[0])->
GetFrmFmt()->GetRowSplit();
for ( USHORT i = 1; i < aRowArr.Count() && rpSz; ++i )
{
if ( (*rpSz).GetValue() != ((SwTableLine*)aRowArr[i])->GetFrmFmt()->GetRowSplit().GetValue() )
rpSz = 0;
}
if ( rpSz )
rpSz = new SwFmtRowSplit( *rpSz );
}
}
}
2000-09-18 23:08:29 +00:00
/******************************************************************************
* void SwDoc::SetRowHeight( SwTwips nNew )
******************************************************************************/
void SwDoc::SetRowHeight( const SwCursor& rCursor, const SwFmtFrmSize &rNew )
{
SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode();
if( pTblNd )
{
SvPtrarr aRowArr( 25, 50 ); //Zum sammeln Lines.
::lcl_CollectLines( aRowArr, rCursor, true );
2000-09-18 23:08:29 +00:00
if( aRowArr.Count() )
{
if( DoesUndo() )
{
ClearRedo();
AppendUndo( new SwUndoAttrTbl( *pTblNd ));
}
SvPtrarr aFmtCmp( Max( BYTE(255), BYTE(aRowArr.Count()) ), 255 );
for ( USHORT i = 0; i < aRowArr.Count(); ++i )
::lcl_ProcessRowSize( aFmtCmp, (SwTableLine*)aRowArr[i], rNew );
SwTblFmtCmp::Delete( aFmtCmp );
SetModified();
}
}
}
/******************************************************************************
* SwTwips SwDoc::GetRowHeight() const
******************************************************************************/
void SwDoc::GetRowHeight( const SwCursor& rCursor, SwFmtFrmSize *& rpSz ) const
{
rpSz = 0;
SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode();
if( pTblNd )
{
SvPtrarr aRowArr( 25, 50 ); //Zum sammeln der Lines.
::lcl_CollectLines( aRowArr, rCursor, true );
2000-09-18 23:08:29 +00:00
if( aRowArr.Count() )
{
rpSz = &(SwFmtFrmSize&)((SwTableLine*)aRowArr[0])->
GetFrmFmt()->GetFrmSize();
for ( USHORT i = 1; i < aRowArr.Count() && rpSz; ++i )
{
if ( *rpSz != ((SwTableLine*)aRowArr[i])->GetFrmFmt()->GetFrmSize() )
rpSz = 0;
}
if ( rpSz )
rpSz = new SwFmtFrmSize( *rpSz );
}
}
}
BOOL SwDoc::BalanceRowHeight( const SwCursor& rCursor, BOOL bTstOnly )
{
BOOL bRet = FALSE;
SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode();
if( pTblNd )
{
SvPtrarr aRowArr( 25, 50 ); //Zum sammeln der Lines.
::lcl_CollectLines( aRowArr, rCursor, true );
2000-09-18 23:08:29 +00:00
if( 1 < aRowArr.Count() )
{
if( !bTstOnly )
{
long nHeight = 0;
USHORT i;
for ( i = 0; i < aRowArr.Count(); ++i )
2000-09-18 23:08:29 +00:00
{
SwClientIter aIter( *((SwTableLine*)aRowArr[i])->GetFrmFmt() );
SwFrm* pFrm = (SwFrm*)aIter.First( TYPE(SwFrm) );
while ( pFrm )
{
nHeight = Max( nHeight, pFrm->Frm().Height() );
pFrm = (SwFrm*)aIter.Next();
}
}
SwFmtFrmSize aNew( ATT_MIN_SIZE, 0, nHeight );
if( DoesUndo() )
{
ClearRedo();
AppendUndo( new SwUndoAttrTbl( *pTblNd ));
}
SvPtrarr aFmtCmp( Max( BYTE(255), BYTE(aRowArr.Count()) ), 255 );
for( i = 0; i < aRowArr.Count(); ++i )
::lcl_ProcessRowSize( aFmtCmp, (SwTableLine*)aRowArr[i], aNew );
SwTblFmtCmp::Delete( aFmtCmp );
SetModified();
}
bRet = TRUE;
}
}
return bRet;
}
/******************************************************************************
* void SwDoc::SetRowBackground()
******************************************************************************/
void SwDoc::SetRowBackground( const SwCursor& rCursor, const SvxBrushItem &rNew )
{
SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode();
if( pTblNd )
{
SvPtrarr aRowArr( 25, 50 ); //Zum sammeln Lines.
::lcl_CollectLines( aRowArr, rCursor, true );
2000-09-18 23:08:29 +00:00
if( aRowArr.Count() )
{
if( DoesUndo() )
{
ClearRedo();
AppendUndo( new SwUndoAttrTbl( *pTblNd ));
}
SvPtrarr aFmtCmp( Max( BYTE(255), BYTE(aRowArr.Count()) ), 255 );
for( USHORT i = 0; i < aRowArr.Count(); ++i )
::lcl_ProcessRowAttr( aFmtCmp, (SwTableLine*)aRowArr[i], rNew );
2000-09-18 23:08:29 +00:00
SwTblFmtCmp::Delete( aFmtCmp );
SetModified();
}
}
}
/******************************************************************************
* SwTwips SwDoc::GetRowBackground() const
******************************************************************************/
BOOL SwDoc::GetRowBackground( const SwCursor& rCursor, SvxBrushItem &rToFill ) const
{
BOOL bRet = FALSE;
SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode();
if( pTblNd )
{
SvPtrarr aRowArr( 25, 50 ); //Zum sammeln Lines.
::lcl_CollectLines( aRowArr, rCursor, true );
2000-09-18 23:08:29 +00:00
if( aRowArr.Count() )
{
rToFill = ((SwTableLine*)aRowArr[0])->GetFrmFmt()->GetBackground();
bRet = TRUE;
for ( USHORT i = 1; i < aRowArr.Count(); ++i )
if ( rToFill != ((SwTableLine*)aRowArr[i])->GetFrmFmt()->GetBackground() )
{
bRet = FALSE;
break;
}
}
}
return bRet;
}
/***********************************************************************
#* Class : SwDoc
#* Methoden : SetTabBorders(), GetTabBorders()
#***********************************************************************/
inline void InsertCell( SvPtrarr& rCellArr, SwCellFrm* pCellFrm )
{
if( USHRT_MAX == rCellArr.GetPos( pCellFrm ) )
rCellArr.Insert( pCellFrm, rCellArr.Count() );
2000-09-18 23:08:29 +00:00
}
//-----------------------------------------------------------------------------
void lcl_CollectCells( SvPtrarr &rArr, const SwRect &rUnion,
SwTabFrm *pTab )
{
SwLayoutFrm *pCell = pTab->FirstCell();
do
{
// Wenn in der Zelle ein spaltiger Bereich sitzt, muessen wir
// uns erst wieder zur Zelle hochhangeln
while ( !pCell->IsCellFrm() )
pCell = pCell->GetUpper();
OSL_ENSURE( pCell, "Frame ist keine Zelle." );
2000-09-18 23:08:29 +00:00
if ( rUnion.IsOver( pCell->Frm() ) )
::InsertCell( rArr, (SwCellFrm*)pCell );
//Dafuer sorgen, dass die Zelle auch verlassen wird (Bereiche)
SwLayoutFrm *pTmp = pCell;
do
{ pTmp = pTmp->GetNextLayoutLeaf();
} while ( pCell->IsAnLower( pTmp ) );
pCell = pTmp;
} while( pCell && pTab->IsAnLower( pCell ) );
}
void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet )
{
SwCntntNode* pCntNd = rCursor.GetPoint()->nNode.GetNode().GetCntntNode();
SwTableNode* pTblNd = pCntNd ? pCntNd->FindTableNode() : 0;
2000-09-18 23:08:29 +00:00
if( !pTblNd )
return ;
SwLayoutFrm *pStart, *pEnd;
::lcl_GetStartEndCell( rCursor, pStart, pEnd );
SwSelUnions aUnions;
::MakeSelUnions( aUnions, pStart, pEnd );
if( aUnions.Count() )
{
SwTable& rTable = pTblNd->GetTable();
if( DoesUndo() )
{
ClearRedo();
AppendUndo( new SwUndoAttrTbl( *pTblNd ));
}
SvPtrarr aFmtCmp( 255, 255 );
const SvxBoxItem* pSetBox;
const SvxBoxInfoItem *pSetBoxInfo;
const SvxBorderLine* pLeft = 0;
const SvxBorderLine* pRight = 0;
const SvxBorderLine* pTop = 0;
const SvxBorderLine* pBottom = 0;
const SvxBorderLine* pHori = 0;
const SvxBorderLine* pVert = 0;
BOOL bHoriValid = TRUE, bVertValid = TRUE,
bTopValid = TRUE, bBottomValid = TRUE,
bLeftValid = TRUE, bRightValid = TRUE;
// JP 21.07.95: die Flags im BoxInfo-Item entscheiden, wann eine
// BorderLine gueltig ist!!
if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_BORDER_INNER, FALSE,
(const SfxPoolItem**)&pSetBoxInfo) )
{
pHori = pSetBoxInfo->GetHori();
pVert = pSetBoxInfo->GetVert();
bHoriValid = pSetBoxInfo->IsValid(VALID_HORI);
bVertValid = pSetBoxInfo->IsValid(VALID_VERT);
// wollen wir die auswerten ??
bTopValid = pSetBoxInfo->IsValid(VALID_TOP);
bBottomValid = pSetBoxInfo->IsValid(VALID_BOTTOM);
bLeftValid = pSetBoxInfo->IsValid(VALID_LEFT);
bRightValid = pSetBoxInfo->IsValid(VALID_RIGHT);
}
if( SFX_ITEM_SET == rSet.GetItemState( RES_BOX, FALSE,
(const SfxPoolItem**)&pSetBox) )
{
pLeft = pSetBox->GetLeft();
pRight = pSetBox->GetRight();
pTop = pSetBox->GetTop();
pBottom = pSetBox->GetBottom();
}
else
{
// nicht gesetzt, also keine gueltigen Werte
bTopValid = bBottomValid = bLeftValid = bRightValid = FALSE;
pSetBox = 0;
}
BOOL bFirst = TRUE;
for ( USHORT i = 0; i < aUnions.Count(); ++i )
{
SwSelUnion *pUnion = aUnions[i];
SwTabFrm *pTab = pUnion->GetTable();
const SwRect &rUnion = pUnion->GetUnion();
const BOOL bLast = i == aUnions.Count() - 1 ? TRUE : FALSE;
SvPtrarr aCellArr( 255, 255 );
::lcl_CollectCells( aCellArr, pUnion->GetUnion(), pTab );
//Alle Zellenkanten, die mit dem UnionRect uebereinstimmen oder
//darueber hinausragen sind Aussenkanten. Alle anderen sind
//Innenkanten.
//neu: Die Aussenkanten koennen abhaengig davon, ob es sich um eine
//Start/Mittlere/Folge -Tabelle (bei Selektionen ueber FollowTabs)
//handelt doch keine Aussenkanten sein.
//Aussenkanten werden links, rechts, oben und unten gesetzt.
//Innenkanten werden nur oben und links gesetzt.
for ( USHORT j = 0; j < aCellArr.Count(); ++j )
{
SwCellFrm *pCell = (SwCellFrm*)aCellArr[j];
const sal_Bool bVert = pTab->IsVertical();
const sal_Bool bRTL = pTab->IsRightToLeft();
sal_Bool bTopOver, bLeftOver, bRightOver, bBottomOver;
if ( bVert )
{
bTopOver = pCell->Frm().Right() >= rUnion.Right();
bLeftOver = pCell->Frm().Top() <= rUnion.Top();
bRightOver = pCell->Frm().Bottom() >= rUnion.Bottom();
bBottomOver = pCell->Frm().Left() <= rUnion.Left();
}
else
{
bTopOver = pCell->Frm().Top() <= rUnion.Top();
bLeftOver = pCell->Frm().Left() <= rUnion.Left();
bRightOver = pCell->Frm().Right() >= rUnion.Right();
bBottomOver = pCell->Frm().Bottom() >= rUnion.Bottom();
}
if ( bRTL )
{
sal_Bool bTmp = bRightOver;
bRightOver = bLeftOver;
bLeftOver = bTmp;
}
2000-09-18 23:08:29 +00:00
//Grundsaetzlich nichts setzen in HeadlineRepeats.
if ( pTab->IsFollow() &&
( pTab->IsInHeadline( *pCell ) ||
// --> FME 2006-02-07 #126092# Same holds for follow flow rows.
pCell->IsInFollowFlowRow() ) )
// <--
2000-09-18 23:08:29 +00:00
continue;
SvxBoxItem aBox( pCell->GetFmt()->GetBox() );
INT16 nType = 0;
//Obere Kante
if( bTopValid )
{
if ( bFirst && bTopOver )
2000-09-18 23:08:29 +00:00
{
aBox.SetLine( pTop, BOX_LINE_TOP );
nType |= 0x0001;
}
else if ( bHoriValid )
{
aBox.SetLine( 0, BOX_LINE_TOP );
nType |= 0x0002;
}
}
//Linke Kante
if ( bLeftOver )
2000-09-18 23:08:29 +00:00
{
if( bLeftValid )
{
aBox.SetLine( pLeft, BOX_LINE_LEFT );
nType |= 0x0004;
}
}
else if( bVertValid )
{
aBox.SetLine( pVert, BOX_LINE_LEFT );
nType |= 0x0008;
}
//Rechte Kante
if( bRightValid )
{
if ( bRightOver )
2000-09-18 23:08:29 +00:00
{
aBox.SetLine( pRight, BOX_LINE_RIGHT );
nType |= 0x0010;
}
else if ( bVertValid )
{
aBox.SetLine( 0, BOX_LINE_RIGHT );
nType |= 0x0020;
}
}
//Untere Kante
if ( bLast && bBottomOver )
2000-09-18 23:08:29 +00:00
{
if( bBottomValid )
{
aBox.SetLine( pBottom, BOX_LINE_BOTTOM );
nType |= 0x0040;
}
}
else if( bHoriValid )
{
aBox.SetLine( pHori, BOX_LINE_BOTTOM );
nType |= 0x0080;
}
if( pSetBox )
{
static USHORT const aBorders[] = {
2000-09-18 23:08:29 +00:00
BOX_LINE_BOTTOM, BOX_LINE_TOP,
BOX_LINE_RIGHT, BOX_LINE_LEFT };
const USHORT* pBrd = aBorders;
for( int k = 0; k < 4; ++k, ++pBrd )
2000-09-18 23:08:29 +00:00
aBox.SetDistance( pSetBox->GetDistance( *pBrd ), *pBrd );
}
SwTableBox *pBox = (SwTableBox*)pCell->GetTabBox();
SwFrmFmt *pNewFmt;
if ( 0 != (pNewFmt = SwTblFmtCmp::FindNewFmt( aFmtCmp, pBox->GetFrmFmt(), nType )))
pBox->ChgFrmFmt( (SwTableBoxFmt*)pNewFmt );
else
{
SwFrmFmt *pOld = pBox->GetFrmFmt();
SwFrmFmt *pNew = pBox->ClaimFrmFmt();
pNew->SetFmtAttr( aBox );
2000-09-18 23:08:29 +00:00
aFmtCmp.Insert( new SwTblFmtCmp( pOld, pNew, nType ), aFmtCmp.Count());
}
}
bFirst = FALSE;
}
SwHTMLTableLayout *pTableLayout = rTable.GetHTMLTableLayout();
if( pTableLayout )
2000-09-18 23:08:29 +00:00
{
SwCntntFrm* pFrm = rCursor.GetCntntNode()->GetFrm();
SwTabFrm* pTabFrm = pFrm->ImplFindTabFrm();
pTableLayout->BordersChanged(
pTableLayout->GetBrowseWidthByTabFrm( *pTabFrm ), TRUE );
2000-09-18 23:08:29 +00:00
}
SwTblFmtCmp::Delete( aFmtCmp );
::ClearFEShellTabCols();
SetModified();
}
}
void lcl_SetLineStyle( SvxBorderLine *pToSet,
const Color *pColor, const SvxBorderLine *pBorderLine)
{
if ( pBorderLine )
{
if ( !pColor )
{
Color aTmp( pToSet->GetColor() );
*pToSet = *pBorderLine;
pToSet->SetColor( aTmp );
}
else
*pToSet = *pBorderLine;
}
if ( pColor )
pToSet->SetColor( *pColor );
}
void SwDoc::SetTabLineStyle( const SwCursor& rCursor,
const Color* pColor, BOOL bSetLine,
const SvxBorderLine* pBorderLine )
{
SwCntntNode* pCntNd = rCursor.GetPoint()->nNode.GetNode().GetCntntNode();
SwTableNode* pTblNd = pCntNd ? pCntNd->FindTableNode() : 0;
2000-09-18 23:08:29 +00:00
if( !pTblNd )
return ;
SwLayoutFrm *pStart, *pEnd;
::lcl_GetStartEndCell( rCursor, pStart, pEnd );
SwSelUnions aUnions;
::MakeSelUnions( aUnions, pStart, pEnd );
if( aUnions.Count() )
{
SwTable& rTable = pTblNd->GetTable();
if( DoesUndo() )
{
ClearRedo();
AppendUndo( new SwUndoAttrTbl( *pTblNd ));
}
for( USHORT i = 0; i < aUnions.Count(); ++i )
{
SwSelUnion *pUnion = aUnions[i];
SwTabFrm *pTab = pUnion->GetTable();
SvPtrarr aCellArr( 255, 255 );
::lcl_CollectCells( aCellArr, pUnion->GetUnion(), pTab );
for ( USHORT j = 0; j < aCellArr.Count(); ++j )
{
SwCellFrm *pCell = ( SwCellFrm* )aCellArr[j];
//Grundsaetzlich nichts setzen in HeadlineRepeats.
if ( pTab->IsFollow() && pTab->IsInHeadline( *pCell ) )
2000-09-18 23:08:29 +00:00
continue;
((SwTableBox*)pCell->GetTabBox())->ClaimFrmFmt();
SwFrmFmt *pFmt = pCell->GetFmt();
SvxBoxItem aBox( pFmt->GetBox() );
if ( !pBorderLine && bSetLine )
aBox = *(SvxBoxItem*)::GetDfltAttr( RES_BOX );
else
{
if ( aBox.GetTop() )
::lcl_SetLineStyle( (SvxBorderLine*)aBox.GetTop(),
pColor, pBorderLine );
if ( aBox.GetBottom() )
::lcl_SetLineStyle( (SvxBorderLine*)aBox.GetBottom(),
pColor, pBorderLine );
if ( aBox.GetLeft() )
::lcl_SetLineStyle( (SvxBorderLine*)aBox.GetLeft(),
pColor, pBorderLine );
if ( aBox.GetRight() )
::lcl_SetLineStyle( (SvxBorderLine*)aBox.GetRight(),
pColor, pBorderLine );
}
pFmt->SetFmtAttr( aBox );
2000-09-18 23:08:29 +00:00
}
}
SwHTMLTableLayout *pTableLayout = rTable.GetHTMLTableLayout();
if( pTableLayout )
2000-09-18 23:08:29 +00:00
{
SwCntntFrm* pFrm = rCursor.GetCntntNode()->GetFrm();
SwTabFrm* pTabFrm = pFrm->ImplFindTabFrm();
pTableLayout->BordersChanged(
pTableLayout->GetBrowseWidthByTabFrm( *pTabFrm ), TRUE );
2000-09-18 23:08:29 +00:00
}
::ClearFEShellTabCols();
SetModified();
}
}
void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const
{
SwCntntNode* pCntNd = rCursor.GetPoint()->nNode.GetNode().GetCntntNode();
SwTableNode* pTblNd = pCntNd ? pCntNd->FindTableNode() : 0;
2000-09-18 23:08:29 +00:00
if( !pTblNd )
return ;
SwLayoutFrm *pStart, *pEnd;
::lcl_GetStartEndCell( rCursor, pStart, pEnd );
SwSelUnions aUnions;
::MakeSelUnions( aUnions, pStart, pEnd );
if( aUnions.Count() )
{
SvxBoxItem aSetBox ((const SvxBoxItem &) rSet.Get(RES_BOX ));
SvxBoxInfoItem aSetBoxInfo((const SvxBoxInfoItem&) rSet.Get(SID_ATTR_BORDER_INNER));
BOOL bTopSet = FALSE,
bBottomSet = FALSE,
bLeftSet = FALSE,
bRightSet = FALSE,
bHoriSet = FALSE,
bVertSet = FALSE,
bDistanceSet = FALSE;
aSetBoxInfo.ResetFlags();
for ( USHORT i = 0; i < aUnions.Count(); ++i )
{
SwSelUnion *pUnion = aUnions[i];
const SwTabFrm *pTab = pUnion->GetTable();
const SwRect &rUnion = pUnion->GetUnion();
const BOOL bFirst = i == 0 ? TRUE : FALSE;
const BOOL bLast = i == aUnions.Count() - 1 ? TRUE : FALSE;
SvPtrarr aCellArr( 255, 255 );
::lcl_CollectCells( aCellArr, rUnion, (SwTabFrm*)pTab );
for ( USHORT j = 0; j < aCellArr.Count(); ++j )
{
const SwCellFrm *pCell = (const SwCellFrm*)aCellArr[j];
const sal_Bool bVert = pTab->IsVertical();
const sal_Bool bRTL = pTab->IsRightToLeft();
sal_Bool bTopOver, bLeftOver, bRightOver, bBottomOver;
if ( bVert )
{
bTopOver = pCell->Frm().Right() >= rUnion.Right();
bLeftOver = pCell->Frm().Top() <= rUnion.Top();
bRightOver = pCell->Frm().Bottom() >= rUnion.Bottom();
bBottomOver = pCell->Frm().Left() <= rUnion.Left();
}
else
{
bTopOver = pCell->Frm().Top() <= rUnion.Top();
bLeftOver = pCell->Frm().Left() <= rUnion.Left();
bRightOver = pCell->Frm().Right() >= rUnion.Right();
bBottomOver = pCell->Frm().Bottom() >= rUnion.Bottom();
}
if ( bRTL )
{
sal_Bool bTmp = bRightOver;
bRightOver = bLeftOver;
bLeftOver = bTmp;
}
2000-09-18 23:08:29 +00:00
const SwFrmFmt *pFmt = pCell->GetFmt();
const SvxBoxItem &rBox = pFmt->GetBox();
//Obere Kante
if ( bFirst && bTopOver )
2000-09-18 23:08:29 +00:00
{
if (aSetBoxInfo.IsValid(VALID_TOP))
{
if ( !bTopSet )
{ bTopSet = TRUE;
aSetBox.SetLine( rBox.GetTop(), BOX_LINE_TOP );
}
else if ((aSetBox.GetTop() && rBox.GetTop() &&
!(*aSetBox.GetTop() == *rBox.GetTop())) ||
((!aSetBox.GetTop()) ^ (!rBox.GetTop()))) // XOR-Ausdruck ist TRUE, wenn genau einer der beiden Pointer 0 ist
{
aSetBoxInfo.SetValid(VALID_TOP, FALSE );
aSetBox.SetLine( 0, BOX_LINE_TOP );
}
}
}
//Linke Kante
if ( bLeftOver )
2000-09-18 23:08:29 +00:00
{
if (aSetBoxInfo.IsValid(VALID_LEFT))
{
if ( !bLeftSet )
{ bLeftSet = TRUE;
aSetBox.SetLine( rBox.GetLeft(), BOX_LINE_LEFT );
}
else if ((aSetBox.GetLeft() && rBox.GetLeft() &&
!(*aSetBox.GetLeft() == *rBox.GetLeft())) ||
((!aSetBox.GetLeft()) ^ (!rBox.GetLeft())))
{
aSetBoxInfo.SetValid(VALID_LEFT, FALSE );
aSetBox.SetLine( 0, BOX_LINE_LEFT );
}
}
}
else
{
if (aSetBoxInfo.IsValid(VALID_VERT))
{
if ( !bVertSet )
{ bVertSet = TRUE;
aSetBoxInfo.SetLine( rBox.GetLeft(), BOXINFO_LINE_VERT );
}
else if ((aSetBoxInfo.GetVert() && rBox.GetLeft() &&
!(*aSetBoxInfo.GetVert() == *rBox.GetLeft())) ||
((!aSetBoxInfo.GetVert()) ^ (!rBox.GetLeft())))
{ aSetBoxInfo.SetValid( VALID_VERT, FALSE );
aSetBoxInfo.SetLine( 0, BOXINFO_LINE_VERT );
}
}
}
//Rechte Kante
if ( aSetBoxInfo.IsValid(VALID_RIGHT) && bRightOver )
2000-09-18 23:08:29 +00:00
{
if ( !bRightSet )
{ bRightSet = TRUE;
aSetBox.SetLine( rBox.GetRight(), BOX_LINE_RIGHT );
}
else if ((aSetBox.GetRight() && rBox.GetRight() &&
!(*aSetBox.GetRight() == *rBox.GetRight())) ||
(!aSetBox.GetRight() ^ !rBox.GetRight()))
{ aSetBoxInfo.SetValid( VALID_RIGHT, FALSE );
aSetBox.SetLine( 0, BOX_LINE_RIGHT );
}
}
//Untere Kante
if ( bLast && bBottomOver )
2000-09-18 23:08:29 +00:00
{
if ( aSetBoxInfo.IsValid(VALID_BOTTOM) )
{
if ( !bBottomSet )
{ bBottomSet = TRUE;
aSetBox.SetLine( rBox.GetBottom(), BOX_LINE_BOTTOM );
}
else if ((aSetBox.GetBottom() && rBox.GetBottom() &&
!(*aSetBox.GetBottom() == *rBox.GetBottom())) ||
(!aSetBox.GetBottom() ^ !rBox.GetBottom()))
{ aSetBoxInfo.SetValid( VALID_BOTTOM, FALSE );
aSetBox.SetLine( 0, BOX_LINE_BOTTOM );
}
}
}
//in allen Zeilen ausser der letzten werden die
// horiz. Linien aus der Bottom-Linie entnommen
else
{
if (aSetBoxInfo.IsValid(VALID_HORI))
{
if ( !bHoriSet )
{ bHoriSet = TRUE;
aSetBoxInfo.SetLine( rBox.GetBottom(), BOXINFO_LINE_HORI );
}
else if ((aSetBoxInfo.GetHori() && rBox.GetBottom() &&
!(*aSetBoxInfo.GetHori() == *rBox.GetBottom())) ||
((!aSetBoxInfo.GetHori()) ^ (!rBox.GetBottom())))
{
aSetBoxInfo.SetValid( VALID_HORI, FALSE );
aSetBoxInfo.SetLine( 0, BOXINFO_LINE_HORI );
}
}
}
// Abstand zum Text
if (aSetBoxInfo.IsValid(VALID_DISTANCE))
{
static USHORT const aBorders[] = {
2000-09-18 23:08:29 +00:00
BOX_LINE_BOTTOM, BOX_LINE_TOP,
BOX_LINE_RIGHT, BOX_LINE_LEFT };
const USHORT* pBrd = aBorders;
if( !bDistanceSet ) // bei 1. Durchlauf erstmal setzen
{
bDistanceSet = TRUE;
for( int k = 0; k < 4; ++k, ++pBrd )
2000-09-18 23:08:29 +00:00
aSetBox.SetDistance( rBox.GetDistance( *pBrd ),
*pBrd );
}
else
{
for( int k = 0; k < 4; ++k, ++pBrd )
2000-09-18 23:08:29 +00:00
if( aSetBox.GetDistance( *pBrd ) !=
rBox.GetDistance( *pBrd ) )
{
aSetBoxInfo.SetValid( VALID_DISTANCE, FALSE );
aSetBox.SetDistance( (USHORT) 0 );
break;
}
}
}
}
}
rSet.Put( aSetBox );
rSet.Put( aSetBoxInfo );
}
}
/***********************************************************************
#* Class : SwDoc
#* Methoden : SetBoxAttr
#***********************************************************************/
void SwDoc::SetBoxAttr( const SwCursor& rCursor, const SfxPoolItem &rNew )
{
SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode();
SwSelBoxes aBoxes;
if( pTblNd && ::lcl_GetBoxSel( rCursor, aBoxes, TRUE ) )
{
SwTable& rTable = pTblNd->GetTable();
if( DoesUndo() )
{
ClearRedo();
AppendUndo( new SwUndoAttrTbl( *pTblNd ));
}
SvPtrarr aFmtCmp( Max( BYTE(255), BYTE(aBoxes.Count()) ), 255 );
for ( USHORT i = 0; i < aBoxes.Count(); ++i )
{
SwTableBox *pBox = aBoxes[i];
SwFrmFmt *pNewFmt;
if ( 0 != (pNewFmt = SwTblFmtCmp::FindNewFmt( aFmtCmp, pBox->GetFrmFmt(), 0 )))
pBox->ChgFrmFmt( (SwTableBoxFmt*)pNewFmt );
else
{
SwFrmFmt *pOld = pBox->GetFrmFmt();
SwFrmFmt *pNew = pBox->ClaimFrmFmt();
pNew->SetFmtAttr( rNew );
2000-09-18 23:08:29 +00:00
aFmtCmp.Insert( new SwTblFmtCmp( pOld, pNew, 0 ), aFmtCmp.Count());
}
}
SwHTMLTableLayout *pTableLayout = rTable.GetHTMLTableLayout();
if( pTableLayout )
2000-09-18 23:08:29 +00:00
{
SwCntntFrm* pFrm = rCursor.GetCntntNode()->GetFrm();
SwTabFrm* pTabFrm = pFrm->ImplFindTabFrm();
pTableLayout->Resize(
pTableLayout->GetBrowseWidthByTabFrm( *pTabFrm ), TRUE );
2000-09-18 23:08:29 +00:00
}
SwTblFmtCmp::Delete( aFmtCmp );
SetModified();
}
}
/***********************************************************************
#* Class : SwDoc
#* Methoden : GetBoxAttr()
2000-09-18 23:08:29 +00:00
#***********************************************************************/
BOOL SwDoc::GetBoxAttr( const SwCursor& rCursor, SfxPoolItem& rToFill ) const
2000-09-18 23:08:29 +00:00
{
BOOL bRet = FALSE;
SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode();
SwSelBoxes aBoxes;
if( pTblNd && lcl_GetBoxSel( rCursor, aBoxes ))
{
bRet = TRUE;
BOOL bOneFound = FALSE;
const USHORT nWhich = rToFill.Which();
2000-09-18 23:08:29 +00:00
for( USHORT i = 0; i < aBoxes.Count(); ++i )
{
switch ( nWhich )
2000-09-18 23:08:29 +00:00
{
case RES_BACKGROUND:
{
const SvxBrushItem &rBack =
aBoxes[i]->GetFrmFmt()->GetBackground();
if( !bOneFound )
{
(SvxBrushItem&)rToFill = rBack;
bOneFound = TRUE;
}
else if( rToFill != rBack )
bRet = FALSE;
}
2000-09-18 23:08:29 +00:00
break;
case RES_FRAMEDIR:
{
const SvxFrameDirectionItem& rDir =
aBoxes[i]->GetFrmFmt()->GetFrmDir();
if( !bOneFound )
{
(SvxFrameDirectionItem&)rToFill = rDir;
bOneFound = TRUE;
}
else if( rToFill != rDir )
bRet = FALSE;
}
2000-09-18 23:08:29 +00:00
}
if ( FALSE == bRet )
break;
2000-09-18 23:08:29 +00:00
}
}
return bRet;
}
/***********************************************************************
#* Class : SwDoc
#* Methoden : SetBoxAlign, SetBoxAlign
#***********************************************************************/
void SwDoc::SetBoxAlign( const SwCursor& rCursor, USHORT nAlign )
{
OSL_ENSURE( nAlign == text::VertOrientation::NONE ||
nAlign == text::VertOrientation::CENTER ||
nAlign == text::VertOrientation::BOTTOM, "wrong alignment" );
SwFmtVertOrient aVertOri( 0, nAlign );
2000-09-18 23:08:29 +00:00
SetBoxAttr( rCursor, aVertOri );
}
USHORT SwDoc::GetBoxAlign( const SwCursor& rCursor ) const
{
USHORT nAlign = USHRT_MAX;
SwTableNode* pTblNd = rCursor.GetPoint()->nNode.GetNode().FindTableNode();
SwSelBoxes aBoxes;
if( pTblNd && ::lcl_GetBoxSel( rCursor, aBoxes ))
for( USHORT i = 0; i < aBoxes.Count(); ++i )
{
const SwFmtVertOrient &rOri =
aBoxes[i]->GetFrmFmt()->GetVertOrient();
if( USHRT_MAX == nAlign )
nAlign = static_cast<USHORT>(rOri.GetVertOrient());
2000-09-18 23:08:29 +00:00
else if( rOri.GetVertOrient() != nAlign )
{
nAlign = USHRT_MAX;
break;
}
}
return nAlign;
}
/***********************************************************************
#* Class : SwDoc
#* Methoden : AdjustCellWidth()
#***********************************************************************/
USHORT lcl_CalcCellFit( const SwLayoutFrm *pCell )
{
SwTwips nRet = 0;
const SwFrm *pFrm = pCell->Lower(); //Die ganze Zelle.
SWRECTFN( pCell )
2000-09-18 23:08:29 +00:00
while ( pFrm )
{
const SwTwips nAdd = (pFrm->Frm().*fnRect->fnGetWidth)() -
(pFrm->Prt().*fnRect->fnGetWidth)();
// --> FME 2005-12-02 #127801# pFrm does not necessarily have to be a SwTxtFrm!
const SwTwips nCalcFitToContent = pFrm->IsTxtFrm() ?
((SwTxtFrm*)pFrm)->CalcFitToContent() :
(pFrm->Prt().*fnRect->fnGetWidth)();
// <--
nRet = Max( nRet, nCalcFitToContent + nAdd );
2000-09-18 23:08:29 +00:00
pFrm = pFrm->GetNext();
}
//Umrandung und linker/rechter Rand wollen mit kalkuliert werden.
nRet += (pCell->Frm().*fnRect->fnGetWidth)() -
(pCell->Prt().*fnRect->fnGetWidth)();
2000-09-18 23:08:29 +00:00
//Um Rechenungenauikeiten, die spaeter bei SwTable::SetTabCols enstehen,
//auszugleichen, addieren wir noch ein bischen.
nRet += COLFUZZY;
return (USHORT)Max( long(MINLAY), nRet );
}
/*Die Zelle ist in der Selektion, wird aber nicht von den TabCols beschrieben.
*Das bedeutet, dass die Zelle aufgrund der zweidimensionalen Darstellung von
*anderen Zellen "geteilt" wurde. Wir muessen also den Wunsch- bzw. Minimalwert
*der Zelle auf die Spalten, durch die sie geteilt wurde verteilen.
*
*Dazu sammeln wir zuerst die Spalten - nicht die Spaltentrenner! - ein, die
*sich mit der Zelle ueberschneiden. Den Wunschwert der Zelle verteilen wir
*dann anhand des Betrages der Ueberschneidung auf die Zellen.
*Wenn eine Zelle bereits einen groesseren Wunschwert angemeldet hat, so bleibt
*dieser erhalten, kleinere Wuensche werden ueberschrieben.
*/
void lcl_CalcSubColValues( SvUShorts &rToFill, const SwTabCols &rCols,
const SwLayoutFrm *pCell, const SwLayoutFrm *pTab,
BOOL bWishValues )
{
const USHORT nWish = bWishValues ?
::lcl_CalcCellFit( pCell ) :
MINLAY + USHORT(pCell->Frm().Width() - pCell->Prt().Width());
SWRECTFN( pTab )
2000-09-18 23:08:29 +00:00
for ( USHORT i = 0 ; i <= rCols.Count(); ++i )
{
long nColLeft = i == 0 ? rCols.GetLeft() : rCols[i-1];
long nColRight = i == rCols.Count() ? rCols.GetRight() : rCols[i];
nColLeft += rCols.GetLeftMin();
nColRight += rCols.GetLeftMin();
//Werte auf die Verhaeltnisse der Tabelle (Follows) anpassen.
if ( rCols.GetLeftMin() != USHORT((pTab->Frm().*fnRect->fnGetLeft)()) )
2000-09-18 23:08:29 +00:00
{
const long nDiff = (pTab->Frm().*fnRect->fnGetLeft)() - rCols.GetLeftMin();
2000-09-18 23:08:29 +00:00
nColLeft += nDiff;
nColRight += nDiff;
}
const long nCellLeft = (pCell->Frm().*fnRect->fnGetLeft)();
const long nCellRight = (pCell->Frm().*fnRect->fnGetRight)();
2000-09-18 23:08:29 +00:00
//Ueberschneidungsbetrag ermitteln.
long nWidth = 0;
if ( nColLeft <= nCellLeft && nColRight >= (nCellLeft+COLFUZZY) )
nWidth = nColRight - nCellLeft;
else if ( nColLeft <= (nCellRight-COLFUZZY) && nColRight >= nCellRight )
nWidth = nCellRight - nColLeft;
else if ( nColLeft >= nCellLeft && nColRight <= nCellRight )
nWidth = nColRight - nColLeft;
if ( nWidth && pCell->Frm().Width() )
2000-09-18 23:08:29 +00:00
{
long nTmp = nWidth * nWish / pCell->Frm().Width();
if ( USHORT(nTmp) > rToFill[i] )
rToFill[i] = USHORT(nTmp);
}
}
}
/*Besorgt neue Werte zu Einstellung der TabCols.
*Es wird nicht ueber die Eintrage in den TabCols itereriert, sondern
*quasi ueber die Zwischenraeume, die ja die Zellen beschreiben.
*
*bWishValues == TRUE: Es werden zur aktuellen Selektion bzw. zur aktuellen
* Zelle die Wunschwerte aller betroffen Zellen ermittelt.
* Sind mehrere Zellen in einer Spalte, so wird der
* groesste Wunschwert als Ergebnis geliefert.
* Fuer die TabCol-Eintraege, zu denen keine Zellen
* ermittelt wurden, werden 0-en eingetragen.
*
*bWishValues == FALSE: Die Selektion wird senkrecht ausgedehnt. Zu jeder
* Spalte in den TabCols, die sich mit der Selektion
* schneidet wird der Minimalwert ermittelt.
*/
void lcl_CalcColValues( SvUShorts &rToFill, const SwTabCols &rCols,
const SwLayoutFrm *pStart, const SwLayoutFrm *pEnd,
BOOL bWishValues )
{
SwSelUnions aUnions;
::MakeSelUnions( aUnions, pStart, pEnd,
bWishValues ? nsSwTblSearchType::TBLSEARCH_NONE : nsSwTblSearchType::TBLSEARCH_COL );
2000-09-18 23:08:29 +00:00
for ( USHORT i2 = 0; i2 < aUnions.Count(); ++i2 )
{
SwSelUnion *pSelUnion = aUnions[i2];
const SwTabFrm *pTab = pSelUnion->GetTable();
const SwRect &rUnion = pSelUnion->GetUnion();
SWRECTFN( pTab )
sal_Bool bRTL = pTab->IsRightToLeft();
2000-09-18 23:08:29 +00:00
const SwLayoutFrm *pCell = pTab->FirstCell();
do
{
if ( pCell->IsCellFrm() && pCell->FindTabFrm() == pTab && ::IsFrmInTblSel( rUnion, pCell ) )
2000-09-18 23:08:29 +00:00
{
const long nCLeft = (pCell->Frm().*fnRect->fnGetLeft)();
const long nCRight = (pCell->Frm().*fnRect->fnGetRight)();
2000-09-18 23:08:29 +00:00
BOOL bNotInCols = TRUE;
for ( USHORT i = 0; i <= rCols.Count(); ++i )
{
USHORT nFit = rToFill[i];
long nColLeft = i == 0 ? rCols.GetLeft() : rCols[i-1];
long nColRight = i == rCols.Count() ? rCols.GetRight() : rCols[i];
if ( bRTL )
{
long nTmpRight = nColRight;
nColRight = rCols.GetRight() - nColLeft;
nColLeft = rCols.GetRight() - nTmpRight;
}
2000-09-18 23:08:29 +00:00
nColLeft += rCols.GetLeftMin();
nColRight += rCols.GetLeftMin();
//Werte auf die Verhaeltnisse der Tabelle (Follows) anpassen.
long nLeftA = nColLeft;
long nRightA = nColRight;
if ( rCols.GetLeftMin() != USHORT((pTab->Frm().*fnRect->fnGetLeft)()) )
2000-09-18 23:08:29 +00:00
{
const long nDiff = (pTab->Frm().*fnRect->fnGetLeft)() - rCols.GetLeftMin();
2000-09-18 23:08:29 +00:00
nLeftA += nDiff;
nRightA += nDiff;
}
//Wir wollen nicht allzu genau hinsehen.
if ( ::IsSame(nCLeft, nLeftA) && ::IsSame(nCRight, nRightA))
{
bNotInCols = FALSE;
if ( bWishValues )
{
const USHORT nWish = ::lcl_CalcCellFit( pCell );
if ( nWish > nFit )
nFit = nWish;
}
else
{ const USHORT nMin = MINLAY + USHORT(pCell->Frm().Width() -
pCell->Prt().Width());
if ( !nFit || nMin < nFit )
nFit = nMin;
}
if ( rToFill[i] < nFit )
rToFill[i] = nFit;
}
}
if ( bNotInCols )
::lcl_CalcSubColValues( rToFill, rCols, pCell, pTab, bWishValues );
}
do {
pCell = pCell->GetNextLayoutLeaf();
}while( pCell && pCell->Frm().Width() == 0 );
} while ( pCell && pTab->IsAnLower( pCell ) );
2000-09-18 23:08:29 +00:00
}
}
void SwDoc::AdjustCellWidth( const SwCursor& rCursor, BOOL bBalance )
{
// pruefe ob vom aktuellen Crsr der Point/Mark in einer Tabelle stehen
SwCntntNode* pCntNd = rCursor.GetPoint()->nNode.GetNode().GetCntntNode();
SwTableNode* pTblNd = pCntNd ? pCntNd->FindTableNode() : 0;
2000-09-18 23:08:29 +00:00
if( !pTblNd )
return ;
SwLayoutFrm *pStart, *pEnd;
::lcl_GetStartEndCell( rCursor, pStart, pEnd );
//TabCols besorgen, den ueber diese stellen wir die Tabelle neu ein.
SwFrm* pBoxFrm = pStart;
while( pBoxFrm && !pBoxFrm->IsCellFrm() )
2000-09-18 23:08:29 +00:00
pBoxFrm = pBoxFrm->GetUpper();
if ( !pBoxFrm )
return; // robust
2000-09-18 23:08:29 +00:00
SwTabCols aTabCols;
GetTabCols( aTabCols, 0, (SwCellFrm*)pBoxFrm );
if ( ! aTabCols.Count() )
return;
2000-09-18 23:08:29 +00:00
const BYTE nTmp = (BYTE)Max( USHORT(255), USHORT(aTabCols.Count() + 1) );
SvUShorts aWish( nTmp, nTmp ),
aMins( nTmp, nTmp );
USHORT i;
for ( i = 0; i <= aTabCols.Count(); ++i )
2000-09-18 23:08:29 +00:00
{
aWish.Insert( USHORT(0), aWish.Count() );
aMins.Insert( USHORT(0), aMins.Count() );
}
::lcl_CalcColValues( aWish, aTabCols, pStart, pEnd, TRUE );
//Es ist Robuster wenn wir die Min-Werte fuer die ganze Tabelle berechnen.
const SwTabFrm *pTab = pStart->ImplFindTabFrm();
pStart = (SwLayoutFrm*)pTab->FirstCell();
pEnd = (SwLayoutFrm*)pTab->FindLastCntnt()->GetUpper();
while( !pEnd->IsCellFrm() )
pEnd = pEnd->GetUpper();
::lcl_CalcColValues( aMins, aTabCols, pStart, pEnd, FALSE );
if( bBalance )
{
//Alle Spalten, die makiert sind haben jetzt einen Wunschwert
//eingtragen. Wir addieren die aktuellen Werte, teilen das Ergebnis
//durch die Anzahl und haben eine Wunschwert fuer den ausgleich.
USHORT nWish = 0, nCnt = 0;
for ( i = 0; i <= aTabCols.Count(); ++i )
{
int nDiff = aWish[i];
if ( nDiff )
{
if ( i == 0 )
nWish = static_cast<USHORT>( nWish + aTabCols[i] - aTabCols.GetLeft() );
2000-09-18 23:08:29 +00:00
else if ( i == aTabCols.Count() )
nWish = static_cast<USHORT>(nWish + aTabCols.GetRight() - aTabCols[i-1] );
2000-09-18 23:08:29 +00:00
else
nWish = static_cast<USHORT>(nWish + aTabCols[i] - aTabCols[i-1] );
2000-09-18 23:08:29 +00:00
++nCnt;
}
}
nWish = nWish / nCnt;
2000-09-18 23:08:29 +00:00
for ( i = 0; i < aWish.Count(); ++i )
if ( aWish[i] )
aWish[i] = nWish;
}
const USHORT nOldRight = static_cast<USHORT>(aTabCols.GetRight());
2000-09-18 23:08:29 +00:00
//Um die Impl. einfach zu gestalten, aber trotzdem in den meissten Faellen
//den Platz richtig auszunutzen laufen wir zweimal.
//Problem: Erste Spalte wird breiter, die anderen aber erst danach
//schmaler. Die Wunschbreite der ersten Spalte wuerde abgelehnt, weil
//mit ihr die max. Breite der Tabelle ueberschritten wuerde.
for ( USHORT k= 0; k < 2; ++k )
{
for ( i = 0; i <= aTabCols.Count(); ++i )
{
int nDiff = aWish[i];
if ( nDiff )
{
int nMin = aMins[i];
if ( nMin > nDiff )
nDiff = nMin;
if ( i == 0 )
{
if( aTabCols.Count() )
nDiff -= aTabCols[0] - aTabCols.GetLeft();
else
nDiff -= aTabCols.GetRight() - aTabCols.GetLeft();
}
else if ( i == aTabCols.Count() )
nDiff -= aTabCols.GetRight() - aTabCols[i-1];
else
nDiff -= aTabCols[i] - aTabCols[i-1];
long nTabRight = aTabCols.GetRight() + nDiff;
2000-09-18 23:08:29 +00:00
//Wenn die Tabelle zu breit wuerde begrenzen wir die Anpassung
//auf das erlaubte Maximum.
if ( !bBalance && nTabRight > aTabCols.GetRightMax() )
{
const long nTmpD = nTabRight - aTabCols.GetRightMax();
nDiff -= nTmpD;
nTabRight -= nTmpD;
2000-09-18 23:08:29 +00:00
}
for ( USHORT i2 = i; i2 < aTabCols.Count(); ++i2 )
aTabCols[i2] += nDiff;
aTabCols.SetRight( nTabRight );
}
}
}
const USHORT nNewRight = static_cast<USHORT>(aTabCols.GetRight());
2000-09-18 23:08:29 +00:00
SwFrmFmt *pFmt = pTblNd->GetTable().GetFrmFmt();
const sal_Int16 nOriHori = pFmt->GetHoriOrient().GetHoriOrient();
2000-09-18 23:08:29 +00:00
//So, die richtige Arbeit koennen wir jetzt der SwTable ueberlassen.
SetTabCols( aTabCols, FALSE, 0, (SwCellFrm*)pBoxFrm );
// i54248: lijian/fme
// alignment might have been changed in SetTabCols, restore old value:
const SwFmtHoriOrient &rHori = pFmt->GetHoriOrient();
SwFmtHoriOrient aHori( rHori );
if ( aHori.GetHoriOrient() != nOriHori )
{
aHori.SetHoriOrient( nOriHori );
pFmt->SetFmtAttr( aHori );
}
2000-09-18 23:08:29 +00:00
//Bei Automatischer Breite wird auf Linksbuendig umgeschaltet.
//Bei Randattributen wird der Rechte Rand angepasst.
if( !bBalance && nNewRight < nOldRight )
{
if( aHori.GetHoriOrient() == text::HoriOrientation::FULL )
2000-09-18 23:08:29 +00:00
{
aHori.SetHoriOrient( text::HoriOrientation::LEFT );
pFmt->SetFmtAttr( aHori );
2000-09-18 23:08:29 +00:00
}
}
SetModified();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */