summaryrefslogtreecommitdiff
path: root/sc/source/ui
diff options
context:
space:
mode:
authorNiklas Nebel <nn@openoffice.org>2002-05-23 16:26:41 +0000
committerNiklas Nebel <nn@openoffice.org>2002-05-23 16:26:41 +0000
commitf4cbc8207ed944e1253182ff0a264d15ce8b58d6 (patch)
tree9f1e2da4b16174c9e04ffcbb38e9e279964a860f /sc/source/ui
parent292e9056c2708f37c6c1ce3887e378312fb1bb2f (diff)
#98721# support creating field control from field selection window
Diffstat (limited to 'sc/source/ui')
-rw-r--r--sc/source/ui/view/tabvwshb.cxx43
-rw-r--r--sc/source/ui/view/viewfun5.cxx6
2 files changed, 44 insertions, 5 deletions
diff --git a/sc/source/ui/view/tabvwshb.cxx b/sc/source/ui/view/tabvwshb.cxx
index f59fde7c9229..07a7ce186e37 100644
--- a/sc/source/ui/view/tabvwshb.cxx
+++ b/sc/source/ui/view/tabvwshb.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: tabvwshb.cxx,v $
*
- * $Revision: 1.11 $
+ * $Revision: 1.12 $
*
- * last change: $Author: nn $ $Date: 2001-12-21 12:58:39 $
+ * last change: $Author: nn $ $Date: 2002-05-23 17:26:41 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -73,6 +73,7 @@
// INCLUDE ---------------------------------------------------------------
+#include <svx/dataaccessdescriptor.hxx>
#include <svx/pfiledlg.hxx>
#include <svx/svdmark.hxx>
#include <svx/svdograf.hxx>
@@ -113,6 +114,7 @@ SO2_DECL_REF(SvStorage)
#include "fuinsert.hxx"
#include "docsh.hxx"
#include "chartarr.hxx"
+#include "drawview.hxx"
// STATIC DATA -----------------------------------------------------------
@@ -435,6 +437,43 @@ void ScTabViewShell::ExecDrawIns(SfxRequest& rReq)
SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_AREALINKS_CHANGED ) ); // Navigator
rReq.Done();
}
+ break;
+
+ // #98721#
+ case SID_FM_CREATE_FIELDCONTROL:
+ {
+ SFX_REQUEST_ARG( rReq, pDescriptorItem, SfxUnoAnyItem, SID_FM_DATACCESS_DESCRIPTOR, sal_False );
+ DBG_ASSERT( pDescriptorItem, "SID_FM_CREATE_FIELDCONTROL: invalid request args!" );
+
+ if(pDescriptorItem)
+ {
+ //! merge with ScViewFunc::PasteDataFormat (SOT_FORMATSTR_ID_SBA_FIELDDATAEXCHANGE)?
+
+ ScDrawView* pDrView = GetScDrawView();
+ SdrPageView* pPageView = pDrView ? pDrView->GetPageViewPvNum(0) : NULL;
+ if(pPageView)
+ {
+ ::svx::ODataAccessDescriptor aDescriptor(pDescriptorItem->GetValue());
+ SdrObject* pNewDBField = pDrView->CreateFieldControl(aDescriptor);
+
+ if(pNewDBField)
+ {
+ Rectangle aVisArea = pWin->PixelToLogic(Rectangle(Point(0,0), pWin->GetOutputSizePixel()));
+ Point aObjPos(aVisArea.Center());
+ Size aObjSize(pNewDBField->GetLogicRect().GetSize());
+ aObjPos.X() -= aObjSize.Width() / 2;
+ aObjPos.Y() -= aObjSize.Height() / 2;
+ Rectangle aNewObjectRectangle(aObjPos, aObjSize);
+
+ pNewDBField->SetLogicRect(aNewObjectRectangle);
+
+ pView->InsertObject(pNewDBField, *pPageView, pView->IsSolidDraggingNow() ? SDRINSERT_NOBROADCAST : 0);
+ }
+ }
+ }
+ rReq.Done();
+ }
+ break;
}
}
diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx
index 0a3b79539b42..e65386d381b0 100644
--- a/sc/source/ui/view/viewfun5.cxx
+++ b/sc/source/ui/view/viewfun5.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: viewfun5.cxx,v $
*
- * $Revision: 1.18 $
+ * $Revision: 1.19 $
*
- * last change: $Author: dr $ $Date: 2001-11-07 12:49:49 $
+ * last change: $Author: nn $ $Date: 2002-05-23 17:26:41 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -323,7 +323,7 @@ BOOL ScViewFunc::PasteDataFormat( ULONG nFormatId,
{
// insert database field control
- if ( ::svx::OColumnTransferable::canExtractColumnDescriptor( aDataHelper.GetDataFlavorExVector(), CTF_COLUMN_DESCRIPTOR ) )
+ if ( ::svx::OColumnTransferable::canExtractColumnDescriptor( aDataHelper.GetDataFlavorExVector(), CTF_COLUMN_DESCRIPTOR | CTF_CONTROL_EXCHANGE ) )
{
MakeDrawLayer();
ScDrawView* pDrawView = GetScDrawView();