summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sfx2/source/dialog/tabdlg.cxx137
-rw-r--r--sfx2/source/view/viewimp.hxx14
-rw-r--r--sfx2/source/view/viewsh.cxx55
3 files changed, 190 insertions, 16 deletions
diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx
index f319255094f0..4e032806a53d 100644
--- a/sfx2/source/dialog/tabdlg.cxx
+++ b/sfx2/source/dialog/tabdlg.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: tabdlg.cxx,v $
*
- * $Revision: 1.9 $
+ * $Revision: 1.10 $
*
- * last change: $Author: pb $ $Date: 2001-02-09 06:51:48 $
+ * last change: $Author: mba $ $Date: 2001-03-30 15:56:35 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -86,6 +86,8 @@
#include "app.hxx"
#include "sfxresid.hxx"
#include "sfxhelp.hxx"
+#include "ctrlitem.hxx"
+#include "bindings.hxx"
#include "dialog.hrc"
#include "helpid.hrc"
@@ -115,6 +117,89 @@ struct Data_Impl
{}
};
+TYPEINIT1(SfxTabDialogItem,SfxSetItem);
+
+SfxTabDialogItem::SfxTabDialogItem( const SfxTabDialogItem& rAttr, SfxItemPool* pItemPool )
+ : SfxSetItem( rAttr, pItemPool )
+{
+}
+
+SfxTabDialogItem::SfxTabDialogItem( USHORT nId, const SfxItemSet& rItemSet )
+ : SfxSetItem( nId, rItemSet )
+{
+}
+
+SfxPoolItem* __EXPORT SfxTabDialogItem::Clone(SfxItemPool* pToPool) const
+{
+ return new SfxTabDialogItem( *this, pToPool );
+}
+
+SfxPoolItem* __EXPORT SfxTabDialogItem::Create(SvStream& rStream, USHORT nVersion) const
+{
+ DBG_ERROR( "Use it only in UI!" );
+ return NULL;
+}
+
+class SfxTabDialogController : public SfxControllerItem
+{
+ SfxTabDialog* pDialog;
+ const SfxItemSet* pSet;
+public:
+ SfxTabDialogController( USHORT nId, SfxBindings& rBindings, SfxTabDialog* pDlg )
+ : SfxControllerItem( nId, rBindings )
+ , pDialog( pDlg )
+ , pSet( NULL )
+ {}
+
+ ~SfxTabDialogController();
+
+ DECL_LINK( Execute_Impl, void* );
+ virtual void StateChanged( USHORT nSID, SfxItemState eState, const SfxPoolItem* pState );
+};
+
+SfxTabDialogController::~SfxTabDialogController()
+{
+ delete pSet;
+}
+
+IMPL_LINK( SfxTabDialogController, Execute_Impl, void*, pVoid )
+{
+ if ( pDialog->OK_Impl() && pDialog->Ok() )
+ {
+ const SfxPoolItem* aItems[2];
+ SfxTabDialogItem aItem( GetId(), *pDialog->GetOutputItemSet() );
+ aItems[0] = &aItem;
+ aItems[1] = NULL;
+ GetBindings().Execute( GetId(), aItems );
+ }
+
+ return 0;
+}
+
+void SfxTabDialogController::StateChanged( USHORT nSID, SfxItemState eState, const SfxPoolItem* pState )
+{
+ const SfxSetItem* pSetItem = PTR_CAST( SfxSetItem, pState );
+ if ( pSetItem )
+ {
+ pSet = pDialog->pSet = pSetItem->GetItemSet().Clone();
+ BOOL bDialogStarted = FALSE;
+ for ( USHORT n=0; n<pDialog->aTabCtrl.GetPageCount(); n++ )
+ {
+ USHORT nId = pDialog->aTabCtrl.GetPageId( n );
+ SfxTabPage* pTabPage = (SfxTabPage*) pDialog->aTabCtrl.GetTabPage( nId );
+ if ( pTabPage )
+ {
+ pTabPage->Reset( pSetItem->GetItemSet() );
+ bDialogStarted = TRUE;
+ }
+ }
+
+ if ( bDialogStarted )
+ pDialog->Show();
+ }
+ else
+ pDialog->Hide();
+}
DECL_PTRARRAY(SfxTabDlgData_Impl, Data_Impl *, 4,4)
@@ -127,6 +212,7 @@ struct TabDlg_Impl
SfxTabDlgData_Impl* pData;
PushButton* pApplyButton;
+ SfxTabDialogController* pController;
TabDlg_Impl( BYTE nCnt ) :
@@ -135,7 +221,8 @@ struct TabDlg_Impl
bInOK ( FALSE ),
bHideResetBtn ( FALSE ),
pData ( new SfxTabDlgData_Impl( nCnt ) ),
- pApplyButton ( NULL )
+ pApplyButton ( NULL ),
+ pController ( NULL )
{}
};
@@ -348,7 +435,7 @@ const SfxPoolItem* SfxTabPage::GetExchangeItem( const SfxItemSet& rSet,
// class SfxTabDialog ----------------------------------------------------
-#define INI_LIST \
+#define INI_LIST(ItemSetPtr) \
aTabCtrl ( this, ResId(ID_TABCONTROL ) ),\
aOKBtn ( this ),\
pUserBtn ( pUserButtonText? new PushButton(this): 0 ),\
@@ -356,7 +443,7 @@ const SfxPoolItem* SfxTabPage::GetExchangeItem( const SfxItemSet& rSet,
aHelpBtn ( this ),\
aResetBtn ( this ),\
aBaseFmtBtn ( this ),\
- pSet ( pItemSet ),\
+ pSet ( ItemSetPtr ),\
pOutSet ( 0 ),\
pExampleSet ( 0 ),\
pRanges ( 0 ),\
@@ -387,7 +474,7 @@ SfxTabDialog::SfxTabDialog
// wenn != 0, wird der UserButton erzeugt
) :
TabDialog( pParent, rResId ),
- INI_LIST,
+ INI_LIST(pItemSet),
pFrame( pViewFrame )
{
Init_Impl( bFmt, pUserButtonText );
@@ -413,13 +500,48 @@ SfxTabDialog::SfxTabDialog
// wenn != 0, wird der UserButton erzeugt
) :
TabDialog( pParent, rResId ),
- INI_LIST,
+ INI_LIST(pItemSet),
pFrame( 0 )
{
Init_Impl( bFmt, pUserButtonText );
DBG_WARNING( "bitte den Ctor mit ViewFrame verwenden" );
}
+SfxTabDialog::SfxTabDialog
+
+/* [Beschreibung]
+
+ Konstruktor, tempor"ar ohne Frame
+*/
+
+(
+ Window* pParent, // Parent-Fenster
+ const ResId& rResId, // ResourceId
+ USHORT nSetId,
+ SfxBindings& rBindings,
+ BOOL bEditFmt, // Flag: es werden Vorlagen bearbeitet
+ // wenn ja -> zus"atzlicher Button f"ur Standard
+ const String* pUserButtonText // Text f"ur BenutzerButton;
+ // wenn != 0, wird der UserButton erzeugt
+) :
+ TabDialog( pParent, rResId ),
+ INI_LIST(NULL),
+ pFrame( 0 )
+{
+ rBindings.ENTERREGISTRATIONS();
+ pImpl->pController = new SfxTabDialogController( nSetId, rBindings, this );
+ rBindings.LEAVEREGISTRATIONS();
+
+ EnableApplyButton( TRUE );
+ SetApplyHandler( LINK( pImpl->pController, SfxTabDialogController, Execute_Impl ) );
+
+ rBindings.Invalidate( nSetId );
+ rBindings.Update( nSetId );
+ DBG_ASSERT( pSet, "No ItemSet!" );
+
+ Init_Impl( bFmt, pUserButtonText );
+}
+
// -----------------------------------------------------------------------
SfxTabDialog::~SfxTabDialog()
@@ -455,6 +577,7 @@ SfxTabDialog::~SfxTabDialog()
delete pDataObject;
}
+ delete pImpl->pController;
delete pImpl->pApplyButton;
delete pImpl->pData;
delete pImpl;
diff --git a/sfx2/source/view/viewimp.hxx b/sfx2/source/view/viewimp.hxx
index 0800fc800585..154d0b124b01 100644
--- a/sfx2/source/view/viewimp.hxx
+++ b/sfx2/source/view/viewimp.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: viewimp.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: mba $ $Date: 2001-01-25 15:56:13 $
+ * last change: $Author: mba $ $Date: 2001-03-30 15:59:24 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -77,6 +77,15 @@ class SfxAcceleratorManager;
class SfxOfficeDispatch;
class SfxBaseController;
+struct ModelessDialog_Impl
+{
+ Dialog* pDialog;
+ USHORT nSlotId;
+};
+
+typedef ModelessDialog_Impl* ModelessDialogPtr_Impl;
+SV_DECL_PTRARR( ModelessDialogPtrArr_Impl, ModelessDialogPtr_Impl, 4, 4 );
+
typedef SfxShell* SfxShellPtr_Impl;
SV_DECL_PTRARR( SfxShellArr_Impl, SfxShellPtr_Impl, 4, 4 );
@@ -89,6 +98,7 @@ struct SfxViewShell_Impl
{
BOOL bControllerSet;
SfxShellArr_Impl aArr;
+ ModelessDialogPtrArr_Impl aDialogArr;
SbxObjectRef xSelectionObj;
SvBorder aBorder;
Size aOptimalSize;
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index e607ddbad200..434a739f84ca 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: viewsh.cxx,v $
*
- * $Revision: 1.13 $
+ * $Revision: 1.14 $
*
- * last change: $Author: mtg $ $Date: 2001-03-23 10:43:09 $
+ * last change: $Author: mba $ $Date: 2001-03-30 15:59:24 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -74,11 +74,6 @@
#ifndef _SFX_WHITER_HXX //autogen
#include <svtools/whiter.hxx>
#endif
-#if SUPD<613//MUSTINI
-#ifndef _SFXINIMGR_HXX //autogen
-#include <svtools/iniman.hxx>
-#endif
-#endif
#ifndef _MSGBOX_HXX //autogen
#include <vcl/msgbox.hxx>
#endif
@@ -914,6 +909,15 @@ USHORT SfxViewShell::PrepareClose
return FALSE;
}
+ ModelessDialogPtrArr_Impl& rArr = pImp->aDialogArr;
+ for ( USHORT nPos=0; rArr.Count(); )
+ {
+ ModelessDialogPtr_Impl pEntry = rArr[nPos];
+ rArr.Remove( nPos );
+ delete pEntry->pDialog;
+ delete pEntry;
+ }
+
return TRUE;
}
@@ -1732,4 +1736,41 @@ Reference < XController > SfxViewShell::GetController()
return pImp->pController;
}
+void SfxViewShell::AddModelessDialog( Dialog* pDialog, USHORT nSlotId )
+{
+ ModelessDialogPtr_Impl pEntry = new ModelessDialog_Impl;
+ pEntry->pDialog = pDialog;
+ pEntry->nSlotId = nSlotId;
+ pImp->aDialogArr.Insert( pEntry, pImp->aDialogArr.Count() );
+
+}
+
+BOOL SfxViewShell::HasModelessDialog( USHORT nSlotId )
+{
+ ModelessDialogPtrArr_Impl& rArr = pImp->aDialogArr;
+ for ( USHORT nPos=0; nPos<rArr.Count(); nPos++ )
+ {
+ ModelessDialogPtr_Impl pEntry = rArr[nPos];
+ if ( pEntry->nSlotId == nSlotId )
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+void SfxViewShell::RemoveModelessDialog( USHORT nSlotId )
+{
+ ModelessDialogPtrArr_Impl& rArr = pImp->aDialogArr;
+ for ( USHORT nPos=0; nPos<rArr.Count(); nPos++ )
+ {
+ ModelessDialogPtr_Impl pEntry = rArr[nPos];
+ if ( pEntry->nSlotId == nSlotId )
+ {
+ rArr.Remove( nPos );
+ delete pEntry->pDialog;
+ delete pEntry;
+ break;
+ }
+ }
+}