Files
libreoffice/xmloff/inc/txtlists.hxx

180 lines
7.6 KiB
C++
Raw Normal View History

2010-10-27 13:11:31 +01:00
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
re-base on ALv2 code. Includes: Patches contributed by: Armin Le Grand. #118558# Correcting OLE attributes of LO3.4 at load time by loading as OOo3.3, details see task. http://svn.apache.org/viewvc?view=revision&revision=1195906 #118485# - Styles for OLEs are not saved. http://svn.apache.org/viewvc?view=revision&revision=1182166 #118898# Adapted ImpGraphic::ImplGetBitmap to correctly convert metafiles http://svn.apache.org/viewvc?view=revision&revision=1293316 #119337# Solves the wrong get/setPropertyValue calls in SvxShapeText (and thus in SvxOle2Shape) http://svn.apache.org/viewvc?view=revision&revision=1344156 Patches contributed by Mathias Bauer (and others) gnumake4 work variously http://svn.apache.org/viewvc?view=revision&revision=1394707 http://svn.apache.org/viewvc?view=revision&revision=1394326 cws mba34issues01: #i117717#: remove wrong assertion http://svn.apache.org/viewvc?view=revision&revision=1172349 Patch contributed by Herbert Duerr goodbye Registration and License dialogs, don't let the door hit you http://svn.apache.org/viewvc?view=revision&revision=1172613 help gcc 4.6.0 on 32bit ubuntu 11.10" http://svn.apache.org/viewvc?view=revision&revision=1245357 Do not add targets for junit tests when junit is disabled. Patch contributed by Andre Fischer http://svn.apache.org/viewvc?view=revision&revision=1241508 Revert "sb140: #i117082# avoid unncessary static class data members commit 21d97438e2944861e26e4984195f959a0cce1e41. remove obsolete FreeBSD visibility special case. retain consolidated BSD bridge code, remove OS/2 pieces.
2012-11-12 17:21:24 +00:00
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_XMLOFF_INC_TXTLISTS_HXX
#define INCLUDED_XMLOFF_INC_TXTLISTS_HXX
#include <rtl/ustring.hxx>
#include <map>
#include <vector>
2008-10-01 06:34:11 +00:00
#include <stack>
#include <boost/utility.hpp>
#include <boost/tuple/tuple.hpp>
#include <com/sun/star/container/XIndexReplace.hpp>
#include <xmloff/xmlictxt.hxx>
2008-10-01 06:34:11 +00:00
class SvXMLImport;
class XMLTextListBlockContext;
2008-10-01 06:34:11 +00:00
class XMLTextListItemContext;
class XMLNumberedParaContext;
2008-10-01 06:34:11 +00:00
class XMLTextListsHelper : private boost::noncopyable
{
public:
XMLTextListsHelper();
~XMLTextListsHelper();
2008-10-01 06:34:11 +00:00
/// 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
// Add optional parameter <sListStyleDefaultListId> (#i92811#)
void KeepListAsProcessed( const OUString& sListId,
const OUString& sListStyleName,
const OUString& sContinueListId,
const OUString& sListStyleDefaultListId = OUString() );
bool IsListProcessed( const OUString& sListId ) const;
OUString GetListStyleOfProcessedList(
const OUString& sListId ) const;
OUString GetContinueListIdOfProcessedList(
const OUString& sListId ) const;
const OUString& GetLastProcessedListId() const { return msLastProcessedListId;}
const OUString& GetListStyleOfLastProcessedList() const { return msListStyleOfLastProcessedList;}
OUString GenerateNewListId() const;
// Provide list id for a certain list block for import (#i92811#)
OUString GetListIdForListBlock( XMLTextListBlockContext& rListBlock );
// keep track of continue list chain for export
void StoreLastContinuingList( const OUString& sListId,
const OUString& sContinuingListId );
OUString GetLastContinuingListId( const OUString& sListId ) const;
// keep track of opened list elements of a certain list for export
void PushListOnStack( const OUString& sListId,
const OUString& sListStyleName );
void PopListFromStack();
bool EqualsToTopListStyleOnStack( const OUString& sListId ) const;
2008-10-01 06:34:11 +00:00
/** 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 OUString& i_ListId,
sal_Int16 & io_rLevel, const OUString& i_StyleName);
2008-10-01 06:34:11 +00:00
/// get ID of the last numbered-paragraph iff it has given style-name
OUString GetNumberedParagraphListId(
2008-10-01 06:34:11 +00:00
const sal_uInt16 i_Level,
const OUString& i_StyleName);
2008-10-01 06:34:11 +00:00
/** 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 OUString& i_ParentStyleName,
const OUString& i_StyleName,
2008-10-01 06:34:11 +00:00
sal_Int16 & io_rLevel,
bool* o_pRestartNumbering = 0,
bool* io_pSetDefaults = 0);
2008-10-01 06:34:11 +00:00
private:
2008-10-01 06:34:11 +00:00
/** 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
typedef ::std::map< OUString,
::std::pair< OUString, OUString > > tMapForLists;
tMapForLists* mpProcessedLists;
OUString msLastProcessedListId;
OUString msListStyleOfLastProcessedList;
/* additional container for processed lists.
map with <ListStyleName> as key and pair( <ListId, ListStyleDefaultListId> )
as value. (#i92811#)
*/
tMapForLists* mpMapListIdToListStyleDefaultListId;
// container type to build up continue list chain:
// map with <ListId> of master list as key and <ListId> of last list
// continuing the master list as value
typedef ::std::map< OUString, OUString > tMapForContinuingLists;
tMapForContinuingLists* mpContinuingLists;
// stack type for opened list elements and its list style:
// vector with pair( <ListId>, <ListStyleName> ) as value
typedef ::std::vector< ::std::pair< OUString, OUString > >
tStackForLists;
tStackForLists* mpListStack;
2008-10-01 06:34:11 +00:00
/// 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< OUString, OUString > >
2008-10-01 06:34:11 +00:00
LastNumberedParagraphs_t;
LastNumberedParagraphs_t mLastNumberedParagraphs;
/// numbered-paragraphs
typedef ::std::vector< ::std::pair< OUString,
2008-10-01 06:34:11 +00:00
::com::sun::star::uno::Reference<
::com::sun::star::container::XIndexReplace > > > NumParaList_t;
::std::map< OUString, NumParaList_t > mNPLists;
2008-10-01 06:34:11 +00:00
};
#endif
2010-10-27 13:11:31 +01:00
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */