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