diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2008-10-01 06:34:11 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2008-10-01 06:34:11 +0000 |
commit | 530897d64bdedae156cf91697ae29dfb47e3809d (patch) | |
tree | 1754f54859642cefcf366619738e8bf55d4b95d3 /xmloff/inc/txtlists.hxx | |
parent | 3be4a064474bdb07c11c3152d8f4cfa8acf56819 (diff) |
CWS-TOOLING: integrate CWS swlists02
Diffstat (limited to 'xmloff/inc/txtlists.hxx')
-rw-r--r-- | xmloff/inc/txtlists.hxx | 88 |
1 files changed, 84 insertions, 4 deletions
diff --git a/xmloff/inc/txtlists.hxx b/xmloff/inc/txtlists.hxx index 9ba60abea87d..0655c3a52ca6 100644 --- a/xmloff/inc/txtlists.hxx +++ b/xmloff/inc/txtlists.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: txtlists.hxx,v $ - * $Revision: 1.3 $ + * $Revision: 1.2.24.2 $ * * This file is part of OpenOffice.org. * @@ -35,17 +35,38 @@ #include <comphelper/stl_types.hxx> #include <map> #include <vector> +#include <stack> +#include <boost/utility.hpp> +#include <boost/tuple/tuple.hpp> +#include <com/sun/star/container/XIndexReplace.hpp> +#include <xmloff/xmlictxt.hxx> -// --> OD 2008-08-15 #i92811# +class SvXMLImport; class XMLTextListBlockContext; -// <-- +class XMLTextListItemContext; +class XMLNumberedParaContext; -class XMLTextListsHelper +class XMLTextListsHelper : private boost::noncopyable { public: XMLTextListsHelper(); ~XMLTextListsHelper(); + /// list stack for importing: + + /// push a list context on the list context stack + void PushListContext(XMLTextListBlockContext *i_pListBlock = 0); + void PushListContext(XMLNumberedParaContext *i_pNumberedParagraph); + /// pop the list context stack + void PopListContext(); + /// peek at the top of the list context stack + void ListContextTop(XMLTextListBlockContext*& o_pListBlockContext, + XMLTextListItemContext*& o_pListItemContext, + XMLNumberedParaContext*& o_pNumberedParagraphContext ); + /// set list item on top of the list context stack + void SetListItem( XMLTextListItemContext *pListItem ); + + // keeping track of processed lists for import and export // --> OD 2008-08-15 #i92811# // - add optional parameter <sListStyleDefaultListId> @@ -83,7 +104,52 @@ class XMLTextListsHelper void PopListFromStack(); sal_Bool EqualsToTopListStyleOnStack( const ::rtl::OUString sListId ) const; + /** for importing numbered-paragraph + note that the ID namespace for numbered-paragraph and regular list + is distinct; we never combine a list and a n-p + */ + ::com::sun::star::uno::Reference< + ::com::sun::star::container::XIndexReplace> + EnsureNumberedParagraph( + SvXMLImport & i_rImport, + const ::rtl::OUString i_ListId, + sal_Int16 & io_rLevel, const ::rtl::OUString i_StyleName); + + /// get ID of the last numbered-paragraph iff it has given style-name + ::rtl::OUString GetNumberedParagraphListId( + const sal_uInt16 i_Level, + const ::rtl::OUString i_StyleName); + + /** Creates a NumRule from given style-name. + @param i_rImport the SvXMLImport + @param i_xNumRule parent num rule + @param i_ParentStyleName parent list style name + @param i_StyleName the list style name + @param io_rLevel the list level (may be reset if too large) + @param o_rRestartNumbering set to true if no style (defaulting) + @param io_rSetDefaults set to true if no style (defaulting) + */ + static ::com::sun::star::uno::Reference< + ::com::sun::star::container::XIndexReplace> MakeNumRule( + SvXMLImport & i_rImport, + const ::com::sun::star::uno::Reference< + ::com::sun::star::container::XIndexReplace>& i_xNumRule, + const ::rtl::OUString i_ParentStyleName, + const ::rtl::OUString i_StyleName, + sal_Int16 & io_rLevel, + sal_Bool* o_pRestartNumbering = 0, + sal_Bool* io_pSetDefaults = 0); + private: + + /** list context: list, list-item, numbered-paragraph + XMLTextListBlockContext, XMLTextListItemContext, + XMLNumberedParaContext + */ + typedef ::boost::tuple<SvXMLImportContextRef, + SvXMLImportContextRef, SvXMLImportContextRef> ListStackFrame_t; + ::std::stack< ListStackFrame_t > mListStack; + // container type for processed lists: // map with <ListId> as key and pair( <ListStyleName, ContinueListId> ) // as value @@ -113,5 +179,19 @@ class XMLTextListsHelper typedef ::std::vector< ::std::pair< ::rtl::OUString, ::rtl::OUString > > tStackForLists; tStackForLists* mpListStack; + + /// to connect numbered-paragraphs that have no list-id attribute: + /// vector of pair of style-name and list-id (indexed by level) + typedef ::std::vector< ::std::pair< ::rtl::OUString, ::rtl::OUString > > + LastNumberedParagraphs_t; + + LastNumberedParagraphs_t mLastNumberedParagraphs; + + /// numbered-paragraphs + typedef ::std::vector< ::std::pair< ::rtl::OUString, + ::com::sun::star::uno::Reference< + ::com::sun::star::container::XIndexReplace > > > NumParaList_t; + ::std::map< ::rtl::OUString, NumParaList_t > mNPLists; + }; #endif |