diff options
Diffstat (limited to 'sw/source/core/inc')
92 files changed, 16643 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..f738ff9cdffc --- /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 USHORT GetMetricVal( int n ) +{ +#ifdef USE_MEASUREMENT + USHORT nVal = MEASURE_METRIC == SvtSysLocale().GetLocaleData().getMeasurementSystemEnum() + ? 567 // 1 cm + : 770; // 1/2 Inch +#else + USHORT 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..1a5cd1724050 --- /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); + + void dumpFieldmarks( ) const; + + // 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..50a45e2ab0f3 --- /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( + USHORT nLength, /// length of this portion in the model string + USHORT 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( + USHORT nLength, /// length of this portion in the model string + const String& rText, /// text which is painted on-screen + USHORT 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( + USHORT 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/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..bf88111742b3 --- /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: + BOOL bAutocorrBlock; + BOOL bBlock; + SfxObjectShellRef xDocShellRef; + USHORT 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&, BOOL bOnlyTxt = FALSE ); + virtual void AddName( const String&, const String&, BOOL bOnlyTxt = FALSE ); + void GeneratePackageName ( const String& rShort, String& rPackageName ); + virtual ~SwXMLTextBlocks(); + //virtual BOOL IsOld() const; + virtual ULONG Delete( USHORT ); + virtual ULONG Rename( USHORT, const String&, const String& ); + virtual ULONG CopyBlock( SwImpBlocks& rImp, String& rShort, const String& rLong); + virtual void ClearDoc(); + virtual ULONG GetDoc( USHORT ); + virtual ULONG BeginPutDoc( const String&, const String& ); + virtual ULONG PutDoc(); + virtual ULONG GetText( USHORT, String& ); + virtual ULONG PutText( const String&, const String&, const String& ); + virtual ULONG MakeBlockList(); + + virtual short GetFileType ( void ) const; + virtual ULONG OpenFile( BOOL bReadOnly = TRUE ); + virtual void CloseFile(); + + static BOOL IsFileUCBStorage( const String & rFileName); + + // Methods for the new Autocorrecter + ULONG GetText( const String& rShort, String& ); + + virtual BOOL IsOnlyTextBlock( const String& rShort ) const; + virtual BOOL IsOnlyTextBlock( USHORT nIdx ) const; + virtual void SetIsTextOnly( const String& rShort, BOOL bNewValue ); + virtual void SetIsTextOnly( USHORT nIdx, BOOL bNewValue ); + + virtual ULONG GetMacroTable( USHORT, SvxMacroTableDtor& rMacroTbl, + sal_Bool bFileAlreadyOpen = sal_False ); + virtual ULONG SetMacroTable( USHORT nIdx, + const SvxMacroTableDtor& rMacroTable, + sal_Bool bFileAlreadyOpen = sal_False ); + virtual BOOL PutMuchEntries( BOOL bOn ); + +public: + SwDoc* GetDoc() const { return pDoc; } + //void SetDoc( SwDoc * pNewDoc); + ULONG StartPutBlock( const String& rShort, const String& rPackageName ); + ULONG PutBlock( SwPaM& rPaM, const String& rLong ); + ULONG GetBlockText( const String& rShort, String& rText ); + 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/acorrect.hxx b/sw/source/core/inc/acorrect.hxx new file mode 100644 index 000000000000..bc2d2d4cb1f3 --- /dev/null +++ b/sw/source/core/inc/acorrect.hxx @@ -0,0 +1,122 @@ +/************************************************************************* + * + * 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; + SwUndoId nUndoId; + bool bUndoIdInitialized; + + void DeleteSel( SwPaM& rDelPam ); + +public: + SwAutoCorrDoc( SwEditShell& rEditShell, SwPaM& rPam, sal_Unicode cIns = 0 ); + ~SwAutoCorrDoc(); + + virtual BOOL Delete( xub_StrLen nStt, xub_StrLen nEnd ); + virtual BOOL Insert( xub_StrLen nPos, const String& rTxt ); + virtual BOOL Replace( xub_StrLen nPos, const String& rTxt ); + + virtual BOOL SetAttr( xub_StrLen nStt, xub_StrLen nEnd, USHORT nSlotId, + SfxPoolItem& ); + + virtual 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: + // TRUE: den, vor der normalen Einfuegeposition (TRUE) + // FALSE: den, in den das korrigierte Wort eingfuegt wurde. + // (Muss nicht der gleiche Absatz sein!!!!) + virtual const String* GetPrevPara( BOOL bAtNormalPos ); + + virtual 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( ULONG nFlag, xub_StrLen nPos, + const String& rExceptWord, sal_Unicode cChar ); + virtual LanguageType GetLanguage( xub_StrLen nPos, BOOL bPrevPara ) const; +}; + +class SwAutoCorrExceptWord +{ + String sWord; + ULONG nFlags, nNode; + xub_StrLen nCntnt; + sal_Unicode cChar; + LanguageType eLanguage; + BOOL bDeleted; +public: + SwAutoCorrExceptWord( ULONG nAFlags, 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(FALSE) + {} + + BOOL IsDeleted() const { return bDeleted; } + void CheckChar( const SwPosition& rPos, sal_Unicode cChar ); + 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..581225061553 --- /dev/null +++ b/sw/source/core/inc/anchoredobjectposition.hxx @@ -0,0 +1,488 @@ + /************************************************************************* + * + * 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# + SwTwips _ImplAdjustVertRelPos( const SwTwips _nTopOfAnch, + const bool _bVert, + 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. + + @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 _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 SwFrm& _rPageAlignLayFrm, + const SwTwips _nProposedRelPosY, + const bool _bFollowTextFlow, + const bool _bCheckBottom = true ) const + { + return !mbDoNotCaptureAnchoredObj + ? _ImplAdjustVertRelPos( _nTopOfAnch, _bVert, + _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 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/blink.hxx b/sw/source/core/inc/blink.hxx new file mode 100644 index 000000000000..8f8b086fef3b --- /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; + USHORT nDir; +public: + SwBlinkPortion( const SwLinePortion* pPortion, USHORT 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; } + USHORT GetDirection() const { return nDir; } + BOOL operator<( const SwBlinkPortion& rBlinkPortion ) const + { return (long)pPor < (long)rBlinkPortion.pPor; } + 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; + BOOL bVisible; +public: + SwBlink(); + ~SwBlink(); + + DECL_LINK( Blinker, Timer * ); + + void Insert( const Point& rPoint, const SwLinePortion* pPor, + const SwTxtFrm *pTxtFrm, USHORT nDir ); + void Replace( const SwLinePortion* pOld, const SwLinePortion* pNew ); + void Delete( const SwLinePortion* pPor ); + void FrmDelete( const SwRootFrm* pRoot ); + inline 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..9bd12a45205f --- /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* ); + + 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..90c6a44fa239 --- /dev/null +++ b/sw/source/core/inc/bookmrk.hxx @@ -0,0 +1,261 @@ +/************************************************************************* + * + * 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 + , private ::boost::noncopyable + { + 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(); + + // SwClient + virtual void Modify( SfxPoolItem *pOld, SfxPoolItem *pNew ); + + 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: + 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..fb479fc86549 --- /dev/null +++ b/sw/source/core/inc/cellfrm.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 _CELLFRM_HXX +#define _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 ); + +public: + SwCellFrm( const SwTableBox &, bool bInsertContent = true ); + ~SwCellFrm(); + + virtual BOOL GetCrsrOfst( SwPosition *, Point&, SwCrsrMoveState* = 0 ) const; + virtual void Modify( SfxPoolItem*, SfxPoolItem* ); + virtual void Paint( const SwRect&, const SwPrtOptions *pPrintData = NULL ) const; + virtual void CheckDirection( 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..6d915bc72a8b --- /dev/null +++ b/sw/source/core/inc/cntfrm.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 _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 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 + BOOL _WouldFit( SwTwips nSpace, + SwLayoutFrm *pNewUpper, + BOOL bTstMove, + const bool bObjsInNewUpper ); + // <-- + virtual void MakeAll(); + + void _UpdateAttr( SfxPoolItem*, SfxPoolItem*, BYTE &, + SwAttrSetChg *pa = 0, SwAttrSetChg *pb = 0 ); + + virtual BOOL ShouldBwdMoved( SwLayoutFrm *pNewUpper, BOOL, BOOL& ); + + const SwCntntFrm* ImplGetNextCntntFrm( bool bFwd ) const; + +protected: + + BOOL MakePrtArea( const SwBorderAttrs & ); + + virtual void Modify( SfxPoolItem*, SfxPoolItem* ); + virtual SwTwips ShrinkFrm( SwTwips, BOOL bTst = FALSE, BOOL bInfo = FALSE ); + virtual SwTwips GrowFrm ( SwTwips, BOOL bTst = FALSE, BOOL bInfo = FALSE ); + + SwCntntFrm( SwCntntNode * const ); + +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; + USHORT GetSectionLevel(); + + inline const SwCntntFrm *GetFollow() const; + inline SwCntntFrm *GetFollow(); + SwTxtFrm* FindMaster() const; + + //Layoutabhaengiges Cursortravelling + virtual BOOL LeftMargin( SwPaM * ) const; + virtual BOOL RightMargin( SwPaM *, BOOL bAPI = FALSE ) const; + virtual BOOL UnitUp( SwPaM *, const SwTwips nOffset = 0, + BOOL bSetInReadOnly = FALSE ) const; + virtual BOOL UnitDown( SwPaM *, const SwTwips nOffset = 0, + BOOL bSetInReadOnly = FALSE ) const; + inline BOOL StartNextPage( SwPaM * ) const; + inline BOOL StartPrevPage( SwPaM * ) const; + inline BOOL StartCurrPage( SwPaM * ) const; + inline BOOL EndCurrPage( SwPaM * ) const; + inline BOOL EndNextPage( SwPaM * ) const; + inline 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 ); + + BOOL MoveFtnCntFwd( BOOL, SwFtnBossFrm* );//von MoveFwd gerufen bei Ftn-Inhalt + + inline SwCntntFrm* GetNextCntntFrm() const; + inline SwCntntFrm* GetPrevCntntFrm() const; +}; + +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..4d8a54528aa5 --- /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* ); + ~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..1edb60f2cba9 --- /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 ULONG nRecord; + static SwImplProtocol* pImpl; + static BOOL Start() { return 0 != ( PROT_INIT & nRecord ); } +public: + static ULONG Record() { return nRecord; } + static void SetRecord( ULONG nNew ) { nRecord = nNew; } + static BOOL Record( ULONG nFunc ) { return 0 != (( nFunc | PROT_INIT ) & nRecord); } + static void Record( const SwFrm* pFrm, ULONG nFunction, ULONG nAction, void* pParam ); + static void Init(); + static void Stop(); + static void SnapShot( const SwFrm* pFrm, ULONG nFlags ); + static void GetVar( const USHORT nNo, long& rVar ); +}; + +class SwEnterLeave +{ + SwImplEnterLeave* pImpl; + void Ctor( const SwFrm* pFrm, ULONG nFunc, ULONG nAct, void* pPar ); + void Dtor(); +public: + SwEnterLeave( const SwFrm* pFrm, ULONG nFunc, 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..a89761a57c46 --- /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 +{ + USHORT aCount[DBG_MAX_STACK]; + USHORT 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..47e8fb700809 --- /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 UINT32 SWGInventor = UINT32('S')*0x00000001+ + UINT32('W')*0x00000100+ + UINT32('G')*0x00010000; + +const UINT16 SwFlyDrawObjIdentifier = 0x0001; +const 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 UINT32 GetObjInventor() const; + virtual UINT16 GetObjIdentifier() const; + virtual 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..a8740639f603 --- /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 +{ + 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 ); + + BOOL operator==( const _SetGetExpFld& rFld ) const + { return nNode == rFld.nNode && nCntnt == rFld.nCntnt && + ( !CNTNT.pTxtFld || !rFld.CNTNT.pTxtFld || + CNTNT.pTxtFld == rFld.CNTNT.pTxtFld ); } + 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; } + + 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, USHORT nSize, const String& rName, + String& rRet, USHORT* 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. + + ULONG nNodes; // sollte die NodesAnzahl unterschiedlich sein + BYTE nFldLstGetMode; + + BOOL bInUpdateFlds : 1; // zur Zeit laeuft ein UpdateFlds, + BOOL bFldsDirty : 1; // irgendwelche Felder sind ungueltig + + void _MakeFldList( SwDoc& pDoc, int eGetMode ); + void GetBodyNode( const SwTxtFld& , USHORT nFldWhich ); + void GetBodyNode( const SwSectionNode&); +public: + SwDocUpdtFld(); + ~SwDocUpdtFld(); + + const _SetGetExpFlds* GetSortLst() const { return pFldSortLst; } + + void MakeFldList( SwDoc& rDoc, int bAll, int eGetMode ); + + void InsDelFldInFldLst( BOOL bIns, const SwTxtFld& rFld ); + + void InsertFldType( const SwFieldType& rType ); + void RemoveFldType( const SwFieldType& rType ); + + BOOL IsInUpdateFlds() const { return bInUpdateFlds; } + void SetInUpdateFlds( BOOL b ) { bInUpdateFlds = b; } + + BOOL IsFieldsDirty() const { return bFldsDirty; } + void SetFieldsDirty( 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..984166322b71 --- /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, + USHORT nS, USHORT nT, SwMovedBoxes& rMovedList, SwUndoSort* pUD=0); +void MoveRow(SwDoc* pDoc, const FlatFndBox& rBox, + USHORT nS, USHORT nT, SwMovedBoxes& rMovedList, SwUndoSort* pUD=0); +void MoveCell(SwDoc* pDoc, const SwTableBox* pSource, + const SwTableBox* pTar, 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(USHORT nKey ) const = 0; + virtual double GetValue(USHORT nKey ) const; + + BOOL operator==(const SwSortElement& ); + BOOL operator<(const SwSortElement& ); + + double StrToDouble(const String& rStr) const; +}; + +/*-------------------------------------------------------------------- + Beschreibung: Sortieren Text + --------------------------------------------------------------------*/ + +struct SwSortTxtElement : public SwSortElement +{ + // fuer Text + ULONG nOrg; + SwNodeIndex aPos; + + SwSortTxtElement( const SwNodeIndex& rPos ); + virtual ~SwSortTxtElement(); + + virtual String GetKey( USHORT nKey ) const; +}; + +/*-------------------------------------------------------------------- + Beschreibung: Sortieren Tabelle + --------------------------------------------------------------------*/ + +struct SwSortBoxElement : public SwSortElement +{ + USHORT nRow; + + SwSortBoxElement( USHORT nRC ); + virtual ~SwSortBoxElement(); + + virtual String GetKey( USHORT nKey ) const; + virtual double GetValue( USHORT nKey ) const; +}; + + +/*-------------------------------------------------------------------- + Beschreibung: SymFndBoxes stellt ein zweidimensionales + Array von FndBoxes dar + --------------------------------------------------------------------*/ + +class FlatFndBox +{ +public: + FlatFndBox(SwDoc* pDocPtr, const _FndBox& rBox); + ~FlatFndBox(); + + BOOL IsSymmetric() const { return bSym; } + USHORT GetRows() const { return nRows; } + USHORT GetCols() const { return nCols; } + + const _FndBox* GetBox(USHORT nCol, USHORT nRow) const; + + inline BOOL HasItemSets() const; + const SfxItemSet* GetItemSet(USHORT nCol, USHORT nRow) const; + +private: + + BOOL CheckLineSymmetry(const _FndBox& rBox); + BOOL CheckBoxSymmetry(const _FndLine& rLn); + USHORT GetColCount(const _FndBox& rBox); + USHORT GetRowCount(const _FndBox& rBox); + void FillFlat(const _FndBox&, BOOL bLastBox=FALSE); + + SwDoc* pDoc; + const _FndBox& rBoxRef; + _FndBoxPtr* pArr; + SfxItemSet** ppItemSets; + + USHORT nRows; + USHORT nCols; + + USHORT nRow; + USHORT nCol; + + BOOL bSym; +}; + + +inline 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..cb03e0531000 --- /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( USHORT nArrayIdx, + USHORT 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, USHORT nLevel, + const Range& rRange ); + + // returne die TextCollection ueber den Namen / aus Format-Pool + SwTxtFmtColl* GetTxtFmtColl( USHORT 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 + + BOOL SetPosAtStartEnd( SwPosition& rPos, BOOL bAtStart = 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..714208a4b6c9 --- /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 USHORT nIdx = 0, + const USHORT nLen = STRING_LEN ); + inline void DrawStretchText( const Point& rStart, USHORT nWidth, + const String& rTxt, + const USHORT nIdx = 0, + const USHORT nLen = STRING_LEN ); + inline void DrawTextArray( const Point& rStart, + const String& rTxt, + long *pKernArray = 0, + const USHORT nIdx = 0, + const USHORT nLen = STRING_LEN); + inline void DrawLine( const Point& rStart, const Point& rEnd ); + inline void DrawRect( const SwRect& rRect, + const USHORT nHorzRount = 0, + const USHORT nVertRound = 0 ); + + inline const Point *GetOrigin() const {return pPos; } +}; + +/************************************************************************* + * SwDrawDev::DrawText + *************************************************************************/ + +inline void SwDrawDev::DrawText( const Point& rStart, const String& rTxt, + const USHORT nIdx, const USHORT 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, USHORT nWidth, + const String& rTxt, const USHORT nIdx, const USHORT 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 USHORT nIdx, const USHORT 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 USHORT nHorzRound, const USHORT 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..ab25e5435aa7 --- /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; + USHORT nWidth; + USHORT nAscent; + USHORT nCompress; + long nSperren; + long nSpace; + long nKern; + xub_StrLen nNumberOfBlanks; + BYTE nCursorBidiLevel; + BOOL bBullet : 1; + BOOL bUpper : 1; // Fuer Kapitaelchen: Grossbuchstaben-Flag + BOOL bDrawSpace : 1; // Fuer Kapitaelchen: Unter/Durchstreichung + BOOL bGreyWave : 1; // Graue Wellenlinie beim extended TextInput + 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. + BOOL bSnapToGrid : 1; // Does paragraph snap to grid? + BOOL bIgnoreFrmRTL : 1; // Paint text as if text has LTR direction, used for + // line numbering + 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 + BOOL bPos : 1; // These flags should control, that the appropriate + BOOL bWrong : 1; // Set-function has been called before calling + BOOL bGrammarCheck : 1; // the Get-function of a member + BOOL bSize : 1; + BOOL bFnt : 1; + BOOL bHyph : 1; + BOOL bLeft : 1; + BOOL bRight : 1; + BOOL bKana : 1; + BOOL bOfst : 1; + BOOL bAscent: 1; + BOOL bSperr : 1; + BOOL bSpace : 1; + BOOL bNumberOfBlanks : 1; + BOOL bUppr : 1; + BOOL bDrawSp: 1; +#endif + + SwDrawTextInfo( ViewShell *pS, OutputDevice &rO, const SwScriptInfo* pSI, + const XubString &rSt, xub_StrLen nI, xub_StrLen nL, + USHORT nW = 0, BOOL bB = 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 = FALSE; + bSpaceStop = FALSE; + bSnapToGrid = FALSE; + bIgnoreFrmRTL = FALSE; + bPosMatchesBounds = 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 = FALSE; + bDrawSpace = 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 = 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; + } + + USHORT GetWidth() const + { + return nWidth; + } + + USHORT GetAscent() const + { + ASSERT( bAscent, "DrawTextInfo: Undefined Ascent" ); + return nAscent; + } + + USHORT 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; + } + + BYTE GetCursorBidiLevel() const + { + return nCursorBidiLevel; + } + + BOOL GetBullet() const + { + return bBullet; + } + + BOOL GetUpper() const + { + ASSERT( bUppr, "DrawTextInfo: Undefined Upperflag" ); + return bUpper; + } + + BOOL GetDrawSpace() const + { + ASSERT( bDrawSp, "DrawTextInfo: Undefined DrawSpaceflag" ); + return bDrawSpace; + } + + BOOL GetGreyWave() const + { + return bGreyWave; + } + + BOOL IsSpaceStop() const + { + return bSpaceStop; + } + + BOOL SnapToGrid() const + { + return bSnapToGrid; + } + + BOOL IsIgnoreFrmRTL() const + { + return bIgnoreFrmRTL; + } + + BOOL IsPosMatchesBounds() const + { + return bPosMatchesBounds; + } + + void SetOut( OutputDevice &rNew ) + { + pOut = &rNew; + } + + void SetPos( const Point &rNew ) + { + pPos = &rNew; +#ifdef DBG_UTIL + bPos = TRUE; +#endif + } + + void SetHyphPos( xub_StrLen *pNew ) + { + pHyphPos = pNew; +#ifdef DBG_UTIL + bHyph = TRUE; +#endif + } + + void SetText( const XubString &rNew ) + { + pText = &rNew; + } + + void SetWrong( const SwWrongList* pNew ) + { + pWrong = pNew; +#ifdef DBG_UTIL + bWrong = TRUE; +#endif + } + + void SetGrammarCheck( const SwWrongList* pNew ) + { + pGrammarCheck = pNew; +#ifdef DBG_UTIL + bGrammarCheck = TRUE; +#endif + } + + void SetSmartTags( const SwWrongList* pNew ) + { + pSmartTags = pNew; + } + + void SetSize( const Size &rNew ) + { + pSize = &rNew; +#ifdef DBG_UTIL + bSize = TRUE; +#endif + } + + void SetFont( SwFont* pNew ) + { + pFnt = pNew; +#ifdef DBG_UTIL + bFnt = 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 = TRUE; +#endif + } + + void SetLeft( long nNew ) + { + nLeft = nNew; +#ifdef DBG_UTIL + bLeft = TRUE; +#endif + } + + void SetRight( long nNew ) + { + nRight = nNew; +#ifdef DBG_UTIL + bRight = TRUE; +#endif + } + + void SetKanaDiff( long nNew ) + { + nKanaDiff = nNew; +#ifdef DBG_UTIL + bKana = TRUE; +#endif + } + + void SetWidth( USHORT nNew ) + { + nWidth = nNew; + } + + void SetAscent( USHORT nNew ) + { + nAscent = nNew; +#ifdef DBG_UTIL + bAscent = 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 = TRUE; + bSperr = TRUE; +#endif + } + + void SetNumberOfBlanks( xub_StrLen nNew ) + { +#ifdef DBG_UTIL + bNumberOfBlanks = TRUE; +#endif + nNumberOfBlanks = nNew; + } + + void SetCursorBidiLevel( BYTE nNew ) + { + nCursorBidiLevel = nNew; + } + + void SetKanaComp( short nNew ) + { + nCompress = nNew; + } + + void SetBullet( BOOL bNew ) + { + bBullet = bNew; + } + + void SetUnderFnt( SwUnderlineFont* pULFnt ) + { + pUnderFnt = pULFnt; + } + + void SetUpper( BOOL bNew ) + { + bUpper = bNew; +#ifdef DBG_UTIL + bUppr = TRUE; +#endif + } + + void SetDrawSpace( BOOL bNew ) + { + bDrawSpace = bNew; +#ifdef DBG_UTIL + bDrawSp = TRUE; +#endif + } + + void SetGreyWave( BOOL bNew ) + { + bGreyWave = bNew; + } + + void SetSpaceStop( BOOL bNew ) + { + bSpaceStop = bNew; + } + + void SetSnapToGrid( BOOL bNew ) + { + bSnapToGrid = bNew; + } + + void SetIgnoreFrmRTL( BOOL bNew ) + { + bIgnoreFrmRTL = bNew; + } + + void SetPosMatchesBounds( BOOL bNew ) + { + bPosMatchesBounds = bNew; + } + + void Shift( USHORT 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..0414ebd41be3 --- /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, USHORT nTol, SdrObject* pObj, SdrPageView* pPV, 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, ULONG nOldPos, + ULONG nNewPos ); + virtual 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/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..634a1fbb53a1 --- /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 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 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; + + BOOL bIsFollow :1; //Ist's ein Follow + BOOL bLockJoin :1; //Join (und damit deleten) verboten wenn TRUE! + BOOL bUndersized:1; // wir sind kleiner als gewuenscht + BOOL bFtnAtEnd :1; // For sectionfrms only: footnotes at the end of section + BOOL bEndnAtEnd :1; // " " " : endnotes at the end of section + BOOL bCntntLock :1; // " " " : content locked + BOOL bOwnFtnNum :1; // " " " : special numbering of footnotes + BOOL bFtnLock :1; // " " " : ftn, don't leave this section bwd + BOOL bFlyLock :1; // Stop positioning of at-character flyframes + + //Prueft ob Vorwaertsfluss noch Sinn macht Endloswanderschaften (unterbinden) + inline BOOL IsFwdMoveAllowed(); + // --> OD 2005-03-08 #i44049# - method <CalcCntnt(..)> has to check this property. + friend void CalcCntnt( SwLayoutFrm *pLay, bool bNoColl, bool bNoCalcFollow ); + // <-- + 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 + BYTE BwdMoveNecessary( const SwPageFrm *pPage, const SwRect &rRect ); + + void LockJoin() { bLockJoin = TRUE; } + void UnlockJoin() { bLockJoin = FALSE; } + + BOOL CheckMoveFwd( BOOL &rbMakePage, BOOL bKeep, BOOL bMovedBwd ); + BOOL MoveFwd( BOOL bMakePage, BOOL bPageBreak, BOOL bMoveAlways = FALSE ); + virtual BOOL ShouldBwdMoved( SwLayoutFrm *pNewUpper, BOOL bHead, BOOL &rReformat )=0; + BOOL MoveBwd( BOOL &rbReformat ); + +public: + SwFlowFrm( SwFrm &rFrm ); + + const SwFrm *GetFrm() const { return &rThis; } + SwFrm *GetFrm() { return &rThis; } + + static BOOL IsMoveBwdJump() { return bMoveBwdJump; } + static void SetMoveBwdJump( BOOL bNew ){ bMoveBwdJump = bNew; } + + inline void SetUndersized( const BOOL bNew ) { bUndersized = bNew; } + inline BOOL IsUndersized() const { return bUndersized; } + + BOOL IsPrevObjMove() const; + + //Die Kette mit minimalen Operationen und Benachrichtigungen unter den + //neuen Parent Moven. + void MoveSubTree( SwLayoutFrm* pParent, SwFrm* pSibling = 0 ); + + BOOL HasFollow() const { return pFollow ? TRUE : FALSE; } + BOOL IsFollow() const { return bIsFollow; } + inline void _SetIsFollow( BOOL bSet ) { bIsFollow = bSet; } + const SwFlowFrm *GetFollow() const { return pFollow; } + SwFlowFrm *GetFollow() { return pFollow; } + 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(); } + BOOL IsFtnAtEnd() const { return bFtnAtEnd; } + BOOL IsEndnAtEnd() const { return bEndnAtEnd; } + BOOL IsAnyNoteAtEnd() const { return bFtnAtEnd || bEndnAtEnd; } + BOOL AreNotesAtEnd() const { return bFtnAtEnd && bEndnAtEnd; } + + BOOL IsPageBreak( BOOL bAct ) const; + BOOL IsColBreak( BOOL bAct ) const; + + //Ist ein Keep zu beruecksichtigen (Breaks!) + BOOL IsKeep( const SwAttrSet& rAttrs, bool bBreakCheck = false ) const; + + sal_Bool HasLockedFollow() const; + + BOOL HasParaSpaceAtPages( 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: <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( BOOL bNew ){ bFtnLock = bNew; } + BOOL IsFtnLock() const { return bFtnLock; } + void SetFlyLock( BOOL bNew ){ bFlyLock = bNew; } + BOOL IsFlyLock() const { return bFlyLock; } + void SetOwnFtnNum( BOOL bNew ){ bOwnFtnNum = bNew; } + BOOL IsOwnFtnNum() const { return bOwnFtnNum; } + void SetCntntLock( BOOL bNew ){ bCntntLock = bNew; } + 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 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..cadac60cb8ca --- /dev/null +++ b/sw/source/core/inc/flyfrm.hxx @@ -0,0 +1,287 @@ +/************************************************************************* + * + * 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 _FLYFRM_HXX +#define _FLYFRM_HXX + +#include "layfrm.hxx" + +class SwPageFrm; +class SwFlyFrmFmt; +class SwFmtFrmSize; +struct SwCrsrMoveState; +class SwBorderAttrs; +class SwVirtFlyDrawObj; +class SwSpzFrmFmts; +class SwAttrSetChg; +class PolyPolygon; + +// OD 2004-03-22 #i26791# +#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 BOOL bBody = FALSE ); + +// berechnet das Rechteck, in dem das Objekt bewegt bzw. resized werden darf +BOOL CalcClipRect( const SdrObject *pSdrObj, SwRect &rRect, BOOL bMove = 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 *, ULONG, SwFrm *, SwPageFrm * ); + friend void AppendAllObjs( const SwSpzFrmFmts * ); + friend void Notify( SwFlyFrm *, SwPageFrm *pOld, const SwRect &rOld, + const SwRect* pOldPrt ); + + void InitDrawObj( BOOL bNotify ); //Wird von den CToren gerufen. + void FinitDrawObj(); //Wird vom CTor gerufen. + + void _UpdateAttr( SfxPoolItem*, SfxPoolItem*, BYTE &, + SwAttrSetChg *pa = 0, SwAttrSetChg *pb = 0 ); + + using SwLayoutFrm::CalcRel; + +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: + 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. + BOOL bNotifyBack:1; //TRUE wenn am Ende eines MakeAll() der Background + //vom NotifyDTor benachrichtigt werden muss. +protected: + + 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! + BOOL bMinHeight:1; //TRUE wenn die vom Attribut vorgegebene Hoehe eine + //eine Minimalhoehe ist (der Frm also bei Bedarf + //darueberhinaus wachsen kann). + BOOL bHeightClipped :1; //TRUE wenn der Fly nicht die Pos/Size anhand der Attrs + BOOL bWidthClipped :1; //formatieren konnte, weil z.B. nicht genug Raum vorh. + //war. + 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. + BOOL bInCnt :1; // FLY_AS_CHAR, anchored as character + BOOL bAtCnt :1; // FLY_AT_PARA, anchored at paragraph + BOOL bLayout :1; // FLY_AT_PAGE, FLY_AT_FLY, at page or at frame + BOOL bAutoPosition :1; // FLY_AT_CHAR, anchored at character + BOOL bNoShrink :1; // temporary forbud of shrinking to avoid loops + 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 = TRUE; } + void Unlock() { bLocked = FALSE; } + + void SetMinHeight() { bMinHeight = TRUE; } + void ResetMinHeight(){ bMinHeight = FALSE; } + + Size CalcRel( const SwFmtFrmSize &rSz ) const; + SwTwips CalcAutoWidth() const; + + SwFlyFrm( SwFlyFrmFmt*, 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(); + + // --> OD 2006-08-10 #i68520# + virtual bool _SetObjTop( const SwTwips _nTop ); + virtual bool _SetObjLeft( const SwTwips _nLeft ); + // <-- + + // --> OD 2006-10-05 #i70122# + virtual const SwRect GetObjBoundRect() const; + // <-- +public: + // OD 2004-03-23 #i26791# + TYPEINFO(); + + virtual ~SwFlyFrm(); + virtual void Modify( SfxPoolItem*, SfxPoolItem* ); + // erfrage vom Client Informationen + virtual BOOL GetInfo( SfxPoolItem& ) const; + virtual void Paint( const SwRect&, const SwPrtOptions *pPrintData = NULL ) const; + virtual Size ChgSize( const Size& aNewSize ); + virtual BOOL GetCrsrOfst( SwPosition *, Point&, + SwCrsrMoveState* = 0 ) const; + + virtual void CheckDirection( BOOL bVert ); + virtual void Cut(); +#ifdef DBG_UTIL + virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 ); +#endif + + SwTwips _Shrink( SwTwips, BOOL bTst ); + SwTwips _Grow ( SwTwips, BOOL bTst ); + void _Invalidate( SwPageFrm *pPage = 0 ); + + 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 ); + BOOL IsInvalid() const { return bInvalid; } + void Invalidate() const { ((SwFlyFrm*)this)->bInvalid = TRUE; } + void Validate() const { ((SwFlyFrm*)this)->bInvalid = FALSE; } + + BOOL IsMinHeight() const { return bMinHeight; } + BOOL IsLocked() const { return bLocked; } + BOOL IsAutoPos() const { return bAutoPosition; } + BOOL IsFlyInCntFrm() const { return bInCnt; } + BOOL IsFlyFreeFrm() const { return bAtCnt || bLayout; } + BOOL IsFlyLayFrm() const { return bLayout; } + BOOL IsFlyAtCntFrm() const { return bAtCnt; } + + BOOL IsNotifyBack() const { return bNotifyBack; } + void SetNotifyBack() { bNotifyBack = TRUE; } + void ResetNotifyBack() { bNotifyBack = FALSE; } + BOOL IsNoShrink() const { return bNoShrink; } + void SetNoShrink( BOOL bNew ) { bNoShrink = bNew; } + BOOL IsLockDeleteContent() const { return bLockDeleteContent; } + void SetLockDeleteContent( BOOL bNew ) { bLockDeleteContent = bNew; } + + + BOOL IsClipped() const { return bHeightClipped || bWidthClipped; } + BOOL IsHeightClipped() const { return bHeightClipped; } + BOOL IsWidthClipped() const { return bWidthClipped; } + + BOOL IsLowerOf( const SwLayoutFrm* pUpper ) const; + inline 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 + BOOL GetContour( PolyPolygon& rContour, + const sal_Bool _bForPaint = sal_False ) const; + + + //Auf dieser Shell painten (PreView, Print-Flag usw. rekursiv beachten)?. + static 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; +}; +#endif diff --git a/sw/source/core/inc/flyfrms.hxx b/sw/source/core/inc/flyfrms.hxx new file mode 100644 index 000000000000..105d1f117f9e --- /dev/null +++ b/sw/source/core/inc/flyfrms.hxx @@ -0,0 +1,259 @@ +/************************************************************************* + * + * 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 *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 *pAnchor ); + SwFlyLayFrm( SwFlyLayFrm& ); + + virtual void Modify( SfxPoolItem*, 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(); + +public: + // --> OD 2004-06-29 #i28701# + TYPEINFO(); + + SwFlyAtCntFrm( SwFlyFrmFmt*, SwFrm *pAnchor ); + + virtual void Modify( SfxPoolItem*, SfxPoolItem* ); + + 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. + + BOOL bInvalidLayout :1; + BOOL bInvalidCntnt :1; + +protected: + virtual void NotifyBackground( SwPageFrm *pPage, + const SwRect& rRect, PrepareHint eHint); + virtual void MakeAll(); + +public: + // --> OD 2004-06-29 #i28701# + TYPEINFO(); + + SwFlyInCntFrm( SwFlyFrmFmt*, SwFrm *pAnchor ); + + virtual ~SwFlyInCntFrm(); + virtual void Format( const SwBorderAttrs *pAttrs = 0 ); + virtual void Modify( SfxPoolItem*, SfxPoolItem* ); + + 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; + BOOL IsInvalid() const { return (bInvalidLayout || bInvalidCntnt); } + BOOL IsInvalidLayout() const { return bInvalidLayout; } + 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 = TRUE; +} +inline void SwFlyInCntFrm::InvalidateCntnt() const +{ + ((SwFlyInCntFrm*)this)->bInvalidCntnt = TRUE; +} +inline void SwFlyInCntFrm::ValidateLayout() const +{ + ((SwFlyInCntFrm*)this)->bInvalidLayout = FALSE; +} +inline void SwFlyInCntFrm::ValidateCntnt() const +{ + ((SwFlyInCntFrm*)this)->bInvalidCntnt = FALSE; +} + +#endif diff --git a/sw/source/core/inc/fntcache.hxx b/sw/source/core/inc/fntcache.hxx new file mode 100644 index 000000000000..f49a69b5e992 --- /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 BYTE *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; + USHORT nGuessedLeading; + USHORT nExtLeading; + USHORT nScrAscent; + USHORT nPrtAscent; + USHORT nScrHeight; + USHORT nPrtHeight; + USHORT nPropWidth; + USHORT nZoom; + BOOL bSymbol : 1; + 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 BOOL bSwitchH2V, const BOOL bSwitchL2R, + long nHalfSpace, long* pKernArray, const 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 USHORT GetGuessedLeading() const { return nGuessedLeading; } + inline USHORT GetExtLeading() const { return nExtLeading; } + + USHORT GetFontAscent( const ViewShell *pSh, const OutputDevice& rOut ); + USHORT GetFontHeight( const ViewShell *pSh, const OutputDevice& rOut ); + USHORT 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 USHORT GetZoom() const { return nZoom; } + inline USHORT GetPropWidth() const { return nPropWidth; } + inline 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, USHORT &rIndex, const void *pOwner, + ViewShell *pShell, + BOOL bCheck = 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..e1560a230d7a --- /dev/null +++ b/sw/source/core/inc/frame.hxx @@ -0,0 +1,1257 @@ +/************************************************************************* + * + * 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 _FRAME_HXX +#define _FRAME_HXX +#include <svl/svarray.hxx> +#include "swtypes.hxx" // fuer SwTwips +#include "swrect.hxx" +#include "calbck.hxx" // fuer SwClient + +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 SwPrtOptions; + +// --> OD 2004-07-06 #i28701# +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 BOOL (SwFrm:: *SwFrmMax)( long ); +typedef void (SwFrm:: *SwFrmMakePos)( const SwFrm*, const SwFrm*, 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; +#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 +{ + //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; + // <-- + + 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( SfxPoolItem*, SfxPoolItem*, BYTE & ); + SwFrm* _GetIndNext(); + void SetDirFlags( 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 + + USHORT bFlag01: 1; + USHORT bFlag02: 1; + USHORT bFlag03: 1; + USHORT bFlag04: 1; + USHORT bFlag05: 1; + USHORT bReverse: 1; // Next line above/at the right side instead + // under/at the left side of the previous line. + USHORT bInvalidR2L: 1; + USHORT bDerivedR2L: 1; + USHORT bRightToLeft: 1; + USHORT bInvalidVert: 1; + USHORT bDerivedVert: 1; + USHORT bVertical: 1; + USHORT nType: 4; //Who am I? + + BOOL bValidPos: 1; + BOOL bValidPrtArea: 1; + BOOL bValidSize: 1; + BOOL bValidLineNum: 1; + BOOL bFixSize: 1; + BOOL bUnUsed1: 1; + BOOL bCompletePaint: 1; //Frame wird ganz gepaintet wenn TRUE, auch + //wenn der Inhalt nur teilw. veraendert ist; + //Bei CntntFrms wird ausschliesslich wenn TRUE + //der Border (von Action) gemalt. + BOOL bRetouche: 1; //Der Frame ist fuer Retusche verantwortlich + //wenn TRUE. +public: + BOOL bUnUsed2: 1; +protected: + BOOL bInfInvalid: 1; //InfoFlags sind Invalid. + BOOL bInfBody: 1; //Frm steht im DokumentBody. + BOOL bInfTab: 1; //Frm steht in einer Tabelle. + BOOL bInfFly: 1; //Frm steht in einem Fly. + BOOL bInfFtn: 1; //Frm steht in einer Fussnote. + BOOL bInfSct: 1; //Frm steht in einem Bereich. + BOOL bColLocked: 1; //Grow/Shrink sperren bei spaltigen Section- + //oder Fly-Frames, wird im Format gesetzt + + void ColLock() { bColLocked = TRUE; } + void ColUnlock() { bColLocked = FALSE; } + + SwPageFrm *InsertPage( SwPageFrm *pSibling, 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, BOOL bTst = FALSE ); + + + //Aendern nur die Framesize, nicht die PrtArea-SSize + virtual SwTwips ShrinkFrm( SwTwips, BOOL bTst = FALSE, BOOL bInfo = FALSE ) = 0; + virtual SwTwips GrowFrm ( SwTwips, BOOL bTst = FALSE, BOOL bInfo = FALSE ) = 0; + + SwModify *GetDep() { return pRegisteredIn; } + const SwModify *GetDep() const { return pRegisteredIn; } + + SwFrm( SwModify* ); + + void CheckDir( UINT16 nDir, BOOL bVert, BOOL bOnlyBiDi, 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 <FALSE>. + + @author OD + */ + virtual void _ActionOnInvalidation( const InvalidationType _nInvalid ); + + //Schatten und Umrandung painten + void PaintShadow( const SwRect&, SwRect&, const SwBorderAttrs& ) const; + +public: + TYPEINFO(); //Bereits in Basisklasse Client drin. + + USHORT 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, BOOL bTst = FALSE, BOOL bInfo = FALSE ); + SwTwips Grow ( SwTwips, BOOL bTst = FALSE, BOOL bInfo = 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, 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, BOOL bFwd, + const SwFrm *pAnch ) const; + + 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 BOOL bLowerBorder = FALSE ) const; + void PaintBackground( const SwRect&, const SwPageFrm *pPage, + const SwBorderAttrs &, + const BOOL bLowerMode = FALSE, + const BOOL bLowerBorder = 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; + + BOOL GetBackgroundBrush( const SvxBrushItem*& rpBrush, + const Color*& rpColor, + SwRect &rOrigRect, + BOOL bLowerMode ) const; + + inline void SetCompletePaint() const; + inline void ResetCompletePaint() const; + inline BOOL IsCompletePaint() const { return bCompletePaint; } + + inline void SetRetouche() const; + inline void ResetRetouche() const; + inline BOOL IsRetouche() const { return bRetouche; } + + void SetInfFlags(); //Setzen der InfoFlags + inline void InvalidateInfFlags() { bInfInvalid = TRUE; } + inline BOOL IsInDocBody() const; //Benutzen die InfoFlags. + inline BOOL IsInFtn() const; //ggf. werden die Flags ermittelt. + inline BOOL IsInTab() const; + inline BOOL IsInFly() const; + inline 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 BOOL IsReverse() const { return bReverse; } + inline void SetReverse( BOOL bNew ){ bReverse = bNew ? 1 : 0; } + inline BOOL IsVertical() const; + inline BOOL GetVerticalFlag() const; + inline void SetVertical( BOOL bNew ){ bVertical = bNew ? 1 : 0; } + inline void SetDerivedVert( BOOL bNew ){ bDerivedVert = bNew ? 1 : 0; } + inline void SetInvalidVert( BOOL bNew) { bInvalidVert = bNew ? 1 : 0; } + inline BOOL IsRightToLeft() const; + inline BOOL GetRightToLeftFlag() const; + inline void SetRightToLeft( BOOL bNew ){ bRightToLeft = bNew ? 1 : 0; } + inline void SetDerivedR2L( BOOL bNew ) { bDerivedR2L = bNew ? 1 : 0; } + inline void SetInvalidR2L( 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 <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 + */ +// 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). + BOOL IsFtnAllowed() const; + + virtual void Modify( SfxPoolItem*, SfxPoolItem* ); + virtual void Format( const SwBorderAttrs *pAttrs = 0 ); + + virtual void CheckDirection( BOOL bVert ); + + void ReinitializeFrmSizeAttrFlags(); + + const SwAttrSet *GetAttrSet() const; + + inline BOOL HasFixSize() const { return bFixSize; } + inline void SetFixSize( BOOL bNew ) { bFixSize = bNew; } + + //Kann 0 liefern, pruefen auch ob die Shell zum richtigen Dokument + //gehoert. Impl in frmsh.hxx + ViewShell *GetShell() const; + + //Prueft alle Seiten ab der Uebergebenen und korrigiert ggf. + static void CheckPageDescs( SwPageFrm *pStart, BOOL bNotifyFields = TRUE ); + + //Koennen 0 liefern, einmal const einmal nicht + SwFrm *GetNext() { return pNext; } + SwFrm *GetPrev() { return pPrev; } + SwLayoutFrm *GetUpper() { return pUpper; } + SwRootFrm *FindRootFrm(); + SwPageFrm *FindPageFrm(); + SwFrm *FindColFrm(); + SwFtnBossFrm *FindFtnBossFrm( BOOL bFootnotes = 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; } + 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 SwRootFrm *FindRootFrm() const; + inline const SwFtnBossFrm *FindFtnBossFrm( BOOL bFtn = 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(); } + + USHORT GetPhyPageNum() const; //Seitennummer ohne Offset + USHORT GetVirtPageNum() const; //Seitenummer mit Offset + BOOL OnRightPage() const { return 0 != GetPhyPageNum() % 2; }; + 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( BOOL bBorder = 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 = TRUE; } + + BOOL GetValidPosFlag() const { return bValidPos; } + BOOL GetValidPrtAreaFlag()const { return bValidPrtArea; } + BOOL GetValidSizeFlag() const { return bValidSize; } + BOOL GetValidLineNumFlag()const { return bValidLineNum; } + 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 = FALSE; + _ActionOnInvalidation( INVALID_SIZE ); + } + } + void _InvalidatePrt() + { + if ( bValidPrtArea && _InvalidationAllowed( INVALID_PRTAREA ) ) + { + bValidPrtArea = FALSE; + _ActionOnInvalidation( INVALID_PRTAREA ); + } + } + void _InvalidatePos() + { + if ( bValidPos && _InvalidationAllowed( INVALID_POS ) ) + { + bValidPos = FALSE; + _ActionOnInvalidation( INVALID_POS ); + } + } + void _InvalidateLineNum() + { + if ( bValidLineNum && _InvalidationAllowed( INVALID_LINENUM ) ) + { + bValidLineNum = FALSE; + _ActionOnInvalidation( INVALID_LINENUM ); + } + } + void _InvalidateAll() + { + if ( ( bValidSize || bValidPrtArea || bValidPos ) && + _InvalidationAllowed( INVALID_ALL ) ) + { + bValidSize = bValidPrtArea = bValidPos = 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( BOOL bNoFtn = FALSE ); + void ImplInvalidateNextPos( BOOL bNoFtn = 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 BOOL GetCrsrOfst( SwPosition *, Point&, + SwCrsrMoveState* = 0 ) const; + virtual BOOL GetCharRect( SwRect &, const SwPosition&, + SwCrsrMoveState* = 0 ) const; + virtual void Paint( const SwRect&, const SwPrtOptions *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, BOOL bNotify = TRUE ); + + //TRUE wenn's die richtige Klasse ist, FALSE sonst + inline BOOL IsLayoutFrm() const; + inline BOOL IsRootFrm() const; + inline BOOL IsPageFrm() const; + inline BOOL IsColumnFrm() const; + inline BOOL IsFtnBossFrm() const; // Fussnotenbosse sind PageFrms und ColumnFrms + inline BOOL IsHeaderFrm() const; + inline BOOL IsFooterFrm() const; + inline BOOL IsFtnContFrm() const; + inline BOOL IsFtnFrm() const; + inline BOOL IsBodyFrm() const; + inline BOOL IsColBodyFrm() const; // in layfrm.hxx implementiert, BodyFrm unterhalb ColumnFrm + inline BOOL IsPageBodyFrm() const; // in layfrm.hxx implementiert, BodyFrm unterhalb PageFrm + inline BOOL IsFlyFrm() const; + inline BOOL IsSctFrm() const; + inline BOOL IsTabFrm() const; + inline BOOL IsRowFrm() const; + inline BOOL IsCellFrm() const; + inline BOOL IsCntntFrm() const; + inline BOOL IsTxtFrm() const; + inline BOOL IsNoTxtFrm() const; + inline BOOL IsFlowFrm() const; //Frms deren PrtArea von den Nachbarn + //abhaengen und die halt im Inhaltsfluss + //stehen. + inline BOOL IsRetoucheFrm() const; //Frms die Retouchefaehig sind bzw. die + //u.U. hinter sich Retouchieren muessen. + inline 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 + BOOL IsProtected() const; + + 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; + BOOL SetMinLeft( long ); + BOOL SetMaxBottom( long ); + BOOL SetMaxRight( long ); + BOOL SetMinTop( long ); + void MakeBelowPos( const SwFrm*, const SwFrm*, BOOL ); + void MakeUpperPos( const SwFrm*, const SwFrm*, BOOL ); + void MakeLeftPos( const SwFrm*, const SwFrm*, BOOL ); + void MakeRightPos( const SwFrm*, const SwFrm*, BOOL ); + inline BOOL IsNeighbourFrm() const + { return GetType() & FRM_NEIGHBOUR ? TRUE : 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 + void ValidateThisAndAllLowers( const USHORT nStage ); +}; + +inline BOOL SwFrm::IsInDocBody() const +{ + if ( bInfInvalid ) + ((SwFrm*)this)->SetInfFlags(); + return bInfBody; +} +inline BOOL SwFrm::IsInFtn() const +{ + if ( bInfInvalid ) + ((SwFrm*)this)->SetInfFlags(); + return bInfFtn; +} +inline BOOL SwFrm::IsInTab() const +{ + if ( bInfInvalid ) + ((SwFrm*)this)->SetInfFlags(); + return bInfTab; +} +inline BOOL SwFrm::IsInFly() const +{ + if ( bInfInvalid ) + ((SwFrm*)this)->SetInfFlags(); + return bInfFly; +} +inline BOOL SwFrm::IsInSct() const +{ + if ( bInfInvalid ) + ((SwFrm*)this)->SetInfFlags(); + return bInfSct; +} +BOOL SwFrm::IsVertical() const +{ + if( bInvalidVert ) + ((SwFrm*)this)->SetDirFlags( TRUE ); + return bVertical != 0; +} +BOOL SwFrm::GetVerticalFlag() const +{ + return bVertical != 0; +} +inline BOOL SwFrm::IsRightToLeft() const +{ + if( bInvalidR2L ) + ((SwFrm*)this)->SetDirFlags( FALSE ); + return bRightToLeft != 0; +} +BOOL SwFrm::GetRightToLeftFlag() const +{ + return bRightToLeft != 0; +} + +inline void SwFrm::SetCompletePaint() const +{ + ((SwFrm*)this)->bCompletePaint = TRUE; +} +inline void SwFrm::ResetCompletePaint() const +{ + ((SwFrm*)this)->bCompletePaint = FALSE; +} + +inline void SwFrm::SetRetouche() const +{ + ((SwFrm*)this)->bRetouche = TRUE; +} +inline void SwFrm::ResetRetouche() const +{ + ((SwFrm*)this)->bRetouche = 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 = FALSE; + + // OD 2004-05-19 #i28701# + _ActionOnInvalidation( INVALID_ALL ); + } +} + +inline void SwFrm::InvalidateNextPos( 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 SwRootFrm *SwFrm::FindRootFrm() const +{ + return ((SwFrm*)this)->FindRootFrm(); +} +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( 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 BOOL SwFrm::IsLayoutFrm() const +{ + return GetType() & FRM_LAYOUT ? TRUE : FALSE; +} +inline BOOL SwFrm::IsRootFrm() const +{ + return nType == FRMC_ROOT; +} +inline BOOL SwFrm::IsPageFrm() const +{ + return nType == FRMC_PAGE; +} +inline BOOL SwFrm::IsColumnFrm() const +{ + return nType == FRMC_COLUMN; +} +inline BOOL SwFrm::IsFtnBossFrm() const +{ + return GetType() & FRM_FTNBOSS ? TRUE : FALSE; +} +inline BOOL SwFrm::IsHeaderFrm() const +{ + return nType == FRMC_HEADER; +} +inline BOOL SwFrm::IsFooterFrm() const +{ + return nType == FRMC_FOOTER; +} +inline BOOL SwFrm::IsFtnContFrm() const +{ + return nType == FRMC_FTNCONT; +} +inline BOOL SwFrm::IsFtnFrm() const +{ + return nType == FRMC_FTN; +} +inline BOOL SwFrm::IsBodyFrm() const +{ + return nType == FRMC_BODY; +} +inline BOOL SwFrm::IsFlyFrm() const +{ + return nType == FRMC_FLY; +} +inline BOOL SwFrm::IsSctFrm() const +{ + return nType == FRMC_SECTION; +} +inline BOOL SwFrm::IsTabFrm() const +{ + return nType == FRMC_TAB; +} +inline BOOL SwFrm::IsRowFrm() const +{ + return nType == FRMC_ROW; +} +inline BOOL SwFrm::IsCellFrm() const +{ + return nType == FRMC_CELL; +} +inline BOOL SwFrm::IsCntntFrm() const +{ + return GetType() & FRM_CNTNT ? TRUE : FALSE; +} +inline BOOL SwFrm::IsTxtFrm() const +{ + return nType == FRMC_TXT; +} +inline BOOL SwFrm::IsNoTxtFrm() const +{ + return nType == FRMC_NOTXT; +} +inline BOOL SwFrm::IsFlowFrm() const +{ + return GetType() & 0xCA00 ? TRUE : FALSE; //TabFrm, CntntFrm, SectionFrm +} +inline BOOL SwFrm::IsRetoucheFrm() const +{ + return GetType() & 0xCA40 ? TRUE : FALSE; //TabFrm, CntntFrm, SectionFrm, Ftnfrm +} +inline BOOL SwFrm::IsAccessibleFrm() const +{ + return GetType() & FRM_ACCESSIBLE ? TRUE : FALSE; +} +#endif diff --git a/sw/source/core/inc/frminf.hxx b/sw/source/core/inc/frminf.hxx new file mode 100644 index 000000000000..a39490a9b663 --- /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? + BOOL IsOneLine() const; + + // Ist die Zeile zu X% gefuellt? + BOOL IsFilled( const BYTE 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, BOOL bCenter = TRUE ) const; + + // Sammelt die whitespaces am Zeilenbeginn und -ende im Pam + void GetSpaces( SwPaM &rPam, BOOL bWithLineBreak ) const; + + // Ist an der ersten Textposition ein Bullet/Symbol etc? + 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) + USHORT 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..94befc1dca59 --- /dev/null +++ b/sw/source/core/inc/frmtool.hxx @@ -0,0 +1,582 @@ +/************************************************************************* + * + * 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 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 BYTE 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. +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, ULONG nIndex, + BOOL bPages = FALSE, 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 BOOL bDontCreateObjects; + +//Fuer FlyCnts, siehe SwFlyAtCntFrm::MakeAll() +extern 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, + BOOL bOdd, BOOL bInsertEmpty, 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 BOOL bInva ); + +const SwFrm* GetVirtualUpper( const SwFrm* pFrm, const Point& rPos ); + +BOOL Is_Lower_Of( const SwFrm *pCurrFrm, const SdrObject* pObj ); + +const SwFrm *FindKontext( const SwFrm *pFrm, USHORT nAdditionalKontextTyp ); + +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( SwModify const&, USHORT const nFrmType, const Point* = 0, + const SwPosition *pPos = 0, + const BOOL bCalcFrm = FALSE ); + +//Sollen ExtraDaten (Reline-Strich, Zeilennummern) gepaintet werden? +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; + BOOL bHadFollow; + BOOL bInvaKeep; + 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 = TRUE; } + // --> OD 2005-07-29 #i49383# + void FrmDeleted() + { + mbFrmDeleted = true; + } + // <-- +}; + +class SwLayNotify : public SwFrmNotify +{ + BOOL bLowersComplete; + + SwLayoutFrm *GetLay() { return (SwLayoutFrm*)pFrm; } +public: + SwLayNotify( SwLayoutFrm *pLayFrm ); + ~SwLayNotify(); + + void SetLowersComplete( BOOL b ) { bLowersComplete = b; } + 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 + + 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. + BOOL bTopLine :1; + BOOL bBottomLine :1; + BOOL bLeftLine :1; + BOOL bRightLine :1; + BOOL bTop :1; + BOOL bBottom :1; + BOOL bLine :1; + + BOOL bIsLine :1; //Umrandung an mind. einer Kante? + + BOOL bCacheGetLine :1; //GetTopLine(), GetBottomLine() cachen? + BOOL bCachedGetTopLine :1; //GetTopLine() gecached? + 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 BOOL bCachedJoinedWithPrev :1; + mutable BOOL bCachedJoinedWithNext :1; + // OD 21.05.2003 #108789# - booleans indicating, if borders are joined + // with previous/next frame. + BOOL bJoinedWithPrev :1; + BOOL bJoinedWithNext :1; + + //Die gecache'ten Werte, undefiniert bis sie einmal berechnet wurden. + USHORT 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>. + 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". + 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 USHORT CalcTopLine() const; + inline USHORT CalcBottomLine() const; + inline USHORT CalcLeftLine() const; + inline USHORT CalcRightLine() const; + inline USHORT CalcTop() const; + inline USHORT CalcBottom() const; + long CalcLeft( const SwFrm *pCaller ) const; + long CalcRight( const SwFrm *pCaller ) const; + + inline BOOL IsLine() const; + + inline const Size &GetSize() const { return aFrmSize; } + + inline 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 USHORT GetTopLine ( const SwFrm& _rFrm, + const SwFrm* _pPrevFrm = 0L ) const; + inline USHORT GetBottomLine( const SwFrm& _rFrm ) const; + inline void SetGetCacheLine( 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. + BOOL JoinedWithPrev( const SwFrm& _rFrm, + const SwFrm* _pPrevFrm = 0L ) const; + 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 BOOL bFlysOnly; +public: + SwOrderIter( const SwPageFrm *pPage, BOOL bFlysOnly = 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 BYTE nCnt; + static BOOL bLocked; +public: + StackHack() + { + if ( ++StackHack::nCnt > 50 ) + StackHack::bLocked = TRUE; + } + ~StackHack() + { + if ( --StackHack::nCnt < 5 ) + StackHack::bLocked = FALSE; + } + + static BOOL IsLocked() { return StackHack::bLocked; } + static BYTE 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 USHORT SwBorderAttrs::GetTopLine ( const SwFrm& _rFrm, + const SwFrm* _pPrevFrm ) const +{ + if ( !bCachedGetTopLine || _pPrevFrm ) + { + const_cast<SwBorderAttrs*>(this)->_GetTopLine( _rFrm, _pPrevFrm ); + } + return nGetTopLine; +} +inline USHORT SwBorderAttrs::GetBottomLine( const SwFrm& _rFrm ) const +{ + if ( !bCachedGetBottomLine ) + const_cast<SwBorderAttrs*>(this)->_GetBottomLine( _rFrm ); + return nGetBottomLine; +} +inline void SwBorderAttrs::SetGetCacheLine( BOOL bNew ) const +{ + ((SwBorderAttrs*)this)->bCacheGetLine = bNew; + ((SwBorderAttrs*)this)->bCachedGetBottomLine = + ((SwBorderAttrs*)this)->bCachedGetTopLine = FALSE; + // OD 21.05.2003 #108789# - invalidate cache for values <bJoinedWithPrev> + // and <bJoinedWithNext>. + bCachedJoinedWithPrev = FALSE; + bCachedJoinedWithNext = FALSE; +} + +inline USHORT SwBorderAttrs::CalcTopLine() const +{ + if ( bTopLine ) + ((SwBorderAttrs*)this)->_CalcTopLine(); + return nTopLine; +} +inline USHORT SwBorderAttrs::CalcBottomLine() const +{ + if ( bBottomLine ) + ((SwBorderAttrs*)this)->_CalcBottomLine(); + return nBottomLine; +} +inline USHORT SwBorderAttrs::CalcLeftLine() const +{ + if ( bLeftLine ) + ((SwBorderAttrs*)this)->_CalcLeftLine(); + return nLeftLine; +} +inline USHORT SwBorderAttrs::CalcRightLine() const +{ + if ( bRightLine ) + ((SwBorderAttrs*)this)->_CalcRightLine(); + return nRightLine; +} +inline USHORT SwBorderAttrs::CalcTop() const +{ + if ( bTop ) + ((SwBorderAttrs*)this)->_CalcTop(); + return nTop; +} +inline USHORT SwBorderAttrs::CalcBottom() const +{ + if ( bBottom ) + ((SwBorderAttrs*)this)->_CalcBottom(); + return nBottom; +} +inline 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 ? 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..8b9ea8348395 --- /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(); + BYTE _NeighbourhoodAdjustment( const SwFrm* pFrm ) const; +protected: + + void InsertFtn( SwFtnFrm * ); + static void ResetFtn( const SwFtnFrm *pAssumed ); +public: + inline SwFtnBossFrm( SwFrmFmt* pFmt) : SwLayoutFrm( pFmt ) {} + + 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 *, BOOL bPrep = TRUE ); + static SwFtnFrm *FindFtn( const SwCntntFrm *, const SwTxtFtn * ); + SwFtnContFrm *FindFtnCont(); + inline const SwFtnContFrm *FindFtnCont() const; + const SwFtnFrm *FindFirstFtn( SwCntntFrm* ) const; + SwFtnContFrm *FindNearestFtnCont( BOOL bDontLeave = FALSE ); + + void ChangeFtnRef( const SwCntntFrm *pOld, const SwTxtFtn *, + SwCntntFrm *pNew ); + void RearrangeFtns( const SwTwips nDeadLine, const BOOL bLock = 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, BOOL bCalc = FALSE ); + void MoveFtns( const SwCntntFrm *pSrc, SwCntntFrm *pDest, + SwTxtFtn *pAttr ); + // Sollte AdjustNeighbourhood gerufen werden (oder Grow/Shrink)? + BYTE 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..f8db9fabdf2d --- /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* ); + + const SwFtnFrm* FindFootNote() const; + + virtual SwTwips ShrinkFrm( SwTwips, BOOL bTst = FALSE, BOOL bInfo = FALSE ); + virtual SwTwips GrowFrm ( SwTwips, BOOL bTst = FALSE, BOOL bInfo = 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) + + 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, BOOL bTst = FALSE, BOOL bInfo = FALSE ); + virtual SwTwips GrowFrm ( SwTwips, BOOL bTst = FALSE, BOOL bInfo = FALSE ); +#endif + + +public: + SwFtnFrm( SwFrmFmt*, SwCntntFrm*, SwTxtFtn* ); + + virtual void Cut(); + virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 ); + + 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 = TRUE; } + void UnlockBackMove() { bBackMoveLocked = FALSE;} + BOOL IsBackMoveLocked() { return bBackMoveLocked; } + + // Verhindert, dass der letzte Inhalt den SwFtnFrm mitloescht (Cut()) + inline void ColLock() { bColLocked = TRUE; } + inline void ColUnlock() { bColLocked = 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..ff25552abc27 --- /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 BOOL GetEatSpacing() const; // in hffrm.cxx +public: + SwHeadFootFrm(SwFrmFmt * pFrm, USHORT aType); + virtual void Format( const SwBorderAttrs *pAttrs = 0 ); + virtual SwTwips GrowFrm( SwTwips, + BOOL bTst = FALSE, BOOL bInfo = FALSE ); + virtual SwTwips ShrinkFrm( SwTwips, + BOOL bTst = FALSE, BOOL bInfo = FALSE ); +}; + +class SwHeaderFrm: public SwHeadFootFrm +{ +public: + SwHeaderFrm( SwFrmFmt* pFrm ) : SwHeadFootFrm(pFrm, FRMC_HEADER) {}; + + DECL_FIXEDMEMPOOL_NEWDEL(SwHeaderFrm) +}; + +class SwFooterFrm: public SwHeadFootFrm +{ +public: + SwFooterFrm( SwFrmFmt* pFrm ) : SwHeadFootFrm(pFrm, 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..2186ccac0d2d --- /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. + USHORT nPreInvaPage; + + ULONG nStartTicks; //Startzeitpunkt der Aktion, vergeht zu viel Zeit kann + //der WaitCrsr per CheckWaitCrsr() eingeschaltet werden. + + USHORT nInputType; //Bei welchem Input soll die Verarbeitung abgebrochen + //werden? + USHORT nEndPage; //StatBar Steuerung. + USHORT nCheckPageNum; //CheckPageDesc() wurde verzoegert wenn != USHRT_MAX + //ab dieser Seite Checken. + + BOOL bPaint; //Painten oder nur Formatieren? + BOOL bComplete; //Alles bis zum sichtbaren Bereich Formatieren oder + //oder nur den sichtbaren Bereich? + BOOL bCalcLayout; //Vollstaendige Reformatierung? + BOOL bAgain; //Zur automatisch wiederholten Action wenn Seiten + //geloscht werden. + BOOL bNextCycle; //Wiederaufsetzen bei der ersten Ungueltigen Seite. + BOOL bInput; //Zum Abbrechen der Verarbeitung wenn ein Input anliegt. + BOOL bIdle; //True wenn die Layaction vom Idler ausgeloest wurde. + BOOL bReschedule; //Soll das Reschedule - abhaengig vom Progress - + //gerufen werden? + BOOL bCheckPages; //CheckPageDescs() ausfuehren oder verzoegern. + BOOL bUpdateExpFlds;//Wird gesetzt wenn nach dem Formatierien noch eine + //Runde fuer den ExpFld laufen muss. + BOOL bBrowseActionStop; //Action fruehzeitig beenden (per bInput) und den + //Rest dem Idler ueberlassen. + BOOL bWaitAllowed; //Wartecursor erlaubt? + BOOL bPaintExtraData; //Anzeige von Zeilennumerierung o. ae. eingeschaltet? + 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 ); + BOOL PaintWithoutFlys( const SwRect &, const SwCntntFrm *, + const SwPageFrm * ); + inline BOOL _PaintCntnt( const SwCntntFrm *, const SwPageFrm *, + const SwRect & ); + + BOOL FormatLayout( SwLayoutFrm *, BOOL bAddRect = TRUE ); + BOOL FormatLayoutTab( SwTabFrm *, BOOL bAddRect = TRUE ); + BOOL FormatCntnt( const SwPageFrm* pPage ); + void _FormatCntnt( const SwCntntFrm* pCntnt, + const SwPageFrm* pPage ); + BOOL IsShortCut( SwPageFrm *& ); + + BOOL TurboAction(); + BOOL _TurboAction( const SwCntntFrm * ); + void InternalAction(); + + SwPageFrm *CheckFirstVisPage( SwPageFrm *pPage ); + + BOOL RemoveEmptyBrowserPages(); + + inline void CheckIdleEnd(); + inline ULONG GetStartTicks() { return nStartTicks; } + +#endif + +public: + SwLayAction( SwRootFrm *pRt, SwViewImp *pImp ); + ~SwLayAction(); + +#ifdef _LAYACT_CXX + void SetIdle ( BOOL bNew ) { bIdle = bNew; } + void SetCheckPages ( BOOL bNew ) { bCheckPages = bNew; } + void SetBrowseActionStop(BOOL bNew ) { bBrowseActionStop = bNew; } + void SetNextCycle ( BOOL bNew ) { bNextCycle = bNew; } + + BOOL IsWaitAllowed() const { return bWaitAllowed; } + BOOL IsNextCycle() const { return bNextCycle; } + BOOL IsInput() const { return bInput; } + BOOL IsWait() const { return 0 != pWait; } + BOOL IsPaint() const { return bPaint; } + BOOL IsIdle() const { return bIdle; } + BOOL IsReschedule() const { return bReschedule; } + BOOL IsPaintExtraData() const { return bPaintExtraData;} + BOOL IsStopPrt() const; + BOOL IsInterrupt() const { return IsInput() || IsStopPrt(); } + + USHORT GetInputType() const { return nInputType; } +#endif + + //Einstellen der Action auf das gewuenschte Verhalten. + void SetPaint ( BOOL bNew ) { bPaint = bNew; } + void SetComplete ( BOOL bNew ) { bComplete = bNew; } + void SetStatBar ( BOOL bNew ); + void SetInputType ( USHORT nNew ) { nInputType = nNew; } + void SetCalcLayout ( BOOL bNew ) { bCalcLayout = bNew; } + void SetReschedule ( BOOL bNew ) { bReschedule = bNew; } + void SetWaitAllowed ( BOOL bNew ) { bWaitAllowed = bNew; } + + void SetAgain() { bAgain = TRUE; } + void SetUpdateExpFlds() {bUpdateExpFlds = TRUE; } + void SetProgress(SfxProgress * _pProgress = NULL) + { pProgress = _pProgress; } + + inline void SetCheckPageNum( USHORT nNew ); + inline void SetCheckPageNumDirect( USHORT nNew ) { nCheckPageNum = nNew; } + + void Action(); //Jetzt gehts loos... + void Reset(); //Zurueck auf CTor-Defaults. + + BOOL IsAgain() const { return bAgain; } + BOOL IsComplete() const { return bComplete; } + BOOL IsExpFlds() const { return bUpdateExpFlds; } + BOOL IsCalcLayout() const { return bCalcLayout; } + BOOL IsCheckPages() const { return bCheckPages; } + BOOL IsBrowseActionStop() const { return bBrowseActionStop; } + BOOL IsActionInProgress() const { return bActionInProgress; } + + USHORT 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; + BOOL FormatLayoutFly( SwFlyFrm * ); + // --> OD 2004-06-09 #i28701# - method is now public + 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. + BOOL bPageValid; // Konnte die Seite alles validiert werden? + BOOL bAllValid; // Konnte alles validiert werden? + +#ifdef DBG_UTIL + 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 + BOOL _DoIdleJob( const SwCntntFrm*, IdleJobType ); + BOOL DoIdleJob( IdleJobType, BOOL bVisAreaOnly ); + +#endif + +public: + SwLayIdle( SwRootFrm *pRt, SwViewImp *pImp ); + ~SwLayIdle(); +}; + +inline void SwLayAction::SetCheckPageNum( USHORT 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..2376a5fbb480 --- /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; + USHORT 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; } + USHORT& 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..28216e326b41 --- /dev/null +++ b/sw/source/core/inc/layfrm.hxx @@ -0,0 +1,209 @@ +/************************************************************************* + * + * 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 _LAYFRM_HXX +#define _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, BOOL bTst = FALSE, BOOL bInfo = FALSE ); + virtual SwTwips GrowFrm ( SwTwips, BOOL bTst = FALSE, BOOL bInfo = FALSE ); + + long CalcRel( const SwFmtFrmSize &rSz, 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, BOOL bAdjustAttributes ); + + void ChgColumns( const SwFmtCol &rOld, const SwFmtCol &rNew, + const BOOL bChgFtn = 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 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 BOOL bDontLeave, + const BOOL bBodyOnly = FALSE, + const BOOL bCalc = FALSE, + const SwCrsrMoveState *pCMS = 0, + const BOOL bDefaultExpand = TRUE ) const; + + SwLayoutFrm( SwFrmFmt* ); + ~SwLayoutFrm(); + + virtual void Paint( const SwRect&, const SwPrtOptions *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 ); + // <-- + BOOL IsAnLower( const SwFrm * ) const; + + const SwFrmFmt *GetFmt() const { return (const SwFrmFmt*)GetDep(); } + SwFrmFmt *GetFmt() { return (SwFrmFmt*)GetDep(); } + void SetFrmFmt( SwFrmFmt* ); + + //Verschieben der Ftns aller Lower - ab dem StartCntnt. + //TRUE wenn mindestens eine Ftn verschoben wurde. + //Ruft das Update der Seitennummer wenn bFtnNums gesetzt ist. + BOOL MoveLowerFtns( SwCntntFrm *pStart, SwFtnBossFrm *pOldBoss, + SwFtnBossFrm *pNewBoss, const 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 BOOL SwFrm::IsColBodyFrm() const +{ + return nType == FRMC_BODY && GetUpper()->IsColumnFrm(); +} + +inline 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 //_LAYFRM_HXX diff --git a/sw/source/core/inc/layouter.hxx b/sw/source/core/inc/layouter.hxx new file mode 100644 index 000000000000..4429e716578f --- /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 ); + 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 ); + BOOL HasEndnotes() const; + + void LoopControl( SwPageFrm* pPage, BYTE nLoop ); + void EndLoopControl(); + void LoopingLouieLight( const SwDoc& rDoc, const SwTxtFrm& rFrm ); + + static void CollectEndnotes( SwDoc* pDoc, SwSectionFrm* pSect ); + static BOOL Collecting( SwDoc* pDoc, SwSectionFrm* pSect, SwFtnFrm* pFtn ); + static 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/makefile.mk b/sw/source/core/inc/makefile.mk new file mode 100644 index 000000000000..1b35ca49549d --- /dev/null +++ b/sw/source/core/inc/makefile.mk @@ -0,0 +1,26 @@ +#************************************************************************* +# +# 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. +# +#************************************************************************* 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..ca98a089969d --- /dev/null +++ b/sw/source/core/inc/mvsave.hxx @@ -0,0 +1,231 @@ +/************************************************************************* + * + * 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 _MVSAVE_HXX +#define _MVSAVE_HXX + + +#include <tools/string.hxx> +#ifndef _KEYCOD_HXX //autogen +#include <vcl/keycod.hxx> +#endif +#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; + ULONG m_nNode1; + 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, ULONG nNode, xub_StrLen nCntnt, + SvULongs& rSaveArr, BYTE nSaveFly = 0 ); +void _RestoreCntntIdx( SwDoc* pDoc, SvULongs& rSaveArr, + ULONG nNode, xub_StrLen nOffset = 0, + BOOL bAuto = 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 +{ + ULONG nNdDiff; /// relative node difference + SwFrmFmt* pFrmFmt; /// the fly's frame format + sal_Bool bInsertPosition; /// if true, anchor _at_ insert position + + _SaveFly( 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; + ULONG nNode; + xub_StrLen nCntnt; + USHORT nType; // Insert/Move/Delete/... (UndoIds) + +public: + SwDataChanged( const SwPaM& rPam, USHORT nType ); + SwDataChanged( SwDoc* pDoc, const SwPosition& rPos, USHORT nType ); + ~SwDataChanged(); + + 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 an OldPos auf NewPos + Offset +void PaMCorrAbs( const SwPosition &rOldPos, + const SwPosition &rNewPos, + const xub_StrLen nOffset = 0 ); + + // Setzt alle PaMs in OldNode auf NewPos + Offset +void PaMCorrAbs( const SwNodeIndex &rOldNode, + const SwPosition &rNewPos, + const xub_StrLen nOffset = 0 ); + + // Setzt alle PaMs im Bereich vom Range nach NewPos +void PaMCorrAbs( const SwPaM& rRange, + const SwPosition& rNewPos ); + + // Setzt alle PaMs im Bereich von [StartNode, EndNode] nach NewPos +void PaMCorrAbs( const SwNodeIndex &rStartNode, + const SwNodeIndex &rEndNode, + 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; + UINT32 nOrdNum; + +public: + _ZSortFly( const SwFrmFmt* pFrmFmt, const SwFmtAnchor* pFlyAnchor, + UINT32 nArrOrdNum ); + _ZSortFly& operator=( const _ZSortFly& rCpy ) + { + pFmt = rCpy.pFmt, pAnchor = rCpy.pAnchor, nOrdNum = rCpy.nOrdNum; + return *this; + } + + int operator==( const _ZSortFly& ) const { return 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 // _MVSAVE_HXX + diff --git a/sw/source/core/inc/node2lay.hxx b/sw/source/core/inc/node2lay.hxx new file mode 100644 index 000000000000..6743458f91dc --- /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, ULONG nIdx ); + ~SwNode2Layout(); + SwFrm* NextFrm(); + SwLayoutFrm* UpperFrm( SwFrm* &rpFrm, const SwNode& rNode ); + void RestoreUpperFrms( SwNodes& rNds, ULONG nStt, ULONG nEnd ); + + SwFrm *GetFrm( const Point* pDocPos = 0, + const SwPosition *pPos = 0, + const BOOL bCalcFrm = 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..bf23966d1a3d --- /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; } + 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() {} + USHORT Count() const { return aList.Count(); } + void InsertURLNote( const String& rURL, const String& rTarget, + const SwRect& rRect ); + const SwURLNote& GetURLNote( USHORT 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..7782a6b90d98 --- /dev/null +++ b/sw/source/core/inc/notxtfrm.hxx @@ -0,0 +1,78 @@ +/************************************************************************* + * + * 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 _NOTXTFRM_HXX +#define _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(); +public: + SwNoTxtFrm( SwNoTxtNode * const ); + ~SwNoTxtFrm(); + + virtual void Modify( SfxPoolItem*, SfxPoolItem* ); + virtual void Paint(const SwRect&, const SwPrtOptions *pPrintData = NULL ) const; + virtual BOOL GetCharRect( SwRect &, const SwPosition&, + SwCrsrMoveState* = 0) const; + BOOL GetCrsrOfst(SwPosition* pPos, Point& aPoint, + SwCrsrMoveState* = 0) const; + + const Size &GetGrfSize() const { return GetSize(); } + void GetGrfArea( SwRect &rRect, SwRect * = 0, BOOL bMirror = TRUE ) const; + + BOOL IsTransparent() const; + + void StopAnimation( OutputDevice* = 0 ) const; + BOOL HasAnimation() const; + + // Routinen fuer den Grafik-Cache + USHORT 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/pagefrm.hxx b/sw/source/core/inc/pagefrm.hxx new file mode 100644 index 000000000000..bc2fef9b8be4 --- /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. + + USHORT nPhyPageNum; //Physikalische Seitennummer. + + BOOL bInvalidCntnt :1; + BOOL bInvalidLayout :1; + BOOL bInvalidFlyCntnt :1; + BOOL bInvalidFlyLayout :1; + BOOL bInvalidFlyInCnt :1; + BOOL bFtnPage :1; //Diese Seite ist fuer Dokumentende-Fussnoten. + BOOL bEmptyPage :1; //Dies ist eine explizite Leerseite + BOOL bEndNotePage :1; //'Fussnotenseite' fuer Endnoten + BOOL bInvalidSpelling :1; //Das Online-Spelling ist gefordert + BOOL bInvalidSmartTags :1; //checking for smarttags is needed // SMARTTAGS + BOOL bInvalidAutoCmplWrds :1; //Auto-Complete Wordliste aktualisieren + BOOL bInvalidWordCount :1; + 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( SfxPoolItem*, SfxPoolItem*, BYTE &, + 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(); + +public: + DECL_FIXEDMEMPOOL_NEWDEL(SwPageFrm) + + SwPageFrm( SwFrmFmt*, 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; + + BOOL IsEmptyPage() const { return bEmptyPage; } //explizite Leerseite. + + void UpdateFtnNum(); + + //Immer nach dem Paste rufen. Erzeugt die Seitengeb. Rahmen und Formatiert + //generischen Inhalt. + void PreparePage( 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 BOOL GetCrsrOfst( SwPosition *, Point&, + SwCrsrMoveState* = 0 ) const; + virtual void Modify( SfxPoolItem*, SfxPoolItem* ); + // erfrage vom Client Informationen + virtual BOOL GetInfo( SfxPoolItem& ) const; + + virtual void Cut(); + virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 ); + virtual void CheckDirection( BOOL bVert ); + void CheckGrid( BOOL bInvalidate ); + void PaintGrid( OutputDevice* pOut, SwRect &rRect ) const; + BOOL HasGrid() const { return bHasGrid; } + + //Zeilennummern usw malen + void RefreshExtraData( const SwRect & ) const; + + //Hilfslinien malen. + void RefreshSubsidiary( const SwRect& ) const; + + //Fussnotenschnittstelle + BOOL IsFtnPage() const { return bFtnPage; } + BOOL IsEndNotePage() const { return bEndNotePage; } + void SetFtnPage( BOOL b ) { bFtnPage = b; } + void SetEndNotePage( BOOL b ) { bEndNotePage = b; } + + inline USHORT GetPhyPageNum() const { return nPhyPageNum;} + inline void SetPhyPageNum( USHORT 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 BOOL IsInvalid() const; + inline BOOL IsInvalidFly() const; + BOOL IsInvalidFlyLayout() const { return bInvalidFlyLayout; } + BOOL IsInvalidFlyCntnt() const { return bInvalidFlyCntnt; } + BOOL IsInvalidFlyInCnt() const { return bInvalidFlyInCnt; } + BOOL IsInvalidLayout() const { return bInvalidLayout; } + BOOL IsInvalidCntnt() const { return (bInvalidCntnt || bInvalidFlyInCnt); } + BOOL IsInvalidSpelling() const { return bInvalidSpelling; } + BOOL IsInvalidSmartTags() const { return bInvalidSmartTags; } // SMARTTAGS + BOOL IsInvalidAutoCompleteWords() const { return bInvalidAutoCmplWrds; } + 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, USHORT 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 = TRUE; +} +inline void SwPageFrm::InvalidateFlyCntnt() const +{ + ((SwPageFrm*)this)->bInvalidFlyCntnt = TRUE; +} +inline void SwPageFrm::InvalidateFlyInCnt() const +{ + ((SwPageFrm*)this)->bInvalidFlyInCnt = TRUE; +} +inline void SwPageFrm::InvalidateLayout() const +{ + ((SwPageFrm*)this)->bInvalidLayout = TRUE; +} +inline void SwPageFrm::InvalidateCntnt() const +{ + ((SwPageFrm*)this)->bInvalidCntnt = TRUE; +} +inline void SwPageFrm::InvalidateSpelling() const +{ + ((SwPageFrm*)this)->bInvalidSpelling = TRUE; +} +// SMARTTAGS +inline void SwPageFrm::InvalidateSmartTags() const +{ + ((SwPageFrm*)this)->bInvalidSmartTags = TRUE; +} +inline void SwPageFrm::InvalidateAutoCompleteWords() const +{ + ((SwPageFrm*)this)->bInvalidAutoCmplWrds = TRUE; +} +inline void SwPageFrm::InvalidateWordCount() const +{ + ((SwPageFrm*)this)->bInvalidWordCount = TRUE; +} +inline void SwPageFrm::ValidateFlyLayout() const +{ + ((SwPageFrm*)this)->bInvalidFlyLayout = FALSE; +} +inline void SwPageFrm::ValidateFlyCntnt() const +{ + ((SwPageFrm*)this)->bInvalidFlyCntnt = FALSE; +} +inline void SwPageFrm::ValidateFlyInCnt() const +{ + ((SwPageFrm*)this)->bInvalidFlyInCnt = FALSE; +} +inline void SwPageFrm::ValidateLayout() const +{ + ((SwPageFrm*)this)->bInvalidLayout = FALSE; +} +inline void SwPageFrm::ValidateCntnt() const +{ + ((SwPageFrm*)this)->bInvalidCntnt = FALSE; +} +inline void SwPageFrm::ValidateSpelling() const +{ + ((SwPageFrm*)this)->bInvalidSpelling = FALSE; +} +// SMARTTAGS +inline void SwPageFrm::ValidateSmartTags() const +{ + ((SwPageFrm*)this)->bInvalidSmartTags = FALSE; +} +inline void SwPageFrm::ValidateAutoCompleteWords() const +{ + ((SwPageFrm*)this)->bInvalidAutoCmplWrds = FALSE; +} +inline void SwPageFrm::ValidateWordCount() const +{ + ((SwPageFrm*)this)->bInvalidWordCount = FALSE; +} + +inline BOOL SwPageFrm::IsInvalid() const +{ + return (bInvalidCntnt || bInvalidLayout || bInvalidFlyInCnt); +} +inline 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..e549011f18af --- /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*); +BOOL GoInDoc( SwPaM&, SwMoveFn); +BOOL GoInSection( SwPaM&, SwMoveFn); +BOOL GoInNode( SwPaM&, SwMoveFn); +BOOL GoInCntnt( SwPaM&, SwMoveFn); +BOOL GoInCntntCells( SwPaM&, SwMoveFn); +BOOL GoInCntntSkipHidden( SwPaM&, SwMoveFn); +BOOL GoInCntntCellsSkipHidden( SwPaM&, SwMoveFn); +const SwTxtAttr* GetFrwrdTxtHint( const SwpHints&, USHORT&, xub_StrLen ); +const SwTxtAttr* GetBkwrdTxtHint( const SwpHints&, USHORT&, xub_StrLen ); + +BOOL GoNext(SwNode* pNd, SwIndex * pIdx, USHORT nMode ); +BOOL GoPrevious(SwNode* pNd, SwIndex * pIdx, USHORT nMode ); +SW_DLLPUBLIC SwCntntNode* GoNextNds( SwNodeIndex * pIdx, BOOL ); +SwCntntNode* GoPreviousNds( SwNodeIndex * pIdx, BOOL ); + +// --------- Funktionsdefinitionen fuer die SwCrsrShell -------------- + +BOOL GoPrevPara( SwPaM&, SwPosPara); +BOOL GoCurrPara( SwPaM&, SwPosPara); +BOOL GoNextPara( SwPaM&, SwPosPara); +BOOL GoPrevSection( SwPaM&, SwPosSection); +BOOL GoCurrSection( SwPaM&, SwPosSection); +BOOL GoNextSection( SwPaM&, SwPosSection); + + +// ------------ Typedefiniton fuer Funktionen ---------------------- + +typedef BOOL (*GoNd)( SwNode*, SwIndex*, USHORT ); +typedef SwCntntNode* (*GoNds)( SwNodeIndex*, BOOL ); +typedef void (*GoDoc)( SwPosition* ); +typedef void (*GoSection)( SwPosition* ); +typedef BOOL (SwPosition:: *CmpOp)( const SwPosition& ) const; +typedef const SwTxtAttr* (*GetHint)( const SwpHints&, USHORT&, 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&, BOOL&, SwMoveFn, BOOL bInReadOnly = FALSE ); + + + +#endif diff --git a/sw/source/core/inc/prevwpage.hxx b/sw/source/core/inc/prevwpage.hxx new file mode 100644 index 000000000000..517f4494b44f --- /dev/null +++ b/sw/source/core/inc/prevwpage.hxx @@ -0,0 +1,36 @@ +#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/rootfrm.hxx b/sw/source/core/inc/rootfrm.hxx new file mode 100644 index 000000000000..ee894a0ef539 --- /dev/null +++ b/sw/source/core/inc/rootfrm.hxx @@ -0,0 +1,369 @@ +/************************************************************************* + * + * 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 _ROOTFRM_HXX +#define _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 + USHORT 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 BOOL bInPaint; //Schutz gegen doppelte Paints. + static BOOL bNoVirDev; //Bei SystemPaints kein virt. Device + + BOOL bCheckSuperfluous :1; //Leere Seiten suchen? + BOOL bIdleFormat :1; //Idle-Formatierer anwerfen? + BOOL bBrowseWidthValid :1; //Ist nBrowseWidth gueltig? + BOOL bDummy2 :1; //Unbenutzt + BOOL bTurboAllowed :1; + BOOL bAssertFlyPages :1; //Ggf. weitere Seiten fuer Flys einfuegen? + BOOL bDummy :1; //Unbenutzt + BOOL bIsVirtPageNum :1; //gibt es eine virtuelle Seitennummer ? + BOOL bIsNewLayout :1; //Layout geladen oder neu erzeugt. + 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; + + USHORT 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 ); + + //Virtuelles Device ausgeben (z.B. wenn Animationen ins Spiel kommen) + static BOOL FlushVout(); + //Clipping sparen, wenn im Vout eh genau das Cliprechteck ausgegeben wird + static BOOL HasSameRect( const SwRect& rRect ); + + SwRootFrm( SwFrmFmt*, ViewShell* ); + ~SwRootFrm(); + + 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( BOOL bVirDev = 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 BOOL GetCrsrOfst( SwPosition *, Point&, + SwCrsrMoveState* = 0 ) const; + + virtual void Paint( const SwRect&, const SwPrtOptions *pPrintData = NULL ) const; + virtual SwTwips ShrinkFrm( SwTwips, BOOL bTst = FALSE, BOOL bInfo = FALSE ); + virtual SwTwips GrowFrm ( SwTwips, BOOL bTst = FALSE, BOOL bInfo = 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, BOOL bNext ) const; + + virtual Size ChgSize( const Size& aNewSize ); + + void SetIdleFlags() { bIdleFormat = TRUE; } + BOOL IsIdleFormat() const { return bIdleFormat; } + void ResetIdleFormat() { bIdleFormat = 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 = TRUE; } + void AssertFlyPages(); + 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( BYTE 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 = TRUE; } + BOOL IsSuperfluous() const { return bCheckSuperfluous; } + void RemoveSuperfluous(); + + //abfragen/setzen der aktuellen Seite und der Gesamtzahl der Seiten. + //Es wird soweit wie notwendig Formatiert. + USHORT GetCurrPage( const SwPaM* ) const; + USHORT SetCurrPage( SwCursor*, USHORT nPageNum ); + Point GetPagePos( USHORT nPageNum ) const; + USHORT GetPageNum() const { return nPhyPageNums; } + void DecrPhyPageNums() { --nPhyPageNums; } + void IncrPhyPageNums() { ++nPhyPageNums; } + BOOL IsVirtPageNum() const { return bIsVirtPageNum; } + inline void SetVirtPageNum( const BOOL bOf ) const; + BOOL IsDummyPage( USHORT 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&, 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 = FALSE; } + void ResetTurboFlag() const { ((SwRootFrm*)this)->bTurboAllowed = TRUE; } + 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, BOOL bPageOnly = FALSE, + BOOL bEndNotes = FALSE ); + void CheckFtnPageDescs( BOOL bEndNote ); + + const SwPageFrm *GetLastPage() const { return pLastPage; } + SwPageFrm *GetLastPage() { return pLastPage; } + + static BOOL IsInPaint() { return bInPaint; } + + static void SetNoVirDev( const BOOL bNew ) { bNoVirDev = bNew; } + + inline long GetBrowseWidth() const; + void SetBrowseWidth( long n ) { bBrowseWidthValid = TRUE; nBrowseWidth = n;} + inline void InvalidateBrowseWidth(); + +#ifdef LONG_TABLE_HACK + void HackPrepareLongTblPaint( int nMode ); +#endif + + BOOL IsNewLayout() const { return bIsNewLayout; } + void ResetNewLayout() { bIsNewLayout = 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: + BOOL IsInDelList( SwSectionFrm* pSct ) const; // Ist der SectionFrm in der Liste enthalten? +#endif + + + void SetCallbackActionEnabled( BOOL b ) { bCallbackActionEnabled = b; } + 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 BOOL bOf) const +{ + ((SwRootFrm*)this)->bIsVirtPageNum = bOf; +} + +#endif //_ROOTFRM_HXX + diff --git a/sw/source/core/inc/rowfrm.hxx b/sw/source/core/inc/rowfrm.hxx new file mode 100644 index 000000000000..7f772e10913f --- /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, BOOL bTst = FALSE, BOOL bInfo = FALSE ); + virtual SwTwips GrowFrm ( SwTwips, BOOL bTst = FALSE, BOOL bInfo = FALSE ); + + const SwTableLine *pTabLine; + SwRowFrm* pFollowRow; + // --> collapsing borders FME 2005-05-27 #i29550# + USHORT mnTopMarginForLowers; + USHORT mnBottomMarginForLowers; + USHORT mnBottomLineSize; + // <-- collapsing + bool bIsFollowFlowRow; + bool bIsRepeatedHeadline; + bool mbIsRowSpanLine; + +protected: + virtual void MakeAll(); + +public: + SwRowFrm( const SwTableLine &, bool bInsertContent = true ); + ~SwRowFrm(); + + virtual void Cut(); + virtual void Modify( SfxPoolItem*, SfxPoolItem* ); + + //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 BOOL bHeight ); + + // + // + SwRowFrm* GetFollowRow() const { return pFollowRow; } + void SetFollowRow( SwRowFrm* pNew ) { pFollowRow = pNew; } + + // --> collapsing borders FME 2005-05-27 #i29550# + USHORT GetTopMarginForLowers() const { return mnTopMarginForLowers; } + void SetTopMarginForLowers( USHORT nNew ) { mnTopMarginForLowers = nNew; } + USHORT GetBottomMarginForLowers() const { return mnBottomMarginForLowers; } + void SetBottomMarginForLowers( USHORT nNew ) { mnBottomMarginForLowers = nNew; } + USHORT GetBottomLineSize() const { return mnBottomLineSize; } + void SetBottomLineSize( USHORT 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..07d58e5a72ef --- /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; + USHORT nWordType; + BOOL bClip; + +public: + SwScanner( const SwTxtNode& rNd, const String& rTxt, const LanguageType* pLang, + const ModelToViewHelper::ConversionMap* pConvMap, + USHORT nWordType, + xub_StrLen nStart, xub_StrLen nEnde, BOOL bClip = 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 + 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; + BYTE 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 BYTE GetDefaultDir() const { return nDefaultDir; }; + + // array operations, nCnt refers to array position + inline USHORT CountScriptChg() const; + inline xub_StrLen GetScriptChg( const USHORT nCnt ) const; + inline BYTE GetScriptType( const USHORT nCnt ) const; + + inline USHORT CountDirChg() const; + inline xub_StrLen GetDirChg( const USHORT nCnt ) const; + inline BYTE GetDirType( const USHORT nCnt ) const; + + inline USHORT CountKashida() const; + inline xub_StrLen GetKashida( const USHORT nCnt ) const; + + inline USHORT CountCompChg() const; + inline xub_StrLen GetCompStart( const USHORT nCnt ) const; + inline xub_StrLen GetCompLen( const USHORT nCnt ) const; + inline BYTE GetCompType( const USHORT nCnt ) const; + + inline USHORT CountHiddenChg() const; + inline xub_StrLen GetHiddenChg( const USHORT 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; + BYTE 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 BYTE* pLevel = 0 ) const; + BYTE DirType( const xub_StrLen nPos ) const; + +#if OSL_DEBUG_LEVEL > 1 + BYTE 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 USHORT 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 + USHORT 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 USHORT nCompress, const USHORT 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 +*/ + USHORT 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 +*/ + USHORT 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 USHORT 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 BYTE WhichFont( xub_StrLen nIdx, const String* pTxt, const SwScriptInfo* pSI ); +}; + +inline void SwScriptInfo::SetInvalidity( const xub_StrLen nPos ) +{ + if ( nPos < nInvalidityPos ) + nInvalidityPos = nPos; +}; +inline USHORT SwScriptInfo::CountScriptChg() const { return aScriptChg.Count(); } +inline xub_StrLen SwScriptInfo::GetScriptChg( const USHORT nCnt ) const +{ + ASSERT( nCnt < aScriptChg.Count(),"No ScriptChange today!"); + return aScriptChg[ nCnt ]; +} +inline BYTE SwScriptInfo::GetScriptType( const xub_StrLen nCnt ) const +{ + ASSERT( nCnt < aScriptChg.Count(),"No ScriptType today!"); + return aScriptType[ nCnt ]; +} + +inline USHORT SwScriptInfo::CountDirChg() const { return aDirChg.Count(); } +inline xub_StrLen SwScriptInfo::GetDirChg( const USHORT nCnt ) const +{ + ASSERT( nCnt < aDirChg.Count(),"No DirChange today!"); + return aDirChg[ nCnt ]; +} +inline BYTE SwScriptInfo::GetDirType( const xub_StrLen nCnt ) const +{ + ASSERT( nCnt < aDirChg.Count(),"No DirType today!"); + return aDirType[ nCnt ]; +} + +inline USHORT SwScriptInfo::CountKashida() const { return aKashida.Count(); } +inline xub_StrLen SwScriptInfo::GetKashida( const USHORT nCnt ) const +{ + ASSERT( nCnt < aKashida.Count(),"No Kashidas today!"); + return aKashida[ nCnt ]; +} + +inline USHORT SwScriptInfo::CountCompChg() const { return aCompChg.Count(); }; +inline xub_StrLen SwScriptInfo::GetCompStart( const USHORT nCnt ) const +{ + ASSERT( nCnt < aCompChg.Count(),"No CompressionStart today!"); + return aCompChg[ nCnt ]; +} +inline xub_StrLen SwScriptInfo::GetCompLen( const USHORT nCnt ) const +{ + ASSERT( nCnt < aCompChg.Count(),"No CompressionLen today!"); + return aCompLen[ nCnt ]; +} + +inline BYTE SwScriptInfo::GetCompType( const USHORT nCnt ) const +{ + ASSERT( nCnt < aCompChg.Count(),"No CompressionType today!"); + return aCompType[ nCnt ]; +} + +inline USHORT SwScriptInfo::CountHiddenChg() const { return aHiddenChg.Count(); }; +inline xub_StrLen SwScriptInfo::GetHiddenChg( const USHORT nCnt ) const +{ + ASSERT( nCnt < aHiddenChg.Count(),"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..3f677ec51932 --- /dev/null +++ b/sw/source/core/inc/sectfrm.hxx @@ -0,0 +1,148 @@ +/************************************************************************* + * + * 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( SfxPoolItem*, SfxPoolItem*, BYTE &, + SwAttrSetChg *pa = 0, SwAttrSetChg *pb = 0 ); + void _Cut( BOOL bRemove ); + // Is there a FtnContainer? + // An empty sectionfrm without FtnCont is superfluous + BOOL IsSuperfluous() const { return !ContainsAny() && !ContainsFtnCont(); } + void CalcFtnAtEndFlag(); + void CalcEndAtEndFlag(); + const SwSectionFmt* _GetEndSectFmt() const; + BOOL IsEndnoteAtMyEnd() const; +protected: + virtual void MakeAll(); + virtual BOOL ShouldBwdMoved( SwLayoutFrm *pNewUpper, BOOL bHead, BOOL &rReformat ); + virtual void Format( const SwBorderAttrs *pAttrs = 0 ); +public: + SwSectionFrm( SwSection & ); //Inhalt wird nicht erzeugt! + SwSectionFrm( SwSectionFrm &, BOOL bMaster );//_Nur_ zum Erzeugen von Master/Follows + ~SwSectionFrm(); + + void Init(); + virtual void CheckDirection( BOOL bVert ); + + virtual void Cut(); + virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 ); + virtual void Modify( SfxPoolItem*, SfxPoolItem* ); + + inline const SwSectionFrm *GetFollow() const; + inline SwSectionFrm *GetFollow(); + SwSectionFrm* FindMaster() const; + + SwCntntFrm *FindLastCntnt( BYTE nMode = 0 ); + inline const SwCntntFrm *FindLastCntnt( BYTE nMode = 0 ) const; + inline SwSection* GetSection() { return pSection; } + inline const SwSection* GetSection() const { return pSection; } + inline void ColLock() { bColLocked = TRUE; } + inline void ColUnlock() { bColLocked = FALSE; } + + void CalcFtnCntnt(); + void SimpleFormat(); + BOOL IsDescendantFrom( const SwSectionFmt* pSect ) const; + 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 + BOOL SplitSect( SwFrm* pFrm, BOOL bApres ); + void DelEmpty( BOOL bRemove ); // wie Cut(), Follow-Verkettung wird aber mitgepflegt + BOOL IsToIgnore() const // Keine Groesse, kein Inhalt, muss ignoriert werden + { return !Frm().Height() && !ContainsCntnt(); } + SwFtnContFrm* ContainsFtnCont( const SwFtnContFrm* pCont = NULL ) const; + BOOL Growable() const; + SwTwips _Shrink( SwTwips, BOOL bTst ); + SwTwips _Grow ( SwTwips, 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. + BOOL ToMaximize( BOOL bCheckFollow ) const; + inline BOOL _ToMaximize() const + { if( !pSection ) return FALSE; return ToMaximize( FALSE ); } + BOOL MoveAllowed( const SwFrm* ) const; + BOOL CalcMinDiff( SwTwips& rMinDiff ) const; + // Uebergibt man kein bOverSize bzw. FALSE, so ist der Returnwert + // >0 fuer Undersized-Frames, ==0 sonst. + // Uebergibt man 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( BOOL bOverSize = FALSE ); + // Groesse an die Umgebung anpassen + void _CheckClipping( BOOL bGrow, BOOL bMaximize ); + + void InvalidateFtnPos(); + void CollectEndnotes( SwLayouter* pLayouter ); + const SwSectionFmt* GetEndSectFmt() const + { if( IsEndnAtEnd() ) return _GetEndSectFmt(); return NULL; } + + static void MoveCntntAndDelete( SwSectionFrm* pDel, 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( BYTE 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..300929642f7a --- /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; + USHORT nHashS, nHashL; // Hash-Codes zum Checken + long nPos; // Dateiposition (SW2-Format) +public: + String aShort; // Short name + String aLong; // Long name + String aPackageName; // Package name + BOOL bIsOnlyTxtFlagInit : 1; // ist das Flag gueltig? + BOOL bIsOnlyTxt : 1; // unformatted text + 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 + USHORT nCur; // aktueller Index + BOOL bReadOnly : 1; + BOOL bInPutMuchBlocks : 1; // put serveral block entries + BOOL bInfoChanged : 1; // any Info of TextBlock is changed + + SwImpBlocks( const String&, BOOL = 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&, BOOL bOnlyTxt = FALSE ); + BOOL IsFileChanged() const; + void Touch(); + +public: + static USHORT Hash( const String& ); // Hashcode fuer Blocknamen + USHORT GetCount() const; // Anzahl Textbausteine ermitteln + USHORT GetIndex( const String& ) const; // Index fuer Kurznamen ermitteln + USHORT GetLongIndex( const String& ) const; //Index fuer Langnamen ermitteln + const String& GetShortName( USHORT ) const; // Kurzname fuer Index zurueck + const String& GetLongName( USHORT ) const; // Langname fuer Index zurueck + const String& GetPackageName( USHORT ) const; // Langname fuer Index zurueck + + const String& GetFileName() const {return aFile;} // phys. Dateinamen liefern + void SetName( const String& rName ) // logic name + { aName = rName; bInfoChanged = TRUE; } + const String & GetName( void ) + { return aName; } + + const String& GetBaseURL() const { return sBaseURL;} + void SetBaseURL( const String& rURL ) { sBaseURL = rURL; } + + virtual ULONG Delete( USHORT ) = 0; + virtual ULONG Rename( USHORT, const String&, const String& ) = 0; + virtual ULONG CopyBlock( SwImpBlocks& rImp, String& rShort, const String& rLong) = 0; + virtual ULONG GetDoc( USHORT ) = 0; + virtual ULONG GetDocForConversion( USHORT ); + virtual ULONG BeginPutDoc( const String&, const String& ) = 0; + virtual ULONG PutDoc() = 0; + virtual ULONG GetText( USHORT, String& ) = 0; + virtual ULONG PutText( const String&, const String&, const String& ) = 0; + virtual ULONG MakeBlockList() = 0; + + virtual ULONG OpenFile( BOOL bReadOnly = TRUE ) = 0; + virtual void CloseFile() = 0; + + virtual BOOL IsOnlyTextBlock( const String& rShort ) const; + + virtual ULONG GetMacroTable( USHORT nIdx, SvxMacroTableDtor& rMacroTbl, + sal_Bool bFileAlreadyOpen = sal_False ); + virtual ULONG SetMacroTable( USHORT nIdx, + const SvxMacroTableDtor& rMacroTbl, + sal_Bool bFileAlreadyOpen = sal_False ); + virtual BOOL PutMuchEntries( BOOL bOn ); +}; + +/* +class Sw3Persist : public SvPersist +{ + virtual void FillClass( SvGlobalName * pClassName, + ULONG * pClipFormat, + String * pAppName, + String * pLongUserName, + String * pUserName, + sal_Int32 nFileFormat=SOFFICE_FILEFORMAT_CURRENT ) const; + virtual BOOL Save(); + virtual 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 + USHORT nNamedFmts; // benannte Formate + USHORT nColls; // Text-Collections + USHORT nBlks; // Anzahl Elemente im CONTENTS-Record +public: + Sw2TextBlocks( const String& ); + virtual ~Sw2TextBlocks(); + virtual ULONG Delete( USHORT ); + virtual ULONG Rename( USHORT, const String&, const String& ); + virtual ULONG CopyBlock( SwImpBlocks& rImp, String& rShort, const String& rLong); + virtual ULONG GetDoc( USHORT ); + virtual ULONG BeginPutDoc( const String&, const String& ); + virtual ULONG PutDoc(); + virtual ULONG GetText( USHORT, String& ); + virtual ULONG PutText( const String&, const String&, const String& ); + virtual ULONG MakeBlockList(); + virtual short GetFileType( ) const; + ULONG LoadDoc(); + + virtual ULONG OpenFile( BOOL bReadOnly = TRUE ); + virtual void CloseFile(); + + void StatLineStartPercent(); // zum Anzeigen des Prozessbars +}; + +class Sw3Io; +class Sw3IoImp; + +class Sw3TextBlocks : public SwImpBlocks +{ + Sw3Io* pIo3; + Sw3IoImp* pImp; + BOOL bAutocorrBlock; + +public: + Sw3TextBlocks( const String& ); + Sw3TextBlocks( SvStorage& ); + virtual ~Sw3TextBlocks(); + virtual ULONG Delete( USHORT ); + virtual ULONG Rename( USHORT, const String&, const String& ); + virtual ULONG CopyBlock( SwImpBlocks& rImp, String& rShort, const String& rLong); + virtual ULONG GetDoc( USHORT ); + virtual ULONG GetDocForConversion( USHORT ); + virtual ULONG BeginPutDoc( const String&, const String& ); + virtual ULONG PutDoc(); + virtual void SetDoc( SwDoc * pNewDoc); + virtual ULONG GetText( USHORT, String& ); + virtual ULONG PutText( const String&, const String&, const String& ); + virtual ULONG MakeBlockList(); + virtual short GetFileType( ) const; + + virtual ULONG OpenFile( BOOL bReadOnly = TRUE ); + virtual void CloseFile(); + + // Methoden fuer die neue Autokorrektur + ULONG GetText( const String& rShort, String& ); + SwDoc* GetDoc() const { return pDoc; } + + virtual BOOL IsOnlyTextBlock( const String& rShort ) const; + + virtual ULONG GetMacroTable( USHORT, SvxMacroTableDtor& rMacroTbl, + sal_Bool bFileAlreadyOpen = sal_False ); + virtual ULONG SetMacroTable( USHORT 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..90803b515080 --- /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 USHORT nMax; //Mehr sollen nicht aufgenommen werden, + //der Cache kann aber dynamisch um jeweils + //nMax vergroessert werden. + USHORT 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 BYTE hineinstecken!!! +#ifdef DBG_UTIL + SwCache( const USHORT nInitSize, const USHORT nGrowSize, + const ByteString &rNm ); + ~SwCache(); +#else + SwCache( const USHORT nInitSize, const USHORT nGrowSize ); +#endif + + void Flush( const BYTE nPercent = 100 ); + + //bToTop == FALSE -> Keine LRU-Umsortierung! + SwCacheObj *Get( const void *pOwner, const BOOL bToTop = TRUE ); + SwCacheObj *Get( const void *pOwner, const USHORT nIndex, + const BOOL bToTop = TRUE ); + void ToTop( SwCacheObj *pObj ); + + BOOL Insert( SwCacheObj *pNew ); + void Delete( const void *pOwner ); +// void Delete( const void *pOwner, const USHORT nIndex ); + + void SetLRUOfst( const USHORT nOfst ); //nOfst sagt wieviele unangetastet + //bleiben sollen. + void ResetLRUOfst() { pFirst = pRealFirst; } + + inline void IncreaseMax( const USHORT nAdd ); + inline void DecreaseMax( const USHORT nSub ); + USHORT 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 USHORT 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; + + USHORT nCachePos; //Position im Cache-Array. + + BYTE 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 USHORT 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 BOOL IsOwner( const void *pNew ) const; + + inline USHORT GetCachePos() const { return nCachePos; } + inline void Invalidate() { pOwner = 0; } + + inline 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, BOOL bSeek = TRUE ); + inline SwCacheAccess( SwCache &rCache, const void *pOwner, const USHORT nIndex ); + +public: + virtual ~SwCacheAccess(); + + virtual BOOL IsAvailable() const; + + //Abkuerzung fuer diejenigen, die wissen, das die Ableitung das IsAvailable + //nicht ueberladen haben. + BOOL IsAvail() const { return pObj != 0; } +}; + +inline void SwCache::IncreaseMax( const USHORT nAdd ) +{ + nCurMax = nCurMax + sal::static_int_cast< USHORT >(nAdd); +#ifdef DBG_UTIL + ++nIncreaseMax; +#endif +} +inline void SwCache::DecreaseMax( const USHORT nSub ) +{ + if ( nCurMax > nSub ) + nCurMax = nCurMax - sal::static_int_cast< USHORT >(nSub); +#ifdef DBG_UTIL + ++nDecreaseMax; +#endif +} + +inline 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, 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 USHORT 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..201c64149e05 --- /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 + USHORT nFntIndex; // Index im Fontcache + USHORT nOrgHeight; // Hoehe inkl. Escapement/Proportion + USHORT nOrgAscent; // Ascent inkl. Escapement/Proportion + USHORT nPropWidth; // proportional width + inline SwSubFont() : aSize(0,0) + { pMagic = NULL; nFntIndex = nOrgHeight = nOrgAscent = 0; nPropWidth =100; } + + USHORT CalcEscAscent( const USHORT nOldAscent ) const; + USHORT CalcEscHeight( const USHORT nOldHeight, + const USHORT nOldAscent ) const; + void CalcEsc( SwDrawTextInfo& rInf, Point& rPos ); + + inline void CopyMagic( const SwSubFont& rFnt ) + { pMagic = rFnt.pMagic; nFntIndex = rFnt.nFntIndex; } + + BOOL operator==( const SwFont &rFnt ) const; + SwSubFont& operator=( const SwSubFont &rFont ); + + short _CheckKerning( ); + + BOOL ChgFnt( ViewShell *pSh, OutputDevice& rOut ); + BOOL IsSymbol( ViewShell *pSh ); + USHORT GetAscent( ViewShell *pSh, const OutputDevice& rOut ); + USHORT GetHeight( ViewShell *pSh, const OutputDevice& rOut ); + Size _GetTxtSize( SwDrawTextInfo& rInf ); + Size GetCapitalSize( SwDrawTextInfo& rInf ); + void _DrawText( SwDrawTextInfo &rInf, const 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 BOOL bOutline ); + inline void SetVertical( const USHORT nDir, const BOOL bVertFormat ); + inline void SetShadow( const BOOL bShadow ); + inline void SetAutoKern( const BYTE nAutoKern ); + inline void SetWordLineMode( const 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 BYTE 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 USHORT nNew ) + { pMagic = 0; nPropWidth = nNew; } +public: + USHORT 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 + BYTE nToxCnt; // Zaehlt die Schachtelungstiefe der Tox + BYTE nRefCnt; // Zaehlt die Schachtelungstiefe der Refs + BYTE m_nMetaCount; // count META/METAFIELD + BYTE nActual; // actual font (Latin, CJK or CTL) + + // Schalter fuer die Font-Extensions + BOOL bNoHyph :1; // SwTxtNoHyphenHere: keine Trennstelle + BOOL bBlink :1; // blinkender Font + BOOL bPaintBlank :1; // Blanks nicht mit DrawRect + BOOL bFntChg :1; + BOOL bOrgChg :1; // nOrgHeight/Ascent sind invalid + BOOL bURL :1; + BOOL bPaintWrong :1; // Flag fuer Rechtschreibfehler + BOOL bGreyWave :1; // Fuers extended TextInput: Graue Wellenlinie + BOOL bNoColReplace :1; // Replacement without colormanipulation + + 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 BYTE GetActual() const { return nActual; } + inline void SetActual( BYTE nNew ); + inline const SvxFont& GetActualFont() const { return aSub[nActual]; } + + // holt sich eine MagicNumber ueber SwFntAccess + void GoMagic( ViewShell *pSh, BYTE nWhich ); + // set background color + void SetBackColor( Color* pNewColor ); + inline const Color* GetBackColor() const{ return pBackColor; } + + inline void ChkMagic( ViewShell *pSh, BYTE nWhich ) + { if( !aSub[ nWhich ].pMagic ) GoMagic( pSh, nWhich ); } + // uebernimmt die MagicNumber eines (hoffentlich ident.) Kollegen + inline void CopyMagic( const SwFont* pFnt, BYTE nWhich ) + { aSub[nWhich].CopyMagic( pFnt->aSub[nWhich] ); } + inline void GetMagic( const void* &rMagic, USHORT &rIdx, BYTE nWhich ) + { rMagic = aSub[nWhich].pMagic; rIdx = aSub[nWhich].nFntIndex; } + inline void SetMagic( const void* pNew, const USHORT nIdx, BYTE nWhich ) + { aSub[nWhich].pMagic = pNew; aSub[nWhich].nFntIndex = nIdx; } + inline BOOL DifferentMagic( const SwFont* pFnt, BYTE nWhich ) + { return aSub[nWhich].pMagic != pFnt->aSub[nWhich].pMagic || + !aSub[nWhich].pMagic || !pFnt->aSub[nWhich].pMagic; } + + inline const Size &GetSize( BYTE nWhich ) const + { return aSub[nWhich].aSize; } + inline BOOL IsFntChg() const { return bFntChg; } + inline void SetFntChg( const BOOL bNew ) { bFntChg = bNew; } + + // die gekapselten SV-Font-Methoden (setzen bFntChg auf 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 BOOL bOutline ); + void SetVertical( USHORT nDir, const BOOL nVertLayout = FALSE ); + inline void SetShadow( const BOOL bShadow ); + inline void SetAutoKern( BYTE nAutoKern ); + inline void SetTransparent( const BOOL bTrans ); + inline void SetWordLineMode( const 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 BYTE nNewPropr ); + + inline void SetPropWidth( const USHORT nNew ); + + inline void SetFamily( const FontFamily eFamily, const BYTE nWhich ); + inline void SetName( const XubString& rName, const BYTE nWhich ); + inline void SetStyleName( const XubString& rStyleName, const BYTE nWhich ); + inline void SetSize( const Size& rSize, const BYTE nWhich ); + inline void SetWeight( const FontWeight eWeight, const BYTE nWhich ); + inline void SetItalic( const FontItalic eItalic, const BYTE nWhich ); + inline void SetLanguage( LanguageType eNewLang, const BYTE nWhich ); + inline void SetCharSet( const CharSet eCharSet, const BYTE nWhich ); + inline void SetPitch( const FontPitch ePitch, const BYTE nWhich ); + inline void SetRelief( const FontRelief eNew ); + + // Get/Set-Methoden fuer die aktuelle Einstellung + inline void SetNoHyph( const BOOL bNew ); + inline BOOL IsNoHyph() const { return bNoHyph; } + inline void SetBlink( const BOOL bBlink ); + inline BOOL IsBlink() const { return bBlink; } + inline BYTE &GetTox() { return nToxCnt; } + inline BYTE GetTox() const { return nToxCnt; } + inline BOOL IsTox() const { return ( 0 != nToxCnt ); } + inline BYTE &GetRef() { return nRefCnt; } + inline BYTE GetRef() const { return nRefCnt; } + inline BOOL IsRef() const { return ( 0 != nRefCnt ); } + inline BYTE &GetMeta() { return m_nMetaCount; } + inline BYTE GetMeta() const { return m_nMetaCount; } + inline bool IsMeta() const { return (0 != m_nMetaCount); } + inline void SetURL( const BOOL bURL ); + inline BOOL IsURL() const { return bURL; } + inline void SetGreyWave( const BOOL bNew ); + inline BOOL IsGreyWave() const { return bGreyWave; } + inline void SetNoCol( const BOOL bNew ); + inline BOOL IsNoCol() const { return bNoColReplace; } + + inline void SetPaintBlank( const BOOL bNew ); + inline BOOL IsPaintBlank() const { return bPaintBlank; } + inline void SetPaintWrong( const BOOL bNew ); + inline BOOL IsPaintWrong() const { return bPaintWrong; } + + // Setzen der Basisklasse Font fuer SwTxtCharFmt + void SetDiffFnt( const SfxItemSet* pSet, + const IDocumentSettingAccess* pIDocumentSettingAccess ); + + inline const SvxFont &GetFnt( const BYTE nWhich ) const + { return aSub[nWhich]; }; + + 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(); } + BOOL IsShadow() const { return aSub[nActual].IsShadow(); } + BOOL IsWordLineMode() const { return aSub[nActual].IsWordLineMode(); } + BOOL IsOutline() const { return aSub[nActual].IsOutline(); } + BOOL IsKerning() const { return aSub[nActual].IsKerning(); } + short GetEscapement() const { return aSub[nActual].GetEscapement(); } + SvxCaseMap GetCaseMap() const { return aSub[nActual].GetCaseMap(); } + BYTE 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(); } + USHORT GetPropWidth() const { return aSub[nActual].GetPropWidth(); } + USHORT GetOrientation( const BOOL nVertLayout = FALSE ) const; + + inline const XubString& GetName( const BYTE nWhich ) const + { return aSub[nWhich].GetName(); } + inline LanguageType GetLanguage( const BYTE nWhich ) const + { return aSub[nWhich].GetLanguage(); } + inline const XubString& GetStyleName( const BYTE nWhich ) const + { return aSub[nWhich].GetStyleName(); } + inline FontFamily GetFamily( const BYTE nWhich ) const + { return aSub[nWhich].GetFamily(); } + inline FontItalic GetItalic( const BYTE nWhich ) const + { return aSub[nWhich].GetItalic(); } + inline FontPitch GetPitch( const BYTE nWhich ) const + { return aSub[nWhich].GetPitch(); } + inline rtl_TextEncoding GetCharSet( const BYTE nWhich ) const + { return aSub[nWhich].GetCharSet(); } + inline long GetHeight( const BYTE nWhich ) const + { return aSub[nWhich].GetSize().Height(); } + inline FontWeight GetWeight( const BYTE nWhich ) const + { return aSub[nWhich].GetWeight(); } + inline FontEmphasisMark GetEmphasisMark( const BYTE 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 USHORT GetAscent( ViewShell *pSh, const OutputDevice& rOut ) + { return aSub[nActual].GetAscent( pSh, rOut ); } + inline USHORT GetHeight( ViewShell *pSh, const OutputDevice& rOut ) + { return aSub[nActual].GetHeight( pSh, rOut ); } + + inline void Invalidate() + { bFntChg = bOrgChg = TRUE; } +}; + +inline void SwFont::SetColor( const Color& rColor ) +{ + bFntChg = 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 = 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 BYTE nWhich ) +{ + bFntChg = 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 BYTE nWhich ) +{ + bFntChg = 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 BYTE nWhich ) +{ + bFntChg = 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 BYTE nWhich ) +{ + bFntChg = 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 BYTE nWhich ) +{ + bFntChg = 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 = 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 BYTE nWhich ) +{ + bFntChg = 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 = 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 = 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 = 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 BYTE nWhich ) +{ + bFntChg = TRUE; + aSub[nWhich].SetItalic( eItalic ); +} + +// gekapselte SV-Font-Methode +inline void SwSubFont::SetOutline( const BOOL bOutline ) +{ + pMagic = 0; + Font::SetOutline( bOutline ); +} + +inline void SwFont::SetOutline( const BOOL bOutline ) +{ + bFntChg = TRUE; + aSub[0].SetOutline( bOutline ); + aSub[1].SetOutline( bOutline ); + aSub[2].SetOutline( bOutline ); +} + +// gekapselte SV-Font-Methode +inline void SwSubFont::SetShadow( const BOOL bShadow ) +{ + pMagic = 0; + Font::SetShadow( bShadow ); +} + +inline void SwFont::SetShadow( const BOOL bShadow ) +{ + bFntChg = TRUE; + aSub[0].SetShadow( bShadow ); + aSub[1].SetShadow( bShadow ); + aSub[2].SetShadow( bShadow ); +} + +// gekapselte SV-Font-Methode +inline void SwSubFont::SetAutoKern( const BYTE nAutoKern ) +{ + pMagic = 0; + Font::SetKerning( nAutoKern ); +} + +inline void SwFont::SetAutoKern( BYTE nAutoKern ) +{ + bFntChg = TRUE; + aSub[1].SetAutoKern( nAutoKern ); + if( nAutoKern ) + nAutoKern = KERNING_FONTSPECIFIC; + aSub[0].SetAutoKern( nAutoKern ); + aSub[2].SetAutoKern( nAutoKern ); +} + +inline void SwFont::SetTransparent( const 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 BOOL bWordLineMode ) +{ + pMagic = 0; + Font::SetWordLineMode( bWordLineMode ); +} + +inline void SwFont::SetWordLineMode( const BOOL bWordLineMode ) +{ + bFntChg = 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 = TRUE; + aSub[0].SetEmphasisMark( eValue ); + aSub[1].SetEmphasisMark( eValue ); + aSub[2].SetEmphasisMark( eValue ); +} + +inline void SwFont::SetPropWidth( const USHORT nNew ) +{ + if( nNew != aSub[0].GetPropWidth() ) + { + bFntChg = 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 = 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 BYTE nWhich ) +{ + if( aSub[nWhich].aSize != rSize ) + { + aSub[nWhich].SetSize( rSize ); + bFntChg = TRUE; + bOrgChg = TRUE; + } +} + +inline void SwFont::SetActual( BYTE nNew ) +{ + if ( nActual != nNew ) + { + bFntChg = TRUE; + bOrgChg = TRUE; + nActual = nNew; + } +} + +inline void SwSubFont::SetProportion( const BYTE nNewPropr ) +{ + pMagic = 0; + Font::SetSize( Size( (long) aSize.Width() * nNewPropr / 100L, + (long) aSize.Height() * nNewPropr / 100L ) ); + SvxFont::SetPropr( nNewPropr ); +} + +inline void SwFont::SetProportion( const BYTE nNewPropr ) +{ + if( nNewPropr != aSub[0].GetPropr() ) + { + bFntChg = TRUE; + bOrgChg = 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 = TRUE; + bOrgChg = 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 BYTE 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 BOOL bNew ) +{ + bPaintBlank = bNew; +} + +inline void SwFont::SetPaintWrong( const BOOL bNew ) +{ + bPaintWrong = bNew; +} + +inline void SwFont::SetNoHyph( const BOOL bNew ) +{ + bNoHyph = bNew; +} + +inline void SwFont::SetBlink( const BOOL bNew ) +{ + bBlink = bNew; +} + +inline void SwFont::SetURL( const BOOL bNew ) +{ + bURL = bNew; +} + +inline void SwFont::SetGreyWave( const BOOL bNew ) +{ + bGreyWave = bNew; +} + +inline void SwFont::SetNoCol( const BOOL bNew ) +{ + bNoColReplace = bNew; +} + +inline void SwSubFont::SetVertical( const USHORT nDir, const 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: + USHORT nGetTextSize; + USHORT nDrawText; + USHORT nGetStretchTextSize; + USHORT nDrawStretchText; + USHORT nChangeFont; + USHORT nGetFontMetric; + + inline void Reset() + { + nGetTextSize = nDrawText = nGetStretchTextSize = + nDrawStretchText = nChangeFont = nGetFontMetric = 0; + } + + inline SvStatistics() { Reset(); } + + inline void PrintOn( SvStream &rOS ) const; //$ ostream + inline 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..3f55c6bdf0ec --- /dev/null +++ b/sw/source/core/inc/tabfrm.hxx @@ -0,0 +1,233 @@ +/************************************************************************* + * + * 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 _TABFRM_HXX +#define _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, BOOL bFwd ); + + SwTable* pTable; + + BOOL bComplete :1; //Eintrage als Repaint ohne das CompletePaint + //der Basisklasse gesetzt werden muss. Damit + //sollen unertraegliche Tabellen-Repaints + //vermieden werden. + BOOL bCalcLowers :1; //Im MakeAll auf jedenfall auch fuer Stabilitaet + //des Inhaltes sorgen. + BOOL bLowersFormatted :1;//Kommunikation zwischen MakeAll und Layact + BOOL bLockBackMove :1; //BackMove-Test hat der Master erledigt. + 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# + 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. + + BOOL bHasFollowFlowLine :1; // Means that the first line in the follow + // is indented to contain content from a broken + // cell + 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 + 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 + BOOL bRemoveFollowFlowLinePending :1; + // --> OD 2004-10-04 #i26945# + 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# + BOOL bObjsDoesFit :1; // For splitting table rows algorithm, this boolean + // indicates, if the floating screen objects fits + // <-- + 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( SfxPoolItem*, SfxPoolItem*, BYTE &, + SwAttrSetChg *pa = 0, SwAttrSetChg *pb = 0 ); + + virtual BOOL ShouldBwdMoved( SwLayoutFrm *pNewUpper, BOOL bHead, BOOL &rReformat ); + +protected: + virtual void MakeAll(); + virtual void Format( const SwBorderAttrs *pAttrs = 0 ); + //Aendert nur die Framesize, nicht die PrtArea-SSize + virtual SwTwips GrowFrm ( SwTwips, BOOL bTst = FALSE, BOOL bInfo = FALSE ); +public: + SwTabFrm( SwTable & ); //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 void Modify( SfxPoolItem*, SfxPoolItem* ); + virtual BOOL GetInfo( SfxPoolItem &rHnt ) const; + virtual void Paint( const SwRect&, const SwPrtOptions *pPrintData = NULL ) const; + virtual void CheckDirection( 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; } + + BOOL IsComplete() { return bComplete; } + void SetComplete() { bComplete = TRUE; } + void ResetComplete() { bComplete = FALSE; } + + BOOL IsLowersFormatted() const { return bLowersFormatted; } + void SetLowersFormatted( BOOL b ) { bLowersFormatted = b; } + + void SetCalcLowers() { bCalcLowers = TRUE; } //Sparsam einsetzen! + void SetResizeHTMLTable() { bResizeHTMLTable = TRUE; } //dito + void SetONECalcLowers() { bONECalcLowers = TRUE; } + + // + // Start: New stuff for breaking table rows + // + BOOL HasFollowFlowLine() const { return bHasFollowFlowLine; } + void SetFollowFlowLine( BOOL bNew ) { bHasFollowFlowLine = bNew; } + + BOOL IsRebuildLastLine() const { return bIsRebuildLastLine; } + void SetRebuildLastLine( BOOL bNew ) { bIsRebuildLastLine = bNew; } + + BOOL IsRestrictTableGrowth() const { return bRestrictTableGrowth; } + void SetRestrictTableGrowth( BOOL bNew ) { bRestrictTableGrowth = bNew; } + + BOOL IsRemoveFollowFlowLinePending() const { return bRemoveFollowFlowLinePending; } + void SetRemoveFollowFlowLinePending( BOOL bNew ) { bRemoveFollowFlowLinePending = bNew; } + + // --> OD 2004-10-04 #i26945# + BOOL IsConsiderObjsForMinCellHeight() const + { + return bConsiderObjsForMinCellHeight; + } + void SetConsiderObjsForMinCellHeight( BOOL _bNewConsiderObjsForMinCellHeight ) + { + bConsiderObjsForMinCellHeight = _bNewConsiderObjsForMinCellHeight; + } + // <-- + // --> OD 2004-10-04 #i26945# + BOOL DoesObjsFit() const + { + return bObjsDoesFit; + } + void SetDoesObjsFit( BOOL _bNewObjsDoesFit ) + { + bObjsDoesFit = _bNewObjsDoesFit; + } + // <-- + + bool RemoveFollowFlowLine(); + // + // End: New stuff for breaking table rows + // + + 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: + USHORT 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 //_TABFRM_HXX diff --git a/sw/source/core/inc/tblrwcl.hxx b/sw/source/core/inc/tblrwcl.hxx new file mode 100644 index 000000000000..6100ee41a422 --- /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: +BOOL lcl_CopyRow( const _FndLine*& rpFndLine, void* pPara ); +BOOL lcl_CopyCol( const _FndBox*& rpFndBox, void* pPara ); + +BOOL lcl_MergeGCBox( const SwTableBox*& rpBox, void* pPara ); +BOOL lcl_MergeGCLine( const SwTableLine*& rpLine, void* pPara ); + +BOOL lcl_Merge_MoveBox( const _FndBox*& rpFndBox, void* pPara ); +BOOL lcl_Merge_MoveLine( const _FndLine*& rpFndLine, void* pPara ); + +BOOL lcl_CopyBoxToDoc( const _FndBox*& rpFndBox, void* pPara ); +BOOL lcl_CopyLineToDoc( const _FndLine*& rpFndLn, void* pPara ); + +BOOL lcl_BoxSetHeadCondColl( const SwTableBox*& rpBox, void* pPara ); +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, USHORT nInsPos, USHORT nCnt = 1 ); + +SW_DLLPUBLIC void _DeleteBox( SwTable& rTbl, SwTableBox* pBox, SwUndo* pUndo = 0, + BOOL bCalcNewSize = TRUE, const BOOL bCorrBorder = 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; + USHORT nMode, nWidth; + BOOL bGetFromTop : 1; + BOOL bGetValues : 1; + +public: + SwCollectTblLineBoxes( BOOL bTop, USHORT nMd = 0, SwHistory* pHist=0 ) + : aPosArr( 16, 16 ), aBoxes( 16, 16 ), + pHst( pHist ), nMode( nMd ), nWidth( 0 ), + bGetFromTop( bTop ), bGetValues( TRUE ) + + {} + + void AddBox( const SwTableBox& rBox ); + const SwTableBox* GetBoxOfPos( const SwTableBox& rBox ); + void AddToUndoHistory( const SwCntntNode& rNd ); + + USHORT Count() const { return aBoxes.Count(); } + const SwTableBox& GetBox( USHORT nPos, USHORT* pWidth = 0 ) const + { + // hier wird die EndPos der Spalte benoetigt! + if( pWidth ) + *pWidth = nPos+1 == aPosArr.Count() ? nWidth + : aPosArr[ nPos+1 ]; + return *aBoxes[ nPos ]; + } + + BOOL IsGetFromTop() const { return bGetFromTop; } + BOOL IsGetValues() const { return bGetValues; } + + USHORT GetMode() const { return nMode; } + void SetValues( BOOL bFlag ) { bGetValues = FALSE; nWidth = 0; + bGetFromTop = bFlag; } + BOOL Resize( USHORT nOffset, USHORT nWidth ); +}; + +BOOL lcl_Box_CollectBox( const SwTableBox*& rpBox, void* pPara ); +BOOL lcl_Line_CollectBox( const SwTableLine*& rpLine, void* pPara ); + +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 +{ + USHORT mnSplitLine; // the line number where the table has been splitted + std::vector< long > mnRowSpans; // the row span attributes in this line + SwSaveRowSpan( SwTableBoxes& rBoxes, USHORT nSplitLn ); +}; + +struct _SwGCLineBorder +{ + const SwTableLines* pLines; + SwShareBoxFmts* pShareFmts; + USHORT nLinePos; + + _SwGCLineBorder( const SwTable& rTable ) + : pLines( &rTable.GetTabLines() ), pShareFmts(0), nLinePos( 0 ) {} + + _SwGCLineBorder( const SwTableBox& rBox ) + : pLines( &rBox.GetTabLines() ), pShareFmts(0), nLinePos( 0 ) {} + BOOL IsLastLine() const { return nLinePos + 1 >= pLines->Count(); } +}; + +class _SwGCBorder_BoxBrd +{ + const SvxBorderLine* pBrdLn; + BOOL bAnyBorderFnd; +public: + _SwGCBorder_BoxBrd() : pBrdLn( 0 ), bAnyBorderFnd( FALSE ) {} + + void SetBorder( const SvxBorderLine& rBorderLine ) + { pBrdLn = &rBorderLine; bAnyBorderFnd = FALSE; } + + // checke, ob die linke Border dieselbe wie die gesetzte ist + // returnt FALSE falls gar keine Border gesetzt ist + BOOL CheckLeftBorderOfFormat( const SwFrmFmt& rFmt ); + + BOOL IsAnyBorderFound() const { return bAnyBorderFnd; } +}; + +BOOL lcl_GC_Line_Border( const SwTableLine*& , void* pPara ); +BOOL lcl_GC_Box_Border( const SwTableBox*& , void* pPara ); + +BOOL lcl_GCBorder_ChkBoxBrd_L( const SwTableLine*& , void* pPara ); +BOOL lcl_GCBorder_ChkBoxBrd_B( const SwTableBox*& , void* pPara ); + +BOOL lcl_GCBorder_GetLastBox_L( const SwTableLine*& , void* pPara ); +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 TRUE, wenn geloescht werden kann + BOOL RemoveFormat( const SwFrmFmt& rFmt ); +}; + + +SV_DECL_PTRARR_DEL( _SwShareBoxFmts, SwShareBoxFmt*, 8, 8 ) + +class SwShareBoxFmts +{ + _SwShareBoxFmts aShareArr; + BOOL Seek_Entry( const SwFrmFmt& rFmt, USHORT* 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..16dd42596995 --- /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( 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..d88aae514904 --- /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 _TXMSRT_HXX +#define _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; + BOOL bMainEntry; + + SwTOXSource() : pNd(0), nPos(0), bMainEntry(FALSE) {} + SwTOXSource( const SwCntntNode* pNode, xub_StrLen n, 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; + USHORT nOptions; + + void Init(); + +public: + SwTOXInternational( LanguageType nLang, USHORT 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 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 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( BOOL bMorePages ) const; + + String ToUpper( const String& rStr, xub_StrLen nPos ) const; + inline 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; + ULONG nPos; + xub_StrLen nCntPos; + USHORT nType; + static USHORT nOpt; + + SwTOXSortTabBase( TOXSortType nType, + const SwCntntNode* pTOXSrc, + const SwTxtTOXMark* pTxtMark, + const SwTOXInternational* pIntl, + const ::com::sun::star::lang::Locale* pLocale = NULL ); + virtual ~SwTOXSortTabBase() {} + + USHORT GetType() const { return nType; } + USHORT GetOptions() const { return nOpt; } + + virtual void FillText( SwTxtNode& rNd, const SwIndex& rInsPos, USHORT nAuthField = 0) const; + virtual USHORT GetLevel() const = 0; + virtual BOOL operator==( const SwTOXSortTabBase& ); + virtual BOOL operator<( const SwTOXSortTabBase& ); + + virtual String GetURL() const; + + inline void GetTxt( String&, String& ) const; + inline const ::com::sun::star::lang::Locale& GetLocale() const; + +private: + BOOL bValidTxt; + String sSortTxt; + String sSortTxtReading; + + virtual void _GetText( String&, String& ) = 0; +}; + +inline void SwTOXSortTabBase::GetTxt( String& rSortTxt, + String& rSortTxtReading ) const +{ + if( !bValidTxt ) + { + SwTOXSortTabBase* pThis = (SwTOXSortTabBase*)this; + pThis->_GetText( pThis->sSortTxt, pThis->sSortTxtReading ); + pThis->bValidTxt = 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*, USHORT nOptions, BYTE nKeyLevel, + const SwTOXInternational& rIntl, + const ::com::sun::star::lang::Locale& rLocale ); + virtual ~SwTOXIndex() {} + + + virtual void FillText( SwTxtNode& rNd, const SwIndex& rInsPos, USHORT nAuthField = 0 ) const; + virtual USHORT GetLevel() const; + virtual BOOL operator==( const SwTOXSortTabBase& ); + virtual BOOL operator<( const SwTOXSortTabBase& ); + +private: + virtual void _GetText( String&, String& ); + + BYTE nKeyLevel; +}; + +struct SwTOXCustom : public SwTOXSortTabBase +{ + SwTOXCustom( const String& rKey, const String& rReading, USHORT nLevel, + const SwTOXInternational& rIntl, + const ::com::sun::star::lang::Locale& rLocale ); + virtual ~SwTOXCustom() {} + + virtual USHORT GetLevel() const; + virtual BOOL operator==( const SwTOXSortTabBase& ); + virtual BOOL operator<( const SwTOXSortTabBase& ); + +private: + virtual void _GetText( String&, String& ); + + String aKey; + String sReading; + USHORT 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, USHORT nAuthField = 0 ) const; + virtual USHORT GetLevel() const; +private: + virtual void _GetText( String&, String& ); + +}; + +struct SwTOXPara : public SwTOXSortTabBase +{ + SwTOXPara( const SwCntntNode&, SwTOXElement, USHORT 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, USHORT nAuthField = 0 ) const; + virtual USHORT GetLevel() const; + + virtual String GetURL() const; +private: + virtual void _GetText( String&, String& ); + + SwTOXElement eType; + USHORT m_nLevel; + xub_StrLen nStartIndex; + xub_StrLen nEndIndex; +}; + +struct SwTOXTable : public SwTOXSortTabBase +{ + SwTOXTable( const SwCntntNode& rNd ); + virtual ~SwTOXTable() {} + + void SetLevel(USHORT nSet){nLevel = nSet;} + + virtual USHORT GetLevel() const; + + virtual String GetURL() const; +private: + virtual void _GetText( String&, String& ); + + USHORT nLevel; +}; + +struct SwTOXAuthority : public SwTOXSortTabBase +{ +private: + SwFmtFld& m_rField; + virtual void FillText( SwTxtNode& rNd, const SwIndex& rInsPos, USHORT nAuthField = 0 ) const; + virtual void _GetText( String&, String& ); + +public: + SwTOXAuthority( const SwCntntNode& rNd, SwFmtFld& rField, const SwTOXInternational& rIntl ); + virtual ~SwTOXAuthority() {} + + SwFmtFld& GetFldFmt() {return m_rField;} + + virtual BOOL operator==( const SwTOXSortTabBase& ); + virtual BOOL operator<( const SwTOXSortTabBase& ); + virtual USHORT GetLevel() const; +}; + + +#endif // _TXMSRT_HXX diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx new file mode 100644 index 000000000000..5a8783df261b --- /dev/null +++ b/sw/source/core/inc/txtfrm.hxx @@ -0,0 +1,830 @@ +/************************************************************************* + * + * 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 _TXTFRM_HXX +#define _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, USHORT 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 + + ULONG nAllLines :24;//Anzahl der Zeilen fuer das Paint (inkl. nThisLines) + 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. + + USHORT 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 USHORT 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); + +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&, USHORT ); + // is called from the FormatSpelling( ) method + SwRect SmartTagScan( SwCntntNode* , USHORT ); + // Wird vom CollectAutoCmplWords gerufen + void CollectAutoCmplWrds( SwCntntNode* , USHORT ); + + // 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( const SwRect &, const SwPrtOptions *pPrintData = NULL ) const; + virtual void Modify( SfxPoolItem*, SfxPoolItem* ); + 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, BYTE& nCrsrLevel, + sal_Bool& bRight, sal_Bool bInsertCrsr ); + + // Methoden zur Verwaltung von FolgeFrames + SwCntntFrm *SplitFrm( const xub_StrLen nTxtPos ); + SwCntntFrm *JoinFrm(); + inline USHORT GetOfst() const { return nOfst; } + void _SetOfst( const USHORT nNewOfst ); + inline void SetOfst ( const USHORT nNewOfst ); + inline void ManipOfst ( const USHORT 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); + 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( BOOL bVert ); + + // Liefert die Summe der Zeilenhoehen in pLine zurueck. + USHORT 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 USHORT GetCacheIdx() const { return nCacheIdx; } + inline void SetCacheIdx( const USHORT 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 + USHORT FirstLineHeight() const; + + // Haengt FlyInCntFrm um, wenn nEnd > Index >= nStart ist. + void MoveFlyInCnt( SwTxtFrm *pNew, USHORT nStart, USHORT nEnd ); + + // Berechnet die Position von FlyInCntFrms + USHORT CalcFlyPos( SwFrmFmt* pSearch ); + + // Ermittelt die Startposition und Schrittweite des Registers + sal_Bool FillRegister( SwTwips& rRegStart, USHORT& rRegDiff ); + + + USHORT GetLineCount( USHORT nPos ); //Ermittelt die Zeilenanzahl + + //Fuer die Anzeige der Zeilennummern. + ULONG GetAllLines() const { return nAllLines; } + 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; + } +}; + +/************************************************************************* + * 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..559ed95a69d4 --- /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 USHORT +#define MSHRT_MAX USHRT_MAX +// Koordinaten: Breite, Hoehe und Offsets in X-/Y-Richtung sowie Ascent etc. +#define KSHORT USHORT +#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..329502ea1d1c --- /dev/null +++ b/sw/source/core/inc/undoflystrattr.hxx @@ -0,0 +1,57 @@ +/************************************************************************* + * + * 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 _UNDO_FLY_STR_ATTR_HXX +#define _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 Undo( SwUndoIter & rIt ); + virtual void Redo( SwUndoIter & rIt ); + virtual void Repeat( SwUndoIter & rIt ); + + virtual SwRewriter GetRewriter() const; + + private: + SwFlyFrmFmt& mrFlyFrmFmt; + const String msOldStr; + const String msNewStr; +}; + +#endif // _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..1f5c74612a81 --- /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 USHORT 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..0f89b3b75663 --- /dev/null +++ b/sw/source/core/inc/viewimp.hxx @@ -0,0 +1,364 @@ +/************************************************************************* + * + * 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 _VIEWIMP_HXX +#define _VIEWIMP_HXX + +#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 SwPrtOptions; +class SwPagePreviewLayout; +struct PrevwPage; +#include <vector> +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; + + BOOL bFirstPageInvalid :1; //Pointer auf erste Seite ungueltig? + + //BOOL bResetXorVisibility:1; //StartAction/EndAction + //HMHBOOL bShowHdlPaint :1; //LockPaint/UnlockPaint + BOOL bResetHdlHiddenPaint:1;// -- "" -- + + BOOL bSmoothUpdate :1; //Meber fuer SmoothScroll + BOOL bStopSmooth :1; + BOOL bStopPrt :1; // Stop Printing + + USHORT 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 TRUE The printer shall be stopped. + @retval FALSE else + */ + BOOL IsStopPrt() { return bStopPrt; } + + /** + Resets signal for stopping printing. + + */ + void ResetStopPrt() { bStopPrt = 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 = TRUE; } + + BOOL AddPaintRect( const SwRect &rRect ); + SwRegionRects *GetRegion() { return pRegion; } + void DelRegion(); + + // neues Interface fuer StarView Drawing + inline 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, + const SwPrtOptions *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 + BOOL IsDragPossible( const Point &rPoint ); + void NotifySizeChg( const Size &rNewSz ); + + //SS Fuer die Lay- bzw. IdleAction und verwandtes + BOOL IsAction() const { return pLayAct != 0; } + 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(); + BOOL IsCalcLayoutProgress() const; //Fragt die LayAction wenn vorhanden. + //TRUE wenn eine LayAction laeuft, dort wird dann auch das Flag fuer + //ExpressionFields gesetzt. + BOOL IsUpdateExpFlds(); + + void SetRestoreActions(USHORT nSet){nRestoreActions = nSet;} + USHORT 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 //_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..2f8c8047c96e --- /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(USHORT nWhere, std::vector<SwWrongArea>::iterator startPos, std::vector<SwWrongArea>::iterator endPos); + void Remove( USHORT nIdx, USHORT 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 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 ); + BOOL InvalidateWrong(); + BOOL Fresh( xub_StrLen &rStart, xub_StrLen &rEnd, xub_StrLen nPos, + xub_StrLen nLen, USHORT nIndex, xub_StrLen nCursorPos ); + USHORT 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( USHORT nIdx ) const + { + return nIdx < maList.size() ? maList[nIdx].mnLen : 0; + } + + inline xub_StrLen Pos( USHORT nIdx ) const + { + return nIdx < maList.size() ? maList[nIdx].mnPos : 0; + } + + inline USHORT Count() const { return (USHORT)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, USHORT 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( USHORT nIdx ) const + { + return nIdx < maList.size() ? maList[nIdx].mpSubList : 0; + } + + void InsertSubList( xub_StrLen nNewPos, xub_StrLen nNewLen, USHORT nWhere, SwWrongList* pSubList ); + + inline const SwWrongArea* GetElement( USHORT 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 |