1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_xmloff.hxx" 30*cdf0e10cSrcweir #include "XMLSectionImportContext.hxx" 31*cdf0e10cSrcweir #include "XMLSectionSourceImportContext.hxx" 32*cdf0e10cSrcweir #include "XMLSectionSourceDDEImportContext.hxx" 33*cdf0e10cSrcweir #include <xmloff/xmlictxt.hxx> 34*cdf0e10cSrcweir #include <xmloff/xmlimp.hxx> 35*cdf0e10cSrcweir #include <xmloff/txtimp.hxx> 36*cdf0e10cSrcweir #include <xmloff/nmspmap.hxx> 37*cdf0e10cSrcweir #include "xmloff/xmlnmspe.hxx" 38*cdf0e10cSrcweir #include <xmloff/xmltoken.hxx> 39*cdf0e10cSrcweir #include <xmloff/xmluconv.hxx> 40*cdf0e10cSrcweir #include <xmloff/prstylei.hxx> 41*cdf0e10cSrcweir #include <com/sun/star/container/XNamed.hpp> 42*cdf0e10cSrcweir #include <com/sun/star/uno/Reference.h> 43*cdf0e10cSrcweir #include <com/sun/star/text/XTextContent.hpp> 44*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 45*cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp> 46*cdf0e10cSrcweir #include <com/sun/star/text/ControlCharacter.hpp> 47*cdf0e10cSrcweir 48*cdf0e10cSrcweir 49*cdf0e10cSrcweir using ::rtl::OUString; 50*cdf0e10cSrcweir using ::com::sun::star::beans::XPropertySet; 51*cdf0e10cSrcweir using ::com::sun::star::uno::Reference; 52*cdf0e10cSrcweir using ::com::sun::star::xml::sax::XAttributeList; 53*cdf0e10cSrcweir using ::com::sun::star::lang::XMultiServiceFactory; 54*cdf0e10cSrcweir using ::com::sun::star::container::XNamed; 55*cdf0e10cSrcweir 56*cdf0e10cSrcweir using namespace ::com::sun::star::uno; 57*cdf0e10cSrcweir using namespace ::com::sun::star::text; 58*cdf0e10cSrcweir using namespace ::xmloff::token; 59*cdf0e10cSrcweir 60*cdf0e10cSrcweir 61*cdf0e10cSrcweir TYPEINIT1( XMLSectionImportContext, SvXMLImportContext ); 62*cdf0e10cSrcweir 63*cdf0e10cSrcweir const sal_Char sAPI_TextSection[] = "com.sun.star.text.TextSection"; 64*cdf0e10cSrcweir const sal_Char sAPI_IndexHeaderSection[] = "com.sun.star.text.IndexHeaderSection"; 65*cdf0e10cSrcweir const sal_Char sAPI_IsProtected[] = "IsProtected"; 66*cdf0e10cSrcweir const sal_Char sAPI_Condition[] = "Condition"; 67*cdf0e10cSrcweir const sal_Char sAPI_IsVisible[] = "IsVisible"; 68*cdf0e10cSrcweir const sal_Char sAPI_IsCurrentlyVisible[] = "IsCurrentlyVisible"; 69*cdf0e10cSrcweir const sal_Char sAPI_ProtectionKey[] = "ProtectionKey"; 70*cdf0e10cSrcweir 71*cdf0e10cSrcweir enum XMLSectionToken 72*cdf0e10cSrcweir { 73*cdf0e10cSrcweir XML_TOK_SECTION_XMLID, 74*cdf0e10cSrcweir XML_TOK_SECTION_STYLE_NAME, 75*cdf0e10cSrcweir XML_TOK_SECTION_NAME, 76*cdf0e10cSrcweir XML_TOK_SECTION_CONDITION, 77*cdf0e10cSrcweir XML_TOK_SECTION_DISPLAY, 78*cdf0e10cSrcweir XML_TOK_SECTION_PROTECT, 79*cdf0e10cSrcweir XML_TOK_SECTION_PROTECTION_KEY, 80*cdf0e10cSrcweir XML_TOK_SECTION_IS_HIDDEN 81*cdf0e10cSrcweir }; 82*cdf0e10cSrcweir 83*cdf0e10cSrcweir static __FAR_DATA SvXMLTokenMapEntry aSectionTokenMap[] = 84*cdf0e10cSrcweir { 85*cdf0e10cSrcweir { XML_NAMESPACE_XML , XML_ID, XML_TOK_SECTION_XMLID }, 86*cdf0e10cSrcweir { XML_NAMESPACE_TEXT, XML_STYLE_NAME, XML_TOK_SECTION_STYLE_NAME }, 87*cdf0e10cSrcweir { XML_NAMESPACE_TEXT, XML_NAME, XML_TOK_SECTION_NAME }, 88*cdf0e10cSrcweir { XML_NAMESPACE_TEXT, XML_CONDITION, XML_TOK_SECTION_CONDITION }, 89*cdf0e10cSrcweir { XML_NAMESPACE_TEXT, XML_DISPLAY, XML_TOK_SECTION_DISPLAY }, 90*cdf0e10cSrcweir { XML_NAMESPACE_TEXT, XML_PROTECTED, XML_TOK_SECTION_PROTECT }, 91*cdf0e10cSrcweir { XML_NAMESPACE_TEXT, XML_PROTECTION_KEY, XML_TOK_SECTION_PROTECTION_KEY}, 92*cdf0e10cSrcweir { XML_NAMESPACE_TEXT, XML_IS_HIDDEN, XML_TOK_SECTION_IS_HIDDEN }, 93*cdf0e10cSrcweir // compatibility with SRC629 (or earlier) versions 94*cdf0e10cSrcweir { XML_NAMESPACE_TEXT, XML_PROTECT, XML_TOK_SECTION_PROTECT }, 95*cdf0e10cSrcweir XML_TOKEN_MAP_END 96*cdf0e10cSrcweir }; 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir // section import: This one is fairly tricky due to a variety of 100*cdf0e10cSrcweir // limits of the core or the API. The main problem is that if you 101*cdf0e10cSrcweir // insert a section within another section, you can't move the cursor 102*cdf0e10cSrcweir // between the ends of the inner and the enclosing section. To avoid 103*cdf0e10cSrcweir // these problems, additional markers are first inserted and later deleted. 104*cdf0e10cSrcweir XMLSectionImportContext::XMLSectionImportContext( 105*cdf0e10cSrcweir SvXMLImport& rImport, 106*cdf0e10cSrcweir sal_uInt16 nPrfx, 107*cdf0e10cSrcweir const OUString& rLocalName ) 108*cdf0e10cSrcweir : SvXMLImportContext(rImport, nPrfx, rLocalName) 109*cdf0e10cSrcweir , sTextSection(RTL_CONSTASCII_USTRINGPARAM(sAPI_TextSection)) 110*cdf0e10cSrcweir , sIndexHeaderSection(RTL_CONSTASCII_USTRINGPARAM(sAPI_IndexHeaderSection)) 111*cdf0e10cSrcweir , sCondition(RTL_CONSTASCII_USTRINGPARAM(sAPI_Condition)) 112*cdf0e10cSrcweir , sIsVisible(RTL_CONSTASCII_USTRINGPARAM(sAPI_IsVisible)) 113*cdf0e10cSrcweir , sProtectionKey(RTL_CONSTASCII_USTRINGPARAM(sAPI_ProtectionKey)) 114*cdf0e10cSrcweir , sIsProtected(RTL_CONSTASCII_USTRINGPARAM(sAPI_IsProtected)) 115*cdf0e10cSrcweir , sIsCurrentlyVisible(RTL_CONSTASCII_USTRINGPARAM(sAPI_IsCurrentlyVisible)) 116*cdf0e10cSrcweir , bProtect(sal_False) 117*cdf0e10cSrcweir , bCondOK(sal_False) 118*cdf0e10cSrcweir , bIsVisible(sal_True) 119*cdf0e10cSrcweir , bValid(sal_False) 120*cdf0e10cSrcweir , bSequenceOK(sal_False) 121*cdf0e10cSrcweir , bIsCurrentlyVisible(sal_True) 122*cdf0e10cSrcweir , bIsCurrentlyVisibleOK(sal_False) 123*cdf0e10cSrcweir , bHasContent(sal_False) 124*cdf0e10cSrcweir { 125*cdf0e10cSrcweir } 126*cdf0e10cSrcweir 127*cdf0e10cSrcweir XMLSectionImportContext::~XMLSectionImportContext() 128*cdf0e10cSrcweir { 129*cdf0e10cSrcweir } 130*cdf0e10cSrcweir 131*cdf0e10cSrcweir void XMLSectionImportContext::StartElement( 132*cdf0e10cSrcweir const Reference<XAttributeList> & xAttrList) 133*cdf0e10cSrcweir { 134*cdf0e10cSrcweir // process attributes 135*cdf0e10cSrcweir ProcessAttributes(xAttrList); 136*cdf0e10cSrcweir 137*cdf0e10cSrcweir // process index headers: 138*cdf0e10cSrcweir sal_Bool bIsIndexHeader = IsXMLToken( GetLocalName(), XML_INDEX_TITLE ); 139*cdf0e10cSrcweir if (bIsIndexHeader) 140*cdf0e10cSrcweir { 141*cdf0e10cSrcweir bValid = sal_True; 142*cdf0e10cSrcweir } 143*cdf0e10cSrcweir 144*cdf0e10cSrcweir UniReference<XMLTextImportHelper> rHelper = GetImport().GetTextImport(); 145*cdf0e10cSrcweir 146*cdf0e10cSrcweir // valid? 147*cdf0e10cSrcweir if (bValid) 148*cdf0e10cSrcweir { 149*cdf0e10cSrcweir // create text section (as XPropertySet) 150*cdf0e10cSrcweir Reference<XMultiServiceFactory> xFactory( 151*cdf0e10cSrcweir GetImport().GetModel(),UNO_QUERY); 152*cdf0e10cSrcweir if (xFactory.is()) 153*cdf0e10cSrcweir { 154*cdf0e10cSrcweir Reference<XInterface> xIfc = 155*cdf0e10cSrcweir xFactory->createInstance( bIsIndexHeader ? sIndexHeaderSection 156*cdf0e10cSrcweir : sTextSection ); 157*cdf0e10cSrcweir if (xIfc.is()) 158*cdf0e10cSrcweir { 159*cdf0e10cSrcweir Reference<XPropertySet> xPropSet(xIfc, UNO_QUERY); 160*cdf0e10cSrcweir 161*cdf0e10cSrcweir // save PropertySet (for CreateChildContext) 162*cdf0e10cSrcweir xSectionPropertySet = xPropSet; 163*cdf0e10cSrcweir 164*cdf0e10cSrcweir // name 165*cdf0e10cSrcweir Reference<XNamed> xNamed(xPropSet, UNO_QUERY); 166*cdf0e10cSrcweir xNamed->setName(sName); 167*cdf0e10cSrcweir 168*cdf0e10cSrcweir // stylename? 169*cdf0e10cSrcweir if (sStyleName.getLength() > 0) 170*cdf0e10cSrcweir { 171*cdf0e10cSrcweir XMLPropStyleContext* pStyle = rHelper-> 172*cdf0e10cSrcweir FindSectionStyle(sStyleName); 173*cdf0e10cSrcweir 174*cdf0e10cSrcweir if (pStyle != NULL) 175*cdf0e10cSrcweir { 176*cdf0e10cSrcweir pStyle->FillPropertySet( xPropSet ); 177*cdf0e10cSrcweir } 178*cdf0e10cSrcweir } 179*cdf0e10cSrcweir 180*cdf0e10cSrcweir // IsVisible and condition (not for index headers) 181*cdf0e10cSrcweir if (! bIsIndexHeader) 182*cdf0e10cSrcweir { 183*cdf0e10cSrcweir Any aAny; 184*cdf0e10cSrcweir aAny.setValue( &bIsVisible, ::getBooleanCppuType() ); 185*cdf0e10cSrcweir xPropSet->setPropertyValue( sIsVisible, aAny ); 186*cdf0e10cSrcweir 187*cdf0e10cSrcweir // #97450# hidden sections must be hidden on reload 188*cdf0e10cSrcweir // For backwards compatibilty, set flag only if it is 189*cdf0e10cSrcweir // present 190*cdf0e10cSrcweir if( bIsCurrentlyVisibleOK ) 191*cdf0e10cSrcweir { 192*cdf0e10cSrcweir aAny.setValue( &bIsCurrentlyVisible, 193*cdf0e10cSrcweir ::getBooleanCppuType() ); 194*cdf0e10cSrcweir xPropSet->setPropertyValue( sIsCurrentlyVisible, aAny); 195*cdf0e10cSrcweir } 196*cdf0e10cSrcweir 197*cdf0e10cSrcweir if (bCondOK) 198*cdf0e10cSrcweir { 199*cdf0e10cSrcweir aAny <<= sCond; 200*cdf0e10cSrcweir xPropSet->setPropertyValue( sCondition, aAny ); 201*cdf0e10cSrcweir } 202*cdf0e10cSrcweir } 203*cdf0e10cSrcweir 204*cdf0e10cSrcweir // password (only for regular sections) 205*cdf0e10cSrcweir if ( bSequenceOK && 206*cdf0e10cSrcweir IsXMLToken(GetLocalName(), XML_SECTION) ) 207*cdf0e10cSrcweir { 208*cdf0e10cSrcweir Any aAny; 209*cdf0e10cSrcweir aAny <<= aSequence; 210*cdf0e10cSrcweir xPropSet->setPropertyValue(sProtectionKey, aAny); 211*cdf0e10cSrcweir } 212*cdf0e10cSrcweir 213*cdf0e10cSrcweir // protection 214*cdf0e10cSrcweir Any aAny; 215*cdf0e10cSrcweir aAny.setValue( &bProtect, ::getBooleanCppuType() ); 216*cdf0e10cSrcweir xPropSet->setPropertyValue( sIsProtected, aAny ); 217*cdf0e10cSrcweir 218*cdf0e10cSrcweir // insert marker, <paragraph>, marker; then insert 219*cdf0e10cSrcweir // section over the first marker character, and delete the 220*cdf0e10cSrcweir // last paragraph (and marker) when closing a section. 221*cdf0e10cSrcweir Reference<XTextRange> xStart = 222*cdf0e10cSrcweir rHelper->GetCursor()->getStart(); 223*cdf0e10cSrcweir #ifndef DBG_UTIL 224*cdf0e10cSrcweir static const sal_Char sMarker[] = " "; 225*cdf0e10cSrcweir #else 226*cdf0e10cSrcweir static const sal_Char sMarker[] = "X"; 227*cdf0e10cSrcweir #endif 228*cdf0e10cSrcweir OUString sMarkerString(RTL_CONSTASCII_USTRINGPARAM(sMarker)); 229*cdf0e10cSrcweir rHelper->InsertString(sMarkerString); 230*cdf0e10cSrcweir rHelper->InsertControlCharacter( 231*cdf0e10cSrcweir ControlCharacter::APPEND_PARAGRAPH ); 232*cdf0e10cSrcweir rHelper->InsertString(sMarkerString); 233*cdf0e10cSrcweir 234*cdf0e10cSrcweir // select first marker 235*cdf0e10cSrcweir rHelper->GetCursor()->gotoRange(xStart, sal_False); 236*cdf0e10cSrcweir rHelper->GetCursor()->goRight(1, sal_True); 237*cdf0e10cSrcweir 238*cdf0e10cSrcweir // convert section to XTextContent 239*cdf0e10cSrcweir Reference<XTextContent> xTextContent(xSectionPropertySet, 240*cdf0e10cSrcweir UNO_QUERY); 241*cdf0e10cSrcweir 242*cdf0e10cSrcweir // and insert (over marker) 243*cdf0e10cSrcweir rHelper->GetText()->insertTextContent( 244*cdf0e10cSrcweir rHelper->GetCursorAsRange(), xTextContent, sal_True ); 245*cdf0e10cSrcweir 246*cdf0e10cSrcweir // and delete first marker (in section) 247*cdf0e10cSrcweir rHelper->GetText()->insertString( 248*cdf0e10cSrcweir rHelper->GetCursorAsRange(), sEmpty, sal_True); 249*cdf0e10cSrcweir 250*cdf0e10cSrcweir // finally, check for redlines that should start at 251*cdf0e10cSrcweir // the section start node 252*cdf0e10cSrcweir rHelper->RedlineAdjustStartNodeCursor(sal_True); // start ??? 253*cdf0e10cSrcweir 254*cdf0e10cSrcweir // xml:id for RDF metadata 255*cdf0e10cSrcweir GetImport().SetXmlId(xIfc, sXmlId); 256*cdf0e10cSrcweir } 257*cdf0e10cSrcweir } 258*cdf0e10cSrcweir } 259*cdf0e10cSrcweir } 260*cdf0e10cSrcweir 261*cdf0e10cSrcweir void XMLSectionImportContext::ProcessAttributes( 262*cdf0e10cSrcweir const Reference<XAttributeList> & xAttrList ) 263*cdf0e10cSrcweir { 264*cdf0e10cSrcweir SvXMLTokenMap aTokenMap(aSectionTokenMap); 265*cdf0e10cSrcweir 266*cdf0e10cSrcweir sal_Int16 nLength = xAttrList->getLength(); 267*cdf0e10cSrcweir for(sal_Int16 nAttr = 0; nAttr < nLength; nAttr++) 268*cdf0e10cSrcweir { 269*cdf0e10cSrcweir OUString sLocalName; 270*cdf0e10cSrcweir sal_uInt16 nNamePrefix = GetImport().GetNamespaceMap(). 271*cdf0e10cSrcweir GetKeyByAttrName( xAttrList->getNameByIndex(nAttr), 272*cdf0e10cSrcweir &sLocalName ); 273*cdf0e10cSrcweir OUString sAttr = xAttrList->getValueByIndex(nAttr); 274*cdf0e10cSrcweir 275*cdf0e10cSrcweir switch (aTokenMap.Get(nNamePrefix, sLocalName)) 276*cdf0e10cSrcweir { 277*cdf0e10cSrcweir case XML_TOK_SECTION_XMLID: 278*cdf0e10cSrcweir sXmlId = sAttr; 279*cdf0e10cSrcweir break; 280*cdf0e10cSrcweir case XML_TOK_SECTION_STYLE_NAME: 281*cdf0e10cSrcweir sStyleName = sAttr; 282*cdf0e10cSrcweir break; 283*cdf0e10cSrcweir case XML_TOK_SECTION_NAME: 284*cdf0e10cSrcweir sName = sAttr; 285*cdf0e10cSrcweir bValid = sal_True; 286*cdf0e10cSrcweir break; 287*cdf0e10cSrcweir case XML_TOK_SECTION_CONDITION: 288*cdf0e10cSrcweir { 289*cdf0e10cSrcweir OUString sTmp; 290*cdf0e10cSrcweir sal_uInt16 nPrefix = GetImport().GetNamespaceMap(). 291*cdf0e10cSrcweir _GetKeyByAttrName( sAttr, &sTmp, sal_False ); 292*cdf0e10cSrcweir if( XML_NAMESPACE_OOOW == nPrefix ) 293*cdf0e10cSrcweir { 294*cdf0e10cSrcweir sCond = sTmp; 295*cdf0e10cSrcweir bCondOK = sal_True; 296*cdf0e10cSrcweir } 297*cdf0e10cSrcweir else 298*cdf0e10cSrcweir sCond = sAttr; 299*cdf0e10cSrcweir } 300*cdf0e10cSrcweir break; 301*cdf0e10cSrcweir case XML_TOK_SECTION_DISPLAY: 302*cdf0e10cSrcweir if (IsXMLToken(sAttr, XML_TRUE)) 303*cdf0e10cSrcweir { 304*cdf0e10cSrcweir bIsVisible = sal_True; 305*cdf0e10cSrcweir } 306*cdf0e10cSrcweir else if ( IsXMLToken(sAttr, XML_NONE) || 307*cdf0e10cSrcweir IsXMLToken(sAttr, XML_CONDITION) ) 308*cdf0e10cSrcweir { 309*cdf0e10cSrcweir bIsVisible = sal_False; 310*cdf0e10cSrcweir } 311*cdf0e10cSrcweir // else: ignore 312*cdf0e10cSrcweir break; 313*cdf0e10cSrcweir case XML_TOK_SECTION_IS_HIDDEN: 314*cdf0e10cSrcweir { 315*cdf0e10cSrcweir sal_Bool bTmp; 316*cdf0e10cSrcweir if (SvXMLUnitConverter::convertBool(bTmp, sAttr)) 317*cdf0e10cSrcweir { 318*cdf0e10cSrcweir bIsCurrentlyVisible = !bTmp; 319*cdf0e10cSrcweir bIsCurrentlyVisibleOK = sal_True; 320*cdf0e10cSrcweir } 321*cdf0e10cSrcweir } 322*cdf0e10cSrcweir break; 323*cdf0e10cSrcweir case XML_TOK_SECTION_PROTECTION_KEY: 324*cdf0e10cSrcweir SvXMLUnitConverter::decodeBase64(aSequence, sAttr); 325*cdf0e10cSrcweir bSequenceOK = sal_True; 326*cdf0e10cSrcweir break; 327*cdf0e10cSrcweir case XML_TOK_SECTION_PROTECT: 328*cdf0e10cSrcweir { 329*cdf0e10cSrcweir sal_Bool bTmp; 330*cdf0e10cSrcweir if (SvXMLUnitConverter::convertBool(bTmp, sAttr)) 331*cdf0e10cSrcweir { 332*cdf0e10cSrcweir bProtect = bTmp; 333*cdf0e10cSrcweir } 334*cdf0e10cSrcweir break; 335*cdf0e10cSrcweir } 336*cdf0e10cSrcweir default: 337*cdf0e10cSrcweir ; // ignore 338*cdf0e10cSrcweir break; 339*cdf0e10cSrcweir } 340*cdf0e10cSrcweir } 341*cdf0e10cSrcweir } 342*cdf0e10cSrcweir 343*cdf0e10cSrcweir void XMLSectionImportContext::EndElement() 344*cdf0e10cSrcweir { 345*cdf0e10cSrcweir // get rid of last paragraph 346*cdf0e10cSrcweir // (unless it's the only paragraph in the section) 347*cdf0e10cSrcweir UniReference<XMLTextImportHelper> rHelper = GetImport().GetTextImport(); 348*cdf0e10cSrcweir rHelper->GetCursor()->goRight(1, sal_False); 349*cdf0e10cSrcweir if (bHasContent) 350*cdf0e10cSrcweir { 351*cdf0e10cSrcweir rHelper->GetCursor()->goLeft(1, sal_True); 352*cdf0e10cSrcweir rHelper->GetText()->insertString(rHelper->GetCursorAsRange(), 353*cdf0e10cSrcweir sEmpty, sal_True); 354*cdf0e10cSrcweir } 355*cdf0e10cSrcweir 356*cdf0e10cSrcweir // and delete second marker 357*cdf0e10cSrcweir rHelper->GetCursor()->goRight(1, sal_True); 358*cdf0e10cSrcweir rHelper->GetText()->insertString(rHelper->GetCursorAsRange(), 359*cdf0e10cSrcweir sEmpty, sal_True); 360*cdf0e10cSrcweir 361*cdf0e10cSrcweir // check for redlines to our endnode 362*cdf0e10cSrcweir rHelper->RedlineAdjustStartNodeCursor(sal_False); 363*cdf0e10cSrcweir } 364*cdf0e10cSrcweir 365*cdf0e10cSrcweir SvXMLImportContext* XMLSectionImportContext::CreateChildContext( 366*cdf0e10cSrcweir sal_uInt16 nPrefix, 367*cdf0e10cSrcweir const OUString& rLocalName, 368*cdf0e10cSrcweir const Reference<XAttributeList> & xAttrList ) 369*cdf0e10cSrcweir { 370*cdf0e10cSrcweir SvXMLImportContext* pContext = NULL; 371*cdf0e10cSrcweir 372*cdf0e10cSrcweir // section-source (-dde) elements 373*cdf0e10cSrcweir if ( (XML_NAMESPACE_TEXT == nPrefix) && 374*cdf0e10cSrcweir IsXMLToken(rLocalName, XML_SECTION_SOURCE) ) 375*cdf0e10cSrcweir { 376*cdf0e10cSrcweir pContext = new XMLSectionSourceImportContext(GetImport(), 377*cdf0e10cSrcweir nPrefix, rLocalName, 378*cdf0e10cSrcweir xSectionPropertySet); 379*cdf0e10cSrcweir } 380*cdf0e10cSrcweir else if ( (XML_NAMESPACE_OFFICE == nPrefix) && 381*cdf0e10cSrcweir IsXMLToken(rLocalName, XML_DDE_SOURCE) ) 382*cdf0e10cSrcweir { 383*cdf0e10cSrcweir pContext = new XMLSectionSourceDDEImportContext(GetImport(), 384*cdf0e10cSrcweir nPrefix, rLocalName, 385*cdf0e10cSrcweir xSectionPropertySet); 386*cdf0e10cSrcweir } 387*cdf0e10cSrcweir else 388*cdf0e10cSrcweir { 389*cdf0e10cSrcweir // otherwise: text context 390*cdf0e10cSrcweir pContext = GetImport().GetTextImport()->CreateTextChildContext( 391*cdf0e10cSrcweir GetImport(), nPrefix, rLocalName, xAttrList, 392*cdf0e10cSrcweir XML_TEXT_TYPE_SECTION ); 393*cdf0e10cSrcweir 394*cdf0e10cSrcweir // if that fails, default context 395*cdf0e10cSrcweir if (NULL == pContext) 396*cdf0e10cSrcweir { 397*cdf0e10cSrcweir pContext = new SvXMLImportContext( GetImport(), 398*cdf0e10cSrcweir nPrefix, rLocalName ); 399*cdf0e10cSrcweir } 400*cdf0e10cSrcweir else 401*cdf0e10cSrcweir bHasContent = sal_True; 402*cdf0e10cSrcweir } 403*cdf0e10cSrcweir 404*cdf0e10cSrcweir return pContext; 405*cdf0e10cSrcweir } 406*cdf0e10cSrcweir 407