From 3f89f88651f2c0b0c2edf37d9f13c4e48592091c Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 23 Oct 2014 09:16:08 +0100 Subject: callcatcher: lots more unused post ww1 filter removal Change-Id: I7bf6dc1d366093e797a19a8e555103c15b311ac8 --- sw/inc/hintids.hxx | 5 +- sw/source/filter/basflt/fltshell.cxx | 616 ----------------------------------- sw/source/filter/inc/fltshell.hxx | 247 -------------- 3 files changed, 2 insertions(+), 866 deletions(-) (limited to 'sw') diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx index 5774ffb5254c..f47b4044d165 100644 --- a/sw/inc/hintids.hxx +++ b/sw/inc/hintids.hxx @@ -344,7 +344,7 @@ RES_MSG_END // new attributes!) enum RES_FLTRATTR { -RES_FLTRATTR_BEGIN = RES_MSG_END, + RES_FLTRATTR_BEGIN = RES_MSG_END, RES_FLTR_STYLESHEET = RES_FLTRATTR_BEGIN, RES_FLTR_BOOKMARK, RES_FLTR_ANCHOR, @@ -353,10 +353,9 @@ RES_FLTRATTR_BEGIN = RES_MSG_END, RES_FLTR_NUMRULE_NUM, RES_FLTR_SDR_ANCHOR, RES_FLTR_TOX, - RES_FLTR_SECTION, RES_FLTR_REDLINE, RES_FLTR_SCRIPTTYPE, -RES_FLTRATTR_END + RES_FLTRATTR_END }; #define RES_TBX_DUMMY RES_FLTRATTR_END + 1 diff --git a/sw/source/filter/basflt/fltshell.cxx b/sw/source/filter/basflt/fltshell.cxx index 6e97e7c19911..9c05880cfb68 100644 --- a/sw/source/filter/basflt/fltshell.cxx +++ b/sw/source/filter/basflt/fltshell.cxx @@ -631,13 +631,6 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos, pNd->SetAttr( aBkSet ); } break; - case RES_FLTR_SECTION: - MakePoint(rEntry, pDoc, aRegion); // so far always Point==Mark - pDoc->InsertSwSection(aRegion, - *(static_cast(rEntry.pAttr))->GetSectionData(), - 0, 0, false); - delete (((SwFltSection*)rEntry.pAttr)->GetSectionData()); - break; case RES_FLTR_REDLINE: { if (rEntry.MakeRegion(pDoc, aRegion, true)) @@ -982,328 +975,17 @@ SfxPoolItem* SwFltTOX::Clone(SfxItemPool*) const return new SwFltTOX(*this); } -// methods of SwFltSwSection follow -SwFltSection::SwFltSection(SwSectionData *const pSect) - : SfxPoolItem(RES_FLTR_SECTION) - , m_pSection(pSect) -{ -} - -SwFltSection::SwFltSection(const SwFltSection& rCpy) - : SfxPoolItem(RES_FLTR_SECTION) - , m_pSection(rCpy.m_pSection) -{ -} - -bool SwFltSection::operator==(const SfxPoolItem& rItem) const -{ - return m_pSection == ((SwFltSection&)rItem).m_pSection; -} - -SfxPoolItem* SwFltSection::Clone(SfxItemPool*) const -{ - return new SwFltSection(*this); -} - -// here starts code generated by mdt. this is a shell, if possible, soon for -// all filters. the whole trouble of inserting texts and formatting attributes, -// manage positions, styles & headers/footers etc. - -SwFltShell::SwFltShell(SwDoc* pDoc, SwPaM& rPaM, const OUString& rBaseURL, bool bNew, sal_uLong nFieldFl) : - pCurrentPageDesc(0), - pSavedPos(0), - eSubMode(None), - nAktStyle(0), - aStack(pDoc, nFieldFl), - aEndStack(pDoc, nFieldFl), - pPaM(new SwPaM(*(rPaM.GetPoint()))), - sBaseURL(rBaseURL), - nPageDescOffset(GetDoc().GetPageDescCnt()), - eSrcCharSet(RTL_TEXTENCODING_MS_1252), - bNewDoc(bNew), - bStdPD(false), - bProtect(false) -{ - memset( pColls, 0, sizeof( pColls ) ); - pOutDoc = new SwFltOutDoc( *pDoc, pPaM, aStack, aEndStack ); - pOut = pOutDoc; - - if( !bNewDoc ){ // insert into document ? - // Because only entire lines are read, lines might need - // to be inserted or broken up - const SwPosition* pPos = pPaM->GetPoint(); - const SwTxtNode* pSttNd = pPos->nNode.GetNode().GetTxtNode(); - if (pPos->nContent.GetIndex() && !pSttNd->GetTxt().isEmpty()) - // insert position not in empty line - pDoc->getIDocumentContentOperations().SplitNode( *pPos, false ); // make new line - if (!pSttNd->GetTxt().isEmpty()) - { // InsertPos not on empty line - pDoc->getIDocumentContentOperations().SplitNode( *pPos, false ); // new line - pPaM->Move( fnMoveBackward ); // go to empty line - } - - // prohibit reading tables in footnotes / tables - sal_uLong nNd = pPos->nNode.GetIndex(); - bool bReadNoTbl = 0 != pSttNd->FindTableNode() || - ( nNd < pDoc->GetNodes().GetEndOfInserts().GetIndex() && - pDoc->GetNodes().GetEndOfInserts().StartOfSectionIndex() < nNd ); - if( bReadNoTbl ) - pOutDoc->SetReadNoTable(); - } - pCurrentPageDesc = &pDoc->GetPageDesc( 0 ); // Standard - -} - -SwFltShell::~SwFltShell() -{ - sal_uInt16 i; - - if (eSubMode == Style) - EndStyle(); - if( pOutDoc->IsInTable() ) // if not properly terminated - EndTable(); - if( pOutDoc->IsInFly() ) - EndFly(); - - GetDoc().getIDocumentState().SetUpdateExpFldStat(true); - GetDoc().SetInitDBFields(true); - aStack.SetAttr(*pPaM->GetPoint(), 0, false); - aStack.SetAttr(*pPaM->GetPoint(), 0, false); - aEndStack.SetAttr(*pPaM->GetPoint(), 0, false); - aEndStack.SetAttr(*pPaM->GetPoint(), 0, false); - if( bProtect ){ // The entire document is supposed to be protected - - SwDoc& rDoc = GetDoc(); - // 1. Create SectionFmt and Section - SwSectionFmt* pSFmt = rDoc.MakeSectionFmt( 0 ); - SwSectionData aSectionData(CONTENT_SECTION, OUString("PMW-Protect")); - aSectionData.SetProtectFlag( true ); - // 2. Look up Start- and EndIdx - const SwNode* pEndNd = &rDoc.GetNodes().GetEndOfContent(); - SwNodeIndex aEndIdx( *pEndNd, -1L ); - const SwStartNode* pSttNd = pEndNd->StartOfSectionNode(); - SwNodeIndex aSttIdx( *pSttNd, 1L ); // +1 -> insert after StartNode - // Section - // insert Section - rDoc.GetNodes().InsertTextSection( - aSttIdx, *pSFmt, aSectionData, 0, &aEndIdx, false ); - - if( !IsFlagSet(SwFltControlStack::DONT_HARD_PROTECT) ){ - SwDocShell* pDocSh = rDoc.GetDocShell(); - if( pDocSh ) - pDocSh->SetReadOnlyUI( true ); - } - } - // Update document page descriptors (only this way also left - // pages get adjusted) - - GetDoc().ChgPageDesc( 0, GetDoc().GetPageDesc( 0 )); // PageDesc "Standard" - for (i=nPageDescOffset;iGetPoint()); -} - -void SwFltShell::NextPage() -{ - NextParagraph(); - GetDoc().getIDocumentContentOperations().InsertPoolItem(*pPaM, - SvxFmtBreakItem(SVX_BREAK_PAGE_BEFORE, RES_BREAK), 0); -} - -SwFltShell& SwFltShell::AddGraphic( const OUString& rPicName ) -{ - // embedded: - GraphicFilter& rFilter = GraphicFilter::GetGraphicFilter(); - Graphic aGraphic; - // one of: GFF_NOT GFF_BMP GFF_GIF GFF_JPG GFF_PCD GFF_PCX GFF_PNG - // GFF_TIF GFF_XBM GFF_DXF GFF_MET GFF_PCT GFF_SGF GFF_SVM GFF_WMF - // GFF_SGV GFF_XXX - INetURLObject aDir( - URIHelper::SmartRel2Abs( - INetURLObject(GetBaseURL()), rPicName, - URIHelper::GetMaybeFileHdl()) ); - switch (rFilter.ImportGraphic(aGraphic, aDir)) - { - case GRFILTER_OK: - *this << aGraphic; - break; - case GRFILTER_OPENERROR: - case GRFILTER_IOERROR: - case GRFILTER_FORMATERROR: - case GRFILTER_VERSIONERROR: - case GRFILTER_FILTERERROR: - case GRFILTER_ABORT: - case GRFILTER_TOOBIG: - default: - AddError( "picture import error" ); - break; - } - return *this; -} - -SwFltShell& SwFltShell::SetStyle( sal_uInt16 nStyle ) -{ - SwFltFormatCollection* p = pColls[ nStyle ]; - - if (p) - { - if( !pOutDoc->IsInTable() && nStyle != nAktStyle ) - { - if( pColls[nAktStyle]->IsInFly() && pOutDoc->IsInFly() ) - pOutDoc->EndFly(); - if( p->IsInFly() ) - p->BeginStyleFly( pOutDoc ); - } - GetDoc().SetTxtFmtColl(*pPaM, p->GetColl()); - nAktStyle = nStyle; - } - else - { - OSL_FAIL( "Invalid SwFltStyleCode" ); - } - return *this; -} - -SwFltShell& SwFltShell::operator << (SwFltBookmark& aBook) -{ - aBook.maName = ConvertUStr( aBook.maName ); - aBook.maVal = QuoteStr(aBook.maVal); - aEndStack.NewAttr(*pPaM->GetPoint(), aBook); - return *this; -} - -void SwFltShell::SetBookEnd(long nHandle) -{ - aEndStack.SetAttr( *pPaM->GetPoint(), RES_FLTR_BOOKMARK, true, nHandle ); -} - -SwFltShell& SwFltShell::EndItem( sal_uInt16 nAttrId ) -{ - switch( nAttrId ) - { - case RES_FLTR_BOOKMARK: - OSL_FAIL( "Wrong invocation for bookmark end" ); - break; - - case RES_FLTR_TOX: - aEndStack.SetAttr(*pPaM->GetPoint(), nAttrId); - break; - - default: - aStack.SetAttr(*pPaM->GetPoint(), nAttrId); - break; - } - return *this; -} - -SwFltShell& SwFltShell::operator << (const SwField& rField) -{ - GetDoc().getIDocumentContentOperations().InsertPoolItem(*pPaM, SwFmtFld(rField), 0); - return *this; -} - /*virtual*/ SwFltOutBase& SwFltOutDoc::operator << (const SfxPoolItem& rItem) { rStack.NewAttr(*pPaM->GetPoint(), rItem); return *this; } -/*virtual*/ SwFltOutBase& SwFltFormatCollection::operator << - (const SfxPoolItem& rItem) -{ - pColl->SetFmtAttr(rItem); - return *this; -} - const SfxPoolItem& SwFltOutDoc::GetAttr(sal_uInt16 nWhich) { return *rStack.GetFmtAttr(*pPaM->GetPoint(), nWhich); } -const SfxPoolItem& SwFltFormatCollection::GetAttr(sal_uInt16 nWhich) -{ - return GetColl()->GetFmtAttr(nWhich); // with Parents -} - // GetNodeOrStyAttr fetches attributes for toggle and modify attributes: // For format definitions, the current style with parents is // consulted, otherwise the node with parents. @@ -1317,66 +999,6 @@ const SfxPoolItem& SwFltOutDoc::GetNodeOrStyAttr(sal_uInt16 nWhich) return GetDoc().GetAttrPool().GetDefaultItem(nWhich); } -const SfxPoolItem& SwFltFormatCollection::GetNodeOrStyAttr(sal_uInt16 nWhich) -{ - return GetColl()->GetFmtAttr(nWhich); // with Parents -} - -const SfxPoolItem& SwFltShell::GetNodeOrStyAttr(sal_uInt16 nWhich) -{ - return pOut->GetNodeOrStyAttr( nWhich ); -} - -const SfxPoolItem& SwFltShell::GetAttr(sal_uInt16 nWhich) -{ - return pOut->GetAttr( nWhich ); -} - -const SfxPoolItem& SwFltShell::GetFlyFrmAttr(sal_uInt16 nWhich) -{ - return pOut->GetFlyFrmAttr( nWhich ); -} - -SwFieldType* SwFltShell::GetSysFldType(sal_uInt16 eWhich) -{ - return GetDoc().getIDocumentFieldsAccess().GetSysFldType(eWhich); -} - -bool SwFltShell::GetWeightBold() -{ - return ((SvxWeightItem&)GetNodeOrStyAttr(RES_CHRATR_WEIGHT)).GetWeight() - != WEIGHT_NORMAL; -} - -bool SwFltShell::GetPostureItalic() -{ - return ((SvxPostureItem&)GetNodeOrStyAttr(RES_CHRATR_POSTURE)).GetPosture() - != ITALIC_NONE; -} - -bool SwFltShell::GetCrossedOut() -{ - return ((SvxCrossedOutItem&)GetNodeOrStyAttr(RES_CHRATR_CROSSEDOUT)) - .GetStrikeout() != STRIKEOUT_NONE; -} - -bool SwFltShell::GetContour() -{ - return ((SvxContourItem&)GetNodeOrStyAttr(RES_CHRATR_CONTOUR)).GetValue(); -} - -bool SwFltShell::GetCaseKapitaelchen() -{ - return ((SvxCaseMapItem&)GetNodeOrStyAttr(RES_CHRATR_CASEMAP)) - .GetCaseMap() == SVX_CASEMAP_KAPITAELCHEN; -} - -bool SwFltShell::GetCaseVersalien() -{ - return ((SvxCaseMapItem&)GetNodeOrStyAttr(RES_CHRATR_CASEMAP)) - .GetCaseMap() == SVX_CASEMAP_VERSALIEN; -} - // Tables SwFltOutBase::~SwFltOutBase() { @@ -1896,244 +1518,6 @@ void SwFltOutDoc::EndFly() pFly = 0; } -/*virtual*/ bool SwFltFormatCollection::IsInFly() -{ - return bHasFly; -}; - -/*virtual*/ void SwFltFormatCollection::SetFlyFrmAttr(const SfxPoolItem& rAttr) -{ - if (!pFlyAttrs) - pFlyAttrs = new SfxItemSet( GetDoc().GetAttrPool(), - RES_FRMATR_BEGIN, RES_FRMATR_END-1 ); - pFlyAttrs->Put( rAttr ); -} - -/*virtual*/ const SfxPoolItem& SwFltFormatCollection::GetFlyFrmAttr(sal_uInt16 nWhich) -{ - if( pFlyAttrs ) - return pFlyAttrs->Get( nWhich, false ); - else - return GetDoc().GetAttrPool().GetDefaultItem(nWhich); -} - -bool SwFltFormatCollection::BeginFly( RndStdIds eAnchor, - bool bAbsolutePos, - const SfxItemSet* pMoreAttrs) - -{ - SwFltOutBase::BeginFly( eAnchor, bAbsolutePos, pMoreAttrs ); - bHasFly = true; - return true; -} - -void SwFltFormatCollection::EndFly() // never gets called -{ -} - -bool SwFltFormatCollection::BeginStyleFly( SwFltOutDoc* pOutDoc ) -{ - OSL_ENSURE( pOutDoc, "BeginStyleFly without pOutDoc" ); - OSL_ENSURE( pOutDoc && !pOutDoc->IsInFly(), "BeginStyleFly in Fly" ); - if( pOutDoc && !pOutDoc->IsInFly() ) - return pOutDoc->BeginFly( eFlyAnchor, bFlyAbsPos, pFlyAttrs ); - else - return false; -} - -bool SwFltShell::BeginFly( RndStdIds eAnchor, - bool bAbsolutePos) -{ - if (pOut->IsInFly()){ - OSL_FAIL("BeginFly in Fly"); - return false; - } - if (pOutDoc->IsInTable()){ - OSL_FAIL("BeginFly in Table"); - return false; - } - pOut->BeginFly( eAnchor, bAbsolutePos, pColls[nAktStyle]->GetpFlyAttrs() ); - eSubMode = Fly; - return true; -} - -void SwFltShell::SetFlyXPos( short nXPos, sal_Int16 eHRel, - sal_Int16 eHAlign) -{ - SetFlyFrmAttr( SwFmtHoriOrient( nXPos, eHAlign, eHRel ) ); -} - -void SwFltShell::SetFlyYPos( short nYPos, sal_Int16 eVRel, - sal_Int16 eVAlign) -{ - SetFlyFrmAttr( SwFmtVertOrient( nYPos, eVAlign, eVRel ) ); -} - -void SwFltShell::EndFly() -{ - if (!pOut->IsInFly()){ - OSL_FAIL("EndFly without Fly"); - return; - } - if (pOutDoc->IsInTable()){ // Table intermingled with Fly doesn't make sense - OSL_FAIL("EndFly in Table ( intermingled )"); - EndTable(); - } - pOut->EndFly(); - eSubMode = None; -} - -void SwFltShell::BeginFootnote() -{ - if( pOut->IsInFly() ){ // Happens at footnote in Fly, among others - OSL_FAIL("Footnote in Fly not permitted"); - return; - } - if( pOutDoc->IsInTable() ){ - OSL_FAIL("Footnote in table currently not allowed"); - return; - } - - // Close all attributes, because otherwise attributes extending into - // footnotes might be created - aStack.SetAttr( *pPaM->GetPoint(), 0, false ); - // Don't force-close EndStack for now, so bookmarks on footnotes can - // be applied to PMW - - SwFmtFtn aFtn; - GetDoc().getIDocumentContentOperations().InsertPoolItem(*pPaM, aFtn, 0); - OSL_ENSURE(pSavedPos == NULL, "SwFltShell"); - pSavedPos = new SwPosition(*pPaM->GetPoint()); - pPaM->Move(fnMoveBackward, fnGoCntnt); - SwTxtNode* pTxt = pPaM->GetNode().GetTxtNode(); - SwTxtAttr *const pFN = pTxt->GetTxtAttrForCharAt( - pPaM->GetPoint()->nContent.GetIndex(), RES_TXTATR_FTN); - if( !pFN ){ // Happens at footnote in Fly, among others - OSL_ENSURE(pFN, "Problems with creating footnote text"); - return; - } - const SwNodeIndex* pStartIndex = ((SwTxtFtn*)pFN)->GetStartNode(); - OSL_ENSURE(pStartIndex, "Problems with creating footnote text"); - pPaM->GetPoint()->nNode = pStartIndex->GetIndex() + 1; - pPaM->GetPoint()->nContent.Assign(pPaM->GetCntntNode(), 0); - eSubMode = Footnote; -} - -void SwFltShell::EndFootnote() -{ - if(!pSavedPos) - return; - // Close all attributes, because otherwise - // attributes extending out of footnotes might - // be created - aStack.SetAttr( *pPaM->GetPoint(), 0, false ); - // Don't force-close EndStack for now, so bookmarks on footnotes can - // be applied to PMW - - *pPaM->GetPoint() = *pSavedPos; // restore Cursor - delete pSavedPos; - pSavedPos = 0; -} - -void SwFltShell::BeginHeader(SwPageDesc* /*pPD*/) -{ - SwFrmFmt* pFmt = &pCurrentPageDesc->GetMaster(); - SwFrmFmt* pHdFtFmt; - pFmt->SetFmtAttr(SwFmtHeader(true)); - pHdFtFmt = (SwFrmFmt*)pFmt->GetHeader().GetHeaderFmt(); - const SwNodeIndex* pStartIndex = pHdFtFmt->GetCntnt().GetCntntIdx(); - if (!pStartIndex) - return; - OSL_ENSURE(pSavedPos == NULL, "SwFltShell"); - pSavedPos = new SwPosition(*pPaM->GetPoint()); - pPaM->GetPoint()->nNode = pStartIndex->GetIndex() + 1; - pPaM->GetPoint()->nContent.Assign(pPaM->GetCntntNode(), 0); - eSubMode = Header; -} - -void SwFltShell::BeginFooter(SwPageDesc* /*pPD*/) -{ - SwFrmFmt* pFmt = &pCurrentPageDesc->GetMaster(); - SwFrmFmt* pHdFtFmt; - pFmt->SetFmtAttr(SwFmtFooter(true)); - pHdFtFmt = (SwFrmFmt*)pFmt->GetFooter().GetFooterFmt(); - const SwNodeIndex* pStartIndex = pHdFtFmt->GetCntnt().GetCntntIdx(); - if (!pStartIndex) - return; - OSL_ENSURE(pSavedPos == NULL, "SwFltShell"); - pSavedPos = new SwPosition(*pPaM->GetPoint()); - pPaM->GetPoint()->nNode = pStartIndex->GetIndex() + 1; - pPaM->GetPoint()->nContent.Assign(pPaM->GetCntntNode(), 0); - eSubMode = Footer; -} - -void SwFltShell::EndHeaderFooter() -{ - *pPaM->GetPoint() = *pSavedPos; // restore Cursor - delete pSavedPos; - pSavedPos = 0; -} - -SwPageDesc* SwFltShell::MakePageDesc(SwPageDesc* pFirstPageDesc) -{ - if(bStdPD) // no new PageDescs - return pCurrentPageDesc; - - bool bFollow = (pFirstPageDesc != 0); - SwPageDesc* pNewPD; - if (bFollow && pFirstPageDesc->GetFollow() != pFirstPageDesc) - return pFirstPageDesc; // Error: already has Follow - // Detection of duplicate names still missing (low probability of this - // actually occurring) - - pNewPD = GetDoc().MakePageDesc( - SwViewShell::GetShellRes()->GetPageDescName(GetDoc().GetPageDescCnt(), bFollow ? ShellResource::FOLLOW_PAGE : ShellResource::NORMAL_PAGE), - pFirstPageDesc, false); - - if (bFollow) - { - // This one follows pPageDesc - pFirstPageDesc->SetFollow(pNewPD); - pNewPD->SetFollow(pNewPD); - } - else - { - GetDoc().getIDocumentContentOperations().InsertPoolItem( *pPaM, SwFmtPageDesc( pNewPD ), 0 ); - } - pNewPD->WriteUseOn( // all pages - (UseOnPage)(nsUseOnPage::PD_ALL | nsUseOnPage::PD_HEADERSHARE | nsUseOnPage::PD_FOOTERSHARE)); - return pNewPD; -} - -SwFltFormatCollection::SwFltFormatCollection( - SwDoc& _rDoc, RES_POOL_COLLFMT_TYPE nType ) : - SwFltOutBase(_rDoc), - pColl(_rDoc.getIDocumentStylePoolAccess().GetTxtCollFromPool( static_cast< sal_uInt16 >(nType), false )), - pFlyAttrs( 0 ), - bHasFly( false ) -{ - Reset(); // reset default attrs and auto flag -} - -SwFltFormatCollection::SwFltFormatCollection( - SwDoc& _rDoc, const OUString& rName ) : - SwFltOutBase(_rDoc), - pFlyAttrs( 0 ), - bHasFly( false ) -{ - pColl = _rDoc.MakeTxtFmtColl(rName, (SwTxtFmtColl*)_rDoc.GetDfltTxtFmtColl()); - Reset(); // reset default attrs and auto flag -} - -void SwFltShell::NextStyle(sal_uInt16 nWhich, sal_uInt16 nNext) -{ - OSL_ENSURE(pColls[nWhich], "Next style for noexistent style" ); - OSL_ENSURE(pColls[nNext], "Next style to noexistent style" ); - if( pColls[nWhich] && pColls[nNext] ) - pColls[nWhich]->GetColl()->SetNextTxtFmtColl( - *pColls[nNext]->GetColl() ); -} - // UpdatePageDescs needs to be called at end of parsing to make Writer actually // accept Pagedescs contents void UpdatePageDescs(SwDoc &rDoc, sal_uInt16 nInPageDescOffset) diff --git a/sw/source/filter/inc/fltshell.hxx b/sw/source/filter/inc/fltshell.hxx index a39d363ba3ad..8837961f080a 100644 --- a/sw/source/filter/inc/fltshell.hxx +++ b/sw/source/filter/inc/fltshell.hxx @@ -36,7 +36,6 @@ #include class SwTOXBase; -class SwFltShell; class SwField; class SwFieldType; class Graphic; @@ -137,7 +136,6 @@ class SW_DLLPUBLIC SwFltControlStack : private ::boost::noncopyable typedef boost::ptr_deque Entries; typedef Entries::iterator myEIter; Entries maEntries; - friend class SwFltShell; sal_uLong nFieldFlags; vcl::KeyCode aEmptyKeyCode; // fuer Bookmarks @@ -270,7 +268,6 @@ public: class SW_DLLPUBLIC SwFltBookmark : public SfxPoolItem { private: - friend class SwFltShell; // darf aName und aVal uebersetzen long mnHandle; OUString maName; @@ -317,18 +314,6 @@ public: bool HadPageDescItem() const { return bHadPageDescItem; } }; -class SwFltSection : public SfxPoolItem -{ - SwSectionData * m_pSection; - -public: - SwFltSection( SwSectionData *const pSect ); - SwFltSection( const SwFltSection& ); - // "pure virtual Methoden" vom SfxPoolItem - virtual bool operator==(const SfxPoolItem&) const SAL_OVERRIDE; - virtual SfxPoolItem* Clone(SfxItemPool* = 0) const SAL_OVERRIDE; - SwSectionData * GetSectionData() { return m_pSection; } -}; // Der WWEndStack verhaelt sich wie der WWControlStck, nur dass die Attribute // auf ihm bis ans Ende des Dokuments gehortet werden, falls auf sie noch // zugegriffen werden muss (z.B. Book/RefMarks, Index u.s.w.) @@ -459,238 +444,6 @@ public: virtual void EndFly() SAL_OVERRIDE; }; -class SwFltFormatCollection : public SwFltOutBase -{ - SwTxtFmtColl* pColl; - SfxItemSet* pFlyAttrs; // Simulation der Flys in Styles - bool bHasFly; -public: - SwFltFormatCollection(SwDoc&, RES_POOL_COLLFMT_TYPE nType); - SwFltFormatCollection(SwDoc&, const OUString& rName ); - virtual ~SwFltFormatCollection() { if( pFlyAttrs ) delete pFlyAttrs; } - - void Reset() - { - // #i73790# - method renamed - pColl->ResetAllFmtAttr(); - pColl->SetAuto(false); // nach Empfehlung JP - } - void Derived(SwTxtFmtColl* pBase) - { pColl->SetDerivedFrom(pBase); } - -// SwTxtFmtColl* Search(String, CharSet eSrc); - SwTxtFmtColl* GetColl() { return pColl; } - void SetHasFly() { bHasFly = true; } - SfxItemSet* GetpFlyAttrs() { return pFlyAttrs; } - - virtual SwFltOutBase& operator << (const SfxPoolItem& rItem) SAL_OVERRIDE; - virtual const SfxPoolItem& GetAttr(sal_uInt16 nWhich) SAL_OVERRIDE; - virtual const SfxPoolItem& GetNodeOrStyAttr(sal_uInt16 nWhich) SAL_OVERRIDE; - - virtual bool IsInFly() SAL_OVERRIDE; - virtual void SetFlyFrmAttr(const SfxPoolItem& rAttr) SAL_OVERRIDE; - virtual const SfxPoolItem& GetFlyFrmAttr(sal_uInt16 nWhich) SAL_OVERRIDE; - virtual bool BeginFly( RndStdIds eAnchor, bool bAbsolutePos, - const SfxItemSet* pMoreAttrs = 0 ) SAL_OVERRIDE; - bool BeginStyleFly( SwFltOutDoc* pOutDoc ); - virtual void EndFly() SAL_OVERRIDE; -}; - -// dies nun ist die zauberhafteklasse: intention: alle eins nach dem -// andern hinein'pipe'n. wird eine besondere struktur eingelesen, wird -// eine klammer geoeffnet (BeginXxx) und nach beendigung geschlossen -// (EndXxx), wobei Xxx zB fuer Fusznoten, Kopf/Fuszzeilen oder -// Tabellen steht. Styles funktionieren auch so, haben aber den -// unterschied, keine buchstaben zu akzeptieren. -// beginnt ein neuer absatz oder aehnliches, wird NextXxx genutzt. -// hier ist moeglich, Tab, Zeilenumbruch, Absatzende, Seitenumbruch -// und Sektionsende einzufuegen. - -class SwFltShell -{ - SwFltOutDoc* pOutDoc; - SwFltFormatCollection* pColls[256]; - SwFltOutBase* pOut; - -// SwFltFormatCollection* pFormat; // set when in style-mode - SwPageDesc* pCurrentPageDesc; - SwPosition* pSavedPos; // set, when in footnote or header/footer -mode -#ifdef None -#undef None -#endif - enum SubModes { - None, - Header, - Footer, - Footnote, - Table, - Fly, - Style, - Max - } eSubMode; - -// Fly items: - sal_uInt16 nAktStyle; // zur Indizierung pStyleFlyTable - - SwFltControlStack aStack; - SwFltEndStack aEndStack; - SwPaM* pPaM; - - OUString sBaseURL; - sal_uInt16 nPageDescOffset; // fuers update der pagedescs - rtl_TextEncoding eSrcCharSet; // charset der quelle - friend class SwFltControlStack; - bool bNewDoc; - bool bStdPD; - bool bProtect; - -public: - SwFltShell(SwDoc* , SwPaM& , const OUString& rBaseURL, bool bNew, sal_uLong = 0); - ~SwFltShell(); - - SwDoc& GetDoc() { return *aStack.pDoc; } - - rtl_TextEncoding SetCharSet(rtl_TextEncoding eNew) { rtl_TextEncoding eOld = eSrcCharSet; - eSrcCharSet = eNew; - return eOld; - } - void SetUseStdPageDesc() { bStdPD = true; } - void SetProtect() { bProtect = true; } - SwPageDesc* MakePageDesc(SwPageDesc* pFirstPageDesc = NULL); - SwPageDesc& GetPageDesc() { return *pCurrentPageDesc; } - void NextTab() { (*this) << sal_uInt8(0x09); } - void NextLine() { (*this) << sal_uInt8(0x0a); } - void NextParagraph(); - void NextPage(); - void NextSection() { pCurrentPageDesc = MakePageDesc(); } - - SwFltShell& AddGraphic( const OUString& rPicName ); - SwFltShell& AddError( const sal_Char* pErr ); - SwFltShell& EndItem( sal_uInt16 nId ); - SwFltShell& SetStyle( sal_uInt16 nStyle ); - - SwFltShell& operator << ( Graphic& ); - SwFltShell& operator << ( SwFltBookmark& aBook ); - void SetBookEnd(long nHandle); - SwFltShell& operator << ( const OUString& ); // Vorsicht: CHARSET_ANSI - SwFltShell& operator << ( const sal_Unicode ); - SwFltShell& operator << ( const SwField& ); - SwFltShell& operator << ( const SfxPoolItem& rItem ) - { *pOut << rItem; return *this; } - -// SwFltShell& operator >> (SfxPoolItem&); -// methode zum beenden einer sub-sektion, zB Fusznote etc - void End() { eSubMode = None; } -// methoden zur verwaltung von Header/Footer - void BeginHeader(SwPageDesc* =NULL); - void BeginFooter(SwPageDesc* =NULL); - void EndHeaderFooter(); -// methoden zur verwaltung von FootNotes - void BeginFootnote(); - void EndFootnote(); -// methoden zur verwaltung von Tabellen - bool IsInTable() { - return ( pOut == pOutDoc ) && pOutDoc->IsInTable(); } - const SfxPoolItem& GetCellAttr(sal_uInt16 nWhich) { - return pOut->GetCellAttr(nWhich); } - bool BeginTable() { - bool b = pOut->BeginTable(); - if(b) eSubMode = Table; - return b; } - void NextTableCell() { - pOut->NextTableCell(); } - void NextTableRow() { - pOut->NextTableRow(); } - void SetTableWidth(SwTwips nW) { - pOut->SetTableWidth(nW); } - bool IsTableWidthSet() { - return pOutDoc->IsTableWidthSet(); } - void SetTableOrient(sal_Int16 eOri) { - pOut->SetTableOrient(eOri); } - void SetCellWidth(SwTwips nWidth, sal_uInt16 nCell = USHRT_MAX ) { - pOut->SetCellWidth(nWidth, nCell); } - void SetCellHeight(SwTwips nH) { - pOut->SetCellHeight(nH); } - void SetCellBorder(const SvxBoxItem& rFmtBox, sal_uInt16 nCell = USHRT_MAX ){ - pOut->SetCellBorder(rFmtBox, nCell); } - void SetCellSpace(sal_uInt16 nSp) { - pOut->SetCellSpace(nSp); } - void DeleteCell(sal_uInt16 nCell = USHRT_MAX) { - pOut->DeleteCell(nCell); } - void EndTable() { - pOut->EndTable(); } -// methoden zur verwaltung von Flys - bool IsInFly() { return pOut->IsInFly(); } - bool BeginFly( RndStdIds eAnchor = FLY_AT_PARA, bool bAbsolutePos = false ); - void SetFlyAnchor( RndStdIds eAnchor ) - { pOut->SetFlyAnchor( eAnchor ); } - void SetFlyXPos( short nXPos, sal_Int16 eHRel = com::sun::star::text::RelOrientation::FRAME, - sal_Int16 eHAlign = com::sun::star::text::HoriOrientation::NONE ); - void SetFlyYPos( short nYPos, sal_Int16 eVRel = com::sun::star::text::RelOrientation::FRAME, - sal_Int16 eVAlign = com::sun::star::text::VertOrientation::NONE ); - void SetFlyFrmAttr(const SfxPoolItem& rAttr){ - pOut->SetFlyFrmAttr( rAttr ); } - void EndFly(); -// methoden zur verwaltung von styles: - void BeginStyle(sal_uInt16 nUserCode, RES_POOL_COLLFMT_TYPE aType) - { - OSL_ENSURE(nUserCodeGetColl() ) - ((SwFltFormatCollection*)pOut)->Derived(pColls[nBased]->GetColl()); - } - void NextStyle(sal_uInt16 nWhich, sal_uInt16 nNext); - - void EndStyle() - { -// OSL_ENSURE(eSubMode == Style, "wrong state for style"); - nAktStyle = 0; - pOut = pOutDoc; - eSubMode = None; - } - - bool IsFlagSet(SwFltControlStack::Flags no) const - { return aStack.IsFlagSet(no); } - OUString ConvertUStr(const OUString& rInOut); - OUString QuoteStr( const OUString& rIn ); - - // folgende status kann die shell verwalten: - const SfxPoolItem& GetNodeOrStyAttr(sal_uInt16 nWhich); - const SfxPoolItem& GetAttr(sal_uInt16 nWhich); - const SfxPoolItem& GetFlyFrmAttr(sal_uInt16 nWhich); - SwFieldType* GetSysFldType(sal_uInt16 eWhich); - bool GetWeightBold(); - bool GetPostureItalic(); - bool GetCrossedOut(); - bool GetContour(); - bool GetCaseKapitaelchen(); - bool GetCaseVersalien(); - - const OUString& GetBaseURL() const { return sBaseURL; } -}; - SW_DLLPUBLIC void UpdatePageDescs(SwDoc &rDoc, sal_uInt16 nInPageDescOffset); #endif -- cgit