1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: patattr.hxx,v $
10 * $Revision: 1.14.32.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SC_SCPATATR_HXX
32 #define SC_SCPATATR_HXX
34 #include <svtools/poolitem.hxx>
35 #include <svtools/itemset.hxx>
36 #include <vcl/fontcvt.hxx>
37 #include <svx/svxenum.hxx>
44 class SvNumberFormatter
;
48 // how to treat COL_AUTO in GetFont:
50 enum ScAutoFontColorMode
52 SC_AUTOCOL_RAW
, // COL_AUTO is returned
53 SC_AUTOCOL_BLACK
, // always use black
54 SC_AUTOCOL_PRINT
, // black or white, depending on background
55 SC_AUTOCOL_DISPLAY
, // from style settings, or black/white if needed
56 SC_AUTOCOL_IGNOREFONT
, // like DISPLAY, but ignore stored font color (assume COL_AUTO)
57 SC_AUTOCOL_IGNOREBACK
, // like DISPLAY, but ignore stored background color (use configured color)
58 SC_AUTOCOL_IGNOREALL
// like DISPLAY, but ignore stored font and background colors
62 class SC_DLLPUBLIC ScPatternAttr
: public SfxSetItem
67 static ScDocument
* pDoc
;
68 ScPatternAttr(SfxItemSet
* pItemSet
, const String
& rStyleName
);
69 ScPatternAttr(SfxItemSet
* pItemSet
, ScStyleSheet
* pStyleSheet
= NULL
);
70 ScPatternAttr(SfxItemPool
* pItemPool
);
71 ScPatternAttr(const ScPatternAttr
& rPatternAttr
);
75 virtual SfxPoolItem
* Clone( SfxItemPool
*pPool
= 0 ) const;
76 virtual SfxPoolItem
* Create(SvStream
& rStream
, USHORT nVersion
) const;
77 virtual SvStream
& Store(SvStream
& rStream
, USHORT nItemVersion
) const;
79 virtual int operator==(const SfxPoolItem
& rCmp
) const;
81 const SfxPoolItem
& GetItem( USHORT nWhichP
) const
82 { return GetItemSet().Get(nWhichP
); }
84 static const SfxPoolItem
& GetItem( USHORT nWhich
, const SfxItemSet
& rItemSet
, const SfxItemSet
* pCondSet
);
85 const SfxPoolItem
& GetItem( USHORT nWhich
, const SfxItemSet
* pCondSet
) const;
87 // pWhich sind keine Ranges, sondern einzelne IDs, 0-terminiert
88 BOOL
HasItemsSet( const USHORT
* pWhich
) const;
89 void ClearItems( const USHORT
* pWhich
);
91 void DeleteUnchanged( const ScPatternAttr
* pOldAttrs
);
93 static SvxCellOrientation
GetCellOrientation( const SfxItemSet
& rItemSet
, const SfxItemSet
* pCondSet
= 0 );
94 SvxCellOrientation
GetCellOrientation( const SfxItemSet
* pCondSet
= 0 ) const;
96 /** Static helper function to fill a font object from the passed item set. */
97 static void GetFont( Font
& rFont
, const SfxItemSet
& rItemSet
,
98 ScAutoFontColorMode eAutoMode
,
99 OutputDevice
* pOutDev
= NULL
,
100 const Fraction
* pScale
= NULL
,
101 const SfxItemSet
* pCondSet
= NULL
,
102 BYTE nScript
= 0, const Color
* pBackConfigColor
= NULL
,
103 const Color
* pTextConfigColor
= NULL
);
104 /** Fills a font object from the own item set. */
105 void GetFont( Font
& rFont
, ScAutoFontColorMode eAutoMode
,
106 OutputDevice
* pOutDev
= NULL
,
107 const Fraction
* pScale
= NULL
,
108 const SfxItemSet
* pCondSet
= NULL
,
109 BYTE nScript
= 0, const Color
* pBackConfigColor
= NULL
,
110 const Color
* pTextConfigColor
= NULL
) const;
112 /** Converts all Calc items contained in rSrcSet to edit engine items and puts them into rEditSet. */
113 static void FillToEditItemSet( SfxItemSet
& rEditSet
, const SfxItemSet
& rSrcSet
, const SfxItemSet
* pCondSet
= NULL
);
114 /** Converts all Calc items contained in the own item set to edit engine items and puts them into pEditSet. */
115 void FillEditItemSet( SfxItemSet
* pEditSet
, const SfxItemSet
* pCondSet
= NULL
) const;
117 /** Converts all edit engine items contained in rEditSet to Calc items and puts them into rDestSet. */
118 static void GetFromEditItemSet( SfxItemSet
& rDestSet
, const SfxItemSet
& rEditSet
);
119 /** Converts all edit engine items contained in pEditSet to Calc items and puts them into the own item set. */
120 void GetFromEditItemSet( const SfxItemSet
* pEditSet
);
122 void FillEditParaItems( SfxItemSet
* pSet
) const;
124 ScPatternAttr
* PutInPool( ScDocument
* pDestDoc
, ScDocument
* pSrcDoc
) const;
126 void SetStyleSheet(ScStyleSheet
* pNewStyle
);
127 const ScStyleSheet
* GetStyleSheet() const { return pStyle
; }
128 const String
* GetStyleName() const;
129 void UpdateStyleSheet();
132 BOOL
IsVisible() const;
133 BOOL
IsVisibleEqual( const ScPatternAttr
& rOther
) const;
135 /** If font is an old symbol font StarBats/StarMath
136 with text encoding RTL_TEXTENC_SYMBOL */
137 BOOL
IsSymbolFont() const;
139 //UNUSED2008-05 /** Create a FontToSubsFontConverter if needed for
140 //UNUSED2008-05 this pattern, else return 0.
142 //UNUSED2008-05 @param nFlags is the bit mask which shall be
143 //UNUSED2008-05 used for CreateFontToSubsFontConverter().
145 //UNUSED2008-05 The converter must be destroyed by the caller
146 //UNUSED2008-05 using DestroyFontToSubsFontConverter() which
147 //UNUSED2008-05 should be accomplished using the
148 //UNUSED2008-05 ScFontToSubsFontConverter_AutoPtr
150 //UNUSED2008-05 FontToSubsFontConverter GetSubsFontConverter( ULONG nFlags ) const;
152 ULONG
GetNumberFormat( SvNumberFormatter
* ) const;
153 ULONG
GetNumberFormat( SvNumberFormatter
* pFormatter
,
154 const SfxItemSet
* pCondSet
) const;
156 long GetRotateVal( const SfxItemSet
* pCondSet
) const;
157 BYTE
GetRotateDir( const SfxItemSet
* pCondSet
) const;
161 class ScFontToSubsFontConverter_AutoPtr
163 FontToSubsFontConverter h
;
168 DestroyFontToSubsFontConverter( h
);
172 ScFontToSubsFontConverter_AutoPtr( const ScFontToSubsFontConverter_AutoPtr
& );
173 ScFontToSubsFontConverter_AutoPtr
& operator=( const ScFontToSubsFontConverter_AutoPtr
& );
176 ScFontToSubsFontConverter_AutoPtr()
179 ~ScFontToSubsFontConverter_AutoPtr()
184 ScFontToSubsFontConverter_AutoPtr
& operator=( FontToSubsFontConverter hN
)
191 operator FontToSubsFontConverter() const