LibreOffice Module xmloff (master) 1
prstylei.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19#ifndef INCLUDED_XMLOFF_PRSTYLEI_HXX
20#define INCLUDED_XMLOFF_PRSTYLEI_HXX
21
22#include <sal/config.h>
23#include <xmloff/dllapi.h>
24#include <sal/types.h>
25#include <vector>
26#include <xmloff/xmlstyle.hxx>
27
28#include <unordered_set>
29
30struct XMLPropertyState;
31
32namespace com::sun::star {
33 namespace beans { class XPropertySet; }
34}
35
36namespace com::sun::star::style { class XStyle; }
37
38typedef std::unordered_set<OUString> OldFillStyleDefinitionSet;
39
41{
42private:
43 ::std::vector< XMLPropertyState > maProperties;
44 css::uno::Reference < css::style::XStyle > mxStyle;
46
48 XMLPropStyleContext& operator =(XMLPropStyleContext const &) = delete;
49
50public:
51
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;
56
57protected:
58
59 // Helper which will deactivate all old fill definitions (identified by
60 // the given OldFillStyleDefinitionSet) in the local maProperties. Deactivation
61 // is done setting the index to -1. It returns true when actually old fill
62 // definitions existed and were deactivated
63 void deactivateOldFillStyleDefinitions(
64 const OldFillStyleDefinitionSet& rHashSetOfTags);
65
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();
71
72 // provider for often used sets
73 static const OldFillStyleDefinitionSet& getStandardSet();
74 static const OldFillStyleDefinitionSet& getHeaderSet();
75 static const OldFillStyleDefinitionSet& getFooterSet();
76
77 virtual void SetAttribute( sal_Int32 nElement, const OUString& rValue ) override;
78 SvXMLStylesContext *GetStyles() { return mxStyles.get(); }
79 ::std::vector< XMLPropertyState > & GetProperties() { return maProperties; }
80
81 // Override this method to create a new style. It's called by
82 // CreateInsert to create a style if a style with the requested family and
83 // name couldn't be found.
84 virtual css::uno::Reference< css::style::XStyle > Create();
85
86public:
87
88
90 SvXMLStylesContext& rStyles, XmlStyleFamily nFamily,
91 bool bDefaultStyle=false );
92 virtual ~XMLPropStyleContext() override;
93
94 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
95 sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
96
97 virtual void FillPropertySet(
98 const css::uno::Reference< css::beans::XPropertySet > & rPropSet );
99
100 virtual bool isEmptyDataStyleName() { return false; };
101
102 const SvXMLStylesContext *GetStyles() const { return static_cast<const SvXMLStylesContext *>(mxStyles.get()); }
103 const ::std::vector< XMLPropertyState > & GetProperties() const { return maProperties; }
104
105 const css::uno::Reference< css::style::XStyle >&
106 GetStyle() const { return mxStyle; }
108 const css::uno::Reference< css::style::XStyle >& xStl) { mxStyle = xStl; }
109
110 virtual void SetDefaults() override;
111
112 virtual void CreateAndInsert( bool bOverwrite ) override;
113 virtual void Finish( bool bOverwrite ) override;
114};
115
116#endif
117
118/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual css::uno::Reference< XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 Element, const css::uno::Reference< css::xml::sax::XFastAttributeList > &Attribs) override
Definition: xmlictxt.cxx:59
virtual void SetAttribute(sal_Int32 nElement, const OUString &rValue)
Definition: xmlstyle.cxx:68
virtual void Finish(bool bOverwrite)
Definition: xmlstyle.cxx:142
virtual void CreateAndInsert(bool bOverwrite)
Definition: xmlstyle.cxx:134
virtual void SetDefaults()
Definition: xmlstyle.cxx:130
virtual bool isEmptyDataStyleName()
Definition: prstylei.hxx:100
const css::uno::Reference< css::style::XStyle > & GetStyle() const
Definition: prstylei.hxx:106
::std::vector< XMLPropertyState > & GetProperties()
Definition: prstylei.hxx:79
XMLPropStyleContext(XMLPropStyleContext const &)=delete
const SvXMLStylesContext * GetStyles() const
Definition: prstylei.hxx:102
void SetStyle(const css::uno::Reference< css::style::XStyle > &xStl)
Definition: prstylei.hxx:107
css::uno::Reference< css::style::XStyle > mxStyle
Definition: prstylei.hxx:44
rtl::Reference< SvXMLStylesContext > mxStyles
Definition: prstylei.hxx:45
::std::vector< XMLPropertyState > maProperties
Definition: prstylei.hxx:43
SvXMLStylesContext * GetStyles()
Definition: prstylei.hxx:78
const ::std::vector< XMLPropertyState > & GetProperties() const
Definition: prstylei.hxx:103
#define XMLOFF_DLLPUBLIC
Definition: dllapi.h:29
XmlStyleFamily
Definition: families.hxx:50
SvGenericNameContainerMapImpl maProperties
class SAL_NO_VTABLE XPropertySet
void Create(SwFormatVertOrient &rItem, SvStream &rStrm, sal_uInt16 nVersionAbusedAsSize)
std::unordered_set< OUString > OldFillStyleDefinitionSet
Definition: prstylei.hxx:38
Smart struct to transport an Any with an index to the appropriate property-name.
Definition: maptype.hxx:140