2010-10-14 08:30:41 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2011-03-31 10:05:04 +02:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2006-09-16 20:20:52 +00:00
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
#include <svx/svdmodel.hxx>
|
|
|
|
#include <svx/svdpage.hxx>
|
|
|
|
#include <fmtfordr.hxx>
|
|
|
|
#include <fmtpdsc.hxx>
|
|
|
|
#include <frmfmt.hxx>
|
|
|
|
#include <swtable.hxx>
|
|
|
|
#include <rootfrm.hxx>
|
|
|
|
#include <pagefrm.hxx>
|
|
|
|
#include <cntfrm.hxx>
|
|
|
|
#include <viewsh.hxx>
|
|
|
|
#include <doc.hxx>
|
|
|
|
#include <node.hxx>
|
|
|
|
#include <dflyobj.hxx>
|
|
|
|
#include <frmtool.hxx>
|
|
|
|
#include <virtoutp.hxx>
|
|
|
|
#include <blink.hxx>
|
|
|
|
#include <ndindex.hxx>
|
|
|
|
#include <sectfrm.hxx>
|
|
|
|
#include <notxtfrm.hxx>
|
2001-03-02 09:47:13 +00:00
|
|
|
#include <pagedesc.hxx>
|
2006-06-20 11:02:40 +00:00
|
|
|
#include "viewimp.hxx"
|
2006-10-11 07:49:52 +00:00
|
|
|
#include "IDocumentTimerAccess.hxx"
|
|
|
|
#include "IDocumentLayoutAccess.hxx"
|
|
|
|
#include "IDocumentFieldsAccess.hxx"
|
|
|
|
#include "IDocumentSettingAccess.hxx"
|
|
|
|
#include "IDocumentDrawModelAccess.hxx"
|
2008-03-05 16:03:13 +00:00
|
|
|
#include <hints.hxx>
|
2008-07-16 12:27:17 +00:00
|
|
|
#include <viewopt.hxx>
|
2012-07-13 15:19:48 +02:00
|
|
|
#include <set>
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
SwLayVout *SwRootFrm::pVout = 0;
|
2012-11-27 20:49:30 +09:00
|
|
|
bool SwRootFrm::bInPaint = false;
|
2011-01-17 15:06:54 +01:00
|
|
|
sal_Bool SwRootFrm::bNoVirDev = sal_False;
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2013-02-09 11:35:20 +01:00
|
|
|
SwCache *SwFrm::mpCache = 0;
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2001-11-09 12:32:26 +00:00
|
|
|
long FirstMinusSecond( long nFirst, long nSecond )
|
|
|
|
{ return nFirst - nSecond; }
|
|
|
|
long SecondMinusFirst( long nFirst, long nSecond )
|
|
|
|
{ return nSecond - nFirst; }
|
|
|
|
long SwIncrement( long nA, long nAdd )
|
|
|
|
{ return nA + nAdd; }
|
|
|
|
long SwDecrement( long nA, long nSub )
|
|
|
|
{ return nA - nSub; }
|
|
|
|
|
2001-09-11 07:13:09 +00:00
|
|
|
static SwRectFnCollection aHorizontal = {
|
|
|
|
/* fnRectGet */
|
|
|
|
&SwRect::_Top,
|
|
|
|
&SwRect::_Bottom,
|
|
|
|
&SwRect::_Left,
|
|
|
|
&SwRect::_Right,
|
|
|
|
&SwRect::_Width,
|
|
|
|
&SwRect::_Height,
|
2001-10-05 11:36:10 +00:00
|
|
|
&SwRect::TopLeft,
|
2001-09-18 08:14:03 +00:00
|
|
|
&SwRect::_Size,
|
2001-09-11 07:13:09 +00:00
|
|
|
/* fnRectSet */
|
|
|
|
&SwRect::_Top,
|
|
|
|
&SwRect::_Bottom,
|
|
|
|
&SwRect::_Left,
|
|
|
|
&SwRect::_Right,
|
|
|
|
&SwRect::_Width,
|
|
|
|
&SwRect::_Height,
|
|
|
|
|
|
|
|
&SwRect::SubTop,
|
|
|
|
&SwRect::AddBottom,
|
|
|
|
&SwRect::SubLeft,
|
|
|
|
&SwRect::AddRight,
|
|
|
|
&SwRect::AddWidth,
|
|
|
|
&SwRect::AddHeight,
|
|
|
|
|
|
|
|
&SwRect::SetPosX,
|
|
|
|
&SwRect::SetPosY,
|
|
|
|
|
|
|
|
&SwFrm::GetTopMargin,
|
|
|
|
&SwFrm::GetBottomMargin,
|
|
|
|
&SwFrm::GetLeftMargin,
|
2001-09-13 07:20:02 +00:00
|
|
|
&SwFrm::GetRightMargin,
|
2001-11-09 12:32:26 +00:00
|
|
|
&SwFrm::SetLeftRightMargins,
|
|
|
|
&SwFrm::SetTopBottomMargins,
|
2001-11-16 10:40:30 +00:00
|
|
|
&SwFrm::GetPrtTop,
|
2001-09-13 07:20:02 +00:00
|
|
|
&SwFrm::GetPrtBottom,
|
2001-11-16 10:40:30 +00:00
|
|
|
&SwFrm::GetPrtLeft,
|
|
|
|
&SwFrm::GetPrtRight,
|
2001-12-12 13:44:09 +00:00
|
|
|
&SwRect::GetTopDistance,
|
2001-09-19 07:45:10 +00:00
|
|
|
&SwRect::GetBottomDistance,
|
2001-12-12 13:44:09 +00:00
|
|
|
&SwRect::GetLeftDistance,
|
|
|
|
&SwRect::GetRightDistance,
|
|
|
|
&SwFrm::SetMaxBottom,
|
2001-11-09 12:32:26 +00:00
|
|
|
&SwRect::OverStepBottom,
|
|
|
|
|
2001-12-13 11:58:32 +00:00
|
|
|
&SwRect::SetUpperLeftCorner,
|
2001-11-09 12:32:26 +00:00
|
|
|
&SwFrm::MakeBelowPos,
|
|
|
|
&FirstMinusSecond,
|
|
|
|
&FirstMinusSecond,
|
|
|
|
&SwIncrement,
|
2001-11-16 10:40:30 +00:00
|
|
|
&SwIncrement,
|
2001-11-29 14:50:52 +00:00
|
|
|
&SwRect::SetLeftAndWidth,
|
2001-11-16 10:40:30 +00:00
|
|
|
&SwRect::SetTopAndHeight
|
2001-09-11 07:13:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static SwRectFnCollection aVertical = {
|
|
|
|
/* fnRectGet */
|
|
|
|
&SwRect::_Right,
|
|
|
|
&SwRect::_Left,
|
|
|
|
&SwRect::_Top,
|
|
|
|
&SwRect::_Bottom,
|
|
|
|
&SwRect::_Height,
|
|
|
|
&SwRect::_Width,
|
2001-10-05 11:36:10 +00:00
|
|
|
&SwRect::TopRight,
|
2001-09-18 08:14:03 +00:00
|
|
|
&SwRect::SwappedSize,
|
2001-09-11 07:13:09 +00:00
|
|
|
/* fnRectSet */
|
|
|
|
&SwRect::_Right,
|
|
|
|
&SwRect::_Left,
|
|
|
|
&SwRect::_Top,
|
|
|
|
&SwRect::_Bottom,
|
|
|
|
&SwRect::_Height,
|
|
|
|
&SwRect::_Width,
|
|
|
|
|
|
|
|
&SwRect::AddRight,
|
|
|
|
&SwRect::SubLeft,
|
|
|
|
&SwRect::SubTop,
|
|
|
|
&SwRect::AddBottom,
|
|
|
|
&SwRect::AddHeight,
|
|
|
|
&SwRect::AddWidth,
|
|
|
|
|
|
|
|
&SwRect::SetPosY,
|
|
|
|
&SwRect::SetPosX,
|
|
|
|
|
|
|
|
&SwFrm::GetRightMargin,
|
|
|
|
&SwFrm::GetLeftMargin,
|
|
|
|
&SwFrm::GetTopMargin,
|
2001-09-13 07:20:02 +00:00
|
|
|
&SwFrm::GetBottomMargin,
|
2001-11-09 12:32:26 +00:00
|
|
|
&SwFrm::SetTopBottomMargins,
|
|
|
|
&SwFrm::SetRightLeftMargins,
|
2001-11-16 10:40:30 +00:00
|
|
|
&SwFrm::GetPrtRight,
|
2001-09-13 07:20:02 +00:00
|
|
|
&SwFrm::GetPrtLeft,
|
2001-11-16 10:40:30 +00:00
|
|
|
&SwFrm::GetPrtTop,
|
|
|
|
&SwFrm::GetPrtBottom,
|
2001-12-12 13:44:09 +00:00
|
|
|
&SwRect::GetRightDistance,
|
2001-09-19 07:45:10 +00:00
|
|
|
&SwRect::GetLeftDistance,
|
2001-12-12 13:44:09 +00:00
|
|
|
&SwRect::GetTopDistance,
|
|
|
|
&SwRect::GetBottomDistance,
|
|
|
|
&SwFrm::SetMinLeft,
|
2001-11-09 12:32:26 +00:00
|
|
|
&SwRect::OverStepLeft,
|
|
|
|
|
2001-12-13 11:58:32 +00:00
|
|
|
&SwRect::SetUpperRightCorner,
|
2001-11-09 12:32:26 +00:00
|
|
|
&SwFrm::MakeLeftPos,
|
|
|
|
&FirstMinusSecond,
|
|
|
|
&SecondMinusFirst,
|
|
|
|
&SwIncrement,
|
2001-11-16 10:40:30 +00:00
|
|
|
&SwDecrement,
|
2001-11-29 14:50:52 +00:00
|
|
|
&SwRect::SetTopAndHeight,
|
2001-11-16 10:40:30 +00:00
|
|
|
&SwRect::SetRightAndWidth
|
2001-09-11 07:13:09 +00:00
|
|
|
};
|
|
|
|
|
2001-10-05 11:36:10 +00:00
|
|
|
static SwRectFnCollection aBottomToTop = {
|
|
|
|
/* fnRectGet */
|
|
|
|
&SwRect::_Bottom,
|
|
|
|
&SwRect::_Top,
|
|
|
|
&SwRect::_Left,
|
|
|
|
&SwRect::_Right,
|
|
|
|
&SwRect::_Width,
|
|
|
|
&SwRect::_Height,
|
|
|
|
&SwRect::BottomLeft,
|
|
|
|
&SwRect::_Size,
|
|
|
|
/* fnRectSet */
|
|
|
|
&SwRect::_Bottom,
|
|
|
|
&SwRect::_Top,
|
|
|
|
&SwRect::_Left,
|
|
|
|
&SwRect::_Right,
|
|
|
|
&SwRect::_Width,
|
|
|
|
&SwRect::_Height,
|
|
|
|
|
|
|
|
&SwRect::AddBottom,
|
|
|
|
&SwRect::SubTop,
|
|
|
|
&SwRect::SubLeft,
|
|
|
|
&SwRect::AddRight,
|
|
|
|
&SwRect::AddWidth,
|
|
|
|
&SwRect::AddHeight,
|
|
|
|
|
|
|
|
&SwRect::SetPosX,
|
|
|
|
&SwRect::SetPosY,
|
|
|
|
|
|
|
|
&SwFrm::GetBottomMargin,
|
|
|
|
&SwFrm::GetTopMargin,
|
|
|
|
&SwFrm::GetLeftMargin,
|
|
|
|
&SwFrm::GetRightMargin,
|
2001-11-09 12:32:26 +00:00
|
|
|
&SwFrm::SetLeftRightMargins,
|
|
|
|
&SwFrm::SetBottomTopMargins,
|
2001-11-16 10:40:30 +00:00
|
|
|
&SwFrm::GetPrtBottom,
|
2001-10-05 11:36:10 +00:00
|
|
|
&SwFrm::GetPrtTop,
|
2001-11-16 10:40:30 +00:00
|
|
|
&SwFrm::GetPrtLeft,
|
2001-12-12 13:44:09 +00:00
|
|
|
&SwFrm::GetPrtRight,
|
|
|
|
&SwRect::GetBottomDistance,
|
2001-10-05 11:36:10 +00:00
|
|
|
&SwRect::GetTopDistance,
|
2001-12-12 13:44:09 +00:00
|
|
|
&SwRect::GetLeftDistance,
|
|
|
|
&SwRect::GetRightDistance,
|
|
|
|
&SwFrm::SetMinTop,
|
2001-11-09 12:32:26 +00:00
|
|
|
&SwRect::OverStepTop,
|
|
|
|
|
2001-12-13 11:58:32 +00:00
|
|
|
&SwRect::SetLowerLeftCorner,
|
2001-11-09 12:32:26 +00:00
|
|
|
&SwFrm::MakeUpperPos,
|
|
|
|
&FirstMinusSecond,
|
|
|
|
&SecondMinusFirst,
|
|
|
|
&SwIncrement,
|
2001-11-16 10:40:30 +00:00
|
|
|
&SwDecrement,
|
2001-11-29 14:50:52 +00:00
|
|
|
&SwRect::SetLeftAndWidth,
|
2001-11-16 10:40:30 +00:00
|
|
|
&SwRect::SetBottomAndHeight
|
2001-10-05 11:36:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static SwRectFnCollection aVerticalRightToLeft = {
|
|
|
|
/* fnRectGet */
|
|
|
|
&SwRect::_Left,
|
|
|
|
&SwRect::_Right,
|
|
|
|
&SwRect::_Top,
|
|
|
|
&SwRect::_Bottom,
|
|
|
|
&SwRect::_Height,
|
|
|
|
&SwRect::_Width,
|
|
|
|
&SwRect::BottomRight,
|
|
|
|
&SwRect::SwappedSize,
|
|
|
|
/* fnRectSet */
|
|
|
|
&SwRect::_Left,
|
|
|
|
&SwRect::_Right,
|
|
|
|
&SwRect::_Top,
|
|
|
|
&SwRect::_Bottom,
|
|
|
|
&SwRect::_Height,
|
|
|
|
&SwRect::_Width,
|
|
|
|
|
|
|
|
&SwRect::SubLeft,
|
|
|
|
&SwRect::AddRight,
|
|
|
|
&SwRect::SubTop,
|
|
|
|
&SwRect::AddBottom,
|
|
|
|
&SwRect::AddHeight,
|
|
|
|
&SwRect::AddWidth,
|
|
|
|
|
|
|
|
&SwRect::SetPosY,
|
|
|
|
&SwRect::SetPosX,
|
|
|
|
|
|
|
|
&SwFrm::GetLeftMargin,
|
|
|
|
&SwFrm::GetRightMargin,
|
|
|
|
&SwFrm::GetTopMargin,
|
|
|
|
&SwFrm::GetBottomMargin,
|
2001-11-09 12:32:26 +00:00
|
|
|
&SwFrm::SetTopBottomMargins,
|
|
|
|
&SwFrm::SetLeftRightMargins,
|
2001-11-16 10:40:30 +00:00
|
|
|
&SwFrm::GetPrtLeft,
|
2001-10-05 11:36:10 +00:00
|
|
|
&SwFrm::GetPrtRight,
|
2001-11-16 10:40:30 +00:00
|
|
|
&SwFrm::GetPrtBottom,
|
|
|
|
&SwFrm::GetPrtTop,
|
2001-12-12 13:44:09 +00:00
|
|
|
&SwRect::GetLeftDistance,
|
2001-10-05 11:36:10 +00:00
|
|
|
&SwRect::GetRightDistance,
|
2001-12-12 13:44:09 +00:00
|
|
|
&SwRect::GetBottomDistance,
|
|
|
|
&SwRect::GetTopDistance,
|
|
|
|
&SwFrm::SetMaxRight,
|
2001-11-09 12:32:26 +00:00
|
|
|
&SwRect::OverStepRight,
|
|
|
|
|
2001-12-13 11:58:32 +00:00
|
|
|
&SwRect::SetLowerLeftCorner,
|
2001-11-09 12:32:26 +00:00
|
|
|
&SwFrm::MakeRightPos,
|
|
|
|
&FirstMinusSecond,
|
|
|
|
&FirstMinusSecond,
|
|
|
|
&SwDecrement,
|
2001-11-16 10:40:30 +00:00
|
|
|
&SwIncrement,
|
2001-11-29 14:50:52 +00:00
|
|
|
&SwRect::SetBottomAndHeight,
|
2001-11-16 10:40:30 +00:00
|
|
|
&SwRect::SetLeftAndWidth
|
2001-10-05 11:36:10 +00:00
|
|
|
};
|
2009-03-04 16:19:59 +00:00
|
|
|
//Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
|
|
|
|
static SwRectFnCollection aVerticalLeftToRight = {
|
|
|
|
/* fnRectGet */
|
|
|
|
&SwRect::_Left,
|
|
|
|
&SwRect::_Right,
|
|
|
|
&SwRect::_Top,
|
|
|
|
&SwRect::_Bottom,
|
|
|
|
&SwRect::_Height,
|
|
|
|
&SwRect::_Width,
|
|
|
|
&SwRect::TopLeft,
|
|
|
|
&SwRect::SwappedSize,
|
|
|
|
/* fnRectSet */
|
|
|
|
&SwRect::_Left,
|
|
|
|
&SwRect::_Right,
|
|
|
|
&SwRect::_Top,
|
|
|
|
&SwRect::_Bottom,
|
|
|
|
&SwRect::_Height,
|
|
|
|
&SwRect::_Width,
|
|
|
|
|
|
|
|
&SwRect::SubLeft,
|
|
|
|
&SwRect::AddRight,
|
|
|
|
&SwRect::SubTop,
|
|
|
|
&SwRect::AddBottom,
|
|
|
|
&SwRect::AddHeight,
|
|
|
|
&SwRect::AddWidth,
|
|
|
|
|
|
|
|
&SwRect::SetPosY,
|
|
|
|
&SwRect::SetPosX,
|
2001-10-05 11:36:10 +00:00
|
|
|
|
2009-03-04 16:19:59 +00:00
|
|
|
&SwFrm::GetLeftMargin,
|
|
|
|
&SwFrm::GetRightMargin,
|
|
|
|
&SwFrm::GetTopMargin,
|
|
|
|
&SwFrm::GetBottomMargin,
|
|
|
|
&SwFrm::SetTopBottomMargins,
|
|
|
|
&SwFrm::SetLeftRightMargins,
|
|
|
|
&SwFrm::GetPrtLeft,
|
|
|
|
&SwFrm::GetPrtRight,
|
|
|
|
&SwFrm::GetPrtTop,
|
|
|
|
&SwFrm::GetPrtBottom,
|
|
|
|
&SwRect::GetLeftDistance,
|
|
|
|
&SwRect::GetRightDistance,
|
|
|
|
&SwRect::GetTopDistance,
|
|
|
|
&SwRect::GetBottomDistance,
|
|
|
|
&SwFrm::SetMaxRight,
|
|
|
|
&SwRect::OverStepRight,
|
|
|
|
|
|
|
|
&SwRect::SetUpperLeftCorner,
|
|
|
|
&SwFrm::MakeRightPos,
|
|
|
|
&FirstMinusSecond,
|
|
|
|
&FirstMinusSecond,
|
|
|
|
&SwIncrement,
|
|
|
|
&SwIncrement,
|
|
|
|
&SwRect::SetTopAndHeight,
|
|
|
|
&SwRect::SetLeftAndWidth
|
|
|
|
};
|
|
|
|
//End of SCMS
|
2001-09-11 07:13:09 +00:00
|
|
|
SwRectFn fnRectHori = &aHorizontal;
|
|
|
|
SwRectFn fnRectVert = &aVertical;
|
2009-03-04 16:19:59 +00:00
|
|
|
//Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
|
|
|
|
SwRectFn fnRectVertL2R = &aVerticalLeftToRight;
|
|
|
|
//End of SCMS
|
2001-10-05 11:36:10 +00:00
|
|
|
SwRectFn fnRectB2T = &aBottomToTop;
|
|
|
|
SwRectFn fnRectVL2R = &aVerticalRightToLeft;
|
2001-09-11 07:13:09 +00:00
|
|
|
|
2011-04-16 22:42:13 -03:00
|
|
|
// #i65250#
|
2006-06-02 11:12:26 +00:00
|
|
|
sal_uInt32 SwFrm::mnLastFrmId=0;
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2012-02-06 10:45:17 +01:00
|
|
|
TYPEINIT1(SwFrm,SwClient); //rtti for SwFrm
|
|
|
|
TYPEINIT1(SwCntntFrm,SwFrm); //rtti for SwCntntFrm
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
void _FrmInit()
|
|
|
|
{
|
|
|
|
SwRootFrm::pVout = new SwLayVout();
|
2012-01-21 15:21:16 +01:00
|
|
|
SwCache *pNew = new SwCache( 100
|
2011-11-24 00:52:00 +01:00
|
|
|
#ifdef DBG_UTIL
|
2000-09-18 23:08:29 +00:00
|
|
|
, "static SwBorderAttrs::pCache"
|
|
|
|
#endif
|
|
|
|
);
|
|
|
|
SwFrm::SetCache( pNew );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void _FrmFinit()
|
|
|
|
{
|
2011-11-24 00:52:07 +01:00
|
|
|
#if OSL_DEBUG_LEVEL > 0
|
2012-02-06 10:45:17 +01:00
|
|
|
// The cache may only contain null pointers at this time.
|
2012-05-23 16:13:53 +02:00
|
|
|
for( sal_uInt16 n = SwFrm::GetCachePtr()->size(); n; )
|
2000-09-18 23:08:29 +00:00
|
|
|
if( (*SwFrm::GetCachePtr())[ --n ] )
|
|
|
|
{
|
|
|
|
SwCacheObj* pObj = (*SwFrm::GetCachePtr())[ n ];
|
2013-10-10 17:48:53 +03:00
|
|
|
OSL_ENSURE( !pObj, "Who didn't deregister?");
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
delete SwRootFrm::pVout;
|
|
|
|
delete SwFrm::GetCachePtr();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
2012-02-06 10:45:17 +01:00
|
|
|
|* RootFrm::Everything that belongs to CurrShell
|
2000-09-18 23:08:29 +00:00
|
|
|
|*
|
|
|
|
|*************************************************************************/
|
|
|
|
|
2012-07-13 15:19:48 +02:00
|
|
|
class SwCurrShells : public std::set<CurrShell*> {};
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2013-10-26 19:50:13 +02:00
|
|
|
CurrShell::CurrShell( SwViewShell *pNew )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2012-02-06 10:45:17 +01:00
|
|
|
OSL_ENSURE( pNew, "insert 0-Shell?" );
|
2000-09-18 23:08:29 +00:00
|
|
|
pRoot = pNew->GetLayout();
|
|
|
|
if ( pRoot )
|
|
|
|
{
|
|
|
|
pPrev = pRoot->pCurrShell;
|
|
|
|
pRoot->pCurrShell = pNew;
|
2012-07-13 15:19:48 +02:00
|
|
|
pRoot->pCurrShells->insert( this );
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
pPrev = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
CurrShell::~CurrShell()
|
|
|
|
{
|
|
|
|
if ( pRoot )
|
|
|
|
{
|
2012-07-13 15:19:48 +02:00
|
|
|
pRoot->pCurrShells->erase( this );
|
2000-09-18 23:08:29 +00:00
|
|
|
if ( pPrev )
|
|
|
|
pRoot->pCurrShell = pPrev;
|
2012-07-13 15:19:48 +02:00
|
|
|
if ( pRoot->pCurrShells->empty() && pRoot->pWaitingCurrShell )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
pRoot->pCurrShell = pRoot->pWaitingCurrShell;
|
|
|
|
pRoot->pWaitingCurrShell = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-26 19:50:13 +02:00
|
|
|
void SetShell( SwViewShell *pSh )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
SwRootFrm *pRoot = pSh->GetLayout();
|
2012-07-13 15:19:48 +02:00
|
|
|
if ( pRoot->pCurrShells->empty() )
|
2000-09-18 23:08:29 +00:00
|
|
|
pRoot->pCurrShell = pSh;
|
|
|
|
else
|
|
|
|
pRoot->pWaitingCurrShell = pSh;
|
|
|
|
}
|
|
|
|
|
2013-10-26 19:50:13 +02:00
|
|
|
void SwRootFrm::DeRegisterShell( SwViewShell *pSh )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2012-02-06 10:45:17 +01:00
|
|
|
// Activate some shell if possible
|
2000-09-18 23:08:29 +00:00
|
|
|
if ( pCurrShell == pSh )
|
2013-10-26 19:50:13 +02:00
|
|
|
pCurrShell = pSh->GetNext() != pSh ? (SwViewShell*)pSh->GetNext() : 0;
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2012-02-06 10:45:17 +01:00
|
|
|
// Doesn't matter anymore
|
2000-09-18 23:08:29 +00:00
|
|
|
if ( pWaitingCurrShell == pSh )
|
|
|
|
pWaitingCurrShell = 0;
|
|
|
|
|
2012-02-06 10:45:17 +01:00
|
|
|
// Remove references
|
2012-07-13 15:19:48 +02:00
|
|
|
for ( SwCurrShells::iterator it = pCurrShells->begin(); it != pCurrShells->end(); ++it )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2012-07-13 15:19:48 +02:00
|
|
|
CurrShell *pC = *it;
|
2000-09-18 23:08:29 +00:00
|
|
|
if (pC->pPrev == pSh)
|
|
|
|
pC->pPrev = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void InitCurrShells( SwRootFrm *pRoot )
|
|
|
|
{
|
|
|
|
pRoot->pCurrShells = new SwCurrShells;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwRootFrm::SwRootFrm()
|
|
|
|
|*
|
2012-02-06 10:45:17 +01:00
|
|
|
|* Description:
|
|
|
|
|* The RootFrm requests an own FrmFmt from the document, which it is
|
|
|
|
|* going to delete again in the dtor. The own FrmFmt is derived from
|
2012-02-21 14:26:06 +01:00
|
|
|
|* the passed FrmFmt.
|
2000-09-18 23:08:29 +00:00
|
|
|
|*
|
|
|
|
|*************************************************************************/
|
|
|
|
|
|
|
|
|
2013-10-26 19:50:13 +02:00
|
|
|
SwRootFrm::SwRootFrm( SwFrmFmt *pFmt, SwViewShell * pSh ) :
|
2000-09-18 23:08:29 +00:00
|
|
|
SwLayoutFrm( pFmt->GetDoc()->MakeFrmFmt(
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString("Root"), pFmt ), 0 ),
|
2008-03-07 13:56:42 +00:00
|
|
|
maPagesArea(),
|
|
|
|
mnViewWidth( -1 ),
|
|
|
|
mnColumns( 0 ),
|
|
|
|
mbBookMode( false ),
|
|
|
|
mbSidebarChanged( false ),
|
2008-07-16 12:27:17 +00:00
|
|
|
mbNeedGrammarCheck( false ),
|
2013-10-24 14:53:53 +01:00
|
|
|
bCheckSuperfluous( false ),
|
|
|
|
bIdleFormat( true ),
|
|
|
|
bBrowseWidthValid( false ),
|
|
|
|
bTurboAllowed( true ),
|
|
|
|
bAssertFlyPages( true ),
|
|
|
|
bIsVirtPageNum( false ),
|
|
|
|
bIsNewLayout( true ),
|
|
|
|
bCallbackActionEnabled ( false ),
|
2013-11-20 10:39:49 +01:00
|
|
|
bLayoutFreezed ( false ),
|
2012-02-06 10:45:17 +01:00
|
|
|
nBrowseWidth( MM50*4 ), //2cm minimum
|
2000-09-18 23:08:29 +00:00
|
|
|
pTurbo( 0 ),
|
|
|
|
pLastPage( 0 ),
|
|
|
|
pCurrShell( pSh ),
|
|
|
|
pWaitingCurrShell( 0 ),
|
2007-09-27 08:04:53 +00:00
|
|
|
pDrawPage( 0 ),
|
2000-09-18 23:08:29 +00:00
|
|
|
pDestroy( 0 ),
|
|
|
|
nPhyPageNums( 0 ),
|
2006-02-01 13:25:03 +00:00
|
|
|
nAccessibleShells( 0 )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
2013-02-09 11:35:20 +01:00
|
|
|
mnType = FRMC_ROOT;
|
2011-02-09 15:55:27 +01:00
|
|
|
setRootFrm( this );
|
2011-02-18 19:02:00 +01:00
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2011-02-25 09:07:02 +01:00
|
|
|
void SwRootFrm::Init( SwFrmFmt* pFmt )
|
2011-02-18 19:02:00 +01:00
|
|
|
{
|
2000-09-18 23:08:29 +00:00
|
|
|
InitCurrShells( this );
|
|
|
|
|
2006-10-11 07:49:52 +00:00
|
|
|
IDocumentTimerAccess *pTimerAccess = pFmt->getIDocumentTimerAccess();
|
|
|
|
IDocumentLayoutAccess *pLayoutAccess = pFmt->getIDocumentLayoutAccess();
|
|
|
|
IDocumentFieldsAccess *pFieldsAccess = pFmt->getIDocumentFieldsAccess();
|
|
|
|
const IDocumentSettingAccess *pSettingAccess = pFmt->getIDocumentSettingAccess();
|
|
|
|
pTimerAccess->StopIdling();
|
2012-09-06 23:34:57 +02:00
|
|
|
// For creating the Flys by MakeFrms()
|
|
|
|
pLayoutAccess->SetCurrentViewShell( this->GetCurrShell() );
|
2012-02-06 10:45:17 +01:00
|
|
|
bCallbackActionEnabled = sal_False; // needs to be set to sal_True before leaving!
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2006-08-14 15:28:02 +00:00
|
|
|
SdrModel *pMd = pFmt->getIDocumentDrawModelAccess()->GetDrawModel();
|
2000-09-18 23:08:29 +00:00
|
|
|
if ( pMd )
|
|
|
|
{
|
2010-06-13 15:22:56 +02:00
|
|
|
// Disable "multiple layout"
|
|
|
|
pDrawPage = pMd->GetPage(0); //pMd->AllocPage( FALSE );
|
|
|
|
//pMd->InsertPage( pDrawPage );
|
|
|
|
// end of disabling
|
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
pDrawPage->SetSize( Frm().SSize() );
|
|
|
|
}
|
|
|
|
|
2012-02-06 10:45:17 +01:00
|
|
|
// Initialize the layout: create pages, link content with Cntnt etc.
|
|
|
|
// First, initialize some stuff, then get hold of the first
|
|
|
|
// node (which will be needed for the PageDesc).
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2006-10-11 07:49:52 +00:00
|
|
|
SwDoc* pDoc = pFmt->GetDoc();
|
2000-09-18 23:08:29 +00:00
|
|
|
SwNodeIndex aIndex( *pDoc->GetNodes().GetEndOfContent().StartOfSectionNode() );
|
2011-01-17 15:06:54 +01:00
|
|
|
SwCntntNode *pNode = pDoc->GetNodes().GoNextSection( &aIndex, sal_True, sal_False );
|
2011-04-18 12:37:38 -03:00
|
|
|
// #123067# pNode = 0 can really happen
|
2005-07-08 10:03:57 +00:00
|
|
|
SwTableNode *pTblNd= pNode ? pNode->FindTableNode() : 0;
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2012-02-06 10:45:17 +01:00
|
|
|
// Get hold of PageDesc (either via FrmFmt of the first node or the initial one).
|
2000-09-18 23:08:29 +00:00
|
|
|
SwPageDesc *pDesc = 0;
|
2013-08-29 17:16:44 +03:00
|
|
|
::boost::optional<sal_uInt16> oPgNum;
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
if ( pTblNd )
|
|
|
|
{
|
|
|
|
const SwFmtPageDesc &rDesc = pTblNd->GetTable().GetFrmFmt()->GetPageDesc();
|
|
|
|
pDesc = (SwPageDesc*)rDesc.GetPageDesc();
|
2012-02-06 10:45:17 +01:00
|
|
|
//#19104# respect the page number offset!!
|
2013-08-29 17:16:44 +03:00
|
|
|
oPgNum = rDesc.GetNumOffset();
|
|
|
|
if (oPgNum)
|
|
|
|
bIsVirtPageNum = true;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
else if ( pNode )
|
|
|
|
{
|
|
|
|
const SwFmtPageDesc &rDesc = pNode->GetSwAttrSet().GetPageDesc();
|
|
|
|
pDesc = (SwPageDesc*)rDesc.GetPageDesc();
|
2012-02-06 10:45:17 +01:00
|
|
|
//#19104# respect the page number offset!!
|
2013-08-29 17:16:44 +03:00
|
|
|
oPgNum = rDesc.GetNumOffset();
|
|
|
|
if (oPgNum)
|
|
|
|
bIsVirtPageNum = true;
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
2001-03-02 09:47:13 +00:00
|
|
|
else
|
2011-01-17 15:06:54 +01:00
|
|
|
bIsVirtPageNum = sal_False;
|
2000-09-18 23:08:29 +00:00
|
|
|
if ( !pDesc )
|
2012-06-21 13:40:06 +02:00
|
|
|
pDesc = &pDoc->GetPageDesc( 0 );
|
2013-08-29 17:16:44 +03:00
|
|
|
const bool bOdd = !oPgNum || 0 != ( oPgNum.get() % 2 );
|
|
|
|
bool bFirst = !oPgNum || 1 == oPgNum.get();
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2012-02-06 10:45:17 +01:00
|
|
|
// Create a page and put it in the layout
|
2012-11-27 20:49:30 +09:00
|
|
|
SwPageFrm *pPage = ::InsertNewPage( *pDesc, this, bOdd, bFirst, false, sal_False, 0 );
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2012-02-06 10:45:17 +01:00
|
|
|
// Find the first page in the Bodytext section.
|
2000-09-18 23:08:29 +00:00
|
|
|
SwLayoutFrm *pLay = pPage->FindBodyCont();
|
|
|
|
while( pLay->Lower() )
|
|
|
|
pLay = (SwLayoutFrm*)pLay->Lower();
|
|
|
|
|
|
|
|
SwNodeIndex aTmp( *pDoc->GetNodes().GetEndOfContent().StartOfSectionNode(), 1 );
|
2011-01-17 15:06:54 +01:00
|
|
|
::_InsertCnt( pLay, pDoc, aTmp.GetIndex(), sal_True );
|
2012-02-06 10:45:17 +01:00
|
|
|
//Remove masters that haven't been replaced yet from the list.
|
2000-09-18 23:08:29 +00:00
|
|
|
RemoveMasterObjs( pDrawPage );
|
2006-10-11 07:49:52 +00:00
|
|
|
if( pSettingAccess->get(IDocumentSettingAccess::GLOBAL_DOCUMENT) )
|
|
|
|
pFieldsAccess->UpdateRefFlds( NULL );
|
2006-06-20 11:02:40 +00:00
|
|
|
//b6433357: Update page fields after loading
|
|
|
|
// --->
|
|
|
|
if ( !pCurrShell || !pCurrShell->Imp()->IsUpdateExpFlds() )
|
|
|
|
{
|
|
|
|
SwDocPosUpdate aMsgHnt( pPage->Frm().Top() );
|
2006-10-11 07:49:52 +00:00
|
|
|
pFieldsAccess->UpdatePageFlds( &aMsgHnt );
|
2006-06-20 11:02:40 +00:00
|
|
|
}
|
|
|
|
|
2006-10-11 07:49:52 +00:00
|
|
|
pTimerAccess->StartIdling();
|
2011-01-17 15:06:54 +01:00
|
|
|
bCallbackActionEnabled = sal_True;
|
2008-07-16 12:27:17 +00:00
|
|
|
|
2013-10-26 19:50:13 +02:00
|
|
|
SwViewShell *pViewSh = GetCurrShell();
|
2008-07-16 12:27:17 +00:00
|
|
|
if (pViewSh)
|
|
|
|
mbNeedGrammarCheck = pViewSh->GetViewOptions()->IsOnlineSpell();
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwRootFrm::~SwRootFrm()
|
|
|
|
|*
|
|
|
|
|*************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SwRootFrm::~SwRootFrm()
|
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
bTurboAllowed = sal_False;
|
2000-09-18 23:08:29 +00:00
|
|
|
pTurbo = 0;
|
2011-09-23 01:13:34 +02:00
|
|
|
// fdo#39510 crash on document close with footnotes
|
|
|
|
// Object ownership in writer and esp. in layout are a mess: Before the
|
|
|
|
// document/layout split SwDoc and SwRootFrm were essentially one object
|
|
|
|
// and magically/uncleanly worked around their common destruction by call
|
|
|
|
// to SwDoc::IsInDtor() -- even from the layout. As of now destuction of
|
|
|
|
// the layout proceeds forward through the frames. Since SwTxtFtn::DelFrms
|
|
|
|
// also searches backwards to find the master of footnotes, they must be
|
|
|
|
// considered to be owned by the SwRootFrm and also be destroyed here,
|
|
|
|
// before tearing down the (now footnote free) rest of the layout.
|
2012-02-18 00:06:33 +01:00
|
|
|
RemoveFtns(0, false, true);
|
2011-09-23 01:13:34 +02:00
|
|
|
|
2000-09-18 23:08:29 +00:00
|
|
|
if(pBlink)
|
|
|
|
pBlink->FrmDelete( this );
|
2011-11-18 16:50:03 +01:00
|
|
|
SwFrmFmt *pRegisteredInNonConst = static_cast<SwFrmFmt*>(GetRegisteredInNonConst());
|
|
|
|
if ( pRegisteredInNonConst )
|
|
|
|
{
|
|
|
|
SwDoc *pDoc = pRegisteredInNonConst->GetDoc();
|
|
|
|
pDoc->DelFrmFmt( pRegisteredInNonConst );
|
|
|
|
pDoc->ClearSwLayouterEntries();
|
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
delete pDestroy;
|
2010-06-13 15:22:56 +02:00
|
|
|
pDestroy = 0;
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2012-02-06 10:45:17 +01:00
|
|
|
// Remove references
|
2012-07-13 15:19:48 +02:00
|
|
|
for ( SwCurrShells::iterator it = pCurrShells->begin(); it != pCurrShells->end(); ++it )
|
|
|
|
(*it)->pRoot = 0;
|
2000-09-18 23:08:29 +00:00
|
|
|
|
|
|
|
delete pCurrShells;
|
2012-02-27 20:43:27 +01:00
|
|
|
pCurrShells = 0;
|
2002-05-03 11:40:10 +00:00
|
|
|
|
2012-02-27 20:43:27 +01:00
|
|
|
// Some accessible shells are left => problems on second SwFrm::Destroy call
|
|
|
|
assert(0 == nAccessibleShells);
|
|
|
|
|
|
|
|
// manually call base classes Destroy because it could call stuff
|
|
|
|
// that accesses members of this
|
|
|
|
SwLayoutFrm::Destroy();
|
|
|
|
SwFrm::Destroy();
|
2000-09-18 23:08:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
|*
|
|
|
|
|* SwRootFrm::RemoveMasterObjs()
|
|
|
|
|*
|
|
|
|
|*************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
void SwRootFrm::RemoveMasterObjs( SdrPage *pPg )
|
|
|
|
{
|
2012-02-06 10:45:17 +01:00
|
|
|
// Remove all master objects from the Page. But don't delete!
|
2011-01-17 15:06:54 +01:00
|
|
|
for( sal_uLong i = pPg ? pPg->GetObjCount() : 0; i; )
|
2000-09-18 23:08:29 +00:00
|
|
|
{
|
|
|
|
SdrObject* pObj = pPg->GetObj( --i );
|
|
|
|
if( pObj->ISA(SwFlyDrawObj ) )
|
|
|
|
pPg->RemoveObject( i );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-06-13 15:22:56 +02:00
|
|
|
void SwRootFrm::AllCheckPageDescs() const
|
|
|
|
{
|
2013-11-20 10:39:49 +01:00
|
|
|
if ( !IsLayoutFreezed() )
|
|
|
|
CheckPageDescs( (SwPageFrm*)this->Lower() );
|
2010-06-13 15:22:56 +02:00
|
|
|
}
|
2013-10-22 15:14:13 +03:00
|
|
|
|
2010-06-13 15:22:56 +02:00
|
|
|
void SwRootFrm::AllInvalidateAutoCompleteWords() const
|
|
|
|
{
|
|
|
|
SwPageFrm *pPage = (SwPageFrm*)this->Lower();
|
|
|
|
while ( pPage )
|
|
|
|
{
|
|
|
|
pPage->InvalidateAutoCompleteWords();
|
|
|
|
pPage = (SwPageFrm*)pPage->GetNext();
|
|
|
|
}
|
2013-10-22 15:14:13 +03:00
|
|
|
}
|
2010-06-13 15:22:56 +02:00
|
|
|
void SwRootFrm::AllAddPaintRect() const
|
|
|
|
{
|
|
|
|
GetCurrShell()->AddPaintRect( this->Frm() );
|
2013-10-22 15:14:13 +03:00
|
|
|
}
|
2010-06-13 15:22:56 +02:00
|
|
|
void SwRootFrm::AllRemoveFtns()
|
|
|
|
{
|
|
|
|
RemoveFtns();
|
|
|
|
}
|
2012-10-16 18:29:11 +09:00
|
|
|
void SwRootFrm::AllInvalidateSmartTagsOrSpelling(bool bSmartTags) const
|
2010-06-13 15:22:56 +02:00
|
|
|
{
|
|
|
|
SwPageFrm *pPage = (SwPageFrm*)this->Lower();
|
|
|
|
while ( pPage )
|
|
|
|
{
|
|
|
|
if ( bSmartTags )
|
|
|
|
pPage->InvalidateSmartTags();
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2010-06-13 15:22:56 +02:00
|
|
|
pPage->InvalidateSpelling();
|
|
|
|
pPage = (SwPageFrm*)pPage->GetNext();
|
2013-10-22 15:14:13 +03:00
|
|
|
}
|
2010-06-13 15:22:56 +02:00
|
|
|
}
|
2000-09-18 23:08:29 +00:00
|
|
|
|
2010-10-14 08:30:41 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|