2010-10-27 06:43:08 -05:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2000-09-18 11:07:07 -05:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 12:31:13 -05:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
2010-02-12 08:01:35 -06:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
2008-04-10 12:31:13 -05:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
2008-04-10 12:31:13 -05:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-09-18 11:07:07 -05:00
|
|
|
*
|
2008-04-10 12:31:13 -05: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 11:07:07 -05:00
|
|
|
*
|
2008-04-10 12:31:13 -05: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 11:07:07 -05:00
|
|
|
*
|
2008-04-10 12:31:13 -05: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 11:07:07 -05:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#ifndef SC_DRWLAYER_HXX
|
|
|
|
#define SC_DRWLAYER_HXX
|
|
|
|
|
|
|
|
#include <vcl/graph.hxx>
|
|
|
|
#include <svx/fmmodel.hxx>
|
2009-03-02 08:19:13 -06:00
|
|
|
#include <svx/svdundo.hxx>
|
2000-09-18 11:07:07 -05:00
|
|
|
#include "global.hxx"
|
|
|
|
|
|
|
|
class ScDocument;
|
|
|
|
class SfxViewShell;
|
2004-10-04 14:03:52 -05:00
|
|
|
class SfxObjectShell;
|
2000-09-18 11:07:07 -05:00
|
|
|
class ScDrawObjData;
|
|
|
|
class ScIMapInfo;
|
2007-07-06 06:29:36 -05:00
|
|
|
class ScMacroInfo;
|
2000-09-18 11:07:07 -05:00
|
|
|
class IMapObject;
|
|
|
|
class ScMarkData;
|
|
|
|
class SdrOle2Obj;
|
2004-06-04 04:08:52 -05:00
|
|
|
class ScRange;
|
|
|
|
class ScAddress;
|
2000-09-18 11:07:07 -05:00
|
|
|
|
|
|
|
class ScTabDeletedHint : public SfxHint
|
|
|
|
{
|
|
|
|
private:
|
2004-06-04 04:08:52 -05:00
|
|
|
SCTAB nTab;
|
2000-09-18 11:07:07 -05:00
|
|
|
public:
|
|
|
|
TYPEINFO();
|
2004-06-04 04:08:52 -05:00
|
|
|
ScTabDeletedHint( SCTAB nTabNo = SCTAB_MAX );
|
2000-09-18 11:07:07 -05:00
|
|
|
virtual ~ScTabDeletedHint();
|
|
|
|
|
2004-06-04 04:08:52 -05:00
|
|
|
SCTAB GetTab() { return nTab; }
|
2000-09-18 11:07:07 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
class ScTabSizeChangedHint : public SfxHint
|
|
|
|
{
|
|
|
|
private:
|
2004-06-04 04:08:52 -05:00
|
|
|
SCTAB nTab;
|
2000-09-18 11:07:07 -05:00
|
|
|
public:
|
|
|
|
TYPEINFO();
|
2004-06-04 04:08:52 -05:00
|
|
|
ScTabSizeChangedHint( SCTAB nTabNo = SCTAB_MAX );
|
2000-09-18 11:07:07 -05:00
|
|
|
virtual ~ScTabSizeChangedHint();
|
|
|
|
|
2004-06-04 04:08:52 -05:00
|
|
|
SCTAB GetTab() { return nTab; }
|
2000-09-18 11:07:07 -05:00
|
|
|
};
|
|
|
|
|
2011-01-11 14:53:29 -06:00
|
|
|
// Adjusting of detective UserData and draw undo's both have to be in SdrUndoGroup;
|
|
|
|
// therefore derived from SdrUndoAction
|
2000-09-18 11:07:07 -05:00
|
|
|
|
2009-03-02 08:19:13 -06:00
|
|
|
class ScUndoObjData : public SdrUndoObj
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
ScAddress aOldStt;
|
|
|
|
ScAddress aOldEnd;
|
|
|
|
ScAddress aNewStt;
|
|
|
|
ScAddress aNewEnd;
|
2011-01-17 06:20:22 -06:00
|
|
|
sal_Bool bHasNew;
|
2009-03-02 08:19:13 -06:00
|
|
|
public:
|
|
|
|
ScUndoObjData( SdrObject* pObj, const ScAddress& rOS, const ScAddress& rOE,
|
|
|
|
const ScAddress& rNS, const ScAddress& rNE );
|
|
|
|
~ScUndoObjData();
|
2000-09-18 11:07:07 -05:00
|
|
|
|
2009-03-02 08:19:13 -06:00
|
|
|
virtual void Undo();
|
|
|
|
virtual void Redo();
|
|
|
|
};
|
|
|
|
|
|
|
|
class SC_DLLPUBLIC ScDrawLayer : public FmFormModel
|
2000-09-18 11:07:07 -05:00
|
|
|
{
|
|
|
|
private:
|
|
|
|
String aName;
|
|
|
|
ScDocument* pDoc;
|
|
|
|
SdrUndoGroup* pUndoGroup;
|
2011-01-17 06:20:22 -06:00
|
|
|
sal_Bool bRecording;
|
|
|
|
sal_Bool bAdjustEnabled;
|
|
|
|
sal_Bool bHyphenatorSet;
|
2000-09-18 11:07:07 -05:00
|
|
|
|
|
|
|
private:
|
2004-06-04 04:08:52 -05:00
|
|
|
void MoveCells( SCTAB nTab, SCCOL nCol1,SCROW nRow1, SCCOL nCol2,SCROW nRow2,
|
2010-03-31 04:24:42 -05:00
|
|
|
SCsCOL nDx,SCsROW nDy, bool bUpdateNoteCaptionPos );
|
2009-03-02 08:19:13 -06:00
|
|
|
|
2011-01-18 17:55:56 -06:00
|
|
|
void RecalcPos( SdrObject* pObj, ScDrawObjData& rData, bool bNegativePage, bool bUpdateNoteCaptionPos );
|
2000-09-18 11:07:07 -05:00
|
|
|
|
|
|
|
public:
|
|
|
|
ScDrawLayer( ScDocument* pDocument, const String& rName );
|
|
|
|
virtual ~ScDrawLayer();
|
|
|
|
|
2010-10-05 07:57:50 -05:00
|
|
|
virtual SdrPage* AllocPage(bool bMasterPage);
|
2000-09-18 11:07:07 -05:00
|
|
|
virtual SdrModel* AllocModel() const;
|
2003-11-24 10:23:37 -06:00
|
|
|
virtual void SetChanged( sal_Bool bFlg = sal_True );
|
2000-09-18 11:07:07 -05:00
|
|
|
|
|
|
|
virtual Window* GetCurDocViewWin();
|
2000-12-03 10:02:17 -06:00
|
|
|
virtual SvStream* GetDocumentStream(SdrDocumentStreamInfo& rStreamInfo) const;
|
2000-09-18 11:07:07 -05:00
|
|
|
|
|
|
|
virtual SdrLayerID GetControlExportLayerId( const SdrObject & ) const;
|
|
|
|
|
2011-01-17 06:20:22 -06:00
|
|
|
sal_Bool HasObjects() const;
|
2000-09-18 11:07:07 -05:00
|
|
|
|
2011-01-17 06:20:22 -06:00
|
|
|
sal_Bool ScAddPage( SCTAB nTab );
|
2004-06-04 04:08:52 -05:00
|
|
|
void ScRemovePage( SCTAB nTab );
|
|
|
|
void ScRenamePage( SCTAB nTab, const String& rNewName );
|
2011-01-17 06:20:22 -06:00
|
|
|
void ScMovePage( sal_uInt16 nOldPos, sal_uInt16 nNewPos );
|
2011-01-11 14:53:29 -06:00
|
|
|
// incl. content, bAlloc=FALSE -> only content
|
2011-01-17 06:20:22 -06:00
|
|
|
void ScCopyPage( sal_uInt16 nOldPos, sal_uInt16 nNewPos, sal_Bool bAlloc );
|
2000-09-18 11:07:07 -05:00
|
|
|
|
|
|
|
ScDocument* GetDocument() const { return pDoc; }
|
|
|
|
|
2011-01-11 14:53:29 -06:00
|
|
|
void UpdateBasic(); // set DocShell Basic in DrawPages
|
2001-05-21 12:19:05 -05:00
|
|
|
void UseHyphenator();
|
2000-09-18 11:07:07 -05:00
|
|
|
|
2011-01-17 06:20:22 -06:00
|
|
|
sal_Bool GetPrintArea( ScRange& rRange, sal_Bool bSetHor, sal_Bool bSetVer ) const;
|
2000-09-18 11:07:07 -05:00
|
|
|
|
2011-01-11 14:53:29 -06:00
|
|
|
// automatic adjustments
|
2000-09-18 11:07:07 -05:00
|
|
|
|
2011-01-17 06:20:22 -06:00
|
|
|
void EnableAdjust( sal_Bool bSet = sal_True ) { bAdjustEnabled = bSet; }
|
2000-09-18 11:07:07 -05:00
|
|
|
|
|
|
|
void BeginCalcUndo();
|
|
|
|
SdrUndoGroup* GetCalcUndo();
|
2011-01-17 06:20:22 -06:00
|
|
|
sal_Bool IsRecording() const { return bRecording; }
|
2000-09-18 11:07:07 -05:00
|
|
|
void AddCalcUndo( SdrUndoAction* pUndo );
|
|
|
|
|
2004-06-04 04:08:52 -05:00
|
|
|
void MoveArea( SCTAB nTab, SCCOL nCol1,SCROW nRow1, SCCOL nCol2,SCROW nRow2,
|
2011-01-17 06:20:22 -06:00
|
|
|
SCsCOL nDx,SCsROW nDy, sal_Bool bInsDel, bool bUpdateNoteCaptionPos = true );
|
2000-09-18 11:07:07 -05:00
|
|
|
|
2011-03-10 15:55:21 -06:00
|
|
|
sal_Bool HasObjectsInRows( SCTAB nTab, SCROW nStartRow, SCROW nEndRow );
|
2000-09-18 11:07:07 -05:00
|
|
|
|
2004-06-04 04:08:52 -05:00
|
|
|
void DeleteObjectsInArea( SCTAB nTab, SCCOL nCol1,SCROW nRow1,
|
|
|
|
SCCOL nCol2,SCROW nRow2 );
|
2000-09-18 11:07:07 -05:00
|
|
|
void DeleteObjectsInSelection( const ScMarkData& rMark );
|
|
|
|
|
2004-06-04 04:08:52 -05:00
|
|
|
void CopyToClip( ScDocument* pClipDoc, SCTAB nTab, const Rectangle& rRange );
|
2002-07-15 08:34:55 -05:00
|
|
|
void CopyFromClip( ScDrawLayer* pClipModel,
|
2004-06-04 04:08:52 -05:00
|
|
|
SCTAB nSourceTab, const Rectangle& rSourceRange,
|
2002-07-15 08:34:55 -05:00
|
|
|
const ScAddress& rDestPos, const Rectangle& rDestRange );
|
|
|
|
|
2011-01-17 06:20:22 -06:00
|
|
|
void SetPageSize( sal_uInt16 nPageNo, const Size& rSize, bool bUpdateNoteCaptionPos = true );
|
2000-09-18 11:07:07 -05:00
|
|
|
|
2004-02-03 05:10:36 -06:00
|
|
|
// mirror or move between positive and negative positions for RTL
|
|
|
|
void MirrorRTL( SdrObject* pObj );
|
|
|
|
static void MirrorRectRTL( Rectangle& rRect ); // for bounding rectangles etc.
|
|
|
|
|
2009-03-02 08:19:13 -06:00
|
|
|
/** Returns the rectangle for the passed cell address in 1/100 mm.
|
|
|
|
@param bMergedCell True = regards merged cells. False = use single column/row size. */
|
|
|
|
static Rectangle GetCellRect( ScDocument& rDoc, const ScAddress& rPos, bool bMergedCell );
|
|
|
|
|
2001-10-05 08:17:32 -05:00
|
|
|
// GetVisibleName: name for navigator etc: GetPersistName or GetName
|
|
|
|
// (ChartListenerCollection etc. must use GetPersistName directly)
|
|
|
|
static String GetVisibleName( SdrObject* pObj );
|
|
|
|
|
2011-01-17 06:20:22 -06:00
|
|
|
SdrObject* GetNamedObject( const String& rName, sal_uInt16 nId, SCTAB& rFoundTab ) const;
|
2002-09-19 04:19:44 -05:00
|
|
|
// if pnCounter != NULL, the search for a name starts with this index + 1,
|
|
|
|
// and the index really used is returned.
|
|
|
|
String GetNewGraphicName( long* pnCounter = NULL ) const;
|
2000-09-18 11:07:07 -05:00
|
|
|
void EnsureGraphicNames();
|
|
|
|
|
2011-01-18 17:55:56 -06:00
|
|
|
static void SetPageAnchored( SdrObject& );
|
|
|
|
static void SetCellAnchored( SdrObject&, const ScDrawObjData &rAnchor );
|
|
|
|
static void SetCellAnchoredFromPosition( SdrObject &rObj, const ScDocument &rDoc, SCTAB nTab );
|
|
|
|
static void UpdateCellAnchorFromPositionEnd( SdrObject &rObj, const ScDocument &rDoc, SCTAB nTab );
|
|
|
|
static ScAnchorType GetAnchorType( const SdrObject& );
|
2000-09-18 11:07:07 -05:00
|
|
|
|
2011-01-11 14:53:29 -06:00
|
|
|
// positions for detektive lines
|
2011-03-10 15:55:21 -06:00
|
|
|
static ScDrawObjData* GetObjData( SdrObject* pObj, sal_Bool bCreate=false );
|
2000-09-18 11:07:07 -05:00
|
|
|
|
2006-07-10 07:23:14 -05:00
|
|
|
// The sheet information in ScDrawObjData isn't updated when sheets are inserted/deleted.
|
|
|
|
// Use this method to get an object with positions on the specified sheet (should be the
|
|
|
|
// sheet on which the object is inserted).
|
|
|
|
static ScDrawObjData* GetObjDataTab( SdrObject* pObj, SCTAB nTab );
|
|
|
|
|
2009-03-02 08:19:13 -06:00
|
|
|
/** Returns true, if the passed object is the caption of a cell note. */
|
|
|
|
static bool IsNoteCaption( SdrObject* pObj );
|
|
|
|
|
|
|
|
/** Returns the object data, if the passed object is a cell note caption. */
|
|
|
|
static ScDrawObjData* GetNoteCaptionData( SdrObject* pObj, SCTAB nTab );
|
|
|
|
|
2000-09-18 11:07:07 -05:00
|
|
|
// Image-Map
|
|
|
|
static ScIMapInfo* GetIMapInfo( SdrObject* pObj );
|
2007-07-06 06:29:36 -05:00
|
|
|
|
2000-09-18 11:07:07 -05:00
|
|
|
static IMapObject* GetHitIMapObject( SdrObject* pObject,
|
|
|
|
const Point& rWinPoint, const Window& rCmpWnd );
|
|
|
|
|
2011-03-10 15:55:21 -06:00
|
|
|
static ScMacroInfo* GetMacroInfo( SdrObject* pObj, sal_Bool bCreate = false );
|
2007-07-06 06:29:36 -05:00
|
|
|
|
2000-09-18 11:07:07 -05:00
|
|
|
private:
|
2011-01-11 14:53:29 -06:00
|
|
|
static SfxObjectShell* pGlobalDrawPersist; // for AllocModel
|
2000-09-18 11:07:07 -05:00
|
|
|
public:
|
2004-10-04 14:03:52 -05:00
|
|
|
static void SetGlobalDrawPersist(SfxObjectShell* pPersist);
|
2005-11-10 09:36:42 -06:00
|
|
|
protected:
|
|
|
|
virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > createUnoModel();
|
2000-09-18 11:07:07 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2010-10-27 06:43:08 -05:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|