2000-09-18 16:07:07 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-11 00:29:34 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-11 00:29:34 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-11 00:29:34 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-11 00:29:34 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-11 00:29:34 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-11 00:29:34 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-07-21 13:53:58 +00:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_sc.hxx"
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
// INCLUDE ---------------------------------------------------------------
|
|
|
|
|
2004-10-04 19:22:52 +00:00
|
|
|
#include <com/sun/star/embed/EmbedStates.hpp>
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
#include <svx/svditer.hxx>
|
|
|
|
#include <svx/svdograf.hxx>
|
2004-08-12 08:30:19 +00:00
|
|
|
#include <svx/svdomedia.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
#include <svx/svdogrp.hxx>
|
|
|
|
#include <svx/svdoole2.hxx>
|
|
|
|
#include <svx/svdouno.hxx>
|
|
|
|
#include <svx/svdpage.hxx>
|
2003-04-24 13:05:34 +00:00
|
|
|
#include <svx/svdundo.hxx>
|
2004-09-08 12:58:27 +00:00
|
|
|
#include <svx/svdocapt.hxx>
|
2010-01-08 18:32:51 +01:00
|
|
|
#include <editeng/outlobj.hxx>
|
|
|
|
#include <editeng/writingmodeitem.hxx>
|
2008-01-29 14:48:58 +00:00
|
|
|
#include <svx/sdrpaintwindow.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
#include <sfx2/bindings.hxx>
|
2004-10-04 19:22:52 +00:00
|
|
|
#include <sfx2/viewfrm.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
#include "drawview.hxx"
|
|
|
|
#include "global.hxx"
|
|
|
|
#include "viewdata.hxx"
|
|
|
|
#include "document.hxx"
|
|
|
|
#include "drawutil.hxx"
|
2004-11-09 17:01:30 +00:00
|
|
|
#include "futext.hxx"
|
2000-09-18 16:07:07 +00:00
|
|
|
#include "globstr.hrc"
|
|
|
|
#include "tabvwsh.hxx"
|
|
|
|
#include "client.hxx"
|
|
|
|
#include "scmod.hxx"
|
|
|
|
#include "drwlayer.hxx"
|
2001-05-11 07:37:53 +00:00
|
|
|
#include "docsh.hxx"
|
2002-06-13 11:18:00 +00:00
|
|
|
#include "viewuno.hxx"
|
2004-09-08 12:58:27 +00:00
|
|
|
#include "userdat.hxx"
|
2008-01-29 14:48:58 +00:00
|
|
|
#include "postit.hxx"
|
2009-03-02 14:19:13 +00:00
|
|
|
#include "undocell.hxx"
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
#include "sc.hrc"
|
|
|
|
|
2002-06-13 11:18:00 +00:00
|
|
|
using namespace com::sun::star;
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
#define SC_HANDLESIZE_BIG 9
|
|
|
|
#define SC_HANDLESIZE_SMALL 7
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2007-09-06 13:21:17 +00:00
|
|
|
#ifdef _MSC_VER
|
2000-09-18 16:07:07 +00:00
|
|
|
#pragma optimize ( "", off )
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
void ScDrawView::Construct()
|
|
|
|
{
|
|
|
|
EnableExtendedKeyInputDispatcher(FALSE);
|
|
|
|
EnableExtendedMouseEventDispatcher(FALSE);
|
|
|
|
EnableExtendedCommandEventDispatcher(FALSE);
|
|
|
|
|
|
|
|
SetFrameDragSingles(TRUE);
|
|
|
|
// SetSolidMarkHdl(TRUE); // einstellbar -> UpdateUserViewOptions
|
|
|
|
|
|
|
|
SetMinMoveDistancePixel( 2 );
|
|
|
|
SetHitTolerancePixel( 2 );
|
|
|
|
|
|
|
|
if (pViewData)
|
|
|
|
{
|
2007-02-27 12:50:54 +00:00
|
|
|
SCTAB nViewTab = pViewData->GetTabNo();
|
|
|
|
ShowSdrPage(GetModel()->GetPage(nViewTab));
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
BOOL bEx = pViewData->GetViewShell()->IsDrawSelMode();
|
2007-02-27 12:50:54 +00:00
|
|
|
BOOL bProt = pDoc->IsTabProtected( nViewTab ) ||
|
2000-09-18 16:07:07 +00:00
|
|
|
pViewData->GetSfxDocShell()->IsReadOnly();
|
|
|
|
|
|
|
|
SdrLayer* pLayer;
|
|
|
|
SdrLayerAdmin& rAdmin = GetModel()->GetLayerAdmin();
|
|
|
|
pLayer = rAdmin.GetLayerPerID(SC_LAYER_BACK);
|
|
|
|
if (pLayer)
|
|
|
|
SetLayerLocked( pLayer->GetName(), bProt || !bEx );
|
|
|
|
pLayer = rAdmin.GetLayerPerID(SC_LAYER_INTERN);
|
|
|
|
if (pLayer)
|
|
|
|
SetLayerLocked( pLayer->GetName(), TRUE );
|
|
|
|
pLayer = rAdmin.GetLayerPerID(SC_LAYER_FRONT);
|
|
|
|
if (pLayer)
|
|
|
|
{
|
|
|
|
SetLayerLocked( pLayer->GetName(), bProt );
|
|
|
|
SetActiveLayer( pLayer->GetName() ); // FRONT als aktiven Layer setzen
|
|
|
|
}
|
|
|
|
pLayer = rAdmin.GetLayerPerID(SC_LAYER_CONTROLS);
|
|
|
|
if (pLayer)
|
|
|
|
SetLayerLocked( pLayer->GetName(), bProt );
|
2005-01-13 16:23:47 +00:00
|
|
|
pLayer = rAdmin.GetLayerPerID(SC_LAYER_HIDDEN);
|
|
|
|
if (pLayer)
|
|
|
|
{
|
|
|
|
SetLayerLocked( pLayer->GetName(), bProt );
|
|
|
|
SetLayerVisible( pLayer->GetName(), sal_False);
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
SetSwapAsynchron(TRUE);
|
|
|
|
}
|
|
|
|
else
|
2006-11-14 14:56:10 +00:00
|
|
|
{
|
|
|
|
ShowSdrPage(GetModel()->GetPage(nTab));
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
UpdateUserViewOptions();
|
|
|
|
RecalcScale();
|
|
|
|
UpdateWorkArea();
|
|
|
|
|
|
|
|
bInConstruct = FALSE;
|
|
|
|
}
|
|
|
|
|
2006-11-14 14:56:10 +00:00
|
|
|
void ScDrawView::ImplClearCalcDropMarker()
|
|
|
|
{
|
|
|
|
if(pDropMarker)
|
|
|
|
{
|
|
|
|
delete pDropMarker;
|
|
|
|
pDropMarker = 0L;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
__EXPORT ScDrawView::~ScDrawView()
|
|
|
|
{
|
2006-11-14 14:56:10 +00:00
|
|
|
ImplClearCalcDropMarker();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ScDrawView::AddCustomHdl()
|
|
|
|
{
|
2004-02-03 11:52:10 +00:00
|
|
|
BOOL bNegativePage = pDoc->IsNegativePage( nTab );
|
|
|
|
|
2004-07-12 14:30:47 +00:00
|
|
|
const SdrMarkList &rMrkList = GetMarkedObjectList();
|
2000-09-18 16:07:07 +00:00
|
|
|
UINT32 nCount = rMrkList.GetMarkCount();
|
|
|
|
for(UINT32 nPos=0; nPos<nCount; nPos++ )
|
|
|
|
{
|
2006-07-25 11:27:11 +00:00
|
|
|
const SdrObject* pObj = rMrkList.GetMark(nPos)->GetMarkedSdrObj();
|
2000-09-18 16:07:07 +00:00
|
|
|
if(ScDrawLayer::GetAnchor(pObj) == SCA_CELL)
|
|
|
|
{
|
|
|
|
const INT32 nDelta = 1;
|
|
|
|
|
2004-02-03 11:52:10 +00:00
|
|
|
Rectangle aBoundRect = pObj->GetCurrentBoundRect();
|
|
|
|
Point aPos;
|
|
|
|
if (bNegativePage)
|
|
|
|
{
|
|
|
|
aPos = aBoundRect.TopRight();
|
|
|
|
aPos.X() = -aPos.X(); // so the loop below is the same
|
|
|
|
}
|
|
|
|
else
|
|
|
|
aPos = aBoundRect.TopLeft();
|
2000-09-18 16:07:07 +00:00
|
|
|
long nPosX = (long) (aPos.X() / HMM_PER_TWIPS) + nDelta;
|
|
|
|
long nPosY = (long) (aPos.Y() / HMM_PER_TWIPS) + nDelta;
|
|
|
|
|
2004-06-04 11:00:26 +00:00
|
|
|
SCCOL nCol;
|
2000-09-18 16:07:07 +00:00
|
|
|
INT32 nWidth = 0;
|
|
|
|
|
|
|
|
for(nCol=0; nCol<=MAXCOL && nWidth<=nPosX; nCol++)
|
|
|
|
nWidth += pDoc->GetColWidth(nCol,nTab);
|
|
|
|
|
2004-06-04 11:00:26 +00:00
|
|
|
if(nCol > 0)
|
2000-09-18 16:07:07 +00:00
|
|
|
--nCol;
|
|
|
|
|
2010-06-23 13:38:34 +02:00
|
|
|
SCROW nRow = nPosY <= 0 ? 0 : pDoc->GetRowForHeight( nTab,
|
2004-08-20 08:15:52 +00:00
|
|
|
(ULONG) nPosY);
|
2004-06-04 11:00:26 +00:00
|
|
|
if(nRow > 0)
|
2000-09-18 16:07:07 +00:00
|
|
|
--nRow;
|
|
|
|
|
|
|
|
ScTabView* pView = pViewData->GetView();
|
|
|
|
ScAddress aScAddress(nCol, nRow, nTab);
|
|
|
|
pView->CreateAnchorHandles(aHdl, aScAddress);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScDrawView::InvalidateAttribs()
|
|
|
|
{
|
2000-09-22 17:57:10 +00:00
|
|
|
if (!pViewData) return;
|
|
|
|
SfxBindings& rBindings = pViewData->GetBindings();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
// echte Statuswerte:
|
2004-10-12 17:19:10 +00:00
|
|
|
rBindings.InvalidateAll( TRUE );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ScDrawView::InvalidateDrawTextAttrs()
|
|
|
|
{
|
2000-09-22 17:57:10 +00:00
|
|
|
if (!pViewData) return;
|
|
|
|
SfxBindings& rBindings = pViewData->GetBindings();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2000-11-25 13:57:47 +00:00
|
|
|
// cjk/ctl font items have no configured slots,
|
|
|
|
// need no invalidate
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
rBindings.Invalidate( SID_ATTR_CHAR_FONT );
|
|
|
|
rBindings.Invalidate( SID_ATTR_CHAR_FONTHEIGHT );
|
|
|
|
rBindings.Invalidate( SID_ATTR_CHAR_WEIGHT );
|
|
|
|
rBindings.Invalidate( SID_ATTR_CHAR_POSTURE );
|
|
|
|
rBindings.Invalidate( SID_ATTR_CHAR_UNDERLINE );
|
|
|
|
rBindings.Invalidate( SID_ULINE_VAL_NONE );
|
|
|
|
rBindings.Invalidate( SID_ULINE_VAL_SINGLE );
|
|
|
|
rBindings.Invalidate( SID_ULINE_VAL_DOUBLE );
|
|
|
|
rBindings.Invalidate( SID_ULINE_VAL_DOTTED );
|
2009-01-05 17:49:45 +00:00
|
|
|
rBindings.Invalidate( SID_ATTR_CHAR_OVERLINE );
|
2000-09-18 16:07:07 +00:00
|
|
|
rBindings.Invalidate( SID_ATTR_CHAR_COLOR );
|
2002-08-19 13:39:33 +00:00
|
|
|
rBindings.Invalidate( SID_ALIGNLEFT );
|
|
|
|
rBindings.Invalidate( SID_ALIGNCENTERHOR );
|
|
|
|
rBindings.Invalidate( SID_ALIGNRIGHT );
|
|
|
|
rBindings.Invalidate( SID_ALIGNBLOCK );
|
2000-09-18 16:07:07 +00:00
|
|
|
rBindings.Invalidate( SID_ATTR_PARA_LINESPACE_10 );
|
|
|
|
rBindings.Invalidate( SID_ATTR_PARA_LINESPACE_15 );
|
|
|
|
rBindings.Invalidate( SID_ATTR_PARA_LINESPACE_20 );
|
|
|
|
rBindings.Invalidate( SID_SET_SUPER_SCRIPT );
|
|
|
|
rBindings.Invalidate( SID_SET_SUB_SCRIPT );
|
2001-03-02 20:05:03 +00:00
|
|
|
rBindings.Invalidate( SID_TEXTDIRECTION_LEFT_TO_RIGHT );
|
|
|
|
rBindings.Invalidate( SID_TEXTDIRECTION_TOP_TO_BOTTOM );
|
2002-09-12 17:08:57 +00:00
|
|
|
rBindings.Invalidate( SID_ATTR_PARA_LEFT_TO_RIGHT );
|
|
|
|
rBindings.Invalidate( SID_ATTR_PARA_RIGHT_TO_LEFT );
|
2004-08-02 11:59:26 +00:00
|
|
|
// pseudo slots for Format menu
|
|
|
|
rBindings.Invalidate( SID_ALIGN_ANY_LEFT );
|
|
|
|
rBindings.Invalidate( SID_ALIGN_ANY_HCENTER );
|
|
|
|
rBindings.Invalidate( SID_ALIGN_ANY_RIGHT );
|
|
|
|
rBindings.Invalidate( SID_ALIGN_ANY_JUSTIFIED );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2006-11-14 14:56:10 +00:00
|
|
|
//void ScDrawView::DrawMarks( OutputDevice* pOut ) const
|
|
|
|
//{
|
|
|
|
// DBG_ASSERT(pOut, "ScDrawView::DrawMarks: No OutputDevice (!)");
|
|
|
|
// SdrPaintWindow* pPaintWindow = FindPaintWindow(*pOut);
|
|
|
|
//
|
|
|
|
// if(pPaintWindow)
|
|
|
|
// {
|
|
|
|
// if(pPaintWindow->isXorVisible())
|
|
|
|
// {
|
|
|
|
// ToggleShownXor(pOut, 0L);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
void ScDrawView::SetMarkedToLayer( BYTE nLayerNo )
|
|
|
|
{
|
2004-07-12 14:30:47 +00:00
|
|
|
if (AreObjectsMarked())
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2003-04-24 13:05:34 +00:00
|
|
|
// #i11702# use SdrUndoObjectLayerChange for undo
|
|
|
|
// STR_UNDO_SELATTR is "Attributes" - should use a different text later
|
|
|
|
BegUndo( ScGlobal::GetRscString( STR_UNDO_SELATTR ) );
|
|
|
|
|
2004-07-12 14:30:47 +00:00
|
|
|
const SdrMarkList& rMark = GetMarkedObjectList();
|
2000-09-18 16:07:07 +00:00
|
|
|
ULONG nCount = rMark.GetMarkCount();
|
|
|
|
for (ULONG i=0; i<nCount; i++)
|
|
|
|
{
|
2006-07-25 11:27:11 +00:00
|
|
|
SdrObject* pObj = rMark.GetMark(i)->GetMarkedSdrObj();
|
2009-03-02 14:19:13 +00:00
|
|
|
if ( !pObj->ISA(SdrUnoObj) && (pObj->GetLayer() != SC_LAYER_INTERN) )
|
2003-04-24 13:05:34 +00:00
|
|
|
{
|
|
|
|
AddUndo( new SdrUndoObjectLayerChange( *pObj, pObj->GetLayer(), (SdrLayerID)nLayerNo) );
|
2000-09-18 16:07:07 +00:00
|
|
|
pObj->SetLayer( nLayerNo );
|
2003-04-24 13:05:34 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2003-04-24 13:05:34 +00:00
|
|
|
EndUndo();
|
|
|
|
|
|
|
|
// repaint is done in SetLayer
|
2001-02-16 17:55:38 +00:00
|
|
|
|
2001-05-11 07:37:53 +00:00
|
|
|
pViewData->GetDocShell()->SetDrawModified();
|
|
|
|
|
2001-02-16 17:55:38 +00:00
|
|
|
// #84073# check mark list now instead of later in a timer
|
|
|
|
CheckMarked();
|
|
|
|
MarkListHasChanged();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-02 14:19:13 +00:00
|
|
|
bool ScDrawView::HasMarkedControl() const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2009-03-02 14:19:13 +00:00
|
|
|
SdrObjListIter aIter( GetMarkedObjectList() );
|
|
|
|
for( SdrObject* pObj = aIter.Next(); pObj; pObj = aIter.Next() )
|
|
|
|
if( pObj->ISA( SdrUnoObj ) )
|
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2009-03-02 14:19:13 +00:00
|
|
|
bool ScDrawView::HasMarkedInternal() const
|
|
|
|
{
|
|
|
|
// internal objects should not be inside a group, but who knows...
|
|
|
|
SdrObjListIter aIter( GetMarkedObjectList() );
|
|
|
|
for( SdrObject* pObj = aIter.Next(); pObj; pObj = aIter.Next() )
|
|
|
|
if( pObj->GetLayer() == SC_LAYER_INTERN )
|
|
|
|
return true;
|
|
|
|
return false;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ScDrawView::UpdateWorkArea()
|
|
|
|
{
|
2004-06-04 11:00:26 +00:00
|
|
|
SdrPage* pPage = GetModel()->GetPage(static_cast<sal_uInt16>(nTab));
|
2000-09-18 16:07:07 +00:00
|
|
|
if (pPage)
|
2004-02-03 11:52:10 +00:00
|
|
|
{
|
|
|
|
Point aPos;
|
|
|
|
Size aPageSize( pPage->GetSize() );
|
|
|
|
Rectangle aNewArea( aPos, aPageSize );
|
|
|
|
if ( aPageSize.Width() < 0 )
|
|
|
|
{
|
|
|
|
// RTL: from max.negative (left) to zero (right)
|
|
|
|
aNewArea.Right() = 0;
|
|
|
|
aNewArea.Left() = aPageSize.Width() + 1;
|
|
|
|
}
|
|
|
|
SetWorkArea( aNewArea );
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
2008-01-29 14:48:58 +00:00
|
|
|
{
|
2000-09-18 16:07:07 +00:00
|
|
|
DBG_ERROR("Page nicht gefunden");
|
2008-01-29 14:48:58 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ScDrawView::DoCut()
|
|
|
|
{
|
|
|
|
DoCopy();
|
|
|
|
BegUndo( ScGlobal::GetRscString( STR_UNDO_CUT ) );
|
|
|
|
DeleteMarked(); // auf dieser View - von der 505f Umstellung nicht betroffen
|
|
|
|
EndUndo();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScDrawView::GetScale( Fraction& rFractX, Fraction& rFractY ) const
|
|
|
|
{
|
|
|
|
rFractX = aScaleX;
|
|
|
|
rFractY = aScaleY;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScDrawView::RecalcScale()
|
|
|
|
{
|
|
|
|
double nPPTX;
|
|
|
|
double nPPTY;
|
|
|
|
Fraction aZoomX(1,1);
|
|
|
|
Fraction aZoomY(1,1);
|
|
|
|
|
|
|
|
if (pViewData)
|
|
|
|
{
|
|
|
|
nTab = pViewData->GetTabNo();
|
|
|
|
nPPTX = pViewData->GetPPTX();
|
|
|
|
nPPTY = pViewData->GetPPTY();
|
|
|
|
aZoomX = pViewData->GetZoomX();
|
|
|
|
aZoomY = pViewData->GetZoomY();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Point aLogic = pDev->LogicToPixel( Point(1000,1000), MAP_TWIP );
|
|
|
|
nPPTX = aLogic.X() / 1000.0;
|
|
|
|
nPPTY = aLogic.Y() / 1000.0;
|
|
|
|
//! Zoom uebergeben ???
|
|
|
|
}
|
|
|
|
|
2004-06-04 11:00:26 +00:00
|
|
|
SCCOL nEndCol = 0;
|
|
|
|
SCROW nEndRow = 0;
|
2000-09-18 16:07:07 +00:00
|
|
|
pDoc->GetTableArea( nTab, nEndCol, nEndRow );
|
|
|
|
if (nEndCol<20)
|
|
|
|
nEndCol = 20;
|
2010-11-02 17:28:24 +01:00
|
|
|
if (nEndRow<20)
|
2010-06-23 13:38:34 +02:00
|
|
|
nEndRow = 1000;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
ScDrawUtil::CalcScale( pDoc, nTab, 0,0, nEndCol,nEndRow, pDev,aZoomX,aZoomY,nPPTX,nPPTY,
|
|
|
|
aScaleX,aScaleY );
|
|
|
|
}
|
|
|
|
|
2005-02-21 15:04:22 +00:00
|
|
|
void ScDrawView::DoConnect(SdrOle2Obj* pOleObj)
|
|
|
|
{
|
|
|
|
if ( pViewData )
|
|
|
|
pViewData->GetViewShell()->ConnectObject( pOleObj );
|
|
|
|
}
|
|
|
|
|
2009-03-02 14:19:13 +00:00
|
|
|
void ScDrawView::MarkListHasChanged()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
FmFormView::MarkListHasChanged();
|
|
|
|
|
|
|
|
UpdateBrowser();
|
|
|
|
|
|
|
|
ScTabViewShell* pViewSh = pViewData->GetViewShell();
|
|
|
|
|
2010-04-19 13:53:40 +02:00
|
|
|
// #i110829# remove the cell selection only if drawing objects are selected
|
|
|
|
if ( !bInConstruct && GetMarkedObjectList().GetMarkCount() )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2010-04-19 13:53:40 +02:00
|
|
|
pViewSh->Unmark(); // remove cell selection
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
// #65379# end cell edit mode if drawing objects are selected
|
2010-04-19 13:53:40 +02:00
|
|
|
SC_MOD()->InputEnterHandler();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// IP deaktivieren
|
|
|
|
|
2007-05-22 19:13:22 +00:00
|
|
|
ScModule* pScMod = SC_MOD();
|
|
|
|
bool bUnoRefDialog = pScMod->IsRefDialogOpen() && pScMod->GetCurRefDlgId() == WID_SIMPLE_REF;
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
ScClient* pClient = (ScClient*) pViewSh->GetIPClient();
|
2007-05-22 19:13:22 +00:00
|
|
|
if ( pClient && pClient->IsObjectInPlaceActive() && !bUnoRefDialog )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
// #41730# beim ViewShell::Activate aus dem Reset2Open nicht die Handles anzeigen
|
2006-12-12 15:09:01 +00:00
|
|
|
//HMHbDisableHdl = TRUE;
|
2006-11-01 17:22:48 +00:00
|
|
|
pClient->DeactivateObject();
|
2006-12-12 15:09:01 +00:00
|
|
|
//HMHbDisableHdl = FALSE;
|
2000-09-18 16:07:07 +00:00
|
|
|
// Image-Ole wieder durch Grafik ersetzen passiert jetzt in ScClient::UIActivate
|
|
|
|
}
|
|
|
|
|
|
|
|
// Ole-Objekt selektiert?
|
|
|
|
|
|
|
|
SdrOle2Obj* pOle2Obj = NULL;
|
|
|
|
SdrGrafObj* pGrafObj = NULL;
|
2004-08-12 08:30:19 +00:00
|
|
|
SdrMediaObj* pMediaObj = NULL;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2004-07-12 14:30:47 +00:00
|
|
|
const SdrMarkList& rMarkList = GetMarkedObjectList();
|
2000-09-18 16:07:07 +00:00
|
|
|
ULONG nMarkCount = rMarkList.GetMarkCount();
|
|
|
|
|
|
|
|
if ( nMarkCount == 0 && !pViewData->GetViewShell()->IsDrawSelMode() && !bInConstruct )
|
|
|
|
{
|
2009-03-02 14:19:13 +00:00
|
|
|
// relock layers that may have been unlocked before
|
|
|
|
LockBackgroundLayer();
|
|
|
|
LockInternalLayer();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2000-10-20 17:27:00 +00:00
|
|
|
BOOL bSubShellSet = FALSE;
|
2000-09-18 16:07:07 +00:00
|
|
|
if (nMarkCount == 1)
|
|
|
|
{
|
2006-07-25 11:27:11 +00:00
|
|
|
SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
|
2000-09-18 16:07:07 +00:00
|
|
|
if (pObj->GetObjIdentifier() == OBJ_OLE2)
|
|
|
|
{
|
|
|
|
pOle2Obj = (SdrOle2Obj*) pObj;
|
|
|
|
if (!pDoc->IsChart(pObj) )
|
|
|
|
pViewSh->SetOleObjectShell(TRUE);
|
|
|
|
else
|
|
|
|
pViewSh->SetChartShell(TRUE);
|
2000-10-20 17:27:00 +00:00
|
|
|
bSubShellSet = TRUE;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else if (pObj->GetObjIdentifier() == OBJ_GRAF)
|
|
|
|
{
|
|
|
|
pGrafObj = (SdrGrafObj*) pObj;
|
|
|
|
pViewSh->SetGraphicShell(TRUE);
|
2000-10-20 17:27:00 +00:00
|
|
|
bSubShellSet = TRUE;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2004-08-12 08:30:19 +00:00
|
|
|
else if (pObj->GetObjIdentifier() == OBJ_MEDIA)
|
|
|
|
{
|
|
|
|
pMediaObj = (SdrMediaObj*) pObj;
|
|
|
|
pViewSh->SetMediaShell(TRUE);
|
|
|
|
bSubShellSet = TRUE;
|
|
|
|
}
|
2000-10-20 17:27:00 +00:00
|
|
|
else if (pObj->GetObjIdentifier() != OBJ_TEXT // Verhindern, das beim Anlegen
|
2000-09-18 16:07:07 +00:00
|
|
|
|| !pViewSh->IsDrawTextShell()) // eines TextObjekts auf die
|
|
|
|
{ // DrawShell umgeschaltet wird.
|
|
|
|
pViewSh->SetDrawShell(TRUE); //@#70206#
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-10-20 17:27:00 +00:00
|
|
|
if ( nMarkCount && !bSubShellSet )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
BOOL bOnlyControls = TRUE;
|
2000-10-20 17:27:00 +00:00
|
|
|
BOOL bOnlyGraf = TRUE;
|
2000-09-18 16:07:07 +00:00
|
|
|
for (ULONG i=0; i<nMarkCount; i++)
|
|
|
|
{
|
2006-07-25 11:27:11 +00:00
|
|
|
SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( pObj->ISA( SdrObjGroup ) )
|
|
|
|
{
|
|
|
|
const SdrObjList *pLst = ((SdrObjGroup*)pObj)->GetSubList();
|
2002-10-11 11:35:10 +00:00
|
|
|
ULONG nListCount = pLst->GetObjCount();
|
|
|
|
if ( nListCount == 0 )
|
|
|
|
{
|
|
|
|
// #104156# An empty group (may occur during Undo) is no control or graphics object.
|
|
|
|
// Creating the form shell during undo would lead to problems with the undo manager.
|
|
|
|
bOnlyControls = FALSE;
|
|
|
|
bOnlyGraf = FALSE;
|
|
|
|
}
|
|
|
|
for ( USHORT j = 0; j < nListCount; ++j )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
SdrObject *pSubObj = pLst->GetObj( j );
|
|
|
|
|
2000-10-20 17:27:00 +00:00
|
|
|
if (!pSubObj->ISA(SdrUnoObj))
|
2000-09-18 16:07:07 +00:00
|
|
|
bOnlyControls = FALSE;
|
2000-10-20 17:27:00 +00:00
|
|
|
if (pSubObj->GetObjIdentifier() != OBJ_GRAF)
|
|
|
|
bOnlyGraf = FALSE;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2000-10-20 17:27:00 +00:00
|
|
|
if ( !bOnlyControls && !bOnlyGraf ) break;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2000-10-20 17:27:00 +00:00
|
|
|
else
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2000-10-20 17:27:00 +00:00
|
|
|
if (!pObj->ISA(SdrUnoObj))
|
|
|
|
bOnlyControls = FALSE;
|
|
|
|
if (pObj->GetObjIdentifier() != OBJ_GRAF)
|
|
|
|
bOnlyGraf = FALSE;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2000-10-20 17:27:00 +00:00
|
|
|
|
|
|
|
if ( !bOnlyControls && !bOnlyGraf ) break;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(bOnlyControls)
|
|
|
|
{
|
|
|
|
pViewSh->SetDrawFormShell(TRUE); // jetzt UNO-Controls
|
|
|
|
}
|
2000-10-20 17:27:00 +00:00
|
|
|
else if(bOnlyGraf)
|
|
|
|
{
|
|
|
|
pViewSh->SetGraphicShell(TRUE);
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
else if(nMarkCount>1)
|
|
|
|
{
|
|
|
|
pViewSh->SetDrawShell(TRUE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Verben anpassen
|
|
|
|
|
2002-06-13 11:18:00 +00:00
|
|
|
SfxViewFrame* pViewFrame = pViewSh->GetViewFrame();
|
2009-12-15 23:07:57 +01:00
|
|
|
BOOL bOle = pViewSh->GetViewFrame()->GetFrame().IsInPlace();
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( pOle2Obj && !bOle )
|
|
|
|
{
|
2004-10-04 19:22:52 +00:00
|
|
|
uno::Reference < embed::XEmbeddedObject > xObj = pOle2Obj->GetObjRef();
|
|
|
|
if (xObj.is())
|
|
|
|
pViewSh->SetVerbs( xObj->getSupportedVerbs() );
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
DBG_ERROR("SdrOle2Obj ohne ObjRef");
|
|
|
|
pViewSh->SetVerbs( 0 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
pViewSh->SetVerbs( 0 );
|
|
|
|
|
|
|
|
// Image-Map Editor
|
|
|
|
|
|
|
|
if ( pOle2Obj )
|
|
|
|
UpdateIMap( pOle2Obj );
|
|
|
|
else if ( pGrafObj )
|
|
|
|
UpdateIMap( pGrafObj );
|
|
|
|
|
|
|
|
InvalidateAttribs(); // nach dem IMap-Editor Update
|
|
|
|
InvalidateDrawTextAttrs();
|
|
|
|
|
2006-11-14 14:56:10 +00:00
|
|
|
for(sal_uInt32 a(0L); a < PaintWindowCount(); a++)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2006-11-14 14:56:10 +00:00
|
|
|
SdrPaintWindow* pPaintWindow = GetPaintWindow(a);
|
|
|
|
OutputDevice& rOutDev = pPaintWindow->GetOutputDevice();
|
|
|
|
|
|
|
|
if(OUTDEV_WINDOW == rOutDev.GetOutDevType())
|
|
|
|
{
|
|
|
|
((Window&)rOutDev).Update();
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2001-10-02 17:41:42 +00:00
|
|
|
|
2002-06-13 11:18:00 +00:00
|
|
|
// uno object for view returns drawing objects as selection,
|
|
|
|
// so it must notify its SelectionChangeListeners
|
|
|
|
|
|
|
|
if (pViewFrame)
|
|
|
|
{
|
2009-12-15 23:07:57 +01:00
|
|
|
SfxFrame& rFrame = pViewFrame->GetFrame();
|
|
|
|
uno::Reference<frame::XController> xController = rFrame.GetController();
|
|
|
|
if (xController.is())
|
2002-06-13 11:18:00 +00:00
|
|
|
{
|
2009-12-15 23:07:57 +01:00
|
|
|
ScTabViewObj* pImp = ScTabViewObj::getImplementation( xController );
|
|
|
|
if (pImp)
|
|
|
|
pImp->SelectionChanged();
|
2002-06-13 11:18:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-10-02 17:41:42 +00:00
|
|
|
// update selection transfer object
|
|
|
|
|
|
|
|
pViewSh->CheckSelectionTransfer();
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void __EXPORT ScDrawView::ModelHasChanged()
|
|
|
|
{
|
2003-12-17 19:10:12 +00:00
|
|
|
SdrObject* pEditObj = GetTextEditObject();
|
|
|
|
if ( pEditObj && !pEditObj->IsInserted() && pViewData )
|
|
|
|
{
|
|
|
|
// #111700# SdrObjEditView::ModelHasChanged will end text edit in this case,
|
|
|
|
// so make sure the EditEngine's undo manager is no longer used.
|
|
|
|
pViewData->GetViewShell()->SetDrawTextUndo(NULL);
|
|
|
|
SetCreateMode(); // don't leave FuText in a funny state
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
FmFormView::ModelHasChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
void __EXPORT ScDrawView::UpdateUserViewOptions()
|
|
|
|
{
|
|
|
|
if (pViewData)
|
|
|
|
{
|
|
|
|
const ScViewOptions& rOpt = pViewData->GetOptions();
|
|
|
|
const ScGridOptions& rGrid = rOpt.GetGridOptions();
|
|
|
|
|
|
|
|
BOOL bBigHdl = rOpt.GetOption( VOPT_BIGHANDLES );
|
|
|
|
|
|
|
|
SetDragStripes( rOpt.GetOption( VOPT_HELPLINES ) );
|
|
|
|
SetSolidMarkHdl( rOpt.GetOption( VOPT_SOLIDHANDLES ) );
|
|
|
|
SetMarkHdlSizePixel( bBigHdl ? SC_HANDLESIZE_BIG : SC_HANDLESIZE_SMALL );
|
|
|
|
|
|
|
|
SetGridVisible( rGrid.GetGridVisible() );
|
|
|
|
SetSnapEnabled( rGrid.GetUseGridSnap() );
|
|
|
|
SetGridSnap( rGrid.GetUseGridSnap() );
|
2001-03-06 13:48:34 +00:00
|
|
|
|
|
|
|
// Snap from grid options is no longer used
|
|
|
|
// SetSnapGrid( Size( rGrid.GetFldSnapX(), rGrid.GetFldSnapY() ) );
|
|
|
|
|
|
|
|
Fraction aFractX( rGrid.GetFldDrawX(), rGrid.GetFldDivisionX() + 1 );
|
|
|
|
Fraction aFractY( rGrid.GetFldDrawY(), rGrid.GetFldDivisionY() + 1 );
|
|
|
|
SetSnapGridWidth( aFractX, aFractY );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
SetGridCoarse( Size( rGrid.GetFldDrawX(), rGrid.GetFldDrawY() ) );
|
|
|
|
SetGridFine( Size( rGrid.GetFldDrawX() / (rGrid.GetFldDivisionX() + 1),
|
|
|
|
rGrid.GetFldDrawY() / (rGrid.GetFldDivisionY() + 1) ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-09-06 13:21:17 +00:00
|
|
|
#ifdef _MSC_VER
|
2000-09-18 16:07:07 +00:00
|
|
|
#pragma optimize ( "", on )
|
|
|
|
#endif
|
|
|
|
|
|
|
|
BOOL ScDrawView::SelectObject( const String& rName )
|
|
|
|
{
|
|
|
|
UnmarkAll();
|
|
|
|
|
2004-06-04 11:00:26 +00:00
|
|
|
SCTAB nObjectTab = 0;
|
2000-09-18 16:07:07 +00:00
|
|
|
SdrObject* pFound = NULL;
|
|
|
|
|
|
|
|
SfxObjectShell* pShell = pDoc->GetDocumentShell();
|
|
|
|
if (pShell)
|
|
|
|
{
|
|
|
|
SdrModel* pDrawLayer = GetModel();
|
2004-06-04 11:00:26 +00:00
|
|
|
SCTAB nTabCount = pDoc->GetTableCount();
|
|
|
|
for (SCTAB i=0; i<nTabCount && !pFound; i++)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2004-06-04 11:00:26 +00:00
|
|
|
SdrPage* pPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(i));
|
2000-09-18 16:07:07 +00:00
|
|
|
DBG_ASSERT(pPage,"Page ?");
|
|
|
|
if (pPage)
|
|
|
|
{
|
|
|
|
SdrObjListIter aIter( *pPage, IM_DEEPWITHGROUPS );
|
|
|
|
SdrObject* pObject = aIter.Next();
|
|
|
|
while (pObject && !pFound)
|
|
|
|
{
|
2001-10-05 13:33:02 +00:00
|
|
|
if ( ScDrawLayer::GetVisibleName( pObject ) == rName )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
pFound = pObject;
|
|
|
|
nObjectTab = i;
|
|
|
|
}
|
|
|
|
pObject = aIter.Next();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( pFound )
|
|
|
|
{
|
|
|
|
ScTabView* pView = pViewData->GetView();
|
|
|
|
if ( nObjectTab != nTab ) // Tabelle umschalten
|
|
|
|
pView->SetTabNo( nObjectTab );
|
|
|
|
|
|
|
|
DBG_ASSERT( nTab == nObjectTab, "Tabellen umschalten hat nicht geklappt" );
|
|
|
|
|
|
|
|
pView->ScrollToObject( pFound );
|
|
|
|
|
2009-03-02 14:19:13 +00:00
|
|
|
/* #61585# To select an object on the background layer, the layer has to
|
|
|
|
be unlocked even if exclusive drawing selection mode is not active
|
|
|
|
(this is reversed in MarkListHasChanged when nothing is selected) */
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( pFound->GetLayer() == SC_LAYER_BACK &&
|
|
|
|
!pViewData->GetViewShell()->IsDrawSelMode() &&
|
|
|
|
!pDoc->IsTabProtected( nTab ) &&
|
|
|
|
!pViewData->GetSfxDocShell()->IsReadOnly() )
|
|
|
|
{
|
2009-03-02 14:19:13 +00:00
|
|
|
UnlockBackgroundLayer();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2006-11-14 14:56:10 +00:00
|
|
|
SdrPageView* pPV = GetSdrPageView();
|
2000-09-18 16:07:07 +00:00
|
|
|
MarkObj( pFound, pPV );
|
|
|
|
}
|
|
|
|
|
|
|
|
return ( pFound != NULL );
|
|
|
|
}
|
|
|
|
|
2008-09-30 05:48:28 +00:00
|
|
|
//UNUSED2008-05 String ScDrawView::GetSelectedChartName() const
|
|
|
|
//UNUSED2008-05 {
|
|
|
|
//UNUSED2008-05 // used for modifying a chart's data area - PersistName must always be used
|
|
|
|
//UNUSED2008-05 // (as in ScDocument::FindChartData and UpdateChartArea)
|
|
|
|
//UNUSED2008-05
|
|
|
|
//UNUSED2008-05 const SdrMarkList& rMarkList = GetMarkedObjectList();
|
|
|
|
//UNUSED2008-05 if (rMarkList.GetMarkCount() == 1)
|
|
|
|
//UNUSED2008-05 {
|
|
|
|
//UNUSED2008-05 SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
|
|
|
|
//UNUSED2008-05 if (pObj->GetObjIdentifier() == OBJ_OLE2)
|
|
|
|
//UNUSED2008-05 if ( pDoc->IsChart(pObj) )
|
|
|
|
//UNUSED2008-05 return static_cast<SdrOle2Obj*>(pObj)->GetPersistName();
|
|
|
|
//UNUSED2008-05 }
|
|
|
|
//UNUSED2008-05
|
|
|
|
//UNUSED2008-05 return EMPTY_STRING; // nichts gefunden
|
|
|
|
//UNUSED2008-05 }
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
FASTBOOL ScDrawView::InsertObjectSafe(SdrObject* pObj, SdrPageView& rPV, ULONG nOptions)
|
|
|
|
{
|
|
|
|
// Markierung nicht aendern, wenn Ole-Objekt aktiv
|
|
|
|
// (bei Drop aus Ole-Objekt wuerde sonst mitten im ExecuteDrag deaktiviert!)
|
|
|
|
|
|
|
|
if (pViewData)
|
|
|
|
{
|
|
|
|
SfxInPlaceClient* pClient = pViewData->GetViewShell()->GetIPClient();
|
2004-10-04 19:22:52 +00:00
|
|
|
if ( pClient && pClient->IsObjectInPlaceActive() )
|
2000-09-18 16:07:07 +00:00
|
|
|
nOptions |= SDRINSERT_DONTMARK;
|
|
|
|
}
|
|
|
|
|
2006-11-14 14:56:10 +00:00
|
|
|
return InsertObjectAtView( pObj, rPV, nOptions );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2009-03-02 14:19:13 +00:00
|
|
|
SdrObject* ScDrawView::GetMarkedNoteCaption( ScDrawObjData** ppCaptData )
|
|
|
|
{
|
|
|
|
const SdrMarkList& rMarkList = GetMarkedObjectList();
|
|
|
|
if( pViewData && (rMarkList.GetMarkCount() == 1) )
|
|
|
|
{
|
|
|
|
SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
|
|
|
|
if( ScDrawObjData* pCaptData = ScDrawLayer::GetNoteCaptionData( pObj, pViewData->GetTabNo() ) )
|
|
|
|
{
|
|
|
|
if( ppCaptData ) *ppCaptData = pCaptData;
|
|
|
|
return pObj;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScDrawView::LockCalcLayer( SdrLayerID nLayer, bool bLock )
|
|
|
|
{
|
|
|
|
SdrLayer* pLockLayer = GetModel()->GetLayerAdmin().GetLayerPerID( nLayer );
|
|
|
|
if( pLockLayer && (IsLayerLocked( pLockLayer->GetName() ) != bLock) )
|
|
|
|
SetLayerLocked( pLockLayer->GetName(), bLock );
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
void __EXPORT ScDrawView::MakeVisible( const Rectangle& rRect, Window& rWin )
|
|
|
|
{
|
|
|
|
//! rWin richtig auswerten
|
|
|
|
//! ggf Zoom aendern
|
|
|
|
|
|
|
|
if ( pViewData && pViewData->GetActiveWin() == &rWin )
|
|
|
|
pViewData->GetView()->MakeVisible( rRect );
|
|
|
|
}
|
|
|
|
|
2009-03-02 14:19:13 +00:00
|
|
|
void ScDrawView::DeleteMarked()
|
|
|
|
{
|
|
|
|
// try to delete a note caption object with its cell note in the Calc document
|
|
|
|
ScDrawObjData* pCaptData = 0;
|
|
|
|
if( SdrObject* pCaptObj = GetMarkedNoteCaption( &pCaptData ) )
|
|
|
|
{
|
|
|
|
(void)pCaptObj; // prevent 'unused variable' compiler warning in pro builds
|
|
|
|
ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
|
|
|
|
ScDocShell* pDocShell = pViewData ? pViewData->GetDocShell() : 0;
|
|
|
|
SfxUndoManager* pUndoMgr = pDocShell ? pDocShell->GetUndoManager() : 0;
|
|
|
|
bool bUndo = pDrawLayer && pDocShell && pUndoMgr && pDoc->IsUndoEnabled();
|
|
|
|
|
|
|
|
// remove the cell note from document, we are its owner now
|
|
|
|
ScPostIt* pNote = pDoc->ReleaseNote( pCaptData->maStart );
|
|
|
|
DBG_ASSERT( pNote, "ScDrawView::DeleteMarked - cell note missing in document" );
|
|
|
|
if( pNote )
|
|
|
|
{
|
|
|
|
// rescue note data for undo (with pointer to caption object)
|
|
|
|
ScNoteData aNoteData = pNote->GetNoteData();
|
|
|
|
DBG_ASSERT( aNoteData.mpCaption == pCaptObj, "ScDrawView::DeleteMarked - caption object does not match" );
|
|
|
|
// collect the drawing undo action created while deleting the note
|
|
|
|
if( bUndo )
|
|
|
|
pDrawLayer->BeginCalcUndo();
|
|
|
|
// delete the note (already removed from document above)
|
|
|
|
delete pNote;
|
|
|
|
// add the undo action for the note
|
|
|
|
if( bUndo )
|
|
|
|
pUndoMgr->AddUndoAction( new ScUndoReplaceNote( *pDocShell, pCaptData->maStart, aNoteData, false, pDrawLayer->GetCalcUndo() ) );
|
|
|
|
// repaint the cell to get rid of the note marker
|
|
|
|
if( pDocShell )
|
|
|
|
pDocShell->PostPaintCell( pCaptData->maStart );
|
|
|
|
// done, return now to skip call of FmFormView::DeleteMarked()
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
FmFormView::DeleteMarked();
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
SdrEndTextEditKind ScDrawView::ScEndTextEdit()
|
|
|
|
{
|
|
|
|
BOOL bIsTextEdit = IsTextEdit();
|
2006-11-14 14:56:10 +00:00
|
|
|
SdrEndTextEditKind eKind = SdrEndTextEdit();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if ( bIsTextEdit && pViewData )
|
|
|
|
pViewData->GetViewShell()->SetDrawTextUndo(NULL); // "normaler" Undo-Manager
|
|
|
|
|
|
|
|
return eKind;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScDrawView::MarkDropObj( SdrObject* pObj )
|
|
|
|
{
|
2006-11-14 14:56:10 +00:00
|
|
|
if ( pDropMarkObj != pObj )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2006-11-14 14:56:10 +00:00
|
|
|
pDropMarkObj = pObj;
|
|
|
|
ImplClearCalcDropMarker();
|
|
|
|
|
|
|
|
if(pDropMarkObj)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2006-11-14 14:56:10 +00:00
|
|
|
pDropMarker = new SdrDropMarkerOverlay(*this, *pDropMarkObj);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-08-25 13:53:16 +00:00
|
|
|
//UNUSED2009-05 void ScDrawView::CaptionTextDirection( USHORT nSlot )
|
|
|
|
//UNUSED2009-05 {
|
|
|
|
//UNUSED2009-05 if(nSlot != SID_TEXTDIRECTION_LEFT_TO_RIGHT && nSlot != SID_TEXTDIRECTION_TOP_TO_BOTTOM)
|
|
|
|
//UNUSED2009-05 return;
|
|
|
|
//UNUSED2009-05
|
|
|
|
//UNUSED2009-05 SdrObject* pObject = GetTextEditObject();
|
|
|
|
//UNUSED2009-05 if ( ScDrawLayer::IsNoteCaption( pObject ) )
|
|
|
|
//UNUSED2009-05 {
|
|
|
|
//UNUSED2009-05 if( SdrCaptionObj* pCaption = dynamic_cast< SdrCaptionObj* >( pObject ) )
|
|
|
|
//UNUSED2009-05 {
|
|
|
|
//UNUSED2009-05 SfxItemSet aAttr(pCaption->GetMergedItemSet());
|
|
|
|
//UNUSED2009-05 aAttr.Put( SvxWritingModeItem(
|
|
|
|
//UNUSED2009-05 nSlot == SID_TEXTDIRECTION_LEFT_TO_RIGHT ?
|
|
|
|
//UNUSED2009-05 com::sun::star::text::WritingMode_LR_TB : com::sun::star::text::WritingMode_TB_RL,
|
|
|
|
//UNUSED2009-05 SDRATTR_TEXTDIRECTION ) );
|
|
|
|
//UNUSED2009-05 pCaption->SetMergedItemSet(aAttr);
|
|
|
|
//UNUSED2009-05 FuPoor* pPoor = pViewData->GetView()->GetDrawFuncPtr();
|
|
|
|
//UNUSED2009-05 if ( pPoor )
|
|
|
|
//UNUSED2009-05 {
|
|
|
|
//UNUSED2009-05 FuText* pText = static_cast<FuText*>(pPoor);
|
|
|
|
//UNUSED2009-05 pText->StopEditMode(TRUE);
|
|
|
|
//UNUSED2009-05 }
|
|
|
|
//UNUSED2009-05 }
|
|
|
|
//UNUSED2009-05 }
|
|
|
|
//UNUSED2009-05 }
|