Branch libreoffice-5-0-4
[LibreOffice.git] / include / xmloff / prstylei.hxx
blob8ce29d50ed2b44e024d73d572e5ad4136e6e00ce
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_XMLOFF_PRSTYLEI_HXX
20 #define INCLUDED_XMLOFF_PRSTYLEI_HXX
22 #include <sal/config.h>
23 #include <xmloff/dllapi.h>
24 #include <sal/types.h>
25 #include <com/sun/star/style/XStyle.hpp>
26 #include <vector>
27 #include <xmloff/xmlstyle.hxx>
29 //UUUU
30 #include <unordered_set>
32 struct XMLPropertyState;
33 class SvXMLStylesContext;
35 namespace com { namespace sun { namespace star {
36 namespace beans { class XPropertySet; }
37 } } }
39 //UUUU
40 typedef std::unordered_set<OUString, OUStringHash> OldFillStyleDefinitionSet;
42 class XMLOFF_DLLPUBLIC XMLPropStyleContext : public SvXMLStyleContext
44 private:
45 const OUString msIsPhysical;
46 const OUString msFollowStyle;
47 ::std::vector< XMLPropertyState > maProperties;
48 ::com::sun::star::uno::Reference < ::com::sun::star::style::XStyle > mxStyle;
49 SvXMLImportContextRef mxStyles;
51 //UUUU
52 static OldFillStyleDefinitionSet maStandardSet;
53 static OldFillStyleDefinitionSet maHeaderSet;
54 static OldFillStyleDefinitionSet maFooterSet;
55 static OldFillStyleDefinitionSet maParaSet;
57 XMLPropStyleContext(XMLPropStyleContext &) SAL_DELETED_FUNCTION;
58 void operator =(XMLPropStyleContext &) SAL_DELETED_FUNCTION;
60 protected:
62 //UUUU Helper to check if the local maProperties contzains the given
63 // FillStyle tag and if the FillStyle there is different from FillStyle_NONE
64 bool doNewDrawingLayerFillStyleDefinitionsExist(
65 const ::rtl::OUString& rFillStyleTag) const;
67 //UUUU Helper which will deactivate all old fill definitions (identified by
68 // the given OldFillStyleDefinitionSet) in the local maProperties. Deactivation
69 // is done setting theindex to -1. It returns true when actually old fill
70 // definitions existed and were deactivated
71 bool deactivateOldFillStyleDefinitions(
72 const OldFillStyleDefinitionSet& rHashSetOfTags);
74 //UUUU Helper to translate new DrawingLayer FillStyle values which are name-based
75 // from ODF internal name to style display names which can be found in the current
76 // document model (using NameOrIndex Items). The change is executed on the internal
77 // maProperties. The return value is true when actually names were changed
78 bool translateNameBasedDrawingLayerFillStyleDefinitionsToStyleDisplayNames();
80 //UUUU provider for often used sets
81 static const OldFillStyleDefinitionSet& getStandardSet();
82 static const OldFillStyleDefinitionSet& getHeaderSet();
83 static const OldFillStyleDefinitionSet& getFooterSet();
84 static const OldFillStyleDefinitionSet& getParaSet();
86 virtual void SetAttribute( sal_uInt16 nPrefixKey,
87 const OUString& rLocalName,
88 const OUString& rValue ) SAL_OVERRIDE;
89 SvXMLStylesContext *GetStyles() { return static_cast<SvXMLStylesContext *>(&mxStyles); }
90 ::std::vector< XMLPropertyState > & GetProperties() { return maProperties; }
92 // Override this method to create a new style. It's called by
93 // CreateInsert to create a style if a style with the requested family and
94 // name couldn't be found.
95 virtual ::com::sun::star::uno::Reference <
96 ::com::sun::star::style::XStyle > Create();
98 public:
100 TYPEINFO_OVERRIDE();
102 XMLPropStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
103 const OUString& rLName,
104 const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
105 SvXMLStylesContext& rStyles, sal_uInt16 nFamily = 0,
106 bool bDefaultStyle=false );
107 virtual ~XMLPropStyleContext();
109 virtual SvXMLImportContext *CreateChildContext(
110 sal_uInt16 nPrefix,
111 const OUString& rLocalName,
112 const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList ) SAL_OVERRIDE;
114 virtual void FillPropertySet(
115 const ::com::sun::star::uno::Reference<
116 ::com::sun::star::beans::XPropertySet > & rPropSet );
118 const SvXMLStylesContext *GetStyles() const { return static_cast<const SvXMLStylesContext *>(&mxStyles); }
119 const ::std::vector< XMLPropertyState > & GetProperties() const { return maProperties; }
121 const ::com::sun::star::uno::Reference <
122 ::com::sun::star::style::XStyle >&
123 GetStyle() const { return mxStyle; }
124 void SetStyle(
125 const ::com::sun::star::uno::Reference<
126 ::com::sun::star::style::XStyle >& xStl) { mxStyle = xStl; }
128 virtual void SetDefaults() SAL_OVERRIDE;
130 virtual void CreateAndInsert( bool bOverwrite ) SAL_OVERRIDE;
131 virtual void Finish( bool bOverwrite ) SAL_OVERRIDE;
134 #endif
136 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */