diff options
Diffstat (limited to 'sw/source/core/inc')
112 files changed, 20024 insertions, 0 deletions
diff --git a/sw/source/core/inc/GetMetricVal.hxx b/sw/source/core/inc/GetMetricVal.hxx new file mode 100644 index 000000000000..0d897cfa395a --- /dev/null +++ b/sw/source/core/inc/GetMetricVal.hxx @@ -0,0 +1,54 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _GETMETRICVAL_HXX +#define _GETMETRICVAL_HXX + +#include <tools/solar.h> + +#define CM_1 0 // 1 centimeter or 1/2 inch +#define CM_05 1 // 0.5 centimeter or 1/4 inch +#define CM_01 2 // 0.1 centimeter or 1/20 inch + +inline sal_uInt16 GetMetricVal( int n ) +{ +#ifdef USE_MEASUREMENT + sal_uInt16 nVal = MEASURE_METRIC == SvtSysLocale().GetLocaleData().getMeasurementSystemEnum() + ? 567 // 1 cm + : 770; // 1/2 Inch +#else + sal_uInt16 nVal = 567; // 1 cm +#endif + + if( CM_01 == n ) + nVal /= 10; + else if( CM_05 == n ) + nVal /= 2; + return nVal; +} + + +#endif diff --git a/sw/source/core/inc/MarkManager.hxx b/sw/source/core/inc/MarkManager.hxx new file mode 100644 index 000000000000..5b03672f461f --- /dev/null +++ b/sw/source/core/inc/MarkManager.hxx @@ -0,0 +1,97 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SW_BOOKMARK_MARKMANAGER_HXX +#define _SW_BOOKMARK_MARKMANAGER_HXX + +#include <IMark.hxx> +#include <IDocumentMarkAccess.hxx> + +namespace sw { namespace mark +{ + class MarkManager + : private ::boost::noncopyable + , virtual public IDocumentMarkAccess + { + public: + MarkManager(/*[in/out]*/ SwDoc& rDoc); +#if OSL_DEBUG_LEVEL > 1 + void dumpFieldmarks( ) const; +#endif + // IDocumentMarkAccess + virtual ::sw::mark::IMark* makeMark(const SwPaM& rPaM, const ::rtl::OUString& rName, IDocumentMarkAccess::MarkType eMark); + + virtual sw::mark::IFieldmark* makeFieldBookmark( const SwPaM& rPaM, + const rtl::OUString& rName, + const rtl::OUString& rType); + virtual sw::mark::IFieldmark* makeNoTextFieldBookmark( const SwPaM& rPaM, + const rtl::OUString& rName, + const rtl::OUString& rType); + + virtual ::sw::mark::IMark* getMarkForTxtNode(const SwTxtNode& rTxtNode, IDocumentMarkAccess::MarkType eMark); + + virtual void repositionMark(::sw::mark::IMark* io_pMark, const SwPaM& rPaM); + virtual bool renameMark(::sw::mark::IMark* io_pMark, const ::rtl::OUString& rNewName); + virtual void correctMarksAbsolute(const SwNodeIndex& rOldNode, const SwPosition& rNewPos, const xub_StrLen nOffset); + virtual void correctMarksRelative(const SwNodeIndex& rOldNode, const SwPosition& rNewPos, const xub_StrLen nOffset); + + virtual void deleteMarks(const SwNodeIndex& rStt, const SwNodeIndex& rEnd, ::std::vector< ::sw::mark::SaveBookmark>* pSaveBkmk, const SwIndex* pSttIdx, const SwIndex* pEndIdx); + + // deleters + virtual void deleteMark(const const_iterator_t ppMark); + virtual void deleteMark(const ::sw::mark::IMark* const pMark); + virtual void clearAllMarks(); + + // marks + virtual const_iterator_t getMarksBegin() const; + virtual const_iterator_t getMarksEnd() const; + virtual sal_Int32 getMarksCount() const; + virtual const_iterator_t findMark(const ::rtl::OUString& rName) const; + + // bookmarks + virtual const_iterator_t getBookmarksBegin() const; + virtual const_iterator_t getBookmarksEnd() const; + virtual sal_Int32 getBookmarksCount() const; + virtual const_iterator_t findBookmark(const ::rtl::OUString& rName) const; + + // Fieldmarks + virtual ::sw::mark::IFieldmark* getFieldmarkFor(const SwPosition& rPos) const; + virtual ::sw::mark::IFieldmark* getFieldmarkBefore(const SwPosition& rPos) const; + virtual ::sw::mark::IFieldmark* getFieldmarkAfter(const SwPosition& rPos) const; + + private: + // make names + ::rtl::OUString getUniqueMarkName(const ::rtl::OUString& rName) const; + void sortMarks(); + + container_t m_vMarks; + container_t m_vBookmarks; + container_t m_vFieldmarks; + SwDoc * const m_pDoc; + }; +}} +#endif diff --git a/sw/source/core/inc/SwGrammarMarkUp.hxx b/sw/source/core/inc/SwGrammarMarkUp.hxx new file mode 100644 index 000000000000..393c917bfc45 --- /dev/null +++ b/sw/source/core/inc/SwGrammarMarkUp.hxx @@ -0,0 +1,74 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _SWGRAMMARMARKUP_HXX +#define _SWGRAMMARMARKUP_HXX + +#include <wrong.hxx> +#include <vector> + +/* SwGrammarMarkUp extends the functionality of a "normal" SwWrongList by memorizing + the start positions of sentences in the paragraph + + The whole class is only a temporary solution without usage of virtual functions. + At the end the whole SwWrongList stuff should be reworked and replaced by interfaces + to deal with all the different wronglists like + spell, grammar, smarttag, sentence... + "MarkUpList" would be a better name than WrongList. +*/ + +class SwGrammarMarkUp : public SwWrongList +{ + std::vector< xub_StrLen > maSentence; +public: + SwGrammarMarkUp() : SwWrongList( WRONGLIST_GRAMMAR ) {} + SwGrammarMarkUp( const SwGrammarMarkUp* ); + + virtual ~SwGrammarMarkUp(); + virtual SwWrongList* Clone(); + virtual void CopyFrom( const SwWrongList& rCopy ); + + /* SwWrongList::Move() + handling of maSentence */ + void MoveGrammar( xub_StrLen nPos, long nDiff ); + /* SwWrongList::SplitList() + handling of maSentence */ + SwGrammarMarkUp* SplitGrammarList( xub_StrLen nSplitPos ); + /* SwWrongList::JoinList() + handling of maSentence */ + void JoinGrammarList( SwGrammarMarkUp* pNext, xub_StrLen nInsertPos ); + /* SwWrongList::ClearList() + handling of maSentence */ + void ClearGrammarList( xub_StrLen nSentenceEnd = STRING_LEN ); + /* setSentence to define the start positionof a sentence, + at the moment the end position is given by the next start position */ + void setSentence( xub_StrLen nStart ); + /* getSentenceStart returns the last start position of a sentence + which is lower or equal to the given parameter */ + xub_StrLen getSentenceStart( xub_StrLen nPos ); + /* getSentenceEnd returns the first start position of a sentence + which is greater than the given parameter */ + xub_StrLen getSentenceEnd( xub_StrLen nPos ); +}; + +#endif diff --git a/sw/source/core/inc/SwPortionHandler.hxx b/sw/source/core/inc/SwPortionHandler.hxx new file mode 100644 index 000000000000..11888f67a8ae --- /dev/null +++ b/sw/source/core/inc/SwPortionHandler.hxx @@ -0,0 +1,101 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SW_PORTIONHANDLER_HXX +#define _SW_PORTIONHANDLER_HXX + +#include <tools/solar.h> +class String; + +/** The SwPortionHandler interface implements a visitor for the layout + * engine's text portions. This can be used to gather information of + * the on-screen representation of a single paragraph. + * + * For each text portion, one of the methods text(...) or special(...) + * is called, depending on whether it is a 'normal' run of text, or + * any other portion. Additionally, the linebreak() method is called + * once at the end of every on-screen line. + * + * All parameters relate to the 'model string', which is the text string + * held by the corresponding SwTxtNode. + * + * The SwPortionHandler can be used with the + * SwTextFrame::VisitPortions(...) method. + */ +class SwPortionHandler +{ +public: + + SwPortionHandler() {} /// (emtpy) constructor + + virtual ~SwPortionHandler() {} /// (empty) destructor + + /** text portion. A run of nLength characters from the model + * string, that contains no special characters like embedded + * fields, etc. Thus, the on-screen text of this portion + * corresponds exactly to the corresponding characters in the + * model string. + */ + virtual void Text( + sal_uInt16 nLength, /// length of this portion in the model string + sal_uInt16 nType /// type of this portion + ) = 0; + + /** special portion. This method is called for every non-text + * portion. The parameters describe the length of the + * corresponding characters in the model string (often 0 or 1), + * the text which is displayed, and the type of the portion. + */ + virtual void Special( + sal_uInt16 nLength, /// length of this portion in the model string + const String& rText, /// text which is painted on-screen + sal_uInt16 nType /// type of this portion + ) = 0; + + /** line break. This method is called whenever a line break in the + * layout occurs. + */ + virtual void LineBreak() = 0; + + /** skip characters. The SwTxtFrame may only display partially + * display a certain paragraph (e.g. when the paragaph is split + * across multiple pages). In this case, the Skip() method must be + * called to inform the portion handler to ignore a certain run of + * characters in the 'model string'. Skip(), if used at all, must + * be called before any of the other methods is called. Calling + * Skip() between portions is not allowed. + */ + virtual void Skip( + sal_uInt16 nLength /// number of 'model string' characters to be skipped + ) = 0; + + /** end of paragraph. This method is to be called when all the + * paragraph's portions have been processed. + */ + virtual void Finish() = 0; +}; + +#endif diff --git a/sw/source/core/inc/SwUndoFmt.hxx b/sw/source/core/inc/SwUndoFmt.hxx new file mode 100644 index 000000000000..1df5436e7ad2 --- /dev/null +++ b/sw/source/core/inc/SwUndoFmt.hxx @@ -0,0 +1,253 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_UNDO_TXT_FMT_COLL_HXX +#define SW_UNDO_TXT_FMT_COLL_HXX + +#include <undobj.hxx> +#include <swundo.hxx> +#include <numrule.hxx> + + +class SwDoc; +class SwTxtFmtColl; +class String; +class SwRewriter; +class SfxItemSet; + +class SwUndoFmtCreate : public SwUndo +{ +protected: + SwFmt * pNew; + String sDerivedFrom; + SwDoc * pDoc; + mutable String sNewName; + SfxItemSet * pNewSet; + sal_uInt16 nId; // FmtId related + sal_Bool bAuto; + +public: + + SwUndoFmtCreate(SwUndoId nUndoId, SwFmt * pNew, SwFmt * pDerivedFrom, + SwDoc * pDoc); + virtual ~SwUndoFmtCreate(); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + + virtual SwRewriter GetRewriter() const; + + virtual SwFmt * Create(SwFmt * pDerivedFrom) = 0; + virtual void Delete() = 0; + virtual SwFmt * Find(const String & rName) const = 0; +}; + +class SwUndoFmtDelete : public SwUndo +{ +protected: + String sDerivedFrom; + SwDoc * pDoc; + String sOldName; + SfxItemSet aOldSet; + sal_uInt16 nId; // FmtId related + sal_Bool bAuto; + +public: + SwUndoFmtDelete(SwUndoId nUndoId, SwFmt * pOld, SwDoc * pDoc); + ~SwUndoFmtDelete(); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + + virtual SwRewriter GetRewriter() const; + + virtual SwFmt * Create(SwFmt * pDerivedFrom) = 0; + virtual void Delete(SwFmt * pFmt) = 0; + virtual SwFmt * Find(const String & rName) const = 0; +}; + +class SwUndoRenameFmt : public SwUndo +{ +protected: + String sOldName, sNewName; + SwDoc * pDoc; +// SwUndoId nId; + +public: + SwUndoRenameFmt(SwUndoId nUndoId, const String & sOldName, + const String & sNewName, + SwDoc * pDoc); + ~SwUndoRenameFmt(); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + + SwRewriter GetRewriter() const; + + virtual SwFmt * Find(const String & rName) const = 0; +}; + +class SwUndoTxtFmtCollCreate : public SwUndoFmtCreate +{ +public: + SwUndoTxtFmtCollCreate(SwTxtFmtColl * pNew, SwTxtFmtColl * pDerivedFrom, + SwDoc * pDoc); + + virtual SwFmt * Create(SwFmt * pDerivedFrom); + virtual void Delete(); + virtual SwFmt * Find(const String & rName) const; +}; + +class SwUndoTxtFmtCollDelete : public SwUndoFmtDelete +{ +public: + SwUndoTxtFmtCollDelete(SwTxtFmtColl * pOld, SwDoc * pDoc); + + virtual SwFmt * Create(SwFmt * pDerivedFrom); + virtual void Delete(SwFmt * pFmt); + virtual SwFmt * Find(const String & rName) const; +}; + +class SwUndoRenameFmtColl : public SwUndoRenameFmt +{ +public: + SwUndoRenameFmtColl(const String & sOldName, + const String & sNewName, + SwDoc * pDoc); + + virtual SwFmt * Find(const String & rName) const; +}; + +class SwUndoCharFmtCreate : public SwUndoFmtCreate +{ +public: + SwUndoCharFmtCreate(SwCharFmt * pNew, SwCharFmt * pDerivedFrom, + SwDoc * pDoc); + + virtual SwFmt * Create(SwFmt * pDerivedFrom); + virtual void Delete(); + virtual SwFmt * Find(const String & rName) const; +}; + +class SwUndoCharFmtDelete : public SwUndoFmtDelete +{ +public: + SwUndoCharFmtDelete(SwCharFmt * pOld, SwDoc * pDoc); + + virtual SwFmt * Create(SwFmt * pDerivedFrom); + virtual void Delete(SwFmt * pFmt); + virtual SwFmt * Find(const String & rName) const; +}; + +class SwUndoRenameCharFmt : public SwUndoRenameFmt +{ +public: + SwUndoRenameCharFmt(const String & sOldName, + const String & sNewName, + SwDoc * pDoc); + + virtual SwFmt * Find(const String & rName) const; +}; + +class SwUndoFrmFmtCreate : public SwUndoFmtCreate +{ + sal_Bool bAuto; + +public: + SwUndoFrmFmtCreate(SwFrmFmt * pNew, SwFrmFmt * pDerivedFrom, + SwDoc * pDoc); + + virtual SwFmt * Create(SwFmt * pDerivedFrom); + virtual void Delete(); + virtual SwFmt * Find(const String & rName) const; +}; + +class SwUndoFrmFmtDelete : public SwUndoFmtDelete +{ +public: + SwUndoFrmFmtDelete(SwFrmFmt * pOld, SwDoc * pDoc); + + virtual SwFmt * Create(SwFmt * pDerivedFrom); + virtual void Delete(SwFmt * pFmt); + virtual SwFmt * Find(const String & rName) const; +}; + +class SwUndoRenameFrmFmt : public SwUndoRenameFmt +{ +public: + SwUndoRenameFrmFmt(const String & sOldName, + const String & sNewName, + SwDoc * pDoc); + + virtual SwFmt * Find(const String & rName) const; +}; + +class SwUndoNumruleCreate : public SwUndo +{ + const SwNumRule * pNew; + mutable SwNumRule aNew; + SwDoc * pDoc; + mutable bool bInitialized; + +public: + SwUndoNumruleCreate(const SwNumRule * pNew, SwDoc * pDoc); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + + SwRewriter GetRewriter() const; +}; + +class SwUndoNumruleDelete : public SwUndo +{ + SwNumRule aOld; + SwDoc * pDoc; + +public: + SwUndoNumruleDelete(const SwNumRule & aRule, SwDoc * pDoc); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + + SwRewriter GetRewriter() const; +}; + +class SwUndoNumruleRename : public SwUndo +{ + String aOldName, aNewName; + SwDoc * pDoc; + + public: + SwUndoNumruleRename(const String & aOldName, const String & aNewName, + SwDoc * pDoc); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + + SwRewriter GetRewriter() const; +}; + +#endif // SW_UNDO_TXT_FMT_COLL_HXX diff --git a/sw/source/core/inc/SwUndoPageDesc.hxx b/sw/source/core/inc/SwUndoPageDesc.hxx new file mode 100644 index 000000000000..1de717a453d6 --- /dev/null +++ b/sw/source/core/inc/SwUndoPageDesc.hxx @@ -0,0 +1,93 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_UNDO_PAGE_DESC_HXX +#define SW_UNDO_PAGE_DESC_HXX + +#include <undobj.hxx> +#include <pagedesc.hxx> + +class SwDoc; +class SwPageDesc; + + +class SwUndoPageDesc : public SwUndo +{ + SwPageDescExt aOld, aNew; + SwDoc * pDoc; + bool bExchange; + + // To avoid duplication of (header/footer)content nodes for simple page desc changes + void ExchangeContentNodes( SwPageDesc& rSource, SwPageDesc &rDest ); + +public: + SwUndoPageDesc(const SwPageDesc & aOld, const SwPageDesc & aNew, + SwDoc * pDoc); + virtual ~SwUndoPageDesc(); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + + virtual SwRewriter GetRewriter() const; +}; + +class SwUndoPageDescCreate : public SwUndo +{ + const SwPageDesc * pDesc; // #116530# + SwPageDescExt aNew; + SwDoc * pDoc; + + void DoImpl(); + +public: + SwUndoPageDescCreate(const SwPageDesc * pNew, SwDoc * pDoc); // #116530# + virtual ~SwUndoPageDescCreate(); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + virtual void RepeatImpl( ::sw::RepeatContext & ); + + virtual SwRewriter GetRewriter() const; +}; + +class SwUndoPageDescDelete : public SwUndo +{ + SwPageDescExt aOld; + SwDoc * pDoc; + + void DoImpl(); + +public: + SwUndoPageDescDelete(const SwPageDesc & aOld, SwDoc * pDoc); + virtual ~SwUndoPageDescDelete(); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + virtual void RepeatImpl( ::sw::RepeatContext & ); + + virtual SwRewriter GetRewriter() const; +}; +#endif // _SW_UNDO_PAGE_DESC_CHANGE_HXX diff --git a/sw/source/core/inc/SwUndoTOXChange.hxx b/sw/source/core/inc/SwUndoTOXChange.hxx new file mode 100644 index 000000000000..5fa221b23979 --- /dev/null +++ b/sw/source/core/inc/SwUndoTOXChange.hxx @@ -0,0 +1,49 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_UNDO_TOX_CHANGE_HXX +#define SW_UNDO_TOX_CHANGE_HXX + +#include <undobj.hxx> +#include <tox.hxx> + +class SwUndoTOXChange : public SwUndo +{ + SwTOXBase * pTOX, aOld, aNew; + + void UpdateTOXBaseSection(); + void DoImpl(); + +public: + SwUndoTOXChange(SwTOXBase * pTOX, const SwTOXBase & rNew); + virtual ~SwUndoTOXChange(); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + virtual void RepeatImpl( ::sw::RepeatContext & ); +}; + +#endif // SW_UNDO_TOX_CHANGE_HXX diff --git a/sw/source/core/inc/SwXMLBlockExport.hxx b/sw/source/core/inc/SwXMLBlockExport.hxx new file mode 100644 index 000000000000..59ca2b59540e --- /dev/null +++ b/sw/source/core/inc/SwXMLBlockExport.hxx @@ -0,0 +1,73 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SW_XMLBLOCKEXPORT_HXX +#define _SW_XMLBLOCKEXPORT_HXX + +#include <xmloff/xmlexp.hxx> + +class String; +class SwXMLTextBlocks; + +class SwXMLBlockListExport : public SvXMLExport +{ +private: + SwXMLTextBlocks &rBlockList; +public: + // #110680# + SwXMLBlockListExport( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, + SwXMLTextBlocks & rBlocks, + const rtl::OUString &rFileName, + com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler> &rHandler); + + virtual ~SwXMLBlockListExport ( void ) {} + sal_uInt32 exportDoc( enum ::xmloff::token::XMLTokenEnum eClass); + void _ExportAutoStyles() {} + void _ExportMasterStyles () {} + void _ExportContent() {} +}; + +class SwXMLTextBlockExport : public SvXMLExport +{ +private: + SwXMLTextBlocks &rBlockList; +public: + // #110680# + SwXMLTextBlockExport( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, + SwXMLTextBlocks & rBlocks, + const rtl::OUString &rFileName, + com::sun::star::uno::Reference< com::sun::star::xml::sax::XDocumentHandler> &rHandler); + + virtual ~SwXMLTextBlockExport ( void ) {} + sal_uInt32 exportDoc(enum ::xmloff::token::XMLTokenEnum /*eClass*/) {return 0;} + sal_uInt32 exportDoc(const String & rText); + void _ExportAutoStyles() {} + void _ExportMasterStyles () {} + void _ExportContent() {} +}; +#endif diff --git a/sw/source/core/inc/SwXMLBlockImport.hxx b/sw/source/core/inc/SwXMLBlockImport.hxx new file mode 100644 index 000000000000..a9aa3bb32b08 --- /dev/null +++ b/sw/source/core/inc/SwXMLBlockImport.hxx @@ -0,0 +1,89 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SW_XMLBLOCKIMPORT_HXX +#define _SW_XMLBLOCKIMPORT_HXX + +#include <xmloff/xmlimp.hxx> + +class SwXMLTextBlocks; +class SwXMLBlockListImport : public SvXMLImport +{ +private: + SwXMLTextBlocks &rBlockList; +protected: + + // This method is called after the namespace map has been updated, but + // before a context for the current element has been pushed. + virtual SvXMLImportContext *CreateContext( sal_uInt16 nPrefix, + const ::rtl::OUString& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList > & xAttrList ); +public: + // #110680# + SwXMLBlockListImport( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, + SwXMLTextBlocks &rBlocks ); + + SwXMLTextBlocks& getBlockList ( void ) + { + return rBlockList; + } + virtual ~SwXMLBlockListImport ( void ) + throw(); +}; + +class SwXMLTextBlockImport : public SvXMLImport +{ +private: + SwXMLTextBlocks &rBlockList; +protected: + + // This method is called after the namespace map has been updated, but + // before a context for the current element has been pushed. + virtual SvXMLImportContext *CreateContext( sal_uInt16 nPrefix, + const ::rtl::OUString& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList > & xAttrList ); +public: + sal_Bool bTextOnly; + String &m_rText; + + // #110680# + SwXMLTextBlockImport( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory, + SwXMLTextBlocks &rBlocks, String &rNewText, sal_Bool bNewTextOnly ); + + SwXMLTextBlocks& getBlockList ( void ) + { + return rBlockList; + } + virtual ~SwXMLTextBlockImport ( void ) + throw(); + virtual void SAL_CALL endDocument(void) + throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); +}; +#endif diff --git a/sw/source/core/inc/SwXMLBlockListContext.hxx b/sw/source/core/inc/SwXMLBlockListContext.hxx new file mode 100644 index 000000000000..8208d78db2d6 --- /dev/null +++ b/sw/source/core/inc/SwXMLBlockListContext.hxx @@ -0,0 +1,126 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SW_XMLBLOCKLISTCONTEXT_HXX +#define _SW_XMLBLOCKLISTCONTEXT_HXX + +#include <xmloff/xmlictxt.hxx> + +class SwXMLBlockListImport; +class SwXMLTextBlockImport; + +class SwXMLBlockListContext : public SvXMLImportContext +{ +private: + SwXMLBlockListImport & rLocalRef; +public: + SwXMLBlockListContext( SwXMLBlockListImport& rImport, + sal_uInt16 nPrefix, + const rtl::OUString& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList > & xAttrList ); + ~SwXMLBlockListContext ( void ); + virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, + const rtl::OUString& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList > & xAttrList ); + +}; +class SwXMLBlockContext : public SvXMLImportContext +{ +private: + SwXMLBlockListImport & rLocalRef; +public: + SwXMLBlockContext( SwXMLBlockListImport& rImport, + sal_uInt16 nPrefix, + const rtl::OUString& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList > & xAttrList ); + ~SwXMLBlockContext ( void ); +}; + +class SwXMLTextBlockDocumentContext : public SvXMLImportContext +{ +private: + SwXMLTextBlockImport & rLocalRef; +public: + SwXMLTextBlockDocumentContext( SwXMLTextBlockImport& rImport, + sal_uInt16 nPrefix, + const rtl::OUString& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList > & xAttrList ); + virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, + const rtl::OUString& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList > & xAttrList ); + ~SwXMLTextBlockDocumentContext ( void ); +}; +class SwXMLTextBlockBodyContext : public SvXMLImportContext +{ +private: + SwXMLTextBlockImport & rLocalRef; +public: + SwXMLTextBlockBodyContext( SwXMLTextBlockImport& rImport, + sal_uInt16 nPrefix, + const rtl::OUString& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList > & xAttrList ); + virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, + const rtl::OUString& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList > & xAttrList ); + ~SwXMLTextBlockBodyContext ( void ); +}; +class SwXMLTextBlockTextContext : public SvXMLImportContext +{ +private: + SwXMLTextBlockImport & rLocalRef; +public: + SwXMLTextBlockTextContext( SwXMLTextBlockImport& rImport, + sal_uInt16 nPrefix, + const rtl::OUString& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList > & xAttrList ); + virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, + const rtl::OUString& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList > & xAttrList ); + ~SwXMLTextBlockTextContext ( void ); +}; +class SwXMLTextBlockParContext : public SvXMLImportContext +{ +private: + SwXMLTextBlockImport & rLocalRef; +public: + SwXMLTextBlockParContext( SwXMLTextBlockImport& rImport, + sal_uInt16 nPrefix, + const rtl::OUString& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList > & xAttrList ); + virtual void Characters( const ::rtl::OUString& rChars ); + ~SwXMLTextBlockParContext ( void ); +}; +#endif diff --git a/sw/source/core/inc/SwXMLTextBlocks.hxx b/sw/source/core/inc/SwXMLTextBlocks.hxx new file mode 100644 index 000000000000..8e487a21fc85 --- /dev/null +++ b/sw/source/core/inc/SwXMLTextBlocks.hxx @@ -0,0 +1,111 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SW_XMLTEXTBLOCKS_HXX +#define _SW_XMLTEXTBLOCKS_HXX +#include <sfx2/objsh.hxx> +#include <sfx2/docfile.hxx> +#include <swblocks.hxx> + +class SfxMedium; +class SwPaM; +class SwDoc; +class SvxMacroTableDtor; +class SwImpBlocks; + +#define SWXML_CONVBLOCK 0x0001 +#define SWXML_NOROOTCOMMIT 0x0002 + +class SwXMLTextBlocks : public SwImpBlocks +{ +protected: + sal_Bool bAutocorrBlock; + sal_Bool bBlock; + SfxObjectShellRef xDocShellRef; + sal_uInt16 nFlags; + String aPackageName; + SfxMediumRef xMedium; + + void ReadInfo(); + void WriteInfo(); + void InitBlockMode ( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& rStorage ); + void ResetBlockMode(); + +public: + com::sun::star::uno::Reference < com::sun::star::embed::XStorage > xBlkRoot; + com::sun::star::uno::Reference < com::sun::star::embed::XStorage > xRoot; + short nCurBlk; + SwXMLTextBlocks( const String& rFile ); + SwXMLTextBlocks( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&, const String& rFile ); + void AddName( const String&, const String&, const String&, sal_Bool bOnlyTxt = sal_False ); + virtual void AddName( const String&, const String&, sal_Bool bOnlyTxt = sal_False ); + void GeneratePackageName ( const String& rShort, String& rPackageName ); + virtual ~SwXMLTextBlocks(); + //virtual sal_Bool IsOld() const; + virtual sal_uLong Delete( sal_uInt16 ); + virtual sal_uLong Rename( sal_uInt16, const String&, const String& ); + virtual sal_uLong CopyBlock( SwImpBlocks& rImp, String& rShort, const String& rLong); + virtual void ClearDoc(); + virtual sal_uLong GetDoc( sal_uInt16 ); + virtual sal_uLong BeginPutDoc( const String&, const String& ); + virtual sal_uLong PutDoc(); + virtual sal_uLong GetText( sal_uInt16, String& ); + virtual sal_uLong PutText( const String&, const String&, const String& ); + virtual sal_uLong MakeBlockList(); + + virtual short GetFileType ( void ) const; + virtual sal_uLong OpenFile( sal_Bool bReadOnly = sal_True ); + virtual void CloseFile(); + + static sal_Bool IsFileUCBStorage( const String & rFileName); + + // Methods for the new Autocorrecter + sal_uLong GetText( const String& rShort, String& ); + + virtual sal_Bool IsOnlyTextBlock( const String& rShort ) const; + virtual sal_Bool IsOnlyTextBlock( sal_uInt16 nIdx ) const; + virtual void SetIsTextOnly( const String& rShort, sal_Bool bNewValue ); + virtual void SetIsTextOnly( sal_uInt16 nIdx, sal_Bool bNewValue ); + + virtual sal_uLong GetMacroTable( sal_uInt16, SvxMacroTableDtor& rMacroTbl, + sal_Bool bFileAlreadyOpen = sal_False ); + virtual sal_uLong SetMacroTable( sal_uInt16 nIdx, + const SvxMacroTableDtor& rMacroTable, + sal_Bool bFileAlreadyOpen = sal_False ); + virtual sal_Bool PutMuchEntries( sal_Bool bOn ); + +public: + SwDoc* GetDoc() const { return pDoc; } + //void SetDoc( SwDoc * pNewDoc); + sal_uLong StartPutBlock( const String& rShort, const String& rPackageName ); + sal_uLong PutBlock( SwPaM& rPaM, const String& rLong ); + sal_uLong GetBlockText( const String& rShort, String& rText ); + sal_uLong PutBlockText( const String& rShort, const String& rName, const String& rText, const String& rPackageName ); + void MakeBlockText( const String& rText ); + +}; + +#endif diff --git a/sw/source/core/inc/SwXTextDefaults.hxx b/sw/source/core/inc/SwXTextDefaults.hxx new file mode 100644 index 000000000000..f1ed6bbf1371 --- /dev/null +++ b/sw/source/core/inc/SwXTextDefaults.hxx @@ -0,0 +1,84 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SW_XTEXT_DEFAULTS_HXX +#define _SW_XTEXT_DEFAULTS_HXX +#include <cppuhelper/implbase3.hxx> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/beans/XPropertyState.hpp> + +#ifndef _COM_SUN_STAR_BEANS_XSERVICEINFO_HPP_ +#include <com/sun/star/lang/XServiceInfo.hpp> +#endif +#include <svl/itemprop.hxx> + +class SwDoc; + +class SwXTextDefaults : public cppu::WeakImplHelper3 + < + com::sun::star::beans::XPropertyState, + com::sun::star::beans::XPropertySet, + com::sun::star::lang::XServiceInfo + > +{ + const SfxItemPropertySet* m_pPropSet; + SwDoc * m_pDoc; +public: + SwXTextDefaults ( SwDoc * pNewDoc ); + ~SwXTextDefaults (); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Any& aValue ) + throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& rPropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) + throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // XPropertyState + virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& rPropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rPropertyNames ) + throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& rPropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& rPropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); +}; +#endif diff --git a/sw/source/core/inc/UndoAttribute.hxx b/sw/source/core/inc/UndoAttribute.hxx new file mode 100644 index 000000000000..849603e2b534 --- /dev/null +++ b/sw/source/core/inc/UndoAttribute.hxx @@ -0,0 +1,288 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SW_UNDO_ATTRIBUTE_HXX +#define SW_UNDO_ATTRIBUTE_HXX + +#include <undobj.hxx> + +#include <memory> + +#ifndef _SVSTDARR_HXX +#define _SVSTDARR_USHORTS +#define _SVSTDARR_ULONGS +#define _SVSTDARR_BOOLS +#define _SVSTDARR_BYTES +#define _SVSTDARR_USHORTSSORT +#include <svl/svstdarr.hxx> +#endif +#include <svl/itemset.hxx> + +#include <swtypes.hxx> +#include <calbck.hxx> + + +class SvxTabStopItem; +class SwFmt; +class SwFtnInfo; +class SwEndNoteInfo; + + +class SwUndoAttr : public SwUndo, private SwUndRng +{ + SfxItemSet m_AttrSet; // attributes for Redo + const ::std::auto_ptr<SwHistory> m_pHistory; // History for Undo + ::std::auto_ptr<SwRedlineData> m_pRedlineData; // Redlining + ::std::auto_ptr<SwRedlineSaveDatas> m_pRedlineSaveData; + sal_uLong m_nNodeIndex; // Offset: for Redlining + const SetAttrMode m_nInsertFlags; // insert flags + + void RemoveIdx( SwDoc& rDoc ); + +public: + SwUndoAttr( const SwPaM&, const SfxItemSet &, const SetAttrMode nFlags ); + SwUndoAttr( const SwPaM&, const SfxPoolItem&, const SetAttrMode nFlags ); + + virtual ~SwUndoAttr(); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + virtual void RepeatImpl( ::sw::RepeatContext & ); + + void SaveRedlineData( const SwPaM& rPam, sal_Bool bInsCntnt ); + + SwHistory& GetHistory() { return *m_pHistory; } + +}; + +class SwUndoResetAttr : public SwUndo, private SwUndRng +{ + const ::std::auto_ptr<SwHistory> m_pHistory; + SvUShortsSort m_Ids; + const sal_uInt16 m_nFormatId; // Format-Id for Redo + +public: + SwUndoResetAttr( const SwPaM&, sal_uInt16 nFmtId ); + SwUndoResetAttr( const SwPosition&, sal_uInt16 nFmtId ); + + virtual ~SwUndoResetAttr(); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + virtual void RepeatImpl( ::sw::RepeatContext & ); + + void SetAttrs( const SvUShortsSort& rArr ); + + SwHistory& GetHistory() { return *m_pHistory; } + +}; + +class SwUndoFmtAttr : public SwUndo +{ + friend class SwUndoDefaultAttr; + SwFmt * m_pFmt; + ::std::auto_ptr<SfxItemSet> m_pOldSet; // old attributes + sal_uLong m_nNodeIndex; + const sal_uInt16 m_nFmtWhich; + const bool m_bSaveDrawPt; + + bool IsFmtInDoc( SwDoc* ); //is the attribute format still in the Doc? + void SaveFlyAnchor( bool bSaveDrawPt = false ); + // --> OD 2004-10-26 #i35443# - Add return value, type <bool>. + // Return value indicates, if anchor attribute is restored. + // Notes: - If anchor attribute is restored, all other existing attributes + // are also restored. + // - Anchor attribute isn't restored successfully, if it contains + // an invalid anchor position and all other existing attributes + // aren't restored. + // This situation occurs for undo of styles. + bool RestoreFlyAnchor(::sw::UndoRedoContext & rContext); + // <-- + // --> OD 2008-02-27 #refactorlists# - removed <rAffectedItemSet> + void Init(); + // <-- + +public: + // register at the Format and save old attributes + // --> OD 2008-02-27 #refactorlists# - removed <rNewSet> + SwUndoFmtAttr( const SfxItemSet& rOldSet, + SwFmt& rFmt, + bool bSaveDrawPt = true ); + // <-- + SwUndoFmtAttr( const SfxPoolItem& rItem, + SwFmt& rFmt, + bool bSaveDrawPt = true ); + + virtual ~SwUndoFmtAttr(); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + virtual void RepeatImpl( ::sw::RepeatContext & ); + + virtual SwRewriter GetRewriter() const; + + void PutAttr( const SfxPoolItem& rItem ); + SwFmt* GetFmt( SwDoc& rDoc ); // checks if it is still in the Doc! +}; + +// --> OD 2008-02-12 #newlistlevelattrs# +class SwUndoFmtResetAttr : public SwUndo +{ + public: + SwUndoFmtResetAttr( SwFmt& rChangedFormat, + const sal_uInt16 nWhichId ); + ~SwUndoFmtResetAttr(); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + + private: + // format at which a certain attribute is reset. + SwFmt * const m_pChangedFormat; + // which ID of the reset attribute + const sal_uInt16 m_nWhichId; + // old attribute which has been reset - needed for undo. + ::std::auto_ptr<SfxPoolItem> m_pOldItem; +}; +// <-- + +class SwUndoDontExpandFmt : public SwUndo +{ + const sal_uLong m_nNodeIndex; + const xub_StrLen m_nContentIndex; + +public: + SwUndoDontExpandFmt( const SwPosition& rPos ); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + virtual void RepeatImpl( ::sw::RepeatContext & ); +}; + +// helper class to receive changed attribute sets +class SwUndoFmtAttrHelper : public SwClient +{ + ::std::auto_ptr<SwUndoFmtAttr> m_pUndo; + const bool m_bSaveDrawPt; + +public: + SwUndoFmtAttrHelper( SwFmt& rFmt, bool bSaveDrawPt = true ); + + virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ); + + SwUndoFmtAttr* GetUndo() const { return m_pUndo.get(); } + // release the undo object (so it is not deleted here), and return it + SwUndoFmtAttr* ReleaseUndo() { return m_pUndo.release(); } +}; + + +class SwUndoMoveLeftMargin : public SwUndo, private SwUndRng +{ + const ::std::auto_ptr<SwHistory> m_pHistory; + const bool m_bModulus; + +public: + SwUndoMoveLeftMargin( const SwPaM&, sal_Bool bRight, sal_Bool bModulus ); + + virtual ~SwUndoMoveLeftMargin(); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + virtual void RepeatImpl( ::sw::RepeatContext & ); + + SwHistory& GetHistory() { return *m_pHistory; } + +}; + + +//-------------------------------------------------------------------- + +class SwUndoDefaultAttr : public SwUndo +{ + ::std::auto_ptr<SfxItemSet> m_pOldSet; // the old attributes + ::std::auto_ptr<SvxTabStopItem> m_pTabStop; + +public: + // registers at the format and saves old attributes + SwUndoDefaultAttr( const SfxItemSet& rOldSet ); + + virtual ~SwUndoDefaultAttr(); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); +}; + + +//-------------------------------------------------------------------- + +class SwUndoChangeFootNote : public SwUndo, private SwUndRng +{ + const ::std::auto_ptr<SwHistory> m_pHistory; + const String m_Text; + const sal_uInt16 m_nNumber; + const bool m_bEndNote; + +public: + SwUndoChangeFootNote( const SwPaM& rRange, const String& rTxt, + sal_uInt16 nNum, bool bIsEndNote ); + virtual ~SwUndoChangeFootNote(); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + virtual void RepeatImpl( ::sw::RepeatContext & ); + + SwHistory& GetHistory() { return *m_pHistory; } +}; + +class SwUndoFootNoteInfo : public SwUndo +{ + ::std::auto_ptr<SwFtnInfo> m_pFootNoteInfo; + +public: + SwUndoFootNoteInfo( const SwFtnInfo &rInfo ); + + virtual ~SwUndoFootNoteInfo(); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); +}; + +class SwUndoEndNoteInfo : public SwUndo +{ + ::std::auto_ptr<SwEndNoteInfo> m_pEndNoteInfo; + +public: + SwUndoEndNoteInfo( const SwEndNoteInfo &rInfo ); + + virtual ~SwUndoEndNoteInfo(); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); +}; + +#endif // SW_UNDO_ATTRIBUTE_HXX + diff --git a/sw/source/core/inc/UndoBookmark.hxx b/sw/source/core/inc/UndoBookmark.hxx new file mode 100644 index 000000000000..87d774d0c43e --- /dev/null +++ b/sw/source/core/inc/UndoBookmark.hxx @@ -0,0 +1,83 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SW_UNDO_BOOKMARK_HXX +#define SW_UNDO_BOOKMARK_HXX + +#include <undobj.hxx> + + +class SwHistoryBookmark; + +namespace sw { + namespace mark { + class IMark; + } +} + + +class SwUndoBookmark : public SwUndo +{ + const ::std::auto_ptr<SwHistoryBookmark> m_pHistoryBookmark; + +protected: + SwUndoBookmark( SwUndoId nUndoId, const ::sw::mark::IMark& ); + + void SetInDoc( SwDoc* ); + void ResetInDoc( SwDoc* ); + +public: + virtual ~SwUndoBookmark(); + + // #111827# + /** + Returns the rewriter for this undo object. + + The rewriter contains the following rule: + + $1 -> <name of bookmark> + + <name of bookmark> is the name of the bookmark whose + insertion/deletion is recorded by this undo object. + + @return the rewriter for this undo object + */ + virtual SwRewriter GetRewriter() const; +}; + + +class SwUndoInsBookmark : public SwUndoBookmark +{ +public: + SwUndoInsBookmark( const ::sw::mark::IMark& ); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); +}; + +#endif // SW_UNDO_BOOKMARK_HXX + diff --git a/sw/source/core/inc/UndoCore.hxx b/sw/source/core/inc/UndoCore.hxx new file mode 100644 index 000000000000..35abb46f7cf7 --- /dev/null +++ b/sw/source/core/inc/UndoCore.hxx @@ -0,0 +1,266 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SW_UNDOCORE_HXX +#define SW_UNDOCORE_HXX + +#include <undobj.hxx> + +#include <calbck.hxx> + + +class SfxItemSet; +class SwFmtColl; +class SwFmtAnchor; +class SdrMarkList; +class SwUndoDelete; +class SwRedlineSaveData; +class SwFrm; +class SwFmt; + +namespace sw { + class UndoManager; + class IShellCursorSupplier; +} + + +typedef SwRedlineSaveData* SwRedlineSaveDataPtr; +SV_DECL_PTRARR_DEL( SwRedlineSaveDatas, SwRedlineSaveDataPtr, 8, 8 ) + + +namespace sw { + +class SW_DLLPRIVATE UndoRedoContext + : public SfxUndoContext +{ +public: + UndoRedoContext(SwDoc & rDoc, IShellCursorSupplier & rCursorSupplier) + : m_rDoc(rDoc) + , m_rCursorSupplier(rCursorSupplier) + , m_pSelFmt(0) + , m_pMarkList(0) + { } + + SwDoc & GetDoc() const { return m_rDoc; } + + IShellCursorSupplier & GetCursorSupplier() { return m_rCursorSupplier; } + + void SetSelections(SwFrmFmt *const pSelFmt, SdrMarkList *const pMarkList) + { + m_pSelFmt = pSelFmt; + m_pMarkList = pMarkList; + } + void GetSelections(SwFrmFmt *& o_rpSelFmt, SdrMarkList *& o_rpMarkList) + { + o_rpSelFmt = m_pSelFmt; + o_rpMarkList = m_pMarkList; + } + +private: + SwDoc & m_rDoc; + IShellCursorSupplier & m_rCursorSupplier; + SwFrmFmt * m_pSelFmt; + SdrMarkList * m_pMarkList; +}; + +class SW_DLLPRIVATE RepeatContext + : public SfxRepeatTarget +{ +public: + RepeatContext(SwDoc & rDoc, SwPaM & rPaM) + : m_rDoc(rDoc) + , m_pCurrentPaM(& rPaM) + , m_bDeleteRepeated(false) + { } + + SwDoc & GetDoc() const { return m_rDoc; } + + SwPaM & GetRepeatPaM() + { + return *m_pCurrentPaM; + } + +private: + friend class ::sw::UndoManager; + friend class ::SwUndoDelete; + + SwDoc & m_rDoc; + SwPaM * m_pCurrentPaM; + bool m_bDeleteRepeated; /// has a delete action been repeated? +}; + +} // namespace sw + + + +class SwUndoFmtColl : public SwUndo, private SwUndRng +{ + String aFmtName; + SwHistory* pHistory; + SwFmtColl* pFmtColl; + // --> OD 2008-04-15 #refactorlists# - for correct <ReDo(..)> and <Repeat(..)> + // boolean, which indicates that the attributes are reseted at the nodes + // before the format has been applied. + const bool mbReset; + // boolean, which indicates that the list attributes had been reseted at + // the nodes before the format has been applied. + const bool mbResetListAttrs; + // <-- + + void DoSetFmtColl(SwDoc & rDoc, SwPaM & rPaM); + +public: + // --> OD 2008-04-15 #refactorlists# +// SwUndoFmtColl( const SwPaM&, SwFmtColl* ); + SwUndoFmtColl( const SwPaM&, SwFmtColl*, + const bool bReset, + const bool bResetListAttrs ); + // <-- + virtual ~SwUndoFmtColl(); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + virtual void RepeatImpl( ::sw::RepeatContext & ); + + // #111827# + /** + Returns the rewriter for this undo object. + + The rewriter contains one rule: + + $1 -> <name of format collection> + + <name of format collection> is the name of the format + collection that is applied by the action recorded by this undo + object. + + @return the rewriter for this undo object + */ + virtual SwRewriter GetRewriter() const; + + SwHistory* GetHistory() { return pHistory; } + +}; + + +class SwUndoSetFlyFmt : public SwUndo, public SwClient +{ + SwFrmFmt* pFrmFmt; // das gespeicherte FlyFormat + SwFrmFmt* pOldFmt; // die alte Fly Vorlage + SwFrmFmt* pNewFmt; // die neue Fly Vorlage + SfxItemSet* pItemSet; // die zurueck-/ gesetzten Attribute + sal_uLong nOldNode, nNewNode; + xub_StrLen nOldCntnt, nNewCntnt; + sal_uInt16 nOldAnchorTyp, nNewAnchorTyp; + sal_Bool bAnchorChgd; + + void PutAttr( sal_uInt16 nWhich, const SfxPoolItem* pItem ); + void Modify( const SfxPoolItem*, const SfxPoolItem* ); + void GetAnchor( SwFmtAnchor& rAnhor, sal_uLong nNode, xub_StrLen nCntnt ); + +public: + SwUndoSetFlyFmt( SwFrmFmt& rFlyFmt, SwFrmFmt& rNewFrmFmt ); + virtual ~SwUndoSetFlyFmt(); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + + virtual SwRewriter GetRewriter() const; + void DeRegisterFromFormat( SwFmt& ); +}; + + +//------------ Undo von verschieben/stufen von Gliederung ---------------- + +class SwUndoOutlineLeftRight : public SwUndo, private SwUndRng +{ + short nOffset; +public: + SwUndoOutlineLeftRight( const SwPaM& rPam, short nOffset ); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + virtual void RepeatImpl( ::sw::RepeatContext & ); +}; + + +//-------------------------------------------------------------------- + +// -> #111827# +const int nUndoStringLength = 20; + +/** + Shortens a string to a maximum length. + + @param rStr the string to be shortened + @param nLength the maximum length for rStr + @param rFillStr string to replace cut out characters with + + If rStr has less than nLength characters it will be returned unaltered. + + If rStr has more than nLength characters the following algorithm + generates the shortened string: + + frontLength = (nLength - length(rFillStr)) / 2 + rearLength = nLength - length(rFillStr) - frontLength + shortenedString = concat(<first frontLength characters of rStr, + rFillStr, + <last rearLength characters of rStr>) + + Preconditions: + - nLength - length(rFillStr) >= 2 + + @return the shortened string + */ +String +ShortenString(const String & rStr, xub_StrLen nLength, const String & rFillStr); +// <- #111827# + +// #16487# +/** + Denotes special characters in a string. + + The rStr is split into parts containing special characters and + parts not containing special characters. In a part containing + special characters all characters are equal. These parts are + maximal. + + @param rStr the string to denote in + + The resulting string is generated by concatenating the found + parts. The parts without special characters are surrounded by + "'". The parts containing special characters are denoted as "n x", + where n is the length of the part and x is the representation of + the special character (i. e. "tab(s)"). + + @return the denoted string +*/ +String DenoteSpecialCharacters(const String & rStr); + + +#endif // SW_UNDOCORE_HXX + diff --git a/sw/source/core/inc/UndoDelete.hxx b/sw/source/core/inc/UndoDelete.hxx new file mode 100644 index 000000000000..7bdfb79c633d --- /dev/null +++ b/sw/source/core/inc/UndoDelete.hxx @@ -0,0 +1,115 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SW_UNDO_DELETE_HXX +#define SW_UNDO_DELETE_HXX + +#include <undobj.hxx> + +#include <tools/mempool.hxx> + + +class SwRedlineSaveDatas; +class SwTxtNode; + +namespace sfx2 { + class MetadatableUndo; +} + + +class SwUndoDelete + : public SwUndo + , private SwUndRng + , private SwUndoSaveCntnt +{ + SwNodeIndex* pMvStt; // Position of Nodes in UndoNodes-Array + String *pSttStr, *pEndStr; + SwRedlineData* pRedlData; + SwRedlineSaveDatas* pRedlSaveData; + ::boost::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndoStart; + ::boost::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndoEnd; + + String sTableName; + + sal_uLong nNode; + sal_uLong nNdDiff; // difference of Nodes before/after Delete + sal_uLong nSectDiff; // diff. of Nodes before/after Move w/ SectionNodes + sal_uLong nReplaceDummy; // diff. to a temporary dummy object + sal_uInt16 nSetPos; + + sal_Bool bGroup : 1; // TRUE: is already Grouped; see CanGrouping() + sal_Bool bBackSp : 1; // TRUE: if Grouped and preceding content deleted + sal_Bool bJoinNext: 1; // TRUE: if range is selected forwards + sal_Bool bTblDelLastNd : 1; // TRUE: TextNode following Table inserted/deleted + sal_Bool bDelFullPara : 1; // TRUE: entire Nodes were deleted + sal_Bool bResetPgDesc : 1; // TRUE: reset PgDsc on following node + sal_Bool bResetPgBrk : 1; // TRUE: reset PgBreak on following node + sal_Bool bFromTableCopy : 1; // TRUE: called by SwUndoTblCpyTbl + + sal_Bool SaveCntnt( const SwPosition* pStt, const SwPosition* pEnd, + SwTxtNode* pSttTxtNd, SwTxtNode* pEndTxtNd ); +public: + SwUndoDelete( SwPaM&, + sal_Bool bFullPara = sal_False, sal_Bool bCalledByTblCpy = sal_False ); + virtual ~SwUndoDelete(); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + virtual void RepeatImpl( ::sw::RepeatContext & ); + + // #111827# + /** + Returns rewriter for this undo object. + + The rewriter consists of the following rule: + + $1 -> '<deleted text>' + + <deleted text> is shortened to nUndoStringLength characters. + + @return rewriter for this undo object + */ + virtual SwRewriter GetRewriter() const; + + sal_Bool CanGrouping( SwDoc*, const SwPaM& ); + + void SetTblDelLastNd() { bTblDelLastNd = sal_True; } + + // for PageDesc/PageBreak Attributes of a table + void SetPgBrkFlags( sal_Bool bPageBreak, sal_Bool bPageDesc ) + { bResetPgDesc = bPageDesc; bResetPgBrk = bPageBreak; } + + void SetTableName(const String & rName); + + // SwUndoTblCpyTbl needs this information: + sal_Bool IsDelFullPara() const { return bDelFullPara; } + + DECL_FIXEDMEMPOOL_NEWDEL(SwUndoDelete) +}; + +#endif // SW_UNDO_DELETE_HXX + diff --git a/sw/source/core/inc/UndoDraw.hxx b/sw/source/core/inc/UndoDraw.hxx new file mode 100644 index 000000000000..9d490901c02b --- /dev/null +++ b/sw/source/core/inc/UndoDraw.hxx @@ -0,0 +1,150 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SW_UNDO_DRAW_HXX +#define SW_UNDO_DRAW_HXX + +#include <undobj.hxx> + +#include <svx/svdundo.hxx> + + +struct SwUndoGroupObjImpl; +class SdrMark; +class SdrMarkList; +class SdrObject; +class SdrObjGroup; +class SdrUndoAction; +class SwDrawFrmFmt; + + + +//-------------------------------------------------------------------- +// ----------- Undo for Draw Objects --------------------------------- + +class SwSdrUndo : public SwUndo +{ + SdrUndoAction* pSdrUndo; + SdrMarkList* pMarkList; // MarkList for all selected SdrObjects +public: + SwSdrUndo( SdrUndoAction* , const SdrMarkList* pMarkList ); + + virtual ~SwSdrUndo(); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + + String GetComment() const; +}; + +class SwUndoDrawGroup : public SwUndo +{ + SwUndoGroupObjImpl* pObjArr; + sal_uInt16 nSize; + sal_Bool bDelFmt; + +public: + SwUndoDrawGroup( sal_uInt16 nCnt ); + + virtual ~SwUndoDrawGroup(); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + + void AddObj( sal_uInt16 nPos, SwDrawFrmFmt*, SdrObject* ); + void SetGroupFmt( SwDrawFrmFmt* ); +}; + +// --> OD 2006-11-01 #130889# +// Action "ungroup drawing object" is now splitted into three parts - see +// method <SwDoc::UnGroupSelection(..)>: +// - creation for <SwDrawFrmFmt> instances for the group members of the +// selected group objects +// - intrinsic ungroup of the selected group objects +// - creation of <SwDrawContact> instances for the former group members and +// connection to the Writer layout. +// Thus, two undo actions (instances of <SwUndo>) are needed: +// - Existing class <SwUndoDrawUnGroup> takes over the part for the formats. +// - New class <SwUndoDrawUnGroupConnectToLayout> takes over the part for +// contact object. +class SwUndoDrawUnGroup : public SwUndo +{ + SwUndoGroupObjImpl* pObjArr; + sal_uInt16 nSize; + sal_Bool bDelFmt; + +public: + SwUndoDrawUnGroup( SdrObjGroup* ); + + virtual ~SwUndoDrawUnGroup(); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + + void AddObj( sal_uInt16 nPos, SwDrawFrmFmt* ); +}; + +// --> OD 2006-11-01 #130889# +class SwUndoDrawUnGroupConnectToLayout : public SwUndo +{ + private: + std::vector< std::pair< SwDrawFrmFmt*, SdrObject* > > aDrawFmtsAndObjs; + + public: + SwUndoDrawUnGroupConnectToLayout(); + + virtual ~SwUndoDrawUnGroupConnectToLayout(); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + + void AddFmtAndObj( SwDrawFrmFmt* pDrawFrmFmt, + SdrObject* pDrawObject ); +}; +// <-- + + +class SwUndoDrawDelete : public SwUndo +{ + SwUndoGroupObjImpl* pObjArr; + SdrMarkList* pMarkLst; // MarkList for all selected SdrObjects + sal_uInt16 nSize; + sal_Bool bDelFmt; + +public: + SwUndoDrawDelete( sal_uInt16 nCnt ); + + virtual ~SwUndoDrawDelete(); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + + void AddObj( sal_uInt16 nPos, SwDrawFrmFmt*, const SdrMark& ); +}; + +#endif // SW_UNDO_DRAW_HXX + diff --git a/sw/source/core/inc/UndoInsert.hxx b/sw/source/core/inc/UndoInsert.hxx new file mode 100644 index 000000000000..a39ba329fdc1 --- /dev/null +++ b/sw/source/core/inc/UndoInsert.hxx @@ -0,0 +1,235 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SW_UNDO_INSERT_HXX +#define SW_UNDO_INSERT_HXX + +#include <undobj.hxx> + +#include <tools/mempool.hxx> + +#include <swtypes.hxx> +#include <IDocumentContentOperations.hxx> + + +class Graphic; +class SwGrfNode; +class SwUndoDelete; +class SwUndoFmtAttr; + + +class SwUndoInsert: public SwUndo, private SwUndoSaveCntnt +{ + SwPosition *pPos; // Inhalt fuers Redo + String *pTxt, *pUndoTxt; + SwRedlineData* pRedlData; + sal_uLong nNode; + xub_StrLen nCntnt, nLen; + sal_Bool bIsWordDelim : 1; + sal_Bool bIsAppend : 1; + + const IDocumentContentOperations::InsertFlags m_nInsertFlags; + + friend class SwDoc; // eigentlich nur SwDoc::Insert( String ) + sal_Bool CanGrouping( sal_Unicode cIns ); + sal_Bool CanGrouping( const SwPosition& rPos ); + + SwDoc * pDoc; + + void Init(const SwNodeIndex & rNode); + String * GetTxtFromDoc() const; + +public: + SwUndoInsert( const SwNodeIndex& rNode, xub_StrLen nCntnt, xub_StrLen nLen, + const IDocumentContentOperations::InsertFlags nInsertFlags, + sal_Bool bWDelim = sal_True ); + SwUndoInsert( const SwNodeIndex& rNode ); + virtual ~SwUndoInsert(); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + virtual void RepeatImpl( ::sw::RepeatContext & ); + + // #111827# + /** + Returns rewriter for this undo object. + + The returned rewriter has the following rule: + + $1 -> '<inserted text>' + + <inserted text> is shortened to a length of nUndoStringLength. + + @return rewriter for this undo object + */ + virtual SwRewriter GetRewriter() const; + + + DECL_FIXEDMEMPOOL_NEWDEL(SwUndoInsert) +}; + + +//-------------------------------------------------------------------- + +SwRewriter SW_DLLPRIVATE +MakeUndoReplaceRewriter(sal_uLong const ocurrences, + ::rtl::OUString const& sOld, ::rtl::OUString const& sNew); + +class SwUndoReplace + : public SwUndo +{ +public: + SwUndoReplace(SwPaM const& rPam, + ::rtl::OUString const& rInsert, bool const bRegExp); + + virtual ~SwUndoReplace(); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + + // #111827# + /** + Returns the rewriter of this undo object. + + If this undo object represents several replacements the + rewriter contains the following rules: + + $1 -> <number of replacements> + $2 -> occurrences of + $3 -> <replaced text> + + If this undo object represents one replacement the rewriter + contains these rules: + + $1 -> <replaced text> + $2 -> "->" (STR_YIELDS) + $3 -> <replacing text> + + @return the rewriter of this undo object + */ + virtual SwRewriter GetRewriter() const; + + void SetEnd( const SwPaM& rPam ); + +private: + class Impl; + ::std::auto_ptr<Impl> m_pImpl; +}; + + +//-------------------------------------------------------------------- + +class SwUndoReRead : public SwUndo +{ + Graphic *pGrf; + String *pNm, *pFltr; + sal_uLong nPos; + sal_uInt16 nMirr; + + void SaveGraphicData( const SwGrfNode& ); + void SetAndSave( ::sw::UndoRedoContext & ); + +public: + SwUndoReRead( const SwPaM& rPam, const SwGrfNode& pGrfNd ); + + virtual ~SwUndoReRead(); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); +}; + +//-------------------------------------------------------------------- + +class SwUndoInsertLabel : public SwUndo +{ + union { + struct { + // fuer NoTxtFrms + SwUndoInsLayFmt* pUndoFly; + SwUndoFmtAttr* pUndoAttr; + } OBJECT; + struct { + // fuer Tabelle/TextRahmen + SwUndoDelete* pUndoInsNd; + sal_uLong nNode; + } NODE; + }; + + String sText; + // --> PB 2005-01-06 #i39983# the separator is drawn with a character style + String sSeparator; + // <-- + String sNumberSeparator; + String sCharacterStyle; + // OD 2004-04-15 #i26791# - re-store of drawing object position no longer needed + sal_uInt16 nFldId; + SwLabelType eType; + sal_uInt8 nLayerId; // fuer Zeichen-Objekte + sal_Bool bBefore :1; + sal_Bool bUndoKeep :1; + sal_Bool bCpyBrd :1; + +public: + SwUndoInsertLabel( const SwLabelType eTyp, const String &rText, + // --> PB 2005-01-06 #i39983# the separator is drawn with a character style + const String& rSeparator, + // <-- + const String& rNumberSeparator, //#i61007# order of captions + const sal_Bool bBefore, const sal_uInt16 nId, + const String& rCharacterStyle, + const sal_Bool bCpyBrd ); + virtual ~SwUndoInsertLabel(); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + virtual void RepeatImpl( ::sw::RepeatContext & ); + + // #111827# + /** + Returns the rewriter of this undo object. + + The rewriter contains this rule: + + $1 -> '<text of inserted label>' + + <text of inserted label> is shortened to nUndoStringLength + characters. + + @return the rewriter of this undo object + */ + virtual SwRewriter GetRewriter() const; + + void SetNodePos( sal_uLong nNd ) + { if( LTYPE_OBJECT != eType ) NODE.nNode = nNd; } + + void SetUndoKeep() { bUndoKeep = sal_True; } + void SetFlys( SwFrmFmt& rOldFly, SfxItemSet& rChgSet, SwFrmFmt& rNewFly ); + void SetDrawObj( sal_uInt8 nLayerId ); +}; + +#endif // SW_UNDO_INSERT_HXX + diff --git a/sw/source/core/inc/UndoManager.hxx b/sw/source/core/inc/UndoManager.hxx new file mode 100644 index 000000000000..0f734d17abfa --- /dev/null +++ b/sw/source/core/inc/UndoManager.hxx @@ -0,0 +1,124 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SW_UNDO_MANAGER_HXX +#define SW_UNDO_MANAGER_HXX + +#include <IDocumentUndoRedo.hxx> + +#include <memory> + +#include <svl/undo.hxx> + + +class IDocumentDrawModelAccess; +class IDocumentRedlineAccess; +class IDocumentState; + + +namespace sw { + +class UndoManager + : public IDocumentUndoRedo + , public SfxUndoManager +{ +public: + + UndoManager(::std::auto_ptr<SwNodes> pUndoNodes, + IDocumentDrawModelAccess & rDrawModelAccess, + IDocumentRedlineAccess & rRedlineAccess, + IDocumentState & rState); + + /** IDocumentUndoRedo */ + virtual void DoUndo(bool const bDoUndo); + virtual bool DoesUndo() const; + virtual void DoGroupUndo(bool const bDoUndo); + virtual bool DoesGroupUndo() const; + virtual void DoDrawUndo(bool const bDoUndo); + virtual bool DoesDrawUndo() const; + virtual void SetUndoNoModifiedPosition(); + virtual void LockUndoNoModifiedPosition(); + virtual void UnLockUndoNoModifiedPosition(); + virtual void SetUndoNoResetModified(); + virtual bool IsUndoNoResetModified() const; +// virtual bool Undo(); + virtual SwUndoId StartUndo(SwUndoId const eUndoId, + SwRewriter const*const pRewriter); + virtual SwUndoId EndUndo(SwUndoId const eUndoId, + SwRewriter const*const pRewriter); + virtual void DelAllUndoObj(); + virtual bool GetLastUndoInfo(::rtl::OUString *const o_pStr, + SwUndoId *const o_pId) const; + virtual SwUndoComments_t GetUndoComments() const; +// virtual bool Redo(); + virtual bool GetFirstRedoInfo(::rtl::OUString *const o_pStr) const; + virtual SwUndoComments_t GetRedoComments() const; + virtual bool Repeat(::sw::RepeatContext & rContext, + sal_uInt16 const nRepeatCnt); + virtual SwUndoId GetRepeatInfo(::rtl::OUString *const o_pStr) const; + virtual void AppendUndo(SwUndo *const pUndo); + virtual void ClearRedo(); + virtual bool IsUndoNodes(SwNodes const& rNodes) const; + + // ::svl::IUndoManager + virtual void AddUndoAction(SfxUndoAction *pAction, + sal_Bool bTryMerg = sal_False); + virtual sal_Bool Undo(); + virtual sal_Bool Redo(); + virtual void EnableUndo(bool bEnable); + + SwUndo * RemoveLastUndo(); + SwUndo * GetLastUndo(); + + SwNodes const& GetUndoNodes() const; + SwNodes & GetUndoNodes(); + +private: + IDocumentDrawModelAccess & m_rDrawModelAccess; + IDocumentRedlineAccess & m_rRedlineAccess; + IDocumentState & m_rState; + + /// Undo nodes array: content not currently in document + ::std::auto_ptr<SwNodes> m_pUndoNodes; + + bool m_bGroupUndo : 1; // TRUE: Undo grouping enabled + bool m_bDrawUndo : 1; // TRUE: Draw Undo enabled + bool m_bLockUndoNoModifiedPosition : 1; + /// position in Undo-Array at which Doc was saved (and is not modified) + UndoStackMark m_UndoSaveMark; + + typedef enum { UNDO = true, REDO = false } UndoOrRedo_t; + bool impl_DoUndoRedo(UndoOrRedo_t const undoOrRedo); + + // UGLY: should not be called + using SfxUndoManager::Repeat; +}; + +} // namespace sw + +#endif // SW_UNDO_MANAGER_HXX + diff --git a/sw/source/core/inc/UndoNumbering.hxx b/sw/source/core/inc/UndoNumbering.hxx new file mode 100644 index 000000000000..8680dcaa3e59 --- /dev/null +++ b/sw/source/core/inc/UndoNumbering.hxx @@ -0,0 +1,154 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SW_UNDO_NUMBERING_HXX +#define SW_UNDO_NUMBERING_HXX + +#include <undobj.hxx> + +#ifndef _SVSTDARR_HXX +#define _SVSTDARR_USHORTS +#define _SVSTDARR_ULONGS +#define _SVSTDARR_BOOLS +#define _SVSTDARR_BYTES +#define _SVSTDARR_USHORTSSORT +#include <svl/svstdarr.hxx> +#endif + +#include <numrule.hxx> + + +//-------------------------------------------------------------------- +//----------- Undo for Numbering ------------------------------------- + +class SwUndoInsNum : public SwUndo, private SwUndRng +{ + SwNumRule aNumRule; + SwHistory* pHistory; + sal_uLong nSttSet; + SwNumRule* pOldNumRule; + String sReplaceRule; + sal_uInt16 nLRSavePos; +public: + SwUndoInsNum( const SwPaM& rPam, const SwNumRule& rRule ); + SwUndoInsNum( const SwNumRule& rOldRule, const SwNumRule& rNewRule, + SwUndoId nUndoId = UNDO_INSFMTATTR ); + SwUndoInsNum( const SwPosition& rPos, const SwNumRule& rRule, + const String& rReplaceRule ); + + virtual ~SwUndoInsNum(); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + virtual void RepeatImpl( ::sw::RepeatContext & ); + + virtual SwRewriter GetRewriter() const; + + SwHistory* GetHistory(); // will be created if necessary + void SetSttNum( sal_uLong nNdIdx ) { nSttSet = nNdIdx; } + void SaveOldNumRule( const SwNumRule& rOld ); + + void SetLRSpaceEndPos(); + +}; + +class SwUndoDelNum : public SwUndo, private SwUndRng +{ + SvULongs aNodeIdx; + SvBytes aLevels; + SvBools aRstLRSpaces; + SwHistory* pHistory; +public: + SwUndoDelNum( const SwPaM& rPam ); + + virtual ~SwUndoDelNum(); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + virtual void RepeatImpl( ::sw::RepeatContext & ); + + void AddNode( const SwTxtNode& rNd, sal_Bool bResetLRSpace ); + SwHistory* GetHistory() { return pHistory; } + +}; + +class SwUndoMoveNum : public SwUndo, private SwUndRng +{ + sal_uLong nNewStt; + long nOffset; +public: + SwUndoMoveNum( const SwPaM& rPam, long nOffset, sal_Bool bIsOutlMv = sal_False ); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + virtual void RepeatImpl( ::sw::RepeatContext & ); + + void SetStartNode( sal_uLong nValue ) { nNewStt = nValue; } +}; + +class SwUndoNumUpDown : public SwUndo, private SwUndRng +{ + short nOffset; +public: + SwUndoNumUpDown( const SwPaM& rPam, short nOffset ); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + virtual void RepeatImpl( ::sw::RepeatContext & ); +}; + +class SwUndoNumOrNoNum : public SwUndo +{ + sal_uLong nIdx; + sal_Bool mbNewNum, mbOldNum; + +public: + SwUndoNumOrNoNum( const SwNodeIndex& rIdx, sal_Bool mbOldNum, + sal_Bool mbNewNum ); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + virtual void RepeatImpl( ::sw::RepeatContext & ); +}; + +class SwUndoNumRuleStart : public SwUndo +{ + sal_uLong nIdx; + sal_uInt16 nOldStt, nNewStt; + sal_Bool bSetSttValue : 1; + sal_Bool bFlag : 1; +public: + SwUndoNumRuleStart( const SwPosition& rPos, sal_Bool bDelete ); + SwUndoNumRuleStart( const SwPosition& rPos, sal_uInt16 nStt ); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + virtual void RepeatImpl( ::sw::RepeatContext & ); +}; + +#endif // SW_UNDO_NUMBERING_HXX + diff --git a/sw/source/core/inc/UndoOverwrite.hxx b/sw/source/core/inc/UndoOverwrite.hxx new file mode 100644 index 000000000000..151de9b344c1 --- /dev/null +++ b/sw/source/core/inc/UndoOverwrite.hxx @@ -0,0 +1,105 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SW_UNDO_OVERWRITE_HXX +#define SW_UNDO_OVERWRITE_HXX + +#include <undobj.hxx> + +#include <com/sun/star/uno/Sequence.h> + + +class SwRedlineSaveDatas; +class SwTxtNode; + +namespace utl { + class TransliterationWrapper; +} + + +class SwUndoOverwrite: public SwUndo, private SwUndoSaveCntnt +{ + String aDelStr, aInsStr; + SwRedlineSaveDatas* pRedlSaveData; + sal_uLong nSttNode; + xub_StrLen nSttCntnt; + sal_Bool bInsChar : 1; // no Overwrite, but Insert + sal_Bool bGroup : 1; // TRUE: is already grouped; evaluated in CanGrouping() + +public: + SwUndoOverwrite( SwDoc*, SwPosition&, sal_Unicode cIns ); + + virtual ~SwUndoOverwrite(); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + virtual void RepeatImpl( ::sw::RepeatContext & ); + + // #111827# + /** + Returns the rewriter of this undo object. + + The rewriter contains the following rule: + + $1 -> '<overwritten text>' + + <overwritten text> is shortened to nUndoStringLength characters. + + @return the rewriter of this undo object + */ + virtual SwRewriter GetRewriter() const; + + sal_Bool CanGrouping( SwDoc*, SwPosition&, sal_Unicode cIns ); +}; + +//-------------------------------------------------------------------- + +struct _UndoTransliterate_Data; +class SwUndoTransliterate : public SwUndo, public SwUndRng +{ + std::vector< _UndoTransliterate_Data * > aChanges; + sal_uInt32 nType; + + void DoTransliterate(SwDoc & rDoc, SwPaM & rPam); + +public: + SwUndoTransliterate( const SwPaM& rPam, + const utl::TransliterationWrapper& rTrans ); + + virtual ~SwUndoTransliterate(); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + virtual void RepeatImpl( ::sw::RepeatContext & ); + + void AddChanges( SwTxtNode& rTNd, xub_StrLen nStart, xub_StrLen nLen, + ::com::sun::star::uno::Sequence <sal_Int32>& rOffsets ); + sal_Bool HasData() const { return aChanges.size() > 0; } +}; + +#endif // SW_UNDO_OVERWRITE_HXX + diff --git a/sw/source/core/inc/UndoRedline.hxx b/sw/source/core/inc/UndoRedline.hxx new file mode 100644 index 000000000000..57b0df0867b9 --- /dev/null +++ b/sw/source/core/inc/UndoRedline.hxx @@ -0,0 +1,145 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SW_UNDO_REDLINE_HXX +#define SW_UNDO_REDLINE_HXX + +#include <undobj.hxx> + + +struct SwSortOptions; +class SwRedline; +class SwRedlineSaveDatas; +class SwUndoDelete; + + +//-------------------------------------------------------------------- + +class SwUndoRedline : public SwUndo, public SwUndRng +{ +protected: + SwRedlineData* pRedlData; + SwRedlineSaveDatas* pRedlSaveData; + SwUndoId nUserId; + sal_Bool bHiddenRedlines; + + virtual void UndoRedlineImpl(SwDoc & rDoc, SwPaM & rPam); + virtual void RedoRedlineImpl(SwDoc & rDoc, SwPaM & rPam); + +public: + SwUndoRedline( SwUndoId nUserId, const SwPaM& rRange ); + + virtual ~SwUndoRedline(); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + + SwUndoId GetUserId() const { return nUserId; } + sal_uInt16 GetRedlSaveCount() const; +}; + +class SwUndoRedlineDelete : public SwUndoRedline +{ + sal_Bool bCanGroup : 1; + sal_Bool bIsDelim : 1; + sal_Bool bIsBackspace : 1; + + virtual void UndoRedlineImpl(SwDoc & rDoc, SwPaM & rPam); + virtual void RedoRedlineImpl(SwDoc & rDoc, SwPaM & rPam); + +public: + SwUndoRedlineDelete( const SwPaM& rRange, SwUndoId nUserId = UNDO_EMPTY ); + + sal_Bool CanGrouping( const SwUndoRedlineDelete& rPrev ); + + // SwUndoTblCpyTbl needs this information: + long NodeDiff() const { return nSttNode - nEndNode; } + xub_StrLen ContentStart() const { return nSttCntnt; } +}; + +class SwUndoRedlineSort : public SwUndoRedline +{ + SwSortOptions* pOpt; + sal_uLong nSaveEndNode, nOffset; + xub_StrLen nSaveEndCntnt; + + virtual void UndoRedlineImpl(SwDoc & rDoc, SwPaM & rPam); + virtual void RedoRedlineImpl(SwDoc & rDoc, SwPaM & rPam); + +public: + SwUndoRedlineSort( const SwPaM& rRange, const SwSortOptions& rOpt ); + + virtual ~SwUndoRedlineSort(); + + virtual void RepeatImpl( ::sw::RepeatContext & ); + + void SetSaveRange( const SwPaM& rRange ); + void SetOffset( const SwNodeIndex& rIdx ); +}; + +class SwUndoAcceptRedline : public SwUndoRedline +{ +private: + virtual void RedoRedlineImpl(SwDoc & rDoc, SwPaM & rPam); + +public: + SwUndoAcceptRedline( const SwPaM& rRange ); + + virtual void RepeatImpl( ::sw::RepeatContext & ); +}; + +class SwUndoRejectRedline : public SwUndoRedline +{ +private: + virtual void RedoRedlineImpl(SwDoc & rDoc, SwPaM & rPam); + +public: + SwUndoRejectRedline( const SwPaM& rRange ); + + virtual void RepeatImpl( ::sw::RepeatContext & ); +}; + +//-------------------------------------------------------------------- + +class SwUndoCompDoc : public SwUndo, public SwUndRng +{ + SwRedlineData* pRedlData; + SwUndoDelete* pUnDel, *pUnDel2; + SwRedlineSaveDatas* pRedlSaveData; + sal_Bool bInsert; +public: + SwUndoCompDoc( const SwPaM& rRg, sal_Bool bIns ); + SwUndoCompDoc( const SwRedline& rRedl ); + + virtual ~SwUndoCompDoc(); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); +}; + +#endif // SW_UNDO_REDLINE_HXX + diff --git a/sw/source/core/inc/UndoSection.hxx b/sw/source/core/inc/UndoSection.hxx new file mode 100644 index 000000000000..bc6c8dd9fbfc --- /dev/null +++ b/sw/source/core/inc/UndoSection.hxx @@ -0,0 +1,82 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SW_UNDO_SECTION_HXX +#define SW_UNDO_SECTION_HXX + +#include <undobj.hxx> + +#include <memory> + +#include <swdllapi.h> + + +class SfxItemSet; +class SwTxtNode; +class SwSectionData; +class SwSectionFmt; +class SwTOXBase; + + +//------------ Undo of Insert-/Delete-Section ---------------------- + +class SwUndoInsSection : public SwUndo, private SwUndRng +{ +private: + const ::std::auto_ptr<SwSectionData> m_pSectionData; + const ::std::auto_ptr<SwTOXBase> m_pTOXBase; /// set iff section is TOX + const ::std::auto_ptr<SfxItemSet> m_pAttrSet; + ::std::auto_ptr<SwHistory> m_pHistory; + ::std::auto_ptr<SwRedlineData> m_pRedlData; + sal_uLong m_nSectionNodePos; + bool m_bSplitAtStart : 1; + bool m_bSplitAtEnd : 1; + bool m_bUpdateFtn : 1; + + void Join( SwDoc& rDoc, sal_uLong nNode ); + +public: + SwUndoInsSection(SwPaM const&, SwSectionData const&, + SfxItemSet const*const pSet, SwTOXBase const*const pTOXBase); + + virtual ~SwUndoInsSection(); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + virtual void RepeatImpl( ::sw::RepeatContext & ); + + void SetSectNdPos(sal_uLong const nPos) { m_nSectionNodePos = nPos; } + void SaveSplitNode(SwTxtNode *const pTxtNd, bool const bAtStart); + void SetUpdtFtnFlag(bool const bFlag) { m_bUpdateFtn = bFlag; } +}; + +SW_DLLPRIVATE SwUndo * MakeUndoDelSection(SwSectionFmt const&); + +SW_DLLPRIVATE SwUndo * MakeUndoUpdateSection(SwSectionFmt const&, bool const); + +#endif // SW_UNDO_SECTION_HXX + diff --git a/sw/source/core/inc/UndoSort.hxx b/sw/source/core/inc/UndoSort.hxx new file mode 100644 index 000000000000..b1cab7246aad --- /dev/null +++ b/sw/source/core/inc/UndoSort.hxx @@ -0,0 +1,97 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SW_UNDO_SORT_HXX +#define SW_UNDO_SORT_HXX + +#include <undobj.hxx> + + +struct SwSortOptions; +class SwTableNode; +class SwUndoAttrTbl; + + +/*-------------------------------------------------------------------- + Undo for Sorting + --------------------------------------------------------------------*/ + +struct SwSortUndoElement +{ + union { + struct { + sal_uLong nKenn; + sal_uLong nSource, nTarget; + } TXT; + struct { + String *pSource, *pTarget; + } TBL; + } SORT_TXT_TBL; + + SwSortUndoElement( const String& aS, const String& aT ) + { + SORT_TXT_TBL.TBL.pSource = new String( aS ); + SORT_TXT_TBL.TBL.pTarget = new String( aT ); + } + SwSortUndoElement( sal_uLong nS, sal_uLong nT ) + { + SORT_TXT_TBL.TXT.nSource = nS; + SORT_TXT_TBL.TXT.nTarget = nT; + SORT_TXT_TBL.TXT.nKenn = 0xffffffff; + } + ~SwSortUndoElement(); +}; + +SV_DECL_PTRARR_DEL(SwSortList, SwSortUndoElement*, 10,30) +SV_DECL_PTRARR(SwUndoSortList, SwNodeIndex*, 10,30) + +class SwUndoSort : public SwUndo, private SwUndRng +{ + SwSortOptions* pSortOpt; + SwSortList aSortList; + SwUndoAttrTbl* pUndoTblAttr; + SwRedlineData* pRedlData; + sal_uLong nTblNd; + +public: + SwUndoSort( const SwPaM&, const SwSortOptions& ); + SwUndoSort( sal_uLong nStt, sal_uLong nEnd, const SwTableNode&, + const SwSortOptions&, sal_Bool bSaveTable ); + + virtual ~SwUndoSort(); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + virtual void RepeatImpl( ::sw::RepeatContext & ); + + void Insert( const String& rOrgPos, const String& rNewPos ); + void Insert( sal_uLong nOrgPos, sal_uLong nNewPos ); + +}; + +#endif // SW_UNDO_SORT_HXX + diff --git a/sw/source/core/inc/UndoSplitMove.hxx b/sw/source/core/inc/UndoSplitMove.hxx new file mode 100644 index 000000000000..f58e71517f78 --- /dev/null +++ b/sw/source/core/inc/UndoSplitMove.hxx @@ -0,0 +1,96 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SW_UNDO_MOVE_HXX +#define SW_UNDO_MOVE_HXX + +#include <undobj.hxx> + + +class SwUndoSplitNode: public SwUndo +{ + SwHistory* pHistory; + SwRedlineData* pRedlData; + sal_uLong nNode; + xub_StrLen nCntnt; + sal_Bool bTblFlag : 1; + sal_Bool bChkTblStt : 1; + +public: + SwUndoSplitNode( SwDoc* pDoc, const SwPosition& rPos, sal_Bool bChkTbl ); + + virtual ~SwUndoSplitNode(); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + virtual void RepeatImpl( ::sw::RepeatContext & ); + + void SetTblFlag() { bTblFlag = sal_True; } +}; + + +class SwUndoMove : public SwUndo, private SwUndRng, private SwUndoSaveCntnt +{ + // nDest.. - destination range of move (after move!) + // nIns.. - source Position of move (after move!) + // nMv.. - destination position of move (before move!); for REDO + sal_uLong nDestSttNode, nDestEndNode, nInsPosNode, nMvDestNode; + xub_StrLen nDestSttCntnt, nDestEndCntnt, nInsPosCntnt, nMvDestCntnt; + + sal_uInt16 nFtnStt; // StartPos of Footnotes in History + + sal_Bool bJoinNext : 1, + bJoinPrev : 1, + bMoveRange : 1; + + bool bMoveRedlines; // use DOC_MOVEREDLINES when calling SwDoc::Move + + void DelFtn( const SwPaM& ); + +public: + SwUndoMove( const SwPaM&, const SwPosition& ); + SwUndoMove( SwDoc* pDoc, const SwNodeRange&, const SwNodeIndex& ); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + + /// set the destination range after the move + void SetDestRange( const SwPaM&, const SwPosition&, sal_Bool, sal_Bool ); + void SetDestRange( const SwNodeIndex& rStt, const SwNodeIndex& rEnd, + const SwNodeIndex& rInsPos ); + + sal_Bool IsMoveRange() const { return bMoveRange; } + sal_uLong GetEndNode() const { return nEndNode; } + sal_uLong GetDestSttNode() const { return nDestSttNode; } + xub_StrLen GetDestSttCntnt() const { return nDestSttCntnt; } + + void SetMoveRedlines( bool b ) { bMoveRedlines = b; } + +}; + +#endif // SW_UNDO_MOVE_HXX + diff --git a/sw/source/core/inc/UndoTable.hxx b/sw/source/core/inc/UndoTable.hxx new file mode 100644 index 000000000000..40032e9dfa86 --- /dev/null +++ b/sw/source/core/inc/UndoTable.hxx @@ -0,0 +1,391 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SW_UNDO_TABLE_HXX +#define SW_UNDO_TABLE_HXX + +#include <undobj.hxx> + +#ifndef _SVSTDARR_HXX +#define _SVSTDARR_USHORTS +#define _SVSTDARR_ULONGS +#define _SVSTDARR_BOOLS +#define _SVSTDARR_BYTES +#define _SVSTDARR_USHORTSSORT +#include <svl/svstdarr.hxx> +#endif + +#include <swtypes.hxx> +#include <itabenum.hxx> + + +class SfxItemSet; + +struct SwSaveRowSpan; +class _SaveTable; +class SwDDEFieldType; +class SwUndoSaveSections; +class SwUndoMoves; +class SwUndoDelete; +class SwSelBoxes; +class SwTblToTxtSaves; +class SwTable; +class SwTableBox; +class SwStartNode; +class SwTableNode; +class SwTableAutoFmt; +class SwTableSortBoxes; + + +class SwUndoInsTbl : public SwUndo +{ + String sTblNm; + SwInsertTableOptions aInsTblOpts; + SwDDEFieldType* pDDEFldType; + SvUShorts* pColWidth; + SwRedlineData* pRedlData; + SwTableAutoFmt* pAutoFmt; + sal_uLong nSttNode; + sal_uInt16 nRows, nCols; + sal_uInt16 nAdjust; + +public: + SwUndoInsTbl( const SwPosition&, sal_uInt16 nCols, sal_uInt16 nRows, + sal_uInt16 eAdjust, const SwInsertTableOptions& rInsTblOpts, + const SwTableAutoFmt* pTAFmt, const SvUShorts* pColArr, + const String & rName); + + virtual ~SwUndoInsTbl(); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + virtual void RepeatImpl( ::sw::RepeatContext & ); + + virtual SwRewriter GetRewriter() const; + +}; + +class SwUndoTxtToTbl : public SwUndo, public SwUndRng +{ + String sTblNm; + SwInsertTableOptions aInsTblOpts; + SvULongs* pDelBoxes; + SwTableAutoFmt* pAutoFmt; + SwHistory* pHistory; + sal_Unicode cTrenner; + sal_uInt16 nAdjust; + sal_Bool bSplitEnd : 1; + +public: + SwUndoTxtToTbl( const SwPaM&, const SwInsertTableOptions&, sal_Unicode, + sal_uInt16, + const SwTableAutoFmt* pAFmt ); + + virtual ~SwUndoTxtToTbl(); + + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + virtual void RepeatImpl( ::sw::RepeatContext & ); + + SwHistory& GetHistory(); // will be created if necessary + void AddFillBox( const SwTableBox& rBox ); +}; + +class SwUndoTblToTxt : public SwUndo +{ + String sTblNm; + SwDDEFieldType* pDDEFldType; + _SaveTable* pTblSave; + SwTblToTxtSaves* pBoxSaves; + SwHistory* pHistory; + sal_uLong nSttNd, nEndNd; + sal_uInt16 nAdjust; + sal_Unicode cTrenner; + sal_uInt16 nHdlnRpt; + sal_Bool bCheckNumFmt : 1; + +public: + SwUndoTblToTxt( const SwTable& rTbl, sal_Unicode cCh ); + + virtual ~SwUndoTblToTxt(); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + virtual void RepeatImpl( ::sw::RepeatContext & ); + + void SetRange( const SwNodeRange& ); + void AddBoxPos( SwDoc& rDoc, sal_uLong nNdIdx, sal_uLong nEndIdx, + xub_StrLen nCntntIdx = STRING_MAXLEN); +}; + +class SwUndoAttrTbl : public SwUndo +{ + sal_uLong nSttNode; + _SaveTable* pSaveTbl; + sal_Bool bClearTabCol : 1; +public: + SwUndoAttrTbl( const SwTableNode& rTblNd, sal_Bool bClearTabCols = sal_False ); + + virtual ~SwUndoAttrTbl(); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); +}; + +class SwUndoTblNumFmt; + +class SwUndoTblAutoFmt : public SwUndo +{ + sal_uLong nSttNode; + _SaveTable* pSaveTbl; + ::std::vector< ::boost::shared_ptr<SwUndoTblNumFmt> > m_Undos; + sal_Bool bSaveCntntAttr; + + void UndoRedo(bool const bUndo, ::sw::UndoRedoContext & rContext); + +public: + SwUndoTblAutoFmt( const SwTableNode& rTblNd, const SwTableAutoFmt& ); + + virtual ~SwUndoTblAutoFmt(); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + + void SaveBoxCntnt( const SwTableBox& rBox ); +}; + +class SwUndoTblNdsChg : public SwUndo +{ + _SaveTable* pSaveTbl; + SvULongs aBoxes; + + union { + SvULongs* pNewSttNds; + SwUndoSaveSections* pDelSects; + } Ptrs; + SvBools aMvBoxes; // for SplitRow (split Nodes of Box) + long nMin, nMax; // for redo of delete column + sal_uLong nSttNode, nCurrBox; + sal_uInt16 nCount, nRelDiff, nAbsDiff, nSetColType; + sal_Bool bFlag; + sal_Bool bSameHeight; // only used for SplitRow +public: + SwUndoTblNdsChg( SwUndoId UndoId, + const SwSelBoxes& rBoxes, + const SwTableNode& rTblNd, + long nMn, long nMx, + sal_uInt16 nCnt, sal_Bool bFlg, sal_Bool bSameHeight ); + + // for SetColWidth + SwUndoTblNdsChg( SwUndoId UndoId, const SwSelBoxes& rBoxes, + const SwTableNode& rTblNd ); + + virtual ~SwUndoTblNdsChg(); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + + void SaveNewBoxes( const SwTableNode& rTblNd, const SwTableSortBoxes& rOld ); + void SaveNewBoxes( const SwTableNode& rTblNd, const SwTableSortBoxes& rOld, + const SwSelBoxes& rBoxes, const SvULongs& rNodeCnts ); + void SaveSection( SwStartNode* pSttNd ); + void ReNewBoxes( const SwSelBoxes& rBoxes ); + + + void SetColWidthParam( sal_uLong nBoxIdx, sal_uInt16 nMode, sal_uInt16 nType, + SwTwips nAbsDif, SwTwips nRelDif ) + { + nCurrBox = nBoxIdx; + nCount = nMode; + nSetColType = nType; + nAbsDiff = (sal_uInt16)nAbsDif; + nRelDiff = (sal_uInt16)nRelDif; + } + +}; + +class SwUndoTblMerge : public SwUndo, private SwUndRng +{ + sal_uLong nTblNode; + _SaveTable* pSaveTbl; + SvULongs aBoxes, aNewSttNds; + SwUndoMoves* pMoves; + SwHistory* pHistory; + +public: + SwUndoTblMerge( const SwPaM& rTblSel ); + + virtual ~SwUndoTblMerge(); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + + void MoveBoxCntnt( SwDoc* pDoc, SwNodeRange& rRg, SwNodeIndex& rPos ); + + void SetSelBoxes( const SwSelBoxes& rBoxes ); + + void AddNewBox( sal_uLong nSttNdIdx ) + { aNewSttNds.Insert( nSttNdIdx, aNewSttNds.Count() ); } + + void SaveCollection( const SwTableBox& rBox ); + +}; + + +class SwUndoTblNumFmt : public SwUndo +{ + SfxItemSet *pBoxSet; + SwHistory* pHistory; + String aStr, aNewFml; + + sal_uLong nFmtIdx, nNewFmtIdx; + double fNum, fNewNum; + sal_uLong nNode; + sal_uLong nNdPos; + + sal_Bool bNewFmt : 1; + sal_Bool bNewFml : 1; + sal_Bool bNewValue : 1; + +public: + SwUndoTblNumFmt( const SwTableBox& rBox, const SfxItemSet* pNewSet = 0 ); + + virtual ~SwUndoTblNumFmt(); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + + void SetNumFmt( sal_uLong nNewNumFmtIdx, const double& rNewNumber ) + { nFmtIdx = nNewNumFmtIdx; fNum = rNewNumber; } + void SetBox( const SwTableBox& rBox ); +}; + +class _UndoTblCpyTbl_Entries; + +class SwUndoTblCpyTbl : public SwUndo +{ + _UndoTblCpyTbl_Entries* pArr; + SwUndoTblNdsChg* pInsRowUndo; + + //b6341295: When redlining is active, PrepareRedline has to create the + //redlining attributes for the new and the old table cell content + SwUndo* PrepareRedline( SwDoc* pDoc, const SwTableBox& rBox, + const SwPosition& rPos, bool& rJoin, bool bRedo ); +public: + SwUndoTblCpyTbl(); + + virtual ~SwUndoTblCpyTbl(); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + + void AddBoxBefore( const SwTableBox& rBox, sal_Bool bDelCntnt ); + void AddBoxAfter( const SwTableBox& rBox, const SwNodeIndex& rIdx, + sal_Bool bDelCntnt ); + + sal_Bool IsEmpty() const; + sal_Bool InsertRow( SwTable& rTbl, const SwSelBoxes& rBoxes, sal_uInt16 nCnt ); +}; + +class SwUndoCpyTbl : public SwUndo +{ + SwUndoDelete* pDel; + sal_uLong nTblNode; +public: + SwUndoCpyTbl(); + + virtual ~SwUndoCpyTbl(); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + + void SetTableSttIdx( sal_uLong nIdx ) { nTblNode = nIdx; } +}; + +class SwUndoSplitTbl : public SwUndo +{ + sal_uLong nTblNode, nOffset; + SwSaveRowSpan* mpSaveRowSpan; // stores row span values at the splitting row + _SaveTable* pSavTbl; + SwHistory* pHistory; + sal_uInt16 nMode, nFmlEnd; + sal_Bool bCalcNewSize; +public: + SwUndoSplitTbl( const SwTableNode& rTblNd, SwSaveRowSpan* pRowSp, + sal_uInt16 nMode, sal_Bool bCalcNewSize ); + + virtual ~SwUndoSplitTbl(); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + virtual void RepeatImpl( ::sw::RepeatContext & ); + + void SetTblNodeOffset( sal_uLong nIdx ) { nOffset = nIdx - nTblNode; } + SwHistory* GetHistory() { return pHistory; } + void SaveFormula( SwHistory& rHistory ); +}; + +class SwUndoMergeTbl : public SwUndo +{ + String aName; + sal_uLong nTblNode; + _SaveTable* pSavTbl, *pSavHdl; + SwHistory* pHistory; + sal_uInt16 nMode; + sal_Bool bWithPrev; +public: + SwUndoMergeTbl( const SwTableNode& rTblNd, const SwTableNode& rDelTblNd, + sal_Bool bWithPrev, sal_uInt16 nMode ); + + virtual ~SwUndoMergeTbl(); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + virtual void RepeatImpl( ::sw::RepeatContext & ); + + void SaveFormula( SwHistory& rHistory ); +}; + + +//-------------------------------------------------------------------- + +class SwUndoTblHeadline : public SwUndo +{ + sal_uLong nTblNd; + sal_uInt16 nOldHeadline; + sal_uInt16 nNewHeadline; +public: + SwUndoTblHeadline( const SwTable&, sal_uInt16 nOldHdl, sal_uInt16 nNewHdl ); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + virtual void RepeatImpl( ::sw::RepeatContext & ); +}; + +#endif // SW_UNDO_TABLE_HXX + diff --git a/sw/source/core/inc/acorrect.hxx b/sw/source/core/inc/acorrect.hxx new file mode 100755 index 000000000000..d90b57b13b50 --- /dev/null +++ b/sw/source/core/inc/acorrect.hxx @@ -0,0 +1,123 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _ACORRECT_HXX +#define _ACORRECT_HXX + +#include <editeng/svxacorr.hxx> + +#include <swundo.hxx> + + +class SwEditShell; +class SwPaM; +class SwNodeIndex; +struct SwPosition; +class SfxItemSet; + +class SwDontExpandItem +{ + SfxItemSet* pDontExpItems; +public: + SwDontExpandItem() : + pDontExpItems(0){} + ~SwDontExpandItem(); + + void SaveDontExpandItems( const SwPosition& rPos ); + void RestoreDontExpandItems( const SwPosition& rPos ); + +}; + +class SwAutoCorrDoc : public SvxAutoCorrDoc +{ + SwEditShell& rEditSh; + SwPaM& rCrsr; + SwNodeIndex* pIdx; + int m_nEndUndoCounter; + bool bUndoIdInitialized; + + void DeleteSel( SwPaM& rDelPam ); + +public: + SwAutoCorrDoc( SwEditShell& rEditShell, SwPaM& rPam, sal_Unicode cIns = 0 ); + ~SwAutoCorrDoc(); + + virtual sal_Bool Delete( xub_StrLen nStt, xub_StrLen nEnd ); + virtual sal_Bool Insert( xub_StrLen nPos, const String& rTxt ); + virtual sal_Bool Replace( xub_StrLen nPos, const String& rTxt ); + virtual sal_Bool ReplaceRange( xub_StrLen nPos, xub_StrLen nLen, const String& rTxt ); + + virtual sal_Bool SetAttr( xub_StrLen nStt, xub_StrLen nEnd, sal_uInt16 nSlotId, + SfxPoolItem& ); + + virtual sal_Bool SetINetAttr( xub_StrLen nStt, xub_StrLen nEnd, const String& rURL ); + + // returne den Text eines vorherigen Absatzes. + // Dieser darf nicht leer sein! + // Gibt es diesen nicht oder gibt es davor nur Leere, dann returne 0 + // Das Flag gibt an: + // sal_True: den, vor der normalen Einfuegeposition (sal_True) + // sal_False: den, in den das korrigierte Wort eingfuegt wurde. + // (Muss nicht der gleiche Absatz sein!!!!) + virtual const String* GetPrevPara( sal_Bool bAtNormalPos ); + + virtual sal_Bool ChgAutoCorrWord( xub_StrLen& rSttPos, xub_StrLen nEndPos, + SvxAutoCorrect& rACorrect, + const String** ppPara ); + + // wird nach dem austauschen der Zeichen von den Funktionen + // - FnCptlSttWrd + // - FnCptlSttSntnc + // gerufen. Dann koennen die Worte ggfs. in die Ausnahmelisten + // aufgenommen werden. + virtual void SaveCpltSttWord( sal_uLong nFlag, xub_StrLen nPos, + const String& rExceptWord, sal_Unicode cChar ); + virtual LanguageType GetLanguage( xub_StrLen nPos, sal_Bool bPrevPara ) const; +}; + +class SwAutoCorrExceptWord +{ + String sWord; + sal_uLong nFlags, nNode; + xub_StrLen nCntnt; + sal_Unicode cChar; + LanguageType eLanguage; + sal_Bool bDeleted; +public: + SwAutoCorrExceptWord( sal_uLong nAFlags, sal_uLong nNd, xub_StrLen nContent, + const String& rWord, sal_Unicode cChr, + LanguageType eLang ) + : sWord(rWord), nFlags(nAFlags), nNode(nNd), nCntnt(nContent), + cChar(cChr), eLanguage(eLang), bDeleted(sal_False) + {} + + sal_Bool IsDeleted() const { return bDeleted; } + void CheckChar( const SwPosition& rPos, sal_Unicode cChar ); + sal_Bool CheckDelChar( const SwPosition& rPos ); +}; + + +#endif diff --git a/sw/source/core/inc/anchoredobjectposition.hxx b/sw/source/core/inc/anchoredobjectposition.hxx new file mode 100644 index 000000000000..178a07c7bec7 --- /dev/null +++ b/sw/source/core/inc/anchoredobjectposition.hxx @@ -0,0 +1,496 @@ + /************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _ANCHOREDOBJECTPOSITION_HXX +#define _ANCHOREDOBJECTPOSITION_HXX + +#include <swtypes.hxx> +// OD 2004-03-16 #i11860# +#include <frame.hxx> + +class SdrObject; +class SwFrm; +class SwFlyFrm; +class SwContact; +class SwFrmFmt; +class SwRect; +class SvxLRSpaceItem; +class SvxULSpaceItem; +class SwFmtHoriOrient; +// OD 2004-03-23 #i26701# +class SwAnchoredObject; + +namespace objectpositioning +{ + class SwEnvironmentOfAnchoredObject; + + class SwAnchoredObjectPosition + { + private: + // object to be positioned + SdrObject& mrDrawObj; + + // information about object + // does the object represents a Writer fly frame + bool mbIsObjFly; + // OD 2004-03-23 #i26791# - anchored object the object belongs to; + SwAnchoredObject* mpAnchoredObj; + // frame the object is anchored at + SwFrm* mpAnchorFrm; + // contact object + SwContact* mpContact; + // frame format + const SwFrmFmt* mpFrmFmt; + // --> OD 2006-03-15 #i62875# + bool mbFollowTextFlow; + // <-- + // --> OD 2006-03-15 #i62875# + // for compatibility option <DoNotCaptureDrawObjsOnPage> + bool mbDoNotCaptureAnchoredObj; + // <-- + + /** determine information about object + + OD 30.07.2003 #110978# + member <mbIsObjFly>, <mpAnchoredObj>, <mpAnchorFrm>, <mpContact> + and <mpFrmFmt> are set + + @author OD + */ + void _GetInfoAboutObj(); + + // --> OD 2006-03-15 #i62875# + // --> OD 2009-09-01 #mongolianlayout# - add parameter <bVertL2R> + SwTwips _ImplAdjustVertRelPos( const SwTwips nTopOfAnch, + const bool bVert, + const bool bVertL2R, + const SwFrm& rPageAlignLayFrm, + const SwTwips nProposedRelPosY, + const bool bFollowTextFlow, + const bool bCheckBottom = true ) const; + SwTwips _ImplAdjustHoriRelPos( const SwFrm& _rPageAlignLayFrm, + const SwTwips _nProposedRelPosX ) const; + // <-- + + protected: + SwAnchoredObjectPosition( SdrObject& _rDrawObj ); + virtual ~SwAnchoredObjectPosition(); + + // accessors for object and its corresponding data/information + inline SdrObject& GetObject() const + { + return mrDrawObj; + } + inline bool IsObjFly() const + { + return mbIsObjFly; + } + inline SwAnchoredObject& GetAnchoredObj() const + { + return *mpAnchoredObj; + } + inline SwFrm& GetAnchorFrm() const + { + return *mpAnchorFrm; + } + inline SwContact& GetContact() const + { + return *mpContact; + } + inline const SwFrmFmt& GetFrmFmt() const + { + return *mpFrmFmt; + } + // --> OD 2006-03-15 #i62875# + inline bool DoesObjFollowsTextFlow() const + { + return mbFollowTextFlow; + } + // <-- + + // virtual methods providing data for to character anchored objects. + virtual bool IsAnchoredToChar() const; + virtual const SwFrm* ToCharOrientFrm() const; + virtual const SwRect* ToCharRect() const; + // OD 12.11.2003 #i22341# + virtual SwTwips ToCharTopOfLine() const; + + // ********************************************************************* + /** helper method to determine top of a frame for the vertical + object positioning + + OD 2004-03-11 #i11860# + + @author OD + */ + SwTwips _GetTopForObjPos( const SwFrm& _rFrm, + const SwRectFn& _fnRect, + const bool _bVert ) const; + + // ********************************************************************* + void _GetVertAlignmentValues( const SwFrm& _rVertOrientFrm, + const SwFrm& _rPageAlignLayFrm, + const sal_Int16 _eRelOrient, + SwTwips& _orAlignAreaHeight, + SwTwips& _orAlignAreaOffset ) const; + + // ********************************************************************* + // --> OD 2004-06-17 #i26791# - add output parameter <_roVertOffsetToFrmAnchorPos> + SwTwips _GetVertRelPos( const SwFrm& _rVertOrientFrm, + const SwFrm& _rPageAlignLayFrm, + const sal_Int16 _eVertOrient, + const sal_Int16 _eRelOrient, + const SwTwips _nVertPos, + const SvxLRSpaceItem& _rLRSpacing, + const SvxULSpaceItem& _rULSpacing, + SwTwips& _roVertOffsetToFrmAnchorPos ) const; + + // ********************************************************************* + /** adjust calculated vertical in order to keep object inside + 'page' alignment layout frame. + + OD 2004-07-22 #i31805# - add parameter <bCheckBottom> + OD 2004-10-08 #i26945# - add parameter <bFollowTextFlow> + OD 2006-03-15 #i62875# - made inline, intrinsic actions moved + to private method <_ImplAdjustVertRelPos>, which is only + called, if <mbDoNotCaptureAnchoredObj> not set. + OD 2009-09-01 #mongolianlayout# - add parameter <bVertL2R> + + @param nTopOfAnch + input parameter - 'vertical' position, at which the relative + position of the object is calculated from. + + @param bVert + input parameter - boolean, indicating, if object is in vertical + layout. + + @param bVertL2R + input parameter - boolean, indicating, if object is in mongolian + layout (vertical left-to-right layout). + + @param rPageAlignLayFrm + input parameter - layout frame, which determines the 'page area' + the object has to be vertical positioned in. + + @param nProposedRelPosY + input parameter - proposed relative vertical position, which + will be adjusted. + + @param bFollowTextFlow + input parameter - value of attribute 'Follow text flow' of the + anchored object. + + @param bCheckBottom + input parameter - boolean indicating, if bottom of anchored + object has to be checked and thus, (if needed) the proposed + relative position has to be adjusted. default value <true> + + @author OD + */ + inline SwTwips _AdjustVertRelPos( const SwTwips nTopOfAnch, + const bool bVert, + const bool bVertL2R, + const SwFrm& rPageAlignLayFrm, + const SwTwips nProposedRelPosY, + const bool bFollowTextFlow, + const bool bCheckBottom = true ) const + { + return !mbDoNotCaptureAnchoredObj + ? _ImplAdjustVertRelPos( nTopOfAnch, bVert, bVertL2R, + rPageAlignLayFrm, + nProposedRelPosY, + bFollowTextFlow, + bCheckBottom ) + : nProposedRelPosY; + } + + // ********************************************************************* + /** calculate relative horizontal position + + --> OD 2004-06-17 #i26791# - add output parameter + <_roHoriOffsetToFrmAnchorPos> + + @author OD + + @param _rHoriOrientFrm + input parameter - frame the horizontal position of the object + is oriented at. + + @param _rEnvOfObj + input parameter - object instance to retrieve environment + information about the object + + @param _rHoriOrient + input parameter - horizontal positioning and alignment, for which + the relative position is calculated. + + @param _rLRSpacing + input parameter - left and right spacing of the object to the text + + @param _rULSpacing + input parameter - upper and lower spacing of the object to the text + + @param _bObjWrapThrough + input parameter - boolean indicating, if object has wrap mode + 'wrap through'. + + @param _nRelPosY + input parameter - relative vertical position + + @param _roHoriOffsetToFrmAnchorPos + output parameter - 'horizontal' offset to frame anchor position + according to the alignment + + @return relative horizontal position in SwTwips + */ + SwTwips _CalcRelPosX( const SwFrm& _rHoriOrientFrm, + const SwEnvironmentOfAnchoredObject& _rEnvOfObj, + const SwFmtHoriOrient& _rHoriOrient, + const SvxLRSpaceItem& _rLRSpacing, + const SvxULSpaceItem& _rULSpacing, + const bool _bObjWrapThrough, + const SwTwips _nRelPosY, + SwTwips& _roHoriOffsetToFrmAnchorPos + ) const; + + // ********************************************************************* + /** adjust calculated horizontal in order to keep object inside + 'page' alignment layout frame for object type position TO_CNTNT + + OD 2006-03-15 #i62875# - made inline, intrinsic actions moved + to private method <_ImplAdjustHoriRelPos>, which is only + called, if <mbDoNotCaptureAnchoredObj> not set. + + @author OD + + @param _rPageAlignLayFrm + input paramter - layout frame, which determines the 'page area' + the object has to be horizontal positioned in. + + @param _nProposedRelPosX + input parameter - proposed relative horizontal position, which + will be adjusted. + + @return adjusted relative horizontal position in SwTwips. + */ + inline SwTwips _AdjustHoriRelPos( const SwFrm& _rPageAlignLayFrm, + const SwTwips _nProposedRelPosX ) const + { + return !mbDoNotCaptureAnchoredObj + ? _ImplAdjustHoriRelPos( _rPageAlignLayFrm, _nProposedRelPosX ) + : _nProposedRelPosX; + } + + // ********************************************************************* + /** toggle given horizontal orientation and relative alignment + + @author OD + + @param _bToggleLeftRight + input parameter - boolean indicating, if horizontal orientation + and relative alignment has to be toggled. + + @param _ioeHoriOrient + input/output parameter - horizontal orientation, that is toggled, + if needed. + + @param _iopeRelOrient + optional input/output parameter (default value NULL) + - if set, relative alignment, that is toggled, if needed. + */ + void _ToggleHoriOrientAndAlign( const bool _bToggleLeftRight, + sal_Int16& _ioeHoriOrient, + sal_Int16& _iopeRelOrient + ) const; + + // ********************************************************************* + /** determine alignment values for horizontal position of object + + @author OD + + @param _rHoriOrientFrm + input parameter - frame the horizontal position of the object + is oriented at. + + @param _rPageAlignLayFrm + input paramter - layout frame, which determines the 'page area' + the object has to be horizontal positioned in. + + @param _eRelOrient + input parameter - horizontal relative alignment, for which + the relative position is calculated. + + @param _bToggleLeftRight + input parameter - boolean indicating, if left/right alignments + have to be toggled. + + @param _bObjWrapThrough + input parameter - boolean indicating, if object has wrap mode + 'wrap through'. + important note: value is only relevant, if _rHoriOrientFrm is + a text frame. + + @param _orAlignAreaWidth + output parameter - width in SwTwips of the area the horizontal + position is aligned to. + + @param _orAlignAreaOffset + output parameter - offset in SwTwips of the area the horizontal + position is aligned to. offset is given to the 'left' of the + anchor position. + + @param _obAlignedRelToPage + output parameter - boolean indicating, that object is aligned + to 'page area'. + */ + void _GetHoriAlignmentValues( const SwFrm& _rHoriOrientFrm, + const SwFrm& _rPageAlignLayFrm, + const sal_Int16 _eRelOrient, + const bool _bObjWrapThrough, + SwTwips& _orAlignAreaWidth, + SwTwips& _orAlignAreaOffset, + bool& _obAlignedRelToPage ) const; + + // ********************************************************************* + /** adjust calculated horizontal position in order to draw object + aside other objects with same positioning + + @author OD + + @param _rHoriOrientFrm + input parameter - frame the horizontal position of the object + is oriented at. + + @param _nProposedRelPosX + input parameter - proposed relative horizontal position, which + will be adjusted. + + @param _nRelPosY + input parameter - relative vertical position + + @param _eHoriOrient + input parameter - horizontal position of object + + @param _eRelOrient + inpt parameter - alignment of object + + @param _rLRSpacing + input parameter - left and right spacing of the object to the text + + @param _rULSpacing + input parameter - upper and lower spacing of the object to the text + + @param _bEvenPage + input parameter - boolean indicating, if object is on an even page. + + @return adjusted relative horizontal position in SwTwips + */ + SwTwips _AdjustHoriRelPosForDrawAside( const SwFrm& _rHoriOrientFrm, + const SwTwips _nProposedRelPosX, + const SwTwips _nRelPosY, + const sal_Int16 _eHoriOrient, + const sal_Int16 _eRelOrient, + const SvxLRSpaceItem& _rLRSpacing, + const SvxULSpaceItem& _rULSpacing, + const bool _bEvenPage + ) const; + + // ********************************************************************* + /** detemine, if object has to draw aside given fly frame + + method used by <_AdjustHoriRelPosForDrawAside(..)> + + @author OD + + @param _pFly + input parameter - fly frame the draw aside check is done for. + + @param _rObjRect + input parameter - proposed object rectangle + + @param _pObjContext + input parameter - context of the object + + @param _nObjIndex + input parameter - index of the anchor frame of the object + + @param _bEvenPage + input parameter - boolean indicating, if object is on an even page. + + @param _eHoriOrient + input parameter - horizontal position of object + + @param _eRelOrient + inpt parameter - alignment of object + + @return boolean indicating, if object has to be drawn aside + given fly frame. + */ + bool _DrawAsideFly( const SwFlyFrm* _pFly, + const SwRect& _rObjRect, + const SwFrm* _pObjContext, + const sal_uLong _nObjIndex, + const bool _bEvenPage, + const sal_Int16 _eHoriOrient, + const sal_Int16 _eRelOrient + ) const; + + // ********************************************************************* + /** determine, if object has to draw aside another object + + the different alignments of the objects determines, if one has + to draw aside another one. Thus, the given alignment are checked + against each other, which one has to be drawn aside the other one. + depending on parameter _bLeft check is done for left or right + positioning. + method used by <_DrawAsideFly(..)> + + @author OD + + @param _eRelOrient1 + input parameter - alignment 1 + + @param _eRelOrient2 + input parameter - alignment 2 + + @param _bLeft + input parameter - boolean indicating, if check is done for left + or for right positioning. + + @return boolean indicating, if an object with an alignment + <_eRelOrient1> has to be drawn aside an object with an + alignment <_eRelOrient2> + */ + bool _Minor( sal_Int16 _eRelOrient1, + sal_Int16 _eRelOrient2, + bool _bLeft ) const; + + public: + virtual void CalcPosition() = 0; + }; +} // namespace objectpositioning + +#endif diff --git a/sw/source/core/inc/ascharanchoredobjectposition.hxx b/sw/source/core/inc/ascharanchoredobjectposition.hxx new file mode 100644 index 000000000000..2f5e2d1bb164 --- /dev/null +++ b/sw/source/core/inc/ascharanchoredobjectposition.hxx @@ -0,0 +1,171 @@ + /************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _ASCHARANCHOREDOBJECTPOSITION_HXX +#define _ASCHARANCHOREDOBJECTPOSITION_HXX +#include <anchoredobjectposition.hxx> +#include <sal/types.h> +#include <swtypes.hxx> +#include <swrect.hxx> + +class SwTxtFrm; +class SwFmtVertOrient; + +namespace objectpositioning +{ + // flags for positioning algorithm of as-character-anchored objects + typedef sal_uInt8 AsCharFlags; + #define AS_CHAR_NOFLAG 0 + #define AS_CHAR_QUICK 1 + #define AS_CHAR_ULSPACE 2 + #define AS_CHAR_INIT 4 + #define AS_CHAR_ROTATE 8 + #define AS_CHAR_REVERSE 16 + #define AS_CHAR_BIDI 32 + + class SwAsCharAnchoredObjectPosition : public SwAnchoredObjectPosition + { + private: + // data to calculate object position + // proposed anchor position, starting point for the calculation + // of the object position + const Point& mrProposedAnchorPos; + // flags that influences the calculation of the anchor position + // AS_CHAR_QUICK : quick formatting - calculated position not set at object + // AS_CHAR_ULSPACE : consider upper/lower spacing - adjustment of anchor position + // AS_CHAR_INIT : initial calculation + // AS_CHAR_ROTATE : object is rotated by 90 degrees + // AS_CHAR_REVERSE : object is reversed (rotated by 270 degrees) + // AS_CHAR_BIDI : object belongs to a BIDI-multi-portion + const AsCharFlags mnFlags; + // needed line values for the different alignments. + const SwTwips mnLineAscent; + const SwTwips mnLineDescent; + const SwTwips mnLineAscentInclObjs; + const SwTwips mnLineDescentInclObjs; + + // calculated data for object position + Point maAnchorPos; + SwTwips mnRelPos; + SwRect maObjBoundRect; + // line alignment relative to line height; gives feedback for line formatting + // 0 - no line alignment, 1 - at top, 2 - at center, 3 - at bottom + sal_uInt8 mnLineAlignment; + + // method to cast <SwAnchoredObjectPosition::GetAnchorFrm()> + const SwTxtFrm& GetAnchorTxtFrm() const; + + /** determine the relative position to base line for object position + + @author OD + + @param _ObjBoundHeight + height including corresponding spacing of the object, for which + the Y-position has to be calculated. + + @param _rVert + given vertical positioning and alignment + + @return relative position to the base line + */ + SwTwips _GetRelPosToBase( const SwTwips _nObjBoundHeight, + const SwFmtVertOrient& _rVert ); + + // ********************************************************************* + public: + /** construtor; provided object to be positioned and needed data + for calculation of the object position + + OD 28.10.2003 #110978# + + @param _rDrawObj + input parameter - object, that is be positioned. + + @param _rProposedAnchorPos + proposed anchor position; starting point for the calculation + of the anchor position + + @param _nFlags + flags that influences the calculation of the anchor position + AS_CHAR_QUICK : quick formatting - calculated position not set at object + AS_CHAR_ULSPACE : consider upper/lower spacing - adjustment of anchor position + AS_CHAR_INIT : initial calculation + AS_CHAR_ROTATE : object is rotated by 90 degrees + AS_CHAR_REVERSE : object is reversed (rotated by 270 degrees) + AS_CHAR_BIDI : object belongs to a BIDI-multi-portion + + @param _nLineAscent, _nLineDescent, _nLineAscentInclObjs, + _nLineDescentInclObjs - needed line values for the different + alignments. + + @author OD + */ + SwAsCharAnchoredObjectPosition( SdrObject& _rDrawObj, + const Point& _rProposedAnchorPos, + const AsCharFlags _nFlags, + const SwTwips _nLineAscent, + const SwTwips _nLineDescent, + const SwTwips _nLineAscentInclObjs, + const SwTwips _nLineDescentInclObjs ); + virtual ~SwAsCharAnchoredObjectPosition(); + + /** calculate position for object position + + members <maAnchorPos>, <mnRelPos>, <maObjBoundRect> and + <mnLineAlignment> are calculated. + calculated position is set at the given object. + + @author OD + */ + virtual void CalcPosition(); + + /** calculated anchored position for object position type AS_CHAR + + @author OD + */ + Point GetAnchorPos() const; + + /** calculated relative position to base line for object position type AS_CHAR + + @author OD + */ + SwTwips GetRelPosY() const; + + /** determined object rectangle including spacing for object position type AS_CHAR + + @author OD + */ + SwRect GetObjBoundRectInclSpacing() const; + + /** determined line alignment relative to line height + + @author OD + */ + sal_uInt8 GetLineAlignment() const; + }; +} // namespace objectpositioning + +#endif diff --git a/sw/source/core/inc/attrhint.hxx b/sw/source/core/inc/attrhint.hxx new file mode 100644 index 000000000000..da2ed160b9c4 --- /dev/null +++ b/sw/source/core/inc/attrhint.hxx @@ -0,0 +1,44 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _ATTRHINT_HXX +#define _ATTRHINT_HXX + +#include <svl/hint.hxx> + +class SwAttrHint : public SfxHint +{ + sal_Int32 nId; +public: + SwAttrHint( sal_Int32 n ) + : nId(n) + {} + + sal_Int32 GetId() const { return nId; } +}; + +#endif diff --git a/sw/source/core/inc/blink.hxx b/sw/source/core/inc/blink.hxx new file mode 100644 index 000000000000..11f11d6d188a --- /dev/null +++ b/sw/source/core/inc/blink.hxx @@ -0,0 +1,89 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _BLINK_HXX +#define _BLINK_HXX + +class SwLinePortion; +class SwRootFrm; +class SwTxtFrm; + +#include <vcl/timer.hxx> +#include <tools/gen.hxx> + +#include <svl/svarray.hxx> + +class SwBlinkPortion +{ + Point aPos; + const SwLinePortion *pPor; + const SwRootFrm *pFrm; + sal_uInt16 nDir; +public: + SwBlinkPortion( const SwLinePortion* pPortion, sal_uInt16 nDirection ) + { pPor = pPortion; nDir = nDirection; } + SwBlinkPortion( const SwBlinkPortion* pBlink, const SwLinePortion* pPort ) + { pPor = pPort; pFrm = pBlink->pFrm; aPos = pBlink->aPos; nDir = pBlink->nDir; } + void SetPos( const Point& aNew ){ aPos = aNew; } + const Point& GetPos() const{ return aPos; } + void SetRootFrm( const SwRootFrm* pNew ){ pFrm = pNew; } + const SwRootFrm* GetRootFrm() const{ return pFrm; } + const SwLinePortion *GetPortion() const{ return pPor; } + sal_uInt16 GetDirection() const { return nDir; } + sal_Bool operator<( const SwBlinkPortion& rBlinkPortion ) const + { return (long)pPor < (long)rBlinkPortion.pPor; } + sal_Bool operator==( const SwBlinkPortion& rBlinkPortion ) const + { return (long)pPor == (long)rBlinkPortion.pPor; } +}; + +typedef SwBlinkPortion* SwBlinkPortionPtr; +SV_DECL_PTRARR_SORT_DEL(SwBlinkList, SwBlinkPortionPtr, 0, 10) + +class SwBlink +{ + SwBlinkList aList; + AutoTimer aTimer; + sal_Bool bVisible; +public: + SwBlink(); + ~SwBlink(); + + DECL_LINK( Blinker, Timer * ); + + void Insert( const Point& rPoint, const SwLinePortion* pPor, + const SwTxtFrm *pTxtFrm, sal_uInt16 nDir ); + void Replace( const SwLinePortion* pOld, const SwLinePortion* pNew ); + void Delete( const SwLinePortion* pPor ); + void FrmDelete( const SwRootFrm* pRoot ); + inline sal_Bool IsVisible() const { return bVisible ; } +}; + +// Blink-Manager, globale Variable, in Blink.Cxx angelegt +extern SwBlink *pBlink; + + +#endif + diff --git a/sw/source/core/inc/bodyfrm.hxx b/sw/source/core/inc/bodyfrm.hxx new file mode 100644 index 000000000000..1ab39ff1578c --- /dev/null +++ b/sw/source/core/inc/bodyfrm.hxx @@ -0,0 +1,49 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _BODYFRM_HXX +#define _BODYFRM_HXX + +#include <tools/mempool.hxx> +#include "layfrm.hxx" + +class SwBorderAttrs; + +class SwBodyFrm: public SwLayoutFrm +{ +protected: + virtual void Format( const SwBorderAttrs *pAttrs = 0 ); + +#if defined ( GCC) && defined ( C272 ) + ~SwBodyFrm(); +#endif +public: + SwBodyFrm( SwFrmFmt*, SwFrm* ); + + DECL_FIXEDMEMPOOL_NEWDEL(SwBodyFrm) +}; + +#endif //_BODYFRM_HXX diff --git a/sw/source/core/inc/bookmrk.hxx b/sw/source/core/inc/bookmrk.hxx new file mode 100644 index 000000000000..9b8a0d7c3876 --- /dev/null +++ b/sw/source/core/inc/bookmrk.hxx @@ -0,0 +1,260 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _BOOKMRK_HXX +#define _BOOKMRK_HXX + +#include <cppuhelper/weakref.hxx> + +#include <sfx2/Metadatable.hxx> + +#include <boost/scoped_ptr.hpp> +#include <boost/noncopyable.hpp> +#include <map> + +#include <IMark.hxx> + + +namespace com { namespace sun { namespace star { + namespace text { class XTextContent; } +} } } + +struct SwPosition; // fwd Decl. wg. UI +class SwDoc; + +namespace sw { namespace mark +{ + class MarkBase + : virtual public IMark + { + public: + //getters + virtual SwPosition& GetMarkPos() const + { return *m_pPos1; } + virtual const ::rtl::OUString& GetName() const + { return m_aName; } + virtual bool IsCoveringPosition(const SwPosition& rPos) const; + virtual SwPosition& GetOtherMarkPos() const + { + OSL_PRECOND(IsExpanded(), "<SwPosition::GetOtherMarkPos(..)> - I have no other Pos set." ); + return *m_pPos2; + } + virtual SwPosition& GetMarkStart() const + { + if( !IsExpanded() ) return GetMarkPos( ); + if ( GetMarkPos( ) < GetOtherMarkPos( ) ) + return GetMarkPos(); + else + return GetOtherMarkPos( ); + } + virtual SwPosition& GetMarkEnd() const + { + if( !IsExpanded() ) return GetMarkPos(); + if ( GetMarkPos( ) > GetOtherMarkPos( ) ) + return GetMarkPos( ); + else + return GetOtherMarkPos( ); + } + virtual bool IsExpanded() const + { return m_pPos2; } + + //setters + virtual void SetName(const ::rtl::OUString& rName) + { m_aName = rName; } + virtual void SetMarkPos(const SwPosition& rNewPos); + virtual void SetOtherMarkPos(const SwPosition& rNewPos); + virtual void ClearOtherMarkPos() + { m_pPos2.reset(); } + + virtual rtl::OUString ToString( ) const; + + virtual void Swap() + { + if(m_pPos2) + m_pPos1.swap(m_pPos2); + } + + virtual void InitDoc(SwDoc* const) + {} + + virtual ~MarkBase(); + + const ::com::sun::star::uno::WeakReference< + ::com::sun::star::text::XTextContent> & GetXBookmark() const + { return m_wXBookmark; } + void SetXBookmark(::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextContent> const& xBkmk) + { m_wXBookmark = xBkmk; } + + protected: + // SwClient + virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ); + + MarkBase(const SwPaM& rPaM, + const ::rtl::OUString& rName); + ::boost::scoped_ptr<SwPosition> m_pPos1; + ::boost::scoped_ptr<SwPosition> m_pPos2; + ::rtl::OUString m_aName; + static ::rtl::OUString GenerateNewName(const ::rtl::OUString& rPrefix); + + ::com::sun::star::uno::WeakReference< + ::com::sun::star::text::XTextContent> m_wXBookmark; + }; + + class NavigatorReminder + : public MarkBase + { + public: + NavigatorReminder(const SwPaM& rPaM); + private: + static const ::rtl::OUString our_sNamePrefix; + }; + + class UnoMark + : public MarkBase + { + public: + UnoMark(const SwPaM& rPaM); + private: + static const ::rtl::OUString our_sNamePrefix; + }; + + class DdeBookmark + : public MarkBase + { + public: + DdeBookmark(const SwPaM& rPaM); + + //getters + const SwServerObject* GetRefObject() const + { return &m_aRefObj; } + SwServerObject* GetRefObject() + { return &m_aRefObj; } + + bool IsServer() const + { return m_aRefObj.Is(); } + + //setters + void SetRefObject( SwServerObject* pObj ); + + void DeregisterFromDoc(SwDoc* const pDoc); + virtual ~DdeBookmark(); + private: + SwServerObjectRef m_aRefObj; + static const ::rtl::OUString our_sNamePrefix; + }; + + class Bookmark + : virtual public IBookmark + , public DdeBookmark + , public ::sfx2::Metadatable + { + public: + Bookmark(const SwPaM& rPaM, + const KeyCode& rCode, + const ::rtl::OUString& rName, + const ::rtl::OUString& rShortName); + virtual void InitDoc(SwDoc* const io_Doc); + + virtual const ::rtl::OUString& GetShortName() const + { return m_sShortName; } + virtual const KeyCode& GetKeyCode() const + { return m_aCode; } + virtual void SetShortName(const ::rtl::OUString& rShortName) + { m_sShortName = rShortName; } + virtual void SetKeyCode(const KeyCode& rCode) + { m_aCode = rCode; } + + // ::sfx2::Metadatable + virtual ::sfx2::IXmlIdRegistry& GetRegistry(); + virtual bool IsInClipboard() const; + virtual bool IsInUndo() const; + virtual bool IsInContent() const; + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::rdf::XMetadatable > MakeUnoObject(); + + private: + KeyCode m_aCode; + ::rtl::OUString m_sShortName; + }; + + class Fieldmark + : virtual public IFieldmark + , public MarkBase + { + public: + Fieldmark(const SwPaM& rPaM); + + // getters + virtual ::rtl::OUString GetFieldname() const + { return m_aFieldname; } + virtual ::rtl::OUString GetFieldHelptext() const + { return m_aFieldHelptext; } + + virtual IFieldmark::parameter_map_t* GetParameters() + { return &m_vParams; } + + virtual const IFieldmark::parameter_map_t* GetParameters() const + { return &m_vParams; } + + // setters + virtual void SetFieldname(const ::rtl::OUString& aFieldname) + { m_aFieldname = aFieldname; } + virtual void SetFieldHelptext(const ::rtl::OUString& aFieldHelptext) + { m_aFieldHelptext = aFieldHelptext; } + + virtual void Invalidate(); + virtual rtl::OUString ToString() const; + private: + ::rtl::OUString m_aFieldname; + ::rtl::OUString m_aFieldHelptext; + IFieldmark::parameter_map_t m_vParams; + + static const ::rtl::OUString our_sNamePrefix; + }; + + class TextFieldmark + : public Fieldmark + { + public: + TextFieldmark(const SwPaM& rPaM); + virtual void InitDoc(SwDoc* const io_pDoc); + }; + + class CheckboxFieldmark + : virtual public ICheckboxFieldmark + , public Fieldmark + { + public: + CheckboxFieldmark(const SwPaM& rPaM); + virtual void InitDoc(SwDoc* const io_pDoc); + bool IsChecked() const; + void SetChecked(bool checked); + }; + +}} +#endif diff --git a/sw/source/core/inc/cellfrm.hxx b/sw/source/core/inc/cellfrm.hxx new file mode 100644 index 000000000000..7554271a63c3 --- /dev/null +++ b/sw/source/core/inc/cellfrm.hxx @@ -0,0 +1,72 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_CELLFRM_HXX +#define SW_CELLFRM_HXX + +#include <tools/mempool.hxx> + +#include "layfrm.hxx" + +class SwTableBox; +struct SwCrsrMoveState; +class SwBorderAttrs; + +class SwCellFrm: public SwLayoutFrm +{ + const SwTableBox* pTabBox; + +protected: + virtual void Format( const SwBorderAttrs *pAttrs = 0 ); + virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ); + +public: + SwCellFrm( const SwTableBox &, SwFrm*, bool bInsertContent = true ); + ~SwCellFrm(); + + virtual sal_Bool GetCrsrOfst( SwPosition *, Point&, SwCrsrMoveState* = 0 ) const; + virtual void Paint( SwRect const&, + SwPrintData const*const pPrintData = NULL ) const; + virtual void CheckDirection( sal_Bool bVert ); + + // --> OD 2010-02-17 #i103961# + virtual void Cut(); + // <-- + + const SwTableBox *GetTabBox() const { return pTabBox; } + + // used for breaking table rows: + SwCellFrm* GetFollowCell() const; + SwCellFrm* GetPreviousCell() const; + + // used for rowspan stuff: + const SwCellFrm& FindStartEndOfRowSpanCell( bool bStart, bool bCurrentTab ) const; + long GetLayoutRowSpan() const; + + DECL_FIXEDMEMPOOL_NEWDEL(SwCellFrm) +}; + +#endif diff --git a/sw/source/core/inc/cntfrm.hxx b/sw/source/core/inc/cntfrm.hxx new file mode 100644 index 000000000000..46bd79377bbb --- /dev/null +++ b/sw/source/core/inc/cntfrm.hxx @@ -0,0 +1,150 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CNTFRM_HXX +#define _CNTFRM_HXX +#include "frame.hxx" +#include "flowfrm.hxx" +#include "cshtyp.hxx" + +class SwLayoutFrm; +class SwCntntNode; +class SwBorderAttrs; +class SwAttrSetChg; +class SwTxtFrm; + +//Implementiert in cntfrm.cxx, wird von cntfrm.cxx und crsrsh.cxx angezogen +extern sal_Bool GetFrmInPage( const SwCntntFrm*, SwWhichPage, SwPosPage, SwPaM* ); + +class SwCntntFrm: public SwFrm, public SwFlowFrm +{ + friend void MakeNxt( SwFrm *pFrm, SwFrm *pNxt ); //ruft MakePrtArea + + // --> OD 2007-11-26 #b6614158# + // parameter <bObjsInNewUpper>, indicating that objects are existing in + // remaining area of new upper + sal_Bool _WouldFit( SwTwips nSpace, + SwLayoutFrm *pNewUpper, + sal_Bool bTstMove, + const bool bObjsInNewUpper ); + // <-- + virtual void MakeAll(); + + void _UpdateAttr( const SfxPoolItem*, const SfxPoolItem*, sal_uInt8 &, + SwAttrSetChg *pa = 0, SwAttrSetChg *pb = 0 ); + + virtual sal_Bool ShouldBwdMoved( SwLayoutFrm *pNewUpper, sal_Bool, sal_Bool& ); + + const SwCntntFrm* ImplGetNextCntntFrm( bool bFwd ) const; + +protected: + + sal_Bool MakePrtArea( const SwBorderAttrs & ); + + virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ); + virtual SwTwips ShrinkFrm( SwTwips, sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False ); + virtual SwTwips GrowFrm ( SwTwips, sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False ); + + SwCntntFrm( SwCntntNode * const, SwFrm* ); + +public: + virtual ~SwCntntFrm(); + TYPEINFO(); //bereits in Basisklassen drin + + virtual void Cut(); + virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 ); + + inline SwCntntNode *GetNode(); + inline const SwCntntNode *GetNode() const; + sal_uInt16 GetSectionLevel(); + + inline const SwCntntFrm *GetFollow() const; + inline SwCntntFrm *GetFollow(); + SwTxtFrm* FindMaster() const; + + //Layoutabhaengiges Cursortravelling + virtual sal_Bool LeftMargin( SwPaM * ) const; + virtual sal_Bool RightMargin( SwPaM *, sal_Bool bAPI = sal_False ) const; + virtual sal_Bool UnitUp( SwPaM *, const SwTwips nOffset = 0, + sal_Bool bSetInReadOnly = sal_False ) const; + virtual sal_Bool UnitDown( SwPaM *, const SwTwips nOffset = 0, + sal_Bool bSetInReadOnly = sal_False ) const; + inline sal_Bool StartNextPage( SwPaM * ) const; + inline sal_Bool StartPrevPage( SwPaM * ) const; + inline sal_Bool StartCurrPage( SwPaM * ) const; + inline sal_Bool EndCurrPage( SwPaM * ) const; + inline sal_Bool EndNextPage( SwPaM * ) const; + inline sal_Bool EndPrevPage( SwPaM * ) const; + + // nMaxHeight is the required height + // bSplit indicates, that the paragraph has to be split + // bTst indicates, that we are currently doing a test formatting + virtual sal_Bool WouldFit( SwTwips &nMaxHeight, sal_Bool &bSplit, sal_Bool bTst ); + + sal_Bool MoveFtnCntFwd( sal_Bool, SwFtnBossFrm* );//von MoveFwd gerufen bei Ftn-Inhalt + + inline SwCntntFrm* GetNextCntntFrm() const; + inline SwCntntFrm* GetPrevCntntFrm() const; + static bool CalcLowers( SwLayoutFrm* pLay, const SwLayoutFrm* pDontLeave, long nBottom, bool bSkipRowSpanCells ); + void RegisterToNode( SwCntntNode& ); + static void DelFrms( const SwCntntNode& ); +}; + +inline SwCntntFrm* SwCntntFrm::GetNextCntntFrm() const +{ + if ( GetNext() && GetNext()->IsCntntFrm() ) + return (SwCntntFrm*)GetNext(); + else + return (SwCntntFrm*)ImplGetNextCntntFrm( true ); +} + +inline SwCntntFrm* SwCntntFrm::GetPrevCntntFrm() const +{ + if ( GetPrev() && GetPrev()->IsCntntFrm() ) + return (SwCntntFrm*)GetPrev(); + else + return (SwCntntFrm*)ImplGetNextCntntFrm( false ); +} + +inline SwCntntNode *SwCntntFrm::GetNode() +{ + return (SwCntntNode*)GetDep(); +} +inline const SwCntntNode *SwCntntFrm::GetNode() const +{ + return (SwCntntNode*)GetDep(); +} + +inline const SwCntntFrm *SwCntntFrm::GetFollow() const +{ + return (const SwCntntFrm*)SwFlowFrm::GetFollow(); +} +inline SwCntntFrm *SwCntntFrm::GetFollow() +{ + return (SwCntntFrm*)SwFlowFrm::GetFollow(); +} + +#endif diff --git a/sw/source/core/inc/colfrm.hxx b/sw/source/core/inc/colfrm.hxx new file mode 100644 index 000000000000..90bb547c3333 --- /dev/null +++ b/sw/source/core/inc/colfrm.hxx @@ -0,0 +1,42 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _COLFRM_HXX +#define _COLFRM_HXX + +#include <tools/mempool.hxx> +#include "ftnboss.hxx" + +class SwColumnFrm: public SwFtnBossFrm +{ +public: + SwColumnFrm( SwFrmFmt*, SwFrm* ); + ~SwColumnFrm(); + + DECL_FIXEDMEMPOOL_NEWDEL(SwColumnFrm) +}; + +#endif //_COLFRM_HXX diff --git a/sw/source/core/inc/crossrefbookmark.hxx b/sw/source/core/inc/crossrefbookmark.hxx new file mode 100644 index 000000000000..27f920be7651 --- /dev/null +++ b/sw/source/core/inc/crossrefbookmark.hxx @@ -0,0 +1,99 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _CROSSREFBOOKMRK_HXX +#define _CROSSREFBOOKMRK_HXX + +#include <IMark.hxx> +#include <bookmrk.hxx> +#include <rtl/ustring.hxx> + + +namespace sw { namespace mark +{ + class CrossRefBookmark + : public Bookmark + { + public: + CrossRefBookmark(const SwPaM& rPaM, + const KeyCode& rCode, + const ::rtl::OUString& rName, + const ::rtl::OUString& rShortName, + const ::rtl::OUString& rPrefix); + + // getters + virtual SwPosition& GetOtherMarkPos() const; + virtual SwPosition& GetMarkStart() const + { return *m_pPos1; } + virtual SwPosition& GetMarkEnd() const + { return *m_pPos1; } + virtual bool IsExpanded() const + { return false; } + + // setters + virtual void SetMarkPos(const SwPosition& rNewPos); + virtual void SetOtherMarkPos(const SwPosition&) + { + OSL_PRECOND(false, + "<CrossRefBookmark::SetOtherMarkPos(..)>" + " - misusage of CrossRefBookmark: other bookmark position isn't allowed to be set." ); + } + virtual void ClearOtherMarkPos() + { + OSL_PRECOND(false, + "<SwCrossRefBookmark::ClearOtherMarkPos(..)>" + " - misusage of CrossRefBookmark: other bookmark position isn't allowed to be set or cleared." ); + } + }; + + class CrossRefHeadingBookmark + : public CrossRefBookmark + { + public: + CrossRefHeadingBookmark(const SwPaM& rPaM, + const KeyCode& rCode, + const ::rtl::OUString& rName, + const ::rtl::OUString& rShortName); + static ::rtl::OUString GenerateNewName(); + static bool IsLegalName(const ::rtl::OUString& rName); + static const ::rtl::OUString our_sNamePrefix; + }; + + class CrossRefNumItemBookmark + : public CrossRefBookmark + { + public: + CrossRefNumItemBookmark(const SwPaM& rPaM, + const KeyCode& rCode, + const ::rtl::OUString& rName, + const ::rtl::OUString& rShortName); + static ::rtl::OUString GenerateNewName(); + static bool IsLegalName(const ::rtl::OUString& rName); + static const ::rtl::OUString our_sNamePrefix; + }; + +}} +#endif diff --git a/sw/source/core/inc/dbg_lay.hxx b/sw/source/core/inc/dbg_lay.hxx new file mode 100644 index 000000000000..3885d9d7dda5 --- /dev/null +++ b/sw/source/core/inc/dbg_lay.hxx @@ -0,0 +1,120 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _DBG_LAY_HXX +#define _DBG_LAY_HXX + +#define PROT_FILE_INIT 0x00000000 +#define PROT_INIT 0x00000001 +#define PROT_MAKEALL 0x00000002 +#define PROT_MOVE_FWD 0x00000004 +#define PROT_MOVE_BWD 0x00000008 +#define PROT_GROW 0x00000010 +#define PROT_SHRINK 0x00000020 +#define PROT_GROW_TST 0x00000040 +#define PROT_SHRINK_TST 0x00000080 +#define PROT_SIZE 0x00000100 +#define PROT_PRTAREA 0x00000200 +#define PROT_POS 0x00000400 +#define PROT_ADJUSTN 0x00000800 +#define PROT_SECTION 0x00001000 +#define PROT_CUT 0x00002000 +#define PROT_PASTE 0x00004000 +#define PROT_LEAF 0x00008000 +#define PROT_TESTFORMAT 0x00010000 +#define PROT_FRMCHANGES 0x00020000 +#define PROT_SNAPSHOT 0x00040000 + +#define ACT_START 1 +#define ACT_END 2 +#define ACT_CREATE_MASTER 3 +#define ACT_CREATE_FOLLOW 4 +#define ACT_DEL_MASTER 5 +#define ACT_DEL_FOLLOW 6 +#define ACT_MERGE 7 +#define ACT_NEXT_SECT 8 +#define ACT_PREV_SECT 9 + +#define SNAP_LOWER 0x00000001 +#define SNAP_FLYFRAMES 0x00000002 +#define SNAP_TABLECONT 0x00000004 + +#ifdef DBG_UTIL + +#include "swtypes.hxx" + +class SwImplProtocol; +class SwFrm; +class SwImplEnterLeave; + +class SwProtocol +{ + static sal_uLong nRecord; + static SwImplProtocol* pImpl; + static sal_Bool Start() { return 0 != ( PROT_INIT & nRecord ); } +public: + static sal_uLong Record() { return nRecord; } + static void SetRecord( sal_uLong nNew ) { nRecord = nNew; } + static sal_Bool Record( sal_uLong nFunc ) { return 0 != (( nFunc | PROT_INIT ) & nRecord); } + static void Record( const SwFrm* pFrm, sal_uLong nFunction, sal_uLong nAction, void* pParam ); + static void Init(); + static void Stop(); + static void SnapShot( const SwFrm* pFrm, sal_uLong nFlags ); + static void GetVar( const sal_uInt16 nNo, long& rVar ); +}; + +class SwEnterLeave +{ + SwImplEnterLeave* pImpl; + void Ctor( const SwFrm* pFrm, sal_uLong nFunc, sal_uLong nAct, void* pPar ); + void Dtor(); +public: + SwEnterLeave( const SwFrm* pFrm, sal_uLong nFunc, sal_uLong nAct, void* pPar ) + { if( SwProtocol::Record( nFunc ) ) Ctor( pFrm, nFunc, nAct, pPar ); else pImpl = NULL; } + ~SwEnterLeave() { if( pImpl ) Dtor(); } +}; + +#define PROTOCOL( pFrm, nFunc, nAct, pPar ) { if( SwProtocol::Record( nFunc ) )\ + SwProtocol::Record( pFrm, nFunc, nAct, pPar ); } +#define PROTOCOL_INIT SwProtocol::Init(); +#define PROTOCOL_STOP SwProtocol::Stop(); +#define PROTOCOL_ENTER( pFrm, nFunc, nAct, pPar ) SwEnterLeave aEnter( pFrm, nFunc, nAct, pPar ); +#define PROTOCOL_SNAPSHOT( pFrm, nFlags ) SwProtocol::SnapShot( pFrm, nFlags ); +#define GET_VARIABLE( nNo, nVar ) SwProtocol::GetVar( nNo, nVar ); + +#else + +#define PROTOCOL( pFrm, nFunc, nAct, pPar ) +#define PROTOCOL_INIT +#define PROTOCOL_STOP +#define PROTOCOL_ENTER( pFrm, nFunc, nAct, pPar ) +#define PROTOCOL_SNAPSHOT( pFrm, nFlags ) +#define GET_VARIABLE( nNo, nVar ) + +#endif + +#endif diff --git a/sw/source/core/inc/dbgloop.hxx b/sw/source/core/inc/dbgloop.hxx new file mode 100644 index 000000000000..bfa17b466828 --- /dev/null +++ b/sw/source/core/inc/dbgloop.hxx @@ -0,0 +1,77 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _DBGLOOP_HXX +#define _DBGLOOP_HXX + +#ifdef DBG_UTIL + +#include <tools/solar.h> + +class SvStream; + +#define DBG_MAX_STACK 20 // Verschachtelungstiefe +#define DBG_MAX_LOOP 1000 // das Abbruchkriterium + +class DbgLoopStack +{ + sal_uInt16 aCount[DBG_MAX_STACK]; + sal_uInt16 nPtr; + const void *pDbg; + void Reset(); +public: + DbgLoopStack(); + void Push( const void *pThis ); + void Pop(); + void Print( SvStream &rOS ) const; //$ ostream +}; + +class DbgLoop +{ + friend inline void PrintLoopStack( SvStream &rOS ); //$ ostream + static DbgLoopStack aDbgLoopStack; +public: + inline DbgLoop( const void *pThis ) { aDbgLoopStack.Push( pThis ); } + inline ~DbgLoop() { aDbgLoopStack.Pop(); } +}; + +inline void PrintLoopStack( SvStream &rOS ) //$ ostream +{ + DbgLoop::aDbgLoopStack.Print( rOS ); +} + +#define DBG_LOOP DbgLoop aDbgLoop( (const void*)this ); +#define DBG_LOOP_RESET DbgLoop aDbgLoop( 0 ); + +#else + +#define DBG_LOOP +#define DBG_LOOP_RESET + +#endif + +#endif diff --git a/sw/source/core/inc/dflyobj.hxx b/sw/source/core/inc/dflyobj.hxx new file mode 100644 index 000000000000..23216709a50a --- /dev/null +++ b/sw/source/core/inc/dflyobj.hxx @@ -0,0 +1,140 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _DFLYOBJ_HXX +#define _DFLYOBJ_HXX +#include <svx/svdovirt.hxx> + +class SwFlyFrm; +class SwFrmFmt; +class SdrObjMacroHitRec; + +const sal_uInt32 SWGInventor = sal_uInt32('S')*0x00000001+ + sal_uInt32('W')*0x00000100+ + sal_uInt32('G')*0x00010000; + +const sal_uInt16 SwFlyDrawObjIdentifier = 0x0001; +const sal_uInt16 SwDrawFirst = 0x0001; + +//--------------------------------------- +//SwFlyDrawObj, Die DrawObjekte fuer Flys. + +class SwFlyDrawObj : public SdrObject +{ +private: + virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties(); + +protected: + // #i95264# SwFlyDrawObj needs an own VC since createViewIndependentPrimitive2DSequence() + // is called when RecalcBoundRect() is used + virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + +public: + TYPEINFO(); + + SwFlyDrawObj(); + ~SwFlyDrawObj(); + + //Damit eine Instanz dieser Klasse beim laden erzeugt werden kann + //(per Factory). + virtual sal_uInt32 GetObjInventor() const; + virtual sal_uInt16 GetObjIdentifier() const; + virtual sal_uInt16 GetObjVersion() const; +}; + +//--------------------------------------- +//SwVirtFlyDrawObj, die virtuellen Objekte fuer Flys. +//Flys werden immer mit virtuellen Objekten angezeigt. Nur so koennen sie +//ggf. mehrfach angezeigt werden (Kopf-/Fusszeilen). + +class SwVirtFlyDrawObj : public SdrVirtObj +{ +private: + SwFlyFrm *pFlyFrm; + +protected: + // AW: Need own sdr::contact::ViewContact since AnchorPos from parent is + // not used but something own (top left of new SnapRect minus top left + // of original SnapRect) + virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact(); + +public: + // for paints triggered form ExecutePrimitive + void wrap_DoPaintObject() const; + + // for simple access to inner and outer bounds + basegfx::B2DRange getOuterBound() const; + basegfx::B2DRange getInnerBound() const; + +public: + TYPEINFO(); + + SwVirtFlyDrawObj(SdrObject& rNew, SwFlyFrm* pFly); + ~SwVirtFlyDrawObj(); + + //Ueberladene Methoden der Basisklasse SdrVirtObj + virtual void TakeObjInfo( SdrObjTransformInfoRec& rInfo ) const; + + //Wir nehemen die Groessenbehandlung vollstaendig selbst in die Hand. + virtual const Rectangle& GetCurrentBoundRect() const; + virtual const Rectangle& GetLastBoundRect() const; + virtual void RecalcBoundRect(); + virtual void RecalcSnapRect(); + virtual const Rectangle& GetSnapRect() const; + virtual void SetSnapRect(const Rectangle& rRect); + virtual void NbcSetSnapRect(const Rectangle& rRect); + virtual const Rectangle& GetLogicRect() const; + virtual void SetLogicRect(const Rectangle& rRect); + virtual void NbcSetLogicRect(const Rectangle& rRect); + virtual ::basegfx::B2DPolyPolygon TakeXorPoly() const; + virtual void NbcMove (const Size& rSiz); + virtual void NbcResize(const Point& rRef, const Fraction& xFact, + const Fraction& yFact); + virtual void Move (const Size& rSiz); + virtual void Resize(const Point& rRef, const Fraction& xFact, + const Fraction& yFact); + + const SwFrmFmt *GetFmt() const; + SwFrmFmt *GetFmt(); + + // Get Methoden fuer die Fly Verpointerung + SwFlyFrm* GetFlyFrm() { return pFlyFrm; } + const SwFlyFrm* GetFlyFrm() const { return pFlyFrm; } + + void SetRect() const; + + // ist eine URL an einer Grafik gesetzt, dann ist das ein Makro-Object + virtual FASTBOOL HasMacro() const; + virtual SdrObject* CheckMacroHit (const SdrObjMacroHitRec& rRec) const; + virtual Pointer GetMacroPointer (const SdrObjMacroHitRec& rRec) const; + + // FullDrag support + virtual bool supportsFullDrag() const; + virtual SdrObject* getFullDragClone() const; +}; + + +#endif diff --git a/sw/source/core/inc/docfld.hxx b/sw/source/core/inc/docfld.hxx new file mode 100644 index 000000000000..dbce10e51db0 --- /dev/null +++ b/sw/source/core/inc/docfld.hxx @@ -0,0 +1,193 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _DOCFLD_HXX +#define _DOCFLD_HXX + +#include <calc.hxx> // fuer SwHash + +class SwTxtFld; +class SwIndex; +class SwNodeIndex; +class SwCntntNode; +class SwCntntFrm; +class SwSectionNode; +class SwSection; +class SwTxtTOXMark; +class SwTableBox; +class SwTxtINetFmt; +class SwFlyFrmFmt; +class SwDoc; +class SwNode; +struct SwPosition; + +// Update an den Expression Feldern +class _SetGetExpFld +{ + sal_uLong nNode; + xub_StrLen nCntnt; + union { + const SwTxtFld* pTxtFld; + const SwSection* pSection; + const SwPosition* pPos; + const SwTxtTOXMark* pTxtTOX; + const SwTableBox* pTBox; + const SwTxtINetFmt* pTxtINet; + const SwFlyFrmFmt* pFlyFmt; + } CNTNT; + enum _SetGetExpFldType + { + TEXTFIELD, TEXTTOXMARK, SECTIONNODE, CRSRPOS, TABLEBOX, + TEXTINET, FLYFRAME + } eSetGetExpFldType; + +public: + _SetGetExpFld( const SwNodeIndex& rNdIdx, const SwTxtFld* pFld = 0, + const SwIndex* pIdx = 0 ); + + _SetGetExpFld( const SwNodeIndex& rNdIdx, const SwTxtINetFmt& rINet, + const SwIndex* pIdx = 0 ); + + _SetGetExpFld( const SwSectionNode& rSectNode, + const SwPosition* pPos = 0 ); + + _SetGetExpFld( const SwTableBox& rTableBox, + const SwPosition* pPos = 0 ); + + _SetGetExpFld( const SwNodeIndex& rNdIdx, const SwTxtTOXMark& rTOX, + const SwIndex* pIdx ); + + _SetGetExpFld( const SwPosition& rPos ); + + _SetGetExpFld( const SwFlyFrmFmt& rFlyFmt, const SwPosition* pPos = 0 ); + + sal_Bool operator==( const _SetGetExpFld& rFld ) const + { return nNode == rFld.nNode && nCntnt == rFld.nCntnt && + ( !CNTNT.pTxtFld || !rFld.CNTNT.pTxtFld || + CNTNT.pTxtFld == rFld.CNTNT.pTxtFld ); } + sal_Bool operator<( const _SetGetExpFld& rFld ) const; + + const SwTxtFld* GetFld() const + { return TEXTFIELD == eSetGetExpFldType ? CNTNT.pTxtFld : 0; } + const SwTxtTOXMark* GetTOX() const + { return TEXTTOXMARK == eSetGetExpFldType ? CNTNT.pTxtTOX : 0; } + const SwSection* GetSection() const + { return SECTIONNODE == eSetGetExpFldType ? CNTNT.pSection : 0; } + const SwTableBox* GetTableBox() const + { return TABLEBOX == eSetGetExpFldType ? CNTNT.pTBox : 0; } + const SwTxtINetFmt* GetINetFmt() const + { return TEXTINET == eSetGetExpFldType ? CNTNT.pTxtINet : 0; } + const SwFlyFrmFmt* GetFlyFmt() const + { return FLYFRAME == eSetGetExpFldType ? CNTNT.pFlyFmt : 0; } + + sal_uLong GetNode() const { return nNode; } + xub_StrLen GetCntnt() const { return nCntnt; } + const void* GetPointer() const { return CNTNT.pTxtFld; } + + void GetPos( SwPosition& rPos ) const; + void GetPosOfContent( SwPosition& rPos ) const; + + const SwNode* GetNodeFromCntnt() const; + xub_StrLen GetCntPosFromCntnt() const; + + void SetBodyPos( const SwCntntFrm& rFrm ); +}; + +typedef _SetGetExpFld* _SetGetExpFldPtr; +SV_DECL_PTRARR_SORT_DEL( _SetGetExpFlds, _SetGetExpFldPtr, 0, 10 ) + + +// Struktur zum Speichern der Strings aus SetExp-String-Feldern +struct _HashStr : public SwHash +{ + String aSetStr; + _HashStr( const String& rName, const String& rText, _HashStr* = 0 ); +}; + +struct SwCalcFldType : public SwHash +{ + const SwFieldType* pFldType; + + SwCalcFldType( const String& rStr, const SwFieldType* pFldTyp ) + : SwHash( rStr ), pFldType( pFldTyp ) + {} +}; + +// Suche nach dem String, der unter dem Namen in der HashTabelle abgelegt +// wurde +void LookString( SwHash** ppTbl, sal_uInt16 nSize, const String& rName, + String& rRet, sal_uInt16* pPos = 0 ); + + +// -------- + +const int GETFLD_ALL = 3; // veroderte Flags !! +const int GETFLD_CALC = 1; +const int GETFLD_EXPAND = 2; + +class SwDocUpdtFld +{ + _SetGetExpFlds* pFldSortLst; // akt. Field-Liste zum Calculieren + SwCalcFldType* aFldTypeTable[ TBLSZ ]; + +// noch eine weitere Optimierung - wird z.Z. nicht angesprochen! + long nFldUpdtPos; // ab dieser Position mit Update starten + SwCntntNode* pCNode; // der TxtNode zur UpdatePos. + + sal_uLong nNodes; // sollte die NodesAnzahl unterschiedlich sein + sal_uInt8 nFldLstGetMode; + + sal_Bool bInUpdateFlds : 1; // zur Zeit laeuft ein UpdateFlds, + sal_Bool bFldsDirty : 1; // irgendwelche Felder sind ungueltig + + void _MakeFldList( SwDoc& pDoc, int eGetMode ); + void GetBodyNode( const SwTxtFld& , sal_uInt16 nFldWhich ); + void GetBodyNode( const SwSectionNode&); +public: + SwDocUpdtFld(); + ~SwDocUpdtFld(); + + const _SetGetExpFlds* GetSortLst() const { return pFldSortLst; } + + void MakeFldList( SwDoc& rDoc, int bAll, int eGetMode ); + + void InsDelFldInFldLst( sal_Bool bIns, const SwTxtFld& rFld ); + + void InsertFldType( const SwFieldType& rType ); + void RemoveFldType( const SwFieldType& rType ); + + sal_Bool IsInUpdateFlds() const { return bInUpdateFlds; } + void SetInUpdateFlds( sal_Bool b ) { bInUpdateFlds = b; } + + sal_Bool IsFieldsDirty() const { return bFldsDirty; } + void SetFieldsDirty( sal_Bool b ) { bFldsDirty = b; } + + SwHash** GetFldTypeTable() const { return (SwHash**)aFldTypeTable; } +}; + + +#endif // _DOCFLD_HXX + diff --git a/sw/source/core/inc/docsort.hxx b/sw/source/core/inc/docsort.hxx new file mode 100644 index 000000000000..5d87e37e9219 --- /dev/null +++ b/sw/source/core/inc/docsort.hxx @@ -0,0 +1,176 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SORT_HXX +#define _SORT_HXX + +#include <svl/svarray.hxx> +#include <ndindex.hxx> + + +class SwDoc; +class SwTableBox; +class SwUndoSort; +class FlatFndBox; +struct SwSortOptions; +struct SwSortElement; +class _FndBox; +class _FndLine; +class CollatorWrapper; +class LocaleDataWrapper; + + +namespace com { namespace sun { namespace star { namespace lang { + struct Locale; +}}}} + +/*-------------------------------------------------------------------- + Beschreibung: Liste aller sortierten Elemente + --------------------------------------------------------------------*/ +typedef const _FndBox* _FndBoxPtr; +typedef SwSortElement* SwSortElementPtr; +typedef const SwTableBox* SwMovedBoxPtr; + +SV_DECL_PTRARR_SORT(SwSortElements, SwSortElementPtr, 0, 1 ) +SV_DECL_PTRARR(SwMovedBoxes, SwMovedBoxPtr, 10, 10 ) + +/*-------------------------------------------------------------------- + Beschreibung: Funktionen zum Moven von Boxen + --------------------------------------------------------------------*/ + +void MoveCol(SwDoc* pDoc, const FlatFndBox& rBox, + sal_uInt16 nS, sal_uInt16 nT, SwMovedBoxes& rMovedList, SwUndoSort* pUD=0); +void MoveRow(SwDoc* pDoc, const FlatFndBox& rBox, + sal_uInt16 nS, sal_uInt16 nT, SwMovedBoxes& rMovedList, SwUndoSort* pUD=0); +void MoveCell(SwDoc* pDoc, const SwTableBox* pSource, + const SwTableBox* pTar, sal_Bool bMovedBefore, SwUndoSort* pUD=0); + +/*------------------------------------------------------------------- + Beschreibung: Elemente zum Sortieren von Text und Tabellen-Inhalt + --------------------------------------------------------------------*/ + +struct SwSortElement +{ + static SwSortOptions* pOptions; + static SwDoc* pDoc; + static const FlatFndBox* pBox; + static CollatorWrapper* pSortCollator; + static ::com::sun::star::lang::Locale* pLocale; + static String* pLastAlgorithm; + static LocaleDataWrapper* pLclData; + + static void Init( SwDoc*, const SwSortOptions& rOpt, FlatFndBox* = 0 ); + static void Finit(); + + virtual ~SwSortElement(); + + virtual String GetKey(sal_uInt16 nKey ) const = 0; + virtual double GetValue(sal_uInt16 nKey ) const; + + sal_Bool operator==(const SwSortElement& ); + sal_Bool operator<(const SwSortElement& ); + + double StrToDouble(const String& rStr) const; +}; + +/*-------------------------------------------------------------------- + Beschreibung: Sortieren Text + --------------------------------------------------------------------*/ + +struct SwSortTxtElement : public SwSortElement +{ + // fuer Text + sal_uLong nOrg; + SwNodeIndex aPos; + + SwSortTxtElement( const SwNodeIndex& rPos ); + virtual ~SwSortTxtElement(); + + virtual String GetKey( sal_uInt16 nKey ) const; +}; + +/*-------------------------------------------------------------------- + Beschreibung: Sortieren Tabelle + --------------------------------------------------------------------*/ + +struct SwSortBoxElement : public SwSortElement +{ + sal_uInt16 nRow; + + SwSortBoxElement( sal_uInt16 nRC ); + virtual ~SwSortBoxElement(); + + virtual String GetKey( sal_uInt16 nKey ) const; + virtual double GetValue( sal_uInt16 nKey ) const; +}; + + +/*-------------------------------------------------------------------- + Beschreibung: SymFndBoxes stellt ein zweidimensionales + Array von FndBoxes dar + --------------------------------------------------------------------*/ + +class FlatFndBox +{ +public: + FlatFndBox(SwDoc* pDocPtr, const _FndBox& rBox); + ~FlatFndBox(); + + sal_Bool IsSymmetric() const { return bSym; } + sal_uInt16 GetRows() const { return nRows; } + sal_uInt16 GetCols() const { return nCols; } + + const _FndBox* GetBox(sal_uInt16 nCol, sal_uInt16 nRow) const; + + inline sal_Bool HasItemSets() const; + const SfxItemSet* GetItemSet(sal_uInt16 nCol, sal_uInt16 nRow) const; + +private: + + sal_Bool CheckLineSymmetry(const _FndBox& rBox); + sal_Bool CheckBoxSymmetry(const _FndLine& rLn); + sal_uInt16 GetColCount(const _FndBox& rBox); + sal_uInt16 GetRowCount(const _FndBox& rBox); + void FillFlat(const _FndBox&, sal_Bool bLastBox=sal_False); + + SwDoc* pDoc; + const _FndBox& rBoxRef; + _FndBoxPtr* pArr; + SfxItemSet** ppItemSets; + + sal_uInt16 nRows; + sal_uInt16 nCols; + + sal_uInt16 nRow; + sal_uInt16 nCol; + + sal_Bool bSym; +}; + + +inline sal_Bool FlatFndBox::HasItemSets() const { return 0 != ppItemSets; } + +#endif // _NDSORT_HXX diff --git a/sw/source/core/inc/doctxm.hxx b/sw/source/core/inc/doctxm.hxx new file mode 100644 index 000000000000..5e3adfb1fd3d --- /dev/null +++ b/sw/source/core/inc/doctxm.hxx @@ -0,0 +1,147 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _DOCTXM_HXX +#define _DOCTXM_HXX + + +#include <svl/svarray.hxx> +#include <tools/gen.hxx> +#include <tox.hxx> +#include <section.hxx> + +class SwTOXInternational; +class SvUShorts; +class SvStringsDtor; +class SvPtrarr; +class SwPageDesc; +class SwTxtNode; +class SwTxtFmtColl; +struct SwPosition; +struct SwTOXSortTabBase; + +typedef SwTOXSortTabBase* SwTOXSortTabBasePtr; + +SV_DECL_PTRARR(SwTOXSortTabBases, SwTOXSortTabBasePtr, 0, 5 ) + +/*-------------------------------------------------------------------- + Beschreibung: Ring der speziellen Verzeichnisse + --------------------------------------------------------------------*/ + +class SwTOXBaseSection : public SwTOXBase, public SwSection +{ + SwTOXSortTabBases aSortArr; + + void UpdateMarks( const SwTOXInternational& rIntl, + const SwTxtNode* pOwnChapterNode ); + void UpdateOutline( const SwTxtNode* pOwnChapterNode ); + void UpdateTemplate( const SwTxtNode* pOwnChapterNode ); + void UpdateCntnt( SwTOXElement eType, + const SwTxtNode* pOwnChapterNode ); + void UpdateTable( const SwTxtNode* pOwnChapterNode ); + void UpdateSequence( const SwTxtNode* pOwnChapterNode ); + void UpdateAuthorities( const SwTOXInternational& rIntl ); + void UpdateAll(); + + // Sortiert einfuegen ins Array fuer die Generierung + void InsertSorted(SwTOXSortTabBase* pBase); + + // Alpha-Trennzeichen bei der Generierung einfuegen + void InsertAlphaDelimitter( const SwTOXInternational& rIntl ); + + // Textrumpf generieren + // OD 18.03.2003 #106329# - add parameter <_TOXSectNdIdx> and <_pDefaultPageDesc> + void GenerateText( sal_uInt16 nArrayIdx, + sal_uInt16 nCount, + SvStringsDtor&, + const sal_uInt32 _nTOXSectNdIdx, + const SwPageDesc* _pDefaultPageDesc ); + + // Seitennummerplatzhalter gegen aktuelle Nummern austauschen + void _UpdatePageNum( SwTxtNode* pNd, + const SvUShorts& rNums, + const SvPtrarr &rDescs, + const SvUShorts* pMainEntryNums, + const SwTOXInternational& rIntl ); + + // Bereich fuer Stichwort einfuegen suchen + Range GetKeyRange( const String& rStr, const String& rStrReading, + const SwTOXSortTabBase& rNew, sal_uInt16 nLevel, + const Range& rRange ); + + // returne die TextCollection ueber den Namen / aus Format-Pool + SwTxtFmtColl* GetTxtFmtColl( sal_uInt16 nLevel ); + +public: + SwTOXBaseSection(SwTOXBase const& rBase, SwSectionFmt & rFmt); + virtual ~SwTOXBaseSection(); + + // OD 19.03.2003 #106329# - add parameter <_bNewTOX> in order to distinguish + // between the creation of a new table-of-content or an update of + // a table-of-content. Default value: false + void Update( const SfxItemSet* pAttr = 0, + const bool _bNewTOX = false ); // Formatieren + void UpdatePageNum(); // Seitennummern einfuegen + TYPEINFO(); // fuers rtti + + sal_Bool SetPosAtStartEnd( SwPosition& rPos, sal_Bool bAtStart = sal_True ) const; +}; +/* -----------------02.09.99 07:52------------------- + + --------------------------------------------------*/ +struct SwDefTOXBase_Impl +{ + SwTOXBase* pContBase; + SwTOXBase* pIdxBase; + SwTOXBase* pUserBase; + SwTOXBase* pTblBase; + SwTOXBase* pObjBase; + SwTOXBase* pIllBase; + SwTOXBase* pAuthBase; + + SwDefTOXBase_Impl() : + pContBase(0), + pIdxBase(0), + pUserBase(0), + pTblBase(0), + pObjBase(0), + pIllBase(0), + pAuthBase(0) + {} + ~SwDefTOXBase_Impl() + { + delete pContBase; + delete pIdxBase; + delete pUserBase; + delete pTblBase; + delete pObjBase; + delete pIllBase; + delete pAuthBase; + } + +}; + +#endif // _DOCTXM_HXX diff --git a/sw/source/core/inc/drawdev.hxx b/sw/source/core/inc/drawdev.hxx new file mode 100644 index 000000000000..7b851403355b --- /dev/null +++ b/sw/source/core/inc/drawdev.hxx @@ -0,0 +1,140 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _DRAWDEV_HXX +#define _DRAWDEV_HXX + +#include "swrect.hxx" + +#ifndef _OUTDEV_HXX //autogen +#include <vcl/outdev.hxx> +#endif + +/************************************************************************* + * class SwDrawDev + * + * Alle Draw-Methoden werden um den Offset *pPos verschoben. + *************************************************************************/ + +class SwDrawDev +{ + OutputDevice *pOut; + const Point *pPos; + +public: + inline SwDrawDev( OutputDevice *pOutDev, const Point *pPosition ) + :pOut(pOutDev), pPos(pPosition) { } + + inline OutputDevice *GetOut() { return pOut; } + + // Ausgabemethoden + inline void DrawText( const Point& rStart, const String& rTxt, + const sal_uInt16 nIdx = 0, + const sal_uInt16 nLen = STRING_LEN ); + inline void DrawStretchText( const Point& rStart, sal_uInt16 nWidth, + const String& rTxt, + const sal_uInt16 nIdx = 0, + const sal_uInt16 nLen = STRING_LEN ); + inline void DrawTextArray( const Point& rStart, + const String& rTxt, + long *pKernArray = 0, + const sal_uInt16 nIdx = 0, + const sal_uInt16 nLen = STRING_LEN); + inline void DrawLine( const Point& rStart, const Point& rEnd ); + inline void DrawRect( const SwRect& rRect, + const sal_uInt16 nHorzRount = 0, + const sal_uInt16 nVertRound = 0 ); + + inline const Point *GetOrigin() const {return pPos; } +}; + +/************************************************************************* + * SwDrawDev::DrawText + *************************************************************************/ + +inline void SwDrawDev::DrawText( const Point& rStart, const String& rTxt, + const sal_uInt16 nIdx, const sal_uInt16 nLen ) +{ + if( !pPos ) + pOut->DrawText( rStart, rTxt, nIdx, nLen ); + else + pOut->DrawText( rStart - *pPos, rTxt, nIdx, nLen ); +} + +/************************************************************************* + * SwDrawDev::DrawStretchText + *************************************************************************/ + +inline void SwDrawDev::DrawStretchText( const Point& rStart, sal_uInt16 nWidth, + const String& rTxt, const sal_uInt16 nIdx, const sal_uInt16 nLen ) +{ + if( !pPos ) + pOut->DrawStretchText( rStart, nWidth, rTxt, nIdx, nLen ); + else + pOut->DrawStretchText( rStart - *pPos, nWidth, rTxt, nIdx, nLen ); +} + +/************************************************************************* + * SwDrawDev::DrawTextArray + *************************************************************************/ + +inline void SwDrawDev::DrawTextArray( const Point& rStart, const String& rTxt, + long *pKernArray, const sal_uInt16 nIdx, const sal_uInt16 nLen ) +{ + if( !pPos ) + pOut->DrawTextArray( rStart, rTxt, pKernArray, nIdx, nLen ); + else + pOut->DrawTextArray( rStart - *pPos, rTxt, pKernArray, nIdx, nLen ); +} + +/************************************************************************* + * SwDrawDev::DrawLine + *************************************************************************/ + +inline void SwDrawDev::DrawLine( const Point& rStart, const Point& rEnd ) +{ + if( !pPos ) + pOut->DrawLine( rStart, rEnd ); + else + pOut->DrawLine( rStart - *pPos, rEnd - *pPos ); +} + +/************************************************************************* + * SwDrawDev::DrawRect + *************************************************************************/ + +inline void SwDrawDev::DrawRect( const SwRect& rRect, + const sal_uInt16 nHorzRound, const sal_uInt16 nVertRound ) +{ + SwRect aRect( rRect ); + if( pPos ) + aRect.Pos() -= *pPos; + pOut->DrawRect( aRect.SVRect(), nHorzRound, nVertRound ); +} + + +#endif diff --git a/sw/source/core/inc/drawfont.hxx b/sw/source/core/inc/drawfont.hxx new file mode 100644 index 000000000000..ba16257d3189 --- /dev/null +++ b/sw/source/core/inc/drawfont.hxx @@ -0,0 +1,594 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _DRAWFONT_HXX +#define _DRAWFONT_HXX + +#include <tools/solar.h> +#include <tools/string.hxx> +#include <errhdl.hxx> + +class SwTxtFrm; +class OutputDevice; +class ViewShell; +class SwScriptInfo; +class Point; +class SwWrongList; +class Size; +class SwFont; +class Font; +class SwUnderlineFont; + +/************************************************************************* + * class SwDrawTextInfo + * + * encapsulates information for drawing text + *************************************************************************/ + +class SwDrawTextInfo +{ + const SwTxtFrm* pFrm; + OutputDevice* pOut; + ViewShell* pSh; + const SwScriptInfo* pScriptInfo; + const Point* pPos; + const XubString* pText; + const SwWrongList* pWrong; + const SwWrongList* pGrammarCheck; + const SwWrongList* pSmartTags; // SMARTTAGS + const Size* pSize; + SwFont *pFnt; + SwUnderlineFont* pUnderFnt; + xub_StrLen* pHyphPos; + long nLeft; + long nRight; + long nKanaDiff; + xub_StrLen nIdx; + xub_StrLen nLen; + xub_StrLen nOfst; + sal_uInt16 nWidth; + sal_uInt16 nAscent; + sal_uInt16 nCompress; + long nSperren; + long nSpace; + long nKern; + xub_StrLen nNumberOfBlanks; + sal_uInt8 nCursorBidiLevel; + sal_Bool bBullet : 1; + sal_Bool bUpper : 1; // Fuer Kapitaelchen: Grossbuchstaben-Flag + sal_Bool bDrawSpace : 1; // Fuer Kapitaelchen: Unter/Durchstreichung + sal_Bool bGreyWave : 1; // Graue Wellenlinie beim extended TextInput + sal_Bool bSpaceStop : 1; // For underlining we need to know, if a portion + // is right in front of a hole portion or a + // fix margin portion. + sal_Bool bSnapToGrid : 1; // Does paragraph snap to grid? + sal_Bool bIgnoreFrmRTL : 1; // Paint text as if text has LTR direction, used for + // line numbering + sal_Bool bPosMatchesBounds :1; // GetCrsrOfst should not return the next + // position if screen position is inside second + // half of bound rect, used for Accessibility + + SwDrawTextInfo(); // nicht zulaessig +public: + +#ifdef DBG_UTIL + sal_Bool bPos : 1; // These flags should control, that the appropriate + sal_Bool bWrong : 1; // Set-function has been called before calling + sal_Bool bGrammarCheck : 1; // the Get-function of a member + sal_Bool bSize : 1; + sal_Bool bFnt : 1; + sal_Bool bHyph : 1; + sal_Bool bLeft : 1; + sal_Bool bRight : 1; + sal_Bool bKana : 1; + sal_Bool bOfst : 1; + sal_Bool bAscent: 1; + sal_Bool bSperr : 1; + sal_Bool bSpace : 1; + sal_Bool bNumberOfBlanks : 1; + sal_Bool bUppr : 1; + sal_Bool bDrawSp: 1; +#endif + + SwDrawTextInfo( ViewShell *pS, OutputDevice &rO, const SwScriptInfo* pSI, + const XubString &rSt, xub_StrLen nI, xub_StrLen nL, + sal_uInt16 nW = 0, sal_Bool bB = sal_False ) + { + pFrm = NULL; + pSh = pS; + pOut = &rO; + pScriptInfo = pSI; + pText = &rSt; + nIdx = nI; + nLen = nL; + nKern = 0; + nCompress = 0; + nWidth = nW; + nNumberOfBlanks = 0; + nCursorBidiLevel = 0; + bBullet = bB; + pUnderFnt = 0; + bGreyWave = sal_False; + bSpaceStop = sal_False; + bSnapToGrid = sal_False; + bIgnoreFrmRTL = sal_False; + bPosMatchesBounds = sal_False; + + // These values are initialized but, they have to be + // set explicitly via their Set-function before they may + // be accessed by their Get-function: + pPos = 0; + pWrong = 0; + pGrammarCheck = 0; + pSmartTags = 0; + pSize = 0; + pFnt = 0; + pHyphPos = 0; + nLeft = 0; + nRight = 0; + nKanaDiff = 0; + nOfst = 0; + nAscent = 0; + nSperren = 0; + nSpace = 0; + bUpper = sal_False; + bDrawSpace = sal_False; + +#ifdef DBG_UTIL + // these flags control, whether the matching member variables have + // been set by using the Set-function before they may be accessed + // by their Get-function: + bPos = bWrong = bGrammarCheck = bSize = bFnt = bAscent = bSpace = bNumberOfBlanks = bUppr = + bDrawSp = bLeft = bRight = bKana = bOfst = bHyph = bSperr = sal_False; +#endif + } + + const SwTxtFrm* GetFrm() const + { + return pFrm; + } + + void SetFrm( const SwTxtFrm* pNewFrm ) + { + pFrm = pNewFrm; + } + + ViewShell *GetShell() const + { + return pSh; + } + + OutputDevice& GetOut() const + { + return *pOut; + } + + OutputDevice *GetpOut() const + { + return pOut; + } + + const SwScriptInfo* GetScriptInfo() const + { + return pScriptInfo; + } + + const Point &GetPos() const + { + ASSERT( bPos, "DrawTextInfo: Undefined Position" ); + return *pPos; + } + + xub_StrLen *GetHyphPos() const + { + ASSERT( bHyph, "DrawTextInfo: Undefined Hyph Position" ); + return pHyphPos; + } + + const XubString &GetText() const + { + return *pText; + } + + const SwWrongList* GetWrong() const + { + ASSERT( bWrong, "DrawTextInfo: Undefined WrongList" ); + return pWrong; + } + + const SwWrongList* GetGrammarCheck() const + { + ASSERT( bGrammarCheck, "DrawTextInfo: Undefined GrammarCheck List" ); + return pGrammarCheck; + } + + const SwWrongList* GetSmartTags() const + { + return pSmartTags; + } + + const Size &GetSize() const + { + ASSERT( bSize, "DrawTextInfo: Undefined Size" ); + return *pSize; + } + + SwFont* GetFont() const + { + ASSERT( bFnt, "DrawTextInfo: Undefined Font" ); + return pFnt; + } + + SwUnderlineFont* GetUnderFnt() const + { + return pUnderFnt; + } + + xub_StrLen GetIdx() const + { + return nIdx; + } + + xub_StrLen GetLen() const + { + return nLen; + } + + xub_StrLen GetOfst() const + { + ASSERT( bOfst, "DrawTextInfo: Undefined Offset" ); + return nOfst; + } + + xub_StrLen GetEnd() const + { + return nIdx + nLen; + } + + long GetLeft() const + { + ASSERT( bLeft, "DrawTextInfo: Undefined left range" ); + return nLeft; + } + + long GetRight() const + { + ASSERT( bRight, "DrawTextInfo: Undefined right range" ); + return nRight; + } + + long GetKanaDiff() const + { + ASSERT( bKana, "DrawTextInfo: Undefined kana difference" ); + return nKanaDiff; + } + + sal_uInt16 GetWidth() const + { + return nWidth; + } + + sal_uInt16 GetAscent() const + { + ASSERT( bAscent, "DrawTextInfo: Undefined Ascent" ); + return nAscent; + } + + sal_uInt16 GetKanaComp() const + { + return nCompress; + } + + long GetSperren() const + { + ASSERT( bSperr, "DrawTextInfo: Undefined >Sperren<" ); + return nSperren; + } + + long GetKern() const + { + return nKern; + } + + long GetSpace() const + { + ASSERT( bSpace, "DrawTextInfo: Undefined Spacing" ); + return nSpace; + } + + xub_StrLen GetNumberOfBlanks() const + { + ASSERT( bNumberOfBlanks, "DrawTextInfo::Undefined NumberOfBlanks" ); + return nNumberOfBlanks; + } + + sal_uInt8 GetCursorBidiLevel() const + { + return nCursorBidiLevel; + } + + sal_Bool GetBullet() const + { + return bBullet; + } + + sal_Bool GetUpper() const + { + ASSERT( bUppr, "DrawTextInfo: Undefined Upperflag" ); + return bUpper; + } + + sal_Bool GetDrawSpace() const + { + ASSERT( bDrawSp, "DrawTextInfo: Undefined DrawSpaceflag" ); + return bDrawSpace; + } + + sal_Bool GetGreyWave() const + { + return bGreyWave; + } + + sal_Bool IsSpaceStop() const + { + return bSpaceStop; + } + + sal_Bool SnapToGrid() const + { + return bSnapToGrid; + } + + sal_Bool IsIgnoreFrmRTL() const + { + return bIgnoreFrmRTL; + } + + sal_Bool IsPosMatchesBounds() const + { + return bPosMatchesBounds; + } + + void SetOut( OutputDevice &rNew ) + { + pOut = &rNew; + } + + void SetPos( const Point &rNew ) + { + pPos = &rNew; +#ifdef DBG_UTIL + bPos = sal_True; +#endif + } + + void SetHyphPos( xub_StrLen *pNew ) + { + pHyphPos = pNew; +#ifdef DBG_UTIL + bHyph = sal_True; +#endif + } + + void SetText( const XubString &rNew ) + { + pText = &rNew; + } + + void SetWrong( const SwWrongList* pNew ) + { + pWrong = pNew; +#ifdef DBG_UTIL + bWrong = sal_True; +#endif + } + + void SetGrammarCheck( const SwWrongList* pNew ) + { + pGrammarCheck = pNew; +#ifdef DBG_UTIL + bGrammarCheck = sal_True; +#endif + } + + void SetSmartTags( const SwWrongList* pNew ) + { + pSmartTags = pNew; + } + + void SetSize( const Size &rNew ) + { + pSize = &rNew; +#ifdef DBG_UTIL + bSize = sal_True; +#endif + } + + void SetFont( SwFont* pNew ) + { + pFnt = pNew; +#ifdef DBG_UTIL + bFnt = sal_True; +#endif + } + + void SetIdx( xub_StrLen nNew ) + { + nIdx = nNew; + } + + void SetLen( xub_StrLen nNew ) + { + nLen = nNew; + } + + void SetOfst( xub_StrLen nNew ) + { + nOfst = nNew; +#ifdef DBG_UTIL + bOfst = sal_True; +#endif + } + + void SetLeft( long nNew ) + { + nLeft = nNew; +#ifdef DBG_UTIL + bLeft = sal_True; +#endif + } + + void SetRight( long nNew ) + { + nRight = nNew; +#ifdef DBG_UTIL + bRight = sal_True; +#endif + } + + void SetKanaDiff( long nNew ) + { + nKanaDiff = nNew; +#ifdef DBG_UTIL + bKana = sal_True; +#endif + } + + void SetWidth( sal_uInt16 nNew ) + { + nWidth = nNew; + } + + void SetAscent( sal_uInt16 nNew ) + { + nAscent = nNew; +#ifdef DBG_UTIL + bAscent = sal_True; +#endif + } + + void SetKern( long nNew ) + { + nKern = nNew; + } + + void SetSpace( long nNew ) + { + if( nNew < 0 ) + { + nSperren = -nNew; + nSpace = 0; + } + else + { + nSpace = nNew; + nSperren = 0; + } +#ifdef DBG_UTIL + bSpace = sal_True; + bSperr = sal_True; +#endif + } + + void SetNumberOfBlanks( xub_StrLen nNew ) + { +#ifdef DBG_UTIL + bNumberOfBlanks = sal_True; +#endif + nNumberOfBlanks = nNew; + } + + void SetCursorBidiLevel( sal_uInt8 nNew ) + { + nCursorBidiLevel = nNew; + } + + void SetKanaComp( short nNew ) + { + nCompress = nNew; + } + + void SetBullet( sal_Bool bNew ) + { + bBullet = bNew; + } + + void SetUnderFnt( SwUnderlineFont* pULFnt ) + { + pUnderFnt = pULFnt; + } + + void SetUpper( sal_Bool bNew ) + { + bUpper = bNew; +#ifdef DBG_UTIL + bUppr = sal_True; +#endif + } + + void SetDrawSpace( sal_Bool bNew ) + { + bDrawSpace = bNew; +#ifdef DBG_UTIL + bDrawSp = sal_True; +#endif + } + + void SetGreyWave( sal_Bool bNew ) + { + bGreyWave = bNew; + } + + void SetSpaceStop( sal_Bool bNew ) + { + bSpaceStop = bNew; + } + + void SetSnapToGrid( sal_Bool bNew ) + { + bSnapToGrid = bNew; + } + + void SetIgnoreFrmRTL( sal_Bool bNew ) + { + bIgnoreFrmRTL = bNew; + } + + void SetPosMatchesBounds( sal_Bool bNew ) + { + bPosMatchesBounds = bNew; + } + + void Shift( sal_uInt16 nDir ); + + // sets a new color at the output device if necessary + // if a font is passed as argument, the change if made to the font + // otherwise the font at the output device is changed + // returns if the font has been changed + sal_Bool ApplyAutoColor( Font* pFnt = 0 ); +}; + +#endif diff --git a/sw/source/core/inc/dview.hxx b/sw/source/core/inc/dview.hxx new file mode 100644 index 000000000000..60021d8fef84 --- /dev/null +++ b/sw/source/core/inc/dview.hxx @@ -0,0 +1,134 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _DVIEW_HXX +#define _DVIEW_HXX + + +#include <svx/fmview.hxx> + +class OutputDevice; +class SwViewImp; +class SwFrm; +class SwFlyFrm; +class SwAnchoredObject; + +class SwDrawView : public FmFormView +{ + //Fuer den Anker + Point aAnchorPoint; //Ankerposition + SwViewImp &rImp; //Die View gehoert immer zu einer Shell + + const SwFrm *CalcAnchor(); + + /** determine maximal order number for a 'child' object of given 'parent' object + + OD 2004-08-20 #110810# + The maximal order number will be determined on the current object + order hierarchy. It's the order number of the 'child' object with the + highest order number. The calculation can be influenced by parameter + <_pExclChildObj> - this 'child' object won't be considered. + + @param <_rParentObj> + input parameter - 'parent' object, for which the maximal order number + for its 'childs' will be determined. + + @param <_pExclChildObj> + optional input parameter - 'child' object, which will not be considered + on the calculation of the maximal order number + + @author OD + */ + sal_uInt32 _GetMaxChildOrdNum( const SwFlyFrm& _rParentObj, + const SdrObject* _pExclChildObj = 0L ) const; + + /** method to move 'repeated' objects of the given moved object to the + according level + + OD 2004-08-23 #110810# + + @param <_rMovedAnchoredObj> + input parameter - moved object, for which the 'repeated' ones have also + to be moved. + + @param <_rMovedChildsObjs> + input parameter - data collection of moved 'child' objects - the 'repeated' + ones of these 'childs' will also been moved. + + @author OD + */ + void _MoveRepeatedObjs( const SwAnchoredObject& _rMovedAnchoredObj, + const std::vector<SdrObject*>& _rMovedChildObjs ) const; + +protected: + // add custom handles (used by other apps, e.g. AnchorPos) + virtual void AddCustomHdl(); + + // overloaded to allow extra handling when picking SwVirtFlyDrawObj's + using FmFormView::CheckSingleSdrObjectHit; + virtual SdrObject* CheckSingleSdrObjectHit(const Point& rPnt, sal_uInt16 nTol, SdrObject* pObj, SdrPageView* pPV, sal_uLong nOptions, const SetOfByte* pMVisLay) const; + +public: + SwDrawView( SwViewImp &rI, SdrModel *pMd, OutputDevice* pOutDev=NULL ); + + //aus der Basisklasse + virtual SdrObject* GetMaxToTopObj(SdrObject* pObj) const; + virtual SdrObject* GetMaxToBtmObj(SdrObject* pObj) const; + virtual void MarkListHasChanged(); + + // #i7672# + // Overload to resue edit background color in active text edit view (OutlinerView) + virtual void ModelHasChanged(); + + virtual void ObjOrderChanged( SdrObject* pObj, sal_uLong nOldPos, + sal_uLong nNewPos ); + virtual sal_Bool TakeDragLimit(SdrDragMode eMode, Rectangle& rRect) const; + virtual void MakeVisible( const Rectangle&, Window &rWin ); + virtual void CheckPossibilities(); + + const SwViewImp &Imp() const { return rImp; } + SwViewImp &Imp() { return rImp; } + + //Anker und Xor fuer das Draggen. + void ShowDragAnchor(); + + virtual void DeleteMarked(); + + //JP 06.10.98: 2. Versuch + inline void ValidateMarkList() { FlushComeBackTimer(); } + + // --> OD 2009-03-05 #i99665# + sal_Bool IsAntiAliasing() const; + // <-- + + // OD 18.06.2003 #108784# - method to replace marked/selected <SwDrawVirtObj> + // by its reference object for delete of selection and group selection + static void ReplaceMarkedDrawVirtObjs( SdrMarkView& _rMarkView ); +}; + + +#endif + diff --git a/sw/source/core/inc/environmentofanchoredobject.hxx b/sw/source/core/inc/environmentofanchoredobject.hxx new file mode 100644 index 000000000000..00a1d509ece4 --- /dev/null +++ b/sw/source/core/inc/environmentofanchoredobject.hxx @@ -0,0 +1,117 @@ + /************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _ENVIRONMENTOFANCHOREDOBJECT_HXX +#define _ENVIRONMENTOFANCHOREDOBJECT_HXX + +class SwFrm; +class SwLayoutFrm; + +namespace objectpositioning +{ + class SwEnvironmentOfAnchoredObject + { + private: + const bool mbFollowTextFlow; + + public: + /** construtor + + OD 05.11.2003 + + @author OD + + @param _bFollowTextFlow + input parameter - indicates, if the anchored object, for which + this environment is instantiated, follow the text flow or not + */ + SwEnvironmentOfAnchoredObject( const bool _bFollowTextFlow ); + + /** destructor + + OD 05.11.2003 + + @author OD + */ + ~SwEnvironmentOfAnchoredObject(); + + /** determine environment layout frame for possible horizontal object + positions respectively for alignment to 'page areas' + + OD 05.11.2003 + this is, if object has to follow the text flow: + - cell frame, if anchored inside a cell + - fly frame, if anchored inside a fly frame + otherwise it's the page frame + + this is, if object hasn't to follow the text flow: + - page frame. + OD 2005-01-20 #118546# - no exception any more. Thus remove + parameter <_bForPageAlignment> + + @author OD + + @param _rHoriOrientFrm + input parameter - frame, at which the horizontal position is + oriented at (typically it's the anchor frame). + starting point for the search of the layout frame. + + @return reference to the layout frame, which determines the + the horizontal environment the object has to be positioned in. + */ + const SwLayoutFrm& GetHoriEnvironmentLayoutFrm( const SwFrm& _rHoriOrientFrm ) const; + + /** determine environment layout frame for possible vertical object + positions respectively for alignments to 'page areas' + + OD 05.11.2003 + this is, if object has to follow the text flow: + - cell frame, if anchored inside a cell + - fly frame, if anchored inside a fly frame + - header/footer frame, if anchored inside page header/footer + - footnote frame, if anchored inside footnote + otherwise it's the document body frame + + this is, if object hasn't to follow the text flow: + - page frame. + OD 2005-01-20 #118546# - no exception any more. Thus remove + parameter <_bForPageAlignment> + + @author OD + + @param _rVertOrientFrm + input parameter - frame, at which the vertical position is + oriented at (typically it's the anchor frame). + starting point for the search of the layout frame. + + @return reference to the layout frame, which determines the + the vertical environment the object has to be positioned in. + */ + const SwLayoutFrm& GetVertEnvironmentLayoutFrm( const SwFrm& _rVertOrientFrm ) const; + }; +} // namespace objectpositioning + +#endif diff --git a/sw/source/core/inc/fieldhint.hxx b/sw/source/core/inc/fieldhint.hxx new file mode 100644 index 000000000000..82955be53bc8 --- /dev/null +++ b/sw/source/core/inc/fieldhint.hxx @@ -0,0 +1,44 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _FIELDHINT_HXX +#define _FIELDHINT_HXX + +#include <svl/hint.hxx> + +class SwFieldHint : public SfxHint +{ + SwPaM* pPaM; +public: + SwFieldHint( SwPaM* p ) + : pPaM(p) + {} + + SwPaM* GetPaM() const { return pPaM; } +}; + +#endif diff --git a/sw/source/core/inc/finalthreadmanager.hxx b/sw/source/core/inc/finalthreadmanager.hxx new file mode 100644 index 000000000000..4d60514506c8 --- /dev/null +++ b/sw/source/core/inc/finalthreadmanager.hxx @@ -0,0 +1,105 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _FINALTHREADMANAGER_HXX +#define _FINALTHREADMANAGER_HXX + +#include "sal/config.h" +#include "cppuhelper/factory.hxx" +#include "cppuhelper/implementationentry.hxx" +#include "cppuhelper/implbase3.hxx" +#include "com/sun/star/lang/XServiceInfo.hpp" +#include "com/sun/star/util/XJobManager.hpp" +#include "com/sun/star/frame/XTerminateListener2.hpp" + + +#include <osl/mutex.hxx> + +#include <list> + +class CancelJobsThread; +class TerminateOfficeThread; +class SwPauseThreadStarting; + +// service helper namespace +namespace comp_FinalThreadManager { + +// component and service helper functions: +::rtl::OUString SAL_CALL _getImplementationName(); +com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL _getSupportedServiceNames(); +com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL _create( + com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > const & context ); + +} // closing service helper namespace + + +class FinalThreadManager : public ::cppu::WeakImplHelper3< com::sun::star::lang::XServiceInfo, + com::sun::star::util::XJobManager, + com::sun::star::frame::XTerminateListener2 > +{ +public: + explicit FinalThreadManager(com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > const & context); + + // ::com::sun::star::lang::XServiceInfo: + virtual ::rtl::OUString SAL_CALL getImplementationName() throw (com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL supportsService(const ::rtl::OUString & ServiceName) throw (com::sun::star::uno::RuntimeException); + virtual com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (com::sun::star::uno::RuntimeException); + + // ::com::sun::star::util::XJobManager: + virtual void SAL_CALL registerJob(const com::sun::star::uno::Reference< com::sun::star::util::XCancellable > & Job) throw (com::sun::star::uno::RuntimeException); + virtual void SAL_CALL releaseJob(const com::sun::star::uno::Reference< com::sun::star::util::XCancellable > & Job) throw (com::sun::star::uno::RuntimeException); + virtual void SAL_CALL cancelAllJobs() throw (com::sun::star::uno::RuntimeException); + + // ::com::sun::star::frame::XTerminateListener2 + virtual void SAL_CALL cancelTermination( const ::com::sun::star::lang::EventObject& Event ) throw (::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::frame::XTerminateListener (inherited via com::sun::star::frame::XTerminateListener2) + virtual void SAL_CALL queryTermination( const ::com::sun::star::lang::EventObject& Event ) throw (::com::sun::star::frame::TerminationVetoException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL notifyTermination( const ::com::sun::star::lang::EventObject& Event ) throw (::com::sun::star::uno::RuntimeException); + + // ::com::sun:star::lang::XEventListener (inherited via com::sun::star::frame::XTerminateListener) + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException); + +private: + FinalThreadManager(FinalThreadManager &); // not defined + void operator =(FinalThreadManager &); // not defined + + virtual ~FinalThreadManager(); + + void registerAsListenerAtDesktop(); + + com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_xContext; + + osl::Mutex maMutex; + + std::list< com::sun::star::uno::Reference< com::sun::star::util::XCancellable > > maThreads; + CancelJobsThread* mpCancelJobsThread; + TerminateOfficeThread* mpTerminateOfficeThread; + SwPauseThreadStarting* mpPauseThreadStarting; + + bool mbRegisteredAtDesktop; +}; +#endif diff --git a/sw/source/core/inc/flowfrm.hxx b/sw/source/core/inc/flowfrm.hxx new file mode 100644 index 000000000000..d1290c66e989 --- /dev/null +++ b/sw/source/core/inc/flowfrm.hxx @@ -0,0 +1,273 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _FLOWFRM_HXX +#define _FLOWFRM_HXX + +//Der FlowFrm gibt die Funktionalitaet fuer alle Frms vor, die fliessen und +//die sich aufspalten koennen (wie CntntFrm oder TabFrm). +//Teile der Funktionalitaet sind im FlowFrm implementiert, andere Teile werden +//von den spezifischen Frms implementiert. +//Der FlowFrm ist kein eigenstaender Frm, es kann also auch niemals eine +//eigenstaendige Instanz vom FlowFrm existieren. +//Der FlowFrm ist nicht einmal ein echter Frm. Die naheliegende Implementierung +//waere ein FlowFrm der virtual vom SwFrm abgeleitet ist und direkt auf den +//eigenen Instanzdaten arbeitet. Abgeleitete Klassen muessten sich +//vom FlowFrm und (ueber mehrere Basisklassen weil der Klassenbaum sich direkt +//vom SwFrm zu SwCntntFrm und zum SwLayoutFrm spaltet) virtual vom SwFrm +//ableiten. +//Leider entstehen dadurch - neben Problemen mit Compilern und Debuggern - +//erhebliche zusaetzliche Kosten, die wir uns heutzutage IMHO nicht erlauben +//koennen. +//Ich greife deshalb auf eine andere Technik zurueck: Der FlowFrm hat eine +//Referenz auf den SwFrm - der er genau betrachtet selbst ist - und ist mit +//diesem befreundet. So kann der FlowFrm anstelle des this-Pointer mit der +//Referenz auf den SwFrm arbeiten. + +//#include "frame.hxx" //fuer inlines + +class SwPageFrm; +class SwRect; +class SwBorderAttrs; +class SwDoc; +class SwNodeIndex; +// --> OD 2005-03-04 #i44049# +class SwObjectFormatterTxtFrm; +// <-- + +void MakeFrms( SwDoc *, const SwNodeIndex &, const SwNodeIndex & ); + +class SwFlowFrm +{ + //PrepareMake darf Locken/Unlocken (Robustheit) + friend inline void PrepareLock ( SwFlowFrm * ); + friend inline void PrepareUnlock( SwFlowFrm * ); + friend inline void TableSplitRecalcLock( SwFlowFrm * ); + friend inline void TableSplitRecalcUnlock( SwFlowFrm * ); + // --> OD 2005-03-04 #i44049# + friend class SwObjectFormatterTxtFrm; + // <-- + + //TblSel darf das Follow-Bit zuruecksetzen. + friend inline void UnsetFollow( SwFlowFrm *pFlow ); + + friend void MakeFrms( SwDoc *, const SwNodeIndex &, const SwNodeIndex & ); + + friend class SwNode2LayImpl; + + SwFrm &rThis; + + //Hilfsfunktionen fuer MoveSubTree() + static SwLayoutFrm *CutTree( SwFrm* ); + static sal_Bool PasteTree( SwFrm *, SwLayoutFrm *, SwFrm *, SwFrm* ); + + //Wird fuer das Zusammenspiel von _GetPrevxxx und MoveBwd gebraucht, damit + //mehrere Blaetter gleichzeitig uebersprungen werden koennen. + //Wird auch vom MoveBwd des TabFrm ausgewertet! + static sal_Bool bMoveBwdJump; + + /** helper method to determine previous frame for calculation of the + upper space + + OD 2004-03-10 #i11860# + + @param _pProposedPrevFrm + optional input parameter - pointer to frame, which should be used + instead of the direct previous frame. + + @author OD + */ + const SwFrm* _GetPrevFrmForUpperSpaceCalc( const SwFrm* _pProposedPrevFrm = 0L ) const; + + /** method to detemine the upper space amount, which is considered for + the previous frame + + OD 2004-03-11 #i11860# + + @author OD + */ + SwTwips _GetUpperSpaceAmountConsideredForPrevFrm() const; + + /** method to detemine the upper space amount, which is considered for + the page grid + + OD 2004-03-12 #i11860# + + @author OD + */ + SwTwips _GetUpperSpaceAmountConsideredForPageGrid( + const SwTwips _nUpperSpaceWithoutGrid ) const; + +protected: + + SwFlowFrm *pFollow; + + sal_Bool bIsFollow :1; //Ist's ein Follow + sal_Bool bLockJoin :1; //Join (und damit deleten) verboten wenn sal_True! + sal_Bool bUndersized:1; // wir sind kleiner als gewuenscht + sal_Bool bFtnAtEnd :1; // For sectionfrms only: footnotes at the end of section + sal_Bool bEndnAtEnd :1; // " " " : endnotes at the end of section + sal_Bool bCntntLock :1; // " " " : content locked + sal_Bool bOwnFtnNum :1; // " " " : special numbering of footnotes + sal_Bool bFtnLock :1; // " " " : ftn, don't leave this section bwd + sal_Bool bFlyLock :1; // Stop positioning of at-character flyframes + + //Prueft ob Vorwaertsfluss noch Sinn macht Endloswanderschaften (unterbinden) + inline sal_Bool IsFwdMoveAllowed(); + // --> OD 2005-03-08 #i44049# - method <CalcCntnt(..)> has to check this property. + friend void CalcCntnt( SwLayoutFrm *pLay, bool bNoColl, bool bNoCalcFollow ); + // <-- + sal_Bool IsKeepFwdMoveAllowed(); //Wie oben, Move fuer Keep. + + //Prueft ob ein Obj das Umlauf wuenscht ueberlappt. + //eine Null bedeutet, kein Objekt ueberlappt, + // 1 heisst, Objekte, die am FlowFrm selbst verankert sind, ueberlappen + // 2 heisst, Objekte, die woanders verankert sind, ueberlappen + // 3 heistt, beiderlei verankerte Objekte ueberlappen + sal_uInt8 BwdMoveNecessary( const SwPageFrm *pPage, const SwRect &rRect ); + + void LockJoin() { bLockJoin = sal_True; } + void UnlockJoin() { bLockJoin = sal_False; } + + sal_Bool CheckMoveFwd( sal_Bool &rbMakePage, sal_Bool bKeep, sal_Bool bMovedBwd ); + sal_Bool MoveFwd( sal_Bool bMakePage, sal_Bool bPageBreak, sal_Bool bMoveAlways = sal_False ); + virtual sal_Bool ShouldBwdMoved( SwLayoutFrm *pNewUpper, sal_Bool bHead, sal_Bool &rReformat )=0; + sal_Bool MoveBwd( sal_Bool &rbReformat ); + +public: + SwFlowFrm( SwFrm &rFrm ); + + const SwFrm *GetFrm() const { return &rThis; } + SwFrm *GetFrm() { return &rThis; } + + static sal_Bool IsMoveBwdJump() { return bMoveBwdJump; } + static void SetMoveBwdJump( sal_Bool bNew ){ bMoveBwdJump = bNew; } + + inline void SetUndersized( const sal_Bool bNew ) { bUndersized = bNew; } + inline sal_Bool IsUndersized() const { return bUndersized; } + + sal_Bool IsPrevObjMove() const; + + //Die Kette mit minimalen Operationen und Benachrichtigungen unter den + //neuen Parent Moven. + void MoveSubTree( SwLayoutFrm* pParent, SwFrm* pSibling = 0 ); + + sal_Bool HasFollow() const { return pFollow ? sal_True : sal_False; } + sal_Bool IsFollow() const { return bIsFollow; } + inline void _SetIsFollow( sal_Bool bSet ) { bIsFollow = bSet; } + const SwFlowFrm *GetFollow() const { return pFollow; } + SwFlowFrm *GetFollow() { return pFollow; } + sal_Bool IsAnFollow( const SwFlowFrm *pFlow ) const; + inline void SetFollow( SwFlowFrm *pNew ) { pFollow = pNew; } + + sal_Bool IsJoinLocked() const { return bLockJoin; } + sal_Bool IsAnyJoinLocked() const { return bLockJoin || HasLockedFollow(); } + sal_Bool IsFtnAtEnd() const { return bFtnAtEnd; } + sal_Bool IsEndnAtEnd() const { return bEndnAtEnd; } + sal_Bool IsAnyNoteAtEnd() const { return bFtnAtEnd || bEndnAtEnd; } + sal_Bool AreNotesAtEnd() const { return bFtnAtEnd && bEndnAtEnd; } + + sal_Bool IsPageBreak( sal_Bool bAct ) const; + sal_Bool IsColBreak( sal_Bool bAct ) const; + + //Ist ein Keep zu beruecksichtigen (Breaks!) + sal_Bool IsKeep( const SwAttrSet& rAttrs, bool bBreakCheck = false ) const; + + sal_Bool HasLockedFollow() const; + + sal_Bool HasParaSpaceAtPages( sal_Bool bSct ) const; + + /** method to determine the upper space hold by the frame + + OD 2004-03-12 #i11860# - add 3rd parameter <_bConsiderGrid> to get + the upper space with and without considering the page grid + (default value: <sal_True>) + + @author ? + */ + SwTwips CalcUpperSpace( const SwBorderAttrs *pAttrs = NULL, + const SwFrm* pPr = NULL, + const bool _bConsiderGrid = true ) const; + + /** method to determine the upper space amount, which is considered for + the previous frame and the page grid, if option 'Use former object + positioning' is OFF + + OD 2004-03-18 #i11860# + + @author OD + */ + SwTwips GetUpperSpaceAmountConsideredForPrevFrmAndPageGrid() const; + + /** calculation of lower space + + OD 2004-03-02 #106629# + + @author OD + */ + SwTwips CalcLowerSpace( const SwBorderAttrs* _pAttrs = 0L ) const; + + /** calculation of the additional space to be considered, if flow frame + is the last inside a table cell + + OD 2004-07-16 #i26250 + + @author OD + + @param _pAttrs + optional input parameter - border attributes of the flow frame. + Used for optimization, if caller has already determined the border + attributes. + + @return SwTwips + */ + SwTwips CalcAddLowerSpaceAsLastInTableCell( + const SwBorderAttrs* _pAttrs = 0L ) const; + + void CheckKeep(); + + void SetFtnLock( sal_Bool bNew ){ bFtnLock = bNew; } + sal_Bool IsFtnLock() const { return bFtnLock; } + void SetFlyLock( sal_Bool bNew ){ bFlyLock = bNew; } + sal_Bool IsFlyLock() const { return bFlyLock; } + void SetOwnFtnNum( sal_Bool bNew ){ bOwnFtnNum = bNew; } + sal_Bool IsOwnFtnNum() const { return bOwnFtnNum; } + void SetCntntLock( sal_Bool bNew ){ bCntntLock = bNew; } + sal_Bool IsCntntLocked() const { return bCntntLock; } + + //casten einen Frm auf einen FlowFrm - wenns denn einer ist, sonst 0 + //Diese Methoden muessen fuer neue Ableitungen geaendert werden! + static SwFlowFrm *CastFlowFrm( SwFrm *pFrm ); + static const SwFlowFrm *CastFlowFrm( const SwFrm *pFrm ); +}; + +inline sal_Bool SwFlowFrm::IsFwdMoveAllowed() +{ + return rThis.GetIndPrev() != 0; +} + + +#endif diff --git a/sw/source/core/inc/flyfrm.hxx b/sw/source/core/inc/flyfrm.hxx new file mode 100644 index 000000000000..ef2744aea127 --- /dev/null +++ b/sw/source/core/inc/flyfrm.hxx @@ -0,0 +1,297 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_FLYFRM_HXX +#define SW_FLYFRM_HXX + +#include "layfrm.hxx" +#include <list> +#include "frmfmt.hxx" + +class SwPageFrm; +class SwFmtFrmSize; +struct SwCrsrMoveState; +class SwBorderAttrs; +class SwVirtFlyDrawObj; +class SwSpzFrmFmts; +class SwAttrSetChg; +class PolyPolygon; +class SwFlyDrawContact; +class SwDrawContact; +class SwFmt; + +#include <anchoredobject.hxx> + +//Sucht ausgehend von pOldAnch einen Anker fuer Absatzgebundene Rahmen. +//Wird beim Draggen von Absatzgebundenen Objekten zur Ankeranzeige sowie +//fuer Ankerwechsel benoetigt. +//implementiert in layout/flycnt.cxx +const SwCntntFrm *FindAnchor( const SwFrm *pOldAnch, const Point &rNew, + const sal_Bool bBody = sal_False ); + +// berechnet das Rechteck, in dem das Objekt bewegt bzw. resized werden darf +sal_Bool CalcClipRect( const SdrObject *pSdrObj, SwRect &rRect, sal_Bool bMove = sal_True ); + +//allg. Basisklasse fuer alle Freifliegenden Rahmen +// OD 2004-03-22 #i26791# - inherit also from <SwAnchoredFlyFrm> +class SwFlyFrm : public SwLayoutFrm, public SwAnchoredObject +{ + //darf Locken. Definiert in frmtool.cxx + friend void AppendObjs ( const SwSpzFrmFmts *, sal_uLong, SwFrm *, SwPageFrm * ); + friend void Notify( SwFlyFrm *, SwPageFrm *pOld, const SwRect &rOld, + const SwRect* pOldPrt ); + + void InitDrawObj( sal_Bool bNotify ); //Wird von den CToren gerufen. + void FinitDrawObj(); //Wird vom CTor gerufen. + + void _UpdateAttr( const SfxPoolItem*, const SfxPoolItem*, sal_uInt8 &, + SwAttrSetChg *pa = 0, SwAttrSetChg *pb = 0 ); + + using SwLayoutFrm::CalcRel; + + sal_uInt32 _GetOrdNumForNewRef( const SwFlyDrawContact* ); + SwVirtFlyDrawObj* CreateNewRef( SwFlyDrawContact* ); + +protected: + + SwFlyFrm *pPrevLink, // Vorgaenger/Nachfolger fuer Verkettung mit + *pNextLink; // Textfluss + + // OD 2004-05-27 #i26791# - moved to <SwAnchoredObject> +// Point aRelPos; //Die Relative Position zum Master + +private: + sal_Bool bLocked :1; //Cntnt-gebundene Flys muessen derart blockiert werden + //koennen, dass sie nicht Formatiert werden; :MakeAll + //returnt dann sofort. Dies ist bei Seitenwechseln + //waehrend der Formatierung notwendig. + //Auch wahrend des RootCTors ist dies notwendig da + //sonst der Anker formatiert wird obwohl die Root noch + //nicht korrekt an der Shell haengt und weil sonst + //initial zuviel Formatiert wuerde. + sal_Bool bNotifyBack:1; //sal_True wenn am Ende eines MakeAll() der Background + //vom NotifyDTor benachrichtigt werden muss. +protected: + + sal_Bool bInvalid :1; //Pos, PrtArea od. SSize wurden Invalidiert, sie werden + //gleich wieder Validiert, denn sie muessen _immer_ + //gueltig sein. Damit in LayAction korrekt gearbeitet + //werden kann muss hier festgehalten werden, dass sie + //invalidiert wurden. Ausnahmen bestaetigen die Regelt! + sal_Bool bMinHeight:1; //sal_True wenn die vom Attribut vorgegebene Hoehe eine + //eine Minimalhoehe ist (der Frm also bei Bedarf + //darueberhinaus wachsen kann). + sal_Bool bHeightClipped :1; //sal_True wenn der Fly nicht die Pos/Size anhand der Attrs + sal_Bool bWidthClipped :1; //formatieren konnte, weil z.B. nicht genug Raum vorh. + //war. + sal_Bool bFormatHeightOnly :1; //Damit nach einer Anpassung der Breite + //(CheckClip) nur das Format aufgerufen wird; + //nicht aber die Breite anhand der Attribute + //wieder bestimmt wird. + sal_Bool bInCnt :1; // FLY_AS_CHAR, anchored as character + sal_Bool bAtCnt :1; // FLY_AT_PARA, anchored at paragraph + sal_Bool bLayout :1; // FLY_AT_PAGE, FLY_AT_FLY, at page or at frame + sal_Bool bAutoPosition :1; // FLY_AT_CHAR, anchored at character + sal_Bool bNoShrink :1; // temporary forbud of shrinking to avoid loops + sal_Bool bLockDeleteContent :1; // If the flag is set, the content of the + // fly frame is not deleted if moved to + // invisible layer. + + friend class SwNoTxtFrm; // Darf NotifyBackground rufen +// virtual void NotifyBackground( SwPageFrm *pPage, +// const SwRect& rRect, PrepareHint eHint) = 0; + + virtual void Format( const SwBorderAttrs *pAttrs = 0 ); + void MakePrtArea( const SwBorderAttrs &rAttrs ); + + void Lock() { bLocked = sal_True; } + void Unlock() { bLocked = sal_False; } + + void SetMinHeight() { bMinHeight = sal_True; } + void ResetMinHeight(){ bMinHeight = sal_False; } + + Size CalcRel( const SwFmtFrmSize &rSz ) const; + SwTwips CalcAutoWidth() const; + + SwFlyFrm( SwFlyFrmFmt*, SwFrm*, SwFrm *pAnchor ); + + /** method to assure that anchored object is registered at the correct + page frame + + OD 2004-07-02 #i28701# + + @author OD + */ + virtual void RegisterAtCorrectPage(); + + virtual bool _SetObjTop( const SwTwips _nTop ); + virtual bool _SetObjLeft( const SwTwips _nLeft ); + + virtual const SwRect GetObjBoundRect() const; + virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ); + +public: + // OD 2004-03-23 #i26791# + TYPEINFO(); + + virtual ~SwFlyFrm(); + // erfrage vom Client Informationen + virtual sal_Bool GetInfo( SfxPoolItem& ) const; + virtual void Paint( SwRect const&, + SwPrintData const*const pPrintData = NULL ) const; + virtual Size ChgSize( const Size& aNewSize ); + virtual sal_Bool GetCrsrOfst( SwPosition *, Point&, + SwCrsrMoveState* = 0 ) const; + + virtual void CheckDirection( sal_Bool bVert ); + virtual void Cut(); +#ifdef DBG_UTIL + virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 ); +#endif + + SwTwips _Shrink( SwTwips, sal_Bool bTst ); + SwTwips _Grow ( SwTwips, sal_Bool bTst ); + void _Invalidate( SwPageFrm *pPage = 0 ); + + sal_Bool FrmSizeChg( const SwFmtFrmSize & ); + + SwFlyFrm *GetPrevLink() const { return pPrevLink; } + SwFlyFrm *GetNextLink() const { return pNextLink; } + + static void ChainFrames( SwFlyFrm *pMaster, SwFlyFrm *pFollow ); + static void UnchainFrames( SwFlyFrm *pMaster, SwFlyFrm *pFollow ); + + SwFlyFrm *FindChainNeighbour( SwFrmFmt &rFmt, SwFrm *pAnch = 0 ); + + // OD 2004-03-24 #i26791# + const SwVirtFlyDrawObj* GetVirtDrawObj() const; + SwVirtFlyDrawObj *GetVirtDrawObj(); + void NotifyDrawObj(); + + void ChgRelPos( const Point &rAbsPos ); + sal_Bool IsInvalid() const { return bInvalid; } + void Invalidate() const { ((SwFlyFrm*)this)->bInvalid = sal_True; } + void Validate() const { ((SwFlyFrm*)this)->bInvalid = sal_False; } + + sal_Bool IsMinHeight() const { return bMinHeight; } + sal_Bool IsLocked() const { return bLocked; } + sal_Bool IsAutoPos() const { return bAutoPosition; } + sal_Bool IsFlyInCntFrm() const { return bInCnt; } + sal_Bool IsFlyFreeFrm() const { return bAtCnt || bLayout; } + sal_Bool IsFlyLayFrm() const { return bLayout; } + sal_Bool IsFlyAtCntFrm() const { return bAtCnt; } + + sal_Bool IsNotifyBack() const { return bNotifyBack; } + void SetNotifyBack() { bNotifyBack = sal_True; } + void ResetNotifyBack() { bNotifyBack = sal_False; } + sal_Bool IsNoShrink() const { return bNoShrink; } + void SetNoShrink( sal_Bool bNew ) { bNoShrink = bNew; } + sal_Bool IsLockDeleteContent() const { return bLockDeleteContent; } + void SetLockDeleteContent( sal_Bool bNew ) { bLockDeleteContent = bNew; } + + + sal_Bool IsClipped() const { return bHeightClipped || bWidthClipped; } + sal_Bool IsHeightClipped() const { return bHeightClipped; } + sal_Bool IsWidthClipped() const { return bWidthClipped; } + + sal_Bool IsLowerOf( const SwLayoutFrm* pUpper ) const; + inline sal_Bool IsUpperOf( const SwFlyFrm& _rLower ) const + { + return _rLower.IsLowerOf( this ); + } + + SwFrm *FindLastLower(); + + // OD 16.04.2003 #i13147# - add parameter <_bForPaint> to avoid load of + // the graphic during paint. Default value: sal_False + sal_Bool GetContour( PolyPolygon& rContour, + const sal_Bool _bForPaint = sal_False ) const; + + + //Auf dieser Shell painten (PreView, Print-Flag usw. rekursiv beachten)?. + static sal_Bool IsPaint( SdrObject *pObj, const ViewShell *pSh ); + + /** SwFlyFrm::IsBackgroundTransparent - for feature #99657# + + OD 12.08.2002 + determines, if background of fly frame has to be drawn transparent + definition found in /core/layout/paintfrm.cxx + + @author OD + + @return true, if background color is transparent or a existing background + graphic is transparent. + */ + sal_Bool IsBackgroundTransparent() const; + + /** SwFlyFrm::IsShadowTransparent - for feature #99657# + + OD 05.08.2002 + determine, if shadow color of fly frame has to be drawn transparent + definition found in /core/layout/paintfrm.cxx + + @author OD + + @return true, if shadow color is transparent. + */ + sal_Bool IsShadowTransparent() const; + + // OD 2004-01-19 #110582# + void Chain( SwFrm* _pAnchor ); + void Unchain(); + void InsertCnt(); + void DeleteCnt(); + // OD 2004-02-12 #110582#-2 + void InsertColumns(); + + // OD 2004-03-23 #i26791# - pure virtual methods of base class <SwAnchoredObject> + virtual void MakeObjPos(); + virtual void InvalidateObjPos(); + + virtual SwFrmFmt& GetFrmFmt(); + virtual const SwFrmFmt& GetFrmFmt() const; + + virtual const SwRect GetObjRect() const; + + /** method to determine, if a format on the Writer fly frame is possible + + OD 2004-05-11 #i28701# + refine 'IsFormatPossible'-conditions of method + <SwAnchoredObject::IsFormatPossible()> by: + format isn't possible, if Writer fly frame is locked resp. col-locked. + + @author OD + */ + virtual bool IsFormatPossible() const; + static void GetAnchoredObjects( std::list<SwAnchoredObject*>&, const SwFmt& rFmt ); + + // overwriting "SwFrmFmt *SwLayoutFrm::GetFmt" to provide the correct derived return type. + // (This is in order to skip on the otherwise necessary casting of the result to + // 'SwFlyFrmFmt *' after calls to this function. The casting is now done in this function.) + virtual const SwFlyFrmFmt *GetFmt() const; + virtual SwFlyFrmFmt *GetFmt(); +}; +#endif diff --git a/sw/source/core/inc/flyfrms.hxx b/sw/source/core/inc/flyfrms.hxx new file mode 100644 index 000000000000..a0a2d9dd1619 --- /dev/null +++ b/sw/source/core/inc/flyfrms.hxx @@ -0,0 +1,257 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _FLYFRMS_HXX +#define _FLYFRMS_HXX +#include "flyfrm.hxx" +// --> OD 2004-06-23 #i28701# +class SwFlyAtCntFrm; + +//Basisklasse fuer diejenigen Flys, die sich relativ frei Bewegen koennen - +//also die nicht _im_ Inhalt gebundenen Flys. +class SwFlyFreeFrm : public SwFlyFrm +{ + SwPageFrm *pPage; //Bei dieser Seite ist der Fly angemeldet. + + // --> OD 2004-11-15 #i34753# - flag for at-page anchored Writer fly frames + // to prevent a positioning - call of method <MakeObjPos()> -, if Writer + // fly frame is already clipped during its format by the object formatter. + bool mbNoMakePos; + // <-- + // --> OD 2004-11-12 #i37068# - flag to prevent move in method + // <CheckClip(..)> + bool mbNoMoveOnCheckClip; + // <-- + void CheckClip( const SwFmtFrmSize &rSz ); //'Emergency' Clipping. + + /** determines, if direct environment of fly frame has 'auto' size + + OD 07.08.2003 #i17297#, #111066#, #111070# + start with anchor frame and search for a header, footer, row or fly frame + stopping at page frame. + return <true>, if such a frame is found and it has 'auto' size. + otherwise <false> is returned. + + @author OD + + @return boolean indicating, that direct environment has 'auto' size + */ + bool HasEnvironmentAutoSize() const; + +protected: + // OD 2004-05-12 #i28701# - new friend class <SwFlyNotify> for access to + // method <NotifyBackground> + friend class SwFlyNotify; + virtual void NotifyBackground( SwPageFrm *pPage, + const SwRect& rRect, PrepareHint eHint); + + SwFlyFreeFrm( SwFlyFrmFmt*, SwFrm*, SwFrm *pAnchor ); + +public: + // --> OD 2004-06-29 #i28701# + TYPEINFO(); + + virtual ~SwFlyFreeFrm(); + + virtual void MakeAll(); + + // --> OD 2004-11-12 #i37068# - accessors for member <mbNoMoveOnCheckClip> + inline void SetNoMoveOnCheckClip( const bool _bNewNoMoveOnCheckClip ) + { + mbNoMoveOnCheckClip = _bNewNoMoveOnCheckClip; + } + inline bool IsNoMoveOnCheckClip() const + { + return mbNoMoveOnCheckClip; + } + // <-- + // --> OD 2004-11-15 #i34753# - accessors for member <mbNoMakePos> + inline void SetNoMakePos( const bool _bNoMakePos ) + { + if ( IsFlyLayFrm() ) + { + mbNoMakePos = _bNoMakePos; + } + } + inline bool IsNoMakePos() const + { + if ( IsFlyLayFrm() ) + { + return mbNoMakePos; + } + else + { + return false; + } + } + // <-- + + /** method to determine, if a format on the Writer fly frame is possible + + OD 2004-05-11 #i28701# + refine 'IsFormatPossible'-conditions of method + <SwFlyFrm::IsFormatPossible()> by: + format isn't possible, if Writer fly frame isn't registered at a page frame + and its anchor frame isn't inside another Writer fly frame. + + @author OD + */ + virtual bool IsFormatPossible() const; +}; + + +//Die Fly's, die an einem Layoutfrm haengen und nicht inhaltsgebunden sind +class SwFlyLayFrm : public SwFlyFreeFrm +{ +public: + // --> OD 2004-06-29 #i28701# + TYPEINFO(); + + SwFlyLayFrm( SwFlyFrmFmt*, SwFrm*, SwFrm *pAnchor ); + SwFlyLayFrm( SwFlyLayFrm& ); +protected: + virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ); +}; + +//Die Flys, die an einem Cntnt haengen nicht aber im Inhalt +class SwFlyAtCntFrm : public SwFlyFreeFrm +{ +protected: + virtual void MakeAll(); + + // OD 2004-05-12 #i28701# + virtual bool _InvalidationAllowed( const InvalidationType _nInvalid ) const; + + /** method to assure that anchored object is registered at the correct + page frame + + OD 2004-07-02 #i28701# + + @author OD + */ + virtual void RegisterAtCorrectPage(); + virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ); + +public: + // --> OD 2004-06-29 #i28701# + TYPEINFO(); + + SwFlyAtCntFrm( SwFlyFrmFmt*, SwFrm*, SwFrm *pAnchor ); + + void SetAbsPos( const Point &rNew ); + + // OD 2004-03-23 #i26791# + virtual void MakeObjPos(); + + /** method to determine, if a format on the Writer fly frame is possible + + OD 2004-05-11 #i28701# + refine 'IsFormatPossible'-conditions of method + <SwFlyFreeFrm::IsFormatPossible()> by: + format isn't possible, if method <MakeAll()> is already in progress. + + @author OD + */ + virtual bool IsFormatPossible() const; +}; + +//Die Flys, die an einem Zeichen in einem Cntnt haengen. +class SwFlyInCntFrm : public SwFlyFrm +{ + Point aRef; //Relativ zu diesem Point wird die AbsPos berechnet. + long nLine; //Zeilenhoehe, Ref.Y() - nLine == Zeilenanfang. + + sal_Bool bInvalidLayout :1; + sal_Bool bInvalidCntnt :1; + +protected: + virtual void NotifyBackground( SwPageFrm *pPage, + const SwRect& rRect, PrepareHint eHint); + virtual void MakeAll(); + virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ); + +public: + // --> OD 2004-06-29 #i28701# + TYPEINFO(); + + SwFlyInCntFrm( SwFlyFrmFmt*, SwFrm*, SwFrm *pAnchor ); + + virtual ~SwFlyInCntFrm(); + virtual void Format( const SwBorderAttrs *pAttrs = 0 ); + + void SetRefPoint( const Point& rPoint, const Point &rRelAttr, + const Point &rRelPos ); + const Point &GetRefPoint() const { return aRef; } + const Point GetRelPos() const; + long GetLineHeight() const { return nLine; } + + inline void InvalidateLayout() const; + inline void InvalidateCntnt() const; + inline void ValidateLayout() const; + inline void ValidateCntnt() const; + sal_Bool IsInvalid() const { return (bInvalidLayout || bInvalidCntnt); } + sal_Bool IsInvalidLayout() const { return bInvalidLayout; } + sal_Bool IsInvalidCntnt() const { return bInvalidCntnt; } + + + //BP 26.11.93: vgl. tabfrm.hxx, gilt bestimmt aber fuer andere auch... + //Zum Anmelden der Flys nachdem ein FlyCnt erzeugt _und_ eingefuegt wurde. + //Muss vom Erzeuger gerufen werden, denn erst nach dem Konstruieren wird + //Das Teil gepastet; mithin ist auch erst dann die Seite zum Anmelden der + //Flys erreichbar. + void RegistFlys(); + + //siehe layact.cxx + void AddRefOfst( long nOfst ) { aRef.Y() += nOfst; } + + // OD 2004-03-23 #i26791# + virtual void MakeObjPos(); + + // --> OD 2004-12-02 #115759# - invalidate anchor frame on invalidation + // of the position, because the position is calculated during the + // format of the anchor frame + virtual void _ActionOnInvalidation( const InvalidationType _nInvalid ); + // <-- +}; + +inline void SwFlyInCntFrm::InvalidateLayout() const +{ + ((SwFlyInCntFrm*)this)->bInvalidLayout = sal_True; +} +inline void SwFlyInCntFrm::InvalidateCntnt() const +{ + ((SwFlyInCntFrm*)this)->bInvalidCntnt = sal_True; +} +inline void SwFlyInCntFrm::ValidateLayout() const +{ + ((SwFlyInCntFrm*)this)->bInvalidLayout = sal_False; +} +inline void SwFlyInCntFrm::ValidateCntnt() const +{ + ((SwFlyInCntFrm*)this)->bInvalidCntnt = sal_False; +} + +#endif diff --git a/sw/source/core/inc/fntcache.hxx b/sw/source/core/inc/fntcache.hxx new file mode 100644 index 000000000000..c95fc3f0a8bc --- /dev/null +++ b/sw/source/core/inc/fntcache.hxx @@ -0,0 +1,160 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _FNTCACHE_HXX +#define _FNTCACHE_HXX + +#include <vcl/font.hxx> +#include <tools/mempool.hxx> + +#include "swtypes.hxx" +#include "swcache.hxx" + +class Printer; +class OutputDevice; +class FontMetric; +class SwFntObj; +class SwDrawTextInfo; // DrawText +class ViewShell; +class SwSubFont; +class MapMode; + +/************************************************************************* + * class SwFntCache + *************************************************************************/ + +class SwFntCache : public SwCache +{ +public: + + inline SwFntCache() : SwCache(50,50 +#ifdef DBG_UTIL + , ByteString( RTL_CONSTASCII_STRINGPARAM( + "Globaler Font-Cache pFntCache" )) +#endif + ) {} + + inline SwFntObj *First( ) { return (SwFntObj *)SwCache::First(); } + inline SwFntObj *Next( SwFntObj *pFntObj) + { return (SwFntObj *)SwCache::Next( (SwCacheObj *)pFntObj ); } + void Flush(); +}; + +// Font-Cache, globale Variable, in txtinit.Cxx angelegt/zerstoert +extern SwFntCache *pFntCache; +extern SwFntObj *pLastFont; +extern sal_uInt8 *pMagicNo; +extern Color *pWaveCol; + +/************************************************************************* + * class SwFntObj + *************************************************************************/ + +class SwFntObj : public SwCacheObj +{ + friend class SwFntAccess; + friend void _InitCore(); + friend void _FinitCore(); + + Font aFont; + Font *pScrFont; + Font *pPrtFont; + OutputDevice* pPrinter; + sal_uInt16 nGuessedLeading; + sal_uInt16 nExtLeading; + sal_uInt16 nScrAscent; + sal_uInt16 nPrtAscent; + sal_uInt16 nScrHeight; + sal_uInt16 nPrtHeight; + sal_uInt16 nPropWidth; + sal_uInt16 nZoom; + sal_Bool bSymbol : 1; + sal_Bool bPaintBlank : 1; + + static long nPixWidth; + static MapMode *pPixMap; + static OutputDevice *pPixOut; + + // SMARTTAGS + void calcLinePos(SwDrawTextInfo& rInf, Point& aStart, Point& aEnd, xub_StrLen nStart, + xub_StrLen nWrLen, xub_StrLen nCnt, const sal_Bool bSwitchH2V, const sal_Bool bSwitchL2R, + long nHalfSpace, long* pKernArray, const sal_Bool bBidiPor); + +public: + DECL_FIXEDMEMPOOL_NEWDEL(SwFntObj) + + SwFntObj( const SwSubFont &rFont, const void* pOwner, + ViewShell *pSh ); + + virtual ~SwFntObj(); + + inline Font *GetScrFont() { return pScrFont; } + inline Font *GetFont() { return &aFont; } + inline const Font *GetFont() const { return &aFont; } + + inline sal_uInt16 GetGuessedLeading() const { return nGuessedLeading; } + inline sal_uInt16 GetExtLeading() const { return nExtLeading; } + + sal_uInt16 GetFontAscent( const ViewShell *pSh, const OutputDevice& rOut ); + sal_uInt16 GetFontHeight( const ViewShell *pSh, const OutputDevice& rOut ); + sal_uInt16 GetFontLeading( const ViewShell *pSh, const OutputDevice& rOut ); + + void GuessLeading( const ViewShell& rSh, const FontMetric& rMet ); + + void SetDevFont( const ViewShell *pSh, OutputDevice& rOut ); + inline OutputDevice* GetPrt() const { return pPrinter; } + inline sal_uInt16 GetZoom() const { return nZoom; } + inline sal_uInt16 GetPropWidth() const { return nPropWidth; } + inline sal_Bool IsSymbol() const { return bSymbol; } + + void DrawText( SwDrawTextInfo &rInf ); + Size GetTextSize( SwDrawTextInfo &rInf ); + xub_StrLen GetCrsrOfst( SwDrawTextInfo &rInf ); + + void CreateScrFont( const ViewShell& rSh, const OutputDevice& rOut ); + void CreatePrtFont( const OutputDevice& rOut ); +}; + +/************************************************************************* + * class SwFntAccess + *************************************************************************/ + + +class SwFntAccess : public SwCacheAccess +{ + ViewShell *pShell; +protected: + virtual SwCacheObj *NewObj( ); + +public: + SwFntAccess( const void * &rMagic, sal_uInt16 &rIndex, const void *pOwner, + ViewShell *pShell, + sal_Bool bCheck = sal_False ); + inline SwFntObj* Get() { return (SwFntObj*) SwCacheAccess::Get(); }; +}; + + +#endif diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx new file mode 100644 index 000000000000..f7967a94b447 --- /dev/null +++ b/sw/source/core/inc/frame.hxx @@ -0,0 +1,1302 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_FRAME_HXX +#define SW_FRAME_HXX + +#include <svl/svarray.hxx> +#include "swtypes.hxx" // fuer SwTwips +#include "swrect.hxx" +#include "calbck.hxx" // fuer SwClient +#include <svl/brdcst.hxx> + +class SwLayoutFrm; +class SwRootFrm; +class SwPageFrm; +class SwFlyFrm; +class SwSectionFrm; +class SdrObject; +class SwFtnFrm; +class SwFtnBossFrm; +class SwTabFrm; +class SwRowFrm; +class SwFlowFrm; +class SwCntntFrm; +class SfxPoolItem; +class SwAttrSet; +class ViewShell; +class Color; +class SwBorderAttrs; +class SwCache; +class SvxBrushItem; +class SwSelectionList; +struct SwPosition; +struct SwCrsrMoveState; +class SwFmt; +class SwPrintData; +class SwSortedObjs; +class SwAnchoredObject; + +//Jeder FrmTyp findet sich hier in einem Bit wieder. +//Die Bits muessen so gesetzt werden, dass mit einer Maskierung festgestellt +//werden kann was fuer ein FrmTyp eine Instanz ist _und_ von welchen Klassen +//sie abgeleitet ist. +//Der Frm hat in der Basisklasse einen Member der von den CToren der +//einzelnen Frms entsprechend gesetzt werden muss. +#define FRM_ROOT 0x0001 +#define FRM_PAGE 0x0002 +#define FRM_COLUMN 0x0004 +#define FRM_HEADER 0x0008 +#define FRM_FOOTER 0x0010 +#define FRM_FTNCONT 0x0020 +#define FRM_FTN 0x0040 +#define FRM_BODY 0x0080 +#define FRM_FLY 0x0100 +#define FRM_SECTION 0x0200 +#define FRM_UNUSED 0x0400 +#define FRM_TAB 0x0800 +#define FRM_ROW 0x1000 +#define FRM_CELL 0x2000 +#define FRM_TXT 0x4000 +#define FRM_NOTXT 0x8000 + +//Fuer den internen Gebrauch ein paar gebraeuchliche Verknuepfungen. +#define FRM_LAYOUT 0x3FFF +#define FRM_CNTNT 0xC000 +#define FRM_FTNBOSS 0x0006 +#define FRM_ACCESSIBLE (FRM_HEADER|FRM_FOOTER|FRM_FTN|FRM_TXT|FRM_ROOT|FRM_FLY|FRM_TAB|FRM_CELL|FRM_PAGE) + + //Weils so schon ist das ganze als Bitfeld.... +//0000 0000 0000 0001 ROOT +//0000 0000 0000 0010 PAGE +//0000 0000 0000 0100 COLUMN +//0000 0000 0000 1000 HEADER +//0000 0000 0001 0000 FOOTER +//0000 0000 0010 0000 FTNCONT +//0000 0000 0100 0000 FTN +//0000 0000 1000 0000 BODY +//0000 0001 0000 0000 FLY +//0000 0010 0000 0000 SECTION +//0000 0100 0000 0000 UNUSED +//0000 1000 0000 0000 TAB +//0001 0000 0000 0000 ROW +//0010 0000 0000 0000 CELL +//0100 0000 0000 0000 TXT +//1000 0000 0000 0000 NOTXT + +// The type of the frame is internal represented by the 4-bit value nType, +// which can expanded to the types above by shifting a bit (0x1 << nType) +// Here are the corresponding defines for the compressed representation: + +#define FRMC_ROOT 0 +#define FRMC_PAGE 1 +#define FRMC_COLUMN 2 +#define FRMC_HEADER 3 +#define FRMC_FOOTER 4 +#define FRMC_FTNCONT 5 +#define FRMC_FTN 6 +#define FRMC_BODY 7 +#define FRMC_FLY 8 +#define FRMC_SECTION 9 +#define FRMC_UNUSED 10 +#define FRMC_TAB 11 +#define FRMC_ROW 12 +#define FRMC_CELL 13 +#define FRMC_TXT 14 +#define FRMC_NOTXT 15 + +#define FRM_NEIGHBOUR 0x2004 +#define FRM_NOTE_VERT 0x7a60 +#define FRM_HEADFOOT 0x0018 +#define FRM_BODYFTNC 0x00a0 + +class SwFrm; +typedef long (SwFrm:: *SwFrmGet)() const; +typedef sal_Bool (SwFrm:: *SwFrmMax)( long ); +typedef void (SwFrm:: *SwFrmMakePos)( const SwFrm*, const SwFrm*, sal_Bool ); +typedef long (*SwOperator)( long, long ); +typedef void (SwFrm:: *SwFrmSet)( long, long ); + +struct SwRectFnCollection +{ + SwRectGet fnGetTop; + SwRectGet fnGetBottom; + SwRectGet fnGetLeft; + SwRectGet fnGetRight; + SwRectGet fnGetWidth; + SwRectGet fnGetHeight; + SwRectPoint fnGetPos; + SwRectSize fnGetSize; + + SwRectSet fnSetTop; + SwRectSet fnSetBottom; + SwRectSet fnSetLeft; + SwRectSet fnSetRight; + SwRectSet fnSetWidth; + SwRectSet fnSetHeight; + + SwRectSet fnSubTop; + SwRectSet fnAddBottom; + SwRectSet fnSubLeft; + SwRectSet fnAddRight; + SwRectSet fnAddWidth; + SwRectSet fnAddHeight; + + SwRectSet fnSetPosX; + SwRectSet fnSetPosY; + + SwFrmGet fnGetTopMargin; + SwFrmGet fnGetBottomMargin; + SwFrmGet fnGetLeftMargin; + SwFrmGet fnGetRightMargin; + SwFrmSet fnSetXMargins; + SwFrmSet fnSetYMargins; + SwFrmGet fnGetPrtTop; + SwFrmGet fnGetPrtBottom; + SwFrmGet fnGetPrtLeft; + SwFrmGet fnGetPrtRight; + SwRectDist fnTopDist; + SwRectDist fnBottomDist; + SwRectDist fnLeftDist; + SwRectDist fnRightDist; + SwFrmMax fnSetLimit; + SwRectMax fnOverStep; + + SwRectSetPos fnSetPos; + SwFrmMakePos fnMakePos; + SwOperator fnXDiff; + SwOperator fnYDiff; + SwOperator fnXInc; + SwOperator fnYInc; + + SwRectSetTwice fnSetLeftAndWidth; + SwRectSetTwice fnSetTopAndHeight; +}; + +typedef SwRectFnCollection* SwRectFn; +/* +extern SwRectFn fnRectHori, fnRectVert, fnRectB2T, fnRectVL2R; +#define SWRECTFN( pFrm ) sal_Bool bVert = pFrm->IsVertical(); \ + sal_Bool bRev = pFrm->IsReverse(); \ + SwRectFn fnRect = bVert ? \ + ( bRev ? fnRectVL2R : fnRectVert ): \ + ( bRev ? fnRectB2T : fnRectHori ); +#define SWRECTFNX( pFrm ) sal_Bool bVertX = pFrm->IsVertical(); \ + sal_Bool bRevX = pFrm->IsReverse(); \ + SwRectFn fnRectX = bVertX ? \ + ( bRevX ? fnRectVL2R : fnRectVert ): \ + ( bRevX ? fnRectB2T : fnRectHori ); +#define SWREFRESHFN( pFrm ) { if( bVert != pFrm->IsVertical() || \ + bRev != pFrm->IsReverse() ) \ + bVert = pFrm->IsVertical(); \ + bRev = pFrm->IsReverse(); \ + fnRect = bVert ? \ + ( bRev ? fnRectVL2R : fnRectVert ): \ + ( bRev ? fnRectB2T : fnRectHori ); } +#define SWRECTFN2( pFrm ) sal_Bool bVert = pFrm->IsVertical(); \ + sal_Bool bNeighb = pFrm->IsNeighbourFrm(); \ + SwRectFn fnRect = bVert == bNeighb ? \ + fnRectHori : fnRectVert; +*/ + +//Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin +extern SwRectFn fnRectHori, fnRectVert, fnRectB2T, fnRectVL2R, fnRectVertL2R; +#define SWRECTFN( pFrm ) sal_Bool bVert = pFrm->IsVertical(); \ + sal_Bool bRev = pFrm->IsReverse(); \ + sal_Bool bVertL2R = pFrm->IsVertLR(); \ + SwRectFn fnRect = bVert ? \ + ( bRev ? fnRectVL2R : ( bVertL2R ? fnRectVertL2R : fnRectVert ) ): \ + ( bRev ? fnRectB2T : fnRectHori ); +#define SWRECTFNX( pFrm ) sal_Bool bVertX = pFrm->IsVertical(); \ + sal_Bool bRevX = pFrm->IsReverse(); \ + sal_Bool bVertL2RX = pFrm->IsVertLR(); \ + SwRectFn fnRectX = bVertX ? \ + ( bRevX ? fnRectVL2R : ( bVertL2RX ? fnRectVertL2R : fnRectVert ) ): \ + ( bRevX ? fnRectB2T : fnRectHori ); +#define SWREFRESHFN( pFrm ) { if( bVert != pFrm->IsVertical() || \ + bRev != pFrm->IsReverse() ) \ + bVert = pFrm->IsVertical(); \ + bRev = pFrm->IsReverse(); \ + bVertL2R = pFrm->IsVertLR(); \ + fnRect = bVert ? \ + ( bRev ? fnRectVL2R : ( bVertL2R ? fnRectVertL2R : fnRectVert ) ): \ + ( bRev ? fnRectB2T : fnRectHori ); } +#define SWRECTFN2( pFrm ) sal_Bool bVert = pFrm->IsVertical(); \ + sal_Bool bVertL2R = pFrm->IsVertLR(); \ + sal_Bool bNeighb = pFrm->IsNeighbourFrm(); \ + SwRectFn fnRect = bVert == bNeighb ? \ + fnRectHori : ( bVertL2R ? fnRectVertL2R : fnRectVert ); +//End of SCMS +#define POS_DIFF( aFrm1, aFrm2 ) \ + ( (aFrm1.*fnRect->fnGetTop)() != (aFrm2.*fnRect->fnGetTop)() || \ + (aFrm1.*fnRect->fnGetLeft)() != (aFrm2.*fnRect->fnGetLeft)() ) + + +//Fuer GetNextLeaf/GetPrevLeaf. +enum MakePageType +{ + MAKEPAGE_NONE, //Keine Seite bzw. Fussnote anlegen + MAKEPAGE_APPEND, //Nur ggf. Seite anhaengen + MAKEPAGE_INSERT, //Seite ggf. anhaengen oder einfuegen. + MAKEPAGE_FTN, //Fussnote ggf. einfuegen. + MAKEPAGE_NOSECTION // Don't create section frames +}; + +// OD 2004-05-06 #i28701# - replaced by new class <SwSortedObjs> +//typedef SdrObject* SdrObjectPtr; +//SV_DECL_PTRARR(SwDrawObjs,SdrObjectPtr,1,1); + +class SwFrm: public SwClient, public SfxBroadcaster +{ + //Der verkappte Frm + friend class SwFlowFrm; + friend class SwLayoutFrm; // Sw3FrameIo: fuer pNext, pPrev + friend class SwLooping; // LoopControlling (layouter.cxx) + + //Hebt die Lower waehrend eines Spaltenumbaus auf. + friend SwFrm *SaveCntnt( SwLayoutFrm *, SwFrm* pStart = NULL ); + friend void RestoreCntnt( SwFrm *, SwLayoutFrm *, SwFrm *pSibling, bool bGrow ); + +#if OSL_DEBUG_LEVEL > 1 + //entfernt leere SwSectionFrms aus einer Kette + friend SwFrm* SwClearDummies( SwFrm* pFrm ); +#endif + + //Zum validieren eines unsinnig invalidierten in SwCntntFrm::MakeAll + friend void ValidateSz( SwFrm *pFrm ); + // Implementiert in text/txtftn.cxx, verhindert Ftn-Oszillation + friend void ValidateTxt( SwFrm *pFrm ); + +// friend void CalcAnchorAndKeep( SwFlyFrm * ); + + friend void MakeNxt( SwFrm *pFrm, SwFrm *pNxt ); + + //Cache fuer (Umrandungs-)Attribute. + static SwCache *pCache; + + // --> OD 2006-05-10 #i65250# + // frame ID is now in general available - used for layout loop control + static sal_uInt32 mnLastFrmId; + const sal_uInt32 mnFrmId; + // <-- + + SwRootFrm *mpRoot; + SwLayoutFrm *pUpper; + SwFrm *pNext; + SwFrm *pPrev; + + SwFrm *_FindNext(); + SwFrm *_FindPrev(); + + /** method to determine next content frame in the same environment + for a flow frame (content frame, table frame, section frame) + + OD 2005-11-30 #i27138# - adding documentation: + Travelling downwards through the layout to determine the next content + frame in the same environment. There are several environments in a + document, which form a closed context regarding this function. These + environments are: + - Each page header + - Each page footer + - Each unlinked fly frame + - Each group of linked fly frames + - All footnotes + - All document body frames + OD 2005-11-30 #i27138# - adding parameter <_bInSameFtn> + Its default value is <false>. If its value is <true>, the environment + 'All footnotes' is no longer treated. Instead each footnote is treated + as an own environment. + + @author OD + + @param _bInSameFtn + input parameter - boolean indicating, that the found next content + frame has to be in the same footnote frame. This parameter is only + relevant for flow frames in footnotes. + + @return SwCntntFrm* + pointer to the found next content frame. It's NULL, if none exists. + */ + SwCntntFrm* _FindNextCnt( const bool _bInSameFtn = false ); + + /** method to determine previous content frame in the same environment + for a flow frame (content frame, table frame, section frame) + + OD 2005-11-30 #i27138# + Travelling upwards through the layout to determine the previous content + frame in the same environment. There are several environments in a + document, which form a closed context regarding this function. These + environments are: + - Each page header + - Each page footer + - Each unlinked fly frame + - Each group of linked fly frames + - All footnotes + - All document body frames + OD 2005-11-30 #i27138# - adding parameter <_bInSameFtn> + Its default value is <false>. If its value is <true>, the environment + 'All footnotes' is no longer treated. Instead each footnote is treated + as an own environment. + + @author OD + + @param _bInSameFtn + input parameter - boolean indicating, that the found previous content + frame has to be in the same footnote frame. This parameter is only + relevant for flow frames in footnotes. + + @return SwCntntFrm* + pointer to the found previous content frame. It's NULL, if none exists. + */ + SwCntntFrm* _FindPrevCnt( const bool _bInSameFtn = false ); + + + void _UpdateAttrFrm( const SfxPoolItem*, const SfxPoolItem*, sal_uInt8 & ); + SwFrm* _GetIndNext(); + void SetDirFlags( sal_Bool bVert ); + + SwFrm( SwFrm & ); //Kopieren ist nicht erlaubt. + + const SwLayoutFrm* ImplGetNextLayoutLeaf( bool bFwd ) const; + +protected: + SwSortedObjs* pDrawObjs; //Hier haengen die DrawObjs, kann 0 sein + + SwRect aFrm; //Absolute Dokumentposition und groesse des Frm + SwRect aPrt; //Position der PrtArea rel zum Frm und groesse der PrtArea + + sal_uInt16 bFlag01: 1; + sal_uInt16 bFlag02: 1; + sal_uInt16 bFlag03: 1; + sal_uInt16 bFlag04: 1; + sal_uInt16 bFlag05: 1; + sal_uInt16 bReverse: 1; // Next line above/at the right side instead + // under/at the left side of the previous line. + sal_uInt16 bInvalidR2L: 1; + sal_uInt16 bDerivedR2L: 1; + sal_uInt16 bRightToLeft: 1; + sal_uInt16 bInvalidVert: 1; + sal_uInt16 bDerivedVert: 1; + sal_uInt16 bVertical: 1; + //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin + sal_uInt16 bVertLR: 1; + //End of SCMS + sal_uInt16 nType: 4; //Who am I? + + sal_Bool bValidPos: 1; + sal_Bool bValidPrtArea: 1; + sal_Bool bValidSize: 1; + sal_Bool bValidLineNum: 1; + sal_Bool bFixSize: 1; + sal_Bool bUnUsed1: 1; + sal_Bool bCompletePaint: 1; //Frame wird ganz gepaintet wenn sal_True, auch + //wenn der Inhalt nur teilw. veraendert ist; + //Bei CntntFrms wird ausschliesslich wenn sal_True + //der Border (von Action) gemalt. + sal_Bool bRetouche: 1; //Der Frame ist fuer Retusche verantwortlich + //wenn sal_True. +public: + sal_Bool bUnUsed2: 1; +protected: + sal_Bool bInfInvalid: 1; //InfoFlags sind Invalid. + sal_Bool bInfBody: 1; //Frm steht im DokumentBody. + sal_Bool bInfTab: 1; //Frm steht in einer Tabelle. + sal_Bool bInfFly: 1; //Frm steht in einem Fly. + sal_Bool bInfFtn: 1; //Frm steht in einer Fussnote. + sal_Bool bInfSct: 1; //Frm steht in einem Bereich. + sal_Bool bColLocked: 1; //Grow/Shrink sperren bei spaltigen Section- + //oder Fly-Frames, wird im Format gesetzt + + void ColLock() { bColLocked = sal_True; } + void ColUnlock() { bColLocked = sal_False; } + + // Only used by SwRootFrm Ctor to get 'this' into mpRoot... + void setRootFrm( SwRootFrm* pRoot ) { mpRoot = pRoot; } + + SwPageFrm *InsertPage( SwPageFrm *pSibling, sal_Bool bFtn ); + void PrepareMake(); + void OptPrepareMake(); + void MakePos(); + // --> OD 2005-09-28 #b6329202# + // method formats next frame of table frame to assure keep attribute. + // in case of nested tables method <SwFrm::MakeAll()> is called to + // avoid format of superior table frame. + friend SwFrm* lcl_FormatNextCntntForKeep( SwTabFrm* pTabFrm ); + // <-- + virtual void MakeAll() = 0; + //Adjustierung der Frames einer Seite + SwTwips AdjustNeighbourhood( SwTwips nDiff, sal_Bool bTst = sal_False ); + + + //Aendern nur die Framesize, nicht die PrtArea-SSize + virtual SwTwips ShrinkFrm( SwTwips, sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False ) = 0; + virtual SwTwips GrowFrm ( SwTwips, sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False ) = 0; + + SwModify *GetDep() { return GetRegisteredInNonConst(); } + const SwModify *GetDep() const { return GetRegisteredIn(); } + + SwFrm( SwModify*, SwFrm* ); + + void CheckDir( sal_uInt16 nDir, sal_Bool bVert, sal_Bool bOnlyBiDi, sal_Bool bBrowse ); + + /** enumeration for the different invalidations + + OD 2004-05-19 #i28701# + + @author OD + */ + enum InvalidationType + { + INVALID_SIZE, INVALID_PRTAREA, INVALID_POS, INVALID_LINENUM, INVALID_ALL + }; + + /** method to determine, if an invalidation is allowed. + + OD 2004-05-19 #i28701 + + @author OD + */ + virtual bool _InvalidationAllowed( const InvalidationType _nInvalid ) const; + + /** method to perform additional actions on an invalidation + + OD 2004-05-19 #i28701# + Method has *only* to contain actions, which has to be performed on + *every* assignment of the corresponding flag to <sal_False>. + + @author OD + */ + virtual void _ActionOnInvalidation( const InvalidationType _nInvalid ); + + //Schatten und Umrandung painten + void PaintShadow( const SwRect&, SwRect&, const SwBorderAttrs& ) const; + virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ); + +public: + TYPEINFO(); //Bereits in Basisklasse Client drin. + + sal_uInt16 GetType() const { return 0x1 << nType; } + + static SwCache &GetCache() { return *pCache; } + static SwCache *GetCachePtr() { return pCache; } + static void SetCache( SwCache *pNew ) { pCache = pNew; } + + //Aendern die PrtArea-SSize und die FrmSize. + SwTwips Shrink( SwTwips, sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False ); + SwTwips Grow ( SwTwips, sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False ); + + //Wir brauchen unterschiedliche Methoden (wg. Performance) fuer das + //Einfuegenin den Layout Baum: + + //Einfuegen vor pBehind oder am Ende der Kette unter pUpper + void InsertBefore( SwLayoutFrm* pParent, SwFrm* pBehind ); + //Einfuegen hinter pBefore oder am Anfang der Kette unter pUpper + void InsertBehind( SwLayoutFrm *pParent, SwFrm *pBefore ); + //Einfuegen vor pBehind oder am Ende der Kette, unter Beruecksichtigung + //der Geschwister von pSct + void InsertGroupBefore( SwFrm* pParent, SwFrm* pWhere, SwFrm* pSct ); + void Remove(); + + //For internal use only; wer es anders macht wird + //in einen Sack gesteckt und muss zwei Tage drin hocken bleiben. + //Fuert Spezialbehandlung fuer _Get[Next|Prev]Leaf() durch (Tabellen). + SwLayoutFrm *GetLeaf( MakePageType eMakePage, sal_Bool bFwd ); + SwLayoutFrm *GetNextLeaf ( MakePageType eMakePage ); + SwLayoutFrm *GetNextFtnLeaf( MakePageType eMakePage ); + SwLayoutFrm *GetNextSctLeaf( MakePageType eMakePage ); + SwLayoutFrm *GetNextCellLeaf( MakePageType eMakePage ); + SwLayoutFrm *GetPrevLeaf ( MakePageType eMakeFtn = MAKEPAGE_FTN ); + SwLayoutFrm *GetPrevFtnLeaf( MakePageType eMakeFtn = MAKEPAGE_FTN ); + SwLayoutFrm *GetPrevSctLeaf( MakePageType eMakeFtn = MAKEPAGE_FTN ); + SwLayoutFrm *GetPrevCellLeaf( MakePageType eMakeFtn = MAKEPAGE_FTN ); + const SwLayoutFrm *GetLeaf ( MakePageType eMakePage, sal_Bool bFwd, + const SwFrm *pAnch ) const; + + sal_Bool WrongPageDesc( SwPageFrm* pNew ); + + // --> OD 2004-07-02 #i28701# - new methods to append/remove drawing objects + void AppendDrawObj( SwAnchoredObject& _rNewObj ); + void RemoveDrawObj( SwAnchoredObject& _rToRemoveObj ); + // <-- + + //Arbeiten mit der Kette der FlyFrms + void AppendFly( SwFlyFrm *pNew ); + void RemoveFly( SwFlyFrm *pToRemove ); + const SwSortedObjs *GetDrawObjs() const { return pDrawObjs; } + SwSortedObjs *GetDrawObjs() { return pDrawObjs; } + // --> OD 2004-07-01 #i28701# - change purpose of method and adjust its name + void InvalidateObjs( const bool _bInvaPosOnly, + const bool _bNoInvaOfAsCharAnchoredObjs = true ); + + virtual void PaintBorder( const SwRect&, const SwPageFrm *pPage, + const SwBorderAttrs & ) const; + void PaintBaBo( const SwRect&, const SwPageFrm *pPage = 0, + const sal_Bool bLowerBorder = sal_False ) const; + void PaintBackground( const SwRect&, const SwPageFrm *pPage, + const SwBorderAttrs &, + const sal_Bool bLowerMode = sal_False, + const sal_Bool bLowerBorder = sal_False ) const; + void PaintBorderLine( const SwRect&, const SwRect&, const SwPageFrm*, + const Color *pColor ) const; + + //Retouche, nicht im Bereich des uebergebenen Rect! + void Retouche( const SwPageFrm *pPage, const SwRect &rRect ) const; + + sal_Bool GetBackgroundBrush( const SvxBrushItem*& rpBrush, + const Color*& rpColor, + SwRect &rOrigRect, + sal_Bool bLowerMode ) const; + + inline void SetCompletePaint() const; + inline void ResetCompletePaint() const; + inline sal_Bool IsCompletePaint() const { return bCompletePaint; } + + inline void SetRetouche() const; + inline void ResetRetouche() const; + inline sal_Bool IsRetouche() const { return bRetouche; } + + void SetInfFlags(); //Setzen der InfoFlags + inline void InvalidateInfFlags() { bInfInvalid = sal_True; } + inline sal_Bool IsInDocBody() const; //Benutzen die InfoFlags. + inline sal_Bool IsInFtn() const; //ggf. werden die Flags ermittelt. + inline sal_Bool IsInTab() const; + inline sal_Bool IsInFly() const; + inline sal_Bool IsInSct() const; + + // If frame is inside a split table row, this function returns + // the corresponding row frame in the follow table. + const SwRowFrm* IsInSplitTableRow() const; + + // If frame is inside a follow flow row, this function returns + // the corresponding row frame master table + const SwRowFrm* IsInFollowFlowRow() const; + + bool IsInBalancedSection() const; + + inline sal_Bool IsReverse() const { return bReverse; } + inline void SetReverse( sal_Bool bNew ){ bReverse = bNew ? 1 : 0; } + inline sal_Bool IsVertical() const; + //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin + inline sal_Bool IsVertLR() const; + //End of SCMS + inline sal_Bool GetVerticalFlag() const; + inline void SetVertical( sal_Bool bNew ){ bVertical = bNew ? 1 : 0; } + //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin + inline void SetbVertLR( sal_Bool bNew ) { bVertLR = bNew ? 1 : 0; } + //End of SCMS + inline void SetDerivedVert( sal_Bool bNew ){ bDerivedVert = bNew ? 1 : 0; } + inline void SetInvalidVert( sal_Bool bNew) { bInvalidVert = bNew ? 1 : 0; } + inline sal_Bool IsRightToLeft() const; + inline sal_Bool GetRightToLeftFlag() const; + inline void SetRightToLeft( sal_Bool bNew ){ bRightToLeft = bNew ? 1 : 0; } + inline void SetDerivedR2L( sal_Bool bNew ) { bDerivedR2L = bNew ? 1 : 0; } + inline void SetInvalidR2L( sal_Bool bNew ) { bInvalidR2L = bNew ? 1 : 0; } + + void CheckDirChange(); + // returns upper left frame position for LTR and + // upper right frame position for Asian / RTL frames + Point GetFrmAnchorPos( sal_Bool bIgnoreFlysAnchoredAtThisFrame ) const; + + /** determine, if frame is moveable in given environment + + OD 08.08.2003 #110978# + method replaced 'old' method <sal_Bool IsMoveable() const>. + Determines, if frame is moveable in given environment. if no environment + is given (parameter _pLayoutFrm == 0L), the movability in the actual + environment (<this->GetUpper()) is checked. + + @author OD + + @param _pLayoutFrm + input parameter - given environment (layout frame), in which the movability + will be checked. If not set ( == 0L ), actual environment is taken. + + @return boolean, indicating, if frame is moveable in given environment + */ +// sal_Bool IsMoveable() const; + bool IsMoveable( const SwLayoutFrm* _pLayoutFrm = 0L ) const; + + //Ist es fuer den (Txt)Frm in der aktuellen Umgebung erlaubt eine + //Fussnote einzufuegen (nicht z.B. in wiederholten TabellenHeadlines). + sal_Bool IsFtnAllowed() const; + + virtual void Format( const SwBorderAttrs *pAttrs = 0 ); + + virtual void CheckDirection( sal_Bool bVert ); + + void ReinitializeFrmSizeAttrFlags(); + + const SwAttrSet *GetAttrSet() const; + + inline sal_Bool HasFixSize() const { return bFixSize; } + inline void SetFixSize( sal_Bool bNew ) { bFixSize = bNew; } + + //Prueft alle Seiten ab der Uebergebenen und korrigiert ggf. + static void CheckPageDescs( SwPageFrm *pStart, sal_Bool bNotifyFields = sal_True ); + + //Koennen 0 liefern, einmal const einmal nicht + SwFrm *GetNext() { return pNext; } + SwFrm *GetPrev() { return pPrev; } + SwLayoutFrm *GetUpper() { return pUpper; } + SwRootFrm *getRootFrm(){ return mpRoot; } + SwPageFrm *FindPageFrm(); + SwFrm *FindColFrm(); + SwFtnBossFrm *FindFtnBossFrm( sal_Bool bFootnotes = sal_False ); + SwTabFrm *ImplFindTabFrm(); + SwFtnFrm *ImplFindFtnFrm(); + SwFlyFrm *ImplFindFlyFrm(); + SwSectionFrm *ImplFindSctFrm(); + SwFrm *FindFooterOrHeader(); + SwFrm *GetLower(); + const SwFrm *GetNext() const { return pNext; } + const SwFrm *GetPrev() const { return pPrev; } + const SwLayoutFrm *GetUpper() const { return pUpper; } + const SwRootFrm *getRootFrm() const { return mpRoot; } + inline SwTabFrm *FindTabFrm(); + inline SwFtnFrm *FindFtnFrm(); + inline SwFlyFrm *FindFlyFrm(); + inline SwSectionFrm *FindSctFrm(); + inline SwFrm *FindNext(); + // --> OD 2005-12-01 #i27138# - add parameter <_bInSameFtn> + inline SwCntntFrm* FindNextCnt( const bool _bInSameFtn = false ); + // <-- + inline SwFrm *FindPrev(); + inline const SwPageFrm *FindPageFrm() const; + inline const SwFtnBossFrm *FindFtnBossFrm( sal_Bool bFtn = sal_False ) const; + inline const SwFrm *FindColFrm() const; + inline const SwFrm *FindFooterOrHeader() const; + inline const SwTabFrm *FindTabFrm() const; + inline const SwFtnFrm *FindFtnFrm() const; + inline const SwFlyFrm *FindFlyFrm() const; + inline const SwSectionFrm *FindSctFrm() const; + inline const SwFrm *FindNext() const; + // --> OD 2005-12-01 #i27138# - add parameter <_bInSameFtn> + inline const SwCntntFrm* FindNextCnt( const bool _bInSameFtn = false ) const; + // <-- + inline const SwFrm *FindPrev() const; + const SwFrm *GetLower() const; + + /** inline wrapper method for <_FindPrevCnt(..)> + + OD 2005-11-30 #i27138# + + @author OD + */ + inline SwCntntFrm* FindPrevCnt( const bool _bInSameFtn = false ) + { + if ( GetPrev() && GetPrev()->IsCntntFrm() ) + return (SwCntntFrm*)(GetPrev()); + else + return _FindPrevCnt( _bInSameFtn ); + } + + /** inline const wrapper method for <_FindPrevCnt(..)> + + OD 2005-11-30 #i27138# + + @author OD + */ + inline const SwCntntFrm* FindPrevCnt( const bool _bInSameFtn = false ) const + { + if ( GetPrev() && GetPrev()->IsCntntFrm() ) + return (const SwCntntFrm*)(GetPrev()); + else + return const_cast<SwFrm*>(this)->_FindPrevCnt( _bInSameFtn ); + } + + // --> OD 2007-09-04 #i79774#, #b6596954# + SwFrm* _GetIndPrev() const; + SwFrm* GetIndPrev() const + { return ( pPrev || !IsInSct() ) ? pPrev : _GetIndPrev(); } +// const SwFrm* GetIndPrev() const { return ((SwFrm*)this)->GetIndPrev(); } + // <-- + SwFrm* GetIndNext() + { return ( pNext || !IsInSct() ) ? pNext : _GetIndNext(); } + const SwFrm* GetIndNext() const { return ((SwFrm*)this)->GetIndNext(); } + + sal_uInt16 GetPhyPageNum() const; //Seitennummer ohne Offset + sal_uInt16 GetVirtPageNum() const; //Seitenummer mit Offset + sal_Bool OnRightPage() const { return 0 != GetPhyPageNum() % 2; }; + sal_Bool WannaRightPage() const; + + + inline const SwLayoutFrm *GetPrevLayoutLeaf() const; + inline const SwLayoutFrm *GetNextLayoutLeaf() const; + inline SwLayoutFrm *GetPrevLayoutLeaf(); + inline SwLayoutFrm *GetNextLayoutLeaf(); + + inline void Calc() const; //Hier wird ggf. 'Formatiert' + inline void OptCalc() const; //Hier wird zur Optimierung davon ausgegangen, + //das die Vorgaenger bereits formatiert sind. + + inline Point GetRelPos() const; + const SwRect &Frm() const { return aFrm; } + const SwRect &Prt() const { return aPrt; } + + // The PaintArea is the area, where content may be displayed. + // The margin of the page or the space between columns belongs to her. + const SwRect PaintArea() const; + // The UnionFrm is the union of frm- and prt-area, normally identical + // to the frm-area except the case of negative prt-margins. + const SwRect UnionFrm( sal_Bool bBorder = sal_False ) const; + + //Der Zugriff auf die Member wird hier ausnahmsweiste gestattet, + //dies soll aber nicht dazu dienen die Werte wahllos zu veraendern; + //es ist nur die einzige Moeglichkeit die Compilerprobleme zu umgehen + //(gleiche Methode mal public mal protected). + SwRect &Frm() { return aFrm; } + SwRect &Prt() { return aPrt; } + + virtual Size ChgSize( const Size& aNewSize ); + + virtual void Cut() = 0; + virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 ) = 0; + + void ValidateLineNum() { bValidLineNum = sal_True; } + + sal_Bool GetValidPosFlag() const { return bValidPos; } + sal_Bool GetValidPrtAreaFlag()const { return bValidPrtArea; } + sal_Bool GetValidSizeFlag() const { return bValidSize; } + sal_Bool GetValidLineNumFlag()const { return bValidLineNum; } + sal_Bool IsValid() const { return bValidPos && bValidSize && bValidPrtArea; } + + //Invalideren nur den Frm + // OD 2004-05-19 #i28701# - add call to method <_ActionOnInvalidation(..)> + // for all invalidation methods. + // OD 2004-05-19 #i28701# - use method <_InvalidationAllowed(..)> to + // decide, if invalidation will to be performed or not. + // --> OD 2004-10-08 #i26945# - no additional invalidation, if it's already + // invalidate. + void _InvalidateSize() + { + if ( bValidSize && _InvalidationAllowed( INVALID_SIZE ) ) + { + bValidSize = sal_False; + _ActionOnInvalidation( INVALID_SIZE ); + } + } + void _InvalidatePrt() + { + if ( bValidPrtArea && _InvalidationAllowed( INVALID_PRTAREA ) ) + { + bValidPrtArea = sal_False; + _ActionOnInvalidation( INVALID_PRTAREA ); + } + } + void _InvalidatePos() + { + if ( bValidPos && _InvalidationAllowed( INVALID_POS ) ) + { + bValidPos = sal_False; + _ActionOnInvalidation( INVALID_POS ); + } + } + void _InvalidateLineNum() + { + if ( bValidLineNum && _InvalidationAllowed( INVALID_LINENUM ) ) + { + bValidLineNum = sal_False; + _ActionOnInvalidation( INVALID_LINENUM ); + } + } + void _InvalidateAll() + { + if ( ( bValidSize || bValidPrtArea || bValidPos ) && + _InvalidationAllowed( INVALID_ALL ) ) + { + bValidSize = bValidPrtArea = bValidPos = sal_False; + _ActionOnInvalidation( INVALID_ALL ); + } + } + // <-- + //Benachrichtigen gleich die Seite mit. + inline void InvalidateSize(); + inline void InvalidatePrt(); + inline void InvalidatePos(); + inline void InvalidateLineNum(); + inline void InvalidateAll(); + void ImplInvalidateSize(); + void ImplInvalidatePrt(); + void ImplInvalidatePos(); + void ImplInvalidateLineNum(); + + inline void InvalidateNextPos( sal_Bool bNoFtn = sal_False ); + void ImplInvalidateNextPos( sal_Bool bNoFtn = sal_False ); + + /** method to invalidate printing area of next frame + + OD 09.01.2004 #i11859# + + @author OD + */ + void InvalidateNextPrtArea(); + + void InvalidatePage( const SwPageFrm *pPage = 0 ) const; + + virtual bool FillSelection( SwSelectionList& rList, const SwRect& rRect ) const; + + virtual sal_Bool GetCrsrOfst( SwPosition *, Point&, + SwCrsrMoveState* = 0 ) const; + virtual sal_Bool GetCharRect( SwRect &, const SwPosition&, + SwCrsrMoveState* = 0 ) const; + virtual void Paint( SwRect const&, + SwPrintData const*const pPrintData = NULL ) const; + + // der "kurze Dienstweg" zwischen den Frames und der Formatierung. + // Wer den void* falsch Casted ist selbst schuld! + // Auf jedenfall muss der void* auf 0 geprueft werden. + virtual void Prepare( const PrepareHint ePrep = PREP_CLEAR, + const void *pVoid = 0, sal_Bool bNotify = sal_True ); + + //sal_True wenn's die richtige Klasse ist, sal_False sonst + inline sal_Bool IsLayoutFrm() const; + inline sal_Bool IsRootFrm() const; + inline sal_Bool IsPageFrm() const; + inline sal_Bool IsColumnFrm() const; + inline sal_Bool IsFtnBossFrm() const; // Fussnotenbosse sind PageFrms und ColumnFrms + inline sal_Bool IsHeaderFrm() const; + inline sal_Bool IsFooterFrm() const; + inline sal_Bool IsFtnContFrm() const; + inline sal_Bool IsFtnFrm() const; + inline sal_Bool IsBodyFrm() const; + inline sal_Bool IsColBodyFrm() const; // in layfrm.hxx implementiert, BodyFrm unterhalb ColumnFrm + inline sal_Bool IsPageBodyFrm() const; // in layfrm.hxx implementiert, BodyFrm unterhalb PageFrm + inline sal_Bool IsFlyFrm() const; + inline sal_Bool IsSctFrm() const; + inline sal_Bool IsTabFrm() const; + inline sal_Bool IsRowFrm() const; + inline sal_Bool IsCellFrm() const; + inline sal_Bool IsCntntFrm() const; + inline sal_Bool IsTxtFrm() const; + inline sal_Bool IsNoTxtFrm() const; + inline sal_Bool IsFlowFrm() const; //Frms deren PrtArea von den Nachbarn + //abhaengen und die halt im Inhaltsfluss + //stehen. + inline sal_Bool IsRetoucheFrm() const; //Frms die Retouchefaehig sind bzw. die + //u.U. hinter sich Retouchieren muessen. + inline sal_Bool IsAccessibleFrm() const; + + void PrepareCrsr(); //Die CrsrShell darf. + + //Ist der Frm (bzw. die Section in der er steht) geschuetzt? + //Auch Fly in Fly in ... und Fussnoten + sal_Bool IsProtected() const; + + sal_Bool IsColLocked() const { return bColLocked; } + + virtual ~SwFrm(); + + // No inline cause we need the function pointers + long GetTopMargin() const; + long GetBottomMargin() const; + long GetLeftMargin() const; + long GetRightMargin() const; + void SetTopBottomMargins( long, long ); + void SetBottomTopMargins( long, long ); + void SetLeftRightMargins( long, long ); + void SetRightLeftMargins( long, long ); + void SetLeftAndWidth( long nLeft, long nWidth ); + void SetTopAndHeight( long nTop, long nHeight ); + void SetRightAndWidth( long nRight, long nWidth ); + void SetBottomAndHeight( long nBottom, long nHeight ); + long GetPrtLeft() const; + long GetPrtBottom() const; + long GetPrtRight() const; + long GetPrtTop() const; + sal_Bool SetMinLeft( long ); + sal_Bool SetMaxBottom( long ); + sal_Bool SetMaxRight( long ); + sal_Bool SetMinTop( long ); + void MakeBelowPos( const SwFrm*, const SwFrm*, sal_Bool ); + void MakeUpperPos( const SwFrm*, const SwFrm*, sal_Bool ); + void MakeLeftPos( const SwFrm*, const SwFrm*, sal_Bool ); + void MakeRightPos( const SwFrm*, const SwFrm*, sal_Bool ); + inline sal_Bool IsNeighbourFrm() const + { return GetType() & FRM_NEIGHBOUR ? sal_True : sal_False; } + + // --> OD 2006-05-10 #i65250# + inline sal_uInt32 GetFrmId() const { return mnFrmId; } + inline sal_uInt32 GetLastFrmId() const { return mnLastFrmId; } + // <-- + + // NEW TABELS + // Some functions for covered/covering table cells. This way unnessessary + // includes can be avoided + bool IsLeaveUpperAllowed() const; + bool IsCoveredCell() const; + bool IsInCoveredCell() const; + + // FME 2007-08-30 #i81146# new loop control + bool KnowsFormat( const SwFmt& rFmt ) const; + void RegisterToFormat( SwFmt& rFmt ); + void ValidateThisAndAllLowers( const sal_uInt16 nStage ); +}; + +inline sal_Bool SwFrm::IsInDocBody() const +{ + if ( bInfInvalid ) + ((SwFrm*)this)->SetInfFlags(); + return bInfBody; +} +inline sal_Bool SwFrm::IsInFtn() const +{ + if ( bInfInvalid ) + ((SwFrm*)this)->SetInfFlags(); + return bInfFtn; +} +inline sal_Bool SwFrm::IsInTab() const +{ + if ( bInfInvalid ) + ((SwFrm*)this)->SetInfFlags(); + return bInfTab; +} +inline sal_Bool SwFrm::IsInFly() const +{ + if ( bInfInvalid ) + ((SwFrm*)this)->SetInfFlags(); + return bInfFly; +} +inline sal_Bool SwFrm::IsInSct() const +{ + if ( bInfInvalid ) + ((SwFrm*)this)->SetInfFlags(); + return bInfSct; +} +sal_Bool SwFrm::IsVertical() const +{ + if( bInvalidVert ) + ((SwFrm*)this)->SetDirFlags( sal_True ); + return bVertical != 0; +} +//Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin +inline sal_Bool SwFrm::IsVertLR() const +{ + return bVertLR != 0; +} +//End of SCMS +sal_Bool SwFrm::GetVerticalFlag() const +{ + return bVertical != 0; +} +inline sal_Bool SwFrm::IsRightToLeft() const +{ + if( bInvalidR2L ) + ((SwFrm*)this)->SetDirFlags( sal_False ); + return bRightToLeft != 0; +} +sal_Bool SwFrm::GetRightToLeftFlag() const +{ + return bRightToLeft != 0; +} + +inline void SwFrm::SetCompletePaint() const +{ + ((SwFrm*)this)->bCompletePaint = sal_True; +} +inline void SwFrm::ResetCompletePaint() const +{ + ((SwFrm*)this)->bCompletePaint = sal_False; +} + +inline void SwFrm::SetRetouche() const +{ + ((SwFrm*)this)->bRetouche = sal_True; +} +inline void SwFrm::ResetRetouche() const +{ + ((SwFrm*)this)->bRetouche = sal_False; +} + +inline SwLayoutFrm *SwFrm::GetNextLayoutLeaf() +{ + return (SwLayoutFrm*)((const SwFrm*)this)->GetNextLayoutLeaf(); +} + +inline SwLayoutFrm *SwFrm::GetPrevLayoutLeaf() +{ + return (SwLayoutFrm*)((const SwFrm*)this)->GetPrevLayoutLeaf(); +} + +inline const SwLayoutFrm *SwFrm::GetNextLayoutLeaf() const +{ + return ImplGetNextLayoutLeaf( true ); +} + +inline const SwLayoutFrm *SwFrm::GetPrevLayoutLeaf() const +{ + return ImplGetNextLayoutLeaf( false ); +} + +inline void SwFrm::InvalidateSize() +{ + if ( bValidSize ) + ImplInvalidateSize(); +} +inline void SwFrm::InvalidatePrt() +{ + if ( bValidPrtArea ) + ImplInvalidatePrt(); +} +inline void SwFrm::InvalidatePos() +{ + if ( bValidPos ) + ImplInvalidatePos(); +} +inline void SwFrm::InvalidateLineNum() +{ + if ( bValidLineNum ) + ImplInvalidateLineNum(); +} + +inline void SwFrm::InvalidateAll() +{ + if ( _InvalidationAllowed( INVALID_ALL ) ) + { + if ( bValidPrtArea && bValidSize && bValidPos ) + ImplInvalidatePos(); + bValidPrtArea = bValidSize = bValidPos = sal_False; + + // OD 2004-05-19 #i28701# + _ActionOnInvalidation( INVALID_ALL ); + } +} + +inline void SwFrm::InvalidateNextPos( sal_Bool bNoFtn ) +{ + if ( pNext && !pNext->IsSctFrm() ) + pNext->InvalidatePos(); +#ifndef C30 // vielleicht geht es ja bei C40 ? + else + ImplInvalidateNextPos( bNoFtn ); +#else + if ( !pNext ) + ImplInvalidateNextPos( bNoFtn ); +#endif +} + +inline void SwFrm::Calc() const +{ + if ( !bValidPos || !bValidPrtArea || !bValidSize ) + ((SwFrm*)this)->PrepareMake(); +} +inline void SwFrm::OptCalc() const +{ + if ( !bValidPos || !bValidPrtArea || !bValidSize ) + ((SwFrm*)this)->OptPrepareMake(); +} + +inline Point SwFrm::GetRelPos() const +{ + Point aRet( aFrm.Pos() ); + //hier wird gecasted, weil die Klasse SwLayoutFrm nur vorward- + //declariert ist. + aRet -= ((SwFrm*)GetUpper())->Prt().Pos(); + aRet -= ((SwFrm*)GetUpper())->Frm().Pos(); + return aRet; +} + +inline const SwPageFrm *SwFrm::FindPageFrm() const +{ + return ((SwFrm*)this)->FindPageFrm(); +} +inline const SwFrm *SwFrm::FindColFrm() const +{ + return ((SwFrm*)this)->FindColFrm(); +} +inline const SwFrm *SwFrm::FindFooterOrHeader() const +{ + return ((SwFrm*)this)->FindFooterOrHeader(); +} +inline SwTabFrm *SwFrm::FindTabFrm() +{ + return IsInTab() ? ImplFindTabFrm() : 0; +} +inline const SwFtnBossFrm *SwFrm::FindFtnBossFrm( sal_Bool bFtn ) const +{ + return ((SwFrm*)this)->FindFtnBossFrm( bFtn ); +} +inline SwFtnFrm *SwFrm::FindFtnFrm() +{ + return IsInFtn() ? ImplFindFtnFrm() : 0; +} +inline SwFlyFrm *SwFrm::FindFlyFrm() +{ + return IsInFly() ? ImplFindFlyFrm() : 0; +} +inline SwSectionFrm *SwFrm::FindSctFrm() +{ + return IsInSct() ? ImplFindSctFrm() : 0; +} + +inline const SwTabFrm *SwFrm::FindTabFrm() const +{ + return IsInTab() ? ((SwFrm*)this)->ImplFindTabFrm() : 0; +} +inline const SwFtnFrm *SwFrm::FindFtnFrm() const +{ + return IsInFtn() ? ((SwFrm*)this)->ImplFindFtnFrm() : 0; +} +inline const SwFlyFrm *SwFrm::FindFlyFrm() const +{ + return IsInFly() ? ((SwFrm*)this)->ImplFindFlyFrm() : 0; +} +inline const SwSectionFrm *SwFrm::FindSctFrm() const +{ + return IsInSct() ? ((SwFrm*)this)->ImplFindSctFrm() : 0; +} +inline SwFrm *SwFrm::FindNext() +{ + if ( pNext ) + return pNext; + else + return _FindNext(); +} +inline const SwFrm *SwFrm::FindNext() const +{ + if ( pNext ) + return pNext; + else + return ((SwFrm*)this)->_FindNext(); +} +// --> OD 2005-12-01 #i27138# - add parameter <_bInSameFtn> +inline SwCntntFrm *SwFrm::FindNextCnt( const bool _bInSameFtn ) +{ + if ( pNext && pNext->IsCntntFrm() ) + return (SwCntntFrm*)pNext; + else + return _FindNextCnt( _bInSameFtn ); +} +// <-- +// --> OD 2005-12-01 #i27138# - add parameter <_bInSameFtn> +inline const SwCntntFrm *SwFrm::FindNextCnt( const bool _bInSameFtn ) const +{ + if ( pNext && pNext->IsCntntFrm() ) + return (SwCntntFrm*)pNext; + else + return ((SwFrm*)this)->_FindNextCnt( _bInSameFtn ); +} +// <-- +inline SwFrm *SwFrm::FindPrev() +{ + if ( pPrev && !pPrev->IsSctFrm() ) + return pPrev; + else + return _FindPrev(); +} +inline const SwFrm *SwFrm::FindPrev() const +{ + if ( pPrev && !pPrev->IsSctFrm() ) + return pPrev; + else + return ((SwFrm*)this)->_FindPrev(); +} + + +inline sal_Bool SwFrm::IsLayoutFrm() const +{ + return GetType() & FRM_LAYOUT ? sal_True : sal_False; +} +inline sal_Bool SwFrm::IsRootFrm() const +{ + return nType == FRMC_ROOT; +} +inline sal_Bool SwFrm::IsPageFrm() const +{ + return nType == FRMC_PAGE; +} +inline sal_Bool SwFrm::IsColumnFrm() const +{ + return nType == FRMC_COLUMN; +} +inline sal_Bool SwFrm::IsFtnBossFrm() const +{ + return GetType() & FRM_FTNBOSS ? sal_True : sal_False; +} +inline sal_Bool SwFrm::IsHeaderFrm() const +{ + return nType == FRMC_HEADER; +} +inline sal_Bool SwFrm::IsFooterFrm() const +{ + return nType == FRMC_FOOTER; +} +inline sal_Bool SwFrm::IsFtnContFrm() const +{ + return nType == FRMC_FTNCONT; +} +inline sal_Bool SwFrm::IsFtnFrm() const +{ + return nType == FRMC_FTN; +} +inline sal_Bool SwFrm::IsBodyFrm() const +{ + return nType == FRMC_BODY; +} +inline sal_Bool SwFrm::IsFlyFrm() const +{ + return nType == FRMC_FLY; +} +inline sal_Bool SwFrm::IsSctFrm() const +{ + return nType == FRMC_SECTION; +} +inline sal_Bool SwFrm::IsTabFrm() const +{ + return nType == FRMC_TAB; +} +inline sal_Bool SwFrm::IsRowFrm() const +{ + return nType == FRMC_ROW; +} +inline sal_Bool SwFrm::IsCellFrm() const +{ + return nType == FRMC_CELL; +} +inline sal_Bool SwFrm::IsCntntFrm() const +{ + return GetType() & FRM_CNTNT ? sal_True : sal_False; +} +inline sal_Bool SwFrm::IsTxtFrm() const +{ + return nType == FRMC_TXT; +} +inline sal_Bool SwFrm::IsNoTxtFrm() const +{ + return nType == FRMC_NOTXT; +} +inline sal_Bool SwFrm::IsFlowFrm() const +{ + return GetType() & 0xCA00 ? sal_True : sal_False; //TabFrm, CntntFrm, SectionFrm +} +inline sal_Bool SwFrm::IsRetoucheFrm() const +{ + return GetType() & 0xCA40 ? sal_True : sal_False; //TabFrm, CntntFrm, SectionFrm, Ftnfrm +} +inline sal_Bool SwFrm::IsAccessibleFrm() const +{ + return GetType() & FRM_ACCESSIBLE ? sal_True : sal_False; +} +#endif diff --git a/sw/source/core/inc/frminf.hxx b/sw/source/core/inc/frminf.hxx new file mode 100644 index 000000000000..347592a8c5f4 --- /dev/null +++ b/sw/source/core/inc/frminf.hxx @@ -0,0 +1,85 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _FRMINF_HXX +#define _FRMINF_HXX + +#include "swtypes.hxx" + +class SwTxtFrm; // SwTxtFrmInfo +class SwPaM; // SwTxtFrmInfo +class SwTxtCursor; // SwTxtFrmInfo + + +/************************************************************************* + * class SwTxtFrmInfo + *************************************************************************/ + +class SwTxtFrmInfo +{ + const SwTxtFrm *pFrm; + + // Wo beginnt der Text (ohne whitespaces)? (Dokument global !!) + SwTwips GetLineStart( const SwTxtCursor &rLine ) const; + +public: + inline SwTxtFrmInfo( const SwTxtFrm *pTxtFrm ) : pFrm(pTxtFrm) { } + + // Passt der Absatz in eine Zeile? + sal_Bool IsOneLine() const; + + // Ist die Zeile zu X% gefuellt? + sal_Bool IsFilled( const sal_uInt8 nPercent ) const; + + // Wo beginnt der Text (ohne whitespaces)? (rel. im Frame !!) + SwTwips GetLineStart() const; + + //returne die mittel Position des n. Charakters + SwTwips GetCharPos( xub_StrLen nChar, sal_Bool bCenter = sal_True ) const; + + // Sammelt die whitespaces am Zeilenbeginn und -ende im Pam + void GetSpaces( SwPaM &rPam, sal_Bool bWithLineBreak ) const; + + // Ist an der ersten Textposition ein Bullet/Symbol etc? + sal_Bool IsBullet( xub_StrLen nTxtPos ) const; + + // Ermittelt Erstzeileneinzug + SwTwips GetFirstIndent() const; + + // setze und erfrage den Frame; + const SwTxtFrm* GetFrm() const { return pFrm; } + SwTxtFrmInfo& SetFrm( const SwTxtFrm* pNew ) + { pFrm = pNew; return *this; } + + // liegt eine Gegenueberstellung vor? (returnt Pos im Frame) + sal_uInt16 GetBigIndent( xub_StrLen& rFndPos, + const SwTxtFrm *pNextFrm = 0 ) const; +}; + + + +#endif + diff --git a/sw/source/core/inc/frmtool.hxx b/sw/source/core/inc/frmtool.hxx new file mode 100644 index 000000000000..c264e8439092 --- /dev/null +++ b/sw/source/core/inc/frmtool.hxx @@ -0,0 +1,583 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _FRMTOOL_HXX +#define _FRMTOOL_HXX +#include "swtypes.hxx" +#include "layfrm.hxx" +#include "frmatr.hxx" +#include "swcache.hxx" +// --> OD 2008-12-04 #i96772# +#include <editeng/lrspitem.hxx> +// <-- + +class SwPageFrm; +class SwFlyFrm; +class SwCntntFrm; +class SwRootFrm; +class SwDoc; +class SwAttrSet; +class SdrObject; +class BigInt; +class SvxBrushItem; +class SdrMarkList; +class SwNodeIndex; +class OutputDevice; +class SwPageDesc; +class SwTableBox; +struct SwFindRowSpanCacheObj; + +#if defined(MSC) +#define MA_FASTCALL __fastcall +#else +#define MA_FASTCALL +#endif + +#define WEIT_WECH LONG_MAX - 20000 //Initale Position der Flys. +#define BROWSE_HEIGHT 56700L * 10L //10 Meter +//#define BROWSE_HEIGHT 1440L * 45L // 45 inch, maximum size for pdf files + +#define GRFNUM_NO 0 +#define GRFNUM_YES 1 +#define GRFNUM_REPLACE 2 + +//Painten des Hintergrunds. Mit Brush oder Graphic. +// OD 05.08.2002 #99657# - add 6th parameter to indicate that method should +// consider background transparency, saved in the color of the brush item +void MA_FASTCALL DrawGraphic( const SvxBrushItem *, OutputDevice *, + const SwRect &rOrg, const SwRect &rOut, const sal_uInt8 nGrfNum = GRFNUM_NO, + const sal_Bool bConsiderBackgroundTransparency = sal_False ); + +// OD 24.01.2003 #106593# - method to align rectangle +// Created declaration here to avoid <extern> declarations +void MA_FASTCALL SwAlignRect( SwRect &rRect, ViewShell *pSh ); + +// OD 24.01.2003 #106593# - method to align graphic rectangle +// Created declaration here to avoid <extern> declarations +void SwAlignGrfRect( SwRect *pGrfRect, const OutputDevice &rOut ); + +//Fly besorgen, wenn keine List hineingereicht wird, wir die der aktuellen +//Shell benutzt. +//Implementierung in feshview.cxx +SwFlyFrm *GetFlyFromMarked( const SdrMarkList *pLst, ViewShell *pSh ); + +//Nicht gleich die math.lib anziehen. +sal_uLong MA_FASTCALL SqRt( BigInt nX ); + +SwFrm *SaveCntnt( SwLayoutFrm *pLay, SwFrm *pStart ); +void RestoreCntnt( SwFrm *pSav, SwLayoutFrm *pParent, SwFrm *pSibling, bool bGrow ); + +//CntntNodes besorgen, CntntFrms erzeugen und in den LayFrm haengen. +void MA_FASTCALL _InsertCnt( SwLayoutFrm *pLay, SwDoc *pDoc, sal_uLong nIndex, + sal_Bool bPages = sal_False, sal_uLong nEndIndex = 0, + SwFrm *pPrv = 0 ); + +//Erzeugen der Frames fuer einen bestimmten Bereich, verwendet _InsertCnt +void MakeFrms( SwDoc *pDoc, const SwNodeIndex &rSttIdx, + const SwNodeIndex &rEndIdx ); + +//Um z.B. fuer Tabelleheadlines das Erzeugen der Flys in _InsertCnt zu unterbinden. +extern sal_Bool bDontCreateObjects; + +//Fuer FlyCnts, siehe SwFlyAtCntFrm::MakeAll() +extern sal_Bool bSetCompletePaintOnInvalidate; + +//Fuer Tabelleneinstellung per Tastatur. +long MA_FASTCALL CalcRowRstHeight( SwLayoutFrm *pRow ); +long MA_FASTCALL CalcHeightWidthFlys( const SwFrm *pFrm ); //MA_FLY_HEIGHT + +//Neue Seite einsetzen +SwPageFrm * MA_FASTCALL InsertNewPage( SwPageDesc &rDesc, SwFrm *pUpper, + sal_Bool bOdd, sal_Bool bInsertEmpty, sal_Bool bFtn, + SwFrm *pSibling ); + +//Flys bei der Seite anmelden. +void RegistFlys( SwPageFrm*, const SwLayoutFrm* ); + +//Benachrichtung des Fly Hintergrundes wenn Notwendig. +void Notify( SwFlyFrm *pFly, SwPageFrm *pOld, const SwRect &rOld, + const SwRect* pOldRect = 0 ); + +void Notify_Background( const SdrObject* pObj, + SwPageFrm* pPage, + const SwRect& rRect, + const PrepareHint eHint, + const sal_Bool bInva ); + +const SwFrm* GetVirtualUpper( const SwFrm* pFrm, const Point& rPos ); + +sal_Bool Is_Lower_Of( const SwFrm *pCurrFrm, const SdrObject* pObj ); + +const SwFrm *FindKontext( const SwFrm *pFrm, sal_uInt16 nAdditionalKontextTyp ); + +sal_Bool IsFrmInSameKontext( const SwFrm *pInnerFrm, const SwFrm *pFrm ); + +const SwFrm * MA_FASTCALL FindPage( const SwRect &rRect, const SwFrm *pPage ); + +// JP 07.05.98: wird von SwCntntNode::GetFrm und von SwFlyFrm::GetFrm +// gerufen +SwFrm* GetFrmOfModify( const SwRootFrm* pLayout, SwModify const&, sal_uInt16 const nFrmType, const Point* = 0, + const SwPosition *pPos = 0, + const sal_Bool bCalcFrm = sal_False ); + +//Sollen ExtraDaten (Reline-Strich, Zeilennummern) gepaintet werden? +sal_Bool IsExtraData( const SwDoc *pDoc ); + +// OD 14.03.2003 #i11760# - method declaration <CalcCntnt(..)> +void CalcCntnt( SwLayoutFrm *pLay, + bool bNoColl = false, + bool bNoCalcFollow = false ); + + +//Die Notify-Klassen merken sich im CTor die aktuellen Groessen und fuehren +//im DTor ggf. die notwendigen Benachrichtigungen durch. + +class SwFrmNotify +{ +protected: + SwFrm *pFrm; + const SwRect aFrm; + const SwRect aPrt; + SwTwips mnFlyAnchorOfst; + SwTwips mnFlyAnchorOfstNoWrap; + sal_Bool bHadFollow; + sal_Bool bInvaKeep; + sal_Bool bValidSize; +protected: + // --> OD 2005-07-29 #i49383# + bool mbFrmDeleted; + // <-- + +public: + SwFrmNotify( SwFrm *pFrm ); + ~SwFrmNotify(); + + const SwRect &Frm() const { return aFrm; } + const SwRect &Prt() const { return aPrt; } + void SetInvaKeep() { bInvaKeep = sal_True; } + // --> OD 2005-07-29 #i49383# + void FrmDeleted() + { + mbFrmDeleted = true; + } + // <-- +}; + +class SwLayNotify : public SwFrmNotify +{ + sal_Bool bLowersComplete; + + SwLayoutFrm *GetLay() { return (SwLayoutFrm*)pFrm; } +public: + SwLayNotify( SwLayoutFrm *pLayFrm ); + ~SwLayNotify(); + + void SetLowersComplete( sal_Bool b ) { bLowersComplete = b; } + sal_Bool IsLowersComplete() { return bLowersComplete; } +}; + +class SwFlyNotify : public SwLayNotify +{ + SwPageFrm *pOldPage; + const SwRect aFrmAndSpace; + SwFlyFrm *GetFly() { return (SwFlyFrm*)pFrm; } +public: + SwFlyNotify( SwFlyFrm *pFlyFrm ); + ~SwFlyNotify(); + + SwPageFrm *GetOldPage() const { return pOldPage; } +}; + +class SwCntntNotify : public SwFrmNotify +{ +private: + // OD 08.01.2004 #i11859# + bool mbChkHeightOfLastLine; + SwTwips mnHeightOfLastLine; + + // OD 2004-02-26 #i25029# + bool mbInvalidatePrevPrtArea; + bool mbBordersJoinedWithPrev; + + SwCntntFrm *GetCnt() { return (SwCntntFrm*)pFrm; } + +public: + SwCntntNotify( SwCntntFrm *pCntFrm ); + ~SwCntntNotify(); + + // OD 2004-02-26 #i25029# + void SetInvalidatePrevPrtArea() + { + mbInvalidatePrevPrtArea = true; + } + + void SetBordersJoinedWithPrev() + { + mbBordersJoinedWithPrev = true; + } +}; + +//SwBorderAttrs kapselt die Berechnung fuer die Randattribute inclusive +//Umrandung. Die Attribute und die errechneten Werte werden gecached. +//Neu: Die gesammte Klasse wird gecached. + +//!!!Achtung: Wenn weitere Attribute gecached werden muss unbedingt die +//Methode Modify::Modify mitgepflegt werden!!! + +// OD 23.01.2003 #106895# - delete old method <SwBorderAttrs::CalcRight()> and +// the stuff that belongs to it. +class SwBorderAttrs : public SwCacheObj +{ + const SwAttrSet &rAttrSet; + const SvxULSpaceItem &rUL; + // --> OD 2008-12-04 #i96772# + SvxLRSpaceItem rLR; + // <-- + const SvxBoxItem &rBox; + const SvxShadowItem &rShadow; + const Size aFrmSize; //Die FrmSize + + sal_Bool bBorderDist :1; //Ist's ein Frm der auch ohne Linie + //einen Abstand haben kann? + + //Mit den Folgenden Bools werden die gecache'ten Werte fuer UNgueltig + //erklaert - bis sie einmal berechnet wurden. + sal_Bool bTopLine :1; + sal_Bool bBottomLine :1; + sal_Bool bLeftLine :1; + sal_Bool bRightLine :1; + sal_Bool bTop :1; + sal_Bool bBottom :1; + sal_Bool bLine :1; + + sal_Bool bIsLine :1; //Umrandung an mind. einer Kante? + + sal_Bool bCacheGetLine :1; //GetTopLine(), GetBottomLine() cachen? + sal_Bool bCachedGetTopLine :1; //GetTopLine() gecached? + sal_Bool bCachedGetBottomLine :1; //GetBottomLine() gecached? + // OD 21.05.2003 #108789# - booleans indicating, if values <bJoinedWithPrev> + // and <bJoinedWithNext> are cached and valid. + // Caching depends on value of <bCacheGetLine>. + mutable sal_Bool bCachedJoinedWithPrev :1; + mutable sal_Bool bCachedJoinedWithNext :1; + // OD 21.05.2003 #108789# - booleans indicating, if borders are joined + // with previous/next frame. + sal_Bool bJoinedWithPrev :1; + sal_Bool bJoinedWithNext :1; + + //Die gecache'ten Werte, undefiniert bis sie einmal berechnet wurden. + sal_uInt16 nTopLine, + nBottomLine, + nLeftLine, + nRightLine, + nTop, + nBottom, + nGetTopLine, + nGetBottomLine; + + //Nur die Lines + Shadow errechnen. + void _CalcTopLine(); + void _CalcBottomLine(); + void _CalcLeftLine(); + void _CalcRightLine(); + + //Lines + Shadow + Abstaende + void _CalcTop(); + void _CalcBottom(); + + void _IsLine(); + + // OD 2004-02-26 #i25029# - add optional 2nd parameter <_pPrevFrm> + // If set, its value is taken for testing, if borders/shadow have to joined + // with previous frame. + void _GetTopLine ( const SwFrm& _rFrm, + const SwFrm* _pPrevFrm = 0L ); + void _GetBottomLine( const SwFrm& _rFrm ); + + // OD 21.05.2003 #108789# - private methods to calculate cached values + // <bJoinedWithPrev> and <bJoinedWithNext>. + // OD 2004-02-26 #i25029# - add optional 2nd parameter <_pPrevFrm> + // If set, its value is taken for testing, if borders/shadow have to joined + // with previous frame. + void _CalcJoinedWithPrev( const SwFrm& _rFrm, + const SwFrm* _pPrevFrm = 0L ); + void _CalcJoinedWithNext( const SwFrm& _rFrm ); + + // OD 21.05.2003 #108789# - internal helper method for methods + // <_CalcJoinedWithPrev> and <_CalcJoinedWithNext>. + sal_Bool _JoinWithCmp( const SwFrm& _rCallerFrm, + const SwFrm& _rCmpFrm ) const; + + //Rechte und linke Linie sowie LRSpace gleich? + // OD 21.05.2003 #108789# - change name of 1st parameter - "rAttrs" -> "rCmpAttrs". + sal_Bool CmpLeftRight( const SwBorderAttrs &rCmpAttrs, + const SwFrm *pCaller, + const SwFrm *pCmp ) const; + +public: + DECL_FIXEDMEMPOOL_NEWDEL(SwBorderAttrs) + + SwBorderAttrs( const SwModify *pOwner, const SwFrm *pConstructor ); + ~SwBorderAttrs(); + + inline const SwAttrSet &GetAttrSet() const { return rAttrSet; } + inline const SvxULSpaceItem &GetULSpace() const { return rUL; } + inline const SvxLRSpaceItem &GetLRSpace() const { return rLR; } + inline const SvxBoxItem &GetBox() const { return rBox; } + inline const SvxShadowItem &GetShadow() const { return rShadow; } + + inline sal_uInt16 CalcTopLine() const; + inline sal_uInt16 CalcBottomLine() const; + inline sal_uInt16 CalcLeftLine() const; + inline sal_uInt16 CalcRightLine() const; + inline sal_uInt16 CalcTop() const; + inline sal_uInt16 CalcBottom() const; + long CalcLeft( const SwFrm *pCaller ) const; + long CalcRight( const SwFrm *pCaller ) const; + + inline sal_Bool IsLine() const; + + inline const Size &GetSize() const { return aFrmSize; } + + inline sal_Bool IsBorderDist() const { return bBorderDist; } + + //Sollen obere bzw. untere Umrandung fuer den Frm ausgewertet werden? + // OD 2004-02-26 #i25029# - add optional 2nd parameter <_pPrevFrm> + // If set, its value is taken for testing, if borders/shadow have to joined + // with previous frame. + inline sal_uInt16 GetTopLine ( const SwFrm& _rFrm, + const SwFrm* _pPrevFrm = 0L ) const; + inline sal_uInt16 GetBottomLine( const SwFrm& _rFrm ) const; + inline void SetGetCacheLine( sal_Bool bNew ) const; + // OD 21.05.2003 #108789# - accessors for cached values <bJoinedWithPrev> + // and <bJoinedWithPrev> + // OD 2004-02-26 #i25029# - add optional 2nd parameter <_pPrevFrm> + // If set, its value is taken for testing, if borders/shadow have to joined + // with previous frame. + sal_Bool JoinedWithPrev( const SwFrm& _rFrm, + const SwFrm* _pPrevFrm = 0L ) const; + sal_Bool JoinedWithNext( const SwFrm& _rFrm ) const; +}; + +class SwBorderAttrAccess : public SwCacheAccess +{ + const SwFrm *pConstructor; //opt: Zur weitergabe an SwBorderAttrs +protected: + virtual SwCacheObj *NewObj(); + +public: + SwBorderAttrAccess( SwCache &rCache, const SwFrm *pOwner ); + + SwBorderAttrs *Get(); +}; + +//--------------------------------------------------------------------- +//Iterator fuer die DrawObjecte einer Seite. Die Objecte werden Nach ihrer +//Z-Order iteriert. +//Das iterieren ist nicht eben billig, denn fuer alle Operationen muss jeweils +//ueber das gesamte SortArray iteriert werden. +class SwOrderIter +{ + const SwPageFrm *pPage; + const SdrObject *pCurrent; + const sal_Bool bFlysOnly; +public: + SwOrderIter( const SwPageFrm *pPage, sal_Bool bFlysOnly = sal_True ); + + void Current( const SdrObject *pNew ) { pCurrent = pNew; } + const SdrObject *Current() const { return pCurrent; } + const SdrObject *operator()() const { return pCurrent; } + const SdrObject *Top(); + const SdrObject *Bottom(); + const SdrObject *Next(); + const SdrObject *Prev(); +}; + + +class StackHack +{ + static sal_uInt8 nCnt; + static sal_Bool bLocked; +public: + StackHack() + { + if ( ++StackHack::nCnt > 50 ) + StackHack::bLocked = sal_True; + } + ~StackHack() + { + if ( --StackHack::nCnt < 5 ) + StackHack::bLocked = sal_False; + } + + static sal_Bool IsLocked() { return StackHack::bLocked; } + static sal_uInt8 Count() { return StackHack::nCnt; } +}; + + +//Sollen obere bzw. untere Umrandung fuer den Frm ausgewertet werden? +// OD 2004-02-26 #i25029# - add optional 2nd parameter <_pPrevFrm> +// If set, its value is taken for testing, if borders/shadow have to joined +// with previous frame. +inline sal_uInt16 SwBorderAttrs::GetTopLine ( const SwFrm& _rFrm, + const SwFrm* _pPrevFrm ) const +{ + if ( !bCachedGetTopLine || _pPrevFrm ) + { + const_cast<SwBorderAttrs*>(this)->_GetTopLine( _rFrm, _pPrevFrm ); + } + return nGetTopLine; +} +inline sal_uInt16 SwBorderAttrs::GetBottomLine( const SwFrm& _rFrm ) const +{ + if ( !bCachedGetBottomLine ) + const_cast<SwBorderAttrs*>(this)->_GetBottomLine( _rFrm ); + return nGetBottomLine; +} +inline void SwBorderAttrs::SetGetCacheLine( sal_Bool bNew ) const +{ + ((SwBorderAttrs*)this)->bCacheGetLine = bNew; + ((SwBorderAttrs*)this)->bCachedGetBottomLine = + ((SwBorderAttrs*)this)->bCachedGetTopLine = sal_False; + // OD 21.05.2003 #108789# - invalidate cache for values <bJoinedWithPrev> + // and <bJoinedWithNext>. + bCachedJoinedWithPrev = sal_False; + bCachedJoinedWithNext = sal_False; +} + +inline sal_uInt16 SwBorderAttrs::CalcTopLine() const +{ + if ( bTopLine ) + ((SwBorderAttrs*)this)->_CalcTopLine(); + return nTopLine; +} +inline sal_uInt16 SwBorderAttrs::CalcBottomLine() const +{ + if ( bBottomLine ) + ((SwBorderAttrs*)this)->_CalcBottomLine(); + return nBottomLine; +} +inline sal_uInt16 SwBorderAttrs::CalcLeftLine() const +{ + if ( bLeftLine ) + ((SwBorderAttrs*)this)->_CalcLeftLine(); + return nLeftLine; +} +inline sal_uInt16 SwBorderAttrs::CalcRightLine() const +{ + if ( bRightLine ) + ((SwBorderAttrs*)this)->_CalcRightLine(); + return nRightLine; +} +inline sal_uInt16 SwBorderAttrs::CalcTop() const +{ + if ( bTop ) + ((SwBorderAttrs*)this)->_CalcTop(); + return nTop; +} +inline sal_uInt16 SwBorderAttrs::CalcBottom() const +{ + if ( bBottom ) + ((SwBorderAttrs*)this)->_CalcBottom(); + return nBottom; +} +inline sal_Bool SwBorderAttrs::IsLine() const +{ + if ( bLine ) + ((SwBorderAttrs*)this)->_IsLine(); + return bIsLine; +} + +/** method to determine the spacing values of a frame + + OD 2004-03-10 #i28701# + Values only provided for flow frames (table, section or text frames) + Note: line spacing value is only determined for text frames + OD 2009-08-28 #i102458# + Add output parameter <obIsLineSpacingProportional> + + @param rFrm + input parameter - frame, for which the spacing values are determined. + + @param onPrevLowerSpacing + output parameter - lower spacing of the frame in SwTwips + + @param onPrevLineSpacing + output parameter - line spacing of the frame in SwTwips + + @param obIsLineSpacingProportional + + @author OD +*/ +void GetSpacingValuesOfFrm( const SwFrm& rFrm, + SwTwips& onLowerSpacing, + SwTwips& onLineSpacing, + bool& obIsLineSpacingProportional ); + +/** method to get the content of the table cell + + Content from any nested tables will be omitted. + Note: line spacing value is only determined for text frames + + @param rCell_ + input parameter - the cell which should be searched for content. + + return + pointer to the found content frame or 0 +*/ + +const SwCntntFrm* GetCellCntnt( const SwLayoutFrm& rCell_ ); + + +/** helper class to check if a frame has been deleted during an operation + * !!!WARNING!!! This should only be used as a last and desperate means + * to make the code robust. + */ + +class SwDeletionChecker +{ + private: + + const SwFrm* mpFrm; + const SwModify* mpRegIn; + + public: + + SwDeletionChecker( const SwFrm* pFrm ) + : mpFrm( pFrm ), + mpRegIn( pFrm ? const_cast<SwFrm*>(pFrm)->GetRegisteredIn() : 0 ) + { + } + + /** + * return + * true if mpFrm != 0 and mpFrm is not client of pRegIn + * false otherwise + */ + bool HasBeenDeleted(); +}; + +#endif //_FRMTOOL_HXX diff --git a/sw/source/core/inc/ftnboss.hxx b/sw/source/core/inc/ftnboss.hxx new file mode 100644 index 000000000000..e993951d7143 --- /dev/null +++ b/sw/source/core/inc/ftnboss.hxx @@ -0,0 +1,137 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _FTNBOSS_HXX +#define _FTNBOSS_HXX + +#include "layfrm.hxx" + +class SwFtnBossFrm; +class SwFtnContFrm; +class SwFtnFrm; +class SwTxtFtn; + + +//Setzen des maximalen Fussnotenbereiches. Restaurieren des alten Wertes im DTor. +//Implementierung im ftnfrm.cxx +class SwSaveFtnHeight +{ + SwFtnBossFrm *pBoss; + const SwTwips nOldHeight; + SwTwips nNewHeight; +public: + SwSaveFtnHeight( SwFtnBossFrm *pBs, const SwTwips nDeadLine ); + ~SwSaveFtnHeight(); +}; + +#define NA_ONLY_ADJUST 0 +#define NA_GROW_SHRINK 1 +#define NA_GROW_ADJUST 2 +#define NA_ADJUST_GROW 3 + +class SwFtnBossFrm: public SwLayoutFrm +{ + //Fuer die privaten Fussnotenoperationen + friend class SwFrm; + friend class SwSaveFtnHeight; + friend class SwPageFrm; // fuer das Setzen der MaxFtnHeight + + //Maximale Hoehe des Fussnotencontainers fuer diese Seite. + SwTwips nMaxFtnHeight; + + SwFtnContFrm *MakeFtnCont(); + SwFtnFrm *FindFirstFtn(); + sal_uInt8 _NeighbourhoodAdjustment( const SwFrm* pFrm ) const; +protected: + + void InsertFtn( SwFtnFrm * ); + static void ResetFtn( const SwFtnFrm *pAssumed ); +public: + inline SwFtnBossFrm( SwFrmFmt* pFmt, SwFrm* pSib ) : SwLayoutFrm( pFmt, pSib ) {} + + SwLayoutFrm *FindBodyCont(); + inline const SwLayoutFrm *FindBodyCont() const; + inline void SetMaxFtnHeight( const SwTwips nNewMax ) { nMaxFtnHeight = nNewMax; } + + //Fussnotenschnittstelle + void AppendFtn( SwCntntFrm *, SwTxtFtn * ); + void RemoveFtn( const SwCntntFrm *, const SwTxtFtn *, sal_Bool bPrep = sal_True ); + static SwFtnFrm *FindFtn( const SwCntntFrm *, const SwTxtFtn * ); + SwFtnContFrm *FindFtnCont(); + inline const SwFtnContFrm *FindFtnCont() const; + const SwFtnFrm *FindFirstFtn( SwCntntFrm* ) const; + SwFtnContFrm *FindNearestFtnCont( sal_Bool bDontLeave = sal_False ); + + void ChangeFtnRef( const SwCntntFrm *pOld, const SwTxtFtn *, + SwCntntFrm *pNew ); + void RearrangeFtns( const SwTwips nDeadLine, const sal_Bool bLock = sal_False, + const SwTxtFtn *pAttr = 0 ); + + //SS damit der Textformatierer Temporaer die Fussnotenhoehe begrenzen + //kann. DeadLine in Dokumentkoordinaten. + void SetFtnDeadLine( const SwTwips nDeadLine ); + SwTwips GetMaxFtnHeight() const { return nMaxFtnHeight; } + + //Liefert den Wert, der noch uebrig ist, bis der Body seine minimale + //Hoehe erreicht hat. + SwTwips GetVarSpace() const; + + //Layoutseitig benoetigte Methoden + /// OD 03.04.2003 #108446# - add parameters <_bCollectOnlyPreviousFtns> and + /// <_pRefFtnBossFrm> in order to control, if only footnotes, which are positioned + /// before the given reference footnote boss frame have to be collected. + /// Note: if parameter <_bCollectOnlyPreviousFtns> is true, then parameter + /// <_pRefFtnBossFrm> have to be referenced to an object. + static void _CollectFtns( const SwCntntFrm* _pRef, + SwFtnFrm* _pFtn, + SvPtrarr& _rFtnArr, + const sal_Bool _bCollectOnlyPreviousFtns = sal_False, + const SwFtnBossFrm* _pRefFtnBossFrm = NULL); + /// OD 03.04.2003 #108446# - add parameter <_bCollectOnlyPreviousFtns> in + /// order to control, if only footnotes, which are positioned before the + /// footnote boss frame <this> have to be collected. + void CollectFtns( const SwCntntFrm* _pRef, + SwFtnBossFrm* _pOld, + SvPtrarr& _rFtnArr, + const sal_Bool _bCollectOnlyPreviousFtns = sal_False ); + void _MoveFtns( SvPtrarr &rFtnArr, sal_Bool bCalc = sal_False ); + void MoveFtns( const SwCntntFrm *pSrc, SwCntntFrm *pDest, + SwTxtFtn *pAttr ); + // Sollte AdjustNeighbourhood gerufen werden (oder Grow/Shrink)? + sal_uInt8 NeighbourhoodAdjustment( const SwFrm* pFrm ) const + { return IsPageFrm() ? NA_ONLY_ADJUST : _NeighbourhoodAdjustment( pFrm ); } +}; + +inline const SwLayoutFrm *SwFtnBossFrm::FindBodyCont() const +{ + return ((SwFtnBossFrm*)this)->FindBodyCont(); +} +inline const SwFtnContFrm *SwFtnBossFrm::FindFtnCont() const +{ + return ((SwFtnBossFrm*)this)->FindFtnCont(); +} + +#endif //_FTNBOSS_HXX diff --git a/sw/source/core/inc/ftnfrm.hxx b/sw/source/core/inc/ftnfrm.hxx new file mode 100644 index 000000000000..c70493b3a6ca --- /dev/null +++ b/sw/source/core/inc/ftnfrm.hxx @@ -0,0 +1,150 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _FTNFRM_HXX +#define _FTNFRM_HXX + +#include "layfrm.hxx" + +class SwCntntFrm; +class SwTxtFtn; +class SwBorderAttrs; +class SwFtnFrm; + +//Fuer Fussnoten gibt es einen Speziellen Bereich auf der Seite. Dieser +//Bereich ist ein SwFtnContFrm. +//Jede Fussnote ist durch einen SwFtnFrm abgegrenzt, dieser nimmt die +//Fussnotenabsaetze auf. SwFtnFrm koennen aufgespalten werden, sie gehen +//dann auf einer anderen Seite weiter. + +class SwFtnContFrm: public SwLayoutFrm +{ +public: + SwFtnContFrm( SwFrmFmt*, SwFrm* ); + + const SwFtnFrm* FindFootNote() const; + + virtual SwTwips ShrinkFrm( SwTwips, sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False ); + virtual SwTwips GrowFrm ( SwTwips, sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False ); + virtual void Format( const SwBorderAttrs *pAttrs = 0 ); + virtual void PaintBorder( const SwRect &, const SwPageFrm *pPage, + const SwBorderAttrs & ) const; + void PaintLine( const SwRect &, const SwPageFrm * ) const; +}; + +class SwFtnFrm: public SwLayoutFrm +{ + //Zeiger auf den FtnFrm in dem die Fussnote weitergefuehrt wird: + // 0 wenn kein Follow vorhanden, + // this beim letzten + // der Follow sonst. + SwFtnFrm *pFollow; + SwFtnFrm *pMaster; //Der FtnFrm dessen Follow ich bin. + SwCntntFrm *pRef; //In diesem CntntFrm steht die Fussnotenref. + SwTxtFtn *pAttr; //Fussnotenattribut (zum wiedererkennen) + + sal_Bool bBackMoveLocked : 1; //Absaetze in dieser Fussnote duerfen derzeit + //nicht rueckwaerts fliessen. + // --> OD 2005-05-18 #i49383# - control unlock of position of lower anchored objects. + bool mbUnlockPosOfLowerObjs : 1; + // <-- +#ifdef DBG_UTIL +protected: + virtual SwTwips ShrinkFrm( SwTwips, sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False ); + virtual SwTwips GrowFrm ( SwTwips, sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False ); +#endif + + +public: + SwFtnFrm( SwFrmFmt*, SwFrm*, SwCntntFrm*, SwTxtFtn* ); + + virtual void Cut(); + virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 ); + + sal_Bool operator<( const SwTxtFtn* pTxtFtn ) const; + +#ifndef DBG_UTIL + const SwCntntFrm *GetRef() const { return pRef; } + SwCntntFrm *GetRef() { return pRef; } +#else + //JP 15.10.2001: in a non pro version test if the attribute has the same + // meaning which his reference is + const SwCntntFrm *GetRef() const; + SwCntntFrm *GetRef(); +#endif + const SwCntntFrm *GetRefFromAttr() const; + SwCntntFrm *GetRefFromAttr(); + + const SwFtnFrm *GetFollow() const { return pFollow; } + SwFtnFrm *GetFollow() { return pFollow; } + + const SwFtnFrm *GetMaster() const { return pMaster; } + SwFtnFrm *GetMaster() { return pMaster; } + + const SwTxtFtn *GetAttr() const { return pAttr; } + SwTxtFtn *GetAttr() { return pAttr; } + + void SetFollow( SwFtnFrm *pNew ) { pFollow = pNew; } + void SetMaster( SwFtnFrm *pNew ) { pMaster = pNew; } + void SetRef ( SwCntntFrm *pNew ) { pRef = pNew; } + + void InvalidateNxtFtnCnts( SwPageFrm* pPage ); + + void LockBackMove() { bBackMoveLocked = sal_True; } + void UnlockBackMove() { bBackMoveLocked = sal_False;} + sal_Bool IsBackMoveLocked() { return bBackMoveLocked; } + + // Verhindert, dass der letzte Inhalt den SwFtnFrm mitloescht (Cut()) + inline void ColLock() { bColLocked = sal_True; } + inline void ColUnlock() { bColLocked = sal_False; } + + // --> OD 2005-05-18 #i49383# + inline void UnlockPosOfLowerObjs() + { + mbUnlockPosOfLowerObjs = true; + } + inline void KeepLockPosOfLowerObjs() + { + mbUnlockPosOfLowerObjs = false; + } + inline bool IsUnlockPosOfLowerObjs() + { + return mbUnlockPosOfLowerObjs; + } + // <-- + /** search for last content in the current footnote frame + + OD 2005-12-02 #i27138# + + @author OD + + @return SwCntntFrm* + pointer to found last content frame. NULL, if none is found. + */ + SwCntntFrm* FindLastCntnt(); +}; + +#endif //_FTNFRM_HXX diff --git a/sw/source/core/inc/hffrm.hxx b/sw/source/core/inc/hffrm.hxx new file mode 100644 index 000000000000..f4a098f9cb1a --- /dev/null +++ b/sw/source/core/inc/hffrm.hxx @@ -0,0 +1,66 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _HFFRM_HXX +#define _HFFRM_HXX + +#include <tools/mempool.hxx> + +#include "layfrm.hxx" + + +class SwHeadFootFrm : public SwLayoutFrm +{ +protected: + void FormatSize(SwTwips nUL, const SwBorderAttrs * pAttrs); + void FormatPrt(SwTwips & nUL, const SwBorderAttrs * pAttrs); + inline sal_Bool GetEatSpacing() const; // in hffrm.cxx +public: + SwHeadFootFrm(SwFrmFmt * pFrm, SwFrm*, sal_uInt16 aType); + virtual void Format( const SwBorderAttrs *pAttrs = 0 ); + virtual SwTwips GrowFrm( SwTwips, + sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False ); + virtual SwTwips ShrinkFrm( SwTwips, + sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False ); +}; + +class SwHeaderFrm: public SwHeadFootFrm +{ +public: + SwHeaderFrm( SwFrmFmt* pFrm, SwFrm* pSib ) : SwHeadFootFrm(pFrm, pSib, FRMC_HEADER) {}; + + DECL_FIXEDMEMPOOL_NEWDEL(SwHeaderFrm) +}; + +class SwFooterFrm: public SwHeadFootFrm +{ +public: + SwFooterFrm( SwFrmFmt* pFrm, SwFrm* pSib ) : SwHeadFootFrm(pFrm, pSib, FRMC_FOOTER) {}; + + DECL_FIXEDMEMPOOL_NEWDEL(SwFooterFrm) +}; + +#endif //_HFFRM_HXX diff --git a/sw/source/core/inc/ifinishedthreadlistener.hxx b/sw/source/core/inc/ifinishedthreadlistener.hxx new file mode 100644 index 000000000000..fe096ba09251 --- /dev/null +++ b/sw/source/core/inc/ifinishedthreadlistener.hxx @@ -0,0 +1,55 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _IFINISHEDTHREADLISTENER_HXX +#define _IFINISHEDTHREADLISTENER_HXX + +#include <osl/interlck.h> + +/** interface class to listen on the finish of a thread + + OD 2007-03-30 #i73788# + Note: The thread provides its ThreadID on the finish notification + + @author OD +*/ +class IFinishedThreadListener +{ + public: + + inline virtual ~IFinishedThreadListener() + { + }; + + virtual void NotifyAboutFinishedThread( const oslInterlockedCount nThreadID ) = 0; + + protected: + + inline IFinishedThreadListener() + { + }; +}; +#endif diff --git a/sw/source/core/inc/ithreadlistenerowner.hxx b/sw/source/core/inc/ithreadlistenerowner.hxx new file mode 100644 index 000000000000..26a5c1bb6fd3 --- /dev/null +++ b/sw/source/core/inc/ithreadlistenerowner.hxx @@ -0,0 +1,58 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _ITHREADLISTENEROWNER_HXX +#define _ITHREADLISTENEROWNER_HXX + +#include <ifinishedthreadlistener.hxx> + +#include <boost/weak_ptr.hpp> + +/** interface class of the owner of a thread listener + + OD 2007-01-30 #i73788# + + @author OD +*/ +class IThreadListenerOwner +{ + public: + + inline virtual ~IThreadListenerOwner() + { + }; + + virtual boost::weak_ptr< IFinishedThreadListener > GetThreadListenerWeakRef() = 0; + + virtual void NotifyAboutFinishedThread( const oslInterlockedCount nThreadID ) = 0; + + protected: + + inline IThreadListenerOwner() + { + }; +}; +#endif diff --git a/sw/source/core/inc/layact.hxx b/sw/source/core/inc/layact.hxx new file mode 100644 index 000000000000..749d5d424fe3 --- /dev/null +++ b/sw/source/core/inc/layact.hxx @@ -0,0 +1,239 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _LAYACT_HXX +#define _LAYACT_HXX +#include "swtypes.hxx" +#include "swrect.hxx" + +class SwRootFrm; +class SwLayoutFrm; +class SwPageFrm; +class SwFlyFrm; +class SwCntntFrm; +class SwTabFrm; +class SwViewImp; +class SwCntntNode; +class SwWait; +// --> OD 2004-06-28 #i28701# +class SfxProgress; + +//Die Verwendung der LayAction laeuft immer gleich ab: +// +// 1. Erzeugen des LayAction-Objektes. +// 2. Einstellen des gewuenschten Verhaltens mittels der Set-Methoden +// 3. Aufruf von Action() +// 4. Baldiges Zerstoeren des Objektes. +// +// Das Objekt meldet sich im CTor beim SwViewImp an und erst im DTor +// wieder ab! Es handelt sich mithin um ein typisches Stackobjekt. + + +class SwLayAction +{ + SwRootFrm *pRoot; + SwViewImp *pImp; //Hier Meldet sich die Action an und ab. + + //Zur Optimierung, damit die Tabellen etwas besser am Crsr kleben beim + //Return/Backspace davor. + //Wenn der erste TabFrm, der sich Paintet (pro Seite) traegt sich im + //Pointer ein. Die CntntFrms unterhalb der Seite brauchen sich + //dann nicht mehr bei der Shell zum Painten anmelden. + const SwTabFrm *pOptTab; + + SwWait *pWait; + + SfxProgress * pProgress; + + //Wenn ein Absatz - oder was auch immer - bei der Formatierung mehr + //als eine Seite rueckwaerts floss traegt er seine neue Seitennummer + //hier ein. Die Steuerung der InternalAction kann dann geeignet reagieren. + sal_uInt16 nPreInvaPage; + + sal_uLong nStartTicks; //Startzeitpunkt der Aktion, vergeht zu viel Zeit kann + //der WaitCrsr per CheckWaitCrsr() eingeschaltet werden. + + sal_uInt16 nInputType; //Bei welchem Input soll die Verarbeitung abgebrochen + //werden? + sal_uInt16 nEndPage; //StatBar Steuerung. + sal_uInt16 nCheckPageNum; //CheckPageDesc() wurde verzoegert wenn != USHRT_MAX + //ab dieser Seite Checken. + + sal_Bool bPaint; //Painten oder nur Formatieren? + sal_Bool bComplete; //Alles bis zum sichtbaren Bereich Formatieren oder + //oder nur den sichtbaren Bereich? + sal_Bool bCalcLayout; //Vollstaendige Reformatierung? + sal_Bool bAgain; //Zur automatisch wiederholten Action wenn Seiten + //geloscht werden. + sal_Bool bNextCycle; //Wiederaufsetzen bei der ersten Ungueltigen Seite. + sal_Bool bInput; //Zum Abbrechen der Verarbeitung wenn ein Input anliegt. + sal_Bool bIdle; //True wenn die Layaction vom Idler ausgeloest wurde. + sal_Bool bReschedule; //Soll das Reschedule - abhaengig vom Progress - + //gerufen werden? + sal_Bool bCheckPages; //CheckPageDescs() ausfuehren oder verzoegern. + sal_Bool bUpdateExpFlds;//Wird gesetzt wenn nach dem Formatierien noch eine + //Runde fuer den ExpFld laufen muss. + sal_Bool bBrowseActionStop; //Action fruehzeitig beenden (per bInput) und den + //Rest dem Idler ueberlassen. + sal_Bool bWaitAllowed; //Wartecursor erlaubt? + sal_Bool bPaintExtraData; //Anzeige von Zeilennumerierung o. ae. eingeschaltet? + sal_Bool bActionInProgress; // wird in Action() anfangs gesetzt und zum Schluss geloescht + + // OD 14.04.2003 #106346# - new flag for content formatting on interrupt. + sal_Bool mbFormatCntntOnInterrupt; + +#ifdef _LAYACT_CXX + + void PaintCntnt( const SwCntntFrm *, const SwPageFrm *, + const SwRect &rOldRect, long nOldBottom ); + sal_Bool PaintWithoutFlys( const SwRect &, const SwCntntFrm *, + const SwPageFrm * ); + inline sal_Bool _PaintCntnt( const SwCntntFrm *, const SwPageFrm *, + const SwRect & ); + + sal_Bool FormatLayout( SwLayoutFrm *, sal_Bool bAddRect = sal_True ); + sal_Bool FormatLayoutTab( SwTabFrm *, sal_Bool bAddRect = sal_True ); + sal_Bool FormatCntnt( const SwPageFrm* pPage ); + void _FormatCntnt( const SwCntntFrm* pCntnt, + const SwPageFrm* pPage ); + sal_Bool IsShortCut( SwPageFrm *& ); + + sal_Bool TurboAction(); + sal_Bool _TurboAction( const SwCntntFrm * ); + void InternalAction(); + + SwPageFrm *CheckFirstVisPage( SwPageFrm *pPage ); + + sal_Bool RemoveEmptyBrowserPages(); + + inline void CheckIdleEnd(); + inline sal_uLong GetStartTicks() { return nStartTicks; } + +#endif + +public: + SwLayAction( SwRootFrm *pRt, SwViewImp *pImp ); + ~SwLayAction(); + +#ifdef _LAYACT_CXX + void SetIdle ( sal_Bool bNew ) { bIdle = bNew; } + void SetCheckPages ( sal_Bool bNew ) { bCheckPages = bNew; } + void SetBrowseActionStop(sal_Bool bNew ) { bBrowseActionStop = bNew; } + void SetNextCycle ( sal_Bool bNew ) { bNextCycle = bNew; } + + sal_Bool IsWaitAllowed() const { return bWaitAllowed; } + sal_Bool IsNextCycle() const { return bNextCycle; } + sal_Bool IsInput() const { return bInput; } + sal_Bool IsWait() const { return 0 != pWait; } + sal_Bool IsPaint() const { return bPaint; } + sal_Bool IsIdle() const { return bIdle; } + sal_Bool IsReschedule() const { return bReschedule; } + sal_Bool IsPaintExtraData() const { return bPaintExtraData;} + sal_Bool IsStopPrt() const; + sal_Bool IsInterrupt() const { return IsInput() || IsStopPrt(); } + + sal_uInt16 GetInputType() const { return nInputType; } +#endif + + //Einstellen der Action auf das gewuenschte Verhalten. + void SetPaint ( sal_Bool bNew ) { bPaint = bNew; } + void SetComplete ( sal_Bool bNew ) { bComplete = bNew; } + void SetStatBar ( sal_Bool bNew ); + void SetInputType ( sal_uInt16 nNew ) { nInputType = nNew; } + void SetCalcLayout ( sal_Bool bNew ) { bCalcLayout = bNew; } + void SetReschedule ( sal_Bool bNew ) { bReschedule = bNew; } + void SetWaitAllowed ( sal_Bool bNew ) { bWaitAllowed = bNew; } + + void SetAgain() { bAgain = sal_True; } + void SetUpdateExpFlds() {bUpdateExpFlds = sal_True; } + void SetProgress(SfxProgress * _pProgress = NULL) + { pProgress = _pProgress; } + + inline void SetCheckPageNum( sal_uInt16 nNew ); + inline void SetCheckPageNumDirect( sal_uInt16 nNew ) { nCheckPageNum = nNew; } + + void Action(); //Jetzt gehts loos... + void Reset(); //Zurueck auf CTor-Defaults. + + sal_Bool IsAgain() const { return bAgain; } + sal_Bool IsComplete() const { return bComplete; } + sal_Bool IsExpFlds() const { return bUpdateExpFlds; } + sal_Bool IsCalcLayout() const { return bCalcLayout; } + sal_Bool IsCheckPages() const { return bCheckPages; } + sal_Bool IsBrowseActionStop() const { return bBrowseActionStop; } + sal_Bool IsActionInProgress() const { return bActionInProgress; } + + sal_uInt16 GetCheckPageNum() const { return nCheckPageNum; } + + //Auch andere sollen den Wartecrsr einschalten koennen. + void CheckWaitCrsr(); + + // --> OD 2004-06-09 #i28701# - method is now public; + // delete 2nd parameter, because its not used; + sal_Bool FormatLayoutFly( SwFlyFrm * ); + // --> OD 2004-06-09 #i28701# - method is now public + sal_Bool _FormatFlyCntnt( const SwFlyFrm * ); + +}; + +class SwLayIdle +{ + + SwRootFrm *pRoot; + SwViewImp *pImp; // Hier Meldet sich der Idler an und ab. + SwCntntNode *pCntntNode; // Hier wird die aktuelle Cursorposition + xub_StrLen nTxtPos; // zwischengespeichert. + sal_Bool bPageValid; // Konnte die Seite alles validiert werden? + sal_Bool bAllValid; // Konnte alles validiert werden? + +#ifdef DBG_UTIL + sal_Bool bIndicator; +#endif + +#ifdef _LAYACT_CXX + +#ifdef DBG_UTIL + void ShowIdle( ColorData eName ); +#endif + + enum IdleJobType{ ONLINE_SPELLING, AUTOCOMPLETE_WORDS, WORD_COUNT, SMART_TAGS }; // SMARTTAGS + sal_Bool _DoIdleJob( const SwCntntFrm*, IdleJobType ); + sal_Bool DoIdleJob( IdleJobType, sal_Bool bVisAreaOnly ); + +#endif + +public: + SwLayIdle( SwRootFrm *pRt, SwViewImp *pImp ); + ~SwLayIdle(); +}; + +inline void SwLayAction::SetCheckPageNum( sal_uInt16 nNew ) +{ + if ( nNew < nCheckPageNum ) + nCheckPageNum = nNew; +} + +#endif //_LAYACT_HXX diff --git a/sw/source/core/inc/laycache.hxx b/sw/source/core/inc/laycache.hxx new file mode 100644 index 000000000000..0f14067d0bda --- /dev/null +++ b/sw/source/core/inc/laycache.hxx @@ -0,0 +1,77 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _LAYCACHE_HXX +#define _LAYCACHE_HXX + +#include <tools/solar.h> + +class SwDoc; +class SwLayCacheImpl; +class SvStream; + +/************************************************************************* + * class SwLayoutCache + * + * This class allows to save layout information in the file and it contains + * this information after loading of a file. + * Call Write(..) with a stream and the document to save and the page break + * information of the document will be written. + * Call Read(..) with a stream and the member pLayCacheImpl will + * read the information from the stream and store it in an internal structur. + * There's a simple locking mechanism at these classes, + * if somebody reads the information, he increments the lock count by 1, + * during the Read(..) function the lock count will set to $8000. + * + **************************************************************************/ + +class SwLayoutCache +{ + SwLayCacheImpl *pImpl; + sal_uInt16 nLockCount; +public: + SwLayoutCache() : pImpl( NULL ), nLockCount( 0 ) {} + ~SwLayoutCache(); + + void Read( SvStream &rStream ); + void Write( SvStream &rStream, const SwDoc& rDoc ); + + void ClearImpl(); + sal_Bool IsLocked() const { return nLockCount > 0; } + sal_uInt16& GetLockCount() { return nLockCount; } + SwLayCacheImpl *LockImpl() + { if( nLockCount & 0x8000 ) return NULL; + if ( pImpl ) + ++nLockCount; + return pImpl; } + void UnlockImpl() { --nLockCount; } + +#ifdef DBG_UTIL + sal_Bool CompareLayout( const SwDoc& rDoc ) const; +#endif +}; + +#endif diff --git a/sw/source/core/inc/layfrm.hxx b/sw/source/core/inc/layfrm.hxx new file mode 100644 index 000000000000..e782d19ae78f --- /dev/null +++ b/sw/source/core/inc/layfrm.hxx @@ -0,0 +1,210 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_LAYFRM_HXX +#define SW_LAYFRM_HXX + +#include "frame.hxx" + +class SwCntntFrm; +class SwFlowFrm; +class SwFmtCol; +struct SwCrsrMoveState; +class SwFrmFmt; +class SwBorderAttrs; +class SwFmtFrmSize; +class SwCellFrm; + +class SwLayoutFrm: public SwFrm +{ + //Der verkappte SwFrm + friend class SwFlowFrm; + friend class SwFrm; + + //Hebt die Lower waehrend eines Spaltenumbaus auf. + friend SwFrm* SaveCntnt( SwLayoutFrm *, SwFrm * ); + friend void RestoreCntnt( SwFrm *, SwLayoutFrm *, SwFrm *pSibling, bool bGrow ); + +#if OSL_DEBUG_LEVEL > 1 + //entfernt leere SwSectionFrms aus einer Kette + friend SwFrm* SwClearDummies( SwFrm* pFrm ); +#endif + + void CopySubtree( const SwLayoutFrm *pDest ); +protected: + virtual void Format( const SwBorderAttrs *pAttrs = 0 ); + virtual void MakeAll(); + + SwFrm *pLower; + + virtual SwTwips ShrinkFrm( SwTwips, sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False ); + virtual SwTwips GrowFrm ( SwTwips, sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False ); + + long CalcRel( const SwFmtFrmSize &rSz, sal_Bool bWidth ) const; + +public: + // --> OD 2004-06-29 #i28701# + TYPEINFO(); + + void PaintSubsidiaryLines( const SwPageFrm*, const SwRect& ) const; + void RefreshLaySubsidiary( const SwPageFrm*, const SwRect& ) const; + void RefreshExtraData( const SwRect & ) const; + + //Proportionale Groessenanpassung der untergeordneten. + void ChgLowersProp( const Size& rOldSize ); + + void AdjustColumns( const SwFmtCol *pCol, sal_Bool bAdjustAttributes ); + + void ChgColumns( const SwFmtCol &rOld, const SwFmtCol &rNew, + const sal_Bool bChgFtn = sal_False ); + + + //Painted die Column-Trennlinien fuer die innenliegenden Columns. + void PaintColLines( const SwRect &, const SwFmtCol &, + const SwPageFrm * ) const; + + virtual bool FillSelection( SwSelectionList& rList, const SwRect& rRect ) const; + + virtual sal_Bool GetCrsrOfst( SwPosition *, Point&, + SwCrsrMoveState* = 0 ) const; + + virtual void Cut(); + virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 ); + + //sucht den dichtesten Cntnt zum SPoint, wird bei Seiten, Flys und Cells + //benutzt wenn GetCrsrOfst versagt hat. + const SwCntntFrm* GetCntntPos( Point &rPoint, const sal_Bool bDontLeave, + const sal_Bool bBodyOnly = sal_False, + const sal_Bool bCalc = sal_False, + const SwCrsrMoveState *pCMS = 0, + const sal_Bool bDefaultExpand = sal_True ) const; + + SwLayoutFrm( SwFrmFmt*, SwFrm* ); + ~SwLayoutFrm(); + + virtual void Paint( SwRect const&, + SwPrintData const*const pPrintData = NULL ) const; + const SwFrm *Lower() const { return pLower; } + SwFrm *Lower() { return pLower; } + const SwCntntFrm *ContainsCntnt() const; + inline SwCntntFrm *ContainsCntnt(); + const SwCellFrm *FirstCell() const; + inline SwCellFrm *FirstCell(); + // --> OD 2006-02-01 #130797# + // Method <ContainsAny()> doesn't investigate content of footnotes by default. + // But under certain circumstances this investigation is intended. + // Thus, introduce new optional parameter <_bInvestigateFtnForSections>. + // It's default is <false>, still indicating that content of footnotes isn't + // investigated for sections. + const SwFrm *ContainsAny( const bool _bInvestigateFtnForSections = false ) const; + inline SwFrm *ContainsAny( const bool _bInvestigateFtnForSections = false ); + // <-- + sal_Bool IsAnLower( const SwFrm * ) const; + + virtual const SwFrmFmt *GetFmt() const; + virtual SwFrmFmt *GetFmt(); + void SetFrmFmt( SwFrmFmt* ); + + //Verschieben der Ftns aller Lower - ab dem StartCntnt. + //sal_True wenn mindestens eine Ftn verschoben wurde. + //Ruft das Update der Seitennummer wenn bFtnNums gesetzt ist. + sal_Bool MoveLowerFtns( SwCntntFrm *pStart, SwFtnBossFrm *pOldBoss, + SwFtnBossFrm *pNewBoss, const sal_Bool bFtnNums ); + + // --> OD 2004-07-01 #i28701# - change purpose of method and its name + // --> OD 2005-03-11 #i44016# - add parameter <_bUnlockPosOfObjs> to + // force an unlockposition call for the lower objects. + void NotifyLowerObjs( const bool _bUnlockPosOfObjs = false ); + // <-- + + //Invalidiert diejenigen innenliegenden Frames, deren Breite und/oder + //Hoehe Prozentual berechnet werden. Auch Rahmen, die an this oder an + //innenliegenden verankert sind werden ggf. invalidiert. + void InvaPercentLowers( SwTwips nDiff = 0 ); + + //Gerufen von Format fuer Rahmen und Bereichen mit Spalten. + void FormatWidthCols( const SwBorderAttrs &, const SwTwips nBorder, + const SwTwips nMinHeight ); + + // InnerHeight returns the height of the content and may be bigger or + // less than the PrtArea-Height of the layoutframe himself + SwTwips InnerHeight() const; + + /** method to check relative position of layout frame to + a given layout frame. + + OD 08.11.2002 - refactoring of pseudo-local method <lcl_Apres(..)> in + <txtftn.cxx> for #104840#. + + @param _aCheckRefLayFrm + constant reference of an instance of class <SwLayoutFrm> which + is used as the reference for the relative position check. + + @author OD + + @return true, if <this> is positioned before the layout frame <p> + */ + bool IsBefore( const SwLayoutFrm* _pCheckRefLayFrm ) const; + + const SwFrm* GetLastLower() const; + inline SwFrm* GetLastLower(); +}; + +//Um doppelte Implementierung zu sparen wird hier ein bischen gecasted +inline SwCntntFrm* SwLayoutFrm::ContainsCntnt() +{ + return (SwCntntFrm*)(((const SwLayoutFrm*)this)->ContainsCntnt()); +} + +inline SwCellFrm* SwLayoutFrm::FirstCell() +{ + return (SwCellFrm*)(((const SwLayoutFrm*)this)->FirstCell()); +} + +// --> OD 2006-02-01 #130797# +inline SwFrm* SwLayoutFrm::ContainsAny( const bool _bInvestigateFtnForSections ) +{ + return (SwFrm*)(((const SwLayoutFrm*)this)->ContainsAny( _bInvestigateFtnForSections )); +} +// <-- + +// Diese SwFrm-inlines sind hier, damit frame.hxx nicht layfrm.hxx includen muss +inline sal_Bool SwFrm::IsColBodyFrm() const +{ + return nType == FRMC_BODY && GetUpper()->IsColumnFrm(); +} + +inline sal_Bool SwFrm::IsPageBodyFrm() const +{ + return nType == FRMC_BODY && GetUpper()->IsPageFrm(); +} + +inline SwFrm* SwLayoutFrm::GetLastLower() +{ + return const_cast<SwFrm*>(static_cast<const SwLayoutFrm*>(this)->GetLastLower()); +} + +#endif // SW_LAYFRM_HXX diff --git a/sw/source/core/inc/layouter.hxx b/sw/source/core/inc/layouter.hxx new file mode 100644 index 000000000000..db506d302642 --- /dev/null +++ b/sw/source/core/inc/layouter.hxx @@ -0,0 +1,183 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _LAYOUTER_HXX +#define _LAYOUTER_HXX + +#include "swtypes.hxx" + +class SwEndnoter; +class SwDoc; +class SwSectionFrm; +class SwFtnFrm; +class SwPageFrm; +class SwLooping; +class IDocumentLayoutAccess; + +// --> OD 2004-06-23 #i28701# +class SwMovedFwdFrmsByObjPos; +class SwTxtFrm; +// <-- +// --> OD 2004-10-05 #i26945# +class SwRowFrm; +// <-- +// --> OD 2004-10-22 #i35911# +class SwObjsMarkedAsTmpConsiderWrapInfluence; +class SwAnchoredObject; +// <-- +// --> OD 2005-01-12 #i40155# +#include <vector> +class SwFrm; +// <-- +// --> OD 2006-05-10 #i65250# +#include <swtypes.hxx> +#include <hash_map> +class SwFlowFrm; +class SwLayoutFrm; +// <-- + +#define LOOP_PAGE 1 + +class SwLayouter +{ + SwEndnoter* pEndnoter; + SwLooping* pLooping; + void _CollectEndnotes( SwSectionFrm* pSect ); + sal_Bool StartLooping( SwPageFrm* pPage ); + + // --> OD 2004-06-23 #i28701# + SwMovedFwdFrmsByObjPos* mpMovedFwdFrms; + // <-- + // --> OD 2004-10-22 #i35911# + SwObjsMarkedAsTmpConsiderWrapInfluence* mpObjsTmpConsiderWrapInfl; + // <-- + // --> OD 2005-01-12 #i40155# - data structure to collect frames, which are + // marked not to wrap around objects. + std::vector< const SwFrm* > maFrmsNotToWrap; + // <-- + +public: + // --> OD 2006-05-10 #i65250# + // - data structure to collect moving backward layout information + struct tMoveBwdLayoutInfoKey + { + // frame ID of flow frame + sal_uInt32 mnFrmId; + // position of new upper frame + SwTwips mnNewUpperPosX; + SwTwips mnNewUpperPosY; + // size of new upper frame + SwTwips mnNewUpperWidth; + SwTwips mnNewUpperHeight; + // free space in new upper frame + SwTwips mnFreeSpaceInNewUpper; + + }; +private: + struct fMoveBwdLayoutInfoKeyHash + { + size_t operator()( const tMoveBwdLayoutInfoKey& p_key ) const + { + return p_key.mnFrmId; + } + }; + struct fMoveBwdLayoutInfoKeyEq + { + bool operator()( const tMoveBwdLayoutInfoKey& p_key1, + const tMoveBwdLayoutInfoKey& p_key2 ) const + { + return p_key1.mnFrmId == p_key2.mnFrmId && + p_key1.mnNewUpperPosX == p_key2.mnNewUpperPosX && + p_key1.mnNewUpperPosY == p_key2.mnNewUpperPosY && + p_key1.mnNewUpperWidth == p_key2.mnNewUpperWidth && + p_key1.mnNewUpperHeight == p_key2.mnNewUpperHeight && + p_key1.mnFreeSpaceInNewUpper == p_key2.mnFreeSpaceInNewUpper; + } + }; + std::hash_map< const tMoveBwdLayoutInfoKey, sal_uInt16, + fMoveBwdLayoutInfoKeyHash, + fMoveBwdLayoutInfoKeyEq > maMoveBwdLayoutInfo; + // <-- +public: + SwLayouter(); + ~SwLayouter(); + void InsertEndnotes( SwSectionFrm* pSect ); + void CollectEndnote( SwFtnFrm* pFtn ); + sal_Bool HasEndnotes() const; + + void LoopControl( SwPageFrm* pPage, sal_uInt8 nLoop ); + void EndLoopControl(); + void LoopingLouieLight( const SwDoc& rDoc, const SwTxtFrm& rFrm ); + + static void CollectEndnotes( SwDoc* pDoc, SwSectionFrm* pSect ); + static sal_Bool Collecting( SwDoc* pDoc, SwSectionFrm* pSect, SwFtnFrm* pFtn ); + static sal_Bool StartLoopControl( SwDoc* pDoc, SwPageFrm *pPage ); + + // --> OD 2004-06-23 #i28701# + static void ClearMovedFwdFrms( const SwDoc& _rDoc ); + static void InsertMovedFwdFrm( const SwDoc& _rDoc, + const SwTxtFrm& _rMovedFwdFrmByObjPos, + const sal_uInt32 _nToPageNum ); + static bool FrmMovedFwdByObjPos( const SwDoc& _rDoc, + const SwTxtFrm& _rTxtFrm, + sal_uInt32& _ornToPageNum ); + // <-- + // --> OD 2005-01-12 #i40155# - ummark given frame as to be moved forward. + static void RemoveMovedFwdFrm( const SwDoc& _rDoc, + const SwTxtFrm& _rTxtFrm ); + // <-- + // --> OD 2004-10-05 #i26945# + static bool DoesRowContainMovedFwdFrm( const SwDoc& _rDoc, + const SwRowFrm& _rRowFrm ); + // <-- + + // --> OD 2004-10-22 #i35911# + static void ClearObjsTmpConsiderWrapInfluence( const SwDoc& _rDoc ); + static void InsertObjForTmpConsiderWrapInfluence( + const SwDoc& _rDoc, + SwAnchoredObject& _rAnchoredObj ); + // <-- + // --> OD 2005-01-12 #i40155# + static void ClearFrmsNotToWrap( const SwDoc& _rDoc ); + static void InsertFrmNotToWrap( const SwDoc& _rDoc, + const SwFrm& _rFrm ); + static bool FrmNotToWrap( const IDocumentLayoutAccess& _rIDLA, + const SwFrm& _rFrm ); + // <-- + // --> OD 2006-05-10 #i65250# + static bool MoveBwdSuppressed( const SwDoc& p_rDoc, + const SwFlowFrm& p_rFlowFrm, + const SwLayoutFrm& p_rNewUpperFrm ); + static void ClearMoveBwdLayoutInfo( const SwDoc& p_rDoc ); + // <-- +}; + + +extern void LOOPING_LOUIE_LIGHT( bool bCondition, const SwTxtFrm& rTxtFrm ); + +#endif //_LAYOUTER_HXX + + diff --git a/sw/source/core/inc/movedfwdfrmsbyobjpos.hxx b/sw/source/core/inc/movedfwdfrmsbyobjpos.hxx new file mode 100644 index 000000000000..c9cd053802d6 --- /dev/null +++ b/sw/source/core/inc/movedfwdfrmsbyobjpos.hxx @@ -0,0 +1,70 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _MOVEDFWDFRMSBYOBJPOS_HXX +#define _MOVEDFWDFRMSBYOBJPOS_HXX + +#include <map> +#include <sal/types.h> + +class SwTxtNode; +class SwTxtFrm; +// --> OD 2004-10-05 #i26945# +class SwRowFrm; +// <-- + +typedef std::map< const SwTxtNode*, const sal_uInt32 > NodeMap; +typedef std::map< const SwTxtNode*, const sal_uInt32 >::const_iterator NodeMapIter; +typedef NodeMap::value_type NodeMapEntry; + + +class SwMovedFwdFrmsByObjPos +{ + private: + NodeMap maMovedFwdFrms; + + public: + SwMovedFwdFrmsByObjPos(); + ~SwMovedFwdFrmsByObjPos(); + + void Insert( const SwTxtFrm& _rMovedFwdFrmByObjPos, + const sal_uInt32 _nToPageNum ); + + // --> OD 2005-01-12 #i40155# + void Remove( const SwTxtFrm& _rTxtFrm ); + // <-- + + bool FrmMovedFwdByObjPos( const SwTxtFrm& _rTxtFrm, + sal_uInt32& _ornToPageNum ) const; + + // --> OD 2004-10-05 #i26945# + bool DoesRowContainMovedFwdFrm( const SwRowFrm& _rRowFrm ) const; + // <-- + + void Clear() { maMovedFwdFrms.clear(); }; +}; + +#endif diff --git a/sw/source/core/inc/mvsave.hxx b/sw/source/core/inc/mvsave.hxx new file mode 100644 index 000000000000..9269606f2031 --- /dev/null +++ b/sw/source/core/inc/mvsave.hxx @@ -0,0 +1,213 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_MVSAVE_HXX +#define SW_MVSAVE_HXX + +#include <tools/string.hxx> +#include <vcl/keycod.hxx> +#include <svl/svarray.hxx> +#include <IDocumentMarkAccess.hxx> +#include <vector> + +namespace sfx2 { + class MetadatableUndo; +} + +class SvNumberFormatter; +class SvULongs; +class SwDoc; +class SwFmtAnchor; +class SwFrmFmt; +class SwIndex; +class SwNodeIndex; +class SwNodeRange; +class SwPaM; +class SwNode; +struct SwPosition; + +namespace sw { namespace mark +{ + class IMark; + + class SaveBookmark + { + public: + SaveBookmark(bool bSavePos, + bool bSaveOtherPos, + const ::sw::mark::IMark& rBkmk, + const SwNodeIndex& rMvPos, + const SwIndex* pIdx =0); + void SetInDoc(SwDoc* pDoc, + const SwNodeIndex&, + const SwIndex* pIdx =0); + IDocumentMarkAccess::MarkType GetOriginalBkmType() const + { return m_eOrigBkmType; } + + private: + ::rtl::OUString m_aName; + ::rtl::OUString m_aShortName; + KeyCode m_aCode; + bool m_bSavePos; + bool m_bSaveOtherPos; + IDocumentMarkAccess::MarkType m_eOrigBkmType; + sal_uLong m_nNode1; + sal_uLong m_nNode2; + xub_StrLen m_nCntnt1; + xub_StrLen m_nCntnt2; + ::boost::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndo; + }; +}} + +#define SAVEFLY 1 +#define SAVEFLY_SPLIT 2 + +void _DelBookmarks(const SwNodeIndex& rStt, + const SwNodeIndex& rEnd, + ::std::vector< ::sw::mark::SaveBookmark> * SaveBkmk =0, + const SwIndex* pSttIdx =0, + const SwIndex* pEndIdx =0); +void _SaveCntntIdx( SwDoc* pDoc, sal_uLong nNode, xub_StrLen nCntnt, + SvULongs& rSaveArr, sal_uInt8 nSaveFly = 0 ); +void _RestoreCntntIdx( SwDoc* pDoc, SvULongs& rSaveArr, + sal_uLong nNode, xub_StrLen nOffset = 0, + sal_Bool bAuto = sal_False ); +void _RestoreCntntIdx( SvULongs& rSaveArr, const SwNode& rNd, + xub_StrLen nLen, xub_StrLen nCorrLen ); + + +/** data structure to temporarily hold fly anchor positions relative to some + * location. */ +struct _SaveFly +{ + sal_uLong nNdDiff; /// relative node difference + SwFrmFmt* pFrmFmt; /// the fly's frame format + sal_Bool bInsertPosition; /// if true, anchor _at_ insert position + + _SaveFly( sal_uLong nNodeDiff, SwFrmFmt* pFmt, sal_Bool bInsert ) + : nNdDiff( nNodeDiff ), pFrmFmt( pFmt ), bInsertPosition( bInsert ) + { } +}; + +SV_DECL_VARARR( _SaveFlyArr, _SaveFly, 0, 10 ) + +void _RestFlyInRange( _SaveFlyArr& rArr, const SwNodeIndex& rSttIdx, + const SwNodeIndex* pInsPos ); +void _SaveFlyInRange( const SwNodeRange& rRg, _SaveFlyArr& rArr ); +void _SaveFlyInRange( const SwPaM& rPam, const SwNodeIndex& rInsPos, + _SaveFlyArr& rArr, sal_Bool bMoveAllFlys ); + +void DelFlyInRange( const SwNodeIndex& rMkNdIdx, + const SwNodeIndex& rPtNdIdx ); + + +class SwDataChanged +{ + const SwPaM* pPam; + const SwPosition* pPos; + SwDoc* pDoc; + sal_uLong nNode; + xub_StrLen nCntnt; + sal_uInt16 nType; // Insert/Move/Delete/... (UndoIds) + +public: + SwDataChanged( const SwPaM& rPam, sal_uInt16 nType ); + SwDataChanged( SwDoc* pDoc, const SwPosition& rPos, sal_uInt16 nType ); + ~SwDataChanged(); + + sal_uLong GetNode() const { return nNode; } + xub_StrLen GetCntnt() const { return nCntnt; } +}; + + +// Funktions-Deklaration damit auch alles unter der CrsrShell mal die +// Crsr verschieben kann +// die Funktionen rufen nicht die SwDoc::Corr - Methoden! + + // Setzt alle PaMs im Bereich vom Range nach NewPos +void PaMCorrAbs( const SwPaM& rRange, + const SwPosition& rNewPos ); + + // Setzt alle PaMs in OldNode auf relative Pos +void PaMCorrRel( const SwNodeIndex &rOldNode, + const SwPosition &rNewPos, + const xub_StrLen nOffset = 0 ); + + +// Hilfsklasse zum kopieren von absatzgebundenen Flys. Durch die Sortierung +// nach der Ordnungsnummer wird versucht die layout seitige Anordnung +// bei zu behalten +class _ZSortFly +{ + const SwFrmFmt* pFmt; + const SwFmtAnchor* pAnchor; + sal_uInt32 nOrdNum; + +public: + _ZSortFly( const SwFrmFmt* pFrmFmt, const SwFmtAnchor* pFlyAnchor, + sal_uInt32 nArrOrdNum ); + _ZSortFly& operator=( const _ZSortFly& rCpy ) + { + pFmt = rCpy.pFmt, pAnchor = rCpy.pAnchor, nOrdNum = rCpy.nOrdNum; + return *this; + } + + int operator==( const _ZSortFly& ) const { return sal_False; } + int operator<( const _ZSortFly& rCmp ) const + { return nOrdNum < rCmp.nOrdNum; } + + const SwFrmFmt* GetFmt() const { return pFmt; } + const SwFmtAnchor* GetAnchor() const { return pAnchor; } +}; + +SV_DECL_VARARR_SORT( _ZSortFlys, _ZSortFly, 0, 10 ) + + +class SwTblNumFmtMerge +{ + SvNumberFormatter* pNFmt; +public: + SwTblNumFmtMerge( const SwDoc& rSrc, SwDoc& rDest ); + ~SwTblNumFmtMerge(); +}; + + +class _SaveRedlEndPosForRestore +{ + SvPtrarr* pSavArr; + SwNodeIndex* pSavIdx; + xub_StrLen nSavCntnt; + + void _Restore(); +public: + _SaveRedlEndPosForRestore( const SwNodeIndex& rInsIdx, xub_StrLen nCntnt ); + ~_SaveRedlEndPosForRestore(); + void Restore() { if( pSavArr ) _Restore(); } +}; + + +#endif // SW_MVSAVE_HXX + diff --git a/sw/source/core/inc/node2lay.hxx b/sw/source/core/inc/node2lay.hxx new file mode 100644 index 000000000000..c70a084c1b85 --- /dev/null +++ b/sw/source/core/inc/node2lay.hxx @@ -0,0 +1,81 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _NODE2LAY_HXX +#define _NODE2LAY_HXX + +#include <tools/solar.h> + +/* -----------------23.02.99 11:33------------------- + * Die Klasse SwNode2Layout stellt die Verbindung von Nodes zum Layout her. + * Sie liefert einen intelligenten Iterator ueber die zum Node oder Nodebereich + * gehoerenden Frames. Je nach Zweck der Iteration, z.B. um vor oder hinter + * den Frames andere Frames einzufuegen, werden Master/Follows erkannt und nur + * die relevanten zurueckgegeben. Auch wiederholte Tabellenueberschriften werden + * beachtet. + * Es ist auch moeglich, ueber SectionNodes zu iterieren, die durch Schachtelung + * manchmal gar keinem SectionFrm direkt zugeordnet sind, manchmal aber sogar + * mehreren. + * SwNode2Layout ist ein Schnittstelle zwischen der aufrufenden Methode und + * einem SwClientIter, sie waehlt je nach Aufgabenstellung das richtige + * SwModify aus, erzeugt einen SwClientIter und filtert dessen Iterationen + * je nach Aufgabenstellung. + * Die Aufgabenstellung wird durch die Wahl des Ctors bestimmt. + * 1. Das Einsammeln der UpperFrms, damit spaeter RestoreUpperFrms wird, + * wird von MakeFrms gerufen, wenn es keinen PrevNext gibt, vor/hinter den + * die Frames gehaengt werden koennen. + * 2. Die Lieferung der Frames hinter/vor die die neuen Frames eines Nodes + * gehaengt werden muessen, ebenfalls von MakeFrms gerufen. + * --------------------------------------------------*/ + +class SwNode2LayImpl; +class SwFrm; +class SwLayoutFrm; +class SwNode; +class SwNodes; +class Point; +struct SwPosition; + +class SwNode2Layout +{ + SwNode2LayImpl *pImpl; +public: + // Dieser Ctor ist zum Einsammeln der UpperFrms gedacht. + SwNode2Layout( const SwNode& rNd ); + // Dieser Ctor ist fuer das Einfuegen vor oder hinter rNd gedacht, + // nIdx ist der Index des einzufuegenden Nodes + SwNode2Layout( const SwNode& rNd, sal_uLong nIdx ); + ~SwNode2Layout(); + SwFrm* NextFrm(); + SwLayoutFrm* UpperFrm( SwFrm* &rpFrm, const SwNode& rNode ); + void RestoreUpperFrms( SwNodes& rNds, sal_uLong nStt, sal_uLong nEnd ); + + SwFrm *GetFrm( const Point* pDocPos = 0, + const SwPosition *pPos = 0, + const sal_Bool bCalcFrm = sal_True ) const; +}; + +#endif diff --git a/sw/source/core/inc/noteurl.hxx b/sw/source/core/inc/noteurl.hxx new file mode 100644 index 000000000000..647e46511991 --- /dev/null +++ b/sw/source/core/inc/noteurl.hxx @@ -0,0 +1,76 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _NOTEURL_HXX +#define _NOTEURL_HXX + + +#include <svl/svarray.hxx> +#include <tools/string.hxx> +#include "swrect.hxx" + +class ImageMap; +class MapMode; + +class SwURLNote +{ + String aURL; + String aTarget; + SwRect aRect; +public: + SwURLNote( const String& rURL, const String& rTarget, const SwRect& rRect ) + : aURL( rURL ), aTarget( rTarget ), aRect( rRect ) + {} + const String& GetURL() const { return aURL; } + const String& GetTarget() const { return aTarget; } + const SwRect& GetRect() const { return aRect; } + sal_Bool operator==( const SwURLNote& rSwURLNote ) const + { return aRect == rSwURLNote.aRect; } +}; + +typedef SwURLNote* SwURLNotePtr; +SV_DECL_PTRARR_DEL(SwURLNoteList, SwURLNotePtr, 0, 5) + +class SwNoteURL +{ + SwURLNoteList aList; +public: + SwNoteURL() {} + sal_uInt16 Count() const { return aList.Count(); } + void InsertURLNote( const String& rURL, const String& rTarget, + const SwRect& rRect ); + const SwURLNote& GetURLNote( sal_uInt16 nPos ) const + { return *aList.GetObject( nPos ); } + void FillImageMap( ImageMap* pMap, const Point& rPos, const MapMode& rMap ); +}; + +// globale Variable, in NoteURL.Cxx angelegt +extern SwNoteURL *pNoteURL; + + +#endif + diff --git a/sw/source/core/inc/notxtfrm.hxx b/sw/source/core/inc/notxtfrm.hxx new file mode 100644 index 000000000000..b460d7465f3c --- /dev/null +++ b/sw/source/core/inc/notxtfrm.hxx @@ -0,0 +1,79 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_NOTXTFRM_HXX +#define SW_NOTXTFRM_HXX + +#include <cntfrm.hxx> + +class SwNoTxtNode; +class OutputDevice; +class SwBorderAttrs; +class Bitmap; +struct SwCrsrMoveState; + +class SwNoTxtFrm: public SwCntntFrm +{ + friend void _FrmFinit(); + + short nWeight; // "Wichtigkeit" der Grafik + + const Size& GetSize() const; + + void InitCtor(); + + void Format ( const SwBorderAttrs *pAttrs = 0 ); + void PaintCntnt ( OutputDevice*, const SwRect&, const SwRect& ) const; + /// OD 25.09.2002 #99739# - delete unused 3rd parameter + void PaintPicture( OutputDevice*, const SwRect& ) const; +protected: + virtual void MakeAll(); + virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ); +public: + SwNoTxtFrm( SwNoTxtNode * const, SwFrm* ); + ~SwNoTxtFrm(); + + virtual void Paint( SwRect const&, + SwPrintData const*const pPrintData = NULL ) const; + virtual sal_Bool GetCharRect( SwRect &, const SwPosition&, + SwCrsrMoveState* = 0) const; + sal_Bool GetCrsrOfst(SwPosition* pPos, Point& aPoint, + SwCrsrMoveState* = 0) const; + + const Size &GetGrfSize() const { return GetSize(); } + void GetGrfArea( SwRect &rRect, SwRect * = 0, sal_Bool bMirror = sal_True ) const; + + sal_Bool IsTransparent() const; + + void StopAnimation( OutputDevice* = 0 ) const; + sal_Bool HasAnimation() const; + + // Routinen fuer den Grafik-Cache + sal_uInt16 GetWeight() { return nWeight; } +}; + +#endif + diff --git a/sw/source/core/inc/objectformatter.hxx b/sw/source/core/inc/objectformatter.hxx new file mode 100644 index 000000000000..7a47a4012b30 --- /dev/null +++ b/sw/source/core/inc/objectformatter.hxx @@ -0,0 +1,238 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _OBJECTFORMATTER_HXX +#define _OBJECTFORMATTER_HXX + +#include <sal/types.h> + +class SwFrm; +// --> OD 2004-10-08 #i26945# +class SwTxtFrm; +// <-- +class SwLayoutFrm; +class SwPageFrm; +class SwAnchoredObject; +class SwLayAction; +// --> OD 2004-10-04 #i26945# +class SwPageNumAndTypeOfAnchors; +// <-- + +// ----------------------------------------------------------------------------- +// OD 2004-06-25 #i28701# +// Format floating screen objects, which are anchored at the given anchor frame +// and registered at the given page frame. +// ----------------------------------------------------------------------------- +class SwObjectFormatter +{ + private: + // page frame, at which the floating screen objects are registered. + const SwPageFrm& mrPageFrm; + + // boolean, indicating that only as-character anchored objects have to + // be formatted. + bool mbFormatOnlyAsCharAnchored; + + // value of document compatibility option 'Consider wrapping style on + // object positioning' + const bool mbConsiderWrapOnObjPos; + + // layout action calling the format of the floating screen objects + SwLayAction* mpLayAction; + + // data structure to collect page number of object's 'anchor' + // --> OD 2004-10-04 #i26945# + SwPageNumAndTypeOfAnchors* mpPgNumAndTypeOfAnchors; + // <-- + + /** helper method for method <_FormatObj(..)> - performs the intrinsic + format of the layout of the given layout frame and all its lower + layout frames. + + OD 2004-06-28 #i28701# + IMPORTANT NOTE: + Method corresponds to methods <SwLayAction::FormatLayoutFly(..)> and + <SwLayAction::FormatLayout(..)>. Thus, its code for the formatting have + to be synchronised. + + @author OD + */ + void _FormatLayout( SwLayoutFrm& _rLayoutFrm ); + + /** helper method for method <_FormatObj(..)> - performs the intrinsic + format of the content of the given floating screen object. + + OD 2004-06-28 #i28701# + + @author OD + */ + void _FormatObjCntnt( SwAnchoredObject& _rAnchoredObj ); + + protected: + SwObjectFormatter( const SwPageFrm& _rPageFrm, + SwLayAction* _pLayAction = 0L, + const bool _bCollectPgNumOfAnchors = false ); + + static SwObjectFormatter* CreateObjFormatter( SwFrm& _rAnchorFrm, + const SwPageFrm& _rPageFrm, + SwLayAction* _pLayAction ); + + virtual SwFrm& GetAnchorFrm() = 0; + + inline const SwPageFrm& GetPageFrm() const + { + return mrPageFrm; + } + + inline bool ConsiderWrapOnObjPos() const + { + return mbConsiderWrapOnObjPos; + } + + inline SwLayAction* GetLayAction() + { + return mpLayAction; + } + + /** method to restrict the format of floating screen objects to + as-character anchored ones + + @author OD + */ + inline void SetFormatOnlyAsCharAnchored() + { + mbFormatOnlyAsCharAnchored = true; + } + + inline bool FormatOnlyAsCharAnchored() const + { + return mbFormatOnlyAsCharAnchored; + } + + /** performs the intrinsic format of a given floating screen object and its content. + + OD 2004-06-28 #i28701# + + @author OD + */ + void _FormatObj( SwAnchoredObject& _rAnchoredObj ); + + /** invokes the intrinsic format method for all floating screen objects, + anchored at anchor frame on the given page frame + + OD 2004-06-28 #i28701# + OD 2004-10-08 #i26945# - for format of floating screen objects for + follow text frames, the 'master' text frame is passed to the method. + Thus, the objects, whose anchor character is inside the follow text + frame can be formatted. + + @author OD + + @param _pMasterTxtFrm + input parameter - pointer to 'master' text frame. default value: NULL + */ + bool _FormatObjsAtFrm( SwTxtFrm* _pMasterTxtFrm = 0L ); + + /** accessor to collected anchored object + + OD 2004-07-05 #i28701# + + @author OD + */ + SwAnchoredObject* GetCollectedObj( const sal_uInt32 _nIndex ); + + /** accessor to 'anchor' page number of collected anchored object + + OD 2004-07-05 #i28701# + + @author OD + */ + sal_uInt32 GetPgNumOfCollected( const sal_uInt32 _nIndex ); + + /** accessor to 'anchor' type of collected anchored object + + OD 2004-10-04 #i26945# + + @author OD + */ + bool IsCollectedAnchoredAtMaster( const sal_uInt32 _nIndex ); + + /** accessor to total number of collected anchored objects + + OD 2004-07-05 #i28701# + + @author OD + */ + sal_uInt32 CountOfCollected(); + + public: + virtual ~SwObjectFormatter(); + + /** intrinsic method to format a certain floating screen object + + OD 2005-01-10 #i40147# - add parameter <_bCheckForMovedFwd> + + @author OD + + @param _rAnchoredObj + input parameter - anchored object, which have to be formatted. + + @param _bCheckForMovedFwd + input parameter - boolean indicating, that after a successful + format of the anchored object the anchor frame has to be checked, + if it would moved forward due to the positioning of the anchored object. + default value: false + value only considered, if wrapping style influence has to be + considered for the positioning of the anchored object. + */ + virtual bool DoFormatObj( SwAnchoredObject& _rAnchoredObj, + const bool _bCheckForMovedFwd = false ) = 0; + + /** intrinsic method to format all floating screen objects + + @author OD + */ + virtual bool DoFormatObjs() = 0; + + /** method to format all floating screen objects at the given anchor frame + + @author OD + */ + static bool FormatObjsAtFrm( SwFrm& _rAnchorFrm, + const SwPageFrm& _rPageFrm, + SwLayAction* _pLayAction = 0L ); + + /** method to format a given floating screen object + + @author OD + */ + static bool FormatObj( SwAnchoredObject& _rAnchoredObj, + SwFrm* _pAnchorFrm = 0L, + const SwPageFrm* _pPageFrm = 0L, + SwLayAction* _pLayAction = 0L ); +}; + +#endif diff --git a/sw/source/core/inc/observablethread.hxx b/sw/source/core/inc/observablethread.hxx new file mode 100644 index 000000000000..45ee0e3a5918 --- /dev/null +++ b/sw/source/core/inc/observablethread.hxx @@ -0,0 +1,105 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _OBSERVABLETHREAD_HXX +#define _OBSERVABLETHREAD_HXX + +#ifndef _OSL_THREAD_HXX_ +#include <osl/thread.hxx> +#endif +#include <rtl/ref.hxx> +#include <osl/interlck.h> + +#include <boost/weak_ptr.hpp> +#include <ithreadlistenerowner.hxx> + +/** class for an observable thread + + OD 2007-01-29 #i73788# + Note: A thread is ref-counted. Thus, an instance of a derived class has to + to be hold via a reference. The thread itself assures during its execution, + that the ref-count is increased. Its execution starts with its <run()> method + and ends with its <onTerminated()> method. + Note: A thread can be only observed by one or none thread observer in order + to notify, that the thread has finished its work. + + @author OD +*/ +class ObservableThread : public osl::Thread, + public rtl::IReference +{ + public: + + virtual ~ObservableThread(); + + void SetListener( boost::weak_ptr< IFinishedThreadListener > pThreadListener, + const oslInterlockedCount nThreadID ); + + // IReference + virtual oslInterlockedCount SAL_CALL acquire(); + virtual oslInterlockedCount SAL_CALL release(); + + protected: + + ObservableThread(); + + /** intrinsic function of the thread + + Important note: + Do not override this method again. Instead override <threadFunction()>. + Otherwise, it's not guaranteed, that its ref-count is increased + during the execution of the thread. + + @author OD + */ + virtual void SAL_CALL run(); + + virtual void threadFunction() = 0; + + /** method called, when thread has finished its work + + Important note: + Do not override this method again. Instead override <threadFinished()>. + Otherwise, it's not guaranteed, that the ref-count is decreased at + the end of its execution and that the observer is notified, that + the thread has finished its work. + + @author OD + */ + virtual void SAL_CALL onTerminated(); + + virtual void threadFinished(); + + private: + + oslInterlockedCount mnRefCount; + + oslInterlockedCount mnThreadID; + + boost::weak_ptr< IFinishedThreadListener > mpThreadListener; + +}; +#endif diff --git a/sw/source/core/inc/pagedeschint.hxx b/sw/source/core/inc/pagedeschint.hxx new file mode 100644 index 000000000000..b18ed39e3315 --- /dev/null +++ b/sw/source/core/inc/pagedeschint.hxx @@ -0,0 +1,46 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _PAGEDESCHINT_HXX +#define _PAGEDESCHINT_HXX + +#include <svl/hint.hxx> + +class SwPageDesc; + +class SwPageDescHint : public SfxHint +{ + SwPageDesc* pPageDesc; +public: + SwPageDescHint( SwPageDesc* p ) + : pPageDesc(p) + {} + + SwPageDesc* GetPageDesc() const { return const_cast<SwPageDesc*>(pPageDesc); } +}; + +#endif diff --git a/sw/source/core/inc/pagefrm.hxx b/sw/source/core/inc/pagefrm.hxx new file mode 100644 index 000000000000..c5d63d0895ec --- /dev/null +++ b/sw/source/core/inc/pagefrm.hxx @@ -0,0 +1,542 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _PAGEFRM_HXX +#define _PAGEFRM_HXX + + +#include <svl/svarray.hxx> + +#include "ftnboss.hxx" +#include <tools/mempool.hxx> + +#include <SidebarWindowsTypes.hxx> + +class SwFlyFrm; +class SwFlyFrmFmt; +class SwPageDesc; +class SwCntntFrm; +struct SwPosition; +struct SwCrsrMoveState; +class SdrObject; +class SwAttrSetChg; +class Font; + +// OD 2004-05-07 #i28701# - replaced by class <SwSortedObjs> +//SV_DECL_PTRARR_SORT(SwSortDrawObjs,SdrObjectPtr,1,2); +class SwSortedObjs; +// --> OD 2004-07-02 #i28701# +class SwAnchoredObject; +// <-- + +enum SwPageChg +{ + CHG_NEWPAGE, + CHG_CUTPAGE, + CHG_CHGPAGE +}; + +class SwPageFrm: public SwFtnBossFrm +{ + friend class SwFrm; + + // OD 2004-05-07 #i28701# - use <SwSortedObjs> + SwSortedObjs *pSortedObjs; + + SwPageDesc *pDesc; //PageDesc der die Seite beschreibt. + + sal_uInt16 nPhyPageNum; //Physikalische Seitennummer. + + sal_Bool bInvalidCntnt :1; + sal_Bool bInvalidLayout :1; + sal_Bool bInvalidFlyCntnt :1; + sal_Bool bInvalidFlyLayout :1; + sal_Bool bInvalidFlyInCnt :1; + sal_Bool bFtnPage :1; //Diese Seite ist fuer Dokumentende-Fussnoten. + sal_Bool bEmptyPage :1; //Dies ist eine explizite Leerseite + sal_Bool bEndNotePage :1; //'Fussnotenseite' fuer Endnoten + sal_Bool bInvalidSpelling :1; //Das Online-Spelling ist gefordert + sal_Bool bInvalidSmartTags :1; //checking for smarttags is needed // SMARTTAGS + sal_Bool bInvalidAutoCmplWrds :1; //Auto-Complete Wordliste aktualisieren + sal_Bool bInvalidWordCount :1; + sal_Bool bHasGrid :1; // Grid for Asian layout + + // OD 2004-05-17 #i28701# - boolean, indicating that layout of page frame + // is in progress. + bool mbLayoutInProgress; + + // OD 12.02.2003 #i9719#, #105645# + static const sal_Int8 mnBorderPxWidth; + static const sal_Int8 mnShadowPxWidth; + + void _UpdateAttr( const SfxPoolItem*, const SfxPoolItem*, sal_uInt8 &, + SwAttrSetChg *pa = 0, SwAttrSetChg *pb = 0 ); + + // Anpassen der max. Fussnotenhoehen in den einzelnen Spalten + void SetColMaxFtnHeight(); + + /** determine rectangle for page border + + OD 12.02.2003 for #i9719# and #105645# + + @author OD + + @param _rPageRect + input parameter - constant instance reference of the page rectangle. + Generally, it's the frame area of the page, but for empty pages in print + preview, this parameter is useful. + + @param _pViewShell + input parameter - instance of the view shell, for which the rectangle + has to be generated. + + @param _orBorderRect + output parameter - instance reference of the border rectangle for + the given page rectangle + */ + static void GetBorderRect( const SwRect& _rPageRect, + ViewShell* _pViewShell, + SwRect& _orBorderRect, + bool bRightSidebar ); + + /** determine rectangle for right page shadow + + OD 12.02.2003 for #i9719# and #105645# + + @author OD + + @param _rPageRect + input parameter - constant instance reference of the page rectangle. + Generally, it's the frame area of the page, but for empty pages in print + preview, this parameter is useful. + + @param _pViewShell + input parameter - instance of the view shell, for which the rectangle + has to be generated. + + @param _orRightShadowRect + output parameter - instance reference of the right shadow rectangle for + the given page rectangle + */ + static void GetRightShadowRect( const SwRect& _rPageRect, + ViewShell* _pViewShell, + SwRect& _orRightShadowRect, + bool bRightSidebar ); + + /** determine rectangle for bottom page shadow + + OD 12.02.2003 for #i9719# and #105645# + + @author OD + + @param _rPageRect + input parameter - constant instance reference of the page rectangle. + Generally, it's the frame area of the page, but for empty pages in print + preview, this parameter is useful. + + @param _pViewShell + input parameter - instance of the view shell, for which the rectangle + has to be generated. + + @param _orBottomShadowRect + output parameter - instance reference of the bottom shadow rectangle for + the given page rectangle + */ + + static void GetBottomShadowRect( const SwRect& _rPageRect, + ViewShell* _pViewShell, + SwRect& _orBottomShadowRect, + bool bRightSidebar ); + + /** adds the sidebar used for notes to right and left border + mod 20.10.2007 for #i6193# + + @author mod + + @param aRect + input parameter - current rect, we change borders if we want a sidebar + + @param _pViewShell + input parameter - instance of the view shell, for which the rectangle + has to be generated. + + @param bPx + input parameter - if set to true, we add in pixel + */ + static void AddSidebarBorders( Rectangle& aRect, ViewShell* _pViewShell, bool bRight, bool bPx = false); + static void AddSidebarBorders( SwRect& aRect, ViewShell* _pViewShell, bool bRight, bool bPx = false); + +protected: + virtual void MakeAll(); + virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ); + +public: + DECL_FIXEDMEMPOOL_NEWDEL(SwPageFrm) + + SwPageFrm( SwFrmFmt*, SwFrm*, SwPageDesc* ); + ~SwPageFrm(); + + //public, damit die ViewShell beim Umschalten vom BrowseMode darauf + //zugreifen kann. + void PrepareHeader(); //Kopf-/Fusszeilen anlegen/entfernen. + void PrepareFooter(); + + const SwSortedObjs *GetSortedObjs() const { return pSortedObjs; } + SwSortedObjs *GetSortedObjs() { return pSortedObjs; } + + // --> OD 2004-07-02 #i28701# - new methods to append/remove drawing objects + void AppendDrawObjToPage( SwAnchoredObject& _rNewObj ); + void RemoveDrawObjFromPage( SwAnchoredObject& _rToRemoveObj ); + // <-- + + void AppendFlyToPage( SwFlyFrm *pNew ); + void RemoveFlyFromPage( SwFlyFrm *pToRemove ); + void MoveFly( SwFlyFrm *pToMove, SwPageFrm *pDest );//optimiertes Remove/Append + + void SetPageDesc( SwPageDesc *, SwFrmFmt * ); + SwPageDesc *GetPageDesc() { return pDesc; } + const SwPageDesc *GetPageDesc() const { return pDesc; } + SwPageDesc *FindPageDesc(); + + SwCntntFrm *FindLastBodyCntnt(); + inline SwCntntFrm *FindFirstBodyCntnt(); + inline const SwCntntFrm *FindFirstBodyCntnt() const; + inline const SwCntntFrm *FindLastBodyCntnt() const; + + //Spezialisiertes GetCntntPos() fuer Felder in Rahmen. + void GetCntntPosition( const Point &rPt, SwPosition &rPos ) const; + + sal_Bool IsEmptyPage() const { return bEmptyPage; } //explizite Leerseite. + + void UpdateFtnNum(); + + //Immer nach dem Paste rufen. Erzeugt die Seitengeb. Rahmen und Formatiert + //generischen Inhalt. + void PreparePage( sal_Bool bFtn ); + + //Schickt an alle ContentFrames ein Prepare wg. geaenderter Registervorlage + void PrepareRegisterChg(); + + // --> OD 2005-06-09 #i50432# - adjust method description and synopsis. + // Appends a fly frame - the given one or a new one - at the page frame. + // Needed for <Modify> and <MakeFrms> + // - return value not needed any more + // - second parameter is of type <SwFlyFrmFmt*> + // - third parameter only needed for assertion, but calling method assures + // this assertion. Thus, delete it. + void PlaceFly( SwFlyFrm* pFly, SwFlyFrmFmt* pFmt ); + // <-- + + virtual sal_Bool GetCrsrOfst( SwPosition *, Point&, + SwCrsrMoveState* = 0 ) const; + // erfrage vom Client Informationen + virtual sal_Bool GetInfo( SfxPoolItem& ) const; + + virtual void Cut(); + virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 ); + virtual void CheckDirection( sal_Bool bVert ); + void CheckGrid( sal_Bool bInvalidate ); + void PaintGrid( OutputDevice* pOut, SwRect &rRect ) const; + sal_Bool HasGrid() const { return bHasGrid; } + + //Zeilennummern usw malen + void RefreshExtraData( const SwRect & ) const; + + //Hilfslinien malen. + void RefreshSubsidiary( const SwRect& ) const; + + //Fussnotenschnittstelle + sal_Bool IsFtnPage() const { return bFtnPage; } + sal_Bool IsEndNotePage() const { return bEndNotePage; } + void SetFtnPage( sal_Bool b ) { bFtnPage = b; } + void SetEndNotePage( sal_Bool b ) { bEndNotePage = b; } + + inline sal_uInt16 GetPhyPageNum() const { return nPhyPageNum;} + inline void SetPhyPageNum( sal_uInt16 nNum ) { nPhyPageNum = nNum;} + inline void DecrPhyPageNum() { --nPhyPageNum; } + inline void IncrPhyPageNum() { ++nPhyPageNum; } + + //Validieren, invalidieren und abfragen des Status der Seite. + //Layout/Cntnt und jeweils Fly/nicht Fly werden getrennt betrachtet. + inline void InvalidateFlyLayout() const; + inline void InvalidateFlyCntnt() const; + inline void InvalidateFlyInCnt() const; + inline void InvalidateLayout() const; + inline void InvalidateCntnt() const; + inline void InvalidateSpelling() const; + inline void InvalidateSmartTags() const; + inline void InvalidateAutoCompleteWords() const; + inline void InvalidateWordCount() const; + inline void ValidateFlyLayout() const; + inline void ValidateFlyCntnt() const; + inline void ValidateFlyInCnt() const; + inline void ValidateLayout() const; + inline void ValidateCntnt() const; + inline void ValidateSpelling() const; + inline void ValidateSmartTags() const; // SMARTTAGS + inline void ValidateAutoCompleteWords() const; + inline void ValidateWordCount() const; + inline sal_Bool IsInvalid() const; + inline sal_Bool IsInvalidFly() const; + sal_Bool IsInvalidFlyLayout() const { return bInvalidFlyLayout; } + sal_Bool IsInvalidFlyCntnt() const { return bInvalidFlyCntnt; } + sal_Bool IsInvalidFlyInCnt() const { return bInvalidFlyInCnt; } + sal_Bool IsInvalidLayout() const { return bInvalidLayout; } + sal_Bool IsInvalidCntnt() const { return (bInvalidCntnt || bInvalidFlyInCnt); } + sal_Bool IsInvalidSpelling() const { return bInvalidSpelling; } + sal_Bool IsInvalidSmartTags() const { return bInvalidSmartTags; } // SMARTTAGS + sal_Bool IsInvalidAutoCompleteWords() const { return bInvalidAutoCmplWrds; } + sal_Bool IsInvalidWordCount() const { return bInvalidWordCount; } + + /** SwPageFrm::GetDrawBackgrdColor - for #102450# + + 29.08.2002: + determine the color, that is respectively will be drawn as background + for the page frame. + + @author OD + + @return reference to an instance of class Color + */ + const Color& GetDrawBackgrdColor() const; + + /** paint margin area of a page + + OD 20.11.2002 for #104598#: + implement paint of margin area; margin area will be painted for a + view shell with a window and if the document is not in online layout. + + @author OD + + @param _rOutputRect + input parameter - constant instance reference of the rectangle, for + which an output has to be generated. + + @param _pViewShell + input parameter - instance of the view shell, on which the output + has to be generated. + */ + void PaintMarginArea( const SwRect& _rOutputRect, + ViewShell* _pViewShell ) const; + + /** paint page border and shadow + + OD 12.02.2003 for #i9719# and #105645# + implement paint of page border and shadow + + @author OD + + @param _rPageRect + input parameter - constant instance reference of the page rectangle. + Generally, it's the frame area of the page, but for empty pages in print + preview, this parameter is useful. + + @param _pViewShell + input parameter - instance of the view shell, on which the output + has to be generated. + */ + static void PaintBorderAndShadow( const SwRect& _rPageRect, + ViewShell* _pViewShell, + bool bPaintRightShadow, + bool bRightSidebar ); + + /** get bound rectangle of border and shadow for repaints + + OD 12.02.2003 for #i9719# and #105645# + + author OD + + @param _rPageRect + input parameter - constant instance reference of the page rectangle. + Generally, it's the frame area of the page, but for empty pages in print + preview, this parameter is useful. + + @param _pViewShell + input parameter - instance of the view shell, for which the rectangle + has to be generated. + + @param _orBorderAndShadowBoundRect + output parameter - instance reference of the bounded border and shadow + rectangle for the given page rectangle + */ + static void GetBorderAndShadowBoundRect( const SwRect& _rPageRect, + ViewShell* _pViewShell, + SwRect& _orBorderAndShadowBoundRect, + const bool bRightSidebar ); + + static void PaintNotesSidebar(const SwRect& _rPageRect, ViewShell* _pViewShell, sal_uInt16 nPageNum, bool bRight); + static void PaintNotesSidebarArrows(const Point &aMiddleFirst, const Point &aMiddleSecond, ViewShell* _pViewShell, const Color aColorUp, const Color aColorDown); + /** + mod #6i193# + + asks the page on which side a margin should be shown, e.g for notes + returns true for left side, false for right side + */ + sw::sidebarwindows::SidebarPosition SidebarPosition() const; + + virtual bool FillSelection( SwSelectionList& rList, const SwRect& rRect ) const; + + // OD 12.02.2003 #i9719#, #105645# + inline sal_Int8 BorderPxWidth() const + { + return mnBorderPxWidth; + } + inline sal_Int8 ShadowPxWidth() const + { + return mnShadowPxWidth; + } + + // OD 22.09.2003 #110978# + const SwRect PrtWithoutHeaderAndFooter() const; + + // OD 2004-05-17 #i28701# + inline bool IsLayoutInProgress() const + { + return mbLayoutInProgress; + } + inline void SetLayoutInProgress( const bool _bLayoutInProgress ) + { + mbLayoutInProgress = _bLayoutInProgress; + } + + // in case this is am empty page, this function returns the 'reference' page + const SwPageFrm& GetFormatPage() const; + + // return font used to paint the "empty page" string + static const Font& GetEmptyPageFont(); + + static SwTwips GetSidebarBorderWidth( const ViewShell* ); +}; + +inline SwCntntFrm *SwPageFrm::FindFirstBodyCntnt() +{ + SwLayoutFrm *pBody = FindBodyCont(); + return pBody ? pBody->ContainsCntnt() : 0; +} +inline const SwCntntFrm *SwPageFrm::FindFirstBodyCntnt() const +{ + const SwLayoutFrm *pBody = FindBodyCont(); + return pBody ? pBody->ContainsCntnt() : 0; +} +inline const SwCntntFrm *SwPageFrm::FindLastBodyCntnt() const +{ + return ((SwPageFrm*)this)->FindLastBodyCntnt(); +} +inline void SwPageFrm::InvalidateFlyLayout() const +{ + ((SwPageFrm*)this)->bInvalidFlyLayout = sal_True; +} +inline void SwPageFrm::InvalidateFlyCntnt() const +{ + ((SwPageFrm*)this)->bInvalidFlyCntnt = sal_True; +} +inline void SwPageFrm::InvalidateFlyInCnt() const +{ + ((SwPageFrm*)this)->bInvalidFlyInCnt = sal_True; +} +inline void SwPageFrm::InvalidateLayout() const +{ + ((SwPageFrm*)this)->bInvalidLayout = sal_True; +} +inline void SwPageFrm::InvalidateCntnt() const +{ + ((SwPageFrm*)this)->bInvalidCntnt = sal_True; +} +inline void SwPageFrm::InvalidateSpelling() const +{ + ((SwPageFrm*)this)->bInvalidSpelling = sal_True; +} +// SMARTTAGS +inline void SwPageFrm::InvalidateSmartTags() const +{ + ((SwPageFrm*)this)->bInvalidSmartTags = sal_True; +} +inline void SwPageFrm::InvalidateAutoCompleteWords() const +{ + ((SwPageFrm*)this)->bInvalidAutoCmplWrds = sal_True; +} +inline void SwPageFrm::InvalidateWordCount() const +{ + ((SwPageFrm*)this)->bInvalidWordCount = sal_True; +} +inline void SwPageFrm::ValidateFlyLayout() const +{ + ((SwPageFrm*)this)->bInvalidFlyLayout = sal_False; +} +inline void SwPageFrm::ValidateFlyCntnt() const +{ + ((SwPageFrm*)this)->bInvalidFlyCntnt = sal_False; +} +inline void SwPageFrm::ValidateFlyInCnt() const +{ + ((SwPageFrm*)this)->bInvalidFlyInCnt = sal_False; +} +inline void SwPageFrm::ValidateLayout() const +{ + ((SwPageFrm*)this)->bInvalidLayout = sal_False; +} +inline void SwPageFrm::ValidateCntnt() const +{ + ((SwPageFrm*)this)->bInvalidCntnt = sal_False; +} +inline void SwPageFrm::ValidateSpelling() const +{ + ((SwPageFrm*)this)->bInvalidSpelling = sal_False; +} +// SMARTTAGS +inline void SwPageFrm::ValidateSmartTags() const +{ + ((SwPageFrm*)this)->bInvalidSmartTags = sal_False; +} +inline void SwPageFrm::ValidateAutoCompleteWords() const +{ + ((SwPageFrm*)this)->bInvalidAutoCmplWrds = sal_False; +} +inline void SwPageFrm::ValidateWordCount() const +{ + ((SwPageFrm*)this)->bInvalidWordCount = sal_False; +} + +inline sal_Bool SwPageFrm::IsInvalid() const +{ + return (bInvalidCntnt || bInvalidLayout || bInvalidFlyInCnt); +} +inline sal_Bool SwPageFrm::IsInvalidFly() const +{ + return bInvalidFlyLayout || bInvalidFlyCntnt; +} + +#define GETGRID( pPage ) const SwTextGridItem *pGrid = NULL; \ + {if( pPage && pPage->HasGrid() && GRID_NONE==(pGrid=(SwTextGridItem*)&pPage->\ + GetPageDesc()->GetMaster().GetFmtAttr(RES_TEXTGRID))->GetGridType() ) \ + pGrid = NULL;} + +#define GETGRIDWIDTH( pGrid , pDoc ) pDoc->IsSquaredPageMode() ? \ + pGrid->GetBaseHeight(): pGrid->GetBaseWidth() + + + +#endif //_PAGEFRM_HXX diff --git a/sw/source/core/inc/pamtyp.hxx b/sw/source/core/inc/pamtyp.hxx new file mode 100644 index 000000000000..9ca795584eb1 --- /dev/null +++ b/sw/source/core/inc/pamtyp.hxx @@ -0,0 +1,102 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _PAMTYP_HXX +#define _PAMTYP_HXX + +#include <svtools/txtcmp.hxx> +#include <pam.hxx> +#include <node.hxx> +#include <tools/string.hxx> + +class SwpHints; +struct SwPosition; +class SwPaM; +class SwTxtAttr; + +// Funktions-Deklarationen fuer die Move/Find-Methoden vom SwPaM + +void GoStartDoc( SwPosition*); +void GoEndDoc( SwPosition*); +void GoStartSection( SwPosition*); +void GoEndSection( SwPosition*); +sal_Bool GoInDoc( SwPaM&, SwMoveFn); +sal_Bool GoInSection( SwPaM&, SwMoveFn); +sal_Bool GoInNode( SwPaM&, SwMoveFn); +sal_Bool GoInCntnt( SwPaM&, SwMoveFn); +sal_Bool GoInCntntCells( SwPaM&, SwMoveFn); +sal_Bool GoInCntntSkipHidden( SwPaM&, SwMoveFn); +sal_Bool GoInCntntCellsSkipHidden( SwPaM&, SwMoveFn); +const SwTxtAttr* GetFrwrdTxtHint( const SwpHints&, sal_uInt16&, xub_StrLen ); +const SwTxtAttr* GetBkwrdTxtHint( const SwpHints&, sal_uInt16&, xub_StrLen ); + +sal_Bool GoNext(SwNode* pNd, SwIndex * pIdx, sal_uInt16 nMode ); +sal_Bool GoPrevious(SwNode* pNd, SwIndex * pIdx, sal_uInt16 nMode ); +SW_DLLPUBLIC SwCntntNode* GoNextNds( SwNodeIndex * pIdx, sal_Bool ); +SwCntntNode* GoPreviousNds( SwNodeIndex * pIdx, sal_Bool ); + +// --------- Funktionsdefinitionen fuer die SwCrsrShell -------------- + +sal_Bool GoPrevPara( SwPaM&, SwPosPara); +sal_Bool GoCurrPara( SwPaM&, SwPosPara); +sal_Bool GoNextPara( SwPaM&, SwPosPara); +sal_Bool GoPrevSection( SwPaM&, SwPosSection); +sal_Bool GoCurrSection( SwPaM&, SwPosSection); +sal_Bool GoNextSection( SwPaM&, SwPosSection); + + +// ------------ Typedefiniton fuer Funktionen ---------------------- + +typedef sal_Bool (*GoNd)( SwNode*, SwIndex*, sal_uInt16 ); +typedef SwCntntNode* (*GoNds)( SwNodeIndex*, sal_Bool ); +typedef void (*GoDoc)( SwPosition* ); +typedef void (*GoSection)( SwPosition* ); +typedef sal_Bool (SwPosition:: *CmpOp)( const SwPosition& ) const; +typedef const SwTxtAttr* (*GetHint)( const SwpHints&, sal_uInt16&, xub_StrLen ); +typedef int (utl::TextSearch:: *SearchTxt)( const String&, xub_StrLen*, + xub_StrLen*, ::com::sun::star::util::SearchResult* ); +typedef void (SwNodes:: *MvSection)( SwNodeIndex * ) const; + + +struct SwMoveFnCollection +{ + GoNd fnNd; + GoNds fnNds; + GoDoc fnDoc; + GoSection fnSections; + CmpOp fnCmpOp; + GetHint fnGetHint; + SearchTxt fnSearch; + MvSection fnSection; +}; + +// --------- Funktionsdefinitionen fuers Suchen -------------- +SwCntntNode* GetNode( SwPaM&, sal_Bool&, SwMoveFn, sal_Bool bInReadOnly = sal_False ); + + + +#endif diff --git a/sw/source/core/inc/prevwpage.hxx b/sw/source/core/inc/prevwpage.hxx new file mode 100644 index 000000000000..5e9e0d752a4f --- /dev/null +++ b/sw/source/core/inc/prevwpage.hxx @@ -0,0 +1,63 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _PREVIEWPAGES_HXX +#define _PREVIEWPAGES_HXX + +// classes <Point>, <Size> and <Rectangle> +#include <tools/gen.hxx> + +class SwPageFrm; + +/** data structure for a preview page in the current preview layout + + OD 12.12.2002 #103492# - struct <PrevwPage> + + @author OD +*/ +struct PrevwPage +{ + const SwPageFrm* pPage; + bool bVisible; + Size aPageSize; + Point aPrevwWinPos; + Point aLogicPos; + Point aMapOffset; + + inline PrevwPage(); +}; + +inline PrevwPage::PrevwPage() + : pPage( 0 ), + bVisible( false ), + aPageSize( Size(0,0) ), + aPrevwWinPos( Point(0,0) ), + aLogicPos( Point(0,0) ), + aMapOffset( Point(0,0) ) +{}; + +#endif diff --git a/sw/source/core/inc/ptqueue.hxx b/sw/source/core/inc/ptqueue.hxx new file mode 100644 index 000000000000..57717405998f --- /dev/null +++ b/sw/source/core/inc/ptqueue.hxx @@ -0,0 +1,62 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _PTQUEUE_HXX +#define _PTQUEUE_HXX + +//Leider vertragen wir es nicht so gut, wenn wir mehr als ein Paint +//gleichzeitig verarbeiten sollen. Insbesondere beim Drucken kommt dies +//leider haeufig vor. +//SwRootFrm::Paint() stellt fest, dass es zum zweitenmal gerufen wird, und +//traegt das Rechteck sowie die dazugehoerige Shell in den PaintCollector ein. +//Diejenigen stellen, die moeglicherweise das doppelte Paint "Verursachen" +//brauchen nur noch zum richtigen Zeitpunkt die gesammelten Paints verarbeiten. +//Derzeit bietet sich der Druckvorgang an, und zwar nach dem Druck von jeweils +//einer Seite. + +//Das Invalidieren der Windows direkt aus dem RootFrm::Paint hat sich als nicht +//erfolgreich erwiesen, weil die Paints dann in den allermeisten Faellen +//wiederum zu einem sehr unguenstigen Zeitpunkt ankommen. +//Nach dem Druck jeder Seite ein Update auf alle Fenster auszuloesen scheint +//auch nicht angeraten, weil einerseits die edit-Windows nicht im direkten +//Zugriff sind und anderseits das notwendige Update je nach Plattform extrem +//teuer werden kann. + +class SwQueuedPaint; +class ViewShell; +class SwRect; + +class SwPaintQueue +{ +public: + static SwQueuedPaint *pQueue; + + static void Add( ViewShell *pSh, const SwRect &rNew ); + static void Remove( ViewShell *pSh ); + static void Repaint(); +}; + +#endif diff --git a/sw/source/core/inc/retrievedinputstreamdata.hxx b/sw/source/core/inc/retrievedinputstreamdata.hxx new file mode 100644 index 000000000000..fd09e1dbaca7 --- /dev/null +++ b/sw/source/core/inc/retrievedinputstreamdata.hxx @@ -0,0 +1,111 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _RETRIEVEDINPUTSTREAMDATA_HXX +#define _RETRIEVEDINPUTSTREAMDATA_HXX + +#include <tools/link.hxx> +#include <sal/types.h> +#include <osl/mutex.hxx> +#include <com/sun/star/uno/Reference.hxx> +#ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HXX_ +#include <com/sun/star/io/XInputStream.hpp> +#endif + +#include <map> + +#include <boost/weak_ptr.hpp> +class SwAsyncRetrieveInputStreamThreadConsumer; +//#ifndef _RETRIEVEINPUTSTREAMCONSUMER_HXX +//#include <retrieveinputstreamconsumer.hxx> +//#endif + +/** Singleton class to manage retrieved input stream data in Writer + + OD 2007-01-29 #i73788# + The instance of this class provides data container for retrieved input + stream data. The data container is accessed via a key, which the data + manager provides on creation of the data container. + When a certain data container is filled with data, an user event is submitted + to trigger the processing of with data. + + @author OD +*/ +class SwRetrievedInputStreamDataManager +{ + public: + + typedef sal_uInt64 tDataKey; + + struct tData + { + boost::weak_ptr< SwAsyncRetrieveInputStreamThreadConsumer > mpThreadConsumer; + com::sun::star::uno::Reference<com::sun::star::io::XInputStream> mxInputStream; + sal_Bool mbIsStreamReadOnly; + + tData() + : mpThreadConsumer(), + mbIsStreamReadOnly( sal_False ) + {}; + + tData( boost::weak_ptr< SwAsyncRetrieveInputStreamThreadConsumer > pThreadConsumer ) + : mpThreadConsumer( pThreadConsumer ), + mbIsStreamReadOnly( sal_False ) + {}; + }; + + static SwRetrievedInputStreamDataManager& GetManager(); + + ~SwRetrievedInputStreamDataManager() + { + }; + + tDataKey ReserveData( boost::weak_ptr< SwAsyncRetrieveInputStreamThreadConsumer > pThreadConsumer ); + + void PushData( const tDataKey nDataKey, + com::sun::star::uno::Reference<com::sun::star::io::XInputStream> xInputStream, + const sal_Bool bIsStreamReadOnly ); + + bool PopData( const tDataKey nDataKey, + tData& rData ); + + DECL_LINK( LinkedInputStreamReady, SwRetrievedInputStreamDataManager::tDataKey* ); + + private: + + static SwRetrievedInputStreamDataManager* mpManager; + static tDataKey mnNextKeyValue; + static osl::Mutex maGetManagerMutex; + + osl::Mutex maMutex; + + std::map< tDataKey, tData > maInputStreamData; + + SwRetrievedInputStreamDataManager() + { + }; +}; +#endif diff --git a/sw/source/core/inc/retrieveinputstream.hxx b/sw/source/core/inc/retrieveinputstream.hxx new file mode 100644 index 000000000000..e16ba350246d --- /dev/null +++ b/sw/source/core/inc/retrieveinputstream.hxx @@ -0,0 +1,68 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _RETRIEVEINPUTSTREAM_HXX +#define _RETRIEVEINPUTSTREAM_HXX + +#include <observablethread.hxx> +#include <tools/string.hxx> +//#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_ +//#include <com/sun/star/uno/Reference.hxx> +//#endif +#ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HXX_ +#include <com/sun/star/io/XInputStream.hpp> +#endif +#include <retrievedinputstreamdata.hxx> + +/** class for a thread to retrieve an input stream given by an URL + + OD 2007-01-29 #i73788# + + @author OD +*/ +class SwAsyncRetrieveInputStreamThread : public ObservableThread +{ + public: + + static ::rtl::Reference< ObservableThread > createThread( + const SwRetrievedInputStreamDataManager::tDataKey nDataKey, + const String& rLinkedURL ); + + virtual ~SwAsyncRetrieveInputStreamThread(); + + protected: + + virtual void threadFunction(); + + private: + + SwAsyncRetrieveInputStreamThread( const SwRetrievedInputStreamDataManager::tDataKey nDataKey, + const String& rLinkedURL ); + + const SwRetrievedInputStreamDataManager::tDataKey mnDataKey; + const String mrLinkedURL; +}; +#endif diff --git a/sw/source/core/inc/retrieveinputstreamconsumer.hxx b/sw/source/core/inc/retrieveinputstreamconsumer.hxx new file mode 100644 index 000000000000..2417f819bed3 --- /dev/null +++ b/sw/source/core/inc/retrieveinputstreamconsumer.hxx @@ -0,0 +1,74 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _RETRIEVEINPUTSTREAMCONSUMER_HXX +#define _RETRIEVEINPUTSTREAMCONSUMER_HXX + +#include <com/sun/star/uno/Reference.hxx> +#ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HXX_ +#include <com/sun/star/io/XInputStream.hpp> +#endif +#include <osl/interlck.h> +#include <retrievedinputstreamdata.hxx> + +class SwGrfNode; +class String; +class SwAsyncRetrieveInputStreamThread; + +/** class to provide creation of a thread to retrieve an input stream given by + an URL and to consume the retrieved input stream. + + OD 2007-01-29 #i73788# + + @author OD +*/ +class SwAsyncRetrieveInputStreamThreadConsumer +{ + public: + + SwAsyncRetrieveInputStreamThreadConsumer( SwGrfNode& rGrfNode ); + ~SwAsyncRetrieveInputStreamThreadConsumer(); + + /** method to create thread + + @author OD + */ + void CreateThread( const String& rURL ); + + /** method called to provide the retrieved input stream to the thread Consumer + + @author OD + */ + void ApplyInputStream( + com::sun::star::uno::Reference<com::sun::star::io::XInputStream> xInputStream, + const sal_Bool bIsStreamReadOnly ); + + private: + + SwGrfNode& mrGrfNode; + oslInterlockedCount mnThreadID; +}; +#endif diff --git a/sw/source/core/inc/rolbck.hxx b/sw/source/core/inc/rolbck.hxx new file mode 100644 index 000000000000..c94383c83377 --- /dev/null +++ b/sw/source/core/inc/rolbck.hxx @@ -0,0 +1,453 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _ROLBCK_HXX +#define _ROLBCK_HXX + +#include <tools/solar.h> +#ifndef _SVSTDARR_HXX +#define _SVSTDARR_USHORTS +#define _SVSTDARR_USHORTSSORT +#include <svl/svstdarr.hxx> +#endif +#include <svl/itemset.hxx> + +//Nur die History anziehen, um das docnew.cxx gegen die CLOOK's zu behaupten. + +namespace sfx2 { + class MetadatableUndo; +} + +class SwDoc; +class SwFmt; +class SwFmtColl; +class SwHistoryHint; +class SwTxtAttr; +class SfxPoolItem; +class SwTxtNode; +class SwUndoSaveSection; +class SwTxtFtn; +class SwTxtFlyCnt; +class SwUndoDelLayFmt; +class SwFlyFrmFmt; +class SwFmtFld; +class SwTxtFld; +class SwFieldType; +class SwTxtTOXMark; +class SwTxtRefMark; +class SwFrmFmt; +class SwpHints; +class SwFmtChain; +class SwNode; +class SwCharFmt; + +#ifndef ROLBCK_HISTORY_ONLY + +#include <tox.hxx> + +#include <SwNumberTreeTypes.hxx> +// --> OD 2007-10-17 #i81002# +#include <IDocumentMarkAccess.hxx> +// <-- + +#include <memory> + + +enum HISTORY_HINT { + HSTRY_SETFMTHNT, + HSTRY_RESETFMTHNT, + HSTRY_SETTXTHNT, + HSTRY_SETTXTFLDHNT, + HSTRY_SETREFMARKHNT, + HSTRY_SETTOXMARKHNT, + HSTRY_RESETTXTHNT, + HSTRY_SETFTNHNT, + HSTRY_CHGFMTCOLL, + HSTRY_FLYCNT, + HSTRY_BOOKMARK, + HSTRY_SETATTRSET, + HSTRY_RESETATTRSET, + HSTRY_CHGFLYANCHOR, + HSTRY_CHGFLYCHAIN, + HSTRY_CHGCHARFMT, // #i27615# + HSTRY_END +}; + +class SwHistoryHint +{ + const HISTORY_HINT m_eWhichId; + +public: + SwHistoryHint( HISTORY_HINT eWhich ) : m_eWhichId( eWhich ) {} + virtual ~SwHistoryHint() {} + virtual void SetInDoc( SwDoc* pDoc, bool bTmpSet ) = 0; + HISTORY_HINT Which() const { return m_eWhichId; } + virtual String GetDescription() const; +}; + +class SwHistorySetFmt : public SwHistoryHint +{ + ::std::auto_ptr<SfxPoolItem> m_pAttr; + const sal_uLong m_nNodeIndex; + +public: + SwHistorySetFmt( const SfxPoolItem* pFmtHt, sal_uLong nNode ); + virtual ~SwHistorySetFmt(); + virtual void SetInDoc( SwDoc* pDoc, bool bTmpSet ); + virtual String GetDescription() const; + +}; + +class SwHistoryResetFmt : public SwHistoryHint +{ + const sal_uLong m_nNodeIndex; + const sal_uInt16 m_nWhich; + +public: + // --> OD 2008-02-27 #refactorlists# - removed <rDoc> + SwHistoryResetFmt( const SfxPoolItem* pFmtHt, sal_uLong nNodeIdx ); + // <-- + virtual void SetInDoc( SwDoc* pDoc, bool bTmpSet ); + +}; + +class SwHistorySetTxt : public SwHistoryHint +{ + ::std::auto_ptr<SfxPoolItem> m_pAttr; + const sal_uLong m_nNodeIndex; + const xub_StrLen m_nStart; + const xub_StrLen m_nEnd; + +public: + SwHistorySetTxt( SwTxtAttr* pTxtHt, sal_uLong nNode ); + virtual ~SwHistorySetTxt(); + virtual void SetInDoc( SwDoc* pDoc, bool bTmpSet ); + +}; + +class SwHistorySetTxtFld : public SwHistoryHint +{ + //!! beware of the order for the declation of the auto_ptrs. + //!! If they get destroyed in the wrong order sw may crash (namely mail-merge as well) + ::std::auto_ptr<SwFieldType> m_pFldType; + const ::std::auto_ptr<SwFmtFld> m_pFld; + + sal_uLong m_nNodeIndex; + xub_StrLen m_nPos; + sal_uInt16 m_nFldWhich; + +public: + SwHistorySetTxtFld( SwTxtFld* pTxtFld, sal_uLong nNode ); + virtual ~SwHistorySetTxtFld(); + virtual void SetInDoc( SwDoc* pDoc, bool bTmpSet ); + + virtual String GetDescription() const; + +}; + +class SwHistorySetRefMark : public SwHistoryHint +{ + const String m_RefName; + const sal_uLong m_nNodeIndex; + const xub_StrLen m_nStart; + const xub_StrLen m_nEnd; + +public: + SwHistorySetRefMark( SwTxtRefMark* pTxtHt, sal_uLong nNode ); + virtual void SetInDoc( SwDoc* pDoc, bool bTmpSet ); + +}; + +class SwHistorySetTOXMark : public SwHistoryHint +{ + SwTOXMark m_TOXMark; + const String m_TOXName; + const TOXTypes m_eTOXTypes; + const sal_uLong m_nNodeIndex; + const xub_StrLen m_nStart; + const xub_StrLen m_nEnd; + +public: + SwHistorySetTOXMark( SwTxtTOXMark* pTxtHt, sal_uLong nNode ); + virtual void SetInDoc( SwDoc* pDoc, bool bTmpSet ); + int IsEqual( const SwTOXMark& rCmp ) const; + +}; + +class SwHistoryResetTxt : public SwHistoryHint +{ + const sal_uLong m_nNodeIndex; + const xub_StrLen m_nStart; + const xub_StrLen m_nEnd; + const sal_uInt16 m_nAttr; + +public: + SwHistoryResetTxt( sal_uInt16 nWhich, xub_StrLen nStt, xub_StrLen nEnd, + sal_uLong nNode ); + virtual void SetInDoc( SwDoc* pDoc, bool bTmpSet ); + + sal_uInt16 GetWhich() const { return m_nAttr; } + sal_uLong GetNode() const { return m_nNodeIndex; } + xub_StrLen GetCntnt() const { return m_nStart; } + +}; + +class SwHistorySetFootnote : public SwHistoryHint +{ + const ::std::auto_ptr<SwUndoSaveSection> m_pUndo; + const String m_FootnoteNumber; + sal_uLong m_nNodeIndex; + const xub_StrLen m_nStart; + const bool m_bEndNote; + +public: + SwHistorySetFootnote( SwTxtFtn* pTxtFtn, sal_uLong nNode ); + SwHistorySetFootnote( const SwTxtFtn& ); + virtual ~SwHistorySetFootnote(); + virtual void SetInDoc( SwDoc* pDoc, bool bTmpSet ); + + virtual String GetDescription() const; + +}; + +class SwHistoryChangeFmtColl : public SwHistoryHint +{ + SwFmtColl * const m_pColl; + const sal_uLong m_nNodeIndex; + const sal_uInt8 m_nNodeType; + +public: + SwHistoryChangeFmtColl( SwFmtColl* pColl, sal_uLong nNode, sal_uInt8 nNodeWhich ); + virtual void SetInDoc( SwDoc* pDoc, bool bTmpSet ); + +}; + +class SwHistoryTxtFlyCnt : public SwHistoryHint +{ + ::std::auto_ptr<SwUndoDelLayFmt> m_pUndo; + +public: + SwHistoryTxtFlyCnt( SwFrmFmt* const pFlyFmt ); + virtual ~SwHistoryTxtFlyCnt(); + virtual void SetInDoc( SwDoc* pDoc, bool bTmpSet ); + SwUndoDelLayFmt* GetUDelLFmt() { return m_pUndo.get(); } + +}; + +class SwHistoryBookmark : public SwHistoryHint +{ + public: + SwHistoryBookmark(const ::sw::mark::IMark& rBkmk, + bool bSavePos, bool bSaveOtherPos); + virtual void SetInDoc(SwDoc * pDoc, bool); + + bool IsEqualBookmark(const ::sw::mark::IMark& rBkmk); + const ::rtl::OUString& GetName() const; + + + private: + const ::rtl::OUString m_aName; + ::rtl::OUString m_aShortName; + KeyCode m_aKeycode; + const sal_uLong m_nNode; + const sal_uLong m_nOtherNode; + const xub_StrLen m_nCntnt; + const xub_StrLen m_nOtherCntnt; + const bool m_bSavePos; + const bool m_bSaveOtherPos; + const bool m_bHadOtherPos; + const IDocumentMarkAccess::MarkType m_eBkmkType; + ::boost::shared_ptr< ::sfx2::MetadatableUndo > m_pMetadataUndo; +}; + +class SwHistorySetAttrSet : public SwHistoryHint +{ + SfxItemSet m_OldSet; + SvUShorts m_ResetArray; + const sal_uLong m_nNodeIndex; + +public: + SwHistorySetAttrSet( const SfxItemSet& rSet, sal_uLong nNode, + const SvUShortsSort& rSetArr ); + virtual void SetInDoc( SwDoc* pDoc, bool bTmpSet ); + +}; + + +class SwHistoryResetAttrSet : public SwHistoryHint +{ + const sal_uLong m_nNodeIndex; + const xub_StrLen m_nStart; + const xub_StrLen m_nEnd; + SvUShorts m_Array; + +public: + SwHistoryResetAttrSet( const SfxItemSet& rSet, sal_uLong nNode, + xub_StrLen nStt = STRING_MAXLEN, + xub_StrLen nEnd = STRING_MAXLEN ); + virtual void SetInDoc( SwDoc* pDoc, bool bTmpSet ); + + const SvUShorts& GetArr() const { return m_Array; } + sal_uLong GetNode() const { return m_nNodeIndex; } + xub_StrLen GetCntnt() const { return m_nStart; } + +}; + +class SwHistoryChangeFlyAnchor : public SwHistoryHint +{ + SwFrmFmt & m_rFmt; + const sal_uLong m_nOldNodeIndex; + const xub_StrLen m_nOldContentIndex; + +public: + SwHistoryChangeFlyAnchor( SwFrmFmt& rFmt ); + virtual void SetInDoc( SwDoc* pDoc, bool bTmpSet ); +}; + +class SwHistoryChangeFlyChain : public SwHistoryHint +{ + SwFlyFrmFmt * const m_pPrevFmt; + SwFlyFrmFmt * const m_pNextFmt; + SwFlyFrmFmt * const m_pFlyFmt; + +public: + SwHistoryChangeFlyChain( SwFlyFrmFmt& rFmt, const SwFmtChain& rAttr ); + virtual void SetInDoc( SwDoc* pDoc, bool bTmpSet ); +}; + +// #i27615# +class SwHistoryChangeCharFmt : public SwHistoryHint +{ + const SfxItemSet m_OldSet; + const String m_Fmt; + +public: + SwHistoryChangeCharFmt( const SfxItemSet& rSet, const String & sFmt); + virtual void SetInDoc( SwDoc* pDoc, bool bTmpSet ); + +}; + + +#endif + +typedef SwHistoryHint* SwHistoryHintPtr; +SV_DECL_PTRARR_DEL( SwpHstry, SwHistoryHintPtr, 0, 2 ) + +class SwHistory +{ + friend class SwDoc; // actually only SwDoc::DelUndoObj may access + friend class SwUndoWriter; // for Undo/Redo Writer + friend class SwRegHistory; // for inserting History attributes + + SwpHstry m_SwpHstry; + sal_uInt16 m_nEndDiff; + +public: + SwHistory( sal_uInt16 nInitSz = 0, sal_uInt16 nGrowSz = 2 ); + ~SwHistory(); + + // delete History from nStart to array end + void Delete( sal_uInt16 nStart = 0 ); + // call and delete all objects between nStart and array end + bool Rollback( SwDoc* pDoc, sal_uInt16 nStart = 0 ); + // call all objects between nStart and TmpEnd; store nStart as TmpEnd + bool TmpRollback( SwDoc* pDoc, sal_uInt16 nStart, bool ToFirst = true ); + + // --> OD 2008-02-27 #refactorlists# - removed <rDoc> + void Add( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewValue, + sal_uLong nNodeIdx ); + // <-- + void Add( SwTxtAttr* pTxtHt, sal_uLong nNodeIdx, bool bNewAttr = true ); + void Add( SwFmtColl*, sal_uLong nNodeIdx, sal_uInt8 nWhichNd ); + void Add( const ::sw::mark::IMark&, bool bSavePos, bool bSaveOtherPos ); + void Add( SwFrmFmt& rFmt ); + void Add( SwFlyFrmFmt&, sal_uInt16& rSetPos ); + void Add( const SwTxtFtn& ); + void Add( const SfxItemSet & rSet, const SwCharFmt & rCharFmt); // #i27615# + + sal_uInt16 Count() const { return m_SwpHstry.Count(); } + sal_uInt16 GetTmpEnd() const { return m_SwpHstry.Count() - m_nEndDiff; } + sal_uInt16 SetTmpEnd( sal_uInt16 nTmpEnd ); // return previous value + SwHistoryHint * operator[]( sal_uInt16 nPos ) { return m_SwpHstry[nPos]; } + SwHistoryHint const* operator[]( sal_uInt16 nPos ) const + { return m_SwpHstry[nPos]; } + + // for SwUndoDelete::Undo/Redo + void Move( sal_uInt16 nPos, SwHistory *pIns, + sal_uInt16 nStart = 0, sal_uInt16 nEnd = USHRT_MAX ) + { + m_SwpHstry.Insert( &pIns->m_SwpHstry, nPos, nStart, nEnd ); + pIns->m_SwpHstry.Remove( nStart, (nEnd == USHRT_MAX) + ? pIns->Count() - nStart + : nEnd ); + } + + // helper methods for recording attribute in History + // used by Undo classes (Delete/Overwrite/Inserts) + void CopyAttr( SwpHints* pHts, sal_uLong nNodeIdx, xub_StrLen nStart, + xub_StrLen nEnd, bool bFields ); + // --> OD 2008-02-27 #refactorlists# - removed <rDoc> + void CopyFmtAttr( const SfxItemSet& rSet, sal_uLong nNodeIdx ); + // <-- +}; + +#ifndef ROLBCK_HISTORY_ONLY + +class SwRegHistory : public SwClient +{ +private: + SvUShortsSort m_WhichIdSet; + SwHistory * const m_pHistory; + sal_uLong m_nNodeIndex; + + void _MakeSetWhichIds(); + +protected: + virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ); + +public: + // --> OD 2008-02-27 #refactorlists# - removed <rDoc> + SwRegHistory( SwHistory* pHst ); + // <-- + SwRegHistory( const SwNode& rNd, SwHistory* pHst ); + SwRegHistory( SwModify* pRegIn, const SwNode& rNd, SwHistory* pHst ); + + /// @return true iff at least 1 item was inserted + bool InsertItems( const SfxItemSet& rSet, + xub_StrLen const nStart, xub_StrLen const nEnd, + SetAttrMode const nFlags ); + + void AddHint( SwTxtAttr* pHt, const bool bNew = false ); + + void RegisterInModify( SwModify* pRegIn, const SwNode& rNd ); + void ChangeNodeIndex( sal_uLong nNew ) { m_nNodeIndex = nNew; } +}; + +#endif + + +#endif // _ROLBCK_HXX + diff --git a/sw/source/core/inc/rootfrm.hxx b/sw/source/core/inc/rootfrm.hxx new file mode 100644 index 000000000000..8150e9a3536f --- /dev/null +++ b/sw/source/core/inc/rootfrm.hxx @@ -0,0 +1,377 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_ROOTFRM_HXX +#define SW_ROOTFRM_HXX + +#include "layfrm.hxx" + +class SwCntntFrm; +class ViewShell; +class SdrPage; +class SwFrmFmt; +class SwPaM; +class SwCursor; +class SwShellCrsr; +class SwTableCursor; +class SwLayVout; +class SwDestroyList; +class SwCurrShells; +class SwViewOption; +class SwSelectionList; +struct SwPosition; +struct SwCrsrMoveState; + +#define HACK_TABLEMODE_INIT 0 +#define HACK_TABLEMODE_LOCKLINES 1 +#define HACK_TABLEMODE_PAINTLINES 2 +#define HACK_TABLEMODE_UNLOCKLINES 3 +#define HACK_TABLEMODE_EXIT 4 + +#define INV_SIZE 1 +#define INV_PRTAREA 2 +#define INV_POS 4 +#define INV_TABLE 8 +#define INV_SECTION 16 +#define INV_LINENUM 32 +#define INV_DIRECTION 64 + +#include <vector> + +class SwRootFrm: public SwLayoutFrm +{ + //Muss das Superfluous temporaer abschalten. + friend void AdjustSizeChgNotify( SwRootFrm *pRoot ); + + //Pflegt pLastPage (Cut() und Paste() vom SwPageFrm + friend inline void SetLastPage( SwPageFrm* ); + + // Fuer das Anlegen und Zerstoeren des virtuellen Outputdevice-Managers + friend void _FrmInit(); //erzeugt pVout + friend void _FrmFinit(); //loescht pVout + + // PAGES01 + std::vector<SwRect> maPageRects;// returns the current rectangle for each page frame + // the rectangle is extended to the top/bottom/left/right + // for pages located at the outer borders + SwRect maPagesArea; // the area covered by the pages + long mnViewWidth; // the current page layout bases on this view width + sal_uInt16 mnColumns; // the current page layout bases on this number of columns + bool mbBookMode; // the current page layout is in book view + bool mbSidebarChanged; // the notes sidebar state has changed + // <-- + + bool mbNeedGrammarCheck; // true when sth needs to be checked (not necessarily started yet!) + + static SwLayVout *pVout; + static sal_Bool bInPaint; //Schutz gegen doppelte Paints. + static sal_Bool bNoVirDev; //Bei SystemPaints kein virt. Device + + sal_Bool bCheckSuperfluous :1; //Leere Seiten suchen? + sal_Bool bIdleFormat :1; //Idle-Formatierer anwerfen? + sal_Bool bBrowseWidthValid :1; //Ist nBrowseWidth gueltig? + sal_Bool bDummy2 :1; //Unbenutzt + sal_Bool bTurboAllowed :1; + sal_Bool bAssertFlyPages :1; //Ggf. weitere Seiten fuer Flys einfuegen? + sal_Bool bDummy :1; //Unbenutzt + sal_Bool bIsVirtPageNum :1; //gibt es eine virtuelle Seitennummer ? + sal_Bool bIsNewLayout :1; //Layout geladen oder neu erzeugt. + sal_Bool bCallbackActionEnabled:1; //Keine Action in Benachrichtung erwuenscht + //siehe dcontact.cxx, ::Changed() + + //Fuer den BrowseMode. nBrowseWidth ist die Aeussere Kante des am weitesten + //rechts stehenden Objectes. Die rechte Kante der Seiten soll im BrowseMode + //nicht kleiner werden als dieser Wert. + long nBrowseWidth; + + //Wenn nur _ein: CntntFrm zu formatieren ist, so steht dieser in pTurbo. + const SwCntntFrm *pTurbo; + + //Die letzte Seite wollen wir uns nicht immer muehsam zusammensuchen. + SwPageFrm *pLastPage; + + //Die Root kuemmert sich nun auch um den Shell-Zugriff. Ueber das Dokument + //sollte man auch immer an die Root herankommen und somit auch immer + //einen Zugriff auf die Shell haben. + //Der Pointer pCurrShell ist der Pointer auf irgendeine der Shells fuer + //das Dokument + //Da es durchaus nicht immer egal ist, auf welcher Shell gearbeitet wird, + //ist es notwendig die aktive Shell zu kennen. Das wird dadurch angenaehert, + //dass der Pointer pCurrShell immer dann umgesetzt wird, wenn eine + //Shell den Fokus erhaelt (FEShell). Zusaetzlich wird der Pointer + //Temporaer von SwCurrShell umgesetzt, dieses wird typischerweise + //ueber das Macro SET_CURR_SHELL erledigt. Makro + Klasse sind in der + //ViewShell zu finden. Diese Objekte koennen auch verschachtelt (auch fuer + //unterschiedliche Shells) erzeugt werden. Sie werden im Array pCurrShells + //gesammelt. + //Weiterhin kann es noch vorkommen, dass eine Shell aktiviert wird, + //waehrend noch ein CurrShell-Objekt "aktiv" ist. Dieses wird dann in + //pWaitingCurrShell eingetragen und vom letzten DTor der CurrShell + //"aktiviert". + //Ein weiteres Problem ist dass Zerstoeren einer Shell waehrend sie aktiv + //ist. Der Pointer pCurrShell wird dann auf eine beliebige andere Shell + //umgesetzt. + //Wenn zum Zeitpunkt der zerstoerung einer Shell diese noch in irgendwelchen + //CurrShell-Objekten referenziert wird, so wird auch dies aufgeklart. + friend class CurrShell; + friend void SetShell( ViewShell *pSh ); + friend void InitCurrShells( SwRootFrm *pRoot ); + ViewShell *pCurrShell; + ViewShell *pWaitingCurrShell; + SwCurrShells *pCurrShells; + + //Eine Page im DrawModel pro Dokument, hat immer die Groesse der Root. + SdrPage *pDrawPage; + + SwDestroyList* pDestroy; + + sal_uInt16 nPhyPageNums; //Anzahl der Seiten. + sal_uInt16 nAccessibleShells; // Number of accessible shells + + void ImplCalcBrowseWidth(); + void ImplInvalidateBrowseWidth(); + + void _DeleteEmptySct(); // zerstoert ggf. die angemeldeten SectionFrms + void _RemoveFromList( SwSectionFrm* pSct ); // entfernt SectionFrms aus der Delete-Liste + +protected: + + virtual void MakeAll(); + +public: + + //MasterObjekte aus der Page entfernen (von den Ctoren gerufen). + static void RemoveMasterObjs( SdrPage *pPg ); + + void AllCheckPageDescs() const;//swmod 080226 + void AllInvalidateAutoCompleteWords() const;//swmod 080305 + void AllAddPaintRect() const; + void AllRemoveFtns() ;//swmod 080305 + void AllInvalidateSmartTagsOrSpelling(sal_Bool bSmartTags) const;//swmod 080307 + //Virtuelles Device ausgeben (z.B. wenn Animationen ins Spiel kommen) + static sal_Bool FlushVout(); + //Clipping sparen, wenn im Vout eh genau das Cliprechteck ausgegeben wird + static sal_Bool HasSameRect( const SwRect& rRect ); + + SwRootFrm( SwFrmFmt*, ViewShell* ); + ~SwRootFrm(); + void Init(SwFrmFmt*); + + ViewShell *GetCurrShell() const { return pCurrShell; } + void DeRegisterShell( ViewShell *pSh ); + + //Start-/EndAction fuer alle Shells auf moeglichst hoeher + //(Shell-Ableitungs-)Ebene aufsetzen. Fuer die StarONE Anbindung, die + //die Shells nicht dirkt kennt. + //Der ChangeLinkd der CrsrShell (UI-Benachrichtigung) wird im EndAllAction + //automatisch gecallt. + void StartAllAction(); + void EndAllAction( sal_Bool bVirDev = sal_False ); + + // fuer bestimmte UNO-Aktionen (Tabellencursor) ist es notwendig, dass alle Actions + // kurzfristig zurueckgesetzt werden. Dazu muss sich jede ViewShell ihren alten Action-zaehler + // merken + void UnoRemoveAllActions(); + void UnoRestoreAllActions(); + + const SdrPage* GetDrawPage() const { return pDrawPage; } + SdrPage* GetDrawPage() { return pDrawPage; } + void SetDrawPage( SdrPage* pNew ){ pDrawPage = pNew; } + + virtual sal_Bool GetCrsrOfst( SwPosition *, Point&, + SwCrsrMoveState* = 0 ) const; + + virtual void Paint( SwRect const&, + SwPrintData const*const pPrintData = NULL ) const; + virtual SwTwips ShrinkFrm( SwTwips, sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False ); + virtual SwTwips GrowFrm ( SwTwips, sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False ); +#ifdef DBG_UTIL + virtual void Cut(); + virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 ); +#endif + + virtual bool FillSelection( SwSelectionList& rList, const SwRect& rRect ) const; + + Point GetNextPrevCntntPos( const Point &rPoint, sal_Bool bNext ) const; + + virtual Size ChgSize( const Size& aNewSize ); + + void SetIdleFlags() { bIdleFormat = sal_True; } + sal_Bool IsIdleFormat() const { return bIdleFormat; } + void ResetIdleFormat() { bIdleFormat = sal_False; } + + bool IsNeedGrammarCheck() const { return mbNeedGrammarCheck; } + void SetNeedGrammarCheck( bool bVal ) { mbNeedGrammarCheck = bVal; } + + //Sorgt dafuer, dass alle gewuenschten Seitengebunden Flys eine Seite finden + void SetAssertFlyPages() { bAssertFlyPages = sal_True; } + void AssertFlyPages(); + sal_Bool IsAssertFlyPages() { return bAssertFlyPages; } + + //Stellt sicher, dass ab der uebergebenen Seite auf allen Seiten die + //Seitengebundenen Rahmen auf der richtigen Seite (Seitennummer) stehen. + void AssertPageFlys( SwPageFrm * ); + + //Saemtlichen Inhalt invalidieren, Size oder PrtArea + void InvalidateAllCntnt( sal_uInt8 nInvalidate = INV_SIZE ); + + /** method to invalidate/re-calculate the position of all floating + screen objects (Writer fly frames and drawing objects), which are + anchored to paragraph or to character. + + OD 2004-03-16 #i11860# + + @author OD + */ + void InvalidateAllObjPos(); + + //Ueberfluessige Seiten entfernen. + void SetSuperfluous() { bCheckSuperfluous = sal_True; } + sal_Bool IsSuperfluous() const { return bCheckSuperfluous; } + void RemoveSuperfluous(); + + //abfragen/setzen der aktuellen Seite und der Gesamtzahl der Seiten. + //Es wird soweit wie notwendig Formatiert. + sal_uInt16 GetCurrPage( const SwPaM* ) const; + sal_uInt16 SetCurrPage( SwCursor*, sal_uInt16 nPageNum ); + Point GetPagePos( sal_uInt16 nPageNum ) const; + sal_uInt16 GetPageNum() const { return nPhyPageNums; } + void DecrPhyPageNums() { --nPhyPageNums; } + void IncrPhyPageNums() { ++nPhyPageNums; } + sal_Bool IsVirtPageNum() const { return bIsVirtPageNum; } + inline void SetVirtPageNum( const sal_Bool bOf ) const; + sal_Bool IsDummyPage( sal_uInt16 nPageNum ) const; + + // Point rPt: The point that should be used to find the page + // Size pSize: If given, we return the (first) page that overlaps with the + // rectangle defined by rPt and pSize + // bool bExtend: Extend each page to the left/right/top/botton up to the + // next page border + const SwPageFrm* GetPageAtPos( const Point& rPt, const Size* pSize = 0, bool bExtend = false ) const; + + //Der Crsr moechte die zu selektierenden Bereiche wissen. + void CalcFrmRects( SwShellCrsr&, sal_Bool bIsTblSel ); + + // Calculates the cells included from the current selection + // false: There was no result because of an invalid layout + // true: Everything worked fine. + bool MakeTblCrsrs( SwTableCursor& ); + + void DisallowTurbo() const { ((SwRootFrm*)this)->bTurboAllowed = sal_False; } + void ResetTurboFlag() const { ((SwRootFrm*)this)->bTurboAllowed = sal_True; } + sal_Bool IsTurboAllowed() const { return bTurboAllowed; } + void SetTurbo( const SwCntntFrm *pCntnt ) { pTurbo = pCntnt; } + void ResetTurbo() { pTurbo = 0; } + const SwCntntFrm *GetTurbo() { return pTurbo; } + + //Fussnotennummern aller Seiten auf den neuesten Stand bringen. + void UpdateFtnNums(); //nur bei Seitenweiser Nummerierung! + + //Alle Fussnoten (nicht etwa die Referenzen) entfernen. + void RemoveFtns( SwPageFrm *pPage = 0, sal_Bool bPageOnly = sal_False, + sal_Bool bEndNotes = sal_False ); + void CheckFtnPageDescs( sal_Bool bEndNote ); + + const SwPageFrm *GetLastPage() const { return pLastPage; } + SwPageFrm *GetLastPage() { return pLastPage; } + + static sal_Bool IsInPaint() { return bInPaint; } + + static void SetNoVirDev( const sal_Bool bNew ) { bNoVirDev = bNew; } + + inline long GetBrowseWidth() const; + void SetBrowseWidth( long n ) { bBrowseWidthValid = sal_True; nBrowseWidth = n;} + inline void InvalidateBrowseWidth(); + +#ifdef LONG_TABLE_HACK + void HackPrepareLongTblPaint( int nMode ); +#endif + + sal_Bool IsNewLayout() const { return bIsNewLayout; } + void ResetNewLayout() { bIsNewLayout = sal_False;} + + // Hier werden leere SwSectionFrms zur Zerstoerung angemeldet + // und spaeter zerstoert oder wieder abgemeldet + void InsertEmptySct( SwSectionFrm* pDel ); + void DeleteEmptySct() { if( pDestroy ) _DeleteEmptySct(); } + void RemoveFromList( SwSectionFrm* pSct ) { if( pDestroy ) _RemoveFromList( pSct ); } +#ifdef DBG_UTIL + // Wird zur Zeit nur fuer ASSERTs benutzt: + sal_Bool IsInDelList( SwSectionFrm* pSct ) const; // Ist der SectionFrm in der Liste enthalten? +#endif + + + void SetCallbackActionEnabled( sal_Bool b ) { bCallbackActionEnabled = b; } + sal_Bool IsCallbackActionEnabled() const { return bCallbackActionEnabled; } + + sal_Bool IsAnyShellAccessible() const { return nAccessibleShells > 0; } + void AddAccessibleShell() { ++nAccessibleShells; } + void RemoveAccessibleShell() { --nAccessibleShells; } + + /** get page frame by phyiscal page number + + OD 14.01.2003 #103492# + looping through the lowers, which are page frame, in order to find the + page frame with the given physical page number. + if no page frame is found, 0 is returned. + Note: Empty page frames are also returned. + + @param _nPageNum + input parameter - physical page number of page frame to be searched and + returned. + + @return pointer to the page frame with the given physical page number + */ + SwPageFrm* GetPageByPageNum( sal_uInt16 _nPageNum ) const; + + // --> PAGES01 + void CheckViewLayout( const SwViewOption* pViewOpt, const SwRect* pVisArea ); + bool IsLeftToRightViewLayout() const; + const SwRect& GetPagesArea() const { return maPagesArea; } + void SetSidebarChanged() { mbSidebarChanged = true; } + // <-- +}; + +inline long SwRootFrm::GetBrowseWidth() const +{ + if ( !bBrowseWidthValid ) + ((SwRootFrm*)this)->ImplCalcBrowseWidth(); + return nBrowseWidth; +} + +inline void SwRootFrm::InvalidateBrowseWidth() +{ + if ( bBrowseWidthValid ) + ImplInvalidateBrowseWidth(); +} + +inline void SwRootFrm::SetVirtPageNum( const sal_Bool bOf) const +{ + ((SwRootFrm*)this)->bIsVirtPageNum = bOf; +} + +#endif // SW_ROOTFRM_HXX + diff --git a/sw/source/core/inc/rowfrm.hxx b/sw/source/core/inc/rowfrm.hxx new file mode 100644 index 000000000000..e66b521d80ba --- /dev/null +++ b/sw/source/core/inc/rowfrm.hxx @@ -0,0 +1,111 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _ROWFRM_HXX +#define _ROWFRM_HXX + +#include <tools/mempool.hxx> + +#include "layfrm.hxx" + +class SwTableLine; +class SwBorderAttrs; + +class SwRowFrm: public SwLayoutFrm +{ + virtual void Format( const SwBorderAttrs *pAttrs = 0 ); + //Aendern nur die Framesize, nicht die PrtArea-SSize + virtual SwTwips ShrinkFrm( SwTwips, sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False ); + virtual SwTwips GrowFrm ( SwTwips, sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False ); + + const SwTableLine *pTabLine; + SwRowFrm* pFollowRow; + // --> collapsing borders FME 2005-05-27 #i29550# + sal_uInt16 mnTopMarginForLowers; + sal_uInt16 mnBottomMarginForLowers; + sal_uInt16 mnBottomLineSize; + // <-- collapsing + bool bIsFollowFlowRow; + bool bIsRepeatedHeadline; + bool mbIsRowSpanLine; + +protected: + virtual void MakeAll(); + virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ); + +public: + SwRowFrm( const SwTableLine &, SwFrm*, bool bInsertContent = true ); + ~SwRowFrm(); + + virtual void Cut(); + + //Zum Anmelden der Flys nachdem eine Zeile erzeugt _und_ eingefuegt wurde. + //Muss vom Erzeuger gerufen werden, denn erst nach dem Konstruieren wird + //Das Teil gepastet; mithin ist auch erst dann die Seite zum Anmelden der + //Flys erreichbar. + void RegistFlys( SwPageFrm *pPage = 0 ); + + const SwTableLine *GetTabLine() const { return pTabLine; } + + //Passt die Zellen auf die aktuelle Hoehe an, invalidiert die Zellen + //wenn die Direction nicht der Hoehe entspricht. + void AdjustCells( const SwTwips nHeight, const sal_Bool bHeight ); + + // + // + SwRowFrm* GetFollowRow() const { return pFollowRow; } + void SetFollowRow( SwRowFrm* pNew ) { pFollowRow = pNew; } + + // --> collapsing borders FME 2005-05-27 #i29550# + sal_uInt16 GetTopMarginForLowers() const { return mnTopMarginForLowers; } + void SetTopMarginForLowers( sal_uInt16 nNew ) { mnTopMarginForLowers = nNew; } + sal_uInt16 GetBottomMarginForLowers() const { return mnBottomMarginForLowers; } + void SetBottomMarginForLowers( sal_uInt16 nNew ) { mnBottomMarginForLowers = nNew; } + sal_uInt16 GetBottomLineSize() const { return mnBottomLineSize; } + void SetBottomLineSize( sal_uInt16 nNew ) { mnBottomLineSize = nNew; } + // <-- collapsing + + bool IsRepeatedHeadline() const { return bIsRepeatedHeadline; } + void SetRepeatedHeadline( bool bNew ) { bIsRepeatedHeadline = bNew; } + + // --> split table rows + bool IsRowSplitAllowed() const; + bool IsFollowFlowRow() const { return bIsFollowFlowRow; } + void SetFollowFlowRow( bool bNew ) { bIsFollowFlowRow = bNew; } + // <-- split table rows + + // --> FME 2006-02-10 #131283# Table row keep feature + bool ShouldRowKeepWithNext() const; + // <-- + + // --> FME 2006-10-30 #i4032# NEW TABLES + bool IsRowSpanLine() const { return mbIsRowSpanLine; } + void SetRowSpanLine( bool bNew ) { mbIsRowSpanLine = bNew; } + + DECL_FIXEDMEMPOOL_NEWDEL(SwRowFrm) +}; + +#endif diff --git a/sw/source/core/inc/scriptinfo.hxx b/sw/source/core/inc/scriptinfo.hxx new file mode 100644 index 000000000000..60c6877d4fb3 --- /dev/null +++ b/sw/source/core/inc/scriptinfo.hxx @@ -0,0 +1,416 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SCRIPTINFO_HXX +#define _SCRIPTINFO_HXX +#ifndef _SVSTDARR_HXX +#define _SVSTDARR_SHORTS +#define _SVSTDARR_BYTES +#define _SVSTDARR_USHORTS +#define _SVSTDARR_XUB_STRLEN +#include <svl/svstdarr.hxx> +#endif +#include <i18npool/lang.h> +#include <list> +#include <modeltoviewhelper.hxx> + +#include <errhdl.hxx> + +class SwTxtNode; +class Point; +class MultiSelection; +class String; +typedef std::list< xub_StrLen > PositionList; + +#define SPACING_PRECISION_FACTOR 100 + +/************************************************************************* + * class SwScanner + * Hilfsklasse, die beim Spellen die Worte im gewuenschten Bereich + * nacheinander zur Verfuegung stellt. + *************************************************************************/ + +class SwScanner +{ + XubString aWord; + const SwTxtNode& rNode; + const String& rText; + const LanguageType* pLanguage; + const ModelToViewHelper::ConversionMap* pConversionMap; + xub_StrLen nStartPos; + xub_StrLen nEndPos; + xub_StrLen nBegin; + xub_StrLen nLen; + LanguageType aCurrLang; + sal_uInt16 nWordType; + sal_Bool bClip; + +public: + SwScanner( const SwTxtNode& rNd, const String& rTxt, const LanguageType* pLang, + const ModelToViewHelper::ConversionMap* pConvMap, + sal_uInt16 nWordType, + xub_StrLen nStart, xub_StrLen nEnde, sal_Bool bClip = sal_False ); + + + // This next word function tries to find the language for the next word + // It should currently _not_ be used for spell checking, and works only for + // ! bReverse + sal_Bool NextWord(); + + const XubString& GetWord() const { return aWord; } + + xub_StrLen GetBegin() const { return nBegin; } + xub_StrLen GetEnd() const { return nBegin + nLen; } + xub_StrLen GetLen() const { return nLen; } + + LanguageType GetCurrentLanguage() const {return aCurrLang;} +}; + +/************************************************************************* + * class SwScriptInfo + * + * encapsultes information about script changes + *************************************************************************/ + +class SwScriptInfo +{ +private: + SvXub_StrLens aScriptChg; + SvBytes aScriptType; + SvXub_StrLens aDirChg; + SvBytes aDirType; + SvXub_StrLens aKashida; + SvXub_StrLens aKashidaInvalid; + SvXub_StrLens aNoKashidaLine; + SvXub_StrLens aNoKashidaLineEnd; + SvXub_StrLens aCompChg; + SvXub_StrLens aCompLen; + SvXub_StrLens aHiddenChg; + SvBytes aCompType; + xub_StrLen nInvalidityPos; + sal_uInt8 nDefaultDir; + + void UpdateBidiInfo( const String& rTxt ); + + sal_Bool IsKashidaValid ( xub_StrLen nKashPos ) const; + void MarkKashidaInvalid ( xub_StrLen nKashPos ); + void ClearKashidaInvalid ( xub_StrLen nKashPos ); + bool MarkOrClearKashidaInvalid( xub_StrLen nStt, xub_StrLen nLen, bool bMark, xub_StrLen nMarkCount ); + bool IsKashidaLine ( xub_StrLen nCharIdx ) const; + +public: + enum CompType { KANA, SPECIAL_LEFT, SPECIAL_RIGHT, NONE }; + + SwScriptInfo(); + ~SwScriptInfo(); + + // determines script changes + void InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL ); + void InitScriptInfo( const SwTxtNode& rNode ); + + // set/get position from which data is invalid + inline void SetInvalidity( const xub_StrLen nPos ); + inline xub_StrLen GetInvalidity() const { return nInvalidityPos; }; + + // get default direction for paragraph + inline sal_uInt8 GetDefaultDir() const { return nDefaultDir; }; + + // array operations, nCnt refers to array position + inline size_t CountScriptChg() const; + inline xub_StrLen GetScriptChg( const size_t nCnt ) const; + inline sal_uInt8 GetScriptType( const sal_uInt16 nCnt ) const; + + inline size_t CountDirChg() const; + inline xub_StrLen GetDirChg( const size_t nCnt ) const; + inline sal_uInt8 GetDirType( const size_t nCnt ) const; + + inline size_t CountKashida() const; + inline xub_StrLen GetKashida( const size_t nCnt ) const; + + inline size_t CountCompChg() const; + inline xub_StrLen GetCompStart( const size_t nCnt ) const; + inline xub_StrLen GetCompLen( const size_t nCnt ) const; + inline sal_uInt8 GetCompType( const size_t nCnt ) const; + + inline size_t CountHiddenChg() const; + inline xub_StrLen GetHiddenChg( const size_t nCnt ) const; + static void CalcHiddenRanges( const SwTxtNode& rNode, + MultiSelection& rHiddenMulti ); + + // "high" level operations, nPos refers to string position + xub_StrLen NextScriptChg( const xub_StrLen nPos ) const; + sal_uInt8 ScriptType( const xub_StrLen nPos ) const; + + // Returns the position of the next direction level change. + // If bLevel is set, the position of the next level which is smaller + // than the level at position nPos is returned. This is required to + // obtain the end of a SwBidiPortion + xub_StrLen NextDirChg( const xub_StrLen nPos, + const sal_uInt8* pLevel = 0 ) const; + sal_uInt8 DirType( const xub_StrLen nPos ) const; + +#if OSL_DEBUG_LEVEL > 1 + sal_uInt8 CompType( const xub_StrLen nPos ) const; +#endif + + // + // HIDDEN TEXT STUFF START + // + +/** Hidden text range information - static and non-version + + @descr Determines if a given position is inside a hidden text range. The + static version tries to obtain a valid SwScriptInfo object + via the SwTxtNode, otherwise it calculates the values from scratch. + The non-static version uses the internally cached informatio + for the calculation. + + @param rNode + The text node. + @param nPos + The given position that should be checked. + @param rnStartPos + Return parameter for the start position of the hidden range. + STRING_LEN if nPos is not inside a hidden range. + @param rnEndPos + Return parameter for the end position of the hidden range. + 0 if nPos is not inside a hidden range. + @param rnEndPos + Return parameter that contains all the hidden text ranges. Optional. + @return + returns true if there are any hidden characters in this paragraph. + +*/ + static bool GetBoundsOfHiddenRange( const SwTxtNode& rNode, xub_StrLen nPos, + xub_StrLen& rnStartPos, xub_StrLen& rnEndPos, + PositionList* pList = 0 ); + bool GetBoundsOfHiddenRange( xub_StrLen nPos, xub_StrLen& rnStartPos, + xub_StrLen& rnEndPos, PositionList* pList = 0 ) const; + + static bool IsInHiddenRange( const SwTxtNode& rNode, xub_StrLen nPos ); + +/** Hidden text attribute handling + + @descr Takes a string and either deletes the hidden ranges or sets + a given character in place of the hidden characters. + + @param rNode + The text node. + @param nPos + The string to modify. + @param cChar + The character that should replace the hidden characters. + @param bDel + If set, the hidden ranges will be deleted from the text node. + */ + static sal_uInt16 MaskHiddenRanges( const SwTxtNode& rNode, XubString& rText, + const xub_StrLen nStt, const xub_StrLen nEnd, + const xub_Unicode cChar ); + +/** Hidden text attribute handling + + @descr Takes a SwTxtNode and deletes the hidden ranges from the node. + + @param rNode + The text node. + */ + static void DeleteHiddenRanges( SwTxtNode& rNode ); + + // + // HIDDEN TEXT STUFF END + // + + // examines the range [ nStart, nStart + nEnd ] if there are kanas + // returns start index of kana entry in array, otherwise USHRT_MAX + sal_uInt16 HasKana( xub_StrLen nStart, const xub_StrLen nEnd ) const; + + // modifies the kerning array according to a given compress value + long Compress( sal_Int32* pKernArray, xub_StrLen nIdx, xub_StrLen nLen, + const sal_uInt16 nCompress, const sal_uInt16 nFontHeight, + Point* pPoint = NULL ) const; + +/** Performes a kashida justification on the kerning array + + @descr Add some extra space for kashida justification to the + positions in the kerning array. + @param pKernArray + The printers kerning array. Optional. + @param pScrArray + The screen kerning array. Optional. + @param nStt + Start referring to the paragraph. + @param nLen + The number of characters to be considered. + @param nSpaceAdd + The value which has to be added to a kashida opportunity. + @return The number of kashida opportunities in the given range +*/ + sal_uInt16 KashidaJustify( sal_Int32* pKernArray, sal_Int32* pScrArray, + xub_StrLen nStt, xub_StrLen nLen, + long nSpaceAdd = 0) const; + +/** Clears array of kashidas marked as invalid + */ + inline void ClearKashidaInvalid ( xub_StrLen nStt, xub_StrLen nLen ) { MarkOrClearKashidaInvalid( nStt, nLen, false, 0 ); } + +/** Marks nCnt kashida positions as invalid + pKashidaPositions: array of char indices relative to the paragraph +*/ + bool MarkKashidasInvalid ( xub_StrLen nCnt, xub_StrLen* pKashidaPositions ); + +/** Marks nCnt kashida positions as invalid + in the given text range + */ + inline bool MarkKashidasInvalid ( xub_StrLen nCnt, xub_StrLen nStt, xub_StrLen nLen ) + { return MarkOrClearKashidaInvalid( nStt, nLen, true, nCnt ); } + +/** retrieves kashida opportunities for a given text range. + returns the number of kashida positions in the given text range + + pKashidaPositions: buffer to reveive the char indices of the + kashida opportunties relative to the paragraph +*/ + sal_uInt16 GetKashidaPositions ( xub_StrLen nStt, xub_StrLen nLen, + xub_StrLen* pKashidaPosition ); + + + + +/** Use regular blank justification instead of kashdida justification for the given line of text. + nStt Start char index of the line referring to the paragraph. + nLen Number of characters in the line +*/ + void SetNoKashidaLine ( xub_StrLen nStt, xub_StrLen nLen ); + +/** Clear forced blank justification for a given line. + nStt Start char index of the line referring to the paragraph. + nLen Number of characters in the line +*/ + void ClearNoKashidaLine ( xub_StrLen nStt, xub_StrLen nLen ); + +/** Checks if text is Arabic text. + + @descr Checks if text is Arabic text. + @param rTxt + The text to check + @param nStt + Start index of the text + @return Returns if the language is an Arabic language + */ + static sal_Bool IsArabicText( const XubString& rTxt, xub_StrLen nStt, xub_StrLen nLen ); + +/** Performes a thai justification on the kerning array + + @descr Add some extra space for thai justification to the + positions in the kerning array. + @param rTxt + The String + @param pKernArray + The printers kerning array. Optional. + @param pScrArray + The screen kerning array. Optional. + @param nIdx + Start referring to the paragraph. + @param nLen + The number of characters to be considered. + @param nSpaceAdd + The value which has to be added to the cells. + @return The number of extra spaces in the given range +*/ + static sal_uInt16 ThaiJustify( const XubString& rTxt, sal_Int32* pKernArray, + sal_Int32* pScrArray, xub_StrLen nIdx, + xub_StrLen nLen, xub_StrLen nNumberOfBlanks = 0, + long nSpaceAdd = 0 ); + + static SwScriptInfo* GetScriptInfo( const SwTxtNode& rNode, + sal_Bool bAllowInvalid = sal_False ); + + static sal_uInt8 WhichFont( xub_StrLen nIdx, const String* pTxt, const SwScriptInfo* pSI ); +}; + +inline void SwScriptInfo::SetInvalidity( const xub_StrLen nPos ) +{ + if ( nPos < nInvalidityPos ) + nInvalidityPos = nPos; +}; +inline size_t SwScriptInfo::CountScriptChg() const { return aScriptChg.size(); } +inline xub_StrLen SwScriptInfo::GetScriptChg( const size_t nCnt ) const +{ + ASSERT( nCnt < aScriptChg.size(),"No ScriptChange today!"); + return aScriptChg[ nCnt ]; +} +inline sal_uInt8 SwScriptInfo::GetScriptType( const xub_StrLen nCnt ) const +{ + ASSERT( nCnt < aScriptType.size(),"No ScriptType today!"); + return aScriptType[ nCnt ]; +} + +inline size_t SwScriptInfo::CountDirChg() const { return aDirChg.size(); } +inline xub_StrLen SwScriptInfo::GetDirChg( const size_t nCnt ) const +{ + ASSERT( nCnt < aDirChg.size(),"No DirChange today!"); + return aDirChg[ nCnt ]; +} +inline sal_uInt8 SwScriptInfo::GetDirType( const size_t nCnt ) const +{ + ASSERT( nCnt < aDirType.size(),"No DirType today!"); + return aDirType[ nCnt ]; +} + +inline size_t SwScriptInfo::CountKashida() const { return aKashida.size(); } +inline xub_StrLen SwScriptInfo::GetKashida( const size_t nCnt ) const +{ + ASSERT( nCnt < aKashida.size(),"No Kashidas today!"); + return aKashida[ nCnt ]; +} + +inline size_t SwScriptInfo::CountCompChg() const { return aCompChg.size(); }; +inline xub_StrLen SwScriptInfo::GetCompStart( const size_t nCnt ) const +{ + ASSERT( nCnt < aCompChg.size(),"No CompressionStart today!"); + return aCompChg[ nCnt ]; +} +inline xub_StrLen SwScriptInfo::GetCompLen( const size_t nCnt ) const +{ + ASSERT( nCnt < aCompLen.size(),"No CompressionLen today!"); + return aCompLen[ nCnt ]; +} + +inline sal_uInt8 SwScriptInfo::GetCompType( const size_t nCnt ) const +{ + ASSERT( nCnt < aCompType.size(),"No CompressionType today!"); + return aCompType[ nCnt ]; +} + +inline size_t SwScriptInfo::CountHiddenChg() const { return aHiddenChg.size(); }; +inline xub_StrLen SwScriptInfo::GetHiddenChg( const size_t nCnt ) const +{ + ASSERT( nCnt < aHiddenChg.size(),"No HiddenChg today!"); + return aHiddenChg[ nCnt ]; +} + + +#endif diff --git a/sw/source/core/inc/sectfrm.hxx b/sw/source/core/inc/sectfrm.hxx new file mode 100644 index 000000000000..77314ff7f956 --- /dev/null +++ b/sw/source/core/inc/sectfrm.hxx @@ -0,0 +1,150 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SECTFRM_HXX +#define _SECTFRM_HXX +#include <tools/mempool.hxx> + +#include "layfrm.hxx" +#include "flowfrm.hxx" + +class SwSection; +class SwSectionFmt; +class SwAttrSetChg; +class SwFtnContFrm; +class SwLayouter; + +#define FINDMODE_ENDNOTE 1 +#define FINDMODE_LASTCNT 2 +#define FINDMODE_MYLAST 4 + +class SwSectionFrm: public SwLayoutFrm, public SwFlowFrm +{ + SwSection* pSection; + + void _UpdateAttr( const SfxPoolItem*, const SfxPoolItem*, sal_uInt8 &, + SwAttrSetChg *pa = 0, SwAttrSetChg *pb = 0 ); + void _Cut( sal_Bool bRemove ); + // Is there a FtnContainer? + // An empty sectionfrm without FtnCont is superfluous + sal_Bool IsSuperfluous() const { return !ContainsAny() && !ContainsFtnCont(); } + void CalcFtnAtEndFlag(); + void CalcEndAtEndFlag(); + const SwSectionFmt* _GetEndSectFmt() const; + sal_Bool IsEndnoteAtMyEnd() const; +protected: + virtual void MakeAll(); + virtual sal_Bool ShouldBwdMoved( SwLayoutFrm *pNewUpper, sal_Bool bHead, sal_Bool &rReformat ); + virtual void Format( const SwBorderAttrs *pAttrs = 0 ); + virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ); + virtual void SwClientNotify( const SwModify&, const SfxHint& ); + +public: + SwSectionFrm( SwSection &, SwFrm* ); //Inhalt wird nicht erzeugt! + SwSectionFrm( SwSectionFrm &, sal_Bool bMaster );//_Nur_ zum Erzeugen von Master/Follows + ~SwSectionFrm(); + + void Init(); + virtual void CheckDirection( sal_Bool bVert ); + + virtual void Cut(); + virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 ); + + inline const SwSectionFrm *GetFollow() const; + inline SwSectionFrm *GetFollow(); + SwSectionFrm* FindMaster() const; + + SwCntntFrm *FindLastCntnt( sal_uInt8 nMode = 0 ); + inline const SwCntntFrm *FindLastCntnt( sal_uInt8 nMode = 0 ) const; + inline SwSection* GetSection() { return pSection; } + inline const SwSection* GetSection() const { return pSection; } + inline void ColLock() { bColLocked = sal_True; } + inline void ColUnlock() { bColLocked = sal_False; } + + void CalcFtnCntnt(); + void SimpleFormat(); + sal_Bool IsDescendantFrom( const SwSectionFmt* pSect ) const; + sal_Bool HasToBreak( const SwFrm* pFrm ) const; + void MergeNext( SwSectionFrm* pNxt ); + //Zerlegt den pFrm umgebenden SectionFrm in zwei Teile, + //pFrm an den Anfang des 2. Teils + sal_Bool SplitSect( SwFrm* pFrm, sal_Bool bApres ); + void DelEmpty( sal_Bool bRemove ); // wie Cut(), Follow-Verkettung wird aber mitgepflegt + sal_Bool IsToIgnore() const // Keine Groesse, kein Inhalt, muss ignoriert werden + { return !Frm().Height() && !ContainsCntnt(); } + SwFtnContFrm* ContainsFtnCont( const SwFtnContFrm* pCont = NULL ) const; + sal_Bool Growable() const; + SwTwips _Shrink( SwTwips, sal_Bool bTst ); + SwTwips _Grow ( SwTwips, sal_Bool bTst ); + + // A sectionfrm has to maximize, if he has a follow or a ftncontainer at + // the end of the page. A superfluous follow will be ignored, + // if bCheckFollow is set. + sal_Bool ToMaximize( sal_Bool bCheckFollow ) const; + inline sal_Bool _ToMaximize() const + { if( !pSection ) return sal_False; return ToMaximize( sal_False ); } + sal_Bool MoveAllowed( const SwFrm* ) const; + sal_Bool CalcMinDiff( SwTwips& rMinDiff ) const; + // Uebergibt man kein bOverSize bzw. sal_False, so ist der Returnwert + // >0 fuer Undersized-Frames, ==0 sonst. + // Uebergibt man sal_True, so kann es auch einen negativen Returnwert geben, + // wenn der SectionFrm nicht vollstaendig ausgefuellt ist, was z.B. bei + // SectionFrm mit Follow meist vorkommt. Benoetigt wird dies im + // FormatWidthCols, um "Luft" aus den Spalten zu lassen. + long Undersize( sal_Bool bOverSize = sal_False ); + // Groesse an die Umgebung anpassen + void _CheckClipping( sal_Bool bGrow, sal_Bool bMaximize ); + + void InvalidateFtnPos(); + void CollectEndnotes( SwLayouter* pLayouter ); + const SwSectionFmt* GetEndSectFmt() const + { if( IsEndnAtEnd() ) return _GetEndSectFmt(); return NULL; } + + static void MoveCntntAndDelete( SwSectionFrm* pDel, sal_Bool bSave ); + + bool IsBalancedSection() const; + + DECL_FIXEDMEMPOOL_NEWDEL(SwSectionFrm) +}; + +typedef SwSectionFrm* SwSectionFrmPtr; +SV_DECL_PTRARR_SORT( SwDestroyList, SwSectionFrmPtr, 1, 5) + +inline const SwSectionFrm *SwSectionFrm::GetFollow() const +{ + return (const SwSectionFrm*)SwFlowFrm::GetFollow(); +} +inline SwSectionFrm *SwSectionFrm::GetFollow() +{ + return (SwSectionFrm*)SwFlowFrm::GetFollow(); +} +inline const SwCntntFrm *SwSectionFrm::FindLastCntnt( sal_uInt8 nMode ) const +{ + return ((SwSectionFrm*)this)->FindLastCntnt( nMode ); +} + + +#endif //_SECTFRM_HXX diff --git a/sw/source/core/inc/setmapvirtdev.hxx b/sw/source/core/inc/setmapvirtdev.hxx new file mode 100644 index 000000000000..e438899c2287 --- /dev/null +++ b/sw/source/core/inc/setmapvirtdev.hxx @@ -0,0 +1,71 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SETMAPVIRTDEV_HXX +#define _SETMAPVIRTDEV_HXX + +class OutputDevice; +class VirtualDevice; +class MapMode; +class Point; + +/** method to set mapping/pixel offset for virtual output device + + OD 12.11.2002 #96272# - method implements two solutions for the mapping of + the virtual output device: + The old solution set the origin of the mapping mode, which will be used in + the virtual output device. This causes several paint errors, because of the + different roundings in the virtual output device and the original output device. + The new solution avoids the rounding differences between virtual and original + output device by setting a pixel offset at the virtual output device. + A local boolean controls, which solution is used, in order to switch in + escalation back to old solution. + + @author OD + + @param _pOrgOutDev + input parameter - constant instance of the original output device, for which + the virtual output device is created. + + @param _pVirDev + input/output parameter - instance of the virtual output device. + + @param _pMapMode + input/output parameter - instance of the mapping mode, which will be set + at the virtual output device. + + @param _rNewOrigin + input parameter - constant instance of the origin, which will be used in + the virtual output device +*/ +void SetMappingForVirtDev( const Point& _rNewOrigin, + MapMode* _pMapMode, + const OutputDevice* _pOrgOutDev, + VirtualDevice* _pVirDev ); + + +#endif + diff --git a/sw/source/core/inc/sortedobjs.hxx b/sw/source/core/inc/sortedobjs.hxx new file mode 100644 index 000000000000..b983e2c81271 --- /dev/null +++ b/sw/source/core/inc/sortedobjs.hxx @@ -0,0 +1,108 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SORTEDOBJS_HXX +#define _SORTEDOBJS_HXX +class SwSortedObjsImpl; +class SwAnchoredObject; + +#include <sal/types.h> + +/** class for collecting anchored objects + + for #i28701# + Anchored objects can be inserted and deleted. The entries can be directly + accessed via index. + An anchored object is inserted sorted. The sort criteria are: + - anchor type + - order 1: to-page, 2: to-fly, 3: to-paragraph|to-character|as-character + - anchor node + - wrapping style (inclusive layer) + - order 1: wrapping style != SURROUND_THROUGHT and not in hell layer, + 2: wrapping style = SURROUND_THROUGHT or in hell layer + - wrapping style influence + - order 1: NONE_SUCCESSIVE_POSITIONED, 2: NONE_CONCURRENT_POSITIONED + - again anchor type + - order 1: to-paragraph, 2: to-character, 3: as-character + - anchor node position + - internal anchor order number + If one of the sort criteria attributes of an anchored object changes, + the sorting has to be updated - use method <Update(..)> + + @author OD +*/ +class SwSortedObjs +{ + private: + SwSortedObjsImpl* mpImpl; + + public: + SwSortedObjs(); + ~SwSortedObjs(); + + sal_uInt32 Count() const; + + /** direct access to the entries + + @param _nIndex + input parameter - index of entry, valid value range [0..Count()-1] + + @author OD + */ + SwAnchoredObject* operator[]( sal_uInt32 _nIndex ) const; + + bool Insert( SwAnchoredObject& _rAnchoredObj ); + + bool Remove( SwAnchoredObject& _rAnchoredObj ); + + bool Contains( const SwAnchoredObject& _rAnchoredObj ) const; + + /** method to update the position of the given anchored object in the + sorted list + + OD 2004-07-01 + + @author OD + + @return boolean, indicating success of the update. + */ + bool Update( SwAnchoredObject& _rAnchoredObj ); + + /** Position of object <_rAnchoredObj> in sorted list + + OD 2004-05-07 + Returns the number of the list position of object <_rAnchoredObj>. + Returns <Count()>, if object isn't contained in list. + + @author OD + + @return sal_uInt32 + Number of the list position of object <_rAnchoredObj> + */ + sal_uInt32 ListPosOf( const SwAnchoredObject& _rAnchoredObj ) const; +}; + +#endif diff --git a/sw/source/core/inc/sortedobjsimpl.hxx b/sw/source/core/inc/sortedobjsimpl.hxx new file mode 100644 index 000000000000..c15ed5e0e5dd --- /dev/null +++ b/sw/source/core/inc/sortedobjsimpl.hxx @@ -0,0 +1,61 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SORTEDOBJSIMPL_HXX +#define _SORTEDOBJSIMPL_HXX + +#include <vector> +#include <sal/types.h> +#include <fmtanchr.hxx> + +class SwAnchoredObject; +class SwTxtFrm; + +class SwSortedObjsImpl +{ + private: + std::vector< SwAnchoredObject* > maSortedObjLst; + + public: + SwSortedObjsImpl(); + ~SwSortedObjsImpl(); + + sal_uInt32 Count() const; + + SwAnchoredObject* operator[]( sal_uInt32 _nIndex ); + + bool Insert( SwAnchoredObject& _rAnchoredObj ); + + bool Remove( SwAnchoredObject& _rAnchoredObj ); + + bool Contains( const SwAnchoredObject& _rAnchoredObj ) const; + + bool Update( SwAnchoredObject& _rAnchoredObj ); + + sal_uInt32 ListPosOf( const SwAnchoredObject& _rAnchoredObj ) const; +}; + +#endif diff --git a/sw/source/core/inc/swblocks.hxx b/sw/source/core/inc/swblocks.hxx new file mode 100644 index 000000000000..c5d2b9240b22 --- /dev/null +++ b/sw/source/core/inc/swblocks.hxx @@ -0,0 +1,242 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SWBLOCKS_HXX +#define _SWBLOCKS_HXX + +#include <tools/string.hxx> + +#ifndef _DATE_HXX //autogen +#include <tools/datetime.hxx> +#endif +#include <svl/svarray.hxx> + + +class SfxMedium; +class SwPaM; +class SwDoc; +class SvxMacroTableDtor; + +// Name eines Textblocks: + +class SwBlockName +{ + friend class SwImpBlocks; + friend class Sw2TextBlocks; + sal_uInt16 nHashS, nHashL; // Hash-Codes zum Checken + long nPos; // Dateiposition (SW2-Format) +public: + String aShort; // Short name + String aLong; // Long name + String aPackageName; // Package name + sal_Bool bIsOnlyTxtFlagInit : 1; // ist das Flag gueltig? + sal_Bool bIsOnlyTxt : 1; // unformatted text + sal_Bool bInPutMuchBlocks : 1; // put serveral block entries + + SwBlockName( const String& rShort, const String& rLong, long n ); + SwBlockName( const String& rShort, const String& rLong, const String& rPackageName ); + + // fuer das Einsortieren in das Array + int operator==( const SwBlockName& r ) { return aShort == r.aShort; } + int operator< ( const SwBlockName& r ) { return aShort < r.aShort; } +}; + +SV_DECL_PTRARR_SORT( SwBlockNames, SwBlockName*, 10, 10 ) + + +class SwImpBlocks +{ + friend class SwTextBlocks; +protected: + String aFile; // physikalischer Dateiname + String aName; // logischer Name der Datei + String aCur; // aktueller Text + String aShort, aLong; // Kurz- und Langname (PutDoc) + String sBaseURL; // base URL - has to be set at the Readers and Writers + SwBlockNames aNames; // Liste aller Bausteine + Date aDateModified; // fuers abgleichen bei den Aktionen + Time aTimeModified; + SwDoc* pDoc; // Austauschdokument + sal_uInt16 nCur; // aktueller Index + sal_Bool bReadOnly : 1; + sal_Bool bInPutMuchBlocks : 1; // put serveral block entries + sal_Bool bInfoChanged : 1; // any Info of TextBlock is changed + + SwImpBlocks( const String&, sal_Bool = sal_False ); + virtual ~SwImpBlocks(); + + static short GetFileType( const String& ); + virtual short GetFileType() const = 0; +#define SWBLK_NO_FILE 0 // nicht da +#define SWBLK_NONE 1 // keine TB-Datei +#define SWBLK_SW2 2 // SW2-Datei +#define SWBLK_SW3 3 // SW3-Datei +#define SWBLK_XML 4 // XML Block List + + virtual void ClearDoc(); // Doc-Inhalt loeschen + SwPaM* MakePaM(); // PaM ueber Doc aufspannen + virtual void AddName( const String&, const String&, sal_Bool bOnlyTxt = sal_False ); + sal_Bool IsFileChanged() const; + void Touch(); + +public: + static sal_uInt16 Hash( const String& ); // Hashcode fuer Blocknamen + sal_uInt16 GetCount() const; // Anzahl Textbausteine ermitteln + sal_uInt16 GetIndex( const String& ) const; // Index fuer Kurznamen ermitteln + sal_uInt16 GetLongIndex( const String& ) const; //Index fuer Langnamen ermitteln + const String& GetShortName( sal_uInt16 ) const; // Kurzname fuer Index zurueck + const String& GetLongName( sal_uInt16 ) const; // Langname fuer Index zurueck + const String& GetPackageName( sal_uInt16 ) const; // Langname fuer Index zurueck + + const String& GetFileName() const {return aFile;} // phys. Dateinamen liefern + void SetName( const String& rName ) // logic name + { aName = rName; bInfoChanged = sal_True; } + const String & GetName( void ) + { return aName; } + + const String& GetBaseURL() const { return sBaseURL;} + void SetBaseURL( const String& rURL ) { sBaseURL = rURL; } + + virtual sal_uLong Delete( sal_uInt16 ) = 0; + virtual sal_uLong Rename( sal_uInt16, const String&, const String& ) = 0; + virtual sal_uLong CopyBlock( SwImpBlocks& rImp, String& rShort, const String& rLong) = 0; + virtual sal_uLong GetDoc( sal_uInt16 ) = 0; + virtual sal_uLong GetDocForConversion( sal_uInt16 ); + virtual sal_uLong BeginPutDoc( const String&, const String& ) = 0; + virtual sal_uLong PutDoc() = 0; + virtual sal_uLong GetText( sal_uInt16, String& ) = 0; + virtual sal_uLong PutText( const String&, const String&, const String& ) = 0; + virtual sal_uLong MakeBlockList() = 0; + + virtual sal_uLong OpenFile( sal_Bool bReadOnly = sal_True ) = 0; + virtual void CloseFile() = 0; + + virtual sal_Bool IsOnlyTextBlock( const String& rShort ) const; + + virtual sal_uLong GetMacroTable( sal_uInt16 nIdx, SvxMacroTableDtor& rMacroTbl, + sal_Bool bFileAlreadyOpen = sal_False ); + virtual sal_uLong SetMacroTable( sal_uInt16 nIdx, + const SvxMacroTableDtor& rMacroTbl, + sal_Bool bFileAlreadyOpen = sal_False ); + virtual sal_Bool PutMuchEntries( sal_Bool bOn ); +}; + +/* +class Sw3Persist : public SvPersist +{ + virtual void FillClass( SvGlobalName * pClassName, + sal_uLong * pClipFormat, + String * pAppName, + String * pLongUserName, + String * pUserName, + sal_Int32 nFileFormat=SOFFICE_FILEFORMAT_CURRENT ) const; + virtual sal_Bool Save(); + virtual sal_Bool SaveCompleted( SvStorage * ); +public: + Sw3Persist(); +}; + +class SwSwgReader; + +class Sw2TextBlocks : public SwImpBlocks +{ + SvPersistRef refPersist; // Fuer OLE-Objekte + SwSwgReader* pRdr; // Lese-Routinen + SfxMedium* pMed; // der logische Input-Stream + String* pText; // String fuer GetText() + long nDocStart; // Beginn des Doc-Records + long nDocSize; // Laenge des Doc-Records + long nStart; // Beginn des CONTENTS-Records + long nSize; // Laenge des CONTENTS-Records + sal_uInt16 nNamedFmts; // benannte Formate + sal_uInt16 nColls; // Text-Collections + sal_uInt16 nBlks; // Anzahl Elemente im CONTENTS-Record +public: + Sw2TextBlocks( const String& ); + virtual ~Sw2TextBlocks(); + virtual sal_uLong Delete( sal_uInt16 ); + virtual sal_uLong Rename( sal_uInt16, const String&, const String& ); + virtual sal_uLong CopyBlock( SwImpBlocks& rImp, String& rShort, const String& rLong); + virtual sal_uLong GetDoc( sal_uInt16 ); + virtual sal_uLong BeginPutDoc( const String&, const String& ); + virtual sal_uLong PutDoc(); + virtual sal_uLong GetText( sal_uInt16, String& ); + virtual sal_uLong PutText( const String&, const String&, const String& ); + virtual sal_uLong MakeBlockList(); + virtual short GetFileType( ) const; + sal_uLong LoadDoc(); + + virtual sal_uLong OpenFile( sal_Bool bReadOnly = sal_True ); + virtual void CloseFile(); + + void StatLineStartPercent(); // zum Anzeigen des Prozessbars +}; + +class Sw3Io; +class Sw3IoImp; + +class Sw3TextBlocks : public SwImpBlocks +{ + Sw3Io* pIo3; + Sw3IoImp* pImp; + sal_Bool bAutocorrBlock; + +public: + Sw3TextBlocks( const String& ); + Sw3TextBlocks( SvStorage& ); + virtual ~Sw3TextBlocks(); + virtual sal_uLong Delete( sal_uInt16 ); + virtual sal_uLong Rename( sal_uInt16, const String&, const String& ); + virtual sal_uLong CopyBlock( SwImpBlocks& rImp, String& rShort, const String& rLong); + virtual sal_uLong GetDoc( sal_uInt16 ); + virtual sal_uLong GetDocForConversion( sal_uInt16 ); + virtual sal_uLong BeginPutDoc( const String&, const String& ); + virtual sal_uLong PutDoc(); + virtual void SetDoc( SwDoc * pNewDoc); + virtual sal_uLong GetText( sal_uInt16, String& ); + virtual sal_uLong PutText( const String&, const String&, const String& ); + virtual sal_uLong MakeBlockList(); + virtual short GetFileType( ) const; + + virtual sal_uLong OpenFile( sal_Bool bReadOnly = sal_True ); + virtual void CloseFile(); + + // Methoden fuer die neue Autokorrektur + sal_uLong GetText( const String& rShort, String& ); + SwDoc* GetDoc() const { return pDoc; } + + virtual sal_Bool IsOnlyTextBlock( const String& rShort ) const; + + virtual sal_uLong GetMacroTable( sal_uInt16, SvxMacroTableDtor& rMacroTbl, + sal_Bool bFileAlreadyOpen = sal_False ); + virtual sal_uLong SetMacroTable( sal_uInt16 nIdx, + const SvxMacroTableDtor& rMacroTbl, + sal_Bool bFileAlreadyOpen = sal_False ); + + void ReadInfo(); +}; +*/ +#endif diff --git a/sw/source/core/inc/swcache.hxx b/sw/source/core/inc/swcache.hxx new file mode 100644 index 000000000000..b23ccb0f834a --- /dev/null +++ b/sw/source/core/inc/swcache.hxx @@ -0,0 +1,302 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SWCACHE_HXX +#define _SWCACHE_HXX + + + +/* + * Es werden Pointer auf Objekte verwaltet. Diese werden in einem einfachen + * PtrArray verwaltet. + * Angelegt (new) werden die Objekte von Cache-Zugriffsklassen, zuerstoert + * werden die Objekte vom Cache. + * + * Auf die Objekte kann wahlweise per Index in das Array oder per Suche + * zugegriffen werden. Soll per Index zugegriffen werden, so obliegt die + * Verwaltung des Index dem Anwender des Cache. + * + * Fuer die verwalteten Cache-Objekte gibt es eine Basisklasse, von dieser + * sind spezifische Klassen abzuleiten. + * In der Basisklasse werden die Cache-Objekte eines Cache doppelt verkettet, + * das ermoeglich die Implementierung eines LRU-Algorithmus. + * + * Der LRU kann in der Cache-Basisklasse manipuliert werden, indem ein + * virtueller First-Pointer gesetzt wird. Dieser kann auf den echten ersten + * plus einem Ofst gesetzt werden. Dadurch kann man den Anfangsbereich des + * Cache sichern und so dafuer sorgen, dass man waehrend bestimmter + * Operationen nicht den Cache versaut. Beispiel: Der Idle-Handler sollte nicht + * den Cache fuer den sichtbaren Bereich vernichten. + * + * Der Cache kann in der Groesse erweitert und wieder verkleinert werden. + * Beispiel: Fuer jede neue Shell wird der Cache fuer FormatInfo vergrossert + * und beim Destruieren der Shell wieder verkleinert. + * + */ + +#ifdef DBG_UTIL +#ifndef _STRING_HXX //autogen +#include <tools/string.hxx> +#endif +#endif + +#ifndef _SVSTDARR_HXX +#define _SVSTDARR_USHORTS +#include <svl/svstdarr.hxx> +#endif + +class SwCacheObj; + +SV_DECL_PTRARR_DEL(SwCacheObjArr,SwCacheObj*,1,1) + +class SwCache : public SwCacheObjArr +{ + SvUShorts aFreePositions; //Freie Positionen fuer das Insert wenn + //die Maximalgrenze nicht erreicht ist. + //Immer wenn ein Objekt ausgetragen wird, + //so wird seine Position hier eingetragen. + + SwCacheObj *pRealFirst; //_immer_ der echte LRU-erste + SwCacheObj *pFirst; //der virtuelle erste. + SwCacheObj *pLast; + + const sal_uInt16 nMax; //Mehr sollen nicht aufgenommen werden, + //der Cache kann aber dynamisch um jeweils + //nMax vergroessert werden. + sal_uInt16 nCurMax; //Mehr werden nicht aufgenommen. + + + void DeleteObj( SwCacheObj *pObj ); + +#ifdef DBG_UTIL + ByteString aName; + long nAppend; //Anzahl der Eintragungen durch Erweiterung. + long nInsertFree; //Anzahl der Eintragungen auf freie Plaetze. + long nReplace; //Anzahl der Ersetzungen durch ein neues Objekt + long nGetSuccess; //Anzahl der Erfolgreichen Get's + long nGetFail; //Anzahl der nicht Erfolgreichen Get's + long nToTop; //Anzahl der Umsortierungen (LRU) + long nDelete; //Anzahl der Loeschungen (von Aussen) + long nGetSeek; //Anzahl der Get's ohne Index + long nAverageSeekCnt; //Anzahl der Seek's fuer alle Get's ohne Index + long nFlushCnt; //Anzahl von Flush-Aufrufen. + long nFlushedObjects; //Anzahl der wg. Flush vernichteten Objekte + long nIncreaseMax; //Anzahl Cache-Erweiterungen + long nDecreaseMax; //Anzahl Cache-Verkleinerungen + + void Check(); //Wird bei swcache.cxx mit DEBUG aktiv! +#endif + +public: + + //nur sal_uInt8 hineinstecken!!! +#ifdef DBG_UTIL + SwCache( const sal_uInt16 nInitSize, const sal_uInt16 nGrowSize, + const ByteString &rNm ); + ~SwCache(); +#else + SwCache( const sal_uInt16 nInitSize, const sal_uInt16 nGrowSize ); +#endif + + void Flush( const sal_uInt8 nPercent = 100 ); + + //bToTop == sal_False -> Keine LRU-Umsortierung! + SwCacheObj *Get( const void *pOwner, const sal_Bool bToTop = sal_True ); + SwCacheObj *Get( const void *pOwner, const sal_uInt16 nIndex, + const sal_Bool bToTop = sal_True ); + void ToTop( SwCacheObj *pObj ); + + sal_Bool Insert( SwCacheObj *pNew ); + void Delete( const void *pOwner ); +// void Delete( const void *pOwner, const sal_uInt16 nIndex ); + + void SetLRUOfst( const sal_uInt16 nOfst ); //nOfst sagt wieviele unangetastet + //bleiben sollen. + void ResetLRUOfst() { pFirst = pRealFirst; } + + inline void IncreaseMax( const sal_uInt16 nAdd ); + inline void DecreaseMax( const sal_uInt16 nSub ); + sal_uInt16 GetCurMax() const { return nCurMax; } + inline SwCacheObj *First() { return pRealFirst; } + inline SwCacheObj *Last() { return pLast; } + inline SwCacheObj *Next( SwCacheObj *pCacheObj); +}; + +//Cache-Manipulation auf die sichere Art. +class SwSaveSetLRUOfst +{ + SwCache &rCache; +public: + SwSaveSetLRUOfst( SwCache &rC, const sal_uInt16 nOfst ) + : rCache( rC ) { rCache.SetLRUOfst( nOfst ); } + + ~SwSaveSetLRUOfst() { rCache.ResetLRUOfst(); } +}; + +//Das allgemeine CacheObjekt. Anwender des Cache muessen eine Klasse vom +//CacheObjekt ableiten und dort die Nutzdaten unterbringen. + +class SwCacheObj +{ + friend class SwCache; //Der darf alles + + SwCacheObj *pNext; //Fuer die LRU-Verkettung. + SwCacheObj *pPrev; + + sal_uInt16 nCachePos; //Position im Cache-Array. + + sal_uInt8 nLock; + + inline SwCacheObj *GetNext() { return pNext; } + inline SwCacheObj *GetPrev() { return pPrev; } + inline void SetNext( SwCacheObj *pNew ) { pNext = pNew; } + inline void SetPrev( SwCacheObj *pNew ) { pPrev = pNew; } + + inline void SetCachePos( const sal_uInt16 nNew ) { nCachePos = nNew; } + +protected: + const void *pOwner; + inline void SetOwner( const void *pNew ) { pOwner = pNew; } + +public: + + SwCacheObj( const void *pOwner ); + virtual ~SwCacheObj(); + + inline const void *GetOwner() const { return pOwner; } + inline sal_Bool IsOwner( const void *pNew ) const; + + inline sal_uInt16 GetCachePos() const { return nCachePos; } + inline void Invalidate() { pOwner = 0; } + + inline sal_Bool IsLocked() const { return 0 != nLock; } + +#ifndef DBG_UTIL + inline void Lock() { ++nLock; } + inline void Unlock() { --nLock; } +#else + void Lock(); + void Unlock(); +#endif + + SwCacheObj *Next() { return pNext; } + SwCacheObj *Prev() { return pPrev; } + +}; + +//Zugriffsklasse fuer den Cache. Im CTor wird das CacheObjekt erzeugt. +//Wenn der Cache keines herausrueckt wird der Member zunaechst auf 0 gesetzt. +//Beim Get wird dann eines erzeugt und, falls moeglich, in den Cache +//eingetragen. +//Anwender der des Cache muessen eine Klasse vom Access ableiten um +//fuer Typsicherheit zu sorgen, die Basisklasse sollte fuer das Get aber immer +//gerufen werden, ein Abgeleitetes Get sollte nur der Typsicherheit dienen. +//Cache-Objekte werden stets gelockt solange die Instanz lebt. + +class SwCacheAccess +{ + SwCache &rCache; + + void _Get(); + +protected: + SwCacheObj *pObj; + const void *pOwner; //Kann ggf. in NewObj benutzt werden. + + virtual SwCacheObj *NewObj() = 0; + + inline SwCacheObj *Get(); + + inline SwCacheAccess( SwCache &rCache, const void *pOwner, sal_Bool bSeek = sal_True ); + inline SwCacheAccess( SwCache &rCache, const void *pOwner, const sal_uInt16 nIndex ); + +public: + virtual ~SwCacheAccess(); + + virtual sal_Bool IsAvailable() const; + + //Abkuerzung fuer diejenigen, die wissen, das die Ableitung das IsAvailable + //nicht ueberladen haben. + sal_Bool IsAvail() const { return pObj != 0; } +}; + +inline void SwCache::IncreaseMax( const sal_uInt16 nAdd ) +{ + nCurMax = nCurMax + sal::static_int_cast< sal_uInt16 >(nAdd); +#ifdef DBG_UTIL + ++nIncreaseMax; +#endif +} +inline void SwCache::DecreaseMax( const sal_uInt16 nSub ) +{ + if ( nCurMax > nSub ) + nCurMax = nCurMax - sal::static_int_cast< sal_uInt16 >(nSub); +#ifdef DBG_UTIL + ++nDecreaseMax; +#endif +} + +inline sal_Bool SwCacheObj::IsOwner( const void *pNew ) const +{ + return pOwner && pOwner == pNew; +} + +inline SwCacheObj *SwCache::Next( SwCacheObj *pCacheObj) +{ + if ( pCacheObj ) + return pCacheObj->GetNext(); + else + return NULL; +} + +inline SwCacheAccess::SwCacheAccess( SwCache &rC, const void *pOwn, sal_Bool bSeek ) : + rCache( rC ), + pObj( 0 ), + pOwner( pOwn ) +{ + if ( bSeek && pOwner && 0 != (pObj = rCache.Get( pOwner )) ) + pObj->Lock(); +} + +inline SwCacheAccess::SwCacheAccess( SwCache &rC, const void *pOwn, + const sal_uInt16 nIndex ) : + rCache( rC ), + pObj( 0 ), + pOwner( pOwn ) +{ + if ( pOwner && 0 != (pObj = rCache.Get( pOwner, nIndex )) ) + pObj->Lock(); +} + +inline SwCacheObj *SwCacheAccess::Get() +{ + if ( !pObj ) + _Get(); + return pObj; +} + + +#endif diff --git a/sw/source/core/inc/swfntcch.hxx b/sw/source/core/inc/swfntcch.hxx new file mode 100644 index 000000000000..375139c260d7 --- /dev/null +++ b/sw/source/core/inc/swfntcch.hxx @@ -0,0 +1,99 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SWFNTCCH_HXX +#define _SWFNTCCH_HXX + +#include <tools/mempool.hxx> + +#define NUM_DEFAULT_VALUES 36 + +#include "swcache.hxx" +#include "swfont.hxx" + +class ViewShell; +class SfxPoolItem; + +/************************************************************************* + * class SwFontCache + *************************************************************************/ + +class SwFontCache : public SwCache +{ +public: + + inline SwFontCache() : SwCache(50,50 +#ifdef DBG_UTIL + , "Globaler AttributSet/Font-Cache pSwFontCache" +#endif + ) {} + +}; + +// AttributSet/Font-Cache, globale Variable, in FontCache.Cxx angelegt +extern SwFontCache *pSwFontCache; + +/************************************************************************* + * class SwFontObj + *************************************************************************/ + +class SwFontObj : public SwCacheObj +{ + friend class SwFontAccess; + +private: + SwFont aSwFont; + const SfxPoolItem* pDefaultArray[ NUM_DEFAULT_VALUES ]; + +public: + DECL_FIXEDMEMPOOL_NEWDEL(SwFontObj) + + SwFontObj( const void* pOwner, ViewShell *pSh ); + + virtual ~SwFontObj(); + + inline SwFont *GetFont() { return &aSwFont; } + inline const SwFont *GetFont() const { return &aSwFont; } + inline const SfxPoolItem** GetDefault() { return pDefaultArray; } +}; + +/************************************************************************* + * class SwFontAccess + *************************************************************************/ + + +class SwFontAccess : public SwCacheAccess +{ + ViewShell *pShell; +protected: + virtual SwCacheObj *NewObj( ); + +public: + SwFontAccess( const void *pOwner, ViewShell *pSh ); + SwFontObj *Get(); +}; + +#endif diff --git a/sw/source/core/inc/swfont.hxx b/sw/source/core/inc/swfont.hxx new file mode 100644 index 000000000000..631abab76b38 --- /dev/null +++ b/sw/source/core/inc/swfont.hxx @@ -0,0 +1,899 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SWFONT_HXX +#define _SWFONT_HXX + +#include <i18npool/lang.h> +#include <tools/color.hxx> +#ifndef _TOOLS_STREAM_HXX //autogen +#include <tools/stream.hxx> +#endif +#include <editeng/svxfont.hxx> +#include <swtypes.hxx> +#include <drawfont.hxx> // SwDrawTextInfo + +class SfxItemSet; +class SwAttrSet; +class SwDoCapitals; // DoCapitals +class SwDrawTextInfo; // _DrawText +class SwScriptInfo; // _GetTxtSize +class ViewShell; +class IDocumentSettingAccess; + +const xub_Unicode CH_BLANK = ' '; // ' ' Leerzeichen +const xub_Unicode CH_BREAK = 0x0A; // +const xub_Unicode CH_TAB = '\t'; // \t +const xub_Unicode CH_PAR = 0xB6; // Paragraph +const xub_Unicode CH_BULLET = 0xB7; // mittiger Punkt + +class SwSubFont : public SvxFont +{ + friend class SwFont; + const void *pMagic; // "MagicNumber" innerhalb des Fontcaches + Size aSize; // Fremde kriegen nur diese Size zu sehen + sal_uInt16 nFntIndex; // Index im Fontcache + sal_uInt16 nOrgHeight; // Hoehe inkl. Escapement/Proportion + sal_uInt16 nOrgAscent; // Ascent inkl. Escapement/Proportion + sal_uInt16 nPropWidth; // proportional width + inline SwSubFont() : aSize(0,0) + { pMagic = NULL; nFntIndex = nOrgHeight = nOrgAscent = 0; nPropWidth =100; } + + sal_uInt16 CalcEscAscent( const sal_uInt16 nOldAscent ) const; + sal_uInt16 CalcEscHeight( const sal_uInt16 nOldHeight, + const sal_uInt16 nOldAscent ) const; + void CalcEsc( SwDrawTextInfo& rInf, Point& rPos ); + + inline void CopyMagic( const SwSubFont& rFnt ) + { pMagic = rFnt.pMagic; nFntIndex = rFnt.nFntIndex; } + + sal_Bool operator==( const SwFont &rFnt ) const; + SwSubFont& operator=( const SwSubFont &rFont ); + + short _CheckKerning( ); + + sal_Bool ChgFnt( ViewShell *pSh, OutputDevice& rOut ); + sal_Bool IsSymbol( ViewShell *pSh ); + sal_uInt16 GetAscent( ViewShell *pSh, const OutputDevice& rOut ); + sal_uInt16 GetHeight( ViewShell *pSh, const OutputDevice& rOut ); + Size _GetTxtSize( SwDrawTextInfo& rInf ); + Size GetCapitalSize( SwDrawTextInfo& rInf ); + void _DrawText( SwDrawTextInfo &rInf, const sal_Bool bGrey ); + void DrawCapital( SwDrawTextInfo &rInf ); + void DrawStretchCapital( SwDrawTextInfo &rInf ); + void DoOnCapitals( SwDoCapitals &rDo ); + void _DrawStretchText( SwDrawTextInfo &rInf ); + xub_StrLen _GetCrsrOfst( SwDrawTextInfo& rInf ); + xub_StrLen GetCapitalCrsrOfst( SwDrawTextInfo& rInf ); + + inline void SetColor( const Color& rColor ); + inline void SetFillColor( const Color& rColor ); + inline void SetCharSet( const CharSet eCharSet ); + inline void SetPitch( const FontPitch ePitch ); + inline void SetAlign( const FontAlign eAlign ); + inline void SetUnderline( const FontUnderline eUnderline ); + inline void SetOverline( const FontUnderline eOverline ); + inline void SetStrikeout( const FontStrikeout eStrikeout ); + inline void SetItalic( const FontItalic eItalic ); + inline void SetOutline( const sal_Bool bOutline ); + inline void SetVertical( const sal_uInt16 nDir, const sal_Bool bVertFormat ); + inline void SetShadow( const sal_Bool bShadow ); + inline void SetAutoKern( const sal_uInt8 nAutoKern ); + inline void SetWordLineMode( const sal_Bool bWordLineMode ); + inline void SetEmphasisMark( const FontEmphasisMark eValue ); + inline void SetRelief( const FontRelief eNew ); + + // Methoden fuer die Hoch-/Tiefstellung + inline void SetEscapement( const short nNewEsc ); + inline void SetProportion( const sal_uInt8 nNewPropr ); + + inline void SetFamily( const FontFamily eFamily ); + inline void SetName( const XubString& rName ); + inline void SetStyleName( const XubString& rStyleName ); + inline void SetSize( const Size& rSize ); + inline void SetWeight( const FontWeight eWeight ); + inline void SetLanguage( LanguageType eNewLang ); + inline short CheckKerning() + { return GetFixKerning() >= 0 ? GetFixKerning() : _CheckKerning( ); } + inline void SetPropWidth( const sal_uInt16 nNew ) + { pMagic = 0; nPropWidth = nNew; } +public: + sal_uInt16 GetPropWidth() const { return nPropWidth; } +}; + +#define SW_LATIN 0 +#define SW_CJK 1 +#define SW_CTL 2 +#define SW_SCRIPTS 3 + +class SwFont +{ // CJK == Chinese, Japanese, Korean + // CTL == Complex text layout ( Hebrew, Arabic ) + SwSubFont aSub[SW_SCRIPTS]; // Latin-, CJK- and CTL-font + Color* pBackColor; // background color (i.e. at character styles) + Color aUnderColor; // color of the underlining + Color aOverColor; // color of the overlining + sal_uInt8 nToxCnt; // Zaehlt die Schachtelungstiefe der Tox + sal_uInt8 nRefCnt; // Zaehlt die Schachtelungstiefe der Refs + sal_uInt8 m_nMetaCount; // count META/METAFIELD + sal_uInt8 nActual; // actual font (Latin, CJK or CTL) + + // Schalter fuer die Font-Extensions + sal_Bool bNoHyph :1; // SwTxtNoHyphenHere: keine Trennstelle + sal_Bool bBlink :1; // blinkender Font + sal_Bool bPaintBlank :1; // Blanks nicht mit DrawRect + sal_Bool bFntChg :1; + sal_Bool bOrgChg :1; // nOrgHeight/Ascent sind invalid + sal_Bool bURL :1; + sal_Bool bPaintWrong :1; // Flag fuer Rechtschreibfehler + sal_Bool bGreyWave :1; // Fuers extended TextInput: Graue Wellenlinie + sal_Bool bNoColReplace :1; // Replacement without colormanipulation + + sal_Bool operator==( const SwFont &rFnt ) const; + +protected: + inline SwFont() { pBackColor = NULL; nActual = SW_LATIN; } + +public: + SwFont( const SwAttrSet* pSet, const IDocumentSettingAccess* pIDocumentSettingAccess ); + SwFont( const SwFont& rFont ); + + inline void ChgFnt( ViewShell *pSh, OutputDevice& rOut ) + { bPaintBlank = aSub[nActual].ChgFnt( pSh, rOut ); } + + ~SwFont(){ delete pBackColor; } + + SwFont& operator=( const SwFont &rFont ); + + inline sal_uInt8 GetActual() const { return nActual; } + inline void SetActual( sal_uInt8 nNew ); + inline const SvxFont& GetActualFont() const { return aSub[nActual]; } + + // holt sich eine MagicNumber ueber SwFntAccess + void GoMagic( ViewShell *pSh, sal_uInt8 nWhich ); + // set background color + void SetBackColor( Color* pNewColor ); + inline const Color* GetBackColor() const{ return pBackColor; } + + inline void ChkMagic( ViewShell *pSh, sal_uInt8 nWhich ) + { if( !aSub[ nWhich ].pMagic ) GoMagic( pSh, nWhich ); } + // uebernimmt die MagicNumber eines (hoffentlich ident.) Kollegen + inline void CopyMagic( const SwFont* pFnt, sal_uInt8 nWhich ) + { aSub[nWhich].CopyMagic( pFnt->aSub[nWhich] ); } + inline void GetMagic( const void* &rMagic, sal_uInt16 &rIdx, sal_uInt8 nWhich ) + { rMagic = aSub[nWhich].pMagic; rIdx = aSub[nWhich].nFntIndex; } + inline void SetMagic( const void* pNew, const sal_uInt16 nIdx, sal_uInt8 nWhich ) + { aSub[nWhich].pMagic = pNew; aSub[nWhich].nFntIndex = nIdx; } + inline sal_Bool DifferentMagic( const SwFont* pFnt, sal_uInt8 nWhich ) + { return aSub[nWhich].pMagic != pFnt->aSub[nWhich].pMagic || + !aSub[nWhich].pMagic || !pFnt->aSub[nWhich].pMagic; } + + inline const Size &GetSize( sal_uInt8 nWhich ) const + { return aSub[nWhich].aSize; } + inline sal_Bool IsFntChg() const { return bFntChg; } + inline void SetFntChg( const sal_Bool bNew ) { bFntChg = bNew; } + + // die gekapselten SV-Font-Methoden (setzen bFntChg auf sal_True) + inline void SetColor( const Color& rColor ); + inline void SetFillColor( const Color& rColor ); + inline void SetAlign( const FontAlign eAlign ); + inline void SetUnderline( const FontUnderline eUnderline ); + inline void SetUnderColor( const Color &rColor ) { aUnderColor = rColor; } + inline void SetOverline( const FontUnderline eOverline ); + inline void SetOverColor( const Color &rColor ) { aOverColor = rColor; } + inline void SetStrikeout( const FontStrikeout eStrikeout ); + inline void SetOutline( const sal_Bool bOutline ); + void SetVertical( sal_uInt16 nDir, const sal_Bool nVertLayout = sal_False ); + inline void SetShadow( const sal_Bool bShadow ); + inline void SetAutoKern( sal_uInt8 nAutoKern ); + inline void SetTransparent( const sal_Bool bTrans ); + inline void SetWordLineMode( const sal_Bool bWordLineMode ); + inline void SetFixKerning( const short nNewKern ); + inline void SetCaseMap( const SvxCaseMap eNew ); + inline void SetEmphasisMark( const FontEmphasisMark eValue ); + + // Methoden fuer die Hoch-/Tiefstellung + inline void SetEscapement( const short nNewEsc ); + inline void SetProportion( const sal_uInt8 nNewPropr ); + + inline void SetPropWidth( const sal_uInt16 nNew ); + + inline void SetFamily( const FontFamily eFamily, const sal_uInt8 nWhich ); + inline void SetName( const XubString& rName, const sal_uInt8 nWhich ); + inline void SetStyleName( const XubString& rStyleName, const sal_uInt8 nWhich ); + inline void SetSize( const Size& rSize, const sal_uInt8 nWhich ); + inline void SetWeight( const FontWeight eWeight, const sal_uInt8 nWhich ); + inline void SetItalic( const FontItalic eItalic, const sal_uInt8 nWhich ); + inline void SetLanguage( LanguageType eNewLang, const sal_uInt8 nWhich ); + inline void SetCharSet( const CharSet eCharSet, const sal_uInt8 nWhich ); + inline void SetPitch( const FontPitch ePitch, const sal_uInt8 nWhich ); + inline void SetRelief( const FontRelief eNew ); + + // Get/Set-Methoden fuer die aktuelle Einstellung + inline void SetNoHyph( const sal_Bool bNew ); + inline sal_Bool IsNoHyph() const { return bNoHyph; } + inline void SetBlink( const sal_Bool bBlink ); + inline sal_Bool IsBlink() const { return bBlink; } + inline sal_uInt8 &GetTox() { return nToxCnt; } + inline sal_uInt8 GetTox() const { return nToxCnt; } + inline sal_Bool IsTox() const { return ( 0 != nToxCnt ); } + inline sal_uInt8 &GetRef() { return nRefCnt; } + inline sal_uInt8 GetRef() const { return nRefCnt; } + inline sal_Bool IsRef() const { return ( 0 != nRefCnt ); } + inline sal_uInt8 &GetMeta() { return m_nMetaCount; } + inline sal_uInt8 GetMeta() const { return m_nMetaCount; } + inline bool IsMeta() const { return (0 != m_nMetaCount); } + inline void SetURL( const sal_Bool bURL ); + inline sal_Bool IsURL() const { return bURL; } + inline void SetGreyWave( const sal_Bool bNew ); + inline sal_Bool IsGreyWave() const { return bGreyWave; } + inline void SetNoCol( const sal_Bool bNew ); + inline sal_Bool IsNoCol() const { return bNoColReplace; } + + inline void SetPaintBlank( const sal_Bool bNew ); + inline sal_Bool IsPaintBlank() const { return bPaintBlank; } + inline void SetPaintWrong( const sal_Bool bNew ); + inline sal_Bool IsPaintWrong() const { return bPaintWrong; } + + // Setzen der Basisklasse Font fuer SwTxtCharFmt + void SetDiffFnt( const SfxItemSet* pSet, + const IDocumentSettingAccess* pIDocumentSettingAccess ); + + inline const SvxFont &GetFnt( const sal_uInt8 nWhich ) const + { return aSub[nWhich]; }; + + sal_Bool IsSymbol( ViewShell *pSh ) + { return aSub[nActual].IsSymbol( pSh ); } + FontUnderline GetUnderline() const { return aSub[nActual].GetUnderline(); } + const Color& GetUnderColor() const { return aUnderColor; } + FontUnderline GetOverline() const { return aSub[nActual].GetOverline(); } + const Color& GetOverColor() const { return aOverColor; } + short GetFixKerning() const { return aSub[nActual].GetFixKerning(); } + FontStrikeout GetStrikeout() const { return aSub[nActual].GetStrikeout(); } + const Color& GetColor() const { return aSub[nActual].GetColor(); } + sal_Bool IsShadow() const { return aSub[nActual].IsShadow(); } + sal_Bool IsWordLineMode() const { return aSub[nActual].IsWordLineMode(); } + sal_Bool IsOutline() const { return aSub[nActual].IsOutline(); } + sal_Bool IsKerning() const { return aSub[nActual].IsKerning(); } + short GetEscapement() const { return aSub[nActual].GetEscapement(); } + SvxCaseMap GetCaseMap() const { return aSub[nActual].GetCaseMap(); } + sal_uInt8 GetPropr() const { return aSub[nActual].GetPropr(); } + FontItalic GetItalic() const { return aSub[nActual].GetItalic(); } + LanguageType GetLanguage() const { return aSub[nActual].GetLanguage(); } + FontAlign GetAlign() const { return aSub[nActual].GetAlign(); } + const XubString& GetName() const { return aSub[nActual].GetName(); } + const XubString& GetStyleName() const {return aSub[nActual].GetStyleName();} + FontFamily GetFamily() const { return aSub[nActual].GetFamily(); } + FontPitch GetPitch() const { return aSub[nActual].GetPitch(); } + rtl_TextEncoding GetCharSet() const { return aSub[nActual].GetCharSet(); } + long GetHeight() const { return aSub[nActual].GetSize().Height(); } + FontWeight GetWeight() const { return aSub[nActual].GetWeight(); } + FontEmphasisMark GetEmphasisMark() const + { return aSub[nActual].GetEmphasisMark(); } + sal_uInt16 GetPropWidth() const { return aSub[nActual].GetPropWidth(); } + sal_uInt16 GetOrientation( const sal_Bool nVertLayout = sal_False ) const; + + inline const XubString& GetName( const sal_uInt8 nWhich ) const + { return aSub[nWhich].GetName(); } + inline LanguageType GetLanguage( const sal_uInt8 nWhich ) const + { return aSub[nWhich].GetLanguage(); } + inline const XubString& GetStyleName( const sal_uInt8 nWhich ) const + { return aSub[nWhich].GetStyleName(); } + inline FontFamily GetFamily( const sal_uInt8 nWhich ) const + { return aSub[nWhich].GetFamily(); } + inline FontItalic GetItalic( const sal_uInt8 nWhich ) const + { return aSub[nWhich].GetItalic(); } + inline FontPitch GetPitch( const sal_uInt8 nWhich ) const + { return aSub[nWhich].GetPitch(); } + inline rtl_TextEncoding GetCharSet( const sal_uInt8 nWhich ) const + { return aSub[nWhich].GetCharSet(); } + inline long GetHeight( const sal_uInt8 nWhich ) const + { return aSub[nWhich].GetSize().Height(); } + inline FontWeight GetWeight( const sal_uInt8 nWhich ) const + { return aSub[nWhich].GetWeight(); } + inline FontEmphasisMark GetEmphasisMark( const sal_uInt8 nWhich ) const + { return aSub[nWhich].GetEmphasisMark(); } + + // Macht den logischen Font im OutputDevice wirksam. + void ChgPhysFnt( ViewShell *pSh, OutputDevice& rOut ); + + Size GetCapitalSize( SwDrawTextInfo& rInf ) + { return aSub[nActual].GetCapitalSize( rInf ); } + + xub_StrLen GetCapitalBreak( ViewShell* pSh, const OutputDevice* pOut, + const SwScriptInfo* pScript, const XubString& rTxt, + long nTextWidth, xub_StrLen* pExtra, const xub_StrLen nIdx, + const xub_StrLen nLen ); + + xub_StrLen GetCapitalCrsrOfst( SwDrawTextInfo& rInf ) + { return aSub[nActual].GetCapitalCrsrOfst( rInf ); } + + void DrawCapital( SwDrawTextInfo &rInf ) + { aSub[nActual].DrawCapital( rInf ); } + + void DrawStretchCapital( SwDrawTextInfo &rInf ) + { aSub[nActual].DrawStretchCapital( rInf ); } + + void DoOnCapitals( SwDoCapitals &rDo ) + { aSub[nActual].DoOnCapitals( rDo ); } + + Size _GetTxtSize( SwDrawTextInfo& rInf ) + { rInf.SetFont( this ); return aSub[nActual]._GetTxtSize( rInf ); } + + xub_StrLen GetTxtBreak( SwDrawTextInfo& rInf, long nTextWidth ); + + xub_StrLen _GetCrsrOfst( SwDrawTextInfo& rInf ) + { return aSub[nActual]._GetCrsrOfst( rInf ); } + + inline void _DrawText( SwDrawTextInfo &rInf ) + { aSub[nActual]._DrawText( rInf, IsGreyWave() ); } + + inline void _DrawStretchText( SwDrawTextInfo &rInf ) + { aSub[nActual]._DrawStretchText( rInf ); } + + inline short CheckKerning() + { return aSub[nActual].CheckKerning(); } + + inline sal_uInt16 GetAscent( ViewShell *pSh, const OutputDevice& rOut ) + { return aSub[nActual].GetAscent( pSh, rOut ); } + inline sal_uInt16 GetHeight( ViewShell *pSh, const OutputDevice& rOut ) + { return aSub[nActual].GetHeight( pSh, rOut ); } + + inline void Invalidate() + { bFntChg = bOrgChg = sal_True; } +}; + +inline void SwFont::SetColor( const Color& rColor ) +{ + bFntChg = sal_True; + aSub[0].SetColor( rColor ); + aSub[1].SetColor( rColor ); + aSub[2].SetColor( rColor ); +} + +// gekapselte SV-Font-Methode +inline void SwSubFont::SetColor( const Color& rColor ) +{ + pMagic = 0; + Font::SetColor( rColor ); +} + + +// gekapselte SV-Font-Methode +inline void SwSubFont::SetFillColor( const Color& rColor ) +{ + pMagic = 0; + Font::SetFillColor( rColor ); +} + +inline void SwFont::SetFillColor( const Color& rColor ) +{ + bFntChg = sal_True; + aSub[0].SetFillColor( rColor ); + aSub[1].SetFillColor( rColor ); + aSub[2].SetFillColor( rColor ); +} + +// gekapselte SV-Font-Methode +inline void SwSubFont::SetFamily( const FontFamily eFamily ) +{ + pMagic = 0; + Font::SetFamily( eFamily ); +} + +inline void SwFont::SetFamily( const FontFamily eFamily, const sal_uInt8 nWhich ) +{ + bFntChg = sal_True; + aSub[nWhich].SetFamily( eFamily ); +} + +// gekapselte SV-Font-Methode +inline void SwSubFont::SetName( const XubString& rName ) +{ + pMagic = 0; + Font::SetName( rName ); +} + +inline void SwFont::SetName( const XubString& rName, const sal_uInt8 nWhich ) +{ + bFntChg = sal_True; + aSub[nWhich].SetName( rName ); +} + +// gekapselte SV-Font-Methode +inline void SwSubFont::SetStyleName( const XubString& rStyleName ) +{ + pMagic = 0; + Font::SetStyleName( rStyleName ); +} + +inline void SwFont::SetStyleName( const XubString& rStyle, const sal_uInt8 nWhich ) +{ + bFntChg = sal_True; + aSub[nWhich].SetStyleName( rStyle ); +} + +// gekapselte SV-Font-Methode +inline void SwSubFont::SetCharSet( const CharSet eCharSet ) +{ + pMagic = 0; + Font::SetCharSet( eCharSet ); +} + +inline void SwFont::SetCharSet( const CharSet eCharSet, const sal_uInt8 nWhich ) +{ + bFntChg = sal_True; + aSub[nWhich].SetCharSet( eCharSet ); +} + +// gekapselte SV-Font-Methode +inline void SwSubFont::SetPitch( const FontPitch ePitch ) +{ + pMagic = 0; + Font::SetPitch( ePitch ); +} + +// gekapselte SV-Font-Methode +inline void SwFont::SetPitch( const FontPitch ePitch, const sal_uInt8 nWhich ) +{ + bFntChg = sal_True; + aSub[nWhich].SetPitch( ePitch ); +} + +// gekapselte SV-Font-Methode +inline void SwSubFont::SetAlign( const FontAlign eAlign ) +{ + pMagic = 0; + Font::SetAlign( eAlign ); +} + +inline void SwFont::SetAlign( const FontAlign eAlign ) +{ + bFntChg = sal_True; + aSub[0].SetAlign( eAlign ); + aSub[1].SetAlign( eAlign ); + aSub[2].SetAlign( eAlign ); +} + +// gekapselte SV-Font-Methode +inline void SwSubFont::SetWeight( const FontWeight eWeight ) +{ + pMagic = 0; + Font::SetWeight( eWeight ); +} + +inline void SwFont::SetWeight( const FontWeight eWeight, const sal_uInt8 nWhich ) +{ + bFntChg = sal_True; + aSub[nWhich].SetWeight( eWeight ); +} + +// gekapselte SV-Font-Methode +inline void SwSubFont::SetUnderline( const FontUnderline eUnderline ) +{ + pMagic = 0; + Font::SetUnderline( eUnderline ); +} + +inline void SwFont::SetUnderline( const FontUnderline eUnderline ) +{ + bFntChg = sal_True; + aSub[0].SetUnderline( eUnderline ); + aSub[1].SetUnderline( eUnderline ); + aSub[2].SetUnderline( eUnderline ); +} + +// gekapselte SV-Font-Methode +inline void SwSubFont::SetOverline( const FontUnderline eOverline ) +{ + pMagic = 0; + Font::SetOverline( eOverline ); +} + +inline void SwFont::SetOverline( const FontUnderline eOverline ) +{ + bFntChg = sal_True; + aSub[0].SetOverline( eOverline ); + aSub[1].SetOverline( eOverline ); + aSub[2].SetOverline( eOverline ); +} + +// gekapselte SV-Font-Methode +inline void SwSubFont::SetStrikeout( const FontStrikeout eStrikeout ) +{ + pMagic = 0; + Font::SetStrikeout( eStrikeout ); +} + +inline void SwFont::SetStrikeout( const FontStrikeout eStrikeout ) +{ + bFntChg = sal_True; + aSub[0].SetStrikeout( eStrikeout ); + aSub[1].SetStrikeout( eStrikeout ); + aSub[2].SetStrikeout( eStrikeout ); +} + +// gekapselte SV-Font-Methode +inline void SwSubFont::SetItalic( const FontItalic eItalic ) +{ + pMagic = 0; + Font::SetItalic( eItalic ); +} + +inline void SwFont::SetItalic( const FontItalic eItalic, const sal_uInt8 nWhich ) +{ + bFntChg = sal_True; + aSub[nWhich].SetItalic( eItalic ); +} + +// gekapselte SV-Font-Methode +inline void SwSubFont::SetOutline( const sal_Bool bOutline ) +{ + pMagic = 0; + Font::SetOutline( bOutline ); +} + +inline void SwFont::SetOutline( const sal_Bool bOutline ) +{ + bFntChg = sal_True; + aSub[0].SetOutline( bOutline ); + aSub[1].SetOutline( bOutline ); + aSub[2].SetOutline( bOutline ); +} + +// gekapselte SV-Font-Methode +inline void SwSubFont::SetShadow( const sal_Bool bShadow ) +{ + pMagic = 0; + Font::SetShadow( bShadow ); +} + +inline void SwFont::SetShadow( const sal_Bool bShadow ) +{ + bFntChg = sal_True; + aSub[0].SetShadow( bShadow ); + aSub[1].SetShadow( bShadow ); + aSub[2].SetShadow( bShadow ); +} + +// gekapselte SV-Font-Methode +inline void SwSubFont::SetAutoKern( const sal_uInt8 nAutoKern ) +{ + pMagic = 0; + Font::SetKerning( nAutoKern ); +} + +inline void SwFont::SetAutoKern( sal_uInt8 nAutoKern ) +{ + bFntChg = sal_True; + aSub[1].SetAutoKern( nAutoKern ); + if( nAutoKern ) + nAutoKern = KERNING_FONTSPECIFIC; + aSub[0].SetAutoKern( nAutoKern ); + aSub[2].SetAutoKern( nAutoKern ); +} + +inline void SwFont::SetTransparent( const sal_Bool bTrans ) +{ + aSub[0].SetTransparent( bTrans ); + aSub[1].SetTransparent( bTrans ); + aSub[2].SetTransparent( bTrans ); +} + +inline void SwFont::SetFixKerning( const short nNewKern ) +{ + aSub[SW_LATIN].SetFixKerning( nNewKern ); + aSub[SW_CJK].SetFixKerning( nNewKern ); + aSub[SW_CTL].SetFixKerning( nNewKern ); +} + +inline void SwFont::SetCaseMap( const SvxCaseMap eNew ) +{ + aSub[SW_LATIN].SetCaseMap( eNew ); + aSub[SW_CJK].SetCaseMap( eNew ); + aSub[SW_CTL].SetCaseMap( eNew ); +} + +// gekapselte SV-Font-Methode +inline void SwSubFont::SetWordLineMode( const sal_Bool bWordLineMode ) +{ + pMagic = 0; + Font::SetWordLineMode( bWordLineMode ); +} + +inline void SwFont::SetWordLineMode( const sal_Bool bWordLineMode ) +{ + bFntChg = sal_True; + aSub[0].SetWordLineMode( bWordLineMode ); + aSub[1].SetWordLineMode( bWordLineMode ); + aSub[2].SetWordLineMode( bWordLineMode ); +} +// gekapselte SV-Font-Methode +inline void SwSubFont::SetEmphasisMark( const FontEmphasisMark eValue ) +{ + pMagic = 0; + Font::SetEmphasisMark( eValue ); +} + +inline void SwFont::SetEmphasisMark( const FontEmphasisMark eValue ) +{ + bFntChg = sal_True; + aSub[0].SetEmphasisMark( eValue ); + aSub[1].SetEmphasisMark( eValue ); + aSub[2].SetEmphasisMark( eValue ); +} + +inline void SwFont::SetPropWidth( const sal_uInt16 nNew ) +{ + if( nNew != aSub[0].GetPropWidth() ) + { + bFntChg = sal_True; + aSub[0].SetPropWidth( nNew ); + aSub[1].SetPropWidth( nNew ); + aSub[2].SetPropWidth( nNew ); + } +} + +// gekapselte SV-Font-Methode +inline void SwSubFont::SetRelief( const FontRelief eNew ) +{ + pMagic = 0; + Font::SetRelief( eNew ); +} + +inline void SwFont::SetRelief( const FontRelief eNew ) +{ + if( eNew != aSub[0].GetRelief() ) + { + bFntChg = sal_True; + aSub[0].SetRelief( eNew ); + aSub[1].SetRelief( eNew ); + aSub[2].SetRelief( eNew ); + } +} + +// ueberladene Font-Methode +inline void SwSubFont::SetSize( const Size& rSize ) +{ + aSize = rSize; + if ( GetPropr() == 100 ) + Font::SetSize( aSize ); + else + { + Font::SetSize( Size( + (long) aSize.Width() * GetPropr() / 100L, + (long) aSize.Height() * GetPropr() / 100L ) ); + } + pMagic = 0; +} + +inline void SwFont::SetSize( const Size& rSize, const sal_uInt8 nWhich ) +{ + if( aSub[nWhich].aSize != rSize ) + { + aSub[nWhich].SetSize( rSize ); + bFntChg = sal_True; + bOrgChg = sal_True; + } +} + +inline void SwFont::SetActual( sal_uInt8 nNew ) +{ + if ( nActual != nNew ) + { + bFntChg = sal_True; + bOrgChg = sal_True; + nActual = nNew; + } +} + +inline void SwSubFont::SetProportion( const sal_uInt8 nNewPropr ) +{ + pMagic = 0; + Font::SetSize( Size( (long) aSize.Width() * nNewPropr / 100L, + (long) aSize.Height() * nNewPropr / 100L ) ); + SvxFont::SetPropr( nNewPropr ); +} + +inline void SwFont::SetProportion( const sal_uInt8 nNewPropr ) +{ + if( nNewPropr != aSub[0].GetPropr() ) + { + bFntChg = sal_True; + bOrgChg = sal_True; + + aSub[0].SetProportion( nNewPropr ); + aSub[1].SetProportion( nNewPropr ); + aSub[2].SetProportion( nNewPropr ); + } +} + +inline void SwSubFont::SetEscapement( const short nNewEsc ) +{ + pMagic = 0; + SvxFont::SetEscapement( nNewEsc ); +} + +inline void SwFont::SetEscapement( const short nNewEsc ) +{ + if( nNewEsc != aSub[0].GetEscapement() ) + { + // these have to be set, otherwise nOrgHeight and nOrgAscent will not + // be calculated + bFntChg = sal_True; + bOrgChg = sal_True; + + aSub[0].SetEscapement( nNewEsc ); + aSub[1].SetEscapement( nNewEsc ); + aSub[2].SetEscapement( nNewEsc ); + } +} + +inline void SwSubFont::SetLanguage( LanguageType eNewLang ) +{ + if( eNewLang == LANGUAGE_SYSTEM ) + eNewLang = (LanguageType)GetAppLanguage(); + SvxFont::SetLanguage( eNewLang ); +} + +inline void SwFont::SetLanguage( const LanguageType eNewLang, const sal_uInt8 nWhich ) +{ + aSub[nWhich].SetLanguage( eNewLang ); + if( SW_CJK == nWhich ) + { + aSub[SW_LATIN].SetCJKContextLanguage( eNewLang ); + aSub[SW_CJK].SetCJKContextLanguage( eNewLang ); + aSub[SW_CTL].SetCJKContextLanguage( eNewLang ); + } +} + +inline void SwFont::SetPaintBlank( const sal_Bool bNew ) +{ + bPaintBlank = bNew; +} + +inline void SwFont::SetPaintWrong( const sal_Bool bNew ) +{ + bPaintWrong = bNew; +} + +inline void SwFont::SetNoHyph( const sal_Bool bNew ) +{ + bNoHyph = bNew; +} + +inline void SwFont::SetBlink( const sal_Bool bNew ) +{ + bBlink = bNew; +} + +inline void SwFont::SetURL( const sal_Bool bNew ) +{ + bURL = bNew; +} + +inline void SwFont::SetGreyWave( const sal_Bool bNew ) +{ + bGreyWave = bNew; +} + +inline void SwFont::SetNoCol( const sal_Bool bNew ) +{ + bNoColReplace = bNew; +} + +inline void SwSubFont::SetVertical( const sal_uInt16 nDir, const sal_Bool bVertFormat ) +{ + pMagic = 0; + Font::SetVertical( bVertFormat ); + Font::SetOrientation( nDir ); +} + + +/************************************************************************* + * class SwUnderlineFont + * + * Used for the "continuous underline" feature. + *************************************************************************/ + +class SwUnderlineFont +{ + Point aPos; + SwFont* pFnt; + +public: + // sets the font which should paint the common baseline + // and the starting point of the common baseline + SwUnderlineFont( SwFont& rFnt, const Point& rPoint ); + ~SwUnderlineFont(); + + SwFont& GetFont() + { + ASSERT( pFnt, "No underline font" ) + return *pFnt; + } + const Point& GetPos() const { return aPos; } + // the x coordinate of the starting point has to be set for each portion + void SetPos( const Point& rPoint ) { aPos = rPoint; } +}; + + +/************************************************************************* + * class SvStatistics + *************************************************************************/ + +#ifndef DBG_UTIL +#define SV_STAT(nWhich) +#else + +class SvStatistics +{ +public: + sal_uInt16 nGetTextSize; + sal_uInt16 nDrawText; + sal_uInt16 nGetStretchTextSize; + sal_uInt16 nDrawStretchText; + sal_uInt16 nChangeFont; + sal_uInt16 nGetFontMetric; + + inline void Reset() + { + nGetTextSize = nDrawText = nGetStretchTextSize = + nDrawStretchText = nChangeFont = nGetFontMetric = 0; + } + + inline SvStatistics() { Reset(); } + + inline void PrintOn( SvStream &rOS ) const; //$ ostream + inline sal_Bool IsEmpty() const + { + return !( nGetTextSize || nDrawText || + nDrawStretchText || nChangeFont || nGetFontMetric ); + } +}; + +// globale Variable, implementiert in swfont.cxx +extern SvStatistics aSvStat; + +#define SV_STAT(nWhich) ++(aSvStat.nWhich); + +inline void SvStatistics::PrintOn( SvStream &rOS ) const //$ ostream +{ + if( IsEmpty() ) + return; + + rOS << "{ SV called:" << '\n'; + if( nGetTextSize ) + rOS << "\tnGetTextSize: " << nGetTextSize << '\n'; if( nDrawText ) + rOS << "\tnDrawText: " << nDrawText << '\n'; if( nGetStretchTextSize ) + rOS << "\tnGetStretchTextSize: " << nGetStretchTextSize << '\n'; if( nDrawStretchText ) + rOS << "\tnDrawStretchText: " << nDrawStretchText << '\n'; if( nChangeFont ) + rOS << "\tnChangeFont: " << nChangeFont << '\n'; if( nGetFontMetric ) + rOS << "\tnGetFontMetric: " << nGetFontMetric << '\n'; rOS << "}" << '\n'; } +#endif /* PRODUCT */ + +#endif + diff --git a/sw/source/core/inc/swselectionlist.hxx b/sw/source/core/inc/swselectionlist.hxx new file mode 100644 index 000000000000..1431a49c5bc3 --- /dev/null +++ b/sw/source/core/inc/swselectionlist.hxx @@ -0,0 +1,97 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SWSELECTIONLIST_HXX +#define _SWSELECTIONLIST_HXX + +#include <list> + +class SwPaM; +class SwFrm; + +/** This class is used as parameter for creation of a block cursor selection + + This class will be created by a block cursor. Its responsibility is + to collect a group of selected text portions which are part of a common + context. + Definition of context: + A page header is a context. + A page footer is a context. + A footnote is a context. + Every fly frame builds a context together with its linked colleagues. + The content of the page bodies builds a context. +*/ + +class SwSelectionList +{ + std::list< SwPaM* > aList; // container for the selected text portions + const SwFrm* pContext; // the context of these text portions +public: + /** Ctor to create an empty list for a given context + + @param pInitCxt + The frame (normally a SwTxtFrm) where the block cursor selection starts, + it will be used to get the allowed context for the text selections. + */ + explicit SwSelectionList( const SwFrm* pInitCxt ); + + /** Start of the container for the selected text portions + */ + std::list<SwPaM*>::iterator getStart() { return aList.begin(); } + + /** End of the container for the selected text portions + */ + std::list<SwPaM*>::iterator getEnd() { return aList.end(); } + + /** Adds a text portion to the selection list + + @param pPam + represents a text portion to select + */ + void insertPaM( SwPaM* pPam ) { aList.push_front( pPam ); } + + /** Reports if the list does not contain any text portion + + @return true, if list is empty + */ + bool isEmpty() const { return aList.empty(); } + + /** Checks if the context of the list is equal to the context of the frame + + If the list does not have already a context, the context of the frame + will define the list's context. + If the list has already a context, it will be compared to the context of + the given frame. + + @param pCheck + The frame to check + + @return true, if the context of the frame is equal to the one of the list + */ + bool checkContext( const SwFrm* pCheck ); +}; + +#endif //_SWSELECTIONLIST_HXX diff --git a/sw/source/core/inc/swthreadjoiner.hxx b/sw/source/core/inc/swthreadjoiner.hxx new file mode 100644 index 000000000000..d3d7ab8bd97b --- /dev/null +++ b/sw/source/core/inc/swthreadjoiner.hxx @@ -0,0 +1,51 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SWTHREADJOINER_HXX +#define _SWTHREADJOINER_HXX + +#include "com/sun/star/util/XJobManager.hpp" +#include <osl/mutex.hxx> + +/** Testing + + @author OD +*/ +class SwThreadJoiner +{ + public: + + static ::com::sun::star::uno::Reference< ::com::sun::star::util::XJobManager >& GetThreadJoiner(); + + static void ReleaseThreadJoiner(); + + private: + static ::com::sun::star::uno::Reference< ::com::sun::star::util::XJobManager > mpThreadJoiner; + static osl::Mutex* mpGetJoinerMutex; + + SwThreadJoiner(); +}; +#endif diff --git a/sw/source/core/inc/swthreadmanager.hxx b/sw/source/core/inc/swthreadmanager.hxx new file mode 100644 index 000000000000..4ab94ef4cfc2 --- /dev/null +++ b/sw/source/core/inc/swthreadmanager.hxx @@ -0,0 +1,89 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _SWTHREADMANAGER_HXX +#define _SWTHREADMANAGER_HXX + +#include <osl/interlck.h> +#include <osl/mutex.hxx> +#include <rtl/ref.hxx> + +#include <boost/utility.hpp> +#include <memory> + + +class ObservableThread; +class ThreadManager; + +/** class to manage threads in Writer using a <ThreadManager> instance + + OD 2007-04-13 #i73788# + Conforms the singleton pattern + + @author OD +*/ +class SwThreadManager + : private ::boost::noncopyable +{ + public: + + static SwThreadManager& GetThreadManager(); + + static bool ExistsThreadManager(); + + // private: don't call! + SwThreadManager(); + // private: don't call! + ~SwThreadManager(); + + oslInterlockedCount AddThread( const rtl::Reference< ObservableThread >& rThread ); + + void RemoveThread( const oslInterlockedCount nThreadID ); + + /** suspend the starting of threads + + Suspending the starting of further threads is sensible during the + destruction of a Writer document. + + @author OD + */ + void SuspendStartingOfThreads(); + + /** continues the starting of threads after it has been suspended + + @author OD + */ + void ResumeStartingOfThreads(); + + bool StartingOfThreadsSuspended(); + + private: + static bool mbThreadManagerInstantiated; + + ::std::auto_ptr<ThreadManager> mpThreadManagerImpl; + +}; +#endif diff --git a/sw/source/core/inc/tabfrm.hxx b/sw/source/core/inc/tabfrm.hxx new file mode 100644 index 000000000000..786383deeecf --- /dev/null +++ b/sw/source/core/inc/tabfrm.hxx @@ -0,0 +1,235 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_TABFRM_HXX +#define SW_TABFRM_HXX + +#include <tools/mempool.hxx> +#include "layfrm.hxx" +#include "flowfrm.hxx" + +class SwTable; +class SwBorderAttrs; +class SwAttrSetChg; + +class SwTabFrm: public SwLayoutFrm, public SwFlowFrm +{ + // OD 14.03.2003 #i11760# - adjustment, because of method signature change + //darf mit den Flags spielen. + friend void CalcCntnt( SwLayoutFrm *pLay, bool bNoColl, bool bNoCalcFollow ); + + //Fuert Spezialbehandlung fuer _Get[Next|Prev]Leaf() durch. + using SwFrm::GetLeaf; + SwLayoutFrm *GetLeaf( MakePageType eMakePage, sal_Bool bFwd ); + + SwTable* pTable; + + sal_Bool bComplete :1; //Eintrage als Repaint ohne das CompletePaint + //der Basisklasse gesetzt werden muss. Damit + //sollen unertraegliche Tabellen-Repaints + //vermieden werden. + sal_Bool bCalcLowers :1; //Im MakeAll auf jedenfall auch fuer Stabilitaet + //des Inhaltes sorgen. + sal_Bool bLowersFormatted :1;//Kommunikation zwischen MakeAll und Layact + sal_Bool bLockBackMove :1; //BackMove-Test hat der Master erledigt. + sal_Bool bResizeHTMLTable :1; //Resize des HTMLTableLayout rufen im MakeAll + //Zur Optimierung, damit dies nicht im + //CntntFrm::Grow gerufen werden muss, denn dann + //wird es ggf. fuer jede Zelle gerufen #47483# + sal_Bool bONECalcLowers :1; //Primaer fuer die StarONE-SS. Beim MakeAll werden + //die Cntnts auf jedenfall per Calc() formatiert. + //es finden keine zusaetzlichen Invalidierungen + //statt und dieser Weg kann auch kaum garantien + //geben. + + sal_Bool bHasFollowFlowLine :1; // Means that the first line in the follow + // is indented to contain content from a broken + // cell + sal_Bool bIsRebuildLastLine :1; // Means that currently the last line of the + // TabFrame is rebuilded. In this case we + // do not want any notification to the master + // table + sal_Bool bRestrictTableGrowth :1; // Usually, the table may grow infinite, + // because the table can be split in + // SwTabFrm::MakeAll. In MakeAll, this + // flag is set to indicate that the table + // may only grow inside its upper. This + // is necessary, in order to let the text + // flow into the FollowFlowLine + sal_Bool bRemoveFollowFlowLinePending :1; + // --> OD 2004-10-04 #i26945# + sal_Bool bConsiderObjsForMinCellHeight :1; // Usually, the floating screen objects + // are considered on the calculation + // for the minimal cell height. + // For splitting table rows algorithm + // it's needed not to consider floating + // screen object for the preparation + // of the re-calculation of the + // last table row. + // <-- + // --> OD 2004-10-15 #i26945# + sal_Bool bObjsDoesFit :1; // For splitting table rows algorithm, this boolean + // indicates, if the floating screen objects fits + // <-- + sal_Bool bDummy4 :1; + + //Split() spaltet den Frm an der angegebenen Stelle, es wird ein + //Follow erzeugt und aufgebaut und direkt hinter this gepastet. + //Join() Holt sich den Inhalt aus dem Follow und vernichtet diesen. + bool Split( const SwTwips nCutPos, bool bTryToSplit, bool bTableRowKeep ); + bool Join(); + + void _UpdateAttr( const SfxPoolItem*, const SfxPoolItem*, sal_uInt8 &, + SwAttrSetChg *pa = 0, SwAttrSetChg *pb = 0 ); + + virtual sal_Bool ShouldBwdMoved( SwLayoutFrm *pNewUpper, sal_Bool bHead, sal_Bool &rReformat ); + +protected: + virtual void MakeAll(); + virtual void Format( const SwBorderAttrs *pAttrs = 0 ); + virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ); + //Aendert nur die Framesize, nicht die PrtArea-SSize + virtual SwTwips GrowFrm ( SwTwips, sal_Bool bTst = sal_False, sal_Bool bInfo = sal_False ); + +public: + SwTabFrm( SwTable &, SwFrm* ); //Immer nach dem erzeugen _und_ pasten das + //Regist Flys rufen! + SwTabFrm( SwTabFrm & ); //_Nur_ zum erzeugen von Follows + ~SwTabFrm(); + + void JoinAndDelFollows(); //Fuer DelFrms des TableNodes! + + //Ruft das RegistFlys der Zeilen. + void RegistFlys(); + + inline const SwTabFrm *GetFollow() const; + inline SwTabFrm *GetFollow(); + SwTabFrm* FindMaster( bool bFirstMaster = false ) const; + + virtual sal_Bool GetInfo( SfxPoolItem &rHnt ) const; + virtual void Paint( SwRect const&, + SwPrintData const*const pPrintData = NULL ) const; + virtual void CheckDirection( sal_Bool bVert ); + + virtual void Cut(); + virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 ); + + virtual void Prepare( const PrepareHint ePrep = PREP_CLEAR, + const void *pVoid = 0, sal_Bool bNotify = sal_True ); + + SwCntntFrm *FindLastCntnt(); + inline const SwCntntFrm *FindLastCntnt() const; + + const SwTable *GetTable() const { return pTable; } + SwTable *GetTable() { return pTable; } + + sal_Bool IsComplete() { return bComplete; } + void SetComplete() { bComplete = sal_True; } + void ResetComplete() { bComplete = sal_False; } + + sal_Bool IsLowersFormatted() const { return bLowersFormatted; } + void SetLowersFormatted( sal_Bool b ) { bLowersFormatted = b; } + + void SetCalcLowers() { bCalcLowers = sal_True; } //Sparsam einsetzen! + void SetResizeHTMLTable() { bResizeHTMLTable = sal_True; } //dito + void SetONECalcLowers() { bONECalcLowers = sal_True; } + + // + // Start: New stuff for breaking table rows + // + sal_Bool HasFollowFlowLine() const { return bHasFollowFlowLine; } + void SetFollowFlowLine( sal_Bool bNew ) { bHasFollowFlowLine = bNew; } + + sal_Bool IsRebuildLastLine() const { return bIsRebuildLastLine; } + void SetRebuildLastLine( sal_Bool bNew ) { bIsRebuildLastLine = bNew; } + + sal_Bool IsRestrictTableGrowth() const { return bRestrictTableGrowth; } + void SetRestrictTableGrowth( sal_Bool bNew ) { bRestrictTableGrowth = bNew; } + + sal_Bool IsRemoveFollowFlowLinePending() const { return bRemoveFollowFlowLinePending; } + void SetRemoveFollowFlowLinePending( sal_Bool bNew ) { bRemoveFollowFlowLinePending = bNew; } + + // --> OD 2004-10-04 #i26945# + sal_Bool IsConsiderObjsForMinCellHeight() const + { + return bConsiderObjsForMinCellHeight; + } + void SetConsiderObjsForMinCellHeight( sal_Bool _bNewConsiderObjsForMinCellHeight ) + { + bConsiderObjsForMinCellHeight = _bNewConsiderObjsForMinCellHeight; + } + // <-- + // --> OD 2004-10-04 #i26945# + sal_Bool DoesObjsFit() const + { + return bObjsDoesFit; + } + void SetDoesObjsFit( sal_Bool _bNewObjsDoesFit ) + { + bObjsDoesFit = _bNewObjsDoesFit; + } + // <-- + + bool RemoveFollowFlowLine(); + // + // End: New stuff for breaking table rows + // + + sal_Bool CalcFlyOffsets( SwTwips& rUpper, long& rLeftOffset, + long& rRightOffset ) const; + + SwTwips CalcHeightOfFirstContentLine() const; + + bool IsInHeadline( const SwFrm& rFrm ) const; + SwRowFrm* GetFirstNonHeadlineRow() const; + + bool IsLayoutSplitAllowed() const; + + // --> collapsing borders FME 2005-05-27 #i29550# + bool IsCollapsingBorders() const; + + // used for collapsing border lines: + sal_uInt16 GetBottomLineSize() const; + // <-- collapsing + + DECL_FIXEDMEMPOOL_NEWDEL(SwTabFrm) +}; + +inline const SwCntntFrm *SwTabFrm::FindLastCntnt() const +{ + return ((SwTabFrm*)this)->FindLastCntnt(); +} + +inline const SwTabFrm *SwTabFrm::GetFollow() const +{ + return (const SwTabFrm*)SwFlowFrm::GetFollow(); +} +inline SwTabFrm *SwTabFrm::GetFollow() +{ + return (SwTabFrm*)SwFlowFrm::GetFollow(); +} + +#endif // SW_TABFRM_HXX diff --git a/sw/source/core/inc/tblrwcl.hxx b/sw/source/core/inc/tblrwcl.hxx new file mode 100644 index 000000000000..866e82274de9 --- /dev/null +++ b/sw/source/core/inc/tblrwcl.hxx @@ -0,0 +1,228 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _TBLRWCL_HXX +#define _TBLRWCL_HXX +#ifndef _SVSTDARR_HXX +#define _SVSTDARR_USHORTS +#include <svl/svstdarr.hxx> +#endif +#include <vector> +#include <swtypes.hxx> +#include <tblsel.hxx> +#include <swtable.hxx> + +class SvxBorderLine; +class SwDoc; +class SwTableNode; +class _FndLine; +class _FndBox; +class SwTableLine; +class SwTableBox; +class SwTableBoxFmt; +class SwHistory; +class SwCntntNode; +class SfxPoolItem; +class SwShareBoxFmts; +class SwFmtFrmSize; + +// Funktions Deklarationen: +sal_Bool lcl_CopyRow( const _FndLine*& rpFndLine, void* pPara ); +sal_Bool lcl_CopyCol( const _FndBox*& rpFndBox, void* pPara ); + +sal_Bool lcl_MergeGCBox( const SwTableBox*& rpBox, void* pPara ); +sal_Bool lcl_MergeGCLine( const SwTableLine*& rpLine, void* pPara ); + +sal_Bool lcl_Merge_MoveBox( const _FndBox*& rpFndBox, void* pPara ); +sal_Bool lcl_Merge_MoveLine( const _FndLine*& rpFndLine, void* pPara ); + +sal_Bool lcl_CopyBoxToDoc( const _FndBox*& rpFndBox, void* pPara ); +sal_Bool lcl_CopyLineToDoc( const _FndLine*& rpFndLn, void* pPara ); + +sal_Bool lcl_BoxSetHeadCondColl( const SwTableBox*& rpBox, void* pPara ); +sal_Bool lcl_LineSetHeadCondColl( const SwTableLine*& rpLine, void* pPara ); + + +#ifdef DBG_UTIL +void _CheckBoxWidth( const SwTableLine& rLine, SwTwips nSize ); +#endif + +void _InsTblBox( SwDoc* pDoc, SwTableNode* pTblNd, + SwTableLine* pLine, SwTableBoxFmt* pBoxFrmFmt, + SwTableBox* pBox, sal_uInt16 nInsPos, sal_uInt16 nCnt = 1 ); + +SW_DLLPUBLIC void _DeleteBox( SwTable& rTbl, SwTableBox* pBox, SwUndo* pUndo = 0, + sal_Bool bCalcNewSize = sal_True, const sal_Bool bCorrBorder = sal_True, + SwShareBoxFmts* pShareFmts = 0 ); + +// Klasse fuers SplitTable +// sammelt von einer Line die Boxen aller obersten oder untersten Lines +// in einem Array. Zusaetzlich werden die Positionen vermerkt. +// ( die Implementierung steht im ndtbl.cxx) + +class SwCollectTblLineBoxes +{ + SvUShorts aPosArr; + SwSelBoxes_SAR aBoxes; + SwHistory* pHst; + sal_uInt16 nMode, nWidth; + sal_Bool bGetFromTop : 1; + sal_Bool bGetValues : 1; + +public: + SwCollectTblLineBoxes( sal_Bool bTop, sal_uInt16 nMd = 0, SwHistory* pHist=0 ) + : aPosArr( 16, 16 ), aBoxes( 16, 16 ), + pHst( pHist ), nMode( nMd ), nWidth( 0 ), + bGetFromTop( bTop ), bGetValues( sal_True ) + + {} + + void AddBox( const SwTableBox& rBox ); + const SwTableBox* GetBoxOfPos( const SwTableBox& rBox ); + void AddToUndoHistory( const SwCntntNode& rNd ); + + sal_uInt16 Count() const { return aBoxes.Count(); } + const SwTableBox& GetBox( sal_uInt16 nPos, sal_uInt16* pWidth = 0 ) const + { + // hier wird die EndPos der Spalte benoetigt! + if( pWidth ) + *pWidth = nPos+1 == aPosArr.Count() ? nWidth + : aPosArr[ nPos+1 ]; + return *aBoxes[ nPos ]; + } + + sal_Bool IsGetFromTop() const { return bGetFromTop; } + sal_Bool IsGetValues() const { return bGetValues; } + + sal_uInt16 GetMode() const { return nMode; } + void SetValues( sal_Bool bFlag ) { bGetValues = sal_False; nWidth = 0; + bGetFromTop = bFlag; } + sal_Bool Resize( sal_uInt16 nOffset, sal_uInt16 nWidth ); +}; + +sal_Bool lcl_Box_CollectBox( const SwTableBox*& rpBox, void* pPara ); +sal_Bool lcl_Line_CollectBox( const SwTableLine*& rpLine, void* pPara ); + +sal_Bool lcl_BoxSetSplitBoxFmts( const SwTableBox*& rpBox, void* pPara ); + +// This structure is needed by Undo to restore row span attributes +// when a table has been splitted into two tables +struct SwSaveRowSpan +{ + sal_uInt16 mnSplitLine; // the line number where the table has been splitted + std::vector< long > mnRowSpans; // the row span attributes in this line + SwSaveRowSpan( SwTableBoxes& rBoxes, sal_uInt16 nSplitLn ); +}; + +struct _SwGCLineBorder +{ + const SwTableLines* pLines; + SwShareBoxFmts* pShareFmts; + sal_uInt16 nLinePos; + + _SwGCLineBorder( const SwTable& rTable ) + : pLines( &rTable.GetTabLines() ), pShareFmts(0), nLinePos( 0 ) {} + + _SwGCLineBorder( const SwTableBox& rBox ) + : pLines( &rBox.GetTabLines() ), pShareFmts(0), nLinePos( 0 ) {} + sal_Bool IsLastLine() const { return nLinePos + 1 >= pLines->Count(); } +}; + +class _SwGCBorder_BoxBrd +{ + const SvxBorderLine* pBrdLn; + sal_Bool bAnyBorderFnd; +public: + _SwGCBorder_BoxBrd() : pBrdLn( 0 ), bAnyBorderFnd( sal_False ) {} + + void SetBorder( const SvxBorderLine& rBorderLine ) + { pBrdLn = &rBorderLine; bAnyBorderFnd = sal_False; } + + // checke, ob die linke Border dieselbe wie die gesetzte ist + // returnt sal_False falls gar keine Border gesetzt ist + sal_Bool CheckLeftBorderOfFormat( const SwFrmFmt& rFmt ); + + sal_Bool IsAnyBorderFound() const { return bAnyBorderFnd; } +}; + +sal_Bool lcl_GC_Line_Border( const SwTableLine*& , void* pPara ); +sal_Bool lcl_GC_Box_Border( const SwTableBox*& , void* pPara ); + +sal_Bool lcl_GCBorder_ChkBoxBrd_L( const SwTableLine*& , void* pPara ); +sal_Bool lcl_GCBorder_ChkBoxBrd_B( const SwTableBox*& , void* pPara ); + +sal_Bool lcl_GCBorder_GetLastBox_L( const SwTableLine*& , void* pPara ); +sal_Bool lcl_GCBorder_GetLastBox_B( const SwTableBox*& , void* pPara ); + + +class SwShareBoxFmt +{ + const SwFrmFmt* pOldFmt; + SvPtrarr aNewFmts; + +public: + SwShareBoxFmt( const SwFrmFmt& rFmt ) + : pOldFmt( &rFmt ), aNewFmts( 1, 4 ) + {} + + const SwFrmFmt& GetOldFormat() const { return *pOldFmt; } + + SwFrmFmt* GetFormat( long nWidth ) const; + SwFrmFmt* GetFormat( const SfxPoolItem& rItem ) const; + void AddFormat( const SwFrmFmt& rFmt ); + // returnt sal_True, wenn geloescht werden kann + sal_Bool RemoveFormat( const SwFrmFmt& rFmt ); +}; + + +SV_DECL_PTRARR_DEL( _SwShareBoxFmts, SwShareBoxFmt*, 8, 8 ) + +class SwShareBoxFmts +{ + _SwShareBoxFmts aShareArr; + sal_Bool Seek_Entry( const SwFrmFmt& rFmt, sal_uInt16* pPos ) const; + + void ChangeFrmFmt( SwTableBox* pBox, SwTableLine* pLn, SwFrmFmt& rFmt ); + +public: + SwShareBoxFmts() {} + ~SwShareBoxFmts(); + + SwFrmFmt* GetFormat( const SwFrmFmt& rFmt, long nWidth ) const; + SwFrmFmt* GetFormat( const SwFrmFmt& rFmt, const SfxPoolItem& ) const; + + void AddFormat( const SwFrmFmt& rOld, const SwFrmFmt& rNew ); + + void SetSize( SwTableBox& rBox, const SwFmtFrmSize& rSz ); + void SetAttr( SwTableBox& rBox, const SfxPoolItem& rItem ); + void SetAttr( SwTableLine& rLine, const SfxPoolItem& rItem ); + + void RemoveFormat( const SwFrmFmt& rFmt ); +}; + + + +#endif diff --git a/sw/source/core/inc/textapi.hxx b/sw/source/core/inc/textapi.hxx new file mode 100755 index 000000000000..609e0a0ecc4d --- /dev/null +++ b/sw/source/core/inc/textapi.hxx @@ -0,0 +1,70 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <editeng/unoedsrc.hxx> +#include <editeng/unotext.hxx> +#include <editeng/eeitem.hxx> +#include <editeng/outliner.hxx> +#include <editeng/unoipset.hxx> +#include <editeng/unoprnms.hxx> +#include <editeng/unoforou.hxx> + +class SwDoc; + +struct SwTextAPIEditSource_Impl; +class SwTextAPIEditSource : public SvxEditSource +{ + SwTextAPIEditSource_Impl* pImpl; + + virtual SvxEditSource* Clone() const; + virtual SvxTextForwarder* GetTextForwarder(); + virtual void UpdateData(); + explicit SwTextAPIEditSource( const SwTextAPIEditSource& rSource ); + +public: + SwTextAPIEditSource(SwDoc* pDoc); + virtual ~SwTextAPIEditSource(); + + void Dispose(); + void SetText( OutlinerParaObject& rText ); + void SetString( const String& rText ); + OutlinerParaObject* CreateText(); + String GetText(); +}; + +class SwTextAPIObject : public SvxUnoText +{ + SwTextAPIEditSource* pSource; +public: + SwTextAPIObject( SwTextAPIEditSource* p); + virtual ~SwTextAPIObject() throw(); + void DisposeEditSource() { pSource->Dispose(); } + OutlinerParaObject* CreateText() { return pSource->CreateText(); } + void SetString( const String& rText ) { pSource->SetString( rText ); } + void SetText( OutlinerParaObject& rText ) { pSource->SetText( rText ); } + String GetText() { return pSource->GetText(); } +}; diff --git a/sw/source/core/inc/threadlistener.hxx b/sw/source/core/inc/threadlistener.hxx new file mode 100644 index 000000000000..9ff03cf37cc4 --- /dev/null +++ b/sw/source/core/inc/threadlistener.hxx @@ -0,0 +1,62 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _THREADLISTENER_HXX +#define _THREADLISTENER_HXX + +#include <ifinishedthreadlistener.hxx> +#include <ithreadlistenerowner.hxx> +#include <observablethread.hxx> + +/** helper class to observe threads + + OD 2007-03-30 #i73788# + An instance of this class can be used to observe a thread in order to + be notified, if the thread has finished its work. The notification is + directly forward to its owner - an instance of IThreadListenerOwner + Note: + - A thread can only have one or none listener. + - The notification is performed via the ThreadID + + @author OD +*/ +class ThreadListener : public IFinishedThreadListener +{ + public: + + ThreadListener( IThreadListenerOwner& rThreadListenerOwner ); + virtual ~ThreadListener(); + + void ListenToThread( const oslInterlockedCount nThreadID, + ObservableThread& rThread ); + + virtual void NotifyAboutFinishedThread( const oslInterlockedCount nThreadID ); + + private: + + IThreadListenerOwner& mrThreadListenerOwner; +}; +#endif diff --git a/sw/source/core/inc/threadmanager.hxx b/sw/source/core/inc/threadmanager.hxx new file mode 100644 index 000000000000..a167548da7b4 --- /dev/null +++ b/sw/source/core/inc/threadmanager.hxx @@ -0,0 +1,172 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _THREADMANAGER_HXX +#define _THREADMANAGER_HXX + +#include <ithreadlistenerowner.hxx> +#include <vcl/timer.hxx> +#include <osl/mutex.hxx> +#include <osl/interlck.h> +#include <rtl/ref.hxx> + +#include <deque> +#include <list> +#include <cppuhelper/weak.hxx> +#include "com/sun/star/util/XJobManager.hpp" +#include <observablethread.hxx> +#include <cancellablejob.hxx> +#include <threadlistener.hxx> + +#include <boost/shared_ptr.hpp> +#include <boost/weak_ptr.hpp> + +/** class to manage threads + + OD 2007-01-29 #i73788# + An instance of this class takes care of the starting of threads. + It assures that not more than <mnStartedSize> threads + are started. + + @author OD +*/ +class ThreadManager : public IThreadListenerOwner +{ + public: + + explicit ThreadManager( ::com::sun::star::uno::Reference< ::com::sun::star::util::XJobManager >& rThreadJoiner ); + ~ThreadManager(); + + // --> IThreadListenerOwner + virtual boost::weak_ptr< IFinishedThreadListener > GetThreadListenerWeakRef(); + virtual void NotifyAboutFinishedThread( const oslInterlockedCount nThreadID ); + // <-- + + /** initialization + + IMPORTANT NOTE: Needs to be called directly after construction + + @author OD + */ + void Init(); + + /** add thread to the thread manager and taking ownership for the thread + + @author OD + + @return unique ID for added thread + */ + oslInterlockedCount AddThread( + const ::rtl::Reference< ObservableThread >& rThread ); + + void RemoveThread( const oslInterlockedCount nThreadID, + const bool bThreadFinished = false ); + + DECL_LINK( TryToStartNewThread, Timer* ); + + /** suspend the starting of threads + + Suspending the starting of further threads is sensible during the + destruction of a Writer document. + + @author OD + */ + inline void SuspendStartingOfThreads() + { + osl::MutexGuard aGuard(maMutex); + + mbStartingOfThreadsSuspended = true; + } + + /** continues the starting of threads after it has been suspended + + @author OD + */ + void ResumeStartingOfThreads(); + + inline bool StartingOfThreadsSuspended() + { + osl::MutexGuard aGuard(maMutex); + + return mbStartingOfThreadsSuspended; + } + + struct tThreadData + { + oslInterlockedCount nThreadID; + ::rtl::Reference< ObservableThread > pThread; + com::sun::star::uno::Reference< com::sun::star::util::XCancellable > aJob; + + tThreadData() + : nThreadID( 0 ), + pThread( 0 ), + aJob() + {} + }; + + private: + + static const std::deque< tThreadData >::size_type mnStartedSize; + + osl::Mutex maMutex; + + ::com::sun::star::uno::WeakReference< ::com::sun::star::util::XJobManager > mrThreadJoiner; + + boost::shared_ptr< ThreadListener > mpThreadListener; + + oslInterlockedCount mnThreadIDCounter; + + std::deque< tThreadData > maWaitingForStartThreads; + std::deque< tThreadData > maStartedThreads; + + Timer maStartNewThreadTimer; + + bool mbStartingOfThreadsSuspended; + + struct ThreadPred + { + oslInterlockedCount mnThreadID; + explicit ThreadPred( oslInterlockedCount nThreadID ) + : mnThreadID( nThreadID ) + {} + + bool operator() ( const tThreadData& rThreadData ) const + { + return rThreadData.nThreadID == mnThreadID; + } + }; + + + inline oslInterlockedCount RetrieveNewThreadID() + { + return osl_incrementInterlockedCount( &mnThreadIDCounter ); + } + + bool StartWaitingThread(); + + bool StartThread( const tThreadData& aThreadData ); +}; +#endif diff --git a/sw/source/core/inc/tocntntanchoredobjectposition.hxx b/sw/source/core/inc/tocntntanchoredobjectposition.hxx new file mode 100644 index 000000000000..80c788098fde --- /dev/null +++ b/sw/source/core/inc/tocntntanchoredobjectposition.hxx @@ -0,0 +1,103 @@ + /************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _TOCNTNTANCHOREDOBJECTPOSITION_HXX +#define _TOCNTNTANCHOREDOBJECTPOSITION_HXX +#include <anchoredobjectposition.hxx> + +class SwFrm; +class SwTxtFrm; +class SwLayoutFrm; +class SwRect; + +namespace objectpositioning +{ + class SwToCntntAnchoredObjectPosition : public SwAnchoredObjectPosition + { + private: + // calculated data for object position + const SwLayoutFrm* mpVertPosOrientFrm; + // --> OD 2004-06-17 #i26791# + // determine offset to frame anchor position according to the + // positioning alignments + Point maOffsetToFrmAnchorPos; + + // data for calculation of position + bool mbAnchorToChar; + const SwFrm* mpToCharOrientFrm; + const SwRect* mpToCharRect; + SwTwips mnToCharTopOfLine; + + virtual bool IsAnchoredToChar() const; + virtual const SwFrm* ToCharOrientFrm() const; + virtual const SwRect* ToCharRect() const; + // OD 12.11.2003 #i22341# + virtual SwTwips ToCharTopOfLine() const; + + // method to cast <SwAnchoredObjectPosition::GetAnchorFrm()> to + // the needed type + SwTxtFrm& GetAnchorTxtFrm() const; + + // ********************************************************************* + /** determine frame for horizontal position + + OD 04.08.2003 + if the given proposed frame is a content frame, the proposed + frame is returned. + otherwise (given proposed frame is a layout frame), + the lower content frames of the proposed frame are checked + for the first, that the anchor or a follow of the anchor. + If none is found, the proposed frame is returned. + + @author OD + + @param _pProposedFrm + input parameter - proposed frame for horizontal position + + @return constant reference to <SwFrm> object, at which the + horizontal position is determined. + */ + const SwFrm& _GetHoriVirtualAnchor( const SwLayoutFrm& _pProposedFrm ) const; + + public: + SwToCntntAnchoredObjectPosition( SdrObject& _rDrawObj ); + virtual ~SwToCntntAnchoredObjectPosition(); + + /** calculate position of object + + @author OD + */ + virtual void CalcPosition(); + + /** frame, at which the vertical position is oriented at + + @author OD + */ + const SwLayoutFrm& GetVertPosOrientFrm() const; + }; +} // namespace objectpositioning + +#endif diff --git a/sw/source/core/inc/tolayoutanchoredobjectposition.hxx b/sw/source/core/inc/tolayoutanchoredobjectposition.hxx new file mode 100644 index 000000000000..e5e77e640057 --- /dev/null +++ b/sw/source/core/inc/tolayoutanchoredobjectposition.hxx @@ -0,0 +1,66 @@ + /************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _TOLAYOUTANCHOREDOBJECTPOSITION_HXX +#define _TOLAYOUTANCHOREDOBJECTPOSITION_HXX +#include <anchoredobjectposition.hxx> +#include <swtypes.hxx> +#include <swrect.hxx> + +namespace objectpositioning +{ + class SwToLayoutAnchoredObjectPosition : public SwAnchoredObjectPosition + { + private: + // calculated data for object position type TO_LAYOUT + Point maRelPos; + + // --> OD 2004-06-17 #i26791# + // determine offset to frame anchor position according to the + // positioning alignments + Point maOffsetToFrmAnchorPos; + + public: + SwToLayoutAnchoredObjectPosition( SdrObject& _rDrawObj ); + virtual ~SwToLayoutAnchoredObjectPosition(); + + /** calculate position for object + + OD 30.07.2003 #110978# + + @author OD + */ + virtual void CalcPosition(); + + /** calculated relative position for object + + @author OD + */ + Point GetRelPos() const; + }; +} // namespace objectpositioning + +#endif diff --git a/sw/source/core/inc/toxhlp.hxx b/sw/source/core/inc/toxhlp.hxx new file mode 100644 index 000000000000..01188e1d8c7e --- /dev/null +++ b/sw/source/core/inc/toxhlp.hxx @@ -0,0 +1,76 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _TOXHLP_HXX +#define _TOXHLP_HXX + +#include <tools/solar.h> +#include <com/sun/star/lang/Locale.hpp> +#include <com/sun/star/uno/Reference.hxx> +#include <swunodef.hxx> + +namespace com { namespace sun { namespace star { +namespace i18n { + class XExtendedIndexEntrySupplier; +} +namespace lang { + class XMultiServiceFactory; +} +}}} + + +class String; + +class IndexEntrySupplierWrapper +{ + STAR_NMSPC::lang::Locale aLcl; + STAR_NMSPC::uno::Reference < com::sun::star::i18n::XExtendedIndexEntrySupplier > xIES; + +public: + IndexEntrySupplierWrapper( + const STAR_NMSPC::lang::Locale& rLcl, + STAR_REFERENCE( lang::XMultiServiceFactory )& rxMSF ); + ~IndexEntrySupplierWrapper(); + + String GetIndexKey( const String& rTxt, const String& rTxtReading, + const STAR_NMSPC::lang::Locale& rLocale ) const; + + String GetFollowingText( sal_Bool bMorePages ) const; + + STAR_NMSPC::uno::Sequence< ::rtl::OUString > + GetAlgorithmList( const STAR_NMSPC::lang::Locale& rLcl ) const; + + sal_Bool LoadAlgorithm( const STAR_NMSPC::lang::Locale& rLcl, + const String& sSortAlgorithm, long nOptions ) const; + + sal_Int16 CompareIndexEntry( const String& rTxt1, const String& rTxtReading1, + const STAR_NMSPC::lang::Locale& rLcl1, + const String& rTxt2, const String& rTxtReading2, + const STAR_NMSPC::lang::Locale& rLcl2 ) const; +}; + +#endif diff --git a/sw/source/core/inc/txmsrt.hxx b/sw/source/core/inc/txmsrt.hxx new file mode 100644 index 000000000000..4d5e41fe8b71 --- /dev/null +++ b/sw/source/core/inc/txmsrt.hxx @@ -0,0 +1,294 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_TXMSRT_HXX +#define SW_TXMSRT_HXX + +#include <i18npool/lang.h> +#include <tox.hxx> + +#include <com/sun/star/lang/Locale.hpp> + + +class CharClass; +class SwCntntNode; +class SwTxtNode; +class SwTxtTOXMark; +class SwIndex; +class SwFmtFld; +class IndexEntrySupplierWrapper; + +enum TOXSortType +{ + TOX_SORT_INDEX, + TOX_SORT_CUSTOM, + TOX_SORT_CONTENT, + TOX_SORT_PARA, + TOX_SORT_TABLE, + TOX_SORT_AUTHORITY +}; + +struct SwTOXSource +{ + const SwCntntNode* pNd; + xub_StrLen nPos; + sal_Bool bMainEntry; + + SwTOXSource() : pNd(0), nPos(0), bMainEntry(sal_False) {} + SwTOXSource( const SwCntntNode* pNode, xub_StrLen n, sal_Bool bMain ) + : pNd(pNode), nPos(n), bMainEntry(bMain) + {} +}; + +SV_DECL_VARARR( SwTOXSources, SwTOXSource, 0, 10 ) + +class SwTOXInternational +{ + IndexEntrySupplierWrapper* pIndexWrapper; + CharClass* pCharClass; + LanguageType eLang; + String sSortAlgorithm; + sal_uInt16 nOptions; + + void Init(); + +public: + SwTOXInternational( LanguageType nLang, sal_uInt16 nOptions, + const String& rSortAlgorithm ); + SwTOXInternational( const SwTOXInternational& ); + ~SwTOXInternational(); + + sal_Int32 Compare( const String& rTxt1, const String& rTxtReading1, + const ::com::sun::star::lang::Locale& rLocale1, + const String& rTxt2, const String& rTxtReading2, + const ::com::sun::star::lang::Locale& rLocale2 ) const; + + inline sal_Bool IsEqual( const String& rTxt1, const String& rTxtReading1, + const ::com::sun::star::lang::Locale& rLocale1, + const String& rTxt2, const String& rTxtReading2, + const ::com::sun::star::lang::Locale& rLocale2 ) const + { + return 0 == Compare( rTxt1, rTxtReading1, rLocale1, + rTxt2, rTxtReading2, rLocale2 ); + } + + inline sal_Bool IsLess( const String& rTxt1, const String& rTxtReading1, + const ::com::sun::star::lang::Locale& rLocale1, + const String& rTxt2, const String& rTxtReading2, + const ::com::sun::star::lang::Locale& rLocale2 ) const + { + return -1 == Compare( rTxt1, rTxtReading1, rLocale1, + rTxt2, rTxtReading2, rLocale2 ); + } + + String GetIndexKey( const String& rTxt, const String& rTxtReading, + const ::com::sun::star::lang::Locale& rLcl ) const; + + String GetFollowingText( sal_Bool bMorePages ) const; + + String ToUpper( const String& rStr, xub_StrLen nPos ) const; + inline sal_Bool IsNumeric( const String& rStr ) const; +}; + +/*-------------------------------------------------------------------- + Beschreibung: Klassen fuer die Sortierung der Verzeichnisse + --------------------------------------------------------------------*/ + +struct SwTOXSortTabBase +{ + SwTOXSources aTOXSources; + ::com::sun::star::lang::Locale aLocale; + const SwTxtNode* pTOXNd; + const SwTxtTOXMark* pTxtMark; + const SwTOXInternational* pTOXIntl; + sal_uLong nPos; + xub_StrLen nCntPos; + sal_uInt16 nType; + static sal_uInt16 nOpt; + + SwTOXSortTabBase( TOXSortType nType, + const SwCntntNode* pTOXSrc, + const SwTxtTOXMark* pTxtMark, + const SwTOXInternational* pIntl, + const ::com::sun::star::lang::Locale* pLocale = NULL ); + virtual ~SwTOXSortTabBase() {} + + sal_uInt16 GetType() const { return nType; } + sal_uInt16 GetOptions() const { return nOpt; } + + virtual void FillText( SwTxtNode& rNd, const SwIndex& rInsPos, sal_uInt16 nAuthField = 0) const; + virtual sal_uInt16 GetLevel() const = 0; + virtual sal_Bool operator==( const SwTOXSortTabBase& ); + virtual sal_Bool operator<( const SwTOXSortTabBase& ); + + virtual String GetURL() const; + + inline void GetTxt( String&, String& ) const; + inline const ::com::sun::star::lang::Locale& GetLocale() const; + +private: + sal_Bool bValidTxt; + String sSortTxt; + String sSortTxtReading; + + virtual void GetText_Impl( String&, String& ) const = 0; +}; + +inline void SwTOXSortTabBase::GetTxt( String& rSortTxt, + String& rSortTxtReading ) const +{ + if( !bValidTxt ) + { + SwTOXSortTabBase* pThis = (SwTOXSortTabBase*)this; + pThis->GetText_Impl( pThis->sSortTxt, pThis->sSortTxtReading ); + pThis->bValidTxt = sal_True; + } + + rSortTxt = sSortTxt; + rSortTxtReading = sSortTxtReading; +} + +inline const ::com::sun::star::lang::Locale& SwTOXSortTabBase::GetLocale() const +{ + return aLocale; +} + +/*-------------------------------------------------------------------- + Beschreibung: fuer Sortierung nach Text + --------------------------------------------------------------------*/ + +struct SwTOXIndex : public SwTOXSortTabBase +{ + SwTOXIndex( const SwTxtNode&, const SwTxtTOXMark*, sal_uInt16 nOptions, sal_uInt8 nKeyLevel, + const SwTOXInternational& rIntl, + const ::com::sun::star::lang::Locale& rLocale ); + virtual ~SwTOXIndex() {} + + + virtual void FillText( SwTxtNode& rNd, const SwIndex& rInsPos, sal_uInt16 nAuthField = 0 ) const; + virtual sal_uInt16 GetLevel() const; + virtual sal_Bool operator==( const SwTOXSortTabBase& ); + virtual sal_Bool operator<( const SwTOXSortTabBase& ); + +private: + virtual void GetText_Impl( String&, String& ) const; + + sal_uInt8 nKeyLevel; +}; + +struct SwTOXCustom : public SwTOXSortTabBase +{ + SwTOXCustom( const String& rKey, const String& rReading, sal_uInt16 nLevel, + const SwTOXInternational& rIntl, + const ::com::sun::star::lang::Locale& rLocale ); + virtual ~SwTOXCustom() {} + + virtual sal_uInt16 GetLevel() const; + virtual sal_Bool operator==( const SwTOXSortTabBase& ); + virtual sal_Bool operator<( const SwTOXSortTabBase& ); + +private: + virtual void GetText_Impl( String&, String& ) const; + + String aKey; + String sReading; + sal_uInt16 nLev; +}; + +/*-------------------------------------------------------------------- + Beschreibung: fuer Sortierung nach Position + --------------------------------------------------------------------*/ + +struct SwTOXContent : public SwTOXSortTabBase +{ + SwTOXContent( const SwTxtNode&, const SwTxtTOXMark*, + const SwTOXInternational& rIntl ); + virtual ~SwTOXContent() {} + + virtual void FillText( SwTxtNode& rNd, const SwIndex& rInsPos, sal_uInt16 nAuthField = 0 ) const; + virtual sal_uInt16 GetLevel() const; +private: + virtual void GetText_Impl( String&, String& ) const; + +}; + +struct SwTOXPara : public SwTOXSortTabBase +{ + SwTOXPara( const SwCntntNode&, SwTOXElement, sal_uInt16 nLevel = FORM_ALPHA_DELIMITTER ); + virtual ~SwTOXPara() {} + + void SetStartIndex( xub_StrLen nSet) { nStartIndex = nSet;} + void SetEndIndex( xub_StrLen nSet ) { nEndIndex = nSet;} + + virtual void FillText( SwTxtNode& rNd, const SwIndex& rInsPos, sal_uInt16 nAuthField = 0 ) const; + virtual sal_uInt16 GetLevel() const; + + virtual String GetURL() const; +private: + virtual void GetText_Impl( String&, String& ) const; + + SwTOXElement eType; + sal_uInt16 m_nLevel; + xub_StrLen nStartIndex; + xub_StrLen nEndIndex; +}; + +struct SwTOXTable : public SwTOXSortTabBase +{ + SwTOXTable( const SwCntntNode& rNd ); + virtual ~SwTOXTable() {} + + void SetLevel(sal_uInt16 nSet){nLevel = nSet;} + + virtual sal_uInt16 GetLevel() const; + + virtual String GetURL() const; +private: + virtual void GetText_Impl( String&, String& ) const; + + sal_uInt16 nLevel; +}; + +struct SwTOXAuthority : public SwTOXSortTabBase +{ +private: + SwFmtFld& m_rField; + virtual void FillText( SwTxtNode& rNd, const SwIndex& rInsPos, sal_uInt16 nAuthField = 0 ) const; + virtual void GetText_Impl( String&, String& ) const; + +public: + SwTOXAuthority( const SwCntntNode& rNd, SwFmtFld& rField, const SwTOXInternational& rIntl ); + virtual ~SwTOXAuthority() {} + + SwFmtFld& GetFldFmt() {return m_rField;} + + virtual sal_Bool operator==( const SwTOXSortTabBase& ); + virtual sal_Bool operator<( const SwTOXSortTabBase& ); + virtual sal_uInt16 GetLevel() const; +}; + + +#endif // SW_TXMSRT_HXX diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx new file mode 100644 index 000000000000..b5418f8d415d --- /dev/null +++ b/sw/source/core/inc/txtfrm.hxx @@ -0,0 +1,835 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_TXTFRM_HXX +#define SW_TXTFRM_HXX + +#include <tools/mempool.hxx> +#include <tools/string.hxx> +#include "cntfrm.hxx" + +#define STRSIZE(x) (sizeof(x)-1) + +class SwCharRange; +class SwTxtNode; +class SwTxtFormatter; +class SwTxtFormatInfo; +class SwParaPortion; +class WidowsAndOrphans; +class SwBodyFrm; +class SwTxtFtn; +class SwInterHyphInfo; // Hyphenate() +class SwCache; +class SwBorderAttrs; +class SwFrmFmt; +class OutputDevice; +class SwTestFormat; +struct SwCrsrMoveState; +struct SwFillData; +class SwPortionHandler; +class SwScriptInfo; +class SwViewOption; +class SwWrongList; + +#define GRID_ON 0 +#define GRID_HEIGHT 1 +#define RUBY_HEIGHT 2 +#define RUBY_TOP 3 +#define GRID_CELLS 4 + +class SwTxtFrm: public SwCntntFrm +{ + friend class SwTxtIter; + friend class SwTestFormat; + friend class WidowsAndOrphans; + friend class SwTxtFrmLocker; // duerfen Lock()/Unlock() + friend sal_Bool lcl_ChangeOffset( SwTxtFrm* pFrm, sal_uInt16 nNew ); + + static SwCache *pTxtCache; //Pointer auf den Line-Cache + static long nMinPrtLine; //Diese Linie darf beim Drucken nicht + //unterschritten werden, Hack fuer Tabellenzellen ueber mehrere Seiten + + sal_uLong nAllLines :24;//Anzahl der Zeilen fuer das Paint (inkl. nThisLines) + sal_uLong nThisLines :8; //Anzahl der Zeilen dieses Frames + + // The x position for flys anchored at this paragraph. + // These values are calculated in SwTxtFrm::CalcBaseOfstForFly() + SwTwips mnFlyAnchorOfst; + // The x position for wrap-through flys anchored at this paragraph. + SwTwips mnFlyAnchorOfstNoWrap; + SwTwips mnFtnLine; + // OD 2004-03-17 #i11860# - re-factoring of #i11859# + // member for height of last line (value needed for proportional line spacing) + SwTwips mnHeightOfLastLine; + // --> OD 2008-01-31 #newlistlevelattrs# + // member for the additional first line offset, which is caused by the list + // label alignment for list level position and space mode LABEL_ALIGNMENT. + // This additional first line offset is used for the text formatting. + // It is NOT used for the determination of printing area. + SwTwips mnAdditionalFirstLineOffset; + // <-- + + + xub_StrLen nOfst; //nOfst gibt den Offset im Cntnt (Anzahl Zeichen) an. + + sal_uInt16 nCacheIdx; //Index in den Cache, USHRT_MAX wenn definitiv + //kein passendes Objekt im Cache steht. + + //Teilt den Master ab und erzeugt einen Follow oder passt die + //Daten im Follow an. + void _AdjustFollow( SwTxtFormatter &rLine, const xub_StrLen nOffset, + const xub_StrLen nStrEnd, const sal_uInt8 nMode ); + inline void AdjustFollow( SwTxtFormatter &rLine, const xub_StrLen nOffset, + const xub_StrLen nStrEnd, const sal_uInt8 nMode ); + + //Iteriert ueber alle Zeilen und stellt das Linespacing + //entsprechend dem Attribut ein. + void CalcLineSpace(); + + void InitCtor(); // Wird in beiden Ctoren gerufen + + // Wird nur in Format gerufen: + void AdjustFrm( const SwTwips nChgHeight, sal_Bool bHasToFit = sal_False ); + + // wertet in Format() die Preps aus. + sal_Bool CalcPreps(); + void PrepWidows( const sal_uInt16 nNeed, sal_Bool bNotify = sal_True ); + void _InvalidateRange( const SwCharRange &, const long = 0); + inline void InvalidateRange( const SwCharRange &, const long = 0); + + // WidowsAndOrphans, AdjustFrm, AdjustFollow + void FormatAdjust( SwTxtFormatter &rLine, WidowsAndOrphans &rFrmBreak, + const xub_StrLen nStrLen, const sal_Bool bDummy ); + + sal_Bool bLocked : 1; // im Format? + sal_Bool bFormatted : 1; // nach Format auf sal_True + sal_Bool bWidow : 1; // sind wir ein Widow + sal_Bool bJustWidow : 1; // haben wir soeben Widow angefordert + sal_Bool bEmpty : 1; // sind wir ein leerer Absatz + sal_Bool bInFtnConnect : 1; // Steht gerade im Connect + sal_Bool bFtn : 1; // Hat mindestens eine Fussnote + sal_Bool bRepaint : 1; // TxtFrm: Repaint steht zur Abholung bereit + sal_Bool bBlinkPor : 1; // enthaelt Blink-Portions + sal_Bool bFieldFollow : 1; // beginne mit Feldrest des Masters + sal_Bool bHasAnimation : 1; // enthaelt animierte SwGrfNumPortion + sal_Bool bIsSwapped : 1; // during text formatting we swap the + // width and height for vertical formatting + // OD 14.03.2003 #i11760# - flag to control, if follow is formatted in + // method <CalcFollow(..)>. + // E.g., avoid formatting of follow, if method <SwLayoutFrm::FormatWidthCols(..)> + // is running. + sal_Bool mbFollowFormatAllowed : 1; + + void ResetPreps(); + inline void Lock() { bLocked = sal_True; } + inline void Unlock() { bLocked = sal_False; } + inline void SetFormatted( const sal_Bool bNew ) { bFormatted = bNew; } + inline void SetWidow( const sal_Bool bNew ) { bWidow = bNew; } + inline void SetJustWidow( const sal_Bool bNew ) { bJustWidow = bNew; } + inline void SetEmpty( const sal_Bool bNew ) { bEmpty = bNew; } + inline void SetFieldFollow( const sal_Bool bNew ) { bFieldFollow = bNew; } + + sal_Bool IsIdxInside( const xub_StrLen nPos, const xub_StrLen nLen ) const; + + // Wechselt den Frame oder auch nicht (vgl. FlyCnt) + sal_Bool _GetCrsrOfst(SwPosition *pPos, const Point &rPoint, + const sal_Bool bChgFrm, SwCrsrMoveState* = 0 ) const; + void FillCrsrPos( SwFillData &rFill ) const; + + // formatiert genau eine Zeile ... + sal_Bool FormatLine( SwTxtFormatter &rLine, const sal_Bool bPrev ); + + // Um Stack einzusparen aufgeteilt ... + // _Format ruft _Format mit Parametern + void _Format( SwParaPortion *pPara ); + void _Format( SwTxtFormatter &rLine, SwTxtFormatInfo &rInf, + const sal_Bool bAdjust = sal_False ); + void FormatOnceMore( SwTxtFormatter &rLine, SwTxtFormatInfo &rInf ); + + // formatiert den Follow und sorgt fuer die Entsorgung bei Orphans + sal_Bool CalcFollow( const xub_StrLen nTxtOfst ); + + // korrigiert die Stelle ab der formatiert werden muss. + xub_StrLen FindBrk(const String &rTxt, const xub_StrLen nStart, + const xub_StrLen nEnd) const; + + // inline-Weiche + SwTwips _GetFtnFrmHeight() const; + + // Aus CalcPreps ausgelagert. + sal_Bool CalcPrepFtnAdjust(); + + // Fuer Ftn und WidOrp: Zwangsvalidierung + void ValidateFrm(); + void ValidateBodyFrm(); + + sal_Bool _GetDropRect( SwRect &rRect ) const; + + void SetPara( SwParaPortion *pNew, sal_Bool bDelete = sal_True ); + + sal_Bool _IsFtnNumFrm() const; + + // 6995: Formatinformationen auffrischen + sal_Bool FormatQuick( bool bForceQuickFormat ); + + // Opt: Leere Absaetze formatieren + sal_Bool FormatEmpty(); + SwTwips EmptyHeight() const; + // Opt: Leere Absaetze painten + sal_Bool PaintEmpty( const SwRect &, sal_Bool bCheck ) const; + + void ChgThisLines();//Muss immer gerufen werden, wenn sich die Zeilenazahl + //veraendert haben kann. + + // required for 'new' relative anchor position + void CalcBaseOfstForFly(); + + /** method to determine height of last line, needed for proportional line spacing + + OD 2004-03-17 #i11860# + OD 2005-05-20 #i47162# - introduce new optional parameter <_bUseFont> + in order to force the usage of the former algorithm to determine the + height of the last line, which uses the font. + + @param _bUseFont + optional input parameter - boolean indicating, if the font has to be + used to determine the height of the last line. default value: false + + @author OD + */ + void _CalcHeightOfLastLine( const bool _bUseFont = false ); + + // ST2 + SwWrongList* _SmartTagScan ( ::rtl::OUString aTxtToScan, SwWrongList *pSmartTagList, + xub_StrLen nBegin,xub_StrLen nEnd, + xub_StrLen nInsertPos, xub_StrLen nActPos, + xub_StrLen &nChgStart, xub_StrLen &nChgEnd, + xub_StrLen &nInvStart, xub_StrLen &nInvEnd); +protected: + virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ); + +public: + + //public, weil der eine oder andere die Methode rufen darf um das + //Prepare zu sparen - mit Vorsicht zu geniessen! + void Init(); + + // Wird von FormatSpelling( ) gerufen + SwRect _AutoSpell( const SwCntntNode*, const SwViewOption&, sal_uInt16 ); + // is called from the FormatSpelling( ) method + SwRect SmartTagScan( SwCntntNode* , sal_uInt16 ); + // Wird vom CollectAutoCmplWords gerufen + void CollectAutoCmplWrds( SwCntntNode* , sal_uInt16 ); + + // Returns the screen position of rPos. The values are relative to the upper + // left position of the page frame. + // Additional information can be obtained by passing an SwCrsrMoveState object. + // Returns sal_False if rPos > number of character is string + virtual sal_Bool GetCharRect( SwRect& rRect, const SwPosition& rPos, + SwCrsrMoveState* pCMS = 0 ) const; + // Eine etwas abgespeckte GetCharRect-Version fuer autopositionierte Rahmen + sal_Bool GetAutoPos( SwRect &, const SwPosition& ) const; + + /** determine top of line for given position in the text frame + + OD 11.11.2003 #i22341# + Assumption: given position exists in the text frame or in a follow of it + OD 2004-02-02 - adjustment + Top of first paragraph line is the top of the paragraph. + OD 2004-03-18 #i11860# - Consider upper space amount considered for + previous frame and the page grid. + + @author OD + + @param _onTopOfLine + output parameter - top of line, if the given position is found in the + text frame. + + @param _rPos + input parameter - reference to the position in the text frame + + @return boolean indicating, if the top of line for the given position + has been determined or not. + */ + bool GetTopOfLine( SwTwips& _onTopOfLine, + const SwPosition& _rPos ) const; + + virtual bool FillSelection( SwSelectionList& rList, const SwRect& rRect ) const; + + + //Liefert in nOffset den Offset des Characters innerhalb des + //gesetzten Textbuffers zurueck, welcher der durch aPoint + //gegebenen Position innerhalb der SSize des Layout am + //naechsten ist. Wenn der SPoint ausserhalb der SSize liegt, + //liefert die Funktion sal_False, sal_True sonst. + virtual sal_Bool GetCrsrOfst( SwPosition *, Point&, + SwCrsrMoveState* = 0) const; + + // GetKeyCrsrOfst sorgt dafuer, dass der Frame nicht gewechselt wird + // (z.B. Wechsel in den zeichengebundenen Frame). + inline sal_Bool GetKeyCrsrOfst(SwPosition *pPos, const Point &rPoint ) const + { return _GetCrsrOfst( pPos, rPoint, sal_False ); } + + void PaintExtraData( const SwRect & rRect ) const; //Seitennummer usw. + SwRect Paint(); + virtual void Paint( SwRect const&, + SwPrintData const*const pPrintData = NULL ) const; + virtual sal_Bool GetInfo( SfxPoolItem & ) const; + + //Layoutorientiertes Cursortravelling: Linker, rechter Rand, + //vorhergehende/naechste Zeile, gleiche horizontale Position. + virtual sal_Bool LeftMargin(SwPaM *) const; + virtual sal_Bool RightMargin(SwPaM *, sal_Bool bAPI = sal_False) const; + + virtual sal_Bool UnitUp(SwPaM *, const SwTwips nOffset = 0, + sal_Bool bSetInReadOnly = sal_False ) const; + virtual sal_Bool UnitDown(SwPaM *, const SwTwips nOffset = 0, + sal_Bool bSetInReadOnly = sal_False ) const; + sal_Bool _UnitUp(SwPaM *, const SwTwips nOffset = 0, + sal_Bool bSetInReadOnly = sal_False ) const; + sal_Bool _UnitDown(SwPaM *, const SwTwips nOffset = 0, + sal_Bool bSetInReadOnly = sal_False ) const; + + // Prepares the cursor position for a visual cursor move (BiDi). + // The behaviour is different for insert and overwrite cursors + void PrepareVisualMove( xub_StrLen& nPos, sal_uInt8& nCrsrLevel, + sal_Bool& bRight, sal_Bool bInsertCrsr ); + + // Methoden zur Verwaltung von FolgeFrames + SwCntntFrm *SplitFrm( const xub_StrLen nTxtPos ); + SwCntntFrm *JoinFrm(); + inline sal_uInt16 GetOfst() const { return nOfst; } + void _SetOfst( const sal_uInt16 nNewOfst ); + inline void SetOfst ( const sal_uInt16 nNewOfst ); + inline void ManipOfst ( const sal_uInt16 nNewOfst ){ nOfst = nNewOfst; } + SwTxtFrm *GetFrmAtPos ( const SwPosition &rPos); + inline const SwTxtFrm *GetFrmAtPos ( const SwPosition &rPos) const; + // OD 07.10.2003 #110978# - return <reference> instead of <pointer> + SwTxtFrm& GetFrmAtOfst( const xub_StrLen nOfst ); + // Wenn es einen Follow gibt und wir selbst keinen Text enthalten: + inline sal_Bool IsEmptyMaster() const + { return GetFollow() && !GetFollow()->GetOfst(); } + + // Liefert den zu bearbeitenden Textausschnitt zurueck (inline, s.u.) + const String& GetTxt() const; + inline SwTxtNode *GetTxtNode() + { return (SwTxtNode*)SwCntntFrm::GetNode(); } + inline const SwTxtNode *GetTxtNode() const + { return (SwTxtNode*)SwCntntFrm::GetNode(); } + + SwTxtFrm(SwTxtNode * const, SwFrm* ); + virtual ~SwTxtFrm(); + + // SwCntntFrm: der "kurze Dienstweg" fuer die Frames. + // Wer den void* falsch casted ist selbst Schuld! + // Auf jedenfall muss der void* auf 0 geprueft werden. + virtual void Prepare( const PrepareHint ePrep = PREP_CLEAR, + const void *pVoid = 0, sal_Bool bNotify = sal_True ); + + // nMaxHeight is the required height + // bSplit indicates, that the paragraph has to be split + // bTst indicates, that we are currently doing a test formatting + virtual sal_Bool WouldFit( SwTwips &nMaxHeight, sal_Bool &bSplit, sal_Bool bTst ); + + // Hier das WouldFit-Aequivalent fuer mal kurz probeweise + // umgehaengte TextFrames, auch hier liefert + // nMaxHeight die benoetigte Hoehe, + // und bSplit sagt, obj der Absatz gesplittet werden muss. + // Uebergeben wird der potentielle Vorgaenger fuer die Abstandsberechnung + sal_Bool TestFormat( const SwFrm* pPrv, SwTwips &nMaxHeight, sal_Bool &bSplit ); + + // Wir formatieren eine Zeile fuer die interaktive Trennung + // Return: found + sal_Bool Hyphenate( SwInterHyphInfo &rInf ); + + // Probegrow + inline SwTwips GrowTst( const SwTwips nGrow ); + + SwParaPortion *GetPara(); + inline const SwParaPortion *GetPara() const; + inline sal_Bool HasPara() const; + sal_Bool _HasPara() const; + // If there are any hanging punctuation portions in the margin + // the offset will be returned. + SwTwips HangingMargin() const; + + // RTTI + TYPEINFO(); + DECL_FIXEDMEMPOOL_NEWDEL(SwTxtFrm) + + // Locking + inline sal_Bool IsLocked() const { return bLocked; } + inline sal_Bool IsFormatted() const { return bFormatted; } + + inline sal_Bool IsWidow() const { return bWidow; } + inline sal_Bool IsJustWidow() const { return bJustWidow; } + inline sal_Bool IsEmpty() const { return bEmpty; } + inline sal_Bool HasFtn() const { return bFtn; } + inline sal_Bool IsInFtnConnect()const { return bInFtnConnect;} + inline sal_Bool IsFieldFollow() const { return bFieldFollow;} + + inline void SetRepaint() const; + inline void ResetRepaint() const; + inline sal_Bool HasRepaint() const { return bRepaint; } + inline void SetBlinkPor() const; + inline void ResetBlinkPor() const; + inline sal_Bool HasBlinkPor() const { return bBlinkPor; } + inline void SetAnimation() const + { ( (SwTxtFrm*)this )->bHasAnimation = sal_True; } + inline sal_Bool HasAnimation() const { return bHasAnimation; } + + inline sal_Bool IsSwapped() const { return bIsSwapped; } + + // Hat der Frm eine lokale Fussnote (in diesem Frm bzw. Follow)? +#ifndef DBG_UTIL + void CalcFtnFlag(); +#else + void CalcFtnFlag( xub_StrLen nStop = STRING_LEN );//Fuer den Test von SplitFrm +#endif + + // Hidden + sal_Bool IsHiddenNow() const; // bHidden && pOut == pPrt + void HideHidden(); // Anhaengsel entfernen wenn Hidden + void HideFootnotes( xub_StrLen nStart, xub_StrLen nEnd ); + + /** method to hide/show objects + + OD 2004-01-15 #110582# + method hides respectively shows objects, which are anchored at paragraph, + at/as a character of the paragraph, corresponding to the paragraph and + paragraph portion visibility. + + @author OD + */ + void HideAndShowObjects(); + + // Ftn + void RemoveFtn( const xub_StrLen nStart = 0, + const xub_StrLen nLen = STRING_LEN ); + inline SwTwips GetFtnFrmHeight() const; + SwTxtFrm *FindFtnRef( const SwTxtFtn *pFtn ); + inline const SwTxtFrm *FindFtnRef( const SwTxtFtn *pFtn ) const + { return FindFtnRef( pFtn ); } + void ConnectFtn( SwTxtFtn *pFtn, const SwTwips nDeadLine ); + + // Wenn wir eine Ftn sind, die auf ihre Referenz zu waechst... + // public weil von SwCntntFrm::MakeAll benoetigt. + SwTwips GetFtnLine( const SwTxtFtn *pFtn ) const; + + // Liefern den linken und den rechten Rand in + // Dokumentkoordinaten (unter Beachtung der Absatzattribute). + inline SwTwips GetLeftMargin() const; + inline SwTwips GetRightMargin() const; + + virtual void Format( const SwBorderAttrs *pAttrs = 0 ); + virtual void CheckDirection( sal_Bool bVert ); + + // Liefert die Summe der Zeilenhoehen in pLine zurueck. + sal_uInt16 GetParHeight() const; + + // Liefert die Resthoehe zurueck + inline SwTwips GetRstHeight() const; + + inline SwTxtFrm *GetFollow(); + inline const SwTxtFrm *GetFollow() const; + + // Suche die Seitennummer von ErgoSum und QuoVadis + SwTxtFrm *FindQuoVadisFrm(); + + // holt die Formatierug nach, wenn der Idle-Handler zugeschlagen hat. + // --> FME 2004-10-29 #i29062# GetFormatted() can trigger a full formatting + // of the paragraph, causing other layout frames to become invalid. This + // has to be avoided during painting. Therefore we need to pass the + // information that we are currently in the paint process. + SwTxtFrm* GetFormatted( bool bForceQuickFormat = false ); + // <-- + + // wird demnaechst uebertragen + inline void SetFtn( const sal_Bool bNew ) { bFtn = bNew; } + + // Beruecksichtigung der Follows + inline sal_Bool IsInside( const xub_StrLen nPos ) const; + + const SwBodyFrm *FindBodyFrm() const; + + // DropCaps und Selektionen + inline sal_Bool GetDropRect( SwRect &rRect ) const + { return HasPara() ? _GetDropRect( rRect ) : sal_False; } + + static SwCache *GetTxtCache() { return pTxtCache; } + static void SetTxtCache( SwCache *pNew ) { pTxtCache = pNew; } + + static long GetMinPrtLine() { return nMinPrtLine; } + static void SetMinPrtLine( long nNew ) { nMinPrtLine = nNew; } + + inline sal_uInt16 GetCacheIdx() const { return nCacheIdx; } + inline void SetCacheIdx( const sal_uInt16 nNew ) { nCacheIdx = nNew; } + + //Entfert die Line-Informationen aus dem Cache. + void ClearPara(); + + // Bin ich ein FtnFrm, der eine Nummer am Absatzanfang hat? + inline sal_Bool IsFtnNumFrm() const + { return IsInFtn() && !GetIndPrev() && _IsFtnNumFrm(); } + + // simuliert eine Formatierung, als wenn es keinen rechten Rand und + // keine Flys oder andere Hindernisse gaebe und liefert die Breite. + SwTwips CalcFitToContent(); + + /** simulate format for a list item paragraph, whose list level attributes + are in LABEL_ALIGNMENT mode, in order to determine additional first + line offset for the real text formatting due to the value of label + adjustment attribute of the list level. + + OD 2008-01-31 #newlistlevelattrs# + + @author OD + */ + void CalcAdditionalFirstLineOffset(); + + // --> OD 2008-01-31 #newlistlevelattrs# + inline SwTwips GetAdditionalFirstLineOffset() const + { + return mnAdditionalFirstLineOffset; + } + // <-- + + // liefert den zusaetzlichen Zeilenabstand fuer den naechsten Absatz + // OD 07.01.2004 #i11859# - change return data type; + // add default parameter <_bNoPropLineSpacing> to control, if the + // value of a proportional line spacing is returned or not + long GetLineSpace( const bool _bNoPropLineSpacing = false ) const; + + // liefert die erste Zeilenhoehe zurueck + sal_uInt16 FirstLineHeight() const; + + // Haengt FlyInCntFrm um, wenn nEnd > Index >= nStart ist. + void MoveFlyInCnt( SwTxtFrm *pNew, sal_uInt16 nStart, sal_uInt16 nEnd ); + + // Berechnet die Position von FlyInCntFrms + sal_uInt16 CalcFlyPos( SwFrmFmt* pSearch ); + + // Ermittelt die Startposition und Schrittweite des Registers + sal_Bool FillRegister( SwTwips& rRegStart, sal_uInt16& rRegDiff ); + + + sal_uInt16 GetLineCount( sal_uInt16 nPos ); //Ermittelt die Zeilenanzahl + + //Fuer die Anzeige der Zeilennummern. + sal_uLong GetAllLines() const { return nAllLines; } + sal_uLong GetThisLines() const { return nThisLines;} + void RecalcAllLines(); + + // Stoppt Animationen innerhalb von Numerierungen + void StopAnimation( OutputDevice *pOut ); + + // visit all portions for Accessibility + void VisitPortions( SwPortionHandler& rPH ) const; + + // returns the script info stored at the paraportion + const SwScriptInfo* GetScriptInfo() const; + + // Swaps width and height of the text frame + void SwapWidthAndHeight(); + // Calculates the coordinates of a rectangle when switching from + // horizontal to vertical layout. + void SwitchHorizontalToVertical( SwRect& rRect ) const; + // Calculates the coordinates of a point when switching from + // horizontal to vertical layout. + void SwitchHorizontalToVertical( Point& rPoint ) const; + // Calculates the a limit value when switching from + // horizontal to vertical layout. + long SwitchHorizontalToVertical( long nLimit ) const; + // Calculates the coordinates of a rectangle when switching from + // vertical to horizontal layout. + void SwitchVerticalToHorizontal( SwRect& rRect ) const; + // Calculates the coordinates of a point when switching from + // vertical to horizontal layout. + void SwitchVerticalToHorizontal( Point& rPoint ) const; + // Calculates the a limit value when switching from + // vertical to horizontal layout. + long SwitchVerticalToHorizontal( long nLimit ) const; + + // Calculates the coordinates of a rectangle when switching from + // LTR to RTL layout + void SwitchLTRtoRTL( SwRect& rRect ) const; + // Calculates the coordinates of a point when switching from + // LTR to RTL layout. + void SwitchLTRtoRTL( Point& rPoint ) const; + // Calculates the coordinates of a rectangle when switching from + // RTL to LTR layout + inline void SwitchRTLtoLTR( SwRect& rRect ) const { SwitchLTRtoRTL( rRect ); } + // Calculates the coordinates of a point when switching from + // RTL to LTR layout. + inline void SwitchRTLtoLTR( Point& rPoint ) const { SwitchLTRtoRTL( rPoint ); }; + + // OD 14.03.2003 #i11760# - access to new member <mbNoFollowFormat> + inline bool FollowFormatAllowed() const + { + return mbFollowFormatAllowed; + } + inline void AllowFollowFormat() + { + mbFollowFormatAllowed = true; + } + inline void ForbidFollowFormat() + { + mbFollowFormatAllowed = false; + } + + SwTwips GetBaseOfstForFly( sal_Bool bIgnoreFlysAnchoredAtThisFrame ) const + { + return ( bIgnoreFlysAnchoredAtThisFrame ? + mnFlyAnchorOfst : + mnFlyAnchorOfstNoWrap ); + } + + // OD 2004-03-17 #i11860# + inline SwTwips GetHeightOfLastLine() const + { + return mnHeightOfLastLine; + } + + static void repaintTextFrames( const SwTxtNode& rNode ); +}; + +/************************************************************************* + * class SwTxtFrmLocker + *************************************************************************/ + +class SwTxtFrmLocker +{ +private: + SwTxtFrm * const pFrm; +public: + inline SwTxtFrmLocker( SwTxtFrm *pTxtFrm ) + : pFrm( pTxtFrm->IsLocked() ? 0 : pTxtFrm ) + { if( pFrm ) pFrm->Lock(); } + inline ~SwTxtFrmLocker() { if( pFrm ) pFrm->Unlock(); } +}; + +/************************************************************************* + * Inline-Implementierung + *************************************************************************/ + +inline const SwParaPortion *SwTxtFrm::GetPara() const +{ + return ((SwTxtFrm*)this)->GetPara(); +} + +inline sal_Bool SwTxtFrm::HasPara() const +{ + return nCacheIdx != USHRT_MAX ? _HasPara() : sal_False; +} + +// 9104: Frm().Height() - Prt().Height(), siehe widorp.cxx und 7455, 6114, 7908 +inline SwTwips SwTxtFrm::GetRstHeight() const +{ + return !GetUpper() ? 0 : ((const SwFrm*)GetUpper())->Frm().Top() + + ((const SwFrm*)GetUpper())->Prt().Top() + + ((const SwFrm*)GetUpper())->Prt().Height() + - Frm().Top() - (Frm().Height() - Prt().Height()); +} + +inline SwTwips SwTxtFrm::GetLeftMargin() const +{ + return Frm().Left() + Prt().Left(); +} +inline SwTwips SwTxtFrm::GetRightMargin() const +{ + return Frm().Left() + Prt().Left() + Prt().Width(); +} +inline SwTwips SwTxtFrm::GrowTst( const SwTwips nGrow ) +{ + return Grow( nGrow, sal_True ); +} + +#if OSL_DEBUG_LEVEL > 1 +// fragt auf WYSIWYG DBG ab +extern sal_Bool IsDbg( const SwTxtFrm *pFrm ); +#define DBTXTFRM aDbstream << "SwTxtFrm[" << GetFrmId() << "]" +#endif + +inline sal_Bool SwTxtFrm::IsInside( const xub_StrLen nPos ) const +{ + sal_Bool bRet = sal_True; + if( nPos < GetOfst() ) + bRet = sal_False; + else + { + const SwTxtFrm *pFoll = GetFollow(); + if( pFoll && nPos >= pFoll->GetOfst() ) + bRet = sal_False; + } + return bRet; +} + +inline SwTwips SwTxtFrm::GetFtnFrmHeight() const +{ + if( !IsFollow() && IsInFtn() && HasPara() ) + return _GetFtnFrmHeight(); + else + return 0; +} + +inline const SwTxtFrm *SwTxtFrm::GetFollow() const +{ + return (const SwTxtFrm*)SwCntntFrm::GetFollow(); +} +inline SwTxtFrm *SwTxtFrm::GetFollow() +{ + return (SwTxtFrm*)SwCntntFrm::GetFollow(); +} + +inline const SwTxtFrm *SwTxtFrm::GetFrmAtPos( const SwPosition &rPos) const +{ + return ((SwTxtFrm*)this)->GetFrmAtPos( rPos ); +} + +inline void SwTxtFrm::AdjustFollow( SwTxtFormatter &rLine, + const xub_StrLen nOffset, const xub_StrLen nStrEnd, const sal_uInt8 nMode ) +{ + if ( HasFollow() ) + _AdjustFollow( rLine, nOffset, nStrEnd, nMode ); +} + +inline void SwTxtFrm::SetOfst( const xub_StrLen nNewOfst ) +{ + if ( nOfst != nNewOfst ) + _SetOfst( nNewOfst ); +} + +inline void SwTxtFrm::SetRepaint() const +{ + ((SwTxtFrm*)this)->bRepaint = sal_True; +} +inline void SwTxtFrm::ResetRepaint() const +{ + ((SwTxtFrm*)this)->bRepaint = sal_False; +} + +inline void SwTxtFrm::SetBlinkPor() const +{ + ((SwTxtFrm*)this)->bBlinkPor = sal_True; +} +inline void SwTxtFrm::ResetBlinkPor() const +{ + ((SwTxtFrm*)this)->bBlinkPor = sal_False; +} + +#ifdef LINGU_STATISTIK + +class SwLinguStatistik +{ +public: + long nWords; // gepruefte Worte + long nFlushCnt; // zaehlt die Messungen + + long nWrong; // als falsch erkannt + long nAlter; // Alternativvorschlaege + long nSpellTime; // Zeitmessung + long nSynonym; // Thesaurus + long nNoSynonym; // Thesaurus ratlos + long nMeaning; // Thesaurus-Bedeutung + long nNoMeaning; // Thesaurus meinungslos + long nTheTime; // Zeitmessung + long nHyphens; // Trennstellen + long nNoHyph; // Worte ohne Trennstellen + long nHyphErr; // Fehler beim Trennen + long nHyphTime; // Zeitmessung + SpellCheck *pSpell; + LanguageType eLang; + + void Flush(); + + inline SwLinguStatistik() + { nWords = nWrong = nAlter = nSynonym = nNoSynonym = + nHyphens = nNoHyph = nHyphErr = nSpellTime = nTheTime = + nHyphTime = nFlushCnt = 0; + pSpell = NULL; + eLang = LANGUAGE_DONTKNOW; } + inline ~SwLinguStatistik(){ Flush(); } +}; + +// globale Variable, implementiert in txtfrm.cxx +extern SwLinguStatistik aSwLinguStat; + +#define SW_LING(nWhich,nInc) (aSwLinguStat.nWhich) += nInc; + +#endif + +#define SWAP_IF_SWAPPED( pFrm )\ + sal_Bool bUndoSwap = sal_False; \ + if ( pFrm->IsVertical() && pFrm->IsSwapped() )\ + { \ + bUndoSwap = sal_True; \ + ((SwTxtFrm*)pFrm)->SwapWidthAndHeight(); \ + } + +#define SWAP_IF_NOT_SWAPPED( pFrm )\ + sal_Bool bUndoSwap = sal_False; \ + if ( pFrm->IsVertical() && ! pFrm->IsSwapped() )\ + { \ + bUndoSwap = sal_True; \ + ((SwTxtFrm*)pFrm)->SwapWidthAndHeight(); \ + } + +#define UNDO_SWAP( pFrm )\ + if ( bUndoSwap )\ + ((SwTxtFrm*)pFrm)->SwapWidthAndHeight(); + +// Helper class which can be used instead of the macros if a function +// has too many returns +class SwFrmSwapper +{ + const SwTxtFrm* pFrm; + sal_Bool bUndo; +public: + SwFrmSwapper( const SwTxtFrm* pFrm, sal_Bool bSwapIfNotSwapped ); + ~SwFrmSwapper(); +}; + +class SwLayoutModeModifier +{ + const OutputDevice& rOut; + long nOldLayoutMode; +public: + SwLayoutModeModifier( const OutputDevice& rOutp ); + ~SwLayoutModeModifier(); + void Modify( sal_Bool bChgToRTL ); + void SetAuto(); +}; + +class SwDigitModeModifier +{ + const OutputDevice& rOut; + LanguageType nOldLanguageType; +public: + SwDigitModeModifier( const OutputDevice& rOutp, LanguageType eCurLang ); + ~SwDigitModeModifier(); +}; + +#endif diff --git a/sw/source/core/inc/txttypes.hxx b/sw/source/core/inc/txttypes.hxx new file mode 100644 index 000000000000..f9026574245e --- /dev/null +++ b/sw/source/core/inc/txttypes.hxx @@ -0,0 +1,103 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _TXTTYPES_HXX +#define _TXTTYPES_HXX + +#include "swtypes.hxx" + +// Ueberpruefte USHORTs, z.B. Indizes auf Arrays oder garantiert kleine +// Integerwerte, auch von aussen vorgegebene +#define MSHORT sal_uInt16 +#define MSHRT_MAX USHRT_MAX +// Koordinaten: Breite, Hoehe und Offsets in X-/Y-Richtung sowie Ascent etc. +#define KSHORT sal_uInt16 +#define KSHRT_MAX USHRT_MAX + +// Portiontypen +#define POR_LIN 0x0000 +#define POR_FLYCNT 0x0001 + +#define POR_HOLE 0x0080 +#define POR_TMPEND 0x0081 +#define POR_BRK 0x0082 +#define POR_KERN 0x0083 +#define POR_ARROW 0x0084 +#define POR_MULTI 0x0085 +#define POR_HIDDEN_TXT 0x0086 +#define POR_CONTROLCHAR 0x0087 + +#define POR_TXT 0x8000 +#define POR_LAY 0x8001 +#define POR_PARA 0x8002 +#define POR_URL 0x8003 +#define POR_HNG 0x8004 + +#define POR_DROP 0x8080 +#define POR_TOX 0x8089 +#define POR_ISOTOX 0x808a +#define POR_REF 0x808b +#define POR_ISOREF 0x808c +#define POR_META 0x808d + +#define POR_EXP 0xc080 +#define POR_BLANK 0xc081 +#define POR_POSTITS 0xc082 + +#define POR_HYPH 0xd080 +#define POR_HYPHSTR 0xd081 +#define POR_SOFTHYPH 0xd082 +#define POR_SOFTHYPHSTR 0xd083 +#define POR_SOFTHYPH_COMP 0xd084 + +#define POR_FLD 0xe080 +#define POR_HIDDEN 0xe081 +#define POR_QUOVADIS 0xe082 +#define POR_ERGOSUM 0xe083 +#define POR_COMBINED 0xe084 +#define POR_FTN 0xe085 + +#define POR_FTNNUM 0xe880 +#define POR_NUMBER 0xe881 +#define POR_BULLET 0xe882 +#define POR_GRFNUM 0xe883 + +#define POR_GLUE 0x0480 + +#define POR_MARGIN 0x04c0 + +#define POR_FIX 0x06c0 +#define POR_FLY 0x06c1 + +#define POR_TAB 0x0750 + +#define POR_TABRIGHT 0x07d0 +#define POR_TABCENTER 0x07d1 +#define POR_TABDECIMAL 0x07d2 + +#define POR_TABLEFT 0x0740 + +#endif //_TXTTYPES_HXX diff --git a/sw/source/core/inc/undoflystrattr.hxx b/sw/source/core/inc/undoflystrattr.hxx new file mode 100644 index 000000000000..5115f1a37c07 --- /dev/null +++ b/sw/source/core/inc/undoflystrattr.hxx @@ -0,0 +1,56 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_UNDO_FLY_STR_ATTR_HXX +#define SW_UNDO_FLY_STR_ATTR_HXX + +#include <undobj.hxx> +#include <swundo.hxx> + +class SwFlyFrmFmt; +class String; + +class SwUndoFlyStrAttr : public SwUndo +{ + public: + SwUndoFlyStrAttr( SwFlyFrmFmt& rFlyFrmFmt, + const SwUndoId eUndoId, + const String& sOldStr, + const String& sNewStr ); + virtual ~SwUndoFlyStrAttr(); + + virtual void UndoImpl( ::sw::UndoRedoContext & ); + virtual void RedoImpl( ::sw::UndoRedoContext & ); + + virtual SwRewriter GetRewriter() const; + + private: + SwFlyFrmFmt& mrFlyFrmFmt; + const String msOldStr; + const String msNewStr; +}; + +#endif // SW_UNDO_FLY_STR_ATTR_HXX diff --git a/sw/source/core/inc/unofldmid.h b/sw/source/core/inc/unofldmid.h new file mode 100644 index 000000000000..6ad9ea28d399 --- /dev/null +++ b/sw/source/core/inc/unofldmid.h @@ -0,0 +1,71 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_UNOFLDMID_H +#define SW_UNOFLDMID_H + +#include <tools/solar.h> + +class String; +namespace com { namespace sun { namespace star { namespace uno { + class Any; +} } } } + +/****************************************************************************** + * + ******************************************************************************/ +//Abbildung der Properties auf den Descriptor +#define FIELD_PROP_PAR1 10 +#define FIELD_PROP_PAR2 11 +#define FIELD_PROP_PAR3 12 +#define FIELD_PROP_FORMAT 13 +#define FIELD_PROP_SUBTYPE 14 +#define FIELD_PROP_BOOL1 15 +#define FIELD_PROP_BOOL2 16 +#define FIELD_PROP_DATE 17 +#define FIELD_PROP_USHORT1 18 +#define FIELD_PROP_USHORT2 19 +#define FIELD_PROP_BYTE1 20 +#define FIELD_PROP_DOUBLE 21 +#define FIELD_PROP_BOOL3 22 +#define FIELD_PROP_PAR4 23 +#define FIELD_PROP_SHORT1 24 +#define FIELD_PROP_DATE_TIME 25 +#define FIELD_PROP_PROP_SEQ 26 +#define FIELD_PROP_LOCALE 27 +#define FIELD_PROP_BOOL4 28 +#define FIELD_PROP_STRINGS 29 +#define FIELD_PROP_PAR5 30 +#define FIELD_PROP_PAR6 31 + +#define FIELD_PROP_IS_FIELD_USED 32 +#define FIELD_PROP_IS_FIELD_DISPLAYED 33 + +#define FIELD_PROP_TEXT 34 + +String& GetString( const com::sun::star::uno::Any&, String& rStr ); + +#endif diff --git a/sw/source/core/inc/unometa.hxx b/sw/source/core/inc/unometa.hxx new file mode 100755 index 000000000000..52ac418b3861 --- /dev/null +++ b/sw/source/core/inc/unometa.hxx @@ -0,0 +1,368 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SW_UNOMETA_HXX +#define SW_UNOMETA_HXX + +#include <deque> + +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/container/XChild.hpp> +#include <com/sun/star/container/XEnumerationAccess.hpp> +#include <com/sun/star/text/XTextContent.hpp> +#include <com/sun/star/text/XTextField.hpp> + +#include <cppuhelper/implbase2.hxx> +#include <cppuhelper/implbase6.hxx> + +#include <sfx2/Metadatable.hxx> + +#include <unobaseclass.hxx> + + +typedef ::std::deque< + ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > > + TextRangeList_t; + +class SwPaM; +class SwTxtNode; + +namespace sw { + class Meta; + class MetaField; +} + +typedef ::cppu::ImplInheritanceHelper6 +< ::sfx2::MetadatableMixin +, ::com::sun::star::lang::XUnoTunnel +, ::com::sun::star::lang::XServiceInfo +, ::com::sun::star::container::XChild +, ::com::sun::star::container::XEnumerationAccess +, ::com::sun::star::text::XTextContent +, ::com::sun::star::text::XText +> SwXMeta_Base; + +class SwXMeta + : public SwXMeta_Base + , private ::boost::noncopyable +{ + +public: + + class Impl; + +protected: + + ::sw::UnoImplPtr<Impl> m_pImpl; + + virtual void SAL_CALL AttachImpl( + const ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextRange > & xTextRange, + const sal_uInt16 nWhich) + throw (::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + + virtual ~SwXMeta(); + + /// @param pDoc and pMeta != 0, but not & because of ImplInheritanceHelper + SwXMeta(SwDoc *const pDoc, ::sw::Meta *const pMeta, + ::com::sun::star::uno::Reference< ::com::sun::star::text::XText> const& + xParentText, + TextRangeList_t const*const pPortions); + +public: + + SwXMeta(SwDoc *const pDoc); + + static ::com::sun::star::uno::Reference< + ::com::sun::star::rdf::XMetadatable > + CreateXMeta( + ::sw::Meta & rMeta, + ::com::sun::star::uno::Reference< ::com::sun::star::text::XText> + const& xParentText = 0, + ::std::auto_ptr<TextRangeList_t const> pPortions = + ::std::auto_ptr<TextRangeList_t const>(0)); + + /// init params with position of the attribute content (w/out CH_TXTATR) + bool SetContentRange( + SwTxtNode *& rpNode, xub_StrLen & rStart, xub_StrLen & rEnd) const; + ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > + GetParentText() const; + + bool CheckForOwnMemberMeta(const SwPaM & rPam, const bool bAbsorb) + throw (::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + + // MetadatableMixin + virtual ::sfx2::Metadatable * GetCoreObject(); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > + GetModel(); + + static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId(); + + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( + const ::com::sun::star::uno::Sequence< sal_Int8 >& Identifier ) + throw (::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( + const ::rtl::OUString& rServiceName) + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL + getSupportedServiceNames() + throw (::com::sun::star::uno::RuntimeException); + + // XComponent + virtual void SAL_CALL dispose() + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addEventListener( + const ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XEventListener > & xListener) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeEventListener( + const ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XEventListener > & xListener) + throw (::com::sun::star::uno::RuntimeException); + + // XChild + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XInterface > SAL_CALL + getParent() + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setParent( + ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XInterface> const& xParent) + throw (::com::sun::star::uno::RuntimeException, + ::com::sun::star::lang::NoSupportException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() + throw (::com::sun::star::uno::RuntimeException); + + // XEnumerationAccess + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::container::XEnumeration > SAL_CALL + createEnumeration() + throw (::com::sun::star::uno::RuntimeException); + + // XTextContent + virtual void SAL_CALL attach( + const ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextRange > & xTextRange) + throw (::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextRange > SAL_CALL getAnchor() + throw (::com::sun::star::uno::RuntimeException); + + // XTextRange + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > + SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextRange > SAL_CALL getStart() + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextRange > SAL_CALL getEnd() + throw (::com::sun::star::uno::RuntimeException); + virtual rtl::OUString SAL_CALL getString() + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setString(const rtl::OUString& rString) + throw (::com::sun::star::uno::RuntimeException); + + // XSimpleText + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextCursor > SAL_CALL + createTextCursor() + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextCursor > SAL_CALL + createTextCursorByRange( + const ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextRange > & xTextPosition) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL insertString( + const ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextRange > & xRange, + const rtl::OUString& aString, sal_Bool bAbsorb) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL insertControlCharacter( + const ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextRange > & xRange, + sal_Int16 nControlCharacter, sal_Bool bAbsorb) + throw (::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + + // XText + virtual void SAL_CALL insertTextContent( + const ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextRange > & xRange, + const ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextContent > & xContent, + sal_Bool bAbsorb) + throw (::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeTextContent( + const ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextContent > & xContent) + throw (::com::sun::star::container::NoSuchElementException, + ::com::sun::star::uno::RuntimeException); + +}; + + +typedef ::cppu::ImplInheritanceHelper2 +< SwXMeta +, ::com::sun::star::beans::XPropertySet +, ::com::sun::star::text::XTextField +> SwXMetaField_Base; + +class SwXMetaField + : public SwXMetaField_Base +{ + +private: + + virtual ~SwXMetaField(); + + friend ::com::sun::star::uno::Reference< + ::com::sun::star::rdf::XMetadatable > + SwXMeta::CreateXMeta(::sw::Meta &, + ::com::sun::star::uno::Reference< ::com::sun::star::text::XText> + const&, + ::std::auto_ptr<TextRangeList_t const> pPortions); + + SwXMetaField(SwDoc *const pDoc, ::sw::Meta *const pMeta, + ::com::sun::star::uno::Reference< ::com::sun::star::text::XText> const& + xParentText, + TextRangeList_t const*const pPortions); + +public: + + SwXMetaField(SwDoc *const pDoc); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( + const ::rtl::OUString& ServiceName) + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL + getSupportedServiceNames( ) + throw (::com::sun::star::uno::RuntimeException); + + // XComponent + virtual void SAL_CALL dispose() + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addEventListener( + const ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XEventListener > & xListener) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeEventListener( + const ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XEventListener > & xListener) + throw (::com::sun::star::uno::RuntimeException); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySetInfo > SAL_CALL + getPropertySetInfo() + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( + const ::rtl::OUString& rPropertyName, + const ::com::sun::star::uno::Any& rValue) + throw (::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL + getPropertyValue(const ::rtl::OUString& rPropertyName) + throw (::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( + const ::rtl::OUString& rPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& xListener) + throw (::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( + const ::rtl::OUString& rPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& xListener) + throw (::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( + const ::rtl::OUString& rPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& xListener) + throw (::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( + const ::rtl::OUString& rPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& xListener) + throw (::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XTextContent + virtual void SAL_CALL attach( + const ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextRange > & xTextRange) + throw ( ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextRange > SAL_CALL getAnchor() + throw (::com::sun::star::uno::RuntimeException); + + // XTextField + virtual rtl::OUString SAL_CALL getPresentation(sal_Bool bShowCommand) + throw (::com::sun::star::uno::RuntimeException); + +}; + +/// get prefix/suffix from the RDF repository. @throws RuntimeException +void getPrefixAndSuffix( + const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel>& xModel, + const ::com::sun::star::uno::Reference< + ::com::sun::star::rdf::XMetadatable>& xMetaField, + ::rtl::OUString *const o_pPrefix, ::rtl::OUString *const o_pSuffix); + +#endif // SW_UNOMETA_HXX + diff --git a/sw/source/core/inc/viewimp.hxx b/sw/source/core/inc/viewimp.hxx new file mode 100644 index 000000000000..3959a815eaa2 --- /dev/null +++ b/sw/source/core/inc/viewimp.hxx @@ -0,0 +1,365 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef SW_VIEWIMP_HXX +#define SW_VIEWIMP_HXX + +#include <vector> + +#include <vcl/timer.hxx> +#include <tools/color.hxx> + +// OD 25.06.2003 #108784# +#include <svx/svdtypes.hxx> + +#include <tools/string.hxx> + +#include <swtypes.hxx> +#include <swrect.hxx> + +class ViewShell; +class SwFlyFrm; +class SwViewOption; +class SwRegionRects; +class SwFrm; +class SwLayAction; +class SwLayIdle; +class SwDrawView; +class SdrPageView; +class SwPageFrm; +class SwRegionRects; +struct SdrPaintProcRec; +class SwAccessibleMap; +class SdrObject; +class Fraction; +class SwPrintData; +class SwPagePreviewLayout; +struct PrevwPage; +class SwTxtFrm; + +class SwViewImp +{ + friend class ViewShell; + + friend class SwLayAction; //Lay- und IdleAction tragen sich ein und aus. + friend class SwLayIdle; + + // OD 12.12.2002 #103492# - for paint of page preview + friend class SwPagePreviewLayout; + + ViewShell *pSh; //Falls jemand einen Imp durchreicht und doch + //mal eine ViewShell braucht hier die + //Rueckwaertsverkettung. + + SwDrawView *pDrawView; //Unsere DrawView + SdrPageView *pSdrPageView; //Genau eine Seite fuer unsere DrawView + + SwPageFrm *pFirstVisPage;//Zeigt immer auf die erste sichtbare Seite. + SwRegionRects *pRegion; //Sammler fuer Paintrects aus der LayAction. + + SwLayAction *pLayAct; //Ist gesetzt wenn ein Action-Objekt existiert + //Wird vom SwLayAction-CTor ein- und vom DTor + //ausgetragen. + SwLayIdle *pIdleAct; //Analog zur SwLayAction fuer SwLayIdle. + + SwAccessibleMap *pAccMap; // Accessible Wrappers + + mutable const SdrObject * pSdrObjCached; + mutable String sSdrObjCachedComment; + + sal_Bool bFirstPageInvalid :1; //Pointer auf erste Seite ungueltig? + + //sal_Bool bResetXorVisibility:1; //StartAction/EndAction + //HMHBOOL bShowHdlPaint :1; //LockPaint/UnlockPaint + sal_Bool bResetHdlHiddenPaint:1;// -- "" -- + + sal_Bool bSmoothUpdate :1; //Meber fuer SmoothScroll + sal_Bool bStopSmooth :1; + sal_Bool bStopPrt :1; // Stop Printing + + sal_uInt16 nRestoreActions ; //Die Anzahl der zu restaurierenden Actions (UNO) + SwRect aSmoothRect; + + // OD 12.12.2002 #103492# + SwPagePreviewLayout* mpPgPrevwLayout; + + /** + Signal whether to stop printing. + + @param _useless just to fit macro + */ + DECL_LINK(SetStopPrt, void * _useless = NULL); + + /** + Returns if printer shall be stopped. + + @retval sal_True The printer shall be stopped. + @retval sal_False else + */ + sal_Bool IsStopPrt() { return bStopPrt; } + + /** + Resets signal for stopping printing. + + */ + void ResetStopPrt() { bStopPrt = sal_False; } + + void SetFirstVisPage(); //Neue Ermittlung der ersten sichtbaren Seite + + void StartAction(); //Henkel Anzeigen und verstecken. + void EndAction(); //gerufen von ViewShell::ImplXXXAction + void LockPaint(); //dito, gerufen von ViewShell::ImplLockPaint + void UnlockPaint(); + +private: + + SwAccessibleMap *CreateAccessibleMap(); + + /** invalidate CONTENT_FLOWS_FROM/_TO relation for paragraphs + + OD 2005-12-01 #i27138# + implementation for wrapper method + <ViewShell::InvalidateAccessibleParaFlowRelation(..)> + + @author OD + + @param _pFromTxtFrm + input parameter - paragraph frame, for which the relation CONTENT_FLOWS_FROM + has to be invalidated. + If NULL, no CONTENT_FLOWS_FROM relation has to be invalidated + + @param _pToTxtFrm + input parameter - paragraph frame, for which the relation CONTENT_FLOWS_TO + has to be invalidated. + If NULL, no CONTENT_FLOWS_TO relation has to be invalidated + */ + void _InvalidateAccessibleParaFlowRelation( const SwTxtFrm* _pFromTxtFrm, + const SwTxtFrm* _pToTxtFrm ); + + /** invalidate text selection for paragraphs + + OD 2005-12-12 #i27301# + implementation for wrapper method + <ViewShell::InvalidateAccessibleParaTextSelection(..)> + + @author OD + */ + void _InvalidateAccessibleParaTextSelection(); + + /** invalidate attributes for paragraphs and paragraph's characters + + OD 2009-01-06 #i88069# + implementation for wrapper method + <ViewShell::InvalidateAccessibleParaAttrs(..)> + + @author OD + */ + void _InvalidateAccessibleParaAttrs( const SwTxtFrm& rTxtFrm ); + +public: + SwViewImp( ViewShell * ); + ~SwViewImp(); + void Init( const SwViewOption * ); //nur fuer ViewShell::Init() + + const ViewShell *GetShell() const { return pSh; } + ViewShell *GetShell() { return pSh; } + + Color GetRetoucheColor() const; + + //Verwaltung zur ersten sichtbaren Seite + inline const SwPageFrm *GetFirstVisPage() const; + inline SwPageFrm *GetFirstVisPage(); + void SetFirstVisPageInvalid() { bFirstPageInvalid = sal_True; } + + sal_Bool AddPaintRect( const SwRect &rRect ); + SwRegionRects *GetRegion() { return pRegion; } + void DelRegion(); + + // neues Interface fuer StarView Drawing + inline sal_Bool HasDrawView() const { return 0 != pDrawView; } + SwDrawView* GetDrawView() { return pDrawView; } + const SwDrawView* GetDrawView() const { return pDrawView; } + SdrPageView*GetPageView() { return pSdrPageView; } + const SdrPageView*GetPageView() const { return pSdrPageView; } + void MakeDrawView(); + + // OD 29.08.2002 #102450# + // add 3rd parameter <const Color* pPageBackgrdColor> for setting this + // color as the background color at the outliner of the draw view + // for painting layers <hell> and <heaven> + // OD 09.12.2002 #103045# - add 4th parameter for the horizontal text + // direction of the page in order to set the default horizontal text + // direction at the outliner of the draw view for painting layers <hell> + // and <heaven>. + // OD 25.06.2003 #108784# - correct type of 1st parameter + void PaintLayer( const SdrLayerID _nLayerID, + SwPrintData const*const pPrintData, + const SwRect& _rRect, + const Color* _pPageBackgrdColor = 0, + const bool _bIsPageRightToLeft = false ) const; + + //wird als Link an die DrawEngine uebergeben, entscheidet was wie + //gepaintet wird oder nicht. + //#110094#-3 + //DECL_LINK( PaintDispatcher, SdrPaintProcRec * ); + + // Interface Drawing + sal_Bool IsDragPossible( const Point &rPoint ); + void NotifySizeChg( const Size &rNewSz ); + + //SS Fuer die Lay- bzw. IdleAction und verwandtes + sal_Bool IsAction() const { return pLayAct != 0; } + sal_Bool IsIdleAction() const { return pIdleAct != 0; } + SwLayAction &GetLayAction() { return *pLayAct; } + const SwLayAction &GetLayAction() const { return *pLayAct; } + SwLayIdle &GetIdleAction() { return *pIdleAct;} + const SwLayIdle &GetIdleAction() const { return *pIdleAct;} + + //Wenn eine Aktion laueft wird diese gebeten zu pruefen ob es + //an der zeit ist den WaitCrsr einzuschalten. + void CheckWaitCrsr(); + sal_Bool IsCalcLayoutProgress() const; //Fragt die LayAction wenn vorhanden. + //sal_True wenn eine LayAction laeuft, dort wird dann auch das Flag fuer + //ExpressionFields gesetzt. + sal_Bool IsUpdateExpFlds(); + + void SetRestoreActions(sal_uInt16 nSet){nRestoreActions = nSet;} + sal_uInt16 GetRestoreActions() const{return nRestoreActions;} + + // OD 12.12.2002 #103492# + void InitPagePreviewLayout(); + + // OD 12.12.2002 #103492# + inline SwPagePreviewLayout* PagePreviewLayout() + { + return mpPgPrevwLayout; + } + + // Is this view accessible? + sal_Bool IsAccessible() const { return pAccMap != 0; } + + inline SwAccessibleMap& GetAccessibleMap(); + + // Update (this) accessible view + void UpdateAccessible(); + + // Remove a frame from the accessible view + void DisposeAccessible( const SwFrm *pFrm, const SdrObject *pObj, + sal_Bool bRecursive ); + inline void DisposeAccessibleFrm( const SwFrm *pFrm, + sal_Bool bRecursive=sal_False ); + inline void DisposeAccessibleObj( const SdrObject *pObj ); + + // Move a frame's position in the accessible view + void MoveAccessible( const SwFrm *pFrm, const SdrObject *pObj, + const SwRect& rOldFrm ); + inline void MoveAccessibleFrm( const SwFrm *pFrm, const SwRect& rOldFrm ); + + // Add a frame in the accessible view + inline void AddAccessibleFrm( const SwFrm *pFrm ); + + inline void AddAccessibleObj( const SdrObject *pObj ); + + // Invalidate accessible frame's frame's content + void InvalidateAccessibleFrmContent( const SwFrm *pFrm ); + + // Invalidate accessible frame's cursor position + void InvalidateAccessibleCursorPosition( const SwFrm *pFrm ); + + // Invalidate editable state for all accessible frames + void InvalidateAccessibleEditableState( sal_Bool bAllShells=sal_True, + const SwFrm *pFrm=0 ); + + // Invalidate frame's relation set (for chained frames) + void InvalidateAccessibleRelationSet( const SwFlyFrm *pMaster, + const SwFlyFrm *pFollow ); + + // update data for accessible preview + // OD 15.01.2003 #103492# - change method signature due to new page preview + // functionality + void UpdateAccessiblePreview( const std::vector<PrevwPage*>& _rPrevwPages, + const Fraction& _rScale, + const SwPageFrm* _pSelectedPageFrm, + const Size& _rPrevwWinSize ); + + void InvalidateAccessiblePreViewSelection( sal_uInt16 nSelPage ); + + // Fire all accessible events that have been collected so far + void FireAccessibleEvents(); +}; + +inline SwPageFrm *SwViewImp::GetFirstVisPage() +{ + if ( bFirstPageInvalid ) + SetFirstVisPage(); + return pFirstVisPage; +} + +inline const SwPageFrm *SwViewImp::GetFirstVisPage() const +{ + if ( bFirstPageInvalid ) + ((SwViewImp*)this)->SetFirstVisPage(); + return pFirstVisPage; +} + +inline SwAccessibleMap& SwViewImp::GetAccessibleMap() +{ + if( !pAccMap ) + CreateAccessibleMap(); + + return *pAccMap; +} + +inline void SwViewImp::DisposeAccessibleFrm( const SwFrm *pFrm, + sal_Bool bRecursive ) +{ + DisposeAccessible( pFrm, 0, bRecursive ); +} + +inline void SwViewImp::DisposeAccessibleObj( const SdrObject *pObj ) +{ + DisposeAccessible( 0, pObj, sal_False ); +} + +inline void SwViewImp::MoveAccessibleFrm( const SwFrm *pFrm, + const SwRect& rOldFrm ) +{ + MoveAccessible( pFrm, 0, rOldFrm ); +} + +inline void SwViewImp::AddAccessibleFrm( const SwFrm *pFrm ) +{ + SwRect aEmptyRect; + MoveAccessible( pFrm, 0, aEmptyRect ); +} + +inline void SwViewImp::AddAccessibleObj( const SdrObject *pObj ) +{ + SwRect aEmptyRect; + MoveAccessible( 0, pObj, aEmptyRect ); +} +#endif // SW_VIEWIMP_HXX + diff --git a/sw/source/core/inc/visiturl.hxx b/sw/source/core/inc/visiturl.hxx new file mode 100644 index 000000000000..a00921f76c82 --- /dev/null +++ b/sw/source/core/inc/visiturl.hxx @@ -0,0 +1,49 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _VISITURL_HXX +#define _VISITURL_HXX + + + + +#include <svl/lstner.hxx> +class SwDoc; + +class SwURLStateChanged : public SfxListener +{ + const SwDoc* pDoc; +public: + SwURLStateChanged( const SwDoc* pD ); + virtual ~SwURLStateChanged(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); +}; + + + +#endif + diff --git a/sw/source/core/inc/wrong.hxx b/sw/source/core/inc/wrong.hxx new file mode 100644 index 000000000000..7067d63a7adf --- /dev/null +++ b/sw/source/core/inc/wrong.hxx @@ -0,0 +1,166 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _WRONG_HXX +#define _WRONG_HXX + +#ifndef _COM_SUN_STAR_SMARTTAGS_XSMARTTAGPROPERTIES_HPP_ +#include <com/sun/star/container/XStringKeyMap.hpp> +#endif + +#include <vector> + +#include <tools/string.hxx> + +class SwWrongList; + +// ST2 +class SwWrongArea +{ +public: + rtl::OUString maType; + com::sun::star::uno::Reference< com::sun::star::container::XStringKeyMap > mxPropertyBag; + xub_StrLen mnPos; + xub_StrLen mnLen; + SwWrongList* mpSubList; + + SwWrongArea() : mnPos(0), mnLen(0), mpSubList(NULL) {} + SwWrongArea( const rtl::OUString& rType, + com::sun::star::uno::Reference< com::sun::star::container::XStringKeyMap > xPropertyBag, + xub_StrLen nPos, + xub_StrLen nLen, + SwWrongList* pSubList ) + : maType(rType), mxPropertyBag(xPropertyBag), mnPos(nPos), mnLen(nLen), mpSubList(pSubList) {} +}; + +enum WrongListType +{ + WRONGLIST_SPELL, + WRONGLIST_GRAMMAR, + WRONGLIST_SMARTTAG, + WRONGLIST_CHANGETRACKING +}; + +class SwWrongList +{ + std::vector<SwWrongArea> maList; + WrongListType meType; + + xub_StrLen nBeginInvalid; // Start des ungueltigen Bereichs + xub_StrLen nEndInvalid; // Ende des ungueltigen Bereichs + + void ShiftLeft( xub_StrLen &rPos, xub_StrLen nStart, xub_StrLen nEnd ) + { if( rPos > nStart ) rPos = rPos > nEnd ? rPos - nEnd + nStart : nStart; } + void ShiftRight( xub_StrLen &rPos, xub_StrLen nStart, xub_StrLen nEnd ) + { if( rPos >= nStart ) rPos += nStart - nEnd; } + void _Invalidate( xub_StrLen nBegin, xub_StrLen nEnd ); + + void Insert(sal_uInt16 nWhere, std::vector<SwWrongArea>::iterator startPos, std::vector<SwWrongArea>::iterator endPos); + void Remove( sal_uInt16 nIdx, sal_uInt16 nLen ); + + // forbidden and not implemented + SwWrongList& operator= (const SwWrongList &); + SwWrongList( const SwWrongList& rCpy ); + +public: + SwWrongList( WrongListType eType ); + + virtual ~SwWrongList(); + virtual SwWrongList* Clone(); + virtual void CopyFrom( const SwWrongList& rCopy ); + + inline WrongListType GetWrongListType() const { return meType; } + inline xub_StrLen GetBeginInv() const { return nBeginInvalid; } + inline xub_StrLen GetEndInv() const { return nEndInvalid; } + inline sal_Bool InsideInvalid( xub_StrLen nChk ) const + { return nChk >= nBeginInvalid && nChk <= nEndInvalid; } + void SetInvalid( xub_StrLen nBegin, xub_StrLen nEnd ); + inline void Validate(){ nBeginInvalid = STRING_LEN; } + void Invalidate( xub_StrLen nBegin, xub_StrLen nEnd ); + sal_Bool InvalidateWrong(); + sal_Bool Fresh( xub_StrLen &rStart, xub_StrLen &rEnd, xub_StrLen nPos, + xub_StrLen nLen, sal_uInt16 nIndex, xub_StrLen nCursorPos ); + sal_uInt16 GetWrongPos( xub_StrLen nValue ) const; + + sal_Bool Check( xub_StrLen &rChk, xub_StrLen &rLn ) const; + sal_Bool InWrongWord( xub_StrLen &rChk, xub_StrLen &rLn ) const; + xub_StrLen NextWrong( xub_StrLen nChk ) const; + + void Move( xub_StrLen nPos, long nDiff ); + void ClearList(); + + // Divide the list into two part, the wrong words until nSplitPos will be + // removed and transferred to a new SwWrongList. + SwWrongList* SplitList( xub_StrLen nSplitPos ); + // Join the next SwWrongList, nInsertPos is my own text length, where + // the other wrong list has to be inserted. + void JoinList( SwWrongList* pNext, xub_StrLen nInsertPos ); + + inline xub_StrLen Len( sal_uInt16 nIdx ) const + { + return nIdx < maList.size() ? maList[nIdx].mnLen : 0; + } + + inline xub_StrLen Pos( sal_uInt16 nIdx ) const + { + return nIdx < maList.size() ? maList[nIdx].mnPos : 0; + } + + inline sal_uInt16 Count() const { return (sal_uInt16)maList.size(); } + + inline void Insert( const rtl::OUString& rType, + com::sun::star::uno::Reference< com::sun::star::container::XStringKeyMap > xPropertyBag, + xub_StrLen nNewPos, xub_StrLen nNewLen, sal_uInt16 nWhere ) + { + std::vector<SwWrongArea>::iterator i = maList.begin(); + if ( nWhere >= maList.size() ) + i = maList.end(); // robust + else + i += nWhere; + maList.insert(i, SwWrongArea( rType, xPropertyBag, nNewPos, nNewLen, 0 ) ); + } + + void Insert( const rtl::OUString& rType, + com::sun::star::uno::Reference< com::sun::star::container::XStringKeyMap > xPropertyBag, + xub_StrLen nNewPos, xub_StrLen nNewLen ); + + inline SwWrongList* SubList( sal_uInt16 nIdx ) const + { + return nIdx < maList.size() ? maList[nIdx].mpSubList : 0; + } + + void InsertSubList( xub_StrLen nNewPos, xub_StrLen nNewLen, sal_uInt16 nWhere, SwWrongList* pSubList ); + + inline const SwWrongArea* GetElement( sal_uInt16 nIdx ) const + { + return nIdx < maList.size() ? &maList[nIdx] : 0; + } + void RemoveEntry( xub_StrLen nBegin, xub_StrLen nEnd ); + bool LookForEntry( xub_StrLen nBegin, xub_StrLen nEnd ); +}; + +#endif |