#94539# Support CJK/CTL in table autoformat dialogs

This commit is contained in:
Daniel Rentz 2001-11-19 12:32:53 +00:00
parent fbf40abe31
commit fad29de756
9 changed files with 835 additions and 1254 deletions

View file

@ -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
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;
#ifndef _ZFORAUTO_HXX_
#include "zforauto.hxx"
#endif
class ScNumFormatAbbrev;
struct ScAfVersions;
/// Contains all items for one cell of a table autoformat.
class ScAutoFormatDataField
{
private:
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 aAdjust;
// Calc specific
SvxHorJustifyItem aHorJustify;
SvxVerJustifyItem aVerJustify;
SvxOrientationItem aOrientation;
SvxMarginItem aMargin;
SfxBoolItem aLinebreak;
// from SO5, 504k on, rotated text
SfxInt32Item aRotateAngle;
SvxRotateModeItem aRotateMode;
// number format
ScNumFormatAbbrev aNumFormat;
public:
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 );
#ifdef READ_OLDVERS
BOOL LoadOld( SvStream& rStream, const ScAfVersions& rVersions );
#endif
};
class ScAutoFormatData : public DataObject
{
private:
String aName;
USHORT nStrResId;
String aName;
USHORT nStrResId;
// common flags of Calc and Writer
BOOL bIncludeFont : 1;
BOOL bIncludeJustify : 1;
BOOL bIncludeFrame : 1;
BOOL bIncludeBackground : 1;
BOOL bIncludeFont : 1;
BOOL bIncludeJustify : 1;
BOOL bIncludeFrame : 1;
BOOL bIncludeBackground : 1;
// Calc specific flags
BOOL bIncludeValueFormat : 1;
BOOL bIncludeWidthHeight : 1;
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];
ScAutoFormatDataField aDataField[ 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];
// Writer specific
SvxAdjustItem* pAdjust[16];
// Calc specific
SvxHorJustifyItem* pHorJustify[16];
SvxVerJustifyItem* pVerJustify[16];
SvxOrientationItem* pOrientation[16];
SvxMarginItem* pMargin[16];
SfxBoolItem* pLinebreak[16];
// from SO5, 504k on, rotated text
SfxInt32Item* pRotateAngle[16];
SvxRotateModeItem* pRotateMode[16];
// number format
ScNumFormatAbbrev* pNumFormat[16];
ScAutoFormatDataField& GetField( USHORT nIndex );
const ScAutoFormatDataField& GetField( USHORT nIndex ) const;
public:
ScAutoFormatData();
ScAutoFormatData( const ScAutoFormatData& rData );
virtual ~ScAutoFormatData();
ScAutoFormatData();
ScAutoFormatData( const ScAutoFormatData& rData );
virtual ~ScAutoFormatData();
virtual DataObject* Clone() const { return new ScAutoFormatData(*this); }
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; }
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 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; }
BOOL GetIncludeFont() const { return bIncludeFont; }
void SetIncludeFont(const BOOL bFont) { bIncludeFont = bFont; }
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; }
BOOL GetIncludeJustify() const { return bIncludeJustify; }
void SetIncludeJustify(const BOOL bJustify) { bIncludeJustify = bJustify; }
const SfxPoolItem* GetItem( USHORT nIndex, USHORT nWhich ) const;
void PutItem( USHORT nIndex, const SfxPoolItem& rItem );
void CopyItem( USHORT nToIndex, USHORT nFromIndex, USHORT nWhich );
BOOL GetIncludeFrame() const { return bIncludeFrame; }
void SetIncludeFrame(const BOOL bFrame) { bIncludeFrame = bFrame; }
const ScNumFormatAbbrev& GetNumFormat( USHORT nIndex ) const;
void SetNumFormat( USHORT nIndex, const ScNumFormatAbbrev& rNumFormat );
BOOL GetIncludeBackground() const { return bIncludeBackground; }
void SetIncludeBackground(const BOOL bBackground) { bIncludeBackground = bBackground; }
BOOL IsEqualData( USHORT nIndex1, USHORT nIndex2 ) const;
BOOL GetIncludeWidthHeight() const { return bIncludeWidthHeight; }
void SetIncludeWidthHeight(const BOOL bWidthHeight) { bIncludeWidthHeight = bWidthHeight; }
void FillToItemSet( USHORT nIndex, SfxItemSet& rItemSet, ScDocument& rDoc ) const;
void GetFromItemSet( USHORT nIndex, const SfxItemSet& rItemSet, const ScNumFormatAbbrev& rNumFormat );
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);
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);
void GetFontColor(USHORT nIndex, SvxColorItem& rFontColor) const;
void SetFontColor(USHORT nIndex, const SvxColorItem& rFontColor);
void GetHorJustify(USHORT nIndex, SvxHorJustifyItem& rHorJustify) const;
void SetHorJustify(USHORT nIndex, const SvxHorJustifyItem& rHorJustify);
void GetVerJustify(USHORT nIndex, SvxVerJustifyItem& rVerJustify) const;
void SetVerJustify(USHORT nIndex, const SvxVerJustifyItem& rVerJustify);
void GetOrientation(USHORT nIndex, SvxOrientationItem& rOrientation) const;
void SetOrientation(USHORT nIndex, const SvxOrientationItem& rOrientation);
void GetLinebreak(USHORT nIndex, SfxBoolItem& rLinebreak) const;
void SetLinebreak(USHORT nIndex, const SfxBoolItem& rLinebreak);
void GetMargin(USHORT nIndex, SvxMarginItem& rMargin) const;
void SetMargin(USHORT nIndex, const SvxMarginItem& rMargin);
void GetBox(USHORT nIndex, SvxBoxItem& rBox) const;
void SetBox(USHORT nIndex, const SvxBoxItem& rBox);
void GetBackground(USHORT nIndex, SvxBrushItem& rBackground) const;
void SetBackground(USHORT nIndex, const SvxBrushItem& rBackground);
void GetRotateAngle( USHORT nIndex, SfxInt32Item& rRotateAngle ) const;
void SetRotateAngle( USHORT nIndex, const SfxInt32Item& rRotateAngle );
void GetRotateMode( USHORT nIndex, SvxRotateModeItem& rRotateMode ) const;
void SetRotateMode( USHORT nIndex, const SvxRotateModeItem& rRotateMode );
const SfxPoolItem* GetItem( USHORT nIndex, USHORT nWhich ) const;
void PutItem( USHORT nIndex, const SfxPoolItem& rItem );
BOOL IsEqualData(USHORT nIndex1, USHORT nIndex2);
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; }
};

View file

@ -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 );

View file

@ -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)

View file

@ -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;

View file

@ -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 );
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -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,

View file

@ -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 = rCJKFont = rCTLFont = GetFont();
Size aFontSize( rFont.GetSize().Width(), 10 );
rFont = GetFont();
aSize = rFont.GetSize();
aSize.Height() = 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 );
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 );
lcl_SetFontProperties( rFont, *pFontItem, *pWeightItem, *pPostureItem );
lcl_SetFontProperties( rCJKFont, *pCJKFontItem, *pCJKWeightItem, *pCJKPostureItem );
lcl_SetFontProperties( rCTLFont, *pCTLFontItem, *pCTLWeightItem, *pCTLPostureItem );
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);
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 );
}
}
}

View file

@ -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 )
{