summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Brauer <mib@openoffice.org>2000-09-28 11:45:50 +0000
committerMichael Brauer <mib@openoffice.org>2000-09-28 11:45:50 +0000
commit428d2fc7884adb2efad3a0775f038bad320ab9f5 (patch)
tree49e2ad13708f11123efc9662016d06d33f3ad2f0
parenta788b7999b263424c017aafedf944a87504fe160 (diff)
Splitting and joining nodes in insert mode fixed
-rw-r--r--sw/source/filter/xml/xmlfmt.cxx27
-rw-r--r--sw/source/filter/xml/xmlimp.cxx219
-rw-r--r--sw/source/filter/xml/xmlimp.hxx112
-rw-r--r--sw/source/filter/xml/xmltbli.cxx209
4 files changed, 103 insertions, 464 deletions
diff --git a/sw/source/filter/xml/xmlfmt.cxx b/sw/source/filter/xml/xmlfmt.cxx
index 2a8d964c4d72..f86b9c9c744c 100644
--- a/sw/source/filter/xml/xmlfmt.cxx
+++ b/sw/source/filter/xml/xmlfmt.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmlfmt.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 17:15:00 $
+ * last change: $Author: mib $ $Date: 2000-09-28 12:45:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -91,6 +91,9 @@
#ifndef _HINTS_HXX //autogen wg. SwFmtChg
#include <hints.hxx>
#endif
+#ifndef _UNOOBJ_HXX
+#include <unoobj.hxx>
+#endif
#ifndef _POOLFMT_HXX //autogen wg. RES_POOL_CHRFMT_TYPE
#include <poolfmt.hxx>
@@ -525,11 +528,11 @@ void SwXMLTextStyleContext_Impl::Finish( sal_Bool bOverwrite )
if( !pStyle )
return;
- SwDoc& rDoc = ((SwXMLImport&)GetImport()).GetDoc();
+ const SwDoc *pDoc = pStyle->GetDoc();
const OUString& rName =
SwXStyleFamilies::GetUIName( GetName(), SFX_STYLE_FAMILY_PARA );
- SwTxtFmtColl *pColl = rDoc.FindTxtFmtCollByName( rName );
+ SwTxtFmtColl *pColl = pDoc->FindTxtFmtCollByName( rName );
ASSERT( pColl, "Text collection not found" );
if( !pColl || RES_CONDTXTFMTCOLL != pColl->Which() )
return;
@@ -541,7 +544,7 @@ void SwXMLTextStyleContext_Impl::Finish( sal_Bool bOverwrite )
const OUString& rName =
SwXStyleFamilies::GetUIName( pCond->GetApplyStyle(),
SFX_STYLE_FAMILY_PARA );
- SwTxtFmtColl* pCondColl = rDoc.FindTxtFmtCollByName( rName );
+ SwTxtFmtColl* pCondColl = pDoc->FindTxtFmtCollByName( rName );
ASSERT( pCondColl,
"SwXMLItemSetStyleContext_Impl::ConnectConditions: cond coll missing" );
if( pCondColl )
@@ -711,9 +714,9 @@ SvXMLImportContext *SwXMLItemSetStyleContext_Impl::CreateItemSetContext(
"SwXMLItemSetStyleContext_Impl::CreateItemSetContext: item set exists" );
SvXMLImportContext *pContext = 0;
- SfxItemPool& rItemPool = GetSwImport().GetDoc().GetAttrPool();
#ifdef XML_CORE_API
+ SfxItemPool& rItemPool = GetSwImport().GetDoc().GetAttrPool();
switch( GetFamily() )
{
case SFX_STYLE_FAMILY_PARA:
@@ -761,6 +764,13 @@ SvXMLImportContext *SwXMLItemSetStyleContext_Impl::CreateItemSetContext(
break;
}
#else
+ Reference<XUnoTunnel> xCrsrTunnel( GetImport().GetTextImport()->GetCursor(),
+ UNO_QUERY);
+ ASSERT( xCrsrTunnel.is(), "missing XUnoTunnel for Cursor" );
+ SwXTextCursor *pTxtCrsr = (SwXTextCursor*)xCrsrTunnel->getSomething(
+ SwXTextCursor::getUnoTunnelId() );
+ ASSERT( pTxtCrsr, "SwXTextCursor missing" );
+ SfxItemPool& rItemPool = pTxtCrsr->GetDoc()->GetAttrPool();
switch( GetFamily() )
{
case XML_STYLE_FAMILY_TABLE_TABLE:
@@ -1677,11 +1687,14 @@ sal_Bool SwXMLImport::FindAutomaticStyle(
Source Code Control System - Header
- $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/sw/source/filter/xml/xmlfmt.cxx,v 1.1.1.1 2000-09-18 17:15:00 hr Exp $
+ $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/sw/source/filter/xml/xmlfmt.cxx,v 1.2 2000-09-28 12:45:50 mib Exp $
Source Code Control System - Update
$Log: not supported by cvs2svn $
+ Revision 1.1.1.1 2000/09/18 17:15:00 hr
+ initial import
+
Revision 1.42 2000/09/18 16:05:05 willem.vandorp
OpenOffice header added.
diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index 41743bc096b2..1e7f69698e48 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmlimp.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 17:15:00 $
+ * last change: $Author: mib $ $Date: 2000-09-28 12:45:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -110,6 +110,9 @@
#ifndef _UNOOBJ_HXX
#include <unoobj.hxx>
#endif
+#ifndef _UNOCRSR_HXX
+#include "unocrsr.hxx"
+#endif
#ifndef _POOLFMT_HXX
#include <poolfmt.hxx>
#endif
@@ -124,6 +127,7 @@ using namespace ::rtl;
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::lang;
sal_Char __READONLY_DATA sXML_np__text[] = "text";
sal_Char __READONLY_DATA sXML_np__table[] = "table";
@@ -256,86 +260,78 @@ SwXMLImport::SwXMLImport(
bLoadDoc( bLDoc ),
bInsert( bInsertMode ),
nStyleFamilyMask( nStyleFamMask ),
- pDoc( &rDoc ),
- pPaM( new SwPaM( *rPaM.GetPoint() ) ),
-#ifdef XML_CORE_API
- pI18NMap( new SvI18NMap ),
- pUnusedNumRules( 0 ),
-#endif
pDocElemTokenMap( 0 ),
-#ifdef XML_CORE_API
- pBodyElemTokenMap( 0 ),
- pStyleStylesElemTokenMap( 0 ),
- pTextPElemTokenMap( 0 ),
- pTextPAttrTokenMap( 0 ),
- pTextListBlockAttrTokenMap( 0 ),
- pTextListBlockElemTokenMap( 0 ),
-#endif
pTableElemTokenMap( 0 ),
-#ifdef XML_CORE_API
- pParaItemMapper( 0 ),
-#endif
pTableItemMapper( 0 ),
pSttNdIdx( 0 ),
bAutoStylesValid( sal_False )
{
-// GetNamespaceMap().AddAtIndex( XML_NAMESPACE_TEXT, sXML_np__text,
-// sXML_n_text, XML_NAMESPACE_TEXT );
-// GetNamespaceMap().AddAtIndex( XML_NAMESPACE_TABLE, sXML_np__table,
-// sXML_n_table, XML_NAMESPACE_TABLE );
-
_InitItemImport();
+ Reference < XTextRange > xTextRange =
+ CreateTextRangeFromPosition( &rDoc, *rPaM.GetPoint(), 0 );
+ Reference < XText > xText = xTextRange->getText();
+ Reference < XTextCursor > xTextCursor =
+ xText->createTextCursorByRange( xTextRange );
+ GetTextImport()->SetCursor( xTextCursor );
if( !IsStylesOnlyMode() )
{
- pSttNdIdx = new SwNodeIndex( pDoc->GetNodes() );
+ pSttNdIdx = new SwNodeIndex( rDoc.GetNodes() );
if( IsInsertMode() )
{
+ Reference<XUnoTunnel> xCrsrTunnel( GetTextImport()->GetCursor(),
+ UNO_QUERY);
+ ASSERT( xCrsrTunnel.is(), "missing XUnoTunnel for Cursor" );
+ SwXTextCursor *pTxtCrsr =
+ (SwXTextCursor*)xCrsrTunnel->getSomething(
+ SwXTextCursor::getUnoTunnelId() );
+ ASSERT( pTxtCrsr, "SwXTextCursor missing" );
+ SwPaM *pPaM = pTxtCrsr->GetCrsr();
const SwPosition* pPos = pPaM->GetPoint();
// Split once and remember the node that has been splitted.
- pDoc->SplitNode( *pPos );
+ rDoc.SplitNode( *pPos );
*pSttNdIdx = pPos->nNode.GetIndex()-1;
// Split again.
- pDoc->SplitNode( *pPos );
+ rDoc.SplitNode( *pPos );
// Insert all content into the new node
pPaM->Move( fnMoveBackward );
- pDoc->SetTxtFmtColl( *pPaM,
- pDoc->GetTxtCollFromPool(RES_POOLCOLL_STANDARD) );
+ rDoc.SetTxtFmtColl( *pPaM,
+ rDoc.GetTxtCollFromPool(RES_POOLCOLL_STANDARD) );
}
}
- Reference < XTextRange > xTextRange =
- CreateTextRangeFromPosition( pDoc, *rPaM.GetPoint(), 0 );
- Reference < XText > xText = xTextRange->getText();
- Reference < XTextCursor > xTextCursor =
- xText->createTextCursorByRange( xTextRange );
- GetTextImport()->SetCursor( xTextCursor );
}
SwXMLImport::~SwXMLImport()
{
- GetTextImport()->ResetCursor();
-
if( !IsStylesOnlyMode() )
{
+ Reference<XUnoTunnel> xCrsrTunnel( GetTextImport()->GetCursor(),
+ UNO_QUERY);
+ ASSERT( xCrsrTunnel.is(), "missing XUnoTunnel for Cursor" );
+ SwXTextCursor *pTxtCrsr =
+ (SwXTextCursor*)xCrsrTunnel->getSomething(
+ SwXTextCursor::getUnoTunnelId() );
+ ASSERT( pTxtCrsr, "SwXTextCursor missing" );
+ SwPaM *pPaM = pTxtCrsr->GetCrsr();
if( IsInsertMode() && pSttNdIdx->GetIndex() )
{
// If we are in insert mode, join the splitted node that is in front
- // of the new content with the first new node.
+ // of the new content with the first new node. Or in other words:
+ // Revert the first split node.
SwTxtNode* pTxtNode = pSttNdIdx->GetNode().GetTxtNode();
SwNodeIndex aNxtIdx( *pSttNdIdx );
if( pTxtNode && pTxtNode->CanJoinNext( &aNxtIdx ))
{
- xub_StrLen nStt = pTxtNode->GetTxt().Len();
-
// If the PaM points to the first new node, move the PaM to the
// end of the previous node.
if( pPaM->GetPoint()->nNode == aNxtIdx )
{
pPaM->GetPoint()->nNode = *pSttNdIdx;
- pPaM->GetPoint()->nContent.Assign( pTxtNode, nStt );
+ pPaM->GetPoint()->nContent.Assign( pTxtNode,
+ pTxtNode->GetTxt().Len() );
}
#ifndef PRODUCT
@@ -365,8 +361,8 @@ SwXMLImport::~SwXMLImport()
}
#endif
// If the first new node isn't empty, convert the node's text
- // attributes into hints. Otherwise, set the new node's paragraph
- // style at the previous (empty) node.
+ // attributes into hints. Otherwise, set the new node's
+ // paragraph style at the previous (empty) node.
SwTxtNode* pDelNd = aNxtIdx.GetNode().GetTxtNode();
if( pTxtNode->GetTxt().Len() )
pDelNd->FmtToTxtAttr( pTxtNode );
@@ -377,13 +373,18 @@ SwXMLImport::~SwXMLImport()
}
SwPosition* pPos = pPaM->GetPoint();
+ DBG_ASSERT( !pPos->nContent.GetIndex(), "last paragraph isn't empty" );
if( !pPos->nContent.GetIndex() )
{
SwTxtNode* pCurrNd;
sal_uInt32 nNodeIdx = pPos->nNode.GetIndex();
+ SwDoc *pDoc = pPaM->GetDoc();
+ DBG_ASSERT( pPos->nNode.GetNode().IsCntntNode(),
+ "insert position is not a content node" );
if( !IsInsertMode() )
{
+ // If we're not in insert mode, the last node is deleted.
if( pDoc->GetNodes()[nNodeIdx -1]->IsCntntNode() )
{
SwCntntNode* pCNd = pPaM->GetCntntNode();
@@ -398,12 +399,23 @@ SwXMLImport::~SwXMLImport()
}
else if( 0 != (pCurrNd = pDoc->GetNodes()[nNodeIdx]->GetTxtNode()) )
{
+ // Id we're in insert mode, the empty node is joined with
+ // the next and the previous one.
if( pCurrNd->CanJoinNext( &pPos->nNode ))
{
SwTxtNode* pNextNd = pPos->nNode.GetNode().GetTxtNode();
pPos->nContent.Assign( pNextNd, 0 );
pPaM->SetMark(); pPaM->DeleteMark();
pNextNd->JoinPrev();
+
+ if( pNextNd->CanJoinPrev(/* &pPos->nNode*/ ) )
+ {
+// SwTxtNode* pPrevNd = pPos->nNode.GetNode().GetTxtNode();
+// pPos->nContent.Assign( pPrevNd, 0 );
+// pPaM->SetMark(); pPaM->DeleteMark();
+// pPrevNd->JoinNext();
+ pNextNd->JoinPrev();
+ }
}
else if( !pCurrNd->GetTxt().Len() )
{
@@ -414,8 +426,11 @@ SwXMLImport::~SwXMLImport()
}
}
}
+#ifdef WE_ARE_SURE_WE_DONT_NEED_THIS_CODE_ANY_LONGER_REMOVE_IT
else if( IsInsertMode() )
{
+ // We're always appending a paragarph at the end of the document,
+ // so this code should enver be executed!
pPaM->Move( fnMoveForward, fnGoNode );
SwTxtNode* pTxtNode = pPos->nNode.GetNode().GetTxtNode();
SwNodeIndex aPrvIdx( pPos->nNode );
@@ -444,127 +459,13 @@ SwXMLImport::~SwXMLImport()
pTxtNode->JoinPrev();
}
}
+#endif
}
-#ifdef XML_CORE_API
- RemoveUnusedNumRules();
-#endif
+ GetTextImport()->ResetCursor();
delete pSttNdIdx;
- delete pPaM;
delete pDocElemTokenMap;
-#ifdef XML_CORE_API
- delete pI18NMap;
- delete pBodyElemTokenMap;
- delete pTextPElemTokenMap;
- delete pTextPAttrTokenMap;
- delete pStyleStylesElemTokenMap;
- delete pTextListBlockAttrTokenMap;
- delete pTextListBlockElemTokenMap;
-#endif
delete pTableElemTokenMap;
_FinitItemImport();
}
-
-/*************************************************************************
-
- Source Code Control System - Header
-
- $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/sw/source/filter/xml/xmlimp.cxx,v 1.1.1.1 2000-09-18 17:15:00 hr Exp $
-
- Source Code Control System - Update
-
- $Log: not supported by cvs2svn $
- Revision 1.30 2000/09/18 16:05:06 willem.vandorp
- OpenOffice header added.
-
- Revision 1.29 2000/08/29 07:33:47 mib
- text import continued
-
- Revision 1.28 2000/08/24 11:16:41 mib
- text import continued
-
- Revision 1.27 2000/08/10 10:22:16 mib
- #74404#: Adeptions to new XSL/XLink working draft
-
- Revision 1.26 2000/07/31 09:42:35 mib
- text export continued
-
- Revision 1.25 2000/07/21 12:55:15 mib
- text import/export using StarOffice API
-
- Revision 1.24 2000/07/07 13:58:36 mib
- text styles using StarOffice API
-
- Revision 1.23 2000/06/08 09:45:54 aw
- changed to use functionality from xmloff project now
-
- Revision 1.22 2000/05/15 16:53:17 jp
- Changes for Unicode
-
- Revision 1.21 2000/05/03 12:08:05 mib
- unicode
-
- Revision 1.20 2000/03/13 14:33:44 mib
- UNO3
-
- Revision 1.19 2000/02/17 14:40:30 mib
- #70271#: XML table import
-
- Revision 1.17 2000/01/27 08:59:02 mib
- #70271#: outline numbering
-
- Revision 1.16 2000/01/20 10:03:16 mib
- #70271#: Lists reworked
-
- Revision 1.15 2000/01/06 15:08:27 mib
- #70271#:separation of text/layout, cond. styles, adaptions to wd-xlink-19991229
-
- Revision 1.14 1999/11/26 11:12:51 mib
- loading of styles only and insert mode
-
- Revision 1.13 1999/11/22 15:53:39 mib
- split/join nodes correctly
-
- Revision 1.12 1999/11/12 11:43:03 mib
- using item mapper, part iii
-
- Revision 1.11 1999/11/10 15:08:09 mib
- Import now uses XMLItemMapper
-
- Revision 1.10 1999/11/01 11:38:50 mib
- List style import
-
- Revision 1.9 1999/10/15 12:39:11 mib
- moved styles element from style to office namespace
-
- Revision 1.8 1999/10/08 11:47:49 mib
- moved some file to SVTOOLS/SVX
-
- Revision 1.7 1999/10/05 14:31:14 hr
- #65293#: removed redundant const
-
- Revision 1.6 1999/09/28 10:46:58 mib
- memory leak
-
- Revision 1.5 1999/09/23 11:54:16 mib
- i18n, token maps and hard paragraph attributes
-
- Revision 1.4 1999/09/22 11:57:14 mib
- string -> wstring
-
- Revision 1.3 1999/08/19 12:57:42 MIB
- attribute import added
-
-
- Rev 1.2 19 Aug 1999 14:57:42 MIB
- attribute import added
-
- Rev 1.1 18 Aug 1999 17:05:20 MIB
- Style import
-
- Rev 1.0 17 Aug 1999 16:32:52 MIB
- Initial revision.
-
-*************************************************************************/
-
diff --git a/sw/source/filter/xml/xmlimp.hxx b/sw/source/filter/xml/xmlimp.hxx
index 5bb684245bf7..df399f6000ff 100644
--- a/sw/source/filter/xml/xmlimp.hxx
+++ b/sw/source/filter/xml/xmlimp.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmlimp.hxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 17:15:00 $
+ * last change: $Author: mib $ $Date: 2000-09-28 12:45:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -62,10 +62,6 @@
#ifndef _XMLIMP_HXX
#define _XMLIMP_HXX
-#ifndef _RSCSFX_HXX
-#include <rsc/rscsfx.hxx>
-#endif
-
#ifndef _XMLOFF_XMLICTXT_HXX
#include <xmloff/xmlictxt.hxx>
#endif
@@ -81,42 +77,19 @@
class SwDoc;
class SwPaM;
class SvXMLUnitConverter;
-class SvI18NMap;
class SvXMLTokenMap;
class SvXMLImportItemMapper;
-class SvXMLStyleContext;
-class SwXMLListBlockContext;
-class SwXMLListItemContext;
class SfxItemSet;
class SwNodeIndex;
-class SwNumRule;
-class SwNumRulesSort_Impl;
class XMLTextImportHelper;
class SwXMLImport: public SvXMLImport
{
- SwDoc *pDoc;
- SwPaM *pPaM; // SwPosition ??
SwNodeIndex *pSttNdIdx;
SvXMLUnitConverter *pTwipUnitConv;
-#ifdef XML_CORE_API
- SvXMLImportItemMapper *pParaItemMapper;// paragraph item import
-#endif
SvXMLImportItemMapper *pTableItemMapper;// paragraph item import
-#ifdef XML_CORE_API
- SvI18NMap *pI18NMap; // name mapping for I18N
- SwNumRulesSort_Impl *pUnusedNumRules;
-#endif
SvXMLTokenMap *pDocElemTokenMap;
-#ifdef XML_CORE_API
- SvXMLTokenMap *pBodyElemTokenMap;
- SvXMLTokenMap *pTextPElemTokenMap;
- SvXMLTokenMap *pTextPAttrTokenMap;
- SvXMLTokenMap *pStyleStylesElemTokenMap;
- SvXMLTokenMap *pTextListBlockAttrTokenMap;
- SvXMLTokenMap *pTextListBlockElemTokenMap;
-#endif
SvXMLTokenMap *pTableElemTokenMap;
SvXMLItemMapEntriesRef xTableItemMap;
@@ -126,10 +99,6 @@ class SwXMLImport: public SvXMLImport
SvXMLImportContextRef xStyles;
SvXMLImportContextRef xAutoStyles;
-#ifdef XML_CORE_API
- SvXMLImportContextRef xListBlock;
- SvXMLImportContextRef xListItem;
-#endif
sal_uInt16 nStyleFamilyMask;// Mask of styles to load
sal_Bool bLoadDoc : 1; // Load doc or styles only
@@ -142,10 +111,6 @@ class SwXMLImport: public SvXMLImport
void _InitItemImport();
void _FinitItemImport();
-#ifdef XML_CORE_API
- void RemoveUnusedNumRules();
-#endif
-
void InsertStyles();
protected:
@@ -176,34 +141,12 @@ public:
::com::sun::star::xml::sax::XAttributeList > & xAttrList,
sal_Bool bAuto );
SvXMLImportContext *CreateBodyContext( const ::rtl::OUString& rLocalName );
-
-
-#ifdef XML_CORE_API
- SwPaM& GetPaM() { return *pPaM; }
-#endif
- SwDoc& GetDoc() { return *pDoc; }
- const SwDoc& GetDoc() const { return *pDoc; }
-
sal_uInt16 GetStyleFamilyMask() const { return nStyleFamilyMask; }
sal_Bool IsInsertMode() const { return bInsert; }
sal_Bool IsStylesOnlyMode() const { return !bLoadDoc; }
-#ifdef XML_CORE_API
- SvI18NMap& GetI18NMap() { return *pI18NMap; }
-#endif
-
inline const SvXMLUnitConverter& GetTwipUnitConverter() const;
-#ifdef XML_CORE_API
- inline const SvXMLImportItemMapper& GetParaItemMapper() const;
-#endif
inline const SvXMLImportItemMapper& GetTableItemMapper() const;
-#ifdef XML_CORE_API
- SvXMLImportContext *CreateParaItemImportContext( sal_uInt16 nPrefix,
- const ::rtl::OUString& rLocalName,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
- SfxItemSet& rItemSet );
-#endif
SvXMLImportContext *CreateTableItemImportContext( sal_uInt16 nPrefix,
const ::rtl::OUString& rLocalName,
const ::com::sun::star::uno::Reference<
@@ -211,45 +154,12 @@ public:
sal_uInt16 nSubFamily, SfxItemSet& rItemSet );
const SvXMLTokenMap& GetDocElemTokenMap();
-#ifdef XML_CORE_API
- const SvXMLTokenMap& GetBodyElemTokenMap();
- const SvXMLTokenMap& GetTextPElemTokenMap();
- const SvXMLTokenMap& GetTextPAttrTokenMap();
- const SvXMLTokenMap& GetStyleStylesElemTokenMap();
- const SvXMLTokenMap& GetTextListBlockAttrTokenMap();
- const SvXMLTokenMap& GetTextListBlockElemTokenMap();
-#endif
const SvXMLTokenMap& GetTableElemTokenMap();
-#ifdef XML_CORE_API
- inline sal_Bool FindAutomaticStyle( SfxStyleFamily eFamily,
- const ::rtl::OUString& rName,
- const SfxItemSet **ppItemSet=0,
- ::rtl::OUString *pParent=0 ) const;
- sal_Bool FindAutomaticStyle( SfxStyleFamily eFamily,
- sal_uInt16 nSubStyle,
- const ::rtl::OUString& rName,
- const SfxItemSet **ppItemSet=0,
- ::rtl::OUString *pParent=0 ) const;
-#else
sal_Bool FindAutomaticStyle( sal_uInt16 nFamily,
const ::rtl::OUString& rName,
const SfxItemSet **ppItemSet=0,
::rtl::OUString *pParent=0 ) const;
-#endif
-
-#ifdef XML_CORE_API
- SwXMLListBlockContext *GetListBlock();
- sal_Bool IsInList() const { return xListBlock.Is(); }
- void SetListBlock( SwXMLListBlockContext *pListBlock );
-
- SwXMLListItemContext *GetListItem();
- sal_Bool HasListItem() const { return xListItem.Is(); }
- void SetListItem( SwXMLListItemContext *pListItem );
-
- void AddUnused( const SwNumRule& rNumRule );
- void SetUsed( const SwNumRule& rNumRule );
-#endif
};
inline const SvXMLUnitConverter& SwXMLImport::GetTwipUnitConverter() const
@@ -257,27 +167,9 @@ inline const SvXMLUnitConverter& SwXMLImport::GetTwipUnitConverter() const
return *pTwipUnitConv;
}
-#ifdef XML_CORE_API
-inline const SvXMLImportItemMapper& SwXMLImport::GetParaItemMapper() const
-{
- return *pParaItemMapper;
-}
-#endif
-
inline const SvXMLImportItemMapper& SwXMLImport::GetTableItemMapper() const
{
return *pTableItemMapper;
}
-#ifdef XML_CORE_API
-inline sal_Bool SwXMLImport::FindAutomaticStyle( SfxStyleFamily eFamily,
- const ::rtl::OUString& rName,
- const SfxItemSet **ppItemSet,
- ::rtl::OUString *pParent ) const
-{
- return FindAutomaticStyle( eFamily, 0U, rName, ppItemSet, pParent );
-}
-#endif
-
-
#endif // _XMLIMP_HXX
diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx
index 59d759891bcf..eacfe63b3832 100644
--- a/sw/source/filter/xml/xmltbli.cxx
+++ b/sw/source/filter/xml/xmltbli.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmltbli.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: mib $ $Date: 2000-09-27 07:52:50 $
+ * last change: $Author: mib $ $Date: 2000-09-28 12:45:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -455,39 +455,6 @@ SvXMLImportContext *SwXMLTableCellContext_Impl::CreateChildContext(
{
SvXMLImportContext *pContext = 0;
-#ifdef XML_CORE_API
- const SvXMLTokenMap& rTokenMap = GetSwImport().GetBodyElemTokenMap();
- sal_Bool bOrdered = sal_False;
- sal_Bool bHeading = sal_False;
- switch( rTokenMap.Get( nPrefix, rLocalName ) )
- {
- case XML_TOK_SW_H:
- bHeading = sal_True;
- case XML_TOK_SW_P:
- InsertContentIfNotThere();
- pContext = new SwXMLParaContext( GetSwImport(),nPrefix, rLocalName,
- xAttrList, bHeading );
- break;
- case XML_TOK_SW_ORDERED_LIST:
- bOrdered = sal_True;
- case XML_TOK_SW_UNORDERED_LIST:
- InsertContentIfNotThere();
- pContext = new SwXMLListBlockContext( GetSwImport(),nPrefix, rLocalName,
- xAttrList, bOrdered );
- break;
-
- case XML_TOK_TABLE_SUBTABLE:
- if( !HasContent() )
- {
- SwXMLTableContext *pTblContext =
- new SwXMLTableContext( GetSwImport(), nPrefix, rLocalName,
- xAttrList, GetTable() );
- pContext = pTblContext;
- InsertContent( pTblContext );
- }
- break;
- }
-#else
if( XML_NAMESPACE_TABLE == nPrefix &&
0 == rLocalName.compareToAscii( sXML_sub_table ) )
{
@@ -507,7 +474,6 @@ SvXMLImportContext *SwXMLTableCellContext_Impl::CreateChildContext(
GetImport(), nPrefix, rLocalName, xAttrList,
XML_TEXT_TYPE_CELL );
}
-#endif
if( !pContext )
pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
@@ -519,19 +485,6 @@ void SwXMLTableCellContext_Impl::EndElement()
{
if( bHasContent )
{
-#ifdef XML_CORE_API
- SwPaM& rPaM = GetSwImport().GetPaM();
- SwCntntNode* pCNd = rPaM.GetCntntNode();
- if( pCNd && pCNd->StartOfSectionIndex() + 2UL <
- pCNd->EndOfSectionIndex() )
- {
- rPaM.GetPoint()->nContent.Assign( 0, 0U );
- rPaM.SetMark();
- rPaM.DeleteMark();
- GetSwImport().GetDoc().GetNodes().Delete( rPaM.GetPoint()->nNode );
- rPaM.Move( fnMoveBackward, fnGoNode );
- }
-#else
if( GetImport().GetTextImport()->GetCursor()->goLeft( 1, sal_True ) )
{
OUString sEmpty;
@@ -539,7 +492,6 @@ void SwXMLTableCellContext_Impl::EndElement()
GetImport().GetTextImport()->GetCursorAsRange(), sEmpty,
sal_True );
}
-#endif
}
else
{
@@ -604,11 +556,7 @@ SwXMLTableColContext_Impl::SwXMLTableColContext_Impl(
const SfxPoolItem *pItem;
const SfxItemSet *pAutoItemSet = 0;
if( GetSwImport().FindAutomaticStyle(
-#ifdef XML_CORE_API
- SFX_STYLE_FAMILY_FRAME, SW_STYLE_SUBFAMILY_TABLE_COL,
-#else
XML_STYLE_FAMILY_TABLE_COLUMN,
-#endif
aStyleName, &pAutoItemSet ) &&
pAutoItemSet &&
SFX_ITEM_SET == pAutoItemSet->GetItemState( RES_FRM_SIZE, sal_False,
@@ -901,30 +849,26 @@ SwXMLTableContext::SwXMLTableContext( SwXMLImport& rImport,
}
SwXMLImport& rSwImport = GetSwImport();
- SwDoc& rDoc = rSwImport.GetDoc();
+ Reference<XUnoTunnel> xCrsrTunnel( GetImport().GetTextImport()->GetCursor(),
+ UNO_QUERY);
+ ASSERT( xCrsrTunnel.is(), "missing XUnoTunnel for Cursor" );
+ SwXTextCursor *pTxtCrsr =
+ (SwXTextCursor*)xCrsrTunnel->getSomething(
+ SwXTextCursor::getUnoTunnelId() );
+ ASSERT( pTxtCrsr, "SwXTextCursor missing" );
+ SwDoc *pDoc = pTxtCrsr->GetDoc();
String sTblName;
if( aName.getLength() )
{
- const SwTableFmt *pTblFmt = rDoc.FindTblFmtByName( aName );
+ const SwTableFmt *pTblFmt = pDoc->FindTblFmtByName( aName );
if( !pTblFmt )
sTblName = aName;
}
if( !sTblName.Len() )
- sTblName = rDoc.GetUniqueTblName();
-
-#ifdef XML_CORE_API
- const SwTable* pSwTable = rDoc.InsertTable( *rSwImport.GetPaM().GetPoint(),
- 1U, 1U, HORI_LEFT );
- pTableNode = pSwTable->GetTableNode();
-
- SwFrmFmt *pTblFrmFmt = pSwTable->GetFrmFmt();
- pTblFrmFmt->SetName( sTblName );
+ sTblName = pDoc->GetUniqueTblName();
- rSwImport.GetPaM().Move( fnMoveBackward );
-#else
Reference< XTextTable > xTable;
-
const SwXTextTable *pXTable = 0;
Reference<XMultiServiceFactory> xFactory( GetImport().GetModel(),
UNO_QUERY );
@@ -960,7 +904,6 @@ SwXMLTableContext::SwXMLTableContext( SwXMLImport& rImport,
Reference < XText> xText( xCell, UNO_QUERY );
xOldCursor = GetImport().GetTextImport()->GetCursor();
GetImport().GetTextImport()->SetCursor( xText->createTextCursor() );
-
}
if( pXTable )
{
@@ -977,7 +920,6 @@ SwXMLTableContext::SwXMLTableContext( SwXMLImport& rImport,
pBox1 = pLine1->GetTabBoxes()[0U];
pSttNd1 = pBox1->GetSttNd();
}
-#endif
}
SwXMLTableContext::SwXMLTableContext( SwXMLImport& rImport,
@@ -1434,12 +1376,7 @@ SwTableBox *SwXMLTableContext::MakeTableBox(
const OUString& rStyleName = pCell->GetStyleName();
if( pCell->GetStartNode() && rStyleName &&
GetSwImport().FindAutomaticStyle(
-#ifdef XML_CORE_API
- SFX_STYLE_FAMILY_FRAME, SW_STYLE_SUBFAMILY_TABLE_BOX,
-#else
- XML_STYLE_FAMILY_TABLE_CELL,
-#endif
- pCell->GetStyleName(),
+ XML_STYLE_FAMILY_TABLE_CELL, pCell->GetStyleName(),
&pAutoItemSet ) )
{
if( pAutoItemSet )
@@ -1478,12 +1415,7 @@ SwTableLine *SwXMLTableContext::MakeTableLine( SwTableBox *pUpper,
if( 1UL == (nBottomRow - nTopRow) &&
rStyleName.getLength() &&
GetSwImport().FindAutomaticStyle(
-#ifdef XML_CORE_API
- SFX_STYLE_FAMILY_FRAME, SW_STYLE_SUBFAMILY_TABLE_LINE,
-#else
- XML_STYLE_FAMILY_TABLE_ROW,
-#endif
- rStyleName, &pAutoItemSet ) )
+ XML_STYLE_FAMILY_TABLE_ROW, rStyleName, &pAutoItemSet ) )
{
if( pAutoItemSet )
pFrmFmt->SetAttr( *pAutoItemSet );
@@ -1914,12 +1846,7 @@ void SwXMLTableContext::MakeTable()
const SfxItemSet *pAutoItemSet = 0;
if( aStyleName.getLength() &&
rSwImport.FindAutomaticStyle(
-#ifdef XML_CORE_API
- SFX_STYLE_FAMILY_FRAME, SW_STYLE_SUBFAMILY_TABLE,
-#else
- XML_STYLE_FAMILY_TABLE_TABLE,
-#endif
- aStyleName, &pAutoItemSet ) &&
+ XML_STYLE_FAMILY_TABLE_TABLE, aStyleName, &pAutoItemSet ) &&
pAutoItemSet )
{
const SfxPoolItem *pItem;
@@ -2014,13 +1941,9 @@ void SwXMLTableContext::MakeTable()
}
SwTableLine *pLine1 = pTableNode->GetTable().GetTabLines()[0U];
-#ifdef XML_CORE_API
- pBox1 = pLine1->GetTabBoxes()[0U];
-#else
DBG_ASSERT( pBox1 == pLine1->GetTabBoxes()[0U],
"Why is box 1 change?" );
pBox1->pSttNd = pSttNd1;
-#endif
pLine1->GetTabBoxes().Remove(0U);
pLineFmt = (SwTableLineFmt*)pLine1->GetFrmFmt();
@@ -2043,7 +1966,7 @@ void SwXMLTableContext::MakeTable()
for( sal_uInt16 i=0; i<pRows->Count(); i++ )
(*pRows)[i]->Dispose();
- if( rSwImport.GetDoc().GetRootFrm() )
+ if( pTableNode->GetDoc()->GetRootFrm() )
{
pTableNode->DelFrms();
SwNodeIndex aIdx( *pTableNode->EndOfSectionNode(), 1 );
@@ -2065,31 +1988,6 @@ const SwStartNode *SwXMLTableContext::InsertTableSection(
const SwStartNode *pPrevSttNd )
{
const SwStartNode *pStNd;
-#ifdef XML_CORE_API
- SwPaM& rPaM = GetSwImport().GetPaM();
- if( bFirstSection )
- {
- // The PaM already is in the first section
- pStNd = rPaM.GetNode()->FindTableBoxStartNode();
- bFirstSection = sal_False;
- }
- else
- {
- SwDoc& rDoc = GetSwImport().GetDoc();
- const SwEndNode *pEndNd = pPrevSttNd ? pPrevSttNd->EndOfSectionNode()
- : pTableNode->EndOfSectionNode();
- sal_uInt32 nOffset = pPrevSttNd ? 1UL : 0UL;
- SwNodeIndex aIdx( *pEndNd, nOffset );
- SwTxtFmtColl *pColl = rDoc.GetTxtCollFromPool( RES_POOLCOLL_STANDARD );
- pStNd = rDoc.GetNodes().MakeTextSection( aIdx, SwTableBoxStartNode,
- pColl );
- if( !pPrevSttNd )
- {
- rPaM.GetPoint()->nNode.Assign( *pStNd, 1UL );
- rPaM.GetPoint()->nContent.Assign( rPaM.GetCntntNode(), 0U );
- }
- }
-#else
Reference<XUnoTunnel> xCrsrTunnel( GetImport().GetTextImport()->GetCursor(),
UNO_QUERY);
ASSERT( xCrsrTunnel.is(), "missing XUnoTunnel for Cursor" );
@@ -2109,24 +2007,24 @@ const SwStartNode *SwXMLTableContext::InsertTableSection(
}
else
{
- SwDoc& rDoc = GetSwImport().GetDoc();
+ SwDoc* pDoc = pTxtCrsr->GetDoc();
const SwEndNode *pEndNd = pPrevSttNd ? pPrevSttNd->EndOfSectionNode()
: pTableNode->EndOfSectionNode();
sal_uInt32 nOffset = pPrevSttNd ? 1UL : 0UL;
SwNodeIndex aIdx( *pEndNd, nOffset );
- SwTxtFmtColl *pColl = rDoc.GetTxtCollFromPool( RES_POOLCOLL_STANDARD );
- pStNd = rDoc.GetNodes().MakeTextSection( aIdx, SwTableBoxStartNode,
+ SwTxtFmtColl *pColl = pDoc->GetTxtCollFromPool( RES_POOLCOLL_STANDARD );
+ pStNd = pDoc->GetNodes().MakeTextSection( aIdx, SwTableBoxStartNode,
pColl );
if( !pPrevSttNd )
{
pBox1->pSttNd = pStNd;
- SwCntntNode *pCNd = rDoc.GetNodes()[ pStNd->GetIndex() + 1 ]
+ SwCntntNode *pCNd = pDoc->GetNodes()[ pStNd->GetIndex() + 1 ]
->GetCntntNode();
SwPosition aPos( *pCNd );
aPos.nContent.Assign( pCNd, 0U );
Reference < XTextRange > xTextRange =
- CreateTextRangeFromPosition( &rDoc, aPos, 0 );
+ CreateTextRangeFromPosition( pDoc, aPos, 0 );
Reference < XText > xText = xTextRange->getText();
Reference < XTextCursor > xTextCursor =
xText->createTextCursorByRange( xTextRange );
@@ -2134,8 +2032,6 @@ const SwStartNode *SwXMLTableContext::InsertTableSection(
}
}
-#endif
-
return pStNd;
}
@@ -2144,15 +2040,10 @@ void SwXMLTableContext::EndElement()
if( !xParentTable.Is() )
{
MakeTable();
-#ifdef XML_CORE_API
- GetSwImport().GetPaM().Move( fnMoveForward );
-#else
GetImport().GetTextImport()->SetCursor( xOldCursor );
-#endif
}
}
-#ifndef XML_CORE_API
class SwXMLTextImportHelper : public XMLTextImportHelper
{
protected:
@@ -2193,61 +2084,3 @@ XMLTextImportHelper* SwXMLImport::CreateTextImport()
return new SwXMLTextImportHelper( GetModel(), IsInsertMode(),
IsStylesOnlyMode() );
}
-
-#endif
-
-/*************************************************************************
-
- Source Code Control System - Header
-
- $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/sw/source/filter/xml/xmltbli.cxx,v 1.4 2000-09-27 07:52:50 mib Exp $
-
- Source Code Control System - Update
-
- $Log: not supported by cvs2svn $
- Revision 1.3 2000/09/27 07:28:00 mib
- align=margins now works without also specifying a width
-
- Revision 1.2 2000/09/27 06:16:11 mib
- #78246#: Calculation of relative column widths now works correctly even if
- the summ of all column widths is smaller than the page width.
-
- Revision 1.1.1.1 2000/09/18 17:15:00 hr
- initial import
-
- Revision 1.11 2000/09/18 16:05:07 willem.vandorp
- OpenOffice header added.
-
- Revision 1.10 2000/09/18 11:58:02 mib
- text frames/graphics import and export continued
-
- Revision 1.9 2000/08/24 11:16:42 mib
- text import continued
-
- Revision 1.8 2000/08/10 10:22:16 mib
- #74404#: Adeptions to new XSL/XLink working draft
-
- Revision 1.7 2000/07/21 12:55:15 mib
- text import/export using StarOffice API
-
- Revision 1.6 2000/06/08 09:45:55 aw
- changed to use functionality from xmloff project now
-
- Revision 1.5 2000/05/03 12:08:05 mib
- unicode
-
- Revision 1.4 2000/03/13 14:33:44 mib
- UNO3
-
- Revision 1.3 2000/03/10 11:15:04 mib
- #72721#: Made table import much more robust, rowspan
-
- Revision 1.2 2000/02/17 15:17:57 mib
- #70271#: headline repeat
-
- Revision 1.1 2000/02/17 14:40:01 mib
- #70271#: XML table import
-
-
-*************************************************************************/
-