blob: b478180a169a1cff1f390176e6696085094f4a41 [file] [log] [blame]
/**************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*************************************************************/
#ifndef _TBLAFMT_HXX
#define _TBLAFMT_HXX
/*************************************************************************
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
JP 20.07.95:
Die akt. Struktur der Autoformatierung darf nicht mehr veraendert werden.
Diese wird durch unterschiedlichen Code vom StartWriter und vom StarCalc
eingelesen/geschrieben.
Sollte sich doch mal eine Aenderung nicht vermeiden lassen, dann auf
jedenfall in beiden Applikationen aendern.
The structure of table auto formatting should not changed. It is used
by different code of Writer and Calc. If a change is necessary, the
source code of both applications must be changed!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
**************************************************************************/
#include <svl/svarray.hxx>
#include "hintids.hxx" //_immmer_ vor den solar-items!
#include <svx/algitem.hxx>
#include <editeng/fontitem.hxx>
#include <editeng/fhgtitem.hxx>
#include <editeng/wghtitem.hxx>
#include <editeng/postitem.hxx>
#include <editeng/udlnitem.hxx>
#include <editeng/crsditem.hxx>
#ifndef _SVX_CNTRTITEM_HXX //autogen
#include <editeng/cntritem.hxx>
#endif
#include <editeng/shdditem.hxx>
#include <editeng/colritem.hxx>
#include <editeng/boxitem.hxx>
#include <editeng/brshitem.hxx>
#include <editeng/adjitem.hxx>
#include <svx/rotmodit.hxx>
#include <svl/intitem.hxx>
#include <editeng/bolnitem.hxx>
#include "swdllapi.h"
struct SwAfVersions;
class SvNumberFormatter;
class SwBoxAutoFmt
{
// common attributes of Calc and Writer
// --- from 641 on: CJK and CTL font settings
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;
SvxOverlineItem aOverline;
SvxCrossedOutItem aCrossedOut;
SvxContourItem aContour;
SvxShadowedItem aShadowed;
SvxColorItem aColor;
SvxBoxItem aBox;
SvxLineItem aTLBR;
SvxLineItem aBLTR;
SvxBrushItem aBackground;
// Writer specific
SvxAdjustItem aAdjust;
// Calc specific
SvxHorJustifyItem aHorJustify;
SvxVerJustifyItem aVerJustify;
SfxBoolItem aStacked;
SvxMarginItem aMargin;
SfxBoolItem aLinebreak;
SfxInt32Item aRotateAngle;
SvxRotateModeItem aRotateMode;
// number format
String sNumFmtString;
LanguageType eSysLanguage, eNumFmtLanguage;
public:
SwBoxAutoFmt();
SwBoxAutoFmt( const SwBoxAutoFmt& rNew );
~SwBoxAutoFmt();
int operator==( const SwBoxAutoFmt& rCmp ) const;
SwBoxAutoFmt& operator=( const SwBoxAutoFmt& rNew );
// die Get-Methoden
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 SvxOverlineItem &GetOverline() const { return aOverline; }
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 SvxAdjustItem &GetAdjust() const { return aAdjust; }
const SvxBoxItem &GetBox() const { return aBox; }
const SvxLineItem &GetTLBR() const { return aTLBR; }
const SvxLineItem &GetBLTR() const { return aBLTR; }
const SvxBrushItem &GetBackground() const { return aBackground; }
void GetValueFormat( String& rFmt, LanguageType& rLng, LanguageType& rSys ) const
{ rFmt = sNumFmtString; rLng = eNumFmtLanguage; rSys = eSysLanguage; }
// die SetMethoden
void SetFont( const SvxFontItem& rNew ) { aFont = rNew; }
void SetHeight( const SvxFontHeightItem& rNew ) { aHeight = rNew; }
void SetWeight( const SvxWeightItem& rNew ) { aWeight = rNew; }
void SetPosture( const SvxPostureItem& rNew ) { aPosture = rNew; }
void SetCJKFont( const SvxFontItem& rNew ) { aCJKFont = rNew; }
void SetCJKHeight( const SvxFontHeightItem& rNew ) { aCJKHeight = rNew; }
void SetCJKWeight( const SvxWeightItem& rNew ) { aCJKWeight = rNew; }
void SetCJKPosture( const SvxPostureItem& rNew ) { aCJKPosture = rNew; }
void SetCTLFont( const SvxFontItem& rNew ) { aCTLFont = rNew; }
void SetCTLHeight( const SvxFontHeightItem& rNew ) { aCTLHeight = rNew; }
void SetCTLWeight( const SvxWeightItem& rNew ) { aCTLWeight = rNew; }
void SetCTLPosture( const SvxPostureItem& rNew ) { aCTLPosture = rNew; }
void SetUnderline( const SvxUnderlineItem& rNew ) { aUnderline = rNew; }
void SetOverline( const SvxOverlineItem& rNew ) { aOverline = rNew; }
void SetCrossedOut( const SvxCrossedOutItem& rNew ) { aCrossedOut = rNew; }
void SetContour( const SvxContourItem& rNew ) { aContour = rNew; }
void SetShadowed( const SvxShadowedItem& rNew ) { aShadowed = rNew; }
void SetColor( const SvxColorItem& rNew ) { aColor = rNew; }
void SetAdjust( const SvxAdjustItem& rNew )
{
aAdjust.SetAdjust( rNew.GetAdjust() );
aAdjust.SetOneWord( rNew.GetOneWord() );
aAdjust.SetLastBlock( rNew.GetLastBlock() );
}
void SetBox( const SvxBoxItem& rNew ) { aBox = rNew; }
void SetBackground( const SvxBrushItem& rNew ) { aBackground = rNew; }
void SetValueFormat( const String& rFmt, LanguageType eLng, LanguageType eSys )
{ sNumFmtString = rFmt; eNumFmtLanguage = eLng; eSysLanguage = eSys; }
sal_Bool Load( SvStream& rStream, const SwAfVersions& rVersions, sal_uInt16 nVer );
sal_Bool Save( SvStream& rStream ) const;
sal_Bool SaveVerionNo( SvStream& rStream ) const;
#ifdef READ_OLDVERS
// lade alte Version
sal_Bool LoadOld( SvStream& rStream, sal_uInt16 aLoadVer[] );
#endif
};
class SW_DLLPUBLIC SwTableAutoFmt
{
friend void _FinitCore(); // zum Zerstoeren des dflt. Pointers
static SwBoxAutoFmt* pDfltBoxAutoFmt;
String aName;
sal_uInt16 nStrResId;
// common flags of Calc and Writer
sal_Bool bInclFont : 1;
sal_Bool bInclJustify : 1;
sal_Bool bInclFrame : 1;
sal_Bool bInclBackground : 1;
sal_Bool bInclValueFormat : 1;
// Calc specific flags
sal_Bool bInclWidthHeight : 1;
SwBoxAutoFmt* aBoxAutoFmt[ 16 ];
public:
SwTableAutoFmt( const String& rName );
SwTableAutoFmt( const SwTableAutoFmt& rNew );
~SwTableAutoFmt();
SwTableAutoFmt& operator=( const SwTableAutoFmt& rNew );
void SetBoxFmt( const SwBoxAutoFmt& rNew, sal_uInt8 nPos );
const SwBoxAutoFmt& GetBoxFmt( sal_uInt8 nPos ) const;
void SetName( const String& rNew ) { aName = rNew; nStrResId = USHRT_MAX; }
const String& GetName() const { return aName; }
enum UpdateFlags { UPDATE_CHAR = 1, UPDATE_BOX = 2, UPDATE_ALL = 3 };
SwBoxAutoFmt& UpdateFromSet( sal_uInt8 nPos, const SfxItemSet& rSet,
UpdateFlags eFlags, SvNumberFormatter* );
void UpdateToSet( sal_uInt8 nPos, SfxItemSet& rSet, UpdateFlags eFlags,
SvNumberFormatter* ) const ;
sal_Bool IsFont() const { return bInclFont; }
sal_Bool IsJustify() const { return bInclJustify; }
sal_Bool IsFrame() const { return bInclFrame; }
sal_Bool IsBackground() const { return bInclBackground; }
sal_Bool IsValueFormat() const { return bInclValueFormat; }
void SetFont( const sal_Bool bNew ) { bInclFont = bNew; }
void SetJustify( const sal_Bool bNew ) { bInclJustify = bNew; }
void SetFrame( const sal_Bool bNew ) { bInclFrame = bNew; }
void SetBackground( const sal_Bool bNew ) { bInclBackground = bNew; }
void SetValueFormat( const sal_Bool bNew ) { bInclValueFormat = bNew; }
void SetWidthHeight( const sal_Bool bNew ) { bInclWidthHeight = bNew; }
sal_Bool Load( SvStream& rStream, const SwAfVersions& );
sal_Bool Save( SvStream& rStream ) const;
#ifdef READ_OLDVERS
// lade alte Version
sal_Bool LoadOld( SvStream& rStream, sal_uInt16 aLoadVer[] );
#endif
};
typedef SwTableAutoFmt* SwTableAutoFmtPtr ;
SV_DECL_PTRARR_DEL( _SwTableAutoFmtTbl, SwTableAutoFmtPtr, 1, 5 )
class SW_DLLPUBLIC SwTableAutoFmtTbl : public _SwTableAutoFmtTbl
{
SW_DLLPRIVATE sal_Bool Load( SvStream& rStream );
SW_DLLPRIVATE sal_Bool Save( SvStream& rStream ) const;
public:
SwTableAutoFmtTbl();
sal_Bool Load();
sal_Bool Save() const;
};
#endif