summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorNiklas Nebel <nn@openoffice.org>2001-04-23 15:58:49 +0000
committerNiklas Nebel <nn@openoffice.org>2001-04-23 15:58:49 +0000
commitb19d42975e49b86b0c6615ab9809d2a0fc1a389f (patch)
treef4676c3f590992abbc42ba3f1535cf34d9cbf846 /sc
parentfa6a201a5c54793dac81eb1cf7ada6e04c321d94 (diff)
slot for clipboard controller
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/drawfunc/drtxtob.cxx63
-rw-r--r--sc/source/ui/drawfunc/drtxtob1.cxx52
-rw-r--r--sc/source/ui/drawfunc/drtxtob2.cxx71
3 files changed, 70 insertions, 116 deletions
diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx
index 0caf5ffa70f5..becf20081771 100644
--- a/sc/source/ui/drawfunc/drtxtob.cxx
+++ b/sc/source/ui/drawfunc/drtxtob.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: drtxtob.cxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: nn $ $Date: 2001-03-26 19:26:30 $
+ * last change: $Author: nn $ $Date: 2001-04-23 16:58:49 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -173,6 +173,7 @@
#define ITEMID_FIELD EE_FEATURE_FIELD
#include <svx/adjitem.hxx>
+#include <svx/clipfmtitem.hxx>
#include <svx/cntritem.hxx>
#include <svx/crsditem.hxx>
#include <svx/editeng.hxx>
@@ -195,6 +196,7 @@
#include <sfx2/objsh.hxx>
#include <sfx2/request.hxx>
#include <sfx2/viewfrm.hxx>
+#include <svtools/transfer.hxx>
#include <svtools/whiter.hxx>
#include <vcl/msgbox.hxx>
@@ -290,27 +292,31 @@ void __EXPORT ScDrawTextObjectBar::Execute( SfxRequest &rReq )
pOutView->PasteSpecial();
break;
- case FID_PASTE_CONTENTS:
+ case SID_CLIPBOARD_FORMAT_ITEMS:
{
- ExecutePasteContents( rReq );
-/*
- SvDataObjectRef pClipObj = SvDataObject::PasteClipboard();
- if (pClipObj.Is())
+ ULONG nFormat = 0;
+ const SfxPoolItem* pItem;
+ if ( pReqArgs &&
+ pReqArgs->GetItemState(nSlot, TRUE, &pItem) == SFX_ITEM_SET &&
+ pItem->ISA(SfxUInt32Item) )
+ {
+ nFormat = ((const SfxUInt32Item*)pItem)->GetValue();
+ }
+
+ if ( nFormat )
{
- SvPasteObjectDialog* pDlg = new SvPasteObjectDialog;
- pDlg->Insert( FORMAT_STRING, ResId( SCSTR_CLIP_STRING ) );
- pDlg->Insert( FORMAT_RTF, ResId( SCSTR_CLIP_RTF ) );
- ULONG nFormat = pDlg->Execute( Application::GetAppWindow(), pClipObj );
- if (nFormat == FORMAT_STRING)
+ if (nFormat == SOT_FORMAT_STRING)
pOutView->Paste();
else
pOutView->PasteSpecial();
- delete pDlg;
}
-*/
}
break;
+ case FID_PASTE_CONTENTS:
+ ExecutePasteContents( rReq );
+ break;
+
case SID_SELECTALL:
{
ULONG nCount = pOutliner->GetParagraphCount();
@@ -473,18 +479,8 @@ void __EXPORT ScDrawTextObjectBar::GetClipState( SfxItemSet& rSet )
return;
}
- BOOL bPaste = HasPasteContents();
-/*
- BOOL bPaste = FALSE;
- SvDataObjectRef pClipObj = SvDataObject::PasteClipboard();
- if (pClipObj.Is())
- {
- const SvDataTypeList& rTypeLst = pClipObj->GetTypeList();
-
- if( rTypeLst.Get( FORMAT_STRING ) || rTypeLst.Get( FORMAT_RTF ) )
- bPaste = TRUE;
- }
-*/
+ TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard() );
+ BOOL bPaste = ( aDataHelper.HasFormat( SOT_FORMAT_STRING ) || aDataHelper.HasFormat( SOT_FORMAT_RTF ) );
SfxWhichIter aIter( rSet );
USHORT nWhich = aIter.FirstWhich();
@@ -497,6 +493,21 @@ void __EXPORT ScDrawTextObjectBar::GetClipState( SfxItemSet& rSet )
if( !bPaste )
rSet.DisableItem( nWhich );
break;
+ case SID_CLIPBOARD_FORMAT_ITEMS:
+ if ( bPaste )
+ {
+ SvxClipboardFmtItem aFormats( SID_CLIPBOARD_FORMAT_ITEMS );
+
+ if ( aDataHelper.HasFormat( SOT_FORMAT_STRING ) )
+ aFormats.AddClipbrdFormat( SOT_FORMAT_STRING, String( ScResId( SCSTR_CLIP_STRING ) ) );
+ if ( aDataHelper.HasFormat( SOT_FORMAT_RTF ) )
+ aFormats.AddClipbrdFormat( SOT_FORMAT_RTF, String( ScResId( SCSTR_CLIP_RTF ) ) );
+
+ rSet.Put( aFormats );
+ }
+ else
+ rSet.DisableItem( nWhich );
+ break;
}
nWhich = aIter.NextWhich();
}
diff --git a/sc/source/ui/drawfunc/drtxtob1.cxx b/sc/source/ui/drawfunc/drtxtob1.cxx
index cff89dd37d7f..e561725856e2 100644
--- a/sc/source/ui/drawfunc/drtxtob1.cxx
+++ b/sc/source/ui/drawfunc/drtxtob1.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: drtxtob1.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: mh $ $Date: 2000-12-07 10:03:57 $
+ * last change: $Author: nn $ $Date: 2001-04-23 16:58:49 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -80,6 +80,7 @@
#include <so3/pastedlg.hxx>
#include <sot/exchange.hxx>
#include <vcl/msgbox.hxx>
+#include <svtools/transfer.hxx>
#include "sc.hrc"
#include "drtxtob.hxx"
@@ -153,45 +154,24 @@ BOOL ScDrawTextObjectBar::ExecuteParaDlg( const SfxItemSet& rArgs,
void ScDrawTextObjectBar::ExecutePasteContents( SfxRequest &rReq )
{
- SvDataObjectRef pClipObj = SvDataObject::PasteClipboard();
- if (pClipObj.Is())
- {
- SdrView* pView = pViewData->GetScDrawView();
- OutlinerView* pOutView = pView->GetTextEditOutlinerView();
- SvPasteObjectDialog* pDlg = new SvPasteObjectDialog;
-
- pDlg->Insert( FORMAT_STRING, ScResId( SCSTR_CLIP_STRING ) );
- pDlg->Insert( FORMAT_RTF, ScResId( SCSTR_CLIP_RTF ) );
+ SdrView* pView = pViewData->GetScDrawView();
+ OutlinerView* pOutView = pView->GetTextEditOutlinerView();
+ SvPasteObjectDialog* pDlg = new SvPasteObjectDialog;
- ULONG nFormat = pDlg->Execute( pViewData->GetDialogParent(), pClipObj );
+ pDlg->Insert( SOT_FORMAT_STRING, ScResId( SCSTR_CLIP_STRING ) );
+ pDlg->Insert( SOT_FORMAT_RTF, ScResId( SCSTR_CLIP_RTF ) );
- //! test if outliner view is still valid
+ TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard() );
- if (nFormat == FORMAT_STRING)
- pOutView->Paste();
- else
- pOutView->PasteSpecial();
- delete pDlg;
- }
-}
+ ULONG nFormat = pDlg->Execute( pViewData->GetDialogParent(), aDataHelper.GetTransferable() );
-BOOL ScDrawTextObjectBar::HasPasteContents()
-{
- BOOL bResult = FALSE;
-
- SvDataObjectRef pClipObj = SvDataObject::PasteClipboard();
- if (pClipObj.Is())
- {
- const SvDataTypeList& rTypeLst = pClipObj->GetTypeList();
+ //! test if outliner view is still valid
- if( rTypeLst.Get( FORMAT_STRING ) || rTypeLst.Get( FORMAT_RTF ) )
- bResult = TRUE;
- }
-
- return bResult;
+ if (nFormat == SOT_FORMAT_STRING)
+ pOutView->Paste();
+ else
+ pOutView->PasteSpecial();
+ delete pDlg;
}
-
-
-
diff --git a/sc/source/ui/drawfunc/drtxtob2.cxx b/sc/source/ui/drawfunc/drtxtob2.cxx
index 21591f23a97e..b7976ea86da4 100644
--- a/sc/source/ui/drawfunc/drtxtob2.cxx
+++ b/sc/source/ui/drawfunc/drtxtob2.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: drtxtob2.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: nn $ $Date: 2001-03-09 19:47:42 $
+ * last change: $Author: nn $ $Date: 2001-04-23 16:58:49 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -354,6 +354,7 @@
#include <sfx2/objsh.hxx>
#include <sfx2/request.hxx>
#include <sot/formats.hxx>
+#include <svtools/whiter.hxx>
#include "sc.hrc"
#include "drtxtob.hxx"
@@ -402,8 +403,13 @@ void __EXPORT ScDrawTextObjectBar::ExecuteGlobal( SfxRequest &rReq )
case SID_PASTE:
case FID_PASTE_CONTENTS:
+ case SID_CLIPBOARD_FORMAT_ITEMS:
case SID_HYPERLINK_SETLINK:
- pViewData->GetViewShell()->ExecuteSlot( rReq );
+ {
+ // cell methods are at cell shell, which is not available if
+ // ScDrawTextObjectBar is active
+ //! move paste etc. to view shell?
+ }
break;
case SID_SELECTALL:
@@ -430,60 +436,17 @@ void __EXPORT ScDrawTextObjectBar::ExecuteGlobal( SfxRequest &rReq )
void ScDrawTextObjectBar::GetGlobalClipState( SfxItemSet& rSet )
{
- //pViewData->GetViewShell()->GetClipState( rSet );
-
- ScTabViewShell* pTabViewShell = pViewData->GetViewShell();
-
- BOOL bDisable = TRUE;
-
-// SID_PASTE
-// FID_PASTE_CONTENTS
-
- if ( ScTransferObj::GetOwnClipboard() || ScDrawTransferObj::GetOwnClipboard() )
- bDisable = FALSE;
- else
- {
- SvDataObjectRef pClipObj = SvDataObject::PasteClipboard();
- if (pClipObj.Is())
- {
- const SvDataTypeList& rTypeLst = pClipObj->GetTypeList();
-
- if( rTypeLst.Get( FORMAT_BITMAP ) ||
- rTypeLst.Get( FORMAT_GDIMETAFILE ) ||
- rTypeLst.Get( SOT_FORMATSTR_ID_SVXB ) ||
- rTypeLst.Get( FORMAT_PRIVATE ) ||
- rTypeLst.Get( FORMAT_RTF ) ||
- rTypeLst.Get( SOT_FORMATSTR_ID_EMBED_SOURCE ) ||
- rTypeLst.Get( SOT_FORMATSTR_ID_LINK_SOURCE ) ||
- rTypeLst.Get( SOT_FORMATSTR_ID_EMBED_SOURCE_OLE ) ||
- rTypeLst.Get( SOT_FORMATSTR_ID_LINK_SOURCE_OLE ) ||
- ScImportExport::IsFormatSupported( pClipObj ) )
- bDisable = FALSE;
- }
- }
-
- // Zellschutz / Multiselektion
+ // cell methods are at cell shell, which is not available if
+ // ScDrawTextObjectBar is active -> disable everything
+ //! move paste etc. to view shell?
- if (!bDisable)
+ SfxWhichIter aIter(rSet);
+ USHORT nWhich = aIter.FirstWhich();
+ while (nWhich)
{
- USHORT nCol = pViewData->GetCurX();
- USHORT nRow = pViewData->GetCurY();
- USHORT nTab = pViewData->GetTabNo();
- ScDocument* pDoc = pViewData->GetDocShell()->GetDocument();
- if (!pDoc->IsBlockEditable( nTab, nCol,nRow, nCol,nRow ))
- bDisable = TRUE;
- ScMarkData& rMark = pViewData->GetMarkData();
- if (rMark.IsMultiMarked())
- bDisable = TRUE;
+ rSet.DisableItem( nWhich );
+ nWhich = aIter.NextWhich();
}
-
- if (bDisable)
- {
- rSet.DisableItem( SID_PASTE );
- rSet.DisableItem( FID_PASTE_CONTENTS );
- }
-
- return;
}
void __EXPORT ScDrawTextObjectBar::ExecuteExtra( SfxRequest &rReq )