build fix
[LibreOffice.git] / sc / inc / patattr.hxx
blob05bfc926c6acd0e453ce518d0cd469e31126c70e
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 .
20 #ifndef INCLUDED_SC_INC_PATATTR_HXX
21 #define INCLUDED_SC_INC_PATATTR_HXX
23 #include <svl/poolitem.hxx>
24 #include <svl/itemset.hxx>
25 #include <svl/languageoptions.hxx>
26 #include <unotools/fontcvt.hxx>
27 #include <editeng/svxenum.hxx>
28 #include "scdllapi.h"
29 #include "fonthelper.hxx"
30 #include <memory>
32 namespace vcl { class Font; }
33 class OutputDevice;
34 class Fraction;
35 class ScStyleSheet;
36 class SvNumberFormatter;
37 class ScDocument;
38 enum class ScRotateDir : sal_uInt8;
40 /// how to treat COL_AUTO in GetFont:
42 enum ScAutoFontColorMode
44 SC_AUTOCOL_RAW, ///< COL_AUTO is returned
45 SC_AUTOCOL_BLACK, ///< always use black
46 SC_AUTOCOL_PRINT, ///< black or white, depending on background
47 SC_AUTOCOL_DISPLAY, ///< from style settings, or black/white if needed
48 SC_AUTOCOL_IGNOREFONT, ///< like DISPLAY, but ignore stored font color (assume COL_AUTO)
49 SC_AUTOCOL_IGNOREBACK, ///< like DISPLAY, but ignore stored background color (use configured color)
50 SC_AUTOCOL_IGNOREALL ///< like DISPLAY, but ignore stored font and background colors
53 class SC_DLLPUBLIC ScPatternAttr: public SfxSetItem
55 std::unique_ptr<OUString> pName;
56 ScStyleSheet* pStyle;
57 sal_uInt64 mnKey;
58 public:
59 ScPatternAttr(SfxItemSet* pItemSet, const OUString& rStyleName);
60 ScPatternAttr(SfxItemSet* pItemSet);
61 ScPatternAttr(SfxItemPool* pItemPool);
62 ScPatternAttr(const ScPatternAttr& rPatternAttr);
64 virtual ~ScPatternAttr() override;
66 virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override;
67 virtual SfxPoolItem* Create(SvStream& rStream, sal_uInt16 nVersion) const override;
68 virtual SvStream& Store(SvStream& rStream, sal_uInt16 nItemVersion) const override;
70 virtual bool operator==(const SfxPoolItem& rCmp) const override;
72 const SfxPoolItem& GetItem( sal_uInt16 nWhichP ) const
73 { return GetItemSet().Get(nWhichP); }
75 static const SfxPoolItem& GetItem( sal_uInt16 nWhich, const SfxItemSet& rItemSet, const SfxItemSet* pCondSet );
76 const SfxPoolItem& GetItem( sal_uInt16 nWhich, const SfxItemSet* pCondSet ) const;
78 /// @param pWhich are no ranges, but single IDs, 0-terminated
79 bool HasItemsSet( const sal_uInt16* pWhich ) const;
80 void ClearItems( const sal_uInt16* pWhich );
82 void DeleteUnchanged( const ScPatternAttr* pOldAttrs );
84 static SvxCellOrientation GetCellOrientation( const SfxItemSet& rItemSet, const SfxItemSet* pCondSet );
85 SvxCellOrientation GetCellOrientation( const SfxItemSet* pCondSet = nullptr ) const;
87 /** Static helper function to fill a font object from the passed item set. */
88 static void GetFont( vcl::Font& rFont, const SfxItemSet& rItemSet,
89 ScAutoFontColorMode eAutoMode,
90 OutputDevice* pOutDev = nullptr,
91 const Fraction* pScale = nullptr,
92 const SfxItemSet* pCondSet = nullptr,
93 SvtScriptType nScript = SvtScriptType::NONE, const Color* pBackConfigColor = nullptr,
94 const Color* pTextConfigColor = nullptr );
96 static ScDxfFont GetDxfFont(const SfxItemSet& rSet, SvtScriptType nScript);
97 /** Fills a font object from the own item set. */
98 void GetFont( vcl::Font& rFont, ScAutoFontColorMode eAutoMode,
99 OutputDevice* pOutDev = nullptr,
100 const Fraction* pScale = nullptr,
101 const SfxItemSet* pCondSet = nullptr,
102 SvtScriptType nScript = SvtScriptType::NONE, const Color* pBackConfigColor = nullptr,
103 const Color* pTextConfigColor = nullptr ) const;
105 /** Converts all Calc items contained in rSrcSet to edit engine items and puts them into rEditSet. */
106 static void FillToEditItemSet( SfxItemSet& rEditSet, const SfxItemSet& rSrcSet, const SfxItemSet* pCondSet = nullptr );
107 /** Converts all Calc items contained in the own item set to edit engine items and puts them into pEditSet. */
108 void FillEditItemSet( SfxItemSet* pEditSet, const SfxItemSet* pCondSet = nullptr ) const;
110 /** Converts all edit engine items contained in rEditSet to Calc items and puts them into rDestSet. */
111 static void GetFromEditItemSet( SfxItemSet& rDestSet, const SfxItemSet& rEditSet );
112 /** Converts all edit engine items contained in pEditSet to Calc items and puts them into the own item set. */
113 void GetFromEditItemSet( const SfxItemSet* pEditSet );
115 void FillEditParaItems( SfxItemSet* pSet ) const;
117 ScPatternAttr* PutInPool( ScDocument* pDestDoc, ScDocument* pSrcDoc ) const;
119 void SetStyleSheet(ScStyleSheet* pNewStyle, bool bClearDirectFormat = true);
120 const ScStyleSheet* GetStyleSheet() const { return pStyle; }
121 const OUString* GetStyleName() const;
122 void UpdateStyleSheet(ScDocument* pDoc);
123 void StyleToName();
125 bool IsVisible() const;
126 bool IsVisibleEqual( const ScPatternAttr& rOther ) const;
128 /** If font is an old symbol font StarBats/StarMath
129 with text encoding RTL_TEXTENC_SYMBOL */
130 bool IsSymbolFont() const;
132 sal_uLong GetNumberFormat( SvNumberFormatter* ) const;
133 sal_uLong GetNumberFormat( SvNumberFormatter* pFormatter,
134 const SfxItemSet* pCondSet ) const;
136 long GetRotateVal( const SfxItemSet* pCondSet ) const;
137 ScRotateDir GetRotateDir( const SfxItemSet* pCondSet ) const;
139 void SetKey(sal_uInt64 nKey);
140 sal_uInt64 GetKey() const;
143 #endif
145 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */