diff options
author | Michael Meeks <michael.meeks@suse.com> | 2011-09-26 22:00:40 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2011-09-27 12:23:09 +0100 |
commit | 3d3c70f969d7305ed1712e85c0979772074a4ed2 (patch) | |
tree | d5117b50b74b0a6effe10f313babbce762bb44b9 /cui | |
parent | 1b5bcb6562abc4fe684fe4e046bde93df1af3d12 (diff) |
more ColorTable to List cleanup, and abstraction of load/save
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/inc/cuitabarea.hxx | 110 | ||||
-rw-r--r-- | cui/source/inc/cuitabline.hxx | 38 | ||||
-rw-r--r-- | cui/source/tabpages/tabarea.cxx | 50 | ||||
-rw-r--r-- | cui/source/tabpages/tabline.cxx | 30 | ||||
-rw-r--r-- | cui/source/tabpages/tabstpge.cxx | 2 | ||||
-rw-r--r-- | cui/source/tabpages/tparea.cxx | 34 | ||||
-rw-r--r-- | cui/source/tabpages/tpbitmap.cxx | 19 | ||||
-rw-r--r-- | cui/source/tabpages/tpcolor.cxx | 563 | ||||
-rw-r--r-- | cui/source/tabpages/tpgradnt.cxx | 19 | ||||
-rw-r--r-- | cui/source/tabpages/tphatch.cxx | 18 | ||||
-rw-r--r-- | cui/source/tabpages/tpline.cxx | 26 | ||||
-rw-r--r-- | cui/source/tabpages/tpshadow.cxx | 26 |
12 files changed, 443 insertions, 492 deletions
diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx index 6bec35fa33e1..69102bafe43b 100644 --- a/cui/source/inc/cuitabarea.hxx +++ b/cui/source/inc/cuitabarea.hxx @@ -39,8 +39,8 @@ class SvxAreaTabDialog : public SfxTabDialog private: SdrModel* mpDrawModel; - XColorListRef mpColorTab; - XColorListRef mpNewColorTab; + XColorListRef mpColorList; + XColorListRef mpNewColorList; XGradientListRef mpGradientList; XGradientListRef mpNewGradientList; XHatchListRef mpHatchingList; @@ -50,7 +50,7 @@ private: const SfxItemSet& mrOutAttrs; - ChangeType mnColorTableState; + ChangeType mnColorListState; ChangeType mnBitmapListState; ChangeType mnGradientListState; ChangeType mnHatchingListState; @@ -75,10 +75,10 @@ public: const SdrView* pSdrView = NULL ); ~SvxAreaTabDialog(); - void SetNewColorTable( XColorListRef pColTab ) - { mpNewColorTab = pColTab; } - XColorListRef GetNewColorTable() const { return mpNewColorTab; } - const XColorListRef GetColorList() const { return mpColorTab; } + void SetNewColorList( XColorListRef pColTab ) + { mpNewColorList = pColTab; } + XColorListRef GetNewColorList() const { return mpNewColorList; } + const XColorListRef GetColorList() const { return mpColorList; } void SetNewGradientList( XGradientListRef pGrdLst) { mpNewGradientList = pGrdLst; } @@ -228,12 +228,12 @@ private: const SfxItemSet& rOutAttrs; RECT_POINT eRP; - XColorListRef pColorTab; + XColorListRef pColorList; XGradientListRef pGradientList; XHatchListRef pHatchingList; XBitmapListRef pBitmapList; - ChangeType* pnColorTableState; + ChangeType* pnColorListState; ChangeType* pnBitmapListState; ChangeType* pnGradientListState; ChangeType* pnHatchingListState; @@ -283,7 +283,7 @@ public: virtual int DeactivatePage( SfxItemSet* pSet ); virtual void PointChanged( Window* pWindow, RECT_POINT eRP ); - void SetColorList( XColorListRef pColTab ) { pColorTab = pColTab; } + void SetColorList( XColorListRef pColTab ) { pColorList = pColTab; } void SetGradientList( XGradientListRef pGrdLst) { pGradientList = pGrdLst; } void SetHatchingList( XHatchListRef pHtchLst) @@ -295,7 +295,7 @@ public: void SetPos( sal_uInt16 nInPos ) { nPos = nInPos; } void SetAreaTP( sal_Bool* pIn ) { pbAreaTP = pIn; } virtual void PageCreated (SfxAllItemSet aSet); - void SetColorChgd( ChangeType* pIn ) { pnColorTableState = pIn; } + void SetColorChgd( ChangeType* pIn ) { pnColorListState = pIn; } void SetGrdChgd( ChangeType* pIn ) { pnGradientListState = pIn; } void SetHtchChgd( ChangeType* pIn ) { pnHatchingListState = pIn; } void SetBmpChgd( ChangeType* pIn ) { pnBitmapListState = pIn; } @@ -323,8 +323,8 @@ private: const SfxItemSet& rOutAttrs; RECT_POINT eRP; - XColorListRef pColorTab; - ChangeType* pnColorTableState; + XColorListRef pColorList; + ChangeType* pnColorListState; sal_uInt16 nPageType; sal_uInt16 nDlgType; sal_uInt16* pPos; @@ -355,11 +355,11 @@ public: virtual int DeactivatePage( SfxItemSet* pSet ); virtual void PointChanged( Window* pWindow, RECT_POINT eRP ); - void SetColorList( XColorListRef pColTab ) { pColorTab = pColTab; } + void SetColorList( XColorListRef pColTab ) { pColorList = pColTab; } void SetPageType( sal_uInt16 nInType ) { nPageType = nInType; } void SetDlgType( sal_uInt16 nInType ) { nDlgType = nInType; } void SetAreaTP( sal_Bool* pIn ) { pbAreaTP = pIn; } - void SetColorChgd( ChangeType* pIn ) { pnColorTableState = pIn; } + void SetColorChgd( ChangeType* pIn ) { pnColorListState = pIn; } virtual void PageCreated (SfxAllItemSet aSet); void DisablePage( sal_Bool bIn ) { bDisable = bIn; } }; @@ -399,11 +399,11 @@ private: const SfxItemSet& rOutAttrs; - XColorListRef pColorTab; + XColorListRef pColorList; XGradientListRef pGradientList; ChangeType* pnGradientListState; - ChangeType* pnColorTableState; + ChangeType* pnColorListState; sal_uInt16* pPageType; sal_uInt16* pDlgType; sal_uInt16* pPos; @@ -440,7 +440,7 @@ public: virtual void ActivatePage( const SfxItemSet& rSet ); virtual int DeactivatePage( SfxItemSet* pSet ); - void SetColorList( XColorListRef pColTab ) { pColorTab = pColTab; } + void SetColorList( XColorListRef pColTab ) { pColorList = pColTab; } void SetGradientList( XGradientListRef pGrdLst) { pGradientList = pGrdLst; } @@ -450,7 +450,7 @@ public: void SetAreaTP( sal_Bool* pIn ) { pbAreaTP = pIn; } void SetGrdChgd( ChangeType* pIn ) { pnGradientListState = pIn; } - void SetColorChgd( ChangeType* pIn ) { pnColorTableState = pIn; } + void SetColorChgd( ChangeType* pIn ) { pnColorListState = pIn; } }; /************************************************************************/ @@ -482,11 +482,11 @@ private: const SfxItemSet& rOutAttrs; RECT_POINT eRP; - XColorListRef pColorTab; + XColorListRef pColorList; XHatchListRef pHatchingList; ChangeType* pnHatchingListState; - ChangeType* pnColorTableState; + ChangeType* pnColorListState; sal_uInt16* pPageType; sal_uInt16* pDlgType; sal_uInt16* pPos; @@ -526,7 +526,7 @@ public: virtual void PointChanged( Window* pWindow, RECT_POINT eRP ); - void SetColorList( XColorListRef pColTab ) { pColorTab = pColTab; } + void SetColorList( XColorListRef pColTab ) { pColorList = pColTab; } void SetHatchingList( XHatchListRef pHtchLst) { pHatchingList = pHtchLst; } @@ -536,7 +536,7 @@ public: void SetAreaTP( sal_Bool* pIn ) { pbAreaTP = pIn; } void SetHtchChgd( ChangeType* pIn ) { pnHatchingListState = pIn; } - void SetColorChgd( ChangeType* pIn ) { pnColorTableState = pIn; } + void SetColorChgd( ChangeType* pIn ) { pnColorListState = pIn; } virtual void DataChanged( const DataChangedEvent& rDCEvt ); }; @@ -570,11 +570,11 @@ private: const SfxItemSet& rOutAttrs; - XColorListRef pColorTab; + XColorListRef pColorList; XBitmapListRef pBitmapList; ChangeType* pnBitmapListState; - ChangeType* pnColorTableState; + ChangeType* pnColorListState; sal_uInt16* pPageType; sal_uInt16* pDlgType; sal_uInt16* pPos; @@ -616,7 +616,7 @@ public: virtual void PointChanged( Window* pWindow, RECT_POINT eRP ); - void SetColorList( XColorListRef pColTab ) { pColorTab = pColTab; } + void SetColorList( XColorListRef pColTab ) { pColorList = pColTab; } void SetBitmapList( XBitmapListRef pBmpLst) { pBitmapList = pBmpLst; } void SetPageType( sal_uInt16* pInType ) { pPageType = pInType; } @@ -625,7 +625,7 @@ public: void SetAreaTP( sal_Bool* pIn ) { pbAreaTP = pIn; } void SetBmpChgd( ChangeType* pIn ) { pnBitmapListState = pIn; } - void SetColorChgd( ChangeType* pIn ) { pnColorTableState = pIn; } + void SetColorChgd( ChangeType* pIn ) { pnColorListState = pIn; } /** Return a label that is associated with the given control. This label is used to the determine the name for the control. @@ -640,18 +640,34 @@ public: // Load save embed functionality class SvxLoadSaveEmbed { - Window *pTopDlg; - CheckBox aBoxEmbed; + XPropertyListType meType; + XOutdevItemPool* mpXPool; + + Window *mpTopDlg; + CheckBox maBoxEmbed; + ImageButton maBtnLoad; + ImageButton maBtnSave; + FixedText maTableName; + DECL_LINK( EmbedToggleHdl_Impl, void * ); -public: // FIXME: privatise these members ... - ImageButton aBtnLoad; - ImageButton aBtnSave; + DECL_LINK( ClickLoadHdl_Impl, void * ); + DECL_LINK( ClickSaveHdl_Impl, void * ); +public: SvxLoadSaveEmbed( Window *pParent, const ResId &aLoad, - const ResId &aSave, const ResId &aEmbed ); + const ResId &aSave, const ResId &aEmbed, + const ResId &aTableName, + XPropertyListType t, XOutdevItemPool* mpXPool ); XPropertyListRef GetList(); void HideLoadSaveEmbed(); bool GetEmbed(); void SetEmbed( bool bEmbed ); + void UpdateTableName(); + void EnableSave( bool bCanSave ); + + virtual bool IsModified() = 0; + virtual void SetModified(bool bIsModified) = 0; + virtual void AddState(ChangeType nState) = 0; + virtual void Update(bool bLoaded) = 0; }; /************************************************************************/ @@ -668,7 +684,6 @@ private: FixedText aFtColor; ColorLB aLbColor; - FixedText aTableNameFT; ValueSet aValSetColorList; SvxXRectPreview aCtlPreviewOld; @@ -692,15 +707,14 @@ private: const SfxItemSet& rOutAttrs; - XColorListRef pColorTab; + XColorListRef pColorList; - ChangeType* pnColorTableState; + ChangeType* pnColorListState; sal_uInt16* pPageType; sal_uInt16* pDlgType; sal_uInt16* pPos; sal_Bool* pbAreaTP; - XOutdevItemPool* pXPool; XFillStyleItem aXFStyleItem; XFillColorItem aXFillColorItem; XFillAttrSetItem aXFillAttr; @@ -735,6 +749,7 @@ private: long CheckChanges_Impl(); #endif + void UpdateModified(); public: SvxColorTabPage( Window* pParent, const SfxItemSet& rInAttrs ); @@ -747,16 +762,33 @@ public: virtual void ActivatePage( const SfxItemSet& rSet ); virtual int DeactivatePage( SfxItemSet* pSet ); - void SetColorList( XColorListRef pColTab ) { pColorTab = pColTab; } + void SetColorList( XColorListRef pColTab ) { pColorList = pColTab; } void SetPageType( sal_uInt16* pInType ) { pPageType = pInType; } void SetDlgType( sal_uInt16* pInType ) { pDlgType = pInType; } void SetPos( sal_uInt16* pInPos ) { pPos = pInPos; } void SetAreaTP( sal_Bool* pIn ) { pbAreaTP = pIn; } - void SetColorChgd( ChangeType* pIn ) { pnColorTableState = pIn; } + void SetColorChgd( ChangeType* pIn ) { pnColorListState = pIn; } virtual void FillUserData(); + + virtual bool IsModified() + { + return *pnColorListState & CT_MODIFIED; + } + virtual void SetModified(bool bIsModified) + { + if (bIsModified) + *pnColorListState |= CT_MODIFIED; + else + *pnColorListState &= ~CT_MODIFIED; + } + virtual void AddState(ChangeType nState) + { + *pnColorListState |= nState; + } + virtual void Update(bool bLoaded); }; #endif // _CUI_TAB_AREA_HXX diff --git a/cui/source/inc/cuitabline.hxx b/cui/source/inc/cuitabline.hxx index 8d8d456f7020..901d9347f7c8 100644 --- a/cui/source/inc/cuitabline.hxx +++ b/cui/source/inc/cuitabline.hxx @@ -40,8 +40,8 @@ private: const SfxItemSet& rOutAttrs; - XColorListRef pColorTab; - XColorListRef mpNewColorTab; + XColorListRef pColorList; + XColorListRef mpNewColorList; XDashListRef pDashList; XDashListRef pNewDashList; XLineEndListRef pLineEndList; @@ -50,7 +50,7 @@ private: ChangeType nLineEndListState; ChangeType nDashListState; - ChangeType mnColorTableState; + ChangeType mnColorListState; sal_uInt16 nPageType; sal_uInt16 nDlgType; @@ -84,16 +84,12 @@ public: XLineEndListRef GetNewLineEndList() const { return pNewLineEndList; } XLineEndListRef GetLineEndList() const { return pLineEndList; } - void SetNewColorTable( XColorListRef pColTab ) { mpNewColorTab = pColTab; } - XColorListRef GetNewColorTable() const { return mpNewColorTab; } - XColorListRef GetColorList() const { return pColorTab; } + void SetNewColorList( XColorListRef pColTab ) { mpNewColorList = pColTab; } + XColorListRef GetNewColorList() const { return mpNewColorList; } + XColorListRef GetColorList() const { return pColorList; } }; -/************************************************************************* -|* -|* Linien-Tab-Page -|* -\************************************************************************/ +/*************************************************************************/ class SvxBmpItemInfo; typedef ::std::vector< SvxBmpItemInfo* > SvxBmpItemInfoList; @@ -165,13 +161,13 @@ private: XLineAttrSetItem aXLineAttr; SfxItemSet& rXLSet; - XColorListRef pColorTab; + XColorListRef pColorList; XDashListRef pDashList; XLineEndListRef pLineEndList; ChangeType* pnLineEndListState; ChangeType* pnDashListState; - ChangeType* pnColorTableState; + ChangeType* pnColorListState; sal_uInt16 nPageType; sal_uInt16 nDlgType; sal_uInt16* pPosDashLb; @@ -225,7 +221,7 @@ public: virtual void FillUserData(); - void SetColorList( XColorListRef pColTab ) { pColorTab = pColTab; } + void SetColorList( XColorListRef pColTab ) { pColorList = pColTab; } void SetDashList( XDashListRef pDshLst ) { pDashList = pDshLst; } void SetLineEndList( XLineEndListRef pLneEndLst) { pLineEndList = pLneEndLst; } void SetObjSelected( sal_Bool bHasObj ) { bObjSelected = bHasObj; } @@ -237,17 +233,13 @@ public: void SetLineEndChgd( ChangeType* pIn ) { pnLineEndListState = pIn; } void SetDashChgd( ChangeType* pIn ) { pnDashListState = pIn; } - void SetColorChgd( ChangeType* pIn ) { pnColorTableState = pIn; } + void SetColorChgd( ChangeType* pIn ) { pnColorListState = pIn; } virtual void PageCreated (SfxAllItemSet aSet); virtual void DataChanged( const DataChangedEvent& rDCEvt ); }; -/************************************************************************* -|* -|* Linien-Definitions-Tab-Page -|* -\************************************************************************/ +/*************************************************************************/ class SvxLineDefTabPage : public SfxTabPage { @@ -341,11 +333,7 @@ public: virtual void DataChanged( const DataChangedEvent& rDCEvt ); }; -/************************************************************************* -|* -|* Linienenden-Definitions-Tab-Page -|* -\************************************************************************/ +/*************************************************************************/ class SvxLineEndDefTabPage : public SfxTabPage { diff --git a/cui/source/tabpages/tabarea.cxx b/cui/source/tabpages/tabarea.cxx index e7e4d97269ff..f4634c08358a 100644 --- a/cui/source/tabpages/tabarea.cxx +++ b/cui/source/tabpages/tabarea.cxx @@ -67,8 +67,8 @@ SvxAreaTabDialog::SvxAreaTabDialog SfxTabDialog( pParent, CUI_RES( RID_SVXDLG_AREA ), pAttr ), mpDrawModel ( pModel ), - mpColorTab ( pModel->GetColorList() ), - mpNewColorTab ( pModel->GetColorList() ), + mpColorList ( pModel->GetColorList() ), + mpNewColorList ( pModel->GetColorList() ), mpGradientList ( pModel->GetGradientList() ), mpNewGradientList ( pModel->GetGradientList() ), mpHatchingList ( pModel->GetHatchList() ), @@ -76,7 +76,7 @@ SvxAreaTabDialog::SvxAreaTabDialog mpBitmapList ( pModel->GetBitmapList() ), mpNewBitmapList ( pModel->GetBitmapList() ), mrOutAttrs ( *pAttr ), - mnColorTableState ( CT_NONE ), + mnColorListState ( CT_NONE ), mnBitmapListState ( CT_NONE ), mnGradientListState ( CT_NONE ), mnHatchingListState ( CT_NONE ), @@ -114,15 +114,15 @@ SvxAreaTabDialog::~SvxAreaTabDialog() void SvxAreaTabDialog::SavePalettes() { SfxObjectShell* pShell = SfxObjectShell::Current(); - if( mpNewColorTab != mpDrawModel->GetColorList() ) + if( mpNewColorList != mpDrawModel->GetColorList() ) { - mpDrawModel->SetPropertyList( static_cast<XPropertyList *>(mpNewColorTab.get()) ); - SvxColorListItem aColorTableItem( mpNewColorTab, SID_COLOR_TABLE ); + mpDrawModel->SetPropertyList( static_cast<XPropertyList *>(mpNewColorList.get()) ); + SvxColorListItem aColorListItem( mpNewColorList, SID_COLOR_TABLE ); if ( pShell ) - pShell->PutItem( aColorTableItem ); + pShell->PutItem( aColorListItem ); else - mpDrawModel->GetItemPool().Put(aColorTableItem,SID_COLOR_TABLE); - mpColorTab = mpDrawModel->GetColorList(); + mpDrawModel->GetItemPool().Put(aColorListItem,SID_COLOR_TABLE); + mpColorList = mpDrawModel->GetColorList(); } if( mpNewGradientList != mpDrawModel->GetGradientList() ) { @@ -202,12 +202,12 @@ void SvxAreaTabDialog::SavePalettes() } } - if( mnColorTableState & CT_MODIFIED ) + if( mnColorListState & CT_MODIFIED ) { - mpColorTab->SetPath( aPath ); - mpColorTab->Save(); + mpColorList->SetPath( aPath ); + mpColorList->Save(); - SvxColorListItem aItem( mpColorTab, SID_COLOR_TABLE ); + SvxColorListItem aItem( mpColorList, SID_COLOR_TABLE ); // ToolBoxControls werden benachrichtigt: if ( pShell ) pShell->PutItem( aItem ); @@ -247,7 +247,7 @@ void SvxAreaTabDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) switch( nId ) { case RID_SVXPAGE_AREA: - ( (SvxAreaTabPage&) rPage ).SetColorList( mpColorTab ); + ( (SvxAreaTabPage&) rPage ).SetColorList( mpColorList ); ( (SvxAreaTabPage&) rPage ).SetGradientList( mpGradientList ); ( (SvxAreaTabPage&) rPage ).SetHatchingList( mpHatchingList ); ( (SvxAreaTabPage&) rPage ).SetBitmapList( mpBitmapList ); @@ -258,7 +258,7 @@ void SvxAreaTabDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) ( (SvxAreaTabPage&) rPage ).SetGrdChgd( &mnGradientListState ); ( (SvxAreaTabPage&) rPage ).SetHtchChgd( &mnHatchingListState ); ( (SvxAreaTabPage&) rPage ).SetBmpChgd( &mnBitmapListState ); - ( (SvxAreaTabPage&) rPage ).SetColorChgd( &mnColorTableState ); + ( (SvxAreaTabPage&) rPage ).SetColorChgd( &mnColorListState ); ( (SvxAreaTabPage&) rPage ).Construct(); // ActivatePage() wird das erste mal nicht gerufen ( (SvxAreaTabPage&) rPage ).ActivatePage( mrOutAttrs ); @@ -267,58 +267,58 @@ void SvxAreaTabDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) case RID_SVXPAGE_SHADOW: { - ( (SvxShadowTabPage&) rPage ).SetColorList( mpColorTab ); + ( (SvxShadowTabPage&) rPage ).SetColorList( mpColorList ); ( (SvxShadowTabPage&) rPage ).SetPageType( mnPageType ); ( (SvxShadowTabPage&) rPage ).SetDlgType( mnDlgType ); ( (SvxShadowTabPage&) rPage ).SetAreaTP( &mbAreaTP ); - ( (SvxShadowTabPage&) rPage ).SetColorChgd( &mnColorTableState ); + ( (SvxShadowTabPage&) rPage ).SetColorChgd( &mnColorListState ); ( (SvxShadowTabPage&) rPage ).Construct(); } break; case RID_SVXPAGE_GRADIENT: - ( (SvxGradientTabPage&) rPage ).SetColorList( mpColorTab ); + ( (SvxGradientTabPage&) rPage ).SetColorList( mpColorList ); ( (SvxGradientTabPage&) rPage ).SetGradientList( mpGradientList ); ( (SvxGradientTabPage&) rPage ).SetPageType( &mnPageType ); ( (SvxGradientTabPage&) rPage ).SetDlgType( &mnDlgType ); ( (SvxGradientTabPage&) rPage ).SetPos( &mnPos ); ( (SvxGradientTabPage&) rPage ).SetAreaTP( &mbAreaTP ); ( (SvxGradientTabPage&) rPage ).SetGrdChgd( &mnGradientListState ); - ( (SvxGradientTabPage&) rPage ).SetColorChgd( &mnColorTableState ); + ( (SvxGradientTabPage&) rPage ).SetColorChgd( &mnColorListState ); ( (SvxGradientTabPage&) rPage ).Construct(); break; case RID_SVXPAGE_HATCH: - ( (SvxHatchTabPage&) rPage ).SetColorList( mpColorTab ); + ( (SvxHatchTabPage&) rPage ).SetColorList( mpColorList ); ( (SvxHatchTabPage&) rPage ).SetHatchingList( mpHatchingList ); ( (SvxHatchTabPage&) rPage ).SetPageType( &mnPageType ); ( (SvxHatchTabPage&) rPage ).SetDlgType( &mnDlgType ); ( (SvxHatchTabPage&) rPage ).SetPos( &mnPos ); ( (SvxHatchTabPage&) rPage ).SetAreaTP( &mbAreaTP ); ( (SvxHatchTabPage&) rPage ).SetHtchChgd( &mnHatchingListState ); - ( (SvxHatchTabPage&) rPage ).SetColorChgd( &mnColorTableState ); + ( (SvxHatchTabPage&) rPage ).SetColorChgd( &mnColorListState ); ( (SvxHatchTabPage&) rPage ).Construct(); break; case RID_SVXPAGE_BITMAP: - ( (SvxBitmapTabPage&) rPage ).SetColorList( mpColorTab ); + ( (SvxBitmapTabPage&) rPage ).SetColorList( mpColorList ); ( (SvxBitmapTabPage&) rPage ).SetBitmapList( mpBitmapList ); ( (SvxBitmapTabPage&) rPage ).SetPageType( &mnPageType ); ( (SvxBitmapTabPage&) rPage ).SetDlgType( &mnDlgType ); ( (SvxBitmapTabPage&) rPage ).SetPos( &mnPos ); ( (SvxBitmapTabPage&) rPage ).SetAreaTP( &mbAreaTP ); ( (SvxBitmapTabPage&) rPage ).SetBmpChgd( &mnBitmapListState ); - ( (SvxBitmapTabPage&) rPage ).SetColorChgd( &mnColorTableState ); + ( (SvxBitmapTabPage&) rPage ).SetColorChgd( &mnColorListState ); ( (SvxBitmapTabPage&) rPage ).Construct(); break; case RID_SVXPAGE_COLOR: - ( (SvxColorTabPage&) rPage ).SetColorList( mpColorTab ); + ( (SvxColorTabPage&) rPage ).SetColorList( mpColorList ); ( (SvxColorTabPage&) rPage ).SetPageType( &mnPageType ); ( (SvxColorTabPage&) rPage ).SetDlgType( &mnDlgType ); ( (SvxColorTabPage&) rPage ).SetPos( &mnPos ); ( (SvxColorTabPage&) rPage ).SetAreaTP( &mbAreaTP ); - ( (SvxColorTabPage&) rPage ).SetColorChgd( &mnColorTableState ); + ( (SvxColorTabPage&) rPage ).SetColorChgd( &mnColorListState ); ( (SvxColorTabPage&) rPage ).Construct(); break; diff --git a/cui/source/tabpages/tabline.cxx b/cui/source/tabpages/tabline.cxx index 46f26b42affc..362026520ce3 100644 --- a/cui/source/tabpages/tabline.cxx +++ b/cui/source/tabpages/tabline.cxx @@ -70,8 +70,8 @@ SvxLineTabDialog::SvxLineTabDialog pDrawModel ( pModel ), pObj ( pSdrObj ), rOutAttrs ( *pAttr ), - pColorTab ( pModel->GetColorList() ), - mpNewColorTab ( pModel->GetColorList() ), + pColorList ( pModel->GetColorList() ), + mpNewColorList ( pModel->GetColorList() ), pDashList ( pModel->GetDashList() ), pNewDashList ( pModel->GetDashList() ), pLineEndList ( pModel->GetLineEndList() ), @@ -79,7 +79,7 @@ SvxLineTabDialog::SvxLineTabDialog bObjSelected ( bHasObj ), nLineEndListState( CT_NONE ), nDashListState( CT_NONE ), - mnColorTableState( CT_NONE ), + mnColorListState( CT_NONE ), nPageType( 0 ), // wird hier in erster Linie benutzt, um mit FillItemSet // die richtigen Attribute zu erhalten ( noch Fragen? ) nDlgType( 0 ), @@ -135,12 +135,12 @@ SvxLineTabDialog::~SvxLineTabDialog() void SvxLineTabDialog::SavePalettes() { SfxObjectShell* pShell = SfxObjectShell::Current(); - if( mpNewColorTab != pDrawModel->GetColorList() ) + if( mpNewColorList != pDrawModel->GetColorList() ) { - pDrawModel->SetPropertyList( static_cast<XPropertyList *>(mpNewColorTab.get()) ); + pDrawModel->SetPropertyList( static_cast<XPropertyList *>(mpNewColorList.get()) ); if ( pShell ) - pShell->PutItem( SvxColorListItem( mpNewColorTab, SID_COLOR_TABLE ) ); - pColorTab = pDrawModel->GetColorList(); + pShell->PutItem( SvxColorListItem( mpNewColorList, SID_COLOR_TABLE ) ); + pColorList = pDrawModel->GetColorList(); } if( pNewDashList != pDrawModel->GetDashList() ) { @@ -181,14 +181,14 @@ void SvxLineTabDialog::SavePalettes() pShell->PutItem( SvxLineEndListItem( pLineEndList, SID_LINEEND_LIST ) ); } - if( mnColorTableState & CT_MODIFIED ) + if( mnColorListState & CT_MODIFIED ) { - pColorTab->SetPath( aPath ); - pColorTab->Save(); + pColorList->SetPath( aPath ); + pColorList->Save(); // ToolBoxControls werden benachrichtigt: if ( pShell ) - pShell->PutItem( SvxColorListItem( pColorTab, SID_COLOR_TABLE ) ); + pShell->PutItem( SvxColorListItem( pColorList, SID_COLOR_TABLE ) ); } } @@ -222,7 +222,7 @@ void SvxLineTabDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) switch( nId ) { case RID_SVXPAGE_LINE: - ( (SvxLineTabPage&) rPage ).SetColorList( pColorTab ); + ( (SvxLineTabPage&) rPage ).SetColorList( pColorList ); ( (SvxLineTabPage&) rPage ).SetDashList( pDashList ); ( (SvxLineTabPage&) rPage ).SetLineEndList( pLineEndList ); ( (SvxLineTabPage&) rPage ).SetDlgType( nDlgType ); @@ -233,7 +233,7 @@ void SvxLineTabDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) ( (SvxLineTabPage&) rPage ).SetLineEndChgd( &nLineEndListState ); ( (SvxLineTabPage&) rPage ).SetObjSelected( bObjSelected ); ( (SvxLineTabPage&) rPage ).Construct(); - ( (SvxLineTabPage&) rPage ).SetColorChgd( &mnColorTableState ); + ( (SvxLineTabPage&) rPage ).SetColorChgd( &mnColorListState ); // ActivatePage() wird das erste mal nicht gerufen ( (SvxLineTabPage&) rPage ).ActivatePage( rOutAttrs ); break; @@ -261,11 +261,11 @@ void SvxLineTabDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) case RID_SVXPAGE_SHADOW: { - ( (SvxShadowTabPage&) rPage ).SetColorList( pColorTab ); + ( (SvxShadowTabPage&) rPage ).SetColorList( pColorList ); ( (SvxShadowTabPage&) rPage ).SetPageType( nPageType ); ( (SvxShadowTabPage&) rPage ).SetDlgType( nDlgType ); ( (SvxShadowTabPage&) rPage ).SetAreaTP( &mbAreaTP ); - ( (SvxShadowTabPage&) rPage ).SetColorChgd( &mnColorTableState ); + ( (SvxShadowTabPage&) rPage ).SetColorChgd( &mnColorListState ); ( (SvxShadowTabPage&) rPage ).Construct(); } break; diff --git a/cui/source/tabpages/tabstpge.cxx b/cui/source/tabpages/tabstpge.cxx index e49a21fa33a1..b0f9cdea4ce2 100644 --- a/cui/source/tabpages/tabstpge.cxx +++ b/cui/source/tabpages/tabstpge.cxx @@ -151,7 +151,7 @@ SvxTabulatorTabPage::SvxTabulatorTabPage( Window* pParent, FieldUnit eFUnit = GetModuleFieldUnit( rAttr ); SetFieldUnit( aTabBox, eFUnit ); - // Buttons initialisieren + // initialize buttons aNewBtn.SetClickHdl( LINK( this,SvxTabulatorTabPage, NewHdl_Impl ) ); aDelBtn.SetClickHdl( LINK( this,SvxTabulatorTabPage, DelHdl_Impl ) ); aDelAllBtn.SetClickHdl( LINK( this,SvxTabulatorTabPage, DelAllHdl_Impl ) ); diff --git a/cui/source/tabpages/tparea.cxx b/cui/source/tabpages/tparea.cxx index 85e2ee99a105..c675255e70f7 100644 --- a/cui/source/tabpages/tparea.cxx +++ b/cui/source/tabpages/tparea.cxx @@ -655,7 +655,7 @@ SvxAreaTabPage::SvxAreaTabPage( Window* pParent, const SfxItemSet& rInAttrs ) : rOutAttrs ( rInAttrs ), - pColorTab( NULL ), + pColorList( NULL ), pGradientList( NULL ), pHatchingList( NULL ), pBitmapList( NULL ), @@ -782,8 +782,8 @@ SvxAreaTabPage::SvxAreaTabPage( Window* pParent, const SfxItemSet& rInAttrs ) : void SvxAreaTabPage::Construct() { // fill colortables / lists - aLbColor.Fill( pColorTab ); - aLbHatchBckgrdColor.Fill ( pColorTab ); + aLbColor.Fill( pColorList ); + aLbHatchBckgrdColor.Fill ( pColorList ); aLbGradient.Fill( pGradientList ); aLbHatching.Fill( pHatchingList ); @@ -805,7 +805,7 @@ void SvxAreaTabPage::ActivatePage( const SfxItemSet& rSet ) { *pbAreaTP = sal_True; - if( pColorTab.is() ) + if( pColorList.is() ) { sal_uInt16 _nPos = 0; // Bitmapliste @@ -870,16 +870,16 @@ void SvxAreaTabPage::ActivatePage( const SfxItemSet& rSet ) aLbGradient.SelectEntryPos( _nPos ); ModifyGradientHdl_Impl( this ); } - // ColorTable - if( *pnColorTableState ) + // ColorList + if( *pnColorListState ) { - if( *pnColorTableState & CT_CHANGED ) - pColorTab = ( (SvxAreaTabDialog*) DLGWIN )-> - GetNewColorTable(); + if( *pnColorListState & CT_CHANGED ) + pColorList = ( (SvxAreaTabDialog*) DLGWIN )-> + GetNewColorList(); // aLbColor _nPos = aLbColor.GetSelectEntryPos(); aLbColor.Clear(); - aLbColor.Fill( pColorTab ); + aLbColor.Fill( pColorList ); nCount = aLbColor.GetEntryCount(); if( nCount == 0 ) ; // This case should never occur @@ -893,7 +893,7 @@ void SvxAreaTabPage::ActivatePage( const SfxItemSet& rSet ) // Backgroundcolor of hatch _nPos = aLbHatchBckgrdColor.GetSelectEntryPos(); aLbHatchBckgrdColor.Clear(); - aLbHatchBckgrdColor.Fill( pColorTab ); + aLbHatchBckgrdColor.Fill( pColorList ); nCount = aLbHatchBckgrdColor.GetEntryCount(); if( nCount == 0 ) ; // This case should never occur @@ -980,7 +980,7 @@ int SvxAreaTabPage::DeactivatePage( SfxItemSet* _pSet ) nPageType = PT_COLOR; nPos = aLbColor.GetSelectEntryPos(); if( nPosOrig != nPos ) - *pnColorTableState |= CT_MODIFIED; + *pnColorListState |= CT_MODIFIED; } break; default: ;//prevent warning @@ -1859,9 +1859,9 @@ IMPL_LINK( SvxAreaTabPage, ClickColorHdl_Impl, void *, EMPTYARG ) // Text der Tabelle setzen String aString( CUI_RES( RID_SVXSTR_TABLE ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); - INetURLObject aURL( pColorTab->GetPath() ); + INetURLObject aURL( pColorList->GetPath() ); - aURL.Append( pColorTab->GetName() ); + aURL.Append( pColorList->GetName() ); DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); if( aURL.getBase().getLength() > 18 ) @@ -2518,7 +2518,7 @@ void SvxAreaTabPage::PointChanged( Window* pWindow, RECT_POINT eRcPt ) void SvxAreaTabPage::PageCreated (SfxAllItemSet aSet) { - SFX_ITEMSET_ARG (&aSet,pColorTabItem,SvxColorListItem,SID_COLOR_TABLE,sal_False); + SFX_ITEMSET_ARG (&aSet,pColorListItem,SvxColorListItem,SID_COLOR_TABLE,sal_False); SFX_ITEMSET_ARG (&aSet,pGradientListItem,SvxGradientListItem,SID_GRADIENT_LIST,sal_False); SFX_ITEMSET_ARG (&aSet,pHatchingListItem,SvxHatchListItem,SID_HATCH_LIST,sal_False); SFX_ITEMSET_ARG (&aSet,pBitmapListItem,SvxBitmapListItem,SID_BITMAP_LIST,sal_False); @@ -2526,8 +2526,8 @@ void SvxAreaTabPage::PageCreated (SfxAllItemSet aSet) SFX_ITEMSET_ARG (&aSet,pDlgTypeItem,SfxUInt16Item,SID_DLG_TYPE,sal_False); SFX_ITEMSET_ARG (&aSet,pPosItem,SfxUInt16Item,SID_TABPAGE_POS,sal_False); - if (pColorTabItem) - SetColorList(pColorTabItem->GetColorList()); + if (pColorListItem) + SetColorList(pColorListItem->GetColorList()); if (pGradientListItem) SetGradientList(pGradientListItem->GetGradientList()); if (pHatchingListItem) diff --git a/cui/source/tabpages/tpbitmap.cxx b/cui/source/tabpages/tpbitmap.cxx index 4d4ea337edb9..c15680efae8f 100644 --- a/cui/source/tabpages/tpbitmap.cxx +++ b/cui/source/tabpages/tpbitmap.cxx @@ -106,9 +106,6 @@ SvxBitmapTabPage::SvxBitmapTabPage aBitmapCtl ( this, aCtlPreview.GetSizePixel() ), rOutAttrs ( rInAttrs ), - pColorTab( NULL ), - pBitmapList( NULL ), - pXPool ( (XOutdevItemPool*) rInAttrs.GetPool() ), aXFStyleItem ( XFILL_BITMAP ), aXBitmapItem ( String(), XOBitmap() ), @@ -158,7 +155,7 @@ SvxBitmapTabPage::SvxBitmapTabPage void SvxBitmapTabPage::Construct() { // Farbtabellen - aLbColor.Fill( pColorTab ); + aLbColor.Fill( pColorList ); aLbBackgroundColor.CopyEntries( aLbColor ); // Bitmaptabelle @@ -176,19 +173,19 @@ void SvxBitmapTabPage::ActivatePage( const SfxItemSet& ) { *pbAreaTP = sal_False; - if( pColorTab.is() ) + if( pColorList.is() ) { - // ColorTable - if( *pnColorTableState & CT_CHANGED || - *pnColorTableState & CT_MODIFIED ) + // ColorList + if( *pnColorListState & CT_CHANGED || + *pnColorListState & CT_MODIFIED ) { - if( *pnColorTableState & CT_CHANGED ) - pColorTab = ( (SvxAreaTabDialog*) DLGWIN )->GetNewColorTable(); + if( *pnColorListState & CT_CHANGED ) + pColorList = ( (SvxAreaTabDialog*) DLGWIN )->GetNewColorList(); // LbColor nPos = aLbColor.GetSelectEntryPos(); aLbColor.Clear(); - aLbColor.Fill( pColorTab ); + aLbColor.Fill( pColorList ); nCount = aLbColor.GetEntryCount(); if( nCount == 0 ) ; // Dieser Fall sollte nicht auftreten diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx index d49e86e9570a..ce1febfc0f9f 100644 --- a/cui/source/tabpages/tpcolor.cxx +++ b/cui/source/tabpages/tpcolor.cxx @@ -53,6 +53,8 @@ #include <svx/dialmgr.hxx> #include <svx/dialogs.hrc> +namespace css = ::com::sun::star; + #define DLGWIN GetParentDialog( this ) static Window* GetParentDialog( Window* pWindow ) @@ -70,26 +72,36 @@ static Window* GetParentDialog( Window* pWindow ) // Load save embed functionality SvxLoadSaveEmbed::SvxLoadSaveEmbed( Window *pParent, const ResId &rLoad, - const ResId &rSave, const ResId &rEmbed ) - : pTopDlg( GetParentDialog( pParent ) ) - , aBoxEmbed( pParent, rEmbed ) - , aBtnLoad( pParent, rLoad ) - , aBtnSave( pParent, rSave ) + const ResId &rSave, const ResId &rEmbed, + const ResId &rTableName, + XPropertyListType t, XOutdevItemPool* pXPool ) + : meType( t ) + , mpXPool( pXPool ) + , mpTopDlg( GetParentDialog( pParent ) ) + , maBoxEmbed( pParent, rEmbed ) + , maBtnLoad( pParent, rLoad ) + , maBtnSave( pParent, rSave ) + , maTableName( pParent, rTableName ) { - aBoxEmbed.SetToggleHdl( LINK( this, SvxLoadSaveEmbed, EmbedToggleHdl_Impl ) ); + maBoxEmbed.SetToggleHdl( LINK( this, SvxLoadSaveEmbed, EmbedToggleHdl_Impl ) ); + + maBtnLoad.SetClickHdl( LINK( this, SvxLoadSaveEmbed, ClickLoadHdl_Impl ) ); + maBtnSave.SetClickHdl( LINK( this, SvxLoadSaveEmbed, ClickSaveHdl_Impl ) ); + SetEmbed( GetEmbed() ); + UpdateTableName(); } XPropertyListRef SvxLoadSaveEmbed::GetList() { - SvxAreaTabDialog* pArea = dynamic_cast< SvxAreaTabDialog* >( pTopDlg ); - SvxLineTabDialog* pLine = dynamic_cast< SvxLineTabDialog* >( pTopDlg ); + SvxAreaTabDialog* pArea = dynamic_cast< SvxAreaTabDialog* >( mpTopDlg ); + SvxLineTabDialog* pLine = dynamic_cast< SvxLineTabDialog* >( mpTopDlg ); XColorListRef pList; if( pArea ) - pList = pArea->GetNewColorTable(); + pList = pArea->GetNewColorList(); if( pLine ) - pList = pLine->GetNewColorTable(); + pList = pLine->GetNewColorList(); if( !pList.is() ) { if( pArea ) @@ -106,7 +118,7 @@ void SvxLoadSaveEmbed::SetEmbed( bool bEmbed ) XPropertyListRef pList = GetList(); if( pList.is() ) pList->SetEmbedInDocument( bEmbed ); - aBoxEmbed.Check( bEmbed ); + maBoxEmbed.Check( bEmbed ); } bool SvxLoadSaveEmbed::GetEmbed() @@ -117,17 +129,196 @@ bool SvxLoadSaveEmbed::GetEmbed() IMPL_LINK( SvxLoadSaveEmbed, EmbedToggleHdl_Impl, void *, EMPTYARG ) { - SetEmbed( aBoxEmbed.IsChecked() ); + SetEmbed( maBoxEmbed.IsChecked() ); return 0; } void SvxLoadSaveEmbed::HideLoadSaveEmbed() { - aBtnLoad.Hide(); - aBtnSave.Hide(); - aBoxEmbed.Hide(); + maBtnLoad.Hide(); + maBtnSave.Hide(); + maBoxEmbed.Hide(); +} + +void SvxLoadSaveEmbed::UpdateTableName() +{ + // Truncate the name if necessary ... + String aString( CUI_RES( RID_SVXSTR_TABLE ) ); + aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); + + XPropertyListRef pList = GetList(); + + INetURLObject aURL( pList->GetPath() ); + aURL.Append( pList->GetName() ); + + if ( aURL.getBase().getLength() > 18 ) + { + aString += String(aURL.getBase()).Copy( 0, 15 ); + aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); + } + else + aString += String (aURL.getBase()); + + maTableName.SetText( aString ); } +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxLoadSaveEmbed, ClickLoadHdl_Impl, void *, EMPTYARG ) +{ + ResMgr& rMgr = CUI_MGR(); + sal_uInt16 nReturn = RET_YES; + bool bLoaded = false; + + if( IsModified() && GetList()->Count() > 0 ) + { + nReturn = WarningBox( mpTopDlg, WinBits( WB_YES_NO_CANCEL ), + String( ResId( RID_SVXSTR_WARN_TABLE_OVERWRITE, rMgr ) ) ).Execute(); + + if ( nReturn == RET_YES ) + GetList()->Save(); + } + + if ( nReturn != RET_CANCEL ) + { + ::sfx2::FileDialogHelper aDlg( + css::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, + 0 ); + String aStrFilterType( RTL_CONSTASCII_USTRINGPARAM( "*.soc" ) ); + aDlg.AddFilter( aStrFilterType, aStrFilterType ); + INetURLObject aFile( SvtPathOptions().GetPalettePath() ); + aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) ); + + if ( aDlg.Execute() == ERRCODE_NONE ) + { + INetURLObject aURL( aDlg.GetPath() ); + INetURLObject aPathURL( aURL ); + + aPathURL.removeSegment(); + aPathURL.removeFinalSlash(); + + XColorListRef pList = XPropertyList::CreatePropertyList( + meType, aPathURL.GetMainURL( INetURLObject::NO_DECODE ), mpXPool )->AsColorList(); + pList->SetName( aURL.getName() ); + if( pList->Load() ) + { + // Pruefen, ob Tabelle geloescht werden darf: + SvxAreaTabDialog* pArea = dynamic_cast< SvxAreaTabDialog* >( mpTopDlg ); + SvxLineTabDialog* pLine = dynamic_cast< SvxLineTabDialog* >( mpTopDlg ); + + pList->SetName( aURL.getName() ); + + // FIXME: want to have a generic set and get method by type ... + if( pArea ) + pArea->SetNewColorList( pList ); + else if( pLine ) + pLine->SetNewColorList( pList ); + + + + bLoaded = true; + UpdateTableName(); + + AddState( CT_CHANGED ); + SetModified( false ); + SetEmbed( true ); + } + else + { + ErrorBox aErrorBox( mpTopDlg, WinBits( WB_OK ), + String( ResId( RID_SVXSTR_READ_DATA_ERROR, rMgr ) ) ); + aErrorBox.Execute(); + } + } + } + Update( bLoaded ); + + return 0; +} + +void SvxLoadSaveEmbed::EnableSave( bool bCanSave ) +{ + if ( bCanSave ) + maBtnSave.Enable(); + else + maBtnSave.Disable(); +} + +// ----------------------------------------------------------------------- + +IMPL_LINK( SvxLoadSaveEmbed, ClickSaveHdl_Impl, void *, EMPTYARG ) +{ + ::sfx2::FileDialogHelper aDlg( + css::ui::dialogs::TemplateDescription::FILESAVE_SIMPLE, 0 ); + String aStrFilterType( RTL_CONSTASCII_USTRINGPARAM( "*.soc" ) ); + aDlg.AddFilter( aStrFilterType, aStrFilterType ); + + INetURLObject aFile( SvtPathOptions().GetPalettePath() ); + DBG_ASSERT( aFile.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); + + XPropertyListRef pList = GetList(); + + if( pList->GetName().Len() ) + { + aFile.Append( pList->GetName() ); + + if( !aFile.getExtension().getLength() ) + aFile.SetExtension( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "soc" ) ) ); + } + + aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) ); + if ( aDlg.Execute() == ERRCODE_NONE ) + { + INetURLObject aURL( aDlg.GetPath() ); + INetURLObject aPathURL( aURL ); + + aPathURL.removeSegment(); + aPathURL.removeFinalSlash(); + + pList->SetName( aURL.getName() ); + pList->SetPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) ); + + if( pList->Save() ) + { + UpdateTableName(); + AddState( CT_SAVED ); + SetModified( false ); + } + else + { + ErrorBox aErrorBox( mpTopDlg, WinBits( WB_OK ), + String( CUI_RES( RID_SVXSTR_WRITE_DATA_ERROR ) ) ); + aErrorBox.Execute(); + } + } + return 0; +} + +void SvxColorTabPage::Update(bool bLoaded) +{ + pColorList = XColorListRef( static_cast<XColorList *>( GetList().get() ) ); + + if (bLoaded) + { + aLbColor.Clear(); + aValSetColorList.Clear(); + Construct(); + Reset( rOutAttrs ); + + if( aLbColor.GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND ) + aLbColor.SelectEntryPos( 0 ); + else + aLbColor.SelectEntryPos( aLbColor.GetSelectEntryPos() ); + + ChangeColorHdl_Impl( this ); + SelectColorLBHdl_Impl( this ); + } + + UpdateModified(); +} + +// ----------------------------------------------------------------------- + SvxColorTabPage::SvxColorTabPage ( Window* pParent, @@ -136,7 +327,8 @@ SvxColorTabPage::SvxColorTabPage SfxTabPage ( pParent, CUI_RES( RID_SVXPAGE_COLOR ), rInAttrs ), SvxLoadSaveEmbed ( this, CUI_RES( BTN_LOAD ), CUI_RES( BTN_SAVE ), - CUI_RES( BTN_EMBED ) ), + CUI_RES( BTN_EMBED ), CUI_RES( FT_TABLE_NAME ), + XCOLOR_LIST, (XOutdevItemPool*) rInAttrs.GetPool() ), aFlProp ( this, CUI_RES( FL_PROP ) ), aFtName ( this, CUI_RES( FT_NAME ) ), @@ -144,7 +336,6 @@ SvxColorTabPage::SvxColorTabPage aFtColor ( this, CUI_RES( FT_COLOR ) ), aLbColor ( this, CUI_RES( LB_COLOR ) ), - aTableNameFT ( this, CUI_RES( FT_TABLE_NAME ) ), aValSetColorList ( this, CUI_RES( CTL_COLORTABLE ) ), aCtlPreviewOld ( this, CUI_RES( CTL_PREVIEW_OLD ) ), @@ -165,16 +356,13 @@ SvxColorTabPage::SvxColorTabPage aBtnDelete ( this, CUI_RES( BTN_DELETE ) ), rOutAttrs ( rInAttrs ), - pColorTab( NULL ), - pXPool ( (XOutdevItemPool*) rInAttrs.GetPool() ), aXFStyleItem ( XFILL_SOLID ), aXFillColorItem ( String(), Color( COL_BLACK ) ), - aXFillAttr ( pXPool ), + aXFillAttr ( (XOutdevItemPool*) rInAttrs.GetPool() ), rXFSet ( aXFillAttr.GetItemSet() ), eCM ( CM_RGB ) - { FreeResource(); @@ -208,8 +396,6 @@ SvxColorTabPage::SvxColorTabPage LINK( this, SvxColorTabPage, ClickWorkOnHdl_Impl ) ); aBtnDelete.SetClickHdl( LINK( this, SvxColorTabPage, ClickDeleteHdl_Impl ) ); - aBtnLoad.SetClickHdl( LINK( this, SvxColorTabPage, ClickLoadHdl_Impl ) ); - aBtnSave.SetClickHdl( LINK( this, SvxColorTabPage, ClickSaveHdl_Impl ) ); // ValueSet aValSetColorList.SetStyle( aValSetColorList.GetStyle() | WB_VSCROLL | WB_ITEMBORDER ); @@ -229,7 +415,7 @@ SvxColorTabPage::SvxColorTabPage void SvxColorTabPage::Construct() { - aLbColor.Fill( pColorTab ); + aLbColor.Fill( pColorList ); FillValueSet_Impl( aValSetColorList ); } @@ -241,7 +427,7 @@ void SvxColorTabPage::ActivatePage( const SfxItemSet& ) { *pbAreaTP = sal_False; - if( pColorTab.is() ) + if( pColorList.is() ) { if( *pPageType == PT_COLOR && *pPos != LISTBOX_ENTRY_NOTFOUND ) { @@ -276,24 +462,6 @@ void SvxColorTabPage::ActivatePage( const SfxItemSet& ) } } - // Ermitteln (evtl. abschneiden) des Namens und in - // der GroupBox darstellen - String aString( CUI_RES( RID_SVXSTR_TABLE ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); - INetURLObject aURL( pColorTab->GetPath() ); - - aURL.Append( pColorTab->GetName() ); - DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); - - if ( aURL.getBase().getLength() > 18 ) - { - aString += String(aURL.getBase()).Copy( 0, 15 ); - aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); - } - else - aString += String(aURL.getBase()); - - aTableNameFT.SetText( aString ); - // Damit evtl. geaenderte Farbe verworfen wird SelectColorLBHdl_Impl( this ); @@ -331,7 +499,7 @@ long SvxColorTabPage::CheckChanges_Impl() sal_uInt16 nPos = aLbColor.GetSelectEntryPos(); if( nPos != LISTBOX_ENTRY_NOTFOUND ) { - Color aColor = pColorTab->GetColor( nPos )->GetColor(); + Color aColor = pColorList->GetColor( nPos )->GetColor(); String aString = aLbColor.GetSelectEntry(); // aNewColor, da COL_USER != COL_irgendwas, auch wenn RGB-Werte gleich @@ -363,7 +531,7 @@ long SvxColorTabPage::CheckChanges_Impl() case RET_BTN_1: // Aendern { ClickModifyHdl_Impl( this ); - aColor = pColorTab->GetColor( nPos )->GetColor(); + aColor = pColorList->GetColor( nPos )->GetColor(); } break; @@ -371,7 +539,7 @@ long SvxColorTabPage::CheckChanges_Impl() { ClickAddHdl_Impl( this ); nPos = aLbColor.GetSelectEntryPos(); - aColor = pColorTab->GetColor( nPos )->GetColor(); + aColor = pColorList->GetColor( nPos )->GetColor(); } break; @@ -389,7 +557,7 @@ long SvxColorTabPage::CheckChanges_Impl() *pPos = nPos; } } - return( 0L ); + return 0; } // ----------------------------------------------------------------------- @@ -405,7 +573,7 @@ sal_Bool SvxColorTabPage::FillItemSet( SfxItemSet& rSet ) sal_uInt16 nPos = aLbColor.GetSelectEntryPos(); if( nPos != LISTBOX_ENTRY_NOTFOUND ) { - aColor = pColorTab->GetColor( nPos )->GetColor(); + aColor = pColorList->GetColor( nPos )->GetColor(); aString = aLbColor.GetSelectEntry(); } else @@ -421,6 +589,15 @@ sal_Bool SvxColorTabPage::FillItemSet( SfxItemSet& rSet ) return( sal_True ); } +void SvxColorTabPage::UpdateModified() +{ + bool bEnable = pColorList->Count(); + aBtnModify.Enable( bEnable ); + aBtnWorkOn.Enable( bEnable ); + aBtnDelete.Enable( bEnable ); + EnableSave( bEnable ); +} + // ----------------------------------------------------------------------- void SvxColorTabPage::Reset( const SfxItemSet& rSet ) @@ -443,22 +620,7 @@ void SvxColorTabPage::Reset( const SfxItemSet& rSet ) SelectColorModelHdl_Impl( this ); aCtlPreviewOld.Invalidate(); - - // Status der Buttons ermitteln - if( pColorTab->Count() ) - { - aBtnModify.Enable(); - aBtnWorkOn.Enable(); - aBtnDelete.Enable(); - aBtnSave.Enable(); - } - else - { - aBtnModify.Disable(); - aBtnWorkOn.Disable(); - aBtnDelete.Disable(); - aBtnSave.Disable(); - } + UpdateModified(); } // ----------------------------------------------------------------------- @@ -491,14 +653,11 @@ IMPL_LINK( SvxColorTabPage, ModifiedHdl_Impl, void *, EMPTYARG ) aCtlPreviewNew.Invalidate(); - return( 0L ); + return 0; } //------------------------------------------------------------------------ -// -// Button 'Hinzuf�gen' -// IMPL_LINK( SvxColorTabPage, ClickAddHdl_Impl, void *, EMPTYARG ) { Window *pWindow = this; @@ -511,12 +670,12 @@ IMPL_LINK( SvxColorTabPage, ClickAddHdl_Impl, void *, EMPTYARG ) String aDesc( ResId( RID_SVXSTR_DESC_COLOR, rMgr ) ); String aName( aEdtName.GetText() ); XColorEntry* pEntry; - long nCount = pColorTab->Count(); + long nCount = pColorList->Count(); sal_Bool bDifferent = sal_True; // Pruefen, ob Name schon vorhanden ist for ( long i = 0; i < nCount && bDifferent; i++ ) - if ( aName == pColorTab->GetColor( i )->GetName() ) + if ( aName == pColorList->GetColor( i )->GetName() ) bDifferent = sal_False; // Wenn ja, wird wiederholt ein neuer Name angefordert @@ -540,7 +699,7 @@ IMPL_LINK( SvxColorTabPage, ClickAddHdl_Impl, void *, EMPTYARG ) for( long i = 0; i < nCount && bDifferent; i++ ) { - if( aName == pColorTab->GetColor( i )->GetName() ) + if( aName == pColorList->GetColor( i )->GetName() ) bDifferent = sal_False; } @@ -559,7 +718,7 @@ IMPL_LINK( SvxColorTabPage, ClickAddHdl_Impl, void *, EMPTYARG ) ConvertColorValues (aAktuellColor, CM_RGB); pEntry = new XColorEntry( aAktuellColor, aName ); - pColorTab->Insert( pEntry, pColorTab->Count() ); + pColorList->Insert( pEntry, pColorList->Count() ); aLbColor.Append( pEntry ); aValSetColorList.InsertItem( aValSetColorList.GetItemCount() + 1, @@ -568,26 +727,17 @@ IMPL_LINK( SvxColorTabPage, ClickAddHdl_Impl, void *, EMPTYARG ) aLbColor.SelectEntryPos( aLbColor.GetEntryCount() - 1 ); // Flag fuer modifiziert setzen - *pnColorTableState |= CT_MODIFIED; + *pnColorListState |= CT_MODIFIED; SelectColorLBHdl_Impl( this ); } - // Status der Buttons ermitteln - if( pColorTab->Count() ) - { - aBtnModify.Enable(); - aBtnWorkOn.Enable(); - aBtnDelete.Enable(); - aBtnSave.Enable(); - } - return( 0L ); + UpdateModified(); + + return 0; } //------------------------------------------------------------------------ -// -// Button '�ndern' -// IMPL_LINK( SvxColorTabPage, ClickModifyHdl_Impl, void *, EMPTYARG ) { sal_uInt16 nPos = aLbColor.GetSelectEntryPos(); @@ -597,12 +747,12 @@ IMPL_LINK( SvxColorTabPage, ClickModifyHdl_Impl, void *, EMPTYARG ) ResMgr& rMgr = CUI_MGR(); String aDesc( ResId( RID_SVXSTR_DESC_COLOR, rMgr ) ); String aName( aEdtName.GetText() ); - long nCount = pColorTab->Count(); + long nCount = pColorList->Count(); sal_Bool bDifferent = sal_True; // Pruefen, ob Name schon vorhanden ist for ( long i = 0; i < nCount && bDifferent; i++ ) - if ( aName == pColorTab->GetColor( i )->GetName() && nPos != i ) + if ( aName == pColorList->GetColor( i )->GetName() && nPos != i ) bDifferent = sal_False; // Wenn ja, wird wiederholt ein neuer Name angefordert @@ -625,7 +775,7 @@ IMPL_LINK( SvxColorTabPage, ClickModifyHdl_Impl, void *, EMPTYARG ) bDifferent = sal_True; for ( long i = 0; i < nCount && bDifferent; i++ ) - if( aName == pColorTab->GetColor( i )->GetName() && nPos != i ) + if( aName == pColorList->GetColor( i )->GetName() && nPos != i ) bDifferent = sal_False; if( bDifferent ) @@ -639,7 +789,7 @@ IMPL_LINK( SvxColorTabPage, ClickModifyHdl_Impl, void *, EMPTYARG ) // Wenn nicht vorhanden, wird Eintrag aufgenommen if( bDifferent ) { - XColorEntry* pEntry = pColorTab->GetColor( nPos ); + XColorEntry* pEntry = pColorList->GetColor( nPos ); Color aTmpColor (aAktuellColor); if (eCM != CM_RGB) @@ -658,17 +808,14 @@ IMPL_LINK( SvxColorTabPage, ClickModifyHdl_Impl, void *, EMPTYARG ) aCtlPreviewOld.Invalidate(); // Flag fuer modifiziert setzen - *pnColorTableState |= CT_MODIFIED; + *pnColorListState |= CT_MODIFIED; } } - return( 0L ); + return 0; } //------------------------------------------------------------------------ -// -// Button 'Bearbeiten' -// IMPL_LINK( SvxColorTabPage, ClickWorkOnHdl_Impl, void *, EMPTYARG ) { SvColorDialog* pColorDlg = new SvColorDialog( DLGWIN ); @@ -702,14 +849,11 @@ IMPL_LINK( SvxColorTabPage, ClickWorkOnHdl_Impl, void *, EMPTYARG ) } delete( pColorDlg ); - return( 0L ); + return 0; } //------------------------------------------------------------------------ -// -// Button 'Loeschen' -// IMPL_LINK( SvxColorTabPage, ClickDeleteHdl_Impl, void *, EMPTYARG ) { sal_uInt16 nPos = aLbColor.GetSelectEntryPos(); @@ -721,21 +865,10 @@ IMPL_LINK( SvxColorTabPage, ClickDeleteHdl_Impl, void *, EMPTYARG ) if( aQueryBox.Execute() == RET_YES ) { - // Jetzt wird richtig geloescht - sal_uLong nCount = pColorTab->Count() - 1; - XColorEntry* pEntry; - - pEntry = pColorTab->Remove( nPos ); - DBG_ASSERT( pEntry, "ColorEntry nicht vorhanden (1) !" ); + XColorEntry* pEntry = pColorList->Remove( nPos ); + DBG_ASSERT( pEntry, "ColorEntry not found !" ); delete pEntry; - for( sal_uLong i = nPos; i < nCount; i++ ) - { - pEntry = pColorTab->Remove( i + 1 ); - DBG_ASSERT( pEntry, "ColorEntry nicht vorhanden (2) !" ); - pColorTab->Insert( pEntry, i ); - } - // Listbox und ValueSet aktualisieren aLbColor.RemoveEntry( nPos ); aValSetColorList.Clear(); @@ -748,200 +881,12 @@ IMPL_LINK( SvxColorTabPage, ClickDeleteHdl_Impl, void *, EMPTYARG ) aCtlPreviewOld.Invalidate(); // Flag fuer modifiziert setzen - *pnColorTableState |= CT_MODIFIED; - } - } - // Status der Buttons ermitteln - if( !pColorTab->Count() ) - { - aBtnModify.Disable(); - aBtnWorkOn.Disable(); - aBtnDelete.Disable(); - aBtnSave.Disable(); - } - return( 0L ); -} - -// ----------------------------------------------------------------------- - -// -// Button 'Farbtabelle laden' -// -IMPL_LINK( SvxColorTabPage, ClickLoadHdl_Impl, void *, EMPTYARG ) -{ - ResMgr& rMgr = CUI_MGR(); - sal_uInt16 nReturn = RET_YES; - - if( *pnColorTableState & CT_MODIFIED ) - { - nReturn = WarningBox( DLGWIN, WinBits( WB_YES_NO_CANCEL ), - String( ResId( RID_SVXSTR_WARN_TABLE_OVERWRITE, rMgr ) ) ).Execute(); - - if ( nReturn == RET_YES ) - pColorTab->Save(); - } - - if ( nReturn != RET_CANCEL ) - { - ::sfx2::FileDialogHelper aDlg( - com::sun::star::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, - 0 ); - String aStrFilterType( RTL_CONSTASCII_USTRINGPARAM( "*.soc" ) ); - aDlg.AddFilter( aStrFilterType, aStrFilterType ); - INetURLObject aFile( SvtPathOptions().GetPalettePath() ); - aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) ); - - if ( aDlg.Execute() == ERRCODE_NONE ) - { - INetURLObject aURL( aDlg.GetPath() ); - INetURLObject aPathURL( aURL ); - - aPathURL.removeSegment(); - aPathURL.removeFinalSlash(); - - // Tabelle speichern - XColorListRef pColList = XPropertyList::CreatePropertyList( - XCOLOR_LIST, aPathURL.GetMainURL( INetURLObject::NO_DECODE ), pXPool )->AsColorList(); - pColList->SetName( aURL.getName() ); // XXX - if( pColList->Load() ) - { - // Pruefen, ob Tabelle geloescht werden darf: - SvxAreaTabDialog* pArea = dynamic_cast< SvxAreaTabDialog* >( DLGWIN ); - SvxLineTabDialog* pLine = dynamic_cast< SvxLineTabDialog* >( DLGWIN ); - - pColorTab = pColList; - if( pArea ) - pArea->SetNewColorTable( pColorTab ); - else if( pLine ) - pLine->SetNewColorTable( pColorTab ); - - aLbColor.Clear(); - aValSetColorList.Clear(); - Construct(); - Reset( rOutAttrs ); - - pColorTab->SetName( aURL.getName() ); - - // Ermitteln (evtl. abschneiden) des Namens und in - // der GroupBox darstellen - String aString( ResId( RID_SVXSTR_TABLE, rMgr ) ); - aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); - - if ( aURL.getBase().getLength() > 18 ) - { - aString += String(aURL.getBase()).Copy( 0, 15 ); - aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); - } - else - aString += String(aURL.getBase()); - - aTableNameFT.SetText( aString ); - - // Flag fuer gewechselt setzen - *pnColorTableState |= CT_CHANGED; - // Flag fuer modifiziert entfernen - *pnColorTableState &= ~CT_MODIFIED; - - if( aLbColor.GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND ) - aLbColor.SelectEntryPos( 0 ); - else - aLbColor.SelectEntryPos( aLbColor.GetSelectEntryPos() ); - - ChangeColorHdl_Impl( this ); - SelectColorLBHdl_Impl( this ); - SetEmbed( true ); - } - else - { - ErrorBox aErrorBox( DLGWIN, WinBits( WB_OK ), - String( ResId( RID_SVXSTR_READ_DATA_ERROR, rMgr ) ) ); - aErrorBox.Execute(); - } + *pnColorListState |= CT_MODIFIED; } } + UpdateModified(); - // Status der Buttons ermitteln - if ( pColorTab->Count() ) - { - aBtnModify.Enable(); - aBtnWorkOn.Enable(); - aBtnDelete.Enable(); - aBtnSave.Enable(); - } - else - { - aBtnModify.Disable(); - aBtnWorkOn.Disable(); - aBtnDelete.Disable(); - aBtnSave.Disable(); - } - return( 0L ); -} - -// ----------------------------------------------------------------------- - -// -// Button 'Farbtabelle speichern' -// -IMPL_LINK( SvxColorTabPage, ClickSaveHdl_Impl, void *, EMPTYARG ) -{ - ::sfx2::FileDialogHelper aDlg( - com::sun::star::ui::dialogs::TemplateDescription::FILESAVE_SIMPLE, 0 ); - String aStrFilterType( RTL_CONSTASCII_USTRINGPARAM( "*.soc" ) ); - aDlg.AddFilter( aStrFilterType, aStrFilterType ); - - INetURLObject aFile( SvtPathOptions().GetPalettePath() ); - DBG_ASSERT( aFile.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" ); - - if( pColorTab->GetName().Len() ) - { - aFile.Append( pColorTab->GetName() ); - - if( !aFile.getExtension().getLength() ) - aFile.SetExtension( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "soc" ) ) ); - } - - aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) ); - if ( aDlg.Execute() == ERRCODE_NONE ) - { - INetURLObject aURL( aDlg.GetPath() ); - INetURLObject aPathURL( aURL ); - - aPathURL.removeSegment(); - aPathURL.removeFinalSlash(); - - pColorTab->SetName( aURL.getName() ); - pColorTab->SetPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) ); - - if( pColorTab->Save() ) - { - // Ermitteln (evtl. abschneiden) des Namens und in - // der GroupBox darstellen - String aString( CUI_RES( RID_SVXSTR_TABLE ) ); - aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) ); - - if ( aURL.getBase().getLength() > 18 ) - { - aString += String(aURL.getBase()).Copy( 0, 15 ); - aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) ); - } - else - aString += String(aURL.getBase()); - aTableNameFT.SetText( aString ); - - // Flag fuer gespeichert setzen - *pnColorTableState |= CT_SAVED; - // Flag fuer modifiziert entfernen - *pnColorTableState &= ~CT_MODIFIED; - } - else - { - ErrorBox aErrorBox( DLGWIN, WinBits( WB_OK ), - String( CUI_RES( RID_SVXSTR_WRITE_DATA_ERROR ) ) ); - aErrorBox.Execute(); - } - } - return( 0L ); + return 0; } //------------------------------------------------------------------------ @@ -964,7 +909,7 @@ IMPL_LINK( SvxColorTabPage, SelectColorLBHdl_Impl, void *, EMPTYARG ) ChangeColorHdl_Impl( this ); } - return( 0L ); + return 0; } //------------------------------------------------------------------------ @@ -987,7 +932,7 @@ IMPL_LINK( SvxColorTabPage, SelectValSetHdl_Impl, void *, EMPTYARG ) ChangeColorHdl_Impl( this ); } - return( 0L ); + return 0; } //------------------------------------------------------------------------ @@ -1141,7 +1086,7 @@ IMPL_LINK( SvxColorTabPage, SelectColorModelHdl_Impl, void *, EMPTYARG ) aMtrFldColorModel3.SetAccessibleName( GetNonMnemonicString(aFtColorModel3.GetText()) ); aMtrFldColorModel4.SetAccessibleName( GetNonMnemonicString(aFtColorModel4.GetText()) ); - return( 0L ); + return 0; } //------------------------------------------------------------------------ @@ -1151,7 +1096,7 @@ long SvxColorTabPage::ChangeColorHdl_Impl( void* ) int nPos = aLbColor.GetSelectEntryPos(); if( nPos != LISTBOX_ENTRY_NOTFOUND ) { - XColorEntry* pEntry = pColorTab->GetColor( nPos ); + XColorEntry* pEntry = pColorList->GetColor( nPos ); aAktuellColor.SetColor ( pEntry->GetColor().GetColor() ); if (eCM != CM_RGB) @@ -1169,14 +1114,14 @@ long SvxColorTabPage::ChangeColorHdl_Impl( void* ) aCtlPreviewNew.Invalidate(); } - return( 0L ); + return 0; } //------------------------------------------------------------------------ void SvxColorTabPage::FillValueSet_Impl( ValueSet& rVs ) { - long nCount = pColorTab->Count(); + long nCount = pColorList->Count(); XColorEntry* pColorEntry; if( nCount > 104 ) @@ -1184,7 +1129,7 @@ void SvxColorTabPage::FillValueSet_Impl( ValueSet& rVs ) for( long i = 0; i < nCount; i++ ) { - pColorEntry = pColorTab->GetColor( i ); + pColorEntry = pColorList->GetColor( i ); rVs.InsertItem( (sal_uInt16) i + 1, pColorEntry->GetColor(), pColorEntry->GetName() ); } } diff --git a/cui/source/tabpages/tpgradnt.cxx b/cui/source/tabpages/tpgradnt.cxx index b2b6c36e5610..fd7f1a9ed6a8 100644 --- a/cui/source/tabpages/tpgradnt.cxx +++ b/cui/source/tabpages/tpgradnt.cxx @@ -97,9 +97,6 @@ SvxGradientTabPage::SvxGradientTabPage rOutAttrs ( rInAttrs ), - pColorTab( NULL ), - pGradientList( NULL ), - pXPool ( (XOutdevItemPool*) rInAttrs.GetPool() ), aXFStyleItem ( XFILL_GRADIENT ), aXGradientItem ( String(), XGradient( COL_BLACK, COL_WHITE ) ), @@ -164,7 +161,7 @@ SvxGradientTabPage::SvxGradientTabPage void SvxGradientTabPage::Construct() { // Farbtabelle - aLbColorFrom.Fill( pColorTab ); + aLbColorFrom.Fill( pColorList ); aLbColorTo.CopyEntries( aLbColorFrom ); // Farbverlauftabelle @@ -182,19 +179,19 @@ void SvxGradientTabPage::ActivatePage( const SfxItemSet& ) { *pbAreaTP = sal_False; - if( pColorTab.is() ) + if( pColorList.is() ) { - // ColorTable - if( *pnColorTableState & CT_CHANGED || - *pnColorTableState & CT_MODIFIED ) + // ColorList + if( *pnColorListState & CT_CHANGED || + *pnColorListState & CT_MODIFIED ) { - if( *pnColorTableState & CT_CHANGED ) - pColorTab = ( (SvxAreaTabDialog*) DLGWIN )->GetNewColorTable(); + if( *pnColorListState & CT_CHANGED ) + pColorList = ( (SvxAreaTabDialog*) DLGWIN )->GetNewColorList(); // LbColorFrom nPos = aLbColorFrom.GetSelectEntryPos(); aLbColorFrom.Clear(); - aLbColorFrom.Fill( pColorTab ); + aLbColorFrom.Fill( pColorList ); nCount = aLbColorFrom.GetEntryCount(); if( nCount == 0 ) ; // Dieser Fall sollte nicht auftreten diff --git a/cui/source/tabpages/tphatch.cxx b/cui/source/tabpages/tphatch.cxx index 556b5c490df7..31b606de95a8 100644 --- a/cui/source/tabpages/tphatch.cxx +++ b/cui/source/tabpages/tphatch.cxx @@ -92,8 +92,6 @@ SvxHatchTabPage::SvxHatchTabPage aBtnSave ( this, CUI_RES( BTN_SAVE ) ), rOutAttrs ( rInAttrs ), - pColorTab( NULL ), - pHatchingList( NULL ), pXPool ( (XOutdevItemPool*) rInAttrs.GetPool() ), aXFStyleItem ( XFILL_HATCH ), @@ -163,7 +161,7 @@ SvxHatchTabPage::SvxHatchTabPage void SvxHatchTabPage::Construct() { // Farbtabelle - aLbLineColor.Fill( pColorTab ); + aLbLineColor.Fill( pColorList ); // Schraffurentabelle aLbHatchings.Fill( pHatchingList ); @@ -180,19 +178,19 @@ void SvxHatchTabPage::ActivatePage( const SfxItemSet& rSet ) { *pbAreaTP = sal_False; - if( pColorTab.is() ) + if( pColorList.is() ) { - // ColorTable - if( *pnColorTableState & CT_CHANGED || - *pnColorTableState & CT_MODIFIED ) + // ColorList + if( *pnColorListState & CT_CHANGED || + *pnColorListState & CT_MODIFIED ) { - if( *pnColorTableState & CT_CHANGED ) - pColorTab = ( (SvxAreaTabDialog*) DLGWIN )->GetNewColorTable(); + if( *pnColorListState & CT_CHANGED ) + pColorList = ( (SvxAreaTabDialog*) DLGWIN )->GetNewColorList(); // LbLineColor nPos = aLbLineColor.GetSelectEntryPos(); aLbLineColor.Clear(); - aLbLineColor.Fill( pColorTab ); + aLbLineColor.Fill( pColorList ); nCount = aLbLineColor.GetEntryCount(); if( nCount == 0 ) ; // Dieser Fall sollte nicht auftreten diff --git a/cui/source/tabpages/tpline.cxx b/cui/source/tabpages/tpline.cxx index e95244545b42..013f94af4d26 100644 --- a/cui/source/tabpages/tpline.cxx +++ b/cui/source/tabpages/tpline.cxx @@ -156,7 +156,7 @@ SvxLineTabPage::SvxLineTabPage rXLSet ( aXLineAttr.GetItemSet() ), pnLineEndListState( 0 ), pnDashListState( 0 ), - pnColorTableState( 0 ), + pnColorListState( 0 ), nPageType ( 0 ) { aLbEndStyle.SetAccessibleName(String(CUI_RES(STR_STYLE))); @@ -223,10 +223,6 @@ SvxLineTabPage::SvxLineTabPage aTsbCenterStart.SetClickHdl( aStart ); aTsbCenterEnd.SetClickHdl( aEnd ); - pColorTab = NULL; - pDashList = NULL; - pLineEndList = NULL; - // #116827# Link aEdgeStyle = LINK( this, SvxLineTabPage, ChangeEdgeStyleHdl_Impl ); maLBEdgeStyle.SetSelectHdl( aEdgeStyle ); @@ -244,6 +240,7 @@ SvxLineTabPage::SvxLineTabPage // #63083# nActLineWidth = -1; } + //#58425# Symbole auf einer Linie (z.B. StarChart) , Symbol-Controls aktivieren void SvxLineTabPage::ShowSymbolControls(sal_Bool bOn) { @@ -276,7 +273,7 @@ SvxLineTabPage::~SvxLineTabPage() void SvxLineTabPage::Construct() { // Farbtabelle - aLbColor.Fill( pColorTab ); + aLbColor.Fill( pColorList ); FillListboxes(); } @@ -403,16 +400,15 @@ void SvxLineTabPage::ActivatePage( const SfxItemSet& rSet ) } } - // ColorTable - if( *pnColorTableState ) + // ColorList + if( *pnColorListState ) { - if( *pnColorTableState & CT_CHANGED ) - pColorTab = ( (SvxLineTabDialog*) DLGWIN )-> - GetNewColorTable(); + if( *pnColorListState & CT_CHANGED ) + pColorList = ( (SvxLineTabDialog*) DLGWIN )->GetNewColorList(); // aLbColor sal_uInt16 nColorPos = aLbColor.GetSelectEntryPos(); aLbColor.Clear(); - aLbColor.Fill( pColorTab ); + aLbColor.Fill( pColorList ); nCount = aLbColor.GetEntryCount(); if( nCount == 0 ) ; // This case should never occur @@ -1833,7 +1829,7 @@ void SvxLineTabPage::DataChanged( const DataChangedEvent& rDCEvt ) void SvxLineTabPage::PageCreated (SfxAllItemSet aSet) { - SFX_ITEMSET_ARG (&aSet,pColorTabItem,SvxColorListItem,SID_COLOR_TABLE,sal_False); + SFX_ITEMSET_ARG (&aSet,pColorListItem,SvxColorListItem,SID_COLOR_TABLE,sal_False); SFX_ITEMSET_ARG (&aSet,pDashListItem,SvxDashListItem,SID_DASH_LIST,sal_False); SFX_ITEMSET_ARG (&aSet,pLineEndListItem,SvxLineEndListItem,SID_LINEEND_LIST,sal_False); SFX_ITEMSET_ARG (&aSet,pPageTypeItem,SfxUInt16Item,SID_PAGE_TYPE,sal_False); @@ -1842,8 +1838,8 @@ void SvxLineTabPage::PageCreated (SfxAllItemSet aSet) SFX_ITEMSET_ARG (&aSet,pSymbolAttrItem,SfxTabDialogItem,SID_ATTR_SET,sal_False); SFX_ITEMSET_ARG (&aSet,pGraphicItem,SvxGraphicItem,SID_GRAPHIC,sal_False); - if (pColorTabItem) - SetColorList(pColorTabItem->GetColorList()); + if (pColorListItem) + SetColorList(pColorListItem->GetColorList()); if (pDashListItem) SetDashList(pDashListItem->GetDashList()); if (pLineEndListItem) diff --git a/cui/source/tabpages/tpshadow.cxx b/cui/source/tabpages/tpshadow.cxx index dd5e4e7caef6..ea334b576bba 100644 --- a/cui/source/tabpages/tpshadow.cxx +++ b/cui/source/tabpages/tpshadow.cxx @@ -83,7 +83,6 @@ SvxShadowTabPage::SvxShadowTabPage( Window* pParent, const SfxItemSet& rInAttrs aMtrTransparent ( this, CUI_RES( MTR_SHADOW_TRANSPARENT ) ), aCtlXRectPreview ( this, CUI_RES( CTL_COLOR_PREVIEW ) ), rOutAttrs ( rInAttrs ), - pColorTab( NULL ), bDisable ( sal_False ), pXPool ( (XOutdevItemPool*) rInAttrs.GetPool() ), aXFillAttr ( pXPool ), @@ -195,7 +194,7 @@ SvxShadowTabPage::SvxShadowTabPage( Window* pParent, const SfxItemSet& rInAttrs void SvxShadowTabPage::Construct() { // Farbtabelle fuellen - aLbShadowColor.Fill( pColorTab ); + aLbShadowColor.Fill( pColorList ); if( bDisable ) { @@ -224,24 +223,24 @@ void SvxShadowTabPage::ActivatePage( const SfxItemSet& rSet ) if( nDlgType == 0 ) { - if( pColorTab.is() ) + if( pColorList.is() ) { - // ColorTable - if( *pnColorTableState & CT_CHANGED || - *pnColorTableState & CT_MODIFIED ) + // ColorList + if( *pnColorListState & CT_CHANGED || + *pnColorListState & CT_MODIFIED ) { - if( *pnColorTableState & CT_CHANGED ) + if( *pnColorListState & CT_CHANGED ) { SvxAreaTabDialog* pArea = dynamic_cast< SvxAreaTabDialog* >( DLGWIN ); if( pArea ) { - pColorTab = pArea->GetNewColorTable(); + pColorList = pArea->GetNewColorList(); } else { SvxLineTabDialog* pLine = dynamic_cast< SvxLineTabDialog* >( DLGWIN ); if( pLine ) - pColorTab = pLine->GetNewColorTable(); + pColorList = pLine->GetNewColorList(); } } @@ -249,7 +248,7 @@ void SvxShadowTabPage::ActivatePage( const SfxItemSet& rSet ) // aLbShadowColor nPos = aLbShadowColor.GetSelectEntryPos(); aLbShadowColor.Clear(); - aLbShadowColor.Fill( pColorTab ); + aLbShadowColor.Fill( pColorList ); nCount = aLbShadowColor.GetEntryCount(); if( nCount == 0 ) ; // Dieser Fall sollte nicht auftreten @@ -596,13 +595,12 @@ void SvxShadowTabPage::PointChanged( Window* pWindow, RECT_POINT eRcPt ) void SvxShadowTabPage::PageCreated (SfxAllItemSet aSet) { - SFX_ITEMSET_ARG (&aSet,pColorTabItem,SvxColorListItem,SID_COLOR_TABLE,sal_False); + SFX_ITEMSET_ARG (&aSet,pColorListItem,SvxColorListItem,SID_COLOR_TABLE,sal_False); SFX_ITEMSET_ARG (&aSet,pPageTypeItem,SfxUInt16Item,SID_PAGE_TYPE,sal_False); SFX_ITEMSET_ARG (&aSet,pDlgTypeItem,SfxUInt16Item,SID_DLG_TYPE,sal_False); - - if (pColorTabItem) - SetColorList(pColorTabItem->GetColorList()); + if (pColorListItem) + SetColorList(pColorListItem->GetColorList()); if (pPageTypeItem) SetPageType(pPageTypeItem->GetValue()); if (pDlgTypeItem) |