summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorArmin Le Grand <Armin.Le.Grand@Sun.COM>2010-02-09 11:33:08 +0100
committerArmin Le Grand <Armin.Le.Grand@Sun.COM>2010-02-09 11:33:08 +0100
commit5f1e3bff24310560c4a3c314bb0cd909d1f423c2 (patch)
treef637a348e1e7a89b0645c15991409f3343674f3f /svx
parent2bb7512e2923c860fa6d6bb55dcb000737f3a7ec (diff)
aw079 #i99386# finer granular changes for MPBGO removal
Diffstat (limited to 'svx')
-rw-r--r--svx/inc/svx/sdrmasterpagedescriptor.hxx7
-rw-r--r--svx/inc/svx/svdobj.hxx4
-rw-r--r--svx/inc/svx/svdpage.hxx118
-rw-r--r--svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx32
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrpage.cxx30
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx13
-rw-r--r--svx/source/sdr/properties/attributeproperties.cxx2
-rw-r--r--svx/source/svdraw/sdrmasterpagedescriptor.cxx21
-rw-r--r--svx/source/svdraw/svdobj.cxx4
-rw-r--r--svx/source/svdraw/svdpage.cxx194
-rw-r--r--svx/source/svdraw/svdpntv.cxx2
-rw-r--r--svx/source/unodraw/UnoGraphicExporter.cxx54
12 files changed, 434 insertions, 47 deletions
diff --git a/svx/inc/svx/sdrmasterpagedescriptor.hxx b/svx/inc/svx/sdrmasterpagedescriptor.hxx
index 52752945255c..a8780c614285 100644
--- a/svx/inc/svx/sdrmasterpagedescriptor.hxx
+++ b/svx/inc/svx/sdrmasterpagedescriptor.hxx
@@ -34,9 +34,12 @@
#include <svx/sdrpageuser.hxx>
#include <svx/svdsob.hxx>
+#define NEWPBG
+
//////////////////////////////////////////////////////////////////////////////
// predeclarations
class SdrObject;
+class SfxItemSet;
namespace sdr
{
@@ -92,8 +95,12 @@ namespace sdr
sal_Bool operator==(const MasterPageDescriptor& rCandidate) const;
sal_Bool operator!=(const MasterPageDescriptor& rCandidate) const;
+#ifdef NEWPBG
+ const SfxItemSet& getCorrectFillAttributes() const;
+#else
// #i42075# Get the correct BackgroundObject
SdrObject* GetBackgroundObject() const;
+#endif
};
} // end of namespace sdr
diff --git a/svx/inc/svx/svdobj.hxx b/svx/inc/svx/svdobj.hxx
index fce776ef0abf..edab358a2e4a 100644
--- a/svx/inc/svx/svdobj.hxx
+++ b/svx/inc/svx/svdobj.hxx
@@ -31,6 +31,8 @@
#ifndef _SVDOBJ_HXX
#define _SVDOBJ_HXX
+#define NEWPBG
+
#include <memory>
#include <cppuhelper/weakref.hxx>
#include <vcl/mapmod.hxx>
@@ -1102,10 +1104,12 @@ public:
sal_Bool IsTransparent( BOOL bCheckForAlphaChannel = FALSE ) const;
+#ifndef NEWPBG
// #111111#
// Needed again and again i will now add a test for finding out if
// this object is the BackgroundObject of the page.
sal_Bool IsMasterPageBackgroundObject() const;
+#endif
// #116168#
// Give info if object is in destruction
diff --git a/svx/inc/svx/svdpage.hxx b/svx/inc/svx/svdpage.hxx
index 02181afb1674..60193f132db9 100644
--- a/svx/inc/svx/svdpage.hxx
+++ b/svx/inc/svx/svdpage.hxx
@@ -31,59 +31,29 @@
#ifndef _SVDPAGE_HXX
#define _SVDPAGE_HXX
-#include <vcl/bitmap.hxx>
+#define NEWPBG
-#ifndef _PRINT_HXX //autogen
+#include <vcl/bitmap.hxx>
#include <vcl/print.hxx>
-#endif
-#ifndef _GDIMTF_HXX //autogen
#include <vcl/gdimtf.hxx>
-#endif
#include <tools/weakbase.hxx>
#include <cppuhelper/weakref.hxx>
#include <svx/svdtypes.hxx>
#include <svx/svdlayer.hxx>
-
-//////////////////////////////////////////////////////////////////////////////
-// sdr::Comment interface
#include <svx/sdrcomment.hxx>
-
-// #111111#
#include <vector>
#include <svx/sdrpageuser.hxx>
-
-// StandardCheckVisisbilityRedirector
#include <svx/sdr/contact/viewobjectcontactredirector.hxx>
#include <svx/sdrmasterpagedescriptor.hxx>
#include "svx/svxdllapi.h"
-
#include <com/sun/star/container/XIndexAccess.hpp>
#include <svx/svdobj.hxx>
#include <boost/scoped_ptr.hpp>
-// #110094#
-namespace sdr
-{
- namespace contact
- {
- class ViewContact;
- } // end of namespace contact
-} // end of namespace sdr
-
-// ------------------------------
-// - intern benutzte Paint-Modi -
-// ------------------------------
-
-//#if 0 // _SOLAR__PRIVATE
-
-#define IMP_PAGEPAINT_NORMAL 0
-#define IMP_PAGEPAINT_PREPARE_CACHE 1
-#define IMP_PAGEPAINT_PAINT_CACHE 2
-#define IMP_PAGEPAINT_PREPARE_BG_CACHE 3
-#define IMP_PAGEPAINT_PAINT_BG_CACHE 4
-
-//#endif // __PRIVATE
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+namespace sdr { namespace contact { class ViewContact; }}
class SdrPage;
class SdrModel;
class SfxItemPool;
@@ -113,7 +83,11 @@ public:
SdrInsertReasonKind GetReason() const { return eReason; }
};
-class SVX_DLLPUBLIC SdrObjList {
+//////////////////////////////////////////////////////////////////////////////
+// class SdrObjList
+
+class SVX_DLLPUBLIC SdrObjList
+{
private:
typedef ::std::vector<SdrObject*> SdrObjectContainerType;
SdrObjectContainerType maList;
@@ -350,8 +324,12 @@ Objektes abgefragt sowie direkt gesetzt werden.
// Used for all methods which return a page number
#define SDRPAGE_NOTFOUND 0xFFFF
+//////////////////////////////////////////////////////////////////////////////
+// class SdrPageGridFrame
+
// Fuer das Fangraster/Punkgitter im Writer
-class SdrPageGridFrame {
+class SdrPageGridFrame
+{
Rectangle aPaper;
Rectangle aUserArea;
public:
@@ -383,8 +361,50 @@ public:
};
////////////////////////////////////////////////////////////////////////////////////////////////////
+// class SdrPageProperties
+
+#ifdef NEWPBG
+
+class SVX_DLLPUBLIC SdrPageProperties : public SfxListener
+{
+private:
+ // data
+ SdrPage* mpSdrPage;
+ SfxStyleSheet* mpStyleSheet;
+ SfxItemSet* mpProperties;
+
+ // internal helpers
+ void ImpRemoveStyleSheet();
+ void ImpAddStyleSheet(SfxStyleSheet& rNewStyleSheet);
+
+ // not implemented
+ SdrPageProperties& operator=(const SdrPageProperties& rCandidate);
+
+public:
+ // construct/destruct
+ SdrPageProperties(SdrPage& rSdrPage);
+ SdrPageProperties(const SdrPageProperties& rCandidate);
+ virtual ~SdrPageProperties();
+
+ // Notify(...) from baseclass SfxListener
+ virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint);
+
+ // data read/write
+ const SfxItemSet& GetItemSet() const;
+ void PutItemSet(const SfxItemSet& rSet);
+ void PutItem(const SfxPoolItem& rItem);
+ void ClearItem(const sal_uInt16 nWhich = 0);
+
+ // StyleSheet access
+ void SetStyleSheet(SfxStyleSheet* pStyleSheet);
+ SfxStyleSheet* GetStyleSheet() const;
+};
+
+#endif
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// class SdrPage
-class SVX_DLLPUBLIC SdrPage: public SdrObjList, public tools::WeakBase< SdrPage >
+class SVX_DLLPUBLIC SdrPage : public SdrObjList, public tools::WeakBase< SdrPage >
{
///////////////////////////////////////////////////////////////////////////////
// start PageUser section
@@ -430,9 +450,19 @@ friend class ChXChartDocument;
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxUnoPage;
protected:
- SdrLayerAdmin* pLayerAdmin;
- SdrObject* pBackgroundObj;
+ SdrLayerAdmin* pLayerAdmin;
+#ifndef NEWPBG
+ SdrObject* pBackgroundObj;
+#else
+private:
+ SdrPageProperties* mpSdrPageProperties;
+
+public:
+ SdrPageProperties& getSdrPageProperties() { return *mpSdrPageProperties; }
+ const SdrPageProperties& getSdrPageProperties() const { return *mpSdrPageProperties; }
+#endif
+protected:
// new MasterPageDescriptorVector
::sdr::MasterPageDescriptor* mpMasterPageDescriptor;
@@ -537,8 +567,10 @@ public:
bool IsSwappingLocked() const { return mbSwappingLocked; }
void SetSwappingLocked(bool bLock) { mbSwappingLocked = bLock; }
+#ifndef NEWPBG
SdrObject* GetBackgroundObj() const { return pBackgroundObj; }
void SetBackgroundObj( SdrObject* pObj );
+#endif
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getUnoPage();
@@ -567,8 +599,8 @@ public:
/** Check if page is the HandoutMasterPage (in SVX, no PK_HANDOUT available) */
bool isHandoutMasterPage() const;
-//////////////////////////////////////////////////////////////////////////////
-// sdr::Comment interface
+ //////////////////////////////////////////////////////////////////////////////
+ // sdr::Comment interface
private:
sdr::CommentVector maComments;
@@ -577,8 +609,6 @@ public:
const sdr::Comment& GetCommentByIndex(sal_uInt32 nIndex);
void AddComment(const sdr::Comment& rNew);
void ReplaceCommentByIndex(sal_uInt32 nIndex, const sdr::Comment& rNew);
-
-//////////////////////////////////////////////////////////////////////////////
};
typedef tools::WeakReference< SdrPage > SdrPageWeakRef;
diff --git a/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx b/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx
index 84f6c7c9bfe2..4dad454af869 100644
--- a/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx
+++ b/svx/source/sdr/contact/viewcontactofmasterpagedescriptor.cxx
@@ -64,6 +64,33 @@ namespace sdr
drawinglayer::primitive2d::Primitive2DSequence ViewContactOfMasterPageDescriptor::createViewIndependentPrimitive2DSequence() const
{
drawinglayer::primitive2d::Primitive2DSequence xRetval;
+
+#ifdef NEWPBG
+ // build primitive from page fill attributes
+ const SfxItemSet& rPageFillAttributes = GetMasterPageDescriptor().getCorrectFillAttributes();
+ const drawinglayer::attribute::SdrFillAttribute aFill(
+ drawinglayer::primitive2d::createNewSdrFillAttribute(rPageFillAttributes));
+
+ if(!aFill.isDefault())
+ {
+ // direct model data is the page size, get and use it
+ const SdrPage& rOwnerPage = GetMasterPageDescriptor().GetOwnerPage();
+ const basegfx::B2DRange aInnerRange(
+ rOwnerPage.GetLftBorder(), rOwnerPage.GetUppBorder(),
+ rOwnerPage.GetWdt() - rOwnerPage.GetRgtBorder(),
+ rOwnerPage.GetHgt() - rOwnerPage.GetLwrBorder());
+ const basegfx::B2DPolygon aInnerPolgon(basegfx::tools::createPolygonFromRect(aInnerRange));
+ const basegfx::B2DHomMatrix aEmptyTransform;
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ drawinglayer::primitive2d::createPolyPolygonFillPrimitive(
+ basegfx::B2DPolyPolygon(aInnerPolgon),
+ aEmptyTransform,
+ aFill,
+ drawinglayer::attribute::FillGradientAttribute()));
+
+ xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ }
+#else
const SdrObject* pBackgroundCandidate = GetMasterPageDescriptor().GetBackgroundObject();
if(pBackgroundCandidate)
@@ -93,6 +120,7 @@ namespace sdr
xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
}
}
+#endif
return xRetval;
}
@@ -113,20 +141,24 @@ namespace sdr
{
sal_uInt32 nRetval(GetMasterPageDescriptor().GetUsedPage().GetObjCount());
+#ifndef NEWPBG
if(nRetval && GetMasterPageDescriptor().GetUsedPage().GetObj(0)->IsMasterPageBackgroundObject())
{
nRetval--;
}
+#endif
return nRetval;
}
ViewContact& ViewContactOfMasterPageDescriptor::GetViewContact(sal_uInt32 nIndex) const
{
+#ifndef NEWPBG
if(GetMasterPageDescriptor().GetUsedPage().GetObjCount() && GetMasterPageDescriptor().GetUsedPage().GetObj(0)->IsMasterPageBackgroundObject())
{
nIndex++;
}
+#endif
return GetMasterPageDescriptor().GetUsedPage().GetObj(nIndex)->GetViewContact();
}
diff --git a/svx/source/sdr/contact/viewcontactofsdrpage.cxx b/svx/source/sdr/contact/viewcontactofsdrpage.cxx
index 12b7e1b0acf4..3018a9dc17e2 100644
--- a/svx/source/sdr/contact/viewcontactofsdrpage.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrpage.cxx
@@ -206,6 +206,31 @@ namespace sdr
}
else
{
+#ifdef NEWPBG
+ // build primitive from pObject's attributes
+ const SfxItemSet& rFillAttributes = rPage.getSdrPageProperties().GetItemSet();
+ const drawinglayer::attribute::SdrFillAttribute aFill(
+ drawinglayer::primitive2d::createNewSdrFillAttribute(rFillAttributes));
+
+ if(!aFill.isDefault())
+ {
+ // direct model data is the page size, get and use it
+ const basegfx::B2DRange aInnerRange(
+ rPage.GetLftBorder(), rPage.GetUppBorder(),
+ rPage.GetWdt() - rPage.GetRgtBorder(), rPage.GetHgt() - rPage.GetLwrBorder());
+ const basegfx::B2DPolygon aInnerPolgon(basegfx::tools::createPolygonFromRect(aInnerRange));
+ const basegfx::B2DHomMatrix aEmptyTransform;
+ const drawinglayer::primitive2d::Primitive2DReference xReference(
+ drawinglayer::primitive2d::createPolyPolygonFillPrimitive(
+ basegfx::B2DPolyPolygon(aInnerPolgon),
+ aEmptyTransform,
+ aFill,
+ drawinglayer::attribute::FillGradientAttribute()));
+
+ xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
+ }
+
+#else
OSL_ENSURE(0 != rPage.GetObjCount(), "MasterPage without MPBGO detected (!)");
if(rPage.GetObjCount())
@@ -239,6 +264,7 @@ namespace sdr
}
}
}
+#endif
}
}
@@ -461,20 +487,24 @@ namespace sdr
{
sal_uInt32 nSubObjectCount(getPage().GetObjCount());
+#ifndef NEWPBG
if(nSubObjectCount && getPage().GetObj(0L)->IsMasterPageBackgroundObject())
{
nSubObjectCount--;
}
+#endif
return nSubObjectCount;
}
ViewContact& ViewContactOfPageHierarchy::GetViewContact(sal_uInt32 nIndex) const
{
+#ifndef NEWPBG
if(getPage().GetObjCount() && getPage().GetObj(0L)->IsMasterPageBackgroundObject())
{
nIndex++;
}
+#endif
SdrObject* pObj = getPage().GetObj(nIndex);
DBG_ASSERT(pObj, "ViewContactOfPageHierarchy::GetViewContact: Corrupt SdrObjList (!)");
diff --git a/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx b/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx
index fa785125118c..f0c3eb2c8bed 100644
--- a/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx
@@ -98,6 +98,18 @@ namespace sdr
rDisplayInfo.SetProcessLayers(aPreprocessedLayers);
rDisplayInfo.SetSubContentActive(true);
+#ifdef NEWPBG
+ // check layer visibility (traditionally was member of layer 1)
+ if(aPreprocessedLayers.IsSet(1))
+ {
+ // hide PageBackground for special DrawModes; historical reasons
+ if(!GetObjectContact().isDrawModeGray() && !GetObjectContact().isDrawModeHighContrast())
+ {
+ // if visible, create the default background primitive sequence
+ xRetval = static_cast< ViewContactOfMasterPageDescriptor& >(GetViewContact()).getViewIndependentPrimitive2DSequence();
+ }
+ }
+#else
// check if there is a MasterPageBackgroundObject and if it's visible in the LayerSet
const SdrObject* pBackgroundCandidate = rDescriptor.GetBackgroundObject();
@@ -110,6 +122,7 @@ namespace sdr
xRetval = static_cast< ViewContactOfMasterPageDescriptor& >(GetViewContact()).getViewIndependentPrimitive2DSequence();
}
}
+#endif
// hide MasterPage content? Test self here for hierarchy
if(isPrimitiveVisible(rDisplayInfo))
diff --git a/svx/source/sdr/properties/attributeproperties.cxx b/svx/source/sdr/properties/attributeproperties.cxx
index 4fcdb12ffe5c..df8944342619 100644
--- a/svx/source/sdr/properties/attributeproperties.cxx
+++ b/svx/source/sdr/properties/attributeproperties.cxx
@@ -587,6 +587,7 @@ namespace sdr
bHintUsed = sal_True;
}
+#ifndef NEWPBG
// #111111#
// When it's the BackgroundObject, set the MasterPage to changed to
// get a refresh for the evtl. changed BackgroundStyle
@@ -602,6 +603,7 @@ namespace sdr
{
GetSdrObject().GetPage()->ActionChanged();
}
+#endif
if(!bHintUsed)
{
diff --git a/svx/source/svdraw/sdrmasterpagedescriptor.cxx b/svx/source/svdraw/sdrmasterpagedescriptor.cxx
index 9cee1e344c6a..dcc519148e27 100644
--- a/svx/source/svdraw/sdrmasterpagedescriptor.cxx
+++ b/svx/source/svdraw/sdrmasterpagedescriptor.cxx
@@ -37,6 +37,11 @@
// #i42075#
#include <svx/svdobj.hxx>
+#ifdef NEWPBG
+#include <svx/xfillit0.hxx>
+#include <svl/itemset.hxx>
+#endif
+
//////////////////////////////////////////////////////////////////////////////
namespace sdr
@@ -98,6 +103,7 @@ namespace sdr
maVisibleLayers = rNew;
GetViewContact().ActionChanged();
+#ifndef NEWPBG
// #i42075# For AFs convenience, do a change notify at the MasterPageBackgroundObject, too
SdrObject* pObject = GetBackgroundObject();
@@ -105,6 +111,7 @@ namespace sdr
{
pObject->BroadcastObjectChange();
}
+#endif
}
}
@@ -123,6 +130,19 @@ namespace sdr
|| maVisibleLayers != rCandidate.maVisibleLayers);
}
+#ifdef NEWPBG
+ const SfxItemSet& MasterPageDescriptor::getCorrectFillAttributes() const
+ {
+ const SfxItemSet& rOwnerPageAtributes = GetOwnerPage().getSdrPageProperties().GetItemSet();
+
+ if(XFILL_NONE != ((const XFillStyleItem&)rOwnerPageAtributes.Get(XATTR_FILLSTYLE)).GetValue())
+ {
+ return rOwnerPageAtributes;
+ }
+
+ return GetUsedPage().getSdrPageProperties().GetItemSet();
+ }
+#else
// #i42075# Get the correct BackgroundObject
SdrObject* MasterPageDescriptor::GetBackgroundObject() const
{
@@ -158,6 +178,7 @@ namespace sdr
return pRetval;
}
+#endif
} // end of namespace sdr
//////////////////////////////////////////////////////////////////////////////
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index 3ed33e0f20ad..58f3d4ce2873 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -375,6 +375,7 @@ sdr::contact::ViewContact& SdrObject::GetViewContact() const
// DrawContact support: Methods for handling Object changes
void SdrObject::ActionChanged() const
{
+#ifndef NEWPBG
// Forward change call to MasterPageDescriptor if BackgroundObject was changed
const SdrPage* pObjectsPage = GetPage();
@@ -419,6 +420,7 @@ void SdrObject::ActionChanged() const
}
}
}
+#endif
// Do necessary ViewContact actions
GetViewContact().ActionChanged();
@@ -3117,6 +3119,7 @@ void SdrObject::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const ba
SetSnapRect(aBaseRect);
}
+#ifndef NEWPBG
// #111111#
// Needed again and again i will now add a test for finding out if
// this object is the BackgroundObject of the page.
@@ -3136,6 +3139,7 @@ sal_Bool SdrObject::IsMasterPageBackgroundObject() const
return sal_False;
}
+#endif
// #116168#
// Give info if object is in destruction
diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx
index 864cc3d77e8d..b53606d53aeb 100644
--- a/svx/source/svdraw/svdpage.cxx
+++ b/svx/source/svdraw/svdpage.cxx
@@ -69,6 +69,7 @@
#include <svx/sdr/contact/viewobjectcontact.hxx>
#include <svx/sdr/contact/displayinfo.hxx>
#include <algorithm>
+#include <svl/smplhint.hxx>
using namespace ::com::sun::star;
@@ -1176,6 +1177,140 @@ sdr::contact::ViewContact& SdrPage::GetViewContact() const
}
////////////////////////////////////////////////////////////////////////////////////////////////////
+#ifdef NEWPBG
+
+void SdrPageProperties::ImpRemoveStyleSheet()
+{
+ if(mpStyleSheet)
+ {
+ EndListening(*mpStyleSheet);
+ mpProperties->SetParent(0);
+ mpStyleSheet = 0;
+ }
+}
+
+void SdrPageProperties::ImpAddStyleSheet(SfxStyleSheet& rNewStyleSheet)
+{
+ if(mpStyleSheet != &rNewStyleSheet)
+ {
+ ImpRemoveStyleSheet();
+ mpStyleSheet = &rNewStyleSheet;
+ StartListening(rNewStyleSheet);
+ mpProperties->SetParent(&rNewStyleSheet.GetItemSet());
+ }
+}
+
+void ImpPageChange(SdrPage& rSdrPage)
+{
+ rSdrPage.ActionChanged();
+
+ if(rSdrPage.GetModel())
+ {
+ rSdrPage.GetModel()->SetChanged(true);
+ SdrHint aHint(HINT_PAGEORDERCHG);
+ aHint.SetPage(&rSdrPage);
+ rSdrPage.GetModel()->Broadcast(aHint);
+ }
+}
+
+SdrPageProperties::SdrPageProperties(SdrPage& rSdrPage)
+: mpSdrPage(&rSdrPage),
+ mpStyleSheet(0),
+ mpProperties(new SfxItemSet(mpSdrPage->GetModel()->GetItemPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST))
+{
+ if(!rSdrPage.IsMasterPage())
+ {
+ mpProperties->Put(XFillStyleItem(XFILL_NONE));
+ }
+}
+
+SdrPageProperties::SdrPageProperties(const SdrPageProperties& rCandidate)
+: mpSdrPage(rCandidate.mpSdrPage),
+ mpStyleSheet(0),
+ mpProperties(new SfxItemSet(*rCandidate.mpProperties))
+{
+ if(rCandidate.GetStyleSheet())
+ {
+ ImpAddStyleSheet(*rCandidate.GetStyleSheet());
+ }
+}
+
+SdrPageProperties::~SdrPageProperties()
+{
+ ImpRemoveStyleSheet();
+ delete mpProperties;
+}
+
+void SdrPageProperties::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
+{
+ const SfxSimpleHint* pSimpleHint = dynamic_cast< const SfxSimpleHint* >(&rHint);
+
+ if(pSimpleHint)
+ {
+ switch(pSimpleHint->GetId())
+ {
+ case SFX_HINT_DATACHANGED :
+ {
+ // notify change, broadcast
+ ImpPageChange(*mpSdrPage);
+ break;
+ }
+ case SFX_HINT_DYING :
+ {
+ // Style needs to be forgotten
+ ImpRemoveStyleSheet();
+ break;
+ }
+ }
+ }
+}
+
+const SfxItemSet& SdrPageProperties::GetItemSet() const
+{
+ return *mpProperties;
+}
+
+void SdrPageProperties::PutItemSet(const SfxItemSet& rSet)
+{
+ OSL_ENSURE(!mpSdrPage->IsMasterPage(), "Item set at MasterPage Attributes (!)");
+ mpProperties->Put(rSet);
+ ImpPageChange(*mpSdrPage);
+}
+
+void SdrPageProperties::PutItem(const SfxPoolItem& rItem)
+{
+ OSL_ENSURE(!mpSdrPage->IsMasterPage(), "Item set at MasterPage Attributes (!)");
+ mpProperties->Put(rItem);
+ ImpPageChange(*mpSdrPage);
+}
+
+void SdrPageProperties::ClearItem(const sal_uInt16 nWhich)
+{
+ mpProperties->ClearItem(nWhich);
+ ImpPageChange(*mpSdrPage);
+}
+
+void SdrPageProperties::SetStyleSheet(SfxStyleSheet* pStyleSheet)
+{
+ if(pStyleSheet)
+ {
+ ImpAddStyleSheet(*pStyleSheet);
+ }
+ else
+ {
+ ImpRemoveStyleSheet();
+ }
+
+ ImpPageChange(*mpSdrPage);
+}
+
+SfxStyleSheet* SdrPageProperties::GetStyleSheet() const
+{
+ return mpStyleSheet;
+}
+
+#endif
+////////////////////////////////////////////////////////////////////////////////////////////////////
TYPEINIT1(SdrPage,SdrObjList);
DBG_NAME(SdrPage)
@@ -1189,7 +1324,11 @@ SdrPage::SdrPage(SdrModel& rNewModel, bool bMasterPage)
nBordRgt(0L),
nBordLwr(0L),
pLayerAdmin(new SdrLayerAdmin(&rNewModel.GetLayerAdmin())),
+#ifndef NEWPBG
pBackgroundObj(0L),
+#else
+ mpSdrPageProperties(0),
+#endif
mpMasterPageDescriptor(0L),
nPageNum(0L),
mbMaster(bMasterPage),
@@ -1201,6 +1340,10 @@ SdrPage::SdrPage(SdrModel& rNewModel, bool bMasterPage)
DBG_CTOR(SdrPage,NULL);
aPrefVisiLayers.SetAll();
eListKind = (bMasterPage) ? SDROBJLIST_MASTERPAGE : SDROBJLIST_DRAWPAGE;
+
+#ifdef NEWPBG
+ mpSdrPageProperties = new SdrPageProperties(*this);
+#endif
}
SdrPage::SdrPage(const SdrPage& rSrcPage)
@@ -1214,7 +1357,11 @@ SdrPage::SdrPage(const SdrPage& rSrcPage)
nBordRgt(rSrcPage.nBordRgt),
nBordLwr(rSrcPage.nBordLwr),
pLayerAdmin(new SdrLayerAdmin(rSrcPage.pModel->GetLayerAdmin())),
+#ifndef NEWPBG
pBackgroundObj(0L),
+#else
+ mpSdrPageProperties(0),
+#endif
mpMasterPageDescriptor(0L),
nPageNum(rSrcPage.nPageNum),
mbMaster(rSrcPage.mbMaster),
@@ -1248,6 +1395,10 @@ SdrPage::SdrPage(const SdrPage& rSrcPage)
mxUnoPage = NULL;
xComponent->dispose();
}
+
+#ifdef NEWPBG
+ mpSdrPageProperties = new SdrPageProperties(rSrcPage.getSdrPageProperties());
+#endif
}
SdrPage::~SdrPage()
@@ -1281,7 +1432,9 @@ SdrPage::~SdrPage()
// when they get called from PageInDestruction().
maPageUsers.clear();
+#ifndef NEWPBG
SdrObject::Free( pBackgroundObj );
+#endif
delete pLayerAdmin;
TRG_ClearMasterPage();
@@ -1293,6 +1446,13 @@ SdrPage::~SdrPage()
mpViewContact = 0L;
}
+#ifdef NEWPBG
+ {
+ delete mpSdrPageProperties;
+ mpSdrPageProperties = 0;
+ }
+#endif
+
DBG_DTOR(SdrPage,NULL);
}
@@ -1304,7 +1464,9 @@ void SdrPage::operator=(const SdrPage& rSrcPage)
mpViewContact = 0L;
}
+#ifndef NEWPBG
SdrObject::Free( pBackgroundObj );
+#endif
// Joe also sets some parameters for the class this one
// is derived from. SdrObjList does the same bad handling of
@@ -1339,6 +1501,7 @@ void SdrPage::operator=(const SdrPage& rSrcPage)
mbObjectsNotPersistent = rSrcPage.mbObjectsNotPersistent;
+#ifndef NEWPBG
if(rSrcPage.pBackgroundObj)
{
pBackgroundObj = rSrcPage.pBackgroundObj->Clone();
@@ -1348,6 +1511,12 @@ void SdrPage::operator=(const SdrPage& rSrcPage)
// #i62000# for single-page MPBGO, force no line
pBackgroundObj->SetMergedItem(XLineStyleItem(XLINE_NONE));
}
+#else
+ {
+ delete mpSdrPageProperties;
+ mpSdrPageProperties = new SdrPageProperties(rSrcPage.getSdrPageProperties());
+ }
+#endif
// Now copy the contained obejcts (by cloning them)
SdrObjList::operator=(rSrcPage);
@@ -1526,8 +1695,16 @@ void SdrPage::SetModel(SdrModel* pNewModel)
}
pLayerAdmin->SetModel(pNewModel);
+#ifndef NEWPBG
if( pBackgroundObj )
pBackgroundObj->SetModel( pNewModel );
+#else
+ {
+ SdrPageProperties *pNew = new SdrPageProperties(getSdrPageProperties());
+ delete mpSdrPageProperties;
+ mpSdrPageProperties = pNew;
+ }
+#endif
}
// update listeners at possible api wrapper object
@@ -1661,6 +1838,7 @@ XubString SdrPage::GetLayoutName() const
return String();
}
+#ifndef NEWPBG
void SdrPage::SetBackgroundObj( SdrObject* pObj )
{
if ( pObj )
@@ -1676,6 +1854,7 @@ void SdrPage::SetBackgroundObj( SdrObject* pObj )
SdrObject::Free( pBackgroundObj );
pBackgroundObj = pObj;
}
+#endif
void SdrPage::SetInserted( bool bIns )
{
@@ -1750,10 +1929,22 @@ Color SdrPage::GetPageBackgroundColor( SdrPageView* pView, bool bScreenDisplay )
aColor = pView->GetApplicationDocumentColor();
}
+#ifdef NEWPBG
+ const SfxItemSet* pBackgroundFill = &getSdrPageProperties().GetItemSet();
+
+ if(!IsMasterPage() && TRG_HasMasterPage())
+ {
+ if(XFILL_NONE == ((const XFillStyleItem&)pBackgroundFill->Get(XATTR_FILLSTYLE)).GetValue())
+ {
+ pBackgroundFill = &TRG_GetMasterPage().getSdrPageProperties().GetItemSet();
+ }
+ }
+
+ GetDraftFillColor(*pBackgroundFill, aColor);
+#else
// first, see if we have a background object
SdrObject* pBackgroundObj2 = NULL;
-
if( IsMasterPage() )
{
if( GetObjCount() )
@@ -1782,6 +1973,7 @@ Color SdrPage::GetPageBackgroundColor( SdrPageView* pView, bool bScreenDisplay )
const SfxItemSet& rSet = pBackgroundObj2->GetMergedItemSet();
GetDraftFillColor( rSet, aColor );
}
+#endif
return aColor;
}
diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx
index 8c46e1d06bb6..2d04301433e9 100644
--- a/svx/source/svdraw/svdpntv.cxx
+++ b/svx/source/svdraw/svdpntv.cxx
@@ -335,7 +335,7 @@ void __EXPORT SdrPaintView::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint
if (eKind==HINT_PAGEORDERCHG) {
const SdrPage* pPg=pSdrHint->GetPage();
- if(!pPg->IsInserted())
+ if(pPg && !pPg->IsInserted())
{
if(mpPageView && mpPageView->GetPage() == pPg)
{
diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx
index ebd8f83e00f0..1e191f3125c1 100644
--- a/svx/source/unodraw/UnoGraphicExporter.cxx
+++ b/svx/source/unodraw/UnoGraphicExporter.cxx
@@ -618,6 +618,7 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic,
VirtualDevice aVDev;
const MapMode aMap( mpDoc->GetScaleUnit(), Point(), rSettings.maScaleX, rSettings.maScaleY );
+#ifndef NEWPBG
// create a view
SdrView* pView;
@@ -633,17 +634,25 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic,
pView->SetBordVisible( FALSE );
pView->SetPageVisible( FALSE );
pView->ShowSdrPage( pPage );
+#endif
SdrOutliner& rOutl=mpDoc->GetDrawOutliner(NULL);
maOldCalcFieldValueHdl = rOutl.GetCalcFieldValueHdl();
rOutl.SetCalcFieldValueHdl( LINK(this, GraphicExporter, CalcFieldValueHdl) );
+#ifdef NEWPBG
+ rOutl.SetBackgroundColor( pPage->GetPageBackgroundColor() );
+#else
rOutl.SetBackgroundColor( pPage->GetPageBackgroundColor(pView->GetSdrPageView()) );
+#endif
// #i102251#
const sal_uInt32 nOldCntrl(rOutl.GetControlWord());
sal_uInt32 nCntrl = nOldCntrl & ~EE_CNTRL_ONLINESPELLING;
rOutl.SetControlWord(nCntrl);
+#ifdef NEWPBG
+ SdrObject* pTempBackgroundShape = 0;
+#endif
std::vector< SdrObject* > aShapes;
bool bRet = true;
@@ -652,6 +661,12 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic,
{
if( rSettings.mbExportOnlyBackground )
{
+#ifdef NEWPBG
+ pTempBackgroundShape = new SdrRectObj(Rectangle(Point(0,0), pPage->GetSize()));
+ pTempBackgroundShape->SetMergedItemSet(pPage->getSdrPageProperties().GetItemSet());
+ pTempBackgroundShape->SetMergedItem(XLineStyleItem(XLINE_NONE));
+ aShapes.push_back(pTempBackgroundShape);
+#else
SdrObject* pShape = 0;
if( pPage->IsMasterPage() )
{
@@ -665,6 +680,7 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic,
if( pShape )
aShapes.push_back( pShape );
+#endif
}
else
{
@@ -741,8 +757,26 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic,
aVDev.SetDrawMode( aVDev.GetDrawMode() | DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT );
aVDev.EnableOutput( FALSE );
aMtf.Record( &aVDev );
-
Size aNewSize;
+
+#ifdef NEWPBG
+ // create a view
+ SdrView* pView;
+
+ if( PTR_CAST( FmFormModel, mpDoc ) )
+ {
+ pView = new FmFormView( PTR_CAST( FmFormModel, mpDoc ), &aVDev );
+ }
+ else
+ {
+ pView = new SdrView( mpDoc, &aVDev );
+ }
+
+ pView->SetBordVisible( FALSE );
+ pView->SetPageVisible( FALSE );
+ pView->ShowSdrPage( pPage );
+#endif
+
if ( pView && pPage )
{
pView->SetBordVisible( FALSE );
@@ -783,6 +817,13 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic,
aGraphic = Graphic(aMtf);
}
+#ifdef NEWPBG
+ if ( pView )
+ {
+ pView->HideSdrPage();
+ delete pView;
+ }
+#endif
if( rSettings.mbTranslucent )
{
Size aOutSize;
@@ -907,6 +948,7 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic,
// calculate bound rect for all shapes
Rectangle aBound;
+#ifndef NEWPBG
if(rSettings.mbExportOnlyBackground)
{
// shape is MPBGO and if it's not yet set, it's size will
@@ -916,6 +958,7 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic,
aBound = Rectangle(Point(0,0), pPage->GetSize());
}
else
+#endif
{
std::vector< SdrObject* >::iterator aIter = aShapes.begin();
const std::vector< SdrObject* >::iterator aEnd = aShapes.end();
@@ -989,11 +1032,20 @@ bool GraphicExporter::GetGraphic( ExportSettings& rSettings, Graphic& aGraphic,
}
}
+#ifndef NEWPBG
if ( pView )
{
pView->HideSdrPage();
delete pView;
}
+#endif
+
+#ifdef NEWPBG
+ if(pTempBackgroundShape)
+ {
+ SdrObject::Free(pTempBackgroundShape);
+ }
+#endif
rOutl.SetCalcFieldValueHdl( maOldCalcFieldValueHdl );