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"
//============================================================================
......
This diff is collapsed.
This diff is collapsed.
......@@ -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