office-gobmx/sc/inc/drwlayer.hxx

222 lines
8.4 KiB
C++
Raw Normal View History

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
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2000-09-18 11:07:07 -05:00
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
2000-09-18 11:07:07 -05:00
*
* OpenOffice.org - a multi-platform office productivity suite
2000-09-18 11:07:07 -05:00
*
* This file is part of OpenOffice.org.
2000-09-18 11:07:07 -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
*
* 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
*
* 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>
#include <svx/svdundo.hxx>
2000-09-18 11:07:07 -05:00
#include "global.hxx"
class ScDocument;
class SfxViewShell;
class SfxObjectShell;
2000-09-18 11:07:07 -05:00
class ScDrawObjData;
class ScIMapInfo;
class ScMacroInfo;
2000-09-18 11:07:07 -05:00
class IMapObject;
class ScMarkData;
class SdrOle2Obj;
class ScRange;
class ScAddress;
2000-09-18 11:07:07 -05:00
class ScTabDeletedHint : public SfxHint
{
private:
SCTAB nTab;
2000-09-18 11:07:07 -05:00
public:
TYPEINFO();
ScTabDeletedHint( SCTAB nTabNo = SCTAB_MAX );
2000-09-18 11:07:07 -05:00
virtual ~ScTabDeletedHint();
SCTAB GetTab() { return nTab; }
2000-09-18 11:07:07 -05:00
};
class ScTabSizeChangedHint : public SfxHint
{
private:
SCTAB nTab;
2000-09-18 11:07:07 -05:00
public:
TYPEINFO();
ScTabSizeChangedHint( SCTAB nTabNo = SCTAB_MAX );
2000-09-18 11:07:07 -05:00
virtual ~ScTabSizeChangedHint();
SCTAB GetTab() { return nTab; }
2000-09-18 11:07:07 -05: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
class ScUndoObjData : public SdrUndoObj
{
private:
ScAddress aOldStt;
ScAddress aOldEnd;
ScAddress aNewStt;
ScAddress aNewEnd;
sal_Bool bHasNew;
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
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;
sal_Bool bRecording;
sal_Bool bAdjustEnabled;
sal_Bool bHyphenatorSet;
2000-09-18 11:07:07 -05:00
private:
void MoveCells( SCTAB nTab, SCCOL nCol1,SCROW nRow1, SCCOL nCol2,SCROW nRow2,
SCsCOL nDx,SCsROW nDy, bool bUpdateNoteCaptionPos );
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;
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;
sal_Bool HasObjects() const;
2000-09-18 11:07:07 -05:00
sal_Bool ScAddPage( SCTAB nTab );
void ScRemovePage( SCTAB nTab );
void ScRenamePage( SCTAB nTab, const String& rNewName );
void ScMovePage( sal_uInt16 nOldPos, sal_uInt16 nNewPos );
// incl. content, bAlloc=FALSE -> only content
void ScCopyPage( sal_uInt16 nOldPos, sal_uInt16 nNewPos, sal_Bool bAlloc );
2000-09-18 11:07:07 -05:00
ScDocument* GetDocument() const { return pDoc; }
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
sal_Bool GetPrintArea( ScRange& rRange, sal_Bool bSetHor, sal_Bool bSetVer ) const;
2000-09-18 11:07:07 -05:00
// automatic adjustments
2000-09-18 11:07:07 -05:00
void EnableAdjust( sal_Bool bSet = sal_True ) { bAdjustEnabled = bSet; }
2000-09-18 11:07:07 -05:00
void BeginCalcUndo();
SdrUndoGroup* GetCalcUndo();
sal_Bool IsRecording() const { return bRecording; }
2000-09-18 11:07:07 -05:00
void AddCalcUndo( SdrUndoAction* pUndo );
void MoveArea( SCTAB nTab, SCCOL nCol1,SCROW nRow1, SCCOL nCol2,SCROW nRow2,
SCsCOL nDx,SCsROW nDy, sal_Bool bInsDel, bool bUpdateNoteCaptionPos = true );
2000-09-18 11:07:07 -05:00
sal_Bool HasObjectsInRows( SCTAB nTab, SCROW nStartRow, SCROW nEndRow );
2000-09-18 11:07:07 -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 );
void CopyToClip( ScDocument* pClipDoc, SCTAB nTab, const Rectangle& rRange );
void CopyFromClip( ScDrawLayer* pClipModel,
SCTAB nSourceTab, const Rectangle& rSourceRange,
const ScAddress& rDestPos, const Rectangle& rDestRange );
void SetPageSize( sal_uInt16 nPageNo, const Size& rSize, bool bUpdateNoteCaptionPos = true );
2000-09-18 11:07:07 -05:00
// mirror or move between positive and negative positions for RTL
void MirrorRTL( SdrObject* pObj );
static void MirrorRectRTL( Rectangle& rRect ); // for bounding rectangles etc.
/** 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 );
// GetVisibleName: name for navigator etc: GetPersistName or GetName
// (ChartListenerCollection etc. must use GetPersistName directly)
static String GetVisibleName( SdrObject* pObj );
SdrObject* GetNamedObject( const String& rName, sal_uInt16 nId, SCTAB& rFoundTab ) const;
// 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
// positions for detektive lines
static ScDrawObjData* GetObjData( SdrObject* pObj, sal_Bool bCreate=false );
2000-09-18 11:07:07 -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 );
/** 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 );
2000-09-18 11:07:07 -05:00
static IMapObject* GetHitIMapObject( SdrObject* pObject,
const Point& rWinPoint, const Window& rCmpWnd );
static ScMacroInfo* GetMacroInfo( SdrObject* pObj, sal_Bool bCreate = false );
2000-09-18 11:07:07 -05:00
private:
static SfxObjectShell* pGlobalDrawPersist; // for AllocModel
2000-09-18 11:07:07 -05:00
public:
static void SetGlobalDrawPersist(SfxObjectShell* pPersist);
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: */