1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 #ifndef _XMLOFF_PRSTYLEI_HXX_ 23 #define _XMLOFF_PRSTYLEI_HXX_ 24 25 #include "sal/config.h" 26 #include "xmloff/dllapi.h" 27 #include "sal/types.h" 28 #include <com/sun/star/style/XStyle.hpp> 29 #include <vector> 30 #include <xmloff/xmlstyle.hxx> 31 32 //UUUU 33 #include <hash_set> 34 35 struct XMLPropertyState; 36 class SvXMLStylesContext; 37 38 namespace com { namespace sun { namespace star { 39 namespace beans { class XPropertySet; } 40 } } } 41 42 //UUUU 43 typedef std::hash_set< rtl::OUString, rtl::OUStringHash > OldFillStyleDefinitionSet; 44 45 class XMLOFF_DLLPUBLIC XMLPropStyleContext : public SvXMLStyleContext 46 { 47 private: 48 const ::rtl::OUString msIsPhysical; 49 const ::rtl::OUString msFollowStyle; 50 ::std::vector< XMLPropertyState > maProperties; 51 ::com::sun::star::uno::Reference < ::com::sun::star::style::XStyle > mxStyle; 52 SvXMLImportContextRef mxStyles; 53 54 //UUUU 55 static OldFillStyleDefinitionSet maStandardSet; 56 static OldFillStyleDefinitionSet maHeaderSet; 57 static OldFillStyleDefinitionSet maFooterSet; 58 static OldFillStyleDefinitionSet maParaSet; 59 60 SAL_DLLPRIVATE XMLPropStyleContext(XMLPropStyleContext &); // not defined 61 SAL_DLLPRIVATE void operator =(XMLPropStyleContext &); // not defined 62 63 protected: 64 65 //UUUU Helper to check if the local maProperties contains the given 66 // FillStyle tag and if the FillStyle there is different from FillStyle_NONE 67 bool doNewDrawingLayerFillStyleDefinitionsExist( 68 const ::rtl::OUString& rFillStyleTag) const; 69 70 //UUUU Helper which will deactivate all old fill definitions (identified by 71 // the given OldFillStyleDefinitionSet) in the local maProperties. Deactivation 72 // is done setting the index to -1. It returns true when actually old fill 73 // definitions existed and were deactivated 74 bool deactivateOldFillStyleDefinitions( 75 const OldFillStyleDefinitionSet& rHashSetOfTags); 76 77 //UUUU Helper to translate new DrawingLayer FillStyle values which are name-based 78 // from ODF internal name to style display names which can be found in the current 79 // document model (using NameOrIndex Items). The change is executed on the internal 80 // maProperties. The return value is true when actually names were changed 81 bool translateNameBasedDrawingLayerFillStyleDefinitionsToStyleDisplayNames(); 82 83 //UUUU provider for often used sets 84 const OldFillStyleDefinitionSet& getStandardSet(); 85 const OldFillStyleDefinitionSet& getHeaderSet(); 86 const OldFillStyleDefinitionSet& getFooterSet(); 87 const OldFillStyleDefinitionSet& getParaSet(); 88 89 virtual void SetAttribute( sal_uInt16 nPrefixKey, 90 const ::rtl::OUString& rLocalName, 91 const ::rtl::OUString& rValue ); 92 SvXMLStylesContext *GetStyles() { return (SvXMLStylesContext *)&mxStyles; } 93 ::std::vector< XMLPropertyState > & GetProperties() { return maProperties; } 94 95 // This method may be overloaded to create a new style. It's called by 96 // CreateInsert to create a style if a style with the requested family and 97 // name couldn't be found. The st 98 virtual ::com::sun::star::uno::Reference < 99 ::com::sun::star::style::XStyle > Create(); 100 101 public: 102 103 TYPEINFO(); 104 105 XMLPropStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx, 106 const ::rtl::OUString& rLName, 107 const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList, 108 SvXMLStylesContext& rStyles, sal_uInt16 nFamily = 0, 109 sal_Bool bDefaultStyle=sal_False ); 110 virtual ~XMLPropStyleContext(); 111 112 virtual SvXMLImportContext *CreateChildContext( 113 sal_uInt16 nPrefix, 114 const ::rtl::OUString& rLocalName, 115 const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList ); 116 117 virtual void FillPropertySet( 118 const ::com::sun::star::uno::Reference< 119 ::com::sun::star::beans::XPropertySet > & rPropSet ); 120 121 const SvXMLStylesContext *GetStyles() const { return (const SvXMLStylesContext *)&mxStyles; } 122 const ::std::vector< XMLPropertyState > & GetProperties() const { return maProperties; } 123 124 const ::com::sun::star::uno::Reference < 125 ::com::sun::star::style::XStyle >& 126 GetStyle() const { return mxStyle; } 127 void SetStyle( 128 const ::com::sun::star::uno::Reference< 129 ::com::sun::star::style::XStyle >& xStl) { mxStyle = xStl; } 130 131 virtual void SetDefaults(); 132 133 virtual void CreateAndInsert( sal_Bool bOverwrite ); 134 virtual void Finish( sal_Bool bOverwrite ); 135 }; 136 137 #endif 138