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 "unointerfacetouniqueidentifiermapper.hxx" 31*cdf0e10cSrcweir #include <tools/debug.hxx> 32*cdf0e10cSrcweir #ifndef _SVSTDARR_LONGS_DECL 33*cdf0e10cSrcweir #define _SVSTDARR_LONGS 34*cdf0e10cSrcweir #include <svl/svstdarr.hxx> 35*cdf0e10cSrcweir #endif 36*cdf0e10cSrcweir #include <svl/svarray.hxx> 37*cdf0e10cSrcweir #include <rtl/ustrbuf.hxx> 38*cdf0e10cSrcweir #include <sal/types.h> 39*cdf0e10cSrcweir 40*cdf0e10cSrcweir #include <vector> 41*cdf0e10cSrcweir #include <list> 42*cdf0e10cSrcweir #include <hash_map> 43*cdf0e10cSrcweir 44*cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 45*cdf0e10cSrcweir #include <com/sun/star/container/XEnumerationAccess.hpp> 46*cdf0e10cSrcweir #include <com/sun/star/container/XEnumeration.hpp> 47*cdf0e10cSrcweir #include <com/sun/star/container/XIndexReplace.hpp> 48*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 49*cdf0e10cSrcweir #include <com/sun/star/beans/XMultiPropertySet.hpp> 50*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyState.hpp> 51*cdf0e10cSrcweir #include <com/sun/star/text/XTextDocument.hpp> 52*cdf0e10cSrcweir #include <com/sun/star/text/XTextSectionsSupplier.hpp> 53*cdf0e10cSrcweir #include <com/sun/star/text/XTextTablesSupplier.hpp> 54*cdf0e10cSrcweir #include <com/sun/star/text/XNumberingRulesSupplier.hpp> 55*cdf0e10cSrcweir #include <com/sun/star/text/XChapterNumberingSupplier.hpp>//#outline level,add by zhaojianwei 56*cdf0e10cSrcweir #include <com/sun/star/text/XTextTable.hpp> 57*cdf0e10cSrcweir #include <com/sun/star/text/XText.hpp> 58*cdf0e10cSrcweir #include <com/sun/star/text/XTextContent.hpp> 59*cdf0e10cSrcweir #include <com/sun/star/text/XTextRange.hpp> 60*cdf0e10cSrcweir #include <com/sun/star/text/XTextField.hpp> 61*cdf0e10cSrcweir #include <com/sun/star/text/XFootnote.hpp> 62*cdf0e10cSrcweir #include <com/sun/star/container/XNamed.hpp> 63*cdf0e10cSrcweir #include <com/sun/star/container/XContentEnumerationAccess.hpp> 64*cdf0e10cSrcweir #include <com/sun/star/text/XTextFrame.hpp> 65*cdf0e10cSrcweir #include <com/sun/star/container/XNameAccess.hpp> 66*cdf0e10cSrcweir #include <com/sun/star/text/SizeType.hpp> 67*cdf0e10cSrcweir #include <com/sun/star/text/HoriOrientation.hpp> 68*cdf0e10cSrcweir #include <com/sun/star/text/VertOrientation.hpp> 69*cdf0e10cSrcweir #include <com/sun/star/text/TextContentAnchorType.hpp> 70*cdf0e10cSrcweir #include <com/sun/star/text/XTextFramesSupplier.hpp> 71*cdf0e10cSrcweir #include <com/sun/star/text/XTextGraphicObjectsSupplier.hpp> 72*cdf0e10cSrcweir #include <com/sun/star/text/XTextEmbeddedObjectsSupplier.hpp> 73*cdf0e10cSrcweir #include <com/sun/star/drawing/XDrawPageSupplier.hpp> 74*cdf0e10cSrcweir #include <com/sun/star/document/XEmbeddedObjectSupplier.hpp> 75*cdf0e10cSrcweir #include <com/sun/star/document/XEventsSupplier.hpp> 76*cdf0e10cSrcweir #include <com/sun/star/document/XRedlinesSupplier.hpp> 77*cdf0e10cSrcweir 78*cdf0e10cSrcweir #include <com/sun/star/text/XBookmarksSupplier.hpp> 79*cdf0e10cSrcweir #include <com/sun/star/text/XFormField.hpp> 80*cdf0e10cSrcweir 81*cdf0e10cSrcweir #include <com/sun/star/text/XTextSection.hpp> 82*cdf0e10cSrcweir #include <com/sun/star/text/SectionFileLink.hpp> 83*cdf0e10cSrcweir #include <com/sun/star/drawing/XShape.hpp> 84*cdf0e10cSrcweir #include <com/sun/star/text/XTextShapesSupplier.hpp> 85*cdf0e10cSrcweir 86*cdf0e10cSrcweir #include <com/sun/star/style/XAutoStylesSupplier.hpp> 87*cdf0e10cSrcweir #include <com/sun/star/style/XAutoStyleFamily.hpp> 88*cdf0e10cSrcweir #include <com/sun/star/text/XTextFieldsSupplier.hpp> 89*cdf0e10cSrcweir #include <com/sun/star/text/XFootnotesSupplier.hpp> 90*cdf0e10cSrcweir #include <com/sun/star/text/XEndnotesSupplier.hpp> 91*cdf0e10cSrcweir #include <com/sun/star/drawing/XControlShape.hpp> 92*cdf0e10cSrcweir #include <com/sun/star/util/DateTime.hpp> 93*cdf0e10cSrcweir #include "xmloff/xmlnmspe.hxx" 94*cdf0e10cSrcweir #include <xmloff/xmlaustp.hxx> 95*cdf0e10cSrcweir #include <xmloff/families.hxx> 96*cdf0e10cSrcweir #include "txtexppr.hxx" 97*cdf0e10cSrcweir #include <xmloff/xmlnumfe.hxx> 98*cdf0e10cSrcweir #include <xmloff/xmlnume.hxx> 99*cdf0e10cSrcweir #include <xmloff/xmluconv.hxx> 100*cdf0e10cSrcweir #include "XMLAnchorTypePropHdl.hxx" 101*cdf0e10cSrcweir #include "xexptran.hxx" 102*cdf0e10cSrcweir #include <xmloff/ProgressBarHelper.hxx> 103*cdf0e10cSrcweir #include <xmloff/nmspmap.hxx> 104*cdf0e10cSrcweir #include <xmloff/xmlexp.hxx> 105*cdf0e10cSrcweir #include "txtflde.hxx" 106*cdf0e10cSrcweir #include <xmloff/txtprmap.hxx> 107*cdf0e10cSrcweir #include "XMLImageMapExport.hxx" 108*cdf0e10cSrcweir #include "XMLTextNumRuleInfo.hxx" 109*cdf0e10cSrcweir #include "xmloff/XMLTextListAutoStylePool.hxx" 110*cdf0e10cSrcweir #include <xmloff/txtparae.hxx> 111*cdf0e10cSrcweir #include "XMLSectionExport.hxx" 112*cdf0e10cSrcweir #include "XMLIndexMarkExport.hxx" 113*cdf0e10cSrcweir #include <xmloff/XMLEventExport.hxx> 114*cdf0e10cSrcweir #include "XMLRedlineExport.hxx" 115*cdf0e10cSrcweir #include "MultiPropertySetHelper.hxx" 116*cdf0e10cSrcweir #include <xmloff/formlayerexport.hxx> 117*cdf0e10cSrcweir #include "XMLTextCharStyleNamesElementExport.hxx" 118*cdf0e10cSrcweir #include <comphelper/stlunosequence.hxx> 119*cdf0e10cSrcweir 120*cdf0e10cSrcweir // --> OD 2008-04-25 #refactorlists# 121*cdf0e10cSrcweir #include <txtlists.hxx> 122*cdf0e10cSrcweir // <-- 123*cdf0e10cSrcweir #include <com/sun/star/rdf/XMetadatable.hpp> 124*cdf0e10cSrcweir 125*cdf0e10cSrcweir using ::rtl::OUString; 126*cdf0e10cSrcweir using ::rtl::OUStringBuffer; 127*cdf0e10cSrcweir 128*cdf0e10cSrcweir using namespace ::std; 129*cdf0e10cSrcweir using namespace ::com::sun::star; 130*cdf0e10cSrcweir using namespace ::com::sun::star::uno; 131*cdf0e10cSrcweir using namespace ::com::sun::star::lang; 132*cdf0e10cSrcweir using namespace ::com::sun::star::beans; 133*cdf0e10cSrcweir using namespace ::com::sun::star::container; 134*cdf0e10cSrcweir using namespace ::com::sun::star::text; 135*cdf0e10cSrcweir using namespace ::com::sun::star::style; 136*cdf0e10cSrcweir using namespace ::com::sun::star::util; 137*cdf0e10cSrcweir using namespace ::com::sun::star::drawing; 138*cdf0e10cSrcweir using namespace ::com::sun::star::document; 139*cdf0e10cSrcweir using namespace ::com::sun::star::frame; 140*cdf0e10cSrcweir using namespace ::xmloff; 141*cdf0e10cSrcweir using namespace ::xmloff::token; 142*cdf0e10cSrcweir 143*cdf0e10cSrcweir namespace 144*cdf0e10cSrcweir { 145*cdf0e10cSrcweir class TextContentSet 146*cdf0e10cSrcweir { 147*cdf0e10cSrcweir public: 148*cdf0e10cSrcweir typedef Reference<XTextContent> text_content_ref_t; 149*cdf0e10cSrcweir typedef list<text_content_ref_t> contents_t; 150*cdf0e10cSrcweir typedef back_insert_iterator<contents_t> inserter_t; 151*cdf0e10cSrcweir typedef contents_t::const_iterator const_iterator_t; 152*cdf0e10cSrcweir 153*cdf0e10cSrcweir inserter_t getInserter() 154*cdf0e10cSrcweir { return back_insert_iterator<contents_t>(m_vTextContents); }; 155*cdf0e10cSrcweir const_iterator_t getBegin() const 156*cdf0e10cSrcweir { return m_vTextContents.begin(); }; 157*cdf0e10cSrcweir const_iterator_t getEnd() const 158*cdf0e10cSrcweir { return m_vTextContents.end(); }; 159*cdf0e10cSrcweir 160*cdf0e10cSrcweir private: 161*cdf0e10cSrcweir contents_t m_vTextContents; 162*cdf0e10cSrcweir }; 163*cdf0e10cSrcweir 164*cdf0e10cSrcweir struct FrameRefHash 165*cdf0e10cSrcweir : public unary_function<Reference<XTextFrame>, size_t> 166*cdf0e10cSrcweir { 167*cdf0e10cSrcweir size_t operator()(const Reference<XTextFrame> xFrame) const 168*cdf0e10cSrcweir { return sal::static_int_cast<size_t>(reinterpret_cast<sal_uIntPtr>(xFrame.get())); } 169*cdf0e10cSrcweir }; 170*cdf0e10cSrcweir 171*cdf0e10cSrcweir static bool lcl_TextContentsUnfiltered(const Reference<XTextContent>&) 172*cdf0e10cSrcweir { return true; }; 173*cdf0e10cSrcweir 174*cdf0e10cSrcweir static bool lcl_ShapeFilter(const Reference<XTextContent>& xTxtContent) 175*cdf0e10cSrcweir { 176*cdf0e10cSrcweir static const OUString sTextFrameService = OUString::createFromAscii("com.sun.star.text.TextFrame"); 177*cdf0e10cSrcweir static const OUString sTextGraphicService = OUString::createFromAscii("com.sun.star.text.TextGraphicObject"); 178*cdf0e10cSrcweir static const OUString sTextEmbeddedService = OUString::createFromAscii("com.sun.star.text.TextEmbeddedObject"); 179*cdf0e10cSrcweir Reference<XShape> xShape(xTxtContent, UNO_QUERY); 180*cdf0e10cSrcweir if(!xShape.is()) 181*cdf0e10cSrcweir return false; 182*cdf0e10cSrcweir Reference<XServiceInfo> xServiceInfo(xTxtContent, UNO_QUERY); 183*cdf0e10cSrcweir if(xServiceInfo->supportsService(sTextFrameService) || 184*cdf0e10cSrcweir xServiceInfo->supportsService(sTextGraphicService) || 185*cdf0e10cSrcweir xServiceInfo->supportsService(sTextEmbeddedService) ) 186*cdf0e10cSrcweir return false; 187*cdf0e10cSrcweir return true; 188*cdf0e10cSrcweir }; 189*cdf0e10cSrcweir 190*cdf0e10cSrcweir class BoundFrames 191*cdf0e10cSrcweir { 192*cdf0e10cSrcweir public: 193*cdf0e10cSrcweir typedef bool (*filter_t)(const Reference<XTextContent>&); 194*cdf0e10cSrcweir BoundFrames( 195*cdf0e10cSrcweir const Reference<XEnumerationAccess> xEnumAccess, 196*cdf0e10cSrcweir const filter_t& rFilter) 197*cdf0e10cSrcweir : m_xEnumAccess(xEnumAccess) 198*cdf0e10cSrcweir { 199*cdf0e10cSrcweir Fill(rFilter); 200*cdf0e10cSrcweir }; 201*cdf0e10cSrcweir BoundFrames() 202*cdf0e10cSrcweir {}; 203*cdf0e10cSrcweir const TextContentSet* GetPageBoundContents() const 204*cdf0e10cSrcweir { return &m_vPageBounds; }; 205*cdf0e10cSrcweir const TextContentSet* GetFrameBoundContents(const Reference<XTextFrame>& rParentFrame) const 206*cdf0e10cSrcweir { 207*cdf0e10cSrcweir framebound_map_t::const_iterator it = m_vFrameBoundsOf.find(rParentFrame); 208*cdf0e10cSrcweir if(it == m_vFrameBoundsOf.end()) 209*cdf0e10cSrcweir return NULL; 210*cdf0e10cSrcweir return &(it->second); 211*cdf0e10cSrcweir }; 212*cdf0e10cSrcweir Reference<XEnumeration> createEnumeration() const 213*cdf0e10cSrcweir { 214*cdf0e10cSrcweir if(!m_xEnumAccess.is()) 215*cdf0e10cSrcweir return Reference<XEnumeration>(); 216*cdf0e10cSrcweir return m_xEnumAccess->createEnumeration(); 217*cdf0e10cSrcweir }; 218*cdf0e10cSrcweir 219*cdf0e10cSrcweir private: 220*cdf0e10cSrcweir typedef hash_map< 221*cdf0e10cSrcweir Reference<XTextFrame>, 222*cdf0e10cSrcweir TextContentSet, 223*cdf0e10cSrcweir FrameRefHash> framebound_map_t; 224*cdf0e10cSrcweir TextContentSet m_vPageBounds; 225*cdf0e10cSrcweir framebound_map_t m_vFrameBoundsOf; 226*cdf0e10cSrcweir const Reference<XEnumerationAccess> m_xEnumAccess; 227*cdf0e10cSrcweir void Fill(const filter_t& rFilter); 228*cdf0e10cSrcweir static const OUString our_sAnchorType; 229*cdf0e10cSrcweir static const OUString our_sAnchorFrame; 230*cdf0e10cSrcweir }; 231*cdf0e10cSrcweir const OUString BoundFrames::our_sAnchorType = OUString::createFromAscii("AnchorType"); 232*cdf0e10cSrcweir const OUString BoundFrames::our_sAnchorFrame = OUString::createFromAscii("AnchorFrame"); 233*cdf0e10cSrcweir 234*cdf0e10cSrcweir class FieldParamExporter 235*cdf0e10cSrcweir { 236*cdf0e10cSrcweir public: 237*cdf0e10cSrcweir FieldParamExporter(SvXMLExport* const pExport, Reference<XNameContainer> xFieldParams) 238*cdf0e10cSrcweir : m_pExport(pExport) 239*cdf0e10cSrcweir , m_xFieldParams(xFieldParams) 240*cdf0e10cSrcweir { }; 241*cdf0e10cSrcweir void Export(); 242*cdf0e10cSrcweir 243*cdf0e10cSrcweir private: 244*cdf0e10cSrcweir SvXMLExport* const m_pExport; 245*cdf0e10cSrcweir const Reference<XNameContainer> m_xFieldParams; 246*cdf0e10cSrcweir 247*cdf0e10cSrcweir void ExportParameter(const OUString& sKey, const OUString& sValue); 248*cdf0e10cSrcweir }; 249*cdf0e10cSrcweir } 250*cdf0e10cSrcweir 251*cdf0e10cSrcweir namespace xmloff 252*cdf0e10cSrcweir { 253*cdf0e10cSrcweir class BoundFrameSets 254*cdf0e10cSrcweir { 255*cdf0e10cSrcweir public: 256*cdf0e10cSrcweir BoundFrameSets(const Reference<XInterface> xModel); 257*cdf0e10cSrcweir const BoundFrames* GetTexts() const 258*cdf0e10cSrcweir { return m_pTexts.get(); }; 259*cdf0e10cSrcweir const BoundFrames* GetGraphics() const 260*cdf0e10cSrcweir { return m_pGraphics.get(); }; 261*cdf0e10cSrcweir const BoundFrames* GetEmbeddeds() const 262*cdf0e10cSrcweir { return m_pEmbeddeds.get(); }; 263*cdf0e10cSrcweir const BoundFrames* GetShapes() const 264*cdf0e10cSrcweir { return m_pShapes.get(); }; 265*cdf0e10cSrcweir private: 266*cdf0e10cSrcweir auto_ptr<BoundFrames> m_pTexts; 267*cdf0e10cSrcweir auto_ptr<BoundFrames> m_pGraphics; 268*cdf0e10cSrcweir auto_ptr<BoundFrames> m_pEmbeddeds; 269*cdf0e10cSrcweir auto_ptr<BoundFrames> m_pShapes; 270*cdf0e10cSrcweir }; 271*cdf0e10cSrcweir } 272*cdf0e10cSrcweir 273*cdf0e10cSrcweir typedef OUString *OUStringPtr; 274*cdf0e10cSrcweir SV_DECL_PTRARR_DEL( OUStrings_Impl, OUStringPtr, 20, 10 ) 275*cdf0e10cSrcweir SV_IMPL_PTRARR( OUStrings_Impl, OUStringPtr ) 276*cdf0e10cSrcweir 277*cdf0e10cSrcweir SV_DECL_PTRARR_SORT_DEL( OUStringsSort_Impl, OUStringPtr, 20, 10 ) 278*cdf0e10cSrcweir SV_IMPL_OP_PTRARR_SORT( OUStringsSort_Impl, OUStringPtr ) 279*cdf0e10cSrcweir 280*cdf0e10cSrcweir #ifdef DBG_UTIL 281*cdf0e10cSrcweir static int txtparae_bContainsIllegalCharacters = sal_False; 282*cdf0e10cSrcweir #endif 283*cdf0e10cSrcweir 284*cdf0e10cSrcweir // The following map shows which property values are required: 285*cdf0e10cSrcweir // 286*cdf0e10cSrcweir // property auto style pass export 287*cdf0e10cSrcweir // -------------------------------------------------------- 288*cdf0e10cSrcweir // ParaStyleName if style exists always 289*cdf0e10cSrcweir // ParaConditionalStyleName if style exists always 290*cdf0e10cSrcweir // NumberingRules if style exists always 291*cdf0e10cSrcweir // TextSection always always 292*cdf0e10cSrcweir // ParaChapterNumberingLevel never always 293*cdf0e10cSrcweir // NumberingIsNumber never always 294*cdf0e10cSrcweir 295*cdf0e10cSrcweir // The conclusion is that for auto styles the first three properties 296*cdf0e10cSrcweir // should be queried using a multi property set if, and only if, an 297*cdf0e10cSrcweir // auto style needs to be exported. TextSection should be queried by 298*cdf0e10cSrcweir // an individual call to getPropertyvalue, because this seems to be 299*cdf0e10cSrcweir // less expensive than querying the first three properties if they aren't 300*cdf0e10cSrcweir // required. 301*cdf0e10cSrcweir 302*cdf0e10cSrcweir // For the export pass all properties can be queried using a multi property 303*cdf0e10cSrcweir // set. 304*cdf0e10cSrcweir 305*cdf0e10cSrcweir static const sal_Char* aParagraphPropertyNamesAuto[] = 306*cdf0e10cSrcweir { 307*cdf0e10cSrcweir "NumberingRules", 308*cdf0e10cSrcweir "ParaConditionalStyleName", 309*cdf0e10cSrcweir "ParaStyleName", 310*cdf0e10cSrcweir NULL 311*cdf0e10cSrcweir }; 312*cdf0e10cSrcweir 313*cdf0e10cSrcweir enum eParagraphPropertyNamesEnumAuto 314*cdf0e10cSrcweir { 315*cdf0e10cSrcweir NUMBERING_RULES_AUTO = 0, 316*cdf0e10cSrcweir PARA_CONDITIONAL_STYLE_NAME_AUTO = 1, 317*cdf0e10cSrcweir PARA_STYLE_NAME_AUTO = 2 318*cdf0e10cSrcweir }; 319*cdf0e10cSrcweir 320*cdf0e10cSrcweir static const sal_Char* aParagraphPropertyNames[] = 321*cdf0e10cSrcweir { 322*cdf0e10cSrcweir "NumberingIsNumber", 323*cdf0e10cSrcweir "NumberingStyleName", //#outline level,add by zhaojianwei 324*cdf0e10cSrcweir 325*cdf0e10cSrcweir //"ParaChapterNumberingLevel", //#outline level,remove by zhaojianwei 326*cdf0e10cSrcweir "OutlineLevel", //<-end,add by zhaojianwei 327*cdf0e10cSrcweir "ParaConditionalStyleName", 328*cdf0e10cSrcweir "ParaStyleName", 329*cdf0e10cSrcweir "TextSection", 330*cdf0e10cSrcweir NULL 331*cdf0e10cSrcweir }; 332*cdf0e10cSrcweir 333*cdf0e10cSrcweir enum eParagraphPropertyNamesEnum 334*cdf0e10cSrcweir { 335*cdf0e10cSrcweir NUMBERING_IS_NUMBER = 0, 336*cdf0e10cSrcweir PARA_NUMBERING_STYLENAME = 1, //#outline level,add by zhaojianwei 337*cdf0e10cSrcweir //PARA_CHAPTER_NUMERBING_LEVEL = 1, //#outline level,remove by zhaojianwei 338*cdf0e10cSrcweir PARA_OUTLINE_LEVEL=2, //<-end.add by zhaojianwei 339*cdf0e10cSrcweir PARA_CONDITIONAL_STYLE_NAME = 3, 340*cdf0e10cSrcweir PARA_STYLE_NAME = 4, 341*cdf0e10cSrcweir TEXT_SECTION = 5 342*cdf0e10cSrcweir }; 343*cdf0e10cSrcweir 344*cdf0e10cSrcweir void BoundFrames::Fill(const filter_t& rFilter) 345*cdf0e10cSrcweir { 346*cdf0e10cSrcweir if(!m_xEnumAccess.is()) 347*cdf0e10cSrcweir return; 348*cdf0e10cSrcweir const Reference< XEnumeration > xEnum = m_xEnumAccess->createEnumeration(); 349*cdf0e10cSrcweir if(!xEnum.is()) 350*cdf0e10cSrcweir return; 351*cdf0e10cSrcweir while(xEnum->hasMoreElements()) 352*cdf0e10cSrcweir { 353*cdf0e10cSrcweir Reference<XPropertySet> xPropSet(xEnum->nextElement(), UNO_QUERY); 354*cdf0e10cSrcweir Reference<XTextContent> xTextContent(xPropSet, UNO_QUERY); 355*cdf0e10cSrcweir if(!xPropSet.is() || !xTextContent.is()) 356*cdf0e10cSrcweir continue; 357*cdf0e10cSrcweir TextContentAnchorType eAnchor; 358*cdf0e10cSrcweir xPropSet->getPropertyValue(our_sAnchorType) >>= eAnchor; 359*cdf0e10cSrcweir if(TextContentAnchorType_AT_PAGE != eAnchor && TextContentAnchorType_AT_FRAME != eAnchor) 360*cdf0e10cSrcweir continue; 361*cdf0e10cSrcweir if(!rFilter(xTextContent)) 362*cdf0e10cSrcweir continue; 363*cdf0e10cSrcweir 364*cdf0e10cSrcweir TextContentSet::inserter_t pInserter = m_vPageBounds.getInserter(); 365*cdf0e10cSrcweir if(TextContentAnchorType_AT_FRAME == eAnchor) 366*cdf0e10cSrcweir { 367*cdf0e10cSrcweir Reference<XTextFrame> xAnchorTxtFrame( 368*cdf0e10cSrcweir xPropSet->getPropertyValue(our_sAnchorFrame), 369*cdf0e10cSrcweir uno::UNO_QUERY); 370*cdf0e10cSrcweir pInserter = m_vFrameBoundsOf[xAnchorTxtFrame].getInserter(); 371*cdf0e10cSrcweir } 372*cdf0e10cSrcweir *pInserter++ = xTextContent; 373*cdf0e10cSrcweir } 374*cdf0e10cSrcweir } 375*cdf0e10cSrcweir 376*cdf0e10cSrcweir BoundFrameSets::BoundFrameSets(const Reference<XInterface> xModel) 377*cdf0e10cSrcweir : m_pTexts(new BoundFrames()) 378*cdf0e10cSrcweir , m_pGraphics(new BoundFrames()) 379*cdf0e10cSrcweir , m_pEmbeddeds(new BoundFrames()) 380*cdf0e10cSrcweir , m_pShapes(new BoundFrames()) 381*cdf0e10cSrcweir { 382*cdf0e10cSrcweir const Reference<XTextFramesSupplier> xTFS(xModel, UNO_QUERY); 383*cdf0e10cSrcweir const Reference<XTextGraphicObjectsSupplier> xGOS(xModel, UNO_QUERY); 384*cdf0e10cSrcweir const Reference<XTextEmbeddedObjectsSupplier> xEOS(xModel, UNO_QUERY); 385*cdf0e10cSrcweir const Reference<XDrawPageSupplier> xDPS(xModel, UNO_QUERY); 386*cdf0e10cSrcweir if(xTFS.is()) 387*cdf0e10cSrcweir m_pTexts = auto_ptr<BoundFrames>(new BoundFrames( 388*cdf0e10cSrcweir Reference<XEnumerationAccess>(xTFS->getTextFrames(), UNO_QUERY), 389*cdf0e10cSrcweir &lcl_TextContentsUnfiltered)); 390*cdf0e10cSrcweir if(xGOS.is()) 391*cdf0e10cSrcweir m_pGraphics = auto_ptr<BoundFrames>(new BoundFrames( 392*cdf0e10cSrcweir Reference<XEnumerationAccess>(xGOS->getGraphicObjects(), UNO_QUERY), 393*cdf0e10cSrcweir &lcl_TextContentsUnfiltered)); 394*cdf0e10cSrcweir if(xEOS.is()) 395*cdf0e10cSrcweir m_pEmbeddeds = auto_ptr<BoundFrames>(new BoundFrames( 396*cdf0e10cSrcweir Reference<XEnumerationAccess>(xEOS->getEmbeddedObjects(), UNO_QUERY), 397*cdf0e10cSrcweir &lcl_TextContentsUnfiltered)); 398*cdf0e10cSrcweir if(xDPS.is()) 399*cdf0e10cSrcweir m_pShapes = auto_ptr<BoundFrames>(new BoundFrames( 400*cdf0e10cSrcweir Reference<XEnumerationAccess>(xDPS->getDrawPage(), UNO_QUERY), 401*cdf0e10cSrcweir &lcl_ShapeFilter)); 402*cdf0e10cSrcweir }; 403*cdf0e10cSrcweir 404*cdf0e10cSrcweir void FieldParamExporter::Export() 405*cdf0e10cSrcweir { 406*cdf0e10cSrcweir static const Type aStringType = ::getCppuType((OUString*)0); 407*cdf0e10cSrcweir static const Type aBoolType = ::getCppuType((sal_Bool*)0); 408*cdf0e10cSrcweir static const Type aSeqType = ::getCppuType((Sequence<OUString>*)0); 409*cdf0e10cSrcweir static const Type aIntType = ::getCppuType((sal_Int32*)0); 410*cdf0e10cSrcweir Sequence<OUString> vParameters(m_xFieldParams->getElementNames()); 411*cdf0e10cSrcweir for(const OUString* pCurrent=::comphelper::stl_begin(vParameters); pCurrent!=::comphelper::stl_end(vParameters); ++pCurrent) 412*cdf0e10cSrcweir { 413*cdf0e10cSrcweir const Any aValue = m_xFieldParams->getByName(*pCurrent); 414*cdf0e10cSrcweir const Type aValueType = aValue.getValueType(); 415*cdf0e10cSrcweir if(aValueType == aStringType) 416*cdf0e10cSrcweir { 417*cdf0e10cSrcweir OUString sValue; 418*cdf0e10cSrcweir aValue >>= sValue; 419*cdf0e10cSrcweir ExportParameter(*pCurrent,sValue); 420*cdf0e10cSrcweir } 421*cdf0e10cSrcweir else if(aValueType == aBoolType) 422*cdf0e10cSrcweir { 423*cdf0e10cSrcweir sal_Bool bValue = false; 424*cdf0e10cSrcweir aValue >>= bValue; 425*cdf0e10cSrcweir ExportParameter(*pCurrent,OUString::createFromAscii(bValue ? "true" : "false")); 426*cdf0e10cSrcweir } 427*cdf0e10cSrcweir else if(aValueType == aSeqType) 428*cdf0e10cSrcweir { 429*cdf0e10cSrcweir Sequence<OUString> vValue; 430*cdf0e10cSrcweir aValue >>= vValue; 431*cdf0e10cSrcweir for(OUString* pSeqCurrent = ::comphelper::stl_begin(vValue); pSeqCurrent != ::comphelper::stl_end(vValue); ++pSeqCurrent) 432*cdf0e10cSrcweir { 433*cdf0e10cSrcweir ExportParameter(*pCurrent, *pSeqCurrent); 434*cdf0e10cSrcweir } 435*cdf0e10cSrcweir } 436*cdf0e10cSrcweir else if(aValueType == aIntType) 437*cdf0e10cSrcweir { 438*cdf0e10cSrcweir sal_Int32 nValue = 0; 439*cdf0e10cSrcweir aValue >>= nValue; 440*cdf0e10cSrcweir ExportParameter(*pCurrent, OUStringBuffer().append(nValue).makeStringAndClear()); 441*cdf0e10cSrcweir } 442*cdf0e10cSrcweir } 443*cdf0e10cSrcweir } 444*cdf0e10cSrcweir 445*cdf0e10cSrcweir void FieldParamExporter::ExportParameter(const OUString& sKey, const OUString& sValue) 446*cdf0e10cSrcweir { 447*cdf0e10cSrcweir m_pExport->AddAttribute(XML_NAMESPACE_FIELD, XML_NAME, sKey); 448*cdf0e10cSrcweir m_pExport->AddAttribute(XML_NAMESPACE_FIELD, XML_VALUE, sValue); 449*cdf0e10cSrcweir m_pExport->StartElement(XML_NAMESPACE_FIELD, XML_PARAM, sal_False); 450*cdf0e10cSrcweir m_pExport->EndElement(XML_NAMESPACE_FIELD, XML_PARAM, sal_False); 451*cdf0e10cSrcweir } 452*cdf0e10cSrcweir 453*cdf0e10cSrcweir void XMLTextParagraphExport::Add( sal_uInt16 nFamily, 454*cdf0e10cSrcweir const Reference < XPropertySet > & rPropSet, 455*cdf0e10cSrcweir const XMLPropertyState** ppAddStates, bool bDontSeek ) 456*cdf0e10cSrcweir { 457*cdf0e10cSrcweir UniReference < SvXMLExportPropertyMapper > xPropMapper; 458*cdf0e10cSrcweir switch( nFamily ) 459*cdf0e10cSrcweir { 460*cdf0e10cSrcweir case XML_STYLE_FAMILY_TEXT_PARAGRAPH: 461*cdf0e10cSrcweir xPropMapper = GetParaPropMapper(); 462*cdf0e10cSrcweir break; 463*cdf0e10cSrcweir case XML_STYLE_FAMILY_TEXT_TEXT: 464*cdf0e10cSrcweir xPropMapper = GetTextPropMapper(); 465*cdf0e10cSrcweir break; 466*cdf0e10cSrcweir case XML_STYLE_FAMILY_TEXT_FRAME: 467*cdf0e10cSrcweir xPropMapper = GetAutoFramePropMapper(); 468*cdf0e10cSrcweir break; 469*cdf0e10cSrcweir case XML_STYLE_FAMILY_TEXT_SECTION: 470*cdf0e10cSrcweir xPropMapper = GetSectionPropMapper(); 471*cdf0e10cSrcweir break; 472*cdf0e10cSrcweir case XML_STYLE_FAMILY_TEXT_RUBY: 473*cdf0e10cSrcweir xPropMapper = GetRubyPropMapper(); 474*cdf0e10cSrcweir break; 475*cdf0e10cSrcweir } 476*cdf0e10cSrcweir DBG_ASSERT( xPropMapper.is(), "There is the property mapper?" ); 477*cdf0e10cSrcweir 478*cdf0e10cSrcweir vector< XMLPropertyState > xPropStates = 479*cdf0e10cSrcweir xPropMapper->Filter( rPropSet ); 480*cdf0e10cSrcweir 481*cdf0e10cSrcweir if( ppAddStates ) 482*cdf0e10cSrcweir { 483*cdf0e10cSrcweir while( *ppAddStates ) 484*cdf0e10cSrcweir { 485*cdf0e10cSrcweir xPropStates.push_back( **ppAddStates ); 486*cdf0e10cSrcweir ppAddStates++; 487*cdf0e10cSrcweir } 488*cdf0e10cSrcweir } 489*cdf0e10cSrcweir 490*cdf0e10cSrcweir if( !xPropStates.empty() ) 491*cdf0e10cSrcweir { 492*cdf0e10cSrcweir Reference< XPropertySetInfo > xPropSetInfo(rPropSet->getPropertySetInfo()); 493*cdf0e10cSrcweir OUString sParent, sCondParent; 494*cdf0e10cSrcweir sal_uInt16 nIgnoreProps = 0; 495*cdf0e10cSrcweir switch( nFamily ) 496*cdf0e10cSrcweir { 497*cdf0e10cSrcweir case XML_STYLE_FAMILY_TEXT_PARAGRAPH: 498*cdf0e10cSrcweir if( xPropSetInfo->hasPropertyByName( sParaStyleName ) ) 499*cdf0e10cSrcweir { 500*cdf0e10cSrcweir rPropSet->getPropertyValue( sParaStyleName ) >>= sParent; 501*cdf0e10cSrcweir } 502*cdf0e10cSrcweir if( xPropSetInfo->hasPropertyByName( sParaConditionalStyleName ) ) 503*cdf0e10cSrcweir { 504*cdf0e10cSrcweir rPropSet->getPropertyValue( sParaConditionalStyleName ) >>= sCondParent; 505*cdf0e10cSrcweir } 506*cdf0e10cSrcweir if( xPropSetInfo->hasPropertyByName( sNumberingRules ) ) 507*cdf0e10cSrcweir { 508*cdf0e10cSrcweir Reference < XIndexReplace > xNumRule(rPropSet->getPropertyValue( sNumberingRules ), uno::UNO_QUERY); 509*cdf0e10cSrcweir if( xNumRule.is() && xNumRule->getCount() ) 510*cdf0e10cSrcweir { 511*cdf0e10cSrcweir Reference < XNamed > xNamed( xNumRule, UNO_QUERY ); 512*cdf0e10cSrcweir OUString sName; 513*cdf0e10cSrcweir if( xNamed.is() ) 514*cdf0e10cSrcweir sName = xNamed->getName(); 515*cdf0e10cSrcweir sal_Bool bAdd = !sName.getLength(); 516*cdf0e10cSrcweir if( !bAdd ) 517*cdf0e10cSrcweir { 518*cdf0e10cSrcweir Reference < XPropertySet > xNumPropSet( xNumRule, 519*cdf0e10cSrcweir UNO_QUERY ); 520*cdf0e10cSrcweir const OUString sIsAutomatic( RTL_CONSTASCII_USTRINGPARAM( "IsAutomatic" ) ); 521*cdf0e10cSrcweir if( xNumPropSet.is() && 522*cdf0e10cSrcweir xNumPropSet->getPropertySetInfo() 523*cdf0e10cSrcweir ->hasPropertyByName( sIsAutomatic ) ) 524*cdf0e10cSrcweir { 525*cdf0e10cSrcweir bAdd = *(sal_Bool *)xNumPropSet->getPropertyValue( sIsAutomatic ).getValue(); 526*cdf0e10cSrcweir // --> OD 2007-01-12 #i73361# - check on outline style 527*cdf0e10cSrcweir const OUString sNumberingIsOutline( RTL_CONSTASCII_USTRINGPARAM( "NumberingIsOutline" ) ); 528*cdf0e10cSrcweir if ( bAdd && 529*cdf0e10cSrcweir xNumPropSet->getPropertySetInfo() 530*cdf0e10cSrcweir ->hasPropertyByName( sNumberingIsOutline ) ) 531*cdf0e10cSrcweir { 532*cdf0e10cSrcweir bAdd = !(*(sal_Bool *)xNumPropSet->getPropertyValue( sNumberingIsOutline ).getValue()); 533*cdf0e10cSrcweir } 534*cdf0e10cSrcweir // <-- 535*cdf0e10cSrcweir } 536*cdf0e10cSrcweir else 537*cdf0e10cSrcweir { 538*cdf0e10cSrcweir bAdd = sal_True; 539*cdf0e10cSrcweir } 540*cdf0e10cSrcweir } 541*cdf0e10cSrcweir if( bAdd ) 542*cdf0e10cSrcweir pListAutoPool->Add( xNumRule ); 543*cdf0e10cSrcweir } 544*cdf0e10cSrcweir } 545*cdf0e10cSrcweir break; 546*cdf0e10cSrcweir case XML_STYLE_FAMILY_TEXT_TEXT: 547*cdf0e10cSrcweir { 548*cdf0e10cSrcweir // Get parent and remove hyperlinks (they aren't of interest) 549*cdf0e10cSrcweir UniReference< XMLPropertySetMapper > xPM(xPropMapper->getPropertySetMapper()); 550*cdf0e10cSrcweir for( ::std::vector< XMLPropertyState >::iterator i(xPropStates.begin()); 551*cdf0e10cSrcweir nIgnoreProps < 2 && i != xPropStates.end(); ) 552*cdf0e10cSrcweir { 553*cdf0e10cSrcweir if( i->mnIndex == -1 ) 554*cdf0e10cSrcweir { 555*cdf0e10cSrcweir ++i; 556*cdf0e10cSrcweir continue; 557*cdf0e10cSrcweir } 558*cdf0e10cSrcweir 559*cdf0e10cSrcweir switch( xPM->GetEntryContextId(i->mnIndex) ) 560*cdf0e10cSrcweir { 561*cdf0e10cSrcweir case CTF_CHAR_STYLE_NAME: 562*cdf0e10cSrcweir case CTF_HYPERLINK_URL: 563*cdf0e10cSrcweir i->mnIndex = -1; 564*cdf0e10cSrcweir nIgnoreProps++; 565*cdf0e10cSrcweir i = xPropStates.erase( i ); 566*cdf0e10cSrcweir break; 567*cdf0e10cSrcweir default: 568*cdf0e10cSrcweir ++i; 569*cdf0e10cSrcweir break; 570*cdf0e10cSrcweir } 571*cdf0e10cSrcweir } 572*cdf0e10cSrcweir } 573*cdf0e10cSrcweir break; 574*cdf0e10cSrcweir case XML_STYLE_FAMILY_TEXT_FRAME: 575*cdf0e10cSrcweir if( xPropSetInfo->hasPropertyByName( sFrameStyleName ) ) 576*cdf0e10cSrcweir { 577*cdf0e10cSrcweir rPropSet->getPropertyValue( sFrameStyleName ) >>= sParent; 578*cdf0e10cSrcweir } 579*cdf0e10cSrcweir break; 580*cdf0e10cSrcweir case XML_STYLE_FAMILY_TEXT_SECTION: 581*cdf0e10cSrcweir case XML_STYLE_FAMILY_TEXT_RUBY: 582*cdf0e10cSrcweir ; // section styles have no parents 583*cdf0e10cSrcweir break; 584*cdf0e10cSrcweir } 585*cdf0e10cSrcweir if( (xPropStates.size() - nIgnoreProps) > 0 ) 586*cdf0e10cSrcweir { 587*cdf0e10cSrcweir GetAutoStylePool().Add( nFamily, sParent, xPropStates, bDontSeek ); 588*cdf0e10cSrcweir if( sCondParent.getLength() && sParent != sCondParent ) 589*cdf0e10cSrcweir GetAutoStylePool().Add( nFamily, sCondParent, xPropStates ); 590*cdf0e10cSrcweir } 591*cdf0e10cSrcweir } 592*cdf0e10cSrcweir } 593*cdf0e10cSrcweir 594*cdf0e10cSrcweir bool lcl_validPropState( const XMLPropertyState& rState ) 595*cdf0e10cSrcweir { 596*cdf0e10cSrcweir return rState.mnIndex != -1; 597*cdf0e10cSrcweir } 598*cdf0e10cSrcweir 599*cdf0e10cSrcweir void XMLTextParagraphExport::Add( sal_uInt16 nFamily, 600*cdf0e10cSrcweir MultiPropertySetHelper& rPropSetHelper, 601*cdf0e10cSrcweir const Reference < XPropertySet > & rPropSet, 602*cdf0e10cSrcweir const XMLPropertyState** ppAddStates) 603*cdf0e10cSrcweir { 604*cdf0e10cSrcweir UniReference < SvXMLExportPropertyMapper > xPropMapper; 605*cdf0e10cSrcweir switch( nFamily ) 606*cdf0e10cSrcweir { 607*cdf0e10cSrcweir case XML_STYLE_FAMILY_TEXT_PARAGRAPH: 608*cdf0e10cSrcweir xPropMapper = GetParaPropMapper(); 609*cdf0e10cSrcweir break; 610*cdf0e10cSrcweir } 611*cdf0e10cSrcweir DBG_ASSERT( xPropMapper.is(), "There is the property mapper?" ); 612*cdf0e10cSrcweir 613*cdf0e10cSrcweir vector< XMLPropertyState > xPropStates(xPropMapper->Filter( rPropSet )); 614*cdf0e10cSrcweir if( ppAddStates ) 615*cdf0e10cSrcweir { 616*cdf0e10cSrcweir while( *ppAddStates ) 617*cdf0e10cSrcweir { 618*cdf0e10cSrcweir xPropStates.push_back( **ppAddStates ); 619*cdf0e10cSrcweir ++ppAddStates; 620*cdf0e10cSrcweir } 621*cdf0e10cSrcweir } 622*cdf0e10cSrcweir 623*cdf0e10cSrcweir if( rPropSetHelper.hasProperty( NUMBERING_RULES_AUTO ) ) 624*cdf0e10cSrcweir { 625*cdf0e10cSrcweir Reference < XIndexReplace > xNumRule(rPropSetHelper.getValue( NUMBERING_RULES_AUTO, 626*cdf0e10cSrcweir rPropSet, sal_True ), uno::UNO_QUERY); 627*cdf0e10cSrcweir if( xNumRule.is() && xNumRule->getCount() ) 628*cdf0e10cSrcweir { 629*cdf0e10cSrcweir Reference < XNamed > xNamed( xNumRule, UNO_QUERY ); 630*cdf0e10cSrcweir OUString sName; 631*cdf0e10cSrcweir if( xNamed.is() ) 632*cdf0e10cSrcweir sName = xNamed->getName(); 633*cdf0e10cSrcweir sal_Bool bAdd = !sName.getLength(); 634*cdf0e10cSrcweir if( !bAdd ) 635*cdf0e10cSrcweir { 636*cdf0e10cSrcweir Reference < XPropertySet > xNumPropSet( xNumRule, 637*cdf0e10cSrcweir UNO_QUERY ); 638*cdf0e10cSrcweir const OUString sIsAutomatic( RTL_CONSTASCII_USTRINGPARAM( "IsAutomatic" ) ); 639*cdf0e10cSrcweir if( xNumPropSet.is() && 640*cdf0e10cSrcweir xNumPropSet->getPropertySetInfo() 641*cdf0e10cSrcweir ->hasPropertyByName( sIsAutomatic ) ) 642*cdf0e10cSrcweir { 643*cdf0e10cSrcweir bAdd = *(sal_Bool *)xNumPropSet->getPropertyValue( sIsAutomatic ).getValue(); 644*cdf0e10cSrcweir // --> OD 2007-01-12 #i73361# - check on outline style 645*cdf0e10cSrcweir const OUString sNumberingIsOutline( RTL_CONSTASCII_USTRINGPARAM( "NumberingIsOutline" ) ); 646*cdf0e10cSrcweir if ( bAdd && 647*cdf0e10cSrcweir xNumPropSet->getPropertySetInfo() 648*cdf0e10cSrcweir ->hasPropertyByName( sNumberingIsOutline ) ) 649*cdf0e10cSrcweir { 650*cdf0e10cSrcweir bAdd = !(*(sal_Bool *)xNumPropSet->getPropertyValue( sNumberingIsOutline ).getValue()); 651*cdf0e10cSrcweir } 652*cdf0e10cSrcweir // <-- 653*cdf0e10cSrcweir } 654*cdf0e10cSrcweir else 655*cdf0e10cSrcweir { 656*cdf0e10cSrcweir bAdd = sal_True; 657*cdf0e10cSrcweir } 658*cdf0e10cSrcweir } 659*cdf0e10cSrcweir if( bAdd ) 660*cdf0e10cSrcweir pListAutoPool->Add( xNumRule ); 661*cdf0e10cSrcweir } 662*cdf0e10cSrcweir } 663*cdf0e10cSrcweir 664*cdf0e10cSrcweir if( !xPropStates.empty() ) 665*cdf0e10cSrcweir { 666*cdf0e10cSrcweir OUString sParent, sCondParent; 667*cdf0e10cSrcweir switch( nFamily ) 668*cdf0e10cSrcweir { 669*cdf0e10cSrcweir case XML_STYLE_FAMILY_TEXT_PARAGRAPH: 670*cdf0e10cSrcweir if( rPropSetHelper.hasProperty( PARA_STYLE_NAME_AUTO ) ) 671*cdf0e10cSrcweir { 672*cdf0e10cSrcweir rPropSetHelper.getValue( PARA_STYLE_NAME_AUTO, rPropSet, 673*cdf0e10cSrcweir sal_True ) >>= sParent; 674*cdf0e10cSrcweir } 675*cdf0e10cSrcweir if( rPropSetHelper.hasProperty( PARA_CONDITIONAL_STYLE_NAME_AUTO ) ) 676*cdf0e10cSrcweir { 677*cdf0e10cSrcweir rPropSetHelper.getValue( PARA_CONDITIONAL_STYLE_NAME_AUTO, 678*cdf0e10cSrcweir rPropSet, sal_True ) >>= sCondParent; 679*cdf0e10cSrcweir } 680*cdf0e10cSrcweir 681*cdf0e10cSrcweir break; 682*cdf0e10cSrcweir } 683*cdf0e10cSrcweir 684*cdf0e10cSrcweir if( find_if( xPropStates.begin(), xPropStates.end(), lcl_validPropState ) != xPropStates.end() ) 685*cdf0e10cSrcweir { 686*cdf0e10cSrcweir GetAutoStylePool().Add( nFamily, sParent, xPropStates ); 687*cdf0e10cSrcweir if( sCondParent.getLength() && sParent != sCondParent ) 688*cdf0e10cSrcweir GetAutoStylePool().Add( nFamily, sCondParent, xPropStates ); 689*cdf0e10cSrcweir } 690*cdf0e10cSrcweir } 691*cdf0e10cSrcweir } 692*cdf0e10cSrcweir 693*cdf0e10cSrcweir OUString XMLTextParagraphExport::Find( 694*cdf0e10cSrcweir sal_uInt16 nFamily, 695*cdf0e10cSrcweir const Reference < XPropertySet > & rPropSet, 696*cdf0e10cSrcweir const OUString& rParent, 697*cdf0e10cSrcweir const XMLPropertyState** ppAddStates) const 698*cdf0e10cSrcweir { 699*cdf0e10cSrcweir OUString sName( rParent ); 700*cdf0e10cSrcweir UniReference < SvXMLExportPropertyMapper > xPropMapper; 701*cdf0e10cSrcweir switch( nFamily ) 702*cdf0e10cSrcweir { 703*cdf0e10cSrcweir case XML_STYLE_FAMILY_TEXT_PARAGRAPH: 704*cdf0e10cSrcweir xPropMapper = GetParaPropMapper(); 705*cdf0e10cSrcweir break; 706*cdf0e10cSrcweir case XML_STYLE_FAMILY_TEXT_FRAME: 707*cdf0e10cSrcweir xPropMapper = GetAutoFramePropMapper(); 708*cdf0e10cSrcweir break; 709*cdf0e10cSrcweir case XML_STYLE_FAMILY_TEXT_SECTION: 710*cdf0e10cSrcweir xPropMapper = GetSectionPropMapper(); 711*cdf0e10cSrcweir break; 712*cdf0e10cSrcweir case XML_STYLE_FAMILY_TEXT_RUBY: 713*cdf0e10cSrcweir xPropMapper = GetRubyPropMapper(); 714*cdf0e10cSrcweir break; 715*cdf0e10cSrcweir } 716*cdf0e10cSrcweir DBG_ASSERT( xPropMapper.is(), "There is the property mapper?" ); 717*cdf0e10cSrcweir if( !xPropMapper.is() ) 718*cdf0e10cSrcweir return sName; 719*cdf0e10cSrcweir vector< XMLPropertyState > xPropStates(xPropMapper->Filter( rPropSet )); 720*cdf0e10cSrcweir if( ppAddStates ) 721*cdf0e10cSrcweir { 722*cdf0e10cSrcweir while( *ppAddStates ) 723*cdf0e10cSrcweir { 724*cdf0e10cSrcweir xPropStates.push_back( **ppAddStates ); 725*cdf0e10cSrcweir ++ppAddStates; 726*cdf0e10cSrcweir } 727*cdf0e10cSrcweir } 728*cdf0e10cSrcweir if( find_if( xPropStates.begin(), xPropStates.end(), lcl_validPropState ) != xPropStates.end() ) 729*cdf0e10cSrcweir sName = GetAutoStylePool().Find( nFamily, sName, xPropStates ); 730*cdf0e10cSrcweir 731*cdf0e10cSrcweir return sName; 732*cdf0e10cSrcweir } 733*cdf0e10cSrcweir 734*cdf0e10cSrcweir OUString XMLTextParagraphExport::FindTextStyleAndHyperlink( 735*cdf0e10cSrcweir const Reference < XPropertySet > & rPropSet, 736*cdf0e10cSrcweir sal_Bool& rbHyperlink, 737*cdf0e10cSrcweir sal_Bool& rbHasCharStyle, 738*cdf0e10cSrcweir sal_Bool& rbHasAutoStyle, 739*cdf0e10cSrcweir const XMLPropertyState** ppAddStates ) const 740*cdf0e10cSrcweir { 741*cdf0e10cSrcweir UniReference < SvXMLExportPropertyMapper > xPropMapper(GetTextPropMapper()); 742*cdf0e10cSrcweir vector< XMLPropertyState > xPropStates(xPropMapper->Filter( rPropSet )); 743*cdf0e10cSrcweir 744*cdf0e10cSrcweir // Get parent and remove hyperlinks (they aren't of interest) 745*cdf0e10cSrcweir OUString sName; 746*cdf0e10cSrcweir rbHyperlink = rbHasCharStyle = rbHasAutoStyle = sal_False; 747*cdf0e10cSrcweir sal_uInt16 nIgnoreProps = 0; 748*cdf0e10cSrcweir UniReference< XMLPropertySetMapper > xPM(xPropMapper->getPropertySetMapper()); 749*cdf0e10cSrcweir ::std::vector< XMLPropertyState >::iterator aFirstDel = xPropStates.end(); 750*cdf0e10cSrcweir ::std::vector< XMLPropertyState >::iterator aSecondDel = xPropStates.end(); 751*cdf0e10cSrcweir 752*cdf0e10cSrcweir for( ::std::vector< XMLPropertyState >::iterator 753*cdf0e10cSrcweir i = xPropStates.begin(); 754*cdf0e10cSrcweir nIgnoreProps < 2 && i != xPropStates.end(); 755*cdf0e10cSrcweir i++ ) 756*cdf0e10cSrcweir { 757*cdf0e10cSrcweir if( i->mnIndex == -1 ) 758*cdf0e10cSrcweir continue; 759*cdf0e10cSrcweir 760*cdf0e10cSrcweir switch( xPM->GetEntryContextId(i->mnIndex) ) 761*cdf0e10cSrcweir { 762*cdf0e10cSrcweir case CTF_CHAR_STYLE_NAME: 763*cdf0e10cSrcweir i->maValue >>= sName; 764*cdf0e10cSrcweir i->mnIndex = -1; 765*cdf0e10cSrcweir rbHasCharStyle = sName.getLength() > 0; 766*cdf0e10cSrcweir if( nIgnoreProps ) 767*cdf0e10cSrcweir aSecondDel = i; 768*cdf0e10cSrcweir else 769*cdf0e10cSrcweir aFirstDel = i; 770*cdf0e10cSrcweir nIgnoreProps++; 771*cdf0e10cSrcweir break; 772*cdf0e10cSrcweir case CTF_HYPERLINK_URL: 773*cdf0e10cSrcweir rbHyperlink = sal_True; 774*cdf0e10cSrcweir i->mnIndex = -1; 775*cdf0e10cSrcweir if( nIgnoreProps ) 776*cdf0e10cSrcweir aSecondDel = i; 777*cdf0e10cSrcweir else 778*cdf0e10cSrcweir aFirstDel = i; 779*cdf0e10cSrcweir nIgnoreProps++; 780*cdf0e10cSrcweir break; 781*cdf0e10cSrcweir } 782*cdf0e10cSrcweir } 783*cdf0e10cSrcweir if( ppAddStates ) 784*cdf0e10cSrcweir { 785*cdf0e10cSrcweir while( *ppAddStates ) 786*cdf0e10cSrcweir { 787*cdf0e10cSrcweir xPropStates.push_back( **ppAddStates ); 788*cdf0e10cSrcweir ppAddStates++; 789*cdf0e10cSrcweir } 790*cdf0e10cSrcweir } 791*cdf0e10cSrcweir if( (xPropStates.size() - nIgnoreProps) > 0L ) 792*cdf0e10cSrcweir { 793*cdf0e10cSrcweir // erase the character style, otherwise the autostyle cannot be found! 794*cdf0e10cSrcweir // erase the hyperlink, otherwise the autostyle cannot be found! 795*cdf0e10cSrcweir if ( nIgnoreProps ) 796*cdf0e10cSrcweir { 797*cdf0e10cSrcweir // If two elements of a vector have to be deleted, 798*cdf0e10cSrcweir // we should delete the second one first. 799*cdf0e10cSrcweir if( --nIgnoreProps ) 800*cdf0e10cSrcweir xPropStates.erase( aSecondDel ); 801*cdf0e10cSrcweir xPropStates.erase( aFirstDel ); 802*cdf0e10cSrcweir } 803*cdf0e10cSrcweir OUString sParent; // AutoStyles should not have parents! 804*cdf0e10cSrcweir sName = GetAutoStylePool().Find( XML_STYLE_FAMILY_TEXT_TEXT, sParent, xPropStates ); 805*cdf0e10cSrcweir DBG_ASSERT( sName.getLength(), "AutoStyle could not be found" ); 806*cdf0e10cSrcweir rbHasAutoStyle = sal_True; 807*cdf0e10cSrcweir } 808*cdf0e10cSrcweir 809*cdf0e10cSrcweir return sName; 810*cdf0e10cSrcweir } 811*cdf0e10cSrcweir 812*cdf0e10cSrcweir OUString XMLTextParagraphExport::FindTextStyle( 813*cdf0e10cSrcweir const Reference < XPropertySet > & rPropSet, 814*cdf0e10cSrcweir sal_Bool& rHasCharStyle ) const 815*cdf0e10cSrcweir { 816*cdf0e10cSrcweir sal_Bool bDummy; 817*cdf0e10cSrcweir sal_Bool bDummy2; 818*cdf0e10cSrcweir return FindTextStyleAndHyperlink( rPropSet, bDummy, rHasCharStyle, bDummy2 ); 819*cdf0e10cSrcweir } 820*cdf0e10cSrcweir 821*cdf0e10cSrcweir 822*cdf0e10cSrcweir // --> OD 2008-04-25 #refactorlists# 823*cdf0e10cSrcweir // adjustments to support lists independent from list style 824*cdf0e10cSrcweir void XMLTextParagraphExport::exportListChange( 825*cdf0e10cSrcweir const XMLTextNumRuleInfo& rPrevInfo, 826*cdf0e10cSrcweir const XMLTextNumRuleInfo& rNextInfo ) 827*cdf0e10cSrcweir { 828*cdf0e10cSrcweir // end a list 829*cdf0e10cSrcweir if ( rPrevInfo.GetLevel() > 0 ) 830*cdf0e10cSrcweir { 831*cdf0e10cSrcweir bool bRootListToBeClosed = false; 832*cdf0e10cSrcweir sal_Int16 nListLevelsToBeClosed = 0; 833*cdf0e10cSrcweir if ( !rNextInfo.BelongsToSameList( rPrevInfo ) || 834*cdf0e10cSrcweir rNextInfo.GetLevel() <= 0 ) 835*cdf0e10cSrcweir { 836*cdf0e10cSrcweir // close complete previous list 837*cdf0e10cSrcweir bRootListToBeClosed = true; 838*cdf0e10cSrcweir nListLevelsToBeClosed = rPrevInfo.GetLevel(); 839*cdf0e10cSrcweir } 840*cdf0e10cSrcweir else if ( rPrevInfo.GetLevel() > rNextInfo.GetLevel() ) 841*cdf0e10cSrcweir { 842*cdf0e10cSrcweir // close corresponding sub lists 843*cdf0e10cSrcweir DBG_ASSERT( rNextInfo.GetLevel() > 0, 844*cdf0e10cSrcweir "<rPrevInfo.GetLevel() > 0> not hold. Serious defect -> please inform OD." ); 845*cdf0e10cSrcweir nListLevelsToBeClosed = rPrevInfo.GetLevel() - rNextInfo.GetLevel(); 846*cdf0e10cSrcweir } 847*cdf0e10cSrcweir 848*cdf0e10cSrcweir if ( nListLevelsToBeClosed > 0 && 849*cdf0e10cSrcweir pListElements && 850*cdf0e10cSrcweir pListElements->Count() >= ( 2 * nListLevelsToBeClosed ) ) 851*cdf0e10cSrcweir { 852*cdf0e10cSrcweir do { 853*cdf0e10cSrcweir for( sal_uInt16 j = 0; j < 2; ++j ) 854*cdf0e10cSrcweir { 855*cdf0e10cSrcweir OUString *pElem = (*pListElements)[pListElements->Count()-1]; 856*cdf0e10cSrcweir pListElements->Remove( pListElements->Count()-1 ); 857*cdf0e10cSrcweir 858*cdf0e10cSrcweir GetExport().EndElement( *pElem, sal_True ); 859*cdf0e10cSrcweir 860*cdf0e10cSrcweir delete pElem; 861*cdf0e10cSrcweir } 862*cdf0e10cSrcweir 863*cdf0e10cSrcweir // remove closed list from list stack 864*cdf0e10cSrcweir mpTextListsHelper->PopListFromStack(); 865*cdf0e10cSrcweir 866*cdf0e10cSrcweir --nListLevelsToBeClosed; 867*cdf0e10cSrcweir } while ( nListLevelsToBeClosed > 0 ); 868*cdf0e10cSrcweir } 869*cdf0e10cSrcweir } 870*cdf0e10cSrcweir 871*cdf0e10cSrcweir const bool bExportODF = 872*cdf0e10cSrcweir ( GetExport().getExportFlags() & EXPORT_OASIS ) != 0; 873*cdf0e10cSrcweir const SvtSaveOptions::ODFDefaultVersion eODFDefaultVersion = 874*cdf0e10cSrcweir GetExport().getDefaultVersion(); 875*cdf0e10cSrcweir 876*cdf0e10cSrcweir // start a new list 877*cdf0e10cSrcweir if ( rNextInfo.GetLevel() > 0 ) 878*cdf0e10cSrcweir { 879*cdf0e10cSrcweir bool bRootListToBeStarted = false; 880*cdf0e10cSrcweir sal_Int16 nListLevelsToBeOpened = 0; 881*cdf0e10cSrcweir if ( !rPrevInfo.BelongsToSameList( rNextInfo ) || 882*cdf0e10cSrcweir rPrevInfo.GetLevel() <= 0 ) 883*cdf0e10cSrcweir { 884*cdf0e10cSrcweir // new root list 885*cdf0e10cSrcweir bRootListToBeStarted = true; 886*cdf0e10cSrcweir nListLevelsToBeOpened = rNextInfo.GetLevel(); 887*cdf0e10cSrcweir } 888*cdf0e10cSrcweir else if ( rNextInfo.GetLevel() > rPrevInfo.GetLevel() ) 889*cdf0e10cSrcweir { 890*cdf0e10cSrcweir // open corresponding sub lists 891*cdf0e10cSrcweir DBG_ASSERT( rPrevInfo.GetLevel() > 0, 892*cdf0e10cSrcweir "<rPrevInfo.GetLevel() > 0> not hold. Serious defect -> please inform OD." ); 893*cdf0e10cSrcweir nListLevelsToBeOpened = rNextInfo.GetLevel() - rPrevInfo.GetLevel(); 894*cdf0e10cSrcweir } 895*cdf0e10cSrcweir 896*cdf0e10cSrcweir if ( nListLevelsToBeOpened > 0 ) 897*cdf0e10cSrcweir { 898*cdf0e10cSrcweir const ::rtl::OUString sListStyleName( rNextInfo.GetNumRulesName() ); 899*cdf0e10cSrcweir // Currently only the text documents support <ListId>. 900*cdf0e10cSrcweir // Thus, for other document types <sListId> is empty. 901*cdf0e10cSrcweir const ::rtl::OUString sListId( rNextInfo.GetListId() ); 902*cdf0e10cSrcweir bool bExportListStyle( true ); 903*cdf0e10cSrcweir bool bRestartNumberingAtContinuedRootList( false ); 904*cdf0e10cSrcweir sal_Int16 nRestartValueForContinuedRootList( -1 ); 905*cdf0e10cSrcweir // --> OD 2008-11-26 #158694# 906*cdf0e10cSrcweir bool bContinueingPreviousSubList = !bRootListToBeStarted && 907*cdf0e10cSrcweir rNextInfo.IsContinueingPreviousSubTree(); 908*cdf0e10cSrcweir // <-- 909*cdf0e10cSrcweir do { 910*cdf0e10cSrcweir GetExport().CheckAttrList(); 911*cdf0e10cSrcweir 912*cdf0e10cSrcweir if ( bRootListToBeStarted ) 913*cdf0e10cSrcweir { 914*cdf0e10cSrcweir if ( !mpTextListsHelper->IsListProcessed( sListId ) ) 915*cdf0e10cSrcweir { 916*cdf0e10cSrcweir if ( bExportODF && 917*cdf0e10cSrcweir eODFDefaultVersion >= SvtSaveOptions::ODFVER_012 && 918*cdf0e10cSrcweir sListId.getLength() > 0 ) 919*cdf0e10cSrcweir { 920*cdf0e10cSrcweir // --> OD 2008-07-31 #i92221# 921*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_XML, 922*cdf0e10cSrcweir XML_ID, 923*cdf0e10cSrcweir sListId ); 924*cdf0e10cSrcweir // <-- 925*cdf0e10cSrcweir } 926*cdf0e10cSrcweir mpTextListsHelper->KeepListAsProcessed( sListId, 927*cdf0e10cSrcweir sListStyleName, 928*cdf0e10cSrcweir ::rtl::OUString() ); 929*cdf0e10cSrcweir } 930*cdf0e10cSrcweir else 931*cdf0e10cSrcweir { 932*cdf0e10cSrcweir const ::rtl::OUString sNewListId( 933*cdf0e10cSrcweir mpTextListsHelper->GenerateNewListId() ); 934*cdf0e10cSrcweir if ( bExportODF && 935*cdf0e10cSrcweir eODFDefaultVersion >= SvtSaveOptions::ODFVER_012 && 936*cdf0e10cSrcweir sListId.getLength() > 0 ) 937*cdf0e10cSrcweir { 938*cdf0e10cSrcweir // --> OD 2008-07-31 #i92221# 939*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_XML, 940*cdf0e10cSrcweir XML_ID, 941*cdf0e10cSrcweir sNewListId ); 942*cdf0e10cSrcweir // <-- 943*cdf0e10cSrcweir } 944*cdf0e10cSrcweir 945*cdf0e10cSrcweir const ::rtl::OUString sContinueListId = 946*cdf0e10cSrcweir mpTextListsHelper->GetLastContinuingListId( sListId ); 947*cdf0e10cSrcweir // store that list with list id <sNewListId> is last list, 948*cdf0e10cSrcweir // which has continued list with list id <sListId> 949*cdf0e10cSrcweir mpTextListsHelper->StoreLastContinuingList( sListId, 950*cdf0e10cSrcweir sNewListId ); 951*cdf0e10cSrcweir if ( sListStyleName == 952*cdf0e10cSrcweir mpTextListsHelper->GetListStyleOfLastProcessedList() && 953*cdf0e10cSrcweir // --> OD 2008-08-15 #i92811# 954*cdf0e10cSrcweir sContinueListId == 955*cdf0e10cSrcweir mpTextListsHelper->GetLastProcessedListId() && 956*cdf0e10cSrcweir // <-- 957*cdf0e10cSrcweir !rNextInfo.IsRestart() ) 958*cdf0e10cSrcweir { 959*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_TEXT, 960*cdf0e10cSrcweir XML_CONTINUE_NUMBERING, 961*cdf0e10cSrcweir XML_TRUE ); 962*cdf0e10cSrcweir } 963*cdf0e10cSrcweir else 964*cdf0e10cSrcweir { 965*cdf0e10cSrcweir if ( bExportODF && 966*cdf0e10cSrcweir eODFDefaultVersion >= SvtSaveOptions::ODFVER_012 && 967*cdf0e10cSrcweir sListId.getLength() > 0 ) 968*cdf0e10cSrcweir { 969*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_TEXT, 970*cdf0e10cSrcweir XML_CONTINUE_LIST, 971*cdf0e10cSrcweir sContinueListId ); 972*cdf0e10cSrcweir } 973*cdf0e10cSrcweir 974*cdf0e10cSrcweir if ( rNextInfo.IsRestart() && 975*cdf0e10cSrcweir ( nListLevelsToBeOpened != 1 || 976*cdf0e10cSrcweir !rNextInfo.HasStartValue() ) ) 977*cdf0e10cSrcweir { 978*cdf0e10cSrcweir bRestartNumberingAtContinuedRootList = true; 979*cdf0e10cSrcweir nRestartValueForContinuedRootList = 980*cdf0e10cSrcweir rNextInfo.GetListLevelStartValue(); 981*cdf0e10cSrcweir } 982*cdf0e10cSrcweir } 983*cdf0e10cSrcweir 984*cdf0e10cSrcweir mpTextListsHelper->KeepListAsProcessed( sNewListId, 985*cdf0e10cSrcweir sListStyleName, 986*cdf0e10cSrcweir sContinueListId ); 987*cdf0e10cSrcweir } 988*cdf0e10cSrcweir 989*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_STYLE_NAME, 990*cdf0e10cSrcweir GetExport().EncodeStyleName( sListStyleName ) ); 991*cdf0e10cSrcweir bExportListStyle = false; 992*cdf0e10cSrcweir 993*cdf0e10cSrcweir bRootListToBeStarted = false; 994*cdf0e10cSrcweir } 995*cdf0e10cSrcweir else if ( bExportListStyle && 996*cdf0e10cSrcweir !mpTextListsHelper->EqualsToTopListStyleOnStack( sListStyleName ) ) 997*cdf0e10cSrcweir { 998*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_STYLE_NAME, 999*cdf0e10cSrcweir GetExport().EncodeStyleName( sListStyleName ) ); 1000*cdf0e10cSrcweir bExportListStyle = false; 1001*cdf0e10cSrcweir } 1002*cdf0e10cSrcweir 1003*cdf0e10cSrcweir // --> OD 2008-11-26 #158694# 1004*cdf0e10cSrcweir if ( bContinueingPreviousSubList ) 1005*cdf0e10cSrcweir { 1006*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_TEXT, 1007*cdf0e10cSrcweir XML_CONTINUE_NUMBERING, XML_TRUE ); 1008*cdf0e10cSrcweir bContinueingPreviousSubList = false; 1009*cdf0e10cSrcweir } 1010*cdf0e10cSrcweir // <-- 1011*cdf0e10cSrcweir 1012*cdf0e10cSrcweir enum XMLTokenEnum eLName = XML_LIST; 1013*cdf0e10cSrcweir 1014*cdf0e10cSrcweir OUString *pElem = new OUString( 1015*cdf0e10cSrcweir GetExport().GetNamespaceMap().GetQNameByKey( 1016*cdf0e10cSrcweir XML_NAMESPACE_TEXT, 1017*cdf0e10cSrcweir GetXMLToken(eLName) ) ); 1018*cdf0e10cSrcweir GetExport().IgnorableWhitespace(); 1019*cdf0e10cSrcweir GetExport().StartElement( *pElem, sal_False ); 1020*cdf0e10cSrcweir 1021*cdf0e10cSrcweir if( !pListElements ) 1022*cdf0e10cSrcweir pListElements = new OUStrings_Impl; 1023*cdf0e10cSrcweir pListElements->Insert( pElem, pListElements->Count() ); 1024*cdf0e10cSrcweir 1025*cdf0e10cSrcweir mpTextListsHelper->PushListOnStack( sListId, 1026*cdf0e10cSrcweir sListStyleName ); 1027*cdf0e10cSrcweir 1028*cdf0e10cSrcweir // <text:list-header> or <text:list-item> 1029*cdf0e10cSrcweir GetExport().CheckAttrList(); 1030*cdf0e10cSrcweir 1031*cdf0e10cSrcweir // --> OD 2009-06-24 #i97309# 1032*cdf0e10cSrcweir // export start value in case of <bRestartNumberingAtContinuedRootList> 1033*cdf0e10cSrcweir // at correct list item 1034*cdf0e10cSrcweir if ( nListLevelsToBeOpened == 1 ) 1035*cdf0e10cSrcweir { 1036*cdf0e10cSrcweir if ( rNextInfo.HasStartValue() ) 1037*cdf0e10cSrcweir { 1038*cdf0e10cSrcweir OUStringBuffer aBuffer; 1039*cdf0e10cSrcweir aBuffer.append( (sal_Int32)rNextInfo.GetStartValue() ); 1040*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_START_VALUE, 1041*cdf0e10cSrcweir aBuffer.makeStringAndClear() ); 1042*cdf0e10cSrcweir } 1043*cdf0e10cSrcweir else if ( bRestartNumberingAtContinuedRootList ) 1044*cdf0e10cSrcweir { 1045*cdf0e10cSrcweir OUStringBuffer aBuffer; 1046*cdf0e10cSrcweir aBuffer.append( (sal_Int32)nRestartValueForContinuedRootList ); 1047*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_TEXT, 1048*cdf0e10cSrcweir XML_START_VALUE, 1049*cdf0e10cSrcweir aBuffer.makeStringAndClear() ); 1050*cdf0e10cSrcweir bRestartNumberingAtContinuedRootList = false; 1051*cdf0e10cSrcweir } 1052*cdf0e10cSrcweir } 1053*cdf0e10cSrcweir // <-- 1054*cdf0e10cSrcweir 1055*cdf0e10cSrcweir eLName = ( rNextInfo.IsNumbered() || nListLevelsToBeOpened > 1 ) 1056*cdf0e10cSrcweir ? XML_LIST_ITEM 1057*cdf0e10cSrcweir : XML_LIST_HEADER; 1058*cdf0e10cSrcweir pElem = new OUString( GetExport().GetNamespaceMap().GetQNameByKey( 1059*cdf0e10cSrcweir XML_NAMESPACE_TEXT, 1060*cdf0e10cSrcweir GetXMLToken(eLName) ) ); 1061*cdf0e10cSrcweir GetExport().IgnorableWhitespace(); 1062*cdf0e10cSrcweir GetExport().StartElement( *pElem, sal_False ); 1063*cdf0e10cSrcweir 1064*cdf0e10cSrcweir pListElements->Insert( pElem, pListElements->Count() ); 1065*cdf0e10cSrcweir 1066*cdf0e10cSrcweir // --> OD 2008-11-26 #158694# 1067*cdf0e10cSrcweir // export of <text:number> element for last opened <text:list-item>, if requested 1068*cdf0e10cSrcweir if ( GetExport().exportTextNumberElement() && 1069*cdf0e10cSrcweir eLName == XML_LIST_ITEM && nListLevelsToBeOpened == 1 && // last iteration --> last opened <text:list-item> 1070*cdf0e10cSrcweir rNextInfo.ListLabelString().getLength() > 0 ) 1071*cdf0e10cSrcweir { 1072*cdf0e10cSrcweir const ::rtl::OUString aTextNumberElem = 1073*cdf0e10cSrcweir OUString( GetExport().GetNamespaceMap().GetQNameByKey( 1074*cdf0e10cSrcweir XML_NAMESPACE_TEXT, 1075*cdf0e10cSrcweir GetXMLToken(XML_NUMBER) ) ); 1076*cdf0e10cSrcweir GetExport().IgnorableWhitespace(); 1077*cdf0e10cSrcweir GetExport().StartElement( aTextNumberElem, sal_False ); 1078*cdf0e10cSrcweir GetExport().Characters( rNextInfo.ListLabelString() ); 1079*cdf0e10cSrcweir GetExport().EndElement( aTextNumberElem, sal_True ); 1080*cdf0e10cSrcweir } 1081*cdf0e10cSrcweir // <-- 1082*cdf0e10cSrcweir 1083*cdf0e10cSrcweir --nListLevelsToBeOpened; 1084*cdf0e10cSrcweir } while ( nListLevelsToBeOpened > 0 ); 1085*cdf0e10cSrcweir } 1086*cdf0e10cSrcweir } 1087*cdf0e10cSrcweir 1088*cdf0e10cSrcweir if ( rNextInfo.GetLevel() > 0 && 1089*cdf0e10cSrcweir rNextInfo.IsNumbered() && 1090*cdf0e10cSrcweir rPrevInfo.BelongsToSameList( rNextInfo ) && 1091*cdf0e10cSrcweir rPrevInfo.GetLevel() >= rNextInfo.GetLevel() ) 1092*cdf0e10cSrcweir { 1093*cdf0e10cSrcweir // close previous list-item 1094*cdf0e10cSrcweir DBG_ASSERT( pListElements && pListElements->Count() >= 2, 1095*cdf0e10cSrcweir "SwXMLExport::ExportListChange: list elements missing" ); 1096*cdf0e10cSrcweir 1097*cdf0e10cSrcweir OUString *pElem = (*pListElements)[pListElements->Count()-1]; 1098*cdf0e10cSrcweir GetExport().EndElement( *pElem, sal_True ); 1099*cdf0e10cSrcweir 1100*cdf0e10cSrcweir pListElements->Remove( pListElements->Count()-1 ); 1101*cdf0e10cSrcweir delete pElem; 1102*cdf0e10cSrcweir 1103*cdf0e10cSrcweir // --> OD 2009-11-12 #i103745# - only for sub lists 1104*cdf0e10cSrcweir if ( rNextInfo.IsRestart() && !rNextInfo.HasStartValue() && 1105*cdf0e10cSrcweir rNextInfo.GetLevel() != 1 ) 1106*cdf0e10cSrcweir // <-- 1107*cdf0e10cSrcweir { 1108*cdf0e10cSrcweir // start new sub list respectively list on same list level 1109*cdf0e10cSrcweir pElem = (*pListElements)[pListElements->Count()-1]; 1110*cdf0e10cSrcweir GetExport().EndElement( *pElem, sal_True ); 1111*cdf0e10cSrcweir GetExport().IgnorableWhitespace(); 1112*cdf0e10cSrcweir GetExport().StartElement( *pElem, sal_False ); 1113*cdf0e10cSrcweir } 1114*cdf0e10cSrcweir 1115*cdf0e10cSrcweir // open new list-item 1116*cdf0e10cSrcweir GetExport().CheckAttrList(); 1117*cdf0e10cSrcweir if( rNextInfo.HasStartValue() ) 1118*cdf0e10cSrcweir { 1119*cdf0e10cSrcweir OUStringBuffer aBuffer; 1120*cdf0e10cSrcweir aBuffer.append( (sal_Int32)rNextInfo.GetStartValue() ); 1121*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_START_VALUE, 1122*cdf0e10cSrcweir aBuffer.makeStringAndClear() ); 1123*cdf0e10cSrcweir } 1124*cdf0e10cSrcweir // --> OD 2009-11-12 #i103745# - handle restart without start value on list level 1 1125*cdf0e10cSrcweir else if ( rNextInfo.IsRestart() && /*!rNextInfo.HasStartValue() &&*/ 1126*cdf0e10cSrcweir rNextInfo.GetLevel() == 1 ) 1127*cdf0e10cSrcweir { 1128*cdf0e10cSrcweir OUStringBuffer aBuffer; 1129*cdf0e10cSrcweir aBuffer.append( (sal_Int32)rNextInfo.GetListLevelStartValue() ); 1130*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_START_VALUE, 1131*cdf0e10cSrcweir aBuffer.makeStringAndClear() ); 1132*cdf0e10cSrcweir } 1133*cdf0e10cSrcweir // <-- 1134*cdf0e10cSrcweir if ( ( GetExport().getExportFlags() & EXPORT_OASIS ) != 0 && 1135*cdf0e10cSrcweir GetExport().getDefaultVersion() >= SvtSaveOptions::ODFVER_012 ) 1136*cdf0e10cSrcweir { 1137*cdf0e10cSrcweir const ::rtl::OUString sListStyleName( rNextInfo.GetNumRulesName() ); 1138*cdf0e10cSrcweir if ( !mpTextListsHelper->EqualsToTopListStyleOnStack( sListStyleName ) ) 1139*cdf0e10cSrcweir { 1140*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_TEXT, 1141*cdf0e10cSrcweir XML_STYLE_OVERRIDE, 1142*cdf0e10cSrcweir GetExport().EncodeStyleName( sListStyleName ) ); 1143*cdf0e10cSrcweir } 1144*cdf0e10cSrcweir } 1145*cdf0e10cSrcweir pElem = new OUString( GetExport().GetNamespaceMap().GetQNameByKey( 1146*cdf0e10cSrcweir XML_NAMESPACE_TEXT, 1147*cdf0e10cSrcweir GetXMLToken(XML_LIST_ITEM) ) ); 1148*cdf0e10cSrcweir GetExport().IgnorableWhitespace(); 1149*cdf0e10cSrcweir GetExport().StartElement( *pElem, sal_False ); 1150*cdf0e10cSrcweir 1151*cdf0e10cSrcweir pListElements->Insert( pElem, pListElements->Count() ); 1152*cdf0e10cSrcweir 1153*cdf0e10cSrcweir // --> OD 2008-11-26 #158694# 1154*cdf0e10cSrcweir // export of <text:number> element for <text:list-item>, if requested 1155*cdf0e10cSrcweir if ( GetExport().exportTextNumberElement() && 1156*cdf0e10cSrcweir rNextInfo.ListLabelString().getLength() > 0 ) 1157*cdf0e10cSrcweir { 1158*cdf0e10cSrcweir const ::rtl::OUString aTextNumberElem = 1159*cdf0e10cSrcweir OUString( GetExport().GetNamespaceMap().GetQNameByKey( 1160*cdf0e10cSrcweir XML_NAMESPACE_TEXT, 1161*cdf0e10cSrcweir GetXMLToken(XML_NUMBER) ) ); 1162*cdf0e10cSrcweir GetExport().IgnorableWhitespace(); 1163*cdf0e10cSrcweir GetExport().StartElement( aTextNumberElem, sal_False ); 1164*cdf0e10cSrcweir GetExport().Characters( rNextInfo.ListLabelString() ); 1165*cdf0e10cSrcweir GetExport().EndElement( aTextNumberElem, sal_True ); 1166*cdf0e10cSrcweir } 1167*cdf0e10cSrcweir // <-- 1168*cdf0e10cSrcweir } 1169*cdf0e10cSrcweir } 1170*cdf0e10cSrcweir // <-- 1171*cdf0e10cSrcweir 1172*cdf0e10cSrcweir XMLTextParagraphExport::XMLTextParagraphExport( 1173*cdf0e10cSrcweir SvXMLExport& rExp, 1174*cdf0e10cSrcweir SvXMLAutoStylePoolP & rASP 1175*cdf0e10cSrcweir ) : 1176*cdf0e10cSrcweir XMLStyleExport( rExp, OUString(), &rASP ), 1177*cdf0e10cSrcweir rAutoStylePool( rASP ), 1178*cdf0e10cSrcweir pBoundFrameSets(new BoundFrameSets(GetExport().GetModel())), 1179*cdf0e10cSrcweir pFieldExport( 0 ), 1180*cdf0e10cSrcweir pListElements( 0 ), 1181*cdf0e10cSrcweir // --> OD 2008-05-07 #refactorlists# - no longer needed 1182*cdf0e10cSrcweir // pExportedLists( 0 ), 1183*cdf0e10cSrcweir // <-- 1184*cdf0e10cSrcweir pListAutoPool( new XMLTextListAutoStylePool( this->GetExport() ) ), 1185*cdf0e10cSrcweir pSectionExport( NULL ), 1186*cdf0e10cSrcweir pIndexMarkExport( NULL ), 1187*cdf0e10cSrcweir 1188*cdf0e10cSrcweir pRedlineExport( NULL ), 1189*cdf0e10cSrcweir pHeadingStyles( NULL ), 1190*cdf0e10cSrcweir 1191*cdf0e10cSrcweir bProgress( sal_False ), 1192*cdf0e10cSrcweir bBlock( sal_False ), 1193*cdf0e10cSrcweir 1194*cdf0e10cSrcweir bOpenRuby( sal_False ), 1195*cdf0e10cSrcweir // --> OD 2008-04-25 #refactorlists# 1196*cdf0e10cSrcweir mpTextListsHelper( 0 ), 1197*cdf0e10cSrcweir maTextListsHelperStack(), 1198*cdf0e10cSrcweir // <-- 1199*cdf0e10cSrcweir 1200*cdf0e10cSrcweir sActualSize(RTL_CONSTASCII_USTRINGPARAM("ActualSize")), 1201*cdf0e10cSrcweir // --> OD 2009-07-22 #i73249# 1202*cdf0e10cSrcweir // sAlternativeText(RTL_CONSTASCII_USTRINGPARAM("AlternativeText")), 1203*cdf0e10cSrcweir sTitle(RTL_CONSTASCII_USTRINGPARAM("Title")), 1204*cdf0e10cSrcweir sDescription(RTL_CONSTASCII_USTRINGPARAM("Description")), 1205*cdf0e10cSrcweir // <-- 1206*cdf0e10cSrcweir sAnchorCharStyleName(RTL_CONSTASCII_USTRINGPARAM("AnchorCharStyleName")), 1207*cdf0e10cSrcweir sAnchorPageNo(RTL_CONSTASCII_USTRINGPARAM("AnchorPageNo")), 1208*cdf0e10cSrcweir sAnchorType(RTL_CONSTASCII_USTRINGPARAM("AnchorType")), 1209*cdf0e10cSrcweir sBeginNotice(RTL_CONSTASCII_USTRINGPARAM("BeginNotice")), 1210*cdf0e10cSrcweir sBookmark(RTL_CONSTASCII_USTRINGPARAM("Bookmark")), 1211*cdf0e10cSrcweir sCategory(RTL_CONSTASCII_USTRINGPARAM("Category")), 1212*cdf0e10cSrcweir sChainNextName(RTL_CONSTASCII_USTRINGPARAM("ChainNextName")), 1213*cdf0e10cSrcweir sCharStyleName(RTL_CONSTASCII_USTRINGPARAM("CharStyleName")), 1214*cdf0e10cSrcweir sCharStyleNames(RTL_CONSTASCII_USTRINGPARAM("CharStyleNames")), 1215*cdf0e10cSrcweir sContourPolyPolygon(RTL_CONSTASCII_USTRINGPARAM("ContourPolyPolygon")), 1216*cdf0e10cSrcweir sDocumentIndex(RTL_CONSTASCII_USTRINGPARAM("DocumentIndex")), 1217*cdf0e10cSrcweir sDocumentIndexMark(RTL_CONSTASCII_USTRINGPARAM("DocumentIndexMark")), 1218*cdf0e10cSrcweir sEndNotice(RTL_CONSTASCII_USTRINGPARAM("EndNotice")), 1219*cdf0e10cSrcweir sFootnote(RTL_CONSTASCII_USTRINGPARAM("Footnote")), 1220*cdf0e10cSrcweir sFootnoteCounting(RTL_CONSTASCII_USTRINGPARAM("FootnoteCounting")), 1221*cdf0e10cSrcweir sFrame(RTL_CONSTASCII_USTRINGPARAM("Frame")), 1222*cdf0e10cSrcweir sFrameHeightAbsolute(RTL_CONSTASCII_USTRINGPARAM("FrameHeightAbsolute")), 1223*cdf0e10cSrcweir sFrameHeightPercent(RTL_CONSTASCII_USTRINGPARAM("FrameHeightPercent")), 1224*cdf0e10cSrcweir sFrameStyleName(RTL_CONSTASCII_USTRINGPARAM("FrameStyleName")), 1225*cdf0e10cSrcweir sFrameWidthAbsolute(RTL_CONSTASCII_USTRINGPARAM("FrameWidthAbsolute")), 1226*cdf0e10cSrcweir sFrameWidthPercent(RTL_CONSTASCII_USTRINGPARAM("FrameWidthPercent")), 1227*cdf0e10cSrcweir sGraphicFilter(RTL_CONSTASCII_USTRINGPARAM("GraphicFilter")), 1228*cdf0e10cSrcweir sGraphicRotation(RTL_CONSTASCII_USTRINGPARAM("GraphicRotation")), 1229*cdf0e10cSrcweir sGraphicURL(RTL_CONSTASCII_USTRINGPARAM("GraphicURL")), 1230*cdf0e10cSrcweir sHeight(RTL_CONSTASCII_USTRINGPARAM("Height")), 1231*cdf0e10cSrcweir sHoriOrient(RTL_CONSTASCII_USTRINGPARAM("HoriOrient")), 1232*cdf0e10cSrcweir sHoriOrientPosition(RTL_CONSTASCII_USTRINGPARAM("HoriOrientPosition")), 1233*cdf0e10cSrcweir sHyperLinkName(RTL_CONSTASCII_USTRINGPARAM("HyperLinkName")), 1234*cdf0e10cSrcweir sHyperLinkTarget(RTL_CONSTASCII_USTRINGPARAM("HyperLinkTarget")), 1235*cdf0e10cSrcweir sHyperLinkURL(RTL_CONSTASCII_USTRINGPARAM("HyperLinkURL")), 1236*cdf0e10cSrcweir sIsAutomaticContour(RTL_CONSTASCII_USTRINGPARAM("IsAutomaticContour")), 1237*cdf0e10cSrcweir sIsCollapsed(RTL_CONSTASCII_USTRINGPARAM("IsCollapsed")), 1238*cdf0e10cSrcweir sIsPixelContour(RTL_CONSTASCII_USTRINGPARAM("IsPixelContour")), 1239*cdf0e10cSrcweir sIsStart(RTL_CONSTASCII_USTRINGPARAM("IsStart")), 1240*cdf0e10cSrcweir sIsSyncHeightToWidth(RTL_CONSTASCII_USTRINGPARAM("IsSyncHeightToWidth")), 1241*cdf0e10cSrcweir sIsSyncWidthToHeight(RTL_CONSTASCII_USTRINGPARAM("IsSyncWidthToHeight")), 1242*cdf0e10cSrcweir sNumberingRules(RTL_CONSTASCII_USTRINGPARAM("NumberingRules")), 1243*cdf0e10cSrcweir sNumberingType(RTL_CONSTASCII_USTRINGPARAM("NumberingType")), 1244*cdf0e10cSrcweir sPageDescName(RTL_CONSTASCII_USTRINGPARAM("PageDescName")), 1245*cdf0e10cSrcweir sPageStyleName(RTL_CONSTASCII_USTRINGPARAM("PageStyleName")), 1246*cdf0e10cSrcweir sParaChapterNumberingLevel(RTL_CONSTASCII_USTRINGPARAM("ParaChapterNumberingLevel")), 1247*cdf0e10cSrcweir sParaConditionalStyleName(RTL_CONSTASCII_USTRINGPARAM("ParaConditionalStyleName")), 1248*cdf0e10cSrcweir sParagraphService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.Paragraph")), 1249*cdf0e10cSrcweir sParaStyleName(RTL_CONSTASCII_USTRINGPARAM("ParaStyleName")), 1250*cdf0e10cSrcweir sPositionEndOfDoc(RTL_CONSTASCII_USTRINGPARAM("PositionEndOfDoc")), 1251*cdf0e10cSrcweir sPrefix(RTL_CONSTASCII_USTRINGPARAM("Prefix")), 1252*cdf0e10cSrcweir sRedline(RTL_CONSTASCII_USTRINGPARAM("Redline")), 1253*cdf0e10cSrcweir sReferenceId(RTL_CONSTASCII_USTRINGPARAM("ReferenceId")), 1254*cdf0e10cSrcweir sReferenceMark(RTL_CONSTASCII_USTRINGPARAM("ReferenceMark")), 1255*cdf0e10cSrcweir sRelativeHeight(RTL_CONSTASCII_USTRINGPARAM("RelativeHeight")), 1256*cdf0e10cSrcweir sRelativeWidth(RTL_CONSTASCII_USTRINGPARAM("RelativeWidth")), 1257*cdf0e10cSrcweir sRuby(RTL_CONSTASCII_USTRINGPARAM("Ruby")), 1258*cdf0e10cSrcweir sRubyAdjust(RTL_CONSTASCII_USTRINGPARAM("RubyAdjust")), 1259*cdf0e10cSrcweir sRubyCharStyleName(RTL_CONSTASCII_USTRINGPARAM("RubyCharStyleName")), 1260*cdf0e10cSrcweir sRubyText(RTL_CONSTASCII_USTRINGPARAM("RubyText")), 1261*cdf0e10cSrcweir sServerMap(RTL_CONSTASCII_USTRINGPARAM("ServerMap")), 1262*cdf0e10cSrcweir sShapeService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.Shape")), 1263*cdf0e10cSrcweir sSizeType(RTL_CONSTASCII_USTRINGPARAM("SizeType")), 1264*cdf0e10cSrcweir sSoftPageBreak( RTL_CONSTASCII_USTRINGPARAM( "SoftPageBreak" ) ), 1265*cdf0e10cSrcweir sStartAt(RTL_CONSTASCII_USTRINGPARAM("StartAt")), 1266*cdf0e10cSrcweir sSuffix(RTL_CONSTASCII_USTRINGPARAM("Suffix")), 1267*cdf0e10cSrcweir sTableService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextTable")), 1268*cdf0e10cSrcweir sText(RTL_CONSTASCII_USTRINGPARAM("Text")), 1269*cdf0e10cSrcweir sTextContentService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextContent")), 1270*cdf0e10cSrcweir sTextEmbeddedService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextEmbeddedObject")), 1271*cdf0e10cSrcweir sTextEndnoteService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.Endnote")), 1272*cdf0e10cSrcweir sTextField(RTL_CONSTASCII_USTRINGPARAM("TextField")), 1273*cdf0e10cSrcweir sTextFieldService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextField")), 1274*cdf0e10cSrcweir sTextFrameService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextFrame")), 1275*cdf0e10cSrcweir sTextGraphicService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextGraphicObject")), 1276*cdf0e10cSrcweir sTextPortionType(RTL_CONSTASCII_USTRINGPARAM("TextPortionType")), 1277*cdf0e10cSrcweir sTextSection(RTL_CONSTASCII_USTRINGPARAM("TextSection")), 1278*cdf0e10cSrcweir sUnvisitedCharStyleName(RTL_CONSTASCII_USTRINGPARAM("UnvisitedCharStyleName")), 1279*cdf0e10cSrcweir sVertOrient(RTL_CONSTASCII_USTRINGPARAM("VertOrient")), 1280*cdf0e10cSrcweir sVertOrientPosition(RTL_CONSTASCII_USTRINGPARAM("VertOrientPosition")), 1281*cdf0e10cSrcweir sVisitedCharStyleName(RTL_CONSTASCII_USTRINGPARAM("VisitedCharStyleName")), 1282*cdf0e10cSrcweir sWidth(RTL_CONSTASCII_USTRINGPARAM("Width")), 1283*cdf0e10cSrcweir sWidthType( RTL_CONSTASCII_USTRINGPARAM( "WidthType" ) ), 1284*cdf0e10cSrcweir sTextFieldStart( RTL_CONSTASCII_USTRINGPARAM( "TextFieldStart" ) ), 1285*cdf0e10cSrcweir sTextFieldEnd( RTL_CONSTASCII_USTRINGPARAM( "TextFieldEnd" ) ), 1286*cdf0e10cSrcweir sTextFieldStartEnd( RTL_CONSTASCII_USTRINGPARAM( "TextFieldStartEnd" ) ), 1287*cdf0e10cSrcweir aCharStyleNamesPropInfoCache( sCharStyleNames ) 1288*cdf0e10cSrcweir { 1289*cdf0e10cSrcweir UniReference < XMLPropertySetMapper > xPropMapper(new XMLTextPropertySetMapper( TEXT_PROP_MAP_PARA )); 1290*cdf0e10cSrcweir xParaPropMapper = new XMLTextExportPropertySetMapper( xPropMapper, 1291*cdf0e10cSrcweir GetExport() ); 1292*cdf0e10cSrcweir 1293*cdf0e10cSrcweir OUString sFamily( GetXMLToken(XML_PARAGRAPH) ); 1294*cdf0e10cSrcweir OUString aPrefix( String( 'P' ) ); 1295*cdf0e10cSrcweir rAutoStylePool.AddFamily( XML_STYLE_FAMILY_TEXT_PARAGRAPH, sFamily, 1296*cdf0e10cSrcweir xParaPropMapper, aPrefix ); 1297*cdf0e10cSrcweir 1298*cdf0e10cSrcweir xPropMapper = new XMLTextPropertySetMapper( TEXT_PROP_MAP_TEXT ); 1299*cdf0e10cSrcweir xTextPropMapper = new XMLTextExportPropertySetMapper( xPropMapper, 1300*cdf0e10cSrcweir GetExport() ); 1301*cdf0e10cSrcweir sFamily = OUString( GetXMLToken(XML_TEXT) ); 1302*cdf0e10cSrcweir aPrefix = OUString( String( 'T' ) ); 1303*cdf0e10cSrcweir rAutoStylePool.AddFamily( XML_STYLE_FAMILY_TEXT_TEXT, sFamily, 1304*cdf0e10cSrcweir xTextPropMapper, aPrefix ); 1305*cdf0e10cSrcweir 1306*cdf0e10cSrcweir xPropMapper = new XMLTextPropertySetMapper( TEXT_PROP_MAP_AUTO_FRAME ); 1307*cdf0e10cSrcweir xAutoFramePropMapper = new XMLTextExportPropertySetMapper( xPropMapper, 1308*cdf0e10cSrcweir GetExport() ); 1309*cdf0e10cSrcweir sFamily = OUString( RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_GRAPHICS_NAME) ); 1310*cdf0e10cSrcweir aPrefix = OUString( RTL_CONSTASCII_USTRINGPARAM( "fr" ) ); 1311*cdf0e10cSrcweir rAutoStylePool.AddFamily( XML_STYLE_FAMILY_TEXT_FRAME, sFamily, 1312*cdf0e10cSrcweir xAutoFramePropMapper, aPrefix ); 1313*cdf0e10cSrcweir 1314*cdf0e10cSrcweir xPropMapper = new XMLTextPropertySetMapper( TEXT_PROP_MAP_SECTION ); 1315*cdf0e10cSrcweir xSectionPropMapper = new XMLTextExportPropertySetMapper( xPropMapper, 1316*cdf0e10cSrcweir GetExport() ); 1317*cdf0e10cSrcweir sFamily = OUString( GetXMLToken( XML_SECTION ) ); 1318*cdf0e10cSrcweir aPrefix = OUString( RTL_CONSTASCII_USTRINGPARAM( "Sect" ) ); 1319*cdf0e10cSrcweir rAutoStylePool.AddFamily( XML_STYLE_FAMILY_TEXT_SECTION, sFamily, 1320*cdf0e10cSrcweir xSectionPropMapper, aPrefix ); 1321*cdf0e10cSrcweir 1322*cdf0e10cSrcweir xPropMapper = new XMLTextPropertySetMapper( TEXT_PROP_MAP_RUBY ); 1323*cdf0e10cSrcweir xRubyPropMapper = new SvXMLExportPropertyMapper( xPropMapper ); 1324*cdf0e10cSrcweir sFamily = OUString( GetXMLToken( XML_RUBY ) ); 1325*cdf0e10cSrcweir aPrefix = OUString( RTL_CONSTASCII_USTRINGPARAM( "Ru" ) ); 1326*cdf0e10cSrcweir rAutoStylePool.AddFamily( XML_STYLE_FAMILY_TEXT_RUBY, sFamily, 1327*cdf0e10cSrcweir xRubyPropMapper, aPrefix ); 1328*cdf0e10cSrcweir 1329*cdf0e10cSrcweir xPropMapper = new XMLTextPropertySetMapper( TEXT_PROP_MAP_FRAME ); 1330*cdf0e10cSrcweir xFramePropMapper = new XMLTextExportPropertySetMapper( xPropMapper, 1331*cdf0e10cSrcweir GetExport() ); 1332*cdf0e10cSrcweir 1333*cdf0e10cSrcweir pSectionExport = new XMLSectionExport( rExp, *this ); 1334*cdf0e10cSrcweir pIndexMarkExport = new XMLIndexMarkExport( rExp, *this ); 1335*cdf0e10cSrcweir 1336*cdf0e10cSrcweir if( ! IsBlockMode() && 1337*cdf0e10cSrcweir Reference<XRedlinesSupplier>( GetExport().GetModel(), UNO_QUERY ).is()) 1338*cdf0e10cSrcweir pRedlineExport = new XMLRedlineExport( rExp ); 1339*cdf0e10cSrcweir 1340*cdf0e10cSrcweir // The text field helper needs a pre-constructed XMLPropertyState 1341*cdf0e10cSrcweir // to export the combined characters field. We construct that 1342*cdf0e10cSrcweir // here, because we need the text property mapper to do it. 1343*cdf0e10cSrcweir 1344*cdf0e10cSrcweir // construct Any value, then find index 1345*cdf0e10cSrcweir sal_Int32 nIndex = xTextPropMapper->getPropertySetMapper()->FindEntryIndex( 1346*cdf0e10cSrcweir "", XML_NAMESPACE_STYLE, 1347*cdf0e10cSrcweir GetXMLToken(XML_TEXT_COMBINE)); 1348*cdf0e10cSrcweir pFieldExport = new XMLTextFieldExport( rExp, new XMLPropertyState( nIndex, uno::makeAny(sal_True) ) ); 1349*cdf0e10cSrcweir 1350*cdf0e10cSrcweir // --> OD 2008-05-08 #refactorlists# 1351*cdf0e10cSrcweir PushNewTextListsHelper(); 1352*cdf0e10cSrcweir // <-- 1353*cdf0e10cSrcweir } 1354*cdf0e10cSrcweir 1355*cdf0e10cSrcweir XMLTextParagraphExport::~XMLTextParagraphExport() 1356*cdf0e10cSrcweir { 1357*cdf0e10cSrcweir delete pHeadingStyles; 1358*cdf0e10cSrcweir delete pRedlineExport; 1359*cdf0e10cSrcweir delete pIndexMarkExport; 1360*cdf0e10cSrcweir delete pSectionExport; 1361*cdf0e10cSrcweir delete pFieldExport; 1362*cdf0e10cSrcweir delete pListElements; 1363*cdf0e10cSrcweir // --> OD 2008-05-07 #refactorlists# - no longer needed 1364*cdf0e10cSrcweir // delete pExportedLists; 1365*cdf0e10cSrcweir // <-- 1366*cdf0e10cSrcweir delete pListAutoPool; 1367*cdf0e10cSrcweir #ifdef DBG_UTIL 1368*cdf0e10cSrcweir txtparae_bContainsIllegalCharacters = sal_False; 1369*cdf0e10cSrcweir #endif 1370*cdf0e10cSrcweir // --> OD 2008-04-25 #refactorlists# 1371*cdf0e10cSrcweir // also deletes <mpTextListsHelper> 1372*cdf0e10cSrcweir PopTextListsHelper(); 1373*cdf0e10cSrcweir DBG_ASSERT( maTextListsHelperStack.size() == 0, 1374*cdf0e10cSrcweir "misusage of text lists helper stack - it is not empty. Serious defect - please inform OD" ); 1375*cdf0e10cSrcweir // <-- 1376*cdf0e10cSrcweir } 1377*cdf0e10cSrcweir 1378*cdf0e10cSrcweir SvXMLExportPropertyMapper *XMLTextParagraphExport::CreateShapeExtPropMapper( 1379*cdf0e10cSrcweir SvXMLExport& rExport ) 1380*cdf0e10cSrcweir { 1381*cdf0e10cSrcweir UniReference < XMLPropertySetMapper > xPropMapper = 1382*cdf0e10cSrcweir new XMLTextPropertySetMapper( TEXT_PROP_MAP_SHAPE ); 1383*cdf0e10cSrcweir return new XMLTextExportPropertySetMapper( xPropMapper, rExport ); 1384*cdf0e10cSrcweir } 1385*cdf0e10cSrcweir 1386*cdf0e10cSrcweir SvXMLExportPropertyMapper *XMLTextParagraphExport::CreateCharExtPropMapper( 1387*cdf0e10cSrcweir SvXMLExport& rExport) 1388*cdf0e10cSrcweir { 1389*cdf0e10cSrcweir XMLPropertySetMapper *pPropMapper = 1390*cdf0e10cSrcweir new XMLTextPropertySetMapper( TEXT_PROP_MAP_TEXT ); 1391*cdf0e10cSrcweir return new XMLTextExportPropertySetMapper( pPropMapper, rExport ); 1392*cdf0e10cSrcweir } 1393*cdf0e10cSrcweir 1394*cdf0e10cSrcweir SvXMLExportPropertyMapper *XMLTextParagraphExport::CreateParaExtPropMapper( 1395*cdf0e10cSrcweir SvXMLExport& rExport) 1396*cdf0e10cSrcweir { 1397*cdf0e10cSrcweir XMLPropertySetMapper *pPropMapper = 1398*cdf0e10cSrcweir new XMLTextPropertySetMapper( TEXT_PROP_MAP_SHAPE_PARA ); 1399*cdf0e10cSrcweir return new XMLTextExportPropertySetMapper( pPropMapper, rExport ); 1400*cdf0e10cSrcweir } 1401*cdf0e10cSrcweir 1402*cdf0e10cSrcweir SvXMLExportPropertyMapper *XMLTextParagraphExport::CreateParaDefaultExtPropMapper( 1403*cdf0e10cSrcweir SvXMLExport& rExport) 1404*cdf0e10cSrcweir { 1405*cdf0e10cSrcweir XMLPropertySetMapper *pPropMapper = 1406*cdf0e10cSrcweir new XMLTextPropertySetMapper( TEXT_PROP_MAP_TEXT_ADDITIONAL_DEFAULTS ); 1407*cdf0e10cSrcweir return new XMLTextExportPropertySetMapper( pPropMapper, rExport ); 1408*cdf0e10cSrcweir } 1409*cdf0e10cSrcweir 1410*cdf0e10cSrcweir void XMLTextParagraphExport::exportPageFrames( sal_Bool bAutoStyles, 1411*cdf0e10cSrcweir sal_Bool bIsProgress ) 1412*cdf0e10cSrcweir { 1413*cdf0e10cSrcweir const TextContentSet* const pTexts = pBoundFrameSets->GetTexts()->GetPageBoundContents(); 1414*cdf0e10cSrcweir const TextContentSet* const pGraphics = pBoundFrameSets->GetGraphics()->GetPageBoundContents(); 1415*cdf0e10cSrcweir const TextContentSet* const pEmbeddeds = pBoundFrameSets->GetEmbeddeds()->GetPageBoundContents(); 1416*cdf0e10cSrcweir const TextContentSet* const pShapes = pBoundFrameSets->GetShapes()->GetPageBoundContents(); 1417*cdf0e10cSrcweir for(TextContentSet::const_iterator_t it = pTexts->getBegin(); 1418*cdf0e10cSrcweir it != pTexts->getEnd(); 1419*cdf0e10cSrcweir ++it) 1420*cdf0e10cSrcweir exportTextFrame(*it, bAutoStyles, bIsProgress, sal_True); 1421*cdf0e10cSrcweir for(TextContentSet::const_iterator_t it = pGraphics->getBegin(); 1422*cdf0e10cSrcweir it != pGraphics->getEnd(); 1423*cdf0e10cSrcweir ++it) 1424*cdf0e10cSrcweir exportTextGraphic(*it, bAutoStyles); 1425*cdf0e10cSrcweir for(TextContentSet::const_iterator_t it = pEmbeddeds->getBegin(); 1426*cdf0e10cSrcweir it != pEmbeddeds->getEnd(); 1427*cdf0e10cSrcweir ++it) 1428*cdf0e10cSrcweir exportTextEmbedded(*it, bAutoStyles); 1429*cdf0e10cSrcweir for(TextContentSet::const_iterator_t it = pShapes->getBegin(); 1430*cdf0e10cSrcweir it != pShapes->getEnd(); 1431*cdf0e10cSrcweir ++it) 1432*cdf0e10cSrcweir exportShape(*it, bAutoStyles); 1433*cdf0e10cSrcweir } 1434*cdf0e10cSrcweir 1435*cdf0e10cSrcweir void XMLTextParagraphExport::exportFrameFrames( 1436*cdf0e10cSrcweir sal_Bool bAutoStyles, 1437*cdf0e10cSrcweir sal_Bool bIsProgress, 1438*cdf0e10cSrcweir const Reference < XTextFrame > *pParentTxtFrame ) 1439*cdf0e10cSrcweir { 1440*cdf0e10cSrcweir const TextContentSet* const pTexts = pBoundFrameSets->GetTexts()->GetFrameBoundContents(*pParentTxtFrame); 1441*cdf0e10cSrcweir if(pTexts) 1442*cdf0e10cSrcweir for(TextContentSet::const_iterator_t it = pTexts->getBegin(); 1443*cdf0e10cSrcweir it != pTexts->getEnd(); 1444*cdf0e10cSrcweir ++it) 1445*cdf0e10cSrcweir exportTextFrame(*it, bAutoStyles, bIsProgress, sal_True); 1446*cdf0e10cSrcweir const TextContentSet* const pGraphics = pBoundFrameSets->GetGraphics()->GetFrameBoundContents(*pParentTxtFrame); 1447*cdf0e10cSrcweir if(pGraphics) 1448*cdf0e10cSrcweir for(TextContentSet::const_iterator_t it = pGraphics->getBegin(); 1449*cdf0e10cSrcweir it != pGraphics->getEnd(); 1450*cdf0e10cSrcweir ++it) 1451*cdf0e10cSrcweir exportTextGraphic(*it, bAutoStyles); 1452*cdf0e10cSrcweir const TextContentSet* const pEmbeddeds = pBoundFrameSets->GetEmbeddeds()->GetFrameBoundContents(*pParentTxtFrame); 1453*cdf0e10cSrcweir if(pEmbeddeds) 1454*cdf0e10cSrcweir for(TextContentSet::const_iterator_t it = pEmbeddeds->getBegin(); 1455*cdf0e10cSrcweir it != pEmbeddeds->getEnd(); 1456*cdf0e10cSrcweir ++it) 1457*cdf0e10cSrcweir exportTextEmbedded(*it, bAutoStyles); 1458*cdf0e10cSrcweir const TextContentSet* const pShapes = pBoundFrameSets->GetShapes()->GetFrameBoundContents(*pParentTxtFrame); 1459*cdf0e10cSrcweir if(pShapes) 1460*cdf0e10cSrcweir for(TextContentSet::const_iterator_t it = pShapes->getBegin(); 1461*cdf0e10cSrcweir it != pShapes->getEnd(); 1462*cdf0e10cSrcweir ++it) 1463*cdf0e10cSrcweir exportShape(*it, bAutoStyles); 1464*cdf0e10cSrcweir } 1465*cdf0e10cSrcweir 1466*cdf0e10cSrcweir // bookmarks, reference marks (and TOC marks) are the same except for the 1467*cdf0e10cSrcweir // element names. We use the same method for export and it an array with 1468*cdf0e10cSrcweir // the proper element names 1469*cdf0e10cSrcweir static const enum XMLTokenEnum lcl_XmlReferenceElements[] = { 1470*cdf0e10cSrcweir XML_REFERENCE_MARK, XML_REFERENCE_MARK_START, XML_REFERENCE_MARK_END }; 1471*cdf0e10cSrcweir static const enum XMLTokenEnum lcl_XmlBookmarkElements[] = { 1472*cdf0e10cSrcweir XML_BOOKMARK, XML_BOOKMARK_START, XML_BOOKMARK_END }; 1473*cdf0e10cSrcweir 1474*cdf0e10cSrcweir // This function replaces the text portion iteration during auto style 1475*cdf0e10cSrcweir // collection. 1476*cdf0e10cSrcweir bool XMLTextParagraphExport::collectTextAutoStylesOptimized( sal_Bool bIsProgress ) 1477*cdf0e10cSrcweir { 1478*cdf0e10cSrcweir GetExport().GetShapeExport(); // make sure the graphics styles family is added 1479*cdf0e10cSrcweir 1480*cdf0e10cSrcweir const sal_Bool bAutoStyles = sal_True; 1481*cdf0e10cSrcweir const sal_Bool bExportContent = sal_False; 1482*cdf0e10cSrcweir 1483*cdf0e10cSrcweir // Export AutoStyles: 1484*cdf0e10cSrcweir Reference< XAutoStylesSupplier > xAutoStylesSupp( GetExport().GetModel(), UNO_QUERY ); 1485*cdf0e10cSrcweir if ( xAutoStylesSupp.is() ) 1486*cdf0e10cSrcweir { 1487*cdf0e10cSrcweir Reference< XAutoStyles > xAutoStyleFamilies = xAutoStylesSupp->getAutoStyles(); 1488*cdf0e10cSrcweir OUString sName; 1489*cdf0e10cSrcweir sal_uInt16 nFamily; 1490*cdf0e10cSrcweir 1491*cdf0e10cSrcweir for ( int i = 0; i < 3; ++i ) 1492*cdf0e10cSrcweir { 1493*cdf0e10cSrcweir if ( 0 == i ) 1494*cdf0e10cSrcweir { 1495*cdf0e10cSrcweir sName = OUString( RTL_CONSTASCII_USTRINGPARAM( "CharacterStyles" ) ); 1496*cdf0e10cSrcweir nFamily = XML_STYLE_FAMILY_TEXT_TEXT; 1497*cdf0e10cSrcweir } 1498*cdf0e10cSrcweir else if ( 1 == i ) 1499*cdf0e10cSrcweir { 1500*cdf0e10cSrcweir sName = OUString( RTL_CONSTASCII_USTRINGPARAM( "RubyStyles" ) ); 1501*cdf0e10cSrcweir nFamily = XML_STYLE_FAMILY_TEXT_RUBY; 1502*cdf0e10cSrcweir } 1503*cdf0e10cSrcweir else 1504*cdf0e10cSrcweir { 1505*cdf0e10cSrcweir sName = OUString( RTL_CONSTASCII_USTRINGPARAM( "ParagraphStyles" ) ); 1506*cdf0e10cSrcweir nFamily = XML_STYLE_FAMILY_TEXT_PARAGRAPH; 1507*cdf0e10cSrcweir } 1508*cdf0e10cSrcweir 1509*cdf0e10cSrcweir Any aAny = xAutoStyleFamilies->getByName( sName ); 1510*cdf0e10cSrcweir Reference< XAutoStyleFamily > xAutoStyles = *(Reference<XAutoStyleFamily>*)aAny.getValue(); 1511*cdf0e10cSrcweir Reference < XEnumeration > xAutoStylesEnum( xAutoStyles->createEnumeration() ); 1512*cdf0e10cSrcweir 1513*cdf0e10cSrcweir while ( xAutoStylesEnum->hasMoreElements() ) 1514*cdf0e10cSrcweir { 1515*cdf0e10cSrcweir aAny = xAutoStylesEnum->nextElement(); 1516*cdf0e10cSrcweir Reference< XAutoStyle > xAutoStyle = *(Reference<XAutoStyle>*)aAny.getValue(); 1517*cdf0e10cSrcweir Reference < XPropertySet > xPSet( xAutoStyle, uno::UNO_QUERY ); 1518*cdf0e10cSrcweir Add( nFamily, xPSet, 0, true ); 1519*cdf0e10cSrcweir } 1520*cdf0e10cSrcweir } 1521*cdf0e10cSrcweir } 1522*cdf0e10cSrcweir 1523*cdf0e10cSrcweir // Export Field AutoStyles: 1524*cdf0e10cSrcweir Reference< XTextFieldsSupplier > xTextFieldsSupp( GetExport().GetModel(), UNO_QUERY ); 1525*cdf0e10cSrcweir if ( xTextFieldsSupp.is() ) 1526*cdf0e10cSrcweir { 1527*cdf0e10cSrcweir Reference< XEnumerationAccess > xTextFields = xTextFieldsSupp->getTextFields(); 1528*cdf0e10cSrcweir Reference < XEnumeration > xTextFieldsEnum( xTextFields->createEnumeration() ); 1529*cdf0e10cSrcweir 1530*cdf0e10cSrcweir while ( xTextFieldsEnum->hasMoreElements() ) 1531*cdf0e10cSrcweir { 1532*cdf0e10cSrcweir Any aAny = xTextFieldsEnum->nextElement(); 1533*cdf0e10cSrcweir Reference< XTextField > xTextField = *(Reference<XTextField>*)aAny.getValue(); 1534*cdf0e10cSrcweir exportTextField( xTextField, bAutoStyles, bIsProgress, 1535*cdf0e10cSrcweir !xAutoStylesSupp.is() ); 1536*cdf0e10cSrcweir try 1537*cdf0e10cSrcweir { 1538*cdf0e10cSrcweir Reference < XPropertySet > xSet( xTextField, UNO_QUERY ); 1539*cdf0e10cSrcweir Reference < XText > xText; 1540*cdf0e10cSrcweir Any a = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("TextRange") ); 1541*cdf0e10cSrcweir a >>= xText; 1542*cdf0e10cSrcweir if ( xText.is() ) 1543*cdf0e10cSrcweir { 1544*cdf0e10cSrcweir exportText( xText, sal_True, bIsProgress, bExportContent ); 1545*cdf0e10cSrcweir GetExport().GetTextParagraphExport() 1546*cdf0e10cSrcweir ->collectTextAutoStyles( xText ); 1547*cdf0e10cSrcweir } 1548*cdf0e10cSrcweir } 1549*cdf0e10cSrcweir catch (Exception&) 1550*cdf0e10cSrcweir { 1551*cdf0e10cSrcweir } 1552*cdf0e10cSrcweir } 1553*cdf0e10cSrcweir } 1554*cdf0e10cSrcweir 1555*cdf0e10cSrcweir // Export text frames: 1556*cdf0e10cSrcweir Reference<XEnumeration> xTextFramesEnum = pBoundFrameSets->GetTexts()->createEnumeration(); 1557*cdf0e10cSrcweir if(xTextFramesEnum.is()) 1558*cdf0e10cSrcweir while(xTextFramesEnum->hasMoreElements()) 1559*cdf0e10cSrcweir { 1560*cdf0e10cSrcweir Reference<XTextContent> xTxtCntnt(xTextFramesEnum->nextElement(), UNO_QUERY); 1561*cdf0e10cSrcweir if(xTxtCntnt.is()) 1562*cdf0e10cSrcweir exportTextFrame(xTxtCntnt, bAutoStyles, bIsProgress, bExportContent, 0); 1563*cdf0e10cSrcweir } 1564*cdf0e10cSrcweir 1565*cdf0e10cSrcweir // Export graphic objects: 1566*cdf0e10cSrcweir Reference<XEnumeration> xGraphicsEnum = pBoundFrameSets->GetGraphics()->createEnumeration(); 1567*cdf0e10cSrcweir if(xGraphicsEnum.is()) 1568*cdf0e10cSrcweir while(xGraphicsEnum->hasMoreElements()) 1569*cdf0e10cSrcweir { 1570*cdf0e10cSrcweir Reference<XTextContent> xTxtCntnt(xGraphicsEnum->nextElement(), UNO_QUERY); 1571*cdf0e10cSrcweir if(xTxtCntnt.is()) 1572*cdf0e10cSrcweir exportTextGraphic(xTxtCntnt, true, 0); 1573*cdf0e10cSrcweir } 1574*cdf0e10cSrcweir 1575*cdf0e10cSrcweir // Export embedded objects: 1576*cdf0e10cSrcweir Reference<XEnumeration> xEmbeddedsEnum = pBoundFrameSets->GetEmbeddeds()->createEnumeration(); 1577*cdf0e10cSrcweir if(xEmbeddedsEnum.is()) 1578*cdf0e10cSrcweir while(xEmbeddedsEnum->hasMoreElements()) 1579*cdf0e10cSrcweir { 1580*cdf0e10cSrcweir Reference<XTextContent> xTxtCntnt(xEmbeddedsEnum->nextElement(), UNO_QUERY); 1581*cdf0e10cSrcweir if(xTxtCntnt.is()) 1582*cdf0e10cSrcweir exportTextEmbedded(xTxtCntnt, true, 0); 1583*cdf0e10cSrcweir } 1584*cdf0e10cSrcweir 1585*cdf0e10cSrcweir // Export shapes: 1586*cdf0e10cSrcweir Reference<XEnumeration> xShapesEnum = pBoundFrameSets->GetShapes()->createEnumeration(); 1587*cdf0e10cSrcweir if(xShapesEnum.is()) 1588*cdf0e10cSrcweir while(xShapesEnum->hasMoreElements()) 1589*cdf0e10cSrcweir { 1590*cdf0e10cSrcweir Reference<XTextContent> xTxtCntnt(xShapesEnum->nextElement(), UNO_QUERY); 1591*cdf0e10cSrcweir if(xTxtCntnt.is()) 1592*cdf0e10cSrcweir { 1593*cdf0e10cSrcweir Reference<XServiceInfo> xServiceInfo(xTxtCntnt, UNO_QUERY); 1594*cdf0e10cSrcweir if( xServiceInfo->supportsService(sShapeService)) 1595*cdf0e10cSrcweir exportShape(xTxtCntnt, true, 0); 1596*cdf0e10cSrcweir } 1597*cdf0e10cSrcweir } 1598*cdf0e10cSrcweir 1599*cdf0e10cSrcweir sal_Int32 nCount; 1600*cdf0e10cSrcweir // AutoStyles for sections 1601*cdf0e10cSrcweir Reference< XTextSectionsSupplier > xSectionsSupp( GetExport().GetModel(), UNO_QUERY ); 1602*cdf0e10cSrcweir if ( xSectionsSupp.is() ) 1603*cdf0e10cSrcweir { 1604*cdf0e10cSrcweir Reference< XIndexAccess > xSections( xSectionsSupp->getTextSections(), UNO_QUERY ); 1605*cdf0e10cSrcweir if ( xSections.is() ) 1606*cdf0e10cSrcweir { 1607*cdf0e10cSrcweir nCount = xSections->getCount(); 1608*cdf0e10cSrcweir for( sal_Int32 i = 0; i < nCount; ++i ) 1609*cdf0e10cSrcweir { 1610*cdf0e10cSrcweir Any aAny = xSections->getByIndex( i ); 1611*cdf0e10cSrcweir Reference< XTextSection > xSection = *(Reference<XTextSection>*)aAny.getValue(); 1612*cdf0e10cSrcweir Reference < XPropertySet > xPSet( xSection, uno::UNO_QUERY ); 1613*cdf0e10cSrcweir Add( XML_STYLE_FAMILY_TEXT_SECTION, xPSet ); 1614*cdf0e10cSrcweir } 1615*cdf0e10cSrcweir } 1616*cdf0e10cSrcweir } 1617*cdf0e10cSrcweir 1618*cdf0e10cSrcweir // AutoStyles for tables (Note: suppress autostyle collection for paragraphs in exportTable) 1619*cdf0e10cSrcweir Reference< XTextTablesSupplier > xTablesSupp( GetExport().GetModel(), UNO_QUERY ); 1620*cdf0e10cSrcweir if ( xTablesSupp.is() ) 1621*cdf0e10cSrcweir { 1622*cdf0e10cSrcweir Reference< XIndexAccess > xTables( xTablesSupp->getTextTables(), UNO_QUERY ); 1623*cdf0e10cSrcweir if ( xTables.is() ) 1624*cdf0e10cSrcweir { 1625*cdf0e10cSrcweir nCount = xTables->getCount(); 1626*cdf0e10cSrcweir for( sal_Int32 i = 0; i < nCount; ++i ) 1627*cdf0e10cSrcweir { 1628*cdf0e10cSrcweir Any aAny = xTables->getByIndex( i ); 1629*cdf0e10cSrcweir Reference< XTextTable > xTable = *(Reference<XTextTable>*)aAny.getValue(); 1630*cdf0e10cSrcweir Reference < XTextContent > xTextContent( xTable, uno::UNO_QUERY ); 1631*cdf0e10cSrcweir exportTable( xTextContent, sal_True, sal_True ); 1632*cdf0e10cSrcweir } 1633*cdf0e10cSrcweir } 1634*cdf0e10cSrcweir } 1635*cdf0e10cSrcweir 1636*cdf0e10cSrcweir Reference< XNumberingRulesSupplier > xNumberingRulesSupp( GetExport().GetModel(), UNO_QUERY ); 1637*cdf0e10cSrcweir if ( xNumberingRulesSupp.is() ) 1638*cdf0e10cSrcweir { 1639*cdf0e10cSrcweir Reference< XIndexAccess > xNumberingRules = xNumberingRulesSupp->getNumberingRules(); 1640*cdf0e10cSrcweir nCount = xNumberingRules->getCount(); 1641*cdf0e10cSrcweir // --> OD 2007-01-12 #i73361# 1642*cdf0e10cSrcweir const OUString sNumberingIsOutline( RTL_CONSTASCII_USTRINGPARAM( "NumberingIsOutline" ) ); 1643*cdf0e10cSrcweir // <-- 1644*cdf0e10cSrcweir for( sal_Int32 i = 0; i < nCount; ++i ) 1645*cdf0e10cSrcweir { 1646*cdf0e10cSrcweir Reference< XIndexReplace > xNumRule( xNumberingRules->getByIndex( i ), UNO_QUERY ); 1647*cdf0e10cSrcweir if( xNumRule.is() && xNumRule->getCount() ) 1648*cdf0e10cSrcweir { 1649*cdf0e10cSrcweir Reference < XNamed > xNamed( xNumRule, UNO_QUERY ); 1650*cdf0e10cSrcweir OUString sName; 1651*cdf0e10cSrcweir if( xNamed.is() ) 1652*cdf0e10cSrcweir sName = xNamed->getName(); 1653*cdf0e10cSrcweir sal_Bool bAdd = !sName.getLength(); 1654*cdf0e10cSrcweir if( !bAdd ) 1655*cdf0e10cSrcweir { 1656*cdf0e10cSrcweir Reference < XPropertySet > xNumPropSet( xNumRule, 1657*cdf0e10cSrcweir UNO_QUERY ); 1658*cdf0e10cSrcweir const OUString sIsAutomatic( RTL_CONSTASCII_USTRINGPARAM( "IsAutomatic" ) ); 1659*cdf0e10cSrcweir if( xNumPropSet.is() && 1660*cdf0e10cSrcweir xNumPropSet->getPropertySetInfo() 1661*cdf0e10cSrcweir ->hasPropertyByName( sIsAutomatic ) ) 1662*cdf0e10cSrcweir { 1663*cdf0e10cSrcweir bAdd = *(sal_Bool *)xNumPropSet->getPropertyValue( sIsAutomatic ).getValue(); 1664*cdf0e10cSrcweir // --> OD 2007-01-12 #i73361# - check on outline style 1665*cdf0e10cSrcweir if ( bAdd && 1666*cdf0e10cSrcweir xNumPropSet->getPropertySetInfo() 1667*cdf0e10cSrcweir ->hasPropertyByName( sNumberingIsOutline ) ) 1668*cdf0e10cSrcweir { 1669*cdf0e10cSrcweir bAdd = !(*(sal_Bool *)xNumPropSet->getPropertyValue( sNumberingIsOutline ).getValue()); 1670*cdf0e10cSrcweir } 1671*cdf0e10cSrcweir // <-- 1672*cdf0e10cSrcweir } 1673*cdf0e10cSrcweir else 1674*cdf0e10cSrcweir { 1675*cdf0e10cSrcweir bAdd = sal_True; 1676*cdf0e10cSrcweir } 1677*cdf0e10cSrcweir } 1678*cdf0e10cSrcweir if( bAdd ) 1679*cdf0e10cSrcweir pListAutoPool->Add( xNumRule ); 1680*cdf0e10cSrcweir } 1681*cdf0e10cSrcweir } 1682*cdf0e10cSrcweir } 1683*cdf0e10cSrcweir 1684*cdf0e10cSrcweir return true; 1685*cdf0e10cSrcweir } 1686*cdf0e10cSrcweir 1687*cdf0e10cSrcweir void XMLTextParagraphExport::exportText( 1688*cdf0e10cSrcweir const Reference < XText > & rText, 1689*cdf0e10cSrcweir sal_Bool bAutoStyles, 1690*cdf0e10cSrcweir sal_Bool bIsProgress, 1691*cdf0e10cSrcweir sal_Bool bExportParagraph ) 1692*cdf0e10cSrcweir { 1693*cdf0e10cSrcweir if( bAutoStyles ) 1694*cdf0e10cSrcweir GetExport().GetShapeExport(); // make sure the graphics styles family 1695*cdf0e10cSrcweir // is added 1696*cdf0e10cSrcweir Reference < XEnumerationAccess > xEA( rText, UNO_QUERY ); 1697*cdf0e10cSrcweir Reference < XEnumeration > xParaEnum(xEA->createEnumeration()); 1698*cdf0e10cSrcweir Reference < XPropertySet > xPropertySet( rText, UNO_QUERY ); 1699*cdf0e10cSrcweir Reference < XTextSection > xBaseSection; 1700*cdf0e10cSrcweir 1701*cdf0e10cSrcweir // #97718# footnotes don't supply paragraph enumerations in some cases 1702*cdf0e10cSrcweir // This is always a bug, but at least we don't want to crash. 1703*cdf0e10cSrcweir DBG_ASSERT( xParaEnum.is(), "We need a paragraph enumeration" ); 1704*cdf0e10cSrcweir if( ! xParaEnum.is() ) 1705*cdf0e10cSrcweir return; 1706*cdf0e10cSrcweir 1707*cdf0e10cSrcweir sal_Bool bExportLevels = sal_True; 1708*cdf0e10cSrcweir 1709*cdf0e10cSrcweir if (xPropertySet.is()) 1710*cdf0e10cSrcweir { 1711*cdf0e10cSrcweir Reference < XPropertySetInfo > xInfo ( xPropertySet->getPropertySetInfo() ); 1712*cdf0e10cSrcweir 1713*cdf0e10cSrcweir if( xInfo.is() ) 1714*cdf0e10cSrcweir { 1715*cdf0e10cSrcweir if (xInfo->hasPropertyByName( sTextSection )) 1716*cdf0e10cSrcweir { 1717*cdf0e10cSrcweir xPropertySet->getPropertyValue(sTextSection) >>= xBaseSection ; 1718*cdf0e10cSrcweir } 1719*cdf0e10cSrcweir 1720*cdf0e10cSrcweir /* #i35937# 1721*cdf0e10cSrcweir // for applications that use the outliner we need to check if 1722*cdf0e10cSrcweir // the current text object needs the level information exported 1723*cdf0e10cSrcweir if( !bAutoStyles ) 1724*cdf0e10cSrcweir { 1725*cdf0e10cSrcweir // fixme: move string to class member, couldn't do now because 1726*cdf0e10cSrcweir // of no incompatible build 1727*cdf0e10cSrcweir OUString sHasLevels( RTL_CONSTASCII_USTRINGPARAM("HasLevels") ); 1728*cdf0e10cSrcweir if (xInfo->hasPropertyByName( sHasLevels ) ) 1729*cdf0e10cSrcweir { 1730*cdf0e10cSrcweir xPropertySet->getPropertyValue(sHasLevels) >>= bExportLevels; 1731*cdf0e10cSrcweir } 1732*cdf0e10cSrcweir } 1733*cdf0e10cSrcweir */ 1734*cdf0e10cSrcweir } 1735*cdf0e10cSrcweir } 1736*cdf0e10cSrcweir 1737*cdf0e10cSrcweir // #96530# Export redlines at start & end of XText before & after 1738*cdf0e10cSrcweir // exporting the text content enumeration 1739*cdf0e10cSrcweir if( !bAutoStyles && (pRedlineExport != NULL) ) 1740*cdf0e10cSrcweir pRedlineExport->ExportStartOrEndRedline( xPropertySet, sal_True ); 1741*cdf0e10cSrcweir exportTextContentEnumeration( xParaEnum, bAutoStyles, xBaseSection, 1742*cdf0e10cSrcweir bIsProgress, bExportParagraph, 0, bExportLevels ); 1743*cdf0e10cSrcweir if( !bAutoStyles && (pRedlineExport != NULL) ) 1744*cdf0e10cSrcweir pRedlineExport->ExportStartOrEndRedline( xPropertySet, sal_False ); 1745*cdf0e10cSrcweir } 1746*cdf0e10cSrcweir 1747*cdf0e10cSrcweir void XMLTextParagraphExport::exportText( 1748*cdf0e10cSrcweir const Reference < XText > & rText, 1749*cdf0e10cSrcweir const Reference < XTextSection > & rBaseSection, 1750*cdf0e10cSrcweir sal_Bool bAutoStyles, 1751*cdf0e10cSrcweir sal_Bool bIsProgress, 1752*cdf0e10cSrcweir sal_Bool bExportParagraph ) 1753*cdf0e10cSrcweir { 1754*cdf0e10cSrcweir if( bAutoStyles ) 1755*cdf0e10cSrcweir GetExport().GetShapeExport(); // make sure the graphics styles family 1756*cdf0e10cSrcweir // is added 1757*cdf0e10cSrcweir Reference < XEnumerationAccess > xEA( rText, UNO_QUERY ); 1758*cdf0e10cSrcweir Reference < XEnumeration > xParaEnum(xEA->createEnumeration()); 1759*cdf0e10cSrcweir 1760*cdf0e10cSrcweir // #98165# don't continue without a paragraph enumeration 1761*cdf0e10cSrcweir if( ! xParaEnum.is() ) 1762*cdf0e10cSrcweir return; 1763*cdf0e10cSrcweir 1764*cdf0e10cSrcweir // #96530# Export redlines at start & end of XText before & after 1765*cdf0e10cSrcweir // exporting the text content enumeration 1766*cdf0e10cSrcweir Reference<XPropertySet> xPropertySet; 1767*cdf0e10cSrcweir if( !bAutoStyles && (pRedlineExport != NULL) ) 1768*cdf0e10cSrcweir { 1769*cdf0e10cSrcweir xPropertySet.set(rText, uno::UNO_QUERY ); 1770*cdf0e10cSrcweir pRedlineExport->ExportStartOrEndRedline( xPropertySet, sal_True ); 1771*cdf0e10cSrcweir } 1772*cdf0e10cSrcweir exportTextContentEnumeration( xParaEnum, bAutoStyles, rBaseSection, 1773*cdf0e10cSrcweir bIsProgress, bExportParagraph ); 1774*cdf0e10cSrcweir if( !bAutoStyles && (pRedlineExport != NULL) ) 1775*cdf0e10cSrcweir pRedlineExport->ExportStartOrEndRedline( xPropertySet, sal_False ); 1776*cdf0e10cSrcweir } 1777*cdf0e10cSrcweir 1778*cdf0e10cSrcweir sal_Bool XMLTextParagraphExport::exportTextContentEnumeration( 1779*cdf0e10cSrcweir const Reference < XEnumeration > & rContEnum, 1780*cdf0e10cSrcweir sal_Bool bAutoStyles, 1781*cdf0e10cSrcweir const Reference < XTextSection > & rBaseSection, 1782*cdf0e10cSrcweir sal_Bool bIsProgress, 1783*cdf0e10cSrcweir sal_Bool bExportParagraph, 1784*cdf0e10cSrcweir const Reference < XPropertySet > *pRangePropSet, 1785*cdf0e10cSrcweir sal_Bool bExportLevels ) 1786*cdf0e10cSrcweir { 1787*cdf0e10cSrcweir DBG_ASSERT( rContEnum.is(), "No enumeration to export!" ); 1788*cdf0e10cSrcweir sal_Bool bHasMoreElements = rContEnum->hasMoreElements(); 1789*cdf0e10cSrcweir if( !bHasMoreElements ) 1790*cdf0e10cSrcweir return sal_False; 1791*cdf0e10cSrcweir 1792*cdf0e10cSrcweir XMLTextNumRuleInfo aPrevNumInfo; 1793*cdf0e10cSrcweir XMLTextNumRuleInfo aNextNumInfo; 1794*cdf0e10cSrcweir 1795*cdf0e10cSrcweir sal_Bool bHasContent = sal_False; 1796*cdf0e10cSrcweir Reference<XTextSection> xCurrentTextSection(rBaseSection); 1797*cdf0e10cSrcweir 1798*cdf0e10cSrcweir MultiPropertySetHelper aPropSetHelper( 1799*cdf0e10cSrcweir bAutoStyles ? aParagraphPropertyNamesAuto : 1800*cdf0e10cSrcweir aParagraphPropertyNames ); 1801*cdf0e10cSrcweir 1802*cdf0e10cSrcweir sal_Bool bHoldElement = sal_False; 1803*cdf0e10cSrcweir Reference < XTextContent > xTxtCntnt; 1804*cdf0e10cSrcweir while( bHoldElement || bHasMoreElements ) 1805*cdf0e10cSrcweir { 1806*cdf0e10cSrcweir if (bHoldElement) 1807*cdf0e10cSrcweir { 1808*cdf0e10cSrcweir bHoldElement = sal_False; 1809*cdf0e10cSrcweir } 1810*cdf0e10cSrcweir else 1811*cdf0e10cSrcweir { 1812*cdf0e10cSrcweir xTxtCntnt.set(rContEnum->nextElement(), uno::UNO_QUERY); 1813*cdf0e10cSrcweir 1814*cdf0e10cSrcweir aPropSetHelper.resetValues(); 1815*cdf0e10cSrcweir 1816*cdf0e10cSrcweir } 1817*cdf0e10cSrcweir 1818*cdf0e10cSrcweir Reference<XServiceInfo> xServiceInfo( xTxtCntnt, UNO_QUERY ); 1819*cdf0e10cSrcweir if( xServiceInfo->supportsService( sParagraphService ) ) 1820*cdf0e10cSrcweir { 1821*cdf0e10cSrcweir if( bExportLevels ) 1822*cdf0e10cSrcweir { 1823*cdf0e10cSrcweir if( bAutoStyles ) 1824*cdf0e10cSrcweir { 1825*cdf0e10cSrcweir exportListAndSectionChange( xCurrentTextSection, xTxtCntnt, 1826*cdf0e10cSrcweir aPrevNumInfo, aNextNumInfo, 1827*cdf0e10cSrcweir bAutoStyles ); 1828*cdf0e10cSrcweir } 1829*cdf0e10cSrcweir else 1830*cdf0e10cSrcweir { 1831*cdf0e10cSrcweir // --> OD 2006-09-27 #i69627# 1832*cdf0e10cSrcweir // --> OD 2008-04-24 #refactorlists# 1833*cdf0e10cSrcweir // pass list auto style pool to <XMLTextNumRuleInfo> instance 1834*cdf0e10cSrcweir // --> OD 2008-11-26 #158694# 1835*cdf0e10cSrcweir // pass info about request to export <text:number> element 1836*cdf0e10cSrcweir // to <XMLTextNumRuleInfo> instance 1837*cdf0e10cSrcweir aNextNumInfo.Set( xTxtCntnt, 1838*cdf0e10cSrcweir GetExport().writeOutlineStyleAsNormalListStyle(), 1839*cdf0e10cSrcweir GetListAutoStylePool(), 1840*cdf0e10cSrcweir GetExport().exportTextNumberElement() ); 1841*cdf0e10cSrcweir // <-- 1842*cdf0e10cSrcweir 1843*cdf0e10cSrcweir exportListAndSectionChange( xCurrentTextSection, aPropSetHelper, 1844*cdf0e10cSrcweir TEXT_SECTION, xTxtCntnt, 1845*cdf0e10cSrcweir aPrevNumInfo, aNextNumInfo, 1846*cdf0e10cSrcweir bAutoStyles ); 1847*cdf0e10cSrcweir } 1848*cdf0e10cSrcweir } 1849*cdf0e10cSrcweir 1850*cdf0e10cSrcweir // if we found a mute section: skip all section content 1851*cdf0e10cSrcweir if (pSectionExport->IsMuteSection(xCurrentTextSection)) 1852*cdf0e10cSrcweir { 1853*cdf0e10cSrcweir // Make sure headings are exported anyway. 1854*cdf0e10cSrcweir if( !bAutoStyles ) 1855*cdf0e10cSrcweir pSectionExport->ExportMasterDocHeadingDummies(); 1856*cdf0e10cSrcweir 1857*cdf0e10cSrcweir while (rContEnum->hasMoreElements() && 1858*cdf0e10cSrcweir pSectionExport->IsInSection( xCurrentTextSection, 1859*cdf0e10cSrcweir xTxtCntnt, sal_True )) 1860*cdf0e10cSrcweir { 1861*cdf0e10cSrcweir xTxtCntnt.set(rContEnum->nextElement(), uno::UNO_QUERY); 1862*cdf0e10cSrcweir aPropSetHelper.resetValues(); 1863*cdf0e10cSrcweir aNextNumInfo.Reset(); 1864*cdf0e10cSrcweir } 1865*cdf0e10cSrcweir // the first non-mute element still needs to be processed 1866*cdf0e10cSrcweir bHoldElement = 1867*cdf0e10cSrcweir ! pSectionExport->IsInSection( xCurrentTextSection, 1868*cdf0e10cSrcweir xTxtCntnt, sal_False ); 1869*cdf0e10cSrcweir } 1870*cdf0e10cSrcweir else 1871*cdf0e10cSrcweir exportParagraph( xTxtCntnt, bAutoStyles, bIsProgress, 1872*cdf0e10cSrcweir bExportParagraph, aPropSetHelper ); 1873*cdf0e10cSrcweir bHasContent = sal_True; 1874*cdf0e10cSrcweir } 1875*cdf0e10cSrcweir else if( xServiceInfo->supportsService( sTableService ) ) 1876*cdf0e10cSrcweir { 1877*cdf0e10cSrcweir if( !bAutoStyles ) 1878*cdf0e10cSrcweir { 1879*cdf0e10cSrcweir aNextNumInfo.Reset(); 1880*cdf0e10cSrcweir } 1881*cdf0e10cSrcweir 1882*cdf0e10cSrcweir exportListAndSectionChange( xCurrentTextSection, xTxtCntnt, 1883*cdf0e10cSrcweir aPrevNumInfo, aNextNumInfo, 1884*cdf0e10cSrcweir bAutoStyles ); 1885*cdf0e10cSrcweir 1886*cdf0e10cSrcweir if (! pSectionExport->IsMuteSection(xCurrentTextSection)) 1887*cdf0e10cSrcweir { 1888*cdf0e10cSrcweir // export start + end redlines (for wholly redlined tables) 1889*cdf0e10cSrcweir if ((! bAutoStyles) && (NULL != pRedlineExport)) 1890*cdf0e10cSrcweir pRedlineExport->ExportStartOrEndRedline(xTxtCntnt, sal_True); 1891*cdf0e10cSrcweir 1892*cdf0e10cSrcweir exportTable( xTxtCntnt, bAutoStyles, bIsProgress ); 1893*cdf0e10cSrcweir 1894*cdf0e10cSrcweir if ((! bAutoStyles) && (NULL != pRedlineExport)) 1895*cdf0e10cSrcweir pRedlineExport->ExportStartOrEndRedline(xTxtCntnt, sal_False); 1896*cdf0e10cSrcweir } 1897*cdf0e10cSrcweir else if( !bAutoStyles ) 1898*cdf0e10cSrcweir { 1899*cdf0e10cSrcweir // Make sure headings are exported anyway. 1900*cdf0e10cSrcweir pSectionExport->ExportMasterDocHeadingDummies(); 1901*cdf0e10cSrcweir } 1902*cdf0e10cSrcweir 1903*cdf0e10cSrcweir bHasContent = sal_True; 1904*cdf0e10cSrcweir } 1905*cdf0e10cSrcweir else if( xServiceInfo->supportsService( sTextFrameService ) ) 1906*cdf0e10cSrcweir { 1907*cdf0e10cSrcweir exportTextFrame( xTxtCntnt, bAutoStyles, bIsProgress, sal_True, pRangePropSet ); 1908*cdf0e10cSrcweir } 1909*cdf0e10cSrcweir else if( xServiceInfo->supportsService( sTextGraphicService ) ) 1910*cdf0e10cSrcweir { 1911*cdf0e10cSrcweir exportTextGraphic( xTxtCntnt, bAutoStyles, pRangePropSet ); 1912*cdf0e10cSrcweir } 1913*cdf0e10cSrcweir else if( xServiceInfo->supportsService( sTextEmbeddedService ) ) 1914*cdf0e10cSrcweir { 1915*cdf0e10cSrcweir exportTextEmbedded( xTxtCntnt, bAutoStyles, pRangePropSet ); 1916*cdf0e10cSrcweir } 1917*cdf0e10cSrcweir else if( xServiceInfo->supportsService( sShapeService ) ) 1918*cdf0e10cSrcweir { 1919*cdf0e10cSrcweir exportShape( xTxtCntnt, bAutoStyles, pRangePropSet ); 1920*cdf0e10cSrcweir } 1921*cdf0e10cSrcweir else 1922*cdf0e10cSrcweir { 1923*cdf0e10cSrcweir DBG_ASSERT( !xTxtCntnt.is(), "unknown text content" ); 1924*cdf0e10cSrcweir } 1925*cdf0e10cSrcweir 1926*cdf0e10cSrcweir if( !bAutoStyles ) 1927*cdf0e10cSrcweir { 1928*cdf0e10cSrcweir aPrevNumInfo = aNextNumInfo; 1929*cdf0e10cSrcweir } 1930*cdf0e10cSrcweir 1931*cdf0e10cSrcweir bHasMoreElements = rContEnum->hasMoreElements(); 1932*cdf0e10cSrcweir } 1933*cdf0e10cSrcweir 1934*cdf0e10cSrcweir if( bExportLevels && bHasContent && !bAutoStyles ) 1935*cdf0e10cSrcweir { 1936*cdf0e10cSrcweir aNextNumInfo.Reset(); 1937*cdf0e10cSrcweir 1938*cdf0e10cSrcweir // close open lists and sections; no new styles 1939*cdf0e10cSrcweir exportListAndSectionChange( xCurrentTextSection, rBaseSection, 1940*cdf0e10cSrcweir aPrevNumInfo, aNextNumInfo, 1941*cdf0e10cSrcweir bAutoStyles ); 1942*cdf0e10cSrcweir } 1943*cdf0e10cSrcweir 1944*cdf0e10cSrcweir return sal_True; 1945*cdf0e10cSrcweir } 1946*cdf0e10cSrcweir 1947*cdf0e10cSrcweir void XMLTextParagraphExport::exportParagraph( 1948*cdf0e10cSrcweir const Reference < XTextContent > & rTextContent, 1949*cdf0e10cSrcweir sal_Bool bAutoStyles, sal_Bool bIsProgress, sal_Bool bExportParagraph, 1950*cdf0e10cSrcweir MultiPropertySetHelper& rPropSetHelper) 1951*cdf0e10cSrcweir { 1952*cdf0e10cSrcweir sal_Int16 nOutlineLevel = -1; 1953*cdf0e10cSrcweir 1954*cdf0e10cSrcweir if( bIsProgress ) 1955*cdf0e10cSrcweir { 1956*cdf0e10cSrcweir ProgressBarHelper *pProgress = GetExport().GetProgressBarHelper(); 1957*cdf0e10cSrcweir pProgress->SetValue( pProgress->GetValue()+1 ); 1958*cdf0e10cSrcweir } 1959*cdf0e10cSrcweir 1960*cdf0e10cSrcweir // get property set or multi property set and initialize helper 1961*cdf0e10cSrcweir Reference<XMultiPropertySet> xMultiPropSet( rTextContent, UNO_QUERY ); 1962*cdf0e10cSrcweir Reference<XPropertySet> xPropSet( rTextContent, UNO_QUERY ); 1963*cdf0e10cSrcweir 1964*cdf0e10cSrcweir // check for supported properties 1965*cdf0e10cSrcweir if( !rPropSetHelper.checkedProperties() ) 1966*cdf0e10cSrcweir rPropSetHelper.hasProperties( xPropSet->getPropertySetInfo() ); 1967*cdf0e10cSrcweir 1968*cdf0e10cSrcweir // if( xMultiPropSet.is() ) 1969*cdf0e10cSrcweir // rPropSetHelper.getValues( xMultiPropSet ); 1970*cdf0e10cSrcweir // else 1971*cdf0e10cSrcweir // rPropSetHelper.getValues( xPropSet ); 1972*cdf0e10cSrcweir 1973*cdf0e10cSrcweir if( bExportParagraph ) 1974*cdf0e10cSrcweir { 1975*cdf0e10cSrcweir if( bAutoStyles ) 1976*cdf0e10cSrcweir { 1977*cdf0e10cSrcweir Add( XML_STYLE_FAMILY_TEXT_PARAGRAPH, rPropSetHelper, xPropSet ); 1978*cdf0e10cSrcweir } 1979*cdf0e10cSrcweir else 1980*cdf0e10cSrcweir { 1981*cdf0e10cSrcweir // xml:id for RDF metadata 1982*cdf0e10cSrcweir GetExport().AddAttributeXmlId(rTextContent); 1983*cdf0e10cSrcweir GetExport().AddAttributesRDFa(rTextContent); 1984*cdf0e10cSrcweir 1985*cdf0e10cSrcweir OUString sStyle; 1986*cdf0e10cSrcweir if( rPropSetHelper.hasProperty( PARA_STYLE_NAME ) ) 1987*cdf0e10cSrcweir { 1988*cdf0e10cSrcweir if( xMultiPropSet.is() ) 1989*cdf0e10cSrcweir rPropSetHelper.getValue( PARA_STYLE_NAME, 1990*cdf0e10cSrcweir xMultiPropSet ) >>= sStyle; 1991*cdf0e10cSrcweir else 1992*cdf0e10cSrcweir rPropSetHelper.getValue( PARA_STYLE_NAME, 1993*cdf0e10cSrcweir xPropSet ) >>= sStyle; 1994*cdf0e10cSrcweir } 1995*cdf0e10cSrcweir 1996*cdf0e10cSrcweir Reference< XInterface > xRef( rTextContent, UNO_QUERY ); 1997*cdf0e10cSrcweir if( xRef.is() ) 1998*cdf0e10cSrcweir { 1999*cdf0e10cSrcweir const OUString& rIdentifier = GetExport().getInterfaceToIdentifierMapper().getIdentifier( xRef ); 2000*cdf0e10cSrcweir if( rIdentifier.getLength() ) 2001*cdf0e10cSrcweir { 2002*cdf0e10cSrcweir // FIXME: this is just temporary until EditEngine 2003*cdf0e10cSrcweir // paragraphs implement XMetadatable. 2004*cdf0e10cSrcweir // then that must be used and not the mapper, because 2005*cdf0e10cSrcweir // when both can be used we get two xml:id! 2006*cdf0e10cSrcweir uno::Reference<rdf::XMetadatable> const xMeta(xRef, 2007*cdf0e10cSrcweir uno::UNO_QUERY); 2008*cdf0e10cSrcweir OSL_ENSURE(!xMeta.is(), "paragraph that implements " 2009*cdf0e10cSrcweir "XMetadatable used in interfaceToIdentifierMapper?"); 2010*cdf0e10cSrcweir GetExport().AddAttributeIdLegacy(XML_NAMESPACE_TEXT, 2011*cdf0e10cSrcweir rIdentifier); 2012*cdf0e10cSrcweir } 2013*cdf0e10cSrcweir } 2014*cdf0e10cSrcweir 2015*cdf0e10cSrcweir OUString sAutoStyle( sStyle ); 2016*cdf0e10cSrcweir sAutoStyle = Find( XML_STYLE_FAMILY_TEXT_PARAGRAPH, xPropSet, sStyle ); 2017*cdf0e10cSrcweir if( sAutoStyle.getLength() ) 2018*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_STYLE_NAME, 2019*cdf0e10cSrcweir GetExport().EncodeStyleName( sAutoStyle ) ); 2020*cdf0e10cSrcweir 2021*cdf0e10cSrcweir if( rPropSetHelper.hasProperty( PARA_CONDITIONAL_STYLE_NAME ) ) 2022*cdf0e10cSrcweir { 2023*cdf0e10cSrcweir OUString sCondStyle; 2024*cdf0e10cSrcweir if( xMultiPropSet.is() ) 2025*cdf0e10cSrcweir rPropSetHelper.getValue( PARA_CONDITIONAL_STYLE_NAME, 2026*cdf0e10cSrcweir xMultiPropSet ) >>= sCondStyle; 2027*cdf0e10cSrcweir else 2028*cdf0e10cSrcweir rPropSetHelper.getValue( PARA_CONDITIONAL_STYLE_NAME, 2029*cdf0e10cSrcweir xPropSet ) >>= sCondStyle; 2030*cdf0e10cSrcweir if( sCondStyle != sStyle ) 2031*cdf0e10cSrcweir { 2032*cdf0e10cSrcweir sCondStyle = Find( XML_STYLE_FAMILY_TEXT_PARAGRAPH, xPropSet, 2033*cdf0e10cSrcweir sCondStyle ); 2034*cdf0e10cSrcweir if( sCondStyle.getLength() ) 2035*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_TEXT, 2036*cdf0e10cSrcweir XML_COND_STYLE_NAME, 2037*cdf0e10cSrcweir GetExport().EncodeStyleName( sCondStyle ) ); 2038*cdf0e10cSrcweir } 2039*cdf0e10cSrcweir } 2040*cdf0e10cSrcweir 2041*cdf0e10cSrcweir //if( rPropSetHelper.hasProperty( PARA_CHAPTER_NUMERBING_LEVEL ) ) //#outline level,zhaojianwei 2042*cdf0e10cSrcweir if( rPropSetHelper.hasProperty( PARA_OUTLINE_LEVEL ) ) //<-end 2043*cdf0e10cSrcweir { 2044*cdf0e10cSrcweir if( xMultiPropSet.is() ) 2045*cdf0e10cSrcweir //rPropSetHelper.getValue( PARA_CHAPTER_NUMERBING_LEVEL, //#outline level,zhaojianwei 2046*cdf0e10cSrcweir rPropSetHelper.getValue( PARA_OUTLINE_LEVEL, //<-end 2047*cdf0e10cSrcweir xMultiPropSet ) >>= nOutlineLevel; 2048*cdf0e10cSrcweir else 2049*cdf0e10cSrcweir //rPropSetHelper.getValue( PARA_CHAPTER_NUMERBING_LEVEL, //#outline level,zhaojianwei 2050*cdf0e10cSrcweir rPropSetHelper.getValue( PARA_OUTLINE_LEVEL, //<-end 2051*cdf0e10cSrcweir xPropSet ) >>= nOutlineLevel; 2052*cdf0e10cSrcweir 2053*cdf0e10cSrcweir //if( -1 != nOutlineLevel ) //#outline level,zhaojianwei 2054*cdf0e10cSrcweir if( 0 < nOutlineLevel ) //<-end,zhaojianwei 2055*cdf0e10cSrcweir { 2056*cdf0e10cSrcweir OUStringBuffer sTmp; 2057*cdf0e10cSrcweir //sTmp.append( sal_Int32( nOutlineLevel + 1 ) ); //#outline level,zhaojianwei 2058*cdf0e10cSrcweir sTmp.append( sal_Int32( nOutlineLevel) ); //<-end,zhaojianwei 2059*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_TEXT, 2060*cdf0e10cSrcweir XML_OUTLINE_LEVEL, 2061*cdf0e10cSrcweir sTmp.makeStringAndClear() ); 2062*cdf0e10cSrcweir 2063*cdf0e10cSrcweir if( rPropSetHelper.hasProperty( NUMBERING_IS_NUMBER ) ) 2064*cdf0e10cSrcweir { 2065*cdf0e10cSrcweir bool bIsNumber = false; 2066*cdf0e10cSrcweir if( xMultiPropSet.is() ) 2067*cdf0e10cSrcweir rPropSetHelper.getValue( 2068*cdf0e10cSrcweir NUMBERING_IS_NUMBER, xMultiPropSet ) >>= bIsNumber; 2069*cdf0e10cSrcweir else 2070*cdf0e10cSrcweir rPropSetHelper.getValue( 2071*cdf0e10cSrcweir NUMBERING_IS_NUMBER, xPropSet ) >>= bIsNumber; 2072*cdf0e10cSrcweir 2073*cdf0e10cSrcweir OUString sListStyleName; 2074*cdf0e10cSrcweir if( xMultiPropSet.is() ) 2075*cdf0e10cSrcweir rPropSetHelper.getValue( 2076*cdf0e10cSrcweir PARA_NUMBERING_STYLENAME, xMultiPropSet ) >>= sListStyleName; 2077*cdf0e10cSrcweir else 2078*cdf0e10cSrcweir rPropSetHelper.getValue( 2079*cdf0e10cSrcweir PARA_NUMBERING_STYLENAME, xPropSet ) >>= sListStyleName; 2080*cdf0e10cSrcweir 2081*cdf0e10cSrcweir 2082*cdf0e10cSrcweir 2083*cdf0e10cSrcweir bool bAssignedtoOutlineStyle = false;//#outline level,add by zhaojianwei 2084*cdf0e10cSrcweir { 2085*cdf0e10cSrcweir Reference< XChapterNumberingSupplier > xCNSupplier( GetExport().GetModel(), UNO_QUERY ); 2086*cdf0e10cSrcweir 2087*cdf0e10cSrcweir OUString sOutlineName; 2088*cdf0e10cSrcweir if (xCNSupplier.is()) 2089*cdf0e10cSrcweir { 2090*cdf0e10cSrcweir Reference< XIndexReplace > xNumRule ( xCNSupplier->getChapterNumberingRules() ); 2091*cdf0e10cSrcweir DBG_ASSERT( xNumRule.is(), "no chapter numbering rules" ); 2092*cdf0e10cSrcweir 2093*cdf0e10cSrcweir if (xNumRule.is()) 2094*cdf0e10cSrcweir { 2095*cdf0e10cSrcweir Reference< XPropertySet > xNumRulePropSet( xNumRule, UNO_QUERY ); 2096*cdf0e10cSrcweir xNumRulePropSet->getPropertyValue( 2097*cdf0e10cSrcweir OUString(RTL_CONSTASCII_USTRINGPARAM("Name")) ) >>= sOutlineName; 2098*cdf0e10cSrcweir bAssignedtoOutlineStyle = ( sListStyleName == sOutlineName ); 2099*cdf0e10cSrcweir } 2100*cdf0e10cSrcweir } 2101*cdf0e10cSrcweir 2102*cdf0e10cSrcweir } //<end,zhaojianwei 2103*cdf0e10cSrcweir 2104*cdf0e10cSrcweir //if( ! bIsNumber ) //#outline level,removed by zhaojianwei 2105*cdf0e10cSrcweir if( ! bIsNumber && bAssignedtoOutlineStyle ) //#outline level,add by zhaojianwei 2106*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_TEXT, 2107*cdf0e10cSrcweir XML_IS_LIST_HEADER, 2108*cdf0e10cSrcweir XML_TRUE ); 2109*cdf0e10cSrcweir } 2110*cdf0e10cSrcweir 2111*cdf0e10cSrcweir { 2112*cdf0e10cSrcweir String sParaIsNumberingRestart 2113*cdf0e10cSrcweir (RTL_CONSTASCII_USTRINGPARAM 2114*cdf0e10cSrcweir ("ParaIsNumberingRestart")); 2115*cdf0e10cSrcweir bool bIsRestartNumbering = false; 2116*cdf0e10cSrcweir 2117*cdf0e10cSrcweir Reference< XPropertySetInfo > 2118*cdf0e10cSrcweir xPropSetInfo(xMultiPropSet.is() ? 2119*cdf0e10cSrcweir xMultiPropSet->getPropertySetInfo(): 2120*cdf0e10cSrcweir xPropSet->getPropertySetInfo()); 2121*cdf0e10cSrcweir 2122*cdf0e10cSrcweir if (xPropSetInfo-> 2123*cdf0e10cSrcweir hasPropertyByName(sParaIsNumberingRestart)) 2124*cdf0e10cSrcweir { 2125*cdf0e10cSrcweir xPropSet->getPropertyValue(sParaIsNumberingRestart) 2126*cdf0e10cSrcweir >>= bIsRestartNumbering; 2127*cdf0e10cSrcweir } 2128*cdf0e10cSrcweir 2129*cdf0e10cSrcweir if (bIsRestartNumbering) 2130*cdf0e10cSrcweir { 2131*cdf0e10cSrcweir GetExport().AddAttribute(XML_NAMESPACE_TEXT, 2132*cdf0e10cSrcweir XML_RESTART_NUMBERING, 2133*cdf0e10cSrcweir XML_TRUE); 2134*cdf0e10cSrcweir 2135*cdf0e10cSrcweir String sNumberingStartValue 2136*cdf0e10cSrcweir (RTL_CONSTASCII_USTRINGPARAM 2137*cdf0e10cSrcweir ("NumberingStartValue")); 2138*cdf0e10cSrcweir 2139*cdf0e10cSrcweir 2140*cdf0e10cSrcweir sal_Int32 nStartValue = 0; 2141*cdf0e10cSrcweir 2142*cdf0e10cSrcweir if (xPropSetInfo-> 2143*cdf0e10cSrcweir hasPropertyByName(sNumberingStartValue)) 2144*cdf0e10cSrcweir { 2145*cdf0e10cSrcweir xPropSet->getPropertyValue(sNumberingStartValue) 2146*cdf0e10cSrcweir >>= nStartValue; 2147*cdf0e10cSrcweir 2148*cdf0e10cSrcweir OUStringBuffer sTmpStartValue; 2149*cdf0e10cSrcweir 2150*cdf0e10cSrcweir sTmpStartValue.append(nStartValue); 2151*cdf0e10cSrcweir 2152*cdf0e10cSrcweir GetExport(). 2153*cdf0e10cSrcweir AddAttribute(XML_NAMESPACE_TEXT, 2154*cdf0e10cSrcweir XML_START_VALUE, 2155*cdf0e10cSrcweir sTmpStartValue. 2156*cdf0e10cSrcweir makeStringAndClear()); 2157*cdf0e10cSrcweir } 2158*cdf0e10cSrcweir } 2159*cdf0e10cSrcweir } 2160*cdf0e10cSrcweir } 2161*cdf0e10cSrcweir } 2162*cdf0e10cSrcweir } 2163*cdf0e10cSrcweir } 2164*cdf0e10cSrcweir 2165*cdf0e10cSrcweir Reference < XEnumerationAccess > xEA( rTextContent, UNO_QUERY ); 2166*cdf0e10cSrcweir Reference < XEnumeration > xTextEnum; 2167*cdf0e10cSrcweir xTextEnum = xEA->createEnumeration(); 2168*cdf0e10cSrcweir const sal_Bool bHasPortions = xTextEnum.is(); 2169*cdf0e10cSrcweir 2170*cdf0e10cSrcweir Reference < XEnumeration> xContentEnum; 2171*cdf0e10cSrcweir Reference < XContentEnumerationAccess > xCEA( rTextContent, UNO_QUERY ); 2172*cdf0e10cSrcweir if( xCEA.is() ) 2173*cdf0e10cSrcweir xContentEnum.set(xCEA->createContentEnumeration( sTextContentService )); 2174*cdf0e10cSrcweir const sal_Bool bHasContentEnum = xContentEnum.is() && 2175*cdf0e10cSrcweir xContentEnum->hasMoreElements(); 2176*cdf0e10cSrcweir 2177*cdf0e10cSrcweir Reference < XTextSection > xSection; 2178*cdf0e10cSrcweir if( bHasContentEnum ) 2179*cdf0e10cSrcweir { 2180*cdf0e10cSrcweir // For the auto styles, the multi property set helper is only used 2181*cdf0e10cSrcweir // if hard attributes are existing. Therfor, it seems to be a better 2182*cdf0e10cSrcweir // strategy to have the TextSection property seperate, because otherwise 2183*cdf0e10cSrcweir // we always retrieve the style names even if they are not required. 2184*cdf0e10cSrcweir if( bAutoStyles ) 2185*cdf0e10cSrcweir { 2186*cdf0e10cSrcweir if( xPropSet->getPropertySetInfo()->hasPropertyByName( sTextSection ) ) 2187*cdf0e10cSrcweir { 2188*cdf0e10cSrcweir xSection.set(xPropSet->getPropertyValue( sTextSection ), uno::UNO_QUERY); 2189*cdf0e10cSrcweir } 2190*cdf0e10cSrcweir } 2191*cdf0e10cSrcweir else 2192*cdf0e10cSrcweir { 2193*cdf0e10cSrcweir if( rPropSetHelper.hasProperty( TEXT_SECTION ) ) 2194*cdf0e10cSrcweir { 2195*cdf0e10cSrcweir xSection.set(rPropSetHelper.getValue( TEXT_SECTION ), uno::UNO_QUERY); 2196*cdf0e10cSrcweir } 2197*cdf0e10cSrcweir } 2198*cdf0e10cSrcweir } 2199*cdf0e10cSrcweir 2200*cdf0e10cSrcweir if( bAutoStyles ) 2201*cdf0e10cSrcweir { 2202*cdf0e10cSrcweir sal_Bool bPrevCharIsSpace = sal_True; 2203*cdf0e10cSrcweir if( bHasContentEnum ) 2204*cdf0e10cSrcweir bPrevCharIsSpace = !exportTextContentEnumeration( 2205*cdf0e10cSrcweir xContentEnum, bAutoStyles, xSection, 2206*cdf0e10cSrcweir bIsProgress, sal_True, 0, sal_True ); 2207*cdf0e10cSrcweir if ( bHasPortions ) 2208*cdf0e10cSrcweir exportTextRangeEnumeration( xTextEnum, bAutoStyles, bIsProgress ); 2209*cdf0e10cSrcweir } 2210*cdf0e10cSrcweir else 2211*cdf0e10cSrcweir { 2212*cdf0e10cSrcweir sal_Bool bPrevCharIsSpace = sal_True; 2213*cdf0e10cSrcweir enum XMLTokenEnum eElem = 2214*cdf0e10cSrcweir //-1 == nOutlineLevel ? XML_P : XML_H; //#outline level,zhaojianwei 2215*cdf0e10cSrcweir 0 < nOutlineLevel ? XML_H : XML_P; //<-end,zhaojianwei 2216*cdf0e10cSrcweir SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT, eElem, 2217*cdf0e10cSrcweir sal_True, sal_False ); 2218*cdf0e10cSrcweir if( bHasContentEnum ) 2219*cdf0e10cSrcweir bPrevCharIsSpace = !exportTextContentEnumeration( 2220*cdf0e10cSrcweir xContentEnum, bAutoStyles, xSection, 2221*cdf0e10cSrcweir bIsProgress ); 2222*cdf0e10cSrcweir exportTextRangeEnumeration( xTextEnum, bAutoStyles, bIsProgress, 2223*cdf0e10cSrcweir bPrevCharIsSpace ); 2224*cdf0e10cSrcweir } 2225*cdf0e10cSrcweir } 2226*cdf0e10cSrcweir 2227*cdf0e10cSrcweir void XMLTextParagraphExport::exportTextRangeEnumeration( 2228*cdf0e10cSrcweir const Reference < XEnumeration > & rTextEnum, 2229*cdf0e10cSrcweir sal_Bool bAutoStyles, sal_Bool bIsProgress, 2230*cdf0e10cSrcweir sal_Bool bPrvChrIsSpc ) 2231*cdf0e10cSrcweir { 2232*cdf0e10cSrcweir static OUString sMeta(RTL_CONSTASCII_USTRINGPARAM("InContentMetadata")); 2233*cdf0e10cSrcweir sal_Bool bPrevCharIsSpace = bPrvChrIsSpc; 2234*cdf0e10cSrcweir 2235*cdf0e10cSrcweir while( rTextEnum->hasMoreElements() ) 2236*cdf0e10cSrcweir { 2237*cdf0e10cSrcweir Reference<XPropertySet> xPropSet(rTextEnum->nextElement(), UNO_QUERY); 2238*cdf0e10cSrcweir Reference < XTextRange > xTxtRange(xPropSet, uno::UNO_QUERY); 2239*cdf0e10cSrcweir Reference<XPropertySetInfo> xPropInfo(xPropSet->getPropertySetInfo()); 2240*cdf0e10cSrcweir 2241*cdf0e10cSrcweir if (xPropInfo->hasPropertyByName(sTextPortionType)) 2242*cdf0e10cSrcweir { 2243*cdf0e10cSrcweir rtl::OUString sType; 2244*cdf0e10cSrcweir xPropSet->getPropertyValue(sTextPortionType) >>= sType; 2245*cdf0e10cSrcweir 2246*cdf0e10cSrcweir if( sType.equals(sText)) 2247*cdf0e10cSrcweir { 2248*cdf0e10cSrcweir exportTextRange( xTxtRange, bAutoStyles, 2249*cdf0e10cSrcweir bPrevCharIsSpace ); 2250*cdf0e10cSrcweir } 2251*cdf0e10cSrcweir else if( sType.equals(sTextField)) 2252*cdf0e10cSrcweir { 2253*cdf0e10cSrcweir exportTextField( xTxtRange, bAutoStyles, bIsProgress ); 2254*cdf0e10cSrcweir bPrevCharIsSpace = sal_False; 2255*cdf0e10cSrcweir } 2256*cdf0e10cSrcweir else if( sType.equals( sFrame ) ) 2257*cdf0e10cSrcweir { 2258*cdf0e10cSrcweir Reference < XEnumeration> xContentEnum; 2259*cdf0e10cSrcweir Reference < XContentEnumerationAccess > xCEA( xTxtRange, 2260*cdf0e10cSrcweir UNO_QUERY ); 2261*cdf0e10cSrcweir if( xCEA.is() ) 2262*cdf0e10cSrcweir xContentEnum.set(xCEA->createContentEnumeration( 2263*cdf0e10cSrcweir sTextContentService )); 2264*cdf0e10cSrcweir // frames are never in sections 2265*cdf0e10cSrcweir Reference<XTextSection> xSection; 2266*cdf0e10cSrcweir if( xContentEnum.is() ) 2267*cdf0e10cSrcweir exportTextContentEnumeration( xContentEnum, 2268*cdf0e10cSrcweir bAutoStyles, 2269*cdf0e10cSrcweir xSection, bIsProgress, sal_True, 2270*cdf0e10cSrcweir &xPropSet ); 2271*cdf0e10cSrcweir 2272*cdf0e10cSrcweir bPrevCharIsSpace = sal_False; 2273*cdf0e10cSrcweir } 2274*cdf0e10cSrcweir else if (sType.equals(sFootnote)) 2275*cdf0e10cSrcweir { 2276*cdf0e10cSrcweir exportTextFootnote(xPropSet, 2277*cdf0e10cSrcweir xTxtRange->getString(), 2278*cdf0e10cSrcweir bAutoStyles, bIsProgress ); 2279*cdf0e10cSrcweir bPrevCharIsSpace = sal_False; 2280*cdf0e10cSrcweir } 2281*cdf0e10cSrcweir else if (sType.equals(sBookmark)) 2282*cdf0e10cSrcweir { 2283*cdf0e10cSrcweir exportTextMark(xPropSet, 2284*cdf0e10cSrcweir sBookmark, 2285*cdf0e10cSrcweir lcl_XmlBookmarkElements, 2286*cdf0e10cSrcweir bAutoStyles); 2287*cdf0e10cSrcweir } 2288*cdf0e10cSrcweir else if (sType.equals(sReferenceMark)) 2289*cdf0e10cSrcweir { 2290*cdf0e10cSrcweir exportTextMark(xPropSet, 2291*cdf0e10cSrcweir sReferenceMark, 2292*cdf0e10cSrcweir lcl_XmlReferenceElements, 2293*cdf0e10cSrcweir bAutoStyles); 2294*cdf0e10cSrcweir } 2295*cdf0e10cSrcweir else if (sType.equals(sDocumentIndexMark)) 2296*cdf0e10cSrcweir { 2297*cdf0e10cSrcweir pIndexMarkExport->ExportIndexMark(xPropSet, bAutoStyles); 2298*cdf0e10cSrcweir } 2299*cdf0e10cSrcweir else if (sType.equals(sRedline)) 2300*cdf0e10cSrcweir { 2301*cdf0e10cSrcweir if (NULL != pRedlineExport) 2302*cdf0e10cSrcweir pRedlineExport->ExportChange(xPropSet, bAutoStyles); 2303*cdf0e10cSrcweir } 2304*cdf0e10cSrcweir else if (sType.equals(sRuby)) 2305*cdf0e10cSrcweir { 2306*cdf0e10cSrcweir exportRuby(xPropSet, bAutoStyles); 2307*cdf0e10cSrcweir } 2308*cdf0e10cSrcweir else if (sType.equals(sMeta)) 2309*cdf0e10cSrcweir { 2310*cdf0e10cSrcweir exportMeta(xPropSet, bAutoStyles, bIsProgress); 2311*cdf0e10cSrcweir } 2312*cdf0e10cSrcweir else if (sType.equals(sTextFieldStart)) 2313*cdf0e10cSrcweir { 2314*cdf0e10cSrcweir Reference<XNamed> xBookmark(xPropSet->getPropertyValue(sBookmark), UNO_QUERY); 2315*cdf0e10cSrcweir if (xBookmark.is()) 2316*cdf0e10cSrcweir { 2317*cdf0e10cSrcweir GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_NAME, xBookmark->getName()); 2318*cdf0e10cSrcweir } 2319*cdf0e10cSrcweir Reference< ::com::sun::star::text::XFormField > xFormField(xPropSet->getPropertyValue(sBookmark), UNO_QUERY); 2320*cdf0e10cSrcweir if (xFormField.is()) 2321*cdf0e10cSrcweir { 2322*cdf0e10cSrcweir GetExport().AddAttribute(XML_NAMESPACE_FIELD, XML_TYPE, xFormField->getFieldType()); 2323*cdf0e10cSrcweir } 2324*cdf0e10cSrcweir GetExport().StartElement(XML_NAMESPACE_FIELD, XML_FIELDMARK_START, sal_False); 2325*cdf0e10cSrcweir if (xFormField.is()) 2326*cdf0e10cSrcweir { 2327*cdf0e10cSrcweir FieldParamExporter(&GetExport(), xFormField->getParameters()).Export(); 2328*cdf0e10cSrcweir } 2329*cdf0e10cSrcweir GetExport().EndElement(XML_NAMESPACE_FIELD, XML_FIELDMARK_START, sal_False); 2330*cdf0e10cSrcweir } 2331*cdf0e10cSrcweir else if (sType.equals(sTextFieldEnd)) 2332*cdf0e10cSrcweir { 2333*cdf0e10cSrcweir GetExport().StartElement(XML_NAMESPACE_FIELD, XML_FIELDMARK_END, sal_False); 2334*cdf0e10cSrcweir GetExport().EndElement(XML_NAMESPACE_FIELD, XML_FIELDMARK_END, sal_False); 2335*cdf0e10cSrcweir } 2336*cdf0e10cSrcweir else if (sType.equals(sTextFieldStartEnd)) 2337*cdf0e10cSrcweir { 2338*cdf0e10cSrcweir Reference<XNamed> xBookmark(xPropSet->getPropertyValue(sBookmark), UNO_QUERY); 2339*cdf0e10cSrcweir if (xBookmark.is()) 2340*cdf0e10cSrcweir { 2341*cdf0e10cSrcweir GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_NAME, xBookmark->getName()); 2342*cdf0e10cSrcweir } 2343*cdf0e10cSrcweir Reference< ::com::sun::star::text::XFormField > xFormField(xPropSet->getPropertyValue(sBookmark), UNO_QUERY); 2344*cdf0e10cSrcweir if (xFormField.is()) 2345*cdf0e10cSrcweir { 2346*cdf0e10cSrcweir GetExport().AddAttribute(XML_NAMESPACE_FIELD, XML_TYPE, xFormField->getFieldType()); 2347*cdf0e10cSrcweir } 2348*cdf0e10cSrcweir GetExport().StartElement(XML_NAMESPACE_FIELD, XML_FIELDMARK, sal_False); 2349*cdf0e10cSrcweir if (xFormField.is()) 2350*cdf0e10cSrcweir { 2351*cdf0e10cSrcweir FieldParamExporter(&GetExport(), xFormField->getParameters()).Export(); 2352*cdf0e10cSrcweir } 2353*cdf0e10cSrcweir GetExport().EndElement(XML_NAMESPACE_FIELD, XML_FIELDMARK, sal_False); 2354*cdf0e10cSrcweir } 2355*cdf0e10cSrcweir else if (sType.equals(sSoftPageBreak)) 2356*cdf0e10cSrcweir { 2357*cdf0e10cSrcweir exportSoftPageBreak(xPropSet, bAutoStyles); 2358*cdf0e10cSrcweir } 2359*cdf0e10cSrcweir else { 2360*cdf0e10cSrcweir DBG_ERROR("unknown text portion type"); 2361*cdf0e10cSrcweir } 2362*cdf0e10cSrcweir } 2363*cdf0e10cSrcweir else 2364*cdf0e10cSrcweir { 2365*cdf0e10cSrcweir Reference<XServiceInfo> xServiceInfo( xTxtRange, UNO_QUERY ); 2366*cdf0e10cSrcweir if( xServiceInfo->supportsService( sTextFieldService ) ) 2367*cdf0e10cSrcweir { 2368*cdf0e10cSrcweir exportTextField( xTxtRange, bAutoStyles, bIsProgress ); 2369*cdf0e10cSrcweir bPrevCharIsSpace = sal_False; 2370*cdf0e10cSrcweir } 2371*cdf0e10cSrcweir else 2372*cdf0e10cSrcweir { 2373*cdf0e10cSrcweir // no TextPortionType property -> non-Writer app -> text 2374*cdf0e10cSrcweir exportTextRange( xTxtRange, bAutoStyles, bPrevCharIsSpace ); 2375*cdf0e10cSrcweir } 2376*cdf0e10cSrcweir } 2377*cdf0e10cSrcweir } 2378*cdf0e10cSrcweir 2379*cdf0e10cSrcweir // now that there are nested enumerations for meta(-field), this may be valid! 2380*cdf0e10cSrcweir // DBG_ASSERT( !bOpenRuby, "Red Alert: Ruby still open!" ); 2381*cdf0e10cSrcweir } 2382*cdf0e10cSrcweir 2383*cdf0e10cSrcweir void XMLTextParagraphExport::exportTable( 2384*cdf0e10cSrcweir const Reference < XTextContent > &, 2385*cdf0e10cSrcweir sal_Bool /*bAutoStyles*/, sal_Bool /*bIsProgress*/ ) 2386*cdf0e10cSrcweir { 2387*cdf0e10cSrcweir } 2388*cdf0e10cSrcweir 2389*cdf0e10cSrcweir void XMLTextParagraphExport::exportTextField( 2390*cdf0e10cSrcweir const Reference < XTextRange > & rTextRange, 2391*cdf0e10cSrcweir sal_Bool bAutoStyles, sal_Bool bIsProgress ) 2392*cdf0e10cSrcweir { 2393*cdf0e10cSrcweir Reference < XPropertySet > xPropSet( rTextRange, UNO_QUERY ); 2394*cdf0e10cSrcweir // non-Writer apps need not support Property TextField, so test first 2395*cdf0e10cSrcweir if (xPropSet->getPropertySetInfo()->hasPropertyByName( sTextField )) 2396*cdf0e10cSrcweir { 2397*cdf0e10cSrcweir Reference < XTextField > xTxtFld(xPropSet->getPropertyValue( sTextField ), uno::UNO_QUERY); 2398*cdf0e10cSrcweir DBG_ASSERT( xTxtFld.is(), "text field missing" ); 2399*cdf0e10cSrcweir if( xTxtFld.is() ) 2400*cdf0e10cSrcweir { 2401*cdf0e10cSrcweir exportTextField(xTxtFld, bAutoStyles, bIsProgress, sal_True); 2402*cdf0e10cSrcweir } 2403*cdf0e10cSrcweir else 2404*cdf0e10cSrcweir { 2405*cdf0e10cSrcweir // write only characters 2406*cdf0e10cSrcweir GetExport().Characters(rTextRange->getString()); 2407*cdf0e10cSrcweir } 2408*cdf0e10cSrcweir } 2409*cdf0e10cSrcweir } 2410*cdf0e10cSrcweir 2411*cdf0e10cSrcweir void XMLTextParagraphExport::exportTextField( 2412*cdf0e10cSrcweir const Reference < XTextField > & xTextField, 2413*cdf0e10cSrcweir const sal_Bool bAutoStyles, const sal_Bool bIsProgress, 2414*cdf0e10cSrcweir const sal_Bool bRecursive ) 2415*cdf0e10cSrcweir { 2416*cdf0e10cSrcweir if ( bAutoStyles ) 2417*cdf0e10cSrcweir { 2418*cdf0e10cSrcweir pFieldExport->ExportFieldAutoStyle( xTextField, bIsProgress, 2419*cdf0e10cSrcweir bRecursive ); 2420*cdf0e10cSrcweir } 2421*cdf0e10cSrcweir else 2422*cdf0e10cSrcweir { 2423*cdf0e10cSrcweir pFieldExport->ExportField( xTextField, bIsProgress ); 2424*cdf0e10cSrcweir } 2425*cdf0e10cSrcweir } 2426*cdf0e10cSrcweir 2427*cdf0e10cSrcweir void XMLTextParagraphExport::exportSoftPageBreak( 2428*cdf0e10cSrcweir const Reference<XPropertySet> & , 2429*cdf0e10cSrcweir sal_Bool ) 2430*cdf0e10cSrcweir { 2431*cdf0e10cSrcweir SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT, 2432*cdf0e10cSrcweir XML_SOFT_PAGE_BREAK, sal_False, 2433*cdf0e10cSrcweir sal_False ); 2434*cdf0e10cSrcweir } 2435*cdf0e10cSrcweir 2436*cdf0e10cSrcweir void XMLTextParagraphExport::exportTextMark( 2437*cdf0e10cSrcweir const Reference<XPropertySet> & rPropSet, 2438*cdf0e10cSrcweir const OUString sProperty, 2439*cdf0e10cSrcweir const enum XMLTokenEnum pElements[], 2440*cdf0e10cSrcweir sal_Bool bAutoStyles) 2441*cdf0e10cSrcweir { 2442*cdf0e10cSrcweir // mib said: "Hau wech!" 2443*cdf0e10cSrcweir // 2444*cdf0e10cSrcweir // (Originally, I'd export a span element in case the (book|reference)mark 2445*cdf0e10cSrcweir // was formatted. This actually makes a difference in case some pervert 2446*cdf0e10cSrcweir // sets a point reference mark in the document and, say, formats it bold. 2447*cdf0e10cSrcweir // This basically meaningless formatting will now been thrown away 2448*cdf0e10cSrcweir // (aka cleaned up), since mib said: ... dvo 2449*cdf0e10cSrcweir 2450*cdf0e10cSrcweir if (!bAutoStyles) 2451*cdf0e10cSrcweir { 2452*cdf0e10cSrcweir // name element 2453*cdf0e10cSrcweir Reference<XNamed> xName(rPropSet->getPropertyValue(sProperty), UNO_QUERY); 2454*cdf0e10cSrcweir GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_NAME, 2455*cdf0e10cSrcweir xName->getName()); 2456*cdf0e10cSrcweir 2457*cdf0e10cSrcweir // start, end, or point-reference? 2458*cdf0e10cSrcweir sal_Int8 nElement; 2459*cdf0e10cSrcweir if( *(sal_Bool *)rPropSet->getPropertyValue(sIsCollapsed).getValue() ) 2460*cdf0e10cSrcweir { 2461*cdf0e10cSrcweir nElement = 0; 2462*cdf0e10cSrcweir } 2463*cdf0e10cSrcweir else 2464*cdf0e10cSrcweir { 2465*cdf0e10cSrcweir nElement = *(sal_Bool *)rPropSet->getPropertyValue(sIsStart).getValue() ? 1 : 2; 2466*cdf0e10cSrcweir } 2467*cdf0e10cSrcweir 2468*cdf0e10cSrcweir // bookmark, bookmark-start: xml:id and RDFa for RDF metadata 2469*cdf0e10cSrcweir if( nElement < 2 ) { 2470*cdf0e10cSrcweir GetExport().AddAttributeXmlId(xName); 2471*cdf0e10cSrcweir const uno::Reference<text::XTextContent> xTextContent( 2472*cdf0e10cSrcweir xName, uno::UNO_QUERY_THROW); 2473*cdf0e10cSrcweir GetExport().AddAttributesRDFa(xTextContent); 2474*cdf0e10cSrcweir } 2475*cdf0e10cSrcweir 2476*cdf0e10cSrcweir // export element 2477*cdf0e10cSrcweir DBG_ASSERT(pElements != NULL, "illegal element array"); 2478*cdf0e10cSrcweir DBG_ASSERT(nElement >= 0, "illegal element number"); 2479*cdf0e10cSrcweir DBG_ASSERT(nElement <= 2, "illegal element number"); 2480*cdf0e10cSrcweir SvXMLElementExport aElem(GetExport(), 2481*cdf0e10cSrcweir XML_NAMESPACE_TEXT, pElements[nElement], 2482*cdf0e10cSrcweir sal_False, sal_False); 2483*cdf0e10cSrcweir } 2484*cdf0e10cSrcweir // else: no styles. (see above) 2485*cdf0e10cSrcweir } 2486*cdf0e10cSrcweir 2487*cdf0e10cSrcweir sal_Bool lcl_txtpara_isBoundAsChar( 2488*cdf0e10cSrcweir const Reference < XPropertySet > & rPropSet, 2489*cdf0e10cSrcweir const Reference < XPropertySetInfo > & rPropSetInfo ) 2490*cdf0e10cSrcweir { 2491*cdf0e10cSrcweir sal_Bool bIsBoundAsChar = sal_False; 2492*cdf0e10cSrcweir OUString sAnchorType( RTL_CONSTASCII_USTRINGPARAM( "AnchorType" ) ); 2493*cdf0e10cSrcweir if( rPropSetInfo->hasPropertyByName( sAnchorType ) ) 2494*cdf0e10cSrcweir { 2495*cdf0e10cSrcweir TextContentAnchorType eAnchor; 2496*cdf0e10cSrcweir rPropSet->getPropertyValue( sAnchorType ) >>= eAnchor; 2497*cdf0e10cSrcweir bIsBoundAsChar = TextContentAnchorType_AS_CHARACTER == eAnchor; 2498*cdf0e10cSrcweir } 2499*cdf0e10cSrcweir 2500*cdf0e10cSrcweir return bIsBoundAsChar; 2501*cdf0e10cSrcweir } 2502*cdf0e10cSrcweir 2503*cdf0e10cSrcweir sal_Int32 XMLTextParagraphExport::addTextFrameAttributes( 2504*cdf0e10cSrcweir const Reference < XPropertySet >& rPropSet, 2505*cdf0e10cSrcweir sal_Bool bShape, 2506*cdf0e10cSrcweir OUString *pMinHeightValue ) 2507*cdf0e10cSrcweir { 2508*cdf0e10cSrcweir sal_Int32 nShapeFeatures = SEF_DEFAULT; 2509*cdf0e10cSrcweir 2510*cdf0e10cSrcweir // draw:name (#97662#: not for shapes, since those names will be 2511*cdf0e10cSrcweir // treated in the shape export) 2512*cdf0e10cSrcweir if( !bShape ) 2513*cdf0e10cSrcweir { 2514*cdf0e10cSrcweir Reference < XNamed > xNamed( rPropSet, UNO_QUERY ); 2515*cdf0e10cSrcweir if( xNamed.is() ) 2516*cdf0e10cSrcweir { 2517*cdf0e10cSrcweir OUString sName( xNamed->getName() ); 2518*cdf0e10cSrcweir if( sName.getLength() ) 2519*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, 2520*cdf0e10cSrcweir xNamed->getName() ); 2521*cdf0e10cSrcweir } 2522*cdf0e10cSrcweir } 2523*cdf0e10cSrcweir 2524*cdf0e10cSrcweir OUStringBuffer sValue; 2525*cdf0e10cSrcweir 2526*cdf0e10cSrcweir // text:anchor-type 2527*cdf0e10cSrcweir TextContentAnchorType eAnchor = TextContentAnchorType_AT_PARAGRAPH; 2528*cdf0e10cSrcweir rPropSet->getPropertyValue( sAnchorType ) >>= eAnchor; 2529*cdf0e10cSrcweir { 2530*cdf0e10cSrcweir XMLAnchorTypePropHdl aAnchorTypeHdl; 2531*cdf0e10cSrcweir OUString sTmp; 2532*cdf0e10cSrcweir aAnchorTypeHdl.exportXML( sTmp, uno::makeAny(eAnchor), 2533*cdf0e10cSrcweir GetExport().GetMM100UnitConverter() ); 2534*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_ANCHOR_TYPE, sTmp ); 2535*cdf0e10cSrcweir } 2536*cdf0e10cSrcweir 2537*cdf0e10cSrcweir // text:anchor-page-number 2538*cdf0e10cSrcweir if( TextContentAnchorType_AT_PAGE == eAnchor ) 2539*cdf0e10cSrcweir { 2540*cdf0e10cSrcweir sal_Int16 nPage = 0; 2541*cdf0e10cSrcweir rPropSet->getPropertyValue( sAnchorPageNo ) >>= nPage; 2542*cdf0e10cSrcweir GetExport().GetMM100UnitConverter().convertNumber( sValue, 2543*cdf0e10cSrcweir (sal_Int32)nPage ); 2544*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_ANCHOR_PAGE_NUMBER, 2545*cdf0e10cSrcweir sValue.makeStringAndClear() ); 2546*cdf0e10cSrcweir } 2547*cdf0e10cSrcweir else 2548*cdf0e10cSrcweir { 2549*cdf0e10cSrcweir // #92210# 2550*cdf0e10cSrcweir nShapeFeatures |= SEF_EXPORT_NO_WS; 2551*cdf0e10cSrcweir } 2552*cdf0e10cSrcweir 2553*cdf0e10cSrcweir // OD 2004-06-01 #i27691# - correction: no export of svg:x, if object 2554*cdf0e10cSrcweir // is anchored as-character. 2555*cdf0e10cSrcweir if ( !bShape && 2556*cdf0e10cSrcweir eAnchor != TextContentAnchorType_AS_CHARACTER ) 2557*cdf0e10cSrcweir { 2558*cdf0e10cSrcweir // svg:x 2559*cdf0e10cSrcweir sal_Int16 nHoriOrient = HoriOrientation::NONE; 2560*cdf0e10cSrcweir rPropSet->getPropertyValue( sHoriOrient ) >>= nHoriOrient; 2561*cdf0e10cSrcweir if( HoriOrientation::NONE == nHoriOrient ) 2562*cdf0e10cSrcweir { 2563*cdf0e10cSrcweir sal_Int32 nPos = 0; 2564*cdf0e10cSrcweir rPropSet->getPropertyValue( sHoriOrientPosition ) >>= nPos; 2565*cdf0e10cSrcweir GetExport().GetMM100UnitConverter().convertMeasure( sValue, nPos ); 2566*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_SVG, XML_X, 2567*cdf0e10cSrcweir sValue.makeStringAndClear() ); 2568*cdf0e10cSrcweir } 2569*cdf0e10cSrcweir } 2570*cdf0e10cSrcweir else if( TextContentAnchorType_AS_CHARACTER == eAnchor ) 2571*cdf0e10cSrcweir nShapeFeatures = (nShapeFeatures & ~SEF_EXPORT_X); 2572*cdf0e10cSrcweir 2573*cdf0e10cSrcweir if( !bShape || TextContentAnchorType_AS_CHARACTER == eAnchor ) 2574*cdf0e10cSrcweir { 2575*cdf0e10cSrcweir // svg:y 2576*cdf0e10cSrcweir sal_Int16 nVertOrient = VertOrientation::NONE; 2577*cdf0e10cSrcweir rPropSet->getPropertyValue( sVertOrient ) >>= nVertOrient; 2578*cdf0e10cSrcweir if( VertOrientation::NONE == nVertOrient ) 2579*cdf0e10cSrcweir { 2580*cdf0e10cSrcweir sal_Int32 nPos = 0; 2581*cdf0e10cSrcweir rPropSet->getPropertyValue( sVertOrientPosition ) >>= nPos; 2582*cdf0e10cSrcweir GetExport().GetMM100UnitConverter().convertMeasure( sValue, nPos ); 2583*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_SVG, XML_Y, 2584*cdf0e10cSrcweir sValue.makeStringAndClear() ); 2585*cdf0e10cSrcweir } 2586*cdf0e10cSrcweir if( bShape ) 2587*cdf0e10cSrcweir nShapeFeatures = (nShapeFeatures & ~SEF_EXPORT_Y); 2588*cdf0e10cSrcweir } 2589*cdf0e10cSrcweir 2590*cdf0e10cSrcweir 2591*cdf0e10cSrcweir Reference< XPropertySetInfo > xPropSetInfo(rPropSet->getPropertySetInfo()); 2592*cdf0e10cSrcweir 2593*cdf0e10cSrcweir // svg:width 2594*cdf0e10cSrcweir sal_Int16 nWidthType = SizeType::FIX; 2595*cdf0e10cSrcweir if( xPropSetInfo->hasPropertyByName( sWidthType ) ) 2596*cdf0e10cSrcweir { 2597*cdf0e10cSrcweir rPropSet->getPropertyValue( sWidthType ) >>= nWidthType; 2598*cdf0e10cSrcweir } 2599*cdf0e10cSrcweir if( xPropSetInfo->hasPropertyByName( sWidth ) ) 2600*cdf0e10cSrcweir { 2601*cdf0e10cSrcweir sal_Int32 nWidth = 0; 2602*cdf0e10cSrcweir // VAR size will be written as zero min-size 2603*cdf0e10cSrcweir if( SizeType::VARIABLE != nWidthType ) 2604*cdf0e10cSrcweir { 2605*cdf0e10cSrcweir rPropSet->getPropertyValue( sWidth ) >>= nWidth; 2606*cdf0e10cSrcweir } 2607*cdf0e10cSrcweir GetExport().GetMM100UnitConverter().convertMeasure( sValue, nWidth ); 2608*cdf0e10cSrcweir if( SizeType::FIX != nWidthType ) 2609*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_FO, XML_MIN_WIDTH, 2610*cdf0e10cSrcweir sValue.makeStringAndClear() ); 2611*cdf0e10cSrcweir else 2612*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_SVG, XML_WIDTH, 2613*cdf0e10cSrcweir sValue.makeStringAndClear() ); 2614*cdf0e10cSrcweir } 2615*cdf0e10cSrcweir sal_Bool bSyncWidth = sal_False; 2616*cdf0e10cSrcweir if( xPropSetInfo->hasPropertyByName( sIsSyncWidthToHeight ) ) 2617*cdf0e10cSrcweir { 2618*cdf0e10cSrcweir bSyncWidth = *(sal_Bool *)rPropSet->getPropertyValue( sIsSyncWidthToHeight ).getValue(); 2619*cdf0e10cSrcweir if( bSyncWidth ) 2620*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_REL_WIDTH, 2621*cdf0e10cSrcweir XML_SCALE ); 2622*cdf0e10cSrcweir } 2623*cdf0e10cSrcweir if( !bSyncWidth && xPropSetInfo->hasPropertyByName( sRelativeWidth ) ) 2624*cdf0e10cSrcweir { 2625*cdf0e10cSrcweir sal_Int16 nRelWidth = 0; 2626*cdf0e10cSrcweir rPropSet->getPropertyValue( sRelativeWidth ) >>= nRelWidth; 2627*cdf0e10cSrcweir DBG_ASSERT( nRelWidth >= 0 && nRelWidth <= 254, 2628*cdf0e10cSrcweir "Got illegal relative width from API" ); 2629*cdf0e10cSrcweir if( nRelWidth > 0 ) 2630*cdf0e10cSrcweir { 2631*cdf0e10cSrcweir GetExport().GetMM100UnitConverter().convertPercent( sValue, 2632*cdf0e10cSrcweir nRelWidth ); 2633*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_REL_WIDTH, 2634*cdf0e10cSrcweir sValue.makeStringAndClear() ); 2635*cdf0e10cSrcweir } 2636*cdf0e10cSrcweir } 2637*cdf0e10cSrcweir 2638*cdf0e10cSrcweir // svg:height, fo:min-height or style:rel-height 2639*cdf0e10cSrcweir sal_Int16 nSizeType = SizeType::FIX; 2640*cdf0e10cSrcweir if( xPropSetInfo->hasPropertyByName( sSizeType ) ) 2641*cdf0e10cSrcweir { 2642*cdf0e10cSrcweir rPropSet->getPropertyValue( sSizeType ) >>= nSizeType; 2643*cdf0e10cSrcweir } 2644*cdf0e10cSrcweir sal_Bool bSyncHeight = sal_False; 2645*cdf0e10cSrcweir if( xPropSetInfo->hasPropertyByName( sIsSyncHeightToWidth ) ) 2646*cdf0e10cSrcweir { 2647*cdf0e10cSrcweir bSyncHeight = *(sal_Bool *)rPropSet->getPropertyValue( sIsSyncHeightToWidth ).getValue(); 2648*cdf0e10cSrcweir } 2649*cdf0e10cSrcweir sal_Int16 nRelHeight = 0; 2650*cdf0e10cSrcweir if( !bSyncHeight && xPropSetInfo->hasPropertyByName( sRelativeHeight ) ) 2651*cdf0e10cSrcweir { 2652*cdf0e10cSrcweir rPropSet->getPropertyValue( sRelativeHeight ) >>= nRelHeight; 2653*cdf0e10cSrcweir } 2654*cdf0e10cSrcweir if( xPropSetInfo->hasPropertyByName( sHeight ) ) 2655*cdf0e10cSrcweir { 2656*cdf0e10cSrcweir sal_Int32 nHeight = 0; 2657*cdf0e10cSrcweir if( SizeType::VARIABLE != nSizeType ) 2658*cdf0e10cSrcweir { 2659*cdf0e10cSrcweir rPropSet->getPropertyValue( sHeight ) >>= nHeight; 2660*cdf0e10cSrcweir } 2661*cdf0e10cSrcweir GetExport().GetMM100UnitConverter().convertMeasure( sValue, 2662*cdf0e10cSrcweir nHeight ); 2663*cdf0e10cSrcweir if( SizeType::FIX != nSizeType && 0==nRelHeight && !bSyncHeight && 2664*cdf0e10cSrcweir pMinHeightValue ) 2665*cdf0e10cSrcweir *pMinHeightValue = sValue.makeStringAndClear(); 2666*cdf0e10cSrcweir else 2667*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_SVG, XML_HEIGHT, 2668*cdf0e10cSrcweir sValue.makeStringAndClear() ); 2669*cdf0e10cSrcweir } 2670*cdf0e10cSrcweir if( bSyncHeight ) 2671*cdf0e10cSrcweir { 2672*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_REL_HEIGHT, 2673*cdf0e10cSrcweir SizeType::MIN == nSizeType ? XML_SCALE_MIN : XML_SCALE ); 2674*cdf0e10cSrcweir 2675*cdf0e10cSrcweir } 2676*cdf0e10cSrcweir else if( nRelHeight > 0 ) 2677*cdf0e10cSrcweir { 2678*cdf0e10cSrcweir GetExport().GetMM100UnitConverter().convertPercent( sValue, 2679*cdf0e10cSrcweir nRelHeight ); 2680*cdf0e10cSrcweir if( SizeType::MIN == nSizeType ) 2681*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_FO, XML_MIN_HEIGHT, 2682*cdf0e10cSrcweir sValue.makeStringAndClear() ); 2683*cdf0e10cSrcweir else 2684*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_REL_HEIGHT, 2685*cdf0e10cSrcweir sValue.makeStringAndClear() ); 2686*cdf0e10cSrcweir } 2687*cdf0e10cSrcweir 2688*cdf0e10cSrcweir OUString sZOrder( RTL_CONSTASCII_USTRINGPARAM( "ZOrder" ) ); 2689*cdf0e10cSrcweir if( xPropSetInfo->hasPropertyByName( sZOrder ) ) 2690*cdf0e10cSrcweir { 2691*cdf0e10cSrcweir sal_Int32 nZIndex = 0; 2692*cdf0e10cSrcweir rPropSet->getPropertyValue( sZOrder ) >>= nZIndex; 2693*cdf0e10cSrcweir if( -1 != nZIndex ) 2694*cdf0e10cSrcweir { 2695*cdf0e10cSrcweir GetExport().GetMM100UnitConverter().convertNumber( sValue, 2696*cdf0e10cSrcweir nZIndex ); 2697*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_DRAW, XML_ZINDEX, 2698*cdf0e10cSrcweir sValue.makeStringAndClear() ); 2699*cdf0e10cSrcweir } 2700*cdf0e10cSrcweir } 2701*cdf0e10cSrcweir 2702*cdf0e10cSrcweir return nShapeFeatures; 2703*cdf0e10cSrcweir } 2704*cdf0e10cSrcweir 2705*cdf0e10cSrcweir void XMLTextParagraphExport::exportAnyTextFrame( 2706*cdf0e10cSrcweir const Reference < XTextContent > & rTxtCntnt, 2707*cdf0e10cSrcweir FrameType eType, 2708*cdf0e10cSrcweir sal_Bool bAutoStyles, 2709*cdf0e10cSrcweir sal_Bool bIsProgress, 2710*cdf0e10cSrcweir sal_Bool bExportContent, 2711*cdf0e10cSrcweir const Reference < XPropertySet > *pRangePropSet) 2712*cdf0e10cSrcweir { 2713*cdf0e10cSrcweir Reference < XPropertySet > xPropSet( rTxtCntnt, UNO_QUERY ); 2714*cdf0e10cSrcweir 2715*cdf0e10cSrcweir if( bAutoStyles ) 2716*cdf0e10cSrcweir { 2717*cdf0e10cSrcweir if( FT_EMBEDDED == eType ) 2718*cdf0e10cSrcweir _collectTextEmbeddedAutoStyles( xPropSet ); 2719*cdf0e10cSrcweir // --> OD 2004-08-09 #i28745# - no text frame style for shapes 2720*cdf0e10cSrcweir else if ( FT_SHAPE != eType ) 2721*cdf0e10cSrcweir Add( XML_STYLE_FAMILY_TEXT_FRAME, xPropSet ); 2722*cdf0e10cSrcweir // <-- 2723*cdf0e10cSrcweir 2724*cdf0e10cSrcweir if( pRangePropSet && lcl_txtpara_isBoundAsChar( xPropSet, 2725*cdf0e10cSrcweir xPropSet->getPropertySetInfo() ) ) 2726*cdf0e10cSrcweir Add( XML_STYLE_FAMILY_TEXT_TEXT, *pRangePropSet ); 2727*cdf0e10cSrcweir 2728*cdf0e10cSrcweir switch( eType ) 2729*cdf0e10cSrcweir { 2730*cdf0e10cSrcweir case FT_TEXT: 2731*cdf0e10cSrcweir { 2732*cdf0e10cSrcweir // frame bound frames 2733*cdf0e10cSrcweir if ( bExportContent ) 2734*cdf0e10cSrcweir { 2735*cdf0e10cSrcweir Reference < XTextFrame > xTxtFrame( rTxtCntnt, UNO_QUERY ); 2736*cdf0e10cSrcweir Reference < XText > xTxt(xTxtFrame->getText()); 2737*cdf0e10cSrcweir exportFrameFrames( sal_True, bIsProgress, &xTxtFrame ); 2738*cdf0e10cSrcweir exportText( xTxt, bAutoStyles, bIsProgress, sal_True ); 2739*cdf0e10cSrcweir } 2740*cdf0e10cSrcweir } 2741*cdf0e10cSrcweir break; 2742*cdf0e10cSrcweir case FT_SHAPE: 2743*cdf0e10cSrcweir { 2744*cdf0e10cSrcweir Reference < XShape > xShape( rTxtCntnt, UNO_QUERY ); 2745*cdf0e10cSrcweir GetExport().GetShapeExport()->collectShapeAutoStyles( xShape ); 2746*cdf0e10cSrcweir } 2747*cdf0e10cSrcweir break; 2748*cdf0e10cSrcweir default: 2749*cdf0e10cSrcweir break; 2750*cdf0e10cSrcweir } 2751*cdf0e10cSrcweir } 2752*cdf0e10cSrcweir else 2753*cdf0e10cSrcweir { 2754*cdf0e10cSrcweir Reference< XPropertySetInfo > xPropSetInfo(xPropSet->getPropertySetInfo()); 2755*cdf0e10cSrcweir Reference< XPropertyState > xPropState( xPropSet, UNO_QUERY ); 2756*cdf0e10cSrcweir { 2757*cdf0e10cSrcweir sal_Bool bAddCharStyles = pRangePropSet && 2758*cdf0e10cSrcweir lcl_txtpara_isBoundAsChar( xPropSet, xPropSetInfo ); 2759*cdf0e10cSrcweir 2760*cdf0e10cSrcweir sal_Bool bIsUICharStyle; 2761*cdf0e10cSrcweir sal_Bool bHasAutoStyle = sal_False; 2762*cdf0e10cSrcweir sal_Bool bDummy; 2763*cdf0e10cSrcweir 2764*cdf0e10cSrcweir OUString sStyle; 2765*cdf0e10cSrcweir 2766*cdf0e10cSrcweir if( bAddCharStyles ) 2767*cdf0e10cSrcweir sStyle = FindTextStyleAndHyperlink( *pRangePropSet, bDummy, bIsUICharStyle, bHasAutoStyle ); 2768*cdf0e10cSrcweir else 2769*cdf0e10cSrcweir bIsUICharStyle = sal_False; 2770*cdf0e10cSrcweir 2771*cdf0e10cSrcweir XMLTextCharStyleNamesElementExport aCharStylesExport( 2772*cdf0e10cSrcweir GetExport(), bIsUICharStyle && 2773*cdf0e10cSrcweir aCharStyleNamesPropInfoCache.hasProperty( 2774*cdf0e10cSrcweir *pRangePropSet ), bHasAutoStyle, 2775*cdf0e10cSrcweir *pRangePropSet, sCharStyleNames ); 2776*cdf0e10cSrcweir 2777*cdf0e10cSrcweir if( sStyle.getLength() ) 2778*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_STYLE_NAME, 2779*cdf0e10cSrcweir GetExport().EncodeStyleName( sStyle ) ); 2780*cdf0e10cSrcweir { 2781*cdf0e10cSrcweir SvXMLElementExport aElem( GetExport(), sStyle.getLength() > 0, 2782*cdf0e10cSrcweir XML_NAMESPACE_TEXT, XML_SPAN, sal_False, sal_False ); 2783*cdf0e10cSrcweir { 2784*cdf0e10cSrcweir SvXMLElementExport aElement( GetExport(), 2785*cdf0e10cSrcweir FT_SHAPE != eType && 2786*cdf0e10cSrcweir addHyperlinkAttributes( xPropSet, 2787*cdf0e10cSrcweir xPropState,xPropSetInfo ), 2788*cdf0e10cSrcweir XML_NAMESPACE_DRAW, XML_A, sal_False, sal_False ); 2789*cdf0e10cSrcweir switch( eType ) 2790*cdf0e10cSrcweir { 2791*cdf0e10cSrcweir case FT_TEXT: 2792*cdf0e10cSrcweir _exportTextFrame( xPropSet, xPropSetInfo, bIsProgress ); 2793*cdf0e10cSrcweir break; 2794*cdf0e10cSrcweir case FT_GRAPHIC: 2795*cdf0e10cSrcweir _exportTextGraphic( xPropSet, xPropSetInfo ); 2796*cdf0e10cSrcweir break; 2797*cdf0e10cSrcweir case FT_EMBEDDED: 2798*cdf0e10cSrcweir _exportTextEmbedded( xPropSet, xPropSetInfo ); 2799*cdf0e10cSrcweir break; 2800*cdf0e10cSrcweir case FT_SHAPE: 2801*cdf0e10cSrcweir { 2802*cdf0e10cSrcweir Reference < XShape > xShape( rTxtCntnt, UNO_QUERY ); 2803*cdf0e10cSrcweir sal_Int32 nFeatures = 2804*cdf0e10cSrcweir addTextFrameAttributes( xPropSet, sal_True ); 2805*cdf0e10cSrcweir GetExport().GetShapeExport() 2806*cdf0e10cSrcweir ->exportShape( xShape, nFeatures ); 2807*cdf0e10cSrcweir } 2808*cdf0e10cSrcweir break; 2809*cdf0e10cSrcweir } 2810*cdf0e10cSrcweir } 2811*cdf0e10cSrcweir } 2812*cdf0e10cSrcweir } 2813*cdf0e10cSrcweir } 2814*cdf0e10cSrcweir } 2815*cdf0e10cSrcweir 2816*cdf0e10cSrcweir void XMLTextParagraphExport::_exportTextFrame( 2817*cdf0e10cSrcweir const Reference < XPropertySet > & rPropSet, 2818*cdf0e10cSrcweir const Reference < XPropertySetInfo > & rPropSetInfo, 2819*cdf0e10cSrcweir sal_Bool bIsProgress ) 2820*cdf0e10cSrcweir { 2821*cdf0e10cSrcweir Reference < XTextFrame > xTxtFrame( rPropSet, UNO_QUERY ); 2822*cdf0e10cSrcweir Reference < XText > xTxt(xTxtFrame->getText()); 2823*cdf0e10cSrcweir 2824*cdf0e10cSrcweir OUString sStyle; 2825*cdf0e10cSrcweir if( rPropSetInfo->hasPropertyByName( sFrameStyleName ) ) 2826*cdf0e10cSrcweir { 2827*cdf0e10cSrcweir rPropSet->getPropertyValue( sFrameStyleName ) >>= sStyle; 2828*cdf0e10cSrcweir } 2829*cdf0e10cSrcweir 2830*cdf0e10cSrcweir OUString sAutoStyle( sStyle ); 2831*cdf0e10cSrcweir OUString aMinHeightValue; 2832*cdf0e10cSrcweir sAutoStyle = Find( XML_STYLE_FAMILY_TEXT_FRAME, rPropSet, sStyle ); 2833*cdf0e10cSrcweir if( sAutoStyle.getLength() ) 2834*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_DRAW, XML_STYLE_NAME, 2835*cdf0e10cSrcweir GetExport().EncodeStyleName( sAutoStyle ) ); 2836*cdf0e10cSrcweir addTextFrameAttributes( rPropSet, sal_False, &aMinHeightValue ); 2837*cdf0e10cSrcweir 2838*cdf0e10cSrcweir SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_DRAW, 2839*cdf0e10cSrcweir XML_FRAME, sal_False, sal_True ); 2840*cdf0e10cSrcweir 2841*cdf0e10cSrcweir if( aMinHeightValue.getLength() ) 2842*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_FO, XML_MIN_HEIGHT, 2843*cdf0e10cSrcweir aMinHeightValue ); 2844*cdf0e10cSrcweir 2845*cdf0e10cSrcweir // draw:chain-next-name 2846*cdf0e10cSrcweir if( rPropSetInfo->hasPropertyByName( sChainNextName ) ) 2847*cdf0e10cSrcweir { 2848*cdf0e10cSrcweir OUString sNext; 2849*cdf0e10cSrcweir if( (rPropSet->getPropertyValue( sChainNextName ) >>= sNext) && sNext.getLength() > 0 ) 2850*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_DRAW, 2851*cdf0e10cSrcweir XML_CHAIN_NEXT_NAME, 2852*cdf0e10cSrcweir sNext ); 2853*cdf0e10cSrcweir } 2854*cdf0e10cSrcweir 2855*cdf0e10cSrcweir { 2856*cdf0e10cSrcweir SvXMLElementExport aElement( GetExport(), XML_NAMESPACE_DRAW, 2857*cdf0e10cSrcweir XML_TEXT_BOX, sal_True, sal_True ); 2858*cdf0e10cSrcweir 2859*cdf0e10cSrcweir // frame bound frames 2860*cdf0e10cSrcweir exportFramesBoundToFrame( xTxtFrame, bIsProgress ); 2861*cdf0e10cSrcweir 2862*cdf0e10cSrcweir exportText( xTxt, sal_False, bIsProgress, sal_True ); 2863*cdf0e10cSrcweir } 2864*cdf0e10cSrcweir 2865*cdf0e10cSrcweir // script:events 2866*cdf0e10cSrcweir Reference<XEventsSupplier> xEventsSupp( xTxtFrame, UNO_QUERY ); 2867*cdf0e10cSrcweir GetExport().GetEventExport().Export(xEventsSupp); 2868*cdf0e10cSrcweir 2869*cdf0e10cSrcweir // image map 2870*cdf0e10cSrcweir GetExport().GetImageMapExport().Export( rPropSet ); 2871*cdf0e10cSrcweir 2872*cdf0e10cSrcweir // --> OD 2009-07-22 #i73249# 2873*cdf0e10cSrcweir // svg:title and svg:desc 2874*cdf0e10cSrcweir exportTitleAndDescription( rPropSet, rPropSetInfo ); 2875*cdf0e10cSrcweir // <-- 2876*cdf0e10cSrcweir } 2877*cdf0e10cSrcweir 2878*cdf0e10cSrcweir void XMLTextParagraphExport::exportContour( 2879*cdf0e10cSrcweir const Reference < XPropertySet > & rPropSet, 2880*cdf0e10cSrcweir const Reference < XPropertySetInfo > & rPropSetInfo ) 2881*cdf0e10cSrcweir { 2882*cdf0e10cSrcweir if( !rPropSetInfo->hasPropertyByName( sContourPolyPolygon ) ) 2883*cdf0e10cSrcweir return; 2884*cdf0e10cSrcweir 2885*cdf0e10cSrcweir PointSequenceSequence aSourcePolyPolygon; 2886*cdf0e10cSrcweir rPropSet->getPropertyValue( sContourPolyPolygon ) >>= aSourcePolyPolygon; 2887*cdf0e10cSrcweir 2888*cdf0e10cSrcweir if( !aSourcePolyPolygon.getLength() ) 2889*cdf0e10cSrcweir return; 2890*cdf0e10cSrcweir 2891*cdf0e10cSrcweir awt::Point aPoint( 0, 0 ); 2892*cdf0e10cSrcweir awt::Size aSize( 0, 0 ); 2893*cdf0e10cSrcweir sal_Int32 nPolygons = aSourcePolyPolygon.getLength(); 2894*cdf0e10cSrcweir const PointSequence *pPolygons = aSourcePolyPolygon.getConstArray(); 2895*cdf0e10cSrcweir while( nPolygons-- ) 2896*cdf0e10cSrcweir { 2897*cdf0e10cSrcweir sal_Int32 nPoints = pPolygons->getLength(); 2898*cdf0e10cSrcweir const awt::Point *pPoints = pPolygons->getConstArray(); 2899*cdf0e10cSrcweir while( nPoints-- ) 2900*cdf0e10cSrcweir { 2901*cdf0e10cSrcweir if( aSize.Width < pPoints->X ) 2902*cdf0e10cSrcweir aSize.Width = pPoints->X; 2903*cdf0e10cSrcweir if( aSize.Height < pPoints->Y ) 2904*cdf0e10cSrcweir aSize.Height = pPoints->Y; 2905*cdf0e10cSrcweir pPoints++; 2906*cdf0e10cSrcweir } 2907*cdf0e10cSrcweir pPolygons++; 2908*cdf0e10cSrcweir } 2909*cdf0e10cSrcweir 2910*cdf0e10cSrcweir sal_Bool bPixel = sal_False; 2911*cdf0e10cSrcweir if( rPropSetInfo->hasPropertyByName( sIsPixelContour ) ) 2912*cdf0e10cSrcweir { 2913*cdf0e10cSrcweir bPixel = *(sal_Bool *)rPropSet->getPropertyValue( sIsPixelContour ).getValue(); 2914*cdf0e10cSrcweir } 2915*cdf0e10cSrcweir 2916*cdf0e10cSrcweir // svg: width 2917*cdf0e10cSrcweir OUStringBuffer aStringBuffer( 10 ); 2918*cdf0e10cSrcweir if( bPixel ) 2919*cdf0e10cSrcweir GetExport().GetMM100UnitConverter().convertMeasurePx(aStringBuffer, aSize.Width); 2920*cdf0e10cSrcweir else 2921*cdf0e10cSrcweir GetExport().GetMM100UnitConverter().convertMeasure(aStringBuffer, aSize.Width); 2922*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_SVG, XML_WIDTH, 2923*cdf0e10cSrcweir aStringBuffer.makeStringAndClear() ); 2924*cdf0e10cSrcweir 2925*cdf0e10cSrcweir // svg: height 2926*cdf0e10cSrcweir if( bPixel ) 2927*cdf0e10cSrcweir GetExport().GetMM100UnitConverter().convertMeasurePx(aStringBuffer, aSize.Height); 2928*cdf0e10cSrcweir else 2929*cdf0e10cSrcweir GetExport().GetMM100UnitConverter().convertMeasure(aStringBuffer, aSize.Height); 2930*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_SVG, XML_HEIGHT, 2931*cdf0e10cSrcweir aStringBuffer.makeStringAndClear() ); 2932*cdf0e10cSrcweir 2933*cdf0e10cSrcweir // svg:viewbox 2934*cdf0e10cSrcweir SdXMLImExViewBox aViewBox(0, 0, aSize.Width, aSize.Height); 2935*cdf0e10cSrcweir GetExport().AddAttribute(XML_NAMESPACE_SVG, XML_VIEWBOX, 2936*cdf0e10cSrcweir aViewBox.GetExportString()); 2937*cdf0e10cSrcweir 2938*cdf0e10cSrcweir sal_Int32 nOuterCnt( aSourcePolyPolygon.getLength() ); 2939*cdf0e10cSrcweir 2940*cdf0e10cSrcweir enum XMLTokenEnum eElem = XML_TOKEN_INVALID; 2941*cdf0e10cSrcweir if( 1L == nOuterCnt ) 2942*cdf0e10cSrcweir { 2943*cdf0e10cSrcweir // simple polygon shape, can be written as svg:points sequence 2944*cdf0e10cSrcweir /*const*/ PointSequence* pSequence = 2945*cdf0e10cSrcweir (PointSequence*)aSourcePolyPolygon.getConstArray(); 2946*cdf0e10cSrcweir 2947*cdf0e10cSrcweir SdXMLImExPointsElement aPoints( pSequence, aViewBox, aPoint, aSize ); 2948*cdf0e10cSrcweir 2949*cdf0e10cSrcweir // write point array 2950*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_DRAW, XML_POINTS, 2951*cdf0e10cSrcweir aPoints.GetExportString()); 2952*cdf0e10cSrcweir eElem = XML_CONTOUR_POLYGON; 2953*cdf0e10cSrcweir } 2954*cdf0e10cSrcweir else 2955*cdf0e10cSrcweir { 2956*cdf0e10cSrcweir // polypolygon, needs to be written as a svg:path sequence 2957*cdf0e10cSrcweir /*const*/ PointSequence* pOuterSequence = 2958*cdf0e10cSrcweir (PointSequence*)aSourcePolyPolygon.getConstArray(); 2959*cdf0e10cSrcweir if(pOuterSequence) 2960*cdf0e10cSrcweir { 2961*cdf0e10cSrcweir // prepare svx:d element export 2962*cdf0e10cSrcweir SdXMLImExSvgDElement aSvgDElement( aViewBox ); 2963*cdf0e10cSrcweir 2964*cdf0e10cSrcweir for(sal_Int32 a(0L); a < nOuterCnt; a++) 2965*cdf0e10cSrcweir { 2966*cdf0e10cSrcweir /*const*/ PointSequence* pSequence = pOuterSequence++; 2967*cdf0e10cSrcweir if(pSequence) 2968*cdf0e10cSrcweir { 2969*cdf0e10cSrcweir aSvgDElement.AddPolygon(pSequence, 0L, aPoint, 2970*cdf0e10cSrcweir aSize, sal_True ); 2971*cdf0e10cSrcweir } 2972*cdf0e10cSrcweir } 2973*cdf0e10cSrcweir 2974*cdf0e10cSrcweir // write point array 2975*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_SVG, XML_D, 2976*cdf0e10cSrcweir aSvgDElement.GetExportString()); 2977*cdf0e10cSrcweir eElem = XML_CONTOUR_PATH; 2978*cdf0e10cSrcweir } 2979*cdf0e10cSrcweir } 2980*cdf0e10cSrcweir 2981*cdf0e10cSrcweir if( rPropSetInfo->hasPropertyByName( sIsAutomaticContour ) ) 2982*cdf0e10cSrcweir { 2983*cdf0e10cSrcweir sal_Bool bTmp = *(sal_Bool *)rPropSet->getPropertyValue( 2984*cdf0e10cSrcweir sIsAutomaticContour ).getValue(); 2985*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_DRAW, 2986*cdf0e10cSrcweir XML_RECREATE_ON_EDIT, bTmp ? XML_TRUE : XML_FALSE ); 2987*cdf0e10cSrcweir } 2988*cdf0e10cSrcweir 2989*cdf0e10cSrcweir // write object now 2990*cdf0e10cSrcweir SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_DRAW, eElem, 2991*cdf0e10cSrcweir sal_True, sal_True ); 2992*cdf0e10cSrcweir } 2993*cdf0e10cSrcweir 2994*cdf0e10cSrcweir void XMLTextParagraphExport::_exportTextGraphic( 2995*cdf0e10cSrcweir const Reference < XPropertySet > & rPropSet, 2996*cdf0e10cSrcweir const Reference < XPropertySetInfo > & rPropSetInfo ) 2997*cdf0e10cSrcweir { 2998*cdf0e10cSrcweir OUString sStyle; 2999*cdf0e10cSrcweir if( rPropSetInfo->hasPropertyByName( sFrameStyleName ) ) 3000*cdf0e10cSrcweir { 3001*cdf0e10cSrcweir rPropSet->getPropertyValue( sFrameStyleName ) >>= sStyle; 3002*cdf0e10cSrcweir } 3003*cdf0e10cSrcweir 3004*cdf0e10cSrcweir OUString sAutoStyle( sStyle ); 3005*cdf0e10cSrcweir sAutoStyle = Find( XML_STYLE_FAMILY_TEXT_FRAME, rPropSet, sStyle ); 3006*cdf0e10cSrcweir if( sAutoStyle.getLength() ) 3007*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_DRAW, XML_STYLE_NAME, 3008*cdf0e10cSrcweir GetExport().EncodeStyleName( sAutoStyle ) ); 3009*cdf0e10cSrcweir addTextFrameAttributes( rPropSet, sal_False ); 3010*cdf0e10cSrcweir 3011*cdf0e10cSrcweir // svg:transform 3012*cdf0e10cSrcweir sal_Int16 nVal = 0; 3013*cdf0e10cSrcweir rPropSet->getPropertyValue( sGraphicRotation ) >>= nVal; 3014*cdf0e10cSrcweir if( nVal != 0 ) 3015*cdf0e10cSrcweir { 3016*cdf0e10cSrcweir OUStringBuffer sRet( GetXMLToken(XML_ROTATE).getLength()+4 ); 3017*cdf0e10cSrcweir sRet.append( GetXMLToken(XML_ROTATE)); 3018*cdf0e10cSrcweir sRet.append( (sal_Unicode)'(' ); 3019*cdf0e10cSrcweir GetExport().GetMM100UnitConverter().convertNumber( sRet, (sal_Int32)nVal ); 3020*cdf0e10cSrcweir sRet.append( (sal_Unicode)')' ); 3021*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_SVG, XML_TRANSFORM, 3022*cdf0e10cSrcweir sRet.makeStringAndClear() ); 3023*cdf0e10cSrcweir } 3024*cdf0e10cSrcweir 3025*cdf0e10cSrcweir 3026*cdf0e10cSrcweir SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_DRAW, 3027*cdf0e10cSrcweir XML_FRAME, sal_False, sal_True ); 3028*cdf0e10cSrcweir 3029*cdf0e10cSrcweir // xlink:href 3030*cdf0e10cSrcweir OUString sOrigURL; 3031*cdf0e10cSrcweir rPropSet->getPropertyValue( sGraphicURL ) >>= sOrigURL; 3032*cdf0e10cSrcweir OUString sURL(GetExport().AddEmbeddedGraphicObject( sOrigURL )); 3033*cdf0e10cSrcweir setTextEmbeddedGraphicURL( rPropSet, sURL ); 3034*cdf0e10cSrcweir 3035*cdf0e10cSrcweir // If there still is no url, then then graphic is empty 3036*cdf0e10cSrcweir if( sURL.getLength() ) 3037*cdf0e10cSrcweir { 3038*cdf0e10cSrcweir GetExport().AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, sURL ); 3039*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE ); 3040*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED ); 3041*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, 3042*cdf0e10cSrcweir XML_ONLOAD ); 3043*cdf0e10cSrcweir } 3044*cdf0e10cSrcweir 3045*cdf0e10cSrcweir // draw:filter-name 3046*cdf0e10cSrcweir OUString sGrfFilter; 3047*cdf0e10cSrcweir rPropSet->getPropertyValue( sGraphicFilter ) >>= sGrfFilter; 3048*cdf0e10cSrcweir if( sGrfFilter.getLength() ) 3049*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_DRAW, XML_FILTER_NAME, 3050*cdf0e10cSrcweir sGrfFilter ); 3051*cdf0e10cSrcweir 3052*cdf0e10cSrcweir { 3053*cdf0e10cSrcweir SvXMLElementExport aElement( GetExport(), XML_NAMESPACE_DRAW, 3054*cdf0e10cSrcweir XML_IMAGE, sal_False, sal_True ); 3055*cdf0e10cSrcweir 3056*cdf0e10cSrcweir // optional office:binary-data 3057*cdf0e10cSrcweir GetExport().AddEmbeddedGraphicObjectAsBase64( sOrigURL ); 3058*cdf0e10cSrcweir } 3059*cdf0e10cSrcweir 3060*cdf0e10cSrcweir // script:events 3061*cdf0e10cSrcweir Reference<XEventsSupplier> xEventsSupp( rPropSet, UNO_QUERY ); 3062*cdf0e10cSrcweir GetExport().GetEventExport().Export(xEventsSupp); 3063*cdf0e10cSrcweir 3064*cdf0e10cSrcweir // image map 3065*cdf0e10cSrcweir GetExport().GetImageMapExport().Export( rPropSet ); 3066*cdf0e10cSrcweir 3067*cdf0e10cSrcweir // --> OD 2009-07-22 #i73249# 3068*cdf0e10cSrcweir // svg:title and svg:desc 3069*cdf0e10cSrcweir exportTitleAndDescription( rPropSet, rPropSetInfo ); 3070*cdf0e10cSrcweir // <-- 3071*cdf0e10cSrcweir 3072*cdf0e10cSrcweir // draw:contour 3073*cdf0e10cSrcweir exportContour( rPropSet, rPropSetInfo ); 3074*cdf0e10cSrcweir } 3075*cdf0e10cSrcweir 3076*cdf0e10cSrcweir void XMLTextParagraphExport::_collectTextEmbeddedAutoStyles(const Reference < XPropertySet > & ) 3077*cdf0e10cSrcweir { 3078*cdf0e10cSrcweir DBG_ASSERT( !this, "no API implementation avialable" ); 3079*cdf0e10cSrcweir } 3080*cdf0e10cSrcweir 3081*cdf0e10cSrcweir void XMLTextParagraphExport::_exportTextEmbedded( 3082*cdf0e10cSrcweir const Reference < XPropertySet > &, 3083*cdf0e10cSrcweir const Reference < XPropertySetInfo > & ) 3084*cdf0e10cSrcweir { 3085*cdf0e10cSrcweir DBG_ASSERT( !this, "no API implementation avialable" ); 3086*cdf0e10cSrcweir } 3087*cdf0e10cSrcweir 3088*cdf0e10cSrcweir void XMLTextParagraphExport::exportEvents( const Reference < XPropertySet > & rPropSet ) 3089*cdf0e10cSrcweir { 3090*cdf0e10cSrcweir // script:events 3091*cdf0e10cSrcweir Reference<XEventsSupplier> xEventsSupp( rPropSet, UNO_QUERY ); 3092*cdf0e10cSrcweir GetExport().GetEventExport().Export(xEventsSupp); 3093*cdf0e10cSrcweir 3094*cdf0e10cSrcweir // image map 3095*cdf0e10cSrcweir OUString sImageMap(RTL_CONSTASCII_USTRINGPARAM("ImageMap")); 3096*cdf0e10cSrcweir if (rPropSet->getPropertySetInfo()->hasPropertyByName(sImageMap)) 3097*cdf0e10cSrcweir GetExport().GetImageMapExport().Export( rPropSet ); 3098*cdf0e10cSrcweir } 3099*cdf0e10cSrcweir 3100*cdf0e10cSrcweir // --> OD 2009-07-22 #i73249# 3101*cdf0e10cSrcweir void XMLTextParagraphExport::exportTitleAndDescription( 3102*cdf0e10cSrcweir const Reference < XPropertySet > & rPropSet, 3103*cdf0e10cSrcweir const Reference < XPropertySetInfo > & rPropSetInfo ) 3104*cdf0e10cSrcweir { 3105*cdf0e10cSrcweir // svg:title 3106*cdf0e10cSrcweir if( rPropSetInfo->hasPropertyByName( sTitle ) ) 3107*cdf0e10cSrcweir { 3108*cdf0e10cSrcweir OUString sObjTitle; 3109*cdf0e10cSrcweir rPropSet->getPropertyValue( sTitle ) >>= sObjTitle; 3110*cdf0e10cSrcweir if( sObjTitle.getLength() ) 3111*cdf0e10cSrcweir { 3112*cdf0e10cSrcweir SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_SVG, 3113*cdf0e10cSrcweir XML_TITLE, sal_True, sal_False ); 3114*cdf0e10cSrcweir GetExport().Characters( sObjTitle ); 3115*cdf0e10cSrcweir } 3116*cdf0e10cSrcweir } 3117*cdf0e10cSrcweir 3118*cdf0e10cSrcweir // svg:description 3119*cdf0e10cSrcweir if( rPropSetInfo->hasPropertyByName( sDescription ) ) 3120*cdf0e10cSrcweir { 3121*cdf0e10cSrcweir OUString sObjDesc; 3122*cdf0e10cSrcweir rPropSet->getPropertyValue( sDescription ) >>= sObjDesc; 3123*cdf0e10cSrcweir if( sObjDesc.getLength() ) 3124*cdf0e10cSrcweir { 3125*cdf0e10cSrcweir SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_SVG, 3126*cdf0e10cSrcweir XML_DESC, sal_True, sal_False ); 3127*cdf0e10cSrcweir GetExport().Characters( sObjDesc ); 3128*cdf0e10cSrcweir } 3129*cdf0e10cSrcweir } 3130*cdf0e10cSrcweir } 3131*cdf0e10cSrcweir // <-- 3132*cdf0e10cSrcweir 3133*cdf0e10cSrcweir void XMLTextParagraphExport::setTextEmbeddedGraphicURL( 3134*cdf0e10cSrcweir const Reference < XPropertySet >&, 3135*cdf0e10cSrcweir OUString& /*rStreamName*/ ) const 3136*cdf0e10cSrcweir { 3137*cdf0e10cSrcweir } 3138*cdf0e10cSrcweir 3139*cdf0e10cSrcweir sal_Bool XMLTextParagraphExport::addHyperlinkAttributes( 3140*cdf0e10cSrcweir const Reference < XPropertySet > & rPropSet, 3141*cdf0e10cSrcweir const Reference < XPropertyState > & rPropState, 3142*cdf0e10cSrcweir const Reference < XPropertySetInfo > & rPropSetInfo ) 3143*cdf0e10cSrcweir { 3144*cdf0e10cSrcweir sal_Bool bExport = sal_False; 3145*cdf0e10cSrcweir OUString sHRef, sName, sTargetFrame, sUStyleName, sVStyleName; 3146*cdf0e10cSrcweir sal_Bool bServerMap = sal_False; 3147*cdf0e10cSrcweir 3148*cdf0e10cSrcweir /* bool bHyperLinkURL = false; 3149*cdf0e10cSrcweir bool bHyperLinkName = false; 3150*cdf0e10cSrcweir bool bHyperLinkTarget = false; 3151*cdf0e10cSrcweir bool bServer = false; 3152*cdf0e10cSrcweir bool bUnvisitedCharStyleName = false; 3153*cdf0e10cSrcweir bool bVisitedCharStyleName = false; 3154*cdf0e10cSrcweir 3155*cdf0e10cSrcweir const Reference< XMultiPropertySet > xMultiPropertySet( rPropSet, UNO_QUERY ); 3156*cdf0e10cSrcweir if ( xMultiPropertySet.is() ) 3157*cdf0e10cSrcweir { 3158*cdf0e10cSrcweir sal_uInt32 nCount = 0; 3159*cdf0e10cSrcweir Sequence< OUString > aPropertyNames( 6 ); 3160*cdf0e10cSrcweir OUString* pArray = aPropertyNames.getArray(); 3161*cdf0e10cSrcweir 3162*cdf0e10cSrcweir if ( rPropSetInfo->hasPropertyByName( sServerMap ) ) 3163*cdf0e10cSrcweir { 3164*cdf0e10cSrcweir bServer = true; 3165*cdf0e10cSrcweir pArray[ nCount++ ] = sServerMap; 3166*cdf0e10cSrcweir } 3167*cdf0e10cSrcweir if ( rPropSetInfo->hasPropertyByName( sHyperLinkName ) ) 3168*cdf0e10cSrcweir { 3169*cdf0e10cSrcweir bHyperLinkName = true; 3170*cdf0e10cSrcweir pArray[ nCount++ ] = sHyperLinkName; 3171*cdf0e10cSrcweir } 3172*cdf0e10cSrcweir if ( rPropSetInfo->hasPropertyByName( sHyperLinkTarget ) ) 3173*cdf0e10cSrcweir { 3174*cdf0e10cSrcweir bHyperLinkTarget = true; 3175*cdf0e10cSrcweir pArray[ nCount++ ] = sHyperLinkTarget; 3176*cdf0e10cSrcweir } 3177*cdf0e10cSrcweir if ( rPropSetInfo->hasPropertyByName( sHyperLinkURL ) ) 3178*cdf0e10cSrcweir { 3179*cdf0e10cSrcweir bHyperLinkURL = true; 3180*cdf0e10cSrcweir pArray[ nCount++ ] = sHyperLinkURL; 3181*cdf0e10cSrcweir } 3182*cdf0e10cSrcweir if ( rPropSetInfo->hasPropertyByName( sUnvisitedCharStyleName ) ) 3183*cdf0e10cSrcweir { 3184*cdf0e10cSrcweir bUnvisitedCharStyleName = true; 3185*cdf0e10cSrcweir pArray[ nCount++ ] = sUnvisitedCharStyleName; 3186*cdf0e10cSrcweir } 3187*cdf0e10cSrcweir if ( rPropSetInfo->hasPropertyByName( sVisitedCharStyleName ) ) 3188*cdf0e10cSrcweir { 3189*cdf0e10cSrcweir bVisitedCharStyleName = true; 3190*cdf0e10cSrcweir pArray[ nCount++ ] = sVisitedCharStyleName; 3191*cdf0e10cSrcweir } 3192*cdf0e10cSrcweir 3193*cdf0e10cSrcweir aPropertyNames.realloc( nCount ); 3194*cdf0e10cSrcweir 3195*cdf0e10cSrcweir if ( nCount ) 3196*cdf0e10cSrcweir { 3197*cdf0e10cSrcweir Sequence< PropertyState > aPropertyStates( nCount ); 3198*cdf0e10cSrcweir PropertyState* pStateArray = aPropertyStates.getArray(); 3199*cdf0e10cSrcweir 3200*cdf0e10cSrcweir if ( rPropState.is() ) 3201*cdf0e10cSrcweir aPropertyStates = rPropState->getPropertyStates( aPropertyNames ); 3202*cdf0e10cSrcweir 3203*cdf0e10cSrcweir Sequence< Any > aPropertyValues ( xMultiPropertySet->getPropertyValues( aPropertyNames ) ); 3204*cdf0e10cSrcweir Any* pValueArray = aPropertyValues.getArray(); 3205*cdf0e10cSrcweir 3206*cdf0e10cSrcweir sal_uInt32 nIdx = 0; 3207*cdf0e10cSrcweir 3208*cdf0e10cSrcweir if ( bServer ) 3209*cdf0e10cSrcweir { 3210*cdf0e10cSrcweir if ( !rPropState.is() || PropertyState_DIRECT_VALUE == pStateArray[ nIdx ] ) 3211*cdf0e10cSrcweir { 3212*cdf0e10cSrcweir bServerMap = *(sal_Bool *)pValueArray[ nIdx ].getValue(); 3213*cdf0e10cSrcweir if( bServerMap ) 3214*cdf0e10cSrcweir bExport = sal_True; 3215*cdf0e10cSrcweir } 3216*cdf0e10cSrcweir ++nIdx; 3217*cdf0e10cSrcweir } 3218*cdf0e10cSrcweir if ( bHyperLinkName ) 3219*cdf0e10cSrcweir { 3220*cdf0e10cSrcweir if ( !rPropState.is() || PropertyState_DIRECT_VALUE == pStateArray[ nIdx ] ) 3221*cdf0e10cSrcweir { 3222*cdf0e10cSrcweir pValueArray[ nIdx ] >>= sName; 3223*cdf0e10cSrcweir if( sName.getLength() > 0 ) 3224*cdf0e10cSrcweir bExport = sal_True; 3225*cdf0e10cSrcweir } 3226*cdf0e10cSrcweir ++nIdx; 3227*cdf0e10cSrcweir } 3228*cdf0e10cSrcweir if ( bHyperLinkTarget ) 3229*cdf0e10cSrcweir { 3230*cdf0e10cSrcweir if ( !rPropState.is() || PropertyState_DIRECT_VALUE == pStateArray[ nIdx ] ) 3231*cdf0e10cSrcweir { 3232*cdf0e10cSrcweir pValueArray[ nIdx ] >>= sTargetFrame; 3233*cdf0e10cSrcweir if( sTargetFrame.getLength() ) 3234*cdf0e10cSrcweir bExport = sal_True; 3235*cdf0e10cSrcweir } 3236*cdf0e10cSrcweir ++nIdx; 3237*cdf0e10cSrcweir } 3238*cdf0e10cSrcweir if ( bHyperLinkURL ) 3239*cdf0e10cSrcweir { 3240*cdf0e10cSrcweir if ( !rPropState.is() || PropertyState_DIRECT_VALUE == pStateArray[ nIdx ] ) 3241*cdf0e10cSrcweir { 3242*cdf0e10cSrcweir pValueArray[ nIdx ] >>= sHRef; 3243*cdf0e10cSrcweir if( sHRef.getLength() > 0 ) 3244*cdf0e10cSrcweir bExport = sal_True; 3245*cdf0e10cSrcweir } 3246*cdf0e10cSrcweir ++nIdx; 3247*cdf0e10cSrcweir } 3248*cdf0e10cSrcweir if ( bUnvisitedCharStyleName ) 3249*cdf0e10cSrcweir { 3250*cdf0e10cSrcweir if ( !rPropState.is() || PropertyState_DIRECT_VALUE == pStateArray[ nIdx ] ) 3251*cdf0e10cSrcweir { 3252*cdf0e10cSrcweir pValueArray[ nIdx ] >>= sUStyleName; 3253*cdf0e10cSrcweir if( sUStyleName.getLength() ) 3254*cdf0e10cSrcweir bExport = sal_True; 3255*cdf0e10cSrcweir } 3256*cdf0e10cSrcweir ++nIdx; 3257*cdf0e10cSrcweir } 3258*cdf0e10cSrcweir if ( bVisitedCharStyleName ) 3259*cdf0e10cSrcweir { 3260*cdf0e10cSrcweir if ( !rPropState.is() || PropertyState_DIRECT_VALUE == pStateArray[ nIdx ] ) 3261*cdf0e10cSrcweir { 3262*cdf0e10cSrcweir pValueArray[ nIdx ] >>= sVStyleName; 3263*cdf0e10cSrcweir if( sVStyleName.getLength() ) 3264*cdf0e10cSrcweir bExport = sal_True; 3265*cdf0e10cSrcweir } 3266*cdf0e10cSrcweir ++nIdx; 3267*cdf0e10cSrcweir } 3268*cdf0e10cSrcweir } 3269*cdf0e10cSrcweir } 3270*cdf0e10cSrcweir else 3271*cdf0e10cSrcweir {*/ 3272*cdf0e10cSrcweir if( rPropSetInfo->hasPropertyByName( sHyperLinkURL ) && 3273*cdf0e10cSrcweir ( !rPropState.is() || PropertyState_DIRECT_VALUE == 3274*cdf0e10cSrcweir rPropState->getPropertyState( sHyperLinkURL ) ) ) 3275*cdf0e10cSrcweir { 3276*cdf0e10cSrcweir rPropSet->getPropertyValue( sHyperLinkURL ) >>= sHRef; 3277*cdf0e10cSrcweir 3278*cdf0e10cSrcweir if( sHRef.getLength() > 0 ) 3279*cdf0e10cSrcweir bExport = sal_True; 3280*cdf0e10cSrcweir } 3281*cdf0e10cSrcweir 3282*cdf0e10cSrcweir if( rPropSetInfo->hasPropertyByName( sHyperLinkName ) && 3283*cdf0e10cSrcweir ( !rPropState.is() || PropertyState_DIRECT_VALUE == 3284*cdf0e10cSrcweir rPropState->getPropertyState( sHyperLinkName ) ) ) 3285*cdf0e10cSrcweir { 3286*cdf0e10cSrcweir rPropSet->getPropertyValue( sHyperLinkName ) >>= sName; 3287*cdf0e10cSrcweir if( sName.getLength() > 0 ) 3288*cdf0e10cSrcweir bExport = sal_True; 3289*cdf0e10cSrcweir } 3290*cdf0e10cSrcweir 3291*cdf0e10cSrcweir if( rPropSetInfo->hasPropertyByName( sHyperLinkTarget ) && 3292*cdf0e10cSrcweir ( !rPropState.is() || PropertyState_DIRECT_VALUE == 3293*cdf0e10cSrcweir rPropState->getPropertyState( sHyperLinkTarget ) ) ) 3294*cdf0e10cSrcweir { 3295*cdf0e10cSrcweir rPropSet->getPropertyValue( sHyperLinkTarget ) >>= sTargetFrame; 3296*cdf0e10cSrcweir if( sTargetFrame.getLength() ) 3297*cdf0e10cSrcweir bExport = sal_True; 3298*cdf0e10cSrcweir } 3299*cdf0e10cSrcweir 3300*cdf0e10cSrcweir if( rPropSetInfo->hasPropertyByName( sServerMap ) && 3301*cdf0e10cSrcweir ( !rPropState.is() || PropertyState_DIRECT_VALUE == 3302*cdf0e10cSrcweir rPropState->getPropertyState( sServerMap ) ) ) 3303*cdf0e10cSrcweir { 3304*cdf0e10cSrcweir bServerMap = *(sal_Bool *)rPropSet->getPropertyValue( sServerMap ).getValue(); 3305*cdf0e10cSrcweir if( bServerMap ) 3306*cdf0e10cSrcweir bExport = sal_True; 3307*cdf0e10cSrcweir } 3308*cdf0e10cSrcweir 3309*cdf0e10cSrcweir if( rPropSetInfo->hasPropertyByName( sUnvisitedCharStyleName ) && 3310*cdf0e10cSrcweir ( !rPropState.is() || PropertyState_DIRECT_VALUE == 3311*cdf0e10cSrcweir rPropState->getPropertyState( sUnvisitedCharStyleName ) ) ) 3312*cdf0e10cSrcweir { 3313*cdf0e10cSrcweir rPropSet->getPropertyValue( sUnvisitedCharStyleName ) >>= sUStyleName; 3314*cdf0e10cSrcweir if( sUStyleName.getLength() ) 3315*cdf0e10cSrcweir bExport = sal_True; 3316*cdf0e10cSrcweir } 3317*cdf0e10cSrcweir 3318*cdf0e10cSrcweir if( rPropSetInfo->hasPropertyByName( sVisitedCharStyleName ) && 3319*cdf0e10cSrcweir ( !rPropState.is() || PropertyState_DIRECT_VALUE == 3320*cdf0e10cSrcweir rPropState->getPropertyState( sVisitedCharStyleName ) ) ) 3321*cdf0e10cSrcweir { 3322*cdf0e10cSrcweir rPropSet->getPropertyValue( sVisitedCharStyleName ) >>= sVStyleName; 3323*cdf0e10cSrcweir if( sVStyleName.getLength() ) 3324*cdf0e10cSrcweir bExport = sal_True; 3325*cdf0e10cSrcweir } 3326*cdf0e10cSrcweir 3327*cdf0e10cSrcweir if( bExport ) 3328*cdf0e10cSrcweir { 3329*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE ); 3330*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference( sHRef ) ); 3331*cdf0e10cSrcweir 3332*cdf0e10cSrcweir if( sName.getLength() > 0 ) 3333*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_OFFICE, XML_NAME, sName ); 3334*cdf0e10cSrcweir 3335*cdf0e10cSrcweir if( sTargetFrame.getLength() ) 3336*cdf0e10cSrcweir { 3337*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_OFFICE, 3338*cdf0e10cSrcweir XML_TARGET_FRAME_NAME, sTargetFrame ); 3339*cdf0e10cSrcweir enum XMLTokenEnum eTok = 3340*cdf0e10cSrcweir sTargetFrame.equalsAsciiL( "_blank", sizeof("_blank")-1 ) 3341*cdf0e10cSrcweir ? XML_NEW : XML_REPLACE; 3342*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, eTok ); 3343*cdf0e10cSrcweir } 3344*cdf0e10cSrcweir 3345*cdf0e10cSrcweir if( bServerMap ) 3346*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_OFFICE, 3347*cdf0e10cSrcweir XML_SERVER_MAP, XML_TRUE ); 3348*cdf0e10cSrcweir 3349*cdf0e10cSrcweir if( sUStyleName.getLength() ) 3350*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_TEXT, 3351*cdf0e10cSrcweir XML_STYLE_NAME, GetExport().EncodeStyleName( sUStyleName ) ); 3352*cdf0e10cSrcweir 3353*cdf0e10cSrcweir if( sVStyleName.getLength() ) 3354*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_TEXT, 3355*cdf0e10cSrcweir XML_VISITED_STYLE_NAME, GetExport().EncodeStyleName( sVStyleName ) ); 3356*cdf0e10cSrcweir } 3357*cdf0e10cSrcweir 3358*cdf0e10cSrcweir return bExport; 3359*cdf0e10cSrcweir } 3360*cdf0e10cSrcweir 3361*cdf0e10cSrcweir void XMLTextParagraphExport::exportTextRange( 3362*cdf0e10cSrcweir const Reference < XTextRange > & rTextRange, 3363*cdf0e10cSrcweir sal_Bool bAutoStyles, 3364*cdf0e10cSrcweir sal_Bool& rPrevCharIsSpace ) 3365*cdf0e10cSrcweir { 3366*cdf0e10cSrcweir Reference < XPropertySet > xPropSet( rTextRange, UNO_QUERY ); 3367*cdf0e10cSrcweir if( bAutoStyles ) 3368*cdf0e10cSrcweir { 3369*cdf0e10cSrcweir Add( XML_STYLE_FAMILY_TEXT_TEXT, xPropSet ); 3370*cdf0e10cSrcweir } 3371*cdf0e10cSrcweir else 3372*cdf0e10cSrcweir { 3373*cdf0e10cSrcweir sal_Bool bHyperlink = sal_False; 3374*cdf0e10cSrcweir sal_Bool bIsUICharStyle = sal_False; 3375*cdf0e10cSrcweir sal_Bool bHasAutoStyle = sal_False; 3376*cdf0e10cSrcweir 3377*cdf0e10cSrcweir OUString sStyle(FindTextStyleAndHyperlink( xPropSet, bHyperlink, 3378*cdf0e10cSrcweir bIsUICharStyle, bHasAutoStyle )); 3379*cdf0e10cSrcweir 3380*cdf0e10cSrcweir Reference < XPropertySetInfo > xPropSetInfo; 3381*cdf0e10cSrcweir if( bHyperlink ) 3382*cdf0e10cSrcweir { 3383*cdf0e10cSrcweir Reference< XPropertyState > xPropState( xPropSet, UNO_QUERY ); 3384*cdf0e10cSrcweir xPropSetInfo.set(xPropSet->getPropertySetInfo()); 3385*cdf0e10cSrcweir bHyperlink = addHyperlinkAttributes( xPropSet, xPropState, xPropSetInfo ); 3386*cdf0e10cSrcweir } 3387*cdf0e10cSrcweir SvXMLElementExport aElem( GetExport(), bHyperlink, XML_NAMESPACE_TEXT, 3388*cdf0e10cSrcweir XML_A, sal_False, sal_False ); 3389*cdf0e10cSrcweir if( bHyperlink ) 3390*cdf0e10cSrcweir { 3391*cdf0e10cSrcweir // export events (if supported) 3392*cdf0e10cSrcweir OUString sHyperLinkEvents(RTL_CONSTASCII_USTRINGPARAM( 3393*cdf0e10cSrcweir "HyperLinkEvents")); 3394*cdf0e10cSrcweir if (xPropSetInfo->hasPropertyByName(sHyperLinkEvents)) 3395*cdf0e10cSrcweir { 3396*cdf0e10cSrcweir Reference<XNameReplace> xName(xPropSet->getPropertyValue(sHyperLinkEvents), uno::UNO_QUERY); 3397*cdf0e10cSrcweir GetExport().GetEventExport().Export(xName, sal_False); 3398*cdf0e10cSrcweir } 3399*cdf0e10cSrcweir } 3400*cdf0e10cSrcweir 3401*cdf0e10cSrcweir { 3402*cdf0e10cSrcweir XMLTextCharStyleNamesElementExport aCharStylesExport( 3403*cdf0e10cSrcweir GetExport(), bIsUICharStyle && 3404*cdf0e10cSrcweir aCharStyleNamesPropInfoCache.hasProperty( 3405*cdf0e10cSrcweir xPropSet, xPropSetInfo ), bHasAutoStyle, 3406*cdf0e10cSrcweir xPropSet, sCharStyleNames ); 3407*cdf0e10cSrcweir 3408*cdf0e10cSrcweir OUString aText(rTextRange->getString()); 3409*cdf0e10cSrcweir if( sStyle.getLength() ) 3410*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_STYLE_NAME, 3411*cdf0e10cSrcweir GetExport().EncodeStyleName( sStyle ) ); 3412*cdf0e10cSrcweir { 3413*cdf0e10cSrcweir // in a block to make sure it is destroyed before the text:a element 3414*cdf0e10cSrcweir SvXMLElementExport aElement( GetExport(), sStyle.getLength() > 0, 3415*cdf0e10cSrcweir XML_NAMESPACE_TEXT, XML_SPAN, sal_False, 3416*cdf0e10cSrcweir sal_False ); 3417*cdf0e10cSrcweir exportText( aText, rPrevCharIsSpace ); 3418*cdf0e10cSrcweir } 3419*cdf0e10cSrcweir } 3420*cdf0e10cSrcweir } 3421*cdf0e10cSrcweir } 3422*cdf0e10cSrcweir 3423*cdf0e10cSrcweir void XMLTextParagraphExport::exportText( const OUString& rText, 3424*cdf0e10cSrcweir sal_Bool& rPrevCharIsSpace ) 3425*cdf0e10cSrcweir { 3426*cdf0e10cSrcweir sal_Int32 nExpStartPos = 0; 3427*cdf0e10cSrcweir sal_Int32 nEndPos = rText.getLength(); 3428*cdf0e10cSrcweir sal_Int32 nSpaceChars = 0; 3429*cdf0e10cSrcweir for( sal_Int32 nPos = 0; nPos < nEndPos; nPos++ ) 3430*cdf0e10cSrcweir { 3431*cdf0e10cSrcweir sal_Unicode cChar = rText[nPos]; 3432*cdf0e10cSrcweir sal_Bool bExpCharAsText = sal_True; 3433*cdf0e10cSrcweir sal_Bool bExpCharAsElement = sal_False; 3434*cdf0e10cSrcweir sal_Bool bCurrCharIsSpace = sal_False; 3435*cdf0e10cSrcweir switch( cChar ) 3436*cdf0e10cSrcweir { 3437*cdf0e10cSrcweir case 0x0009: // Tab 3438*cdf0e10cSrcweir case 0x000A: // LF 3439*cdf0e10cSrcweir // These characters are exported as text. 3440*cdf0e10cSrcweir bExpCharAsElement = sal_True; 3441*cdf0e10cSrcweir bExpCharAsText = sal_False; 3442*cdf0e10cSrcweir break; 3443*cdf0e10cSrcweir case 0x000D: 3444*cdf0e10cSrcweir break; // legal character 3445*cdf0e10cSrcweir case 0x0020: // Blank 3446*cdf0e10cSrcweir if( rPrevCharIsSpace ) 3447*cdf0e10cSrcweir { 3448*cdf0e10cSrcweir // If the previous character is a space character, 3449*cdf0e10cSrcweir // too, export a special space element. 3450*cdf0e10cSrcweir bExpCharAsText = sal_False; 3451*cdf0e10cSrcweir } 3452*cdf0e10cSrcweir bCurrCharIsSpace = sal_True; 3453*cdf0e10cSrcweir break; 3454*cdf0e10cSrcweir default: 3455*cdf0e10cSrcweir if( cChar < 0x0020 ) 3456*cdf0e10cSrcweir { 3457*cdf0e10cSrcweir #ifdef DBG_UTIL 3458*cdf0e10cSrcweir OSL_ENSURE( txtparae_bContainsIllegalCharacters || 3459*cdf0e10cSrcweir cChar >= 0x0020, 3460*cdf0e10cSrcweir "illegal character in text content" ); 3461*cdf0e10cSrcweir txtparae_bContainsIllegalCharacters = sal_True; 3462*cdf0e10cSrcweir #endif 3463*cdf0e10cSrcweir bExpCharAsText = sal_False; 3464*cdf0e10cSrcweir } 3465*cdf0e10cSrcweir break; 3466*cdf0e10cSrcweir } 3467*cdf0e10cSrcweir 3468*cdf0e10cSrcweir // If the current character is not exported as text 3469*cdf0e10cSrcweir // the text that has not been exported by now has to be exported now. 3470*cdf0e10cSrcweir if( nPos > nExpStartPos && !bExpCharAsText ) 3471*cdf0e10cSrcweir { 3472*cdf0e10cSrcweir DBG_ASSERT( 0==nSpaceChars, "pending spaces" ); 3473*cdf0e10cSrcweir OUString sExp( rText.copy( nExpStartPos, nPos - nExpStartPos ) ); 3474*cdf0e10cSrcweir GetExport().Characters( sExp ); 3475*cdf0e10cSrcweir nExpStartPos = nPos; 3476*cdf0e10cSrcweir } 3477*cdf0e10cSrcweir 3478*cdf0e10cSrcweir // If there are spaces left that have not been exported and the 3479*cdf0e10cSrcweir // current chracter is not a space , the pending spaces have to be 3480*cdf0e10cSrcweir // exported now. 3481*cdf0e10cSrcweir if( nSpaceChars > 0 && !bCurrCharIsSpace ) 3482*cdf0e10cSrcweir { 3483*cdf0e10cSrcweir DBG_ASSERT( nExpStartPos == nPos, " pending characters" ); 3484*cdf0e10cSrcweir 3485*cdf0e10cSrcweir if( nSpaceChars > 1 ) 3486*cdf0e10cSrcweir { 3487*cdf0e10cSrcweir OUStringBuffer sTmp; 3488*cdf0e10cSrcweir sTmp.append( (sal_Int32)nSpaceChars ); 3489*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_C, 3490*cdf0e10cSrcweir sTmp.makeStringAndClear() ); 3491*cdf0e10cSrcweir } 3492*cdf0e10cSrcweir 3493*cdf0e10cSrcweir SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT, 3494*cdf0e10cSrcweir XML_S, sal_False, sal_False ); 3495*cdf0e10cSrcweir 3496*cdf0e10cSrcweir nSpaceChars = 0; 3497*cdf0e10cSrcweir } 3498*cdf0e10cSrcweir 3499*cdf0e10cSrcweir // If the current character has to be exported as a special 3500*cdf0e10cSrcweir // element, the elemnt will be exported now. 3501*cdf0e10cSrcweir if( bExpCharAsElement ) 3502*cdf0e10cSrcweir { 3503*cdf0e10cSrcweir switch( cChar ) 3504*cdf0e10cSrcweir { 3505*cdf0e10cSrcweir case 0x0009: // Tab 3506*cdf0e10cSrcweir { 3507*cdf0e10cSrcweir SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT, 3508*cdf0e10cSrcweir XML_TAB, sal_False, 3509*cdf0e10cSrcweir sal_False ); 3510*cdf0e10cSrcweir } 3511*cdf0e10cSrcweir break; 3512*cdf0e10cSrcweir case 0x000A: // LF 3513*cdf0e10cSrcweir { 3514*cdf0e10cSrcweir SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT, 3515*cdf0e10cSrcweir XML_LINE_BREAK, sal_False, 3516*cdf0e10cSrcweir sal_False ); 3517*cdf0e10cSrcweir } 3518*cdf0e10cSrcweir break; 3519*cdf0e10cSrcweir } 3520*cdf0e10cSrcweir } 3521*cdf0e10cSrcweir 3522*cdf0e10cSrcweir // If the current character is a space, and the previous one 3523*cdf0e10cSrcweir // is a space, too, the number of pending spaces is incremented 3524*cdf0e10cSrcweir // only. 3525*cdf0e10cSrcweir if( bCurrCharIsSpace && rPrevCharIsSpace ) 3526*cdf0e10cSrcweir nSpaceChars++; 3527*cdf0e10cSrcweir rPrevCharIsSpace = bCurrCharIsSpace; 3528*cdf0e10cSrcweir 3529*cdf0e10cSrcweir // If the currect character is not exported as text, the start 3530*cdf0e10cSrcweir // position for text is the position behind the current position. 3531*cdf0e10cSrcweir if( !bExpCharAsText ) 3532*cdf0e10cSrcweir { 3533*cdf0e10cSrcweir DBG_ASSERT( nExpStartPos == nPos, "wrong export start pos" ); 3534*cdf0e10cSrcweir nExpStartPos = nPos+1; 3535*cdf0e10cSrcweir } 3536*cdf0e10cSrcweir } 3537*cdf0e10cSrcweir 3538*cdf0e10cSrcweir if( nExpStartPos < nEndPos ) 3539*cdf0e10cSrcweir { 3540*cdf0e10cSrcweir DBG_ASSERT( 0==nSpaceChars, " pending spaces " ); 3541*cdf0e10cSrcweir OUString sExp( rText.copy( nExpStartPos, nEndPos - nExpStartPos ) ); 3542*cdf0e10cSrcweir GetExport().Characters( sExp ); 3543*cdf0e10cSrcweir } 3544*cdf0e10cSrcweir 3545*cdf0e10cSrcweir // If there are some spaces left, they have to be exported now. 3546*cdf0e10cSrcweir if( nSpaceChars > 0 ) 3547*cdf0e10cSrcweir { 3548*cdf0e10cSrcweir if( nSpaceChars > 1 ) 3549*cdf0e10cSrcweir { 3550*cdf0e10cSrcweir OUStringBuffer sTmp; 3551*cdf0e10cSrcweir sTmp.append( (sal_Int32)nSpaceChars ); 3552*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_TEXT, XML_C, 3553*cdf0e10cSrcweir sTmp.makeStringAndClear() ); 3554*cdf0e10cSrcweir } 3555*cdf0e10cSrcweir 3556*cdf0e10cSrcweir SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT, XML_S, 3557*cdf0e10cSrcweir sal_False, sal_False ); 3558*cdf0e10cSrcweir } 3559*cdf0e10cSrcweir } 3560*cdf0e10cSrcweir 3561*cdf0e10cSrcweir void XMLTextParagraphExport::exportTextDeclarations() 3562*cdf0e10cSrcweir { 3563*cdf0e10cSrcweir pFieldExport->ExportFieldDeclarations(); 3564*cdf0e10cSrcweir 3565*cdf0e10cSrcweir // get XPropertySet from the document and ask for AutoMarkFileURL. 3566*cdf0e10cSrcweir // If it exists, export the auto-mark-file element. 3567*cdf0e10cSrcweir Reference<XPropertySet> xPropertySet( GetExport().GetModel(), UNO_QUERY ); 3568*cdf0e10cSrcweir if (xPropertySet.is()) 3569*cdf0e10cSrcweir { 3570*cdf0e10cSrcweir OUString sUrl; 3571*cdf0e10cSrcweir OUString sIndexAutoMarkFileURL( 3572*cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM("IndexAutoMarkFileURL")); 3573*cdf0e10cSrcweir if (xPropertySet->getPropertySetInfo()->hasPropertyByName( 3574*cdf0e10cSrcweir sIndexAutoMarkFileURL)) 3575*cdf0e10cSrcweir { 3576*cdf0e10cSrcweir xPropertySet->getPropertyValue(sIndexAutoMarkFileURL) >>= sUrl; 3577*cdf0e10cSrcweir if (sUrl.getLength() > 0) 3578*cdf0e10cSrcweir { 3579*cdf0e10cSrcweir GetExport().AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, 3580*cdf0e10cSrcweir GetExport().GetRelativeReference(sUrl) ); 3581*cdf0e10cSrcweir SvXMLElementExport aAutoMarkElement( 3582*cdf0e10cSrcweir GetExport(), XML_NAMESPACE_TEXT, 3583*cdf0e10cSrcweir XML_ALPHABETICAL_INDEX_AUTO_MARK_FILE, 3584*cdf0e10cSrcweir sal_True, sal_True ); 3585*cdf0e10cSrcweir } 3586*cdf0e10cSrcweir } 3587*cdf0e10cSrcweir } 3588*cdf0e10cSrcweir } 3589*cdf0e10cSrcweir 3590*cdf0e10cSrcweir void XMLTextParagraphExport::exportTextDeclarations( 3591*cdf0e10cSrcweir const Reference<XText> & rText ) 3592*cdf0e10cSrcweir { 3593*cdf0e10cSrcweir pFieldExport->ExportFieldDeclarations(rText); 3594*cdf0e10cSrcweir } 3595*cdf0e10cSrcweir 3596*cdf0e10cSrcweir void XMLTextParagraphExport::exportUsedDeclarations( sal_Bool bOnlyUsed ) 3597*cdf0e10cSrcweir { 3598*cdf0e10cSrcweir pFieldExport->SetExportOnlyUsedFieldDeclarations( bOnlyUsed ); 3599*cdf0e10cSrcweir } 3600*cdf0e10cSrcweir 3601*cdf0e10cSrcweir 3602*cdf0e10cSrcweir void XMLTextParagraphExport::exportTrackedChanges(sal_Bool bAutoStyles) 3603*cdf0e10cSrcweir { 3604*cdf0e10cSrcweir if (NULL != pRedlineExport) 3605*cdf0e10cSrcweir pRedlineExport->ExportChangesList( bAutoStyles ); 3606*cdf0e10cSrcweir } 3607*cdf0e10cSrcweir 3608*cdf0e10cSrcweir void XMLTextParagraphExport::exportTrackedChanges( 3609*cdf0e10cSrcweir const Reference<XText> & rText, 3610*cdf0e10cSrcweir sal_Bool bAutoStyle) 3611*cdf0e10cSrcweir { 3612*cdf0e10cSrcweir if (NULL != pRedlineExport) 3613*cdf0e10cSrcweir pRedlineExport->ExportChangesList(rText, bAutoStyle); 3614*cdf0e10cSrcweir } 3615*cdf0e10cSrcweir 3616*cdf0e10cSrcweir void XMLTextParagraphExport::recordTrackedChangesForXText( 3617*cdf0e10cSrcweir const Reference<XText> & rText ) 3618*cdf0e10cSrcweir { 3619*cdf0e10cSrcweir if (NULL != pRedlineExport) 3620*cdf0e10cSrcweir pRedlineExport->SetCurrentXText(rText); 3621*cdf0e10cSrcweir } 3622*cdf0e10cSrcweir 3623*cdf0e10cSrcweir void XMLTextParagraphExport::recordTrackedChangesNoXText() 3624*cdf0e10cSrcweir { 3625*cdf0e10cSrcweir if (NULL != pRedlineExport) 3626*cdf0e10cSrcweir pRedlineExport->SetCurrentXText(); 3627*cdf0e10cSrcweir } 3628*cdf0e10cSrcweir 3629*cdf0e10cSrcweir 3630*cdf0e10cSrcweir void XMLTextParagraphExport::exportTextAutoStyles() 3631*cdf0e10cSrcweir { 3632*cdf0e10cSrcweir GetAutoStylePool().exportXML( XML_STYLE_FAMILY_TEXT_PARAGRAPH, 3633*cdf0e10cSrcweir GetExport().GetDocHandler(), 3634*cdf0e10cSrcweir GetExport().GetMM100UnitConverter(), 3635*cdf0e10cSrcweir GetExport().GetNamespaceMap() ); 3636*cdf0e10cSrcweir 3637*cdf0e10cSrcweir GetAutoStylePool().exportXML( XML_STYLE_FAMILY_TEXT_TEXT, 3638*cdf0e10cSrcweir GetExport().GetDocHandler(), 3639*cdf0e10cSrcweir GetExport().GetMM100UnitConverter(), 3640*cdf0e10cSrcweir GetExport().GetNamespaceMap() ); 3641*cdf0e10cSrcweir 3642*cdf0e10cSrcweir GetAutoStylePool().exportXML( XML_STYLE_FAMILY_TEXT_FRAME, 3643*cdf0e10cSrcweir GetExport().GetDocHandler(), 3644*cdf0e10cSrcweir GetExport().GetMM100UnitConverter(), 3645*cdf0e10cSrcweir GetExport().GetNamespaceMap() ); 3646*cdf0e10cSrcweir 3647*cdf0e10cSrcweir GetAutoStylePool().exportXML( XML_STYLE_FAMILY_TEXT_SECTION, 3648*cdf0e10cSrcweir GetExport().GetDocHandler(), 3649*cdf0e10cSrcweir GetExport().GetMM100UnitConverter(), 3650*cdf0e10cSrcweir GetExport().GetNamespaceMap() ); 3651*cdf0e10cSrcweir 3652*cdf0e10cSrcweir GetAutoStylePool().exportXML( XML_STYLE_FAMILY_TEXT_RUBY, 3653*cdf0e10cSrcweir GetExport().GetDocHandler(), 3654*cdf0e10cSrcweir GetExport().GetMM100UnitConverter(), 3655*cdf0e10cSrcweir GetExport().GetNamespaceMap() ); 3656*cdf0e10cSrcweir 3657*cdf0e10cSrcweir pListAutoPool->exportXML(); 3658*cdf0e10cSrcweir } 3659*cdf0e10cSrcweir 3660*cdf0e10cSrcweir void XMLTextParagraphExport::exportRuby( 3661*cdf0e10cSrcweir const Reference<XPropertySet> & rPropSet, 3662*cdf0e10cSrcweir sal_Bool bAutoStyles ) 3663*cdf0e10cSrcweir { 3664*cdf0e10cSrcweir // early out: a collapsed ruby makes no sense 3665*cdf0e10cSrcweir if (*(sal_Bool*)rPropSet->getPropertyValue(sIsCollapsed).getValue()) 3666*cdf0e10cSrcweir return; 3667*cdf0e10cSrcweir 3668*cdf0e10cSrcweir // start value ? 3669*cdf0e10cSrcweir sal_Bool bStart = (*(sal_Bool*)rPropSet->getPropertyValue(sIsStart).getValue()); 3670*cdf0e10cSrcweir 3671*cdf0e10cSrcweir if (bAutoStyles) 3672*cdf0e10cSrcweir { 3673*cdf0e10cSrcweir // ruby auto styles 3674*cdf0e10cSrcweir if (bStart) 3675*cdf0e10cSrcweir Add( XML_STYLE_FAMILY_TEXT_RUBY, rPropSet ); 3676*cdf0e10cSrcweir } 3677*cdf0e10cSrcweir else 3678*cdf0e10cSrcweir { 3679*cdf0e10cSrcweir // prepare element names 3680*cdf0e10cSrcweir OUString aRuby(GetXMLToken(XML_RUBY)); 3681*cdf0e10cSrcweir OUString sTextRuby(GetExport().GetNamespaceMap(). 3682*cdf0e10cSrcweir GetQNameByKey(XML_NAMESPACE_TEXT, aRuby)); 3683*cdf0e10cSrcweir OUString sRubyBase(GetXMLToken(XML_RUBY_BASE)); 3684*cdf0e10cSrcweir OUString sTextRubyBase(GetExport().GetNamespaceMap(). 3685*cdf0e10cSrcweir GetQNameByKey(XML_NAMESPACE_TEXT, sRubyBase)); 3686*cdf0e10cSrcweir 3687*cdf0e10cSrcweir if (bStart) 3688*cdf0e10cSrcweir { 3689*cdf0e10cSrcweir // ruby start 3690*cdf0e10cSrcweir 3691*cdf0e10cSrcweir // we can only start a ruby if none is open 3692*cdf0e10cSrcweir DBG_ASSERT(! bOpenRuby, "Can't open a ruby inside of ruby!"); 3693*cdf0e10cSrcweir if( bOpenRuby ) 3694*cdf0e10cSrcweir return; 3695*cdf0e10cSrcweir 3696*cdf0e10cSrcweir // save ruby text + ruby char style 3697*cdf0e10cSrcweir rPropSet->getPropertyValue(sRubyText) >>= sOpenRubyText; 3698*cdf0e10cSrcweir rPropSet->getPropertyValue(sRubyCharStyleName) >>= sOpenRubyCharStyle; 3699*cdf0e10cSrcweir 3700*cdf0e10cSrcweir // ruby style 3701*cdf0e10cSrcweir GetExport().CheckAttrList(); 3702*cdf0e10cSrcweir OUString sEmpty; 3703*cdf0e10cSrcweir OUString sStyleName(Find( XML_STYLE_FAMILY_TEXT_RUBY, rPropSet, 3704*cdf0e10cSrcweir sEmpty )); 3705*cdf0e10cSrcweir DBG_ASSERT(sStyleName.getLength() > 0, "I can't find the style!"); 3706*cdf0e10cSrcweir GetExport().AddAttribute(XML_NAMESPACE_TEXT, 3707*cdf0e10cSrcweir XML_STYLE_NAME, sStyleName); 3708*cdf0e10cSrcweir 3709*cdf0e10cSrcweir // export <text:ruby> and <text:ruby-base> start elements 3710*cdf0e10cSrcweir GetExport().StartElement( XML_NAMESPACE_TEXT, XML_RUBY, sal_False); 3711*cdf0e10cSrcweir GetExport().ClearAttrList(); 3712*cdf0e10cSrcweir GetExport().StartElement( XML_NAMESPACE_TEXT, XML_RUBY_BASE, 3713*cdf0e10cSrcweir sal_False ); 3714*cdf0e10cSrcweir bOpenRuby = sal_True; 3715*cdf0e10cSrcweir } 3716*cdf0e10cSrcweir else 3717*cdf0e10cSrcweir { 3718*cdf0e10cSrcweir // ruby end 3719*cdf0e10cSrcweir 3720*cdf0e10cSrcweir // check for an open ruby 3721*cdf0e10cSrcweir DBG_ASSERT(bOpenRuby, "Can't close a ruby if none is open!"); 3722*cdf0e10cSrcweir if( !bOpenRuby ) 3723*cdf0e10cSrcweir return; 3724*cdf0e10cSrcweir 3725*cdf0e10cSrcweir // close <text:ruby-base> 3726*cdf0e10cSrcweir GetExport().EndElement(XML_NAMESPACE_TEXT, XML_RUBY_BASE, 3727*cdf0e10cSrcweir sal_False); 3728*cdf0e10cSrcweir 3729*cdf0e10cSrcweir // write the ruby text (with char style) 3730*cdf0e10cSrcweir { 3731*cdf0e10cSrcweir if (sOpenRubyCharStyle.getLength() > 0) 3732*cdf0e10cSrcweir GetExport().AddAttribute( 3733*cdf0e10cSrcweir XML_NAMESPACE_TEXT, XML_STYLE_NAME, 3734*cdf0e10cSrcweir GetExport().EncodeStyleName( sOpenRubyCharStyle) ); 3735*cdf0e10cSrcweir 3736*cdf0e10cSrcweir SvXMLElementExport aRubyElement( 3737*cdf0e10cSrcweir GetExport(), XML_NAMESPACE_TEXT, XML_RUBY_TEXT, 3738*cdf0e10cSrcweir sal_False, sal_False); 3739*cdf0e10cSrcweir 3740*cdf0e10cSrcweir GetExport().Characters(sOpenRubyText); 3741*cdf0e10cSrcweir } 3742*cdf0e10cSrcweir 3743*cdf0e10cSrcweir // and finally, close the ruby 3744*cdf0e10cSrcweir GetExport().EndElement(XML_NAMESPACE_TEXT, XML_RUBY, sal_False); 3745*cdf0e10cSrcweir bOpenRuby = sal_False; 3746*cdf0e10cSrcweir } 3747*cdf0e10cSrcweir } 3748*cdf0e10cSrcweir } 3749*cdf0e10cSrcweir 3750*cdf0e10cSrcweir void XMLTextParagraphExport::exportMeta( 3751*cdf0e10cSrcweir const Reference<XPropertySet> & i_xPortion, 3752*cdf0e10cSrcweir sal_Bool i_bAutoStyles, sal_Bool i_isProgress) 3753*cdf0e10cSrcweir { 3754*cdf0e10cSrcweir static OUString sMeta(RTL_CONSTASCII_USTRINGPARAM("InContentMetadata")); 3755*cdf0e10cSrcweir 3756*cdf0e10cSrcweir bool doExport(!i_bAutoStyles); // do not export element if autostyles 3757*cdf0e10cSrcweir // check version >= 1.2 3758*cdf0e10cSrcweir switch (GetExport().getDefaultVersion()) { 3759*cdf0e10cSrcweir case SvtSaveOptions::ODFVER_011: // fall thru 3760*cdf0e10cSrcweir case SvtSaveOptions::ODFVER_010: doExport = false; break; 3761*cdf0e10cSrcweir default: break; 3762*cdf0e10cSrcweir } 3763*cdf0e10cSrcweir 3764*cdf0e10cSrcweir const Reference< XTextContent > xTextContent( 3765*cdf0e10cSrcweir i_xPortion->getPropertyValue(sMeta), UNO_QUERY_THROW); 3766*cdf0e10cSrcweir const Reference< XEnumerationAccess > xEA( xTextContent, UNO_QUERY_THROW ); 3767*cdf0e10cSrcweir const Reference< XEnumeration > xTextEnum( xEA->createEnumeration() ); 3768*cdf0e10cSrcweir 3769*cdf0e10cSrcweir if (doExport) 3770*cdf0e10cSrcweir { 3771*cdf0e10cSrcweir const Reference<rdf::XMetadatable> xMeta(xTextContent, UNO_QUERY_THROW); 3772*cdf0e10cSrcweir 3773*cdf0e10cSrcweir // text:meta with neither xml:id nor RDFa is invalid 3774*cdf0e10cSrcweir xMeta->ensureMetadataReference(); 3775*cdf0e10cSrcweir 3776*cdf0e10cSrcweir // xml:id and RDFa for RDF metadata 3777*cdf0e10cSrcweir GetExport().AddAttributeXmlId(xMeta); 3778*cdf0e10cSrcweir GetExport().AddAttributesRDFa(xTextContent); 3779*cdf0e10cSrcweir } 3780*cdf0e10cSrcweir 3781*cdf0e10cSrcweir SvXMLElementExport aElem( GetExport(), doExport, 3782*cdf0e10cSrcweir XML_NAMESPACE_TEXT, XML_META, sal_False, sal_False ); 3783*cdf0e10cSrcweir 3784*cdf0e10cSrcweir // recurse to export content 3785*cdf0e10cSrcweir exportTextRangeEnumeration( xTextEnum, i_bAutoStyles, i_isProgress ); 3786*cdf0e10cSrcweir } 3787*cdf0e10cSrcweir 3788*cdf0e10cSrcweir 3789*cdf0e10cSrcweir void XMLTextParagraphExport::PreventExportOfControlsInMuteSections( 3790*cdf0e10cSrcweir const Reference<XIndexAccess> & rShapes, 3791*cdf0e10cSrcweir UniReference<xmloff::OFormLayerXMLExport> xFormExport ) 3792*cdf0e10cSrcweir { 3793*cdf0e10cSrcweir // check parameters ad pre-conditions 3794*cdf0e10cSrcweir if( ( ! rShapes.is() ) || ( ! xFormExport.is() ) ) 3795*cdf0e10cSrcweir { 3796*cdf0e10cSrcweir // if we don't have shapes or a form export, there's nothing to do 3797*cdf0e10cSrcweir return; 3798*cdf0e10cSrcweir } 3799*cdf0e10cSrcweir DBG_ASSERT( pSectionExport != NULL, "We need the section export." ); 3800*cdf0e10cSrcweir 3801*cdf0e10cSrcweir Reference<XEnumeration> xShapesEnum = pBoundFrameSets->GetShapes()->createEnumeration(); 3802*cdf0e10cSrcweir if(!xShapesEnum.is()) 3803*cdf0e10cSrcweir return; 3804*cdf0e10cSrcweir while( xShapesEnum->hasMoreElements() ) 3805*cdf0e10cSrcweir { 3806*cdf0e10cSrcweir // now we need to check 3807*cdf0e10cSrcweir // 1) if this is a control shape, and 3808*cdf0e10cSrcweir // 2) if it's in a mute section 3809*cdf0e10cSrcweir // if both answers are 'yes', notify the form layer export 3810*cdf0e10cSrcweir 3811*cdf0e10cSrcweir // we join accessing the shape and testing for control 3812*cdf0e10cSrcweir Reference<XControlShape> xControlShape(xShapesEnum->nextElement(), UNO_QUERY); 3813*cdf0e10cSrcweir if( xControlShape.is() ) 3814*cdf0e10cSrcweir { 3815*cdf0e10cSrcweir // Reference<XPropertySet> xPropSet( xControlShape, UNO_QUERY ); 3816*cdf0e10cSrcweir // Reference<XTextContent> xTextContent; 3817*cdf0e10cSrcweir // xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TextRange" ) ) ) >>= xTextContent; 3818*cdf0e10cSrcweir 3819*cdf0e10cSrcweir Reference<XTextContent> xTextContent( xControlShape, UNO_QUERY ); 3820*cdf0e10cSrcweir if( xTextContent.is() ) 3821*cdf0e10cSrcweir { 3822*cdf0e10cSrcweir if( pSectionExport->IsMuteSection( xTextContent, sal_False ) ) 3823*cdf0e10cSrcweir { 3824*cdf0e10cSrcweir // Ah, we've found a shape that 3825*cdf0e10cSrcweir // 1) is a control shape 3826*cdf0e10cSrcweir // 2) is anchored in a mute section 3827*cdf0e10cSrcweir // so: don't export it! 3828*cdf0e10cSrcweir xFormExport->excludeFromExport( 3829*cdf0e10cSrcweir xControlShape->getControl() ); 3830*cdf0e10cSrcweir } 3831*cdf0e10cSrcweir // else: not in mute section -> should be exported -> nothing 3832*cdf0e10cSrcweir // to do 3833*cdf0e10cSrcweir } 3834*cdf0e10cSrcweir // else: no anchor -> ignore 3835*cdf0e10cSrcweir } 3836*cdf0e10cSrcweir // else: no control shape -> nothing to do 3837*cdf0e10cSrcweir } 3838*cdf0e10cSrcweir } 3839*cdf0e10cSrcweir sal_Int32 XMLTextParagraphExport::GetHeadingLevel( const OUString& rStyleName ) 3840*cdf0e10cSrcweir { 3841*cdf0e10cSrcweir if( !pHeadingStyles ) 3842*cdf0e10cSrcweir { 3843*cdf0e10cSrcweir pHeadingStyles = new XMLStringVector; 3844*cdf0e10cSrcweir SvxXMLNumRuleExport::GetOutlineStyles( *pHeadingStyles, 3845*cdf0e10cSrcweir GetExport().GetModel() ); 3846*cdf0e10cSrcweir } 3847*cdf0e10cSrcweir for( XMLStringVector::size_type i=0; i < pHeadingStyles->size(); ++i ) 3848*cdf0e10cSrcweir { 3849*cdf0e10cSrcweir if( (*pHeadingStyles)[i] == rStyleName ) 3850*cdf0e10cSrcweir return static_cast < sal_Int32 >( i ); 3851*cdf0e10cSrcweir } 3852*cdf0e10cSrcweir 3853*cdf0e10cSrcweir return -1; 3854*cdf0e10cSrcweir } 3855*cdf0e10cSrcweir 3856*cdf0e10cSrcweir // --> OD 2008-05-08 #refactorlists# 3857*cdf0e10cSrcweir void XMLTextParagraphExport::PushNewTextListsHelper() 3858*cdf0e10cSrcweir { 3859*cdf0e10cSrcweir mpTextListsHelper = new XMLTextListsHelper(); 3860*cdf0e10cSrcweir maTextListsHelperStack.push_back( mpTextListsHelper ); 3861*cdf0e10cSrcweir } 3862*cdf0e10cSrcweir 3863*cdf0e10cSrcweir void XMLTextParagraphExport::PopTextListsHelper() 3864*cdf0e10cSrcweir { 3865*cdf0e10cSrcweir delete mpTextListsHelper; 3866*cdf0e10cSrcweir mpTextListsHelper = 0; 3867*cdf0e10cSrcweir maTextListsHelperStack.pop_back(); 3868*cdf0e10cSrcweir if ( !maTextListsHelperStack.empty() ) 3869*cdf0e10cSrcweir { 3870*cdf0e10cSrcweir mpTextListsHelper = maTextListsHelperStack.back(); 3871*cdf0e10cSrcweir } 3872*cdf0e10cSrcweir } 3873*cdf0e10cSrcweir // <-- 3874