diff options
author | Valentin Kettner <vakevk+libreoffice@gmail.com> | 2014-08-08 19:16:38 +0200 |
---|---|---|
committer | Valentin Kettner <vakevk+libreoffice@gmail.com> | 2014-08-12 23:26:38 +0200 |
commit | 535971f3a166da6c0e44a6b7211c7f8c298f388f (patch) | |
tree | 0336851da5207b32512a6833be9f7b0412bdf96d /sw | |
parent | 5494954b269267f6ee3bdd5ac73e7513fa69978f (diff) |
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
Diffstat (limited to 'sw')
72 files changed, 2524 insertions, 2294 deletions
diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk index abf895720e73..507b94ca2a60 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 cc77e3a32d21..3d6c2654cf4c 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 a3c5df690a64..82ee3a9c365b 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 684bff798b78..da16b116e6fb 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 e504d6e2f5e1..1772723d72a3 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 000000000000..1dae48015cb1 --- /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); + aFmt.SetCharFmt( pBullCFmt ); + aFmt.SetStart( 1 ); + aFmt.SetIncludeUpperLevels( 1 ); + aFmt.SetBulletFont( &numfunc::GetDefBulletFont() ); + aFmt.SetBulletChar( cBulletChar ); + + static const sal_uInt16 aAbsSpace[ MAXLEVEL ] = + { +// cm: 0,4 0,8 1,2 1,6 2,0 2,4 2,8 3,2 3,6 4,0 + 227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268 + }; + 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_BUL2: + { + SwNumFmt aFmt; + + aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode ); + aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL); + aFmt.SetCharFmt( pBullCFmt ); + aFmt.SetStart( 1 ); + aFmt.SetIncludeUpperLevels( 1 ); + aFmt.SetBulletFont( &numfunc::GetDefBulletFont() ); + aFmt.SetBulletChar( 0x2013 ); + + static const sal_uInt16 aAbsSpace[ MAXLEVEL ] = + { +// cm: 0,3 0,6 0,9 1,2 1,5 1,8 2,1 2,4 2,7 3,0 + 170, 340, 510, 680, 850, 1020, 1191, 1361, 1531, 1701 + }; + 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_BUL3: + { + SwNumFmt aFmt; + + aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode ); + + aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL); + aFmt.SetCharFmt( pBullCFmt ); + aFmt.SetStart( 1 ); + aFmt.SetIncludeUpperLevels( 1 ); + aFmt.SetBulletFont( &numfunc::GetDefBulletFont() ); + + sal_uInt16 nOffs = GetMetricVal( CM_01 ) * 4; + + 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) + { + aFmt.SetBulletChar( ( n & 1 ? 0x25a1 : 0x2611 ) ); + + if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) + { + aFmt.SetAbsLSpace( ((n & 1) +1) * nOffs ); + } + else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT ) + { + long nPos = ((n & 1) +1) * static_cast<long>(nOffs); + aFmt.SetListtabPos(nPos); + aFmt.SetIndentAt(nPos); + } + + pNewRule->Set( n, aFmt ); + } + } + break; + case RES_POOLNUMRULE_BUL4: + { + SwNumFmt aFmt; + + aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode ); + aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL); + aFmt.SetCharFmt( pBullCFmt ); + aFmt.SetStart( 1 ); + aFmt.SetIncludeUpperLevels( 1 ); + aFmt.SetBulletFont( &numfunc::GetDefBulletFont() ); + + static const sal_uInt16 aAbsSpace[ MAXLEVEL ] = + { +// cm: 0,4 0,8 1,2 1,6 2,0 2,4 2,8 3,2 3,6 4,0 + 227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268 + }; + + 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) + { + switch( n ) + { + case 0: aFmt.SetBulletChar( 0x27a2 ); break; + case 1: aFmt.SetBulletChar( 0xE006 ); break; + default: aFmt.SetBulletChar( 0xE004 ); break; + } + + 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_BUL5: + { + SwNumFmt aFmt; + + aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode ); + aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL); + aFmt.SetCharFmt( pBullCFmt ); + aFmt.SetStart( 1 ); + aFmt.SetIncludeUpperLevels( 1 ); + aFmt.SetBulletChar( 0x2717 ); + aFmt.SetBulletFont( &numfunc::GetDefBulletFont() ); + + static const sal_uInt16 aAbsSpace[ MAXLEVEL ] = + { +// cm: 0,4 0,8 1,2 1,6 2,0 2,4 2,8 3,2 3,6 4,0 + 227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268 + }; + 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; + } + + return pNewRule; +} + +/// Check if this AutoCollection is already/still in use in this Document +bool DocumentStylePoolManager::IsPoolTxtCollUsed( sal_uInt16 nId ) const +{ + 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 = 0; + bool bFnd = false; + for( sal_uInt16 n = 0; !bFnd && n < m_rSwdoc.GetTxtFmtColls()->size(); ++n ) + { + pNewColl = (*m_rSwdoc.GetTxtFmtColls())[ n ]; + if( nId == pNewColl->GetPoolFmtId() ) + bFnd = true; + } + + if( !bFnd || !pNewColl->GetDepends() ) + return false; + + SwAutoFmtGetDocNode aGetHt( &m_rSwdoc.GetNodes() ); + return !pNewColl->GetInfo( aGetHt ); +} + +/// Check if this AutoCollection is already/still in use +bool DocumentStylePoolManager::IsPoolFmtUsed( sal_uInt16 nId ) const +{ + SwFmt *pNewFmt = 0; + const SwFmtsBase* pArray[ 2 ]; + sal_uInt16 nArrCnt = 1; + bool bFnd = true; + + if (RES_POOLCHR_BEGIN <= nId && nId < RES_POOLCHR_END) + { + pArray[0] = m_rSwdoc.GetCharFmts(); + } + else if (RES_POOLFRM_BEGIN <= nId && nId < RES_POOLFRM_END) + { + pArray[0] = m_rSwdoc.GetFrmFmts(); + pArray[1] = m_rSwdoc.GetSpzFrmFmts(); + nArrCnt = 2; + } + else + { + SAL_WARN("sw.core", "Invalid Pool Id: " << nId << " should be within " + "[" << int(RES_POOLCHR_BEGIN) << "," << int(RES_POOLCHR_END) << ") or " + "[" << int(RES_POOLFRM_BEGIN) << "," << int(RES_POOLFRM_END) << ")"); + bFnd = false; + } + + if( bFnd ) + { + bFnd = false; + while( nArrCnt-- && !bFnd ) + for( sal_uInt16 n = 0; !bFnd && n < (*pArray[nArrCnt]).GetFmtCount(); ++n ) + if( nId == ( pNewFmt = (*pArray[ nArrCnt ] ).GetFmt( n ) )-> + GetPoolFmtId() ) + bFnd = true; + } + + // Not found or no dependencies? + if( bFnd && pNewFmt->GetDepends() ) + { + // Check if we have dependent ContentNodes in the Nodes array + // (also indirect ones for derived Formats) + SwAutoFmtGetDocNode aGetHt( &m_rSwdoc.GetNodes() ); + bFnd = !pNewFmt->GetInfo( aGetHt ); + } + else + bFnd = false; + + return bFnd; +} + +/// Check if this AutoCollection is already/still in use in this Document +bool DocumentStylePoolManager::IsPoolPageDescUsed( sal_uInt16 nId ) const +{ + OSL_ENSURE( RES_POOLPAGE_BEGIN <= nId && nId < RES_POOLPAGE_END, + "Wrong AutoFormat Id" ); + SwPageDesc *pNewPgDsc = 0; + bool bFnd = false; + for( sal_uInt16 n = 0; !bFnd && n < m_rSwdoc.GetPageDescCnt(); ++n ) + { + pNewPgDsc = &m_rSwdoc.GetPageDesc(n); + if( nId == pNewPgDsc->GetPoolFmtId() ) + bFnd = true; + } + + // Not found or no dependencies? + if( !bFnd || !pNewPgDsc->GetDepends() ) // ?????? + return false; + + // Check if we have dependent ContentNodes in the Nodes array + // (also indirect ones for derived Formats) + SwAutoFmtGetDocNode aGetHt( &m_rSwdoc.GetNodes() ); + return !pNewPgDsc->GetInfo( aGetHt ); +} + +DocumentStylePoolManager::~DocumentStylePoolManager() +{ +} + +} + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/doc/acmplwrd.cxx b/sw/source/core/doc/acmplwrd.cxx index 2dcd890d8f86..adff16c70bb1 100644 --- a/sw/source/core/doc/acmplwrd.cxx +++ b/sw/source/core/doc/acmplwrd.cxx @@ -31,6 +31,7 @@ #include <pagedesc.hxx> #include <poolfmt.hxx> #include <calbck.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <editeng/svxacorr.hxx> #include <editeng/acorrcfg.hxx> @@ -103,7 +104,7 @@ SwAutoCompleteClient::SwAutoCompleteClient(SwAutoCompleteWord& rToTell, SwDoc& r pAutoCompleteWord(&rToTell), pDoc(&rSwDoc) { - pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this); + pDoc->getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this); #if OSL_DEBUG_LEVEL > 0 ++nSwAutoCompleteClientCount; #endif @@ -114,7 +115,7 @@ SwAutoCompleteClient::SwAutoCompleteClient(const SwAutoCompleteClient& rClient) pAutoCompleteWord(rClient.pAutoCompleteWord), pDoc(rClient.pDoc) { - pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this); + pDoc->getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this); #if OSL_DEBUG_LEVEL > 0 ++nSwAutoCompleteClientCount; #endif diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 7a30e1a05d9d..1827f24177ec 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -32,6 +32,7 @@ #include <DocumentFieldsManager.hxx> #include <DocumentStatisticsManager.hxx> #include <DocumentStateManager.hxx> +#include <DocumentStylePoolManager.hxx> #include <DocumentLayoutManager.hxx> #include <UndoManager.hxx> #include <hintids.hxx> @@ -472,6 +473,17 @@ IDocumentLayoutAccess & SwDoc::getIDocumentLayoutAccess() return *m_pDocumentLayoutManager; } +//IDocumentStylePoolAccess +IDocumentStylePoolAccess const & SwDoc::getIDocumentStylePoolAccess() const +{ + return *m_pDocumentStylePoolManager; +} + +IDocumentStylePoolAccess & SwDoc::getIDocumentStylePoolAccess() +{ + return *m_pDocumentStylePoolManager; +} + /* Implementations the next Interface here */ /* @@ -1229,7 +1241,7 @@ void SwDoc::Summary( SwDoc* pExtDoc, sal_uInt8 nLevel, sal_uInt8 nPara, bool bIm !pMyColl->IsAssignedToListLevelOfOutlineStyle() ? RES_POOLCOLL_HEADLINE2 : RES_POOLCOLL_HEADLINE1 ); - pMyColl = pExtDoc->GetTxtCollFromPool( nHeadLine ); + pMyColl = pExtDoc->getIDocumentStylePoolAccess().GetTxtCollFromPool( nHeadLine ); pNd->ChgFmtColl( pMyColl ); } if( !pNd->Len() && diff --git a/sw/source/core/doc/docdraw.cxx b/sw/source/core/doc/docdraw.cxx index 99017251d08f..25bcb900adc6 100644 --- a/sw/source/core/doc/docdraw.cxx +++ b/sw/source/core/doc/docdraw.cxx @@ -44,6 +44,7 @@ #include <IDocumentDrawModelAccess.hxx> #include <IDocumentState.hxx> #include <IDocumentLayoutAccess.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <docsh.hxx> #include <rootfrm.hxx> #include <poolfmt.hxx> @@ -562,7 +563,7 @@ IMPL_LINK(SwDoc, CalcFieldValueHdl, EditFieldInfo*, pInfo) else nChrFmt = RES_POOLCHR_INET_NORMAL; - SwFmt *pFmt = GetCharFmtFromPool(nChrFmt); + SwFmt *pFmt = getIDocumentStylePoolAccess().GetCharFmtFromPool(nChrFmt); Color aColor(COL_LIGHTBLUE); if (pFmt) diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index 5d5afa69ba45..690555ab97cd 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -41,6 +41,7 @@ #include <IDocumentFieldsAccess.hxx> #include <IDocumentState.hxx> #include <IDocumentLayoutAccess.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <rootfrm.hxx> #include <pagefrm.hxx> #include <hints.hxx> @@ -1770,7 +1771,7 @@ void SwDoc::SetTxtFmtCollByAutoFmt( const SwPosition& rPos, sal_uInt16 nPoolId, getIDocumentRedlineAccess().AppendRedline( pRedl, true ); } - SetTxtFmtColl( aPam, GetTxtCollFromPool( nPoolId ) ); + SetTxtFmtColl( aPam, getIDocumentStylePoolAccess().GetTxtCollFromPool( nPoolId ) ); if (pSet && pSet->Count()) { diff --git a/sw/source/core/doc/docftn.cxx b/sw/source/core/doc/docftn.cxx index de88a23d37f0..258a336beee8 100644 --- a/sw/source/core/doc/docftn.cxx +++ b/sw/source/core/doc/docftn.cxx @@ -32,6 +32,7 @@ #include <IDocumentUndoRedo.hxx> #include <IDocumentState.hxx> #include <IDocumentLayoutAccess.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <ndtxt.hxx> #include <poolfmt.hxx> #include <ftninfo.hxx> @@ -121,7 +122,7 @@ SwPageDesc *SwEndNoteInfo::GetPageDesc( SwDoc &rDoc ) const { if ( !aPageDescDep.GetRegisteredIn() ) { - SwPageDesc *pDesc = rDoc.GetPageDescFromPool( static_cast<sal_uInt16>( + SwPageDesc *pDesc = rDoc.getIDocumentStylePoolAccess().GetPageDescFromPool( static_cast<sal_uInt16>( m_bEndNote ? RES_POOLPAGE_ENDNOTE : RES_POOLPAGE_FOOTNOTE ) ); pDesc->Add( &((SwClient&)aPageDescDep) ); } @@ -153,7 +154,7 @@ SwCharFmt* SwEndNoteInfo::GetCharFmt(SwDoc &rDoc) const { if ( !aCharFmtDep.GetRegisteredIn() ) { - SwCharFmt* pFmt = rDoc.GetCharFmtFromPool( static_cast<sal_uInt16>( + SwCharFmt* pFmt = rDoc.getIDocumentStylePoolAccess().GetCharFmtFromPool( static_cast<sal_uInt16>( m_bEndNote ? RES_POOLCHR_ENDNOTE : RES_POOLCHR_FOOTNOTE ) ); pFmt->Add( &((SwClient&)aCharFmtDep) ); } @@ -170,7 +171,7 @@ SwCharFmt* SwEndNoteInfo::GetAnchorCharFmt(SwDoc &rDoc) const { if( !aAnchorCharFmtDep.GetRegisteredIn() ) { - SwCharFmt* pFmt = rDoc.GetCharFmtFromPool( static_cast<sal_uInt16>( + SwCharFmt* pFmt = rDoc.getIDocumentStylePoolAccess().GetCharFmtFromPool( static_cast<sal_uInt16>( m_bEndNote ? RES_POOLCHR_ENDNOTE_ANCHOR : RES_POOLCHR_FOOTNOTE_ANCHOR ) ); pFmt->Add( &((SwClient&)aAnchorCharFmtDep) ); } diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx index 9e319be247bc..2b04375b5d22 100644 --- a/sw/source/core/doc/doclay.cxx +++ b/sw/source/core/doc/doclay.cxx @@ -69,6 +69,7 @@ #include <IDocumentFieldsAccess.hxx> #include <IDocumentState.hxx> #include <IDocumentLayoutAccess.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <rootfrm.hxx> #include <pagefrm.hxx> #include <cntfrm.hxx> @@ -166,7 +167,7 @@ SwFlyFrmFmt* SwDoc::_MakeFlySection( const SwPosition& rAnchPos, SwFrmFmt* pFrmFmt ) { if( !pFrmFmt ) - pFrmFmt = GetFrmFmtFromPool( RES_POOLFRM_FRAME ); + pFrmFmt = getIDocumentStylePoolAccess().GetFrmFmtFromPool( RES_POOLFRM_FRAME ); OUString sName; if( !mbInReading ) @@ -326,7 +327,7 @@ SwFlyFrmFmt* SwDoc::MakeFlySection( RndStdIds eAnchorType, if( bCallMake ) { if( !pFrmFmt ) - pFrmFmt = GetFrmFmtFromPool( RES_POOLFRM_FRAME ); + pFrmFmt = getIDocumentStylePoolAccess().GetFrmFmtFromPool( RES_POOLFRM_FRAME ); sal_uInt16 nCollId = static_cast<sal_uInt16>( GetDocumentSettingManager().get(IDocumentSettingAccess::HTML_MODE) ? RES_POOLCOLL_TEXT : RES_POOLCOLL_FRAME ); @@ -335,7 +336,7 @@ SwFlyFrmFmt* SwDoc::MakeFlySection( RndStdIds eAnchorType, propagate an existing adjust item at the anchor to the new content node. */ SwCntntNode * pNewTxtNd = GetNodes().MakeTxtNode (SwNodeIndex( GetNodes().GetEndOfAutotext()), - GetTxtCollFromPool( nCollId )); + getIDocumentStylePoolAccess().GetTxtCollFromPool( nCollId )); SwCntntNode * pAnchorNode = pAnchorPos->nNode.GetNode().GetCntntNode(); assert(pAnchorNode); // pAnchorNode from cursor, must be valid @@ -674,7 +675,7 @@ lcl_InsertLabel(SwDoc & rDoc, SwTxtFmtColls *const pTxtFmtCollTbl, if( !pColl ) { - pColl = rDoc.GetTxtCollFromPool( RES_POOLCOLL_LABEL ); + pColl = rDoc.getIDocumentStylePoolAccess().GetTxtCollFromPool( RES_POOLCOLL_LABEL ); } SwTxtNode *pNew = NULL; @@ -738,7 +739,7 @@ lcl_InsertLabel(SwDoc & rDoc, SwTxtFmtColls *const pTxtFmtCollTbl, pOldFmt->DelFrms(); pNewFmt = rDoc.MakeFlyFrmFmt( rDoc.GetUniqueFrameName(), - rDoc.GetFrmFmtFromPool(RES_POOLFRM_FRAME) ); + rDoc.getIDocumentStylePoolAccess().GetFrmFmtFromPool(RES_POOLFRM_FRAME) ); /* #i6447#: Only the selected items are copied from the old format. */ @@ -921,7 +922,7 @@ lcl_InsertLabel(SwDoc & rDoc, SwTxtFmtColls *const pTxtFmtCollTbl, if( !pCharFmt ) { const sal_uInt16 nMyId = SwStyleNameMapper::GetPoolIdFromUIName(rCharacterStyle, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT); - pCharFmt = rDoc.GetCharFmtFromPool( nMyId ); + pCharFmt = rDoc.getIDocumentStylePoolAccess().GetCharFmtFromPool( nMyId ); } if (pCharFmt) { @@ -1023,7 +1024,7 @@ lcl_InsertDrawLabel( SwDoc & rDoc, SwTxtFmtColls *const pTxtFmtCollTbl, if( !pColl ) { - pColl = rDoc.GetTxtCollFromPool( RES_POOLCOLL_LABEL ); + pColl = rDoc.getIDocumentStylePoolAccess().GetTxtCollFromPool( RES_POOLCOLL_LABEL ); } SwTxtNode* pNew = NULL; @@ -1095,7 +1096,7 @@ lcl_InsertDrawLabel( SwDoc & rDoc, SwTxtFmtColls *const pTxtFmtCollTbl, SwFlyStartNode, pColl ); pNewFmt = rDoc.MakeFlyFrmFmt( rDoc.GetUniqueFrameName(), - rDoc.GetFrmFmtFromPool( RES_POOLFRM_FRAME ) ); + rDoc.getIDocumentStylePoolAccess().GetFrmFmtFromPool( RES_POOLFRM_FRAME ) ); // Set border and shadow to default if the template contains any. if( SFX_ITEM_SET == pNewFmt->GetAttrSet().GetItemState( RES_BOX, true )) @@ -1213,7 +1214,7 @@ lcl_InsertDrawLabel( SwDoc & rDoc, SwTxtFmtColls *const pTxtFmtCollTbl, if ( !pCharFmt ) { const sal_uInt16 nMyId = SwStyleNameMapper::GetPoolIdFromUIName( rCharacterStyle, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT ); - pCharFmt = rDoc.GetCharFmtFromPool( nMyId ); + pCharFmt = rDoc.getIDocumentStylePoolAccess().GetCharFmtFromPool( nMyId ); } if ( pCharFmt ) { diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index 678aaed8f0f1..f81b9f1c25ad 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -102,6 +102,7 @@ #include <DocumentStatisticsManager.hxx> #include <DocumentStateManager.hxx> #include <DocumentLayoutManager.hxx> +#include <DocumentStylePoolManager.hxx> #include <unochart.hxx> #include <fldbas.hxx> @@ -219,6 +220,7 @@ SwDoc::SwDoc() m_pDocumentFieldsManager( new ::sw::DocumentFieldsManager( *this ) ), m_pDocumentStatisticsManager( new ::sw::DocumentStatisticsManager( *this ) ), m_pDocumentLayoutManager( new ::sw::DocumentLayoutManager( *this ) ), + m_pDocumentStylePoolManager( new ::sw::DocumentStylePoolManager( *this ) ), mpDfltFrmFmt( new SwFrmFmt( GetAttrPool(), sFrmFmtStr, 0 ) ), mpEmptyPageFmt( new SwFrmFmt( GetAttrPool(), sEmptyPageStr, mpDfltFrmFmt ) ), mpColumnContFmt( new SwFrmFmt( GetAttrPool(), sColumnCntStr, mpDfltFrmFmt ) ), @@ -308,7 +310,7 @@ SwDoc::SwDoc() // Create PageDesc, EmptyPageFmt and ColumnFmt if ( maPageDescs.empty() ) - GetPageDescFromPool( RES_POOLPAGE_STANDARD ); + getIDocumentStylePoolAccess().GetPageDescFromPool( RES_POOLPAGE_STANDARD ); // Set to "Empty Page" mpEmptyPageFmt->SetFmtAttr( SwFmtFrmSize( ATT_FIX_SIZE ) ); @@ -330,7 +332,7 @@ SwDoc::SwDoc() SwNodeIndex(GetUndoManager().GetUndoNodes().GetEndOfContent()), mpDfltTxtFmtColl ); new SwTxtNode( SwNodeIndex( GetNodes().GetEndOfContent() ), - GetTxtCollFromPool( RES_POOLCOLL_STANDARD )); + getIDocumentStylePoolAccess().GetTxtCollFromPool( RES_POOLCOLL_STANDARD )); maOLEModifiedTimer.SetTimeout( 1000 ); maOLEModifiedTimer.SetTimeoutHdl( LINK( this, SwDoc, DoUpdateModifiedOLE )); @@ -761,8 +763,8 @@ void SwDoc::ClearDoc() delete mpNumberFormatter, mpNumberFormatter = 0; - GetPageDescFromPool( RES_POOLPAGE_STANDARD ); - pFirstNd->ChgFmtColl( GetTxtCollFromPool( RES_POOLCOLL_STANDARD )); + getIDocumentStylePoolAccess().GetPageDescFromPool( RES_POOLPAGE_STANDARD ); + pFirstNd->ChgFmtColl( getIDocumentStylePoolAccess().GetTxtCollFromPool( RES_POOLCOLL_STANDARD )); nDummyPgDsc = maPageDescs.size(); maPageDescs.push_back( pDummyPgDsc ); // set the layout back to the new standard pagedesc diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx index 69550f5a567d..e2ad87b1f9e5 100644 --- a/sw/source/core/doc/docnum.cxx +++ b/sw/source/core/doc/docnum.cxx @@ -29,6 +29,7 @@ #include <DocumentRedlineManager.hxx> #include <IDocumentFieldsAccess.hxx> #include <IDocumentState.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <pam.hxx> #include <ndtxt.hxx> #include <doctxm.hxx> @@ -231,7 +232,7 @@ bool SwDoc::OutlineUpDown( const SwPaM& rPam, short nOffset ) n++; SwTxtFmtColl *aTmpColl = - GetTxtCollFromPool(static_cast<sal_uInt16>(RES_POOLCOLL_HEADLINE1 + n)); + getIDocumentStylePoolAccess().GetTxtCollFromPool(static_cast<sal_uInt16>(RES_POOLCOLL_HEADLINE1 + n)); if( aTmpColl->IsAssignedToListLevelOfOutlineStyle() && aTmpColl->GetAssignedOutlineStyleLevel() == n ) @@ -260,7 +261,7 @@ bool SwDoc::OutlineUpDown( const SwPaM& rPam, short nOffset ) n--; SwTxtFmtColl *aTmpColl = - GetTxtCollFromPool(static_cast<sal_uInt16>(RES_POOLCOLL_HEADLINE1 + n)); + getIDocumentStylePoolAccess().GetTxtCollFromPool(static_cast<sal_uInt16>(RES_POOLCOLL_HEADLINE1 + n)); if( aTmpColl->IsAssignedToListLevelOfOutlineStyle() && aTmpColl->GetAssignedOutlineStyleLevel() == n ) diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index 150a92d683ec..e79b98ecea03 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -32,6 +32,7 @@ #include <IDocumentRedlineAccess.hxx> #include <IDocumentState.hxx> #include <IDocumentLayoutAccess.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <docary.hxx> #include <ndtxt.hxx> #include <redline.hxx> @@ -608,7 +609,7 @@ void SwRedlineExtraData_FmtColl::Reject( SwPaM& rPam ) const // What about Undo? Is it turned off? SwTxtFmtColl* pColl = USHRT_MAX == nPoolId ? pDoc->FindTxtFmtCollByName( sFmtNm ) - : pDoc->GetTxtCollFromPool( nPoolId ); + : pDoc->getIDocumentStylePoolAccess().GetTxtCollFromPool( nPoolId ); if( pColl ) pDoc->SetTxtFmtColl( rPam, pColl, false ); @@ -1128,7 +1129,7 @@ void SwRangeRedline::MoveToSection() ? ((SwTxtNode*)pCSttNd)->GetTxtColl() : (pCEndNd && pCEndNd->IsTxtNode() ) ? ((SwTxtNode*)pCEndNd)->GetTxtColl() - : pDoc->GetTxtCollFromPool( + : pDoc->getIDocumentStylePoolAccess().GetTxtCollFromPool( RES_POOLCOLL_STANDARD ); pSttNd = rNds.MakeTextSection( SwNodeIndex( rNds.GetEndOfRedlines() ), @@ -1196,7 +1197,7 @@ void SwRangeRedline::CopyToSection() { SwTxtFmtColl* pColl = (pCSttNd && pCSttNd->IsTxtNode() ) ? ((SwTxtNode*)pCSttNd)->GetTxtColl() - : pDoc->GetTxtCollFromPool( + : pDoc->getIDocumentStylePoolAccess().GetTxtCollFromPool( RES_POOLCOLL_STANDARD ); pSttNd = rNds.MakeTextSection( SwNodeIndex( rNds.GetEndOfRedlines() ), diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx index 3744d8983263..5d89632afcca 100644 --- a/sw/source/core/doc/doctxm.cxx +++ b/sw/source/core/doc/doctxm.cxx @@ -41,6 +41,7 @@ #include <IDocumentFieldsAccess.hxx> #include <IDocumentState.hxx> #include <IDocumentLayoutAccess.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <pagefrm.hxx> #include <ndtxt.hxx> #include <swtable.hxx> @@ -355,7 +356,7 @@ const SwTOXBaseSection* SwDoc::InsertTableOf( const SwPosition& rPos, SwNodeIndex aIdx( *pSectNd, +1 ); SwTxtNode* pHeadNd = GetNodes().MakeTxtNode( aIdx, - GetTxtCollFromPool( RES_POOLCOLL_STANDARD ) ); + getIDocumentStylePoolAccess().GetTxtCollFromPool( RES_POOLCOLL_STANDARD ) ); OUString sNm( pNewSection->GetTOXName() ); // ??Resource @@ -850,7 +851,7 @@ void SwTOXBaseSection::Update(const SfxItemSet* pAttr, SwNodeIndex aSttIdx( *pSectNd, +1 ); SwNodeIndex aEndIdx( *pSectNd->EndOfSectionNode() ); pFirstEmptyNd = pDoc->GetNodes().MakeTxtNode( aEndIdx, - pDoc->GetTxtCollFromPool( RES_POOLCOLL_TEXT ) ); + pDoc->getIDocumentStylePoolAccess().GetTxtCollFromPool( RES_POOLCOLL_TEXT ) ); { // Task 70995 - save and restore PageDesc and Break Attributes @@ -1118,7 +1119,7 @@ SwTxtFmtColl* SwTOXBaseSection::GetTxtFmtColl( sal_uInt16 nLevel ) } else nPoolFmt = nPoolFmt + nLevel; - pColl = pDoc->GetTxtCollFromPool( nPoolFmt ); + pColl = pDoc->getIDocumentStylePoolAccess().GetTxtCollFromPool( nPoolFmt ); } return pColl; } @@ -1806,7 +1807,7 @@ void SwTOXBaseSection::_UpdatePageNum( SwTxtNode* pNd, sal_uInt16 nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( GetMainEntryCharStyle(), nsSwGetPoolIdFromName::GET_POOLID_CHRFMT ); SwCharFmt* pCharFmt = 0; if(USHRT_MAX != nPoolId) - pCharFmt = pDoc->GetCharFmtFromPool(nPoolId); + pCharFmt = pDoc->getIDocumentStylePoolAccess().GetCharFmtFromPool(nPoolId); else pCharFmt = pDoc->FindCharFmtByName( GetMainEntryCharStyle() ); if(!pCharFmt) diff --git a/sw/source/core/doc/lineinfo.cxx b/sw/source/core/doc/lineinfo.cxx index 36868826609f..cfa0ab867a27 100644 --- a/sw/source/core/doc/lineinfo.cxx +++ b/sw/source/core/doc/lineinfo.cxx @@ -19,6 +19,7 @@ #include "doc.hxx" #include <IDocumentLayoutAccess.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <IDocumentState.hxx> #include "lineinfo.hxx" #include "charfmt.hxx" diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx index c6bae4aab45f..4e21086a7b50 100644 --- a/sw/source/core/doc/notxtfrm.cxx +++ b/sw/source/core/doc/notxtfrm.cxx @@ -40,6 +40,7 @@ #include <fesh.hxx> #include <doc.hxx> #include <IDocumentSettingAccess.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <IDocumentDeviceAccess.hxx> #include <flyfrm.hxx> #include <flyfrms.hxx> @@ -128,7 +129,7 @@ static void lcl_PaintReplacement( const SwRect &rRect, const OUString &rText, else if ( !rURL.GetURL().isEmpty() ) bVisited = rSh.GetDoc()->IsVisitedURL( rURL.GetURL() ); - SwFmt *pFmt = rSh.GetDoc()->GetFmtFromPool( static_cast<sal_uInt16> + SwFmt *pFmt = rSh.GetDoc()->getIDocumentStylePoolAccess().GetFmtFromPool( static_cast<sal_uInt16> (bVisited ? RES_POOLCHR_INET_VISIT : RES_POOLCHR_INET_NORMAL ) ); aCol = pFmt->GetColor().GetValue(); eUnderline = pFmt->GetUnderline().GetLineStyle(); diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx index d88e8443f355..0b0ccc7c7291 100644 --- a/sw/source/core/doc/number.cxx +++ b/sw/source/core/doc/number.cxx @@ -50,6 +50,7 @@ #include <unotools/saveopt.hxx> #include <IDocumentListsAccess.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <IDocumentState.hxx> using namespace ::com::sun::star; @@ -208,7 +209,7 @@ SwNumFmt::SwNumFmt(const SvxNumberFormat& rNumFmt, SwDoc* pDoc) sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName( rCharStyleName, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT ); pCFmt = nId != USHRT_MAX - ? pDoc->GetCharFmtFromPool( nId ) + ? pDoc->getIDocumentStylePoolAccess().GetCharFmtFromPool( nId ) : pDoc->MakeCharFmt( rCharStyleName, 0 ); } pCFmt->Add( this ); diff --git a/sw/source/core/doc/poolfmt.cxx b/sw/source/core/doc/poolfmt.cxx index 78db9b550a71..2af05755144e 100644 --- a/sw/source/core/doc/poolfmt.cxx +++ b/sw/source/core/doc/poolfmt.cxx @@ -48,6 +48,7 @@ #include <IDocumentUndoRedo.hxx> #include <DocumentSettingManager.hxx> #include <IDocumentState.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <fmtanchr.hxx> #include <fmtornt.hxx> #include <fmtsrnd.hxx> @@ -72,39 +73,6 @@ using namespace ::editeng; using namespace ::com::sun::star; -const sal_uInt16 PT_3 = 3 * 20; // 3 pt -const sal_uInt16 PT_6 = 6 * 20; // 6 pt -const sal_uInt16 PT_7 = 7 * 20; // 7 pt -const sal_uInt16 PT_10 = 10 * 20; // 10 pt -const sal_uInt16 PT_12 = 12 * 20; // 12 pt -const sal_uInt16 PT_14 = 14 * 20; // 14 pt -const sal_uInt16 PT_16 = 16 * 20; // 16 pt -const sal_uInt16 PT_18 = 18 * 20; // 18 pt -const sal_uInt16 PT_24 = 24 * 20; // 24 pt -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; -} - void SetAllScriptItem( SfxItemSet& rSet, const SfxPoolItem& rItem ) { rSet.Put( rItem ); @@ -134,156 +102,6 @@ void SetAllScriptItem( SfxItemSet& rSet, const SfxPoolItem& rItem ) rSet.Put( rItem, nWhCTL ); } -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->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->GetTxtCollFromPool( nNxt )); -} - /// Return the AutoCollection by it's Id. If it doesn't /// exist yet, create it. /// If the String pointer is defined, then only query for @@ -295,1934 +113,6 @@ SvxFrameDirection GetDefaultFrameDirection(sal_uLong nLanguage) return eResult; } -SwTxtFmtColl* SwDoc::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 < mpTxtFmtCollTbl->size(); ++n ) - { - if( nId == ( pNewColl = (*mpTxtFmtCollTbl)[ 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( GetAttrPool(), aTxtFmtCollSetRange ); - sal_uInt16 nParent = GetPoolParent( nId ); - - { - -//FEATURE::CONDCOLL - if(::IsConditionalByPoolId( nId )) - pNewColl = new SwConditionTxtFmtColl( GetAttrPool(), aNm, !nParent - ? mpDfltTxtFmtColl - : GetTxtCollFromPool( nParent )); - else -//FEATURE::CONDCOLL - pNewColl = new SwTxtFmtColl( GetAttrPool(), aNm, !nParent - ? mpDfltTxtFmtColl - : GetTxtCollFromPool( nParent )); - pNewColl->SetPoolFmtId( nId ); - mpTxtFmtCollTbl->push_back( pNewColl ); - } - - bool bNoDefault = 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( 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&)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( 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( this, 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( this, 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( this, 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( this, 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( this, 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( this, 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( this, 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( this, 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( this, 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( this, 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( *this ); - - 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( 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( this, aSet, 0, true, false ); - { - SwFmtLineNumber aLN; aLN.SetCountLines( false ); - aSet.Put( aLN ); - } - break; - case RES_POOLCOLL_TOX_USER1: // 1. Level - lcl_SetRegister( this, aSet, 0, false, true ); - break; - case RES_POOLCOLL_TOX_USER2: // 2. Level - lcl_SetRegister( this, aSet, 1, false, true ); - break; - case RES_POOLCOLL_TOX_USER3: // 3. Level - lcl_SetRegister( this, aSet, 2, false, true ); - break; - case RES_POOLCOLL_TOX_USER4: // 4. Level - lcl_SetRegister( this, aSet, 3, false, true ); - break; - case RES_POOLCOLL_TOX_USER5: // 5. Level - lcl_SetRegister( this, aSet, 4, false, true ); - break; - case RES_POOLCOLL_TOX_USER6: // 6. Level - lcl_SetRegister( this, aSet, 5, false, true ); - break; - case RES_POOLCOLL_TOX_USER7: // 7. Level - lcl_SetRegister( this, aSet, 6, false, true ); - break; - case RES_POOLCOLL_TOX_USER8: // 8. Level - lcl_SetRegister( this, aSet, 7, false, true ); - break; - case RES_POOLCOLL_TOX_USER9: // 9. Level - lcl_SetRegister( this, aSet, 8, false, true ); - break; - case RES_POOLCOLL_TOX_USER10: // 10. Level - lcl_SetRegister( this, aSet, 9, false, true ); - break; - - // Index - case RES_POOLCOLL_TOX_IDXH: // Header - lcl_SetRegister( this, aSet, 0, true, false ); - { - SwFmtLineNumber aLN; aLN.SetCountLines( false ); - aSet.Put( aLN ); - } - break; - case RES_POOLCOLL_TOX_IDX1: // 1. Level - lcl_SetRegister( this, aSet, 0, false, false ); - break; - case RES_POOLCOLL_TOX_IDX2: // 2. Level - lcl_SetRegister( this, aSet, 1, false, false ); - break; - case RES_POOLCOLL_TOX_IDX3: // 3. Level - lcl_SetRegister( this, aSet, 2, false, false ); - break; - case RES_POOLCOLL_TOX_IDXBREAK: // Trenner - lcl_SetRegister( this, aSet, 0, false, false ); - break; - - // Table of Content - case RES_POOLCOLL_TOX_CNTNTH: // Header - lcl_SetRegister( this, aSet, 0, true, false ); - { - SwFmtLineNumber aLN; aLN.SetCountLines( false ); - aSet.Put( aLN ); - } - break; - case RES_POOLCOLL_TOX_CNTNT1: // 1. Level - lcl_SetRegister( this, aSet, 0, false, true ); - break; - case RES_POOLCOLL_TOX_CNTNT2: // 2. Level - lcl_SetRegister( this, aSet, 1, false, true ); - break; - case RES_POOLCOLL_TOX_CNTNT3: // 3. Level - lcl_SetRegister( this, aSet, 2, false, true ); - break; - case RES_POOLCOLL_TOX_CNTNT4: // 4. Level - lcl_SetRegister( this, aSet, 3, false, true ); - break; - case RES_POOLCOLL_TOX_CNTNT5: // 5. Level - lcl_SetRegister( this, aSet, 4, false, true ); - break; - case RES_POOLCOLL_TOX_CNTNT6: // 6. Level - lcl_SetRegister( this, aSet, 5, false, true ); - break; - case RES_POOLCOLL_TOX_CNTNT7: // 7. Level - lcl_SetRegister( this, aSet, 6, false, true ); - break; - case RES_POOLCOLL_TOX_CNTNT8: // 8. Level - lcl_SetRegister( this, aSet, 7, false, true ); - break; - case RES_POOLCOLL_TOX_CNTNT9: // 9. Level - lcl_SetRegister( this, aSet, 8, false, true ); - break; - case RES_POOLCOLL_TOX_CNTNT10: // 10. Level - lcl_SetRegister( this, 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( this, 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( this, aSet, 0, false, true ); - break; - - case RES_POOLCOLL_NUM_LEVEL1S: - lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL1, - lNumFirstLineOffset, SwNumRule::GetNumIndent( 0 ), - PT_12, PT_6 ); - break; - case RES_POOLCOLL_NUM_LEVEL1: - lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL1, - lNumFirstLineOffset, SwNumRule::GetNumIndent( 0 ), - 0, PT_6 ); - break; - case RES_POOLCOLL_NUM_LEVEL1E: - lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL1, - lNumFirstLineOffset, SwNumRule::GetNumIndent( 0 ), - 0, PT_12 ); - break; - case RES_POOLCOLL_NUM_NONUM1: - lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_NONUM1, - 0, SwNumRule::GetNumIndent( 0 ), 0, PT_6 ); - break; - case RES_POOLCOLL_NUM_LEVEL2S: - lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL2, - lNumFirstLineOffset, SwNumRule::GetNumIndent( 1 ), - PT_12, PT_6 ); - break; - case RES_POOLCOLL_NUM_LEVEL2: - lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL2, - lNumFirstLineOffset, SwNumRule::GetNumIndent( 1 ), - 0, PT_6 ); - break; - case RES_POOLCOLL_NUM_LEVEL2E: - lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL2, - lNumFirstLineOffset, SwNumRule::GetNumIndent( 1 ), - 0, PT_12 ); - break; - case RES_POOLCOLL_NUM_NONUM2: - lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_NONUM2, - 0, SwNumRule::GetNumIndent( 1 ), 0, PT_6 ); - break; - case RES_POOLCOLL_NUM_LEVEL3S: - lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL3, - lNumFirstLineOffset, SwNumRule::GetNumIndent( 2 ), - PT_12, PT_6 ); - break; - case RES_POOLCOLL_NUM_LEVEL3: - lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL3, - lNumFirstLineOffset, SwNumRule::GetNumIndent( 2 ), - 0, PT_6 ); - break; - case RES_POOLCOLL_NUM_LEVEL3E: - lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL3, - lNumFirstLineOffset, SwNumRule::GetNumIndent( 2 ), - 0, PT_12 ); - break; - case RES_POOLCOLL_NUM_NONUM3: - lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_NONUM3, - 0, SwNumRule::GetNumIndent( 2 ), 0, PT_6 ); - break; - case RES_POOLCOLL_NUM_LEVEL4S: - lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL4, - lNumFirstLineOffset, SwNumRule::GetNumIndent( 3 ), - PT_12, PT_6 ); - break; - case RES_POOLCOLL_NUM_LEVEL4: - lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL4, - lNumFirstLineOffset, SwNumRule::GetNumIndent( 3 ), - 0, PT_6 ); - break; - case RES_POOLCOLL_NUM_LEVEL4E: - lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL4, - lNumFirstLineOffset, SwNumRule::GetNumIndent( 3 ), - 0, PT_12 ); - break; - case RES_POOLCOLL_NUM_NONUM4: - lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_NONUM4, - 0, SwNumRule::GetNumIndent( 3 ), 0, PT_6 ); - break; - case RES_POOLCOLL_NUM_LEVEL5S: - lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL5, - lNumFirstLineOffset, SwNumRule::GetNumIndent( 4 ), - PT_12, PT_6 ); - break; - case RES_POOLCOLL_NUM_LEVEL5: - lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL5, - lNumFirstLineOffset, SwNumRule::GetNumIndent( 4 ), - 0, PT_6 ); - break; - case RES_POOLCOLL_NUM_LEVEL5E: - lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_LEVEL5, - lNumFirstLineOffset, SwNumRule::GetNumIndent( 4 ), - 0, PT_12 ); - break; - case RES_POOLCOLL_NUM_NONUM5: - lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_NUM_NONUM5, - 0, SwNumRule::GetNumIndent( 4 ), 0, PT_6 ); - break; - - case RES_POOLCOLL_BUL_LEVEL1S: - lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL1, - lBullFirstLineOffset, SwNumRule::GetBullIndent( 0 ), - PT_12, PT_6 ); - break; - case RES_POOLCOLL_BUL_LEVEL1: - lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL1, - lBullFirstLineOffset, SwNumRule::GetBullIndent( 0 ), - 0, PT_6 ); - break; - case RES_POOLCOLL_BUL_LEVEL1E: - lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL1, - lBullFirstLineOffset, SwNumRule::GetBullIndent( 0 ), - 0, PT_12 ); - break; - case RES_POOLCOLL_BUL_NONUM1: - lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_NONUM1, - 0, SwNumRule::GetBullIndent( 0 ), 0, PT_6 ); - break; - case RES_POOLCOLL_BUL_LEVEL2S: - lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL2, - lBullFirstLineOffset, SwNumRule::GetBullIndent( 1 ), - PT_12, PT_6 ); - break; - case RES_POOLCOLL_BUL_LEVEL2: - lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL2, - lBullFirstLineOffset, SwNumRule::GetBullIndent( 1 ), - 0, PT_6 ); - break; - case RES_POOLCOLL_BUL_LEVEL2E: - lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL2, - lBullFirstLineOffset, SwNumRule::GetBullIndent( 1 ), - 0, PT_12 ); - break; - case RES_POOLCOLL_BUL_NONUM2: - lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_NONUM2, - 0, SwNumRule::GetBullIndent( 1 ), 0, PT_6 ); - break; - case RES_POOLCOLL_BUL_LEVEL3S: - lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL3, - lBullFirstLineOffset, SwNumRule::GetBullIndent( 2 ), - PT_12, PT_6 ); - break; - case RES_POOLCOLL_BUL_LEVEL3: - lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL3, - lBullFirstLineOffset, SwNumRule::GetBullIndent( 2 ), - 0, PT_6 ); - break; - case RES_POOLCOLL_BUL_LEVEL3E: - lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL3, - lBullFirstLineOffset, SwNumRule::GetBullIndent( 2 ), - 0, PT_12 ); - break; - case RES_POOLCOLL_BUL_NONUM3: - lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_NONUM3, - 0, SwNumRule::GetBullIndent( 2 ), 0, PT_6 ); - break; - case RES_POOLCOLL_BUL_LEVEL4S: - lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL4, - lBullFirstLineOffset, SwNumRule::GetBullIndent( 3 ), - PT_12, PT_6 ); - break; - case RES_POOLCOLL_BUL_LEVEL4: - lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL4, - lBullFirstLineOffset, SwNumRule::GetBullIndent( 3 ), - 0, PT_6 ); - break; - case RES_POOLCOLL_BUL_LEVEL4E: - lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL4, - lBullFirstLineOffset, SwNumRule::GetBullIndent( 3 ), - 0, PT_12 ); - break; - case RES_POOLCOLL_BUL_NONUM4: - lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_NONUM4, - 0, SwNumRule::GetBullIndent( 3 ), 0, PT_6 ); - break; - case RES_POOLCOLL_BUL_LEVEL5S: - lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL5, - lBullFirstLineOffset, SwNumRule::GetBullIndent( 4 ), - PT_12, PT_6 ); - break; - case RES_POOLCOLL_BUL_LEVEL5: - lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL5, - lBullFirstLineOffset, SwNumRule::GetBullIndent( 4 ), - 0, PT_6 ); - break; - case RES_POOLCOLL_BUL_LEVEL5E: - lcl_SetNumBul( this, pNewColl, aSet, RES_POOLCOLL_BUL_LEVEL5, - lBullFirstLineOffset, SwNumRule::GetBullIndent( 4 ), - 0, PT_12 ); - break; - case RES_POOLCOLL_BUL_NONUM5: - lcl_SetNumBul( this, 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; -} - -/// Check if this AutoCollection is already/still in use in this Document -bool SwDoc::IsPoolTxtCollUsed( sal_uInt16 nId ) const -{ - 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 = 0; - bool bFnd = false; - for( sal_uInt16 n = 0; !bFnd && n < mpTxtFmtCollTbl->size(); ++n ) - { - pNewColl = (*mpTxtFmtCollTbl)[ n ]; - if( nId == pNewColl->GetPoolFmtId() ) - bFnd = true; - } - - if( !bFnd || !pNewColl->GetDepends() ) - return false; - - SwAutoFmtGetDocNode aGetHt( &GetNodes() ); - return !pNewColl->GetInfo( aGetHt ); -} - -/// Return the AutomaticFormat with the supplied Id. If it doesn't -/// exist, create it. -SwFmt* SwDoc::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] = mpCharFmtTbl; - pDeriveFmt = mpDfltCharFmt; - - 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] = mpFrmFmtTbl; - pArray[1] = mpSpzFrmFmtTbl; - pDeriveFmt = mpDfltFrmFmt; - 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( GetAttrPool(), pWhichRange ); - - { - bool bIsModified = getIDocumentState().IsModified(); - - { - ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo()); - switch (nId & (COLL_GET_RANGE_BITS + POOLGRP_NOCOLLID) ) - { - case POOLGRP_CHARFMT: - pNewFmt = _MakeCharFmt(aNm, pDeriveFmt, false, true); - break; - case POOLGRP_FRAMEFMT: - pNewFmt = _MakeFrmFmt(aNm, pDeriveFmt, false, true); - break; - default: - break; - } - } - - if( !bIsModified ) - 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 ( 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* SwDoc::GetFrmFmtFromPool( sal_uInt16 nId ) -{ - return (SwFrmFmt*)GetFmtFromPool( nId ); -} - -SwCharFmt* SwDoc::GetCharFmtFromPool( sal_uInt16 nId ) -{ - return (SwCharFmt*)GetFmtFromPool( nId ); -} - -/// Check if this AutoCollection is already/still in use -bool SwDoc::IsPoolFmtUsed( sal_uInt16 nId ) const -{ - SwFmt *pNewFmt = 0; - const SwFmtsBase* pArray[ 2 ]; - sal_uInt16 nArrCnt = 1; - bool bFnd = true; - - if (RES_POOLCHR_BEGIN <= nId && nId < RES_POOLCHR_END) - { - pArray[0] = mpCharFmtTbl; - } - else if (RES_POOLFRM_BEGIN <= nId && nId < RES_POOLFRM_END) - { - pArray[0] = mpFrmFmtTbl; - pArray[1] = mpSpzFrmFmtTbl; - nArrCnt = 2; - } - else - { - SAL_WARN("sw.core", "Invalid Pool Id: " << nId << " should be within " - "[" << int(RES_POOLCHR_BEGIN) << "," << int(RES_POOLCHR_END) << ") or " - "[" << int(RES_POOLFRM_BEGIN) << "," << int(RES_POOLFRM_END) << ")"); - bFnd = false; - } - - if( bFnd ) - { - bFnd = false; - while( nArrCnt-- && !bFnd ) - for( sal_uInt16 n = 0; !bFnd && n < (*pArray[nArrCnt]).GetFmtCount(); ++n ) - if( nId == ( pNewFmt = (*pArray[ nArrCnt ] ).GetFmt( n ) )-> - GetPoolFmtId() ) - bFnd = true; - } - - // Not found or no dependencies? - if( bFnd && pNewFmt->GetDepends() ) - { - // Check if we have dependent ContentNodes in the Nodes array - // (also indirect ones for derived Formats) - SwAutoFmtGetDocNode aGetHt( &GetNodes() ); - bFnd = !pNewFmt->GetInfo( aGetHt ); - } - else - bFnd = false; - - return bFnd; -} - -static void lcl_PutStdPageSizeIntoItemSet( SwDoc* pDoc, SfxItemSet& rSet ) -{ - SwPageDesc* pStdPgDsc = pDoc->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 ); -} - -SwPageDesc* SwDoc::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 < maPageDescs.size(); ++n ) - { - if ( nId == maPageDescs[ n ]->GetPoolFmtId() ) - { - return maPageDescs[ 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 = getIDocumentState().IsModified(); - - { - ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo()); - pNewPgDsc = MakePageDesc(aNm, 0, bRegardLanguage); - } - - pNewPgDsc->SetPoolFmtId( nId ); - if ( !bIsModified ) - { - 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( 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( this, 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( this, 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( this, 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( this, 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( this, 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 = this->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* SwDoc::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 < GetNumRuleTbl().size(); ++n ) - { - if (nId == ( pNewRule = 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 = getIDocumentState().IsModified(); - - sal_uInt16 n = MakeNumRule( aNm, 0, false, eNumberFormatPositionAndSpaceMode ); - - pNewRule = 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 ) - 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); - aFmt.SetCharFmt( pBullCFmt ); - aFmt.SetStart( 1 ); - aFmt.SetIncludeUpperLevels( 1 ); - aFmt.SetBulletFont( &numfunc::GetDefBulletFont() ); - aFmt.SetBulletChar( cBulletChar ); - - static const sal_uInt16 aAbsSpace[ MAXLEVEL ] = - { -// cm: 0,4 0,8 1,2 1,6 2,0 2,4 2,8 3,2 3,6 4,0 - 227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268 - }; - 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_BUL2: - { - SwNumFmt aFmt; - - aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode ); - aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL); - aFmt.SetCharFmt( pBullCFmt ); - aFmt.SetStart( 1 ); - aFmt.SetIncludeUpperLevels( 1 ); - aFmt.SetBulletFont( &numfunc::GetDefBulletFont() ); - aFmt.SetBulletChar( 0x2013 ); - - static const sal_uInt16 aAbsSpace[ MAXLEVEL ] = - { -// cm: 0,3 0,6 0,9 1,2 1,5 1,8 2,1 2,4 2,7 3,0 - 170, 340, 510, 680, 850, 1020, 1191, 1361, 1531, 1701 - }; - 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_BUL3: - { - SwNumFmt aFmt; - - aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode ); - - aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL); - aFmt.SetCharFmt( pBullCFmt ); - aFmt.SetStart( 1 ); - aFmt.SetIncludeUpperLevels( 1 ); - aFmt.SetBulletFont( &numfunc::GetDefBulletFont() ); - - sal_uInt16 nOffs = GetMetricVal( CM_01 ) * 4; - - 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) - { - aFmt.SetBulletChar( ( n & 1 ? 0x25a1 : 0x2611 ) ); - - if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) - { - aFmt.SetAbsLSpace( ((n & 1) +1) * nOffs ); - } - else if ( eNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT ) - { - long nPos = ((n & 1) +1) * static_cast<long>(nOffs); - aFmt.SetListtabPos(nPos); - aFmt.SetIndentAt(nPos); - } - - pNewRule->Set( n, aFmt ); - } - } - break; - case RES_POOLNUMRULE_BUL4: - { - SwNumFmt aFmt; - - aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode ); - aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL); - aFmt.SetCharFmt( pBullCFmt ); - aFmt.SetStart( 1 ); - aFmt.SetIncludeUpperLevels( 1 ); - aFmt.SetBulletFont( &numfunc::GetDefBulletFont() ); - - static const sal_uInt16 aAbsSpace[ MAXLEVEL ] = - { -// cm: 0,4 0,8 1,2 1,6 2,0 2,4 2,8 3,2 3,6 4,0 - 227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268 - }; - - 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) - { - switch( n ) - { - case 0: aFmt.SetBulletChar( 0x27a2 ); break; - case 1: aFmt.SetBulletChar( 0xE006 ); break; - default: aFmt.SetBulletChar( 0xE004 ); break; - } - - 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_BUL5: - { - SwNumFmt aFmt; - - aFmt.SetPositionAndSpaceMode( eNumberFormatPositionAndSpaceMode ); - aFmt.SetNumberingType(SVX_NUM_CHAR_SPECIAL); - aFmt.SetCharFmt( pBullCFmt ); - aFmt.SetStart( 1 ); - aFmt.SetIncludeUpperLevels( 1 ); - aFmt.SetBulletChar( 0x2717 ); - aFmt.SetBulletFont( &numfunc::GetDefBulletFont() ); - - static const sal_uInt16 aAbsSpace[ MAXLEVEL ] = - { -// cm: 0,4 0,8 1,2 1,6 2,0 2,4 2,8 3,2 3,6 4,0 - 227, 454, 680, 907, 1134, 1361, 1587, 1814, 2041, 2268 - }; - 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; - } - - return pNewRule; -} - -/// Check if this AutoCollection is already/still in use in this Document -bool SwDoc::IsPoolPageDescUsed( sal_uInt16 nId ) const -{ - OSL_ENSURE( RES_POOLPAGE_BEGIN <= nId && nId < RES_POOLPAGE_END, - "Wrong AutoFormat Id" ); - SwPageDesc *pNewPgDsc = 0; - bool bFnd = false; - for( sal_uInt16 n = 0; !bFnd && n < maPageDescs.size(); ++n ) - { - pNewPgDsc = maPageDescs[ n ]; - if( nId == pNewPgDsc->GetPoolFmtId() ) - bFnd = true; - } - - // Not found or no dependencies? - if( !bFnd || !pNewPgDsc->GetDepends() ) // ?????? - return false; - - // Check if we have dependent ContentNodes in the Nodes array - // (also indirect ones for derived Formats) - SwAutoFmtGetDocNode aGetHt( &GetNodes() ); - return !pNewPgDsc->GetInfo( aGetHt ); -} - // See if the Paragraph/Character/Frame/Page style is in use bool SwDoc::IsUsed( const SwModify& rModify ) const { @@ -2395,7 +285,7 @@ void SwDoc::RemoveAllFmtLanguageDependencies() /* Restore the language independ pool defaults and styles. */ GetAttrPool().ResetPoolDefaultItem( RES_PARATR_ADJUST ); - SwTxtFmtColl * pTxtFmtColl = GetTxtCollFromPool( RES_POOLCOLL_STANDARD ); + SwTxtFmtColl * pTxtFmtColl = getIDocumentStylePoolAccess().GetTxtCollFromPool( RES_POOLCOLL_STANDARD ); pTxtFmtColl->ResetFmtAttr( RES_PARATR_ADJUST ); /* koreans do not like SvxScriptItem(TRUE) */ diff --git a/sw/source/core/doc/tblcpy.cxx b/sw/source/core/doc/tblcpy.cxx index 2e28d86c1027..8f5d1558f70e 100644 --- a/sw/source/core/doc/tblcpy.cxx +++ b/sw/source/core/doc/tblcpy.cxx @@ -27,6 +27,7 @@ #include <IDocumentRedlineAccess.hxx> #include <IDocumentFieldsAccess.hxx> #include <IDocumentLayoutAccess.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <cntfrm.hxx> #include <pam.hxx> #include <swtable.hxx> @@ -612,7 +613,7 @@ static void lcl_CpyBox( const SwTable& rCpyTbl, const SwTableBox* pCpyBox, ? RES_POOLCOLL_TABLE == nPoolId : RES_POOLCOLL_TABLE_HDLN == nPoolId ) ) { - SwTxtFmtColl* pColl = pDoc->GetTxtCollFromPool( + SwTxtFmtColl* pColl = pDoc->getIDocumentStylePoolAccess().GetTxtCollFromPool( static_cast<sal_uInt16>( RES_POOLCOLL_TABLE == nPoolId ? RES_POOLCOLL_TABLE_HDLN diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx index 2575f19fea8a..b136668aace4 100644 --- a/sw/source/core/doc/tblrwcl.cxx +++ b/sw/source/core/doc/tblrwcl.cxx @@ -33,6 +33,7 @@ #include <IDocumentChartDataProviderAccess.hxx> #include <DocumentContentOperationsManager.hxx> #include <IDocumentRedlineAccess.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <IDocumentFieldsAccess.hxx> #include <cntfrm.hxx> #include <tabfrm.hxx> @@ -2138,8 +2139,8 @@ bool SwTable::MakeCopy( SwDoc* pInsDoc, const SwPosition& rPos, SwDoc* pSrcDoc = GetFrmFmt()->GetDoc(); if( pSrcDoc != pInsDoc ) { - pInsDoc->CopyTxtColl( *pSrcDoc->GetTxtCollFromPool( RES_POOLCOLL_TABLE ) ); - pInsDoc->CopyTxtColl( *pSrcDoc->GetTxtCollFromPool( RES_POOLCOLL_TABLE_HDLN ) ); + pInsDoc->CopyTxtColl( *pSrcDoc->getIDocumentStylePoolAccess().GetTxtCollFromPool( RES_POOLCOLL_TABLE ) ); + pInsDoc->CopyTxtColl( *pSrcDoc->getIDocumentStylePoolAccess().GetTxtCollFromPool( RES_POOLCOLL_TABLE_HDLN ) ); } SwTable* pNewTbl = (SwTable*)pInsDoc->InsertTable( diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index 607b2587dec1..066b617ddb0d 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -43,6 +43,7 @@ #include <DocumentSettingManager.hxx> #include <IDocumentChartDataProviderAccess.hxx> #include <IDocumentRedlineAccess.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <IDocumentFieldsAccess.hxx> #include <IDocumentLayoutAccess.hxx> #include <IDocumentState.hxx> @@ -359,13 +360,13 @@ const SwTable* SwDoc::InsertTable( const SwInsertTableOptions& rInsTblOpts, } // Start with inserting the Nodes and get the AutoFormat for the Table - SwTxtFmtColl *pBodyColl = GetTxtCollFromPool( RES_POOLCOLL_TABLE ), + SwTxtFmtColl *pBodyColl = getIDocumentStylePoolAccess().GetTxtCollFromPool( RES_POOLCOLL_TABLE ), *pHeadColl = pBodyColl; bool bDfltBorders = 0 != ( rInsTblOpts.mnInsMode & tabopts::DEFAULT_BORDER ); if( (rInsTblOpts.mnInsMode & tabopts::HEADLINE) && (1 != nRows || !bDfltBorders) ) - pHeadColl = GetTxtCollFromPool( RES_POOLCOLL_TABLE_HDLN ); + pHeadColl = getIDocumentStylePoolAccess().GetTxtCollFromPool( RES_POOLCOLL_TABLE_HDLN ); const sal_uInt16 nRowsToRepeat = tabopts::HEADLINE == (rInsTblOpts.mnInsMode & tabopts::HEADLINE) ? @@ -719,7 +720,7 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts, SwTableNode* pTblNd = GetNodes().TextToTable( aRg, cCh, pTableFmt, pLineFmt, pBoxFmt, - GetTxtCollFromPool( RES_POOLCOLL_STANDARD ), pUndo ); + getIDocumentStylePoolAccess().GetTxtCollFromPool( RES_POOLCOLL_STANDARD ), pUndo ); SwTable * pNdTbl = &pTblNd->GetTable(); OSL_ENSURE( pNdTbl, "No Table Node created" ); @@ -1210,7 +1211,7 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> > SwTableNode* pTblNd = GetNodes().TextToTable( rTableNodes, pTableFmt, pLineFmt, pBoxFmt, - GetTxtCollFromPool( RES_POOLCOLL_STANDARD )/*, pUndo*/ ); + getIDocumentStylePoolAccess().GetTxtCollFromPool( RES_POOLCOLL_STANDARD )/*, pUndo*/ ); SwTable * pNdTbl = &pTblNd->GetTable(); OSL_ENSURE( pNdTbl, "No Table Node created" ); @@ -1993,7 +1994,7 @@ bool SwDoc::DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn ) { const SwNodeIndex aTmpIdx( *pTblNd->EndOfSectionNode(), 1 ); GetNodes().MakeTxtNode( aTmpIdx, - GetTxtCollFromPool( RES_POOLCOLL_STANDARD ) ); + getIDocumentStylePoolAccess().GetTxtCollFromPool( RES_POOLCOLL_STANDARD ) ); } // Save the cursors (UNO and otherwise) @@ -2045,7 +2046,7 @@ bool SwDoc::DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn ) { const SwNodeIndex aTmpIdx( *pTblNd->EndOfSectionNode(), 1 ); GetNodes().MakeTxtNode( aTmpIdx, - GetTxtCollFromPool( RES_POOLCOLL_STANDARD ) ); + getIDocumentStylePoolAccess().GetTxtCollFromPool( RES_POOLCOLL_STANDARD ) ); } // Save the cursors (UNO and otherwise) @@ -3216,7 +3217,7 @@ bool SwDoc::SplitTable( const SwPosition& rPos, sal_uInt16 eHdlnMode, // Insert a paragraph between the Table GetNodes().MakeTxtNode( SwNodeIndex( *pNew ), - GetTxtCollFromPool( RES_POOLCOLL_TEXT ) ); + getIDocumentStylePoolAccess().GetTxtCollFromPool( RES_POOLCOLL_TEXT ) ); } // Update Layout diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx index cee18af1fd09..0fa16f167730 100644 --- a/sw/source/core/docnode/node.cxx +++ b/sw/source/core/docnode/node.cxx @@ -1913,7 +1913,7 @@ drawinglayer::attribute::SdrAllFillAttributesHelperPtr SwCntntNode::getSdrAllFil const IDocumentSettingAccess* SwNode::getIDocumentSettingAccess() const { return &GetDoc()->GetDocumentSettingManager(); } const IDocumentDeviceAccess* SwNode::getIDocumentDeviceAccess() const { return &GetDoc()->getIDocumentDeviceAccess(); } const IDocumentRedlineAccess* SwNode::getIDocumentRedlineAccess() const { return &GetDoc()->getIDocumentRedlineAccess(); } -const IDocumentStylePoolAccess* SwNode::getIDocumentStylePoolAccess() const { return GetDoc(); } +const IDocumentStylePoolAccess* SwNode::getIDocumentStylePoolAccess() const { return &GetDoc()->getIDocumentStylePoolAccess(); } const IDocumentDrawModelAccess* SwNode::getIDocumentDrawModelAccess() const { return & GetDoc()->getIDocumentDrawModelAccess(); } const IDocumentLayoutAccess* SwNode::getIDocumentLayoutAccess() const { return &GetDoc()->getIDocumentLayoutAccess(); } IDocumentLayoutAccess* SwNode::getIDocumentLayoutAccess() { return &GetDoc()->getIDocumentLayoutAccess(); } diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx index 4d0c43757738..46ee7ab20ee0 100644 --- a/sw/source/core/docnode/section.cxx +++ b/sw/source/core/docnode/section.cxx @@ -37,6 +37,7 @@ #include <DocumentContentOperationsManager.hxx> #include <IDocumentRedlineAccess.hxx> #include <IDocumentFieldsAccess.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <IDocumentState.hxx> #include <node.hxx> #include <pam.hxx> @@ -1202,7 +1203,7 @@ static void lcl_UpdateLinksInSect( SwBaseLink& rUpdLnk, SwSectionNode& rSectNd ) SwNodeIndex aIdx( *pSectNd, +1 ); SwNodeIndex aEndIdx( *pSectNd->EndOfSectionNode() ); SwTxtNode* pNewNd = pDoc->GetNodes().MakeTxtNode( aIdx, - pDoc->GetTxtCollFromPool( RES_POOLCOLL_TEXT ) ); + pDoc->getIDocumentStylePoolAccess().GetTxtCollFromPool( RES_POOLCOLL_TEXT ) ); if( pESh ) pESh->StartAllAction(); diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx index c13e18c34b9f..110ab73b4f21 100644 --- a/sw/source/core/edit/autofmt.cxx +++ b/sw/source/core/edit/autofmt.cxx @@ -41,6 +41,7 @@ #include <doc.hxx> #include <IDocumentUndoRedo.hxx> #include <DocumentRedlineManager.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <docary.hxx> #include <editsh.hxx> #include <index.hxx> @@ -1401,7 +1402,7 @@ void SwAutoFormat::BuildEnum( sal_uInt16 nLvl, sal_uInt16 nDigitLevel ) { if( m_aFlags.bSetNumRule ) { - SwCharFmt* pCFmt = m_pDoc->GetCharFmtFromPool( + SwCharFmt* pCFmt = m_pDoc->getIDocumentStylePoolAccess().GetCharFmtFromPool( RES_POOLCHR_BUL_LEVEL ); bChgBullet = true; // Was the format already somewhere adjusted? @@ -1489,7 +1490,7 @@ void SwAutoFormat::BuildEnum( sal_uInt16 nLvl, sal_uInt16 nDigitLevel ) { if( !pCur ) // adjust NumRule if it is new { - SwCharFmt* pCFmt = m_pDoc->GetCharFmtFromPool( + SwCharFmt* pCFmt = m_pDoc->getIDocumentStylePoolAccess().GetCharFmtFromPool( RES_POOLCHR_NUM_LEVEL ); if( !nDigitLevel ) { diff --git a/sw/source/core/edit/edfmt.cxx b/sw/source/core/edit/edfmt.cxx index 576cb02a65ee..e0ec77c66725 100644 --- a/sw/source/core/edit/edfmt.cxx +++ b/sw/source/core/edit/edfmt.cxx @@ -18,6 +18,7 @@ */ #include "doc.hxx" +#include <IDocumentStylePoolAccess.hxx> #include "editsh.hxx" #include "swtable.hxx" #include "pam.hxx" @@ -130,18 +131,18 @@ SwCharFmt* SwEditShell::MakeCharFmt( const OUString& rName, SwTxtFmtColl* SwEditShell::GetTxtCollFromPool( sal_uInt16 nId ) { - return GetDoc()->GetTxtCollFromPool( nId ); + return GetDoc()->getIDocumentStylePoolAccess().GetTxtCollFromPool( nId ); } /// return the requested automatic format - base-class ! SwFmt* SwEditShell::GetFmtFromPool( sal_uInt16 nId ) { - return GetDoc()->GetFmtFromPool( nId ); + return GetDoc()->getIDocumentStylePoolAccess().GetFmtFromPool( nId ); } SwPageDesc* SwEditShell::GetPageDescFromPool( sal_uInt16 nId ) { - return GetDoc()->GetPageDescFromPool( nId ); + return GetDoc()->getIDocumentStylePoolAccess().GetPageDescFromPool( nId ); } bool SwEditShell::IsUsed( const SwModify& rModify ) const diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx index 5a2873fdf921..81d8c4321170 100644 --- a/sw/source/core/fields/docufld.cxx +++ b/sw/source/core/fields/docufld.cxx @@ -74,6 +74,7 @@ #include <doc.hxx> #include <IDocumentFieldsAccess.hxx> #include <IDocumentStatistics.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <IDocumentLayoutAccess.hxx> #include <rootfrm.hxx> #include <pagefrm.hxx> @@ -2339,7 +2340,7 @@ SwFieldType* SwJumpEditFieldType::Copy() const SwCharFmt* SwJumpEditFieldType::GetCharFmt() { - SwCharFmt* pFmt = pDoc->GetCharFmtFromPool( RES_POOLCHR_JUMPEDIT ); + SwCharFmt* pFmt = pDoc->getIDocumentStylePoolAccess().GetCharFmtFromPool( RES_POOLCHR_JUMPEDIT ); // not registered yet? if( !aDep.GetRegisteredIn() ) diff --git a/sw/source/core/frmedt/fedesc.cxx b/sw/source/core/frmedt/fedesc.cxx index d3a67d81491e..2240feb6042c 100644 --- a/sw/source/core/frmedt/fedesc.cxx +++ b/sw/source/core/frmedt/fedesc.cxx @@ -22,6 +22,7 @@ #include <doc.hxx> #include <IDocumentUndoRedo.hxx> #include <IDocumentContentOperations.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <pagefrm.hxx> #include <rootfrm.hxx> #include <cntfrm.hxx> @@ -130,7 +131,7 @@ SwPageDesc* SwFEShell::FindPageDescByName( const OUString& rName, { sal_uInt16 nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( rName, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC ); if( USHRT_MAX != nPoolId && - 0 != (pDesc = GetDoc()->GetPageDescFromPool( nPoolId )) + 0 != (pDesc = GetDoc()->getIDocumentStylePoolAccess().GetPageDescFromPool( nPoolId )) && pPos ) // appended always *pPos = GetDoc()->GetPageDescCnt() - 1 ; diff --git a/sw/source/core/inc/DocumentStylePoolManager.hxx b/sw/source/core/inc/DocumentStylePoolManager.hxx new file mode 100644 index 000000000000..e3ec3889a450 --- /dev/null +++ b/sw/source/core/inc/DocumentStylePoolManager.hxx @@ -0,0 +1,60 @@ +/* -*- 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_DOCUMENTSTYLEPOOLMANAGER_HXX +#define INCLUDED_SW_SOURCE_CORE_INC_DOCUMENTSTYLEPOOLMANAGER_HXX + +#include <IDocumentStylePoolAccess.hxx> +#include <boost/utility.hpp> + +class SwDoc; + +namespace sw { + +class DocumentStylePoolManager : public IDocumentStylePoolAccess, + public ::boost::noncopyable +{ + +public: + + DocumentStylePoolManager( SwDoc& i_rSwdoc ); + + 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; + + virtual ~DocumentStylePoolManager(); + +private: + + SwDoc& m_rSwdoc; +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ + diff --git a/sw/source/core/layout/pagedesc.cxx b/sw/source/core/layout/pagedesc.cxx index e7641f2fbcfb..ebc0f27a2f3f 100644 --- a/sw/source/core/layout/pagedesc.cxx +++ b/sw/source/core/layout/pagedesc.cxx @@ -31,6 +31,7 @@ #include <frmtool.hxx> #include <doc.hxx> #include <poolfmt.hrc> +#include <IDocumentStylePoolAccess.hxx> #include <poolfmt.hxx> #include <switerator.hxx> @@ -346,7 +347,7 @@ SwPageDesc* SwPageDesc::GetByName(SwDoc& rDoc, const OUString& rName) { if (rName==SW_RESSTR(i)) { - return rDoc.GetPageDescFromPool( static_cast< sal_uInt16 >( + return rDoc.getIDocumentStylePoolAccess().GetPageDescFromPool( static_cast< sal_uInt16 >( i - RC_POOLPAGEDESC_BEGIN + RES_POOLPAGE_BEGIN) ); } } diff --git a/sw/source/core/swg/SwXMLTextBlocks.cxx b/sw/source/core/swg/SwXMLTextBlocks.cxx index 87bec19fb1d4..520555601e2c 100644 --- a/sw/source/core/swg/SwXMLTextBlocks.cxx +++ b/sw/source/core/swg/SwXMLTextBlocks.cxx @@ -29,6 +29,7 @@ #include <comphelper/storagehelper.hxx> #include <doc.hxx> #include <IDocumentUndoRedo.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <docsh.hxx> #include <pam.hxx> #include <swblocks.hxx> @@ -599,7 +600,7 @@ void SwXMLTextBlocks::MakeBlockText( const OUString& rText ) SwTxtNode* pTxtNode = pDoc->GetNodes()[ pDoc->GetNodes().GetEndOfContent(). GetIndex() - 1 ]->GetTxtNode(); if( pTxtNode->GetTxtColl() == pDoc->GetDfltTxtFmtColl() ) - pTxtNode->ChgFmtColl( pDoc->GetTxtCollFromPool( RES_POOLCOLL_STANDARD )); + pTxtNode->ChgFmtColl( pDoc->getIDocumentStylePoolAccess().GetTxtCollFromPool( RES_POOLCOLL_STANDARD )); sal_Int32 nPos = 0; do diff --git a/sw/source/core/tox/ToxTextGenerator.cxx b/sw/source/core/tox/ToxTextGenerator.cxx index af71b04b4abb..4ce9ffacaaab 100644 --- a/sw/source/core/tox/ToxTextGenerator.cxx +++ b/sw/source/core/tox/ToxTextGenerator.cxx @@ -24,6 +24,8 @@ #include "fchrfmt.hxx" #include "doc.hxx" #include <IDocumentLayoutAccess.hxx> +#include <IDocumentStylePoolAccess.hxx> +#include <IDocumentStylePoolAccess.hxx> #include "fmtinfmt.hxx" #include "ndtxt.hxx" #include "pagedesc.hxx" @@ -244,7 +246,7 @@ ToxTextGenerator::GenerateText(SwDoc* pDoc, const std::vector<SwTOXSortTabBase*> { SwCharFmt* pCharFmt; if( USHRT_MAX != aToken.nPoolId ) - pCharFmt = pDoc->GetCharFmtFromPool( aToken.nPoolId ); + pCharFmt = pDoc->getIDocumentStylePoolAccess().GetCharFmtFromPool( aToken.nPoolId ); else pCharFmt = pDoc->FindCharFmtByName( aToken.sCharStyleName); diff --git a/sw/source/core/txtnode/atrftn.cxx b/sw/source/core/txtnode/atrftn.cxx index 5a93c7c789c2..f7f2aa555860 100644 --- a/sw/source/core/txtnode/atrftn.cxx +++ b/sw/source/core/txtnode/atrftn.cxx @@ -19,6 +19,7 @@ #include <doc.hxx> #include <DocumentContentOperationsManager.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <cntfrm.hxx> #include <pagefrm.hxx> #include <fmtftn.hxx> @@ -403,7 +404,7 @@ void SwTxtFtn::MakeNewTextSection( SwNodes& rNodes ) } if( 0 == (pFmtColl = pInfo->GetFtnTxtColl() ) ) - pFmtColl = rNodes.GetDoc()->GetTxtCollFromPool( nPoolId ); + pFmtColl = rNodes.GetDoc()->getIDocumentStylePoolAccess().GetTxtCollFromPool( nPoolId ); SwStartNode* pSttNd = rNodes.MakeTextSection( SwNodeIndex( rNodes.GetEndOfInserts() ), SwFootnoteStartNode, pFmtColl ); diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index 5dbaaf8effad..4f4eca65f6e6 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -55,6 +55,7 @@ #include <IDocumentUndoRedo.hxx> #include <IDocumentFieldsAccess.hxx> #include <IDocumentLayoutAccess.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <fldbas.hxx> #include <pam.hxx> #include <ndtxt.hxx> @@ -210,7 +211,7 @@ void SwTxtINetFmt::InitINetFmt(SwTxtNode & rNode) { ChgTxtNode(&rNode); SwCharFmt * const pFmt( - rNode.GetDoc()->GetCharFmtFromPool(RES_POOLCHR_INET_NORMAL) ); + rNode.GetDoc()->getIDocumentStylePoolAccess().GetCharFmtFromPool(RES_POOLCHR_INET_NORMAL) ); pFmt->Add( this ); } @@ -218,7 +219,7 @@ void SwTxtRuby::InitRuby(SwTxtNode & rNode) { ChgTxtNode(&rNode); SwCharFmt * const pFmt( - rNode.GetDoc()->GetCharFmtFromPool(RES_POOLCHR_RUBYTEXT) ); + rNode.GetDoc()->getIDocumentStylePoolAccess().GetCharFmtFromPool(RES_POOLCHR_RUBYTEXT) ); pFmt->Add( this ); } diff --git a/sw/source/core/txtnode/txtatr2.cxx b/sw/source/core/txtnode/txtatr2.cxx index d355d61db4e4..59f8234f68cf 100644 --- a/sw/source/core/txtnode/txtatr2.cxx +++ b/sw/source/core/txtnode/txtatr2.cxx @@ -33,6 +33,7 @@ #include <fmtruby.hxx> #include <fmtmeta.hxx> #include <IDocumentState.hxx> +#include <IDocumentStylePoolAccess.hxx> TYPEINIT1(SwTxtINetFmt,SwClient); TYPEINIT1(SwTxtRuby,SwClient); @@ -146,7 +147,7 @@ SwCharFmt* SwTxtINetFmt::GetCharFmt() pRet = IsPoolUserFmt( nId ) ? ( (SwDoc*) pDoc )->FindCharFmtByName( rStr ) - : ( (SwDoc*) pDoc )->GetCharFmtFromPool( nId ); + : ( (SwDoc*) pDoc )->getIDocumentStylePoolAccess().GetCharFmtFromPool( nId ); if ( bResetMod ) { @@ -267,7 +268,7 @@ SwCharFmt* SwTxtRuby::GetCharFmt() pRet = IsPoolUserFmt( nId ) ? ((SwDoc*)pDoc)->FindCharFmtByName( rStr ) - : ((SwDoc*)pDoc)->GetCharFmtFromPool( nId ); + : ((SwDoc*)pDoc)->getIDocumentStylePoolAccess().GetCharFmtFromPool( nId ); if( bResetMod ) { diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx index ceebdc08b202..272cf9fc2fc4 100644 --- a/sw/source/core/undo/undel.cxx +++ b/sw/source/core/undo/undel.cxx @@ -27,6 +27,7 @@ #include <doc.hxx> #include <UndoManager.hxx> #include <IDocumentRedlineAccess.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <swtable.hxx> #include <swundo.hxx> #include <pam.hxx> @@ -1020,7 +1021,7 @@ void SwUndoDelete::RedoImpl(::sw::UndoRedoContext & rContext) // than add again a Node at the end const SwNodeIndex aTmpIdx( *pTblNd->EndOfSectionNode(), 1 ); rDoc.GetNodes().MakeTxtNode( aTmpIdx, - rDoc.GetTxtCollFromPool( RES_POOLCOLL_STANDARD ) ); + rDoc.getIDocumentStylePoolAccess().GetTxtCollFromPool( RES_POOLCOLL_STANDARD ) ); } SwCntntNode* pNextNd = rDoc.GetNodes()[ diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx index 2be19a0f1998..e583f07c9449 100644 --- a/sw/source/core/undo/untbl.cxx +++ b/sw/source/core/undo/untbl.cxx @@ -38,6 +38,7 @@ #include <IDocumentChartDataProviderAccess.hxx> #include <IDocumentRedlineAccess.hxx> #include <IDocumentFieldsAccess.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <editsh.hxx> #include <docary.hxx> #include <ndtxt.hxx> @@ -1970,7 +1971,7 @@ void SwUndoTblMerge::UndoImpl(::sw::UndoRedoContext & rContext) CHECKTABLE(pTblNd->GetTable()) SwSelBoxes aSelBoxes; - SwTxtFmtColl* pColl = rDoc.GetTxtCollFromPool( RES_POOLCOLL_STANDARD ); + SwTxtFmtColl* pColl = rDoc.getIDocumentStylePoolAccess().GetTxtCollFromPool( RES_POOLCOLL_STANDARD ); std::set<sal_uLong>::iterator it; for (it = m_Boxes.begin(); it != m_Boxes.end(); ++it) diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx index 4d14470c2ea3..1c972ed70746 100644 --- a/sw/source/core/unocore/unofield.cxx +++ b/sw/source/core/unocore/unofield.cxx @@ -30,6 +30,7 @@ #include <doc.hxx> #include <IDocumentFieldsAccess.hxx> #include <IDocumentStatistics.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <IDocumentState.hxx> #include <hints.hxx> #include <fmtfld.hxx> @@ -524,7 +525,7 @@ SwXFieldMaster::getSupportedServiceNames() throw (uno::RuntimeException, std::ex } SwXFieldMaster::SwXFieldMaster(SwDoc *const pDoc, sal_uInt16 const nResId) - : m_pImpl(new Impl(*this, pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD), + : m_pImpl(new Impl(*this, pDoc->getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD), *pDoc, nResId, true)) { } @@ -2926,7 +2927,7 @@ public: sal_Int32 m_nNextIndex; ///< index of next element to be returned Impl(SwDoc & rDoc) - : SwClient(rDoc.GetPageDescFromPool(RES_POOLPAGE_STANDARD)) + : SwClient(rDoc.getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD)) , m_pDoc(& rDoc) , m_nNextIndex(0) { } diff --git a/sw/source/core/unocore/unoflatpara.cxx b/sw/source/core/unocore/unoflatpara.cxx index 555a0ff9d218..517c7ec2f905 100644 --- a/sw/source/core/unocore/unoflatpara.cxx +++ b/sw/source/core/unocore/unoflatpara.cxx @@ -30,6 +30,7 @@ #include <ndtxt.hxx> #include <doc.hxx> #include <docsh.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <viewsh.hxx> #include <viewimp.hxx> #include <breakit.hxx> @@ -347,7 +348,7 @@ SwXFlatParagraphIterator::SwXFlatParagraphIterator( SwDoc& rDoc, sal_Int32 nType //mnStartNode = mnCurrentNode = get node from current cursor TODO! // register as listener and get notified when document is closed - mpDoc->GetPageDescFromPool( RES_POOLPAGE_STANDARD )->Add(this); + mpDoc->getIDocumentStylePoolAccess().GetPageDescFromPool( RES_POOLPAGE_STANDARD )->Add(this); } SwXFlatParagraphIterator::~SwXFlatParagraphIterator() diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index 694fda405394..50534a3c9f3d 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -44,6 +44,7 @@ #include <IDocumentUndoRedo.hxx> #include <IDocumentDrawModelAccess.hxx> #include <IDocumentLayoutAccess.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <docsh.hxx> #include <editsh.hxx> #include <swcli.hxx> @@ -967,7 +968,7 @@ bool SwFrameProperties_Impl::AnyToItemSet(SwDoc *pDoc, SfxItemSet& rSet, SfxItem } else { - const :: SfxItemSet *pItemSet = &pDoc->GetFrmFmtFromPool( RES_POOLFRM_FRAME )->GetAttrSet(); + const :: SfxItemSet *pItemSet = &pDoc->getIDocumentStylePoolAccess().GetFrmFmtFromPool( RES_POOLFRM_FRAME )->GetAttrSet(); bRet = FillBaseProperties( rSet, *pItemSet, rSizeFound ); lcl_FillCol ( rSet, *pItemSet, pColumns ); } @@ -1046,7 +1047,7 @@ bool SwGraphicProperties_Impl::AnyToItemSet( } else { - const :: SfxItemSet *pItemSet = &pDoc->GetFrmFmtFromPool( RES_POOLFRM_GRAPHIC )->GetAttrSet(); + const :: SfxItemSet *pItemSet = &pDoc->getIDocumentStylePoolAccess().GetFrmFmtFromPool( RES_POOLFRM_GRAPHIC )->GetAttrSet(); bRet = FillBaseProperties(rFrmSet, *pItemSet, rSizeFound); lcl_FillMirror ( rGrSet, *pItemSet, pHEvenMirror, pHOddMirror, pVMirror, bRet ); } @@ -1167,7 +1168,7 @@ SwXFrame::SwXFrame(FlyCntType eSet, const :: SfxItemPropertySet* pSet, SwDoc *pD , m_pCopySource(0) { // Register ourselves as a listener to the document (via the page descriptor) - pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this); + pDoc->getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this); // get the property set for the default style data // First get the model uno::Reference < XModel > xModel = pDoc->GetDocShell()->GetBaseModel(); diff --git a/sw/source/core/unocore/unoredline.cxx b/sw/source/core/unocore/unoredline.cxx index f6f0c401ae49..48f4e17066db 100644 --- a/sw/source/core/unocore/unoredline.cxx +++ b/sw/source/core/unocore/unoredline.cxx @@ -39,6 +39,7 @@ #include <unoport.hxx> #include <unoredline.hxx> #include <doc.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <docary.hxx> using namespace ::com::sun::star; @@ -385,7 +386,7 @@ SwXRedline::SwXRedline(SwRangeRedline& rRedline, SwDoc& rDoc) : pDoc(&rDoc), pRedline(&rRedline) { - pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this); + pDoc->getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this); } SwXRedline::~SwXRedline() diff --git a/sw/source/core/unocore/unoredlines.cxx b/sw/source/core/unocore/unoredlines.cxx index 639dda3d9343..94891fb31d42 100644 --- a/sw/source/core/unocore/unoredlines.cxx +++ b/sw/source/core/unocore/unoredlines.cxx @@ -29,6 +29,7 @@ #include <pagedesc.hxx> #include "poolfmt.hxx" #include <doc.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <docary.hxx> #include <redline.hxx> #include <switerator.hxx> @@ -114,7 +115,7 @@ uno::Sequence< OUString > SwXRedlines::getSupportedServiceNames(void) beans::XPropertySet* SwXRedlines::GetObject( SwRangeRedline& rRedline, SwDoc& rDoc ) { - SwPageDesc* pStdDesc = rDoc.GetPageDescFromPool(RES_POOLPAGE_STANDARD); + SwPageDesc* pStdDesc = rDoc.getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD); SwIterator<SwXRedline,SwPageDesc> aIter(*pStdDesc); SwXRedline* pxRedline = aIter.First(); while(pxRedline) @@ -132,7 +133,7 @@ SwXRedlineEnumeration::SwXRedlineEnumeration(SwDoc& rDoc) : pDoc(&rDoc), nCurrentIndex(0) { - pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this); + pDoc->getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this); } SwXRedlineEnumeration::~SwXRedlineEnumeration() diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx index 30ceae526e18..ca92aaab3d3c 100644 --- a/sw/source/core/unocore/unosett.cxx +++ b/sw/source/core/unocore/unosett.cxx @@ -32,6 +32,7 @@ #include <ftninfo.hxx> #include <doc.hxx> #include <pagedesc.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <charfmt.hxx> #include <lineinfo.hxx> #include <docsh.hxx> @@ -212,7 +213,7 @@ static SwCharFmt* lcl_getCharFmt(SwDoc* pDoc, const uno::Any& aValue) { const sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(sCharFmt, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT); if(USHRT_MAX != nId) - pRet = pDoc->GetCharFmtFromPool( nId ); + pRet = pDoc->getIDocumentStylePoolAccess().GetCharFmtFromPool( nId ); } return pRet; } @@ -228,7 +229,7 @@ static SwTxtFmtColl* lcl_GetParaStyle(SwDoc* pDoc, const uno::Any& aValue) { const sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName( sParaStyle, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL ); if( USHRT_MAX != nId ) - pRet = pDoc->GetTxtCollFromPool( nId ); + pRet = pDoc->getIDocumentStylePoolAccess().GetTxtCollFromPool( nId ); } return pRet; } @@ -254,7 +255,7 @@ static SwPageDesc* lcl_GetPageDesc(SwDoc* pDoc, const uno::Any& aValue) { const sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(sPageDesc, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC); if(USHRT_MAX != nId) - pRet = pDoc->GetPageDescFromPool( nId ); + pRet = pDoc->getIDocumentStylePoolAccess().GetPageDescFromPool( nId ); } return pRet; } @@ -994,7 +995,7 @@ Any SwXLineNumberingProperties::getPropertyValue(const OUString& rPropertyName) if(rInfo.HasCharFormat()) { SwStyleNameMapper::FillProgName( - rInfo.GetCharFmt(*pDoc)->GetName(), + rInfo.GetCharFmt(pDoc->getIDocumentStylePoolAccess())->GetName(), aString, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, true); @@ -1159,7 +1160,7 @@ SwXNumberingRules::SwXNumberingRules(const SwNumRule& rRule, SwDoc* doc) : } } if(pDoc) - pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this); + pDoc->getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this); for(sal_uInt16 i = 0; i < MAXLEVEL; ++i) { m_sNewCharStyleNames[i] = aInvalidStyle; @@ -1174,7 +1175,7 @@ SwXNumberingRules::SwXNumberingRules(SwDocShell& rDocSh) : m_pPropertySet(GetNumberingRulesSet()), bOwnNumRuleCreated(false) { - pDocShell->GetDoc()->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this); + pDocShell->GetDoc()->getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this); } SwXNumberingRules::SwXNumberingRules(SwDoc& rDoc) : @@ -1184,7 +1185,7 @@ SwXNumberingRules::SwXNumberingRules(SwDoc& rDoc) : m_pPropertySet(GetNumberingRulesSet()), bOwnNumRuleCreated(false) { - rDoc.GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this); + rDoc.getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this); m_sCreatedNumRuleName = rDoc.GetUniqueNumRuleName(); #if OSL_DEBUG_LEVEL > 1 const sal_uInt16 nIndex = diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index a58cf4c08140..2f9912c45ea6 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -38,6 +38,7 @@ #include <doc.hxx> #include <IDocumentUndoRedo.hxx> #include <IDocumentDeviceAccess.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <docary.hxx> #include <charfmt.hxx> #include <cmdid.h> @@ -1197,7 +1198,7 @@ SwXStyle::SwXStyle( SwDoc *pDoc, SfxStyleFamily eFam, bool bConditional) : bIsConditional(bConditional) { // Register ourselves as a listener to the document (via the page descriptor) - pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this); + pDoc->getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this); // get the property set for the default style data // First get the model uno::Reference < frame::XModel > xModel = pDoc->GetDocShell()->GetBaseModel(); @@ -1616,7 +1617,7 @@ const SwPageDesc& SwStyleBase_Impl::GetOldPageDesc() { if(SW_RESSTR(i) == mrStyleName) { - mpOldPageDesc = mrDoc.GetPageDescFromPool( static_cast< sal_uInt16 >(RES_POOLPAGE_BEGIN + i - RC_POOLPAGEDESC_BEGIN) ); + mpOldPageDesc = mrDoc.getIDocumentStylePoolAccess().GetPageDescFromPool( static_cast< sal_uInt16 >(RES_POOLPAGE_BEGIN + i - RC_POOLPAGEDESC_BEGIN) ); break; } } @@ -3131,7 +3132,7 @@ void SAL_CALL SwXStyle::setAllPropertiesToDefault( ) aUL.SetLower(static_cast <sal_uInt16> (nSize)); pTargetFmt->SetFmtAttr(aLR); pTargetFmt->SetFmtAttr(aUL); - SwPageDesc* pStdPgDsc = m_pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD); + SwPageDesc* pStdPgDsc = m_pDoc->getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD); SwFmtFrmSize aFrmSz(ATT_FIX_SIZE); if(RES_POOLPAGE_STANDARD == rPageDesc.GetPoolFmtId()) @@ -4101,7 +4102,7 @@ SwXAutoStyleFamily::SwXAutoStyleFamily(SwDocShell* pDocSh, IStyleAccess::SwAutoS pDocShell( pDocSh ), eFamily(nFamily) { // Register ourselves as a listener to the document (via the page descriptor) - pDocSh->GetDoc()->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this); + pDocSh->GetDoc()->getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this); } SwXAutoStyleFamily::~SwXAutoStyleFamily() @@ -4404,7 +4405,7 @@ SwXAutoStylesEnumerator::SwXAutoStylesEnumerator( SwDoc* pDoc, IStyleAccess::SwA : pImpl( new SwAutoStylesEnumImpl( pDoc, eFam ) ) { // Register ourselves as a listener to the document (via the page descriptor) - pDoc->GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this); + pDoc->getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this); } SwXAutoStylesEnumerator::~SwXAutoStylesEnumerator() @@ -4462,7 +4463,7 @@ SwXAutoStyle::SwXAutoStyle( mrDoc(*pDoc) { // Register ourselves as a listener to the document (via the page descriptor) - mrDoc.GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this); + mrDoc.getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD)->Add(this); } SwXAutoStyle::~SwXAutoStyle() diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index 363ad2f35b50..5b308afbc39c 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -2536,7 +2536,7 @@ IDocumentRedlineAccess* SwViewShell::getIDocumentRedlineAccess() { return &mpDoc const IDocumentLayoutAccess* SwViewShell::getIDocumentLayoutAccess() const { return &mpDoc->getIDocumentLayoutAccess(); } IDocumentLayoutAccess* SwViewShell::getIDocumentLayoutAccess() { return &mpDoc->getIDocumentLayoutAccess(); } IDocumentContentOperations* SwViewShell::getIDocumentContentOperations() { return &mpDoc->getIDocumentContentOperations(); } -IDocumentStylePoolAccess* SwViewShell::getIDocumentStylePoolAccess() { return mpDoc; } +IDocumentStylePoolAccess* SwViewShell::getIDocumentStylePoolAccess() { return &mpDoc->getIDocumentStylePoolAccess(); } const IDocumentStatistics* SwViewShell::getIDocumentStatistics() const { return &mpDoc->getIDocumentStatistics(); } IDocumentUndoRedo & SwViewShell::GetIDocumentUndoRedo() diff --git a/sw/source/filter/ascii/parasc.cxx b/sw/source/filter/ascii/parasc.cxx index 7265d8ef5e26..803ef460e88c 100644 --- a/sw/source/filter/ascii/parasc.cxx +++ b/sw/source/filter/ascii/parasc.cxx @@ -29,6 +29,7 @@ #include <shellio.hxx> #include <doc.hxx> #include <IDocumentDeviceAccess.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <swtypes.hxx> #include <ndtxt.hxx> #include <pam.hxx> @@ -155,9 +156,9 @@ sal_uLong SwASCIIParser::CallParser() if (bNewDoc) { - pColl = pDoc->GetTxtCollFromPool(RES_POOLCOLL_HTML_PRE, false); + pColl = pDoc->getIDocumentStylePoolAccess().GetTxtCollFromPool(RES_POOLCOLL_HTML_PRE, false); if (!pColl) - pColl = pDoc->GetTxtCollFromPool(RES_POOLCOLL_STANDARD,false); + pColl = pDoc->getIDocumentStylePoolAccess().GetTxtCollFromPool(RES_POOLCOLL_STANDARD,false); if (pColl) pDoc->SetTxtFmtColl(*pPam, pColl); } diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx index 593782a2725e..9c7898f93037 100644 --- a/sw/source/filter/basflt/shellio.cxx +++ b/sw/source/filter/basflt/shellio.cxx @@ -43,6 +43,7 @@ #include <IDocumentRedlineAccess.hxx> #include <IDocumentFieldsAccess.hxx> #include <IDocumentState.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <pam.hxx> #include <editsh.hxx> #include <undobj.hxx> @@ -627,7 +628,7 @@ void Reader::ResetFrmFmts( SwDoc& rDoc ) }; for (sal_uInt16 i = 0; i < SAL_N_ELEMENTS(s_ids); ++i) { - SwFrmFmt *const pFrmFmt = rDoc.GetFrmFmtFromPool( s_ids[i] ); + SwFrmFmt *const pFrmFmt = rDoc.getIDocumentStylePoolAccess().GetFrmFmtFromPool( s_ids[i] ); pFrmFmt->ResetFmtAttr( RES_LR_SPACE ); pFrmFmt->ResetFmtAttr( RES_UL_SPACE ); @@ -921,8 +922,8 @@ bool SetHTMLTemplate( SwDoc & rDoc ) if( pCNd ) { pCNd->SetAttr - ( SwFmtPageDesc(rDoc.GetPageDescFromPool(RES_POOLPAGE_HTML, false) ) ); - pCNd->ChgFmtColl( rDoc.GetTxtCollFromPool( RES_POOLCOLL_TEXT, false )); + ( SwFmtPageDesc(rDoc.getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_HTML, false) ) ); + pCNd->ChgFmtColl( rDoc.getIDocumentStylePoolAccess().GetTxtCollFromPool( RES_POOLCOLL_TEXT, false )); } return bRet; diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx index b9cc4c687b4d..8c8032ddc128 100644 --- a/sw/source/filter/html/css1atr.cxx +++ b/sw/source/filter/html/css1atr.cxx @@ -564,7 +564,7 @@ void SwHTMLWriter::OutStyleSheet( const SwPageDesc& rPageDesc, bool bUsed ) sal_uInt16 nPoolId = pColl->GetPoolFmtId(); if( !bUsed || nPoolId == RES_POOLCOLL_TEXT || pDoc->IsUsed( *pColl ) ) - OutCSS1_SwFmt( *this, *pColl, pDoc, pTemplate ); + OutCSS1_SwFmt( *this, *pColl, &pDoc->getIDocumentStylePoolAccess(), pTemplate ); } // the Default-TextStyle is not also exported !! @@ -576,7 +576,7 @@ void SwHTMLWriter::OutStyleSheet( const SwPageDesc& rPageDesc, bool bUsed ) if( !bUsed || nPoolId == RES_POOLCHR_INET_NORMAL || nPoolId == RES_POOLCHR_INET_VISIT || pDoc->IsUsed( *pCFmt ) ) - OutCSS1_SwFmt( *this, *pCFmt, pDoc, pTemplate ); + OutCSS1_SwFmt( *this, *pCFmt, &pDoc->getIDocumentStylePoolAccess(), pTemplate ); } const SwFtnIdxs& rIdxs = pDoc->GetFtnIdxs(); @@ -1512,16 +1512,16 @@ static Writer& OutCSS1_SwFmt( Writer& rWrt, const SwFmt& rFmt, switch( nDeep ) { case CSS1_FMT_ISTAG: - pRefFmt = SwHTMLWriter::GetTemplateFmt( nRefPoolId, pTemplate ); + pRefFmt = SwHTMLWriter::GetTemplateFmt( nRefPoolId, &pTemplate->getIDocumentStylePoolAccess() ); break; case CSS1_FMT_CMPREF: pRefFmt = SwHTMLWriter::GetTemplateFmt( nRefPoolId, pDoc ); - pRefFmtScript = SwHTMLWriter::GetTemplateFmt( nRefPoolId, pTemplate ); + pRefFmtScript = SwHTMLWriter::GetTemplateFmt( nRefPoolId, &pTemplate->getIDocumentStylePoolAccess() ); bClearSame = false; break; default: pRefFmt = SwHTMLWriter::GetParentFmt( rFmt, nDeep ); - pRefFmtScript = SwHTMLWriter::GetTemplateFmt( nRefPoolId, pTemplate ); + pRefFmtScript = SwHTMLWriter::GetTemplateFmt( nRefPoolId, &pTemplate->getIDocumentStylePoolAccess() ); bSetDefaults = false; break; } @@ -1639,7 +1639,7 @@ static Writer& OutCSS1_SwPageDesc( Writer& rWrt, const SwPageDesc& rPageDesc, if( !bExtRef ) pRefPageDesc = pDoc->GetPageDescFromPool( nRefPoolId, false ); else if( pTemplate ) - pRefPageDesc = pTemplate->GetPageDescFromPool( nRefPoolId, false ); + pRefPageDesc = pTemplate->getIDocumentStylePoolAccess().GetPageDescFromPool( nRefPoolId, false ); OUString aSelector = "@" + OStringToOUString( sCSS1_page, RTL_TEXTENCODING_ASCII_US ); @@ -1764,7 +1764,7 @@ static Writer& OutCSS1_SwFtnInfo( Writer& rWrt, const SwEndNoteInfo& rInfo, // footnote and endnote template. if( nNotes == 0 && rHTMLWrt.pTemplate ) { - SwFmt *pRefFmt = rHTMLWrt.pTemplate->GetCharFmtFromPool( + SwFmt *pRefFmt = rHTMLWrt.pTemplate->getIDocumentStylePoolAccess().GetCharFmtFromPool( static_cast< sal_uInt16 >(bEndNote ? RES_POOLCHR_ENDNOTE : RES_POOLCHR_FOOTNOTE) ); if( pRefFmt ) SwHTMLWriter::SubtractItemSet( aItemSet, pRefFmt->GetAttrSet(), diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx index a4e57ddc1d75..3bf58a5c4b22 100644 --- a/sw/source/filter/html/htmlatr.cxx +++ b/sw/source/filter/html/htmlatr.cxx @@ -60,6 +60,7 @@ #include <charfmt.hxx> #include <fmtfld.hxx> #include <doc.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <pam.hxx> #include <ndtxt.hxx> #include <paratr.hxx> @@ -269,7 +270,7 @@ SwHTMLFmtInfo::SwHTMLFmtInfo( const SwFmt *pF, SwDoc *pDoc, SwDoc *pTemplate, // fuer HTML-Tag-Vorlagen die Unterscheide zum Original // (sofern verfuegbar) pReferenceFmt = SwHTMLWriter::GetTemplateFmt( nRefPoolId, - pTemplate ); + &pTemplate->getIDocumentStylePoolAccess() ); break; default: @@ -277,7 +278,7 @@ SwHTMLFmtInfo::SwHTMLFmtInfo( const SwFmt *pF, SwDoc *pDoc, SwDoc *pTemplate, // aktuellen Doks, wenn die nicht verfuegbar ist if( pTemplate ) pReferenceFmt = SwHTMLWriter::GetTemplateFmt( nRefPoolId, - pTemplate ); + &pTemplate->getIDocumentStylePoolAccess() ); else pReferenceFmt = SwHTMLWriter::GetParentFmt( *pFmt, nDeep ); break; @@ -291,9 +292,9 @@ SwHTMLFmtInfo::SwHTMLFmtInfo( const SwFmt *pF, SwDoc *pDoc, SwDoc *pTemplate, // exportiert werden. Fuer Nicht-Styles-Export sollte die der // HTML-Vorlage als Referenz dienen if( !bOutStyles && pTemplate ) - pReferenceFmt = pTemplate->GetTxtCollFromPool( RES_POOLCOLL_TEXT, false ); + pReferenceFmt = pTemplate->getIDocumentStylePoolAccess().GetTxtCollFromPool( RES_POOLCOLL_TEXT, false ); else - pReferenceFmt = pDoc->GetTxtCollFromPool( RES_POOLCOLL_TEXT, false ); + pReferenceFmt = pDoc->getIDocumentStylePoolAccess().GetTxtCollFromPool( RES_POOLCOLL_TEXT, false ); } if( pReferenceFmt || nDeep==0 ) @@ -382,7 +383,7 @@ SwHTMLFmtInfo::SwHTMLFmtInfo( const SwFmt *pF, SwDoc *pDoc, SwDoc *pTemplate, bool bPut = true; if( pTemplate ) { - pReferenceFmt = SwHTMLWriter::GetTemplateFmt( nRefPoolId, pTemplate ); + pReferenceFmt = SwHTMLWriter::GetTemplateFmt( nRefPoolId, &pTemplate->getIDocumentStylePoolAccess() ); const SfxPoolItem *pRefItem; bool bRefItemSet = SFX_ITEM_SET==pReferenceFmt->GetAttrSet().GetItemState( @@ -1817,9 +1818,9 @@ void HTMLEndPosLst::Insert( const SfxPoolItem& rItem, break; case RES_TXTATR_INETFMT: { - if( GetFmtInfo( *pDoc->GetCharFmtFromPool( + if( GetFmtInfo( *pDoc->getIDocumentStylePoolAccess().GetCharFmtFromPool( RES_POOLCHR_INET_NORMAL), rFmtInfos )->bScriptDependent || - GetFmtInfo( *pDoc->GetCharFmtFromPool( + GetFmtInfo( *pDoc->getIDocumentStylePoolAccess().GetCharFmtFromPool( RES_POOLCHR_INET_VISIT), rFmtInfos )->bScriptDependent ) { bDependsOnScript = true; @@ -2091,7 +2092,7 @@ Writer& OutHTML_SwTxtNode( Writer& rWrt, const SwCntntNode& rNode ) if( nLeft || nRight ) { const SwFrmFmt& rPgFmt = - rHTMLWrt.pDoc->GetPageDescFromPool + rHTMLWrt.pDoc->getIDocumentStylePoolAccess().GetPageDescFromPool ( RES_POOLPAGE_HTML, false )->GetMaster(); const SwFmtFrmSize& rSz = rPgFmt.GetFrmSize(); const SvxLRSpaceItem& rLR = rPgFmt.GetLRSpace(); @@ -2942,7 +2943,7 @@ Writer& OutHTML_INetFmt( Writer& rWrt, const SwFmtINetFmt& rINetFmt, bool bOn ) bool bScriptDependent = false; { - const SwCharFmt* pFmt = rWrt.pDoc->GetCharFmtFromPool( + const SwCharFmt* pFmt = rWrt.pDoc->getIDocumentStylePoolAccess().GetCharFmtFromPool( RES_POOLCHR_INET_NORMAL ); SwHTMLFmtInfo aFmtInfo( pFmt ); SwHTMLFmtInfos::const_iterator it = rHTMLWrt.aChrFmtInfos.find( aFmtInfo ); @@ -2953,7 +2954,7 @@ Writer& OutHTML_INetFmt( Writer& rWrt, const SwFmtINetFmt& rINetFmt, bool bOn ) } if( !bScriptDependent ) { - const SwCharFmt* pFmt = rWrt.pDoc->GetCharFmtFromPool( + const SwCharFmt* pFmt = rWrt.pDoc->getIDocumentStylePoolAccess().GetCharFmtFromPool( RES_POOLCHR_INET_VISIT ); SwHTMLFmtInfo aFmtInfo( pFmt ); SwHTMLFmtInfos::const_iterator it = rHTMLWrt.aChrFmtInfos.find( aFmtInfo ); diff --git a/sw/source/filter/html/htmlcss1.cxx b/sw/source/filter/html/htmlcss1.cxx index 3341816f751a..0ea2a03155c6 100644 --- a/sw/source/filter/html/htmlcss1.cxx +++ b/sw/source/filter/html/htmlcss1.cxx @@ -48,6 +48,7 @@ #include <svx/svxids.hrc> #include "doc.hxx" +#include <IDocumentStylePoolAccess.hxx> #include "pam.hxx" #include "ndtxt.hxx" #include "poolfmt.hxx" @@ -562,7 +563,7 @@ void SwCSS1Parser::SetPageDescAttrs( const SwPageDesc *pPageDesc, const SvxBrushItem& SwCSS1Parser::GetPageDescBackground() const { - return pDoc->GetPageDescFromPool( RES_POOLPAGE_HTML, false ) + return pDoc->getIDocumentStylePoolAccess().GetPageDescFromPool( RES_POOLPAGE_HTML, false ) ->GetMaster().GetBackground(); } @@ -1227,7 +1228,7 @@ SwTxtFmtColl *SwCSS1Parser::GetTxtCollFromPool( sal_uInt16 nPoolId ) const { sal_uInt16 nOldArrLen = pDoc->GetTxtFmtColls()->size(); - SwTxtFmtColl *pColl = pDoc->GetTxtCollFromPool( nPoolId, false ); + SwTxtFmtColl *pColl = pDoc->getIDocumentStylePoolAccess().GetTxtCollFromPool( nPoolId, false ); if( bIsNewDoc ) { @@ -1244,7 +1245,7 @@ SwCharFmt *SwCSS1Parser::GetCharFmtFromPool( sal_uInt16 nPoolId ) const { sal_uInt16 nOldArrLen = pDoc->GetCharFmts()->size(); - SwCharFmt *pCharFmt = pDoc->GetCharFmtFromPool( nPoolId ); + SwCharFmt *pCharFmt = pDoc->getIDocumentStylePoolAccess().GetCharFmtFromPool( nPoolId ); if( bIsNewDoc ) { @@ -1342,7 +1343,7 @@ SwTxtFmtColl *SwCSS1Parser::GetTxtFmtColl( sal_uInt16 nTxtColl, SwPageDesc *SwCSS1Parser::GetMasterPageDesc() { - return pDoc->GetPageDescFromPool( RES_POOLPAGE_HTML, false ); + return pDoc->getIDocumentStylePoolAccess().GetPageDescFromPool( RES_POOLPAGE_HTML, false ); } static SwPageDesc *FindPageDesc(SwDoc *pDoc, sal_uInt16 nPoolId) @@ -1359,7 +1360,7 @@ static SwPageDesc *FindPageDesc(SwDoc *pDoc, sal_uInt16 nPoolId) const SwPageDesc *SwCSS1Parser::GetPageDesc( sal_uInt16 nPoolId, bool bCreate ) { if( RES_POOLPAGE_HTML == nPoolId ) - return pDoc->GetPageDescFromPool( RES_POOLPAGE_HTML, false ); + return pDoc->getIDocumentStylePoolAccess().GetPageDescFromPool( RES_POOLPAGE_HTML, false ); const SwPageDesc *pPageDesc = FindPageDesc(pDoc, nPoolId); if( !pPageDesc && bCreate ) @@ -1370,11 +1371,11 @@ const SwPageDesc *SwCSS1Parser::GetPageDesc( sal_uInt16 nPoolId, bool bCreate ) if( RES_POOLPAGE_FIRST == nPoolId ) pMasterPageDesc = FindPageDesc(pDoc, RES_POOLPAGE_RIGHT); if( !pMasterPageDesc ) - pMasterPageDesc = pDoc->GetPageDescFromPool( RES_POOLPAGE_HTML, false ); + pMasterPageDesc = pDoc->getIDocumentStylePoolAccess().GetPageDescFromPool( RES_POOLPAGE_HTML, false ); // Die neue Seitenvorlage entsteht aus dem Master durch kopieren. SwPageDesc *pNewPageDesc = pDoc-> - GetPageDescFromPool( nPoolId, false ); + getIDocumentStylePoolAccess().GetPageDescFromPool( nPoolId, false ); // dazu brauchen wir auch die Nummer der neuen Vorlage OSL_ENSURE(pNewPageDesc == FindPageDesc(pDoc, nPoolId), "Seitenvorlage nicht gefunden"); @@ -1823,7 +1824,7 @@ bool SwCSS1Parser::ParseStyleSheet( const OUString& rIn ) return false; SwPageDesc *pMasterPageDesc = - pDoc->GetPageDescFromPool( RES_POOLPAGE_HTML, false ); + pDoc->getIDocumentStylePoolAccess().GetPageDescFromPool( RES_POOLPAGE_HTML, false ); SvxCSS1MapEntry *pPageEntry = GetPage( aEmptyOUStr, false ); if( pPageEntry ) diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index c3f61af78f29..2d701fa8c357 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -82,6 +82,7 @@ #include <IDocumentLinksAdministration.hxx> #include <IDocumentRedlineAccess.hxx> #include <IDocumentFieldsAccess.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <IDocumentStatistics.hxx> #include <IDocumentState.hxx> #include <pam.hxx> @@ -202,7 +203,7 @@ sal_uLong HTMLReader::Read( SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPam, if( !rDoc.getIDocumentSettingAccess().get(IDocumentSettingAccess::HTML_MODE) ) { rDoc.getIDocumentContentOperations().InsertPoolItem( rPam, SwFmtPageDesc( - rDoc.GetPageDescFromPool( RES_POOLPAGE_HTML, false )), 0 ); + rDoc.getIDocumentStylePoolAccess().GetPageDescFromPool( RES_POOLPAGE_HTML, false )), 0 ); } } diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx index 2a5f8e539fb8..1a34ff663a1f 100644 --- a/sw/source/filter/html/wrthtml.cxx +++ b/sw/source/filter/html/wrthtml.cxx @@ -78,6 +78,7 @@ #include <swerror.h> #include <rtl/strbuf.hxx> #include <IDocumentSettingAccess.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <xmloff/odffields.hxx> #define MAX_INDENT_LEVEL 20 @@ -289,7 +290,7 @@ sal_uLong SwHTMLWriter::WriteStream() nLastLFPos = 0; nDefListLvl = 0; nDefListMargin = ((pTemplate && !bCfgOutStyles) ? pTemplate : pDoc) - ->GetTxtCollFromPool( RES_POOLCOLL_HTML_DD, false ) + ->getIDocumentStylePoolAccess().GetTxtCollFromPool( RES_POOLCOLL_HTML_DD, false ) ->GetLRSpace().GetTxtLeft(); nHeaderFooterSpace = 0; nTxtAttrsToIgnore = 0; @@ -823,7 +824,7 @@ static void OutBodyColor( const sal_Char* pTag, const SwFmt *pFmt, if( rHWrt.pTemplate ) pRefFmt = SwHTMLWriter::GetTemplateFmt( pFmt->GetPoolFmtId(), - rHWrt.pTemplate ); + &rHWrt.pTemplate->getIDocumentStylePoolAccess() ); const SvxColorItem *pColorItem = 0; @@ -1016,15 +1017,15 @@ const SwPageDesc *SwHTMLWriter::MakeHeader( sal_uInt16 &rHeaderAttrs ) // Textfarbe ausgeben, wenn sie an der Standard-Vorlage gesetzt ist // und sich geaendert hat. OutBodyColor( OOO_STRING_SVTOOLS_HTML_O_text, - pDoc->GetTxtCollFromPool( RES_POOLCOLL_STANDARD, false ), + pDoc->getIDocumentStylePoolAccess().GetTxtCollFromPool( RES_POOLCOLL_STANDARD, false ), *this ); // Farben fuer (un)besuchte Links OutBodyColor( OOO_STRING_SVTOOLS_HTML_O_link, - pDoc->GetCharFmtFromPool( RES_POOLCHR_INET_NORMAL ), + pDoc->getIDocumentStylePoolAccess().GetCharFmtFromPool( RES_POOLCHR_INET_NORMAL ), *this ); OutBodyColor( OOO_STRING_SVTOOLS_HTML_O_vlink, - pDoc->GetCharFmtFromPool( RES_POOLCHR_INET_VISIT ), + pDoc->getIDocumentStylePoolAccess().GetCharFmtFromPool( RES_POOLCHR_INET_VISIT ), *this ); const SfxItemSet& rItemSet = pPageDesc->GetMaster().GetAttrSet(); diff --git a/sw/source/filter/rtf/swparrtf.cxx b/sw/source/filter/rtf/swparrtf.cxx index 01cd541e9f7f..b144f0b86f2d 100644 --- a/sw/source/filter/rtf/swparrtf.cxx +++ b/sw/source/filter/rtf/swparrtf.cxx @@ -23,6 +23,7 @@ #include <ndtxt.hxx> #include <doc.hxx> #include <docsh.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <pam.hxx> #include <swerror.h> @@ -68,7 +69,7 @@ sal_uLong SwRTFReader::Read( SwDoc &rDoc, const OUString& /*rBaseURL*/, SwPaM& r // Step 4: Insert all content into the new node rPam.Move( fnMoveBackward ); rDoc.SetTxtFmtColl - ( rPam, rDoc.GetTxtCollFromPool(RES_POOLCOLL_STANDARD, false ) ); + ( rPam, rDoc.getIDocumentStylePoolAccess().GetTxtCollFromPool(RES_POOLCOLL_STANDARD, false ) ); SwDocShell *pDocShell(rDoc.GetDocShell()); uno::Reference<lang::XMultiServiceFactory> xMultiServiceFactory(comphelper::getProcessServiceFactory()); diff --git a/sw/source/filter/writer/writer.cxx b/sw/source/filter/writer/writer.cxx index 7ba91b20fee6..a85db796b131 100644 --- a/sw/source/filter/writer/writer.cxx +++ b/sw/source/filter/writer/writer.cxx @@ -136,8 +136,8 @@ Writer::~Writer() */ IDocumentSettingAccess* Writer::getIDocumentSettingAccess() { return &pDoc->getIDocumentSettingAccess(); } const IDocumentSettingAccess* Writer::getIDocumentSettingAccess() const { return &pDoc->getIDocumentSettingAccess(); } -IDocumentStylePoolAccess* Writer::getIDocumentStylePoolAccess() { return pDoc; } -const IDocumentStylePoolAccess* Writer::getIDocumentStylePoolAccess() const { return pDoc; } +IDocumentStylePoolAccess* Writer::getIDocumentStylePoolAccess() { return &pDoc->getIDocumentStylePoolAccess(); } +const IDocumentStylePoolAccess* Writer::getIDocumentStylePoolAccess() const { return &pDoc->getIDocumentStylePoolAccess(); } void Writer::ResetWriter() { diff --git a/sw/source/filter/ww1/fltshell.cxx b/sw/source/filter/ww1/fltshell.cxx index 704a8becac0a..b59f30915253 100644 --- a/sw/source/filter/ww1/fltshell.cxx +++ b/sw/source/filter/ww1/fltshell.cxx @@ -47,6 +47,7 @@ #include <doc.hxx> #include <IDocumentFieldsAccess.hxx> #include <IDocumentRedlineAccess.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <IDocumentState.hxx> #include <IDocumentLayoutAccess.hxx> #include <ndtxt.hxx> @@ -1541,7 +1542,7 @@ void SwFltOutDoc::NextTableCell() GetDoc().IsIdxInTbl(pPaM->GetPoint()->nNode), pTableLine, (SwTableBoxFmt*)pTableBox->GetFrmFmt(), - GetDoc().GetTxtCollFromPool(RES_POOLCOLL_STANDARD, false ), + GetDoc().getIDocumentStylePoolAccess().GetTxtCollFromPool(RES_POOLCOLL_STANDARD, false ), 0, pTableBoxes->size()); SeekCell(usTableY, usTableX, true); @@ -1563,7 +1564,7 @@ void SwFltOutDoc::NextTableRow() usTableX = 0; SeekCell(++usTableY, usTableX, true); GetDoc().SetTxtFmtColl(*pPaM, - GetDoc().GetTxtCollFromPool(RES_POOLCOLL_STANDARD, false )); + GetDoc().getIDocumentStylePoolAccess().GetTxtCollFromPool(RES_POOLCOLL_STANDARD, false )); } } @@ -1750,7 +1751,7 @@ bool SwFltOutDoc::SeekCell(short nRow, short nCol, bool bPam) pPaM->GetPoint()->nNode = pTableBox->GetSttIdx() + 1; pPaM->GetPoint()->nContent.Assign(pPaM->GetCntntNode(), 0); GetDoc().SetTxtFmtColl(*pPaM, - GetDoc().GetTxtCollFromPool(RES_POOLCOLL_STANDARD, false )); + GetDoc().getIDocumentStylePoolAccess().GetTxtCollFromPool(RES_POOLCOLL_STANDARD, false )); } return true; } @@ -2107,7 +2108,7 @@ SwPageDesc* SwFltShell::MakePageDesc(SwPageDesc* pFirstPageDesc) SwFltFormatCollection::SwFltFormatCollection( SwDoc& _rDoc, RES_POOL_COLLFMT_TYPE nType ) : SwFltOutBase(_rDoc), - pColl(_rDoc.GetTxtCollFromPool( static_cast< sal_uInt16 >(nType), false )), + pColl(_rDoc.getIDocumentStylePoolAccess().GetTxtCollFromPool( static_cast< sal_uInt16 >(nType), false )), pFlyAttrs( 0 ), bHasFly( false ) { diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 59dd510b507a..e382c1b4a0e6 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -113,6 +113,7 @@ #include <docsh.hxx> #include <docary.hxx> #include <IDocumentSettingAccess.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <IDocumentRedlineAccess.hxx> #include <osl/file.hxx> @@ -3720,7 +3721,7 @@ bool lcl_isDefaultFontSize(const SvxFontHeightItem& rFontHeight, SwDoc* pDoc) { bool bRet = rFontHeight.GetHeight() != 200; // see StyleSheetTable_Impl::StyleSheetTable_Impl() where we set this default // Additionally, if the default para style has the same font size, then don't write it here. - SwTxtFmtColl* pDefaultStyle = pDoc->GetTxtCollFromPool(RES_POOLCOLL_STANDARD); + SwTxtFmtColl* pDefaultStyle = pDoc->getIDocumentStylePoolAccess().GetTxtCollFromPool(RES_POOLCOLL_STANDARD); if (pDefaultStyle) { const SfxPoolItem* pItem = 0; diff --git a/sw/source/filter/ww8/writerhelper.cxx b/sw/source/filter/ww8/writerhelper.cxx index 3135b2ba01b4..2122e14d56d1 100644 --- a/sw/source/filter/ww8/writerhelper.cxx +++ b/sw/source/filter/ww8/writerhelper.cxx @@ -51,6 +51,7 @@ #include <vcl/svapp.hxx> #include <IDocumentDrawModelAccess.hxx> #include <IDocumentLayoutAccess.hxx> +#include <IDocumentStylePoolAccess.hxx> using namespace com::sun::star; using namespace nsSwGetPoolIdFromName; @@ -487,7 +488,7 @@ namespace sw sal_uInt16 n = SwStyleNameMapper::GetPoolIdFromUIName(rName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL); if (n != SAL_MAX_UINT16) // found or standard - pColl = rDoc.GetTxtCollFromPool(n, false); + pColl = rDoc.getIDocumentStylePoolAccess().GetTxtCollFromPool(n, false); } return pColl; } @@ -501,7 +502,7 @@ namespace sw sal_uInt16 n = SwStyleNameMapper::GetPoolIdFromUIName(rName, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT); if (n != SAL_MAX_UINT16) // found or standard - pFmt = rDoc.GetCharFmtFromPool(n); + pFmt = rDoc.getIDocumentStylePoolAccess().GetCharFmtFromPool(n); } return pFmt; } diff --git a/sw/source/filter/ww8/writerwordglue.cxx b/sw/source/filter/ww8/writerwordglue.cxx index f6b1f0db0b25..ce22c37a603e 100644 --- a/sw/source/filter/ww8/writerwordglue.cxx +++ b/sw/source/filter/ww8/writerwordglue.cxx @@ -21,6 +21,7 @@ #include "writerwordglue.hxx" #include <doc.hxx> #include "writerhelper.hxx" +#include <IDocumentStylePoolAccess.hxx> #include <algorithm> #include <functional> @@ -160,7 +161,7 @@ namespace myImplHelpers //equivalent, then map it to one of our built in styles regardless //of its name if (sal::static_int_cast< size_t >(eSti) < SAL_N_ELEMENTS(aArr) && aArr[eSti] != RES_NONE) - pRet = mrDoc.GetTxtCollFromPool( static_cast< sal_uInt16 >(aArr[eSti]), false); + pRet = mrDoc.getIDocumentStylePoolAccess().GetTxtCollFromPool( static_cast< sal_uInt16 >(aArr[eSti]), false); return pRet; } @@ -221,7 +222,7 @@ namespace myImplHelpers } SwCharFmt *pRet = 0; if (eLookup != RES_POOLCHR_NORMAL_END) - pRet = mrDoc.GetCharFmtFromPool( static_cast< sal_uInt16 >(eLookup) ); + pRet = mrDoc.getIDocumentStylePoolAccess().GetCharFmtFromPool( static_cast< sal_uInt16 >(eLookup) ); return pRet; } diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index b10a2a1e6281..534610f8e516 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -58,7 +58,9 @@ #include <doc.hxx> #include <IDocumentSettingAccess.hxx> #include <IDocumentDrawModelAccess.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <IDocumentStatistics.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <IDocumentLayoutAccess.hxx> #include <viewopt.hxx> #include <docary.hxx> @@ -3215,7 +3217,7 @@ void WW8Export::ExportDocument_Impl() // set AutoHyphenation flag if found in default para style const SfxPoolItem* pItem; SwTxtFmtColl* pStdTxtFmtColl = - pDoc->GetTxtCollFromPool(RES_POOLCOLL_STANDARD, false); + pDoc->getIDocumentStylePoolAccess().GetTxtCollFromPool(RES_POOLCOLL_STANDARD, false); if (pStdTxtFmtColl && SFX_ITEM_SET == pStdTxtFmtColl->GetItemState( RES_PARATR_HYPHENZONE, false, &pItem)) { diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index dd4dbebf8dcf..88133992f43d 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -93,6 +93,7 @@ #include <doc.hxx> #include <IDocumentSettingAccess.hxx> #include <IDocumentFieldsAccess.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <docary.hxx> #include <pam.hxx> #include <paratr.hxx> @@ -1710,7 +1711,7 @@ void WW8AttributeOutput::TextINetFormat( const SwFmtINetFmt& rINet ) const SwCharFmt* pFmt = IsPoolUserFmt( nId ) ? m_rWW8Export.pDoc->FindCharFmtByName( rStr ) - : m_rWW8Export.pDoc->GetCharFmtFromPool( nId ); + : m_rWW8Export.pDoc->getIDocumentStylePoolAccess().GetCharFmtFromPool( nId ); if ( m_rWW8Export.bWrtWW8 ) m_rWW8Export.InsUInt16( NS_sprm::LN_CIstd ); diff --git a/sw/source/filter/ww8/ww8glsy.cxx b/sw/source/filter/ww8/ww8glsy.cxx index 5a5cbc6caf93..5312c8985edb 100644 --- a/sw/source/filter/ww8/ww8glsy.cxx +++ b/sw/source/filter/ww8/ww8glsy.cxx @@ -28,6 +28,7 @@ #include <fmtanchr.hxx> #include <frmfmt.hxx> #include <doc.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <docary.hxx> #include "ww8glsy.hxx" #include "ww8par.hxx" @@ -105,7 +106,7 @@ bool WW8Glossary::MakeEntries(SwDoc *pD, SwTextBlocks &rBlocks, if( aStart < aDocEnd ) { - SwTxtFmtColl* pColl = pD->GetTxtCollFromPool + SwTxtFmtColl* pColl = pD->getIDocumentStylePoolAccess().GetTxtCollFromPool (RES_POOLCOLL_STANDARD, false); sal_uInt16 nGlosEntry = 0; SwCntntNode* pCNd = 0; diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 05c9eeddf78e..742f7091af1a 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -75,6 +75,7 @@ #include <docsh.hxx> #include <IDocumentFieldsAccess.hxx> #include <IDocumentLayoutAccess.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <docufld.hxx> #include <swfltopt.hxx> #include <viewsh.hxx> @@ -4376,7 +4377,7 @@ SwFmtPageDesc wwSectionManager::SetSwFmtPageDesc(mySegIter &rIter, if (IsNewDoc() && rIter == rStart) { rIter->mpPage = - mrReader.rDoc.GetPageDescFromPool(RES_POOLPAGE_STANDARD); + mrReader.rDoc.getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD); } else { @@ -4532,7 +4533,7 @@ void wwSectionManager::InsertSegments() { pTxtNd = mrReader.rDoc.GetNodes().MakeTxtNode(aAnchor, - mrReader.rDoc.GetTxtCollFromPool( RES_POOLCOLL_TEXT )); + mrReader.rDoc.getIDocumentStylePoolAccess().GetTxtCollFromPool( RES_POOLCOLL_TEXT )); aSectPaM.GetPoint()->nNode = SwNodeIndex(*pTxtNd); aSectPaM.GetPoint()->nContent.Assign( @@ -5095,7 +5096,7 @@ sal_uLong SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss, const SwPosition &rPos) { SwNodeIndex aIdx( rDoc.GetNodes().GetEndOfContent()); SwTxtFmtColl* pColl = - rDoc.GetTxtCollFromPool(RES_POOLCOLL_STANDARD, + rDoc.getIDocumentStylePoolAccess().GetTxtCollFromPool(RES_POOLCOLL_STANDARD, false); SwStartNode *pNode = rDoc.GetNodes().MakeTextSection(aIdx, diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index c27ae6f9f50b..8ba8fb3f4e23 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -43,6 +43,7 @@ #include <msfilter.hxx> #include <pam.hxx> #include <doc.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <docary.hxx> #include <ndtxt.hxx> #include <paratr.hxx> @@ -4367,7 +4368,7 @@ void WW8RStyle::Import() { pIo->pDfltTxtFmtColl = pIo->rDoc.GetDfltTxtFmtColl(); pIo->pStandardFmtColl = - pIo->rDoc.GetTxtCollFromPool(RES_POOLCOLL_STANDARD, false); + pIo->rDoc.getIDocumentStylePoolAccess().GetTxtCollFromPool(RES_POOLCOLL_STANDARD, false); if( pIo->nIniFlags & WW8FL_NO_STYLES ) return; diff --git a/sw/source/filter/xml/XMLRedlineImportHelper.cxx b/sw/source/filter/xml/XMLRedlineImportHelper.cxx index 846905b7ff62..94d4ee26f3f8 100644 --- a/sw/source/filter/xml/XMLRedlineImportHelper.cxx +++ b/sw/source/filter/xml/XMLRedlineImportHelper.cxx @@ -23,6 +23,7 @@ #include <unocrsr.hxx> #include "doc.hxx" #include <IDocumentContentOperations.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <tools/datetime.hxx> #include "poolfmt.hxx" #include "unoredline.hxx" @@ -469,7 +470,7 @@ Reference<XTextCursor> XMLRedlineImportHelper::CreateRedlineTextSection( } // create text section for redline - SwTxtFmtColl *pColl = pDoc->GetTxtCollFromPool + SwTxtFmtColl *pColl = pDoc->getIDocumentStylePoolAccess().GetTxtCollFromPool (RES_POOLCOLL_STANDARD, false ); SwStartNode* pRedlineNode = pDoc->GetNodes().MakeTextSection( pDoc->GetNodes().GetEndOfRedlines(), diff --git a/sw/source/filter/xml/xmlfmt.cxx b/sw/source/filter/xml/xmlfmt.cxx index 061dd1eda6bf..06f27fae5038 100644 --- a/sw/source/filter/xml/xmlfmt.cxx +++ b/sw/source/filter/xml/xmlfmt.cxx @@ -28,6 +28,7 @@ #include <paratr.hxx> #include <doc.hxx> #include "docary.hxx" +#include <IDocumentStylePoolAccess.hxx> #include "unostyle.hxx" #include "fmtpdsc.hxx" #include "pagedesc.hxx" @@ -639,7 +640,7 @@ void SwXMLItemSetStyleContext_Impl::ConnectPageDesc() // first if it hasn't been used by now. const sal_uInt16 nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( sName, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC ); if( USHRT_MAX != nPoolId ) - pPageDesc = pDoc->GetPageDescFromPool( nPoolId, false ); + pPageDesc = pDoc->getIDocumentStylePoolAccess().GetPageDescFromPool( nPoolId, false ); } if( !pPageDesc ) diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx index 5e22cea194cc..b1384c08ae62 100644 --- a/sw/source/filter/xml/xmlimp.cxx +++ b/sw/source/filter/xml/xmlimp.cxx @@ -37,6 +37,7 @@ #include <drawdoc.hxx> #include <IDocumentSettingAccess.hxx> #include <IDocumentDeviceAccess.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <IDocumentDrawModelAccess.hxx> #include <unofreg.hxx> #include <TextCursorHelper.hxx> @@ -664,7 +665,7 @@ void SwXMLImport::startDocument() // Insert all content into the new node pPaM->Move( fnMoveBackward ); pDoc->SetTxtFmtColl - ( *pPaM, pDoc->GetTxtCollFromPool(RES_POOLCOLL_STANDARD, false ) ); + ( *pPaM, pDoc->getIDocumentStylePoolAccess().GetTxtCollFromPool(RES_POOLCOLL_STANDARD, false ) ); } } diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx index d535ac263243..a05ca718a053 100644 --- a/sw/source/filter/xml/xmltbli.cxx +++ b/sw/source/filter/xml/xmltbli.cxx @@ -41,6 +41,7 @@ #include "doc.hxx" #include <IDocumentFieldsAccess.hxx> #include <IDocumentLayoutAccess.hxx> +#include <IDocumentStylePoolAccess.hxx> #include "swtable.hxx" #include "swtblfmt.hxx" #include "pam.hxx" @@ -2866,7 +2867,7 @@ const SwStartNode *SwXMLTableContext::InsertTableSection( sal_uInt32 nOffset = pPrevSttNd ? 1UL : 0UL; SwNodeIndex aIdx( *pEndNd, nOffset ); SwTxtFmtColl *pColl = - pDoc->GetTxtCollFromPool( RES_POOLCOLL_STANDARD, false ); + pDoc->getIDocumentStylePoolAccess().GetTxtCollFromPool( RES_POOLCOLL_STANDARD, false ); pStNd = pDoc->GetNodes().MakeTextSection( aIdx, SwTableBoxStartNode, pColl ); // Consider the case that a table is defined without a row. diff --git a/sw/source/uibase/app/docshini.cxx b/sw/source/uibase/app/docshini.cxx index 4b29782584e2..9f29674aad81 100644 --- a/sw/source/uibase/app/docshini.cxx +++ b/sw/source/uibase/app/docshini.cxx @@ -62,6 +62,7 @@ #include <IDocumentSettingAccess.hxx> #include <IDocumentDeviceAccess.hxx> #include <IDocumentDrawModelAccess.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <IDocumentChartDataProviderAccess.hxx> #include <IDocumentState.hxx> #include <docfac.hxx> @@ -210,7 +211,7 @@ bool SwDocShell::InitNew( const uno::Reference < embed::XStorage >& xStor ) mpDoc->SetDefault(*pFontItem); if( !bHTMLTemplSet ) { - SwTxtFmtColl *pColl = mpDoc->GetTxtCollFromPool(RES_POOLCOLL_STANDARD); + SwTxtFmtColl *pColl = mpDoc->getIDocumentStylePoolAccess().GetTxtCollFromPool(RES_POOLCOLL_STANDARD); pColl->ResetFmtAttr(nFontWhich); } pFontItem.reset(); @@ -220,7 +221,7 @@ bool SwDocShell::InitNew( const uno::Reference < embed::XStorage >& xStor ) mpDoc->SetDefault(SvxFontHeightItem( nFontHeight, 100, aFontHeightWhich[i] )); if( !bHTMLTemplSet ) { - SwTxtFmtColl *pColl = mpDoc->GetTxtCollFromPool(RES_POOLCOLL_STANDARD); + SwTxtFmtColl *pColl = mpDoc->getIDocumentStylePoolAccess().GetTxtCollFromPool(RES_POOLCOLL_STANDARD); pColl->ResetFmtAttr(aFontHeightWhich[i]); } @@ -267,7 +268,7 @@ bool SwDocShell::InitNew( const uno::Reference < embed::XStorage >& xStor ) if( pPrt ) aFont = pPrt->GetFontMetric( aFont ); - pColl = mpDoc->GetTxtCollFromPool(aFontIdPoolId[nIdx + 1]); + pColl = mpDoc->getIDocumentStylePoolAccess().GetTxtCollFromPool(aFontIdPoolId[nIdx + 1]); if( !bHTMLTemplSet || SFX_ITEM_SET != pColl->GetAttrSet().GetItemState( nFontWhich, false ) ) @@ -280,7 +281,7 @@ bool SwDocShell::InitNew( const uno::Reference < embed::XStorage >& xStor ) if(nFontHeight <= 0) nFontHeight = SwStdFontConfig::GetDefaultHeightFor( aFontIdPoolId[nIdx], eLanguage ); if(!pColl) - pColl = mpDoc->GetTxtCollFromPool(aFontIdPoolId[nIdx + 1]); + pColl = mpDoc->getIDocumentStylePoolAccess().GetTxtCollFromPool(aFontIdPoolId[nIdx + 1]); SvxFontHeightItem aFontHeight( (const SvxFontHeightItem&)pColl->GetFmtAttr( nFontHeightWhich, true )); if(aFontHeight.GetHeight() != sal::static_int_cast<sal_uInt32, sal_Int32>(nFontHeight)) { diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx index 9a1e8e731a0b..0fa8e68f412c 100644 --- a/sw/source/uibase/app/docstyle.cxx +++ b/sw/source/uibase/app/docstyle.cxx @@ -40,6 +40,7 @@ #include <ccoll.hxx> #include <doc.hxx> #include <IDocumentUndoRedo.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <IDocumentSettingAccess.hxx> #include <IDocumentDrawModelAccess.hxx> #include <IDocumentState.hxx> @@ -135,7 +136,7 @@ static SwCharFmt* lcl_FindCharFmt( SwDoc& rDoc, { // explore Pool const sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(rName, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT); if(nId != USHRT_MAX) - pFmt = rDoc.GetCharFmtFromPool(nId); + pFmt = rDoc.getIDocumentStylePoolAccess().GetCharFmtFromPool(nId); } } if(pStyle) @@ -171,7 +172,7 @@ static SwTxtFmtColl* lcl_FindParaFmt( SwDoc& rDoc, { // explore Pool const sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(rName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL); if(nId != USHRT_MAX) - pColl = rDoc.GetTxtCollFromPool(nId); + pColl = rDoc.getIDocumentStylePoolAccess().GetTxtCollFromPool(nId); } } @@ -208,7 +209,7 @@ static SwFrmFmt* lcl_FindFrmFmt( SwDoc& rDoc, { // explore Pool const sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(rName, nsSwGetPoolIdFromName::GET_POOLID_FRMFMT); if(nId != USHRT_MAX) - pFmt = rDoc.GetFrmFmtFromPool(nId); + pFmt = rDoc.getIDocumentStylePoolAccess().GetFrmFmtFromPool(nId); } } @@ -243,7 +244,7 @@ static const SwPageDesc* lcl_FindPageDesc( SwDoc& rDoc, { sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(rName, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC); if(nId != USHRT_MAX) - pDesc = rDoc.GetPageDescFromPool(nId); + pDesc = rDoc.getIDocumentStylePoolAccess().GetPageDescFromPool(nId); } } @@ -277,7 +278,7 @@ static const SwNumRule* lcl_FindNumRule( SwDoc& rDoc, { sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName(rName, nsSwGetPoolIdFromName::GET_POOLID_NUMRULE); if(nId != USHRT_MAX) - pRule = rDoc.GetNumRuleFromPool(nId); + pRule = rDoc.getIDocumentStylePoolAccess().GetNumRuleFromPool(nId); } } @@ -1415,7 +1416,7 @@ void SwDocStyleSheet::SetItemSet( const SfxItemSet& rSet, sal_uInt16 nPoolId = SwStyleNameMapper::GetPoolIdFromUIName( sNumRule, nsSwGetPoolIdFromName::GET_POOLID_NUMRULE ); if( USHRT_MAX != nPoolId ) // It's a standard numbering rule { - rDoc.GetNumRuleFromPool( nPoolId ); // Create numbering rule (physical) + rDoc.getIDocumentStylePoolAccess().GetNumRuleFromPool( nPoolId ); // Create numbering rule (physical) } } } @@ -2774,7 +2775,7 @@ SfxStyleSheetBase* SwStyleSheetIterator::First() if ( bAll || (nSMask & ~SFXSTYLEBIT_USED) == SWSTYLEBIT_CONDCOLL ) { if( !bIsSearchUsed || - rDoc.IsPoolTxtCollUsed( RES_POOLCOLL_TEXT )) + rDoc.getIDocumentStylePoolAccess().IsPoolTxtCollUsed( RES_POOLCOLL_TEXT )) aLst.Append( cPARA, SwStyleNameMapper::GetTextUINameArray()[ RES_POOLCOLL_TEXT - RES_POOLCOLL_TEXT_BEGIN ] ); } @@ -2810,7 +2811,7 @@ SfxStyleSheetBase* SwStyleSheetIterator::First() OUString s; while( *pPoolIds ) { - if( !bIsSearchUsed || rDoc.IsPoolTxtCollUsed( *pPoolIds ) ) + if( !bIsSearchUsed || rDoc.getIDocumentStylePoolAccess().IsPoolTxtCollUsed( *pPoolIds ) ) aLst.Append( cPARA, s = SwStyleNameMapper::GetUIName( *pPoolIds, s )); ++pPoolIds; @@ -2977,28 +2978,28 @@ void SwStyleSheetIterator::AppendStyleList(const ::std::vector<OUString>& rList, { case nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL: { - bUsed = rDoc.IsPoolTxtCollUsed( nId ); + bUsed = rDoc.getIDocumentStylePoolAccess().IsPoolTxtCollUsed( nId ); SwFmt* pFmt = rDoc.FindTxtFmtCollByName( rList[i] ); bHidden = pFmt && pFmt->IsHidden( ); } break; case nsSwGetPoolIdFromName::GET_POOLID_CHRFMT: { - bUsed = rDoc.IsPoolFmtUsed( nId ); + bUsed = rDoc.getIDocumentStylePoolAccess().IsPoolFmtUsed( nId ); SwFmt* pFmt = rDoc.FindCharFmtByName( rList[i] ); bHidden = pFmt && pFmt->IsHidden( ); } break; case nsSwGetPoolIdFromName::GET_POOLID_FRMFMT: { - bUsed = rDoc.IsPoolFmtUsed( nId ); + bUsed = rDoc.getIDocumentStylePoolAccess().IsPoolFmtUsed( nId ); SwFmt* pFmt = rDoc.FindFrmFmtByName( rList[i] ); bHidden = pFmt && pFmt->IsHidden( ); } break; case nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC: { - bUsed = rDoc.IsPoolPageDescUsed( nId ); + bUsed = rDoc.getIDocumentStylePoolAccess().IsPoolPageDescUsed( nId ); SwPageDesc* pPgDesc = rDoc.FindPageDesc(rList[i]); bHidden = pPgDesc && pPgDesc->IsHidden( ); } diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index d1606cebc69c..964a575d4365 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -102,6 +102,7 @@ #include <IDocumentRedlineAccess.hxx> #include <IDocumentFieldsAccess.hxx> #include <IDocumentStatistics.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <IDocumentLayoutAccess.hxx> #include <IDocumentState.hxx> #include <editeng/forbiddencharacterstable.hxx> @@ -203,7 +204,7 @@ static SwTxtFmtColl *lcl_GetParaStyle(const OUString& rCollName, SwDoc* pDoc) const sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName( rCollName, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL ); if( USHRT_MAX != nId ) - pColl = pDoc->GetTxtCollFromPool( nId ); + pColl = pDoc->getIDocumentStylePoolAccess().GetTxtCollFromPool( nId ); } return pColl; } diff --git a/sw/source/uibase/utlui/uitool.cxx b/sw/source/uibase/utlui/uitool.cxx index 48ffaaf80a48..cb44f35e1c08 100644 --- a/sw/source/uibase/utlui/uitool.cxx +++ b/sw/source/uibase/utlui/uitool.cxx @@ -27,6 +27,7 @@ #include <svl/stritem.hxx> #include <unotools/syslocale.hxx> #include <sfx2/app.hxx> +#include <IDocumentStylePoolAccess.hxx> #include <sfx2/docfile.hxx> #include <sfx2/docfilt.hxx> #include <editeng/pmdlitem.hxx> @@ -383,7 +384,7 @@ void ItemSetToPageDesc( const SfxItemSet& rSet, SwPageDesc& rPageDesc ) const sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName( rColl, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL ); if( USHRT_MAX != nId ) - pColl = rDoc.GetTxtCollFromPool( nId ); + pColl = rDoc.getIDocumentStylePoolAccess().GetTxtCollFromPool( nId ); else pColl = rDoc.MakeTxtFmtColl( rColl, (SwTxtFmtColl*)rDoc.GetDfltTxtFmtColl() ); |