nss: upgrade to release 3.73
[LibreOffice.git] / include / xmloff / prstylei.hxx
blobb79ae267f9b11015f103e68de5a88de326ce9438
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 <vector>
26 #include <xmloff/xmlstyle.hxx>
28 #include <unordered_set>
30 struct XMLPropertyState;
32 namespace com::sun::star {
33 namespace beans { class XPropertySet; }
36 namespace com::sun::star::style { class XStyle; }
38 typedef std::unordered_set<OUString> OldFillStyleDefinitionSet;
40 class XMLOFF_DLLPUBLIC XMLPropStyleContext : public SvXMLStyleContext
42 private:
43 ::std::vector< XMLPropertyState > maProperties;
44 css::uno::Reference < css::style::XStyle > mxStyle;
45 rtl::Reference<SvXMLStylesContext> mxStyles;
47 XMLPropStyleContext(XMLPropStyleContext const &) = delete;
48 XMLPropStyleContext& operator =(XMLPropStyleContext const &) = delete;
50 public:
52 // Helper to check if the local maProperties contains the given
53 // FillStyle tag and if the FillStyle there is different from FillStyle_NONE
54 bool doNewDrawingLayerFillStyleDefinitionsExist(
55 const OUString& rFillStyleTag) const;
57 protected:
59 // Helper which will deactivate all old fill definitions (identified by
60 // the given OldFillStyleDefinitionSet) in the local maProperties. Deactivation
61 // is done setting theindex to -1. It returns true when actually old fill
62 // definitions existed and were deactivated
63 void deactivateOldFillStyleDefinitions(
64 const OldFillStyleDefinitionSet& rHashSetOfTags);
66 // Helper to translate new DrawingLayer FillStyle values which are name-based
67 // from ODF internal name to style display names which can be found in the current
68 // document model (using NameOrIndex Items). The change is executed on the internal
69 // maProperties. The return value is true when actually names were changed
70 void translateNameBasedDrawingLayerFillStyleDefinitionsToStyleDisplayNames();
72 // provider for often used sets
73 static const OldFillStyleDefinitionSet& getStandardSet();
74 static const OldFillStyleDefinitionSet& getHeaderSet();
75 static const OldFillStyleDefinitionSet& getFooterSet();
77 virtual void SetAttribute( sal_uInt16 nPrefixKey,
78 const OUString& rLocalName,
79 const OUString& rValue ) override;
80 SvXMLStylesContext *GetStyles() { return mxStyles.get(); }
81 ::std::vector< XMLPropertyState > & GetProperties() { return maProperties; }
83 // Override this method to create a new style. It's called by
84 // CreateInsert to create a style if a style with the requested family and
85 // name couldn't be found.
86 virtual css::uno::Reference< css::style::XStyle > Create();
88 public:
91 XMLPropStyleContext( SvXMLImport& rImport,
92 SvXMLStylesContext& rStyles, XmlStyleFamily nFamily,
93 bool bDefaultStyle=false );
94 virtual ~XMLPropStyleContext() override;
96 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
97 sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
99 virtual void FillPropertySet(
100 const css::uno::Reference< css::beans::XPropertySet > & rPropSet );
102 virtual bool isEmptyDataStyleName() { return false; };
104 const SvXMLStylesContext *GetStyles() const { return static_cast<const SvXMLStylesContext *>(mxStyles.get()); }
105 const ::std::vector< XMLPropertyState > & GetProperties() const { return maProperties; }
107 const css::uno::Reference< css::style::XStyle >&
108 GetStyle() const { return mxStyle; }
109 void SetStyle(
110 const css::uno::Reference< css::style::XStyle >& xStl) { mxStyle = xStl; }
112 virtual void SetDefaults() override;
114 virtual void CreateAndInsert( bool bOverwrite ) override;
115 virtual void Finish( bool bOverwrite ) override;
118 #endif
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */