summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xmloff/inc/txtfldi.hxx6
-rw-r--r--xmloff/inc/txtlists.hxx88
-rw-r--r--xmloff/inc/xmloff/txtimp.hxx113
-rw-r--r--xmloff/inc/xmloff/xmlimp.hxx8
-rw-r--r--xmloff/inc/xmloff/xmltoken.hxx8
-rw-r--r--xmloff/source/core/xmlimp.cxx8
-rw-r--r--xmloff/source/core/xmltoken.cxx7
-rw-r--r--xmloff/source/draw/ximpshap.cxx15
-rw-r--r--xmloff/source/draw/ximpshap.hxx7
-rw-r--r--xmloff/source/table/XMLTableImport.cxx18
-rw-r--r--xmloff/source/text/XMLFootnoteImportContext.cxx27
-rw-r--r--xmloff/source/text/XMLFootnoteImportContext.hxx7
-rw-r--r--xmloff/source/text/XMLTextFrameContext.cxx32
-rw-r--r--xmloff/source/text/XMLTextListBlockContext.cxx130
-rw-r--r--xmloff/source/text/XMLTextListBlockContext.hxx6
-rw-r--r--xmloff/source/text/XMLTextListItemContext.cxx19
-rw-r--r--xmloff/source/text/txtfldi.cxx31
-rw-r--r--xmloff/source/text/txtimp.cxx231
-rw-r--r--xmloff/source/text/txtlists.cxx262
-rw-r--r--xmloff/source/text/txtparai.cxx147
-rw-r--r--xmloff/source/text/txtparai.hxx39
21 files changed, 751 insertions, 458 deletions
diff --git a/xmloff/inc/txtfldi.hxx b/xmloff/inc/txtfldi.hxx
index 1425ec4c98..4ced397688 100644
--- a/xmloff/inc/txtfldi.hxx
+++ b/xmloff/inc/txtfldi.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: txtfldi.hxx,v $
- * $Revision: 1.38 $
+ * $Revision: 1.38.66.2 $
*
* This file is part of OpenOffice.org.
*
@@ -1360,10 +1360,6 @@ class XMLAnnotationImportContext : public XMLTextFieldImportContext
com::sun::star::uno::Reference < com::sun::star::text::XTextCursor > mxCursor;
com::sun::star::uno::Reference < com::sun::star::text::XTextCursor > mxOldCursor;
- /// old list item and block (#91964#)
- SvXMLImportContextRef mxOldListBlock;
- SvXMLImportContextRef mxOldListItem;
-
public:
TYPEINFO();
diff --git a/xmloff/inc/txtlists.hxx b/xmloff/inc/txtlists.hxx
index 9ba60abea8..0655c3a52c 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
diff --git a/xmloff/inc/xmloff/txtimp.hxx b/xmloff/inc/xmloff/txtimp.hxx
index d24677ec9c..7897ebd7e9 100644
--- a/xmloff/inc/xmloff/txtimp.hxx
+++ b/xmloff/inc/xmloff/txtimp.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: txtimp.hxx,v $
- * $Revision: 1.15 $
+ * $Revision: 1.13.2.2 $
*
* This file is part of OpenOffice.org.
*
@@ -37,6 +37,9 @@
#include <map>
#include <vector>
+#include <memory>
+#include <boost/utility.hpp>
+
#include <tools/list.hxx>
#include <xmloff/xmlictxt.hxx>
#include <xmloff/xmlimppr.hxx>
@@ -57,7 +60,6 @@ class XMLTextListsHelper;
class SvXMLImport;
class SvXMLStylesContext;
class XMLTextListBlockContext;
-class XMLTextListItemContext;
class SvxXMLListStyleContext;
class XMLPropStyleContext;
class SvI18NMap;
@@ -262,6 +264,17 @@ enum XMLTextPAttrTokens
XML_TOK_TEXT_P_END=XML_TOK_UNKNOWN
};
+enum XMLTextNumberedParagraphAttrTokens
+{
+ XML_TOK_TEXT_NUMBERED_PARAGRAPH_XMLID,
+ XML_TOK_TEXT_NUMBERED_PARAGRAPH_LIST_ID,
+ XML_TOK_TEXT_NUMBERED_PARAGRAPH_LEVEL,
+ XML_TOK_TEXT_NUMBERED_PARAGRAPH_STYLE_NAME,
+ XML_TOK_TEXT_NUMBERED_PARAGRAPH_CONTINUE_NUMBERING,
+ XML_TOK_TEXT_NUMBERED_PARAGRAPH_START_VALUE,
+ XML_TOK_TEXT_NUMBERED_PARAGRAPH_END=XML_TOK_UNKNOWN
+};
+
enum XMLTextListBlockAttrTokens
{
XML_TOK_TEXT_LIST_BLOCK_XMLID,
@@ -361,29 +374,29 @@ enum XMLTextType
// create type for section list, XMLSectionList_Impl
DECLARE_LIST( XMLSectionList_Impl, XMLSectionImportContext* )
-class XMLOFF_DLLPUBLIC XMLTextImportHelper : public UniRefBase
+class XMLOFF_DLLPUBLIC XMLTextImportHelper : public UniRefBase,
+ private boost::noncopyable
{
- SvXMLTokenMap *pTextElemTokenMap;
- SvXMLTokenMap *pTextPElemTokenMap;
- SvXMLTokenMap *pTextPAttrTokenMap;
- SvXMLTokenMap *pTextFieldAttrTokenMap;
- SvXMLTokenMap *pTextListBlockAttrTokenMap;
- SvXMLTokenMap *pTextListBlockElemTokenMap;
- SvXMLTokenMap *pTextFrameAttrTokenMap;
- SvXMLTokenMap *pTextContourAttrTokenMap;
- SvXMLTokenMap *pTextHyperlinkAttrTokenMap;
- SvXMLTokenMap *pTextMasterPageElemTokenMap;
- SvStringsDtor *pPrevFrmNames;
- SvStringsDtor *pNextFrmNames;
+ ::std::auto_ptr<SvXMLTokenMap> pTextElemTokenMap;
+ ::std::auto_ptr<SvXMLTokenMap> pTextPElemTokenMap;
+ ::std::auto_ptr<SvXMLTokenMap> pTextPAttrTokenMap;
+ ::std::auto_ptr<SvXMLTokenMap> pTextFieldAttrTokenMap;
+ ::std::auto_ptr<SvXMLTokenMap> pTextNumberedParagraphAttrTokenMap;
+ ::std::auto_ptr<SvXMLTokenMap> pTextListBlockAttrTokenMap;
+ ::std::auto_ptr<SvXMLTokenMap> pTextListBlockElemTokenMap;
+ ::std::auto_ptr<SvXMLTokenMap> pTextFrameAttrTokenMap;
+ ::std::auto_ptr<SvXMLTokenMap> pTextContourAttrTokenMap;
+ ::std::auto_ptr<SvXMLTokenMap> pTextHyperlinkAttrTokenMap;
+ ::std::auto_ptr<SvXMLTokenMap> pTextMasterPageElemTokenMap;
+ ::std::auto_ptr<SvStringsDtor> pPrevFrmNames;
+ ::std::auto_ptr<SvStringsDtor> pNextFrmNames;
// --> OD 2008-04-25 #refactorlists#
- XMLTextListsHelper* mpTextListsHelper;
+ ::std::auto_ptr<XMLTextListsHelper> mpTextListsHelper;
// <--
SvXMLImportContextRef xAutoStyles;
SvXMLImportContextRef xFontDecls;
- SvXMLImportContextRef xListBlock;
- SvXMLImportContextRef xListItem;
XMLSectionList_Impl aSectionList;
@@ -393,7 +406,7 @@ class XMLOFF_DLLPUBLIC XMLTextImportHelper : public UniRefBase
UniReference < SvXMLImportPropertyMapper > xSectionImpPrMap;
UniReference < SvXMLImportPropertyMapper > xRubyImpPrMap;
- SvI18NMap *pRenameMap;
+ ::std::auto_ptr<SvI18NMap> pRenameMap;
// --> OD 2006-10-12 #i69629# - change and extend data structure:
// - data structure contains candidates of paragraph styles, which
// will be assigned to the outline style
@@ -568,6 +581,7 @@ public:
inline const SvXMLTokenMap& GetTextHyperlinkAttrTokenMap();
inline const SvXMLTokenMap& GetTextMasterPageElemTokenMap();
+ const SvXMLTokenMap& GetTextNumberedParagraphAttrTokenMap();
const SvXMLTokenMap& GetTextListBlockAttrTokenMap();
const SvXMLTokenMap& GetTextListBlockElemTokenMap();
const SvXMLTokenMap& GetTextFieldAttrTokenMap(); // impl: txtfldi.cxx
@@ -588,18 +602,6 @@ public:
sal_Bool IsOrganizerMode() { return bOrganizerMode; }
sal_Bool IsProgress() { return bProgress; }
- XMLTextListBlockContext *GetListBlock();
- SvXMLImportContext *_GetListBlock() { return &xListBlock; }
- sal_Bool IsInList() const { return xListBlock.Is(); }
- void SetListBlock( XMLTextListBlockContext *pListBlock );
- void _SetListBlock( SvXMLImportContext *pListBlock );
-
- XMLTextListItemContext *GetListItem();
- SvXMLImportContext *_GetListItem() { return &xListItem; }
- sal_Bool HasListItem() const { return xListItem.Is(); }
- void SetListItem( XMLTextListItemContext *pListItem );
- void _SetListItem( SvXMLImportContext *pListItem );
-
XMLSectionList_Impl& GetSectionList() { return aSectionList; }
::rtl::OUString ConvertStarFonts( const ::rtl::OUString& rChars,
@@ -891,77 +893,68 @@ public:
SvXMLImport& GetXMLImport() { return rSvXMLImport;}
// --> OD 2008-04-25 #refactorlists#
- // --> OD 2008-08-15 #i92811#
- // - add optional parameter <sListStyleDefaultListId>
- void KeepListAsProcessed( ::rtl::OUString sListId,
- ::rtl::OUString sListStyleName,
- ::rtl::OUString sContinueListId,
- ::rtl::OUString sListStyleDefaultListId = ::rtl::OUString() );
+ XMLTextListsHelper& GetTextListHelper() { return *mpTextListsHelper; }
// <--
- sal_Bool IsListProcessed( const ::rtl::OUString sListId ) const;
-
- ::rtl::OUString GetContinueListIdOfProcessedList(
- const ::rtl::OUString sListId ) const;
- const ::rtl::OUString& GetLastProcessedListId() const;
- const ::rtl::OUString& GetListStyleOfLastProcessedList() const;
-
- ::rtl::OUString GenerateNewListId() const;
- // <--
+ // forwards to TextListHelper; these are used in many places
+ /// push a list context on the list context stack
+ void PushListContext(XMLTextListBlockContext *i_pListBlock = 0);
+ /// pop the list context stack
+ void PopListContext();
};
inline const SvXMLTokenMap& XMLTextImportHelper::GetTextElemTokenMap()
{
- if( !pTextElemTokenMap )
- pTextElemTokenMap = _GetTextElemTokenMap();
+ if( !pTextElemTokenMap.get() )
+ pTextElemTokenMap.reset( _GetTextElemTokenMap() );
return *pTextElemTokenMap;
}
inline const SvXMLTokenMap& XMLTextImportHelper::GetTextPElemTokenMap()
{
- if( !pTextPElemTokenMap )
- pTextPElemTokenMap = _GetTextPElemTokenMap();
+ if( !pTextPElemTokenMap.get() )
+ pTextPElemTokenMap.reset( _GetTextPElemTokenMap() );
return *pTextPElemTokenMap;
}
inline const SvXMLTokenMap& XMLTextImportHelper::GetTextPAttrTokenMap()
{
- if( !pTextPAttrTokenMap )
- pTextPAttrTokenMap = _GetTextPAttrTokenMap();
+ if( !pTextPAttrTokenMap.get() )
+ pTextPAttrTokenMap.reset( _GetTextPAttrTokenMap() );
return *pTextPAttrTokenMap;
}
inline const SvXMLTokenMap& XMLTextImportHelper::GetTextFrameAttrTokenMap()
{
- if( !pTextFrameAttrTokenMap )
- pTextFrameAttrTokenMap = _GetTextFrameAttrTokenMap();
+ if( !pTextFrameAttrTokenMap.get() )
+ pTextFrameAttrTokenMap.reset( _GetTextFrameAttrTokenMap() );
return *pTextFrameAttrTokenMap;
}
inline const SvXMLTokenMap& XMLTextImportHelper::GetTextContourAttrTokenMap()
{
- if( !pTextContourAttrTokenMap )
- pTextContourAttrTokenMap = _GetTextContourAttrTokenMap();
+ if( !pTextContourAttrTokenMap.get() )
+ pTextContourAttrTokenMap.reset( _GetTextContourAttrTokenMap() );
return *pTextContourAttrTokenMap;
}
inline const SvXMLTokenMap& XMLTextImportHelper::GetTextHyperlinkAttrTokenMap()
{
- if( !pTextHyperlinkAttrTokenMap )
- pTextHyperlinkAttrTokenMap = _GetTextHyperlinkAttrTokenMap();
+ if( !pTextHyperlinkAttrTokenMap.get() )
+ pTextHyperlinkAttrTokenMap.reset( _GetTextHyperlinkAttrTokenMap() );
return *pTextHyperlinkAttrTokenMap;
}
inline const SvXMLTokenMap& XMLTextImportHelper::GetTextMasterPageElemTokenMap()
{
- if( !pTextMasterPageElemTokenMap )
- pTextMasterPageElemTokenMap = _GetTextMasterPageElemTokenMap();
+ if( !pTextMasterPageElemTokenMap.get() )
+ pTextMasterPageElemTokenMap.reset( _GetTextMasterPageElemTokenMap() );
return *pTextMasterPageElemTokenMap;
}
diff --git a/xmloff/inc/xmloff/xmlimp.hxx b/xmloff/inc/xmloff/xmlimp.hxx
index 074ec01888..3ca4633a66 100644
--- a/xmloff/inc/xmloff/xmlimp.hxx
+++ b/xmloff/inc/xmloff/xmlimp.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: xmlimp.hxx,v $
- * $Revision: 1.12 $
+ * $Revision: 1.12.2.1 $
*
* This file is part of OpenOffice.org.
*
@@ -46,12 +46,8 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/document/XImporter.hpp>
#include <com/sun/star/document/XFilter.hpp>
-#ifndef _COM_SUN_STAR_DRAWING_XGRAPHICOBJECTRESOLVER_HPP_
#include <com/sun/star/document/XGraphicObjectResolver.hpp>
-#endif
-#ifndef _COM_SUN_STAR_DRAWING_XEMBEDDEDOBJECTRESOLVER_HPP_
#include <com/sun/star/document/XEmbeddedObjectResolver.hpp>
-#endif
#include <com/sun/star/beans/XPropertySet.hpp>
#include <cppuhelper/weak.hxx>
#include <xmloff/txtimp.hxx>
@@ -328,7 +324,7 @@ public:
const ::rtl::OUString& rName,
const ::rtl::OUString& rDisplayName );
::rtl::OUString GetStyleDisplayName( sal_uInt16 nFamily,
- const ::rtl::OUString& rName );
+ const ::rtl::OUString& rName ) const;
ProgressBarHelper* GetProgressBarHelper();
diff --git a/xmloff/inc/xmloff/xmltoken.hxx b/xmloff/inc/xmloff/xmltoken.hxx
index 770f42a73a..9650ba527b 100644
--- a/xmloff/inc/xmloff/xmltoken.hxx
+++ b/xmloff/inc/xmloff/xmltoken.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: xmltoken.hxx,v $
- * $Revision: 1.28 $
+ * $Revision: 1.26.2.3 $
*
* This file is part of OpenOffice.org.
*
@@ -3028,7 +3028,13 @@ namespace xmloff { namespace token {
// fs: #i90243#
XML_XFORM_MODEL_SETTINGS,
+ // ODF 1.2 metadata
XML_META_FIELD,
+ XML_ABOUT,
+ XML_DATATYPE,
+
+ // ODF 1.2 numbered-paragraph
+ XML_LIST_ID,
XML_TREAT_EMPTY_CELLS,
XML_LEAVE_GAP,
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index fbcad5d3ff..259d2d1a5b 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: xmlimp.cxx,v $
- * $Revision: 1.113 $
+ * $Revision: 1.112.2.2 $
*
* This file is part of OpenOffice.org.
*
@@ -47,9 +47,7 @@
#include <xmloff/xmlictxt.hxx>
#include <xmloff/xmlimp.hxx>
#include <xmloff/xmlnumfi.hxx>
-#ifndef _XMLOFF_XMLEVENTIMPORTHELPER_HXX
#include "XMLEventImportHelper.hxx"
-#endif
#include "XMLStarBasicContextFactory.hxx"
#include "XMLScriptContextFactory.hxx"
#include "StyleMap.hxx"
@@ -66,9 +64,7 @@
#include <tools/string.hxx> // used in StartElement for logging
#include <cppuhelper/implbase1.hxx>
#include <comphelper/extract.hxx>
-#ifndef _VCL_FONTCVT_HXX
#include <vcl/fontcvt.hxx>
-#endif
#include <com/sun/star/rdf/XMetadatable.hpp>
@@ -1350,7 +1346,7 @@ void SvXMLImport::AddStyleDisplayName( sal_uInt16 nFamily,
}
OUString SvXMLImport::GetStyleDisplayName( sal_uInt16 nFamily,
- const OUString& rName )
+ const OUString& rName ) const
{
OUString sName( rName );
if( mpStyleMap && rName.getLength() )
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index f39dd1acc6..d8dec47b33 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: xmltoken.cxx,v $
- * $Revision: 1.132 $
+ * $Revision: 1.130.2.3 $
*
* This file is part of OpenOffice.org.
*
@@ -3032,6 +3032,11 @@ namespace xmloff { namespace token {
// ODF 1.2 metadata
TOKEN( "meta-field", XML_META_FIELD ),
+ TOKEN( "about", XML_ABOUT ),
+ TOKEN( "datatype", XML_DATATYPE ),
+
+ // ODF 1.2 numbered-paragraph
+ TOKEN( "list-id", XML_LIST_ID ),
TOKEN( "treat-empty-cells", XML_TREAT_EMPTY_CELLS ),
TOKEN( "leave-gap", XML_LEAVE_GAP ),
diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx
index aa63749a1d..86625bdb5c 100644
--- a/xmloff/source/draw/ximpshap.cxx
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: ximpshap.cxx,v $
- * $Revision: 1.129 $
+ * $Revision: 1.128.2.2 $
*
* This file is part of OpenOffice.org.
*
@@ -162,6 +162,7 @@ SdXMLShapeContext::SdXMLShapeContext(
: SvXMLShapeContext( rImport, nPrfx, rLocalName, bTemporaryShape )
, mxShapes( rShapes )
, mxAttrList(xAttrList)
+, mbListContextPushed( false )
, mnStyleFamily(XML_STYLE_FAMILY_SD_GRAPHICS_ID)
, mbIsPlaceholder(FALSE)
, mbClearDefaultAttributes( true )
@@ -239,10 +240,8 @@ SvXMLImportContext *SdXMLShapeContext::CreateChildContext( USHORT p_nPrefix,
// remember old list item and block (#91964#) and reset them
// for the text frame
- mxOldListBlock = xTxtImport->_GetListBlock();
- mxOldListItem = xTxtImport->_GetListItem();
- xTxtImport->_SetListBlock( NULL );
- xTxtImport->_SetListItem( NULL );
+ xTxtImport->PushListContext();
+ mbListContextPushed = true;
}
}
@@ -370,10 +369,8 @@ void SdXMLShapeContext::EndElement()
GetImport().GetTextImport()->SetCursor( mxOldCursor );
// reinstall old list item (if necessary) #91964#
- if ( mxOldListBlock.Is() )
- {
- GetImport().GetTextImport()->_SetListBlock( mxOldListBlock );
- GetImport().GetTextImport()->_SetListItem( mxOldListItem );
+ if (mbListContextPushed) {
+ GetImport().GetTextImport()->PopListContext();
}
if( msHyperlink.getLength() != 0 ) try
diff --git a/xmloff/source/draw/ximpshap.hxx b/xmloff/source/draw/ximpshap.hxx
index d79742d43a..65616bfdf2 100644
--- a/xmloff/source/draw/ximpshap.hxx
+++ b/xmloff/source/draw/ximpshap.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: ximpshap.hxx,v $
- * $Revision: 1.48 $
+ * $Revision: 1.48.2.1 $
*
* This file is part of OpenOffice.org.
*
@@ -66,9 +66,8 @@ protected:
rtl::OUString maShapeName;
rtl::OUString maThumbnailURL;
- /// old list item and block (#91964#)
- SvXMLImportContextRef mxOldListBlock;
- SvXMLImportContextRef mxOldListItem;
+ /// whether to restore list context (#91964#)
+ bool mbListContextPushed;
sal_uInt16 mnStyleFamily;
sal_uInt16 mnClass;
diff --git a/xmloff/source/table/XMLTableImport.cxx b/xmloff/source/table/XMLTableImport.cxx
index dee1bfa6c3..dbbb7bdbb9 100644
--- a/xmloff/source/table/XMLTableImport.cxx
+++ b/xmloff/source/table/XMLTableImport.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: XMLTableImport.cxx,v $
- * $Revision: 1.4 $
+ * $Revision: 1.4.2.1 $
*
* This file is part of OpenOffice.org.
*
@@ -167,8 +167,7 @@ public:
Reference< XMergeableCell > mxCell;
Reference< XTextCursor > mxCursor;
Reference< XTextCursor > mxOldCursor;
- SvXMLImportContextRef mxOldListBlock;
- SvXMLImportContextRef mxOldListItem;
+ bool mbListContextPushed;
sal_Int32 mnColSpan, mnRowSpan, mnRepeated;
};
@@ -626,6 +625,7 @@ OUString XMLTableImportContext::GetDefaultCellStyleName() const
XMLCellImportContext::XMLCellImportContext( SvXMLImport& rImport, const Reference< XMergeableCell >& xCell, const OUString& sDefaultCellStyleName, USHORT nPrfx, const OUString& rLName, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList )
: SvXMLImportContext( rImport, nPrfx, rLName )
, mxCell( xCell )
+, mbListContextPushed( false )
, mnColSpan( 1 )
, mnRowSpan( 1 )
, mnRepeated( 1 )
@@ -716,10 +716,8 @@ SvXMLImportContext * XMLCellImportContext::CreateChildContext( USHORT nPrefix, c
// remember old list item and block (#91964#) and reset them
// for the text frame
- mxOldListBlock = xTxtImport->_GetListBlock();
- mxOldListItem = xTxtImport->_GetListItem();
- xTxtImport->_SetListBlock( NULL );
- xTxtImport->_SetListItem( NULL );
+ xTxtImport->PushListContext();
+ mbListContextPushed = true;
}
}
@@ -759,10 +757,8 @@ void XMLCellImportContext::EndElement()
GetImport().GetTextImport()->SetCursor( mxOldCursor );
// reinstall old list item (if necessary) #91964#
- if ( mxOldListBlock.Is() )
- {
- GetImport().GetTextImport()->_SetListBlock( mxOldListBlock );
- GetImport().GetTextImport()->_SetListItem( mxOldListItem );
+ if (mbListContextPushed) {
+ GetImport().GetTextImport()->PopListContext();
}
}
diff --git a/xmloff/source/text/XMLFootnoteImportContext.cxx b/xmloff/source/text/XMLFootnoteImportContext.cxx
index bd30e9de12..c0b0e94f77 100644
--- a/xmloff/source/text/XMLFootnoteImportContext.cxx
+++ b/xmloff/source/text/XMLFootnoteImportContext.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: XMLFootnoteImportContext.cxx,v $
- * $Revision: 1.15 $
+ * $Revision: 1.15.66.1 $
*
* This file is part of OpenOffice.org.
*
@@ -34,10 +34,7 @@
#include "XMLFootnoteImportContext.hxx"
-
-#ifndef _RTL_USTRING
#include <rtl/ustring.hxx>
-#endif
#include <tools/debug.hxx>
#include <xmloff/xmlimp.hxx>
#include <xmloff/txtimp.hxx>
@@ -45,17 +42,10 @@
#include "xmlnmspe.hxx"
#include <xmloff/xmltoken.hxx>
-#ifndef _XMLOFF_XMLFOOTNOTEBODYIMPORTCONTEXT_HXX
#include "XMLFootnoteBodyImportContext.hxx"
-#endif
-
-#ifndef _XMLOFF_XMLTEXTLISTBLOCKCONTEXT_HXX
#include "XMLTextListBlockContext.hxx"
-#endif
-
-#ifndef _XMLOFF_XMLTEXTLISTITEMCONTEXT_HXX
#include "XMLTextListItemContext.hxx"
-#endif
+
#include <com/sun/star/xml/sax/XAttributeList.hpp>
#include <com/sun/star/text/XTextContent.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -63,7 +53,6 @@
#include <com/sun/star/text/XFootnote.hpp>
-
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
@@ -100,6 +89,7 @@ XMLFootnoteImportContext::XMLFootnoteImportContext(
const OUString& rLocalName )
: SvXMLImportContext(rImport, nPrfx, rLocalName)
, sPropertyReferenceId(RTL_CONSTASCII_USTRINGPARAM("ReferenceId"))
+, mbListContextPushed(false)
, rHelper(rHlp)
{
}
@@ -171,10 +161,8 @@ void XMLFootnoteImportContext::StartElement(
// remember old list item and block (#89891#) and reset them
// for the footnote
- xListBlock = rHelper.GetListBlock();
- xListItem = rHelper.GetListItem();
- rHelper.SetListBlock( NULL );
- rHelper.SetListItem( NULL );
+ rHelper.PushListContext();
+ mbListContextPushed = true;
// remember footnote (for CreateChildContext)
Reference<XFootnote> xNote(xTextContent, UNO_QUERY);
@@ -198,8 +186,9 @@ void XMLFootnoteImportContext::EndElement()
rHelper.SetCursor(xOldCursor);
// reinstall old list item
- rHelper.SetListBlock( (XMLTextListBlockContext*)&xListBlock );
- rHelper.SetListItem( (XMLTextListItemContext*)&xListItem );
+ if (mbListContextPushed) {
+ rHelper.PopListContext();
+ }
}
diff --git a/xmloff/source/text/XMLFootnoteImportContext.hxx b/xmloff/source/text/XMLFootnoteImportContext.hxx
index e70f9449e3..3615e96aac 100644
--- a/xmloff/source/text/XMLFootnoteImportContext.hxx
+++ b/xmloff/source/text/XMLFootnoteImportContext.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: XMLFootnoteImportContext.hxx,v $
- * $Revision: 1.5 $
+ * $Revision: 1.5.66.1 $
*
* This file is part of OpenOffice.org.
*
@@ -59,8 +59,7 @@ class XMLFootnoteImportContext : public SvXMLImportContext
::com::sun::star::text::XTextCursor> xOldCursor;
/// old list item and block (#89891#)
- SvXMLImportContextRef xListBlock;
- SvXMLImportContextRef xListItem;
+ bool mbListContextPushed;
/// text import helper; holds current XTextCursor (and XText)
XMLTextImportHelper& rHelper;
@@ -70,7 +69,7 @@ class XMLFootnoteImportContext : public SvXMLImportContext
::com::sun::star::text::XFootnote> xFootnote;
public:
-
+
TYPEINFO();
XMLFootnoteImportContext(
diff --git a/xmloff/source/text/XMLTextFrameContext.cxx b/xmloff/source/text/XMLTextFrameContext.cxx
index 4b1c358165..c3aaba7e12 100644
--- a/xmloff/source/text/XMLTextFrameContext.cxx
+++ b/xmloff/source/text/XMLTextFrameContext.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: XMLTextFrameContext.cxx,v $
- * $Revision: 1.75 $
+ * $Revision: 1.75.34.1 $
*
* This file is part of OpenOffice.org.
*
@@ -32,17 +32,13 @@
#include "precompiled_xmloff.hxx"
#include <tools/debug.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#ifndef _COM_SUN_STAR_TEXT_TEXTCONTENTANCHORTYPE_HPP
#include <com/sun/star/text/TextContentAnchorType.hpp>
-#endif
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/text/XTextFrame.hpp>
#include <com/sun/star/container/XNamed.hpp>
#include <com/sun/star/text/SizeType.hpp>
#include <com/sun/star/drawing/XShape.hpp>
-#ifndef _COM_SUN_STAR_DOCUMENT_XEVENTSSUPPLIER_HPP
#include <com/sun/star/document/XEventsSupplier.hpp>
-#endif
#include <com/sun/star/document/XEmbeddedObjectSupplier.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/text/HoriOrientation.hpp>
@@ -65,19 +61,13 @@
#include "XMLImageMapContext.hxx"
#include "XMLTextFrameContext.hxx"
-#ifndef _XMLOFF_XMLTEXTLISTBLOCKCONTEXT_HXX
#include "XMLTextListBlockContext.hxx"
-#endif
-
-#ifndef _XMLOFF_XMLTEXTLISTITEMCONTEXT_HXX
#include "XMLTextListItemContext.hxx"
-#endif
#include <xmloff/attrlist.hxx>
#include <comphelper/stl_types.hxx>
-#ifndef __SGI_STL_MAP
#include <map>
-#endif
+
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
@@ -376,8 +366,7 @@ class XMLTextFrameContext_Impl : public SvXMLImportContext
::com::sun::star::io::XOutputStream > xBase64Stream;
/// old list item and block (#89891#)
- SvXMLImportContextRef xListBlock;
- SvXMLImportContextRef xListItem;
+ bool mbListContextPushed;
const ::rtl::OUString sWidth;
const ::rtl::OUString sWidthType;
@@ -794,10 +783,8 @@ void XMLTextFrameContext_Impl::Create( sal_Bool /*bHRefOrBase64*/ )
// remember old list item and block (#89892#) and reset them
// for the text frame
- xListBlock = xTextImportHelper->GetListBlock();
- xListItem = xTextImportHelper->GetListItem();
- xTextImportHelper->SetListBlock( NULL );
- xTextImportHelper->SetListItem( NULL );
+ xTextImportHelper->PushListContext();
+ mbListContextPushed = true;
}
}
@@ -824,6 +811,7 @@ XMLTextFrameContext_Impl::XMLTextFrameContext_Impl(
sal_uInt16 nNewType,
const Reference< XAttributeList > & rFrameAttrList )
: SvXMLImportContext( rImport, nPrfx, rLName )
+, mbListContextPushed( false )
, sWidth(RTL_CONSTASCII_USTRINGPARAM("Width"))
, sWidthType(RTL_CONSTASCII_USTRINGPARAM("WidthType"))
, sRelativeWidth(RTL_CONSTASCII_USTRINGPARAM("RelativeWidth"))
@@ -1098,12 +1086,8 @@ void XMLTextFrameContext_Impl::EndElement()
}
// reinstall old list item (if necessary) #89892#
- if ( xListBlock.Is() )
- {
- GetImport().GetTextImport()->SetListBlock(
- (XMLTextListBlockContext*)&xListBlock );
- GetImport().GetTextImport()->SetListItem(
- (XMLTextListItemContext*)&xListItem );
+ if (mbListContextPushed) {
+ GetImport().GetTextImport()->PopListContext();
}
if (( nType == XML_TEXT_FRAME_APPLET || nType == XML_TEXT_FRAME_PLUGIN ) && xPropSet.is())
diff --git a/xmloff/source/text/XMLTextListBlockContext.cxx b/xmloff/source/text/XMLTextListBlockContext.cxx
index a82576cd28..d3cb826425 100644
--- a/xmloff/source/text/XMLTextListBlockContext.cxx
+++ b/xmloff/source/text/XMLTextListBlockContext.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: XMLTextListBlockContext.cxx,v $
- * $Revision: 1.15 $
+ * $Revision: 1.13.2.4 $
*
* This file is part of OpenOffice.org.
*
@@ -42,6 +42,7 @@
#include <xmloff/xmltoken.hxx>
#include "XMLTextListItemContext.hxx"
#include "XMLTextListBlockContext.hxx"
+#include "txtlists.hxx"
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
@@ -69,7 +70,7 @@ XMLTextListBlockContext::XMLTextListBlockContext(
// --> OD 2008-04-22 #refactorlists#
, msListStyleName()
// <--
-, mxParentListBlock( rTxtImp.GetListBlock() )
+, mxParentListBlock( )
, mnLevel( 0 )
// --> OD 2008-05-07 #refactorlists#
//, mbRestartNumbering( sal_True )
@@ -81,6 +82,14 @@ XMLTextListBlockContext::XMLTextListBlockContext(
, msContinueListId()
// <--
{
+ {
+ // get the parent list block context (if any); this is a bit ugly...
+ XMLTextListBlockContext * pLB(0);
+ XMLTextListItemContext * pLI(0);
+ XMLNumberedParaContext * pNP(0);
+ rTxtImp.GetTextListHelper().ListContextTop(pLB, pLI, pNP);
+ mxParentListBlock = pLB;
+ }
// Inherit style name from parent list, as well as the flags whether
// numbering must be restarted and formats have to be created.
OUString sParentListStyleName;
@@ -150,88 +159,16 @@ XMLTextListBlockContext::XMLTextListBlockContext(
}
}
- if ( msListStyleName.getLength() &&
- msListStyleName != sParentListStyleName )
- {
- OUString sDisplayStyleName(
- GetImport().GetStyleDisplayName( XML_STYLE_FAMILY_TEXT_LIST,
- msListStyleName ) );
- const Reference < XNameContainer >& rNumStyles =
- mrTxtImport.GetNumberingStyles();
- if( rNumStyles.is() && rNumStyles->hasByName( sDisplayStyleName ) )
- {
- Reference < XStyle > xStyle;
- Any aAny = rNumStyles->getByName( sDisplayStyleName );
- aAny >>= xStyle;
-
- // --> OD 2008-05-07 #refactorlists# - no longer needed
-// // If the style has not been used, the restart numbering has
-// // to be set never.
-// if ( mbRestartNumbering && !xStyle->isInUse() )
-// {
-// mbRestartNumbering = sal_False;
-// }
- // <--
-
- Reference< XPropertySet > xPropSet( xStyle, UNO_QUERY );
- aAny = xPropSet->getPropertyValue( mrTxtImport.sNumberingRules );
- aAny >>= mxNumRules;
- }
- else
- {
- const SvxXMLListStyleContext *pListStyle =
- mrTxtImport.FindAutoListStyle( msListStyleName );
- if( pListStyle )
- {
- mxNumRules = pListStyle->GetNumRules();
- // --> OD 2008-05-07 #refactorlists# - no longer needed
-// sal_Bool bUsed = mxNumRules.is();
- // <--
- if( !mxNumRules.is() )
- {
- pListStyle->CreateAndInsertAuto();
- mxNumRules = pListStyle->GetNumRules();
- }
- // --> OD 2008-05-07 #refactorlists# - no longer needed
-// if( mbRestartNumbering && !bUsed )
-// mbRestartNumbering = sal_False;
- // <--
- }
- }
- }
-
+ mxNumRules = XMLTextListsHelper::MakeNumRule(GetImport(), mxNumRules,
+ sParentListStyleName, msListStyleName,
+ mnLevel, &mbRestartNumbering, &mbSetDefaults );
if( !mxNumRules.is() )
- {
- // If no style name has been specified for this style and for any
- // parent or if no num rule this the specified name is existing,
- // create a new one.
-
- mxNumRules =
- SvxXMLListStyleContext::CreateNumRule( GetImport().GetModel() );
- DBG_ASSERT( mxNumRules.is(), "go no numbering rule" );
- if( !mxNumRules.is() )
- return;
-
- // Because it is a new num rule, numbering must be restarted never.
- mbRestartNumbering = sal_False;
- mbSetDefaults = sal_True;
- }
-
- const sal_Int32 nLevelCount = mxNumRules->getCount();
- if( mnLevel >= nLevelCount )
- mnLevel = sal::static_int_cast< sal_Int16 >(nLevelCount-1);
-
- if( mbSetDefaults )
- {
- // Because there is no list style sheet for this style, a default
- // format must be set for any level of this num rule.
- SvxXMLListStyleContext::SetDefaultStyle( mxNumRules, mnLevel,
- sal_False );
- }
+ return;
// --> OD 2008-04-23 #refactorlists#
if ( mnLevel == 0 ) // root <list> element
{
+ XMLTextListsHelper& rTextListsHelper( mrTxtImport.GetTextListHelper() );
// --> OD 2008-08-15 #i92811#
::rtl::OUString sListStyleDefaultListId;
{
@@ -266,7 +203,7 @@ XMLTextListBlockContext::XMLTextListBlockContext(
msListId = sListStyleDefaultListId;
if ( !bIsContinueNumberingAttributePresent &&
!mbRestartNumbering &&
- mrTxtImport.IsListProcessed( msListId ) )
+ rTextListsHelper.IsListProcessed( msListId ) )
{
mbRestartNumbering = sal_True;
}
@@ -276,23 +213,24 @@ XMLTextListBlockContext::XMLTextListBlockContext(
if ( msListId.getLength() == 0 )
{
// generate a new list id for the list
- msListId = mrTxtImport.GenerateNewListId();
+ msListId = rTextListsHelper.GenerateNewListId();
}
}
if ( bIsContinueNumberingAttributePresent && !mbRestartNumbering &&
msContinueListId.getLength() == 0 )
{
- if ( mrTxtImport.GetListStyleOfLastProcessedList() == msListStyleName &&
- mrTxtImport.GetLastProcessedListId() != msListId )
+ ::rtl::OUString Last( rTextListsHelper.GetLastProcessedListId() );
+ if ( rTextListsHelper.GetListStyleOfLastProcessedList() == msListStyleName
+ && Last != msListId )
{
- msContinueListId = mrTxtImport.GetLastProcessedListId();
+ msContinueListId = Last;
}
}
if ( msContinueListId.getLength() > 0 )
{
- if ( !mrTxtImport.IsListProcessed( msContinueListId ) )
+ if ( !rTextListsHelper.IsListProcessed( msContinueListId ) )
{
msContinueListId = ::rtl::OUString();
}
@@ -301,33 +239,30 @@ XMLTextListBlockContext::XMLTextListBlockContext(
// search continue list chain for master list and
// continue the master list.
::rtl::OUString sTmpStr =
- mrTxtImport.GetContinueListIdOfProcessedList( msContinueListId );
+ rTextListsHelper.GetContinueListIdOfProcessedList( msContinueListId );
while ( sTmpStr.getLength() > 0 )
{
msContinueListId = sTmpStr;
sTmpStr =
- mrTxtImport.GetContinueListIdOfProcessedList( msContinueListId );
+ rTextListsHelper.GetContinueListIdOfProcessedList( msContinueListId );
}
}
}
- if ( !mrTxtImport.IsListProcessed( msListId ) )
+ if ( !rTextListsHelper.IsListProcessed( msListId ) )
{
// --> OD 2008-08-15 #i92811#
- mrTxtImport.KeepListAsProcessed( msListId, msListStyleName,
- msContinueListId,
- sListStyleDefaultListId );
+ rTextListsHelper.KeepListAsProcessed(
+ msListId, msListStyleName, msContinueListId,
+ sListStyleDefaultListId );
// <--
}
}
// <--
// Remember this list block.
- mrTxtImport.SetListBlock( this );
-
- // There is no list item by now.
- mrTxtImport.SetListItem( 0 );
+ mrTxtImport.GetTextListHelper().PushListContext( this );
}
XMLTextListBlockContext::~XMLTextListBlockContext()
@@ -346,11 +281,11 @@ void XMLTextListBlockContext::EndElement()
}
// Restore current list block.
- mrTxtImport.SetListBlock( pParent );
+ mrTxtImport.GetTextListHelper().PopListContext();
// Any paragraph following the list within the same list item must not
// be numbered.
- mrTxtImport.SetListItem( 0 );
+ mrTxtImport.GetTextListHelper().SetListItem( 0 );
}
SvXMLImportContext *XMLTextListBlockContext::CreateChildContext(
@@ -391,3 +326,4 @@ const ::rtl::OUString& XMLTextListBlockContext::GetContinueListId() const
return msContinueListId;
}
// <--
+
diff --git a/xmloff/source/text/XMLTextListBlockContext.hxx b/xmloff/source/text/XMLTextListBlockContext.hxx
index 3a5a86e6cf..d412e551a1 100644
--- a/xmloff/source/text/XMLTextListBlockContext.hxx
+++ b/xmloff/source/text/XMLTextListBlockContext.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: XMLTextListBlockContext.hxx,v $
- * $Revision: 1.9 $
+ * $Revision: 1.9.2.1 $
*
* This file is part of OpenOffice.org.
*
@@ -50,8 +50,8 @@ class XMLTextListBlockContext : public SvXMLImportContext
SvXMLImportContextRef mxParentListBlock;
sal_Int16 mnLevel;
- sal_Bool mbRestartNumbering : 1;
- sal_Bool mbSetDefaults : 1;
+ sal_Bool mbRestartNumbering;
+ sal_Bool mbSetDefaults;
// --> OD 2008-04-22 #refactorlists#
// text:id property of <list> element, only valid for root <list> element
diff --git a/xmloff/source/text/XMLTextListItemContext.cxx b/xmloff/source/text/XMLTextListItemContext.cxx
index 45b8b88d32..2acb8da650 100644
--- a/xmloff/source/text/XMLTextListItemContext.cxx
+++ b/xmloff/source/text/XMLTextListItemContext.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: XMLTextListItemContext.cxx,v $
- * $Revision: 1.12 $
+ * $Revision: 1.12.2.1 $
*
* This file is part of OpenOffice.org.
*
@@ -35,13 +35,10 @@
#include <xmloff/nmspmap.hxx>
#include "xmlnmspe.hxx"
#include <xmloff/xmltoken.hxx>
-#ifndef _XMLOFF_TXTPARAI_HXX
#include "txtparai.hxx"
-#endif
+#include "txtlists.hxx"
#include "XMLTextListBlockContext.hxx"
-#ifndef _XMLOFF_TXTIMP_HXX
#include <xmloff/txtimp.hxx>
-#endif
// --> OD 2008-05-08 #refactorlists#
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/style/XStyle.hpp>
@@ -50,6 +47,7 @@
#include "XMLTextListItemContext.hxx"
+
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
@@ -138,13 +136,12 @@ XMLTextListItemContext::XMLTextListItemContext(
}
}
- DBG_ASSERT( !rTxtImport.GetListItem(),
- "SwXMLListItemContext::SwXMLListItemContext: list item is existing" );
-
// If this is a <text:list-item> element, then remember it as a sign
// that a bullet has to be generated.
- if( !bIsHeader )
- rTxtImport.SetListItem( this );
+ if( !bIsHeader ) {
+ rTxtImport.GetTextListHelper().SetListItem( this );
+ }
+
}
XMLTextListItemContext::~XMLTextListItemContext()
@@ -154,7 +151,7 @@ XMLTextListItemContext::~XMLTextListItemContext()
void XMLTextListItemContext::EndElement()
{
// finish current list item
- rTxtImport.SetListItem( 0 );
+ rTxtImport.GetTextListHelper().SetListItem( 0 );
}
SvXMLImportContext *XMLTextListItemContext::CreateChildContext(
diff --git a/xmloff/source/text/txtfldi.cxx b/xmloff/source/text/txtfldi.cxx
index 791a1034da..3b8b551b92 100644
--- a/xmloff/source/text/txtfldi.cxx
+++ b/xmloff/source/text/txtfldi.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: txtfldi.cxx,v $
- * $Revision: 1.71 $
+ * $Revision: 1.71.66.2 $
*
* This file is part of OpenOffice.org.
*
@@ -71,9 +71,7 @@
#include <com/sun/star/util/XUpdatable.hpp>
#include <com/sun/star/sdb/CommandType.hpp>
-#ifndef _RTL_USTRING
#include <rtl/ustring.hxx>
-#endif
#include <rtl/ustrbuf.hxx>
#include <rtl/math.hxx>
#include <tools/debug.hxx>
@@ -289,8 +287,9 @@ static __FAR_DATA SvXMLTokenMapEntry aTextFieldAttrTokenMap[] =
const SvXMLTokenMap& XMLTextImportHelper::GetTextFieldAttrTokenMap()
{
- if (NULL == pTextFieldAttrTokenMap) {
- pTextFieldAttrTokenMap = new SvXMLTokenMap(aTextFieldAttrTokenMap);
+ if ( !pTextFieldAttrTokenMap.get() ) {
+ pTextFieldAttrTokenMap.reset(
+ new SvXMLTokenMap(aTextFieldAttrTokenMap) );
}
return *pTextFieldAttrTokenMap;
@@ -3700,6 +3699,11 @@ XMLAnnotationImportContext::XMLAnnotationImportContext(
sPropertyTextRange(RTL_CONSTASCII_USTRINGPARAM(sAPI_TextRange))
{
bValid = sal_True;
+
+ // remember old list item and block (#91964#) and reset them
+ // for the text frame
+ // do this in the constructor, not in CreateChildContext (#i93392#)
+ GetImport().GetTextImport()->PushListContext();
}
void XMLAnnotationImportContext::ProcessAttribute(
@@ -3742,19 +3746,12 @@ SvXMLImportContext* XMLAnnotationImportContext::CreateChildContext(
mxOldCursor = xTxtImport->GetCursor();
mxCursor = xText->createTextCursor();
}
-
+
if( mxCursor.is() )
{
xTxtImport->SetCursor( mxCursor );
pContext = xTxtImport->CreateTextChildContext( GetImport(), nPrefix, rLocalName, xAttrList );
}
-
- // remember old list item and block (#91964#) and reset them
- // for the text frame
- mxOldListBlock = xTxtImport->_GetListBlock();
- mxOldListItem = xTxtImport->_GetListItem();
- xTxtImport->_SetListBlock( NULL );
- xTxtImport->_SetListItem( NULL );
}
}
catch ( Exception& )
@@ -3785,12 +3782,8 @@ void XMLAnnotationImportContext::EndElement()
if( mxOldCursor.is() )
GetImport().GetTextImport()->SetCursor( mxOldCursor );
- // reinstall old list item (if necessary) #91964#
- if ( mxOldListBlock.Is() )
- {
- GetImport().GetTextImport()->_SetListBlock( mxOldListBlock );
- GetImport().GetTextImport()->_SetListItem( mxOldListItem );
- }
+ // reinstall old list item #91964#
+ GetImport().GetTextImport()->PopListContext();
if ( bValid )
{
diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx
index 4fa0f66688..d5a0331d4a 100644
--- a/xmloff/source/text/txtimp.cxx
+++ b/xmloff/source/text/txtimp.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: txtimp.cxx,v $
- * $Revision: 1.146 $
+ * $Revision: 1.143.2.3 $
*
* This file is part of OpenOffice.org.
*
@@ -46,9 +46,7 @@
#include <com/sun/star/text/XTextFramesSupplier.hpp>
#include <com/sun/star/text/XTextGraphicObjectsSupplier.hpp>
#include <com/sun/star/text/XTextEmbeddedObjectsSupplier.hpp>
-#ifndef _COM_SUN_STAR_TEXT_TEXTCONTENTANCHORTYPE_HPP
#include <com/sun/star/text/TextContentAnchorType.hpp>
-#endif
#include <com/sun/star/text/XTextFrame.hpp>
#include <com/sun/star/drawing/XShapes.hpp>
#include <com/sun/star/util/DateTime.hpp>
@@ -62,15 +60,9 @@
#include <xmloff/xmlnumfi.hxx>
#include <xmloff/xmlnumi.hxx>
-#ifndef _XMLOFF_TXTPARAI_HXX
#include "txtparai.hxx"
-#endif
-#ifndef _XMLOFF_TXTIMP_HXX
#include <xmloff/txtimp.hxx>
-#endif
-#ifndef _XMLOFF_TXTPRMAP_HXX
#include <xmloff/txtprmap.hxx>
-#endif
#include "txtimppr.hxx"
#include <xmloff/xmlimp.hxx>
#include "txtvfldi.hxx"
@@ -78,15 +70,11 @@
#include "XMLTextListItemContext.hxx"
#include "XMLTextListBlockContext.hxx"
#include "XMLTextFrameContext.hxx"
-#ifndef _XMLOFF_XMLPROPERTYBACKPATCHTER_HXX
#include "XMLPropertyBackpatcher.hxx"
-#endif
#include "XMLTextFrameHyperlinkContext.hxx"
#include "XMLSectionImportContext.hxx"
#include "XMLIndexTOCContext.hxx"
-#ifndef _XMLOFF_XMLFONTSTYLESCONTEXT_HXX
#include <xmloff/XMLFontStylesContext.hxx>
-#endif
#include <xmloff/ProgressBarHelper.hxx>
#include <xmloff/nmspmap.hxx>
#include <xmloff/XMLEventsImportContext.hxx>
@@ -94,9 +82,7 @@
#include "XMLChangeImportContext.hxx"
#include "XMLAutoMarkFileContext.hxx"
-#ifndef _XMLOFF_XMLCALCULATION_SETTINGS_CONTEXT_HXX
#include "XMLCalculationSettingsContext.hxx"
-#endif
#include <xmloff/formsimp.hxx>
#include "XMLNumberStylesImport.hxx"
// --> OD 2006-10-12 #i69629#
@@ -353,6 +339,21 @@ static __FAR_DATA SvXMLTokenMapEntry aTextPAttrTokenMap[] =
XML_TOKEN_MAP_END
};
+static __FAR_DATA SvXMLTokenMapEntry aTextNumberedParagraphAttrTokenMap[] =
+{
+ { XML_NAMESPACE_XML , XML_ID, XML_TOK_TEXT_NUMBERED_PARAGRAPH_XMLID },
+ { XML_NAMESPACE_TEXT, XML_LIST_ID,
+ XML_TOK_TEXT_NUMBERED_PARAGRAPH_LIST_ID },
+ { XML_NAMESPACE_TEXT, XML_LEVEL, XML_TOK_TEXT_NUMBERED_PARAGRAPH_LEVEL },
+ { XML_NAMESPACE_TEXT, XML_STYLE_NAME,
+ XML_TOK_TEXT_NUMBERED_PARAGRAPH_STYLE_NAME },
+ { XML_NAMESPACE_TEXT, XML_CONTINUE_NUMBERING,
+ XML_TOK_TEXT_NUMBERED_PARAGRAPH_CONTINUE_NUMBERING },
+ { XML_NAMESPACE_TEXT, XML_START_VALUE,
+ XML_TOK_TEXT_NUMBERED_PARAGRAPH_START_VALUE },
+ XML_TOKEN_MAP_END
+};
+
static __FAR_DATA SvXMLTokenMapEntry aTextListBlockAttrTokenMap[] =
{
{ XML_NAMESPACE_XML , XML_ID, XML_TOK_TEXT_LIST_BLOCK_XMLID },
@@ -453,6 +454,7 @@ XMLTextImportHelper::XMLTextImportHelper(
, pTextPElemTokenMap( 0 )
, pTextPAttrTokenMap( 0 )
, pTextFieldAttrTokenMap( 0 )
+, pTextNumberedParagraphAttrTokenMap( 0 )
, pTextListBlockAttrTokenMap( 0 )
, pTextListBlockElemTokenMap( 0 )
, pTextFrameAttrTokenMap( 0 )
@@ -626,25 +628,6 @@ XMLTextImportHelper::XMLTextImportHelper(
XMLTextImportHelper::~XMLTextImportHelper()
{
- delete pTextElemTokenMap;
- delete pTextPElemTokenMap;
- delete pTextPAttrTokenMap;
- delete pTextListBlockAttrTokenMap;
- delete pTextListBlockElemTokenMap;
- delete pTextFieldAttrTokenMap;
- delete pTextFrameAttrTokenMap;
- delete pTextContourAttrTokenMap;
- delete pTextHyperlinkAttrTokenMap;
- delete pTextMasterPageElemTokenMap;
-
- delete pRenameMap;
-
- delete pPrevFrmNames;
- delete pNextFrmNames;
-
- // --> OD 2008-04-25 #refactorlists#
- delete mpTextListsHelper;
- // <--
// --> OD 2006-10-12 #i69629#
delete [] mpOutlineStylesCandidates;
// <--
@@ -999,26 +982,60 @@ OUString XMLTextImportHelper::SetStyleAndAttrs(
// Set numbering rules
Reference < XIndexReplace > xNumRules(xPropSet->getPropertyValue( sNumberingRules ), UNO_QUERY);
- if( IsInList() )
- {
- XMLTextListBlockContext *pListBlock = GetListBlock();
+ XMLTextListBlockContext * pListBlock(0);
+ XMLTextListItemContext * pListItem(0);
+ XMLNumberedParaContext * pNumberedParagraph(0);
+ GetTextListHelper().ListContextTop(
+ pListBlock, pListItem, pNumberedParagraph);
+
+ OSL_ENSURE(!(pListBlock && pNumberedParagraph), "XMLTextImportHelper::"
+ "SetStyleAndAttrs: both list and numbered-paragraph???");
+
+ Reference < XIndexReplace > xNewNumRules;
+ sal_Int8 nLevel(-1);
+ ::rtl::OUString sListId;
+ sal_Int16 nStartValue(-1);
+ bool bNumberingIsNumber(true);
+
+ if (pListBlock) {
+
+ if (!pListItem) {
+ bNumberingIsNumber = false; // list-header
+ }
// --> OD 2008-05-08 #refactorlists#
// consider text:style-override property of <text:list-item>
-// Reference < XIndexReplace > xNewNumRules(
-// pListBlock->GetNumRules());
- XMLTextListItemContext* pListItem = GetListItem();
- Reference < XIndexReplace > xNewNumRules(
- pListItem != 0 && pListItem->HasNumRulesOverride()
- ? pListItem->GetNumRulesOverride()
- : pListBlock->GetNumRules() );
+ xNewNumRules.set(
+ (pListItem != 0 && pListItem->HasNumRulesOverride())
+ ? pListItem->GetNumRulesOverride()
+ : pListBlock->GetNumRules() );
+ // <--
+ nLevel = static_cast<sal_Int8>(pListBlock->GetLevel());
+
+ if ( pListItem && pListItem->HasStartValue() ) {
+ nStartValue = pListItem->GetStartValue();
+ }
+
+ // --> OD 2008-08-15 #i92811#
+ sListId = mpTextListsHelper->GetListIdForListBlock( *pListBlock );
// <--
+ }
+ else if (pNumberedParagraph)
+ {
+ xNewNumRules.set(pNumberedParagraph->GetNumRules());
+ nLevel = static_cast<sal_Int8>(pNumberedParagraph->GetLevel());
+ sListId = pNumberedParagraph->GetListId();
+ nStartValue = pNumberedParagraph->GetStartValue();
+ }
+
+ if (pListBlock || pNumberedParagraph)
+ {
sal_Bool bSameNumRules = xNewNumRules == xNumRules;
if( !bSameNumRules && xNewNumRules.is() && xNumRules.is() )
{
// If the interface pointers are different then this does
// not mean that the num rules are different. Further tests
- // are rquired then. However, if only one num rule is
+ // are required then. However, if only one num rule is
// set, no tests are required of course.
Reference< XNamed > xNewNamed( xNewNumRules, UNO_QUERY );
Reference< XNamed > xNamed( xNumRules, UNO_QUERY );
@@ -1055,8 +1072,7 @@ OUString XMLTextImportHelper::SetStyleAndAttrs(
}
}
- sal_Int8 nLevel = (sal_Int8)pListBlock->GetLevel();
- if( !pListItem &&
+ if (!bNumberingIsNumber &&
xPropSetInfo->hasPropertyByName( sNumberingIsNumber ) )
{
xPropSet->setPropertyValue( sNumberingIsNumber, Any(sal_False) );
@@ -1067,7 +1083,7 @@ OUString XMLTextImportHelper::SetStyleAndAttrs(
bNumberingLevelSet = true;
// <--
- if( pListBlock->IsRestartNumbering() )
+ if( pListBlock && pListBlock->IsRestartNumbering() )
{
// TODO: property missing
if( xPropSetInfo->hasPropertyByName( sParaIsNumberingRestart ) )
@@ -1078,27 +1094,19 @@ OUString XMLTextImportHelper::SetStyleAndAttrs(
}
pListBlock->ResetRestartNumbering();
}
- if( pListItem && pListItem->HasStartValue() &&
+
+ if ( 0 <= nStartValue &&
xPropSetInfo->hasPropertyByName( sNumberingStartValue ) )
{
xPropSet->setPropertyValue(sNumberingStartValue,
- makeAny(pListItem->GetStartValue()));
+ makeAny(nStartValue));
}
- // --> OD 2008-04-23 #refactorlists#
- if ( xPropSetInfo->hasPropertyByName( sPropNameListId ) )
- {
- // --> OD 2008-08-15 #i92811#
- const ::rtl::OUString sListBlockListId(
- mpTextListsHelper->GetListIdForListBlock( *pListBlock ) );
- if ( sListBlockListId.getLength() != 0 )
- {
- xPropSet->setPropertyValue( sPropNameListId,
- makeAny( sListBlockListId ) );
- }
- // <--
+
+ if (sListId.getLength()) {
+ xPropSet->setPropertyValue( sPropNameListId, makeAny(sListId) );
}
- // <--
- SetListItem( (XMLTextListItemContext *)0 );
+
+ GetTextListHelper().SetListItem( (XMLTextListItemContext *)0 );
}
else
{
@@ -1769,8 +1777,9 @@ SvXMLImportContext *XMLTextImportHelper::CreateTextChildContext(
rImport.GetProgressBarHelper()->Increment();
}
break;
- case XML_TOK_TEXT_NUMBERED_PARAGRAPH:
- pContext = new XMLNumberedParaContext( rImport, nPrefix, rLocalName );
+ case XML_TOK_TEXT_NUMBERED_PARAGRAPH:
+ pContext = new XMLNumberedParaContext(
+ rImport, nPrefix, rLocalName, xAttrList );
break;
case XML_TOK_TEXT_LIST:
pContext = new XMLTextListBlockContext( rImport, *this,
@@ -2063,58 +2072,49 @@ XMLPropStyleContext* XMLTextImportHelper::FindPageMaster(
return pStyle;
}
-XMLTextListItemContext *XMLTextImportHelper::GetListItem()
-{
- return (XMLTextListItemContext *)&xListItem;
-}
-void XMLTextImportHelper::SetListItem( XMLTextListItemContext *pListItem )
+void XMLTextImportHelper::PushListContext(XMLTextListBlockContext *i_pListBlock)
{
- xListItem = pListItem;
+ GetTextListHelper().PushListContext(i_pListBlock);
}
-void XMLTextImportHelper::_SetListItem( SvXMLImportContext *pListItem )
+void XMLTextImportHelper::PopListContext()
{
- xListItem = PTR_CAST( XMLTextListItemContext, pListItem );
+ GetTextListHelper().PopListContext();
}
-XMLTextListBlockContext *XMLTextImportHelper::GetListBlock()
-{
- return (XMLTextListBlockContext *)&xListBlock;
-}
-void XMLTextImportHelper::SetListBlock( XMLTextListBlockContext *pListBlock )
+const SvXMLTokenMap& XMLTextImportHelper::GetTextNumberedParagraphAttrTokenMap()
{
- xListBlock = pListBlock;
-}
+ if( !pTextNumberedParagraphAttrTokenMap.get() )
+ pTextNumberedParagraphAttrTokenMap.reset(
+ new SvXMLTokenMap( aTextNumberedParagraphAttrTokenMap ) );
-void XMLTextImportHelper::_SetListBlock( SvXMLImportContext *pListBlock )
-{
- xListBlock = PTR_CAST( XMLTextListBlockContext, pListBlock );
+ return *pTextNumberedParagraphAttrTokenMap;
}
const SvXMLTokenMap& XMLTextImportHelper::GetTextListBlockAttrTokenMap()
{
- if( !pTextListBlockAttrTokenMap )
- pTextListBlockAttrTokenMap =
- new SvXMLTokenMap( aTextListBlockAttrTokenMap );
+ if( !pTextListBlockAttrTokenMap.get() )
+ pTextListBlockAttrTokenMap.reset(
+ new SvXMLTokenMap( aTextListBlockAttrTokenMap ) );
return *pTextListBlockAttrTokenMap;
}
const SvXMLTokenMap& XMLTextImportHelper::GetTextListBlockElemTokenMap()
{
- if( !pTextListBlockElemTokenMap )
- pTextListBlockElemTokenMap =
- new SvXMLTokenMap( aTextListBlockElemTokenMap );
+ if( !pTextListBlockElemTokenMap.get() )
+ pTextListBlockElemTokenMap.reset(
+ new SvXMLTokenMap( aTextListBlockElemTokenMap ) );
return *pTextListBlockElemTokenMap;
}
SvI18NMap& XMLTextImportHelper::GetRenameMap()
{
- if( 0 == pRenameMap )
- pRenameMap = new SvI18NMap();
+ if( !pRenameMap.get() )
+ pRenameMap.reset( new SvI18NMap() );
return *pRenameMap;
}
@@ -2241,10 +2241,10 @@ void XMLTextImportHelper::ConnectFrameChains(
}
else
{
- if( !pPrevFrmNames )
+ if( !pPrevFrmNames.get() )
{
- pPrevFrmNames = new SvStringsDtor;
- pNextFrmNames = new SvStringsDtor;
+ pPrevFrmNames.reset( new SvStringsDtor );
+ pNextFrmNames.reset( new SvStringsDtor );
}
pPrevFrmNames->Insert( new String( rFrmName ),
pPrevFrmNames->Count() );
@@ -2252,7 +2252,7 @@ void XMLTextImportHelper::ConnectFrameChains(
pNextFrmNames->Count() );
}
}
- if( pPrevFrmNames && pPrevFrmNames->Count() )
+ if( pPrevFrmNames.get() && pPrevFrmNames->Count() )
{
sal_uInt16 nCount = pPrevFrmNames->Count();
for( sal_uInt16 i=0; i<nCount; i++ )
@@ -2426,42 +2426,3 @@ void XMLTextImportHelper::ResetOpenRedlineId()
SetOpenRedlineId(sEmpty);
}
-// --> OD 2008-04-25 #refactorlists#
-// --> OD 2008-08-15 #i92811#
-void XMLTextImportHelper::KeepListAsProcessed( ::rtl::OUString sListId,
- ::rtl::OUString sListStyleName,
- ::rtl::OUString sContinueListId,
- ::rtl::OUString sListStyleDefaultListId )
-{
- mpTextListsHelper->KeepListAsProcessed( sListId, sListStyleName,
- sContinueListId,
- sListStyleDefaultListId );
-}
-// <--
-
-sal_Bool XMLTextImportHelper::IsListProcessed( const ::rtl::OUString sListId ) const
-{
- return mpTextListsHelper->IsListProcessed( sListId );
-}
-
-::rtl::OUString XMLTextImportHelper::GetContinueListIdOfProcessedList(
- const ::rtl::OUString sListId ) const
-{
- return mpTextListsHelper->GetContinueListIdOfProcessedList( sListId );
-}
-
-const ::rtl::OUString& XMLTextImportHelper::GetLastProcessedListId() const
-{
- return mpTextListsHelper->GetLastProcessedListId();
-}
-
-const ::rtl::OUString& XMLTextImportHelper::GetListStyleOfLastProcessedList() const
-{
- return mpTextListsHelper->GetListStyleOfLastProcessedList();
-}
-
-::rtl::OUString XMLTextImportHelper::GenerateNewListId() const
-{
- return mpTextListsHelper->GenerateNewListId();
-}
-// <--
diff --git a/xmloff/source/text/txtlists.cxx b/xmloff/source/text/txtlists.cxx
index 04db36bd89..90906a8e1e 100644
--- a/xmloff/source/text/txtlists.cxx
+++ b/xmloff/source/text/txtlists.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: txtlists.cxx,v $
- * $Revision: 1.4 $
+ * $Revision: 1.2.24.4 $
*
* This file is part of OpenOffice.org.
*
@@ -36,12 +36,22 @@
#include <tools/date.hxx>
#include <tools/time.hxx>
-// --> OD 2008-08-15 #i92811#
+#include <xmloff/txtimp.hxx>
+#include <xmloff/xmlimp.hxx>
+#include <xmloff/xmlnumi.hxx>
+
+#include <com/sun/star/style/XStyle.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include "XMLTextListItemContext.hxx"
#include "XMLTextListBlockContext.hxx"
-// <--
+#include "txtparai.hxx"
+
+
+using namespace ::com::sun::star;
+
XMLTextListsHelper::XMLTextListsHelper()
- : mpProcessedLists( 0 ),
+ : mpProcessedLists( 0 ),
msLastProcessedListId(),
msListStyleOfLastProcessedList(),
// --> OD 2008-08-15 #i92811#
@@ -78,6 +88,63 @@ XMLTextListsHelper::~XMLTextListsHelper()
}
}
+void XMLTextListsHelper::PushListContext(
+ XMLTextListBlockContext *i_pListBlock)
+{
+// fprintf(stderr, "PushListContext\n");
+ mListStack.push(::boost::make_tuple(i_pListBlock,
+ static_cast<XMLTextListItemContext*>(0),
+ static_cast<XMLNumberedParaContext*>(0)));
+}
+
+void XMLTextListsHelper::PushListContext(
+ XMLNumberedParaContext *i_pNumberedParagraph)
+{
+// fprintf(stderr, "PushListContext(NP)\n");
+ mListStack.push(::boost::make_tuple(
+ static_cast<XMLTextListBlockContext*>(0),
+ static_cast<XMLTextListItemContext*>(0), i_pNumberedParagraph));
+}
+
+void XMLTextListsHelper::PopListContext()
+{
+ OSL_ENSURE(mListStack.size(),
+ "internal error: PopListContext: mListStack empty");
+// fprintf(stderr, "PopListContext\n");
+ if (mListStack.size()) mListStack.pop();
+}
+
+void XMLTextListsHelper::ListContextTop(
+ XMLTextListBlockContext*& o_pListBlockContext,
+ XMLTextListItemContext*& o_pListItemContext,
+ XMLNumberedParaContext*& o_pNumberedParagraphContext )
+{
+ if (mListStack.size()) {
+ o_pListBlockContext =
+ static_cast<XMLTextListBlockContext*>(&mListStack.top().get<0>());
+ o_pListItemContext =
+ static_cast<XMLTextListItemContext *>(&mListStack.top().get<1>());
+ o_pNumberedParagraphContext =
+ static_cast<XMLNumberedParaContext *>(&mListStack.top().get<2>());
+ }
+}
+
+void XMLTextListsHelper::SetListItem( XMLTextListItemContext *i_pListItem )
+{
+ // may be cleared by ListBlockContext for upper list...
+ if (i_pListItem) {
+ OSL_ENSURE(mListStack.size(),
+ "internal error: SetListItem: mListStack empty");
+ OSL_ENSURE(mListStack.top().get<0>(),
+ "internal error: SetListItem: mListStack has no ListBlock");
+ OSL_ENSURE(!mListStack.top().get<1>(),
+ "error: SetListItem: list item already exists");
+ }
+ if (mListStack.size()) {
+ mListStack.top().get<1>() = i_pListItem;
+ }
+}
+
// --> OD 2008-08-15 #i92811# - handling for parameter <sListStyleDefaultListId>
void XMLTextListsHelper::KeepListAsProcessed( ::rtl::OUString sListId,
::rtl::OUString sListStyleName,
@@ -286,3 +353,190 @@ sal_Bool XMLTextListsHelper::EqualsToTopListStyleOnStack( const ::rtl::OUString
? sListId == mpListStack->back().second
: sal_False;
}
+
+::rtl::OUString
+XMLTextListsHelper::GetNumberedParagraphListId(
+ const sal_uInt16 i_Level,
+ const ::rtl::OUString i_StyleName)
+{
+ if (!i_StyleName.getLength()) {
+ OSL_ENSURE(false, "invalid numbered-paragraph: no style-name");
+ }
+ if (i_StyleName.getLength()
+ && (i_Level < mLastNumberedParagraphs.size())
+ && (mLastNumberedParagraphs[i_Level].first == i_StyleName) )
+ {
+ OSL_ENSURE(mLastNumberedParagraphs[i_Level].second.getLength(),
+ "internal error: numbered-paragraph style-name but no list-id?");
+ return mLastNumberedParagraphs[i_Level].second;
+ } else {
+ return GenerateNewListId();
+ }
+}
+
+static void
+ClampLevel(uno::Reference<container::XIndexReplace> const& i_xNumRules,
+ sal_Int16 & io_rLevel)
+{
+ OSL_ENSURE(i_xNumRules.is(), "internal error: ClampLevel: NumRules null");
+ if (i_xNumRules.is()) {
+ const sal_Int32 nLevelCount( i_xNumRules->getCount() );
+ if ( io_rLevel >= nLevelCount ) {
+ io_rLevel = sal::static_int_cast< sal_Int16 >(nLevelCount-1);
+ }
+ }
+}
+
+uno::Reference<container::XIndexReplace>
+XMLTextListsHelper::EnsureNumberedParagraph(
+ SvXMLImport & i_rImport,
+ const ::rtl::OUString i_ListId,
+ sal_Int16 & io_rLevel, const ::rtl::OUString i_StyleName)
+{
+ OSL_ENSURE(i_ListId.getLength(), "inavlid ListId");
+ OSL_ENSURE(io_rLevel >= 0, "inavlid Level");
+ NumParaList_t & rNPList( mNPLists[i_ListId] );
+ const ::rtl::OUString none; // default
+ if (!rNPList.size() && (0 != io_rLevel)) {
+ // create default list style for top level
+ sal_Int16 lev(0);
+ rNPList.push_back(::std::make_pair(none,
+ MakeNumRule(i_rImport, 0, none, none, lev) ));
+ }
+ // create num rule first because this might clamp the level...
+ uno::Reference<container::XIndexReplace> xNumRules;
+ if ((0 == io_rLevel) || !rNPList.size() || i_StyleName.getLength()) {
+ // no parent to inherit from, or explicit style given => new numrules!
+ // index of parent: level - 1, but maybe that does not exist
+ const size_t parent( std::min(static_cast<size_t>(io_rLevel),
+ rNPList.size()) - 1 );
+ xNumRules = MakeNumRule(i_rImport,
+ io_rLevel > 0 ? rNPList[parent].second : 0,
+ io_rLevel > 0 ? rNPList[parent].first : none,
+ i_StyleName, io_rLevel);
+ } else {
+ // no style given, but has a parent => reuse parent numrules!
+ ClampLevel(rNPList.back().second, io_rLevel);
+ }
+ if (static_cast<sal_uInt16>(io_rLevel) + 1U > rNPList.size()) {
+ // new level: need to enlarge
+ for (size_t i = rNPList.size();
+ i < static_cast<size_t>(io_rLevel); ++i) {
+ rNPList.push_back(rNPList.back());
+ }
+ rNPList.push_back(xNumRules.is()
+ ? ::std::make_pair(i_StyleName, xNumRules)
+ : rNPList.back());
+ } else {
+ // old level: no need to enlarge; possibly shrink
+ if (xNumRules.is()) {
+ rNPList[io_rLevel] = std::make_pair(i_StyleName, xNumRules);
+ }
+ if (static_cast<sal_uInt16>(io_rLevel) + 1U < rNPList.size()) {
+ rNPList.erase(rNPList.begin() + io_rLevel + 1, rNPList.end());
+ }
+ }
+ // remember the list id
+ if (mLastNumberedParagraphs.size() <= static_cast<size_t>(io_rLevel)) {
+ mLastNumberedParagraphs.resize(io_rLevel+1);
+ }
+ mLastNumberedParagraphs[io_rLevel] = std::make_pair(i_StyleName, i_ListId);
+ return rNPList.back().second;
+}
+
+/** extracted from the XMLTextListBlockContext constructor */
+uno::Reference<container::XIndexReplace>
+XMLTextListsHelper::MakeNumRule(
+ SvXMLImport & i_rImport,
+ const uno::Reference<container::XIndexReplace>& i_rNumRule,
+ const ::rtl::OUString i_ParentStyleName,
+ const ::rtl::OUString i_StyleName,
+ sal_Int16 & io_rLevel,
+ sal_Bool* o_pRestartNumbering,
+ sal_Bool* io_pSetDefaults)
+{
+ uno::Reference<container::XIndexReplace> xNumRules(i_rNumRule);
+ if ( i_StyleName.getLength() &&
+ i_StyleName != i_ParentStyleName )
+ {
+ const ::rtl::OUString sDisplayStyleName(
+ i_rImport.GetStyleDisplayName( XML_STYLE_FAMILY_TEXT_LIST,
+ i_StyleName) );
+ const uno::Reference < container::XNameContainer >& rNumStyles(
+ i_rImport.GetTextImport()->GetNumberingStyles() );
+ if( rNumStyles.is() && rNumStyles->hasByName( sDisplayStyleName ) )
+ {
+ uno::Reference < style::XStyle > xStyle;
+ uno::Any any = rNumStyles->getByName( sDisplayStyleName );
+ any >>= xStyle;
+
+ // --> OD 2008-05-07 #refactorlists# - no longer needed
+// // If the style has not been used, the restart numbering has
+// // to be set never.
+// if ( mbRestartNumbering && !xStyle->isInUse() )
+// {
+// mbRestartNumbering = sal_False;
+// }
+ // <--
+
+ uno::Reference< beans::XPropertySet > xPropSet( xStyle,
+ uno::UNO_QUERY );
+ any = xPropSet->getPropertyValue(
+ i_rImport.GetTextImport()->sNumberingRules );
+ any >>= xNumRules;
+ }
+ else
+ {
+ const SvxXMLListStyleContext *pListStyle(
+ i_rImport.GetTextImport()->FindAutoListStyle( i_StyleName ) );
+ if( pListStyle )
+ {
+ xNumRules = pListStyle->GetNumRules();
+ // --> OD 2008-05-07 #refactorlists# - no longer needed
+// sal_Bool bUsed = mxNumRules.is();
+ // <--
+ if( !xNumRules.is() )
+ {
+ pListStyle->CreateAndInsertAuto();
+ xNumRules = pListStyle->GetNumRules();
+ }
+ // --> OD 2008-05-07 #refactorlists# - no longer needed
+// if( mbRestartNumbering && !bUsed )
+// mbRestartNumbering = sal_False;
+ // <--
+ }
+ }
+ }
+
+ sal_Bool bSetDefaults(io_pSetDefaults ? *io_pSetDefaults : sal_False);
+ if ( !xNumRules.is() )
+ {
+ // If no style name has been specified for this style and for any
+ // parent or if no num rule with the specified name exists,
+ // create a new one.
+
+ xNumRules =
+ SvxXMLListStyleContext::CreateNumRule( i_rImport.GetModel() );
+ DBG_ASSERT( xNumRules.is(), "got no numbering rule" );
+ if ( !xNumRules.is() )
+ return xNumRules;
+
+ // Because it is a new num rule, numbering must not be restarted.
+ if (o_pRestartNumbering) *o_pRestartNumbering = sal_False;
+ bSetDefaults = sal_True;
+ if (io_pSetDefaults) *io_pSetDefaults = bSetDefaults;
+ }
+
+ ClampLevel(xNumRules, io_rLevel);
+
+ if ( bSetDefaults )
+ {
+ // Because there is no list style sheet for this style, a default
+ // format must be set for any level of this num rule.
+ SvxXMLListStyleContext::SetDefaultStyle( xNumRules, io_rLevel,
+ sal_False );
+ }
+
+ return xNumRules;
+}
+
diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx
index e56f4e11c7..52e58377b7 100644
--- a/xmloff/source/text/txtparai.cxx
+++ b/xmloff/source/text/txtparai.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: txtparai.cxx,v $
- * $Revision: 1.69 $
+ * $Revision: 1.68.2.2 $
*
* This file is part of OpenOffice.org.
*
@@ -64,6 +64,7 @@
#include "XMLTextFrameHyperlinkContext.hxx"
#include <xmloff/XMLEventsImportContext.hxx>
#include "XMLChangeImportContext.hxx"
+#include "txtlists.hxx"
// OD 2004-04-21 #i26791#
@@ -658,7 +659,8 @@ SvXMLImportContext *XMLImpRubyContext_Impl::CreateChildContext(
xAttrList,
pHint );
else
- pContext = 0; // TODO What value should this be?
+ pContext = new SvXMLImportContext(
+ GetImport(), nPrefix, rLocalName );
}
else
pContext = SvXMLImportContext::CreateChildContext( nPrefix, rLocalName,
@@ -2068,28 +2070,121 @@ void XMLParaContext::Characters( const OUString& rChars )
TYPEINIT1( XMLNumberedParaContext, SvXMLImportContext );
XMLNumberedParaContext::XMLNumberedParaContext(
- SvXMLImport& rImport,
- sal_uInt16 nPrfx,
- const OUString& rLName ) :
- SvXMLImportContext( rImport, nPrfx, rLName )
- {
- }
-
- XMLNumberedParaContext::~XMLNumberedParaContext()
- {
- }
-
- SvXMLImportContext *XMLNumberedParaContext::CreateChildContext(
- sal_uInt16 nPrefix, const OUString& rLocalName,
- const Reference< xml::sax::XAttributeList > & xAttrList )
- {
- //FIXME #i52127#: currently <text:numbered-paragraph> is not implemented!
- SvXMLImportContext *pContext = GetImport().GetTextImport()->CreateTextChildContext(
- GetImport(), nPrefix, rLocalName, xAttrList, XML_TEXT_TYPE_BODY );
- return pContext;
- }
-
- void XMLNumberedParaContext::Characters( const OUString& )
- {
- }
+ SvXMLImport& i_rImport,
+ sal_uInt16 i_nPrefix,
+ const OUString& i_rLocalName,
+ const Reference< xml::sax::XAttributeList > & i_xAttrList ) :
+ SvXMLImportContext( i_rImport, i_nPrefix, i_rLocalName ),
+ m_Level(0),
+ m_StartValue(-1),
+ m_ListId(),
+ m_xNumRules()
+{
+ ::rtl::OUString StyleName;
+ bool ContinuteNumbering(false);
+
+ const SvXMLTokenMap& rTokenMap(
+ i_rImport.GetTextImport()->GetTextNumberedParagraphAttrTokenMap() );
+
+ const sal_Int16 nAttrCount( i_xAttrList.is() ?
+ i_xAttrList->getLength() : 0 );
+ for ( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const ::rtl::OUString& rAttrName( i_xAttrList->getNameByIndex( i ) );
+ const ::rtl::OUString& rValue ( i_xAttrList->getValueByIndex( i ) );
+
+ ::rtl::OUString aLocalName;
+ const sal_uInt16 nPrefix(
+ GetImport().GetNamespaceMap().GetKeyByAttrName(
+ rAttrName, &aLocalName ) );
+ switch( rTokenMap.Get( nPrefix, aLocalName ) )
+ {
+ case XML_TOK_TEXT_NUMBERED_PARAGRAPH_XMLID:
+ m_XmlId = rValue;
+//FIXME: there is no UNO API for lists
+ break;
+ case XML_TOK_TEXT_NUMBERED_PARAGRAPH_LIST_ID:
+ m_ListId = rValue;
+ break;
+ case XML_TOK_TEXT_NUMBERED_PARAGRAPH_LEVEL:
+ {
+ sal_Int32 nTmp = rValue.toInt32();
+ if ( nTmp >= 1 && nTmp <= SHRT_MAX ) {
+ m_Level = static_cast<sal_uInt16>(nTmp) - 1;
+ }
+ }
+ break;
+ case XML_TOK_TEXT_NUMBERED_PARAGRAPH_STYLE_NAME:
+ StyleName = rValue;
+ break;
+ case XML_TOK_TEXT_NUMBERED_PARAGRAPH_CONTINUE_NUMBERING:
+ ContinuteNumbering = IsXMLToken(rValue, XML_TRUE);
+// ??? what in Fred's name is this supposed to do?
+ break;
+ case XML_TOK_TEXT_NUMBERED_PARAGRAPH_START_VALUE:
+ {
+ sal_Int32 nTmp = rValue.toInt32();
+ if ( nTmp >= 0 && nTmp <= SHRT_MAX ) {
+ m_StartValue = static_cast<sal_Int16>(nTmp);
+ }
+ }
+ break;
+ }
+ }
+
+ XMLTextListsHelper& rTextListsHelper(
+ i_rImport.GetTextImport()->GetTextListHelper() );
+ if (!m_ListId.getLength()) {
+ OSL_ENSURE( ! i_rImport.GetODFVersion().equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("1.2") ),
+ "invalid numbered-paragraph: no list-id (1.2)");
+ m_ListId = rTextListsHelper.GetNumberedParagraphListId(m_Level,
+ StyleName);
+ OSL_ENSURE(m_ListId.getLength(), "numbered-paragraph: no ListId");
+ if (!m_ListId.getLength()) {
+ return;
+ }
+ }
+ m_xNumRules = rTextListsHelper.EnsureNumberedParagraph( i_rImport,
+ m_ListId, m_Level, StyleName);
+
+ OSL_ENSURE(m_xNumRules.is(), "numbered-paragraph: no NumRules");
+
+ i_rImport.GetTextImport()->GetTextListHelper().PushListContext( this );
+}
+XMLNumberedParaContext::~XMLNumberedParaContext()
+{
+}
+
+void XMLNumberedParaContext::EndElement()
+{
+ if (m_ListId.getLength()) {
+ GetImport().GetTextImport()->PopListContext();
+ }
+}
+
+SvXMLImportContext *XMLNumberedParaContext::CreateChildContext(
+ sal_uInt16 i_nPrefix, const OUString& i_rLocalName,
+ const Reference< xml::sax::XAttributeList > & i_xAttrList )
+{
+ SvXMLImportContext *pContext( 0 );
+
+ if ( XML_NAMESPACE_TEXT == i_nPrefix )
+ {
+ bool bIsHeader( IsXMLToken( i_rLocalName, XML_H ) );
+ if ( bIsHeader || IsXMLToken( i_rLocalName, XML_P ) )
+ {
+ pContext = new XMLParaContext( GetImport(),
+ i_nPrefix, i_rLocalName, i_xAttrList, bIsHeader );
+// ignore text:number } else if (IsXMLToken( i_rLocalName, XML_NUMBER )) {
+ }
+ }
+
+ if (!pContext) {
+ pContext = SvXMLImportContext::CreateChildContext(
+ i_nPrefix, i_rLocalName, i_xAttrList );
+ }
+
+ return pContext;
+}
diff --git a/xmloff/source/text/txtparai.hxx b/xmloff/source/text/txtparai.hxx
index 32f763c6f1..c799540588 100644
--- a/xmloff/source/text/txtparai.hxx
+++ b/xmloff/source/text/txtparai.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: txtparai.hxx,v $
- * $Revision: 1.14 $
+ * $Revision: 1.14.2.1 $
*
* This file is part of OpenOffice.org.
*
@@ -87,22 +87,43 @@ public:
class XMLNumberedParaContext : public SvXMLImportContext
{
+ /// text:list-level MINUS 1
+ sal_Int16 m_Level;
+ /// text:start-value
+ sal_Int16 m_StartValue;
+ /// xml:id
+ ::rtl::OUString m_XmlId;
+ /// text:list-id
+ ::rtl::OUString m_ListId;
+ /// text:style-name
+ ::com::sun::star::uno::Reference <
+ ::com::sun::star::container::XIndexReplace > m_xNumRules;
+
public:
TYPEINFO();
- XMLNumberedParaContext( SvXMLImport& rImport,
- sal_uInt16 nPrfx,
- const ::rtl::OUString& rLName );
+ XMLNumberedParaContext( SvXMLImport& i_rImport,
+ sal_uInt16 i_nPrefix,
+ const ::rtl::OUString& i_rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & i_xAttrList );
virtual ~XMLNumberedParaContext();
- virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
- const ::rtl::OUString& rLocalName,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+ virtual void EndElement();
- virtual void Characters( const ::rtl::OUString& rChars );
+ virtual SvXMLImportContext *CreateChildContext( sal_uInt16 i_nPrefix,
+ const ::rtl::OUString& i_rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & i_xAttrList );
+
+ sal_Int16 GetLevel() const { return m_Level; }
+ const ::com::sun::star::uno::Reference <
+ ::com::sun::star::container::XIndexReplace >& GetNumRules() const
+ { return m_xNumRules; }
+ const ::rtl::OUString& GetListId() const { return m_ListId; }
+ sal_Int16 GetStartValue() const { return m_StartValue; }
};