Kaydet (Commit) d1cfdc0d authored tarafından Daniel Rentz's avatar Daniel Rentz

#101517# HC for number format list box

üst 6ec618d4
......@@ -2,9 +2,9 @@
*
* $RCSfile: fontlb.hxx,v $
*
* $Revision: 1.1.1.1 $
* $Revision: 1.2 $
*
* last change: $Author: hr $ $Date: 2000-09-18 17:00:56 $
* last change: $Author: dr $ $Date: 2002-07-23 10:47:34 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -62,61 +62,91 @@
#ifndef SVX_FONTLB_HXX
#define SVX_FONTLB_HXX
#ifndef _SVTABBX_HXX //autogen
#ifndef _SVTABBOX_HXX
#include <svtools/svtabbx.hxx>
#endif
#ifndef _SV_VIRDEV_HXX //autogen
#ifndef _SV_VIRDEV_HXX
#include <vcl/virdev.hxx>
#endif
// Klasse fuer die Darstellung von schriftabhaengigen Strings
// ============================================================================
/** A list box string item which stores its text and font. */
class SvLBoxFontString : public SvLBoxString
{
private:
Font aPrivatFont;
private:
Font maFont; /// The font used by this item.
bool mbUseColor; /// true = use font color, false = default listbox color.
public:
SvLBoxFontString( SvLBoxEntry*,USHORT nFlags,const XubString& rStr,
const Font& aFont);
SvLBoxFontString();
~SvLBoxFontString();
void InitViewData( SvLBox*,SvLBoxEntry*,SvViewDataItem* );
void Paint( const Point&, SvLBox& rDev, USHORT nFlags,SvLBoxEntry* );
SvLBoxItem* Create() const;
};
SvLBoxFontString();
SvLBoxFontString(
SvLBoxEntry* pEntry,
sal_uInt16 nFlags,
const XubString& rString,
const Font& rFont,
const Color* pColor = NULL );
// Listbox mit schriftabhaengiger Darstellung
class SvxFontListBox : public SvTabListBox
{
private:
virtual ~SvLBoxFontString();
VirtualDevice *pPrivatVDev;
Font aStandardFont;
Font aEntryFont;
BOOL bSettingFont;
/** Creates a new empty list box item. */
virtual SvLBoxItem* Create() const;
protected:
void InitViewData( SvLBox*,SvLBoxEntry*,SvViewDataItem* );
virtual void InitEntry(SvLBoxEntry*, const XubString&,const Image&,const Image&);
/** Paints this entry to the specified position, using the own font settings. */
void Paint(
const Point& rPos,
SvLBox& rDev,
sal_uInt16 nFlags,
SvLBoxEntry* pEntry );
};
public:
SvxFontListBox(Window* pParent,const ResId& aResID);
~SvxFontListBox();
// ============================================================================
void InsertFontEntry( const String& rString, Font aActorFont);
/** A list box supporting formatted string entries. */
class SvxFontListBox : public SvTabListBox
{
private:
Font maStdFont; /// Used for entries without specific font.
void SelectEntryPos( USHORT nPos, BOOL bSelect=TRUE);
ULONG GetSelectEntryPos();
XubString GetSelectEntry();
void SetNoSelection();
// The following members are used to store additional parameters for InitEntry().
Font maEntryFont; /// Current entry font used in InitEntry().
const Color* mpEntryColor; /// Current entry color used in InitEntry().
bool mbUseFont; /// true = Use maEntryFont/mpEntryColor in InitEntry().
public:
SvxFontListBox( Window* pParent, const ResId& rResId );
/** Inserts a list entry and sets the font used for this entry.
@param pColor The font color. NULL = use default listbox text color. */
void InsertFontEntry(
const String& rString, const Font& rFont, const Color* pColor = NULL );
/** Selects/deselects an entry specified by its position in the list box. */
void SelectEntryPos( sal_uInt16 nPos, bool bSelect = true );
/** Removes a selection. */
void SetNoSelection();
/** Returns the position of the entry currently selected or LIST_ENTRY_NOTFOUND. */
sal_uInt32 GetSelectEntryPos() const;
/** Returns the text of the selected entry or an empty string. */
XubString GetSelectEntry() const;
protected:
/** Initializes a new SvLBoxFontString entry.
@descr Uses current value of maEntryFont to set the entry font (if mbUseFont is true). */
virtual void InitEntry(
SvLBoxEntry* pEntry,
const XubString& rEntryText,
const Image& rCollImg,
const Image& rExpImg );
};
// ============================================================================
#endif
......@@ -2,9 +2,9 @@
*
* $RCSfile: ctredlin.cxx,v $
*
* $Revision: 1.5 $
* $Revision: 1.6 $
*
* last change: $Author: nn $ $Date: 2001-07-17 17:33:27 $
* last change: $Author: dr $ $Date: 2002-07-23 10:50:19 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -85,7 +85,6 @@
#include <dialmgr.hxx>
#include "ctredlin.hrc"
#include "ctredlin.hxx"
#include "fontlb.hxx"
#include "helpid.hrc"
//============================================================================
......
......@@ -2,9 +2,9 @@
*
* $RCSfile: fontlb.cxx,v $
*
* $Revision: 1.1.1.1 $
* $Revision: 1.2 $
*
* last change: $Author: hr $ $Date: 2000-09-18 17:01:08 $
* last change: $Author: dr $ $Date: 2002-07-23 10:50:17 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -59,395 +59,140 @@
*
************************************************************************/
#ifndef _SV_IMAGE_HXX //autogen
#include <vcl/image.hxx>
#endif
#pragma hdrstop
#ifndef SVX_FONTLB_HXX
#include "fontlb.hxx"
#endif
DBG_NAME(SvLBoxFontString);
/*************************************************************************
#* Funktionen der in die SvxFontListBox eingefuegten Items
#************************************************************************/
#ifndef _SV_SVAPP_HXX
#include <vcl/svapp.hxx>
#endif
#pragma hdrstop
/*************************************************************************
#* Member: SvLBoxFontString Datum:23.10.97
#*------------------------------------------------------------------------
#*
#* Klasse: SvLBoxFontString
#*
#* Funktion: Konstruktor der Klasse SvLBoxFontString
#*
#* Input: Box- Entry,Flags, Text fuer Anzeige, Schrift
#*
#* Output: ---
#*
#************************************************************************/
// ============================================================================
SvLBoxFontString::SvLBoxFontString( SvLBoxEntry*pEntry,USHORT nFlags,const XubString& rStr,
const Font& aFont)
DBG_NAME( SvLBoxFontString );
: SvLBoxString( pEntry, nFlags, rStr )
SvLBoxFontString::SvLBoxFontString() :
SvLBoxString()
{
DBG_CTOR(SvLBoxFontString,0);
aPrivatFont=aFont;
SetText( pEntry, rStr );
DBG_CTOR( SvLBoxFontString, 0 );
}
/*************************************************************************
#* Member: SvLBoxFontString Datum:23.10.97
#*------------------------------------------------------------------------
#*
#* Klasse: SvLBoxFontString
#*
#* Funktion: Default Konstruktor der Klasse SvLBoxFontString
#*
#* Input: ---
#*
#* Output: ---
#*
#************************************************************************/
SvLBoxFontString::SvLBoxFontString()
: SvLBoxString()
SvLBoxFontString::SvLBoxFontString(
SvLBoxEntry* pEntry, sal_uInt16 nFlags, const XubString& rString,
const Font& rFont, const Color* pColor ) :
SvLBoxString( pEntry, nFlags, rString ),
maFont( rFont ),
mbUseColor( pColor != NULL )
{
DBG_CTOR(SvLBoxFontString,0);
DBG_CTOR( SvLBoxFontString, 0 );
SetText( pEntry, rString );
if( pColor )
maFont.SetColor( *pColor );
}
/*************************************************************************
#* Member: ~SvLBoxFontString Datum:23.10.97
#*------------------------------------------------------------------------
#*
#* Klasse: SvLBoxFontString
#*
#* Funktion: Destruktor der Klasse SvLBoxFontString
#*
#* Input: ---
#*
#* Output: ---
#*
#************************************************************************/
SvLBoxFontString::~SvLBoxFontString()
{
DBG_DTOR(SvLBoxFontString,0);
DBG_DTOR( SvLBoxFontString, 0 );
}
/*************************************************************************
#* Member: SvLBoxFontString Datum:23.10.97
#*------------------------------------------------------------------------
#*
#* Klasse: SvLBoxFontString
#*
#* Funktion: Erzeugt einen neuen SvLBoxFontString
#*
#* Input: ---
#*
#* Output: SvLBoxFontString
#*
#************************************************************************/
SvLBoxItem* SvLBoxFontString::Create() const
{
DBG_CHKTHIS(SvLBoxFontString,0);
DBG_CHKTHIS( SvLBoxFontString, 0 );
return new SvLBoxFontString;
}
/*************************************************************************
#* Member: SvLBoxFontString Datum:23.10.97
#*------------------------------------------------------------------------
#*
#* Klasse: SvLBoxFontString
#*
#* Funktion: Zeichenroutine des SvLBoxFontString. Gezeichnet wird
#* der entsprechende Text mit der eingestellten Schriftart
#* im Ausgabe- Device.
#*
#* Input: Position, Ausgabe- Device, Flag fuer Selection,
#* Zeiger auf den Eintrag
#*
#* Output: ---
#*
#************************************************************************/
void SvLBoxFontString::Paint( const Point& rPos, SvLBox& rDev,
USHORT nFlags, SvLBoxEntry* pEntry )
void SvLBoxFontString::Paint( const Point& rPos, SvLBox& rDev, sal_uInt16 nFlags, SvLBoxEntry* pEntry )
{
Font aFont=rDev.GetFont();
Font a2Font=aPrivatFont;
Color aColor;
if(nFlags & SVLISTENTRYFLAG_SELECTED)
{
aColor=a2Font.GetColor();
aColor.SetRed(~aColor.GetRed());
aColor.SetGreen(~aColor.GetGreen());
aColor.SetBlue(~aColor.GetBlue());
a2Font.SetColor(aColor);
rDev.SetFont(a2Font);
}
else
DBG_CHKTHIS( SvLBoxFontString, 0 );
Font aOldFont( rDev.GetFont() );
Font aNewFont( maFont );
bool bSel = (nFlags & SVLISTENTRYFLAG_SELECTED) != 0;
// if( !mbUseColor ) // selection gets font color, if available
if( !mbUseColor || bSel ) // selection always gets highlight color
{
rDev.SetFont(aPrivatFont);
const StyleSettings& rSett = Application::GetSettings().GetStyleSettings();
aNewFont.SetColor( bSel ? rSett.GetHighlightTextColor() : rSett.GetFieldTextColor() );
}
SvLBoxString::Paint(rPos,rDev,nFlags,pEntry );
rDev.SetFont(aFont);
}
/*************************************************************************
#* Member: SvLBoxFontString Datum:23.10.97
#*------------------------------------------------------------------------
#*
#* Klasse: SvLBoxFontString
#*
#* Funktion: Ermittelt und stellt die Ausgabegroesse in der View ein.
#*
#* Input: Zeiger auf die View, Eintrag, Anzeigedaten
#*
#*
#* Output: ---
#*
#************************************************************************/
void SvLBoxFontString::InitViewData( SvLBox* pView,SvLBoxEntry* pEntry,
SvViewDataItem* pViewData)
{
DBG_CHKTHIS(SvLBoxFontString,0);
Font aFont= pView->GetFont();
pView->SetFont(aPrivatFont);
SvLBoxString::InitViewData(pView,pEntry,pViewData);
pView->SetFont(aFont);
rDev.SetFont( aNewFont );
SvLBoxString::Paint( rPos, rDev, nFlags, pEntry );
rDev.SetFont( aOldFont );
}
/*************************************************************************
#* Listbox mit Schrifteinstellung
#************************************************************************/
/*************************************************************************
#* Member: SvxFontListBox Datum:20.10.97
#*------------------------------------------------------------------------
#*
#* Klasse: SvxFontListBox
#*
#* Funktion: Konstruktor der Klasse SvxFontListBox. Die Klasse dient
#* der Darstellung von Strings in der entsprechenden
#* Schriftart.
#*
#* Input: Parent-Window, WinBits, min. Winkel, max. Winkel
#*
#* Output: ---
#*
#************************************************************************/
SvxFontListBox::SvxFontListBox(Window* pParent,const ResId& aResID)
:SvTabListBox(pParent,aResID)
void SvLBoxFontString::InitViewData( SvLBox* pView, SvLBoxEntry* pEntry, SvViewDataItem* pViewData )
{
pPrivatVDev=new VirtualDevice;
aStandardFont=GetFont();
Size aWinSize=GetOutputSizePixel();
bSettingFont=FALSE;
aStandardFont.SetTransparent(TRUE);
aStandardFont.SetColor(Color(COL_BLUE));
if(pPrivatVDev!=NULL)
{
pPrivatVDev->SetOutputSizePixel(aWinSize);
pPrivatVDev->SetFont(aStandardFont);
}
Color aCol=GetBackground().GetColor();
aStandardFont.SetColor(aCol);
SetFont(aStandardFont);
aEntryFont=aStandardFont;
DBG_CHKTHIS( SvLBoxFontString, 0 );
Font aOldFont( pView->GetFont() );
pView->SetFont( maFont );
SvLBoxString::InitViewData( pView, pEntry, pViewData);
pView->SetFont( aOldFont );
}
/*************************************************************************
#* Member: SvxFontListBox Datum:20.10.97
#*------------------------------------------------------------------------
#*
#* Klasse: SvxFontListBox
#*
#* Funktion: Destruktor der Klasse SvxFontListBox. Gibt den
#* Speicher, der fuer das VDevice angelegt wurde,
#* wieder frei.
#*
#* Input: ---
#*
#* Output: ---
#*
#************************************************************************/
SvxFontListBox::~SvxFontListBox()
// ============================================================================
SvxFontListBox::SvxFontListBox( Window* pParent, const ResId& rResId ) :
SvTabListBox( pParent, rResId ),
maStdFont( GetFont() ),
mbUseFont( false )
{
delete pPrivatVDev;
maStdFont.SetTransparent( TRUE );
maEntryFont = maStdFont;
}
/*************************************************************************
#* Member: InsertFontEntry Datum:20.10.97
#*------------------------------------------------------------------------
#*
#* Klasse: SvxColorTabListBox
#*
#* Funktion: Erzeugt aus dem uebergebenen String eine Bitmap
#* und fuegt diese Bitmap in die ListBox ein.
#*
#* Input: String, Font, Position
#*
#* Output: ---
#*
#************************************************************************/
void SvxFontListBox::InsertFontEntry( const String& rString,Font aActorFont)
void SvxFontListBox::InsertFontEntry( const String& rString, const Font& rFont, const Color* pColor )
{
Point aPos(0,0);
bSettingFont=TRUE;
aEntryFont=aActorFont;
InsertEntry( rString);
mbUseFont = true; // InitEntry() will use maEntryFont
maEntryFont = rFont; // font to use in InitEntry() over InsertEntry()
mpEntryColor = pColor; // color to use in InitEntry() over InsertEntry()
InsertEntry( rString );
mbUseFont = false;
}
/*************************************************************************
#* Member: SelectEntryPos Datum:20.10.97
#*------------------------------------------------------------------------
#*
#* Klasse: SvxFontListBox
#*
#* Funktion: Schaltet an der Position nPos, die Selektion
#* an oder aus.
#*
#* Input: Position, Selektion: An/Aus
#*
#* Output: ---
#*
#************************************************************************/
void SvxFontListBox::SelectEntryPos( USHORT nPos, BOOL bSelect)
void SvxFontListBox::SelectEntryPos( sal_uInt16 nPos, bool bSelect )
{
SvLBoxEntry* pEntry=GetEntry(nPos);
if(pEntry!=NULL)
SvLBoxEntry* pEntry = GetEntry( nPos );
if( pEntry )
{
Select( pEntry,bSelect);
ShowEntry(pEntry );
Select( pEntry, bSelect );
ShowEntry( pEntry );
}
}
/*************************************************************************
#* Member: GetSelectEntryPos Datum:20.10.97
#*------------------------------------------------------------------------
#*
#* Klasse: SvxFontListBox
#*
#* Funktion: Liefert die Position der ersten Selektion
#* zurck.
#*
#* Input: ---
#*
#* Output: Position
#*
#************************************************************************/
ULONG SvxFontListBox::GetSelectEntryPos()
void SvxFontListBox::SetNoSelection()
{
SvLBoxEntry* pSvLBoxEntry=FirstSelected();
ULONG nSel=LIST_APPEND;
if(pSvLBoxEntry!=NULL)
{
nSel=GetModel()->GetAbsPos( pSvLBoxEntry );
}
return nSel;
SelectAll( FALSE, TRUE );
}
/*************************************************************************
#* Member: GetSelectEntry Datum:20.10.97
#*------------------------------------------------------------------------
#*
#* Klasse: SvxFontListBox
#*
#* Funktion: Liefert den ersten Eintrag der Selektion
#* zurck.
#*
#* Input: ---
#*
#* Output: Position
#*
#************************************************************************/
XubString SvxFontListBox::GetSelectEntry()
sal_uInt32 SvxFontListBox::GetSelectEntryPos() const
{
return GetEntryText(GetSelectEntryPos());
SvLBoxEntry* pSvLBoxEntry = FirstSelected();
return pSvLBoxEntry ? GetModel()->GetAbsPos( pSvLBoxEntry ) : LIST_ENTRY_NOTFOUND;
}
/*************************************************************************
#* Member: SetNoSelection Datum:20.10.97
#*------------------------------------------------------------------------
#*
#* Klasse: SvxFontListBox
#*
#* Funktion: Hebt eine bestehende Selektierung auf.
#*
#* Input: ---
#*
#* Output: ---
#*
#************************************************************************/
void SvxFontListBox::SetNoSelection()
XubString SvxFontListBox::GetSelectEntry() const
{
SelectAll( FALSE,TRUE );
return GetEntryText( GetSelectEntryPos() );
}
/*************************************************************************
#* Member: SvxFontListBox Datum:20.10.97
#*------------------------------------------------------------------------
#*
#* Klasse: SvxFontListBox
#*
#* Funktion: Ueberladene Funktion der TreeListBox. Fuegt einen
#* neuen SvLBoxFontString ein.
#*
#* Input: ---
#*
#* Output: ---
#*
#************************************************************************/
void SvxFontListBox::InitEntry( SvLBoxEntry* pEntry, const XubString& aStr,
const Image& aCollEntryBmp, const Image& aExpEntryBmp)
void SvxFontListBox::InitEntry(
SvLBoxEntry* pEntry, const XubString& rEntryText,
const Image& rCollImg, const Image& rExpImg )
{
if(bSettingFont==TRUE)
if( mbUseFont )
{
bSettingFont=FALSE;
SvLBoxButton* pButton;
SvLBoxFontString* pString;
SvLBoxContextBmp* pContextBmp;
if( nTreeFlags & TREEFLAG_CHKBTN )
{
pButton= new SvLBoxButton( pEntry,0,pCheckButtonData );
pEntry->AddItem( pButton );
}
pContextBmp= new SvLBoxContextBmp( pEntry,0, aCollEntryBmp,aExpEntryBmp,
SVLISTENTRYFLAG_EXPANDED);
pEntry->AddItem( pContextBmp );
pString = new SvLBoxFontString( pEntry, 0, aStr,aEntryFont);
pEntry->AddItem( pString );
pEntry->AddItem( new SvLBoxButton( pEntry, 0, pCheckButtonData ) );
pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, rCollImg, rExpImg, SVLISTENTRYFLAG_EXPANDED ) );
pEntry->AddItem( new SvLBoxFontString( pEntry, 0, rEntryText, maEntryFont, mpEntryColor ) );
}
else
{
SvTreeListBox::InitEntry( pEntry, aStr, aCollEntryBmp, aExpEntryBmp);
}
SvTreeListBox::InitEntry( pEntry, rEntryText, rCollImg, rExpImg );
}
// ============================================================================
......@@ -2,9 +2,9 @@
*
* $RCSfile: numfmt.cxx,v $
*
* $Revision: 1.14 $
* $Revision: 1.15 $
*
* last change: $Author: gt $ $Date: 2002-06-11 08:03:53 $
* last change: $Author: dr $ $Date: 2002-07-23 10:50:18 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -174,10 +174,10 @@ SvxNumberPreviewImpl::~SvxNumberPreviewImpl()
#************************************************************************/
void SvxNumberPreviewImpl::NotifyChange( const String& rPrevStr,
const Color& rColor )
const Color* pColor )
{
aPrevStr = rPrevStr;
aPrevCol = rColor;
aPrevCol = pColor ? *pColor : GetSettings().GetStyleSettings().GetWindowTextColor();
Invalidate();
Update();
}
......@@ -504,8 +504,6 @@ void SvxNumberFormatTabPage::Reset( const SfxItemSet& rSet )
USHORT nFmtLbSelPos = 0;
LanguageType eLangType = LANGUAGE_DONTKNOW;
SvxDelStrgs aFmtEntryList;
String aPrevString;
Color aPrevColor;
SvxNumberValueType eValType = SVX_VALUE_TYPE_UNDEFINED;
double nValDouble = 0;
String aValString;
......@@ -638,8 +636,10 @@ void SvxNumberFormatTabPage::Reset( const SfxItemSet& rSet )
FillCurrencyBox();
String aPrevString;
Color* pDummy = NULL;
pNumFmtShell->GetInitSettings( nCatLbSelPos, eLangType, nFmtLbSelPos,
aFmtEntryList, aPrevString, aPrevColor );
aFmtEntryList, aPrevString, pDummy );
aLbCurrency.SelectEntryPos((USHORT)pNumFmtShell->GetCurrencySymbol());
......@@ -720,7 +720,7 @@ void SvxNumberFormatTabPage::Obstructing()
aEdLeadZeroes .SetText( String() );
aBtnNegRed .Check( FALSE );
aBtnThousand .Check( FALSE );
aWndPreview .NotifyChange( String(), Color() );
aWndPreview .NotifyChange( String() );
aLbCategory .SelectEntryPos( 0 );
aEdFormat .SetText( String() );
......@@ -944,11 +944,7 @@ void SvxNumberFormatTabPage::FillFormatListBox_Impl( SvxDelStrgs& rEntries )
String* pEntry;
String aTmpString;
String aTmpCatString;
String aPreviewString;
Color aPreviewColor;
Font aFont=aLbCategory.GetFont();
Font a2Font;
Font a3Font;
double nVal=0;
BOOL bFLAG=FALSE;
USHORT i = 0;
......@@ -983,7 +979,7 @@ void SvxNumberFormatTabPage::FillFormatListBox_Impl( SvxDelStrgs& rEntries )
{
aTmpString=*pEntry;
aPrivCat=pNumFmtShell->GetCategory4Entry(0);
aLbFormat.InsertFontEntry(aTmpString,aFont);
aLbFormat.InsertFontEntry( aTmpString, aFont );
}
break;
......@@ -998,10 +994,10 @@ void SvxNumberFormatTabPage::FillFormatListBox_Impl( SvxDelStrgs& rEntries )
aPrivCat=pNumFmtShell->GetCategory4Entry(i);
if(aPrivCat!=CAT_TEXT)
{
aPreviewString=GetExpColorString(&aPreviewColor, *pEntry,aPrivCat);
a2Font=aLbFormat.GetFont();
a2Font.SetColor(aPreviewColor);
aLbFormat.InsertFontEntry(aPreviewString,a2Font); //@21.10.97
Color* pPreviewColor = NULL;
String aPreviewString( GetExpColorString( pPreviewColor, *pEntry, aPrivCat ) );
Font aEntryFont( aLbFormat.GetFont() );
aLbFormat.InsertFontEntry( aPreviewString, aEntryFont, pPreviewColor );
}
else
{
......@@ -1187,8 +1183,6 @@ void SvxNumberFormatTabPage::UpdateFormatListBox_Impl
{
SvxDelStrgs aEntryList;
short nFmtLbSelPos = 0;
String aPreviewString;
Color aPreviewColor;
short nTmpCatPos;
if(bOneAreaFlag)
......@@ -1254,11 +1248,7 @@ void SvxNumberFormatTabPage::UpdateFormatListBox_Impl
aFtComment.SetText(aLbCategory.GetEntry(1));
}
}
pNumFmtShell->FormatChanged( (USHORT)nFmtLbSelPos,
aPreviewString,
aPreviewColor );
aWndPreview.NotifyChange( aPreviewString, aPreviewColor );
ChangePreviewText( (USHORT)nFmtLbSelPos );
}
}
......@@ -1286,7 +1276,7 @@ void SvxNumberFormatTabPage::UpdateFormatListBox_Impl
if ( bUpdateEdit )
{
aEdFormat.SetText( String() );
aWndPreview.NotifyChange( String(), aPreviewColor );
aWndPreview.NotifyChange( String() );
}
}
}
......@@ -1382,8 +1372,6 @@ IMPL_LINK( SvxNumberFormatTabPage, SelFormatHdl_Impl, void *, pLb )
USHORT nSelPos = (USHORT) aLbFormat.GetSelectEntryPos();
String aFormat = aLbFormat.GetSelectEntry();
String aComment;
String aPreviewString;
Color aPreviewColor;
SvxDelStrgs aEntryList;
short nFmtLbSelPos = nSelPos;
......@@ -1402,11 +1390,7 @@ IMPL_LINK( SvxNumberFormatTabPage, SelFormatHdl_Impl, void *, pLb )
{
if(!aEdFormat.HasFocus()) aEdFormat.SetText( aFormat );
aFtComment.SetText(aComment);
pNumFmtShell->FormatChanged( nSelPos,
aPreviewString,
aPreviewColor );
aWndPreview.NotifyChange( aPreviewString, aPreviewColor );
ChangePreviewText( nSelPos );
}
REMOVE_DONTKNOW() // ggF. UI-Enable
......@@ -1536,9 +1520,6 @@ IMPL_LINK( SvxNumberFormatTabPage, ClickHdl_Impl, ImageButton*, pIB)
if ( bAdded && (nFmtLbSelPos != SELPOS_NONE) )
{
// Alles klar
String aPreviewString;
Color aPreviewColor;
if(bOneAreaFlag) //@@ ???
SetCategory(0);
else
......@@ -1561,11 +1542,7 @@ IMPL_LINK( SvxNumberFormatTabPage, ClickHdl_Impl, ImageButton*, pIB)
//aEdComment.SetText(String()); //@@ ???
aEdComment.SetText(aLbCategory.GetEntry(1)); //String fuer Benutzerdefiniert
//holen
pNumFmtShell->FormatChanged( (USHORT)nFmtLbSelPos,
aPreviewString,
aPreviewColor );
aWndPreview.NotifyChange( aPreviewString, aPreviewColor );
ChangePreviewText( (USHORT)nFmtLbSelPos );
}
}
}
......@@ -1579,8 +1556,6 @@ IMPL_LINK( SvxNumberFormatTabPage, ClickHdl_Impl, ImageButton*, pIB)
}
else if(pIB==&aIbRemove)
{
String aPreviewString;
Color aPreviewColor;
String aFormat = aEdFormat.GetText();
SvxDelStrgs aEntryList;
USHORT nCatLbSelPos = 0;
......@@ -1610,10 +1585,7 @@ IMPL_LINK( SvxNumberFormatTabPage, ClickHdl_Impl, ImageButton*, pIB)
aLbFormat.SelectEntryPos( (USHORT)nFmtLbSelPos );
aEdFormat.SetText( aFormat );
pNumFmtShell->FormatChanged( (USHORT)nFmtLbSelPos,
aPreviewString,
aPreviewColor );
aWndPreview.NotifyChange( aPreviewString, aPreviewColor );
ChangePreviewText( (USHORT)nFmtLbSelPos );
}
else
{
......@@ -1663,8 +1635,6 @@ IMPL_LINK( SvxNumberFormatTabPage, ClickHdl_Impl, ImageButton*, pIB)
IMPL_LINK( SvxNumberFormatTabPage, EditHdl_Impl, Edit*, pEdFormat )
{
ULONG nCurKey = NUMKEY_UNDEFINED;
String aPreviewString; //@ 22.09.97
Color aPreviewColor;
if ( aEdFormat.GetText().Len() == 0 )
{
......@@ -1677,11 +1647,7 @@ IMPL_LINK( SvxNumberFormatTabPage, EditHdl_Impl, Edit*, pEdFormat )
{
String aFormat = aEdFormat.GetText();
//aFtComment.SetText(String());
pNumFmtShell->MakePreviewString(aFormat,aPreviewString, //@ 22.09.97
aPreviewColor);
aWndPreview.NotifyChange( aPreviewString, aPreviewColor );
MakePreviewText( aFormat );
if ( pNumFmtShell->FindEntry( aFormat, &nCurKey ) )
{
......@@ -1746,8 +1712,6 @@ IMPL_LINK( SvxNumberFormatTabPage, OptHdl_Impl, void *, pOptCtrl )
|| ((CheckBox*) pOptCtrl == &aBtnNegRed)
|| ((CheckBox*) pOptCtrl == &aBtnThousand) )
{
String aPreviewString;
Color aPreviewColor;
String aFormat;
BOOL bThousand = aBtnThousand.IsEnabled()
&& aBtnThousand.IsChecked();
......@@ -1767,12 +1731,7 @@ IMPL_LINK( SvxNumberFormatTabPage, OptHdl_Impl, void *, pOptCtrl )
aEdFormat.SetText( aFormat );
//aFtComment.SetText(String());
pNumFmtShell->MakePreviewString( aFormat,
aPreviewString,
aPreviewColor );
aWndPreview.NotifyChange( aPreviewString, aPreviewColor );
MakePreviewText( aFormat );
if ( pNumFmtShell->FindEntry( aFormat ) )
{
......@@ -1847,17 +1806,10 @@ IMPL_LINK( SvxNumberFormatTabPage, LostFocusHdl_Impl, Edit *, pEd)
#*
#************************************************************************/
String SvxNumberFormatTabPage::GetExpColorString(Color *aPreviewColor,
String aFormatStr,
short nTmpCatPos)
String SvxNumberFormatTabPage::GetExpColorString(
Color*& rpPreviewColor, const String& rFormatStr, short nTmpCatPos)
{
Color aTmpCol;
String aPreviewString;
String aTmpString;
double nVal=0;
aTmpString=aFormatStr;
double nVal = 0;
switch (nTmpCatPos)
{
case CAT_CURRENCY: nVal=SVX_NUMVAL_CURRENCY; break;
......@@ -1880,14 +1832,27 @@ String SvxNumberFormatTabPage::GetExpColorString(Color *aPreviewColor,
default: nVal=0;break;
}
pNumFmtShell->MakePrevStringFromVal( aTmpString, //@ 19.09.97
aPreviewString,
aTmpCol,nVal );
*aPreviewColor=aTmpCol;
String aPreviewString;
pNumFmtShell->MakePrevStringFromVal( rFormatStr, aPreviewString, rpPreviewColor, nVal );
return aPreviewString;
}
void SvxNumberFormatTabPage::MakePreviewText( const String& rFormat )
{
String aPreviewString;
Color* pPreviewColor = NULL;
pNumFmtShell->MakePreviewString( rFormat, aPreviewString, pPreviewColor );
aWndPreview.NotifyChange( aPreviewString, pPreviewColor );
}
void SvxNumberFormatTabPage::ChangePreviewText( USHORT nPos )
{
String aPreviewString;
Color* pPreviewColor = NULL;
pNumFmtShell->FormatChanged( nPos, aPreviewString, pPreviewColor );
aWndPreview.NotifyChange( aPreviewString, pPreviewColor );
}
long SvxNumberFormatTabPage::PreNotify( NotifyEvent& rNEvt )
{
if(rNEvt.GetType()==EVENT_LOSEFOCUS)
......
......@@ -2,9 +2,9 @@
*
* $RCSfile: numfmtsh.cxx,v $
*
* $Revision: 1.5 $
* $Revision: 1.6 $
*
* last change: $Author: er $ $Date: 2002-03-14 12:46:02 $
* last change: $Author: dr $ $Date: 2002-07-23 10:52:55 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -86,6 +86,10 @@
#include <langtab.hxx>
#endif
#ifndef _SV_SVAPP_HXX
#include <vcl/svapp.hxx>
#endif
#include "numfmtsh.hxx"
// class SvxNumberFormatShell --------------------------------------------
......@@ -265,7 +269,7 @@ void SvxNumberFormatShell::LanguageChanged( LanguageType eLangType,
void SvxNumberFormatShell::FormatChanged( sal_uInt16 nFmtLbPos,
String& rPreviewStr,
Color& rFontColor )
Color*& rpFontColor )
{
//nCurFormatKey = pCurFmtTable->GetKey( pCurFmtTable->GetObject( nFmtLbPos ) );
......@@ -275,7 +279,7 @@ void SvxNumberFormatShell::FormatChanged( sal_uInt16 nFmtLbPos,
if(nCurFormatKey!=NUMBERFORMAT_ENTRY_NOT_FOUND)
{
GetPreviewString_Impl( rPreviewStr, rFontColor );
GetPreviewString_Impl( rPreviewStr, rpFontColor );
}
else if(nCurCategory==NUMBERFORMAT_CURRENCY)
{
......@@ -283,7 +287,7 @@ void SvxNumberFormatShell::FormatChanged( sal_uInt16 nFmtLbPos,
{
//nCurFormatKey=nFmtLbPos;
MakePrevStringFromVal(*aCurrencyFormatList[nFmtLbPos],
rPreviewStr,rFontColor,nValNum);
rPreviewStr,rpFontColor,nValNum);
}
}
}
......@@ -486,9 +490,9 @@ void SvxNumberFormatShell::GetOptions( const String& rFormat,
void SvxNumberFormatShell::MakePreviewString( const String& rFormatStr,
String& rPreviewStr,
Color& rFontColor )
Color*& rpFontColor )
{
Color* pColor = NULL;
rpFontColor = NULL;
ULONG nExistingFormat = pFormatter->GetEntryKey( rFormatStr, eCurLanguage );
if ( nExistingFormat == NUMBERFORMAT_ENTRY_NOT_FOUND )
......@@ -496,7 +500,7 @@ void SvxNumberFormatShell::MakePreviewString( const String& rFormatStr,
// real preview - not implemented in NumberFormatter for text formats
pFormatter->GetPreviewString( rFormatStr, nValNum, rPreviewStr,
&pColor, eCurLanguage );
&rpFontColor, eCurLanguage );
}
else
{
......@@ -507,16 +511,11 @@ void SvxNumberFormatShell::MakePreviewString( const String& rFormatStr,
( aValStr.Len() && ( pFormatter->GetType(nExistingFormat) & NUMBERFORMAT_TEXT ) ) );
if ( bUseText )
pFormatter->GetOutputString( aValStr, nExistingFormat,
rPreviewStr, &pColor );
rPreviewStr, &rpFontColor );
else
pFormatter->GetOutputString( nValNum, nExistingFormat,
rPreviewStr, &pColor );
rPreviewStr, &rpFontColor );
}
if ( pColor )
rFontColor = *pColor;
else
rFontColor = Color( COL_BLACK );
}
// -----------------------------------------------------------------------
......@@ -577,12 +576,13 @@ sal_Bool SvxNumberFormatShell::FindEntry( const String& rFmtString, sal_uInt32*
// -----------------------------------------------------------------------
void SvxNumberFormatShell::GetInitSettings( sal_uInt16& nCatLbPos,
LanguageType& rLangType,
sal_uInt16& nFmtLbSelPos,
SvStrings& rFmtEntries,
String& rPrevString,
Color& rPrevColor )
void SvxNumberFormatShell::GetInitSettings(
sal_uInt16& nCatLbPos,
LanguageType& rLangType,
sal_uInt16& nFmtLbSelPos,
SvStrings& rFmtEntries,
String& rPrevString,
Color*& rpPrevColor )
{
// -------------------------------------------------------------------
// Vorbedingung: Zahlenformatierer gefunden
......@@ -612,7 +612,7 @@ void SvxNumberFormatShell::GetInitSettings( sal_uInt16& nCatLbPos,
DBG_ASSERT( nSelPos != SELPOS_NONE, "Leere Formatliste!" );
nFmtLbSelPos = (nSelPos != SELPOS_NONE) ? (sal_uInt16)nSelPos : 0;
GetPreviewString_Impl( rPrevString, rPrevColor );
GetPreviewString_Impl( rPrevString, rpPrevColor );
}
// -----------------------------------------------------------------------
......@@ -737,7 +737,6 @@ short SvxNumberFormatShell::FillEListWithFormats_Impl( SvStrings& rList,short nS
String aNewFormNInfo;
String aPrevString;
String a2PrevString;
Color aColor;
short nMyCat = SELPOS_NONE;
short nIq=0;
......@@ -784,7 +783,6 @@ short SvxNumberFormatShell::FillEListWithDateTime_Impl( SvStrings& rList,short n
String aNewFormNInfo;
String aPrevString;
String a2PrevString;
Color aColor;
short nMyCat = SELPOS_NONE;
short nIq=0;
......@@ -869,7 +867,6 @@ short SvxNumberFormatShell::FillEListWithSysCurrencys( SvStrings& rList,short nS
String aNewFormNInfo;
String aPrevString;
String a2PrevString;
Color aColor;
nCurCurrencyEntryPos=0;
......@@ -965,7 +962,6 @@ short SvxNumberFormatShell::FillEListWithUserCurrencys( SvStrings& rList,short n
String aNewFormNInfo;
String aPrevString;
String a2PrevString;
Color aColor;
short nMyCat = SELPOS_NONE;
short nIq=0;
......@@ -1155,8 +1151,6 @@ short SvxNumberFormatShell::FillEListWithUsD_Impl( SvStrings& rList, sal_uInt16
String aNewFormNInfo;
String aPrevString;
String a2PrevString;
Color aColor;
short nMyCat = SELPOS_NONE;
short nIq=0;
......@@ -1204,26 +1198,18 @@ short SvxNumberFormatShell::FillEListWithUsD_Impl( SvStrings& rList, sal_uInt16
// -----------------------------------------------------------------------
void SvxNumberFormatShell::GetPreviewString_Impl( String& rString,
Color& rColor )
void SvxNumberFormatShell::GetPreviewString_Impl( String& rString, Color*& rpColor )
{
Color* pColor = NULL;
rpColor = NULL;
// #50441# if a string was set in addition to the value, use it for text formats
BOOL bUseText = ( eValType == SVX_VALUE_TYPE_STRING ||
( aValStr.Len() && ( pFormatter->GetType(nCurFormatKey) & NUMBERFORMAT_TEXT ) ) );
if ( bUseText )
pFormatter->GetOutputString( aValStr, nCurFormatKey,
rString, &pColor );
pFormatter->GetOutputString( aValStr, nCurFormatKey, rString, &rpColor );
else
pFormatter->GetOutputString( nValNum, nCurFormatKey,
rString, &pColor );
if ( pColor )
rColor = *pColor;
else
rColor = Color( COL_BLACK );
pFormatter->GetOutputString( nValNum, nCurFormatKey, rString, &rpColor );
}
// -----------------------------------------------------------------------
......@@ -1311,20 +1297,16 @@ void SvxNumberFormatShell::CategoryToPos_Impl( short nCategory, sal_uInt16& rPos
#*
#************************************************************************/
void SvxNumberFormatShell::MakePrevStringFromVal( const String& rFormatStr,
String& rPreviewStr,
Color& rFontColor,
double nValue)
void SvxNumberFormatShell::MakePrevStringFromVal(
const String& rFormatStr,
String& rPreviewStr,
Color*& rpFontColor,
double nValue)
{
Color* pColor = NULL;
pFormatter->GetPreviewString( rFormatStr, nValue, rPreviewStr,
&pColor, eCurLanguage );
if ( pColor )
rFontColor = *pColor;
else
rFontColor = Color( COL_BLACK );
rpFontColor = NULL;
pFormatter->GetPreviewString( rFormatStr, nValue, rPreviewStr, &rpFontColor, eCurLanguage );
}
/*************************************************************************
#* Member: GetComment4Entry Datum:30.10.97
#*------------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment