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
2673 lines
87 KiB
C++
2673 lines
87 KiB
C++
/*************************************************************************
|
|
*
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
*
|
|
* Copyright 2008 by Sun Microsystems, Inc.
|
|
*
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
|
*
|
|
* $RCSfile: docfmt.cxx,v $
|
|
* $Revision: 1.52 $
|
|
*
|
|
* This file is part of OpenOffice.org.
|
|
*
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
* only, as published by the Free Software Foundation.
|
|
*
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU Lesser General Public License version 3 for more details
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
* <http://www.openoffice.org/license.html>
|
|
* for a copy of the LGPLv3 License.
|
|
*
|
|
************************************************************************/
|
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
#include "precompiled_sw.hxx"
|
|
|
|
|
|
#define _ZFORLIST_DECLARE_TABLE
|
|
#define _SVSTDARR_USHORTSSORT
|
|
#define _SVSTDARR_USHORTS
|
|
#include <hintids.hxx>
|
|
#include <rtl/logfile.hxx>
|
|
#include <svtools/itemiter.hxx>
|
|
#include <sfx2/app.hxx>
|
|
#include <svtools/misccfg.hxx>
|
|
#include <svx/tstpitem.hxx>
|
|
#include <svx/eeitem.hxx>
|
|
#include <svx/langitem.hxx>
|
|
#include <svx/lrspitem.hxx>
|
|
#include <svx/brkitem.hxx>
|
|
#include <svtools/whiter.hxx>
|
|
#ifndef _ZFORLIST_HXX //autogen
|
|
#define _ZFORLIST_DECLARE_TABLE
|
|
#include <svtools/zforlist.hxx>
|
|
#endif
|
|
#include <comphelper/processfactory.hxx>
|
|
#include <com/sun/star/i18n/WordType.hdl>
|
|
#include <fmtpdsc.hxx>
|
|
#include <fmthdft.hxx>
|
|
#include <fmtcntnt.hxx>
|
|
#include <frmatr.hxx>
|
|
#include <doc.hxx>
|
|
#include <rootfrm.hxx>
|
|
#include <pagefrm.hxx>
|
|
#include <hints.hxx> // fuer SwHyphenBug (in SetDefault)
|
|
#include <ndtxt.hxx>
|
|
#include <pam.hxx>
|
|
#include <undobj.hxx>
|
|
#include <ndgrf.hxx>
|
|
#include <pagedesc.hxx> // Fuer Sonderbehandlung in InsFrmFmt
|
|
#include <rolbck.hxx> // Undo-Attr
|
|
#include <mvsave.hxx> // servieren: Veraenderungen erkennen
|
|
#include <txatbase.hxx>
|
|
#include <swtable.hxx>
|
|
#include <swtblfmt.hxx>
|
|
#include <charfmt.hxx>
|
|
#include <docary.hxx>
|
|
#include <paratr.hxx>
|
|
#include <redline.hxx>
|
|
#include <reffld.hxx>
|
|
#include <txtinet.hxx>
|
|
#include <fmtinfmt.hxx>
|
|
#include <breakit.hxx>
|
|
#include <SwStyleNameMapper.hxx>
|
|
#include <fmtautofmt.hxx>
|
|
#include <istyleaccess.hxx>
|
|
#include <SwUndoFmt.hxx>
|
|
#include <docsh.hxx>
|
|
|
|
using namespace ::com::sun::star::i18n;
|
|
using namespace ::com::sun::star::lang;
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
SV_IMPL_PTRARR(SwFrmFmts,SwFrmFmtPtr)
|
|
SV_IMPL_PTRARR(SwCharFmts,SwCharFmtPtr)
|
|
|
|
//Spezifische Frameformate (Rahmen)
|
|
SV_IMPL_PTRARR(SwSpzFrmFmts,SwFrmFmtPtr)
|
|
|
|
/*
|
|
* interne Funktionen
|
|
*/
|
|
|
|
BOOL SetTxtFmtCollNext( const SwTxtFmtCollPtr& rpTxtColl, void* pArgs )
|
|
{
|
|
SwTxtFmtColl *pDel = (SwTxtFmtColl*) pArgs;
|
|
if ( &rpTxtColl->GetNextTxtFmtColl() == pDel )
|
|
{
|
|
rpTxtColl->SetNextTxtFmtColl( *rpTxtColl );
|
|
}
|
|
return TRUE;
|
|
}
|
|
|
|
/*
|
|
* Zuruecksetzen der harten Formatierung fuer Text
|
|
*/
|
|
|
|
// Uebergabeparameter fuer _Rst und lcl_SetTxtFmtColl
|
|
struct ParaRstFmt
|
|
{
|
|
SwFmtColl* pFmtColl;
|
|
SwHistory* pHistory;
|
|
const SwPosition *pSttNd, *pEndNd;
|
|
const SfxItemSet* pDelSet;
|
|
USHORT nWhich;
|
|
bool bReset;
|
|
// --> OD 2007-11-06 #i62575#
|
|
bool bResetListAttrs;
|
|
// <--
|
|
bool bResetAll;
|
|
bool bInclRefToxMark;
|
|
|
|
bool bKeepOutlineLevelAttr; //#outline level,add by zhaojianwei
|
|
|
|
ParaRstFmt( const SwPosition* pStt, const SwPosition* pEnd,
|
|
SwHistory* pHst, USHORT nWhch = 0, const SfxItemSet* pSet = 0 )
|
|
: pFmtColl(0),
|
|
pHistory(pHst),
|
|
pSttNd(pStt),
|
|
pEndNd(pEnd),
|
|
pDelSet(pSet),
|
|
nWhich(nWhch),
|
|
// --> OD 2007-11-06 #i62675#
|
|
bReset( false ),
|
|
bResetListAttrs( false ),
|
|
// <--
|
|
bResetAll( true ),
|
|
bInclRefToxMark( false ),
|
|
bKeepOutlineLevelAttr( false ) //#outline level,add by zhaojianwei
|
|
{}
|
|
|
|
ParaRstFmt( SwHistory* pHst )
|
|
: pFmtColl(0),
|
|
pHistory(pHst),
|
|
pSttNd(0),
|
|
pEndNd(0),
|
|
pDelSet(0),
|
|
nWhich(0),
|
|
// --> OD 2007-11-06 #i62675#
|
|
bReset( false ),
|
|
bResetListAttrs( false ),
|
|
// <--
|
|
bResetAll( true ),
|
|
bInclRefToxMark( false ),
|
|
bKeepOutlineLevelAttr( false ) //#outline level,add by zhaojianwei
|
|
{}
|
|
};
|
|
|
|
/* in pArgs steht die ChrFmtTablle vom Dokument
|
|
* (wird bei Selectionen am Start/Ende und bei keiner SSelection benoetigt)
|
|
*/
|
|
|
|
BOOL lcl_RstTxtAttr( const SwNodePtr& rpNd, void* pArgs )
|
|
{
|
|
ParaRstFmt* pPara = (ParaRstFmt*)pArgs;
|
|
SwTxtNode * pTxtNode = (SwTxtNode*)rpNd->GetTxtNode();
|
|
if( pTxtNode && pTxtNode->GetpSwpHints() )
|
|
{
|
|
SwIndex aSt( pTxtNode, 0 );
|
|
USHORT nEnd = pTxtNode->Len();
|
|
|
|
if( &pPara->pSttNd->nNode.GetNode() == pTxtNode &&
|
|
pPara->pSttNd->nContent.GetIndex() )
|
|
aSt = pPara->pSttNd->nContent.GetIndex();
|
|
|
|
if( &pPara->pEndNd->nNode.GetNode() == rpNd )
|
|
nEnd = pPara->pEndNd->nContent.GetIndex();
|
|
|
|
if( pPara->pHistory )
|
|
{
|
|
// fuers Undo alle Attribute sichern
|
|
SwRegHistory aRHst( *pTxtNode, pPara->pHistory );
|
|
pTxtNode->GetpSwpHints()->Register( &aRHst );
|
|
pTxtNode->RstAttr( aSt, nEnd - aSt.GetIndex(), pPara->nWhich,
|
|
pPara->pDelSet, pPara->bInclRefToxMark );
|
|
if( pTxtNode->GetpSwpHints() )
|
|
pTxtNode->GetpSwpHints()->DeRegister();
|
|
}
|
|
else
|
|
pTxtNode->RstAttr( aSt, nEnd - aSt.GetIndex(), pPara->nWhich,
|
|
pPara->pDelSet, pPara->bInclRefToxMark );
|
|
}
|
|
return TRUE;
|
|
}
|
|
|
|
BOOL lcl_RstAttr( const SwNodePtr& rpNd, void* pArgs )
|
|
{
|
|
ParaRstFmt* pPara = (ParaRstFmt*)pArgs;
|
|
SwCntntNode* pNode = (SwCntntNode*)rpNd->GetCntntNode();
|
|
if( pNode && pNode->HasSwAttrSet() )
|
|
{
|
|
const BOOL bLocked = pNode->IsModifyLocked();
|
|
pNode->LockModify();
|
|
|
|
SwDoc* pDoc = pNode->GetDoc();
|
|
|
|
// --> OD 2008-04-14 #refactorlists#
|
|
// remove unused attribute RES_LR_SPACE
|
|
// add list attributes
|
|
SfxItemSet aSet( pDoc->GetAttrPool(),
|
|
RES_PAGEDESC, RES_BREAK,
|
|
RES_PARATR_NUMRULE, RES_PARATR_NUMRULE,
|
|
RES_PARATR_OUTLINELEVEL,RES_PARATR_OUTLINELEVEL,//#outline level,removed by zhaojianwei
|
|
RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END - 1,
|
|
0 );
|
|
const SfxItemSet* pSet = pNode->GetpSwAttrSet();
|
|
|
|
// --> OD 2008-04-15 #refactorlists#
|
|
// std::vector<USHORT> aClearWhichIds;
|
|
SvUShorts aClearWhichIds;
|
|
// <--
|
|
// --> OD 2008-04-15 #refactorlists#
|
|
// restoring all paragraph list attributes
|
|
{
|
|
SfxItemSet aListAttrSet( pDoc->GetAttrPool(),
|
|
RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END - 1,
|
|
0 );
|
|
aListAttrSet.Set( *pSet );
|
|
if ( aListAttrSet.Count() )
|
|
{
|
|
aSet.Put( aListAttrSet );
|
|
SfxItemIter aIter( aListAttrSet );
|
|
const SfxPoolItem* pItem = aIter.GetCurItem();
|
|
while( pItem )
|
|
{
|
|
aClearWhichIds.Insert( pItem->Which(), aClearWhichIds.Count() );
|
|
pItem = aIter.NextItem();
|
|
}
|
|
}
|
|
}
|
|
// <--
|
|
|
|
const SfxPoolItem* pItem;
|
|
// USHORT __READONLY_DATA aSavIds[ 3 ] = { RES_PAGEDESC, RES_BREAK, //#outline level,removed by zhaojianwei
|
|
// RES_PARATR_NUMRULE };
|
|
//for( USHORT n = 0; n < 3; ++n )
|
|
USHORT __READONLY_DATA aSavIds[ 4 ] = { RES_PAGEDESC, RES_BREAK, //->add by zhaojianwei
|
|
RES_PARATR_NUMRULE,
|
|
RES_PARATR_OUTLINELEVEL };
|
|
for( USHORT n = 0; n < 4; ++n ) //<-end,zhaojianwei
|
|
{
|
|
if( SFX_ITEM_SET == pSet->GetItemState( aSavIds[ n ], FALSE, &pItem ))
|
|
{
|
|
bool bSave = false;
|
|
switch( aSavIds[ n ] )
|
|
{
|
|
case RES_PAGEDESC:
|
|
bSave = 0 != ((SwFmtPageDesc*)pItem)->GetPageDesc();
|
|
break;
|
|
case RES_BREAK:
|
|
bSave = SVX_BREAK_NONE != ((SvxFmtBreakItem*)pItem)->GetBreak();
|
|
break;
|
|
case RES_PARATR_NUMRULE:
|
|
{
|
|
bSave = 0 != ((SwNumRuleItem*)pItem)->GetValue().Len();
|
|
}
|
|
break;
|
|
case RES_PARATR_OUTLINELEVEL: //#outline level,add by zhaojianwei
|
|
{
|
|
bSave = pPara && pPara->bKeepOutlineLevelAttr;
|
|
}
|
|
break; //<-end,zhaojianwei
|
|
}
|
|
if( bSave )
|
|
{
|
|
aSet.Put( *pItem );
|
|
// --> OD 2008-04-15 #refactorlists#
|
|
// aClearWhichIds.push_back( aSavIds[n] );
|
|
aClearWhichIds.Insert( aSavIds[n], aClearWhichIds.Count() );
|
|
}
|
|
}
|
|
}
|
|
|
|
// --> OD 2008-04-14 #refactorlists#
|
|
// do not clear items directly from item set and only clear to be kept
|
|
// attributes, if no deletion item set is found.
|
|
// pNode->ClearItemsFromAttrSet( aClearWhichIds );
|
|
const bool bKeepAttributes =
|
|
!pPara || !pPara->pDelSet || pPara->pDelSet->Count() == 0;
|
|
if ( bKeepAttributes )
|
|
{
|
|
pNode->ResetAttr( aClearWhichIds );
|
|
}
|
|
// <--
|
|
|
|
if( !bLocked )
|
|
pNode->UnlockModify();
|
|
|
|
if( pPara )
|
|
{
|
|
SwRegHistory aRegH( pNode, *pNode, pPara->pHistory );
|
|
|
|
if( pPara->pDelSet && pPara->pDelSet->Count() )
|
|
{
|
|
// --> OD 2008-04-15 #refactorlists#
|
|
ASSERT( !bKeepAttributes,
|
|
"<lcl_RstAttr(..)> - certain attributes are kept, but not needed. -> please inform OD" );
|
|
// <--
|
|
SfxItemIter aIter( *pPara->pDelSet );
|
|
pItem = aIter.FirstItem();
|
|
while( TRUE )
|
|
{
|
|
// --> OD 2008-04-14 #refactorlists#
|
|
//
|
|
if ( ( pItem->Which() != RES_PAGEDESC &&
|
|
pItem->Which() != RES_BREAK &&
|
|
pItem->Which() != RES_PARATR_NUMRULE ) ||
|
|
( aSet.GetItemState( pItem->Which(), FALSE ) != SFX_ITEM_SET ) )
|
|
{
|
|
pNode->ResetAttr( pItem->Which() );
|
|
}
|
|
// <--
|
|
if( aIter.IsAtEnd() )
|
|
break;
|
|
pItem = aIter.NextItem();
|
|
}
|
|
}
|
|
else if( pPara->bResetAll )
|
|
pNode->ResetAllAttr();
|
|
else
|
|
pNode->ResetAttr( RES_PARATR_BEGIN, POOLATTR_END - 1 );
|
|
}
|
|
else
|
|
pNode->ResetAllAttr();
|
|
|
|
// --> OD 2008-04-15 #refactorlists#
|
|
// only restore saved attributes, if needed
|
|
if ( bKeepAttributes && aSet.Count() )
|
|
// <--
|
|
{
|
|
pNode->LockModify();
|
|
|
|
pNode->SetAttr( aSet );
|
|
|
|
if( !bLocked )
|
|
pNode->UnlockModify();
|
|
}
|
|
}
|
|
return TRUE;
|
|
}
|
|
|
|
void SwDoc::RstTxtAttrs(const SwPaM &rRg, BOOL bInclRefToxMark )
|
|
{
|
|
SwHistory* pHst = 0;
|
|
SwDataChanged aTmp( rRg, 0 );
|
|
if( DoesUndo() )
|
|
{
|
|
ClearRedo();
|
|
SwUndoResetAttr* pUndo = new SwUndoResetAttr( rRg, RES_CHRFMT );
|
|
pHst = &pUndo->GetHistory();
|
|
AppendUndo( pUndo );
|
|
}
|
|
const SwPosition *pStt = rRg.Start(), *pEnd = rRg.End();
|
|
ParaRstFmt aPara( pStt, pEnd, pHst );
|
|
aPara.bInclRefToxMark = ( bInclRefToxMark == TRUE );
|
|
GetNodes().ForEach( pStt->nNode.GetIndex(), pEnd->nNode.GetIndex()+1,
|
|
lcl_RstTxtAttr, &aPara );
|
|
SetModified();
|
|
}
|
|
|
|
void SwDoc::ResetAttrs( const SwPaM &rRg,
|
|
BOOL bTxtAttr,
|
|
const SvUShortsSort* pAttrs,
|
|
// --> OD 2008-11-28 #b96644#
|
|
const bool bSendDataChangedEvents )
|
|
// <--
|
|
{
|
|
SwPaM* pPam = (SwPaM*)&rRg;
|
|
if( !bTxtAttr && pAttrs && pAttrs->Count() &&
|
|
RES_TXTATR_END > (*pAttrs)[ 0 ] )
|
|
bTxtAttr = TRUE;
|
|
|
|
if( !rRg.HasMark() )
|
|
{
|
|
SwTxtNode* pTxtNd = rRg.GetPoint()->nNode.GetNode().GetTxtNode();
|
|
if( !pTxtNd )
|
|
return ;
|
|
|
|
pPam = new SwPaM( *rRg.GetPoint() );
|
|
|
|
SwIndex& rSt = pPam->GetPoint()->nContent;
|
|
USHORT nMkPos, nPtPos = rSt.GetIndex();
|
|
|
|
// JP 22.08.96: Sonderfall: steht der Crsr in einem URL-Attribut
|
|
// dann wird dessen Bereich genommen
|
|
const SwTxtAttr* pURLAttr;
|
|
if( pTxtNd->HasHints() &&
|
|
0 != ( pURLAttr = pTxtNd->GetTxtAttr( rSt, RES_TXTATR_INETFMT ))
|
|
&& pURLAttr->GetINetFmt().GetValue().Len() )
|
|
{
|
|
nMkPos = *pURLAttr->GetStart();
|
|
nPtPos = *pURLAttr->GetEnd();
|
|
}
|
|
else
|
|
{
|
|
Boundary aBndry;
|
|
if( pBreakIt->xBreak.is() )
|
|
aBndry = pBreakIt->xBreak->getWordBoundary(
|
|
pTxtNd->GetTxt(), nPtPos,
|
|
pBreakIt->GetLocale( pTxtNd->GetLang( nPtPos ) ),
|
|
WordType::ANY_WORD /*ANYWORD_IGNOREWHITESPACES*/,
|
|
TRUE );
|
|
|
|
if( aBndry.startPos < nPtPos && nPtPos < aBndry.endPos )
|
|
{
|
|
nMkPos = (xub_StrLen)aBndry.startPos;
|
|
nPtPos = (xub_StrLen)aBndry.endPos;
|
|
}
|
|
else
|
|
{
|
|
nPtPos = nMkPos = rSt.GetIndex();
|
|
if( bTxtAttr )
|
|
pTxtNd->DontExpandFmt( rSt, TRUE );
|
|
}
|
|
}
|
|
|
|
rSt = nMkPos;
|
|
pPam->SetMark();
|
|
pPam->GetPoint()->nContent = nPtPos;
|
|
}
|
|
|
|
// --> OD 2008-11-28 #i96644#
|
|
// SwDataChanged aTmp( *pPam, 0 );
|
|
std::auto_ptr< SwDataChanged > pDataChanged;
|
|
if ( bSendDataChangedEvents )
|
|
{
|
|
pDataChanged.reset( new SwDataChanged( *pPam, 0 ) );
|
|
}
|
|
// <--
|
|
SwHistory* pHst = 0;
|
|
if( DoesUndo() )
|
|
{
|
|
ClearRedo();
|
|
SwUndoResetAttr* pUndo = new SwUndoResetAttr( rRg,
|
|
static_cast<USHORT>(bTxtAttr ? RES_CONDTXTFMTCOLL : RES_TXTFMTCOLL ));
|
|
if( pAttrs && pAttrs->Count() )
|
|
{
|
|
pUndo->SetAttrs( *pAttrs );
|
|
}
|
|
pHst = &pUndo->GetHistory();
|
|
AppendUndo( pUndo );
|
|
}
|
|
|
|
const SwPosition *pStt = pPam->Start(), *pEnd = pPam->End();
|
|
ParaRstFmt aPara( pStt, pEnd, pHst );
|
|
|
|
USHORT __FAR_DATA aResetableSetRange[] = {
|
|
RES_FRMATR_BEGIN, RES_FRMATR_END-1,
|
|
RES_CHRATR_BEGIN, RES_CHRATR_END-1,
|
|
RES_PARATR_BEGIN, RES_PARATR_END-1,
|
|
// --> OD 2008-02-25 #refactorlists#
|
|
RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END-1,
|
|
// <--
|
|
RES_TXTATR_CHARFMT, RES_TXTATR_CHARFMT,
|
|
RES_TXTATR_INETFMT, RES_TXTATR_INETFMT,
|
|
RES_TXTATR_CJK_RUBY, RES_TXTATR_UNKNOWN_CONTAINER,
|
|
RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
|
|
0
|
|
};
|
|
|
|
SfxItemSet aDelSet( GetAttrPool(), aResetableSetRange );
|
|
if( pAttrs && pAttrs->Count() )
|
|
{
|
|
for( USHORT n = pAttrs->Count(); n; )
|
|
if( POOLATTR_END > (*pAttrs)[ --n ] )
|
|
aDelSet.Put( *GetDfltAttr( (*pAttrs)[ n ] ));
|
|
|
|
if( aDelSet.Count() )
|
|
aPara.pDelSet = &aDelSet;
|
|
}
|
|
|
|
BOOL bAdd = TRUE;
|
|
SwNodeIndex aTmpStt( pStt->nNode );
|
|
SwNodeIndex aTmpEnd( pEnd->nNode );
|
|
if( pStt->nContent.GetIndex() ) // nur ein Teil
|
|
{
|
|
// dann spaeter aufsetzen und alle CharFmtAttr -> TxtFmtAttr
|
|
SwTxtNode* pTNd = aTmpStt.GetNode().GetTxtNode();
|
|
if( pTNd && pTNd->HasSwAttrSet() && pTNd->GetpSwAttrSet()->Count() )
|
|
{
|
|
SfxItemIter aIter( *pTNd->GetpSwAttrSet() );
|
|
const SfxPoolItem* pItem = aIter.GetCurItem();
|
|
SfxItemSet aCharSet( GetAttrPool(), RES_CHRATR_BEGIN, RES_CHRATR_END );
|
|
|
|
while( TRUE )
|
|
{
|
|
if( IsInRange( aCharFmtSetRange, pItem->Which() ))
|
|
{
|
|
pTNd->GetOrCreateSwpHints();
|
|
|
|
aCharSet.Put( *pItem );
|
|
|
|
if( pHst )
|
|
{
|
|
SwRegHistory aRegH( pTNd, *pTNd, pHst );
|
|
pTNd->ResetAttr( pItem->Which() );
|
|
}
|
|
else
|
|
pTNd->ResetAttr( pItem->Which() );
|
|
}
|
|
if( aIter.IsAtEnd() )
|
|
break;
|
|
pItem = aIter.NextItem();
|
|
}
|
|
|
|
if ( aCharSet.Count() )
|
|
{
|
|
if ( pHst )
|
|
{
|
|
SwRegHistory( pTNd, aCharSet, 0, pTNd->GetTxt().Len(), nsSetAttrMode::SETATTR_NOFORMATATTR, pHst );
|
|
}
|
|
else
|
|
{
|
|
SwTxtAttr* pNew = pTNd->MakeTxtAttr( aCharSet, 0, pTNd->GetTxt().Len() );
|
|
pTNd->Insert( pNew );
|
|
}
|
|
}
|
|
}
|
|
|
|
aTmpStt++;
|
|
}
|
|
if( pEnd->nContent.GetIndex() == pEnd->nNode.GetNode().GetCntntNode()->Len() )
|
|
// dann spaeter aufsetzen und alle CharFmtAttr -> TxtFmtAttr
|
|
aTmpEnd++, bAdd = FALSE;
|
|
else if( pStt->nNode != pEnd->nNode || !pStt->nContent.GetIndex() )
|
|
{
|
|
SwTxtNode* pTNd = aTmpEnd.GetNode().GetTxtNode();
|
|
if( pTNd && pTNd->HasSwAttrSet() && pTNd->GetpSwAttrSet()->Count() )
|
|
{
|
|
SfxItemIter aIter( *pTNd->GetpSwAttrSet() );
|
|
const SfxPoolItem* pItem = aIter.GetCurItem();
|
|
while( TRUE )
|
|
{
|
|
if( IsInRange( aCharFmtSetRange, pItem->Which() ))
|
|
{
|
|
SwTxtAttr* pTAttr = pTNd->MakeTxtAttr( *pItem, 0,
|
|
pTNd->GetTxt().Len() );
|
|
SwpHints & rHints = pTNd->GetOrCreateSwpHints();
|
|
rHints.SwpHintsArray::Insert( pTAttr );
|
|
if( pHst )
|
|
{
|
|
SwRegHistory aRegH( pTNd, *pTNd, pHst );
|
|
pTNd->ResetAttr( pItem->Which() );
|
|
pHst->Add( pTAttr, aTmpEnd.GetIndex(), true );
|
|
}
|
|
else
|
|
pTNd->ResetAttr( pItem->Which() );
|
|
}
|
|
if( aIter.IsAtEnd() )
|
|
break;
|
|
pItem = aIter.NextItem();
|
|
}
|
|
}
|
|
}
|
|
|
|
if( aTmpStt < aTmpEnd )
|
|
GetNodes().ForEach( pStt->nNode, aTmpEnd, lcl_RstAttr, &aPara );
|
|
else if( !rRg.HasMark() )
|
|
{
|
|
aPara.bResetAll = false ;
|
|
::lcl_RstAttr( &pStt->nNode.GetNode(), &aPara );
|
|
aPara.bResetAll = true ;
|
|
}
|
|
|
|
if( bTxtAttr )
|
|
{
|
|
if( bAdd )
|
|
aTmpEnd++;
|
|
GetNodes().ForEach( pStt->nNode, aTmpEnd, lcl_RstTxtAttr, &aPara );
|
|
}
|
|
|
|
if( pPam != &rRg )
|
|
delete pPam;
|
|
|
|
SetModified();
|
|
}
|
|
|
|
#define DELETECHARSETS if ( bDelete ) { delete pCharSet; delete pOtherSet; }
|
|
|
|
// Einfuegen der Hints nach Inhaltsformen;
|
|
// wird in SwDoc::Insert(..., SwFmtHint &rHt) benutzt
|
|
|
|
BOOL InsAttr( SwDoc *pDoc, const SwPaM &rRg, const SfxItemSet& rChgSet,
|
|
USHORT nFlags, SwUndoAttr* pUndo )
|
|
{
|
|
// teil die Sets auf (fuer Selektion in Nodes)
|
|
const SfxItemSet* pCharSet = 0;
|
|
const SfxItemSet* pOtherSet = 0;
|
|
bool bDelete = false;
|
|
bool bCharAttr = false;
|
|
bool bOtherAttr = false;
|
|
|
|
// Check, if we can work with rChgSet or if we have to create additional SfxItemSets
|
|
if ( 1 == rChgSet.Count() )
|
|
{
|
|
SfxItemIter aIter( rChgSet );
|
|
const SfxPoolItem* pItem = aIter.FirstItem();
|
|
const USHORT nWhich = pItem->Which();
|
|
|
|
if ( isCHRATR(nWhich) ||
|
|
(RES_TXTATR_CHARFMT == nWhich) ||
|
|
(RES_TXTATR_INETFMT == nWhich) ||
|
|
(RES_TXTATR_AUTOFMT == nWhich) ||
|
|
isUNKNOWNATR(nWhich) )
|
|
{
|
|
pCharSet = &rChgSet;
|
|
bCharAttr = true;
|
|
}
|
|
|
|
if ( isPARATR(nWhich)
|
|
// --> OD 2008-02-25 #refactorlists#
|
|
|| isPARATR_LIST(nWhich)
|
|
// <--
|
|
|| isFRMATR(nWhich)
|
|
|| isGRFATR(nWhich) )
|
|
{
|
|
pOtherSet = &rChgSet;
|
|
bOtherAttr = true;
|
|
}
|
|
}
|
|
|
|
// Build new itemset if either
|
|
// - rChgSet.Count() > 1 or
|
|
// - The attribute in rChgSet does not belong to one of the above categories
|
|
if ( !bCharAttr && !bOtherAttr )
|
|
{
|
|
SfxItemSet* pTmpCharItemSet = new SfxItemSet( pDoc->GetAttrPool(),
|
|
RES_CHRATR_BEGIN, RES_CHRATR_END-1,
|
|
RES_TXTATR_AUTOFMT, RES_TXTATR_AUTOFMT,
|
|
RES_TXTATR_INETFMT, RES_TXTATR_INETFMT,
|
|
RES_TXTATR_CHARFMT, RES_TXTATR_CHARFMT,
|
|
RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
|
|
0 );
|
|
|
|
SfxItemSet* pTmpOtherItemSet = new SfxItemSet( pDoc->GetAttrPool(),
|
|
RES_PARATR_BEGIN, RES_PARATR_END-1,
|
|
// --> OD 2008-02-25 #refactorlists#
|
|
RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END-1,
|
|
// <--
|
|
RES_FRMATR_BEGIN, RES_FRMATR_END-1,
|
|
RES_GRFATR_BEGIN, RES_GRFATR_END-1,
|
|
0 );
|
|
|
|
pTmpCharItemSet->Put( rChgSet );
|
|
pTmpOtherItemSet->Put( rChgSet );
|
|
|
|
pCharSet = pTmpCharItemSet;
|
|
pOtherSet = pTmpOtherItemSet;
|
|
|
|
bDelete = true;
|
|
}
|
|
|
|
SwHistory* pHistory = pUndo ? &pUndo->GetHistory() : 0;
|
|
BOOL bRet = FALSE;
|
|
const SwPosition *pStt = rRg.Start(), *pEnd = rRg.End();
|
|
SwCntntNode* pNode = pStt->nNode.GetNode().GetCntntNode();
|
|
|
|
if( pNode && pNode->IsTxtNode() )
|
|
{
|
|
// -> #i27615#
|
|
if (rRg.IsInFrontOfLabel())
|
|
{
|
|
SwTxtNode * pTxtNd = pNode->GetTxtNode();
|
|
SwNumRule * pNumRule = pTxtNd->GetNumRule();
|
|
|
|
// --> OD 2005-10-24 #126346# - make code robust:
|
|
if ( !pNumRule )
|
|
{
|
|
ASSERT( false,
|
|
"<InsAttr(..)> - PaM in front of label, but text node has no numbering rule set. This is a serious defect, please inform OD." );
|
|
DELETECHARSETS
|
|
return FALSE;
|
|
}
|
|
// <--
|
|
|
|
SwNumFmt aNumFmt = pNumRule->Get(static_cast<USHORT>(pTxtNd->GetActualListLevel()));
|
|
SwCharFmt * pCharFmt =
|
|
pDoc->FindCharFmtByName(aNumFmt.GetCharFmtName());
|
|
|
|
if (pCharFmt)
|
|
{
|
|
if (pHistory)
|
|
pHistory->Add(pCharFmt->GetAttrSet(), *pCharFmt);
|
|
|
|
if ( pCharSet )
|
|
pCharFmt->SetFmtAttr(*pCharSet);
|
|
}
|
|
|
|
DELETECHARSETS
|
|
return TRUE;
|
|
}
|
|
// <- #i27615#
|
|
|
|
const SwIndex& rSt = pStt->nContent;
|
|
|
|
// Attribute ohne Ende haben keinen Bereich
|
|
if ( !bCharAttr && !bOtherAttr )
|
|
{
|
|
SfxItemSet aTxtSet( pDoc->GetAttrPool(),
|
|
RES_TXTATR_NOEND_BEGIN, RES_TXTATR_NOEND_END-1 );
|
|
aTxtSet.Put( rChgSet );
|
|
if( aTxtSet.Count() )
|
|
{
|
|
SwRegHistory( (SwTxtNode*)pNode, aTxtSet, rSt.GetIndex(),
|
|
rSt.GetIndex(), nFlags, pHistory );
|
|
bRet = TRUE;
|
|
|
|
if( pDoc->IsRedlineOn() || (!pDoc->IsIgnoreRedline() &&
|
|
pDoc->GetRedlineTbl().Count() ))
|
|
{
|
|
SwPaM aPam( pStt->nNode, pStt->nContent.GetIndex()-1,
|
|
pStt->nNode, pStt->nContent.GetIndex() );
|
|
|
|
if( pUndo )
|
|
pUndo->SaveRedlineData( aPam, TRUE );
|
|
|
|
if( pDoc->IsRedlineOn() )
|
|
pDoc->AppendRedline( new SwRedline( nsRedlineType_t::REDLINE_INSERT, aPam ), true);
|
|
else
|
|
pDoc->SplitRedline( aPam );
|
|
}
|
|
}
|
|
}
|
|
|
|
// TextAttribute mit Ende expandieren nie ihren Bereich
|
|
if ( !bCharAttr && !bOtherAttr )
|
|
{
|
|
// CharFmt wird gesondert behandelt !!!
|
|
// JP 22.08.96: URL-Attribute auch!!
|
|
// TEST_TEMP ToDo: AutoFmt!
|
|
SfxItemSet aTxtSet( pDoc->GetAttrPool(),
|
|
RES_TXTATR_REFMARK, RES_TXTATR_TOXMARK,
|
|
RES_TXTATR_DUMMY5, RES_TXTATR_WITHEND_END-1,
|
|
0 );
|
|
|
|
aTxtSet.Put( rChgSet );
|
|
if( aTxtSet.Count() )
|
|
{
|
|
USHORT nInsCnt = rSt.GetIndex();
|
|
USHORT nEnd = pStt->nNode == pEnd->nNode
|
|
? pEnd->nContent.GetIndex()
|
|
: pNode->Len();
|
|
SwRegHistory( (SwTxtNode*)pNode, aTxtSet, nInsCnt,
|
|
nEnd, nFlags, pHistory );
|
|
bRet = TRUE;
|
|
|
|
if( pDoc->IsRedlineOn() || (!pDoc->IsIgnoreRedline() &&
|
|
pDoc->GetRedlineTbl().Count() ) )
|
|
{
|
|
// wurde Text-Inhalt eingefuegt? (RefMark/TOXMarks ohne Ende)
|
|
BOOL bTxtIns = nInsCnt != rSt.GetIndex();
|
|
// wurde Inhalt eingefuegt oder ueber die Selektion gesetzt?
|
|
SwPaM aPam( pStt->nNode, bTxtIns ? nInsCnt + 1 : nEnd,
|
|
pStt->nNode, nInsCnt );
|
|
if( pUndo )
|
|
pUndo->SaveRedlineData( aPam, bTxtIns );
|
|
|
|
if( pDoc->IsRedlineOn() )
|
|
pDoc->AppendRedline( new SwRedline( bTxtIns
|
|
? nsRedlineType_t::REDLINE_INSERT : nsRedlineType_t::REDLINE_FORMAT, aPam ), true);
|
|
else if( bTxtIns )
|
|
pDoc->SplitRedline( aPam );
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// bei PageDesc's, die am Node gesetzt werden, muss immer das
|
|
// Auto-Flag gesetzt werden!!
|
|
const SvxLRSpaceItem* pLRSpace = 0;
|
|
if( pOtherSet && pOtherSet->Count() )
|
|
{
|
|
SwTableNode* pTblNd;
|
|
const SwFmtPageDesc* pDesc;
|
|
if( SFX_ITEM_SET == pOtherSet->GetItemState( RES_PAGEDESC,
|
|
FALSE, (const SfxPoolItem**)&pDesc ))
|
|
{
|
|
if( pNode )
|
|
{
|
|
// Auto-Flag setzen, nur in Vorlagen ist ohne Auto !
|
|
SwFmtPageDesc aNew( *pDesc );
|
|
// Bug 38479: AutoFlag wird jetzt in der WrtShell gesetzt
|
|
// aNew.SetAuto();
|
|
|
|
// Tabellen kennen jetzt auch Umbrueche
|
|
if( 0 == (nFlags & nsSetAttrMode::SETATTR_APICALL) &&
|
|
0 != ( pTblNd = pNode->FindTableNode() ) )
|
|
{
|
|
SwTableNode* pCurTblNd = pTblNd;
|
|
while ( 0 != ( pCurTblNd = pCurTblNd->StartOfSectionNode()->FindTableNode() ) )
|
|
pTblNd = pCurTblNd;
|
|
|
|
// dann am Tabellen Format setzen
|
|
SwFrmFmt* pFmt = pTblNd->GetTable().GetFrmFmt();
|
|
SwRegHistory aRegH( pFmt, *pTblNd, pHistory );
|
|
pFmt->SetFmtAttr( aNew );
|
|
}
|
|
else
|
|
{
|
|
SwRegHistory aRegH( pNode, *pNode, pHistory );
|
|
pNode->SetAttr( aNew );
|
|
}
|
|
}
|
|
|
|
// bOtherAttr = true means that pOtherSet == rChgSet. In this case
|
|
// we know, that there is only one attribute in pOtherSet. We cannot
|
|
// perform the following operations, instead we return:
|
|
if ( bOtherAttr )
|
|
return TRUE;
|
|
|
|
const_cast<SfxItemSet*>(pOtherSet)->ClearItem( RES_PAGEDESC );
|
|
if( !pOtherSet->Count() )
|
|
{
|
|
DELETECHARSETS
|
|
return TRUE;
|
|
}
|
|
}
|
|
|
|
// Tabellen kennen jetzt auch Umbrueche
|
|
const SvxFmtBreakItem* pBreak;
|
|
if( pNode && 0 == (nFlags & nsSetAttrMode::SETATTR_APICALL) &&
|
|
0 != (pTblNd = pNode->FindTableNode() ) &&
|
|
SFX_ITEM_SET == pOtherSet->GetItemState( RES_BREAK,
|
|
FALSE, (const SfxPoolItem**)&pBreak ) )
|
|
{
|
|
SwTableNode* pCurTblNd = pTblNd;
|
|
while ( 0 != ( pCurTblNd = pCurTblNd->StartOfSectionNode()->FindTableNode() ) )
|
|
pTblNd = pCurTblNd;
|
|
|
|
// dann am Tabellen Format setzen
|
|
SwFrmFmt* pFmt = pTblNd->GetTable().GetFrmFmt();
|
|
SwRegHistory aRegH( pFmt, *pTblNd, pHistory );
|
|
pFmt->SetFmtAttr( *pBreak );
|
|
|
|
// bOtherAttr = true means that pOtherSet == rChgSet. In this case
|
|
// we know, that there is only one attribute in pOtherSet. We cannot
|
|
// perform the following operations, instead we return:
|
|
if ( bOtherAttr )
|
|
return TRUE;
|
|
|
|
const_cast<SfxItemSet*>(pOtherSet)->ClearItem( RES_BREAK );
|
|
if( !pOtherSet->Count() )
|
|
{
|
|
DELETECHARSETS
|
|
return TRUE;
|
|
}
|
|
}
|
|
|
|
// fuer Sonderbehandlung von LR-Space innerhalb einer Numerierung !!!
|
|
pOtherSet->GetItemState( RES_LR_SPACE, FALSE,
|
|
(const SfxPoolItem**)&pLRSpace );
|
|
|
|
{
|
|
// wenns eine PoolNumRule ist, diese ggfs. anlegen
|
|
const SwNumRuleItem* pRule;
|
|
USHORT nPoolId;
|
|
if( SFX_ITEM_SET == pOtherSet->GetItemState( RES_PARATR_NUMRULE,
|
|
FALSE, (const SfxPoolItem**)&pRule ) &&
|
|
!pDoc->FindNumRulePtr( pRule->GetValue() ) &&
|
|
USHRT_MAX != (nPoolId = SwStyleNameMapper::GetPoolIdFromUIName ( pRule->GetValue(),
|
|
nsSwGetPoolIdFromName::GET_POOLID_NUMRULE )) )
|
|
pDoc->GetNumRuleFromPool( nPoolId );
|
|
}
|
|
|
|
}
|
|
|
|
if( !rRg.HasMark() ) // kein Bereich
|
|
{
|
|
if( !pNode )
|
|
{
|
|
DELETECHARSETS
|
|
return bRet;
|
|
}
|
|
|
|
if( pNode->IsTxtNode() && pCharSet && pCharSet->Count() )
|
|
{
|
|
SwTxtNode* pTxtNd = (SwTxtNode*)pNode;
|
|
const SwIndex& rSt = pStt->nContent;
|
|
USHORT nMkPos, nPtPos = rSt.GetIndex();
|
|
const String& rStr = pTxtNd->GetTxt();
|
|
|
|
// JP 22.08.96: Sonderfall: steht der Crsr in einem URL-Attribut
|
|
// dann wird dessen Bereich genommen
|
|
const SwTxtAttr* pURLAttr;
|
|
if( pTxtNd->HasHints() &&
|
|
0 != ( pURLAttr = pTxtNd->GetTxtAttr( rSt, RES_TXTATR_INETFMT ))
|
|
&& pURLAttr->GetINetFmt().GetValue().Len() )
|
|
{
|
|
nMkPos = *pURLAttr->GetStart();
|
|
nPtPos = *pURLAttr->GetEnd();
|
|
}
|
|
else
|
|
{
|
|
Boundary aBndry;
|
|
if( pBreakIt->xBreak.is() )
|
|
aBndry = pBreakIt->xBreak->getWordBoundary(
|
|
pTxtNd->GetTxt(), nPtPos,
|
|
pBreakIt->GetLocale( pTxtNd->GetLang( nPtPos ) ),
|
|
WordType::ANY_WORD /*ANYWORD_IGNOREWHITESPACES*/,
|
|
TRUE );
|
|
|
|
if( aBndry.startPos < nPtPos && nPtPos < aBndry.endPos )
|
|
{
|
|
nMkPos = (xub_StrLen)aBndry.startPos;
|
|
nPtPos = (xub_StrLen)aBndry.endPos;
|
|
}
|
|
else
|
|
nPtPos = nMkPos = rSt.GetIndex();
|
|
}
|
|
|
|
// erstmal die zu ueberschreibenden Attribute aus dem
|
|
// SwpHintsArray entfernen, wenn die Selektion den gesamten
|
|
// Absatz umspannt. (Diese Attribute werden als FormatAttr.
|
|
// eingefuegt und verdraengen nie die TextAttr.!)
|
|
if( !(nFlags & nsSetAttrMode::SETATTR_DONTREPLACE ) &&
|
|
pTxtNd->HasHints() && !nMkPos && nPtPos == rStr.Len() )
|
|
{
|
|
SwIndex aSt( pTxtNd );
|
|
if( pHistory )
|
|
{
|
|
// fuers Undo alle Attribute sichern
|
|
SwRegHistory aRHst( *pTxtNd, pHistory );
|
|
pTxtNd->GetpSwpHints()->Register( &aRHst );
|
|
pTxtNd->RstAttr( aSt, nPtPos, 0, pCharSet );
|
|
if( pTxtNd->GetpSwpHints() )
|
|
pTxtNd->GetpSwpHints()->DeRegister();
|
|
}
|
|
else
|
|
pTxtNd->RstAttr( aSt, nPtPos, 0, pCharSet );
|
|
}
|
|
|
|
// eintragen des Attributes im Node erledigt die SwRegHistory !!
|
|
SwRegHistory( (SwTxtNode*)pNode, *pCharSet,
|
|
nMkPos, nPtPos, nFlags, pHistory );
|
|
bRet = TRUE;
|
|
|
|
if( pDoc->IsRedlineOn() )
|
|
{
|
|
SwPaM aPam( *pNode, nMkPos, *pNode, nPtPos );
|
|
|
|
if( pUndo )
|
|
pUndo->SaveRedlineData( aPam, FALSE );
|
|
pDoc->AppendRedline( new SwRedline( nsRedlineType_t::REDLINE_FORMAT, aPam ), true);
|
|
}
|
|
}
|
|
if( pOtherSet && pOtherSet->Count() )
|
|
{
|
|
SwRegHistory aRegH( pNode, *pNode, pHistory );
|
|
pNode->SetAttr( *pOtherSet );
|
|
bRet = TRUE;
|
|
}
|
|
|
|
DELETECHARSETS
|
|
return bRet;
|
|
}
|
|
|
|
if( pDoc->IsRedlineOn() && pCharSet && pCharSet->Count() )
|
|
{
|
|
if( pUndo )
|
|
pUndo->SaveRedlineData( rRg, FALSE );
|
|
pDoc->AppendRedline( new SwRedline( nsRedlineType_t::REDLINE_FORMAT, rRg ), true);
|
|
}
|
|
|
|
/* jetzt wenn Bereich */
|
|
ULONG nNodes = 0;
|
|
|
|
SwNodeIndex aSt( pDoc->GetNodes() );
|
|
SwNodeIndex aEnd( pDoc->GetNodes() );
|
|
SwIndex aCntEnd( pEnd->nContent );
|
|
|
|
if( pNode )
|
|
{
|
|
USHORT nLen = pNode->Len();
|
|
if( pStt->nNode != pEnd->nNode )
|
|
aCntEnd.Assign( pNode, nLen );
|
|
|
|
if( pStt->nContent.GetIndex() != 0 || aCntEnd.GetIndex() != nLen )
|
|
{
|
|
// eintragen des Attributes im Node erledigt die SwRegHistory !!
|
|
if( pNode->IsTxtNode() && pCharSet && pCharSet->Count() )
|
|
{
|
|
SwRegHistory( (SwTxtNode*)pNode, *pCharSet,
|
|
pStt->nContent.GetIndex(), aCntEnd.GetIndex(),
|
|
nFlags, pHistory );
|
|
}
|
|
|
|
if( pOtherSet && pOtherSet->Count() )
|
|
{
|
|
SwRegHistory aRegH( pNode, *pNode, pHistory );
|
|
pNode->SetAttr( *pOtherSet );
|
|
}
|
|
|
|
// lediglich Selektion in einem Node.
|
|
if( pStt->nNode == pEnd->nNode )
|
|
{
|
|
DELETECHARSETS
|
|
return TRUE;
|
|
}
|
|
++nNodes;
|
|
aSt.Assign( pStt->nNode.GetNode(), +1 );
|
|
}
|
|
else
|
|
aSt = pStt->nNode;
|
|
aCntEnd = pEnd->nContent; // aEnd wurde veraendert !!
|
|
}
|
|
else
|
|
aSt.Assign( pStt->nNode.GetNode(), +1 );
|
|
|
|
// aSt zeigt jetzt auf den ersten vollen Node
|
|
|
|
/*
|
|
* die Selektion umfasst mehr als einen Node
|
|
*/
|
|
if( pStt->nNode < pEnd->nNode )
|
|
{
|
|
pNode = pEnd->nNode.GetNode().GetCntntNode();
|
|
if(pNode)
|
|
{
|
|
USHORT nLen = pNode->Len();
|
|
if( aCntEnd.GetIndex() != nLen )
|
|
{
|
|
// eintragen des Attributes im Node erledigt die SwRegHistory !!
|
|
if( pNode->IsTxtNode() && pCharSet && pCharSet->Count() )
|
|
{
|
|
SwRegHistory( (SwTxtNode*)pNode, *pCharSet,
|
|
0, aCntEnd.GetIndex(), nFlags, pHistory );
|
|
}
|
|
|
|
if( pOtherSet && pOtherSet->Count() )
|
|
{
|
|
SwRegHistory aRegH( pNode, *pNode, pHistory );
|
|
pNode->SetAttr( *pOtherSet );
|
|
}
|
|
|
|
++nNodes;
|
|
aEnd = pEnd->nNode;
|
|
}
|
|
else
|
|
aEnd.Assign( pEnd->nNode.GetNode(), +1 );
|
|
}
|
|
else
|
|
aEnd = pEnd->nNode;
|
|
}
|
|
else
|
|
aEnd.Assign( pEnd->nNode.GetNode(), +1 );
|
|
|
|
// aEnd zeigt jetzt HINTER den letzten voll Node
|
|
|
|
/* Bearbeitung der vollstaendig selektierten Nodes. */
|
|
// alle Attribute aus dem Set zuruecksetzen !!
|
|
if( pCharSet && pCharSet->Count() && !( nsSetAttrMode::SETATTR_DONTREPLACE & nFlags ) )
|
|
{
|
|
|
|
ParaRstFmt aPara( pStt, pEnd, pHistory, 0, pCharSet );
|
|
pDoc->GetNodes().ForEach( aSt, aEnd, lcl_RstTxtAttr, &aPara );
|
|
}
|
|
|
|
BOOL bCreateSwpHints = pCharSet && (
|
|
SFX_ITEM_SET == pCharSet->GetItemState( RES_TXTATR_CHARFMT, FALSE ) ||
|
|
SFX_ITEM_SET == pCharSet->GetItemState( RES_TXTATR_INETFMT, FALSE ) );
|
|
|
|
for(; aSt < aEnd; aSt++ )
|
|
{
|
|
pNode = aSt.GetNode().GetCntntNode();
|
|
if( !pNode )
|
|
continue;
|
|
|
|
SwTxtNode* pTNd = pNode->GetTxtNode();
|
|
if( pHistory )
|
|
{
|
|
SwRegHistory aRegH( pNode, *pNode, pHistory );
|
|
SwpHints *pSwpHints;
|
|
|
|
if( pTNd && pCharSet && pCharSet->Count() )
|
|
{
|
|
pSwpHints = bCreateSwpHints ? &pTNd->GetOrCreateSwpHints()
|
|
: pTNd->GetpSwpHints();
|
|
if( pSwpHints )
|
|
pSwpHints->Register( &aRegH );
|
|
|
|
pTNd->SetAttr( *pCharSet, 0, pTNd->GetTxt().Len(), nFlags );
|
|
if( pSwpHints )
|
|
pSwpHints->DeRegister();
|
|
}
|
|
if( pOtherSet && pOtherSet->Count() )
|
|
pNode->SetAttr( *pOtherSet );
|
|
}
|
|
else
|
|
{
|
|
if( pTNd && pCharSet && pCharSet->Count() )
|
|
pTNd->SetAttr( *pCharSet, 0, pTNd->GetTxt().Len(), nFlags );
|
|
if( pOtherSet && pOtherSet->Count() )
|
|
pNode->SetAttr( *pOtherSet );
|
|
}
|
|
++nNodes;
|
|
}
|
|
|
|
DELETECHARSETS
|
|
return nNodes != 0;
|
|
}
|
|
|
|
|
|
bool SwDoc::Insert( const SwPaM &rRg, const SfxPoolItem &rHt, USHORT nFlags )
|
|
{
|
|
SwDataChanged aTmp( rRg, 0 );
|
|
BOOL bRet;
|
|
SwUndoAttr* pUndoAttr = 0;
|
|
if( DoesUndo() )
|
|
{
|
|
ClearRedo();
|
|
pUndoAttr = new SwUndoAttr( rRg, rHt, nFlags );
|
|
}
|
|
|
|
SfxItemSet aSet( GetAttrPool(), rHt.Which(), rHt.Which() );
|
|
aSet.Put( rHt );
|
|
bRet = InsAttr( this, rRg, aSet, nFlags, pUndoAttr );
|
|
|
|
if( DoesUndo() )
|
|
AppendUndo( pUndoAttr );
|
|
|
|
if( bRet )
|
|
SetModified();
|
|
return bRet;
|
|
}
|
|
|
|
bool SwDoc::Insert( const SwPaM &rRg, const SfxItemSet &rSet, USHORT nFlags )
|
|
{
|
|
SwDataChanged aTmp( rRg, 0 );
|
|
SwUndoAttr* pUndoAttr = 0;
|
|
if( DoesUndo() )
|
|
{
|
|
ClearRedo();
|
|
pUndoAttr = new SwUndoAttr( rRg, rSet );
|
|
}
|
|
|
|
BOOL bRet = InsAttr( this, rRg, rSet, nFlags, pUndoAttr );
|
|
|
|
if( DoesUndo() )
|
|
AppendUndo( pUndoAttr );
|
|
|
|
if( bRet )
|
|
SetModified();
|
|
return bRet;
|
|
}
|
|
|
|
|
|
// Setze das Attribut im angegebenen Format. Ist Undo aktiv, wird
|
|
// das alte in die Undo-History aufgenommen
|
|
void SwDoc::SetAttr( const SfxPoolItem& rAttr, SwFmt& rFmt )
|
|
{
|
|
SfxItemSet aSet( GetAttrPool(), rAttr.Which(), rAttr.Which() );
|
|
aSet.Put( rAttr );
|
|
SetAttr( aSet, rFmt );
|
|
}
|
|
|
|
|
|
// Setze das Attribut im angegebenen Format. Ist Undo aktiv, wird
|
|
// das alte in die Undo-History aufgenommen
|
|
void SwDoc::SetAttr( const SfxItemSet& rSet, SwFmt& rFmt )
|
|
{
|
|
if( DoesUndo() )
|
|
{
|
|
ClearRedo();
|
|
SwUndoFmtAttrHelper aTmp( rFmt );
|
|
rFmt.SetFmtAttr( rSet );
|
|
if ( aTmp.GetUndo() )
|
|
{
|
|
AppendUndo( aTmp.ReleaseUndo() );
|
|
}
|
|
}
|
|
else
|
|
{
|
|
rFmt.SetFmtAttr( rSet );
|
|
}
|
|
SetModified();
|
|
}
|
|
|
|
// --> OD 2008-02-12 #newlistlevelattrs#
|
|
void SwDoc::ResetAttrAtFormat( const USHORT nWhichId,
|
|
SwFmt& rChangedFormat )
|
|
{
|
|
SwUndo* pUndo = 0;
|
|
if ( DoesUndo() )
|
|
pUndo = new SwUndoFmtResetAttr( rChangedFormat, nWhichId );
|
|
|
|
const BOOL bAttrReset = rChangedFormat.ResetFmtAttr( nWhichId );
|
|
|
|
if ( bAttrReset )
|
|
{
|
|
if ( pUndo )
|
|
AppendUndo( pUndo );
|
|
|
|
SetModified();
|
|
}
|
|
else if ( pUndo )
|
|
delete pUndo;
|
|
}
|
|
// <--
|
|
|
|
int lcl_SetNewDefTabStops( SwTwips nOldWidth, SwTwips nNewWidth,
|
|
SvxTabStopItem& rChgTabStop )
|
|
{
|
|
// dann aender bei allen TabStop die default's auf den neuen Wert
|
|
// !!! Achtung: hier wird immer auf dem PoolAttribut gearbeitet,
|
|
// damit nicht in allen Sets die gleiche Berechnung
|
|
// auf dem gleichen TabStop (gepoolt!) vorgenommen
|
|
// wird. Als Modify wird ein FmtChg verschickt.
|
|
|
|
USHORT nOldCnt = rChgTabStop.Count();
|
|
if( !nOldCnt || nOldWidth == nNewWidth )
|
|
return FALSE;
|
|
|
|
// suche den Anfang der Defaults
|
|
SvxTabStop* pTabs = ((SvxTabStop*)rChgTabStop.GetStart())
|
|
+ (nOldCnt-1);
|
|
USHORT n;
|
|
|
|
for( n = nOldCnt; n ; --n, --pTabs )
|
|
if( SVX_TAB_ADJUST_DEFAULT != pTabs->GetAdjustment() )
|
|
break;
|
|
++n;
|
|
if( n < nOldCnt ) // die DefTabStops loeschen
|
|
rChgTabStop.Remove( n, nOldCnt - n );
|
|
return TRUE;
|
|
}
|
|
|
|
// Setze das Attribut als neues default Attribut in diesem Dokument.
|
|
// Ist Undo aktiv, wird das alte in die Undo-History aufgenommen
|
|
void SwDoc::SetDefault( const SfxPoolItem& rAttr )
|
|
{
|
|
SfxItemSet aSet( GetAttrPool(), rAttr.Which(), rAttr.Which() );
|
|
aSet.Put( rAttr );
|
|
SetDefault( aSet );
|
|
}
|
|
|
|
void SwDoc::SetDefault( const SfxItemSet& rSet )
|
|
{
|
|
if( !rSet.Count() )
|
|
return;
|
|
|
|
SwModify aCallMod( 0 );
|
|
SwAttrSet aOld( GetAttrPool(), rSet.GetRanges() ),
|
|
aNew( GetAttrPool(), rSet.GetRanges() );
|
|
SfxItemIter aIter( rSet );
|
|
USHORT nWhich;
|
|
const SfxPoolItem* pItem = aIter.GetCurItem();
|
|
SfxItemPool* pSdrPool = GetAttrPool().GetSecondaryPool();
|
|
while( TRUE )
|
|
{
|
|
BOOL bCheckSdrDflt = FALSE;
|
|
nWhich = pItem->Which();
|
|
aOld.Put( GetAttrPool().GetDefaultItem( nWhich ) );
|
|
GetAttrPool().SetPoolDefaultItem( *pItem );
|
|
aNew.Put( GetAttrPool().GetDefaultItem( nWhich ) );
|
|
|
|
if (isCHRATR(nWhich) || isTXTATR(nWhich))
|
|
{
|
|
aCallMod.Add( pDfltTxtFmtColl );
|
|
aCallMod.Add( pDfltCharFmt );
|
|
bCheckSdrDflt = 0 != pSdrPool;
|
|
}
|
|
else if ( isPARATR(nWhich) ||
|
|
// --> OD 2008-02-25 #refactorlists#
|
|
isPARATR_LIST(nWhich) )
|
|
// <--
|
|
{
|
|
aCallMod.Add( pDfltTxtFmtColl );
|
|
bCheckSdrDflt = 0 != pSdrPool;
|
|
}
|
|
else if (isGRFATR(nWhich))
|
|
{
|
|
aCallMod.Add( pDfltGrfFmtColl );
|
|
}
|
|
else if (isFRMATR(nWhich))
|
|
{
|
|
aCallMod.Add( pDfltGrfFmtColl );
|
|
aCallMod.Add( pDfltTxtFmtColl );
|
|
aCallMod.Add( pDfltFrmFmt );
|
|
}
|
|
else if (isBOXATR(nWhich))
|
|
{
|
|
aCallMod.Add( pDfltFrmFmt );
|
|
}
|
|
|
|
// copy also the defaults
|
|
if( bCheckSdrDflt )
|
|
{
|
|
USHORT nEdtWhich, nSlotId;
|
|
if( 0 != (nSlotId = GetAttrPool().GetSlotId( nWhich ) ) &&
|
|
nSlotId != nWhich &&
|
|
0 != (nEdtWhich = pSdrPool->GetWhich( nSlotId )) &&
|
|
nSlotId != nEdtWhich )
|
|
{
|
|
SfxPoolItem* pCpy = pItem->Clone();
|
|
pCpy->SetWhich( nEdtWhich );
|
|
pSdrPool->SetPoolDefaultItem( *pCpy );
|
|
delete pCpy;
|
|
}
|
|
}
|
|
|
|
if( aIter.IsAtEnd() )
|
|
break;
|
|
pItem = aIter.NextItem();
|
|
}
|
|
|
|
if( aNew.Count() && aCallMod.GetDepends() )
|
|
{
|
|
if( DoesUndo() )
|
|
{
|
|
ClearRedo();
|
|
AppendUndo( new SwUndoDefaultAttr( aOld ) );
|
|
}
|
|
|
|
const SfxPoolItem* pTmpItem;
|
|
if( ( SFX_ITEM_SET ==
|
|
aNew.GetItemState( RES_PARATR_TABSTOP, FALSE, &pTmpItem ) ) &&
|
|
((SvxTabStopItem*)pTmpItem)->Count() )
|
|
{
|
|
// TabStop-Aenderungen behandeln wir erstmal anders:
|
|
// dann aender bei allen TabStop die dafault's auf den neuen Wert
|
|
// !!! Achtung: hier wird immer auf dem PoolAttribut gearbeitet,
|
|
// damit nicht in allen Sets die gleiche Berechnung
|
|
// auf dem gleichen TabStop (gepoolt!) vorgenommen
|
|
// wird. Als Modify wird ein FmtChg verschickt.
|
|
SwTwips nNewWidth = (*(SvxTabStopItem*)pTmpItem)[ 0 ].GetTabPos(),
|
|
nOldWidth = ((SvxTabStopItem&)aOld.Get(RES_PARATR_TABSTOP))[ 0 ].GetTabPos();
|
|
|
|
int bChg = FALSE;
|
|
USHORT nMaxItems = GetAttrPool().GetItemCount( RES_PARATR_TABSTOP );
|
|
for( USHORT n = 0; n < nMaxItems; ++n )
|
|
if( 0 != (pTmpItem = GetAttrPool().GetItem( RES_PARATR_TABSTOP, n ) ))
|
|
bChg |= lcl_SetNewDefTabStops( nOldWidth, nNewWidth,
|
|
*(SvxTabStopItem*)pTmpItem );
|
|
|
|
aNew.ClearItem( RES_PARATR_TABSTOP );
|
|
aOld.ClearItem( RES_PARATR_TABSTOP );
|
|
if( bChg )
|
|
{
|
|
SwFmtChg aChgFmt( pDfltCharFmt );
|
|
// dann sage mal den Frames bescheid
|
|
aCallMod.Modify( &aChgFmt, &aChgFmt );
|
|
}
|
|
}
|
|
}
|
|
|
|
if( aNew.Count() && aCallMod.GetDepends() )
|
|
{
|
|
SwAttrSetChg aChgOld( aOld, aOld );
|
|
SwAttrSetChg aChgNew( aNew, aNew );
|
|
aCallMod.Modify( &aChgOld, &aChgNew ); // alle veraenderten werden verschickt
|
|
}
|
|
|
|
// und die default-Formate wieder beim Object austragen
|
|
SwClient* pDep;
|
|
while( 0 != ( pDep = (SwClient*)aCallMod.GetDepends()) )
|
|
aCallMod.Remove( pDep );
|
|
|
|
SetModified();
|
|
}
|
|
|
|
// Erfrage das Default Attribut in diesem Dokument.
|
|
const SfxPoolItem& SwDoc::GetDefault( USHORT nFmtHint ) const
|
|
{
|
|
return GetAttrPool().GetDefaultItem( nFmtHint );
|
|
}
|
|
|
|
/*
|
|
* Loeschen der Formate
|
|
*/
|
|
void SwDoc::DelCharFmt(USHORT nFmt, BOOL bBroadcast)
|
|
{
|
|
SwCharFmt * pDel = (*pCharFmtTbl)[nFmt];
|
|
|
|
if (bBroadcast)
|
|
BroadcastStyleOperation(pDel->GetName(), SFX_STYLE_FAMILY_CHAR,
|
|
SFX_STYLESHEET_ERASED);
|
|
|
|
if (DoesUndo())
|
|
{
|
|
SwUndo * pUndo =
|
|
new SwUndoCharFmtDelete(pDel, this);
|
|
|
|
AppendUndo(pUndo);
|
|
}
|
|
|
|
pCharFmtTbl->DeleteAndDestroy(nFmt);
|
|
|
|
SetModified();
|
|
}
|
|
|
|
void SwDoc::DelCharFmt( SwCharFmt *pFmt, BOOL bBroadcast )
|
|
{
|
|
USHORT nFmt = pCharFmtTbl->GetPos( pFmt );
|
|
ASSERT( USHRT_MAX != nFmt, "Fmt not found," );
|
|
|
|
DelCharFmt( nFmt, bBroadcast );
|
|
}
|
|
|
|
void SwDoc::DelFrmFmt( SwFrmFmt *pFmt, BOOL bBroadcast )
|
|
{
|
|
if( pFmt->ISA( SwTableBoxFmt ) || pFmt->ISA( SwTableLineFmt ))
|
|
{
|
|
ASSERT( !this, "Format steht nicht mehr im DocArray, "
|
|
"kann per delete geloescht werden" );
|
|
delete pFmt;
|
|
}
|
|
else
|
|
{
|
|
|
|
//Das Format muss in einem der beiden Arrays stehen, in welchem
|
|
//werden wir schon merken.
|
|
USHORT nPos;
|
|
if ( USHRT_MAX != ( nPos = pFrmFmtTbl->GetPos( pFmt )) )
|
|
{
|
|
if (bBroadcast)
|
|
BroadcastStyleOperation(pFmt->GetName(),
|
|
SFX_STYLE_FAMILY_FRAME,
|
|
SFX_STYLESHEET_ERASED);
|
|
|
|
if (DoesUndo())
|
|
{
|
|
SwUndo * pUndo = new SwUndoFrmFmtDelete(pFmt, this);
|
|
|
|
AppendUndo(pUndo);
|
|
}
|
|
|
|
pFrmFmtTbl->DeleteAndDestroy( nPos );
|
|
}
|
|
else
|
|
{
|
|
nPos = GetSpzFrmFmts()->GetPos( pFmt );
|
|
ASSERT( nPos != USHRT_MAX, "FrmFmt not found." );
|
|
if( USHRT_MAX != nPos )
|
|
GetSpzFrmFmts()->DeleteAndDestroy( nPos );
|
|
}
|
|
}
|
|
}
|
|
|
|
void SwDoc::DelTblFrmFmt( SwTableFmt *pFmt )
|
|
{
|
|
USHORT nPos = pTblFrmFmtTbl->GetPos( pFmt );
|
|
ASSERT( USHRT_MAX != nPos, "Fmt not found," );
|
|
pTblFrmFmtTbl->DeleteAndDestroy( nPos );
|
|
}
|
|
|
|
/*
|
|
* Erzeugen der Formate
|
|
*/
|
|
SwFlyFrmFmt *SwDoc::MakeFlyFrmFmt( const String &rFmtName,
|
|
SwFrmFmt *pDerivedFrom )
|
|
{
|
|
SwFlyFrmFmt *pFmt = new SwFlyFrmFmt( GetAttrPool(), rFmtName, pDerivedFrom );
|
|
GetSpzFrmFmts()->Insert(pFmt, GetSpzFrmFmts()->Count());
|
|
SetModified();
|
|
return pFmt;
|
|
}
|
|
|
|
SwDrawFrmFmt *SwDoc::MakeDrawFrmFmt( const String &rFmtName,
|
|
SwFrmFmt *pDerivedFrom )
|
|
{
|
|
SwDrawFrmFmt *pFmt = new SwDrawFrmFmt( GetAttrPool(), rFmtName, pDerivedFrom);
|
|
GetSpzFrmFmts()->Insert(pFmt,GetSpzFrmFmts()->Count());
|
|
SetModified();
|
|
return pFmt;
|
|
}
|
|
|
|
|
|
USHORT SwDoc::GetTblFrmFmtCount(BOOL bUsed) const
|
|
{
|
|
USHORT nCount = pTblFrmFmtTbl->Count();
|
|
if(bUsed)
|
|
{
|
|
SwAutoFmtGetDocNode aGetHt( &aNodes );
|
|
for ( USHORT i = nCount; i; )
|
|
{
|
|
if((*pTblFrmFmtTbl)[--i]->GetInfo( aGetHt ))
|
|
|
|
--nCount;
|
|
}
|
|
}
|
|
|
|
return nCount;
|
|
}
|
|
|
|
|
|
SwFrmFmt& SwDoc::GetTblFrmFmt(USHORT nFmt, BOOL bUsed ) const
|
|
{
|
|
USHORT nRemoved = 0;
|
|
if(bUsed)
|
|
{
|
|
SwAutoFmtGetDocNode aGetHt( &aNodes );
|
|
|
|
for ( USHORT i = 0; i <= nFmt; i++ )
|
|
{
|
|
while ( (*pTblFrmFmtTbl)[ i + nRemoved]->GetInfo( aGetHt ))
|
|
{
|
|
nRemoved++;
|
|
}
|
|
}
|
|
}
|
|
return *((*pTblFrmFmtTbl)[nRemoved + nFmt]);
|
|
}
|
|
|
|
SwTableFmt* SwDoc::MakeTblFrmFmt( const String &rFmtName,
|
|
SwFrmFmt *pDerivedFrom )
|
|
{
|
|
SwTableFmt* pFmt = new SwTableFmt( GetAttrPool(), rFmtName, pDerivedFrom );
|
|
pTblFrmFmtTbl->Insert( pFmt, pTblFrmFmtTbl->Count() );
|
|
SetModified();
|
|
|
|
return pFmt;
|
|
}
|
|
|
|
SwFrmFmt *SwDoc::MakeFrmFmt(const String &rFmtName,
|
|
SwFrmFmt *pDerivedFrom,
|
|
BOOL bBroadcast, BOOL bAuto)
|
|
{
|
|
|
|
SwFrmFmt *pFmt = new SwFrmFmt( GetAttrPool(), rFmtName, pDerivedFrom );
|
|
|
|
pFmt->SetAuto(bAuto);
|
|
pFrmFmtTbl->Insert( pFmt, pFrmFmtTbl->Count());
|
|
SetModified();
|
|
|
|
if (bBroadcast)
|
|
{
|
|
BroadcastStyleOperation(rFmtName, SFX_STYLE_FAMILY_PARA,
|
|
SFX_STYLESHEET_CREATED);
|
|
|
|
if (DoesUndo())
|
|
{
|
|
SwUndo * pUndo = new SwUndoFrmFmtCreate(pFmt, pDerivedFrom, this);
|
|
|
|
AppendUndo(pUndo);
|
|
}
|
|
}
|
|
|
|
return pFmt;
|
|
}
|
|
|
|
SwFmt *SwDoc::_MakeFrmFmt(const String &rFmtName,
|
|
SwFmt *pDerivedFrom,
|
|
BOOL bBroadcast, BOOL bAuto)
|
|
{
|
|
SwFrmFmt *pFrmFmt = dynamic_cast<SwFrmFmt*>(pDerivedFrom);
|
|
pFrmFmt = MakeFrmFmt( rFmtName, pFrmFmt, bBroadcast, bAuto );
|
|
return dynamic_cast<SwFmt*>(pFrmFmt);
|
|
}
|
|
|
|
|
|
// --> OD 2005-01-13 #i40550# - add parameter <bAuto> - not relevant
|
|
SwCharFmt *SwDoc::MakeCharFmt( const String &rFmtName,
|
|
SwCharFmt *pDerivedFrom,
|
|
BOOL bBroadcast,
|
|
BOOL )
|
|
// <--
|
|
{
|
|
SwCharFmt *pFmt = new SwCharFmt( GetAttrPool(), rFmtName, pDerivedFrom );
|
|
pCharFmtTbl->Insert( pFmt, pCharFmtTbl->Count() );
|
|
pFmt->SetAuto( FALSE );
|
|
SetModified();
|
|
|
|
if (DoesUndo())
|
|
{
|
|
SwUndo * pUndo = new SwUndoCharFmtCreate(pFmt, pDerivedFrom, this);
|
|
|
|
AppendUndo(pUndo);
|
|
}
|
|
|
|
if (bBroadcast)
|
|
{
|
|
BroadcastStyleOperation(rFmtName, SFX_STYLE_FAMILY_CHAR,
|
|
SFX_STYLESHEET_CREATED);
|
|
}
|
|
|
|
return pFmt;
|
|
}
|
|
|
|
SwFmt *SwDoc::_MakeCharFmt(const String &rFmtName,
|
|
SwFmt *pDerivedFrom,
|
|
BOOL bBroadcast, BOOL bAuto)
|
|
{
|
|
SwCharFmt *pCharFmt = dynamic_cast<SwCharFmt*>(pDerivedFrom);
|
|
pCharFmt = MakeCharFmt( rFmtName, pCharFmt, bBroadcast, bAuto );
|
|
return dynamic_cast<SwFmt*>(pCharFmt);
|
|
}
|
|
|
|
|
|
/*
|
|
* Erzeugen der FormatCollections
|
|
*/
|
|
// TXT
|
|
// --> OD 2005-01-13 #i40550# - add parameter <bAuto> - not relevant
|
|
SwTxtFmtColl* SwDoc::MakeTxtFmtColl( const String &rFmtName,
|
|
SwTxtFmtColl *pDerivedFrom,
|
|
BOOL bBroadcast,
|
|
BOOL )
|
|
// <--
|
|
{
|
|
SwTxtFmtColl *pFmtColl = new SwTxtFmtColl( GetAttrPool(), rFmtName,
|
|
pDerivedFrom );
|
|
pTxtFmtCollTbl->Insert(pFmtColl, pTxtFmtCollTbl->Count());
|
|
pFmtColl->SetAuto( FALSE );
|
|
SetModified();
|
|
|
|
if (DoesUndo())
|
|
{
|
|
SwUndo * pUndo = new SwUndoTxtFmtCollCreate(pFmtColl, pDerivedFrom,
|
|
this);
|
|
AppendUndo(pUndo);
|
|
}
|
|
|
|
if (bBroadcast)
|
|
BroadcastStyleOperation(rFmtName, SFX_STYLE_FAMILY_PARA,
|
|
SFX_STYLESHEET_CREATED);
|
|
|
|
return pFmtColl;
|
|
}
|
|
|
|
SwFmt *SwDoc::_MakeTxtFmtColl(const String &rFmtName,
|
|
SwFmt *pDerivedFrom,
|
|
BOOL bBroadcast, BOOL bAuto)
|
|
{
|
|
SwTxtFmtColl *pTxtFmtColl = dynamic_cast<SwTxtFmtColl*>(pDerivedFrom);
|
|
pTxtFmtColl = MakeTxtFmtColl( rFmtName, pTxtFmtColl, bBroadcast, bAuto );
|
|
return dynamic_cast<SwFmt*>(pTxtFmtColl);
|
|
}
|
|
|
|
|
|
//FEATURE::CONDCOLL
|
|
SwConditionTxtFmtColl* SwDoc::MakeCondTxtFmtColl( const String &rFmtName,
|
|
SwTxtFmtColl *pDerivedFrom,
|
|
BOOL bBroadcast)
|
|
{
|
|
SwConditionTxtFmtColl*pFmtColl = new SwConditionTxtFmtColl( GetAttrPool(),
|
|
rFmtName, pDerivedFrom );
|
|
pTxtFmtCollTbl->Insert(pFmtColl, pTxtFmtCollTbl->Count());
|
|
pFmtColl->SetAuto( FALSE );
|
|
SetModified();
|
|
|
|
if (bBroadcast)
|
|
BroadcastStyleOperation(rFmtName, SFX_STYLE_FAMILY_PARA,
|
|
SFX_STYLESHEET_CREATED);
|
|
|
|
return pFmtColl;
|
|
}
|
|
//FEATURE::CONDCOLL
|
|
|
|
// GRF
|
|
|
|
SwGrfFmtColl* SwDoc::MakeGrfFmtColl( const String &rFmtName,
|
|
SwGrfFmtColl *pDerivedFrom )
|
|
{
|
|
SwGrfFmtColl *pFmtColl = new SwGrfFmtColl( GetAttrPool(), rFmtName,
|
|
pDerivedFrom );
|
|
pGrfFmtCollTbl->Insert( pFmtColl, pGrfFmtCollTbl->Count() );
|
|
pFmtColl->SetAuto( FALSE );
|
|
SetModified();
|
|
return pFmtColl;
|
|
}
|
|
|
|
void SwDoc::DelTxtFmtColl(USHORT nFmtColl, BOOL bBroadcast)
|
|
{
|
|
ASSERT( nFmtColl, "Remove fuer Coll 0." );
|
|
|
|
// Wer hat die zu loeschende als Next
|
|
SwTxtFmtColl *pDel = (*pTxtFmtCollTbl)[nFmtColl];
|
|
if( pDfltTxtFmtColl == pDel )
|
|
return; // default nie loeschen !!
|
|
|
|
if (bBroadcast)
|
|
BroadcastStyleOperation(pDel->GetName(), SFX_STYLE_FAMILY_PARA,
|
|
SFX_STYLESHEET_ERASED);
|
|
|
|
if (DoesUndo())
|
|
{
|
|
SwUndoTxtFmtCollDelete * pUndo =
|
|
new SwUndoTxtFmtCollDelete(pDel, this);
|
|
|
|
AppendUndo(pUndo);
|
|
}
|
|
|
|
// Die FmtColl austragen
|
|
pTxtFmtCollTbl->Remove(nFmtColl);
|
|
// Next korrigieren
|
|
pTxtFmtCollTbl->ForEach( 1, pTxtFmtCollTbl->Count(),
|
|
&SetTxtFmtCollNext, pDel );
|
|
delete pDel;
|
|
SetModified();
|
|
}
|
|
|
|
void SwDoc::DelTxtFmtColl( SwTxtFmtColl *pColl, BOOL bBroadcast )
|
|
{
|
|
USHORT nFmt = pTxtFmtCollTbl->GetPos( pColl );
|
|
ASSERT( USHRT_MAX != nFmt, "Collection not found," );
|
|
DelTxtFmtColl( nFmt, bBroadcast );
|
|
}
|
|
|
|
BOOL lcl_SetTxtFmtColl( const SwNodePtr& rpNode, void* pArgs )
|
|
{
|
|
// ParaSetFmtColl * pPara = (ParaSetFmtColl*)pArgs;
|
|
SwCntntNode* pCNd = (SwCntntNode*)rpNode->GetTxtNode();
|
|
if( pCNd )
|
|
{
|
|
ParaRstFmt* pPara = (ParaRstFmt*)pArgs;
|
|
|
|
SwTxtFmtColl* pFmt = static_cast<SwTxtFmtColl*>(pPara->pFmtColl);
|
|
if ( pPara->bReset )
|
|
{
|
|
|
|
if( pFmt->GetAttrOutlineLevel() == 0 && pPara )
|
|
pPara->bKeepOutlineLevelAttr = true;
|
|
|
|
lcl_RstAttr( pCNd, pPara );
|
|
|
|
// --> OD 2007-11-06 #i62675#
|
|
// --> OD 2008-04-15 #refactorlists#
|
|
// check, if paragraph style has changed
|
|
if ( pPara->bResetListAttrs &&
|
|
pFmt != pCNd->GetFmtColl() &&
|
|
pFmt->GetItemState( RES_PARATR_NUMRULE ) == SFX_ITEM_SET )
|
|
{
|
|
// --> OD 2008-04-08 #refactorlists#
|
|
// if ( pPara->pHistory )
|
|
// {
|
|
// SwTxtNode* pTNd( dynamic_cast<SwTxtNode*>(pCNd) );
|
|
// ASSERT( pTNd,
|
|
// "<lcl_SetTxtFmtColl(..)> - text node expected -> crash" );
|
|
// SwRegHistory aRegH( pTNd, *pTNd, pPara->pHistory );
|
|
// pCNd->ResetAttr( RES_PARATR_NUMRULE );
|
|
// }
|
|
// else
|
|
// {
|
|
// pCNd->ResetAttr( RES_PARATR_NUMRULE );
|
|
// }
|
|
std::auto_ptr< SwRegHistory > pRegH;
|
|
if ( pPara->pHistory )
|
|
{
|
|
SwTxtNode* pTNd( dynamic_cast<SwTxtNode*>(pCNd) );
|
|
ASSERT( pTNd,
|
|
"<lcl_SetTxtFmtColl(..)> - text node expected -> crash" );
|
|
pRegH.reset( new SwRegHistory( pTNd, *pTNd, pPara->pHistory ) );
|
|
}
|
|
|
|
pCNd->ResetAttr( RES_PARATR_NUMRULE );
|
|
|
|
// reset all list attributes
|
|
pCNd->ResetAttr( RES_PARATR_LIST_LEVEL );
|
|
pCNd->ResetAttr( RES_PARATR_LIST_ISRESTART );
|
|
pCNd->ResetAttr( RES_PARATR_LIST_RESTARTVALUE );
|
|
pCNd->ResetAttr( RES_PARATR_LIST_ISCOUNTED );
|
|
pCNd->ResetAttr( RES_PARATR_LIST_ID );
|
|
}
|
|
// <--
|
|
}
|
|
|
|
// erst in die History aufnehmen, damit ggfs. alte Daten
|
|
// gesichert werden koennen
|
|
if( pPara->pHistory )
|
|
pPara->pHistory->Add( pCNd->GetFmtColl(), pCNd->GetIndex(),
|
|
ND_TEXTNODE );
|
|
|
|
pCNd->ChgFmtColl( pFmt );
|
|
|
|
pPara->nWhich++;
|
|
}
|
|
return TRUE;
|
|
}
|
|
|
|
BOOL SwDoc::SetTxtFmtColl( const SwPaM &rRg,
|
|
SwTxtFmtColl *pFmt,
|
|
bool bReset,
|
|
bool bResetListAttrs )
|
|
{
|
|
SwDataChanged aTmp( rRg, 0 );
|
|
const SwPosition *pStt = rRg.Start(), *pEnd = rRg.End();
|
|
SwHistory* pHst = 0;
|
|
BOOL bRet = TRUE;
|
|
|
|
if( DoesUndo() )
|
|
{
|
|
ClearRedo();
|
|
// --> OD 2008-04-15 #refactorlists#
|
|
SwUndoFmtColl* pUndo = new SwUndoFmtColl( rRg, pFmt,
|
|
bReset,
|
|
bResetListAttrs );
|
|
// <--
|
|
pHst = pUndo->GetHistory();
|
|
AppendUndo( pUndo );
|
|
}
|
|
|
|
ParaRstFmt aPara( pStt, pEnd, pHst );
|
|
aPara.pFmtColl = pFmt;
|
|
aPara.bReset = bReset;
|
|
// --> OD 2007-11-06 #i62675#
|
|
aPara.bResetListAttrs = bResetListAttrs;
|
|
// <--
|
|
|
|
GetNodes().ForEach( pStt->nNode.GetIndex(), pEnd->nNode.GetIndex()+1,
|
|
lcl_SetTxtFmtColl, &aPara );
|
|
if( !aPara.nWhich )
|
|
bRet = FALSE; // keinen gueltigen Node gefunden
|
|
|
|
if( bRet )
|
|
SetModified();
|
|
return bRet;
|
|
}
|
|
|
|
|
|
// ---- Kopiere die Formate in sich selbst (SwDoc) ----------------------
|
|
|
|
SwFmt* SwDoc::CopyFmt( const SwFmt& rFmt,
|
|
const SvPtrarr& rFmtArr,
|
|
FNCopyFmt fnCopyFmt, const SwFmt& rDfltFmt )
|
|
{
|
|
// kein-Autoformat || default Format || Collection-Format
|
|
// dann suche danach.
|
|
if( !rFmt.IsAuto() || !rFmt.GetRegisteredIn() )
|
|
for( USHORT n = 0; n < rFmtArr.Count(); n++ )
|
|
{
|
|
// ist die Vorlage schon im Doc vorhanden ??
|
|
if( ((SwFmt*)rFmtArr[n])->GetName().Equals( rFmt.GetName() ))
|
|
return (SwFmt*)rFmtArr[n];
|
|
}
|
|
|
|
// suche erstmal nach dem "Parent"
|
|
SwFmt* pParent = (SwFmt*)&rDfltFmt;
|
|
if( rFmt.DerivedFrom() && pParent != rFmt.DerivedFrom() )
|
|
pParent = CopyFmt( *rFmt.DerivedFrom(), rFmtArr,
|
|
fnCopyFmt, rDfltFmt );
|
|
|
|
// erzeuge das Format und kopiere die Attribute
|
|
// --> OD 2005-01-13 #i40550#
|
|
SwFmt* pNewFmt = (this->*fnCopyFmt)( rFmt.GetName(), pParent, FALSE, TRUE );
|
|
// <--
|
|
pNewFmt->SetAuto( rFmt.IsAuto() );
|
|
pNewFmt->CopyAttrs( rFmt, TRUE ); // kopiere Attribute
|
|
|
|
pNewFmt->SetPoolFmtId( rFmt.GetPoolFmtId() );
|
|
pNewFmt->SetPoolHelpId( rFmt.GetPoolHelpId() );
|
|
|
|
// HelpFile-Id immer auf dflt setzen !!
|
|
pNewFmt->SetPoolHlpFileId( UCHAR_MAX );
|
|
|
|
return pNewFmt;
|
|
}
|
|
|
|
|
|
// ---- kopiere das Frame-Format --------
|
|
SwFrmFmt* SwDoc::CopyFrmFmt( const SwFrmFmt& rFmt )
|
|
{
|
|
|
|
return (SwFrmFmt*)CopyFmt( rFmt, *GetFrmFmts(), &SwDoc::_MakeFrmFmt,
|
|
*GetDfltFrmFmt() );
|
|
}
|
|
|
|
// ---- kopiere das Char-Format --------
|
|
SwCharFmt* SwDoc::CopyCharFmt( const SwCharFmt& rFmt )
|
|
{
|
|
return (SwCharFmt*)CopyFmt( rFmt, *GetCharFmts(),
|
|
&SwDoc::_MakeCharFmt,
|
|
*GetDfltCharFmt() );
|
|
}
|
|
|
|
|
|
// --- Kopiere TextNodes ----
|
|
|
|
SwTxtFmtColl* SwDoc::CopyTxtColl( const SwTxtFmtColl& rColl )
|
|
{
|
|
SwTxtFmtColl* pNewColl = FindTxtFmtCollByName( rColl.GetName() );
|
|
if( pNewColl )
|
|
return pNewColl;
|
|
|
|
// suche erstmal nach dem "Parent"
|
|
SwTxtFmtColl* pParent = pDfltTxtFmtColl;
|
|
if( pParent != rColl.DerivedFrom() )
|
|
pParent = CopyTxtColl( *(SwTxtFmtColl*)rColl.DerivedFrom() );
|
|
|
|
|
|
//FEATURE::CONDCOLL
|
|
if( RES_CONDTXTFMTCOLL == rColl.Which() )
|
|
{
|
|
pNewColl = new SwConditionTxtFmtColl( GetAttrPool(), rColl.GetName(),
|
|
pParent);
|
|
pTxtFmtCollTbl->Insert( pNewColl, pTxtFmtCollTbl->Count() );
|
|
pNewColl->SetAuto( FALSE );
|
|
SetModified();
|
|
|
|
// Kopiere noch die Bedingungen
|
|
((SwConditionTxtFmtColl*)pNewColl)->SetConditions(
|
|
((SwConditionTxtFmtColl&)rColl).GetCondColls() );
|
|
}
|
|
else
|
|
//FEATURE::CONDCOLL
|
|
pNewColl = MakeTxtFmtColl( rColl.GetName(), pParent );
|
|
|
|
// kopiere jetzt noch die Auto-Formate oder kopiere die Attribute
|
|
pNewColl->CopyAttrs( rColl, TRUE );
|
|
|
|
// setze noch den Outline-Level
|
|
//if( NO_NUMBERING != rColl.GetOutlineLevel() ) //#outline level,zhaojianwei
|
|
// pNewColl->SetOutlineLevel( rColl.GetOutlineLevel() );
|
|
if(rColl.IsAssignedToListLevelOfOutlineStyle())
|
|
pNewColl->AssignToListLevelOfOutlineStyle(rColl.GetAssignedOutlineStyleLevel());//<-end,zhaojianwei
|
|
//<-end
|
|
pNewColl->SetPoolFmtId( rColl.GetPoolFmtId() );
|
|
pNewColl->SetPoolHelpId( rColl.GetPoolHelpId() );
|
|
|
|
// HelpFile-Id immer auf dflt setzen !!
|
|
pNewColl->SetPoolHlpFileId( UCHAR_MAX );
|
|
|
|
if( &rColl.GetNextTxtFmtColl() != &rColl )
|
|
pNewColl->SetNextTxtFmtColl( *CopyTxtColl( rColl.GetNextTxtFmtColl() ));
|
|
|
|
// ggfs. die NumRule erzeugen
|
|
if( this != rColl.GetDoc() )
|
|
{
|
|
const SfxPoolItem* pItem;
|
|
if( SFX_ITEM_SET == pNewColl->GetItemState( RES_PARATR_NUMRULE,
|
|
FALSE, &pItem ))
|
|
{
|
|
const SwNumRule* pRule;
|
|
const String& rName = ((SwNumRuleItem*)pItem)->GetValue();
|
|
if( rName.Len() &&
|
|
0 != ( pRule = rColl.GetDoc()->FindNumRulePtr( rName )) &&
|
|
!pRule->IsAutoRule() )
|
|
{
|
|
SwNumRule* pDestRule = FindNumRulePtr( rName );
|
|
if( pDestRule )
|
|
pDestRule->SetInvalidRule( TRUE );
|
|
else
|
|
MakeNumRule( rName, pRule );
|
|
}
|
|
}
|
|
}
|
|
return pNewColl;
|
|
}
|
|
|
|
// --- Kopiere GrafikNodes ----
|
|
|
|
SwGrfFmtColl* SwDoc::CopyGrfColl( const SwGrfFmtColl& rColl )
|
|
{
|
|
SwGrfFmtColl* pNewColl = FindGrfFmtCollByName( rColl.GetName() );
|
|
if( pNewColl )
|
|
return pNewColl;
|
|
|
|
// suche erstmal nach dem "Parent"
|
|
SwGrfFmtColl* pParent = pDfltGrfFmtColl;
|
|
if( pParent != rColl.DerivedFrom() )
|
|
pParent = CopyGrfColl( *(SwGrfFmtColl*)rColl.DerivedFrom() );
|
|
|
|
// falls nicht, so kopiere sie
|
|
pNewColl = MakeGrfFmtColl( rColl.GetName(), pParent );
|
|
|
|
// noch die Attribute kopieren
|
|
pNewColl->CopyAttrs( rColl );
|
|
|
|
pNewColl->SetPoolFmtId( rColl.GetPoolFmtId() );
|
|
pNewColl->SetPoolHelpId( rColl.GetPoolHelpId() );
|
|
|
|
// HelpFile-Id immer auf dflt setzen !!
|
|
pNewColl->SetPoolHlpFileId( UCHAR_MAX );
|
|
|
|
return pNewColl;
|
|
}
|
|
|
|
SwPageDesc* lcl_FindPageDesc( const SwPageDescs& rArr, const String& rName )
|
|
{
|
|
for( USHORT n = rArr.Count(); n; )
|
|
{
|
|
SwPageDesc* pDesc = rArr[ --n ];
|
|
if( pDesc->GetName() == rName )
|
|
return pDesc;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
void SwDoc::CopyFmtArr( const SvPtrarr& rSourceArr,
|
|
SvPtrarr& rDestArr,
|
|
FNCopyFmt fnCopyFmt,
|
|
SwFmt& rDfltFmt )
|
|
{
|
|
USHORT nSrc;
|
|
SwFmt* pSrc, *pDest;
|
|
|
|
// 1. Schritt alle Formate anlegen (das 0. ueberspringen - Default!)
|
|
for( nSrc = rSourceArr.Count(); nSrc > 1; )
|
|
{
|
|
pSrc = (SwFmt*)rSourceArr[ --nSrc ];
|
|
if( pSrc->IsDefault() || pSrc->IsAuto() )
|
|
continue;
|
|
|
|
if( 0 == FindFmtByName( rDestArr, pSrc->GetName() ) )
|
|
{
|
|
if( RES_CONDTXTFMTCOLL == pSrc->Which() )
|
|
MakeCondTxtFmtColl( pSrc->GetName(), (SwTxtFmtColl*)&rDfltFmt );
|
|
else
|
|
// --> OD 2005-01-13 #i40550#
|
|
(this->*fnCopyFmt)( pSrc->GetName(), &rDfltFmt, FALSE, TRUE );
|
|
// <--
|
|
}
|
|
}
|
|
|
|
// 2. Schritt alle Attribute kopieren, richtige Parents setzen
|
|
for( nSrc = rSourceArr.Count(); nSrc > 1; )
|
|
{
|
|
pSrc = (SwFmt*)rSourceArr[ --nSrc ];
|
|
if( pSrc->IsDefault() || pSrc->IsAuto() )
|
|
continue;
|
|
|
|
pDest = FindFmtByName( rDestArr, pSrc->GetName() );
|
|
pDest->SetAuto( FALSE );
|
|
// pDest->ResetAllAttr();
|
|
// pDest->CopyAttrs( *pSrc, TRUE ); // kopiere Attribute
|
|
//JP 19.02.96: ist so wohl optimaler - loest ggfs. kein Modify aus!
|
|
pDest->DelDiffs( *pSrc );
|
|
// --> OD 2009-03-23 #i94285#
|
|
// copy existing <SwFmtPageDesc> instance, before copying attributes
|
|
// pDest->SetFmtAttr( pSrc->GetAttrSet() ); // kopiere Attribute
|
|
//JP 18.08.98: Bug 55115 - copy PageDescAttribute in this case
|
|
const SfxPoolItem* pItem;
|
|
if( &GetAttrPool() != pSrc->GetAttrSet().GetPool() &&
|
|
SFX_ITEM_SET == pSrc->GetAttrSet().GetItemState(
|
|
RES_PAGEDESC, FALSE, &pItem ) &&
|
|
((SwFmtPageDesc*)pItem)->GetPageDesc() )
|
|
{
|
|
SwFmtPageDesc aPageDesc( *(SwFmtPageDesc*)pItem );
|
|
const String& rNm = aPageDesc.GetPageDesc()->GetName();
|
|
SwPageDesc* pPageDesc = ::lcl_FindPageDesc( aPageDescs, rNm );
|
|
if( !pPageDesc )
|
|
{
|
|
pPageDesc = aPageDescs[ MakePageDesc( rNm ) ];
|
|
}
|
|
pPageDesc->Add( &aPageDesc );
|
|
// pDest->SetFmtAttr( aPageDesc );
|
|
SwAttrSet aTmpAttrSet( pSrc->GetAttrSet() );
|
|
aTmpAttrSet.Put( aPageDesc );
|
|
pDest->SetFmtAttr( aTmpAttrSet );
|
|
}
|
|
else
|
|
{
|
|
pDest->SetFmtAttr( pSrc->GetAttrSet() );
|
|
}
|
|
// <--
|
|
|
|
pDest->SetPoolFmtId( pSrc->GetPoolFmtId() );
|
|
pDest->SetPoolHelpId( pSrc->GetPoolHelpId() );
|
|
|
|
// HelpFile-Id immer auf dflt setzen !!
|
|
pDest->SetPoolHlpFileId( UCHAR_MAX );
|
|
|
|
if( pSrc->DerivedFrom() )
|
|
pDest->SetDerivedFrom( FindFmtByName( rDestArr,
|
|
pSrc->DerivedFrom()->GetName() ) );
|
|
if( RES_TXTFMTCOLL == pSrc->Which() ||
|
|
RES_CONDTXTFMTCOLL == pSrc->Which() )
|
|
{
|
|
SwTxtFmtColl* pSrcColl = (SwTxtFmtColl*)pSrc,
|
|
* pDstColl = (SwTxtFmtColl*)pDest;
|
|
if( &pSrcColl->GetNextTxtFmtColl() != pSrcColl )
|
|
pDstColl->SetNextTxtFmtColl( *(SwTxtFmtColl*)FindFmtByName(
|
|
rDestArr, pSrcColl->GetNextTxtFmtColl().GetName() ) );
|
|
|
|
// setze noch den Outline-Level
|
|
//if( NO_NUMBERING != pSrcColl->GetOutlineLevel() ) //#outline level,zhaojianwei
|
|
// pDstColl->SetOutlineLevel( pSrcColl->GetOutlineLevel() );
|
|
if(pSrcColl->IsAssignedToListLevelOfOutlineStyle())
|
|
pDstColl->AssignToListLevelOfOutlineStyle(pSrcColl->GetAssignedOutlineStyleLevel());//<-end,zhaojianwei
|
|
//<-end
|
|
|
|
//FEATURE::CONDCOLL
|
|
if( RES_CONDTXTFMTCOLL == pSrc->Which() )
|
|
// Kopiere noch die Bedingungen
|
|
// aber erst die alten loeschen!
|
|
((SwConditionTxtFmtColl*)pDstColl)->SetConditions(
|
|
((SwConditionTxtFmtColl*)pSrc)->GetCondColls() );
|
|
//FEATURE::CONDCOLL
|
|
}
|
|
}
|
|
}
|
|
|
|
void SwDoc::_CopyPageDescHeaderFooter( BOOL bCpyHeader,
|
|
const SwFrmFmt& rSrcFmt, SwFrmFmt& rDestFmt )
|
|
{
|
|
// jetzt noch Header-/Footer-Attribute richtig behandeln
|
|
// Contenten Nodes Dokumentuebergreifend kopieren!
|
|
USHORT nAttr = static_cast<USHORT>( bCpyHeader ? RES_HEADER : RES_FOOTER );
|
|
const SfxPoolItem* pItem;
|
|
if( SFX_ITEM_SET != rSrcFmt.GetAttrSet().GetItemState( nAttr, FALSE, &pItem ))
|
|
return ;
|
|
|
|
// Im Header steht noch der Verweis auf das Format aus dem
|
|
// anderen Document!!
|
|
SfxPoolItem* pNewItem = pItem->Clone();
|
|
|
|
SwFrmFmt* pOldFmt;
|
|
if( bCpyHeader )
|
|
pOldFmt = ((SwFmtHeader*)pNewItem)->GetHeaderFmt();
|
|
else
|
|
pOldFmt = ((SwFmtFooter*)pNewItem)->GetFooterFmt();
|
|
|
|
if( pOldFmt )
|
|
{
|
|
SwFrmFmt* pNewFmt = new SwFrmFmt( GetAttrPool(), "CpyDesc",
|
|
GetDfltFrmFmt() );
|
|
pNewFmt->CopyAttrs( *pOldFmt, TRUE );
|
|
|
|
if( SFX_ITEM_SET == pNewFmt->GetAttrSet().GetItemState(
|
|
RES_CNTNT, FALSE, &pItem ))
|
|
{
|
|
SwFmtCntnt* pCntnt = (SwFmtCntnt*)pItem;
|
|
if( pCntnt->GetCntntIdx() )
|
|
{
|
|
SwNodeIndex aTmpIdx( GetNodes().GetEndOfAutotext() );
|
|
const SwNodes& rSrcNds = rSrcFmt.GetDoc()->GetNodes();
|
|
SwStartNode* pSttNd = GetNodes().MakeEmptySection( aTmpIdx,
|
|
bCpyHeader
|
|
? SwHeaderStartNode
|
|
: SwFooterStartNode );
|
|
const SwNode& rCSttNd = pCntnt->GetCntntIdx()->GetNode();
|
|
SwNodeRange aRg( rCSttNd, 0, *rCSttNd.EndOfSectionNode() );
|
|
aTmpIdx = *pSttNd->EndOfSectionNode();
|
|
rSrcNds._Copy( aRg, aTmpIdx );
|
|
aTmpIdx = *pSttNd;
|
|
rSrcFmt.GetDoc()->_CopyFlyInFly( aRg, aTmpIdx );
|
|
pNewFmt->SetFmtAttr( SwFmtCntnt( pSttNd ));
|
|
}
|
|
else
|
|
pNewFmt->ResetFmtAttr( RES_CNTNT );
|
|
}
|
|
if( bCpyHeader )
|
|
pNewFmt->Add( (SwFmtHeader*)pNewItem );
|
|
else
|
|
pNewFmt->Add( (SwFmtFooter*)pNewItem );
|
|
rDestFmt.SetFmtAttr( *pNewItem );
|
|
}
|
|
delete pNewItem;
|
|
}
|
|
|
|
void SwDoc::CopyPageDesc( const SwPageDesc& rSrcDesc, SwPageDesc& rDstDesc,
|
|
BOOL bCopyPoolIds )
|
|
{
|
|
BOOL bNotifyLayout = FALSE;
|
|
|
|
rDstDesc.SetLandscape( rSrcDesc.GetLandscape() );
|
|
rDstDesc.SetNumType( rSrcDesc.GetNumType() );
|
|
if( rDstDesc.ReadUseOn() != rSrcDesc.ReadUseOn() )
|
|
{
|
|
rDstDesc.WriteUseOn( rSrcDesc.ReadUseOn() );
|
|
bNotifyLayout = TRUE;
|
|
}
|
|
|
|
if( bCopyPoolIds )
|
|
{
|
|
rDstDesc.SetPoolFmtId( rSrcDesc.GetPoolFmtId() );
|
|
rDstDesc.SetPoolHelpId( rSrcDesc.GetPoolHelpId() );
|
|
// HelpFile-Id immer auf dflt setzen !!
|
|
rDstDesc.SetPoolHlpFileId( UCHAR_MAX );
|
|
}
|
|
|
|
if( rSrcDesc.GetFollow() != &rSrcDesc )
|
|
{
|
|
SwPageDesc* pFollow = ::lcl_FindPageDesc( aPageDescs,
|
|
rSrcDesc.GetFollow()->GetName() );
|
|
if( !pFollow )
|
|
{
|
|
// dann mal kopieren
|
|
USHORT nPos = MakePageDesc( rSrcDesc.GetFollow()->GetName() );
|
|
pFollow = aPageDescs[ nPos ];
|
|
CopyPageDesc( *rSrcDesc.GetFollow(), *pFollow );
|
|
}
|
|
rDstDesc.SetFollow( pFollow );
|
|
bNotifyLayout = TRUE;
|
|
}
|
|
|
|
// die Header/Footer-Attribute werden gesondert kopiert, die Content-
|
|
// Sections muessen vollstaendig mitgenommen werden!
|
|
{
|
|
SfxItemSet aAttrSet( rSrcDesc.GetMaster().GetAttrSet() );
|
|
aAttrSet.ClearItem( RES_HEADER );
|
|
aAttrSet.ClearItem( RES_FOOTER );
|
|
|
|
rDstDesc.GetMaster().DelDiffs( aAttrSet );
|
|
rDstDesc.GetMaster().SetFmtAttr( aAttrSet );
|
|
|
|
aAttrSet.ClearItem();
|
|
aAttrSet.Put( rSrcDesc.GetLeft().GetAttrSet() );
|
|
aAttrSet.ClearItem( RES_HEADER );
|
|
aAttrSet.ClearItem( RES_FOOTER );
|
|
|
|
rDstDesc.GetLeft().DelDiffs( aAttrSet );
|
|
rDstDesc.GetLeft().SetFmtAttr( aAttrSet );
|
|
}
|
|
|
|
CopyHeader( rSrcDesc.GetMaster(), rDstDesc.GetMaster() );
|
|
CopyFooter( rSrcDesc.GetMaster(), rDstDesc.GetMaster() );
|
|
if( !rDstDesc.IsHeaderShared() )
|
|
CopyHeader( rSrcDesc.GetLeft(), rDstDesc.GetLeft() );
|
|
else
|
|
rDstDesc.GetLeft().SetFmtAttr( rDstDesc.GetMaster().GetHeader() );
|
|
|
|
if( !rDstDesc.IsFooterShared() )
|
|
CopyFooter( rSrcDesc.GetLeft(), rDstDesc.GetLeft() );
|
|
else
|
|
rDstDesc.GetLeft().SetFmtAttr( rDstDesc.GetMaster().GetFooter() );
|
|
|
|
if( bNotifyLayout && GetRootFrm() )
|
|
//Layot benachrichtigen!
|
|
GetRootFrm()->CheckPageDescs( (SwPageFrm*)GetRootFrm()->Lower() );
|
|
|
|
//Wenn sich FussnotenInfo veraendert, so werden die Seiten
|
|
//angetriggert.
|
|
if( !(rDstDesc.GetFtnInfo() == rSrcDesc.GetFtnInfo()) )
|
|
{
|
|
rDstDesc.SetFtnInfo( rSrcDesc.GetFtnInfo() );
|
|
SwMsgPoolItem aInfo( RES_PAGEDESC_FTNINFO );
|
|
{
|
|
SwClientIter aIter( rDstDesc.GetMaster() );
|
|
for( SwClient* pLast = aIter.First(TYPE(SwFrm)); pLast;
|
|
pLast = aIter.Next() )
|
|
pLast->Modify( &aInfo, 0 );
|
|
}
|
|
{
|
|
SwClientIter aIter( rDstDesc.GetLeft() );
|
|
for( SwClient* pLast = aIter.First(TYPE(SwFrm)); pLast;
|
|
pLast = aIter.Next() )
|
|
pLast->Modify( &aInfo, 0 );
|
|
}
|
|
}
|
|
}
|
|
|
|
void SwDoc::ReplaceStyles( SwDoc& rSource )
|
|
{
|
|
BOOL bIsUndo = DoesUndo();
|
|
DoUndo( FALSE );
|
|
|
|
CopyFmtArr( *rSource.pCharFmtTbl, *pCharFmtTbl,
|
|
&SwDoc::_MakeCharFmt, *pDfltCharFmt );
|
|
CopyFmtArr( *rSource.pFrmFmtTbl, *pFrmFmtTbl,
|
|
&SwDoc::_MakeFrmFmt, *pDfltFrmFmt );
|
|
CopyFmtArr( *rSource.pTxtFmtCollTbl, *pTxtFmtCollTbl,
|
|
&SwDoc::_MakeTxtFmtColl, *pDfltTxtFmtColl );
|
|
|
|
// und jetzt noch die Seiten-Vorlagen
|
|
USHORT nCnt = rSource.aPageDescs.Count();
|
|
if( nCnt )
|
|
{
|
|
// ein anderes Doc -> Numberformatter muessen gemergt werden
|
|
SwTblNumFmtMerge aTNFM( rSource, *this );
|
|
|
|
// 1. Schritt alle Formate anlegen (das 0. ueberspringen - Default!)
|
|
while( nCnt )
|
|
{
|
|
SwPageDesc *pSrc = rSource.aPageDescs[ --nCnt ];
|
|
if( 0 == ::lcl_FindPageDesc( aPageDescs, pSrc->GetName() ) )
|
|
MakePageDesc( pSrc->GetName() );
|
|
}
|
|
|
|
// 2. Schritt alle Attribute kopieren, richtige Parents setzen
|
|
for( nCnt = rSource.aPageDescs.Count(); nCnt; )
|
|
{
|
|
SwPageDesc *pSrc = rSource.aPageDescs[ --nCnt ];
|
|
CopyPageDesc( *pSrc, *::lcl_FindPageDesc( aPageDescs, pSrc->GetName() ));
|
|
}
|
|
}
|
|
|
|
//JP 08.04.99: und dann sind da noch die Numerierungs-Vorlagen
|
|
nCnt = rSource.GetNumRuleTbl().Count();
|
|
if( nCnt )
|
|
{
|
|
const SwNumRuleTbl& rArr = rSource.GetNumRuleTbl();
|
|
for( USHORT n = 0; n < nCnt; ++n )
|
|
{
|
|
const SwNumRule& rR = *rArr[ n ];
|
|
if( !rR.IsAutoRule() )
|
|
{
|
|
SwNumRule* pNew = FindNumRulePtr( rR.GetName());
|
|
if( pNew )
|
|
pNew->CopyNumRule( this, rR );
|
|
else
|
|
MakeNumRule( rR.GetName(), &rR );
|
|
}
|
|
}
|
|
}
|
|
|
|
if( bIsUndo )
|
|
{
|
|
// es wurde am Nodes-Array gedreht!
|
|
ClearRedo();
|
|
DelAllUndoObj();
|
|
}
|
|
|
|
SetModified();
|
|
DoUndo( bIsUndo );
|
|
}
|
|
|
|
SwFmt* SwDoc::FindFmtByName( const SvPtrarr& rFmtArr,
|
|
const String& rName ) const
|
|
{
|
|
SwFmt* pFnd = 0;
|
|
for( USHORT n = 0; n < rFmtArr.Count(); n++ )
|
|
{
|
|
// ist die Vorlage schon im Doc vorhanden ??
|
|
if( ((SwFmt*)rFmtArr[n])->GetName() == rName )
|
|
{
|
|
pFnd = (SwFmt*)rFmtArr[n];
|
|
break;
|
|
}
|
|
}
|
|
return pFnd;
|
|
}
|
|
|
|
void SwDoc::MoveLeftMargin( const SwPaM& rPam, BOOL bRight, BOOL bModulus )
|
|
{
|
|
SwHistory* pHistory = 0;
|
|
if( DoesUndo() )
|
|
{
|
|
ClearRedo();
|
|
SwUndoMoveLeftMargin* pUndo = new SwUndoMoveLeftMargin( rPam, bRight,
|
|
bModulus );
|
|
pHistory = &pUndo->GetHistory();
|
|
AppendUndo( pUndo );
|
|
}
|
|
|
|
const SvxTabStopItem& rTabItem = (SvxTabStopItem&)GetDefault( RES_PARATR_TABSTOP );
|
|
USHORT nDefDist = rTabItem.Count() ?
|
|
static_cast<USHORT>(rTabItem[0].GetTabPos()) : 1134;
|
|
const SwPosition &rStt = *rPam.Start(), &rEnd = *rPam.End();
|
|
SwNodeIndex aIdx( rStt.nNode );
|
|
while( aIdx <= rEnd.nNode )
|
|
{
|
|
SwTxtNode* pTNd = aIdx.GetNode().GetTxtNode();
|
|
if( pTNd )
|
|
{
|
|
SvxLRSpaceItem aLS( (SvxLRSpaceItem&)pTNd->SwCntntNode::GetAttr( RES_LR_SPACE ) );
|
|
|
|
// --> FME 2008-09-16 #i93873# See also lcl_MergeListLevelIndentAsLRSpaceItem in thints.cxx
|
|
if ( pTNd->AreListLevelIndentsApplicable() )
|
|
{
|
|
const SwNumRule* pRule = pTNd->GetNumRule();
|
|
if ( pRule )
|
|
{
|
|
const int nListLevel = pTNd->GetActualListLevel();
|
|
if ( nListLevel >= 0 )
|
|
{
|
|
const SwNumFmt& rFmt = pRule->Get(static_cast<USHORT>(nListLevel));
|
|
if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
|
|
{
|
|
aLS.SetTxtLeft( rFmt.GetIndentAt() );
|
|
aLS.SetTxtFirstLineOfst( static_cast<short>(rFmt.GetFirstLineIndent()) );
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
long nNext = aLS.GetTxtLeft();
|
|
if( bModulus )
|
|
nNext = ( nNext / nDefDist ) * nDefDist;
|
|
|
|
if( bRight )
|
|
nNext += nDefDist;
|
|
else
|
|
nNext -= nDefDist;
|
|
|
|
aLS.SetTxtLeft( nNext );
|
|
|
|
SwRegHistory aRegH( pTNd, *pTNd, pHistory );
|
|
pTNd->SetAttr( aLS );
|
|
}
|
|
aIdx++;
|
|
}
|
|
SetModified();
|
|
}
|
|
|
|
BOOL SwDoc::DontExpandFmt( const SwPosition& rPos, BOOL bFlag )
|
|
{
|
|
BOOL bRet = FALSE;
|
|
SwTxtNode* pTxtNd = rPos.nNode.GetNode().GetTxtNode();
|
|
if( pTxtNd )
|
|
{
|
|
bRet = pTxtNd->DontExpandFmt( rPos.nContent, bFlag );
|
|
if( bRet && DoesUndo() )
|
|
{
|
|
ClearRedo();
|
|
AppendUndo( new SwUndoDontExpandFmt( rPos ));
|
|
}
|
|
}
|
|
return bRet;
|
|
}
|
|
|
|
SwTableBoxFmt* SwDoc::MakeTableBoxFmt()
|
|
{
|
|
SwTableBoxFmt* pFmt = new SwTableBoxFmt( GetAttrPool(), aEmptyStr,
|
|
pDfltFrmFmt );
|
|
SetModified();
|
|
return pFmt;
|
|
}
|
|
|
|
SwTableLineFmt* SwDoc::MakeTableLineFmt()
|
|
{
|
|
SwTableLineFmt* pFmt = new SwTableLineFmt( GetAttrPool(), aEmptyStr,
|
|
pDfltFrmFmt );
|
|
SetModified();
|
|
return pFmt;
|
|
}
|
|
|
|
void SwDoc::_CreateNumberFormatter()
|
|
{
|
|
RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDoc::_CreateNumberFormatter" );
|
|
|
|
ASSERT( !pNumberFormatter, "ist doch schon vorhanden" );
|
|
|
|
|
|
LanguageType eLang = LANGUAGE_SYSTEM; //System::GetLanguage();
|
|
/* ((const SvxLanguageItem&)GetAttrPool().
|
|
GetDefaultItem( RES_CHRATR_LANGUAGE )).GetLanguage();
|
|
*/
|
|
Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
|
|
pNumberFormatter = new SvNumberFormatter( xMSF, eLang );
|
|
pNumberFormatter->SetEvalDateFormat( NF_EVALDATEFORMAT_FORMAT_INTL );
|
|
pNumberFormatter->SetYear2000(static_cast<USHORT>(SFX_APP()->GetMiscConfig()->GetYear2000()));
|
|
|
|
}
|
|
|
|
SwTblNumFmtMerge::SwTblNumFmtMerge( const SwDoc& rSrc, SwDoc& rDest )
|
|
: pNFmt( 0 )
|
|
{
|
|
// ein anderes Doc -> Numberformatter muessen gemergt werden
|
|
SvNumberFormatter* pN;
|
|
if( &rSrc != &rDest && 0 != ( pN = ((SwDoc&)rSrc).GetNumberFormatter( FALSE ) ))
|
|
( pNFmt = rDest.GetNumberFormatter( TRUE ))->MergeFormatter( *pN );
|
|
|
|
if( &rSrc != &rDest )
|
|
((SwGetRefFieldType*)rSrc.GetSysFldType( RES_GETREFFLD ))->
|
|
MergeWithOtherDoc( rDest );
|
|
}
|
|
|
|
SwTblNumFmtMerge::~SwTblNumFmtMerge()
|
|
{
|
|
if( pNFmt )
|
|
pNFmt->ClearMergeTable();
|
|
}
|
|
|
|
|
|
void SwDoc::SetTxtFmtCollByAutoFmt( const SwPosition& rPos, USHORT nPoolId,
|
|
const SfxItemSet* pSet )
|
|
{
|
|
SwPaM aPam( rPos );
|
|
SwTxtNode* pTNd = rPos.nNode.GetNode().GetTxtNode();
|
|
|
|
if( mbIsAutoFmtRedline && pTNd )
|
|
{
|
|
// dann das Redline Object anlegen
|
|
const SwTxtFmtColl& rColl = *pTNd->GetTxtColl();
|
|
SwRedline* pRedl = new SwRedline( nsRedlineType_t::REDLINE_FMTCOLL, aPam );
|
|
pRedl->SetMark();
|
|
|
|
// interressant sind nur die Items, die vom Set NICHT wieder
|
|
// in den Node gesetzt werden. Also muss man die Differenz nehmen
|
|
SwRedlineExtraData_FmtColl aExtraData( rColl.GetName(),
|
|
rColl.GetPoolFmtId() );
|
|
if( pSet && pTNd->HasSwAttrSet() )
|
|
{
|
|
SfxItemSet aTmp( *pTNd->GetpSwAttrSet() );
|
|
aTmp.Differentiate( *pSet );
|
|
// das Adjust Item behalten wir extra
|
|
const SfxPoolItem* pItem;
|
|
if( SFX_ITEM_SET == pTNd->GetpSwAttrSet()->GetItemState(
|
|
RES_PARATR_ADJUST, FALSE, &pItem ))
|
|
aTmp.Put( *pItem );
|
|
aExtraData.SetItemSet( aTmp );
|
|
}
|
|
pRedl->SetExtraData( &aExtraData );
|
|
|
|
// !!!!!!!!! Undo fehlt noch !!!!!!!!!!!!!!!!!!
|
|
AppendRedline( pRedl, true );
|
|
}
|
|
|
|
SetTxtFmtColl( aPam, GetTxtCollFromPool( nPoolId ) );
|
|
|
|
if( pSet && pTNd && pSet->Count() )
|
|
{
|
|
aPam.SetMark();
|
|
aPam.GetMark()->nContent.Assign( pTNd, pTNd->GetTxt().Len() );
|
|
Insert( aPam, *pSet, 0 );
|
|
}
|
|
}
|
|
|
|
void SwDoc::SetFmtItemByAutoFmt( const SwPaM& rPam, const SfxItemSet& rSet )
|
|
{
|
|
SwTxtNode* pTNd = rPam.GetPoint()->nNode.GetNode().GetTxtNode();
|
|
|
|
RedlineMode_t eOld = GetRedlineMode();
|
|
|
|
if( mbIsAutoFmtRedline && pTNd )
|
|
{
|
|
// dann das Redline Object anlegen
|
|
SwRedline* pRedl = new SwRedline( nsRedlineType_t::REDLINE_FORMAT, rPam );
|
|
if( !pRedl->HasMark() )
|
|
pRedl->SetMark();
|
|
|
|
// interressant sind nur die Items, die vom Set NICHT wieder
|
|
// in den Node gesetzt werden. Also muss man die Differenz nehmen
|
|
SwRedlineExtraData_Format aExtraData( rSet );
|
|
|
|
/*
|
|
if( pSet && pTNd->HasSwAttrSet() )
|
|
{
|
|
SfxItemSet aTmp( *pTNd->GetpSwAttrSet() );
|
|
aTmp.Differentiate( *pSet );
|
|
// das Adjust Item behalten wir extra
|
|
const SfxPoolItem* pItem;
|
|
if( SFX_ITEM_SET == pTNd->GetpSwAttrSet()->GetItemState(
|
|
RES_PARATR_ADJUST, FALSE, &pItem ))
|
|
aTmp.Put( *pItem );
|
|
aExtraData.SetItemSet( aTmp );
|
|
}
|
|
*/
|
|
pRedl->SetExtraData( &aExtraData );
|
|
|
|
// !!!!!!!!! Undo fehlt noch !!!!!!!!!!!!!!!!!!
|
|
AppendRedline( pRedl, true );
|
|
|
|
SetRedlineMode_intern( (RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE));
|
|
}
|
|
|
|
Insert( rPam, rSet, nsSetAttrMode::SETATTR_DONTEXPAND );
|
|
SetRedlineMode_intern( eOld );
|
|
}
|
|
|
|
void SwDoc::ChgFmt(SwFmt & rFmt, const SfxItemSet & rSet)
|
|
{
|
|
if (DoesUndo())
|
|
{
|
|
// copying <rSet> to <aSet>
|
|
SfxItemSet aSet(rSet);
|
|
// remove from <aSet> all items, which are already set at the format
|
|
aSet.Differentiate(rFmt.GetAttrSet());
|
|
// <aSet> contains now all *new* items for the format
|
|
|
|
// copying current format item set to <aOldSet>
|
|
SfxItemSet aOldSet(rFmt.GetAttrSet());
|
|
// insert new items into <aOldSet>
|
|
aOldSet.Put(aSet);
|
|
// invalidate all new items in <aOldSet> in order to clear these items,
|
|
// if the undo action is triggered.
|
|
{
|
|
SfxItemIter aIter(aSet);
|
|
|
|
const SfxPoolItem * pItem = aIter.FirstItem();
|
|
while (pItem != NULL)
|
|
{
|
|
aOldSet.InvalidateItem(pItem->Which());
|
|
|
|
pItem = aIter.NextItem();
|
|
}
|
|
}
|
|
|
|
SwUndo * pUndo = new SwUndoFmtAttr(aOldSet, rFmt);
|
|
|
|
AppendUndo(pUndo);
|
|
}
|
|
|
|
rFmt.SetFmtAttr(rSet);
|
|
}
|
|
|
|
void SwDoc::RenameFmt(SwFmt & rFmt, const String & sNewName,
|
|
BOOL bBroadcast)
|
|
{
|
|
SfxStyleFamily eFamily = SFX_STYLE_FAMILY_ALL;
|
|
|
|
if (DoesUndo())
|
|
{
|
|
SwUndo * pUndo = NULL;
|
|
|
|
switch (rFmt.Which())
|
|
{
|
|
case RES_CHRFMT:
|
|
pUndo = new SwUndoRenameCharFmt(rFmt.GetName(), sNewName, this);
|
|
eFamily = SFX_STYLE_FAMILY_PARA;
|
|
break;
|
|
case RES_TXTFMTCOLL:
|
|
pUndo = new SwUndoRenameFmtColl(rFmt.GetName(), sNewName, this);
|
|
eFamily = SFX_STYLE_FAMILY_CHAR;
|
|
break;
|
|
case RES_FRMFMT:
|
|
pUndo = new SwUndoRenameFrmFmt(rFmt.GetName(), sNewName, this);
|
|
eFamily = SFX_STYLE_FAMILY_FRAME;
|
|
break;
|
|
|
|
default:
|
|
break;
|
|
}
|
|
|
|
if (pUndo)
|
|
AppendUndo(pUndo);
|
|
}
|
|
|
|
rFmt.SetName(sNewName);
|
|
|
|
if (bBroadcast)
|
|
BroadcastStyleOperation(sNewName, eFamily, SFX_STYLESHEET_MODIFIED);
|
|
}
|
|
|
|
// --> OD 2006-09-27 #i69627#
|
|
namespace docfunc
|
|
{
|
|
bool HasOutlineStyleToBeWrittenAsNormalListStyle( SwDoc& rDoc )
|
|
{
|
|
// If a parent paragraph style of one of the parargraph styles, which
|
|
// are assigned to the list levels of the outline style, has a list style
|
|
// set or inherits a list style from its parent style, the outline style
|
|
// has to be written as a normal list style to the OpenDocument file
|
|
// format or the OpenOffice.org file format.
|
|
bool bRet( false );
|
|
|
|
const SwTxtFmtColls* pTxtFmtColls( rDoc.GetTxtFmtColls() );
|
|
if ( pTxtFmtColls )
|
|
{
|
|
const USHORT nCount = pTxtFmtColls->Count();
|
|
for ( USHORT i = 0; i < nCount; ++i )
|
|
{
|
|
SwTxtFmtColl* pTxtFmtColl = (*pTxtFmtColls)[i];
|
|
|
|
if ( pTxtFmtColl->IsDefault() ||
|
|
// pTxtFmtColl->GetOutlineLevel() == NO_NUMBERING ) //#outline level,zhaojianwei
|
|
! pTxtFmtColl->IsAssignedToListLevelOfOutlineStyle() ) //<-end,zhaojianwei
|
|
{
|
|
continue;
|
|
}
|
|
|
|
const SwTxtFmtColl* pParentTxtFmtColl =
|
|
dynamic_cast<const SwTxtFmtColl*>( pTxtFmtColl->DerivedFrom());
|
|
if ( !pParentTxtFmtColl )
|
|
continue;
|
|
|
|
// --> OD 2007-12-07 #i77708#
|
|
// consider that explicitly no list style is set - empty string
|
|
// at numrule item.
|
|
// const SwNumRuleItem& rDirectItem = pParentTxtFmtColl->GetNumRule();
|
|
// if ( rDirectItem.GetValue().Len() != 0 )
|
|
if ( SFX_ITEM_SET == pParentTxtFmtColl->GetItemState( RES_PARATR_NUMRULE ) )
|
|
{
|
|
bRet = true;
|
|
break;
|
|
}
|
|
// <--
|
|
|
|
}
|
|
|
|
}
|
|
return bRet;
|
|
}
|
|
}
|
|
// <--
|