Kaydet (Commit) 99518441 authored tarafından Christian Lippka's avatar Christian Lippka

#102885# added page master for handout master and notes master

üst 0c13675c
<!--
$Id: drawing.mod,v 1.76 2002-04-09 09:58:38 cl Exp $
$Id: drawing.mod,v 1.77 2002-09-04 14:02:51 cl Exp $
The Contents of this file are made available subject to the terms of
either of the following licenses
......@@ -520,7 +520,7 @@
<!-- Presentation notes -->
<!ELEMENT presentation:notes (%shapes;)*>
<!ATTLIST presentation:notes style:page-master-name %styleName; #IMPLIED>
<!-- presentation page layouts -->
<!ELEMENT style:presentation-page-layout (presentation:placeholder)* >
......
<!--
$Id: style.mod,v 1.55 2002-08-30 17:30:42 dvo Exp $
$Id: style.mod,v 1.56 2002-09-04 14:02:51 cl Exp $
The Contents of this file are made available subject to the terms of
either of the following licenses
......@@ -429,6 +429,7 @@
<!-- handout master -->
<!ELEMENT style:handout-master (%shapes;)*>
<!ATTLIST style:handout-master presentation:presentation-page-layout-name %styleName; #IMPLIED>
<!ATTLIST style:handout-master style:page-master-name %styleName; #IMPLIED>
<!ENTITY % headerText "(text:h|text:p|text:ordered-list|
......
......@@ -2,9 +2,9 @@
*
* $RCSfile: sdxmlexp.cxx,v $
*
* $Revision: 1.81 $
* $Revision: 1.82 $
*
* last change: $Author: cl $ $Date: 2002-06-17 14:14:39 $
* last change: $Author: cl $ $Date: 2002-09-04 13:58:43 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -299,26 +299,36 @@ ImpXMLEXPPageMasterInfo::ImpXMLEXPPageMasterInfo(
{
uno::Any aAny;
aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("BorderBottom")));
aAny >>= mnBorderBottom;
uno::Reference< beans::XPropertySetInfo > xPropsInfo( xPropSet->getPropertySetInfo() );
if( xPropsInfo.is() && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("BorderBottom") )))
{
aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("BorderBottom")));
aAny >>= mnBorderBottom;
aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("BorderLeft")));
aAny >>= mnBorderLeft;
aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("BorderLeft")));
aAny >>= mnBorderLeft;
aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("BorderRight")));
aAny >>= mnBorderRight;
aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("BorderRight")));
aAny >>= mnBorderRight;
aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("BorderTop")));
aAny >>= mnBorderTop;
aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("BorderTop")));
aAny >>= mnBorderTop;
}
aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Width")));
aAny >>= mnWidth;
if( xPropsInfo.is() && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("Width") )))
{
aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Width")));
aAny >>= mnWidth;
aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Height")));
aAny >>= mnHeight;
aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Height")));
aAny >>= mnHeight;
}
aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Orientation")));
aAny >>= meOrientation;
if( xPropsInfo.is() && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("Orientation") )))
{
aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Orientation")));
aAny >>= meOrientation;
}
}
uno::Reference <container::XNamed> xMasterNamed(xPage, uno::UNO_QUERY);
......@@ -545,7 +555,9 @@ DECLARE_LIST(ImpXMLAutoLayoutInfoList, ImpXMLAutoLayoutInfo*);
SdXMLExport::SdXMLExport( sal_Bool bIsDraw, sal_uInt16 nExportFlags )
: SvXMLExport( MAP_CM, bIsDraw ? XML_DRAWING : XML_PRESENTATION, nExportFlags ),
mpPageMasterInfoList(new ImpXMLEXPPageMasterList(1, 4, 4)),
mpPageMaterUsageList(new ImpXMLEXPPageMasterList(1, 4, 4)),
mpPageMasterUsageList(new ImpXMLEXPPageMasterList(1, 4, 4)),
mpNotesPageMasterUsageList(new ImpXMLEXPPageMasterList(1, 4, 4)),
mpHandoutPageMaster(NULL),
mpAutoLayoutInfoList(new ImpXMLAutoLayoutInfoList(1, 4, 4)),
mpSdPropHdlFactory(0L),
mpPropertySetMapper(0L),
......@@ -816,10 +828,15 @@ __EXPORT SdXMLExport::~SdXMLExport()
delete mpPageMasterInfoList;
mpPageMasterInfoList = 0L;
}
if(mpPageMaterUsageList)
if(mpPageMasterUsageList)
{
delete mpPageMasterUsageList;
mpPageMasterUsageList = 0L;
}
if(mpNotesPageMasterUsageList)
{
delete mpPageMaterUsageList;
mpPageMaterUsageList = 0L;
delete mpNotesPageMasterUsageList;
mpNotesPageMasterUsageList = 0L;
}
// clear auto-layout infos
......@@ -1406,39 +1423,71 @@ void SdXMLExport::ImpWriteAutoLayoutPlaceholder(XmlPlaceholder ePl, const Rectan
//////////////////////////////////////////////////////////////////////////////
ImpXMLEXPPageMasterInfo* SdXMLExport::ImpGetOrCreatePageMasterInfo( uno::Reference< drawing::XDrawPage > xMasterPage )
{
bool bDoesExist = false;
ImpXMLEXPPageMasterInfo* pNewInfo = new ImpXMLEXPPageMasterInfo(*this, xMasterPage);
// compare with prev page-master infos
for(sal_uInt32 a = 0; !bDoesExist && a < mpPageMasterInfoList->Count(); a++)
{
if(mpPageMasterInfoList->GetObject(a)
&& *mpPageMasterInfoList->GetObject(a) == *pNewInfo)
{
delete pNewInfo;
pNewInfo = mpPageMasterInfoList->GetObject(a);
bDoesExist = true;
}
}
// add entry when not found same page-master infos
if(!bDoesExist)
mpPageMasterInfoList->Insert(pNewInfo, LIST_APPEND);
return pNewInfo;
}
void SdXMLExport::ImpPrepPageMasterInfos()
{
// create page master info for handout master page
uno::Reference< drawing::XDrawPage > xMasterPage;
uno::Reference< XHandoutMasterSupplier > xHMS( GetModel(), uno::UNO_QUERY );
if( xHMS.is() )
xMasterPage = xHMS->getHandoutMasterPage();
if( xMasterPage.is() )
mpHandoutPageMaster = ImpGetOrCreatePageMasterInfo(xMasterPage);
// create page master infos for master pages
if(mnDocMasterPageCount)
{
// look for needed page-masters, create these
for(sal_Int32 nMPageId = 0L; nMPageId < mnDocMasterPageCount; nMPageId++)
{
uno::Any aAny(mxDocMasterPages->getByIndex(nMPageId));
uno::Reference< drawing::XDrawPage > xMasterPage;
mxDocMasterPages->getByIndex(nMPageId) >>= xMasterPage;
ImpXMLEXPPageMasterInfo* pNewInfo = 0L;
BOOL bDoesExist(FALSE);
if(aAny >>= xMasterPage)
{
pNewInfo = new ImpXMLEXPPageMasterInfo(*this, xMasterPage);
if(xMasterPage.is())
pNewInfo = ImpGetOrCreatePageMasterInfo(xMasterPage);
// compare with prev page-master infos
for(sal_uInt32 a = 0; !bDoesExist && a < mpPageMasterInfoList->Count(); a++)
mpPageMasterUsageList->Insert(pNewInfo, LIST_APPEND);
// look for page master of handout page
if(IsImpress())
{
pNewInfo = NULL;
uno::Reference< presentation::XPresentationPage > xPresPage(xMasterPage, uno::UNO_QUERY);
if(xPresPage.is())
{
if(mpPageMasterInfoList->GetObject(a)
&& *mpPageMasterInfoList->GetObject(a) == *pNewInfo)
uno::Reference< drawing::XDrawPage > xNotesPage(xPresPage->getNotesPage());
if(xNotesPage.is())
{
delete pNewInfo;
pNewInfo = mpPageMasterInfoList->GetObject(a);
bDoesExist = TRUE;
pNewInfo = ImpGetOrCreatePageMasterInfo(xNotesPage);
}
}
mpNotesPageMasterUsageList->Insert( pNewInfo, LIST_APPEND );
}
// add entry when not found same page-master infos
if(!bDoesExist)
mpPageMasterInfoList->Insert(pNewInfo, LIST_APPEND);
mpPageMaterUsageList->Insert(pNewInfo, LIST_APPEND);
}
}
}
......@@ -2295,6 +2344,13 @@ void SdXMLExport::_ExportMasterStyles()
AddAttribute(XML_NAMESPACE_PRESENTATION, XML_PRESENTATION_PAGE_LAYOUT_NAME, maDrawPagesAutoLayoutNames[0]);
}
ImpXMLEXPPageMasterInfo* pInfo = mpHandoutPageMaster;
if(pInfo)
{
OUString sString = pInfo->GetName();
AddAttribute(XML_NAMESPACE_STYLE, XML_PAGE_MASTER_NAME, sString);
}
// write masterpage
SvXMLElementExport aMPG(*this, XML_NAMESPACE_STYLE, XML_HANDOUT_MASTER, sal_True, sal_True);
......@@ -2323,7 +2379,7 @@ void SdXMLExport::_ExportMasterStyles()
AddAttribute(XML_NAMESPACE_STYLE, XML_NAME, sMasterPageName);
}
ImpXMLEXPPageMasterInfo* pInfo = mpPageMaterUsageList->GetObject(nMPageId);
ImpXMLEXPPageMasterInfo* pInfo = mpPageMasterUsageList->GetObject(nMPageId);
if(pInfo)
{
OUString sString = pInfo->GetName();
......@@ -2357,6 +2413,13 @@ void SdXMLExport::_ExportMasterStyles()
uno::Reference< drawing::XShapes > xShapes(xNotesPage, uno::UNO_QUERY);
if(xShapes.is() && xShapes->getCount())
{
ImpXMLEXPPageMasterInfo* pInfo = mpNotesPageMasterUsageList->GetObject(nMPageId);
if(pInfo)
{
OUString sString = pInfo->GetName();
AddAttribute(XML_NAMESPACE_STYLE, XML_PAGE_MASTER_NAME, sString);
}
// write presentation notes
SvXMLElementExport aPSY(*this, XML_NAMESPACE_PRESENTATION, XML_NOTES, sal_True, sal_True);
......
......@@ -2,9 +2,9 @@
*
* $RCSfile: sdxmlexp_impl.hxx,v $
*
* $Revision: 1.21 $
* $Revision: 1.22 $
*
* last change: $Author: cl $ $Date: 2001-11-27 14:14:16 $
* last change: $Author: cl $ $Date: 2002-09-04 13:58:44 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -138,7 +138,9 @@ class SdXMLExport : public SvXMLExport
// temporary infos
ImpXMLEXPPageMasterList* mpPageMasterInfoList;
ImpXMLEXPPageMasterList* mpPageMaterUsageList;
ImpXMLEXPPageMasterList* mpPageMasterUsageList;
ImpXMLEXPPageMasterList* mpNotesPageMasterUsageList;
ImpXMLEXPPageMasterInfo* mpHandoutPageMaster;
ImpXMLAutoLayoutInfoList* mpAutoLayoutInfoList;
com::sun::star::uno::Sequence< ::rtl::OUString > maDrawPagesAutoLayoutNames;
......@@ -171,6 +173,7 @@ class SdXMLExport : public SvXMLExport
// #82003#
virtual void _ExportMeta();
ImpXMLEXPPageMasterInfo* ImpGetOrCreatePageMasterInfo( com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage > xMasterPage );
void ImpPrepPageMasterInfos();
void ImpPrepDrawMasterInfos();
void ImpWritePageMasterInfos();
......
......@@ -2,9 +2,9 @@
*
* $RCSfile: ximpnote.cxx,v $
*
* $Revision: 1.5 $
* $Revision: 1.6 $
*
* last change: $Author: cl $ $Date: 2001-04-18 07:48:51 $
* last change: $Author: cl $ $Date: 2002-09-04 13:58:45 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -80,6 +80,25 @@ SdXMLNotesContext::SdXMLNotesContext( SdXMLImport& rImport,
uno::Reference< drawing::XShapes >& rShapes)
: SdXMLGenericPageContext( rImport, nPrfx, rLocalName, xAttrList, rShapes )
{
const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
for(sal_Int16 i=0; i < nAttrCount; i++)
{
OUString sAttrName = xAttrList->getNameByIndex( i );
OUString aLocalName;
sal_uInt16 nPrefix = GetSdImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
OUString sValue = xAttrList->getValueByIndex( i );
const SvXMLTokenMap& rAttrTokenMap = GetSdImport().GetMasterPageAttrTokenMap();
switch(rAttrTokenMap.Get(nPrefix, aLocalName))
{
case XML_TOK_MASTERPAGE_PAGE_MASTER_NAME:
{
msPageMasterName = sValue;
break;
}
}
}
// now delete all up-to-now contained shapes from this notes page
uno::Reference< drawing::XShape > xShape;
while(rShapes->getCount())
......@@ -88,6 +107,12 @@ SdXMLNotesContext::SdXMLNotesContext( SdXMLImport& rImport,
if(xShape.is())
rShapes->remove(xShape);
}
// set page-master?
if(msPageMasterName.getLength())
{
SetPageMaster( msPageMasterName );
}
}
//////////////////////////////////////////////////////////////////////////////
......
......@@ -2,9 +2,9 @@
*
* $RCSfile: ximpnote.hxx,v $
*
* $Revision: 1.6 $
* $Revision: 1.7 $
*
* last change: $Author: cl $ $Date: 2001-05-28 13:32:20 $
* last change: $Author: cl $ $Date: 2002-09-04 13:58:45 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -83,6 +83,9 @@
class SdXMLNotesContext : public SdXMLGenericPageContext
{
private:
rtl::OUString msPageMasterName;
public:
SdXMLNotesContext( SdXMLImport& rImport, USHORT nPrfx,
const rtl::OUString& rLocalName,
......
......@@ -2,9 +2,9 @@
*
* $RCSfile: ximppage.cxx,v $
*
* $Revision: 1.9 $
* $Revision: 1.10 $
*
* last change: $Author: thb $ $Date: 2001-07-24 17:06:07 $
* last change: $Author: cl $ $Date: 2002-09-04 13:58:46 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -245,3 +245,64 @@ void SdXMLGenericPageContext::DeleteAllShapes()
}
}
void SdXMLGenericPageContext::SetPageMaster( OUString& rsPageMasterName )
{
if( GetSdImport().GetShapeImport()->GetStylesContext() )
{
// look for PageMaster with this name
// #80012# GetStylesContext() replaced with GetAutoStylesContext()
const SvXMLStylesContext* pAutoStyles = GetSdImport().GetShapeImport()->GetAutoStylesContext();
const SvXMLStyleContext* pStyle = pAutoStyles ? pAutoStyles->FindStyleChildContext(XML_STYLE_FAMILY_SD_PAGEMASTERCONEXT_ID, rsPageMasterName) : NULL;
if(pStyle && pStyle->ISA(SdXMLPageMasterContext))
{
const SdXMLPageMasterContext* pPageMaster = (SdXMLPageMasterContext*)pStyle;
const SdXMLPageMasterStyleContext* pPageMasterContext = pPageMaster->GetPageMasterStyle();
if(pPageMasterContext)
{
uno::Reference< drawing::XDrawPage > xMasterPage(GetLocalShapesContext(), uno::UNO_QUERY);
if(xMasterPage.is())
{
// set sizes for this masterpage
uno::Reference <beans::XPropertySet> xPropSet(xMasterPage, uno::UNO_QUERY);
if(xPropSet.is())
{
uno::Any aAny;
aAny <<= pPageMasterContext->GetBorderBottom();
xPropSet->setPropertyValue(
OUString(RTL_CONSTASCII_USTRINGPARAM("BorderBottom")), aAny);
aAny <<= pPageMasterContext->GetBorderLeft();
xPropSet->setPropertyValue(
OUString(RTL_CONSTASCII_USTRINGPARAM("BorderLeft")), aAny);
aAny <<= pPageMasterContext->GetBorderRight();
xPropSet->setPropertyValue(
OUString(RTL_CONSTASCII_USTRINGPARAM("BorderRight")), aAny);
aAny <<= pPageMasterContext->GetBorderTop();
xPropSet->setPropertyValue(
OUString(RTL_CONSTASCII_USTRINGPARAM("BorderTop")), aAny);
aAny <<= pPageMasterContext->GetWidth();
xPropSet->setPropertyValue(
OUString(RTL_CONSTASCII_USTRINGPARAM("Width")), aAny);
aAny <<= pPageMasterContext->GetHeight();
xPropSet->setPropertyValue(
OUString(RTL_CONSTASCII_USTRINGPARAM("Height")), aAny);
aAny <<= pPageMasterContext->GetOrientation();
xPropSet->setPropertyValue(
OUString(RTL_CONSTASCII_USTRINGPARAM("Orientation")), aAny);
}
}
}
}
}
}
\ No newline at end of file
......@@ -2,9 +2,9 @@
*
* $RCSfile: ximppage.hxx,v $
*
* $Revision: 1.3 $
* $Revision: 1.4 $
*
* last change: $Author: cl $ $Date: 2001-05-28 13:32:20 $
* last change: $Author: cl $ $Date: 2002-09-04 13:58:46 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -109,6 +109,9 @@ protected:
const SdXMLImport& GetSdImport() const { return (const SdXMLImport&)GetImport(); }
SdXMLImport& GetSdImport() { return (SdXMLImport&)GetImport(); }
/** sets the properties from a page master style with the given name on this contexts page */
void SetPageMaster( rtl::OUString& rsPageMasterName );
public:
TYPEINFO();
......
......@@ -2,9 +2,9 @@
*
* $RCSfile: ximpstyl.cxx,v $
*
* $Revision: 1.34 $
* $Revision: 1.35 $
*
* last change: $Author: cl $ $Date: 2001-09-28 08:51:44 $
* last change: $Author: cl $ $Date: 2002-09-04 13:58:47 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -833,62 +833,9 @@ SdXMLMasterPageContext::SdXMLMasterPageContext(
}
// set page-master?
if(!bHandoutMaster && msPageMasterName.getLength() && GetSdImport().GetShapeImport()->GetStylesContext())
if(msPageMasterName.getLength())
{
// look for PageMaster with this name
// #80012# GetStylesContext() replaced with GetAutoStylesContext()
const SvXMLStylesContext* pAutoStyles = GetSdImport().GetShapeImport()->GetAutoStylesContext();
const SvXMLStyleContext* pStyle = pAutoStyles ? pAutoStyles->FindStyleChildContext(XML_STYLE_FAMILY_SD_PAGEMASTERCONEXT_ID, msPageMasterName) : NULL;
if(pStyle && pStyle->ISA(SdXMLPageMasterContext))
{
const SdXMLPageMasterContext* pPageMaster = (SdXMLPageMasterContext*)pStyle;
const SdXMLPageMasterStyleContext* pPageMasterContext = pPageMaster->GetPageMasterStyle();
if(pPageMasterContext)
{
uno::Reference< drawing::XDrawPage > xMasterPage(GetLocalShapesContext(), uno::UNO_QUERY);
if(xMasterPage.is())
{
// set sizes for this masterpage
uno::Reference <beans::XPropertySet> xPropSet(xMasterPage, uno::UNO_QUERY);
if(xPropSet.is())
{
uno::Any aAny;
aAny <<= pPageMasterContext->GetBorderBottom();
xPropSet->setPropertyValue(
OUString(RTL_CONSTASCII_USTRINGPARAM("BorderBottom")), aAny);
aAny <<= pPageMasterContext->GetBorderLeft();
xPropSet->setPropertyValue(
OUString(RTL_CONSTASCII_USTRINGPARAM("BorderLeft")), aAny);
aAny <<= pPageMasterContext->GetBorderRight();
xPropSet->setPropertyValue(
OUString(RTL_CONSTASCII_USTRINGPARAM("BorderRight")), aAny);
aAny <<= pPageMasterContext->GetBorderTop();
xPropSet->setPropertyValue(
OUString(RTL_CONSTASCII_USTRINGPARAM("BorderTop")), aAny);
aAny <<= pPageMasterContext->GetWidth();
xPropSet->setPropertyValue(
OUString(RTL_CONSTASCII_USTRINGPARAM("Width")), aAny);
aAny <<= pPageMasterContext->GetHeight();
xPropSet->setPropertyValue(
OUString(RTL_CONSTASCII_USTRINGPARAM("Height")), aAny);
aAny <<= pPageMasterContext->GetOrientation();
xPropSet->setPropertyValue(
OUString(RTL_CONSTASCII_USTRINGPARAM("Orientation")), aAny);
}
}
}
}
SetPageMaster( msPageMasterName );
}
// set PageProperties?
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment