summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorDaniel Rentz <dr@openoffice.org>2001-11-19 12:32:53 +0000
committerDaniel Rentz <dr@openoffice.org>2001-11-19 12:32:53 +0000
commitfad29de7566b7e7fae5750ae53fd0d04f3a71bcb (patch)
tree99bf9e3aca05772ee40e2d0e611ddbcc100f692c /sc
parentfbf40abe31ff1ca1f7eb40fae5aec3ff69157f3f (diff)
#94539# Support CJK/CTL in table autoformat dialogs
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/autoform.hxx395
-rw-r--r--sc/inc/document.hxx10
-rw-r--r--sc/inc/zforauto.hxx6
-rw-r--r--sc/source/core/data/documen6.cxx32
-rw-r--r--sc/source/core/data/table4.cxx176
-rw-r--r--sc/source/core/tool/autoform.cxx1187
-rw-r--r--sc/source/ui/inc/autofmt.hxx57
-rw-r--r--sc/source/ui/miscdlgs/autofmt.cxx187
-rw-r--r--sc/source/ui/view/cellsh3.cxx7
9 files changed, 819 insertions, 1238 deletions
diff --git a/sc/inc/autoform.hxx b/sc/inc/autoform.hxx
index 8a92c28b66fd..dd53f335cf1f 100644
--- a/sc/inc/autoform.hxx
+++ b/sc/inc/autoform.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: autoform.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: dr $ $Date: 2001-11-14 15:07:27 $
+ * last change: $Author: dr $ $Date: 2001-11-19 13:28:26 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -83,235 +83,262 @@ JP 20.07.95:
#ifndef SC_ITEMS_HXX
#include "scitems.hxx"
#endif
+#ifndef _SVX_ADJITEM_HXX
+#include <svx/adjitem.hxx>
+#endif
+#ifndef _SVX_ALGITEM_HXX
+#include <svx/algitem.hxx>
+#endif
+#ifndef _SVX_BOXITEM_HXX
+#include <svx/boxitem.hxx>
+#endif
+#ifndef _SVX_BRSHITEM_HXX
+#include <svx/brshitem.hxx>
+#endif
+#ifndef _SVX_ITEM_HXX
+#include <svx/cntritem.hxx>
+#endif
+#ifndef _SVX_COLRITEM_HXX
+#include <svx/colritem.hxx>
+#endif
+#ifndef _SVX_CRSDITEM_HXX
+#include <svx/crsditem.hxx>
+#endif
+#ifndef _SVX_FHGTITEM_HXX
+#include <svx/fhgtitem.hxx>
+#endif
+#ifndef _SVX_FONTITEM_HXX
+#include <svx/fontitem.hxx>
+#endif
+#ifndef _SVX_POSTITEM_HXX
+#include <svx/postitem.hxx>
+#endif
+#ifndef _SVX_SHDDITEM_HXX
+#include <svx/shdditem.hxx>
+#endif
+#ifndef _SVX_UDLNITEM_HXX
+#include <svx/udlnitem.hxx>
+#endif
+#ifndef _SVX_WGHTITEM_HXX
+#include <svx/wghtitem.hxx>
+#endif
+#ifndef _SVX_ROTMODIT_HXX
+#include <svx/rotmodit.hxx>
+#endif
+#ifndef _SFXINTITEM_HXX
+#include <svtools/intitem.hxx>
+#endif
#ifndef SC_COLLECT_HXX
#include "collect.hxx"
#endif
-
#ifndef SC_SCGLOB_HXX
#include "global.hxx"
#endif
+#ifndef _ZFORAUTO_HXX_
+#include "zforauto.hxx"
+#endif
+
-class SfxBoolItem;
-class SvxHorJustifyItem;
-class SvxVerJustifyItem;
-class SvxMarginItem;
-class SvxOrientationItem;
-class SvxFontItem;
-class SvxPostureItem;
-class SvxWeightItem;
-class SvxFontHeightItem;
-class SvxUnderlineItem;
-class SvxCrossedOutItem;
-class SvxShadowedItem;
-class SvxContourItem;
-class SvxColorItem;
-class SvxBoxItem;
-class SvxAdjustItem;
-class SfxInt32Item;
-class SvxRotateModeItem;
-
-
-class ScNumFormatAbbrev;
struct ScAfVersions;
-class ScAutoFormatData : public DataObject
+
+/// Contains all items for one cell of a table autoformat.
+class ScAutoFormatDataField
{
private:
- String aName;
- USHORT nStrResId;
- // common flags of Calc and Writer
- BOOL bIncludeFont : 1;
- BOOL bIncludeJustify : 1;
- BOOL bIncludeFrame : 1;
- BOOL bIncludeBackground : 1;
-
- // Calc specific flags
- BOOL bIncludeValueFormat : 1;
- BOOL bIncludeWidthHeight : 1;
-
- // common attributes of Calc and Writer
- // --- from 641 on: CJK and CTL font settings
- SvxFontItem* pFont[16];
- SvxFontHeightItem* pFontHeight[16];
- SvxWeightItem* pFontWeight[16];
- SvxPostureItem* pFontPosture[16];
-
- SvxFontItem* pCJKFont[16];
- SvxFontHeightItem* pCJKFontHeight[16];
- SvxWeightItem* pCJKFontWeight[16];
- SvxPostureItem* pCJKFontPosture[16];
-
- SvxFontItem* pCTLFont[16];
- SvxFontHeightItem* pCTLFontHeight[16];
- SvxWeightItem* pCTLFontWeight[16];
- SvxPostureItem* pCTLFontPosture[16];
-
- SvxUnderlineItem* pFontUnderline[16];
- SvxCrossedOutItem* pFontCrossedOut[16];
- SvxContourItem* pFontContour[16];
- SvxShadowedItem* pFontShadowed[16];
- SvxColorItem* pFontColor[16];
- SvxBoxItem* pBox[16];
- SvxBrushItem* pBackground[16];
+ SvxFontItem aFont;
+ SvxFontHeightItem aHeight;
+ SvxWeightItem aWeight;
+ SvxPostureItem aPosture;
+
+ SvxFontItem aCJKFont;
+ SvxFontHeightItem aCJKHeight;
+ SvxWeightItem aCJKWeight;
+ SvxPostureItem aCJKPosture;
+
+ SvxFontItem aCTLFont;
+ SvxFontHeightItem aCTLHeight;
+ SvxWeightItem aCTLWeight;
+ SvxPostureItem aCTLPosture;
+
+ SvxUnderlineItem aUnderline;
+ SvxCrossedOutItem aCrossedOut;
+ SvxContourItem aContour;
+ SvxShadowedItem aShadowed;
+ SvxColorItem aColor;
+ SvxBoxItem aBox;
+ SvxBrushItem aBackground;
// Writer specific
- SvxAdjustItem* pAdjust[16];
+ SvxAdjustItem aAdjust;
// Calc specific
- SvxHorJustifyItem* pHorJustify[16];
- SvxVerJustifyItem* pVerJustify[16];
- SvxOrientationItem* pOrientation[16];
- SvxMarginItem* pMargin[16];
- SfxBoolItem* pLinebreak[16];
+ SvxHorJustifyItem aHorJustify;
+ SvxVerJustifyItem aVerJustify;
+ SvxOrientationItem aOrientation;
+ SvxMarginItem aMargin;
+ SfxBoolItem aLinebreak;
// from SO5, 504k on, rotated text
- SfxInt32Item* pRotateAngle[16];
- SvxRotateModeItem* pRotateMode[16];
+ SfxInt32Item aRotateAngle;
+ SvxRotateModeItem aRotateMode;
// number format
- ScNumFormatAbbrev* pNumFormat[16];
+ ScNumFormatAbbrev aNumFormat;
public:
- ScAutoFormatData();
- ScAutoFormatData( const ScAutoFormatData& rData );
- virtual ~ScAutoFormatData();
-
- virtual DataObject* Clone() const { return new ScAutoFormatData(*this); }
-
- void SetName(const String& rName) { aName = rName; nStrResId = USHRT_MAX; }
- void GetName(String& rName) const { rName = aName; }
-
- BOOL GetIncludeValueFormat() const { return bIncludeValueFormat; }
- void SetIncludeValueFormat(const BOOL bValueFormat) { bIncludeValueFormat = bValueFormat; }
-
- BOOL GetIncludeFont() const { return bIncludeFont; }
- void SetIncludeFont(const BOOL bFont) { bIncludeFont = bFont; }
+ ScAutoFormatDataField();
+ ScAutoFormatDataField( const ScAutoFormatDataField& rCopy );
+ ~ScAutoFormatDataField();
+
+ const ScNumFormatAbbrev& GetNumFormat() const { return aNumFormat; }
+ const SvxFontItem& GetFont() const { return aFont; }
+ const SvxFontHeightItem& GetHeight() const { return aHeight; }
+ const SvxWeightItem& GetWeight() const { return aWeight; }
+ const SvxPostureItem& GetPosture() const { return aPosture; }
+ const SvxFontItem& GetCJKFont() const { return aCJKFont; }
+ const SvxFontHeightItem& GetCJKHeight() const { return aCJKHeight; }
+ const SvxWeightItem& GetCJKWeight() const { return aCJKWeight; }
+ const SvxPostureItem& GetCJKPosture() const { return aCJKPosture; }
+ const SvxFontItem& GetCTLFont() const { return aCTLFont; }
+ const SvxFontHeightItem& GetCTLHeight() const { return aCTLHeight; }
+ const SvxWeightItem& GetCTLWeight() const { return aCTLWeight; }
+ const SvxPostureItem& GetCTLPosture() const { return aCTLPosture; }
+ const SvxUnderlineItem& GetUnderline() const { return aUnderline; }
+ const SvxCrossedOutItem& GetCrossedOut() const { return aCrossedOut; }
+ const SvxContourItem& GetContour() const { return aContour; }
+ const SvxShadowedItem& GetShadowed() const { return aShadowed; }
+ const SvxColorItem& GetColor() const { return aColor; }
+ const SvxHorJustifyItem& GetHorJustify() const { return aHorJustify; }
+ const SvxVerJustifyItem& GetVerJustify() const { return aVerJustify; }
+ const SvxOrientationItem& GetOrientation() const { return aOrientation; }
+ const SfxBoolItem& GetLinebreak() const { return aLinebreak; }
+ const SvxMarginItem& GetMargin() const { return aMargin; }
+ const SvxBoxItem& GetBox() const { return aBox; }
+ const SvxBrushItem& GetBackground() const { return aBackground; }
+ const SvxAdjustItem& GetAdjust() const { return aAdjust; }
+ const SfxInt32Item& GetRotateAngle() const { return aRotateAngle; }
+ const SvxRotateModeItem& GetRotateMode() const { return aRotateMode; }
+
+ void SetNumFormat( const ScNumFormatAbbrev& rNumFormat ) { aNumFormat = rNumFormat; }
+ void SetFont( const SvxFontItem& rFont ) { aFont = rFont; }
+ void SetHeight( const SvxFontHeightItem& rHeight ) { aHeight = rHeight; }
+ void SetWeight( const SvxWeightItem& rWeight ) { aWeight = rWeight; }
+ void SetPosture( const SvxPostureItem& rPosture ) { aPosture = rPosture; }
+ void SetCJKFont( const SvxFontItem& rCJKFont ) { aCJKFont = rCJKFont; }
+ void SetCJKHeight( const SvxFontHeightItem& rCJKHeight ) { aCJKHeight = rCJKHeight; }
+ void SetCJKWeight( const SvxWeightItem& rCJKWeight ) { aCJKWeight = rCJKWeight; }
+ void SetCJKPosture( const SvxPostureItem& rCJKPosture ) { aCJKPosture = rCJKPosture; }
+ void SetCTLFont( const SvxFontItem& rCTLFont ) { aCTLFont = rCTLFont; }
+ void SetCTLHeight( const SvxFontHeightItem& rCTLHeight ) { aCTLHeight = rCTLHeight; }
+ void SetCTLWeight( const SvxWeightItem& rCTLWeight ) { aCTLWeight = rCTLWeight; }
+ void SetCTLPosture( const SvxPostureItem& rCTLPosture ) { aCTLPosture = rCTLPosture; }
+ void SetUnderline( const SvxUnderlineItem& rUnderline ) { aUnderline = rUnderline; }
+ void SetCrossedOut( const SvxCrossedOutItem& rCrossedOut ) { aCrossedOut = rCrossedOut; }
+ void SetContour( const SvxContourItem& rContour ) { aContour = rContour; }
+ void SetShadowed( const SvxShadowedItem& rShadowed ) { aShadowed = rShadowed; }
+ void SetColor( const SvxColorItem& rColor ) { aColor = rColor; }
+ void SetHorJustify( const SvxHorJustifyItem& rHorJustify ) { aHorJustify = rHorJustify; }
+ void SetVerJustify( const SvxVerJustifyItem& rVerJustify ) { aVerJustify = rVerJustify; }
+ void SetOrientation( const SvxOrientationItem& rOrient ) { aOrientation = rOrient; }
+ void SetLinebreak( const SfxBoolItem& rLinebreak ) { aLinebreak.SetValue( rLinebreak.GetValue() ); }
+ void SetMargin( const SvxMarginItem& rMargin ) { aMargin = rMargin; }
+ void SetBox( const SvxBoxItem& rBox ) { aBox = rBox; }
+ void SetBackground( const SvxBrushItem& rBackground ) { aBackground = rBackground; }
+ void SetAdjust( const SvxAdjustItem& rAdjust );
+ void SetRotateAngle( const SfxInt32Item& rRotateAngle ) { aRotateAngle.SetValue( rRotateAngle.GetValue() ); }
+ void SetRotateMode( const SvxRotateModeItem& rRotateMode ) { aRotateMode.SetValue( rRotateMode.GetValue() ); }
+
+ BOOL Load( SvStream& rStream, const ScAfVersions& rVersions, USHORT nVer );
+ BOOL Save( SvStream& rStream );
- BOOL GetIncludeJustify() const { return bIncludeJustify; }
- void SetIncludeJustify(const BOOL bJustify) { bIncludeJustify = bJustify; }
-
- BOOL GetIncludeFrame() const { return bIncludeFrame; }
- void SetIncludeFrame(const BOOL bFrame) { bIncludeFrame = bFrame; }
-
- BOOL GetIncludeBackground() const { return bIncludeBackground; }
- void SetIncludeBackground(const BOOL bBackground) { bIncludeBackground = bBackground; }
-
- BOOL GetIncludeWidthHeight() const { return bIncludeWidthHeight; }
- void SetIncludeWidthHeight(const BOOL bWidthHeight) { bIncludeWidthHeight = bWidthHeight; }
-
- void GetNumFormat(USHORT nIndex, ScNumFormatAbbrev& rNumFormat) const;
- void SetNumFormat(USHORT nIndex, const ScNumFormatAbbrev& rNumFormat);
-
- void GetFont(USHORT nIndex, SvxFontItem& rFont) const;
- void SetFont(USHORT nIndex, const SvxFontItem& rFont);
-
- void GetFontHeight(USHORT nIndex, SvxFontHeightItem& rFontHeight) const;
- void SetFontHeight(USHORT nIndex, const SvxFontHeightItem& rFontHeight);
-
- void GetFontWeight(USHORT nIndex, SvxWeightItem& rFontWeight) const;
- void SetFontWeight(USHORT nIndex, const SvxWeightItem& rFontWeight);
-
- void GetFontPosture(USHORT nIndex, SvxPostureItem& rFontPosture) const;
- void SetFontPosture(USHORT nIndex, const SvxPostureItem& rFontPosture);
-
- // --- from 641 on: CJK and CTL font settings
- void GetCJKFont(USHORT nIndex, SvxFontItem& rFont) const;
- void SetCJKFont(USHORT nIndex, const SvxFontItem& rFont);
-
- void GetCJKFontHeight(USHORT nIndex, SvxFontHeightItem& rFontHeight) const;
- void SetCJKFontHeight(USHORT nIndex, const SvxFontHeightItem& rFontHeight);
-
- void GetCJKFontWeight(USHORT nIndex, SvxWeightItem& rFontWeight) const;
- void SetCJKFontWeight(USHORT nIndex, const SvxWeightItem& rFontWeight);
-
- void GetCJKFontPosture(USHORT nIndex, SvxPostureItem& rFontPosture) const;
- void SetCJKFontPosture(USHORT nIndex, const SvxPostureItem& rFontPosture);
-
- void GetCTLFont(USHORT nIndex, SvxFontItem& rFont) const;
- void SetCTLFont(USHORT nIndex, const SvxFontItem& rFont);
-
- void GetCTLFontHeight(USHORT nIndex, SvxFontHeightItem& rFontHeight) const;
- void SetCTLFontHeight(USHORT nIndex, const SvxFontHeightItem& rFontHeight);
-
- void GetCTLFontWeight(USHORT nIndex, SvxWeightItem& rFontWeight) const;
- void SetCTLFontWeight(USHORT nIndex, const SvxWeightItem& rFontWeight);
-
- void GetCTLFontPosture(USHORT nIndex, SvxPostureItem& rFontPosture) const;
- void SetCTLFontPosture(USHORT nIndex, const SvxPostureItem& rFontPosture);
- //---
-
- void GetFontUnderline(USHORT nIndex, SvxUnderlineItem& rFontUnderline) const;
- void SetFontUnderline(USHORT nIndex, const SvxUnderlineItem& rFontUnderline);
-
- void GetFontCrossedOut(USHORT nIndex, SvxCrossedOutItem& rFontCrossedOut) const;
- void SetFontCrossedOut(USHORT nIndex, const SvxCrossedOutItem& rFontCrossedOut);
+#ifdef READ_OLDVERS
+ BOOL LoadOld( SvStream& rStream, const ScAfVersions& rVersions );
+#endif
+};
- void GetFontContour(USHORT nIndex, SvxContourItem& rFontContour) const;
- void SetFontContour(USHORT nIndex, const SvxContourItem& rFontContour);
- void GetFontShadowed(USHORT nIndex, SvxShadowedItem& rFontShadowed) const;
- void SetFontShadowed(USHORT nIndex, const SvxShadowedItem& rFontShadowed);
+class ScAutoFormatData : public DataObject
+{
+private:
+ String aName;
+ USHORT nStrResId;
+ // common flags of Calc and Writer
+ BOOL bIncludeFont : 1;
+ BOOL bIncludeJustify : 1;
+ BOOL bIncludeFrame : 1;
+ BOOL bIncludeBackground : 1;
- void GetFontColor(USHORT nIndex, SvxColorItem& rFontColor) const;
- void SetFontColor(USHORT nIndex, const SvxColorItem& rFontColor);
+ // Calc specific flags
+ BOOL bIncludeValueFormat : 1;
+ BOOL bIncludeWidthHeight : 1;
- void GetHorJustify(USHORT nIndex, SvxHorJustifyItem& rHorJustify) const;
- void SetHorJustify(USHORT nIndex, const SvxHorJustifyItem& rHorJustify);
+ ScAutoFormatDataField aDataField[ 16 ];
- void GetVerJustify(USHORT nIndex, SvxVerJustifyItem& rVerJustify) const;
- void SetVerJustify(USHORT nIndex, const SvxVerJustifyItem& rVerJustify);
+ ScAutoFormatDataField& GetField( USHORT nIndex );
+ const ScAutoFormatDataField& GetField( USHORT nIndex ) const;
- void GetOrientation(USHORT nIndex, SvxOrientationItem& rOrientation) const;
- void SetOrientation(USHORT nIndex, const SvxOrientationItem& rOrientation);
+public:
+ ScAutoFormatData();
+ ScAutoFormatData( const ScAutoFormatData& rData );
+ virtual ~ScAutoFormatData();
- void GetLinebreak(USHORT nIndex, SfxBoolItem& rLinebreak) const;
- void SetLinebreak(USHORT nIndex, const SfxBoolItem& rLinebreak);
+ virtual DataObject* Clone() const { return new ScAutoFormatData( *this ); }
- void GetMargin(USHORT nIndex, SvxMarginItem& rMargin) const;
- void SetMargin(USHORT nIndex, const SvxMarginItem& rMargin);
+ void SetName( const String& rName ) { aName = rName; nStrResId = USHRT_MAX; }
+ void GetName( String& rName ) const { rName = aName; }
- void GetBox(USHORT nIndex, SvxBoxItem& rBox) const;
- void SetBox(USHORT nIndex, const SvxBoxItem& rBox);
+ BOOL GetIncludeValueFormat() const { return bIncludeValueFormat; }
+ BOOL GetIncludeFont() const { return bIncludeFont; }
+ BOOL GetIncludeJustify() const { return bIncludeJustify; }
+ BOOL GetIncludeFrame() const { return bIncludeFrame; }
+ BOOL GetIncludeBackground() const { return bIncludeBackground; }
+ BOOL GetIncludeWidthHeight() const { return bIncludeWidthHeight; }
- void GetBackground(USHORT nIndex, SvxBrushItem& rBackground) const;
- void SetBackground(USHORT nIndex, const SvxBrushItem& rBackground);
+ void SetIncludeValueFormat( BOOL bValueFormat ) { bIncludeValueFormat = bValueFormat; }
+ void SetIncludeFont( BOOL bFont ) { bIncludeFont = bFont; }
+ void SetIncludeJustify( BOOL bJustify ) { bIncludeJustify = bJustify; }
+ void SetIncludeFrame( BOOL bFrame ) { bIncludeFrame = bFrame; }
+ void SetIncludeBackground( BOOL bBackground ) { bIncludeBackground = bBackground; }
+ void SetIncludeWidthHeight( BOOL bWidthHeight ) { bIncludeWidthHeight = bWidthHeight; }
- void GetRotateAngle( USHORT nIndex, SfxInt32Item& rRotateAngle ) const;
- void SetRotateAngle( USHORT nIndex, const SfxInt32Item& rRotateAngle );
+ const SfxPoolItem* GetItem( USHORT nIndex, USHORT nWhich ) const;
+ void PutItem( USHORT nIndex, const SfxPoolItem& rItem );
+ void CopyItem( USHORT nToIndex, USHORT nFromIndex, USHORT nWhich );
- void GetRotateMode( USHORT nIndex, SvxRotateModeItem& rRotateMode ) const;
- void SetRotateMode( USHORT nIndex, const SvxRotateModeItem& rRotateMode );
+ const ScNumFormatAbbrev& GetNumFormat( USHORT nIndex ) const;
+ void SetNumFormat( USHORT nIndex, const ScNumFormatAbbrev& rNumFormat );
- const SfxPoolItem* GetItem( USHORT nIndex, USHORT nWhich ) const;
- void PutItem( USHORT nIndex, const SfxPoolItem& rItem );
+ BOOL IsEqualData( USHORT nIndex1, USHORT nIndex2 ) const;
- BOOL IsEqualData(USHORT nIndex1, USHORT nIndex2);
+ void FillToItemSet( USHORT nIndex, SfxItemSet& rItemSet, ScDocument& rDoc ) const;
+ void GetFromItemSet( USHORT nIndex, const SfxItemSet& rItemSet, const ScNumFormatAbbrev& rNumFormat );
- BOOL Load(SvStream& rStream, const ScAfVersions& rVersions);
- BOOL Save(SvStream& rStream);
+ BOOL Load( SvStream& rStream, const ScAfVersions& rVersions );
+ BOOL Save( SvStream& rStream );
#ifdef READ_OLDVERS
- BOOL LoadOld( SvStream& rStream, const ScAfVersions& rVersions );
+ BOOL LoadOld( SvStream& rStream, const ScAfVersions& rVersions );
#endif
};
class ScAutoFormat : public SortedCollection
{
private:
- BOOL bSaveLater;
+ BOOL bSaveLater;
public:
- ScAutoFormat(USHORT nLim = 4, USHORT nDel = 4, BOOL bDup = FALSE);
- ScAutoFormat(const ScAutoFormat& AutoFormat);
- virtual ~ScAutoFormat();
- virtual DataObject* Clone() const { return new ScAutoFormat(*this); }
- ScAutoFormatData* operator[]( const USHORT nIndex) const {return (ScAutoFormatData*)At(nIndex);}
- virtual short Compare(DataObject* pKey1, DataObject* pKey2) const;
- BOOL Load();
- BOOL Save();
- USHORT FindIndexPerName( const String& rName ) const;
- void SetSaveLater( BOOL bSet );
- BOOL IsSaveLater() const { return bSaveLater; }
+ ScAutoFormat( USHORT nLim = 4, USHORT nDel = 4, BOOL bDup = FALSE );
+ ScAutoFormat( const ScAutoFormat& AutoFormat );
+ virtual ~ScAutoFormat();
+ virtual DataObject* Clone() const { return new ScAutoFormat( *this ); }
+ ScAutoFormatData* operator[]( const USHORT nIndex ) const {return (ScAutoFormatData*)At( nIndex );}
+ virtual short Compare( DataObject* pKey1, DataObject* pKey2 ) const;
+ BOOL Load();
+ BOOL Save();
+ USHORT FindIndexPerName( const String& rName ) const;
+ void SetSaveLater( BOOL bSet );
+ BOOL IsSaveLater() const { return bSaveLater; }
};
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index e91ab860c132..1cf94d26ee44 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: document.hxx,v $
*
- * $Revision: 1.52 $
+ * $Revision: 1.53 $
*
- * last change: $Author: nn $ $Date: 2001-11-14 15:33:05 $
+ * last change: $Author: dr $ $Date: 2001-11-19 13:28:26 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -170,7 +170,10 @@ namespace com { namespace sun { namespace star {
namespace lang {
class XMultiServiceFactory;
}
-}}}
+ namespace i18n {
+ class XBreakIterator;
+ }
+} } }
#ifdef _ZFORLIST_DECLARE_TABLE
@@ -1023,6 +1026,7 @@ public:
const SfxItemSet* GetCondResult( USHORT nCol, USHORT nRow, USHORT nTab ) const;
const SfxPoolItem* GetEffItem( USHORT nCol, USHORT nRow, USHORT nTab, USHORT nWhich ) const;
+ const ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator >& GetBreakIterator();
BOOL HasStringWeakCharacters( const String& rString );
BYTE GetStringScriptType( const String& rString );
BYTE GetCellScriptType( ScBaseCell* pCell, ULONG nNumberFormat );
diff --git a/sc/inc/zforauto.hxx b/sc/inc/zforauto.hxx
index 5f0f3ef5b9ec..c8ca57461a64 100644
--- a/sc/inc/zforauto.hxx
+++ b/sc/inc/zforauto.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: zforauto.hxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 16:44:51 $
+ * last change: $Author: dr $ $Date: 2001-11-19 13:28:26 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -89,7 +89,7 @@ public:
void Save( SvStream& rStream ) const; // Speichern der Zahlenformate
void PutFormatIndex(ULONG nFormat, SvNumberFormatter& rFormatter);
ULONG GetFormatIndex( SvNumberFormatter& rFormatter);
- inline int operator==(const ScNumFormatAbbrev& rNumFormat)
+ inline int operator==(const ScNumFormatAbbrev& rNumFormat) const
{
return ((sFormatstring == rNumFormat.sFormatstring)
&& (eLnge == rNumFormat.eLnge)
diff --git a/sc/source/core/data/documen6.cxx b/sc/source/core/data/documen6.cxx
index d332feb1bc03..3459842fc6cb 100644
--- a/sc/source/core/data/documen6.cxx
+++ b/sc/source/core/data/documen6.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: documen6.cxx,v $
*
- * $Revision: 1.9 $
+ * $Revision: 1.10 $
*
- * last change: $Author: nn $ $Date: 2001-11-14 15:34:17 $
+ * last change: $Author: dr $ $Date: 2001-11-19 13:29:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -90,21 +90,26 @@ using namespace com::sun::star;
// -----------------------------------------------------------------------
-BOOL ScDocument::HasStringWeakCharacters( const String& rString )
+const uno::Reference< i18n::XBreakIterator >& ScDocument::GetBreakIterator()
{
if ( !pScriptTypeData )
- {
pScriptTypeData = new ScScriptTypeData;
- uno::Reference<uno::XInterface> xInterface = xServiceManager->createInstance(
- rtl::OUString::createFromAscii( SC_BREAKITER_SERVICE ) );
- pScriptTypeData->xBreakIter = uno::Reference<i18n::XBreakIterator>( xInterface, uno::UNO_QUERY );
+ if ( !pScriptTypeData->xBreakIter.is() )
+ {
+ uno::Reference< uno::XInterface > xInterface = xServiceManager->createInstance(
+ ::rtl::OUString::createFromAscii( SC_BREAKITER_SERVICE ) );
+ pScriptTypeData->xBreakIter = uno::Reference< i18n::XBreakIterator >( xInterface, uno::UNO_QUERY );
DBG_ASSERT( pScriptTypeData->xBreakIter.is(), "can't get BreakIterator" );
}
+ return pScriptTypeData->xBreakIter;
+}
+BOOL ScDocument::HasStringWeakCharacters( const String& rString )
+{
BYTE nRet = 0;
if (rString.Len())
{
- uno::Reference<i18n::XBreakIterator> xBreakIter = pScriptTypeData->xBreakIter;
+ uno::Reference<i18n::XBreakIterator> xBreakIter = GetBreakIterator();
if ( xBreakIter.is() )
{
rtl::OUString aText = rString;
@@ -126,22 +131,13 @@ BOOL ScDocument::HasStringWeakCharacters( const String& rString )
return FALSE; // none found
}
-
BYTE ScDocument::GetStringScriptType( const String& rString )
{
- if ( !pScriptTypeData )
- {
- pScriptTypeData = new ScScriptTypeData;
- uno::Reference<uno::XInterface> xInterface = xServiceManager->createInstance(
- rtl::OUString::createFromAscii( SC_BREAKITER_SERVICE ) );
- pScriptTypeData->xBreakIter = uno::Reference<i18n::XBreakIterator>( xInterface, uno::UNO_QUERY );
- DBG_ASSERT( pScriptTypeData->xBreakIter.is(), "can't get BreakIterator" );
- }
BYTE nRet = 0;
if (rString.Len())
{
- uno::Reference<i18n::XBreakIterator> xBreakIter = pScriptTypeData->xBreakIter;
+ uno::Reference<i18n::XBreakIterator> xBreakIter = GetBreakIterator();
if ( xBreakIter.is() )
{
rtl::OUString aText = rString;
diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index dbff0dad93ab..9cb084427191 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: table4.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: dr $ $Date: 2001-11-14 15:08:38 $
+ * last change: $Author: dr $ $Date: 2001-11-19 13:29:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -1518,113 +1518,7 @@ void ScTable::AutoFormatArea(USHORT nStartCol, USHORT nStartRow, USHORT nEndCol,
if (pData)
{
ScPatternAttr aPattern(pDocument->GetPool());
- if (pData->GetIncludeValueFormat())
- {
- ScNumFormatAbbrev aNumFormat;
- pData->GetNumFormat(nIndex, aNumFormat);
- SfxUInt32Item aValueFormat( ATTR_VALUE_FORMAT, 0 );
- aValueFormat.SetValue(aNumFormat.GetFormatIndex(*pDocument->GetFormatTable()));
- aPattern.GetItemSet().Put(aValueFormat);
- SvxLanguageItem aLangItem( aNumFormat.GetLanguage(), ATTR_LANGUAGE_FORMAT );
- aPattern.GetItemSet().Put( aLangItem );
- }
- if (pData->GetIncludeFont())
- {
-
- SvxFontItem aFont;
- pData->GetFont(nIndex, aFont);
- aPattern.GetItemSet().Put(aFont);
- pData->GetCJKFont(nIndex, aFont);
- aPattern.GetItemSet().Put(aFont);
- pData->GetCTLFont(nIndex, aFont);
- aPattern.GetItemSet().Put(aFont);
-
- SvxFontHeightItem aFontHeight;
- pData->GetFontHeight(nIndex, aFontHeight);
- aPattern.GetItemSet().Put(aFontHeight);
- pData->GetCJKFontHeight(nIndex, aFontHeight);
- aPattern.GetItemSet().Put(aFontHeight);
- pData->GetCTLFontHeight(nIndex, aFontHeight);
- aPattern.GetItemSet().Put(aFontHeight);
-
- SvxWeightItem aFontWeight;
- pData->GetFontWeight(nIndex, aFontWeight);
- aPattern.GetItemSet().Put(aFontWeight);
- pData->GetCJKFontWeight(nIndex, aFontWeight);
- aPattern.GetItemSet().Put(aFontWeight);
- pData->GetCTLFontWeight(nIndex, aFontWeight);
- aPattern.GetItemSet().Put(aFontWeight);
-
- SvxPostureItem aFontPosture;
- pData->GetFontPosture(nIndex, aFontPosture);
- aPattern.GetItemSet().Put(aFontPosture);
- pData->GetCJKFontPosture(nIndex, aFontPosture);
- aPattern.GetItemSet().Put(aFontPosture);
- pData->GetCTLFontPosture(nIndex, aFontPosture);
- aPattern.GetItemSet().Put(aFontPosture);
-
- SvxUnderlineItem aFontUnderline;
- pData->GetFontUnderline(nIndex, aFontUnderline);
- aPattern.GetItemSet().Put(aFontUnderline);
-
- SvxCrossedOutItem aFontCrossedOut;
- pData->GetFontCrossedOut(nIndex, aFontCrossedOut);
- aPattern.GetItemSet().Put(aFontCrossedOut);
-
- SvxContourItem aFontContour;
- pData->GetFontContour(nIndex, aFontContour);
- aPattern.GetItemSet().Put(aFontContour);
-
- SvxShadowedItem aFontShadowed;
- pData->GetFontShadowed(nIndex, aFontShadowed);
- aPattern.GetItemSet().Put(aFontShadowed);
-
- SvxColorItem aFontColor;
- pData->GetFontColor(nIndex, aFontColor);
- aPattern.GetItemSet().Put(aFontColor);
- }
- if (pData->GetIncludeJustify())
- {
- SvxHorJustifyItem aHorJustify;
- pData->GetHorJustify(nIndex, aHorJustify);
- aPattern.GetItemSet().Put(aHorJustify);
-
- SvxVerJustifyItem aVerJustify;
- pData->GetVerJustify(nIndex, aVerJustify);
- aPattern.GetItemSet().Put(aVerJustify);
-
- SvxOrientationItem aOrientation;
- pData->GetOrientation(nIndex, aOrientation);
- aPattern.GetItemSet().Put(aOrientation);
-
- SfxBoolItem aLinebreak;
- pData->GetLinebreak(nIndex, aLinebreak);
- aPattern.GetItemSet().Put(aLinebreak);
-
- SvxMarginItem aMargin;
- pData->GetMargin(nIndex, aMargin);
- aPattern.GetItemSet().Put(aMargin);
-
- SfxInt32Item aRotateAngle( ATTR_ROTATE_VALUE );
- pData->GetRotateAngle(nIndex, aRotateAngle);
- aPattern.GetItemSet().Put(aRotateAngle);
-
- SvxRotateModeItem aRotateMode( SVX_ROTATE_MODE_STANDARD, ATTR_ROTATE_MODE );
- pData->GetRotateMode(nIndex, aRotateMode);
- aPattern.GetItemSet().Put(aRotateMode);
- }
- if (pData->GetIncludeFrame())
- {
- SvxBoxItem aBox(ATTR_BORDER);
- pData->GetBox(nIndex, aBox);
- aPattern.GetItemSet().Put(aBox);
- }
- if (pData->GetIncludeBackground())
- {
- SvxBrushItem aBackground;
- pData->GetBackground(nIndex, aBackground);
- aPattern.GetItemSet().Put(aBackground);
- }
+ pData->FillToItemSet(nIndex, aPattern.GetItemSet(), *pDocument);
ApplyPatternArea(nStartCol, nStartRow, nEndCol, nEndRow, aPattern);
}
}
@@ -1638,7 +1532,7 @@ void ScTable::AutoFormat( USHORT nStartCol, USHORT nStartRow, USHORT nEndCol, US
ScAutoFormat* pAutoFormat = ScGlobal::GetAutoFormat();
if (pAutoFormat)
{
- ScAutoFormatData* pData = (ScAutoFormatData*)(*pAutoFormat)[nFormatNo];
+ ScAutoFormatData* pData = (*pAutoFormat)[nFormatNo];
if (pData)
{
USHORT nCol = nStartCol;
@@ -1766,33 +1660,7 @@ void ScTable::GetAutoFormatAttr(USHORT nCol, USHORT nRow, USHORT nIndex, ScAutoF
{
UINT32 nFormatIndex = GetNumberFormat( nCol, nRow );
ScNumFormatAbbrev aNumFormat( nFormatIndex, *pDocument->GetFormatTable() );
-
- rData.SetNumFormat (nIndex, aNumFormat);
- rData.SetFont (nIndex, *(SvxFontItem*)GetAttr( nCol, nRow, ATTR_FONT));
- rData.SetFontHeight (nIndex, *(SvxFontHeightItem*)GetAttr( nCol, nRow, ATTR_FONT_HEIGHT));
- rData.SetFontWeight (nIndex, *(SvxWeightItem*)GetAttr( nCol, nRow, ATTR_FONT_WEIGHT));
- rData.SetFontPosture (nIndex, *(SvxPostureItem*)GetAttr( nCol, nRow, ATTR_FONT_POSTURE));
- rData.SetCJKFont (nIndex, *(SvxFontItem*)GetAttr( nCol, nRow, ATTR_CJK_FONT));
- rData.SetCJKFontHeight (nIndex, *(SvxFontHeightItem*)GetAttr( nCol, nRow, ATTR_CJK_FONT_HEIGHT));
- rData.SetCJKFontWeight (nIndex, *(SvxWeightItem*)GetAttr( nCol, nRow, ATTR_CJK_FONT_WEIGHT));
- rData.SetCJKFontPosture (nIndex, *(SvxPostureItem*)GetAttr( nCol, nRow, ATTR_CJK_FONT_POSTURE));
- rData.SetCTLFont (nIndex, *(SvxFontItem*)GetAttr( nCol, nRow, ATTR_CTL_FONT));
- rData.SetCTLFontHeight (nIndex, *(SvxFontHeightItem*)GetAttr( nCol, nRow, ATTR_CTL_FONT_HEIGHT));
- rData.SetCTLFontWeight (nIndex, *(SvxWeightItem*)GetAttr( nCol, nRow, ATTR_CTL_FONT_WEIGHT));
- rData.SetCTLFontPosture (nIndex, *(SvxPostureItem*)GetAttr( nCol, nRow, ATTR_CTL_FONT_POSTURE));
- rData.SetFontUnderline (nIndex, *(SvxUnderlineItem*)GetAttr( nCol, nRow, ATTR_FONT_UNDERLINE));
- rData.SetFontCrossedOut (nIndex, *(SvxCrossedOutItem*)GetAttr( nCol, nRow, ATTR_FONT_CROSSEDOUT));
- rData.SetFontContour (nIndex, *(SvxContourItem*)GetAttr( nCol, nRow, ATTR_FONT_CONTOUR));
- rData.SetFontShadowed (nIndex, *(SvxShadowedItem*)GetAttr( nCol, nRow, ATTR_FONT_SHADOWED));
- rData.SetFontColor (nIndex, *(SvxColorItem*)GetAttr( nCol, nRow, ATTR_FONT_COLOR));
- rData.SetHorJustify (nIndex, *(SvxHorJustifyItem*)GetAttr( nCol, nRow, ATTR_HOR_JUSTIFY));
- rData.SetVerJustify (nIndex, *(SvxVerJustifyItem*)GetAttr( nCol, nRow, ATTR_VER_JUSTIFY));
- rData.SetOrientation (nIndex, *(SvxOrientationItem*)GetAttr(nCol, nRow, ATTR_ORIENTATION));
- rData.SetLinebreak (nIndex, *(SfxBoolItem*)GetAttr( nCol, nRow, ATTR_LINEBREAK));
- rData.SetMargin (nIndex, *(SvxMarginItem*)GetAttr( nCol, nRow, ATTR_MARGIN));
- rData.SetBackground (nIndex, *(SvxBrushItem*)GetAttr( nCol, nRow, ATTR_BACKGROUND));
- rData.SetRotateAngle (nIndex, *(SfxInt32Item*)GetAttr( nCol, nRow, ATTR_ROTATE_VALUE));
- rData.SetRotateMode (nIndex, *(SvxRotateModeItem*)GetAttr( nCol, nRow, ATTR_ROTATE_MODE));
+ rData.GetFromItemSet( nIndex, GetPattern( nCol, nRow )->GetItemSet(), aNumFormat );
}
#define LF_LEFT 1
@@ -1858,7 +1726,7 @@ void ScTable::GetAutoFormatFrame(USHORT nCol, USHORT nRow, USHORT nFlags, USHORT
else
aBox.SetLine(pTheBox->GetBottom(), BOX_LINE_BOTTOM);
}
- rData.SetBox(nIndex, aBox);
+ rData.PutItem( nIndex, aBox );
}
void ScTable::GetAutoFormatData(USHORT nStartCol, USHORT nStartRow, USHORT nEndCol, USHORT nEndRow, ScAutoFormatData& rData)
@@ -1877,11 +1745,7 @@ void ScTable::GetAutoFormatData(USHORT nStartCol, USHORT nStartRow, USHORT nEndC
if (nEndRow - nStartRow >= 4)
GetAutoFormatFrame(nStartCol, nStartRow + 2, LF_LEFT | LF_RIGHT | LF_BOTTOM, 8, rData);
else
- {
- SvxBoxItem aBox;
- rData.GetBox(4, aBox);
- rData.SetBox(8, aBox);
- }
+ rData.CopyItem( 8, 4, ATTR_BORDER );
// Linke untere Ecke
GetAutoFormatAttr(nStartCol, nEndRow, 12, rData);
GetAutoFormatFrame(nStartCol, nEndRow, LF_ALL, 12, rData);
@@ -1895,11 +1759,7 @@ void ScTable::GetAutoFormatData(USHORT nStartCol, USHORT nStartRow, USHORT nEndC
if (nEndRow - nStartRow >= 4)
GetAutoFormatFrame(nEndCol, nStartRow + 2, LF_LEFT | LF_RIGHT | LF_BOTTOM, 11, rData);
else
- {
- SvxBoxItem aBox;
- rData.GetBox(7, aBox);
- rData.SetBox(11, aBox);
- }
+ rData.CopyItem( 11, 7, ATTR_BORDER );
// Rechte untere Ecke
GetAutoFormatAttr(nEndCol, nEndRow, 15, rData);
GetAutoFormatFrame(nEndCol, nEndRow, LF_ALL, 15, rData);
@@ -1910,11 +1770,7 @@ void ScTable::GetAutoFormatData(USHORT nStartCol, USHORT nStartRow, USHORT nEndC
if (nEndCol - nStartCol >= 4)
GetAutoFormatFrame(nStartCol + 2, nStartRow, LF_TOP | LF_BOTTOM | LF_RIGHT, 2, rData);
else
- {
- SvxBoxItem aBox;
- rData.GetBox(1, aBox);
- rData.SetBox(2, aBox);
- }
+ rData.CopyItem( 2, 1, ATTR_BORDER );
// Untere Zeile
GetAutoFormatAttr(nStartCol + 1, nEndRow, 13, rData);
GetAutoFormatAttr(nStartCol + 2, nEndRow, 14, rData);
@@ -1922,11 +1778,7 @@ void ScTable::GetAutoFormatData(USHORT nStartCol, USHORT nStartRow, USHORT nEndC
if (nEndCol - nStartCol >= 4)
GetAutoFormatFrame(nStartCol + 2, nEndRow, LF_TOP | LF_BOTTOM | LF_RIGHT, 14, rData);
else
- {
- SvxBoxItem aBox;
- rData.GetBox(13, aBox);
- rData.SetBox(14, aBox);
- }
+ rData.CopyItem( 14, 13, ATTR_BORDER );
// Body
GetAutoFormatAttr(nStartCol + 1, nStartRow + 1, 5, rData);
GetAutoFormatAttr(nStartCol + 2, nStartRow + 1, 6, rData);
@@ -1941,11 +1793,9 @@ void ScTable::GetAutoFormatData(USHORT nStartCol, USHORT nStartRow, USHORT nEndC
}
else
{
- SvxBoxItem aBox;
- rData.GetBox(5, aBox);
- rData.SetBox(6, aBox);
- rData.SetBox(9, aBox);
- rData.SetBox(10, aBox);
+ rData.CopyItem( 6, 5, ATTR_BORDER );
+ rData.CopyItem( 9, 5, ATTR_BORDER );
+ rData.CopyItem( 10, 5, ATTR_BORDER );
}
}
}
diff --git a/sc/source/core/tool/autoform.cxx b/sc/source/core/tool/autoform.cxx
index ae5f19476be2..e20d47f40f83 100644
--- a/sc/source/core/tool/autoform.cxx
+++ b/sc/source/core/tool/autoform.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: autoform.cxx,v $
*
- * $Revision: 1.12 $
+ * $Revision: 1.13 $
*
- * last change: $Author: dr $ $Date: 2001-11-14 15:09:18 $
+ * last change: $Author: dr $ $Date: 2001-11-19 13:30:31 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -67,31 +67,20 @@
#define READ_OLDVERS
-#include "scitems.hxx"
-#include <svx/adjitem.hxx>
-#include <svx/algitem.hxx>
-#include <svx/boxitem.hxx>
-#include <svx/brshitem.hxx>
-#include <svx/cntritem.hxx>
-#include <svx/colritem.hxx>
-#include <svx/crsditem.hxx>
-#include <svx/fhgtitem.hxx>
-#include <svx/fontitem.hxx>
-#include <svx/postitem.hxx>
-#include <svx/shdditem.hxx>
-#include <svx/udlnitem.hxx>
-#include <svx/wghtitem.hxx>
-#include <svx/rotmodit.hxx>
+#include "autoform.hxx"
+
#include <sfx2/app.hxx>
-#include <svtools/intitem.hxx>
+#include <sfx2/docfile.hxx>
#include <svtools/pathoptions.hxx>
+#include <svtools/itemset.hxx>
#include <tools/shl.hxx>
#include <vcl/svapp.hxx>
#include <vcl/outdev.hxx>
#include <svx/dialmgr.hxx>
#include <svx/dialogs.hrc>
+#include <svx/langitem.hxx>
#include <tools/urlobj.hxx>
-#include <sfx2/docfile.hxx>
+
#ifndef _UNOTOOLS_TRANSLITERATIONWRAPPER_HXX
#include <unotools/transliterationwrapper.hxx>
#endif
@@ -99,9 +88,8 @@
#include <tools/tenccvt.hxx>
#endif
-#include "autoform.hxx"
-#include "zforauto.hxx"
#include "globstr.hrc"
+#include "document.hxx"
//------------------------------------------------------------------------
@@ -255,664 +243,484 @@ void ScAfVersions::Write(SvStream& rStream)
// ---------------------------------------------------------------------------
-ScAutoFormatData::ScAutoFormatData()
-{
- nStrResId = USHRT_MAX;
-
- bIncludeValueFormat =
- bIncludeFont =
- bIncludeJustify =
- bIncludeFrame =
- bIncludeBackground =
- bIncludeWidthHeight = TRUE;
- for (USHORT i = 0; i < 16; i++)
- {
- pFont[i] = new SvxFontItem;
- pFontHeight[i] = new SvxFontHeightItem;
- pFontWeight[i] = new SvxWeightItem;
- pFontPosture[i] = new SvxPostureItem;
-
- pCJKFont[i] = new SvxFontItem( ATTR_CJK_FONT );
- pCJKFontHeight[i] = new SvxFontHeightItem( 240, 100, ATTR_CJK_FONT_HEIGHT );
- pCJKFontWeight[i] = new SvxWeightItem( WEIGHT_NORMAL, ATTR_CJK_FONT_WEIGHT );
- pCJKFontPosture[i] = new SvxPostureItem( ITALIC_NONE, ATTR_CJK_FONT_POSTURE );
-
- pCTLFont[i] = new SvxFontItem( ATTR_CTL_FONT );
- pCTLFontHeight[i] = new SvxFontHeightItem( 240, 100, ATTR_CTL_FONT_HEIGHT );
- pCTLFontWeight[i] = new SvxWeightItem( WEIGHT_NORMAL, ATTR_CTL_FONT_WEIGHT );
- pCTLFontPosture[i] = new SvxPostureItem( ITALIC_NONE, ATTR_CTL_FONT_POSTURE );
-
- pFontUnderline[i] = new SvxUnderlineItem;
- pFontCrossedOut[i] = new SvxCrossedOutItem;
- pFontContour[i] = new SvxContourItem;
- pFontShadowed[i] = new SvxShadowedItem;
- pFontColor[i] = new SvxColorItem;
- pBox[i] = new SvxBoxItem;
- pBackground[i] = new SvxBrushItem;
-
- pAdjust[i] = new SvxAdjustItem;
-
- pHorJustify[i] = new SvxHorJustifyItem;
- pVerJustify[i] = new SvxVerJustifyItem;
- pOrientation[i] = new SvxOrientationItem;
- pMargin[i] = new SvxMarginItem;
- pLinebreak[i] = new SfxBoolItem( ATTR_LINEBREAK );
- pRotateAngle[i] = new SfxInt32Item( ATTR_ROTATE_VALUE );
- pRotateMode[i] = new SvxRotateModeItem( SVX_ROTATE_MODE_STANDARD, ATTR_ROTATE_MODE );
-
- pNumFormat[i] = new ScNumFormatAbbrev;
- }
-}
+ScAutoFormatDataField::ScAutoFormatDataField() :
+ aCJKFont( ATTR_CJK_FONT ),
+ aCJKHeight( 240, 100, ATTR_CJK_FONT_HEIGHT ),
+ aCJKWeight( WEIGHT_NORMAL, ATTR_CJK_FONT_WEIGHT ),
+ aCJKPosture( ITALIC_NONE, ATTR_CJK_FONT_POSTURE ),
+ aCTLFont( ATTR_CTL_FONT ),
+ aCTLHeight( 240, 100, ATTR_CTL_FONT_HEIGHT ),
+ aCTLWeight( WEIGHT_NORMAL, ATTR_CTL_FONT_WEIGHT ),
+ aCTLPosture( ITALIC_NONE, ATTR_CTL_FONT_POSTURE ),
+ aLinebreak( ATTR_LINEBREAK ),
+ aRotateAngle( ATTR_ROTATE_VALUE ),
+ aRotateMode( SVX_ROTATE_MODE_STANDARD, ATTR_ROTATE_MODE )
+{
+}
+
+ScAutoFormatDataField::ScAutoFormatDataField( const ScAutoFormatDataField& rCopy ) :
+ aFont( rCopy.aFont ),
+ aHeight( rCopy.aHeight ),
+ aWeight( rCopy.aWeight ),
+ aPosture( rCopy.aPosture ),
+ aCJKFont( rCopy.aCJKFont ),
+ aCJKHeight( rCopy.aCJKHeight ),
+ aCJKWeight( rCopy.aCJKWeight ),
+ aCJKPosture( rCopy.aCJKPosture ),
+ aCTLFont( rCopy.aCTLFont ),
+ aCTLHeight( rCopy.aCTLHeight ),
+ aCTLWeight( rCopy.aCTLWeight ),
+ aCTLPosture( rCopy.aCTLPosture ),
+ aUnderline( rCopy.aUnderline ),
+ aCrossedOut( rCopy.aCrossedOut ),
+ aContour( rCopy.aContour ),
+ aShadowed( rCopy.aShadowed ),
+ aColor( rCopy.aColor ),
+ aBox( rCopy.aBox ),
+ aBackground( rCopy.aBackground ),
+ aAdjust( rCopy.aAdjust ),
+ aHorJustify( rCopy.aHorJustify ),
+ aVerJustify( rCopy.aVerJustify ),
+ aOrientation( rCopy.aOrientation ),
+ aMargin( rCopy.aMargin ),
+ aLinebreak( rCopy.aLinebreak ),
+ aRotateAngle( rCopy.aRotateAngle ),
+ aRotateMode( rCopy.aRotateMode ),
+ aNumFormat( rCopy.aNumFormat )
+{
+}
+
+ScAutoFormatDataField::~ScAutoFormatDataField()
+{
+}
+
+void ScAutoFormatDataField::SetAdjust( const SvxAdjustItem& rAdjust )
+{
+ aAdjust.SetAdjust( rAdjust.GetAdjust() );
+ aAdjust.SetOneWord( rAdjust.GetOneWord() );
+ aAdjust.SetLastBlock( rAdjust.GetLastBlock() );
+}
+
+#define READ( aItem, ItemType, nVers ) \
+ pNew = aItem.Create( rStream, nVers ); \
+ aItem = *(ItemType*)pNew; \
+ delete pNew;
-ScAutoFormatData::ScAutoFormatData( const ScAutoFormatData& rData ) :
- aName( rData.aName ),
- nStrResId( rData.nStrResId ),
- bIncludeValueFormat( rData.bIncludeValueFormat ),
- bIncludeFont( rData.bIncludeFont ),
- bIncludeJustify( rData.bIncludeJustify ),
- bIncludeFrame( rData.bIncludeFrame ),
- bIncludeBackground( rData.bIncludeBackground ),
- bIncludeWidthHeight( rData.bIncludeWidthHeight )
+BOOL ScAutoFormatDataField::Load( SvStream& rStream, const ScAfVersions& rVersions, USHORT nVer )
{
- for (USHORT i = 0; i < 16; i++)
- {
- pFont[i] = new SvxFontItem(*rData.pFont[i]);
- pFontHeight[i] = new SvxFontHeightItem(*rData.pFontHeight[i]);
- pFontWeight[i] = new SvxWeightItem(*rData.pFontWeight[i]);
- pFontPosture[i] = new SvxPostureItem(*rData.pFontPosture[i]);
-
- pCJKFont[i] = new SvxFontItem(*rData.pCJKFont[i]);
- pCJKFontHeight[i] = new SvxFontHeightItem(*rData.pCJKFontHeight[i]);
- pCJKFontWeight[i] = new SvxWeightItem(*rData.pCJKFontWeight[i]);
- pCJKFontPosture[i] = new SvxPostureItem(*rData.pCJKFontPosture[i]);
-
- pCTLFont[i] = new SvxFontItem(*rData.pCTLFont[i]);
- pCTLFontHeight[i] = new SvxFontHeightItem(*rData.pCTLFontHeight[i]);
- pCTLFontWeight[i] = new SvxWeightItem(*rData.pCTLFontWeight[i]);
- pCTLFontPosture[i] = new SvxPostureItem(*rData.pCTLFontPosture[i]);
-
- pFontUnderline[i] = new SvxUnderlineItem(*rData.pFontUnderline[i]);
- pFontCrossedOut[i] = new SvxCrossedOutItem(*rData.pFontCrossedOut[i]);
- pFontContour[i] = new SvxContourItem(*rData.pFontContour[i]);
- pFontShadowed[i] = new SvxShadowedItem(*rData.pFontShadowed[i]);
- pFontColor[i] = new SvxColorItem(*rData.pFontColor[i]);
- pBox[i] = new SvxBoxItem(*rData.pBox[i]);
- pBackground[i] = new SvxBrushItem(*rData.pBackground[i]);
-
- pAdjust[ i ] = new SvxAdjustItem( *rData.pAdjust[ i ] );
-
- pHorJustify[i] = new SvxHorJustifyItem(*rData.pHorJustify[i]);
- pVerJustify[i] = new SvxVerJustifyItem(*rData.pVerJustify[i]);
- pOrientation[i] = new SvxOrientationItem(*rData.pOrientation[i]);
- pMargin[i] = new SvxMarginItem(*rData.pMargin[i]);
- pLinebreak[i] = new SfxBoolItem(*rData.pLinebreak[i]);
- pRotateAngle[i] = new SfxInt32Item(*rData.pRotateAngle[i]);
- pRotateMode[i] = new SvxRotateModeItem(*rData.pRotateMode[i]);
-
- pNumFormat[i] = new ScNumFormatAbbrev(*rData.pNumFormat[i]);
- }
-}
+ SfxPoolItem* pNew;
-ScAutoFormatData::~ScAutoFormatData()
-{
- for (USHORT i = 0; i < 16; i++)
+ READ( aFont, SvxFontItem, rVersions.nFontVersion)
+ READ( aHeight, SvxFontHeightItem, rVersions.nFontHeightVersion)
+ READ( aWeight, SvxWeightItem, rVersions.nWeightVersion)
+ READ( aPosture, SvxPostureItem, rVersions.nPostureVersion)
+ // --- from 641 on: CJK and CTL font settings
+ if( AUTOFORMAT_DATA_ID_641 <= nVer )
{
- delete pFont[i];
- delete pFontHeight[i];
- delete pFontWeight[i];
- delete pFontPosture[i];
-
- delete pCJKFont[i];
- delete pCJKFontHeight[i];
- delete pCJKFontWeight[i];
- delete pCJKFontPosture[i];
-
- delete pCTLFont[i];
- delete pCTLFontHeight[i];
- delete pCTLFontWeight[i];
- delete pCTLFontPosture[i];
-
- delete pFontUnderline[i];
- delete pFontCrossedOut[i];
- delete pFontContour[i];
- delete pFontShadowed[i];
- delete pFontColor[i];
- delete pBox[i];
- delete pBackground[i];
-
- delete pAdjust[i];
-
- delete pHorJustify[i];
- delete pVerJustify[i];
- delete pOrientation[i];
- delete pMargin[i];
- delete pLinebreak[i];
- delete pRotateAngle[i];
- delete pRotateMode[i];
-
- delete pNumFormat[i];
+ READ( aCJKFont, SvxFontItem, rVersions.nFontVersion)
+ READ( aCJKHeight, SvxFontHeightItem, rVersions.nFontHeightVersion)
+ READ( aCJKWeight, SvxWeightItem, rVersions.nWeightVersion)
+ READ( aCJKPosture, SvxPostureItem, rVersions.nPostureVersion)
+ READ( aCTLFont, SvxFontItem, rVersions.nFontVersion)
+ READ( aCTLHeight, SvxFontHeightItem, rVersions.nFontHeightVersion)
+ READ( aCTLWeight, SvxWeightItem, rVersions.nWeightVersion)
+ READ( aCTLPosture, SvxPostureItem, rVersions.nPostureVersion)
}
-}
-
-//---------------------------------------------------------------------------------------
-
-void ScAutoFormatData::GetNumFormat(USHORT nIndex, ScNumFormatAbbrev& rNumFormat) const
-{
- rNumFormat = *pNumFormat[nIndex];
-}
-
-void ScAutoFormatData::SetNumFormat(USHORT nIndex, const ScNumFormatAbbrev& rNumFormat)
-{
- *pNumFormat[nIndex] = rNumFormat;
-}
-
-//---------------------------------------------------------------------------------------
-
-void ScAutoFormatData::GetFont(USHORT nIndex, SvxFontItem& rFont) const
-{
- rFont = *pFont[nIndex];
-}
-
-void ScAutoFormatData::SetFont(USHORT nIndex, const SvxFontItem& rFont)
-{
- *pFont[nIndex] = rFont;
-}
-
-//---------------------------------------------------------------------------------------
-
-void ScAutoFormatData::GetFontHeight(USHORT nIndex, SvxFontHeightItem& rFontHeight) const
-{
- rFontHeight = *pFontHeight[nIndex];
-}
-
-void ScAutoFormatData::SetFontHeight(USHORT nIndex, const SvxFontHeightItem& rFontHeight)
-{
- *pFontHeight[nIndex] = rFontHeight;
-}
-
-//---------------------------------------------------------------------------------------
-
-void ScAutoFormatData::GetFontWeight(USHORT nIndex, SvxWeightItem& rFontWeight) const
-{
- rFontWeight = *pFontWeight[nIndex];
-}
-
-void ScAutoFormatData::SetFontWeight(USHORT nIndex, const SvxWeightItem& rFontWeight)
-{
- *pFontWeight[nIndex] = rFontWeight;
-}
-
-//---------------------------------------------------------------------------------------
-
-void ScAutoFormatData::GetFontPosture(USHORT nIndex, SvxPostureItem& rFontPosture) const
-{
- rFontPosture = *pFontPosture[nIndex];
-}
-
-void ScAutoFormatData::SetFontPosture(USHORT nIndex, const SvxPostureItem& rFontPosture)
-{
- *pFontPosture[nIndex] = rFontPosture;
-}
-
-//---------------------------------------------------------------------------------------
-
-void ScAutoFormatData::GetCJKFont(USHORT nIndex, SvxFontItem& rFont) const
-{
- rFont = *pCJKFont[nIndex];
- rFont.SetWhich( pCJKFont[nIndex]->Which() );
-}
-
-void ScAutoFormatData::SetCJKFont(USHORT nIndex, const SvxFontItem& rFont)
-{
- *pCJKFont[nIndex] = rFont;
-}
-
-//---------------------------------------------------------------------------------------
-
-void ScAutoFormatData::GetCJKFontHeight(USHORT nIndex, SvxFontHeightItem& rFontHeight) const
-{
- rFontHeight = *pCJKFontHeight[nIndex];
- rFontHeight.SetWhich( pCJKFontHeight[nIndex]->Which() );
-}
-
-void ScAutoFormatData::SetCJKFontHeight(USHORT nIndex, const SvxFontHeightItem& rFontHeight)
-{
- *pCJKFontHeight[nIndex] = rFontHeight;
-}
-
-//---------------------------------------------------------------------------------------
-
-void ScAutoFormatData::GetCJKFontWeight(USHORT nIndex, SvxWeightItem& rFontWeight) const
-{
- rFontWeight = *pCJKFontWeight[nIndex];
- rFontWeight.SetWhich( pCJKFontWeight[nIndex]->Which() );
-}
-
-void ScAutoFormatData::SetCJKFontWeight(USHORT nIndex, const SvxWeightItem& rFontWeight)
-{
- *pCJKFontWeight[nIndex] = rFontWeight;
-}
-
-//---------------------------------------------------------------------------------------
-
-void ScAutoFormatData::GetCJKFontPosture(USHORT nIndex, SvxPostureItem& rFontPosture) const
-{
- rFontPosture = *pCJKFontPosture[nIndex];
- rFontPosture.SetWhich( pCJKFontPosture[nIndex]->Which() );
-}
-
-void ScAutoFormatData::SetCJKFontPosture(USHORT nIndex, const SvxPostureItem& rFontPosture)
-{
- *pCJKFontPosture[nIndex] = rFontPosture;
-}
-
-//---------------------------------------------------------------------------------------
-
-void ScAutoFormatData::GetCTLFont(USHORT nIndex, SvxFontItem& rFont) const
-{
- rFont = *pCTLFont[nIndex];
- rFont.SetWhich( pCTLFont[nIndex]->Which() );
-}
-
-void ScAutoFormatData::SetCTLFont(USHORT nIndex, const SvxFontItem& rFont)
-{
- *pCTLFont[nIndex] = rFont;
-}
-
-//---------------------------------------------------------------------------------------
-
-void ScAutoFormatData::GetCTLFontHeight(USHORT nIndex, SvxFontHeightItem& rFontHeight) const
-{
- rFontHeight = *pCTLFontHeight[nIndex];
- rFontHeight.SetWhich( pCTLFontHeight[nIndex]->Which() );
-}
-
-void ScAutoFormatData::SetCTLFontHeight(USHORT nIndex, const SvxFontHeightItem& rFontHeight)
-{
- *pCTLFontHeight[nIndex] = rFontHeight;
-}
-
-//---------------------------------------------------------------------------------------
-
-void ScAutoFormatData::GetCTLFontWeight(USHORT nIndex, SvxWeightItem& rFontWeight) const
-{
- rFontWeight = *pCTLFontWeight[nIndex];
- rFontWeight.SetWhich( pCTLFontWeight[nIndex]->Which() );
-}
-
-void ScAutoFormatData::SetCTLFontWeight(USHORT nIndex, const SvxWeightItem& rFontWeight)
-{
- *pCTLFontWeight[nIndex] = rFontWeight;
-}
-
-//---------------------------------------------------------------------------------------
-
-void ScAutoFormatData::GetCTLFontPosture(USHORT nIndex, SvxPostureItem& rFontPosture) const
-{
- rFontPosture = *pCTLFontPosture[nIndex];
- rFontPosture.SetWhich( pCTLFontPosture[nIndex]->Which() );
-}
-
-void ScAutoFormatData::SetCTLFontPosture(USHORT nIndex, const SvxPostureItem& rFontPosture)
-{
- *pCTLFontPosture[nIndex] = rFontPosture;
-}
-
-//---------------------------------------------------------------------------------------
-
-void ScAutoFormatData::GetFontUnderline(USHORT nIndex, SvxUnderlineItem& rFontUnderline) const
-{
- rFontUnderline = *pFontUnderline[nIndex];
-}
-
-void ScAutoFormatData::SetFontUnderline(USHORT nIndex, const SvxUnderlineItem& rFontUnderline)
-{
- *pFontUnderline[nIndex] = rFontUnderline;
-}
-
-//---------------------------------------------------------------------------------------
-
-void ScAutoFormatData::GetFontCrossedOut(USHORT nIndex, SvxCrossedOutItem& rFontCrossedOut) const
-{
- rFontCrossedOut = *pFontCrossedOut[nIndex];
-}
-
-void ScAutoFormatData::SetFontCrossedOut(USHORT nIndex, const SvxCrossedOutItem& rFontCrossedOut)
-{
- *pFontCrossedOut[nIndex] = rFontCrossedOut;
-}
-
-//---------------------------------------------------------------------------------------
+ READ( aUnderline, SvxUnderlineItem, rVersions.nUnderlineVersion)
+ READ( aCrossedOut, SvxCrossedOutItem, rVersions.nCrossedOutVersion)
+ READ( aContour, SvxContourItem, rVersions.nContourVersion)
+ READ( aShadowed, SvxShadowedItem, rVersions.nShadowedVersion)
+ READ( aColor, SvxColorItem, rVersions.nColorVersion)
+ READ( aBox, SvxBoxItem, rVersions.nBoxVersion)
+ READ( aBackground, SvxBrushItem, rVersions.nBrushVersion)
+
+ pNew = aAdjust.Create( rStream, rVersions.nAdjustVersion );
+ SetAdjust( *(SvxAdjustItem*)pNew );
+ delete pNew;
-void ScAutoFormatData::GetFontContour(USHORT nIndex, SvxContourItem& rFontContour) const
-{
- rFontContour = *pFontContour[nIndex];
-}
+ READ( aHorJustify, SvxHorJustifyItem, rVersions.nHorJustifyVersion)
+ READ( aVerJustify, SvxVerJustifyItem, rVersions.nVerJustifyVersion)
+ READ( aOrientation, SvxOrientationItem, rVersions.nOrientationVersion)
+ READ( aMargin, SvxMarginItem, rVersions.nMarginVersion)
-void ScAutoFormatData::SetFontContour(USHORT nIndex, const SvxContourItem& rFontContour)
-{
- *pFontContour[nIndex] = rFontContour;
-}
-
-//---------------------------------------------------------------------------------------
+ pNew = aLinebreak.Create( rStream, rVersions.nBoolVersion );
+ SetLinebreak( *(SfxBoolItem*)pNew );
+ delete pNew;
-void ScAutoFormatData::GetFontShadowed(USHORT nIndex, SvxShadowedItem& rFontShadowed) const
-{
- rFontShadowed = *pFontShadowed[nIndex];
-}
+ if ( nVer >= AUTOFORMAT_DATA_ID_504 )
+ {
+ pNew = aRotateAngle.Create( rStream, rVersions.nInt32Version );
+ SetRotateAngle( *(SfxInt32Item*)pNew );
+ delete pNew;
+ pNew = aRotateMode.Create( rStream, rVersions.nRotateModeVersion );
+ SetRotateMode( *(SvxRotateModeItem*)pNew );
+ delete pNew;
+ }
-void ScAutoFormatData::SetFontShadowed(USHORT nIndex, const SvxShadowedItem& rFontShadowed)
-{
- *pFontShadowed[nIndex] = rFontShadowed;
-}
+ if( 0 == rVersions.nNumFmtVersion )
+ aNumFormat.Load( rStream );
-//---------------------------------------------------------------------------------------
+ // adjust charset in font
+ CharSet eSysSet = gsl_getSystemTextEncoding();
+ CharSet eSrcSet = rStream.GetStreamCharSet();
+ if( eSrcSet != eSysSet && aFont.GetCharSet() == eSrcSet )
+ aFont.GetCharSet() = eSysSet;
-void ScAutoFormatData::GetFontColor(USHORT nIndex, SvxColorItem& rFontColor) const
-{
- rFontColor = *pFontColor[nIndex];
+ return (rStream.GetError() == 0);
}
-void ScAutoFormatData::SetFontColor(USHORT nIndex, const SvxColorItem& rFontColor)
-{
- *pFontColor[nIndex] = rFontColor;
-}
-
-//---------------------------------------------------------------------------------------
+#ifdef READ_OLDVERS
+BOOL ScAutoFormatDataField::LoadOld( SvStream& rStream, const ScAfVersions& rVersions )
+{
+ SfxPoolItem* pNew;
+
+ aNumFormat.Load(rStream);
+
+ READ( aFont, SvxFontItem, rVersions.nFontVersion)
+ READ( aHeight, SvxFontHeightItem, rVersions.nFontHeightVersion)
+ READ( aWeight, SvxWeightItem, rVersions.nWeightVersion)
+ READ( aPosture, SvxPostureItem, rVersions.nPostureVersion)
+ READ( aUnderline, SvxUnderlineItem, rVersions.nUnderlineVersion)
+ READ( aCrossedOut, SvxCrossedOutItem, rVersions.nCrossedOutVersion)
+ READ( aContour, SvxContourItem, rVersions.nContourVersion)
+ READ( aShadowed, SvxShadowedItem, rVersions.nShadowedVersion)
+ READ( aColor, SvxColorItem, rVersions.nColorVersion)
+ READ( aHorJustify, SvxHorJustifyItem, rVersions.nHorJustifyVersion)
+ READ( aVerJustify, SvxVerJustifyItem, rVersions.nVerJustifyVersion)
+ READ( aOrientation, SvxOrientationItem, rVersions.nOrientationVersion)
+ pNew = aLinebreak.Create( rStream, rVersions.nBoolVersion );
+ SetLinebreak( *(SfxBoolItem*)pNew );
+ delete pNew;
+ READ( aMargin, SvxMarginItem, rVersions.nMarginVersion)
+ READ( aBox, SvxBoxItem, rVersions.nBoxVersion)
+ READ( aBackground, SvxBrushItem, rVersions.nBrushVersion)
-void ScAutoFormatData::GetHorJustify(USHORT nIndex, SvxHorJustifyItem& rHorJustify) const
-{
- rHorJustify = *pHorJustify[nIndex];
+ return (rStream.GetError() == 0);
}
+#endif
-void ScAutoFormatData::SetHorJustify(USHORT nIndex, const SvxHorJustifyItem& rHorJustify)
+BOOL ScAutoFormatDataField::Save( SvStream& rStream )
{
- *pHorJustify[nIndex] = rHorJustify;
-}
+ aFont.Store ( rStream, aFont.GetVersion( SOFFICE_FILEFORMAT_40 ) );
+ aHeight.Store ( rStream, aHeight.GetVersion( SOFFICE_FILEFORMAT_40 ) );
+ aWeight.Store ( rStream, aWeight.GetVersion( SOFFICE_FILEFORMAT_40 ) );
+ aPosture.Store ( rStream, aPosture.GetVersion( SOFFICE_FILEFORMAT_40 ) );
+ // --- from 641 on: CJK and CTL font settings
+ aCJKFont.Store ( rStream, aCJKFont.GetVersion( SOFFICE_FILEFORMAT_40 ) );
+ aCJKHeight.Store ( rStream, aCJKHeight.GetVersion( SOFFICE_FILEFORMAT_40 ) );
+ aCJKWeight.Store ( rStream, aCJKWeight.GetVersion( SOFFICE_FILEFORMAT_40 ) );
+ aCJKPosture.Store ( rStream, aCJKPosture.GetVersion( SOFFICE_FILEFORMAT_40 ) );
+ aCTLFont.Store ( rStream, aCTLFont.GetVersion( SOFFICE_FILEFORMAT_40 ) );
+ aCTLHeight.Store ( rStream, aCTLHeight.GetVersion( SOFFICE_FILEFORMAT_40 ) );
+ aCTLWeight.Store ( rStream, aCTLWeight.GetVersion( SOFFICE_FILEFORMAT_40 ) );
+ aCTLPosture.Store ( rStream, aCTLPosture.GetVersion( SOFFICE_FILEFORMAT_40 ) );
-//---------------------------------------------------------------------------------------
+ aUnderline.Store ( rStream, aUnderline.GetVersion( SOFFICE_FILEFORMAT_40 ) );
+ aCrossedOut.Store ( rStream, aCrossedOut.GetVersion( SOFFICE_FILEFORMAT_40 ) );
+ aContour.Store ( rStream, aContour.GetVersion( SOFFICE_FILEFORMAT_40 ) );
+ aShadowed.Store ( rStream, aShadowed.GetVersion( SOFFICE_FILEFORMAT_40 ) );
+ aColor.Store ( rStream, aColor.GetVersion( SOFFICE_FILEFORMAT_40 ) );
+ aBox.Store ( rStream, aBox.GetVersion( SOFFICE_FILEFORMAT_40 ) );
+ aBackground.Store ( rStream, aBackground.GetVersion( SOFFICE_FILEFORMAT_40 ) );
-void ScAutoFormatData::GetVerJustify(USHORT nIndex, SvxVerJustifyItem& rVerJustify) const
-{
- rVerJustify = *pVerJustify[nIndex];
-}
+ aAdjust.Store ( rStream, aAdjust.GetVersion( SOFFICE_FILEFORMAT_40 ) );
-void ScAutoFormatData::SetVerJustify(USHORT nIndex, const SvxVerJustifyItem& rVerJustify)
-{
- *pVerJustify[nIndex] = rVerJustify;
-}
+ aHorJustify.Store ( rStream, aHorJustify.GetVersion( SOFFICE_FILEFORMAT_40 ) );
+ aVerJustify.Store ( rStream, aVerJustify.GetVersion( SOFFICE_FILEFORMAT_40 ) );
+ aOrientation.Store ( rStream, aOrientation.GetVersion( SOFFICE_FILEFORMAT_40 ) );
+ aMargin.Store ( rStream, aMargin.GetVersion( SOFFICE_FILEFORMAT_40 ) );
+ aLinebreak.Store ( rStream, aLinebreak.GetVersion( SOFFICE_FILEFORMAT_40 ) );
+ // Rotation ab SO5
+ aRotateAngle.Store ( rStream, aRotateAngle.GetVersion( SOFFICE_FILEFORMAT_40 ) );
+ aRotateMode.Store ( rStream, aRotateMode.GetVersion( SOFFICE_FILEFORMAT_40 ) );
-//---------------------------------------------------------------------------------------
+ aNumFormat.Save( rStream );
-void ScAutoFormatData::GetOrientation(USHORT nIndex, SvxOrientationItem& rOrientation) const
-{
- rOrientation = *pOrientation[nIndex];
+ return (rStream.GetError() == 0);
}
-void ScAutoFormatData::SetOrientation(USHORT nIndex, const SvxOrientationItem& rOrientation)
-{
- *pOrientation[nIndex] = rOrientation;
-}
-//---------------------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
-void ScAutoFormatData::GetLinebreak(USHORT nIndex, SfxBoolItem& rLinebreak) const
+ScAutoFormatData::ScAutoFormatData()
{
- rLinebreak.SetValue( pLinebreak[nIndex]->GetValue() );
-}
+ nStrResId = USHRT_MAX;
-void ScAutoFormatData::SetLinebreak(USHORT nIndex, const SfxBoolItem& rLinebreak)
-{
- pLinebreak[nIndex]->SetValue( rLinebreak.GetValue() );
+ bIncludeValueFormat =
+ bIncludeFont =
+ bIncludeJustify =
+ bIncludeFrame =
+ bIncludeBackground =
+ bIncludeWidthHeight = TRUE;
}
-//---------------------------------------------------------------------------------------
-
-void ScAutoFormatData::GetMargin(USHORT nIndex, SvxMarginItem& rMargin) const
+ScAutoFormatData::ScAutoFormatData( const ScAutoFormatData& rData ) :
+ aName( rData.aName ),
+ nStrResId( rData.nStrResId ),
+ bIncludeValueFormat( rData.bIncludeValueFormat ),
+ bIncludeFont( rData.bIncludeFont ),
+ bIncludeJustify( rData.bIncludeJustify ),
+ bIncludeFrame( rData.bIncludeFrame ),
+ bIncludeBackground( rData.bIncludeBackground ),
+ bIncludeWidthHeight( rData.bIncludeWidthHeight )
{
- rMargin = *pMargin[nIndex];
}
-void ScAutoFormatData::SetMargin(USHORT nIndex, const SvxMarginItem& rMargin)
+ScAutoFormatData::~ScAutoFormatData()
{
- *pMargin[nIndex] = rMargin;
}
-//---------------------------------------------------------------------------------------
-
-void ScAutoFormatData::GetBox(USHORT nIndex, SvxBoxItem& rBox) const
+ScAutoFormatDataField& ScAutoFormatData::GetField( USHORT nIndex )
{
- rBox = *pBox[nIndex];
+ DBG_ASSERT( (0 <= nIndex) && (nIndex < 16), "ScAutoFormatData::GetField - illegal index" );
+ return aDataField[ nIndex ];
}
-void ScAutoFormatData::SetBox(USHORT nIndex, const SvxBoxItem& rBox)
+const ScAutoFormatDataField& ScAutoFormatData::GetField( USHORT nIndex ) const
{
- *pBox[nIndex] = rBox;
+ DBG_ASSERT( (0 <= nIndex) && (nIndex < 16), "ScAutoFormatData::GetField - illegal index" );
+ return aDataField[ nIndex ];
}
-//---------------------------------------------------------------------------------------
-
-void ScAutoFormatData::GetBackground(USHORT nIndex, SvxBrushItem& rBackground) const
+const SfxPoolItem* ScAutoFormatData::GetItem( USHORT nIndex, USHORT nWhich ) const
{
- rBackground = *pBackground[nIndex];
+ const ScAutoFormatDataField& rField = GetField( nIndex );
+ switch( nWhich )
+ {
+ case ATTR_FONT: return &rField.GetFont();
+ case ATTR_FONT_HEIGHT: return &rField.GetHeight();
+ case ATTR_FONT_WEIGHT: return &rField.GetWeight();
+ case ATTR_FONT_POSTURE: return &rField.GetPosture();
+ case ATTR_CJK_FONT: return &rField.GetCJKFont();
+ case ATTR_CJK_FONT_HEIGHT: return &rField.GetCJKHeight();
+ case ATTR_CJK_FONT_WEIGHT: return &rField.GetCJKWeight();
+ case ATTR_CJK_FONT_POSTURE: return &rField.GetCJKPosture();
+ case ATTR_CTL_FONT: return &rField.GetCTLFont();
+ case ATTR_CTL_FONT_HEIGHT: return &rField.GetCTLHeight();
+ case ATTR_CTL_FONT_WEIGHT: return &rField.GetCTLWeight();
+ case ATTR_CTL_FONT_POSTURE: return &rField.GetCTLPosture();
+ case ATTR_FONT_UNDERLINE: return &rField.GetUnderline();
+ case ATTR_FONT_CROSSEDOUT: return &rField.GetCrossedOut();
+ case ATTR_FONT_CONTOUR: return &rField.GetContour();
+ case ATTR_FONT_SHADOWED: return &rField.GetShadowed();
+ case ATTR_FONT_COLOR: return &rField.GetColor();
+ case ATTR_BORDER: return &rField.GetBox();
+ case ATTR_BACKGROUND: return &rField.GetBackground();
+ case ATTR_HOR_JUSTIFY: return &rField.GetHorJustify();
+ case ATTR_VER_JUSTIFY: return &rField.GetVerJustify();
+ case ATTR_ORIENTATION: return &rField.GetOrientation();
+ case ATTR_MARGIN: return &rField.GetMargin();
+ case ATTR_LINEBREAK: return &rField.GetLinebreak();
+ case ATTR_ROTATE_VALUE: return &rField.GetRotateAngle();
+ case ATTR_ROTATE_MODE: return &rField.GetRotateMode();
+ }
+ return NULL;
}
-void ScAutoFormatData::SetBackground(USHORT nIndex, const SvxBrushItem& rBackground)
+void ScAutoFormatData::PutItem( USHORT nIndex, const SfxPoolItem& rItem )
{
- *pBackground[nIndex] = rBackground;
+ ScAutoFormatDataField& rField = GetField( nIndex );
+ switch( rItem.Which() )
+ {
+ case ATTR_FONT: rField.SetFont( (const SvxFontItem&)rItem ); break;
+ case ATTR_FONT_HEIGHT: rField.SetHeight( (const SvxFontHeightItem&)rItem ); break;
+ case ATTR_FONT_WEIGHT: rField.SetWeight( (const SvxWeightItem&)rItem ); break;
+ case ATTR_FONT_POSTURE: rField.SetPosture( (const SvxPostureItem&)rItem ); break;
+ case ATTR_CJK_FONT: rField.SetCJKFont( (const SvxFontItem&)rItem ); break;
+ case ATTR_CJK_FONT_HEIGHT: rField.SetCJKHeight( (const SvxFontHeightItem&)rItem ); break;
+ case ATTR_CJK_FONT_WEIGHT: rField.SetCJKWeight( (const SvxWeightItem&)rItem ); break;
+ case ATTR_CJK_FONT_POSTURE: rField.SetCJKPosture( (const SvxPostureItem&)rItem ); break;
+ case ATTR_CTL_FONT: rField.SetCTLFont( (const SvxFontItem&)rItem ); break;
+ case ATTR_CTL_FONT_HEIGHT: rField.SetCTLHeight( (const SvxFontHeightItem&)rItem ); break;
+ case ATTR_CTL_FONT_WEIGHT: rField.SetCTLWeight( (const SvxWeightItem&)rItem ); break;
+ case ATTR_CTL_FONT_POSTURE: rField.SetCTLPosture( (const SvxPostureItem&)rItem ); break;
+ case ATTR_FONT_UNDERLINE: rField.SetUnderline( (const SvxUnderlineItem&)rItem ); break;
+ case ATTR_FONT_CROSSEDOUT: rField.SetCrossedOut( (const SvxCrossedOutItem&)rItem ); break;
+ case ATTR_FONT_CONTOUR: rField.SetContour( (const SvxContourItem&)rItem ); break;
+ case ATTR_FONT_SHADOWED: rField.SetShadowed( (const SvxShadowedItem&)rItem ); break;
+ case ATTR_FONT_COLOR: rField.SetColor( (const SvxColorItem&)rItem ); break;
+ case ATTR_BORDER: rField.SetBox( (const SvxBoxItem&)rItem ); break;
+ case ATTR_BACKGROUND: rField.SetBackground( (const SvxBrushItem&)rItem ); break;
+ case ATTR_HOR_JUSTIFY: rField.SetHorJustify( (const SvxHorJustifyItem&)rItem ); break;
+ case ATTR_VER_JUSTIFY: rField.SetVerJustify( (const SvxVerJustifyItem&)rItem ); break;
+ case ATTR_ORIENTATION: rField.SetOrientation( (const SvxOrientationItem&)rItem );break;
+ case ATTR_MARGIN: rField.SetMargin( (const SvxMarginItem&)rItem ); break;
+ case ATTR_LINEBREAK: rField.SetLinebreak( (const SfxBoolItem&)rItem ); break;
+ case ATTR_ROTATE_VALUE: rField.SetRotateAngle( (const SfxInt32Item&)rItem ); break;
+ case ATTR_ROTATE_MODE: rField.SetRotateMode( (const SvxRotateModeItem&)rItem ); break;
+ }
}
-//---------------------------------------------------------------------------------------
-
-void ScAutoFormatData::GetRotateAngle( USHORT nIndex, SfxInt32Item& rRotateAngle ) const
+void ScAutoFormatData::CopyItem( USHORT nToIndex, USHORT nFromIndex, USHORT nWhich )
{
- rRotateAngle.SetValue( pRotateAngle[nIndex]->GetValue() );
+ const SfxPoolItem* pItem = GetItem( nFromIndex, nWhich );
+ if( pItem )
+ PutItem( nToIndex, *pItem );
}
-void ScAutoFormatData::SetRotateAngle( USHORT nIndex, const SfxInt32Item& rRotateAngle )
+const ScNumFormatAbbrev& ScAutoFormatData::GetNumFormat( USHORT nIndex ) const
{
- pRotateAngle[nIndex]->SetValue( rRotateAngle.GetValue() );
+ return GetField( nIndex ).GetNumFormat();
}
-//---------------------------------------------------------------------------------------
-
-void ScAutoFormatData::GetRotateMode( USHORT nIndex, SvxRotateModeItem& rRotateMode ) const
+void ScAutoFormatData::SetNumFormat( USHORT nIndex, const ScNumFormatAbbrev& rNumFormat )
{
- rRotateMode.SetValue( pRotateMode[nIndex]->GetValue() );
+ GetField( nIndex ).SetNumFormat( rNumFormat );
}
-void ScAutoFormatData::SetRotateMode( USHORT nIndex, const SvxRotateModeItem& rRotateMode )
+BOOL ScAutoFormatData::IsEqualData( USHORT nIndex1, USHORT nIndex2 ) const
{
- pRotateMode[nIndex]->SetValue( rRotateMode.GetValue() );
-}
-
-//---------------------------------------------------------------------------------------
+ BOOL bEqual = TRUE;
+ const ScAutoFormatDataField& rField1 = GetField( nIndex1 );
+ const ScAutoFormatDataField& rField2 = GetField( nIndex2 );
-const SfxPoolItem* ScAutoFormatData::GetItem( USHORT nIndex, USHORT nWhich ) const
-{
- switch (nWhich)
+ if( bIncludeValueFormat )
{
- case ATTR_FONT: return pFont[nIndex];
- case ATTR_FONT_HEIGHT: return pFontHeight[nIndex];
- case ATTR_FONT_WEIGHT: return pFontWeight[nIndex];
- case ATTR_FONT_POSTURE: return pFontPosture[nIndex];
- case ATTR_CJK_FONT: return pCJKFont[nIndex];
- case ATTR_CJK_FONT_HEIGHT: return pCJKFontHeight[nIndex];
- case ATTR_CJK_FONT_WEIGHT: return pCJKFontWeight[nIndex];
- case ATTR_CJK_FONT_POSTURE: return pCJKFontPosture[nIndex];
- case ATTR_CTL_FONT: return pCTLFont[nIndex];
- case ATTR_CTL_FONT_HEIGHT: return pCTLFontHeight[nIndex];
- case ATTR_CTL_FONT_WEIGHT: return pCTLFontWeight[nIndex];
- case ATTR_CTL_FONT_POSTURE: return pCTLFontPosture[nIndex];
- case ATTR_FONT_UNDERLINE: return pFontUnderline[nIndex];
- case ATTR_FONT_CROSSEDOUT: return pFontCrossedOut[nIndex];
- case ATTR_FONT_CONTOUR: return pFontContour[nIndex];
- case ATTR_FONT_SHADOWED: return pFontShadowed[nIndex];
- case ATTR_FONT_COLOR: return pFontColor[nIndex];
- case ATTR_BORDER: return pBox[nIndex];
- case ATTR_BACKGROUND: return pBackground[nIndex];
- case ATTR_HOR_JUSTIFY: return pHorJustify[nIndex];
- case ATTR_VER_JUSTIFY: return pVerJustify[nIndex];
- case ATTR_ORIENTATION: return pOrientation[nIndex];
- case ATTR_MARGIN: return pMargin[nIndex];
- case ATTR_LINEBREAK: return pLinebreak[nIndex];
- case ATTR_ROTATE_VALUE: return pRotateAngle[nIndex];
- case ATTR_ROTATE_MODE: return pRotateMode[nIndex];
+ bEqual = bEqual
+ && (rField1.GetNumFormat() == rField2.GetNumFormat());
}
- return NULL;
-}
-
-void ScAutoFormatData::PutItem( USHORT nIndex, const SfxPoolItem& rItem )
-{
- switch (rItem.Which())
+ if( bIncludeFont )
{
- case ATTR_FONT:
- *pFont[nIndex] = (const SvxFontItem&)rItem;
- break;
- case ATTR_FONT_HEIGHT:
- *pFontHeight[nIndex] = (const SvxFontHeightItem&)rItem;
- break;
- case ATTR_FONT_WEIGHT:
- *pFontWeight[nIndex] = (const SvxWeightItem&)rItem;
- break;
- case ATTR_FONT_POSTURE:
- *pFontPosture[nIndex] = (const SvxPostureItem&)rItem;
- break;
- case ATTR_CJK_FONT:
- *pCJKFont[nIndex] = (const SvxFontItem&)rItem;
- break;
- case ATTR_CJK_FONT_HEIGHT:
- *pCJKFontHeight[nIndex] = (const SvxFontHeightItem&)rItem;
- break;
- case ATTR_CJK_FONT_WEIGHT:
- *pCJKFontWeight[nIndex] = (const SvxWeightItem&)rItem;
- break;
- case ATTR_CJK_FONT_POSTURE:
- *pCJKFontPosture[nIndex] = (const SvxPostureItem&)rItem;
- break;
- case ATTR_CTL_FONT:
- *pCTLFont[nIndex] = (const SvxFontItem&)rItem;
- break;
- case ATTR_CTL_FONT_HEIGHT:
- *pCTLFontHeight[nIndex] = (const SvxFontHeightItem&)rItem;
- break;
- case ATTR_CTL_FONT_WEIGHT:
- *pCTLFontWeight[nIndex] = (const SvxWeightItem&)rItem;
- break;
- case ATTR_CTL_FONT_POSTURE:
- *pCTLFontPosture[nIndex] = (const SvxPostureItem&)rItem;
- break;
- case ATTR_FONT_UNDERLINE:
- *pFontUnderline[nIndex] = (const SvxUnderlineItem&)rItem;
- break;
- case ATTR_FONT_CROSSEDOUT:
- *pFontCrossedOut[nIndex] = (const SvxCrossedOutItem&)rItem;
- break;
- case ATTR_FONT_CONTOUR:
- *pFontContour[nIndex] = (const SvxContourItem&)rItem;
- break;
- case ATTR_FONT_SHADOWED:
- *pFontShadowed[nIndex] = (const SvxShadowedItem&)rItem;
- break;
- case ATTR_FONT_COLOR:
- *pFontColor[nIndex] = (const SvxColorItem&)rItem;
- break;
- case ATTR_BORDER:
- *pBox[nIndex] = (const SvxBoxItem&)rItem;
- break;
- case ATTR_BACKGROUND:
- *pBackground[nIndex] = (const SvxBrushItem&)rItem;
- break;
- case ATTR_HOR_JUSTIFY:
- *pHorJustify[nIndex] = (const SvxHorJustifyItem&)rItem;
- break;
- case ATTR_VER_JUSTIFY:
- *pVerJustify[nIndex] = (const SvxVerJustifyItem&)rItem;
- break;
- case ATTR_ORIENTATION:
- *pOrientation[nIndex] = (const SvxOrientationItem&)rItem;
- break;
- case ATTR_MARGIN:
- *pMargin[nIndex] = (const SvxMarginItem&)rItem;
- break;
- case ATTR_LINEBREAK:
- pLinebreak[nIndex]->SetValue( ((const SfxBoolItem&)rItem).GetValue() );
- break;
- case ATTR_ROTATE_VALUE:
- pRotateAngle[nIndex]->SetValue( ((const SfxInt32Item&)rItem).GetValue() );
- break;
- case ATTR_ROTATE_MODE:
- pRotateMode[nIndex]->SetValue( ((const SvxRotateModeItem&)rItem).GetValue() );
- break;
+ bEqual = bEqual
+ && (rField1.GetFont() == rField2.GetFont())
+ && (rField1.GetHeight() == rField2.GetHeight())
+ && (rField1.GetWeight() == rField2.GetWeight())
+ && (rField1.GetPosture() == rField2.GetPosture())
+ && (rField1.GetCJKFont() == rField2.GetCJKFont())
+ && (rField1.GetCJKHeight() == rField2.GetCJKHeight())
+ && (rField1.GetCJKWeight() == rField2.GetCJKWeight())
+ && (rField1.GetCJKPosture() == rField2.GetCJKPosture())
+ && (rField1.GetCTLFont() == rField2.GetCTLFont())
+ && (rField1.GetCTLHeight() == rField2.GetCTLHeight())
+ && (rField1.GetCTLWeight() == rField2.GetCTLWeight())
+ && (rField1.GetCTLPosture() == rField2.GetCTLPosture())
+ && (rField1.GetUnderline() == rField2.GetUnderline())
+ && (rField1.GetCrossedOut() == rField2.GetCrossedOut())
+ && (rField1.GetContour() == rField2.GetContour())
+ && (rField1.GetShadowed() == rField2.GetShadowed())
+ && (rField1.GetColor() == rField2.GetColor());
}
-}
-
-//---------------------------------------------------------------------------------------
-
-BOOL ScAutoFormatData::IsEqualData(USHORT nIndex1, USHORT nIndex2)
-{
- BOOL bEqual = TRUE;
- if (bIncludeValueFormat)
+ if( bIncludeJustify )
{
- bEqual = (bEqual && (*pNumFormat[nIndex1] == *pNumFormat[nIndex2]));
+ bEqual = bEqual
+ && (rField1.GetHorJustify() == rField2.GetHorJustify())
+ && (rField1.GetVerJustify() == rField2.GetVerJustify())
+ && (rField1.GetOrientation() == rField2.GetOrientation())
+ && (rField1.GetLinebreak() == rField2.GetLinebreak())
+ && (rField1.GetMargin() == rField2.GetMargin())
+ && (rField1.GetRotateAngle() == rField2.GetRotateAngle())
+ && (rField1.GetRotateMode() == rField2.GetRotateMode());
}
- if (bIncludeFont)
+ if( bIncludeFrame )
{
- bEqual = (bEqual && (*pFont[nIndex1] == *pFont[nIndex2]));
- bEqual = (bEqual && (*pFontHeight[nIndex1] == *pFontHeight[nIndex2]));
- bEqual = (bEqual && (*pFontWeight[nIndex1] == *pFontWeight[nIndex2]));
- bEqual = (bEqual && (*pFontPosture[nIndex1] == *pFontPosture[nIndex2]));
- bEqual = (bEqual && (*pCJKFont[nIndex1] == *pCJKFont[nIndex2]));
- bEqual = (bEqual && (*pCJKFontHeight[nIndex1] == *pCJKFontHeight[nIndex2]));
- bEqual = (bEqual && (*pCJKFontWeight[nIndex1] == *pCJKFontWeight[nIndex2]));
- bEqual = (bEqual && (*pCJKFontPosture[nIndex1] == *pCJKFontPosture[nIndex2]));
- bEqual = (bEqual && (*pCTLFont[nIndex1] == *pCTLFont[nIndex2]));
- bEqual = (bEqual && (*pCTLFontHeight[nIndex1] == *pCTLFontHeight[nIndex2]));
- bEqual = (bEqual && (*pCTLFontWeight[nIndex1] == *pCTLFontWeight[nIndex2]));
- bEqual = (bEqual && (*pCTLFontPosture[nIndex1] == *pCTLFontPosture[nIndex2]));
- bEqual = (bEqual && (*pFontUnderline[nIndex1] == *pFontUnderline[nIndex2]));
- bEqual = (bEqual && (*pFontCrossedOut[nIndex1] == *pFontCrossedOut[nIndex2]));
- bEqual = (bEqual && (*pFontContour[nIndex1] == *pFontContour[nIndex2]));
- bEqual = (bEqual && (*pFontShadowed[nIndex1] == *pFontShadowed[nIndex2]));
- bEqual = (bEqual && (*pFontColor[nIndex1] == *pFontColor[nIndex2]));
+ bEqual = bEqual
+ && (rField1.GetBox() == rField2.GetBox());
}
- if (bIncludeJustify)
+ if( bIncludeBackground )
{
- bEqual = (bEqual && (*pHorJustify[nIndex1] == *pHorJustify[nIndex2]));
- bEqual = (bEqual && (*pVerJustify[nIndex1] == *pVerJustify[nIndex2]));
- bEqual = (bEqual && (*pOrientation[nIndex1] == *pOrientation[nIndex2]));
- bEqual = (bEqual && (*pLinebreak[nIndex1] == *pLinebreak[nIndex2]));
- bEqual = (bEqual && (*pMargin[nIndex1] == *pMargin[nIndex2]));
- bEqual = (bEqual && (*pRotateAngle[nIndex1] == *pRotateAngle[nIndex2]));
- bEqual = (bEqual && (*pRotateMode[nIndex1] == *pRotateMode[nIndex2]));
+ bEqual = bEqual
+ && (rField1.GetBackground() == rField2.GetBackground());
}
- if (bIncludeFrame)
- bEqual = (bEqual && (*pBox[nIndex1] == *pBox[nIndex2]));
- if (bIncludeBackground)
- bEqual = (bEqual && (*pBackground[nIndex1] == *pBackground[nIndex2]));
return bEqual;
}
-#define READ( i, aItem, aItemType, nVers )\
- pNew = aItem[i]->Create(rStream, nVers ); \
- *aItem[i] = *(aItemType*)pNew; \
- delete pNew;
+void ScAutoFormatData::FillToItemSet( USHORT nIndex, SfxItemSet& rItemSet, ScDocument& rDoc ) const
+{
+ DBG_ASSERT( (0 <= nIndex) && (nIndex < 16), "ScAutoFormatData::FillToItemSet - illegal index" );
+ const ScAutoFormatDataField& rField = aDataField[ nIndex ];
-BOOL ScAutoFormatData::Load(SvStream& rStream, const ScAfVersions& rVersions)
+ if( bIncludeValueFormat )
+ {
+ ScNumFormatAbbrev& rNumFormat = (ScNumFormatAbbrev&)rField.GetNumFormat();
+ SfxUInt32Item aValueFormat( ATTR_VALUE_FORMAT, 0 );
+ aValueFormat.SetValue( rNumFormat.GetFormatIndex( *rDoc.GetFormatTable() ) );
+ rItemSet.Put( aValueFormat );
+ rItemSet.Put( SvxLanguageItem( rNumFormat.GetLanguage(), ATTR_LANGUAGE_FORMAT ) );
+ }
+ if( bIncludeFont )
+ {
+ rItemSet.Put( rField.GetFont() );
+ rItemSet.Put( rField.GetHeight() );
+ rItemSet.Put( rField.GetWeight() );
+ rItemSet.Put( rField.GetPosture() );
+ rItemSet.Put( rField.GetCJKFont() );
+ rItemSet.Put( rField.GetCJKHeight() );
+ rItemSet.Put( rField.GetCJKWeight() );
+ rItemSet.Put( rField.GetCJKPosture() );
+ rItemSet.Put( rField.GetCTLFont() );
+ rItemSet.Put( rField.GetCTLHeight() );
+ rItemSet.Put( rField.GetCTLWeight() );
+ rItemSet.Put( rField.GetCTLPosture() );
+ rItemSet.Put( rField.GetUnderline() );
+ rItemSet.Put( rField.GetCrossedOut() );
+ rItemSet.Put( rField.GetContour() );
+ rItemSet.Put( rField.GetShadowed() );
+ rItemSet.Put( rField.GetColor() );
+ }
+ if( bIncludeJustify )
+ {
+ rItemSet.Put( rField.GetHorJustify() );
+ rItemSet.Put( rField.GetVerJustify() );
+ rItemSet.Put( rField.GetOrientation() );
+ rItemSet.Put( rField.GetLinebreak() );
+ rItemSet.Put( rField.GetMargin() );
+ rItemSet.Put( rField.GetRotateAngle() );
+ rItemSet.Put( rField.GetRotateMode() );
+ }
+ if( bIncludeFrame )
+ rItemSet.Put( rField.GetBox() );
+ if( bIncludeBackground )
+ rItemSet.Put( rField.GetBackground() );
+}
+
+void ScAutoFormatData::GetFromItemSet( USHORT nIndex, const SfxItemSet& rItemSet, const ScNumFormatAbbrev& rNumFormat )
+{
+ DBG_ASSERT( (0 <= nIndex) && (nIndex < 16), "ScAutoFormatData::GetFromItemSet - illegal index" );
+ ScAutoFormatDataField& rField = aDataField[ nIndex ];
+
+ rField.SetNumFormat ( rNumFormat);
+ rField.SetFont ( (const SvxFontItem&) rItemSet.Get( ATTR_FONT ) );
+ rField.SetHeight ( (const SvxFontHeightItem&) rItemSet.Get( ATTR_FONT_HEIGHT ) );
+ rField.SetWeight ( (const SvxWeightItem&) rItemSet.Get( ATTR_FONT_WEIGHT ) );
+ rField.SetPosture ( (const SvxPostureItem&) rItemSet.Get( ATTR_FONT_POSTURE ) );
+ rField.SetCJKFont ( (const SvxFontItem&) rItemSet.Get( ATTR_CJK_FONT ) );
+ rField.SetCJKHeight ( (const SvxFontHeightItem&) rItemSet.Get( ATTR_CJK_FONT_HEIGHT ) );
+ rField.SetCJKWeight ( (const SvxWeightItem&) rItemSet.Get( ATTR_CJK_FONT_WEIGHT ) );
+ rField.SetCJKPosture ( (const SvxPostureItem&) rItemSet.Get( ATTR_CJK_FONT_POSTURE ) );
+ rField.SetCTLFont ( (const SvxFontItem&) rItemSet.Get( ATTR_CTL_FONT ) );
+ rField.SetCTLHeight ( (const SvxFontHeightItem&) rItemSet.Get( ATTR_CTL_FONT_HEIGHT ) );
+ rField.SetCTLWeight ( (const SvxWeightItem&) rItemSet.Get( ATTR_CTL_FONT_WEIGHT ) );
+ rField.SetCTLPosture ( (const SvxPostureItem&) rItemSet.Get( ATTR_CTL_FONT_POSTURE ) );
+ rField.SetUnderline ( (const SvxUnderlineItem&) rItemSet.Get( ATTR_FONT_UNDERLINE ) );
+ rField.SetCrossedOut ( (const SvxCrossedOutItem&) rItemSet.Get( ATTR_FONT_CROSSEDOUT ) );
+ rField.SetContour ( (const SvxContourItem&) rItemSet.Get( ATTR_FONT_CONTOUR ) );
+ rField.SetShadowed ( (const SvxShadowedItem&) rItemSet.Get( ATTR_FONT_SHADOWED ) );
+ rField.SetColor ( (const SvxColorItem&) rItemSet.Get( ATTR_FONT_COLOR ) );
+ rField.SetHorJustify ( (const SvxHorJustifyItem&) rItemSet.Get( ATTR_HOR_JUSTIFY ) );
+ rField.SetVerJustify ( (const SvxVerJustifyItem&) rItemSet.Get( ATTR_VER_JUSTIFY ) );
+ rField.SetOrientation ( (const SvxOrientationItem&) rItemSet.Get( ATTR_ORIENTATION ) );
+ rField.SetLinebreak ( (const SfxBoolItem&) rItemSet.Get( ATTR_LINEBREAK ) );
+ rField.SetMargin ( (const SvxMarginItem&) rItemSet.Get( ATTR_MARGIN ) );
+ rField.SetBackground ( (const SvxBrushItem&) rItemSet.Get( ATTR_BACKGROUND ) );
+ rField.SetRotateAngle ( (const SfxInt32Item&) rItemSet.Get( ATTR_ROTATE_VALUE ) );
+ rField.SetRotateMode ( (const SvxRotateModeItem&) rItemSet.Get( ATTR_ROTATE_MODE ) );
+}
+
+BOOL ScAutoFormatData::Load( SvStream& rStream, const ScAfVersions& rVersions )
{
BOOL bRet = TRUE;
- USHORT nVal = 0;
- rStream >> nVal;
+ USHORT nVer = 0;
+ rStream >> nVer;
bRet = 0 == rStream.GetError();
- if( bRet && (nVal == AUTOFORMAT_DATA_ID_X ||
- (AUTOFORMAT_DATA_ID_504 <= nVal && nVal <= AUTOFORMAT_DATA_ID)) )
+ if( bRet && (nVer == AUTOFORMAT_DATA_ID_X ||
+ (AUTOFORMAT_DATA_ID_504 <= nVer && nVer <= AUTOFORMAT_DATA_ID)) )
{
CharSet eSysSet = gsl_getSystemTextEncoding();
CharSet eSrcSet = rStream.GetStreamCharSet();
BOOL b;
rStream.ReadByteString( aName, eSrcSet );
- if( AUTOFORMAT_DATA_ID_552 <= nVal )
+ if( AUTOFORMAT_DATA_ID_552 <= nVer )
{
rStream >> nStrResId;
USHORT nId = RID_SVXSTR_TBLAFMT_BEGIN + nStrResId;
@@ -932,68 +740,9 @@ BOOL ScAutoFormatData::Load(SvStream& rStream, const ScAfVersions& rVersions)
rStream >> b; bIncludeValueFormat = b;
rStream >> b; bIncludeWidthHeight = b;
- SfxPoolItem* pNew;
bRet = 0 == rStream.GetError();
for( USHORT i = 0; bRet && i < 16; ++i )
- {
- READ( i, pFont, SvxFontItem , rVersions.nFontVersion)
- READ( i, pFontHeight, SvxFontHeightItem , rVersions.nFontHeightVersion)
- READ( i, pFontWeight, SvxWeightItem , rVersions.nWeightVersion)
- READ( i, pFontPosture, SvxPostureItem , rVersions.nPostureVersion)
- // --- from 641 on: CJK and CTL font settings
- if( AUTOFORMAT_DATA_ID_641 <= nVal )
- {
- READ( i, pCJKFont, SvxFontItem , rVersions.nFontVersion)
- READ( i, pCJKFontHeight, SvxFontHeightItem , rVersions.nFontHeightVersion)
- READ( i, pCJKFontWeight, SvxWeightItem , rVersions.nWeightVersion)
- READ( i, pCJKFontPosture, SvxPostureItem , rVersions.nPostureVersion)
- READ( i, pCTLFont, SvxFontItem , rVersions.nFontVersion)
- READ( i, pCTLFontHeight, SvxFontHeightItem , rVersions.nFontHeightVersion)
- READ( i, pCTLFontWeight, SvxWeightItem , rVersions.nWeightVersion)
- READ( i, pCTLFontPosture, SvxPostureItem , rVersions.nPostureVersion)
- }
- READ( i, pFontUnderline, SvxUnderlineItem , rVersions.nUnderlineVersion)
- READ( i, pFontCrossedOut, SvxCrossedOutItem , rVersions.nCrossedOutVersion)
- READ( i, pFontContour, SvxContourItem , rVersions.nContourVersion)
- READ( i, pFontShadowed, SvxShadowedItem , rVersions.nShadowedVersion)
- READ( i, pFontColor, SvxColorItem , rVersions.nColorVersion)
- READ( i, pBox, SvxBoxItem , rVersions.nBoxVersion)
- READ( i, pBackground, SvxBrushItem , rVersions.nBrushVersion)
-
- pNew = pAdjust[i]->Create(rStream, rVersions.nAdjustVersion );
- ((SvxAdjustItem*)pAdjust[i])->SetAdjust( ((SvxAdjustItem*)pNew)->GetAdjust() );
- ((SvxAdjustItem*)pAdjust[i])->SetOneWord( ((SvxAdjustItem*)pNew)->GetOneWord() );
- ((SvxAdjustItem*)pAdjust[i])->SetLastBlock( ((SvxAdjustItem*)pNew)->GetLastBlock() );
- delete pNew;
-
- READ( i, pHorJustify, SvxHorJustifyItem, rVersions.nHorJustifyVersion)
- READ( i, pVerJustify, SvxVerJustifyItem, rVersions.nVerJustifyVersion)
- READ( i, pOrientation, SvxOrientationItem, rVersions.nOrientationVersion)
- READ( i, pMargin, SvxMarginItem, rVersions.nMarginVersion)
-
- pNew = pLinebreak[i]->Create(rStream, rVersions.nBoolVersion );
- pLinebreak[i]->SetValue( ((SfxBoolItem*)pNew)->GetValue() );
- delete pNew;
-
- if ( nVal >= AUTOFORMAT_DATA_ID_504 )
- {
- pNew = pRotateAngle[i]->Create( rStream, rVersions.nInt32Version );
- pRotateAngle[i]->SetValue( ((SfxInt32Item*)pNew)->GetValue() );
- delete pNew;
- pNew = pRotateMode[i]->Create( rStream, rVersions.nRotateModeVersion );
- pRotateMode[i]->SetValue( ((SvxRotateModeItem*)pNew)->GetValue() );
- delete pNew;
- }
-
- if( 0 == rVersions.nNumFmtVersion )
- pNumFormat[i]->Load( rStream );
-
- // CharSet in Font anpassen
- if ( eSrcSet != eSysSet && pFont[i]->GetCharSet() == eSrcSet )
- pFont[i]->GetCharSet() = eSysSet;
-
- bRet = 0 == rStream.GetError();
- }
+ bRet = aDataField[ i ].Load( rStream, rVersions, nVer );
}
else
bRet = FALSE;
@@ -1001,8 +750,7 @@ BOOL ScAutoFormatData::Load(SvStream& rStream, const ScAfVersions& rVersions)
}
#ifdef READ_OLDVERS
-
-BOOL ScAutoFormatData::LoadOld(SvStream& rStream, const ScAfVersions& rVersions)
+BOOL ScAutoFormatData::LoadOld( SvStream& rStream, const ScAfVersions& rVersions )
{
BOOL bRet = TRUE;
USHORT nVal = 0;
@@ -1020,38 +768,13 @@ BOOL ScAutoFormatData::LoadOld(SvStream& rStream, const ScAfVersions& rVersions)
rStream >> b; bIncludeWidthHeight = b;
bRet = 0 == rStream.GetError();
- SfxPoolItem* pNew;
for (USHORT i=0; bRet && i < 16; i++)
- {
- pNumFormat[i]->Load(rStream);
-
- READ( i, pFont, SvxFontItem , rVersions.nFontVersion)
- READ( i, pFontHeight, SvxFontHeightItem , rVersions.nFontHeightVersion)
- READ( i, pFontWeight, SvxWeightItem , rVersions.nWeightVersion)
- READ( i, pFontPosture, SvxPostureItem , rVersions.nPostureVersion)
- READ( i, pFontUnderline, SvxUnderlineItem , rVersions.nUnderlineVersion)
- READ( i, pFontCrossedOut, SvxCrossedOutItem , rVersions.nCrossedOutVersion)
- READ( i, pFontContour, SvxContourItem , rVersions.nContourVersion)
- READ( i, pFontShadowed, SvxShadowedItem , rVersions.nShadowedVersion)
- READ( i, pFontColor, SvxColorItem , rVersions.nColorVersion)
- READ( i, pHorJustify, SvxHorJustifyItem, rVersions.nHorJustifyVersion)
- READ( i, pVerJustify, SvxVerJustifyItem, rVersions.nVerJustifyVersion)
- READ( i, pOrientation, SvxOrientationItem, rVersions.nOrientationVersion)
- pNew = pLinebreak[i]->Create(rStream, rVersions.nBoolVersion );
- pLinebreak[i]->SetValue( ((SfxBoolItem*)pNew)->GetValue() );
- delete pNew;
- READ( i, pMargin, SvxMarginItem, rVersions.nMarginVersion)
- READ( i, pBox, SvxBoxItem , rVersions.nBoxVersion)
- READ( i, pBackground, SvxBrushItem , rVersions.nBrushVersion)
-
- bRet = (rStream.GetError() == 0);
- }
+ bRet = aDataField[ i ].LoadOld( rStream, rVersions );
}
else
bRet = FALSE;
return bRet;
}
-
#endif
BOOL ScAutoFormatData::Save(SvStream& rStream)
@@ -1093,46 +816,11 @@ BOOL ScAutoFormatData::Save(SvStream& rStream)
rStream << ( b = bIncludeBackground );
rStream << ( b = bIncludeValueFormat );
rStream << ( b = bIncludeWidthHeight );
+
BOOL bRet = 0 == rStream.GetError();
for (USHORT i = 0; bRet && (i < 16); i++)
- {
- pFont[i]->Store(rStream, pFont[i]->GetVersion(SOFFICE_FILEFORMAT_40));
- pFontHeight[i]->Store(rStream, pFontHeight[i]->GetVersion(SOFFICE_FILEFORMAT_40));
- pFontWeight[i]->Store(rStream, pFontWeight[i]->GetVersion(SOFFICE_FILEFORMAT_40));
- pFontPosture[i]->Store(rStream, pFontPosture[i]->GetVersion(SOFFICE_FILEFORMAT_40));
- // --- from 641 on: CJK and CTL font settings
- pCJKFont[i]->Store(rStream, pCJKFont[i]->GetVersion(SOFFICE_FILEFORMAT_40));
- pCJKFontHeight[i]->Store(rStream, pCJKFontHeight[i]->GetVersion(SOFFICE_FILEFORMAT_40));
- pCJKFontWeight[i]->Store(rStream, pCJKFontWeight[i]->GetVersion(SOFFICE_FILEFORMAT_40));
- pCJKFontPosture[i]->Store(rStream, pCJKFontPosture[i]->GetVersion(SOFFICE_FILEFORMAT_40));
- pCTLFont[i]->Store(rStream, pCTLFont[i]->GetVersion(SOFFICE_FILEFORMAT_40));
- pCTLFontHeight[i]->Store(rStream, pCTLFontHeight[i]->GetVersion(SOFFICE_FILEFORMAT_40));
- pCTLFontWeight[i]->Store(rStream, pCTLFontWeight[i]->GetVersion(SOFFICE_FILEFORMAT_40));
- pCTLFontPosture[i]->Store(rStream, pCTLFontPosture[i]->GetVersion(SOFFICE_FILEFORMAT_40));
- // ---
-
- pFontUnderline[i]->Store(rStream, pFontUnderline[i]->GetVersion(SOFFICE_FILEFORMAT_40));
- pFontCrossedOut[i]->Store(rStream, pFontCrossedOut[i]->GetVersion(SOFFICE_FILEFORMAT_40));
- pFontContour[i]->Store(rStream, pFontContour[i]->GetVersion(SOFFICE_FILEFORMAT_40));
- pFontShadowed[i]->Store(rStream, pFontShadowed[i]->GetVersion(SOFFICE_FILEFORMAT_40));
- pFontColor[i]->Store(rStream, pFontColor[i]->GetVersion(SOFFICE_FILEFORMAT_40));
- pBox[i]->Store(rStream, pBox[i]->GetVersion(SOFFICE_FILEFORMAT_40));
- pBackground[i]->Store(rStream, pBackground[i]->GetVersion(SOFFICE_FILEFORMAT_40));
-
- pAdjust[i]->Store(rStream, pAdjust[i]->GetVersion(SOFFICE_FILEFORMAT_40));
-
- pHorJustify[i]->Store(rStream, pHorJustify[i]->GetVersion(SOFFICE_FILEFORMAT_40));
- pVerJustify[i]->Store(rStream, pVerJustify[i]->GetVersion(SOFFICE_FILEFORMAT_40));
- pOrientation[i]->Store(rStream, pOrientation[i]->GetVersion(SOFFICE_FILEFORMAT_40));
- pMargin[i]->Store(rStream, pMargin[i]->GetVersion(SOFFICE_FILEFORMAT_40));
- pLinebreak[i]->Store(rStream, pLinebreak[i]->GetVersion(SOFFICE_FILEFORMAT_40));
- // Rotation ab SO5
- pRotateAngle[i]->Store(rStream, pRotateAngle[i]->GetVersion(SOFFICE_FILEFORMAT_40));
- pRotateMode[i]->Store(rStream, pRotateMode[i]->GetVersion(SOFFICE_FILEFORMAT_40));
-
- pNumFormat[i]->Save(rStream);
- bRet = (rStream.GetError() == 0);
- }
+ bRet = aDataField[ i ].Save( rStream );
+
return bRet;
}
@@ -1143,12 +831,12 @@ ScAutoFormat::ScAutoFormat(USHORT nLim, USHORT nDel, BOOL bDup):
SortedCollection (nLim, nDel, bDup),
bSaveLater (FALSE)
{
- // Default "Standard" Format anlegen
- ScAutoFormatData* pData = new ScAutoFormatData();
+ // create default autoformat
+ ScAutoFormatData* pData = new ScAutoFormatData;
String aName(ScGlobal::GetRscString(STR_STYLENAME_STANDARD));
pData->SetName(aName);
- // Default-Font und Groesse
+ // default font, default height
Font aStdFont = OutputDevice::GetDefaultFont(
DEFAULTFONT_LATIN_SPREADSHEET, LANGUAGE_ENGLISH_US, DEFAULTFONT_FLAGS_ONLYONE );
SvxFontItem aFontItem(
@@ -1159,17 +847,17 @@ ScAutoFormat::ScAutoFormat(USHORT nLim, USHORT nDel, BOOL bDup):
DEFAULTFONT_CJK_SPREADSHEET, LANGUAGE_ENGLISH_US, DEFAULTFONT_FLAGS_ONLYONE );
SvxFontItem aCJKFontItem(
aStdFont.GetFamily(), aStdFont.GetName(), aStdFont.GetStyleName(),
- aStdFont.GetPitch(), aStdFont.GetCharSet() );
+ aStdFont.GetPitch(), aStdFont.GetCharSet(), ATTR_CJK_FONT );
aStdFont = OutputDevice::GetDefaultFont(
DEFAULTFONT_CTL_SPREADSHEET, LANGUAGE_ENGLISH_US, DEFAULTFONT_FLAGS_ONLYONE );
SvxFontItem aCTLFontItem(
aStdFont.GetFamily(), aStdFont.GetName(), aStdFont.GetStyleName(),
- aStdFont.GetPitch(), aStdFont.GetCharSet() );
+ aStdFont.GetPitch(), aStdFont.GetCharSet(), ATTR_CTL_FONT );
SvxFontHeightItem aHeight( 200 ); // 10 pt;
- // schwarze duenne Umrandung
+ // black thin border
Color aBlack( COL_BLACK );
SvxBorderLine aLine( &aBlack, DEF_LINE_WIDTH_0 );
SvxBoxItem aBox;
@@ -1189,32 +877,35 @@ ScAutoFormat::ScAutoFormat(USHORT nLim, USHORT nDel, BOOL bDup):
for (USHORT i=0; i<16; i++)
{
- pData->SetBox( i, aBox );
- pData->SetFont( i, aFontItem );
- pData->SetCJKFont( i, aCJKFontItem );
- pData->SetCTLFont( i, aCTLFontItem );
- pData->SetFontHeight( i, aHeight );
- pData->SetCJKFontHeight( i, aHeight );
- pData->SetCTLFontHeight( i, aHeight );
- if (i<4) // oben: weiss auf blau
+ pData->PutItem( i, aBox );
+ pData->PutItem( i, aFontItem );
+ pData->PutItem( i, aCJKFontItem );
+ pData->PutItem( i, aCTLFontItem );
+ aHeight.SetWhich( ATTR_FONT_HEIGHT );
+ pData->PutItem( i, aHeight );
+ aHeight.SetWhich( ATTR_CJK_FONT_HEIGHT );
+ pData->PutItem( i, aHeight );
+ aHeight.SetWhich( ATTR_CTL_FONT_HEIGHT );
+ pData->PutItem( i, aHeight );
+ if (i<4) // top: white on blue
{
- pData->SetFontColor( i, aWhiteText );
- pData->SetBackground( i, aBlueBack );
+ pData->PutItem( i, aWhiteText );
+ pData->PutItem( i, aBlueBack );
}
- else if ( i%4 == 0 ) // links: weiss auf grau70
+ else if ( i%4 == 0 ) // left: white on gray70
{
- pData->SetFontColor( i, aWhiteText );
- pData->SetBackground( i, aGray70Back );
+ pData->PutItem( i, aWhiteText );
+ pData->PutItem( i, aGray70Back );
}
- else if ( i%4 == 3 || i >= 12 ) // rechts & unten: schwarz auf grau20
+ else if ( i%4 == 3 || i >= 12 ) // right and bottom: black on gray20
{
- pData->SetFontColor( i, aBlackText );
- pData->SetBackground( i, aGray20Back );
+ pData->PutItem( i, aBlackText );
+ pData->PutItem( i, aGray20Back );
}
- else // Mitte: schwarz auf weiss
+ else // center: black on white
{
- pData->SetFontColor( i, aBlackText );
- pData->SetBackground( i, aWhiteBack );
+ pData->PutItem( i, aBlackText );
+ pData->PutItem( i, aWhiteBack );
}
}
diff --git a/sc/source/ui/inc/autofmt.hxx b/sc/source/ui/inc/autofmt.hxx
index 31c8d95d33f7..caf654339947 100644
--- a/sc/source/ui/inc/autofmt.hxx
+++ b/sc/source/ui/inc/autofmt.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: autofmt.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: dr $ $Date: 2001-05-25 16:16:47 $
+ * last change: $Author: dr $ $Date: 2001-11-19 13:31:19 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -80,6 +80,9 @@
#ifndef _DIALOG_HXX //autogen
#include <vcl/dialog.hxx>
#endif
+#ifndef _SVTOOLS_SCRIPTEDTEXT_HXX
+#include <svtools/scriptedtext.hxx>
+#endif
//------------------------------------------------------------------------
@@ -102,7 +105,8 @@ class ScAutoFormatDlg : public ModalDialog
public:
ScAutoFormatDlg( Window* pParent,
ScAutoFormat* pAutoFormat,
- const ScAutoFormatData* pSelFormatData );
+ const ScAutoFormatData* pSelFormatData,
+ ScDocument* pDoc );
~ScAutoFormatDlg();
USHORT GetIndex() const { return nIndex; }
@@ -158,7 +162,7 @@ private:
class AutoFmtPreview : public Window
{
public:
- AutoFmtPreview( Window* pParent, const ResId& rRes );
+ AutoFmtPreview( Window* pParent, const ResId& rRes, ScDocument* pDoc );
~AutoFmtPreview();
void NotifyChange( ScAutoFormatData* pNewData );
@@ -167,25 +171,27 @@ protected:
virtual void Paint( const Rectangle& rRect );
private:
- ScAutoFormatData* pCurData;
- VirtualDevice aVD;
- BOOL bFitWidth;
- static USHORT aFmtMap[25]; // Zuordnung: Zelle->Format
- Rectangle aCellArray[25]; // Position und Groesse der Zellen
- SvxBoxItem* aLinePtrArray[49]; // LinienAttribute
- Size aPrvSize;
- const USHORT nLabelColWidth;
- const USHORT nDataColWidth1;
- const USHORT nDataColWidth2;
- const USHORT nRowHeight;
- const String aStrJan;
- const String aStrFeb;
- const String aStrMar;
- const String aStrNorth;
- const String aStrMid;
- const String aStrSouth;
- const String aStrSum;
- SvNumberFormatter* pNumFmt;
+ ScAutoFormatData* pCurData;
+ VirtualDevice aVD;
+ SvtScriptedTextHelper aScriptedText;
+ ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator > xBreakIter;
+ BOOL bFitWidth;
+ static USHORT aFmtMap[25]; // Zuordnung: Zelle->Format
+ Rectangle aCellArray[25]; // Position und Groesse der Zellen
+ SvxBoxItem* aLinePtrArray[49]; // LinienAttribute
+ Size aPrvSize;
+ const USHORT nLabelColWidth;
+ const USHORT nDataColWidth1;
+ const USHORT nDataColWidth2;
+ const USHORT nRowHeight;
+ const String aStrJan;
+ const String aStrFeb;
+ const String aStrMar;
+ const String aStrNorth;
+ const String aStrMid;
+ const String aStrSouth;
+ const String aStrSum;
+ SvNumberFormatter* pNumFmt;
//-------------------------------------------
void Init ();
void DoPaint ( const Rectangle& rRect );
@@ -195,7 +201,10 @@ private:
void DrawBackground ( USHORT nIndex );
void DrawFrame ( USHORT nIndex );
void DrawString ( USHORT nIndex );
- void MakeFont ( USHORT nIndex, Font& rFont );
+ void MakeFonts ( USHORT nIndex,
+ Font& rFont,
+ Font& rCJKFont,
+ Font& rCTLFont );
String MakeNumberString( String cellString, BOOL bAddDec );
void DrawFrameLine ( const SvxBorderLine& rLineD,
Point from,
diff --git a/sc/source/ui/miscdlgs/autofmt.cxx b/sc/source/ui/miscdlgs/autofmt.cxx
index 6768b7b3c780..745e3bc82fd3 100644
--- a/sc/source/ui/miscdlgs/autofmt.cxx
+++ b/sc/source/ui/miscdlgs/autofmt.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: autofmt.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: dr $ $Date: 2001-05-25 16:16:13 $
+ * last change: $Author: dr $ $Date: 2001-11-19 13:32:14 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -95,6 +95,7 @@
#include "miscdlgs.hrc"
#include "autofmt.hxx"
#include "scresid.hxx"
+#include "document.hxx"
#define FRAME_OFFSET 4
@@ -112,13 +113,14 @@ BOOL bIsOlk = FALSE;
ScAutoFormatDlg::ScAutoFormatDlg( Window* pParent,
ScAutoFormat* pAutoFormat,
- const ScAutoFormatData* pSelFormatData ) :
+ const ScAutoFormatData* pSelFormatData,
+ ScDocument* pDoc ) :
ModalDialog ( pParent, ScResId( RID_SCDLG_AUTOFORMAT ) ),
//
aLbFormat ( this, ScResId( LB_FORMAT ) ),
aFlFormat ( this, ScResId( FL_FORMAT ) ),
- pWndPreview ( new AutoFmtPreview( this, ScResId( WND_PREVIEW ) ) ),
+ pWndPreview ( new AutoFmtPreview( this, ScResId( WND_PREVIEW ), pDoc ) ),
aBtnNumFormat ( this, ScResId( BTN_NUMFORMAT ) ),
aBtnBorder ( this, ScResId( BTN_BORDER ) ),
aBtnFont ( this, ScResId( BTN_FONT ) ),
@@ -133,12 +135,12 @@ ScAutoFormatDlg::ScAutoFormatDlg( Window* pParent,
aBtnRemove ( this, ScResId( BTN_REMOVE ) ),
aBtnMore ( this, ScResId( BTN_MORE ) ),
aBtnRename ( this, ScResId( BTN_RENAME ) ),
- aStrTitle ( String( ScResId( STR_ADD_TITLE ) ) ),
- aStrLabel ( String( ScResId( STR_ADD_LABEL ) ) ),
- aStrRename ( String( ScResId( STR_RENAME_TITLE) ) ),
- aStrClose ( String( ScResId( STR_BTN_CLOSE ) ) ),
- aStrDelTitle ( String( ScResId( STR_DEL_TITLE ) ) ),
- aStrDelMsg ( String( ScResId( STR_DEL_MSG ) ) ),
+ aStrTitle ( ScResId( STR_ADD_TITLE ) ),
+ aStrLabel ( ScResId( STR_ADD_LABEL ) ),
+ aStrRename ( ScResId( STR_RENAME_TITLE ) ),
+ aStrClose ( ScResId( STR_BTN_CLOSE ) ),
+ aStrDelTitle ( ScResId( STR_DEL_TITLE ) ),
+ aStrDelMsg ( ScResId( STR_DEL_MSG ) ) ,
//
nIndex ( 0 ),
bFmtInserted ( FALSE ),
@@ -519,18 +521,20 @@ String __EXPORT ScAutoFormatDlg::GetCurrFormatName()
//========================================================================
// AutoFmtPreview
-AutoFmtPreview::AutoFmtPreview( Window* pParent, const ResId& rRes ) :
+AutoFmtPreview::AutoFmtPreview( Window* pParent, const ResId& rRes, ScDocument* pDoc ) :
Window ( pParent, rRes ),
aVD ( *this ),
+ aScriptedText ( aVD ),
+ xBreakIter ( pDoc->GetBreakIterator() ),
pCurData ( NULL ),
bFitWidth ( FALSE ),
- aStrJan ( String( ScResId( STR_JAN ) ) ),
- aStrFeb ( String( ScResId( STR_FEB ) ) ),
- aStrMar ( String( ScResId( STR_MAR ) ) ),
- aStrNorth ( String( ScResId( STR_NORTH ) ) ),
- aStrMid ( String( ScResId( STR_MID ) ) ),
- aStrSouth ( String( ScResId( STR_SOUTH ) ) ),
- aStrSum ( String( ScResId( STR_SUM ) ) ),
+ aStrJan ( ScResId( STR_JAN ) ),
+ aStrFeb ( ScResId( STR_FEB ) ),
+ aStrMar ( ScResId( STR_MAR ) ),
+ aStrNorth ( ScResId( STR_NORTH ) ),
+ aStrMid ( ScResId( STR_MID ) ),
+ aStrSouth ( ScResId( STR_SOUTH ) ),
+ aStrSum ( ScResId( STR_SUM ) ),
aPrvSize ( GetSizePixel().Width() - 6,
GetSizePixel().Height() - 30 ),
nLabelColWidth ( (USHORT)(((aPrvSize.Width()-4)/4)-12) ),
@@ -970,47 +974,59 @@ void AutoFmtPreview::DrawFrame( USHORT nIndex )
//------------------------------------------------------------------------
-void AutoFmtPreview::MakeFont( USHORT nIndex, Font& rFont )
+void lcl_SetFontProperties(
+ Font& rFont,
+ const SvxFontItem& rFontItem,
+ const SvxWeightItem& rWeightItem,
+ const SvxPostureItem& rPostureItem )
+{
+ rFont.SetFamily ( rFontItem.GetFamily() );
+ rFont.SetName ( rFontItem.GetFamilyName() );
+ rFont.SetStyleName ( rFontItem.GetStyleName() );
+ rFont.SetCharSet ( rFontItem.GetCharSet() );
+ rFont.SetPitch ( rFontItem.GetPitch() );
+ rFont.SetWeight ( (FontWeight)rWeightItem.GetValue() );
+ rFont.SetItalic ( (FontItalic)rPostureItem.GetValue() );
+}
+
+#define SETONALLFONTS( MethodName, Value ) \
+rFont.MethodName( Value ); \
+rCJKFont.MethodName( Value ); \
+rCTLFont.MethodName( Value );
+
+void AutoFmtPreview::MakeFonts( USHORT nIndex, Font& rFont, Font& rCJKFont, Font& rCTLFont )
{
if ( pCurData )
{
- Size aSize;
- SvxFontItem aFontItem;
- SvxWeightItem aFontWeightItem;
- SvxPostureItem aFontPostureItem;
- SvxUnderlineItem aFontUnderlineItem;
- SvxCrossedOutItem aFontCrossedOutItem;
- SvxContourItem aFontContourItem;
- SvxShadowedItem aFontShadowedItem;
- SvxColorItem aFontColorItem;
-
- rFont = GetFont();
- aSize = rFont.GetSize();
- aSize.Height() = 10;
-
- pCurData->GetFont ( nIndex, aFontItem );
- pCurData->GetFontWeight ( nIndex, aFontWeightItem );
- pCurData->GetFontPosture ( nIndex, aFontPostureItem );
- pCurData->GetFontUnderline ( nIndex, aFontUnderlineItem );
- pCurData->GetFontCrossedOut ( nIndex, aFontCrossedOutItem );
- pCurData->GetFontContour ( nIndex, aFontContourItem );
- pCurData->GetFontShadowed ( nIndex, aFontShadowedItem );
- pCurData->GetFontColor ( nIndex, aFontColorItem );
-
- rFont.SetFamily ( aFontItem.GetFamily() );
- rFont.SetName ( aFontItem.GetFamilyName() );
- rFont.SetStyleName ( aFontItem.GetStyleName() );
- rFont.SetCharSet ( aFontItem.GetCharSet() );
- rFont.SetPitch ( aFontItem.GetPitch() );
- rFont.SetWeight ( (FontWeight)aFontWeightItem.GetValue() );
- rFont.SetUnderline ( (FontUnderline)aFontUnderlineItem.GetValue() );
- rFont.SetStrikeout ( (FontStrikeout)aFontCrossedOutItem.GetValue() );
- rFont.SetItalic ( (FontItalic)aFontPostureItem.GetValue() );
- rFont.SetOutline ( aFontContourItem.GetValue() );
- rFont.SetShadow ( aFontShadowedItem.GetValue() );
- rFont.SetColor ( aFontColorItem.GetValue() );
- rFont.SetSize ( aSize );
- rFont.SetTransparent (TRUE);
+ rFont = rCJKFont = rCTLFont = GetFont();
+ Size aFontSize( rFont.GetSize().Width(), 10 );
+
+ const SvxFontItem* pFontItem = (const SvxFontItem*) pCurData->GetItem( nIndex, ATTR_FONT );
+ const SvxWeightItem* pWeightItem = (const SvxWeightItem*) pCurData->GetItem( nIndex, ATTR_FONT_WEIGHT );
+ const SvxPostureItem* pPostureItem = (const SvxPostureItem*) pCurData->GetItem( nIndex, ATTR_FONT_POSTURE );
+ const SvxFontItem* pCJKFontItem = (const SvxFontItem*) pCurData->GetItem( nIndex, ATTR_CJK_FONT );
+ const SvxWeightItem* pCJKWeightItem = (const SvxWeightItem*) pCurData->GetItem( nIndex, ATTR_CJK_FONT_WEIGHT );
+ const SvxPostureItem* pCJKPostureItem = (const SvxPostureItem*) pCurData->GetItem( nIndex, ATTR_CJK_FONT_POSTURE );
+ const SvxFontItem* pCTLFontItem = (const SvxFontItem*) pCurData->GetItem( nIndex, ATTR_CTL_FONT );
+ const SvxWeightItem* pCTLWeightItem = (const SvxWeightItem*) pCurData->GetItem( nIndex, ATTR_CTL_FONT_WEIGHT );
+ const SvxPostureItem* pCTLPostureItem = (const SvxPostureItem*) pCurData->GetItem( nIndex, ATTR_CTL_FONT_POSTURE );
+ const SvxUnderlineItem* pUnderlineItem = (const SvxUnderlineItem*) pCurData->GetItem( nIndex, ATTR_FONT_UNDERLINE );
+ const SvxCrossedOutItem* pCrossedOutItem = (const SvxCrossedOutItem*)pCurData->GetItem( nIndex, ATTR_FONT_CROSSEDOUT );
+ const SvxContourItem* pContourItem = (const SvxContourItem*) pCurData->GetItem( nIndex, ATTR_FONT_CONTOUR );
+ const SvxShadowedItem* pShadowedItem = (const SvxShadowedItem*) pCurData->GetItem( nIndex, ATTR_FONT_SHADOWED );
+ const SvxColorItem* pColorItem = (const SvxColorItem*) pCurData->GetItem( nIndex, ATTR_FONT_COLOR );
+
+ lcl_SetFontProperties( rFont, *pFontItem, *pWeightItem, *pPostureItem );
+ lcl_SetFontProperties( rCJKFont, *pCJKFontItem, *pCJKWeightItem, *pCJKPostureItem );
+ lcl_SetFontProperties( rCTLFont, *pCTLFontItem, *pCTLWeightItem, *pCTLPostureItem );
+
+ SETONALLFONTS( SetUnderline, (FontUnderline)pUnderlineItem->GetValue() );
+ SETONALLFONTS( SetStrikeout, (FontStrikeout)pCrossedOutItem->GetValue() );
+ SETONALLFONTS( SetOutline, pContourItem->GetValue() );
+ SETONALLFONTS( SetShadow, pShadowedItem->GetValue() );
+ SETONALLFONTS( SetColor, pColorItem->GetValue() );
+ SETONALLFONTS( SetSize, aFontSize );
+ SETONALLFONTS( SetTransparent, TRUE );
}
}
@@ -1067,9 +1083,8 @@ void AutoFmtPreview::DrawString( USHORT nIndex )
mknum:
if( bNumFormat )
{
- ScNumFormatAbbrev aFmt;
- pCurData->GetNumFormat( (USHORT) nNum, aFmt );
- nNum = aFmt.GetFormatIndex( *pNumFmt );
+ ScNumFormatAbbrev& rNumFormat = (ScNumFormatAbbrev&)pCurData->GetNumFormat( (USHORT) nNum );
+ nNum = rNumFormat.GetFormatIndex( *pNumFmt );
}
else
nNum = 0;
@@ -1079,7 +1094,6 @@ void AutoFmtPreview::DrawString( USHORT nIndex )
if ( cellString.Len() > 0 )
{
- Font oldFont;
Size aStrSize;
USHORT nFmtIndex = aFmtMap[nIndex];
Rectangle cellRect = aCellArray[nIndex];
@@ -1092,38 +1106,32 @@ void AutoFmtPreview::DrawString( USHORT nIndex )
//-------------
// Ausrichtung:
//-------------
- if ( bJustify )
- {
- pCurData->GetHorJustify( nFmtIndex, aHorJustifyItem );
- eJustification = (SvxCellHorJustify)aHorJustifyItem.GetValue();
- }
- else
- {
- eJustification = SVX_HOR_JUSTIFY_STANDARD;
- }
+ eJustification = bJustify ?
+ (SvxCellHorJustify)(((const SvxHorJustifyItem*)pCurData->GetItem( nFmtIndex, ATTR_HOR_JUSTIFY ))->GetValue()) :
+ SVX_HOR_JUSTIFY_STANDARD;
if ( pCurData->GetIncludeFont() )
{
- Font aFont;
+ Font aFont, aCJKFont, aCTLFont;
Size theMaxStrSize;
- MakeFont( nFmtIndex, aFont );
- oldFont = aVD.GetFont();
- aVD.SetFont( aFont );
+ MakeFonts( nFmtIndex, aFont, aCJKFont, aCTLFont );
+
theMaxStrSize = cellRect.GetSize();
theMaxStrSize.Width() -= FRAME_OFFSET;
theMaxStrSize.Height() -= FRAME_OFFSET;
- aStrSize.Width() = aVD.GetTextWidth( cellString );
- aStrSize.Height() = aVD.GetTextHeight();
+
+ aScriptedText.SetFonts( &aFont, &aCJKFont, &aCTLFont );
+ aScriptedText.SetText( cellString, xBreakIter );
+ aStrSize = aScriptedText.GetTextSize();
if ( theMaxStrSize.Height() < aStrSize.Height() )
{
// wenn der String in diesem Font nicht
// in die Zelle passt, wird wieder der
// Standard-Font genommen:
- aVD.SetFont( oldFont );
- aStrSize.Width() = aVD.GetTextWidth( cellString );
- aStrSize.Height() = aVD.GetTextHeight();
+ aScriptedText.SetDefaultFont();
+ aStrSize = aScriptedText.GetTextSize();
}
while ( ( theMaxStrSize.Width() <= aStrSize.Width() )
&& ( cellString.Len() > 1 ) )
@@ -1132,14 +1140,16 @@ void AutoFmtPreview::DrawString( USHORT nIndex )
cellString.Erase( 0, 1 );
else
cellString.Erase( cellString.Len() - 1 );
- aStrSize.Width() = aVD.GetTextWidth( cellString );
- aStrSize.Height() = aVD.GetTextHeight();
+
+ aScriptedText.SetText( cellString, xBreakIter );
+ aStrSize = aScriptedText.GetTextSize();
}
}
else
{
- aStrSize.Width() = aVD.GetTextWidth( cellString );
- aStrSize.Height() = aVD.GetTextHeight();
+ aScriptedText.SetDefaultFont();
+ aScriptedText.SetText( cellString, xBreakIter );
+ aStrSize = aScriptedText.GetTextSize();
}
nRightX = (USHORT)( cellRect.GetWidth()
@@ -1196,11 +1206,8 @@ void AutoFmtPreview::DrawString( USHORT nIndex )
}
//-------------------------------
- aVD.DrawText( aPos, cellString );
+ aScriptedText.DrawText( aPos );
//-------------------------------
-
- if ( pCurData->GetIncludeFont() )
- aVD.SetFont( oldFont );
}
}
}
@@ -1216,15 +1223,12 @@ void AutoFmtPreview::DrawBackground( USHORT nIndex )
USHORT nFmtIndex = aFmtMap[nIndex];
Rectangle cellRect = aCellArray[nIndex];
- SvxBrushItem aBrushItem;
- pCurData->GetBackground( nFmtIndex, aBrushItem );
-
BOOL bHadLine = aVD.IsLineColor();
Color aOldLine = aVD.GetLineColor();
BOOL bHadFill = aVD.IsFillColor();
Color aOldFill = aVD.GetFillColor();
- aVD.SetFillColor( aBrushItem.GetColor() );
+ aVD.SetFillColor( ((const SvxBrushItem*)pCurData->GetItem( nFmtIndex, ATTR_BACKGROUND ))->GetColor() );
aVD.SetLineColor();
//-----------------------
aVD.DrawRect( cellRect );
@@ -1378,8 +1382,7 @@ void AutoFmtPreview::CalcLineMap()
for ( nCell=nFirst; nCell<=nLast; nCell++ )
{
nLine = nCell + 8 + ((nCell/5)*2);
- pCurData->GetBox( aFmtMap[nCell], aFrameItem );
- *(aLinePtrArray[nLine]) = aFrameItem;
+ *(aLinePtrArray[nLine]) = *(const SvxBoxItem*)pCurData->GetItem( aFmtMap[nCell], ATTR_BORDER );
}
}
}
diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx
index 380d5bee2edd..9bf9a696c41a 100644
--- a/sc/source/ui/view/cellsh3.cxx
+++ b/sc/source/ui/view/cellsh3.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: cellsh3.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: nn $ $Date: 2001-05-21 11:03:22 $
+ * last change: $Author: dr $ $Date: 2001-11-19 13:32:53 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -776,7 +776,8 @@ void ScCellShell::Execute( SfxRequest& rReq )
ScAutoFormatDlg* pDlg = new ScAutoFormatDlg(
pDlgParent,
ScGlobal::GetAutoFormat(),
- pNewEntry );
+ pNewEntry,
+ GetViewData()->GetDocument() );
if ( pDlg->Execute() == RET_OK )
{