summaryrefslogtreecommitdiff
path: root/sd/source/ui/unoidl/unopage.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sd/source/ui/unoidl/unopage.cxx')
-rw-r--r--sd/source/ui/unoidl/unopage.cxx144
1 files changed, 45 insertions, 99 deletions
diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx
index 685bb4a48144..69d961d7237a 100644
--- a/sd/source/ui/unoidl/unopage.cxx
+++ b/sd/source/ui/unoidl/unopage.cxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: unopage.cxx,v $
- * $Revision: 1.96 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
@@ -44,23 +41,17 @@
#include <rtl/ustrbuf.hxx>
#include <vcl/bitmapex.hxx>
#include <vcl/metaact.hxx>
-#ifndef _TOOLKIT_UNOIFACE_HXX
#include <toolkit/unohlp.hxx>
-#endif
#include <vcl/svapp.hxx>
#include <vcl/settings.hxx>
#include <unomodel.hxx>
#include <unopage.hxx>
-#ifndef _SVX_SVXIDS_HRC
#include <svx/svxids.hrc>
-#endif
#include <svl/itemset.hxx>
#include <svx/svdmodel.hxx>
#include <sdresid.hxx>
#include <glob.hrc>
-#ifndef _SD_PAGE_HXX //autogen
#include <sdpage.hxx>
-#endif
#include <unoprnms.hxx>
#include <sdattr.hxx>
#include <drawdoc.hxx>
@@ -71,13 +62,14 @@
#include <svl/style.hxx>
#include <rtl/uuid.h>
#include <rtl/memory.h>
+#include <comphelper/serviceinfohelper.hxx>
#include <comphelper/extract.hxx>
#include <list>
#include <svx/svditer.hxx>
#include <svtools/wmf.hxx>
#include <svx/svdoole2.hxx>
-
+#include <svx/svdpool.hxx>
#include <svx/svdview.hxx>
#include "misc.hxx"
#include "View.hxx"
@@ -259,19 +251,19 @@ const SvxItemPropertySet* ImplGetDrawPagePropertySet( sal_Bool bImpress, PageKin
if( ePageKind == PK_STANDARD )
{
//PK_STANDARD always has a background property
- static SvxItemPropertySet aDrawPagePropertySet_Impl( aDrawPagePropertyMap_Impl );
+ static SvxItemPropertySet aDrawPagePropertySet_Impl( aDrawPagePropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
pRet = &aDrawPagePropertySet_Impl;
}
else
{
if(bWithoutBackground)
{
- static SvxItemPropertySet aDrawPageNotesHandoutPropertyNoBackSet_Impl( aDrawPageNotesHandoutPropertyNoBackMap_Impl );
+ static SvxItemPropertySet aDrawPageNotesHandoutPropertyNoBackSet_Impl( aDrawPageNotesHandoutPropertyNoBackMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
pRet = &aDrawPageNotesHandoutPropertyNoBackSet_Impl;
}
else
{
- static SvxItemPropertySet aDrawPageNotesHandoutPropertySet_Impl( aDrawPageNotesHandoutPropertyMap_Impl );
+ static SvxItemPropertySet aDrawPageNotesHandoutPropertySet_Impl( aDrawPageNotesHandoutPropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
pRet = &aDrawPageNotesHandoutPropertySet_Impl;
}
}
@@ -280,12 +272,12 @@ const SvxItemPropertySet* ImplGetDrawPagePropertySet( sal_Bool bImpress, PageKin
{
if(bWithoutBackground)
{
- static SvxItemPropertySet aGraphicPagePropertyNoBackSet_Impl( aGraphicPagePropertyNoBackMap_Impl );
+ static SvxItemPropertySet aGraphicPagePropertyNoBackSet_Impl( aGraphicPagePropertyNoBackMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
pRet = &aGraphicPagePropertyNoBackSet_Impl;
}
else
{
- static SvxItemPropertySet aGraphicPagePropertySet_Impl( aGraphicPagePropertyMap_Impl );
+ static SvxItemPropertySet aGraphicPagePropertySet_Impl( aGraphicPagePropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
pRet = &aGraphicPagePropertySet_Impl;
}
}
@@ -342,12 +334,12 @@ const SvxItemPropertySet* ImplGetMasterPagePropertySet( PageKind ePageKind )
const SvxItemPropertySet* pRet = 0;
if( ePageKind == PK_HANDOUT )
{
- static SvxItemPropertySet aHandoutMasterPagePropertySet_Impl( aHandoutMasterPagePropertyMap_Impl );
+ static SvxItemPropertySet aHandoutMasterPagePropertySet_Impl( aHandoutMasterPagePropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
pRet = &aHandoutMasterPagePropertySet_Impl;
}
else
{
- static SvxItemPropertySet aMasterPagePropertySet_Impl( aMasterPagePropertyMap_Impl );
+ static SvxItemPropertySet aMasterPagePropertySet_Impl( aMasterPagePropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
pRet = &aMasterPagePropertySet_Impl;
}
return pRet;
@@ -364,7 +356,6 @@ SdGenericDrawPage::SdGenericDrawPage( SdXImpressDocument* _pModel, SdPage* pInPa
mpModel ( _pModel ),
mpSdrModel(0),
mpPropSet ( _pSet ),
- mbHasBackgroundObject(sal_False),
mbIsImpressDocument(false)
{
mpSdrModel = SvxFmDrawPage::mpModel;
@@ -1392,9 +1383,6 @@ Reference< drawing::XShape > SdGenericDrawPage::_CreateShape( SdrObject *pObj )
case PRESOBJ_TABLE:
aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("TableShape") );
break;
- case PRESOBJ_BACKGROUND:
- DBG_ASSERT( sal_False, "Danger! Someone got hold of the horrible background shape!" );
- break;
case PRESOBJ_PAGE:
aShapeType += String( RTL_CONSTASCII_USTRINGPARAM("PageShape") );
break;
@@ -1447,7 +1435,7 @@ Sequence< OUString > SAL_CALL SdGenericDrawPage::getSupportedServiceNames()
throw(uno::RuntimeException)
{
Sequence< OUString > aSeq( SvxFmDrawPage::getSupportedServiceNames() );
- SvxServiceInfoHelper::addToSequence( aSeq, 3, "com.sun.star.drawing.GenericDrawPage",
+ comphelper::ServiceInfoHelper::addToSequence( aSeq, 3, "com.sun.star.drawing.GenericDrawPage",
"com.sun.star.document.LinkTarget",
"com.sun.star.document.LinkTargetSupplier");
return aSeq;
@@ -1987,7 +1975,7 @@ OUString SAL_CALL SdPageLinkTargets::getImplementationName()
sal_Bool SAL_CALL SdPageLinkTargets::supportsService( const OUString& ServiceName )
throw(uno::RuntimeException)
{
- return SvxServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
+ return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
}
Sequence< OUString > SAL_CALL SdPageLinkTargets::getSupportedServiceNames()
@@ -2219,10 +2207,10 @@ Sequence< OUString > SAL_CALL SdDrawPage::getSupportedServiceNames() throw(uno::
throwIfDisposed();
Sequence< OUString > aSeq( SdGenericDrawPage::getSupportedServiceNames() );
- SvxServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.drawing.DrawPage" );
+ comphelper::ServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.drawing.DrawPage" );
if( mbIsImpressDocument )
- SvxServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.presentation.DrawPage" );
+ comphelper::ServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.presentation.DrawPage" );
return aSeq;
}
@@ -2469,40 +2457,11 @@ void SdDrawPage::setBackground( const Any& rValue )
if( !xSet.is() )
{
- // the easy case, clear the background obj
- GetPage()->SetBackgroundObj( NULL );
-
- // #110094#-15
- // tell the page that it's visualization has changed
- GetPage()->ActionChanged();
-
+ // the easy case, no background set. Set XFILL_NONE to represent this
+ GetPage()->getSdrPageProperties().PutItem(XFillStyleItem(XFILL_NONE));
return;
}
- // prepare background object
- SdrObject* pObj = GetPage()->GetBackgroundObj();
- if( NULL == pObj )
- {
- pObj = new SdrRectObj();
- GetPage()->SetBackgroundObj( pObj );
-
- // #110094#-15
- // tell the page that it's visualization has changed
- GetPage()->ActionChanged();
- }
-
- const sal_Int32 nLeft = GetPage()->GetLftBorder();
- const sal_Int32 nRight = GetPage()->GetRgtBorder();
- const sal_Int32 nUpper = GetPage()->GetUppBorder();
- const sal_Int32 nLower = GetPage()->GetLwrBorder();
-
- Point aPos ( nLeft, nRight );
- Size aSize( GetPage()->GetSize() );
- aSize.Width() -= nLeft + nRight - 1;
- aSize.Height() -= nUpper + nLower - 1;
- Rectangle aRect( aPos, aSize );
- pObj->SetLogicRect( aRect );
-
// is it our own implementation?
SdUnoPageBackground* pBack = SdUnoPageBackground::getImplementation( xSet );
@@ -2540,11 +2499,14 @@ void SdDrawPage::setBackground( const Any& rValue )
//-/ pObj->NbcSetAttributes( aSet, sal_False );
if( aSet.Count() == 0 )
{
- GetPage()->SetBackgroundObj( NULL );
+ // no background fill, represent by setting XFILL_NONE
+ GetPage()->getSdrPageProperties().PutItem(XFillStyleItem(XFILL_NONE));
}
else
{
- pObj->SetMergedItemSet(aSet);
+ // background fill, set at page (not sure if ClearItem is needed)
+ GetPage()->getSdrPageProperties().ClearItem();
+ GetPage()->getSdrPageProperties().PutItemSet(aSet);
}
// repaint only
@@ -2575,14 +2537,19 @@ Reference< XAnnotationEnumeration > SAL_CALL SdGenericDrawPage::createAnnotation
void SdDrawPage::getBackground( Any& rValue ) throw()
{
- SdrObject* pObj = GetPage()->GetBackgroundObj();
- if( NULL == pObj )
+ const SfxItemSet& rFillAttributes = GetPage()->getSdrPageProperties().GetItemSet();
+
+ if(XFILL_NONE == ((const XFillStyleItem&)rFillAttributes.Get(XATTR_FILLSTYLE)).GetValue())
{
+ // no fill set (switched off by XFILL_NONE), clear rValue to represent this
rValue.clear();
}
else
{
- Reference< beans::XPropertySet > xSet( new SdUnoPageBackground( GetModel()->GetDoc(), pObj ) );
+ // there is a fill set, export to rValue
+ Reference< beans::XPropertySet > xSet(new SdUnoPageBackground(
+ GetModel()->GetDoc(),
+ &GetPage()->getSdrPageProperties().GetItemSet()));
rValue <<= xSet;
}
}
@@ -2686,7 +2653,6 @@ Any SdGenericDrawPage::getNavigationOrder()
SdMasterPage::SdMasterPage( SdXImpressDocument* pModel, SdPage* pPage ) throw()
: SdGenericDrawPage( pModel, pPage, ImplGetMasterPagePropertySet( pPage ? pPage->GetPageKind() : PK_STANDARD ) )
{
- mbHasBackgroundObject = pPage && GetPage()->GetPageKind() == PK_STANDARD;
}
SdMasterPage::~SdMasterPage() throw()
@@ -2807,10 +2773,10 @@ Sequence< OUString > SAL_CALL SdMasterPage::getSupportedServiceNames() throw(uno
throwIfDisposed();
Sequence< OUString > aSeq( SdGenericDrawPage::getSupportedServiceNames() );
- SvxServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.drawing.MasterPage" );
+ comphelper::ServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.drawing.MasterPage" );
if( SvxFmDrawPage::mpPage && ((SdPage*)SvxFmDrawPage::mpPage)->GetPageKind() == PK_HANDOUT )
- SvxServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.presentation.HandoutMasterPage" );
+ comphelper::ServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.presentation.HandoutMasterPage" );
return aSeq;
}
@@ -2831,7 +2797,7 @@ sal_Bool SAL_CALL SdMasterPage::hasElements() throw(uno::RuntimeException)
if( SvxFmDrawPage::mpPage == NULL )
return sal_False;
- return (SvxFmDrawPage::mpPage->GetObjCount() > 1) || (!mbHasBackgroundObject && SvxFmDrawPage::mpPage->GetObjCount() == 1 );
+ return SvxFmDrawPage::mpPage->GetObjCount() > 0;
}
uno::Type SAL_CALL SdMasterPage::getElementType()
@@ -2848,13 +2814,7 @@ sal_Int32 SAL_CALL SdMasterPage::getCount()
throwIfDisposed();
- sal_Int32 nCount = SdGenericDrawPage::getCount();
- DBG_ASSERT( !mbHasBackgroundObject || (nCount > 0), "possible wrong shape count!" );
-
- if( mbHasBackgroundObject && ( nCount > 0 ) )
- nCount--;
-
- return nCount;
+ return SdGenericDrawPage::getCount();
}
Any SAL_CALL SdMasterPage::getByIndex( sal_Int32 Index )
@@ -2864,9 +2824,6 @@ Any SAL_CALL SdMasterPage::getByIndex( sal_Int32 Index )
throwIfDisposed();
- if( mbHasBackgroundObject )
- Index++;
-
return SdGenericDrawPage::getByIndex(Index);
}
@@ -2966,16 +2923,9 @@ void SdMasterPage::setBackground( const Any& rValue )
}
}
-
- // if no background style is available, try the background object
- SdrObject* pObj = GetPage()->GetPresObj(PRESOBJ_BACKGROUND);
- if( pObj == NULL )
- return;
-
- pObj->SetMergedItemSet(aSet);
-
- // repaint only
- SvxFmDrawPage::mpPage->ActionChanged();
+ // if no background style is available, set at page directly. This
+ // is an error and should NOT happen (and will be asserted from the SdrPage)
+ GetPage()->getSdrPageProperties().PutItemSet(aSet);
}
}
catch( Exception& )
@@ -3018,23 +2968,19 @@ void SdMasterPage::getBackground( Any& rValue ) throw()
}
}
- // no stylesheet? try old fashion background rectangle
- SdrObject* pObj = NULL;
- if( SvxFmDrawPage::mpPage->GetObjCount() >= 1 )
+ // No style found, use fill attributes from page background. This
+ // should NOT happen and is an error
+ const SfxItemSet& rFallbackItemSet(SvxFmDrawPage::mpPage->getSdrPageProperties().GetItemSet());
+
+ if(XFILL_NONE == ((const XFillStyleItem&)rFallbackItemSet.Get(XATTR_FILLSTYLE)).GetValue())
{
- pObj = SvxFmDrawPage::mpPage->GetObj(0);
- if( pObj->GetObjInventor() != SdrInventor || pObj->GetObjIdentifier() != OBJ_RECT )
- pObj = NULL;
+ rValue <<= Reference< beans::XPropertySet >(
+ new SdUnoPageBackground(GetModel()->GetDoc(), &rFallbackItemSet));
}
-
- if( pObj )
+ else
{
- rValue <<= Reference< beans::XPropertySet >( new SdUnoPageBackground( GetModel()->GetDoc(), pObj ) );
- return;
+ rValue.clear();
}
-
-
- rValue.clear();
}
}
catch( Exception& )