2010-10-12 15:53:47 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-11-21 22:06:52 +00: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 .
|
|
|
|
*/
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2006-09-17 04:53:36 +00:00
|
|
|
|
2007-06-27 18:04:55 +00:00
|
|
|
#include <svx/svdoattr.hxx>
|
|
|
|
#include <svx/xpool.hxx>
|
|
|
|
#include <svx/svdmodel.hxx>
|
|
|
|
#include <svx/svdpage.hxx>
|
|
|
|
#include <svx/svdattr.hxx>
|
|
|
|
#include <svx/svdpool.hxx>
|
|
|
|
#include <svx/svdotext.hxx>
|
|
|
|
#include <svx/svdocapt.hxx>
|
|
|
|
#include <svx/svdograf.hxx>
|
|
|
|
#include <svx/svdoole2.hxx>
|
|
|
|
#include <svx/svdorect.hxx>
|
|
|
|
#include <svx/svdocirc.hxx>
|
|
|
|
#include <svx/svdomeas.hxx>
|
2009-10-16 00:05:16 +02:00
|
|
|
#include <svl/smplhint.hxx>
|
|
|
|
#include <svl/itemiter.hxx>
|
2007-06-27 18:04:55 +00:00
|
|
|
#include <svx/xenum.hxx>
|
|
|
|
#include <svx/xlineit0.hxx>
|
|
|
|
#include <svx/xlnstwit.hxx>
|
|
|
|
#include <svx/xlnedwit.hxx>
|
|
|
|
#include <svx/xfillit0.hxx>
|
|
|
|
#include <svx/xflbmtit.hxx>
|
|
|
|
#include <svx/xtextit0.hxx>
|
|
|
|
#include <svx/xflbstit.hxx>
|
|
|
|
#include <svx/xflbtoxy.hxx>
|
|
|
|
#include <svx/xftshit.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-04-18 19:59:45 -03:00
|
|
|
#include <editeng/editdata.hxx>
|
2010-01-07 18:52:36 +01:00
|
|
|
#include <editeng/colritem.hxx>
|
|
|
|
#include "editeng/fontitem.hxx"
|
|
|
|
#include <editeng/fhgtitem.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2007-06-27 18:04:55 +00:00
|
|
|
#include <svx/xlnstcit.hxx>
|
|
|
|
#include <svx/xlnwtit.hxx>
|
2009-10-16 00:05:16 +02:00
|
|
|
#include <svl/style.hxx>
|
|
|
|
#include <svl/whiter.hxx>
|
2007-06-27 18:04:55 +00:00
|
|
|
#include <svx/xlnclit.hxx>
|
|
|
|
#include <svx/xflclit.hxx>
|
|
|
|
#include <svx/xlntrit.hxx>
|
|
|
|
#include <svx/xfltrit.hxx>
|
|
|
|
#include <svx/xlnedcit.hxx>
|
2013-02-12 13:41:53 -05:00
|
|
|
#include <editeng/adjustitem.hxx>
|
2007-06-27 18:04:55 +00:00
|
|
|
#include <svx/xflbckit.hxx>
|
|
|
|
#include <svx/xtable.hxx>
|
|
|
|
#include <svx/xbtmpit.hxx>
|
|
|
|
#include <svx/xlndsit.hxx>
|
|
|
|
#include <svx/xlnedit.hxx>
|
|
|
|
#include <svx/xflgrit.hxx>
|
|
|
|
#include <svx/xflftrit.hxx>
|
|
|
|
#include <svx/xflhtit.hxx>
|
|
|
|
#include <svx/xlnstit.hxx>
|
2014-10-28 12:03:34 -04:00
|
|
|
#include <sdr/properties/attributeproperties.hxx>
|
2006-11-14 12:44:24 +00:00
|
|
|
#include <basegfx/polygon/b2dpolygon.hxx>
|
2009-11-04 12:06:36 +01:00
|
|
|
#include "svx/xlinjoit.hxx"
|
2006-11-14 12:44:24 +00:00
|
|
|
|
2014-07-18 18:07:36 +02:00
|
|
|
using namespace com::sun::star;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2003-11-24 15:56:05 +00:00
|
|
|
sdr::properties::BaseProperties* SdrAttrObj::CreateObjectSpecificProperties()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2003-11-24 15:56:05 +00:00
|
|
|
return new sdr::properties::AttributeProperties(*this);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2014-02-25 20:51:35 +01:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2003-11-24 15:56:05 +00:00
|
|
|
TYPEINIT1(SdrAttrObj,SdrObject);
|
2000-10-30 10:20:51 +00:00
|
|
|
|
2003-11-24 15:56:05 +00:00
|
|
|
SdrAttrObj::SdrAttrObj()
|
|
|
|
{
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2003-11-24 15:56:05 +00:00
|
|
|
SdrAttrObj::~SdrAttrObj()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2000-10-30 10:20:51 +00:00
|
|
|
const Rectangle& SdrAttrObj::GetSnapRect() const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2000-10-30 10:20:51 +00:00
|
|
|
if(bSnapRectDirty)
|
|
|
|
{
|
2015-03-26 15:31:47 +01:00
|
|
|
const_cast<SdrAttrObj*>(this)->RecalcSnapRect();
|
|
|
|
const_cast<SdrAttrObj*>(this)->bSnapRectDirty = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2008-10-17 08:40:10 +00:00
|
|
|
|
2000-10-30 10:20:51 +00:00
|
|
|
return maSnapRect;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
void SdrAttrObj::SetModel(SdrModel* pNewModel)
|
|
|
|
{
|
2000-10-30 10:20:51 +00:00
|
|
|
SdrModel* pOldModel = pModel;
|
|
|
|
|
|
|
|
// test for correct pool in ItemSet; move to new pool if necessary
|
2014-08-05 23:04:07 +02:00
|
|
|
if(pNewModel && &GetObjectItemPool() != &pNewModel->GetItemPool())
|
2001-01-26 13:08:54 +00:00
|
|
|
{
|
2014-08-05 23:04:07 +02:00
|
|
|
MigrateItemPool(&GetObjectItemPool(), &pNewModel->GetItemPool(), pNewModel);
|
2001-01-26 13:08:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// call parent
|
2003-11-24 15:56:05 +00:00
|
|
|
SdrObject::SetModel(pNewModel);
|
2001-01-26 13:08:54 +00:00
|
|
|
|
2003-11-24 15:56:05 +00:00
|
|
|
// modify properties
|
|
|
|
GetProperties().SetModel(pOldModel, pNewModel);
|
2001-01-26 13:08:54 +00:00
|
|
|
}
|
2000-10-30 10:20:51 +00:00
|
|
|
|
2014-02-25 20:51:35 +01:00
|
|
|
|
2003-11-24 15:56:05 +00:00
|
|
|
// syntactical sugar for ItemSet accesses
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2010-12-11 23:23:07 +01:00
|
|
|
void SdrAttrObj::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint)
|
2000-10-30 10:20:51 +00:00
|
|
|
{
|
2014-08-27 16:57:21 +02:00
|
|
|
const SfxSimpleHint* pSimple = dynamic_cast<const SfxSimpleHint*>(&rHint);
|
2013-04-07 23:05:56 +09:00
|
|
|
bool bDataChg(pSimple && SFX_HINT_DATACHANGED == pSimple->GetId());
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2003-11-24 15:56:05 +00:00
|
|
|
if(bDataChg)
|
2000-10-30 10:20:51 +00:00
|
|
|
{
|
2003-11-24 15:56:05 +00:00
|
|
|
Rectangle aBoundRect = GetLastBoundRect();
|
|
|
|
SetBoundRectDirty();
|
2014-03-10 11:09:59 +02:00
|
|
|
SetRectsDirty(true);
|
2000-10-30 10:20:51 +00:00
|
|
|
|
2011-11-27 23:21:00 +01:00
|
|
|
// This may have led to object change
|
2003-11-24 15:56:05 +00:00
|
|
|
SetChanged();
|
|
|
|
BroadcastObjectChange();
|
|
|
|
SendUserCall(SDRUSERCALL_CHGATTR, aBoundRect);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-08-03 12:21:11 +00:00
|
|
|
sal_Int32 SdrAttrObj::ImpGetLineWdt() const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2004-08-03 12:21:11 +00:00
|
|
|
sal_Int32 nRetval(0);
|
2000-10-30 10:20:51 +00:00
|
|
|
|
2014-11-21 20:48:11 +02:00
|
|
|
if(drawing::LineStyle_NONE != static_cast<const XLineStyleItem&>(GetObjectItem(XATTR_LINESTYLE)).GetValue())
|
2004-08-03 12:21:11 +00:00
|
|
|
{
|
2014-10-17 10:35:35 +02:00
|
|
|
nRetval = static_cast<const XLineWidthItem&>(GetObjectItem(XATTR_LINEWIDTH)).GetValue();
|
2004-08-03 12:21:11 +00:00
|
|
|
}
|
2000-10-30 10:20:51 +00:00
|
|
|
|
2004-08-03 12:21:11 +00:00
|
|
|
return nRetval;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2014-03-10 11:09:59 +02:00
|
|
|
bool SdrAttrObj::HasFill() const
|
2000-10-30 10:20:51 +00:00
|
|
|
{
|
2014-10-17 10:35:35 +02:00
|
|
|
return bClosedObj && static_cast<const XFillStyleItem&>(GetProperties().GetObjectItemSet().Get(XATTR_FILLSTYLE)).GetValue() != drawing::FillStyle_NONE;
|
2000-10-30 10:20:51 +00:00
|
|
|
}
|
|
|
|
|
2014-03-10 11:09:59 +02:00
|
|
|
bool SdrAttrObj::HasLine() const
|
2000-10-30 10:20:51 +00:00
|
|
|
{
|
2014-11-21 20:48:11 +02:00
|
|
|
return static_cast<const XLineStyleItem&>(GetProperties().GetObjectItemSet().Get(XATTR_LINESTYLE)).GetValue() != drawing::LineStyle_NONE;
|
2000-10-30 10:20:51 +00:00
|
|
|
}
|
2001-03-07 13:38:01 +00:00
|
|
|
|
2010-10-12 15:53:47 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|