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 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: fontlb.hxx,v $ * $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 * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -62,61 +62,91 @@ ...@@ -62,61 +62,91 @@
#ifndef SVX_FONTLB_HXX #ifndef SVX_FONTLB_HXX
#define SVX_FONTLB_HXX #define SVX_FONTLB_HXX
#ifndef _SVTABBX_HXX //autogen #ifndef _SVTABBOX_HXX
#include <svtools/svtabbx.hxx> #include <svtools/svtabbx.hxx>
#endif #endif
#ifndef _SV_VIRDEV_HXX
#ifndef _SV_VIRDEV_HXX //autogen
#include <vcl/virdev.hxx> #include <vcl/virdev.hxx>
#endif #endif
// Klasse fuer die Darstellung von schriftabhaengigen Strings // ============================================================================
/** A list box string item which stores its text and font. */
class SvLBoxFontString : public SvLBoxString class SvLBoxFontString : public SvLBoxString
{ {
private: private:
Font maFont; /// The font used by this item.
Font aPrivatFont; bool mbUseColor; /// true = use font color, false = default listbox color.
public: public:
SvLBoxFontString( SvLBoxEntry*,USHORT nFlags,const XubString& rStr, SvLBoxFontString();
const Font& aFont); SvLBoxFontString(
SvLBoxFontString(); SvLBoxEntry* pEntry,
~SvLBoxFontString(); sal_uInt16 nFlags,
const XubString& rString,
void InitViewData( SvLBox*,SvLBoxEntry*,SvViewDataItem* ); const Font& rFont,
void Paint( const Point&, SvLBox& rDev, USHORT nFlags,SvLBoxEntry* ); const Color* pColor = NULL );
SvLBoxItem* Create() const;
};
// Listbox mit schriftabhaengiger Darstellung virtual ~SvLBoxFontString();
class SvxFontListBox : public SvTabListBox
{
private:
VirtualDevice *pPrivatVDev; /** Creates a new empty list box item. */
Font aStandardFont; virtual SvLBoxItem* Create() const;
Font aEntryFont;
BOOL bSettingFont;
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); // The following members are used to store additional parameters for InitEntry().
ULONG GetSelectEntryPos(); Font maEntryFont; /// Current entry font used in InitEntry().
XubString GetSelectEntry(); const Color* mpEntryColor; /// Current entry color used in InitEntry().
void SetNoSelection(); 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 #endif
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: ctredlin.cxx,v $ * $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 * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -85,7 +85,6 @@ ...@@ -85,7 +85,6 @@
#include <dialmgr.hxx> #include <dialmgr.hxx>
#include "ctredlin.hrc" #include "ctredlin.hrc"
#include "ctredlin.hxx" #include "ctredlin.hxx"
#include "fontlb.hxx"
#include "helpid.hrc" #include "helpid.hrc"
//============================================================================ //============================================================================
......
This diff is collapsed.
This diff is collapsed.
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: numfmtsh.cxx,v $ * $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 * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -86,6 +86,10 @@ ...@@ -86,6 +86,10 @@
#include <langtab.hxx> #include <langtab.hxx>
#endif #endif
#ifndef _SV_SVAPP_HXX
#include <vcl/svapp.hxx>
#endif
#include "numfmtsh.hxx" #include "numfmtsh.hxx"
// class SvxNumberFormatShell -------------------------------------------- // class SvxNumberFormatShell --------------------------------------------
...@@ -265,7 +269,7 @@ void SvxNumberFormatShell::LanguageChanged( LanguageType eLangType, ...@@ -265,7 +269,7 @@ void SvxNumberFormatShell::LanguageChanged( LanguageType eLangType,
void SvxNumberFormatShell::FormatChanged( sal_uInt16 nFmtLbPos, void SvxNumberFormatShell::FormatChanged( sal_uInt16 nFmtLbPos,
String& rPreviewStr, String& rPreviewStr,
Color& rFontColor ) Color*& rpFontColor )
{ {
//nCurFormatKey = pCurFmtTable->GetKey( pCurFmtTable->GetObject( nFmtLbPos ) ); //nCurFormatKey = pCurFmtTable->GetKey( pCurFmtTable->GetObject( nFmtLbPos ) );
...@@ -275,7 +279,7 @@ void SvxNumberFormatShell::FormatChanged( sal_uInt16 nFmtLbPos, ...@@ -275,7 +279,7 @@ void SvxNumberFormatShell::FormatChanged( sal_uInt16 nFmtLbPos,
if(nCurFormatKey!=NUMBERFORMAT_ENTRY_NOT_FOUND) if(nCurFormatKey!=NUMBERFORMAT_ENTRY_NOT_FOUND)
{ {
GetPreviewString_Impl( rPreviewStr, rFontColor ); GetPreviewString_Impl( rPreviewStr, rpFontColor );
} }
else if(nCurCategory==NUMBERFORMAT_CURRENCY) else if(nCurCategory==NUMBERFORMAT_CURRENCY)
{ {
...@@ -283,7 +287,7 @@ void SvxNumberFormatShell::FormatChanged( sal_uInt16 nFmtLbPos, ...@@ -283,7 +287,7 @@ void SvxNumberFormatShell::FormatChanged( sal_uInt16 nFmtLbPos,
{ {
//nCurFormatKey=nFmtLbPos; //nCurFormatKey=nFmtLbPos;
MakePrevStringFromVal(*aCurrencyFormatList[nFmtLbPos], MakePrevStringFromVal(*aCurrencyFormatList[nFmtLbPos],
rPreviewStr,rFontColor,nValNum); rPreviewStr,rpFontColor,nValNum);
} }
} }
} }
...@@ -486,9 +490,9 @@ void SvxNumberFormatShell::GetOptions( const String& rFormat, ...@@ -486,9 +490,9 @@ void SvxNumberFormatShell::GetOptions( const String& rFormat,
void SvxNumberFormatShell::MakePreviewString( const String& rFormatStr, void SvxNumberFormatShell::MakePreviewString( const String& rFormatStr,
String& rPreviewStr, String& rPreviewStr,
Color& rFontColor ) Color*& rpFontColor )
{ {
Color* pColor = NULL; rpFontColor = NULL;
ULONG nExistingFormat = pFormatter->GetEntryKey( rFormatStr, eCurLanguage ); ULONG nExistingFormat = pFormatter->GetEntryKey( rFormatStr, eCurLanguage );
if ( nExistingFormat == NUMBERFORMAT_ENTRY_NOT_FOUND ) if ( nExistingFormat == NUMBERFORMAT_ENTRY_NOT_FOUND )
...@@ -496,7 +500,7 @@ void SvxNumberFormatShell::MakePreviewString( const String& rFormatStr, ...@@ -496,7 +500,7 @@ void SvxNumberFormatShell::MakePreviewString( const String& rFormatStr,
// real preview - not implemented in NumberFormatter for text formats // real preview - not implemented in NumberFormatter for text formats
pFormatter->GetPreviewString( rFormatStr, nValNum, rPreviewStr, pFormatter->GetPreviewString( rFormatStr, nValNum, rPreviewStr,
&pColor, eCurLanguage ); &rpFontColor, eCurLanguage );
} }
else else
{ {
...@@ -507,16 +511,11 @@ void SvxNumberFormatShell::MakePreviewString( const String& rFormatStr, ...@@ -507,16 +511,11 @@ void SvxNumberFormatShell::MakePreviewString( const String& rFormatStr,
( aValStr.Len() && ( pFormatter->GetType(nExistingFormat) & NUMBERFORMAT_TEXT ) ) ); ( aValStr.Len() && ( pFormatter->GetType(nExistingFormat) & NUMBERFORMAT_TEXT ) ) );
if ( bUseText ) if ( bUseText )
pFormatter->GetOutputString( aValStr, nExistingFormat, pFormatter->GetOutputString( aValStr, nExistingFormat,
rPreviewStr, &pColor ); rPreviewStr, &rpFontColor );
else else
pFormatter->GetOutputString( nValNum, nExistingFormat, 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* ...@@ -577,12 +576,13 @@ sal_Bool SvxNumberFormatShell::FindEntry( const String& rFmtString, sal_uInt32*
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
void SvxNumberFormatShell::GetInitSettings( sal_uInt16& nCatLbPos, void SvxNumberFormatShell::GetInitSettings(
LanguageType& rLangType, sal_uInt16& nCatLbPos,
sal_uInt16& nFmtLbSelPos, LanguageType& rLangType,
SvStrings& rFmtEntries, sal_uInt16& nFmtLbSelPos,
String& rPrevString, SvStrings& rFmtEntries,
Color& rPrevColor ) String& rPrevString,
Color*& rpPrevColor )
{ {
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Vorbedingung: Zahlenformatierer gefunden // Vorbedingung: Zahlenformatierer gefunden
...@@ -612,7 +612,7 @@ void SvxNumberFormatShell::GetInitSettings( sal_uInt16& nCatLbPos, ...@@ -612,7 +612,7 @@ void SvxNumberFormatShell::GetInitSettings( sal_uInt16& nCatLbPos,
DBG_ASSERT( nSelPos != SELPOS_NONE, "Leere Formatliste!" ); DBG_ASSERT( nSelPos != SELPOS_NONE, "Leere Formatliste!" );
nFmtLbSelPos = (nSelPos != SELPOS_NONE) ? (sal_uInt16)nSelPos : 0; 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 ...@@ -737,7 +737,6 @@ short SvxNumberFormatShell::FillEListWithFormats_Impl( SvStrings& rList,short nS
String aNewFormNInfo; String aNewFormNInfo;
String aPrevString; String aPrevString;
String a2PrevString; String a2PrevString;
Color aColor;
short nMyCat = SELPOS_NONE; short nMyCat = SELPOS_NONE;
short nIq=0; short nIq=0;
...@@ -784,7 +783,6 @@ short SvxNumberFormatShell::FillEListWithDateTime_Impl( SvStrings& rList,short n ...@@ -784,7 +783,6 @@ short SvxNumberFormatShell::FillEListWithDateTime_Impl( SvStrings& rList,short n
String aNewFormNInfo; String aNewFormNInfo;
String aPrevString; String aPrevString;
String a2PrevString; String a2PrevString;
Color aColor;
short nMyCat = SELPOS_NONE; short nMyCat = SELPOS_NONE;
short nIq=0; short nIq=0;
...@@ -869,7 +867,6 @@ short SvxNumberFormatShell::FillEListWithSysCurrencys( SvStrings& rList,short nS ...@@ -869,7 +867,6 @@ short SvxNumberFormatShell::FillEListWithSysCurrencys( SvStrings& rList,short nS
String aNewFormNInfo; String aNewFormNInfo;
String aPrevString; String aPrevString;
String a2PrevString; String a2PrevString;
Color aColor;
nCurCurrencyEntryPos=0; nCurCurrencyEntryPos=0;
...@@ -965,7 +962,6 @@ short SvxNumberFormatShell::FillEListWithUserCurrencys( SvStrings& rList,short n ...@@ -965,7 +962,6 @@ short SvxNumberFormatShell::FillEListWithUserCurrencys( SvStrings& rList,short n
String aNewFormNInfo; String aNewFormNInfo;
String aPrevString; String aPrevString;
String a2PrevString; String a2PrevString;
Color aColor;
short nMyCat = SELPOS_NONE; short nMyCat = SELPOS_NONE;
short nIq=0; short nIq=0;
...@@ -1155,8 +1151,6 @@ short SvxNumberFormatShell::FillEListWithUsD_Impl( SvStrings& rList, sal_uInt16 ...@@ -1155,8 +1151,6 @@ short SvxNumberFormatShell::FillEListWithUsD_Impl( SvStrings& rList, sal_uInt16
String aNewFormNInfo; String aNewFormNInfo;
String aPrevString; String aPrevString;
String a2PrevString; String a2PrevString;
Color aColor;
short nMyCat = SELPOS_NONE; short nMyCat = SELPOS_NONE;
short nIq=0; short nIq=0;
...@@ -1204,26 +1198,18 @@ short SvxNumberFormatShell::FillEListWithUsD_Impl( SvStrings& rList, sal_uInt16 ...@@ -1204,26 +1198,18 @@ short SvxNumberFormatShell::FillEListWithUsD_Impl( SvStrings& rList, sal_uInt16
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
void SvxNumberFormatShell::GetPreviewString_Impl( String& rString, void SvxNumberFormatShell::GetPreviewString_Impl( String& rString, Color*& rpColor )
Color& rColor )
{ {
Color* pColor = NULL; rpColor = NULL;
// #50441# if a string was set in addition to the value, use it for text formats // #50441# if a string was set in addition to the value, use it for text formats
BOOL bUseText = ( eValType == SVX_VALUE_TYPE_STRING || BOOL bUseText = ( eValType == SVX_VALUE_TYPE_STRING ||
( aValStr.Len() && ( pFormatter->GetType(nCurFormatKey) & NUMBERFORMAT_TEXT ) ) ); ( aValStr.Len() && ( pFormatter->GetType(nCurFormatKey) & NUMBERFORMAT_TEXT ) ) );
if ( bUseText ) if ( bUseText )
pFormatter->GetOutputString( aValStr, nCurFormatKey, pFormatter->GetOutputString( aValStr, nCurFormatKey, rString, &rpColor );
rString, &pColor );
else else
pFormatter->GetOutputString( nValNum, nCurFormatKey, pFormatter->GetOutputString( nValNum, nCurFormatKey, rString, &rpColor );
rString, &pColor );
if ( pColor )
rColor = *pColor;
else
rColor = Color( COL_BLACK );
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
...@@ -1311,20 +1297,16 @@ void SvxNumberFormatShell::CategoryToPos_Impl( short nCategory, sal_uInt16& rPos ...@@ -1311,20 +1297,16 @@ void SvxNumberFormatShell::CategoryToPos_Impl( short nCategory, sal_uInt16& rPos
#* #*
#************************************************************************/ #************************************************************************/
void SvxNumberFormatShell::MakePrevStringFromVal( const String& rFormatStr, void SvxNumberFormatShell::MakePrevStringFromVal(
String& rPreviewStr, const String& rFormatStr,
Color& rFontColor, String& rPreviewStr,
double nValue) Color*& rpFontColor,
double nValue)
{ {
Color* pColor = NULL; rpFontColor = NULL;
pFormatter->GetPreviewString( rFormatStr, nValue, rPreviewStr, &rpFontColor, eCurLanguage );
pFormatter->GetPreviewString( rFormatStr, nValue, rPreviewStr,
&pColor, eCurLanguage );
if ( pColor )
rFontColor = *pColor;
else
rFontColor = Color( COL_BLACK );
} }
/************************************************************************* /*************************************************************************
#* Member: GetComment4Entry Datum:30.10.97 #* 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