1*38d50f7bSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*38d50f7bSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*38d50f7bSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*38d50f7bSAndrew Rist * distributed with this work for additional information 6*38d50f7bSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*38d50f7bSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*38d50f7bSAndrew Rist * "License"); you may not use this file except in compliance 9*38d50f7bSAndrew Rist * with the License. You may obtain a copy of the License at 10*38d50f7bSAndrew Rist * 11*38d50f7bSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*38d50f7bSAndrew Rist * 13*38d50f7bSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*38d50f7bSAndrew Rist * software distributed under the License is distributed on an 15*38d50f7bSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*38d50f7bSAndrew Rist * KIND, either express or implied. See the License for the 17*38d50f7bSAndrew Rist * specific language governing permissions and limitations 18*38d50f7bSAndrew Rist * under the License. 19*38d50f7bSAndrew Rist * 20*38d50f7bSAndrew Rist *************************************************************/ 21*38d50f7bSAndrew Rist 22*38d50f7bSAndrew Rist 23cdf0e10cSrcweir #ifndef SC_XMLANNOI_HXX 24cdf0e10cSrcweir #define SC_XMLANNOI_HXX 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include <memory> 27cdf0e10cSrcweir #include <xmloff/xmlictxt.hxx> 28cdf0e10cSrcweir #include <xmloff/xmlimp.hxx> 29cdf0e10cSrcweir #include <rtl/ustrbuf.hxx> 30cdf0e10cSrcweir #include <editeng/editdata.hxx> 31cdf0e10cSrcweir #include <com/sun/star/drawing/XShape.hpp> 32cdf0e10cSrcweir #include <com/sun/star/drawing/XShapes.hpp> 33cdf0e10cSrcweir 34cdf0e10cSrcweir class ScXMLImport; 35cdf0e10cSrcweir class ScXMLTableRowCellContext; 36cdf0e10cSrcweir 37cdf0e10cSrcweir struct ScXMLAnnotationStyleEntry 38cdf0e10cSrcweir { 39cdf0e10cSrcweir sal_uInt16 mnFamily; 40cdf0e10cSrcweir rtl::OUString maName; 41cdf0e10cSrcweir ESelection maSelection; 42cdf0e10cSrcweir ScXMLAnnotationStyleEntryScXMLAnnotationStyleEntry43cdf0e10cSrcweir ScXMLAnnotationStyleEntry( sal_uInt16 nFam, const rtl::OUString& rNam, const ESelection& rSel ) : 44cdf0e10cSrcweir mnFamily( nFam ), 45cdf0e10cSrcweir maName( rNam ), 46cdf0e10cSrcweir maSelection( rSel ) 47cdf0e10cSrcweir { 48cdf0e10cSrcweir } 49cdf0e10cSrcweir }; 50cdf0e10cSrcweir 51cdf0e10cSrcweir struct ScXMLAnnotationData 52cdf0e10cSrcweir { 53cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > 54cdf0e10cSrcweir mxShape; 55cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > 56cdf0e10cSrcweir mxShapes; 57cdf0e10cSrcweir ::rtl::OUString maAuthor; 58cdf0e10cSrcweir ::rtl::OUString maCreateDate; 59cdf0e10cSrcweir ::rtl::OUString maSimpleText; 60cdf0e10cSrcweir ::rtl::OUString maStyleName; 61cdf0e10cSrcweir ::rtl::OUString maTextStyle; 62cdf0e10cSrcweir bool mbUseShapePos; 63cdf0e10cSrcweir bool mbShown; 64cdf0e10cSrcweir std::vector<ScXMLAnnotationStyleEntry> maContentStyles; 65cdf0e10cSrcweir 66cdf0e10cSrcweir explicit ScXMLAnnotationData(); 67cdf0e10cSrcweir ~ScXMLAnnotationData(); 68cdf0e10cSrcweir }; 69cdf0e10cSrcweir 70cdf0e10cSrcweir class ScXMLAnnotationContext : public SvXMLImportContext 71cdf0e10cSrcweir { 72cdf0e10cSrcweir public: 73cdf0e10cSrcweir 74cdf0e10cSrcweir ScXMLAnnotationContext( ScXMLImport& rImport, sal_uInt16 nPrfx, 75cdf0e10cSrcweir const ::rtl::OUString& rLName, 76cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 77cdf0e10cSrcweir ::com::sun::star::xml::sax::XAttributeList>& xAttrList, 78cdf0e10cSrcweir ScXMLAnnotationData& rAnnotationData, 79cdf0e10cSrcweir ScXMLTableRowCellContext* pCellContext); 80cdf0e10cSrcweir 81cdf0e10cSrcweir virtual ~ScXMLAnnotationContext(); 82cdf0e10cSrcweir 83cdf0e10cSrcweir virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, 84cdf0e10cSrcweir const ::rtl::OUString& rLocalName, 85cdf0e10cSrcweir const ::com::sun::star::uno::Reference< 86cdf0e10cSrcweir ::com::sun::star::xml::sax::XAttributeList>& xAttrList ); 87cdf0e10cSrcweir 88cdf0e10cSrcweir virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList); 89cdf0e10cSrcweir 90cdf0e10cSrcweir virtual void Characters( const ::rtl::OUString& rChars ); 91cdf0e10cSrcweir 92cdf0e10cSrcweir virtual void EndElement(); 93cdf0e10cSrcweir 94cdf0e10cSrcweir void SetShape( 95cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape, 96cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes, 97cdf0e10cSrcweir const ::rtl::OUString& rStyleName, const ::rtl::OUString& rTextStyle ); 98cdf0e10cSrcweir 99cdf0e10cSrcweir void AddContentStyle( sal_uInt16 nFamily, const rtl::OUString& rName, const ESelection& rSelection ); 100cdf0e10cSrcweir 101cdf0e10cSrcweir private: 102cdf0e10cSrcweir ScXMLAnnotationData& mrAnnotationData; 103cdf0e10cSrcweir rtl::OUStringBuffer maTextBuffer; 104cdf0e10cSrcweir rtl::OUStringBuffer maAuthorBuffer; 105cdf0e10cSrcweir rtl::OUStringBuffer maCreateDateBuffer; 106cdf0e10cSrcweir rtl::OUStringBuffer maCreateDateStringBuffer; 107cdf0e10cSrcweir sal_Int32 nParagraphCount; 108cdf0e10cSrcweir sal_Bool bHasTextP; 109cdf0e10cSrcweir ScXMLTableRowCellContext* pCellContext; 110cdf0e10cSrcweir SvXMLImportContext* pShapeContext; 111cdf0e10cSrcweir GetScImport() const112cdf0e10cSrcweir const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); } GetScImport()113cdf0e10cSrcweir ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); } 114cdf0e10cSrcweir }; 115cdf0e10cSrcweir 116cdf0e10cSrcweir 117cdf0e10cSrcweir #endif 118cdf0e10cSrcweir 119