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