sw/Library_sw.mk | 7 sw/inc/IDocumentFieldsAccess.hxx | 2 sw/inc/IDocumentLineNumberAccess.hxx | 42 sw/inc/IDocumentRedlineAccess.hxx | 1 sw/inc/IDocumentState.hxx | 2 sw/inc/doc.hxx | 252 - sw/inc/docary.hxx | 2 sw/inc/fmtcol.hxx | 3 sw/inc/frmfmt.hxx | 2 sw/inc/node.hxx | 5 sw/qa/core/macros-test.cxx | 3 sw/qa/core/uwriter.cxx | 39 sw/qa/extras/inc/swmodeltestbase.hxx | 5 sw/qa/extras/uiwriter/uiwriter.cxx | 2 sw/source/core/access/accpara.cxx | 3 sw/source/core/attr/format.cxx | 6 sw/source/core/bastyp/calc.cxx | 6 sw/source/core/crsr/annotationmark.cxx | 6 sw/source/core/crsr/bookmrk.cxx | 5 sw/source/core/crsr/crsrsh.cxx | 3 sw/source/core/crsr/crstrvl.cxx | 23 sw/source/core/crsr/findattr.cxx | 3 sw/source/core/crsr/findcoll.cxx | 3 sw/source/core/crsr/findtxt.cxx | 3 sw/source/core/crsr/pam.cxx | 11 sw/source/core/crsr/swcrsr.cxx | 34 sw/source/core/crsr/trvltbl.cxx | 9 sw/source/core/crsr/unocrsr.cxx | 7 sw/source/core/doc/CntntIdxStore.cxx | 9 sw/source/core/doc/DocumentChartDataProviderManager.cxx | 3 sw/source/core/doc/DocumentContentOperationsManager.cxx | 268 - sw/source/core/doc/DocumentDeviceManager.cxx | 10 sw/source/core/doc/DocumentDrawModelManager.cxx | 13 sw/source/core/doc/DocumentExternalDataManager.cxx | 34 sw/source/core/doc/DocumentFieldsManager.cxx | 1669 ++++++++ sw/source/core/doc/DocumentLayoutManager.cxx | 519 ++ sw/source/core/doc/DocumentLinksAdministrationManager.cxx | 6 sw/source/core/doc/DocumentRedlineManager.cxx | 2677 +++++++++++++ sw/source/core/doc/DocumentSettingManager.cxx | 10 sw/source/core/doc/DocumentStateManager.cxx | 134 sw/source/core/doc/DocumentStatisticsManager.cxx | 248 + sw/source/core/doc/DocumentStylePoolManager.cxx | 2200 ++++++++++ sw/source/core/doc/DocumentTimerManager.cxx | 26 sw/source/core/doc/acmplwrd.cxx | 5 sw/source/core/doc/doc.cxx | 465 -- sw/source/core/doc/docbm.cxx | 3 sw/source/core/doc/docchart.cxx | 3 sw/source/core/doc/doccomp.cxx | 68 sw/source/core/doc/doccorr.cxx | 10 sw/source/core/doc/docdesc.cxx | 35 sw/source/core/doc/docdraw.cxx | 11 sw/source/core/doc/docedt.cxx | 41 sw/source/core/doc/docfld.cxx | 1831 -------- sw/source/core/doc/docfly.cxx | 28 sw/source/core/doc/docfmt.cxx | 62 sw/source/core/doc/docftn.cxx | 26 sw/source/core/doc/docglbl.cxx | 6 sw/source/core/doc/docglos.cxx | 11 sw/source/core/doc/doclay.cxx | 503 -- sw/source/core/doc/docnew.cxx | 101 sw/source/core/doc/docnum.cxx | 74 sw/source/core/doc/docredln.cxx | 2872 -------------- sw/source/core/doc/docsort.cxx | 22 sw/source/core/doc/doctxm.cxx | 45 sw/source/core/doc/ftnidx.cxx | 3 sw/source/core/doc/htmltbl.cxx | 7 sw/source/core/doc/lineinfo.cxx | 9 sw/source/core/doc/notxtfrm.cxx | 3 sw/source/core/doc/number.cxx | 8 sw/source/core/doc/poolfmt.cxx | 2117 ---------- sw/source/core/doc/swserv.cxx | 3 sw/source/core/doc/tblcpy.cxx | 16 sw/source/core/doc/tblrwcl.cxx | 25 sw/source/core/doc/textboxhelper.cxx | 3 sw/source/core/doc/visiturl.cxx | 3 sw/source/core/docnode/ndcopy.cxx | 5 sw/source/core/docnode/ndnum.cxx | 3 sw/source/core/docnode/ndsect.cxx | 41 sw/source/core/docnode/ndtbl.cxx | 143 sw/source/core/docnode/ndtbl1.cxx | 28 sw/source/core/docnode/node.cxx | 27 sw/source/core/docnode/nodedump.cxx | 13 sw/source/core/docnode/nodes.cxx | 16 sw/source/core/docnode/section.cxx | 22 sw/source/core/draw/dcontact.cxx | 7 sw/source/core/draw/dpage.cxx | 3 sw/source/core/draw/dview.cxx | 5 sw/source/core/edit/autofmt.cxx | 20 sw/source/core/edit/edfld.cxx | 34 sw/source/core/edit/edfldexp.cxx | 3 sw/source/core/edit/edfmt.cxx | 7 sw/source/core/edit/edglbldc.cxx | 5 sw/source/core/edit/edglss.cxx | 14 sw/source/core/edit/editsh.cxx | 13 sw/source/core/edit/edlingu.cxx | 9 sw/source/core/edit/ednumber.cxx | 11 sw/source/core/edit/edredln.cxx | 30 sw/source/core/edit/edtab.cxx | 10 sw/source/core/edit/edundo.cxx | 13 sw/source/core/edit/edws.cxx | 11 sw/source/core/fields/authfld.cxx | 10 sw/source/core/fields/cellfml.cxx | 3 sw/source/core/fields/dbfld.cxx | 5 sw/source/core/fields/ddefld.cxx | 6 sw/source/core/fields/ddetbl.cxx | 6 sw/source/core/fields/docufld.cxx | 20 sw/source/core/fields/expfld.cxx | 11 sw/source/core/fields/fldlst.cxx | 5 sw/source/core/fields/reffld.cxx | 20 sw/source/core/fields/usrfld.cxx | 8 sw/source/core/frmedt/fecopy.cxx | 63 sw/source/core/frmedt/fedesc.cxx | 3 sw/source/core/frmedt/fefly1.cxx | 8 sw/source/core/frmedt/feshview.cxx | 15 sw/source/core/frmedt/fetab.cxx | 8 sw/source/core/frmedt/tblsel.cxx | 27 sw/source/core/graphic/ndgrf.cxx | 3 sw/source/core/inc/DocumentExternalDataManager.hxx | 45 sw/source/core/inc/DocumentFieldsManager.hxx | 106 sw/source/core/inc/DocumentLayoutManager.hxx | 74 sw/source/core/inc/DocumentRedlineManager.hxx | 144 sw/source/core/inc/DocumentStateManager.hxx | 66 sw/source/core/inc/DocumentStatisticsManager.hxx | 73 sw/source/core/inc/DocumentStylePoolManager.hxx | 60 sw/source/core/layout/anchoreddrawobject.cxx | 5 sw/source/core/layout/atrfrm.cxx | 9 sw/source/core/layout/calcmove.cxx | 3 sw/source/core/layout/colfrm.cxx | 8 sw/source/core/layout/flowfrm.cxx | 5 sw/source/core/layout/fly.cxx | 5 sw/source/core/layout/flypos.cxx | 3 sw/source/core/layout/frmtool.cxx | 11 sw/source/core/layout/layact.cxx | 2 sw/source/core/layout/laycache.cxx | 12 sw/source/core/layout/layouter.cxx | 79 sw/source/core/layout/newfrm.cxx | 4 sw/source/core/layout/pagechg.cxx | 7 sw/source/core/layout/pagedesc.cxx | 3 sw/source/core/layout/tabfrm.cxx | 3 sw/source/core/layout/wsfrm.cxx | 3 sw/source/core/swg/SwXMLTextBlocks.cxx | 3 sw/source/core/table/swnewtable.cxx | 3 sw/source/core/table/swtable.cxx | 12 sw/source/core/text/frmpaint.cxx | 3 sw/source/core/text/itratr.cxx | 1 sw/source/core/text/redlnitr.cxx | 14 sw/source/core/text/txtfrm.cxx | 5 sw/source/core/text/txtftn.cxx | 1 sw/source/core/tox/ToxTextGenerator.cxx | 9 sw/source/core/tox/txmsrt.cxx | 3 sw/source/core/txtnode/atrfld.cxx | 2 sw/source/core/txtnode/atrflyin.cxx | 7 sw/source/core/txtnode/atrftn.cxx | 3 sw/source/core/txtnode/ndtxt.cxx | 16 sw/source/core/txtnode/thints.cxx | 25 sw/source/core/txtnode/txtatr2.cxx | 14 sw/source/core/txtnode/txtedt.cxx | 10 sw/source/core/undo/SwUndoField.cxx | 15 sw/source/core/undo/docundo.cxx | 2 sw/source/core/undo/rolbck.cxx | 10 sw/source/core/undo/unattr.cxx | 24 sw/source/core/undo/undel.cxx | 8 sw/source/core/undo/undobj.cxx | 33 sw/source/core/undo/undobj1.cxx | 5 sw/source/core/undo/undraw.cxx | 3 sw/source/core/undo/unins.cxx | 46 sw/source/core/undo/unovwr.cxx | 7 sw/source/core/undo/unredln.cxx | 65 sw/source/core/undo/unsect.cxx | 24 sw/source/core/undo/unspnd.cxx | 21 sw/source/core/undo/untbl.cxx | 67 sw/source/core/undo/untblk.cxx | 21 sw/source/core/unocore/unocoll.cxx | 5 sw/source/core/unocore/unocrsrhelper.cxx | 9 sw/source/core/unocore/unodraw.cxx | 19 sw/source/core/unocore/unofield.cxx | 106 sw/source/core/unocore/unoflatpara.cxx | 3 sw/source/core/unocore/unoframe.cxx | 10 sw/source/core/unocore/unoobj2.cxx | 13 sw/source/core/unocore/unoportenum.cxx | 3 sw/source/core/unocore/unoredline.cxx | 5 sw/source/core/unocore/unoredlines.cxx | 15 sw/source/core/unocore/unosect.cxx | 2 sw/source/core/unocore/unosett.cxx | 15 sw/source/core/unocore/unostyle.cxx | 13 sw/source/core/unocore/unotbl.cxx | 10 sw/source/core/unocore/unotext.cxx | 2 sw/source/core/view/printdata.cxx | 2 sw/source/core/view/viewsh.cxx | 35 sw/source/core/view/vnew.cxx | 21 sw/source/core/view/vprint.cxx | 8 sw/source/filter/ascii/parasc.cxx | 5 sw/source/filter/basflt/shellio.cxx | 56 sw/source/filter/html/css1atr.cxx | 14 sw/source/filter/html/htmlatr.cxx | 21 sw/source/filter/html/htmlbas.cxx | 3 sw/source/filter/html/htmlcss1.cxx | 17 sw/source/filter/html/htmlfld.cxx | 5 sw/source/filter/html/htmltab.cxx | 3 sw/source/filter/html/swhtml.cxx | 19 sw/source/filter/html/wrthtml.cxx | 11 sw/source/filter/rtf/swparrtf.cxx | 3 sw/source/filter/writer/writer.cxx | 4 sw/source/filter/ww1/fltshell.cxx | 37 sw/source/filter/ww1/w1filter.cxx | 9 sw/source/filter/ww8/docxattributeoutput.cxx | 8 sw/source/filter/ww8/docxexport.cxx | 3 sw/source/filter/ww8/rtfexport.cxx | 9 sw/source/filter/ww8/writerhelper.cxx | 16 sw/source/filter/ww8/writerwordglue.cxx | 5 sw/source/filter/ww8/wrtw8nds.cxx | 26 sw/source/filter/ww8/wrtww8.cxx | 25 sw/source/filter/ww8/ww8atr.cxx | 12 sw/source/filter/ww8/ww8glsy.cxx | 3 sw/source/filter/ww8/ww8graf2.cxx | 3 sw/source/filter/ww8/ww8par.cxx | 22 sw/source/filter/ww8/ww8par2.cxx | 3 sw/source/filter/ww8/ww8par3.cxx | 5 sw/source/filter/ww8/ww8par4.cxx | 2 sw/source/filter/ww8/ww8par5.cxx | 56 sw/source/filter/xml/XMLRedlineImportHelper.cxx | 11 sw/source/filter/xml/swxml.cxx | 17 sw/source/filter/xml/wrtxml.cxx | 13 sw/source/filter/xml/xmlexp.cxx | 20 sw/source/filter/xml/xmlfmt.cxx | 3 sw/source/filter/xml/xmlimp.cxx | 3 sw/source/filter/xml/xmlmeta.cxx | 5 sw/source/filter/xml/xmltbli.cxx | 13 sw/source/ui/dialog/docstdlg.cxx | 3 sw/source/ui/fldui/fldvar.cxx | 3 sw/source/ui/vba/vbainformationhelper.cxx | 3 sw/source/ui/vba/vbarevision.cxx | 5 sw/source/ui/vba/wordvbahelper.cxx | 3 sw/source/uibase/app/apphdl.cxx | 3 sw/source/uibase/app/docsh.cxx | 21 sw/source/uibase/app/docsh2.cxx | 32 sw/source/uibase/app/docshini.cxx | 16 sw/source/uibase/app/docst.cxx | 16 sw/source/uibase/app/docstyle.cxx | 32 sw/source/uibase/app/swmodul1.cxx | 3 sw/source/uibase/dbui/dbmgr.cxx | 3 sw/source/uibase/dochdl/swdtflvr.cxx | 12 sw/source/uibase/docvw/PostItMgr.cxx | 3 sw/source/uibase/misc/glshell.cxx | 7 sw/source/uibase/shells/textfld.cxx | 3 sw/source/uibase/uiview/srcview.cxx | 7 sw/source/uibase/uiview/view.cxx | 19 sw/source/uibase/uiview/view2.cxx | 5 sw/source/uibase/uiview/viewstat.cxx | 4 sw/source/uibase/uno/SwXDocumentSettings.cxx | 9 sw/source/uibase/uno/unoatxt.cxx | 17 sw/source/uibase/uno/unotxdoc.cxx | 44 sw/source/uibase/utlui/uitool.cxx | 3 253 files changed, 10544 insertions(+), 9178 deletions(-)
New commits: commit 1f4d9846aeb40af1fbb0126f666766fe6c60d8ff Author: Valentin Kettner <vakevk+libreoff...@gmail.com> Date: Tue Aug 12 15:03:19 2014 +0200 Refactored IDocumentExternalData out of SwDoc. Into the new class DocumentExternalDataManager. Change-Id: Ib863daec170044c46143b47a91739d4c0940d963 diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk index 507b94c..66eb006 100644 --- a/sw/Library_sw.mk +++ b/sw/Library_sw.mk @@ -201,6 +201,7 @@ $(eval $(call gb_Library_add_exception_objects,sw,\ sw/source/core/doc/DocumentStateManager \ sw/source/core/doc/DocumentLayoutManager \ sw/source/core/doc/DocumentStylePoolManager \ + sw/source/core/doc/DocumentExternalDataManager \ sw/source/core/doc/extinput \ sw/source/core/doc/fmtcol \ sw/source/core/doc/ftnidx \ diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 3d6c265..e000a91 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -22,7 +22,6 @@ // SwDoc interfaces #include <IInterface.hxx> #include <IDocumentMarkAccess.hxx> -#include <IDocumentExternalData.hxx> #include <com/sun/star/embed/XEmbeddedObject.hpp> #include <com/sun/star/embed/XStorage.hpp> #include <vcl/timer.hxx> @@ -191,6 +190,7 @@ class IDocumentStatistics; class IDocumentState; class IDocumentLayoutAccess; class IDocumentStylePoolAccess; +class IDocumentExternalData; class _SetGetExpFlds; namespace sw { namespace mark { @@ -216,6 +216,7 @@ namespace sw { class DocumentStateManager; class DocumentLayoutManager; class DocumentStylePoolManager; + class DocumentExternalDataManager; } namespace com { namespace sun { namespace star { @@ -252,8 +253,7 @@ void StartGrammarChecking( SwDoc &rDoc ); // Represents the model of a Writer document. class SW_DLLPUBLIC SwDoc : - public IInterface, - public IDocumentExternalData + public IInterface { friend class ::sw::DocumentContentOperationsManager; @@ -295,6 +295,7 @@ class SW_DLLPUBLIC SwDoc : const ::boost::scoped_ptr< ::sw::DocumentStatisticsManager > m_pDocumentStatisticsManager; const ::boost::scoped_ptr< ::sw::DocumentLayoutManager > m_pDocumentLayoutManager; const ::boost::scoped_ptr< ::sw::DocumentStylePoolManager > m_pDocumentStylePoolManager; + const ::boost::scoped_ptr< ::sw::DocumentExternalDataManager > m_pDocumentExternalDataManager; // Pointer SwFrmFmt *mpDfltFrmFmt; //< Default formats. @@ -603,10 +604,11 @@ public: IDocumentListsAccess const & getIDocumentListsAccess() const; IDocumentListsAccess & getIDocumentListsAccess(); - // IDocumentExternalData - virtual void setExternalData(::sw::tExternalDataType eType, - ::sw::tExternalDataPointer pPayload) SAL_OVERRIDE; - virtual ::sw::tExternalDataPointer getExternalData(::sw::tExternalDataType eType) SAL_OVERRIDE; + //IDocumentExternalData + IDocumentExternalData const & getIDocumentExternalData() const; + IDocumentExternalData & getIDocumentExternalData(); + + //End of Interfaces virtual void setDocReadOnly( bool b) { mbReadOnly = b; } virtual bool getDocReadOnly() const { return mbReadOnly; } diff --git a/sw/source/core/doc/DocumentExternalDataManager.cxx b/sw/source/core/doc/DocumentExternalDataManager.cxx new file mode 100644 index 0000000..3e751a3 --- /dev/null +++ b/sw/source/core/doc/DocumentExternalDataManager.cxx @@ -0,0 +1,34 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include <DocumentExternalDataManager.hxx> + +namespace sw +{ + +void DocumentExternalDataManager::setExternalData(::sw::tExternalDataType eType, ::sw::tExternalDataPointer pPayload) +{ + m_externalData[eType] = pPayload; +} + +::sw::tExternalDataPointer DocumentExternalDataManager::getExternalData(::sw::tExternalDataType eType) +{ + return m_externalData[eType]; +} + +} diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 1827f24..fad297ac 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -34,6 +34,7 @@ #include <DocumentStateManager.hxx> #include <DocumentStylePoolManager.hxx> #include <DocumentLayoutManager.hxx> +#include <DocumentExternalDataManager.hxx> #include <UndoManager.hxx> #include <hintids.hxx> #include <tools/shl.hxx> @@ -484,6 +485,17 @@ IDocumentStylePoolAccess & SwDoc::getIDocumentStylePoolAccess() return *m_pDocumentStylePoolManager; } +//IDocumentExternalData +IDocumentExternalData const & SwDoc::getIDocumentExternalData() const +{ + return *m_pDocumentExternalDataManager; +} + +IDocumentExternalData & SwDoc::getIDocumentExternalData() +{ + return *m_pDocumentExternalDataManager; +} + /* Implementations the next Interface here */ /* @@ -1700,17 +1712,6 @@ SwDoc::GetVbaEventProcessor() return mxVbaEvents; } -void SwDoc::setExternalData(::sw::tExternalDataType eType, - ::sw::tExternalDataPointer pPayload) -{ - m_externalData[eType] = pPayload; -} - -::sw::tExternalDataPointer SwDoc::getExternalData(::sw::tExternalDataType eType) -{ - return m_externalData[eType]; -} - sal_uInt16 SwNumRuleTbl::GetPos(const SwNumRule* pRule) const { const_iterator it = std::find(begin(), end(), pRule); diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index f81b9f1..1e129bf 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -103,6 +103,7 @@ #include <DocumentStateManager.hxx> #include <DocumentLayoutManager.hxx> #include <DocumentStylePoolManager.hxx> +#include <DocumentExternalDataManager.hxx> #include <unochart.hxx> #include <fldbas.hxx> @@ -221,6 +222,7 @@ SwDoc::SwDoc() m_pDocumentStatisticsManager( new ::sw::DocumentStatisticsManager( *this ) ), m_pDocumentLayoutManager( new ::sw::DocumentLayoutManager( *this ) ), m_pDocumentStylePoolManager( new ::sw::DocumentStylePoolManager( *this ) ), + m_pDocumentExternalDataManager( new ::sw::DocumentExternalDataManager() ), mpDfltFrmFmt( new SwFrmFmt( GetAttrPool(), sFrmFmtStr, 0 ) ), mpEmptyPageFmt( new SwFrmFmt( GetAttrPool(), sEmptyPageStr, mpDfltFrmFmt ) ), mpColumnContFmt( new SwFrmFmt( GetAttrPool(), sColumnCntStr, mpDfltFrmFmt ) ), diff --git a/sw/source/core/inc/DocumentExternalDataManager.hxx b/sw/source/core/inc/DocumentExternalDataManager.hxx new file mode 100644 index 0000000..0dc063c --- /dev/null +++ b/sw/source/core/inc/DocumentExternalDataManager.hxx @@ -0,0 +1,45 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_SW_SOURCE_CORE_INC_DOCUMENTEXTERNALDATAMANAGER_HXX +#define INCLUDED_SW_SOURCE_CORE_INC_DOCUMENTEXTERNALDATAMANAGER_HXX + +#include <IDocumentExternalData.hxx> +#include <boost/utility.hpp> +#include <sal/types.h> + +namespace sw { + +class DocumentExternalDataManager : public IDocumentExternalData, + public ::boost::noncopyable +{ + +public: + void setExternalData( ::sw::tExternalDataType eType, ::sw::tExternalDataPointer pPayload) SAL_OVERRIDE; + ::sw::tExternalDataPointer getExternalData(::sw::tExternalDataType eType) SAL_OVERRIDE; + + virtual ~DocumentExternalDataManager() {}; +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ + diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 534610f..69689ec 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -62,6 +62,7 @@ #include <IDocumentStatistics.hxx> #include <IDocumentStylePoolAccess.hxx> #include <IDocumentLayoutAccess.hxx> +#include <IDocumentExternalData.hxx> #include <viewopt.hxx> #include <docary.hxx> #include <pam.hxx> @@ -2832,7 +2833,7 @@ void WW8Export::WriteFkpPlcUsw() // Write SttbfAssoc WW8SttbAssoc * pSttbfAssoc = dynamic_cast<WW8SttbAssoc *> - (pDoc->getExternalData(::sw::STTBF_ASSOC).get()); + (pDoc->getIDocumentExternalData().getExternalData(::sw::STTBF_ASSOC).get()); if ( pSttbfAssoc ) // #i106057# { @@ -2854,7 +2855,7 @@ void WW8Export::WriteFkpPlcUsw() // Reclaim stored FIB data from document. ::ww8::WW8FibData * pFibData = dynamic_cast<ww8::WW8FibData *> - (pDoc->getExternalData(::sw::FIB).get()); + (pDoc->getIDocumentExternalData().getExternalData(::sw::FIB).get()); if ( pFibData ) { diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 742f709..447cf1d 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -76,6 +76,7 @@ #include <IDocumentFieldsAccess.hxx> #include <IDocumentLayoutAccess.hxx> #include <IDocumentStylePoolAccess.hxx> +#include <IDocumentExternalData.hxx> #include <docufld.hxx> #include <swfltopt.hxx> #include <viewsh.hxx> @@ -4898,12 +4899,12 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos) ::sw::tExternalDataPointer pExternalFibData(pFibData); - rDoc.setExternalData(::sw::FIB, pExternalFibData); + rDoc.getIDocumentExternalData().setExternalData(::sw::FIB, pExternalFibData); ::sw::tExternalDataPointer pSttbfAsoc (new ::ww8::WW8Sttb<ww8::WW8Struct>(*pTableStream, pWwFib->fcSttbfAssoc, pWwFib->lcbSttbfAssoc)); - rDoc.setExternalData(::sw::STTBF_ASSOC, pSttbfAsoc); + rDoc.getIDocumentExternalData().setExternalData(::sw::STTBF_ASSOC, pSttbfAsoc); if (pWwFib->fWriteReservation || pWwFib->fReadOnlyRecommended) { commit 535971f3a166da6c0e44a6b7211c7f8c298f388f Author: Valentin Kettner <vakevk+libreoff...@gmail.com> Date: Fri Aug 8 19:16:38 2014 +0200 Refactored IDocumentStylePoolAccess out of SwDoc. Added non const SwDoc::GetDfltTxtFmtColl and SwDoc::GetTxtFmtColls and SwDoc::GetCharFmts. Had to make the manager friend of SwTxtFmtColl and SwConditionTxtFmtColl Had to make SwDoc::_MakeCharFmt and SwDoc::_MakeFrmFmt public. Change-Id: I19a36d91f92b3781a6c4313ec12eb8f7d4dfacc3 diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk index abf8957..507b94c 100644 --- a/sw/Library_sw.mk +++ b/sw/Library_sw.mk @@ -200,6 +200,7 @@ $(eval $(call gb_Library_add_exception_objects,sw,\ sw/source/core/doc/DocumentStatisticsManager \ sw/source/core/doc/DocumentStateManager \ sw/source/core/doc/DocumentLayoutManager \ + sw/source/core/doc/DocumentStylePoolManager \ sw/source/core/doc/extinput \ sw/source/core/doc/fmtcol \ sw/source/core/doc/ftnidx \ diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index cc77e3a..3d6c265 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -22,7 +22,6 @@ // SwDoc interfaces #include <IInterface.hxx> #include <IDocumentMarkAccess.hxx> -#include <IDocumentStylePoolAccess.hxx> #include <IDocumentExternalData.hxx> #include <com/sun/star/embed/XEmbeddedObject.hpp> #include <com/sun/star/embed/XStorage.hpp> @@ -191,6 +190,7 @@ class IDocumentRedlineAccess; class IDocumentStatistics; class IDocumentState; class IDocumentLayoutAccess; +class IDocumentStylePoolAccess; class _SetGetExpFlds; namespace sw { namespace mark { @@ -215,6 +215,7 @@ namespace sw { class DocumentStatisticsManager; class DocumentStateManager; class DocumentLayoutManager; + class DocumentStylePoolManager; } namespace com { namespace sun { namespace star { @@ -252,7 +253,6 @@ void StartGrammarChecking( SwDoc &rDoc ); // Represents the model of a Writer document. class SW_DLLPUBLIC SwDoc : public IInterface, - public IDocumentStylePoolAccess, public IDocumentExternalData { friend class ::sw::DocumentContentOperationsManager; @@ -294,6 +294,7 @@ class SW_DLLPUBLIC SwDoc : const ::boost::scoped_ptr< ::sw::DocumentFieldsManager > m_pDocumentFieldsManager; const ::boost::scoped_ptr< ::sw::DocumentStatisticsManager > m_pDocumentStatisticsManager; const ::boost::scoped_ptr< ::sw::DocumentLayoutManager > m_pDocumentLayoutManager; + const ::boost::scoped_ptr< ::sw::DocumentStylePoolManager > m_pDocumentStylePoolManager; // Pointer SwFrmFmt *mpDfltFrmFmt; //< Default formats. @@ -451,8 +452,11 @@ private: void DoUpdateAllCharts(); DECL_LINK( DoUpdateModifiedOLE, Timer * ); +public: SwFmt *_MakeCharFmt(const OUString &, SwFmt *, bool, bool ); SwFmt *_MakeFrmFmt(const OUString &, SwFmt *, bool, bool ); + +private: SwFmt *_MakeTxtFmtColl(const OUString &, SwFmt *, bool, bool ); private: @@ -542,15 +546,8 @@ public: virtual bool UpdateRsid( const SwPaM &rRg, sal_Int32 nLen ); // IDocumentStylePoolAccess - virtual SwTxtFmtColl* GetTxtCollFromPool( sal_uInt16 nId, bool bRegardLanguage = true ) SAL_OVERRIDE; - virtual SwFmt* GetFmtFromPool( sal_uInt16 nId ) SAL_OVERRIDE; - virtual SwFrmFmt* GetFrmFmtFromPool( sal_uInt16 nId ) SAL_OVERRIDE; - virtual SwCharFmt* GetCharFmtFromPool( sal_uInt16 nId ) SAL_OVERRIDE; - virtual SwPageDesc* GetPageDescFromPool( sal_uInt16 nId, bool bRegardLanguage = true ) SAL_OVERRIDE; - virtual SwNumRule* GetNumRuleFromPool( sal_uInt16 nId ) SAL_OVERRIDE; - virtual bool IsPoolTxtCollUsed( sal_uInt16 nId ) const SAL_OVERRIDE; - virtual bool IsPoolFmtUsed( sal_uInt16 nId ) const SAL_OVERRIDE; - virtual bool IsPoolPageDescUsed( sal_uInt16 nId ) const SAL_OVERRIDE; + IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const; + IDocumentStylePoolAccess & getIDocumentStylePoolAccess(); // SwLineNumberInfo virtual const SwLineNumberInfo& GetLineNumberInfo() const; @@ -806,6 +803,7 @@ public: const SwFrmFmts* GetFrmFmts() const { return mpFrmFmtTbl; } SwFrmFmts* GetFrmFmts() { return mpFrmFmtTbl; } const SwCharFmts* GetCharFmts() const { return mpCharFmtTbl;} + SwCharFmts* GetCharFmts() { return mpCharFmtTbl;} // LayoutFormats (frames, DrawObjects), sometimes const sometimes not const SwFrmFmts* GetSpzFrmFmts() const { return mpSpzFrmFmtTbl; } @@ -843,7 +841,9 @@ public: // Formatcollections (styles) // TXT const SwTxtFmtColl* GetDfltTxtFmtColl() const { return mpDfltTxtFmtColl; } + SwTxtFmtColl* GetDfltTxtFmtColl() { return mpDfltTxtFmtColl; } const SwTxtFmtColls *GetTxtFmtColls() const { return mpTxtFmtCollTbl; } + SwTxtFmtColls *GetTxtFmtColls() { return mpTxtFmtCollTbl; } SwTxtFmtColl *MakeTxtFmtColl( const OUString &rFmtName, SwTxtFmtColl *pDerivedFrom, bool bBroadcast = false, diff --git a/sw/inc/fmtcol.hxx b/sw/inc/fmtcol.hxx index a3c5df6..82ee3a9 100644 --- a/sw/inc/fmtcol.hxx +++ b/sw/inc/fmtcol.hxx @@ -26,6 +26,7 @@ #include <rtl/ustring.hxx> class SwDoc; +namespace sw{ class DocumentStylePoolManager; } class SwFmtColl : public SwFmt { @@ -53,6 +54,7 @@ private: class SW_DLLPUBLIC SwTxtFmtColl: public SwFmtColl { friend class SwDoc; + friend class ::sw::DocumentStylePoolManager; SwTxtFmtColl(const SwTxtFmtColl & rRef); @@ -236,6 +238,7 @@ class SwFmtCollConditions : public boost::ptr_vector<SwCollCondition> {}; class SW_DLLPUBLIC SwConditionTxtFmtColl : public SwTxtFmtColl { friend class SwDoc; + friend class ::sw::DocumentStylePoolManager; protected: SwFmtCollConditions aCondColls; diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index 684bff7..da16b11 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -23,6 +23,7 @@ #include <DocumentRedlineManager.hxx> #include <IDocumentState.hxx> #include <IDocumentLayoutAccess.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <UndoManager.hxx> #include <docary.hxx> #include <textboxhelper.hxx> @@ -1279,7 +1280,7 @@ namespace //local functions originally from docfmt.cxx !pDoc->FindNumRulePtr( pRule->GetValue() ) && USHRT_MAX != (nPoolId = SwStyleNameMapper::GetPoolIdFromUIName ( pRule->GetValue(), nsSwGetPoolIdFromName::GET_POOLID_NUMRULE )) ) - pDoc->GetNumRuleFromPool( nPoolId ); + pDoc->getIDocumentStylePoolAccess().GetNumRuleFromPool( nPoolId ); } } @@ -2572,7 +2573,7 @@ SwFlyFrmFmt* DocumentContentOperationsManager::Insert( const SwPaM &rRg, SwFrmFmt* pFrmFmt ) { if( !pFrmFmt ) - pFrmFmt = m_rSwdoc.GetFrmFmtFromPool( RES_POOLFRM_GRAPHIC ); + pFrmFmt = m_rSwdoc.getIDocumentStylePoolAccess().GetFrmFmtFromPool( RES_POOLFRM_GRAPHIC ); SwGrfNode* pSwGrfNode = m_rSwdoc.GetNodes().MakeGrfNode( SwNodeIndex( m_rSwdoc.GetNodes().GetEndOfAutotext() ), rGrfName, rFltName, pGraphic, @@ -2588,7 +2589,7 @@ SwFlyFrmFmt* DocumentContentOperationsManager::Insert( const SwPaM &rRg, const G SwFrmFmt* pFrmFmt ) { if( !pFrmFmt ) - pFrmFmt = m_rSwdoc.GetFrmFmtFromPool( RES_POOLFRM_GRAPHIC ); + pFrmFmt = m_rSwdoc.getIDocumentStylePoolAccess().GetFrmFmtFromPool( RES_POOLFRM_GRAPHIC ); SwGrfNode* pSwGrfNode = m_rSwdoc.GetNodes().MakeGrfNode( SwNodeIndex( m_rSwdoc.GetNodes().GetEndOfAutotext() ), rGrfObj, m_rSwdoc.GetDfltGrfFmtColl() ); @@ -2609,7 +2610,7 @@ SwFlyFrmFmt* DocumentContentOperationsManager::Insert(const SwPaM &rRg, const sv if (SotExchange::IsMath(aClassName)) nId = RES_POOLFRM_FORMEL; - pFrmFmt = m_rSwdoc.GetFrmFmtFromPool( nId ); + pFrmFmt = m_rSwdoc.getIDocumentStylePoolAccess().GetFrmFmtFromPool( nId ); } return _InsNoTxtNode( *rRg.GetPoint(), m_rSwdoc.GetNodes().MakeOLENode( SwNodeIndex( m_rSwdoc.GetNodes().GetEndOfAutotext() ), @@ -2626,7 +2627,7 @@ SwFlyFrmFmt* DocumentContentOperationsManager::InsertOLE(const SwPaM &rRg, const SwFrmFmt* pFrmFmt ) { if( !pFrmFmt ) - pFrmFmt = m_rSwdoc.GetFrmFmtFromPool( RES_POOLFRM_OLE ); + pFrmFmt = m_rSwdoc.getIDocumentStylePoolAccess().GetFrmFmtFromPool( RES_POOLFRM_OLE ); return _InsNoTxtNode( *rRg.GetPoint(), m_rSwdoc.GetNodes().MakeOLENode( @@ -2844,7 +2845,7 @@ bool DocumentContentOperationsManager::SplitNode( const SwPosition &rPos, bool b { SwTxtNode* pTxtNd = m_rSwdoc.GetNodes().MakeTxtNode( SwNodeIndex( *pTblNd ), - m_rSwdoc.GetTxtCollFromPool( RES_POOLCOLL_TEXT )); + m_rSwdoc.getIDocumentStylePoolAccess().GetTxtCollFromPool( RES_POOLCOLL_TEXT )); if( pTxtNd ) { ((SwPosition&)rPos).nNode = pTblNd->GetIndex()-1; @@ -2915,7 +2916,7 @@ bool DocumentContentOperationsManager::AppendTxtNode( SwPosition& rPos ) // so then one can be created! SwNodeIndex aIdx( rPos.nNode, 1 ); pCurNode = m_rSwdoc.GetNodes().MakeTxtNode( aIdx, - m_rSwdoc.GetTxtCollFromPool( RES_POOLCOLL_STANDARD )); + m_rSwdoc.getIDocumentStylePoolAccess().GetTxtCollFromPool( RES_POOLCOLL_STANDARD )); } else pCurNode = (SwTxtNode*)pCurNode->AppendNode( rPos ); @@ -4098,7 +4099,7 @@ bool DocumentContentOperationsManager::CopyImpl( SwPaM& rPam, SwPosition& rPos, { if( pStt->nContent.GetIndex() || bOneNode ) pDestTxtNd = pDoc->GetNodes().MakeTxtNode( aInsPos, - pDoc->GetTxtCollFromPool(RES_POOLCOLL_STANDARD)); + pDoc->getIDocumentStylePoolAccess().GetTxtCollFromPool(RES_POOLCOLL_STANDARD)); else { pDestTxtNd = static_cast<SwTxtNode*>(pSttTxtNd->MakeCopy( pDoc, aInsPos )); @@ -4281,7 +4282,7 @@ bool DocumentContentOperationsManager::CopyImpl( SwPaM& rPam, SwPosition& rPos, if( !pDestTxtNd ) { pDestTxtNd = pDoc->GetNodes().MakeTxtNode( aInsPos, - pDoc->GetTxtCollFromPool(RES_POOLCOLL_STANDARD)); + pDoc->getIDocumentStylePoolAccess().GetTxtCollFromPool(RES_POOLCOLL_STANDARD)); aDestIdx.Assign( pDestTxtNd, 0 ); aInsPos--; diff --git a/sw/source/core/doc/DocumentLayoutManager.cxx b/sw/source/core/doc/DocumentLayoutManager.cxx index e504d6e..1772723 100644 --- a/sw/source/core/doc/DocumentLayoutManager.cxx +++ b/sw/source/core/doc/DocumentLayoutManager.cxx @@ -21,6 +21,7 @@ #include <IDocumentState.hxx> #include <IDocumentUndoRedo.hxx> #include <DocumentContentOperationsManager.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <undobj.hxx> #include <viewsh.hxx> #include <layouter.hxx> @@ -134,7 +135,7 @@ SwFrmFmt *DocumentLayoutManager::MakeLayoutFmt( RndStdIds eRequest, const SfxIte m_rSwdoc.GetNodes().MakeTextSection ( aTmpIdx, bHeader ? SwHeaderStartNode : SwFooterStartNode, - m_rSwdoc.GetTxtCollFromPool(static_cast<sal_uInt16>( bHeader + m_rSwdoc.getIDocumentStylePoolAccess().GetTxtCollFromPool(static_cast<sal_uInt16>( bHeader ? ( eRequest == RND_STD_HEADERL ? RES_POOLCOLL_HEADERL : eRequest == RND_STD_HEADERR diff --git a/sw/source/core/doc/DocumentStylePoolManager.cxx b/sw/source/core/doc/DocumentStylePoolManager.cxx new file mode 100644 index 0000000..1dae480 --- /dev/null +++ b/sw/source/core/doc/DocumentStylePoolManager.cxx @@ -0,0 +1,2200 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include <DocumentStylePoolManager.hxx> +#include <doc.hxx> +#include <poolfmt.hxx> +#include <DocumentSettingManager.hxx> +#include <IDocumentState.hxx> +#include <IDocumentUndoRedo.hxx> +#include <fmtanchr.hxx> +#include <fmtfsize.hxx> +#include <paratr.hxx> +#include <poolfmt.hxx> +#include <fmtornt.hxx> +#include <fmtsrndenum.hxx> +#include <charfmt.hxx> +#include <fmtsrnd.hxx> +#include <docary.hxx> +#include <GetMetricVal.hxx> +#include <pagedesc.hxx> +#include <frmfmt.hxx> +#include <fmtline.hxx> +#include <numrule.hxx> +#include <editeng/paperinf.hxx> +#include <editeng/wghtitem.hxx> +#include <editeng/fontitem.hxx> +#include <editeng/fhgtitem.hxx> +#include <editeng/tstpitem.hxx> +#include <editeng/lrspitem.hxx> +#include <editeng/ulspitem.hxx> +#include <editeng/lspcitem.hxx> +#include <editeng/adjustitem.hxx> +#include <editeng/postitem.hxx> +#include <editeng/keepitem.hxx> +#include <editeng/opaqitem.hxx> +#include <editeng/boxitem.hxx> +#include <editeng/cmapitem.hxx> +#include <editeng/udlnitem.hxx> +#include <editeng/colritem.hxx> +#include <editeng/protitem.hxx> +#include <editeng/escapementitem.hxx> +#include <editeng/langitem.hxx> +#include <editeng/charrotateitem.hxx> +#include <editeng/frmdiritem.hxx> +#include <editeng/emphasismarkitem.hxx> +#include <editeng/scriptspaceitem.hxx> +#include <rcid.hrc> +#include <com/sun/star/table/BorderLineStyle.hpp> +#include <com/sun/star/text/VertOrientation.hpp> +#include <com/sun/star/text/RelOrientation.hpp> +#include <com/sun/star/text/HoriOrientation.hpp> + +using namespace ::editeng; +using namespace ::com::sun::star; + +namespace +{ + static const sal_uInt16 PT_3 = 3 * 20; // 3 pt + static const sal_uInt16 PT_6 = 6 * 20; // 6 pt + static const sal_uInt16 PT_7 = 7 * 20; // 7 pt + static const sal_uInt16 PT_10 = 10 * 20; // 10 pt + static const sal_uInt16 PT_12 = 12 * 20; // 12 pt + static const sal_uInt16 PT_14 = 14 * 20; // 14 pt + static const sal_uInt16 PT_16 = 16 * 20; // 16 pt + static const sal_uInt16 PT_18 = 18 * 20; // 18 pt + static const sal_uInt16 PT_24 = 24 * 20; // 24 pt + static const sal_uInt16 PT_28 = 28 * 20; // 28 pt + + #define HTML_PARSPACE GetMetricVal( CM_05 ) + + static const sal_uInt16 aHeadlineSizes[ 2 * MAXLEVEL ] = { + // we do everything procentual now: + 130, 115, 100, 95, 85, + 85, 80, 80, 75, 75, // normal + PT_24, PT_18, PT_14, PT_12, PT_10, + PT_7, PT_7, PT_7, PT_7, PT_7 // HTML mode + }; + + static long lcl_GetRightMargin( SwDoc& rDoc ) + { + // Make sure that the printer settings are taken over to the standard + // page style + const SwFrmFmt& rPgDscFmt = rDoc.GetPageDesc( 0 ).GetMaster(); + const SvxLRSpaceItem& rLR = rPgDscFmt.GetLRSpace(); + const long nLeft = rLR.GetLeft(); + const long nRight = rLR.GetRight(); + const long nWidth = rPgDscFmt.GetFrmSize().GetWidth(); + return nWidth - nLeft - nRight; + } + + static void lcl_SetDfltFont( sal_uInt16 nFntType, SfxItemSet& rSet ) + { + static struct { + sal_uInt16 nResLngId; + sal_uInt16 nResFntId; + } aArr[ 3 ] = { + { RES_CHRATR_LANGUAGE, RES_CHRATR_FONT }, + { RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CJK_FONT }, + { RES_CHRATR_CTL_LANGUAGE, RES_CHRATR_CTL_FONT } + }; + for( sal_uInt16 n = 0; n < 3; ++n ) + { + sal_uInt16 nLng = ((SvxLanguageItem&)rSet.GetPool()->GetDefaultItem( + aArr[n].nResLngId )).GetLanguage(); + Font aFnt( OutputDevice::GetDefaultFont( nFntType, + nLng, DEFAULTFONT_FLAGS_ONLYONE ) ); + + rSet.Put( SvxFontItem( aFnt.GetFamily(), aFnt.GetName(), + OUString(), aFnt.GetPitch(), + aFnt.GetCharSet(), aArr[n].nResFntId )); + } + } + + static void lcl_SetDfltFont( sal_uInt16 nLatinFntType, sal_uInt16 nCJKFntType, + sal_uInt16 nCTLFntType, SfxItemSet& rSet ) + { + static struct { + sal_uInt16 nResLngId; + sal_uInt16 nResFntId; + sal_uInt16 nFntType; + } aArr[ 3 ] = { + { RES_CHRATR_LANGUAGE, RES_CHRATR_FONT, 0 }, + { RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CJK_FONT, 0 }, + { RES_CHRATR_CTL_LANGUAGE, RES_CHRATR_CTL_FONT, 0 } + }; + aArr[0].nFntType = nLatinFntType; + aArr[1].nFntType = nCJKFntType; + aArr[2].nFntType = nCTLFntType; + + for( sal_uInt16 n = 0; n < 3; ++n ) + { + sal_uInt16 nLng = ((SvxLanguageItem&)rSet.GetPool()->GetDefaultItem( + aArr[n].nResLngId )).GetLanguage(); + Font aFnt( OutputDevice::GetDefaultFont( aArr[n].nFntType, + nLng, DEFAULTFONT_FLAGS_ONLYONE ) ); + + rSet.Put( SvxFontItem( aFnt.GetFamily(), aFnt.GetName(), + OUString(), aFnt.GetPitch(), + aFnt.GetCharSet(), aArr[n].nResFntId )); + } + } + + static void lcl_SetHeadline( SwDoc* pDoc, SwTxtFmtColl* pColl, + SfxItemSet& rSet, + sal_uInt16 nOutLvlBits, sal_uInt8 nLevel, bool bItalic ) + { + SetAllScriptItem( rSet, SvxWeightItem( WEIGHT_BOLD, RES_CHRATR_WEIGHT ) ); + SvxFontHeightItem aHItem(240, 100, RES_CHRATR_FONTSIZE); + const bool bHTMLMode = pDoc->GetDocumentSettingManager().get(IDocumentSettingAccess::HTML_MODE); + if( bHTMLMode ) + aHItem.SetHeight( aHeadlineSizes[ MAXLEVEL + nLevel ] ); + else + aHItem.SetHeight( PT_14, aHeadlineSizes[ nLevel ] ); + SetAllScriptItem( rSet, aHItem ); + + if( bItalic && !bHTMLMode ) + SetAllScriptItem( rSet, SvxPostureItem( ITALIC_NORMAL, RES_CHRATR_POSTURE ) ); + + if( bHTMLMode ) + { + lcl_SetDfltFont( DEFAULTFONT_LATIN_TEXT, DEFAULTFONT_CJK_TEXT, + DEFAULTFONT_CTL_TEXT, rSet ); + } + + if( pColl ) + { + if( !( nOutLvlBits & ( 1 << nLevel )) ) + { + pColl->AssignToListLevelOfOutlineStyle(nLevel); + if( !bHTMLMode ) + { + SwNumRule * pOutlineRule = pDoc->GetOutlineNumRule(); + const SwNumFmt& rNFmt = pOutlineRule->Get( nLevel ); + + if ( rNFmt.GetPositionAndSpaceMode() == + SvxNumberFormat::LABEL_WIDTH_AND_POSITION && + ( rNFmt.GetAbsLSpace() || rNFmt.GetFirstLineOffset() ) ) + { + SvxLRSpaceItem aLR( (SvxLRSpaceItem&)pColl->GetFmtAttr( RES_LR_SPACE ) ); + aLR.SetTxtFirstLineOfstValue( rNFmt.GetFirstLineOffset() ); + aLR.SetTxtLeft( rNFmt.GetAbsLSpace() ); + pColl->SetFmtAttr( aLR ); + } + + // #i71764# + // Check on document setting OUTLINE_LEVEL_YIELDS_OUTLINE_RULE no longer needed. + // All paragraph styles, which are assigned to a level of the + // outline style has to have the outline style set as its list style. + { + SwNumRuleItem aItem(pOutlineRule->GetName()); + + pColl->SetFmtAttr(aItem); + } + } + } + pColl->SetNextTxtFmtColl( *pDoc->getIDocumentStylePoolAccess().GetTxtCollFromPool( + RES_POOLCOLL_TEXT )); + } + } + + static void lcl_SetRegister( SwDoc* pDoc, SfxItemSet& rSet, sal_uInt16 nFact, + bool bHeader, bool bTab ) + { + SvxLRSpaceItem aLR( RES_LR_SPACE ); + sal_uInt16 nLeft = nFact ? GetMetricVal( CM_05 ) * nFact : 0; + aLR.SetTxtLeft( nLeft ); + + rSet.Put( aLR ); + if( bHeader ) + { + SetAllScriptItem( rSet, SvxWeightItem( WEIGHT_BOLD, RES_CHRATR_WEIGHT ) ); + SetAllScriptItem( rSet, SvxFontHeightItem( PT_16, 100, RES_CHRATR_FONTSIZE ) ); + } + if( bTab ) + { + long nRightMargin = lcl_GetRightMargin( *pDoc ); + SvxTabStopItem aTStops( 0, 0, SVX_TAB_ADJUST_DEFAULT, RES_PARATR_TABSTOP ); + aTStops.Insert( SvxTabStop( nRightMargin - nLeft, + SVX_TAB_ADJUST_RIGHT, + cDfltDecimalChar, '.' )); + rSet.Put( aTStops ); + } + } + + static void lcl_SetNumBul( SwDoc* pDoc, SwTxtFmtColl* pColl, + SfxItemSet& rSet, + sal_uInt16 nNxt, SwTwips nEZ, SwTwips nLeft, + SwTwips nUpper, SwTwips nLower ) + { + + SvxLRSpaceItem aLR( RES_LR_SPACE ); SvxULSpaceItem aUL( RES_UL_SPACE ); + aLR.SetTxtFirstLineOfst( sal_uInt16(nEZ) ); aLR.SetTxtLeft( sal_uInt16(nLeft) ); + aUL.SetUpper( sal_uInt16(nUpper) ); aUL.SetLower( sal_uInt16(nLower) ); + rSet.Put( aLR ); + rSet.Put( aUL ); + + if( pColl ) + pColl->SetNextTxtFmtColl( *pDoc->getIDocumentStylePoolAccess().GetTxtCollFromPool( nNxt )); + } + + static void lcl_PutStdPageSizeIntoItemSet( SwDoc* pDoc, SfxItemSet& rSet ) + { + SwPageDesc* pStdPgDsc = pDoc->getIDocumentStylePoolAccess().GetPageDescFromPool( RES_POOLPAGE_STANDARD ); + SwFmtFrmSize aFrmSz( pStdPgDsc->GetMaster().GetFrmSize() ); + if( pStdPgDsc->GetLandscape() ) + { + SwTwips nTmp = aFrmSz.GetHeight(); + aFrmSz.SetHeight( aFrmSz.GetWidth() ); + aFrmSz.SetWidth( nTmp ); + } + rSet.Put( aFrmSz ); + } +} + + +namespace sw +{ + +DocumentStylePoolManager::DocumentStylePoolManager( SwDoc& i_rSwdoc ) : m_rSwdoc( i_rSwdoc ) +{ +} + +SwTxtFmtColl* DocumentStylePoolManager::GetTxtCollFromPool( sal_uInt16 nId, bool bRegardLanguage ) +{ + OSL_ENSURE( + (RES_POOLCOLL_TEXT_BEGIN <= nId && nId < RES_POOLCOLL_TEXT_END) || + (RES_POOLCOLL_LISTS_BEGIN <= nId && nId < RES_POOLCOLL_LISTS_END) || + (RES_POOLCOLL_EXTRA_BEGIN <= nId && nId < RES_POOLCOLL_EXTRA_END) || + (RES_POOLCOLL_REGISTER_BEGIN <= nId && nId < RES_POOLCOLL_REGISTER_END) || + (RES_POOLCOLL_DOC_BEGIN <= nId && nId < RES_POOLCOLL_DOC_END) || + (RES_POOLCOLL_HTML_BEGIN <= nId && nId < RES_POOLCOLL_HTML_END), + "Wrong AutoFormat Id" ); + + SwTxtFmtColl* pNewColl; + sal_uInt16 nOutLvlBits = 0; + for( sal_uInt16 n = 0; n < m_rSwdoc.GetTxtFmtColls()->size(); ++n ) + { + if( nId == ( pNewColl = (*m_rSwdoc.GetTxtFmtColls())[ n ] )->GetPoolFmtId() ) + { + return pNewColl; + } + + if( pNewColl->IsAssignedToListLevelOfOutlineStyle()) + nOutLvlBits |= ( 1 << pNewColl->GetAssignedOutlineStyleLevel() ); + } + + // Didn't find it until here -> create anew + sal_uInt16 nResId = 0; + if( RES_POOLCOLL_TEXT_BEGIN <= nId && nId < RES_POOLCOLL_TEXT_END ) + nResId = RC_POOLCOLL_TEXT_BEGIN - RES_POOLCOLL_TEXT_BEGIN; + else if (RES_POOLCOLL_LISTS_BEGIN <= nId && nId < RES_POOLCOLL_LISTS_END) + nResId = RC_POOLCOLL_LISTS_BEGIN - RES_POOLCOLL_LISTS_BEGIN; + else if (RES_POOLCOLL_EXTRA_BEGIN <= nId && nId < RES_POOLCOLL_EXTRA_END) + nResId = RC_POOLCOLL_EXTRA_BEGIN - RES_POOLCOLL_EXTRA_BEGIN; + else if (RES_POOLCOLL_REGISTER_BEGIN <= nId && nId < RES_POOLCOLL_REGISTER_END) + nResId = RC_POOLCOLL_REGISTER_BEGIN - RES_POOLCOLL_REGISTER_BEGIN; + else if (RES_POOLCOLL_DOC_BEGIN <= nId && nId < RES_POOLCOLL_DOC_END) + nResId = RC_POOLCOLL_DOC_BEGIN - RES_POOLCOLL_DOC_BEGIN; + else if (RES_POOLCOLL_HTML_BEGIN <= nId && nId < RES_POOLCOLL_HTML_END) + nResId = RC_POOLCOLL_HTML_BEGIN - RES_POOLCOLL_HTML_BEGIN; + + OSL_ENSURE( nResId, "Invalid Pool ID" ); + if( !nResId ) + return GetTxtCollFromPool( RES_POOLCOLL_STANDARD ); + + ResId aResId( nResId + nId, *pSwResMgr ); + OUString aNm( aResId ); + + // A Set for all to-be-set Attributes + SwAttrSet aSet( m_rSwdoc.GetAttrPool(), aTxtFmtCollSetRange ); + sal_uInt16 nParent = GetPoolParent( nId ); + + { + +//FEATURE::CONDCOLL + if(::IsConditionalByPoolId( nId )) + pNewColl = new SwConditionTxtFmtColl( m_rSwdoc.GetAttrPool(), aNm, !nParent + ? m_rSwdoc.GetDfltTxtFmtColl() + : GetTxtCollFromPool( nParent )); + else +//FEATURE::CONDCOLL + pNewColl = new SwTxtFmtColl( m_rSwdoc.GetAttrPool(), aNm, !nParent + ? m_rSwdoc.GetDfltTxtFmtColl() + : GetTxtCollFromPool( nParent )); + pNewColl->SetPoolFmtId( nId ); + m_rSwdoc.GetTxtFmtColls()->push_back( pNewColl ); + } + + bool bNoDefault = m_rSwdoc.GetDocumentSettingManager().get( IDocumentSettingAccess::STYLES_NODEFAULT ); + if ( !bNoDefault ) + { + switch( nId ) + { + // General content forms + case RES_POOLCOLL_STANDARD: + /* koreans do not like SvxScriptItem(TRUE) */ + if (bRegardLanguage) + { + sal_uLong nAppLanguage = GetAppLanguage(); + if (GetDefaultFrameDirection(nAppLanguage) == + FRMDIR_HORI_RIGHT_TOP) + { + SvxAdjustItem aAdjust(SVX_ADJUST_RIGHT, RES_PARATR_ADJUST ); + aSet.Put(aAdjust); + } + if (nAppLanguage == LANGUAGE_KOREAN) + { + SvxScriptSpaceItem aScriptSpace(false, RES_PARATR_SCRIPTSPACE); + aSet.Put(aScriptSpace); + } + } + break; + + case RES_POOLCOLL_TEXT: // Text body + { + SvxLineSpacingItem aLSpc( LINE_SPACE_DEFAULT_HEIGHT, + RES_PARATR_LINESPACING ); + SvxULSpaceItem aUL( 0, PT_7, RES_UL_SPACE ); + aLSpc.SetPropLineSpace( (const sal_uInt8) 120 ); + if( m_rSwdoc.GetDocumentSettingManager().get(IDocumentSettingAccess::HTML_MODE) ) aUL.SetLower( HTML_PARSPACE ); + aSet.Put( aUL ); + aSet.Put( aLSpc ); + } + break; + case RES_POOLCOLL_TEXT_IDENT: // Text body indentation + { + SvxLRSpaceItem aLR( RES_LR_SPACE ); + aLR.SetTxtFirstLineOfst( GetMetricVal( CM_05 )); + aSet.Put( aLR ); + } + break; + case RES_POOLCOLL_TEXT_NEGIDENT: // Text body neg. indentation + { + SvxLRSpaceItem aLR( RES_LR_SPACE ); + aLR.SetTxtFirstLineOfst( -(short)GetMetricVal( CM_05 )); + aLR.SetTxtLeft( GetMetricVal( CM_1 )); + SvxTabStopItem aTStops(RES_PARATR_TABSTOP); aTStops.Insert( SvxTabStop( 0 )); + + aSet.Put( aLR ); + aSet.Put( aTStops ); + } + break; + case RES_POOLCOLL_TEXT_MOVE: // Text body move + { + SvxLRSpaceItem aLR( RES_LR_SPACE ); + aLR.SetTxtLeft( GetMetricVal( CM_05 )); + aSet.Put( aLR ); + } + break; + + case RES_POOLCOLL_CONFRONTATION: // Text body confrontation + { + SvxLRSpaceItem aLR( RES_LR_SPACE ); + aLR.SetTxtFirstLineOfst( - short( GetMetricVal( CM_1 ) * 4 + + GetMetricVal( CM_05)) ); + aLR.SetTxtLeft( GetMetricVal( CM_1 ) * 5 ); + SvxTabStopItem aTStops( RES_PARATR_TABSTOP ); aTStops.Insert( SvxTabStop( 0 )); + + aSet.Put( aLR ); + aSet.Put( aTStops ); + } + break; + case RES_POOLCOLL_MARGINAL: // Text body marginal + { + SvxLRSpaceItem aLR( RES_LR_SPACE ); + aLR.SetTxtLeft( GetMetricVal( CM_1 ) * 4 ); + aSet.Put( aLR ); + } + break; + + case RES_POOLCOLL_HEADLINE_BASE: // Base headline + { + static const sal_uInt16 aFntInit[] = { + DEFAULTFONT_LATIN_HEADING, RES_CHRATR_FONT, + RES_CHRATR_LANGUAGE, LANGUAGE_ENGLISH_US, + DEFAULTFONT_CJK_HEADING, RES_CHRATR_CJK_FONT, + RES_CHRATR_CJK_LANGUAGE, LANGUAGE_ENGLISH_US, + DEFAULTFONT_CTL_HEADING, RES_CHRATR_CTL_FONT, + RES_CHRATR_CTL_LANGUAGE, LANGUAGE_ARABIC_SAUDI_ARABIA, + 0 + }; + + for( const sal_uInt16* pArr = aFntInit; *pArr; pArr += 4 ) + { + sal_uInt16 nLng = ((SvxLanguageItem&)m_rSwdoc.GetDefault( *(pArr+2) )).GetLanguage(); + if( LANGUAGE_DONTKNOW == nLng ) + nLng = *(pArr+3); + + Font aFnt( OutputDevice::GetDefaultFont( *pArr, + nLng, DEFAULTFONT_FLAGS_ONLYONE ) ); + + aSet.Put( SvxFontItem( aFnt.GetFamily(), aFnt.GetName(), + OUString(), aFnt.GetPitch(), + aFnt.GetCharSet(), *(pArr+1) )); + } + + SvxFontHeightItem aFntSize( PT_14, 100, RES_CHRATR_FONTSIZE ); + SvxULSpaceItem aUL( PT_12, PT_6, RES_UL_SPACE ); + if( m_rSwdoc.GetDocumentSettingManager().get(IDocumentSettingAccess::HTML_MODE) ) + aUL.SetLower( HTML_PARSPACE ); + aSet.Put( SvxFmtKeepItem( true, RES_KEEP )); + + pNewColl->SetNextTxtFmtColl( *GetTxtCollFromPool( RES_POOLCOLL_TEXT )); + + aSet.Put( aUL ); + SetAllScriptItem( aSet, aFntSize ); + } + break; + + case RES_POOLCOLL_NUMBUL_BASE: // Base Numbering + break; + + case RES_POOLCOLL_GREETING: // Greeting + case RES_POOLCOLL_REGISTER_BASE: // Base indexes + case RES_POOLCOLL_SIGNATURE: // Signatures + case RES_POOLCOLL_TABLE: // Tabele content + { + SwFmtLineNumber aLN; aLN.SetCountLines( false ); + aSet.Put( aLN ); + } + break; + + case RES_POOLCOLL_HEADLINE1: // Headinline 1 + { + SvxULSpaceItem aUL( PT_12, PT_6, RES_UL_SPACE ); + aSet.Put( aUL ); + lcl_SetHeadline( &m_rSwdoc, pNewColl, aSet, nOutLvlBits, 0, false ); + } + break; + case RES_POOLCOLL_HEADLINE2: // Headinline 2 + { + SvxULSpaceItem aUL( PT_10, PT_6, RES_UL_SPACE ); + aSet.Put( aUL ); + lcl_SetHeadline( &m_rSwdoc, pNewColl, aSet, nOutLvlBits, 1, false ); + } + break; + case RES_POOLCOLL_HEADLINE3: // Headinline 3 + { + SvxULSpaceItem aUL( PT_7, PT_6, RES_UL_SPACE ); + Color aCol( COL_GRAY ); + aSet.Put( aUL ); + aSet.Put( SvxColorItem ( aCol, RES_CHRATR_COLOR ) ); + lcl_SetHeadline( &m_rSwdoc, pNewColl, aSet, nOutLvlBits, 2, false ); + } + break; + case RES_POOLCOLL_HEADLINE4: // Headinline 4 + { + SvxULSpaceItem aUL( PT_6, PT_6, RES_UL_SPACE ); + Color aCol( COL_GRAY ); + aSet.Put( aUL ); + aSet.Put( SvxColorItem ( aCol, RES_CHRATR_COLOR ) ); + lcl_SetHeadline( &m_rSwdoc, pNewColl, aSet, nOutLvlBits, 3, true ); + } + break; + case RES_POOLCOLL_HEADLINE5: // Headinline 5 + { + SvxULSpaceItem aUL( PT_6, PT_3, RES_UL_SPACE ); + aSet.Put( aUL ); + lcl_SetHeadline( &m_rSwdoc, pNewColl, aSet, nOutLvlBits, 4, false ); + } + break; + case RES_POOLCOLL_HEADLINE6: // Headinline 6 + { + SvxULSpaceItem aUL( PT_3, PT_3, RES_UL_SPACE ); + aSet.Put( aUL ); + lcl_SetHeadline( &m_rSwdoc, pNewColl, aSet, nOutLvlBits, 5, true ); + } + break; + case RES_POOLCOLL_HEADLINE7: // Headinline 7 + { + SvxULSpaceItem aUL( PT_3, PT_3, RES_UL_SPACE ); + aSet.Put( aUL ); + lcl_SetHeadline( &m_rSwdoc, pNewColl, aSet, nOutLvlBits, 6, false ); + } + break; + case RES_POOLCOLL_HEADLINE8: // Headinline 8 + { + SvxULSpaceItem aUL( PT_3, PT_3, RES_UL_SPACE ); + aSet.Put( aUL ); + lcl_SetHeadline( &m_rSwdoc, pNewColl, aSet, nOutLvlBits, 7, true ); + } + break; + case RES_POOLCOLL_HEADLINE9: // Headinline 9 + { + SvxULSpaceItem aUL( PT_3, PT_3, RES_UL_SPACE ); + aSet.Put( aUL ); + lcl_SetHeadline( &m_rSwdoc, pNewColl, aSet, nOutLvlBits, 8, false ); + } + break; + case RES_POOLCOLL_HEADLINE10: // Headinline 10 + { + SvxULSpaceItem aUL( PT_3, PT_3, RES_UL_SPACE ); + aSet.Put( aUL ); + lcl_SetHeadline( &m_rSwdoc, pNewColl, aSet, nOutLvlBits, 9, false ); + } + break; + + // Special sections: + // Header + case RES_POOLCOLL_HEADER: + case RES_POOLCOLL_HEADERL: + case RES_POOLCOLL_HEADERR: + // Footer + case RES_POOLCOLL_FOOTER: + case RES_POOLCOLL_FOOTERL: + case RES_POOLCOLL_FOOTERR: + { + SwFmtLineNumber aLN; aLN.SetCountLines( false ); + aSet.Put( aLN ); + + long nRightMargin = lcl_GetRightMargin( m_rSwdoc ); + + SvxTabStopItem aTStops( 0, 0, SVX_TAB_ADJUST_DEFAULT, RES_PARATR_TABSTOP ); + aTStops.Insert( SvxTabStop( nRightMargin / 2, SVX_TAB_ADJUST_CENTER ) ); + aTStops.Insert( SvxTabStop( nRightMargin, SVX_TAB_ADJUST_RIGHT ) ); + + aSet.Put( aTStops ); + } + break; + + case RES_POOLCOLL_TABLE_HDLN: + { + SetAllScriptItem( aSet, SvxWeightItem( WEIGHT_BOLD, RES_CHRATR_WEIGHT ) ); + aSet.Put( SvxAdjustItem( SVX_ADJUST_CENTER, RES_PARATR_ADJUST ) ); + SwFmtLineNumber aLN; aLN.SetCountLines( false ); + aSet.Put( aLN ); + } + break; + + case RES_POOLCOLL_FOOTNOTE: // paragraph style Footnote + case RES_POOLCOLL_ENDNOTE: // paragraph style Endnote + { + SvxLRSpaceItem aLR( RES_LR_SPACE ); + aLR.SetTxtFirstLineOfst( -(short)( GetMetricVal( CM_05 ) + GetMetricVal( CM_01 ) ) ); + aLR.SetTxtLeft( GetMetricVal( CM_05 ) + GetMetricVal( CM_01 ) ); + SetAllScriptItem( aSet, SvxFontHeightItem( PT_10, 100, RES_CHRATR_FONTSIZE ) ); + aSet.Put( aLR ); + SwFmtLineNumber aLN; aLN.SetCountLines( false ); + aSet.Put( aLN ); + } + break; + + case RES_POOLCOLL_LABEL: // basic caption + { + SvxULSpaceItem aUL( RES_UL_SPACE ); aUL.SetUpper( PT_6 ); aUL.SetLower( PT_6 ); + aSet.Put( aUL ); + SetAllScriptItem( aSet, SvxPostureItem( ITALIC_NORMAL, RES_CHRATR_POSTURE ) ); + SetAllScriptItem( aSet, SvxFontHeightItem( PT_10, 100, RES_CHRATR_FONTSIZE ) ); + SwFmtLineNumber aLN; aLN.SetCountLines( false ); + aSet.Put( aLN ); + } + break; + + case RES_POOLCOLL_FRAME: // Frame content + case RES_POOLCOLL_LABEL_ABB: // caption image + case RES_POOLCOLL_LABEL_TABLE: // caption table + case RES_POOLCOLL_LABEL_FRAME: // caption frame + case RES_POOLCOLL_LABEL_DRAWING: // caption drawing + break; + + case RES_POOLCOLL_JAKETADRESS: // envelope address + { + SvxULSpaceItem aUL( RES_UL_SPACE ); aUL.SetLower( PT_3 ); + aSet.Put( aUL ); + SwFmtLineNumber aLN; aLN.SetCountLines( false ); + aSet.Put( aLN ); + } + break; + + case RES_POOLCOLL_SENDADRESS: // Sender address + { + if( m_rSwdoc.GetDocumentSettingManager().get(IDocumentSettingAccess::HTML_MODE) ) + SetAllScriptItem( aSet, SvxPostureItem(ITALIC_NORMAL, RES_CHRATR_POSTURE) ); + else + { + SvxULSpaceItem aUL( RES_UL_SPACE ); aUL.SetLower( PT_3 ); + aSet.Put( aUL ); + } + SwFmtLineNumber aLN; aLN.SetCountLines( false ); + aSet.Put( aLN ); + } + break; + + // User defined indexes: + case RES_POOLCOLL_TOX_USERH: // Header + lcl_SetRegister( &m_rSwdoc, aSet, 0, true, false ); + { + SwFmtLineNumber aLN; aLN.SetCountLines( false ); + aSet.Put( aLN ); + } + break; + case RES_POOLCOLL_TOX_USER1: // 1. Level + lcl_SetRegister( &m_rSwdoc, aSet, 0, false, true ); + break; + case RES_POOLCOLL_TOX_USER2: // 2. Level + lcl_SetRegister( &m_rSwdoc, aSet, 1, false, true ); + break; + case RES_POOLCOLL_TOX_USER3: // 3. Level + lcl_SetRegister( &m_rSwdoc, aSet, 2, false, true ); + break; + case RES_POOLCOLL_TOX_USER4: // 4. Level + lcl_SetRegister( &m_rSwdoc, aSet, 3, false, true ); + break; + case RES_POOLCOLL_TOX_USER5: // 5. Level + lcl_SetRegister( &m_rSwdoc, aSet, 4, false, true ); + break; + case RES_POOLCOLL_TOX_USER6: // 6. Level + lcl_SetRegister( &m_rSwdoc, aSet, 5, false, true ); + break; + case RES_POOLCOLL_TOX_USER7: // 7. Level + lcl_SetRegister( &m_rSwdoc, aSet, 6, false, true ); + break; + case RES_POOLCOLL_TOX_USER8: // 8. Level + lcl_SetRegister( &m_rSwdoc, aSet, 7, false, true ); + break; + case RES_POOLCOLL_TOX_USER9: // 9. Level + lcl_SetRegister( &m_rSwdoc, aSet, 8, false, true ); + break; + case RES_POOLCOLL_TOX_USER10: // 10. Level + lcl_SetRegister( &m_rSwdoc, aSet, 9, false, true ); + break; + + // Index + case RES_POOLCOLL_TOX_IDXH: // Header + lcl_SetRegister( &m_rSwdoc, aSet, 0, true, false ); + { + SwFmtLineNumber aLN; aLN.SetCountLines( false ); + aSet.Put( aLN ); + } + break; + case RES_POOLCOLL_TOX_IDX1: // 1. Level + lcl_SetRegister( &m_rSwdoc, aSet, 0, false, false ); + break; + case RES_POOLCOLL_TOX_IDX2: // 2. Level + lcl_SetRegister( &m_rSwdoc, aSet, 1, false, false ); + break; + case RES_POOLCOLL_TOX_IDX3: // 3. Level + lcl_SetRegister( &m_rSwdoc, aSet, 2, false, false ); + break; + case RES_POOLCOLL_TOX_IDXBREAK: // Trenner + lcl_SetRegister( &m_rSwdoc, aSet, 0, false, false ); + break; + + // Table of Content + case RES_POOLCOLL_TOX_CNTNTH: // Header + lcl_SetRegister( &m_rSwdoc, aSet, 0, true, false ); + { + SwFmtLineNumber aLN; aLN.SetCountLines( false ); + aSet.Put( aLN ); + } + break; + case RES_POOLCOLL_TOX_CNTNT1: // 1. Level + lcl_SetRegister( &m_rSwdoc, aSet, 0, false, true ); + break; + case RES_POOLCOLL_TOX_CNTNT2: // 2. Level + lcl_SetRegister( &m_rSwdoc, aSet, 1, false, true ); + break; + case RES_POOLCOLL_TOX_CNTNT3: // 3. Level + lcl_SetRegister( &m_rSwdoc, aSet, 2, false, true ); + break; + case RES_POOLCOLL_TOX_CNTNT4: // 4. Level + lcl_SetRegister( &m_rSwdoc, aSet, 3, false, true ); + break; + case RES_POOLCOLL_TOX_CNTNT5: // 5. Level + lcl_SetRegister( &m_rSwdoc, aSet, 4, false, true ); + break; + case RES_POOLCOLL_TOX_CNTNT6: // 6. Level + lcl_SetRegister( &m_rSwdoc, aSet, 5, false, true ); + break; + case RES_POOLCOLL_TOX_CNTNT7: // 7. Level + lcl_SetRegister( &m_rSwdoc, aSet, 6, false, true ); + break; + case RES_POOLCOLL_TOX_CNTNT8: // 8. Level + lcl_SetRegister( &m_rSwdoc, aSet, 7, false, true ); + break; + case RES_POOLCOLL_TOX_CNTNT9: // 9. Level + lcl_SetRegister( &m_rSwdoc, aSet, 8, false, true ); + break; + case RES_POOLCOLL_TOX_CNTNT10: // 10. Level + lcl_SetRegister( &m_rSwdoc, aSet, 9, false, true ); + break; + + case RES_POOLCOLL_TOX_ILLUSH: + case RES_POOLCOLL_TOX_OBJECTH: + case RES_POOLCOLL_TOX_TABLESH: + case RES_POOLCOLL_TOX_AUTHORITIESH: + lcl_SetRegister( &m_rSwdoc, aSet, 0, true, false ); + { + SwFmtLineNumber aLN; aLN.SetCountLines( false ); + aSet.Put( aLN ); + } + break; + case RES_POOLCOLL_TOX_ILLUS1: + case RES_POOLCOLL_TOX_OBJECT1: + case RES_POOLCOLL_TOX_TABLES1: + case RES_POOLCOLL_TOX_AUTHORITIES1: + lcl_SetRegister( &m_rSwdoc, aSet, 0, false, true ); + break; + + case RES_POOLCOLL_NUM_LEVEL1S: + lcl_SetNumBul( &m_rSwdoc, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL1, + lNumFirstLineOffset, SwNumRule::GetNumIndent( 0 ), + PT_12, PT_6 ); + break; + case RES_POOLCOLL_NUM_LEVEL1: + lcl_SetNumBul( &m_rSwdoc, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL1, + lNumFirstLineOffset, SwNumRule::GetNumIndent( 0 ), + 0, PT_6 ); + break; + case RES_POOLCOLL_NUM_LEVEL1E: + lcl_SetNumBul( &m_rSwdoc, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL1, + lNumFirstLineOffset, SwNumRule::GetNumIndent( 0 ), + 0, PT_12 ); + break; + case RES_POOLCOLL_NUM_NONUM1: + lcl_SetNumBul( &m_rSwdoc, pNewColl, aSet, RES_POOLCOLL_NUM_NONUM1, + 0, SwNumRule::GetNumIndent( 0 ), 0, PT_6 ); + break; + case RES_POOLCOLL_NUM_LEVEL2S: + lcl_SetNumBul( &m_rSwdoc, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL2, + lNumFirstLineOffset, SwNumRule::GetNumIndent( 1 ), + PT_12, PT_6 ); + break; + case RES_POOLCOLL_NUM_LEVEL2: + lcl_SetNumBul( &m_rSwdoc, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL2, + lNumFirstLineOffset, SwNumRule::GetNumIndent( 1 ), + 0, PT_6 ); + break; + case RES_POOLCOLL_NUM_LEVEL2E: + lcl_SetNumBul( &m_rSwdoc, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL2, + lNumFirstLineOffset, SwNumRule::GetNumIndent( 1 ), + 0, PT_12 ); + break; + case RES_POOLCOLL_NUM_NONUM2: + lcl_SetNumBul( &m_rSwdoc, pNewColl, aSet, RES_POOLCOLL_NUM_NONUM2, + 0, SwNumRule::GetNumIndent( 1 ), 0, PT_6 ); + break; + case RES_POOLCOLL_NUM_LEVEL3S: + lcl_SetNumBul( &m_rSwdoc, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL3, + lNumFirstLineOffset, SwNumRule::GetNumIndent( 2 ), + PT_12, PT_6 ); + break; + case RES_POOLCOLL_NUM_LEVEL3: + lcl_SetNumBul( &m_rSwdoc, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL3, + lNumFirstLineOffset, SwNumRule::GetNumIndent( 2 ), + 0, PT_6 ); + break; + case RES_POOLCOLL_NUM_LEVEL3E: + lcl_SetNumBul( &m_rSwdoc, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL3, + lNumFirstLineOffset, SwNumRule::GetNumIndent( 2 ), + 0, PT_12 ); + break; + case RES_POOLCOLL_NUM_NONUM3: + lcl_SetNumBul( &m_rSwdoc, pNewColl, aSet, RES_POOLCOLL_NUM_NONUM3, + 0, SwNumRule::GetNumIndent( 2 ), 0, PT_6 ); + break; + case RES_POOLCOLL_NUM_LEVEL4S: + lcl_SetNumBul( &m_rSwdoc, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL4, + lNumFirstLineOffset, SwNumRule::GetNumIndent( 3 ), + PT_12, PT_6 ); + break; + case RES_POOLCOLL_NUM_LEVEL4: + lcl_SetNumBul( &m_rSwdoc, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL4, + lNumFirstLineOffset, SwNumRule::GetNumIndent( 3 ), + 0, PT_6 ); + break; + case RES_POOLCOLL_NUM_LEVEL4E: + lcl_SetNumBul( &m_rSwdoc, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL4, + lNumFirstLineOffset, SwNumRule::GetNumIndent( 3 ), + 0, PT_12 ); + break; + case RES_POOLCOLL_NUM_NONUM4: + lcl_SetNumBul( &m_rSwdoc, pNewColl, aSet, RES_POOLCOLL_NUM_NONUM4, + 0, SwNumRule::GetNumIndent( 3 ), 0, PT_6 ); + break; + case RES_POOLCOLL_NUM_LEVEL5S: + lcl_SetNumBul( &m_rSwdoc, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL5, + lNumFirstLineOffset, SwNumRule::GetNumIndent( 4 ), + PT_12, PT_6 ); + break; + case RES_POOLCOLL_NUM_LEVEL5: + lcl_SetNumBul( &m_rSwdoc, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL5, + lNumFirstLineOffset, SwNumRule::GetNumIndent( 4 ), + 0, PT_6 ); + break; + case RES_POOLCOLL_NUM_LEVEL5E: + lcl_SetNumBul( &m_rSwdoc, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL5, + lNumFirstLineOffset, SwNumRule::GetNumIndent( 4 ), + 0, PT_12 ); + break; + case RES_POOLCOLL_NUM_NONUM5: + lcl_SetNumBul( &m_rSwdoc, pNewColl, aSet, RES_POOLCOLL_NUM_NONUM5, + 0, SwNumRule::GetNumIndent( 4 ), 0, PT_6 ); + break; + + case RES_POOLCOLL_BUL_LEVEL1S: + lcl_SetNumBul( &m_rSwdoc, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL1, + lBullFirstLineOffset, SwNumRule::GetBullIndent( 0 ), + PT_12, PT_6 ); + break; + case RES_POOLCOLL_BUL_LEVEL1: + lcl_SetNumBul( &m_rSwdoc, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL1, + lBullFirstLineOffset, SwNumRule::GetBullIndent( 0 ), + 0, PT_6 ); + break; + case RES_POOLCOLL_BUL_LEVEL1E: + lcl_SetNumBul( &m_rSwdoc, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL1, + lBullFirstLineOffset, SwNumRule::GetBullIndent( 0 ), + 0, PT_12 ); + break; + case RES_POOLCOLL_BUL_NONUM1: + lcl_SetNumBul( &m_rSwdoc, pNewColl, aSet, RES_POOLCOLL_BUL_NONUM1, + 0, SwNumRule::GetBullIndent( 0 ), 0, PT_6 ); + break; + case RES_POOLCOLL_BUL_LEVEL2S: + lcl_SetNumBul( &m_rSwdoc, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL2, + lBullFirstLineOffset, SwNumRule::GetBullIndent( 1 ), + PT_12, PT_6 ); + break; + case RES_POOLCOLL_BUL_LEVEL2: + lcl_SetNumBul( &m_rSwdoc, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL2, + lBullFirstLineOffset, SwNumRule::GetBullIndent( 1 ), + 0, PT_6 ); + break; + case RES_POOLCOLL_BUL_LEVEL2E: + lcl_SetNumBul( &m_rSwdoc, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL2, + lBullFirstLineOffset, SwNumRule::GetBullIndent( 1 ), + 0, PT_12 ); + break; + case RES_POOLCOLL_BUL_NONUM2: + lcl_SetNumBul( &m_rSwdoc, pNewColl, aSet, RES_POOLCOLL_BUL_NONUM2, + 0, SwNumRule::GetBullIndent( 1 ), 0, PT_6 ); + break; + case RES_POOLCOLL_BUL_LEVEL3S: + lcl_SetNumBul( &m_rSwdoc, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL3, + lBullFirstLineOffset, SwNumRule::GetBullIndent( 2 ), + PT_12, PT_6 ); + break; + case RES_POOLCOLL_BUL_LEVEL3: + lcl_SetNumBul( &m_rSwdoc, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL3, + lBullFirstLineOffset, SwNumRule::GetBullIndent( 2 ), + 0, PT_6 ); + break; + case RES_POOLCOLL_BUL_LEVEL3E: + lcl_SetNumBul( &m_rSwdoc, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL3, + lBullFirstLineOffset, SwNumRule::GetBullIndent( 2 ), + 0, PT_12 ); + break; + case RES_POOLCOLL_BUL_NONUM3: + lcl_SetNumBul( &m_rSwdoc, pNewColl, aSet, RES_POOLCOLL_BUL_NONUM3, + 0, SwNumRule::GetBullIndent( 2 ), 0, PT_6 ); + break; + case RES_POOLCOLL_BUL_LEVEL4S: + lcl_SetNumBul( &m_rSwdoc, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL4, + lBullFirstLineOffset, SwNumRule::GetBullIndent( 3 ), + PT_12, PT_6 ); + break; + case RES_POOLCOLL_BUL_LEVEL4: + lcl_SetNumBul( &m_rSwdoc, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL4, + lBullFirstLineOffset, SwNumRule::GetBullIndent( 3 ), + 0, PT_6 ); + break; + case RES_POOLCOLL_BUL_LEVEL4E: + lcl_SetNumBul( &m_rSwdoc, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL4, + lBullFirstLineOffset, SwNumRule::GetBullIndent( 3 ), + 0, PT_12 ); + break; + case RES_POOLCOLL_BUL_NONUM4: + lcl_SetNumBul( &m_rSwdoc, pNewColl, aSet, RES_POOLCOLL_BUL_NONUM4, + 0, SwNumRule::GetBullIndent( 3 ), 0, PT_6 ); + break; + case RES_POOLCOLL_BUL_LEVEL5S: + lcl_SetNumBul( &m_rSwdoc, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL5, + lBullFirstLineOffset, SwNumRule::GetBullIndent( 4 ), + PT_12, PT_6 ); + break; + case RES_POOLCOLL_BUL_LEVEL5: + lcl_SetNumBul( &m_rSwdoc, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL5, + lBullFirstLineOffset, SwNumRule::GetBullIndent( 4 ), + 0, PT_6 ); + break; + case RES_POOLCOLL_BUL_LEVEL5E: + lcl_SetNumBul( &m_rSwdoc, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL5, + lBullFirstLineOffset, SwNumRule::GetBullIndent( 4 ), + 0, PT_12 ); + break; + case RES_POOLCOLL_BUL_NONUM5: + lcl_SetNumBul( &m_rSwdoc, pNewColl, aSet, RES_POOLCOLL_BUL_NONUM5, + 0, SwNumRule::GetBullIndent( 4 ), 0, PT_6 ); + break; + + case RES_POOLCOLL_DOC_TITEL: // Document Title + { + SetAllScriptItem( aSet, SvxWeightItem( WEIGHT_BOLD, RES_CHRATR_WEIGHT ) ); + SetAllScriptItem( aSet, SvxFontHeightItem( PT_28, 100, RES_CHRATR_FONTSIZE ) ); + + aSet.Put( SvxAdjustItem( SVX_ADJUST_CENTER, RES_PARATR_ADJUST ) ); + + pNewColl->SetNextTxtFmtColl( *GetTxtCollFromPool( RES_POOLCOLL_TEXT )); + } + break; + + case RES_POOLCOLL_DOC_SUBTITEL: // Document subtitle + { + SvxULSpaceItem aUL( PT_3, PT_6, RES_UL_SPACE ); + aSet.Put( aUL ); + SetAllScriptItem( aSet, SvxFontHeightItem( PT_18, 100, RES_CHRATR_FONTSIZE )); + + aSet.Put( SvxAdjustItem( SVX_ADJUST_CENTER, RES_PARATR_ADJUST )); + + pNewColl->SetNextTxtFmtColl( *GetTxtCollFromPool( + RES_POOLCOLL_TEXT )); + } + break; + + case RES_POOLCOLL_HTML_BLOCKQUOTE: + { + SvxLRSpaceItem aLR( RES_LR_SPACE ); + aLR.SetLeft( GetMetricVal( CM_1 )); + aLR.SetRight( GetMetricVal( CM_1 )); + aSet.Put( aLR ); + SvxULSpaceItem aUL( RES_UL_SPACE ); + aUL = pNewColl->GetULSpace(); + aUL.SetLower( HTML_PARSPACE ); + aSet.Put( aUL); + } + break; + + case RES_POOLCOLL_HTML_PRE: + { + ::lcl_SetDfltFont( DEFAULTFONT_FIXED, aSet ); + + // WORKAROUND: Set PRE to 10pt + SetAllScriptItem( aSet, SvxFontHeightItem(PT_10, 100, RES_CHRATR_FONTSIZE) ); + + // The lower paragraph distance is set explicitly (makes + // assigning hard attributes easier) + SvxULSpaceItem aULSpaceItem( RES_UL_SPACE ); + aULSpaceItem = pNewColl->GetULSpace(); + aULSpaceItem.SetLower( 0 ); + aSet.Put( aULSpaceItem ); + } + break; + + case RES_POOLCOLL_HTML_HR: + { + SvxBoxItem aBox( RES_BOX ); + Color aColor( COL_GRAY ); + SvxBorderLine aNew(&aColor, 1, table::BorderLineStyle::DOUBLE); + aBox.SetLine( &aNew, BOX_LINE_BOTTOM ); + + aSet.Put( aBox ); + aSet.Put( SwParaConnectBorderItem( false ) ); + SetAllScriptItem( aSet, SvxFontHeightItem(120, 100, RES_CHRATR_FONTSIZE) ); + + SvxULSpaceItem aUL( RES_UL_SPACE ); + { + pNewColl->SetNextTxtFmtColl( *GetTxtCollFromPool( + RES_POOLCOLL_TEXT )); + aUL = pNewColl->GetULSpace(); + } + aUL.SetLower( HTML_PARSPACE ); + aSet.Put( aUL); + SwFmtLineNumber aLN; aLN.SetCountLines( false ); + aSet.Put( aLN ); + } + break; + + case RES_POOLCOLL_HTML_DD: + { + SvxLRSpaceItem aLR( RES_LR_SPACE ); + aLR = pNewColl->GetLRSpace(); + // We indent by 1 cm. The IDs are always 2 away from each other! + aLR.SetLeft( GetMetricVal( CM_1 )); + aSet.Put( aLR ); + } + break; + case RES_POOLCOLL_HTML_DT: + { + SvxLRSpaceItem aLR( RES_LR_SPACE ); + { + pNewColl->SetNextTxtFmtColl( *GetTxtCollFromPool( + RES_POOLCOLL_HTML_DD )); + aLR = pNewColl->GetLRSpace(); + } + // We indent by 0 cm. The IDs are always 2 away from each other! + aLR.SetLeft( 0 ); + aSet.Put( aLR ); + } + break; + } + } + + if( aSet.Count() ) + { + { + pNewColl->SetFmtAttr( aSet ); + } + } + return pNewColl; +} + +/// Return the AutomaticFormat with the supplied Id. If it doesn't +/// exist, create it. +SwFmt* DocumentStylePoolManager::GetFmtFromPool( sal_uInt16 nId ) +{ + SwFmt *pNewFmt = 0; + SwFmt *pDeriveFmt = 0; + + SwFmtsBase* pArray[ 2 ]; + sal_uInt16 nArrCnt = 1, nRCId = 0; + sal_uInt16* pWhichRange = 0; + + switch( nId & (COLL_GET_RANGE_BITS + POOLGRP_NOCOLLID) ) + { + case POOLGRP_CHARFMT: + { + pArray[0] = m_rSwdoc.GetCharFmts(); + pDeriveFmt = m_rSwdoc.GetDfltCharFmt(); + + if( nId > RES_POOLCHR_NORMAL_END ) + nRCId = RC_POOLCHRFMT_HTML_BEGIN - RES_POOLCHR_HTML_BEGIN; + else + nRCId = RC_POOLCHRFMT_BEGIN - RES_POOLCHR_BEGIN; + pWhichRange = aCharFmtSetRange; + + // Fault: unknown Format, but a CharFormat + // -> return the first one + if( RES_POOLCHR_BEGIN > nId || nId >= RES_POOLCHR_END ) + { + OSL_ENSURE( false, "invalid Id" ); + nId = RES_POOLCHR_BEGIN; + } + } + break; + case POOLGRP_FRAMEFMT: + { + pArray[0] = m_rSwdoc.GetFrmFmts(); + pArray[1] = m_rSwdoc.GetSpzFrmFmts(); + pDeriveFmt = m_rSwdoc.GetDfltFrmFmt(); + nArrCnt = 2; + nRCId = RC_POOLFRMFMT_BEGIN - RES_POOLFRM_BEGIN; + pWhichRange = aFrmFmtSetRange; + + // Fault: unknown Format, but a FrameFormat + // -> return the first one + if( RES_POOLFRM_BEGIN > nId || nId >= RES_POOLFRM_END ) + { + OSL_ENSURE( false, "invalid Id" ); + nId = RES_POOLFRM_BEGIN; + } + } + break; + + default: + // Fault, unknown Format + OSL_ENSURE( nId, "invalid Id" ); + return 0; + } + OSL_ENSURE( nRCId, "invalid Id" ); + + while( nArrCnt-- ) + for( sal_uInt16 n = 0; n < (*pArray[nArrCnt]).GetFmtCount(); ++n ) + if( nId == ( pNewFmt = (*pArray[ nArrCnt ] ).GetFmt( n ) )-> + GetPoolFmtId() ) + { + return pNewFmt; + } + + ResId aResId( nRCId + nId, *pSwResMgr ); + OUString aNm( aResId ); + SwAttrSet aSet( m_rSwdoc.GetAttrPool(), pWhichRange ); + + { + bool bIsModified = m_rSwdoc.getIDocumentState().IsModified(); + + { + ::sw::UndoGuard const undoGuard(m_rSwdoc.GetIDocumentUndoRedo()); + switch (nId & (COLL_GET_RANGE_BITS + POOLGRP_NOCOLLID) ) + { + case POOLGRP_CHARFMT: + pNewFmt = m_rSwdoc._MakeCharFmt(aNm, pDeriveFmt, false, true); + break; + case POOLGRP_FRAMEFMT: + pNewFmt = m_rSwdoc._MakeFrmFmt(aNm, pDeriveFmt, false, true); + break; + default: + break; + } + } + + if( !bIsModified ) + m_rSwdoc.getIDocumentState().ResetModified(); + pNewFmt->SetPoolFmtId( nId ); + pNewFmt->SetAuto( false ); // no AutoFormat + } + + switch( nId ) + { + case RES_POOLCHR_FOOTNOTE: // Footnote + case RES_POOLCHR_PAGENO: // Page/Field + case RES_POOLCHR_LABEL: // Label + case RES_POOLCHR_DROPCAPS: // Dropcaps + case RES_POOLCHR_NUM_LEVEL: // Numbering level + case RES_POOLCHR_TOXJUMP: // Table of contents jump + case RES_POOLCHR_ENDNOTE: // Endnote + case RES_POOLCHR_LINENUM: // Line numbering + break; + + case RES_POOLCHR_ENDNOTE_ANCHOR: // Endnote anchor + case RES_POOLCHR_FOOTNOTE_ANCHOR: // Footnote anchor + { + aSet.Put( SvxEscapementItem( DFLT_ESC_AUTO_SUPER, 58, RES_CHRATR_ESCAPEMENT ) ); + } + break; + + case RES_POOLCHR_BUL_LEVEL: // Bullet character + { + const Font& rBulletFont = numfunc::GetDefBulletFont(); + SetAllScriptItem( aSet, SvxFontItem( rBulletFont.GetFamily(), + rBulletFont.GetName(), rBulletFont.GetStyleName(), + rBulletFont.GetPitch(), rBulletFont.GetCharSet(), RES_CHRATR_FONT )); + } + break; + + case RES_POOLCHR_INET_NORMAL: + { + Color aCol( COL_BLUE ); + aSet.Put( SvxColorItem( aCol, RES_CHRATR_COLOR ) ); + aSet.Put( SvxUnderlineItem( UNDERLINE_SINGLE, RES_CHRATR_UNDERLINE ) ); + // i40133: patch submitted by rail: set language to 'none' to prevent spell checking: + aSet.Put( SvxLanguageItem( LANGUAGE_NONE, RES_CHRATR_LANGUAGE ) ); + aSet.Put( SvxLanguageItem( LANGUAGE_NONE, RES_CHRATR_CJK_LANGUAGE ) ); + aSet.Put( SvxLanguageItem( LANGUAGE_NONE, RES_CHRATR_CTL_LANGUAGE ) ); + } + break; + case RES_POOLCHR_INET_VISIT: + { + Color aCol( COL_RED ); + aSet.Put( SvxColorItem( aCol, RES_CHRATR_COLOR ) ); + aSet.Put( SvxUnderlineItem( UNDERLINE_SINGLE, RES_CHRATR_UNDERLINE ) ); + aSet.Put( SvxLanguageItem( LANGUAGE_NONE, RES_CHRATR_LANGUAGE ) ); + aSet.Put( SvxLanguageItem( LANGUAGE_NONE, RES_CHRATR_CJK_LANGUAGE ) ); + aSet.Put( SvxLanguageItem( LANGUAGE_NONE, RES_CHRATR_CTL_LANGUAGE ) ); + } + break; + case RES_POOLCHR_JUMPEDIT: + { + Color aCol( COL_CYAN ); + aSet.Put( SvxColorItem( aCol, RES_CHRATR_COLOR ) ); + aSet.Put( SvxUnderlineItem( UNDERLINE_DOTTED, RES_CHRATR_UNDERLINE ) ); + aSet.Put( SvxCaseMapItem( SVX_CASEMAP_KAPITAELCHEN, RES_CHRATR_CASEMAP ) ); + } + break; + + case RES_POOLCHR_RUBYTEXT: + { + long nH = ((SvxFontHeightItem*)GetDfltAttr( + RES_CHRATR_CJK_FONTSIZE ))->GetHeight() / 2; + SetAllScriptItem( aSet, SvxFontHeightItem( nH, 100, RES_CHRATR_FONTSIZE)); + aSet.Put(SvxUnderlineItem( UNDERLINE_NONE, RES_CHRATR_UNDERLINE )); + aSet.Put(SvxEmphasisMarkItem( EMPHASISMARK_NONE, RES_CHRATR_EMPHASIS_MARK) ); + } + break; + + case RES_POOLCHR_HTML_EMPHASIS: + case RES_POOLCHR_HTML_CITIATION: + case RES_POOLCHR_HTML_VARIABLE: + { + SetAllScriptItem( aSet, SvxPostureItem( ITALIC_NORMAL, RES_CHRATR_POSTURE) ); + } + break; + + case RES_POOLCHR_IDX_MAIN_ENTRY: + case RES_POOLCHR_HTML_STRONG: + { + SetAllScriptItem( aSet, SvxWeightItem( WEIGHT_BOLD, RES_CHRATR_WEIGHT )); + } + break; + + case RES_POOLCHR_HTML_CODE: + case RES_POOLCHR_HTML_SAMPLE: + case RES_POOLCHR_HTML_KEYBOARD: + case RES_POOLCHR_HTML_TELETYPE: + { + ::lcl_SetDfltFont( DEFAULTFONT_FIXED, aSet ); + } + break; + case RES_POOLCHR_VERT_NUM: + aSet.Put( SvxCharRotateItem( 900, false, RES_CHRATR_ROTATE ) ); + break; + + case RES_POOLFRM_FRAME: + { + if ( m_rSwdoc.GetDocumentSettingManager().get(IDocumentSettingAccess::HTML_MODE) ) + { + aSet.Put( SwFmtAnchor( FLY_AS_CHAR )); + aSet.Put( SwFmtVertOrient( 0, text::VertOrientation::LINE_CENTER, text::RelOrientation::PRINT_AREA ) ); + aSet.Put( SwFmtSurround( SURROUND_NONE ) ); + } + else + { + aSet.Put( SwFmtAnchor( FLY_AT_PARA )); + aSet.Put( SwFmtSurround( SURROUND_PARALLEL ) ); + aSet.Put( SwFmtHoriOrient( 0, text::HoriOrientation::CENTER, text::RelOrientation::PRINT_AREA ) ); + aSet.Put( SwFmtVertOrient( 0, text::VertOrientation::TOP, text::RelOrientation::PRINT_AREA ) ); + Color aCol( COL_BLACK ); + SvxBorderLine aLine( &aCol, DEF_LINE_WIDTH_0 ); + SvxBoxItem aBox( RES_BOX ); + aBox.SetLine( &aLine, BOX_LINE_TOP ); + aBox.SetLine( &aLine, BOX_LINE_BOTTOM ); + aBox.SetLine( &aLine, BOX_LINE_LEFT ); + aBox.SetLine( &aLine, BOX_LINE_RIGHT ); + aBox.SetDistance( 85 ); + aSet.Put( aBox ); + aSet.Put( SvxLRSpaceItem( 114, 114, 0, 0, RES_LR_SPACE ) ); + aSet.Put( SvxULSpaceItem( 114, 114, RES_UL_SPACE ) ); + } + + //UUUU for styles of FlyFrames do not set the FillStyle to make it a derived attribute + aSet.ClearItem(XATTR_FILLSTYLE); + } + break; + case RES_POOLFRM_GRAPHIC: + case RES_POOLFRM_OLE: + { + aSet.Put( SwFmtAnchor( FLY_AT_PARA )); + aSet.Put( SwFmtHoriOrient( 0, text::HoriOrientation::CENTER, text::RelOrientation::FRAME )); + aSet.Put( SwFmtVertOrient( 0, text::VertOrientation::TOP, text::RelOrientation::FRAME )); + aSet.Put( SwFmtSurround( SURROUND_IDEAL )); + } + break; + case RES_POOLFRM_FORMEL: + { + aSet.Put( SwFmtAnchor( FLY_AS_CHAR ) ); + aSet.Put( SwFmtVertOrient( 0, text::VertOrientation::CHAR_CENTER, text::RelOrientation::FRAME ) ); + aSet.Put( SvxLRSpaceItem( 114, 114, 0, 0, RES_LR_SPACE ) ); + } + break; + case RES_POOLFRM_MARGINAL: + { + aSet.Put( SwFmtAnchor( FLY_AT_PARA )); + aSet.Put( SwFmtHoriOrient( 0, text::HoriOrientation::LEFT, text::RelOrientation::FRAME )); + aSet.Put( SwFmtVertOrient( 0, text::VertOrientation::TOP, text::RelOrientation::FRAME )); + aSet.Put( SwFmtSurround( SURROUND_PARALLEL )); + // Set the default width to 3.5 cm, use the minimum value for the height + aSet.Put( SwFmtFrmSize( ATT_MIN_SIZE, + GetMetricVal( CM_1 ) * 3 + GetMetricVal( CM_05 ), + MM50 )); + } + break; + case RES_POOLFRM_WATERSIGN: + { + aSet.Put( SwFmtAnchor( FLY_AT_PAGE )); + aSet.Put( SwFmtHoriOrient( 0, text::HoriOrientation::CENTER, text::RelOrientation::FRAME )); + aSet.Put( SwFmtVertOrient( 0, text::VertOrientation::CENTER, text::RelOrientation::FRAME )); + aSet.Put( SvxOpaqueItem( sal_False )); + aSet.Put( SwFmtSurround( SURROUND_THROUGHT )); + } + break; + case RES_POOLFRM_LABEL: + { + aSet.Put( SwFmtAnchor( FLY_AS_CHAR ) ); + aSet.Put( SwFmtVertOrient( 0, text::VertOrientation::TOP, text::RelOrientation::FRAME ) ); + aSet.Put( SvxLRSpaceItem( 114, 114, 0, 0, RES_LR_SPACE ) ); + + SvxProtectItem aProtect( RES_PROTECT ); + aProtect.SetSizeProtect( true ); + aProtect.SetPosProtect( true ); + aSet.Put( aProtect ); + + pNewFmt->SetAutoUpdateFmt( true ); + } + break; + } + if( aSet.Count() ) + { + { + pNewFmt->SetFmtAttr( aSet ); + } + } + return pNewFmt; +} + +SwFrmFmt* DocumentStylePoolManager::GetFrmFmtFromPool( sal_uInt16 nId ) +{ + return (SwFrmFmt*)GetFmtFromPool( nId ); +} + +SwCharFmt* DocumentStylePoolManager::GetCharFmtFromPool( sal_uInt16 nId ) +{ + return (SwCharFmt*)GetFmtFromPool( nId ); +} + +SwPageDesc* DocumentStylePoolManager::GetPageDescFromPool( sal_uInt16 nId, bool bRegardLanguage ) +{ + OSL_ENSURE( RES_POOLPAGE_BEGIN <= nId && nId < RES_POOLPAGE_END, + "Wrong AutoFormat Id" ); + + for( sal_uInt16 n = 0; n < m_rSwdoc.GetPageDescCnt(); ++n ) + { + if ( nId == m_rSwdoc.GetPageDesc(n).GetPoolFmtId() ) + { + return &m_rSwdoc.GetPageDesc(n); + } + } + + if( RES_POOLPAGE_BEGIN > nId || nId >= RES_POOLPAGE_END ) + { + // unknown page pool ID + OSL_ENSURE( false, "<SwDoc::GetPageDescFromPool(..)> - unknown page pool ID" ); + nId = RES_POOLPAGE_BEGIN; + } + + SwPageDesc* pNewPgDsc = 0; + { + const ResId aResId( sal_uInt32(RC_POOLPAGEDESC_BEGIN + nId - RES_POOLPAGE_BEGIN), *pSwResMgr ); + const OUString aNm( aResId ); + const bool bIsModified = m_rSwdoc.getIDocumentState().IsModified(); + + { + ::sw::UndoGuard const undoGuard(m_rSwdoc.GetIDocumentUndoRedo()); + pNewPgDsc = m_rSwdoc.MakePageDesc(aNm, 0, bRegardLanguage); + } + + pNewPgDsc->SetPoolFmtId( nId ); + if ( !bIsModified ) + { + m_rSwdoc.getIDocumentState().ResetModified(); + } + } + + SvxLRSpaceItem aLR( RES_LR_SPACE ); + { + aLR.SetLeft( GetMetricVal( CM_1 ) * 2 ); + aLR.SetRight( aLR.GetLeft() ); + } + SvxULSpaceItem aUL( RES_UL_SPACE ); + { + aUL.SetUpper( (sal_uInt16)aLR.GetLeft() ); + aUL.SetLower( (sal_uInt16)aLR.GetLeft() ); + } + + SwAttrSet aSet( m_rSwdoc.GetAttrPool(), aPgFrmFmtSetRange ); + bool bSetLeft = true; + + switch( nId ) + { + case RES_POOLPAGE_STANDARD: // "Default" + { + aSet.Put( aLR ); + aSet.Put( aUL ); + pNewPgDsc->SetUseOn( nsUseOnPage::PD_ALL | nsUseOnPage::PD_FIRSTSHARE ); + } + break; + + case RES_POOLPAGE_FIRST: // "First Page" + case RES_POOLPAGE_REGISTER: // "Index" + { + lcl_PutStdPageSizeIntoItemSet( &m_rSwdoc, aSet ); + aSet.Put( aLR ); + aSet.Put( aUL ); + pNewPgDsc->SetUseOn( nsUseOnPage::PD_ALL ); + if( RES_POOLPAGE_FIRST == nId ) + pNewPgDsc->SetFollow( GetPageDescFromPool( RES_POOLPAGE_STANDARD )); + } + break; + + case RES_POOLPAGE_LEFT: // "Left Page" + { + lcl_PutStdPageSizeIntoItemSet( &m_rSwdoc, aSet ); + aSet.Put( aLR ); + aSet.Put( aUL ); + bSetLeft = false; + pNewPgDsc->SetUseOn( nsUseOnPage::PD_LEFT ); + // this relies on GetPageDescFromPool() not going into infinite recursion + // (by this point RES_POOLPAGE_LEFT will not reach this place again) + pNewPgDsc->SetFollow( GetPageDescFromPool( RES_POOLPAGE_RIGHT )); + } + break; + case RES_POOLPAGE_RIGHT: // "Right Page" + { + lcl_PutStdPageSizeIntoItemSet( &m_rSwdoc, aSet ); + aSet.Put( aLR ); + aSet.Put( aUL ); + bSetLeft = false; + pNewPgDsc->SetUseOn( nsUseOnPage::PD_RIGHT ); + pNewPgDsc->SetFollow( GetPageDescFromPool( RES_POOLPAGE_LEFT )); + } + break; + + case RES_POOLPAGE_JAKET: // "Envelope" + { + Size aPSize( SvxPaperInfo::GetPaperSize( PAPER_ENV_C65 ) ); + LandscapeSwap( aPSize ); + aSet.Put( SwFmtFrmSize( ATT_FIX_SIZE, aPSize.Width(), aPSize.Height() )); + aLR.SetLeft( 0 ); aLR.SetRight( 0 ); + aUL.SetUpper( 0 ); aUL.SetLower( 0 ); + aSet.Put( aLR ); + aSet.Put( aUL ); + + pNewPgDsc->SetUseOn( nsUseOnPage::PD_ALL ); + pNewPgDsc->SetLandscape( true ); + } + break; + + case RES_POOLPAGE_HTML: // "HTML" + { + lcl_PutStdPageSizeIntoItemSet( &m_rSwdoc, aSet ); + aLR.SetRight( GetMetricVal( CM_1 )); + aUL.SetUpper( (sal_uInt16)aLR.GetRight() ); + aUL.SetLower( (sal_uInt16)aLR.GetRight() ); + aSet.Put( aLR ); + aSet.Put( aUL ); + + pNewPgDsc->SetUseOn( nsUseOnPage::PD_ALL ); + } + break; + + case RES_POOLPAGE_FOOTNOTE: // "Footnote" + case RES_POOLPAGE_ENDNOTE: // "Endnote" + { + lcl_PutStdPageSizeIntoItemSet( &m_rSwdoc, aSet ); + aSet.Put( aLR ); + aSet.Put( aUL ); + pNewPgDsc->SetUseOn( nsUseOnPage::PD_ALL ); + SwPageFtnInfo aInf( pNewPgDsc->GetFtnInfo() ); + aInf.SetLineWidth( 0 ); + aInf.SetTopDist( 0 ); + aInf.SetBottomDist( 0 ); + pNewPgDsc->SetFtnInfo( aInf ); + } + break; + + case RES_POOLPAGE_LANDSCAPE: // "Landscape" + { + SwPageDesc* pStdPgDsc = GetPageDescFromPool( RES_POOLPAGE_STANDARD ); + SwFmtFrmSize aFrmSz( pStdPgDsc->GetMaster().GetFrmSize() ); + if ( !pStdPgDsc->GetLandscape() ) + { + const SwTwips nTmp = aFrmSz.GetHeight(); + aFrmSz.SetHeight( aFrmSz.GetWidth() ); + aFrmSz.SetWidth( nTmp ); + } + aSet.Put( aFrmSz ); + aSet.Put( aLR ); + aSet.Put( aUL ); + pNewPgDsc->SetUseOn( nsUseOnPage::PD_ALL ); + pNewPgDsc->SetLandscape( true ); + } + break; + + } + + if( aSet.Count() ) + { + if( bSetLeft ) + { + pNewPgDsc->GetLeft().SetFmtAttr( aSet ); + pNewPgDsc->GetFirstLeft().SetFmtAttr( aSet ); + } + pNewPgDsc->GetMaster().SetFmtAttr( aSet ); + pNewPgDsc->GetFirstMaster().SetFmtAttr( aSet ); + } + return pNewPgDsc; +} + +SwNumRule* DocumentStylePoolManager::GetNumRuleFromPool( sal_uInt16 nId ) +{ + OSL_ENSURE( RES_POOLNUMRULE_BEGIN <= nId && nId < RES_POOLNUMRULE_END, + "Wrong AutoFormat Id" ); + + SwNumRule* pNewRule; + + for (size_t n = 0; n < m_rSwdoc.GetNumRuleTbl().size(); ++n ) + { + if (nId == ( pNewRule = m_rSwdoc.GetNumRuleTbl()[ n ] )->GetPoolFmtId()) + { + return pNewRule; + } + } + + // error: unknown Pool style + if( RES_POOLNUMRULE_BEGIN > nId || nId >= RES_POOLNUMRULE_END ) + { + OSL_ENSURE( false, "invalid Id" ); + nId = RES_POOLNUMRULE_BEGIN; + } + + ResId aResId( sal_uInt32(RC_POOLNUMRULE_BEGIN + nId - RES_POOLNUMRULE_BEGIN), *pSwResMgr ); + OUString aNm( aResId ); + + SwCharFmt *pNumCFmt = 0, *pBullCFmt = 0; + + const SvxNumberFormat::SvxNumPositionAndSpaceMode eNumberFormatPositionAndSpaceMode + = numfunc::GetDefaultPositionAndSpaceMode(); //#i89178# + { + bool bIsModified = m_rSwdoc.getIDocumentState().IsModified(); + + sal_uInt16 n = m_rSwdoc.MakeNumRule( aNm, 0, false, eNumberFormatPositionAndSpaceMode ); + + pNewRule = m_rSwdoc.GetNumRuleTbl()[ n ]; + pNewRule->SetPoolFmtId( nId ); + pNewRule->SetAutoRule( false ); + + if( RES_POOLNUMRULE_NUM1 <= nId && nId <= RES_POOLNUMRULE_NUM5 ) + pNumCFmt = GetCharFmtFromPool( RES_POOLCHR_NUM_LEVEL ); + + if( ( RES_POOLNUMRULE_BUL1 <= nId && nId <= RES_POOLNUMRULE_BUL5 ) || + RES_POOLNUMRULE_NUM5 == nId ) + pBullCFmt = GetCharFmtFromPool( RES_POOLCHR_NUM_LEVEL ); + + if( !bIsModified ) + m_rSwdoc.getIDocumentState().ResetModified(); + } + + switch( nId ) + { + case RES_POOLNUMRULE_NUM1: + { + SwNumFmt aFmt; + aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode ); + aFmt.SetNumberingType(SVX_NUM_ARABIC); + aFmt.SetCharFmt( pNumCFmt ); + aFmt.SetStart( 1 ); + aFmt.SetIncludeUpperLevels( 1 ); + aFmt.SetSuffix( "." ); + + static const sal_uInt16 aAbsSpace[ MAXLEVEL ] = + { +// cm: 0,5 1,0 1,5 2,0 2,5 3,0 3,5 4,0 4,5 5,0 + 283, 567, 850, 1134, 1417, 1701, 1984, 2268, 2551, 2835 + }; + const sal_uInt16* pArr = aAbsSpace; + + if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) + { + aFmt.SetFirstLineOffset( - (*pArr) ); + } + else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT ) + { + aFmt.SetLabelFollowedBy( SvxNumberFormat::LISTTAB ); + aFmt.SetFirstLineIndent( - (*pArr) ); + } + + for (sal_uInt16 n = 0; n < MAXLEVEL; ++n, ++pArr) + { + if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) + { + aFmt.SetAbsLSpace( *pArr ); + } + else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT ) + { + aFmt.SetListtabPos( *pArr ); + aFmt.SetIndentAt( *pArr ); + } + + pNewRule->Set( n, aFmt ); + } + } + break; + + case RES_POOLNUMRULE_NUM2: + { + static const sal_uInt16 aAbsSpace[ MAXLEVEL ] = + { + 283, 283, 567, 709, // 0.50, 0.50, 1.00, 1.25 + 850, 1021, 1304, 1474, // 1.50, 1.80, 2.30, 2.60 + 1588, 1758 // 2.80, 3.10 + }; + + const sal_uInt16* pArr = aAbsSpace; + SwNumFmt aFmt; + + aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode ); + aFmt.SetNumberingType(SVX_NUM_ARABIC); + aFmt.SetCharFmt( pNumCFmt ); + aFmt.SetIncludeUpperLevels( 1 ); + + if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT ) + { + aFmt.SetLabelFollowedBy( SvxNumberFormat::LISTTAB ); + } + + sal_uInt16 nSpace = 0; + for (sal_uInt16 n = 0; n < MAXLEVEL; ++n) + { + if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) + { + aFmt.SetAbsLSpace( nSpace = nSpace + pArr[ n ] ); + aFmt.SetFirstLineOffset( - pArr[ n ] ); + } + else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT ) + { + aFmt.SetListtabPos( nSpace = nSpace + pArr[ n ] ); + aFmt.SetIndentAt( nSpace ); + aFmt.SetFirstLineIndent( - pArr[ n ] ); + } + + aFmt.SetStart( n+1 ); + pNewRule->Set( n, aFmt ); + } + } + break; + case RES_POOLNUMRULE_NUM3: + { + SwNumFmt aFmt; + + aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode ); + aFmt.SetNumberingType(SVX_NUM_ARABIC); + aFmt.SetCharFmt( pNumCFmt ); + aFmt.SetIncludeUpperLevels( 1 ); + + sal_uInt16 nOffs = GetMetricVal( CM_1 ) * 3; + + if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) + { + aFmt.SetFirstLineOffset( - nOffs ); + } + else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT ) + { + aFmt.SetLabelFollowedBy( SvxNumberFormat::LISTTAB ); + aFmt.SetFirstLineIndent( - nOffs ); + } + + for (sal_uInt16 n = 0; n < MAXLEVEL; ++n) + { + if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) + { + aFmt.SetAbsLSpace( (n+1) * nOffs ); + } + else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT ) + { + long nPos = (n+1) * static_cast<long>(nOffs); + aFmt.SetListtabPos(nPos); + aFmt.SetIndentAt(nPos); + } + + aFmt.SetStart( n+1 ); + pNewRule->Set( n, aFmt ); + } + } + break; + case RES_POOLNUMRULE_NUM4: + { + SwNumFmt aFmt; + + aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode ); + aFmt.SetNumberingType(SVX_NUM_ROMAN_UPPER); + aFmt.SetCharFmt( pNumCFmt ); + aFmt.SetIncludeUpperLevels( 1 ); + aFmt.SetSuffix( "." ); + + static const sal_uInt16 aAbsSpace[ MAXLEVEL ] = + { +// cm: 0,5 1,0 1,5 2,0 2,5 3,0 3,5 4,0 4,5 5,0 + 283, 567, 850, 1134, 1417, 1701, 1984, 2268, 2551, 2835 + }; + const sal_uInt16* pArr = aAbsSpace; + + if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) + { + aFmt.SetFirstLineOffset( - (*pArr) ); + } + else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT ) + { + aFmt.SetLabelFollowedBy( SvxNumberFormat::SPACE ); + aFmt.SetFirstLineIndent( - (*pArr) ); + } + + for (sal_uInt16 n = 0; n < MAXLEVEL; ++n, ++pArr) + { + aFmt.SetStart( n + 1 ); + + if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) + { + aFmt.SetAbsLSpace( *pArr ); + } + else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT ) + { + aFmt.SetListtabPos( *pArr ); + aFmt.SetIndentAt( *pArr ); + } + + pNewRule->Set( n, aFmt ); + } + } + break; + case RES_POOLNUMRULE_NUM5: + { + // [ First, LSpace ] + static const sal_uInt16 aAbsSpace0to2[] = + { + 227, 227, // 0.40, 0.40, + 369, 624, // 0.65, 1.10, + 255, 879 // 0.45, 1.55 + }; + + const sal_uInt16* pArr0to2 = aAbsSpace0to2; + SwNumFmt aFmt; + + aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode ); + aFmt.SetNumberingType(SVX_NUM_ARABIC); + aFmt.SetStart( 1 ); + aFmt.SetIncludeUpperLevels( 1 ); + aFmt.SetSuffix( "." ); + + if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT ) + { + aFmt.SetLabelFollowedBy( SvxNumberFormat::LISTTAB ); + } + + if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) + { + aFmt.SetFirstLineOffset( -pArr0to2[0] ); // == 0.40 cm + aFmt.SetAbsLSpace( pArr0to2[1] ); // == 0.40 cm + } + else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT ) + { + aFmt.SetFirstLineIndent( -pArr0to2[0] ); + aFmt.SetListtabPos( pArr0to2[1] ); + aFmt.SetIndentAt( pArr0to2[1] ); + } + + aFmt.SetCharFmt( pNumCFmt ); + pNewRule->Set( 0, aFmt ); + + aFmt.SetIncludeUpperLevels( 2 ); + aFmt.SetStart( 2 ); + + if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) + { + aFmt.SetFirstLineOffset( -pArr0to2[2] ); // == 0.65 cm + aFmt.SetAbsLSpace( pArr0to2[3] ); // == 1.10 cm + } + else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT ) + { + aFmt.SetFirstLineIndent( -pArr0to2[2] ); + aFmt.SetListtabPos( pArr0to2[3] ); + aFmt.SetIndentAt( pArr0to2[3] ); + } + + pNewRule->Set( 1, aFmt ); + + aFmt.SetNumberingType(SVX_NUM_CHARS_LOWER_LETTER); + aFmt.SetSuffix(OUString(static_cast<sal_Unicode>(')'))); + aFmt.SetIncludeUpperLevels( 1 ); + aFmt.SetStart( 3 ); + + if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) + { + aFmt.SetFirstLineOffset( - pArr0to2[4] ); // == 0.45cm + aFmt.SetAbsLSpace( pArr0to2[5] ); // == 1.55 cm + } + else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT ) + { + aFmt.SetFirstLineIndent( -pArr0to2[4] ); + aFmt.SetListtabPos( pArr0to2[5] ); + aFmt.SetIndentAt( pArr0to2[5] ); + } + + pNewRule->Set( 2, aFmt ); + + aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL); + aFmt.SetCharFmt( pBullCFmt ); + aFmt.SetBulletFont( &numfunc::GetDefBulletFont() ); + aFmt.SetBulletChar( cBulletChar ); + sal_Int16 nOffs = GetMetricVal( CM_01 ) * 4, + nOffs2 = GetMetricVal( CM_1 ) * 2; + + if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) + { + aFmt.SetFirstLineOffset( - nOffs ); + } + else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT ) + { + aFmt.SetFirstLineIndent( - nOffs ); + } + + aFmt.SetSuffix( OUString() ); + for (sal_uInt16 n = 3; n < MAXLEVEL; ++n) + { + aFmt.SetStart( n+1 ); + + if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) + { + aFmt.SetAbsLSpace( nOffs2 + ((n-3) * nOffs) ); + } + else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT ) + { + long nPos = nOffs2 + ((n-3) * static_cast<long>(nOffs)); + aFmt.SetListtabPos(nPos); + aFmt.SetIndentAt(nPos); + } + + pNewRule->Set( n, aFmt ); + } + } + break; + + case RES_POOLNUMRULE_BUL1: + { + SwNumFmt aFmt; + + aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode ); + aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL); ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits