Kaydet (Commit) d50bd55c authored tarafından Vishv Brahmbhatt's avatar Vishv Brahmbhatt Kaydeden (comit) Thorsten Behrens

Parsing master presentation objects from 'objectlist.xml'

Parsing the property values of master presentation objects.
Also new functions added to comphelper module for expanding
filepaths macro to appropriate system file paths(for
configuration files present at 'Impress.xcs')

Change-Id: If0381a12155673e85103ddb5d51c34ae53fe2ecb
üst b1e46499
...@@ -86,6 +86,7 @@ $(eval $(call gb_Library_add_exception_objects,comphelper,\ ...@@ -86,6 +86,7 @@ $(eval $(call gb_Library_add_exception_objects,comphelper,\
comphelper/source/misc/documentiologring \ comphelper/source/misc/documentiologring \
comphelper/source/misc/evtlistenerhlp \ comphelper/source/misc/evtlistenerhlp \
comphelper/source/misc/evtmethodhelper \ comphelper/source/misc/evtmethodhelper \
comphelper/source/misc/expandmacro \
comphelper/source/misc/ihwrapnofilter \ comphelper/source/misc/ihwrapnofilter \
comphelper/source/misc/instancelocker \ comphelper/source/misc/instancelocker \
comphelper/source/misc/interaction \ comphelper/source/misc/interaction \
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* 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/.
*/
#include <comphelper/expandmacro.hxx>
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/util/theMacroExpander.hpp>
#include <rtl/ustring.hxx>
#include <rtl/uri.hxx>
#include <osl/file.h>
#include <comphelper/processfactory.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using ::com::sun::star::lang::XMultiServiceFactory;
namespace comphelper
{
rtl::OUString getExpandedFilePath(const rtl::OUString& filepath)
{
const Reference<XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
return getExpandedFilePath(filepath, xContext);
}
rtl::OUString getExpandedFilePath(const rtl::OUString& filepath, const Reference<XComponentContext>& xContext)
{
Reference< util::XMacroExpander > xMacroExpander = util::theMacroExpander::get( xContext );
rtl::OUString aFilename = filepath;
if( aFilename.startsWith( "vnd.sun.star.expand:" ) )
{
// cut protocol
rtl::OUString aMacro( aFilename.copy( sizeof ( "vnd.sun.star.expand:" ) -1 ) );
// decode uric class chars
aMacro = rtl::Uri::decode( aMacro, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 );
// expand macro string
aFilename = xMacroExpander->expandMacros( aMacro );
}
if( aFilename.startsWith( "file://" ) )
{
rtl::OUString aSysPath;
if( osl_getSystemPathFromFileURL( aFilename.pData, &aSysPath.pData ) == osl_File_E_None )
aFilename = aSysPath;
}
return aFilename;
}
}
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* 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/.
*/
#ifndef COMPHELPER_EXPANDMACRO_HXX_INCLUDED
#define COMPHELPER_EXPANDMACRO_HXX_INCLUDED
#include "rtl/ustring.hxx"
#include "comphelper/comphelperdllapi.h"
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/uno/XComponentContext.hpp>
namespace comphelper
{
/**
A helper function to get expanded version of macro for filepaths.
If the given path is prefixed by "vnd.sun.star.expand:", this
function substitutes contained macro references. It then always
returns a system file path, if necessary converting file
URIs. Example:
vnd.sun.star.expand:$BRAND_BASE_DIR/$BRAND_SHARE_SUBDIR gets
converted to e.g. /usr/lib64/libreoffice/share.
@param path to operate on. Both system file path and file URIs are accepted.
@return macro-expanded system file path.
*/
COMPHELPER_DLLPUBLIC rtl::OUString getExpandedFilePath(const rtl::OUString& filepath);
/**
A helper function to get expanded version of macro for filepaths.
If the given path is prefixed by "vnd.sun.star.expand:", this
function substitutes contained macro references. It then always
returns a system file path, if necessary converting file
URIs. Example:
vnd.sun.star.expand:$BRAND_BASE_DIR/$BRAND_SHARE_SUBDIR gets
converted to e.g. /usr/lib64/libreoffice/share.
Use this version if you have a local reference of a component
context at hand, saves us the extra lookup.
@param path to operate on. Both system file path and file URIs are accepted.
@param xContext refers to the component context of the process.
@return macro-expanded system file path.
*/
COMPHELPER_DLLPUBLIC rtl::OUString getExpandedFilePath(const rtl::OUString& filepath,
const ::com::sun::star::uno::Reference<css::uno::XComponentContext>& xContext);
}
#endif
...@@ -482,6 +482,20 @@ ...@@ -482,6 +482,20 @@
</info> </info>
<value oor:separator=";">vnd.sun.star.expand:$BRAND_BASE_DIR/$BRAND_SHARE_SUBDIR/config/soffice.cfg/simpress/layoutlist.xml</value> <value oor:separator=";">vnd.sun.star.expand:$BRAND_BASE_DIR/$BRAND_SHARE_SUBDIR/config/soffice.cfg/simpress/layoutlist.xml</value>
</prop> </prop>
<prop oor:name="PresObjListFiles" oor:type="oor:string-list" oor:nillable="false">
<info>
<desc>
Contains a list of xml files defining the presentation
object used in the master page of "notes" and "handout".
It contains properties of presentation objects,like
their position, width, and height. Entries are run
through macro expansion, so, vnd.sun.star.expand prefix is
allowed.
</desc>
<label>List of files containing master presentation objects</label>
</info>
<value oor:separator=";">vnd.sun.star.expand:$BRAND_BASE_DIR/$BRAND_SHARE_SUBDIR/config/soffice.cfg/simpress/objectlist.xml</value>
</prop>
<prop oor:name="PreviewNewEffects" oor:type="xs:boolean" oor:nillable="false"> <prop oor:name="PreviewNewEffects" oor:type="xs:boolean" oor:nillable="false">
<!-- OldPath: --> <!-- OldPath: -->
<!-- OldLocation: --> <!-- OldLocation: -->
......
...@@ -15,6 +15,7 @@ $(eval $(call gb_Package_add_files,sd_xml,$(LIBO_SHARE_FOLDER)/config/soffice.cf ...@@ -15,6 +15,7 @@ $(eval $(call gb_Package_add_files,sd_xml,$(LIBO_SHARE_FOLDER)/config/soffice.cf
effects.xml \ effects.xml \
transitions.xml \ transitions.xml \
layoutlist.xml \ layoutlist.xml \
objectlist.xml \
)) ))
# vim: set noet sw=4 ts=4: # vim: set noet sw=4 ts=4:
...@@ -192,6 +192,9 @@ private: ...@@ -192,6 +192,9 @@ private:
std::vector<com::sun::star::uno::Reference< std::vector<com::sun::star::uno::Reference<
com::sun::star::xml::dom::XNode> > maLayoutInfo; com::sun::star::xml::dom::XNode> > maLayoutInfo;
std::vector<com::sun::star::uno::Reference<
com::sun::star::xml::dom::XNode> > maPresObjectInfo;
bool mbUseEmbedFonts; bool mbUseEmbedFonts;
protected: protected:
...@@ -272,6 +275,10 @@ public: ...@@ -272,6 +275,10 @@ public:
com::sun::star::xml::dom::XNode> >& GetLayoutVector() const com::sun::star::xml::dom::XNode> >& GetLayoutVector() const
{ return maLayoutInfo; } { return maLayoutInfo; }
/// load xml-based impress master presentation object definitions into document
void InitObjectVector();
/// return reference to vector of master presentation object definitions
const std::vector<com::sun::star::uno::Reference<com::sun::star::xml::dom::XNode>>& GetObjectVector() const { return maPresObjectInfo; }
/** Insert pages into this document /** Insert pages into this document
This method inserts whole pages into this document, either This method inserts whole pages into this document, either
...@@ -317,6 +324,7 @@ public: ...@@ -317,6 +324,7 @@ public:
Whether the replace operation should take the name from the new Whether the replace operation should take the name from the new
page, or preserve the old name page, or preserve the old name
*/ */
sal_Bool InsertBookmarkAsPage(const std::vector<OUString> &rBookmarkList, sal_Bool InsertBookmarkAsPage(const std::vector<OUString> &rBookmarkList,
std::vector<OUString> *pExchangeList, std::vector<OUString> *pExchangeList,
sal_Bool bLink, sal_Bool bReplace, sal_uInt16 nPgPos, sal_Bool bLink, sal_Bool bReplace, sal_uInt16 nPgPos,
......
...@@ -70,11 +70,9 @@ ...@@ -70,11 +70,9 @@
#include <com/sun/star/xml/dom/XNamedNodeMap.hpp> #include <com/sun/star/xml/dom/XNamedNodeMap.hpp>
#include <com/sun/star/xml/dom/DocumentBuilder.hpp> #include <com/sun/star/xml/dom/DocumentBuilder.hpp>
#include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/util/theMacroExpander.hpp>
#include <rtl/ustring.hxx> #include <rtl/ustring.hxx>
#include <rtl/uri.hxx> #include <rtl/uri.hxx>
#include <osl/file.h> #include <comphelper/expandmacro.hxx>
#include <editeng/outliner.hxx> #include <editeng/outliner.hxx>
#include "drawdoc.hxx" #include "drawdoc.hxx"
...@@ -105,9 +103,7 @@ using namespace ::com::sun::star::linguistic2; ...@@ -105,9 +103,7 @@ using namespace ::com::sun::star::linguistic2;
using namespace com::sun::star::xml::dom; using namespace com::sun::star::xml::dom;
using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Reference;
using ::com::sun::star::io::XInputStream;
using ::com::sun::star::lang::XMultiServiceFactory; using ::com::sun::star::lang::XMultiServiceFactory;
using ::com::sun::star::container::XNameAccess;
using ::com::sun::star::beans::PropertyValue; using ::com::sun::star::beans::PropertyValue;
TYPEINIT1( SdDrawDocument, FmFormModel ); TYPEINIT1( SdDrawDocument, FmFormModel );
...@@ -183,6 +179,7 @@ SdDrawDocument::SdDrawDocument(DocumentType eType, SfxObjectShell* pDrDocSh) ...@@ -183,6 +179,7 @@ SdDrawDocument::SdDrawDocument(DocumentType eType, SfxObjectShell* pDrDocSh)
new ImpMasterPageListWatcher(*this)); new ImpMasterPageListWatcher(*this));
InitLayoutVector(); InitLayoutVector();
InitObjectVector();
SetObjectShell(pDrDocSh); // for VCDrawModel SetObjectShell(pDrDocSh); // for VCDrawModel
if (mpDocSh) if (mpDocSh)
...@@ -995,36 +992,16 @@ void SdDrawDocument::InitLayoutVector() ...@@ -995,36 +992,16 @@ void SdDrawDocument::InitLayoutVector()
{ {
const Reference<css::uno::XComponentContext> xContext( const Reference<css::uno::XComponentContext> xContext(
::comphelper::getProcessComponentContext() ); ::comphelper::getProcessComponentContext() );
Reference< util::XMacroExpander > xMacroExpander(
util::theMacroExpander::get( xContext ) );
// get file list from configuration // get file list from configuration
Sequence< rtl::OUString > aFiles( Sequence< rtl::OUString > aFiles(
officecfg::Office::Impress::Misc::LayoutListFiles::get(xContext) ); officecfg::Office::Impress::Misc::LayoutListFiles::get(xContext) );
// loop over each file in sequence rtl::OUString sFilename;
rtl::OUString aFilename;
for( sal_Int32 i=0; i < aFiles.getLength(); ++i ) for( sal_Int32 i=0; i < aFiles.getLength(); ++i )
{ {
aFilename = aFiles[i]; rtl::OUString filepath = aFiles[i];
if( aFilename.startsWith( "vnd.sun.star.expand:" ) ) sFilename= ::comphelper::getExpandedFilePath(filepath,xContext);
{
// cut protocol
rtl::OUString aMacro( aFilename.copy( sizeof ( "vnd.sun.star.expand:" ) -1 ) );
// decode uric class chars
aMacro = rtl::Uri::decode( aMacro, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 );
// expand macro string
aFilename = xMacroExpander->expandMacros( aMacro );
}
if( aFilename.startsWith( "file://" ) )
{
rtl::OUString aSysPath;
if( osl_getSystemPathFromFileURL( aFilename.pData, &aSysPath.pData ) == osl_File_E_None )
aFilename = aSysPath;
}
// load layout file into DOM // load layout file into DOM
Reference< XMultiServiceFactory > xServiceFactory( Reference< XMultiServiceFactory > xServiceFactory(
...@@ -1033,7 +1010,7 @@ void SdDrawDocument::InitLayoutVector() ...@@ -1033,7 +1010,7 @@ void SdDrawDocument::InitLayoutVector()
DocumentBuilder::create( comphelper::getComponentContext (xServiceFactory) )); DocumentBuilder::create( comphelper::getComponentContext (xServiceFactory) ));
// loop over every layout entry in current file // loop over every layout entry in current file
const Reference<XDocument> xDoc = xDocBuilder->parseURI( aFilename ); const Reference<XDocument> xDoc = xDocBuilder->parseURI( sFilename );
const Reference<XNodeList> layoutlist = xDoc->getElementsByTagName("layout"); const Reference<XNodeList> layoutlist = xDoc->getElementsByTagName("layout");
const int nElements = layoutlist->getLength(); const int nElements = layoutlist->getLength();
for(int index=0; index < nElements; index++) for(int index=0; index < nElements; index++)
...@@ -1041,4 +1018,33 @@ void SdDrawDocument::InitLayoutVector() ...@@ -1041,4 +1018,33 @@ void SdDrawDocument::InitLayoutVector()
} }
} }
void SdDrawDocument::InitObjectVector()
{
const Reference<css::uno::XComponentContext> xContext(
::comphelper::getProcessComponentContext() );
// get file list from configuration
Sequence< rtl::OUString > aFiles(
officecfg::Office::Impress::Misc::PresObjListFiles::get(xContext) );
rtl::OUString sFilename;
for( sal_Int32 i=0; i < aFiles.getLength(); ++i )
{
rtl::OUString filepath = aFiles[i];
sFilename= ::comphelper::getExpandedFilePath(filepath,xContext);
// load presentation object file into DOM
Reference< XMultiServiceFactory > xServiceFactory(
xContext->getServiceManager() , UNO_QUERY_THROW );
const Reference<XDocumentBuilder> xDocBuilder(
DocumentBuilder::create( comphelper::getComponentContext (xServiceFactory) ));
// loop over every object entry in current file
const Reference<XDocument> xDoc = xDocBuilder->parseURI( sFilename );
const Reference<XNodeList> objectlist = xDoc->getElementsByTagName("object");
const int nElements = objectlist->getLength();
for(int index=0; index < nElements; index++)
maPresObjectInfo.push_back( objectlist->item(index) );
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -850,8 +850,80 @@ void SdPage::CreateTitleAndLayout(sal_Bool bInit, sal_Bool bCreate ) ...@@ -850,8 +850,80 @@ void SdPage::CreateTitleAndLayout(sal_Bool bInit, sal_Bool bCreate )
} }
} }
static const std::vector<rtl::OUString> PageKindVector = {"PK_STANDARD","PK_NOTES" , "PK_HANDOUT"};
static const std::vector<rtl::OUString> PresObjKindVector = {"PRESOBJ_NONE", "PRESOBJ_TITLE", "PRESOBJ_OUTLINE",
"PRESOBJ_TEXT" ,"PRESOBJ_GRAPHIC" , "PRESOBJ_OBJECT",
"PRESOBJ_CHART", "PRESOBJ_ORGCHART", "PRESOBJ_TABLE",
"PRESOBJ_IMAGE", "PRESOBJ_PAGE", "PRESOBJ_HANDOUT",
"PRESOBJ_NOTES","PRESOBJ_HEADER", "PRESOBJ_FOOTER",
"PRESOBJ_DATETIME", "PRESOBJ_SLIDENUMBER", "PRESOBJ_CALC",
"PRESOBJ_MEDIA", "PRESOBJ_MAX" };
void getPresObjProp( SdPage rPage, const rtl::OUString& sObjKind, const rtl::OUString& sPageKind, double presObjPropValue[])
{
bool bNoObjectFound = true; //used to break from outer loop
const std::vector< Reference<XNode> >& objectInfo = static_cast<const SdDrawDocument*>(rPage.GetModel())->GetObjectVector();
for( std::vector< Reference<XNode> >::const_iterator aIter=objectInfo.begin(); aIter != objectInfo.end(); ++aIter )
{
if(bNoObjectFound)
{
Reference<XNode> objectNode = *aIter; //get i'th object element
Reference<XNamedNodeMap> objectattrlist = objectNode->getAttributes();
Reference<XNode> objectattr = objectattrlist->getNamedItem("type");
rtl::OUString sObjType = objectattr->getNodeValue();
if(sObjType == sObjKind)
{
Reference<XNodeList> objectChildren = objectNode->getChildNodes();
const int objSize = objectChildren->getLength();
for( int j=0; j< objSize; j++)
{
Reference<XNode> obj = objectChildren->item(j);
rtl::OUString nodename = obj->getNodeName();
//check whether children is blank 'text-node' or 'object-prop' node
if(nodename == "object-prop")
{
Reference<XNamedNodeMap> ObjAttributes = obj->getAttributes();
Reference<XNode> ObjPageKind = ObjAttributes->getNamedItem("pagekind");
rtl::OUString sObjPageKind = ObjPageKind->getNodeValue();
if(sObjPageKind == sPageKind)
{
Reference<XNode> ObjSizeHeight = ObjAttributes->getNamedItem("relative-height");
rtl::OUString sValue = ObjSizeHeight->getNodeValue();
presObjPropValue[0] = sValue.toDouble();
Reference<XNode> ObjSizeWidth = ObjAttributes->getNamedItem("relative-width");
sValue = ObjSizeWidth->getNodeValue();
presObjPropValue[1] = sValue.toDouble();
Reference<XNode> ObjPosX = ObjAttributes->getNamedItem("relative-posX");
sValue = ObjPosX->getNodeValue();
presObjPropValue[2] = sValue.toDouble();
Reference<XNode> ObjPosY = ObjAttributes->getNamedItem("relative-posY");
sValue = ObjPosY->getNodeValue();
presObjPropValue[3] = sValue.toDouble();
bNoObjectFound = false;
break;
}
}
}
}
}
else
break;
}
}
SdrObject* SdPage::CreateDefaultPresObj(PresObjKind eObjKind, bool bInsert) SdrObject* SdPage::CreateDefaultPresObj(PresObjKind eObjKind, bool bInsert)
{ {
double propvalue[] = {0,0,0,0};
if( eObjKind == PRESOBJ_TITLE ) if( eObjKind == PRESOBJ_TITLE )
{ {
Rectangle aTitleRect( GetTitleRect() ); Rectangle aTitleRect( GetTitleRect() );
...@@ -869,46 +941,35 @@ SdrObject* SdPage::CreateDefaultPresObj(PresObjKind eObjKind, bool bInsert) ...@@ -869,46 +941,35 @@ SdrObject* SdPage::CreateDefaultPresObj(PresObjKind eObjKind, bool bInsert)
} }
else if( (eObjKind == PRESOBJ_FOOTER) || (eObjKind == PRESOBJ_DATETIME) || (eObjKind == PRESOBJ_SLIDENUMBER) || (eObjKind == PRESOBJ_HEADER ) ) else if( (eObjKind == PRESOBJ_FOOTER) || (eObjKind == PRESOBJ_DATETIME) || (eObjKind == PRESOBJ_SLIDENUMBER) || (eObjKind == PRESOBJ_HEADER ) )
{ {
rtl::OUString sObjKind = PresObjKindVector[eObjKind];
rtl::OUString sPageKind = PageKindVector[mePageKind];
// create footer objects for standard master page // create footer objects for standard master page
if( mePageKind == PK_STANDARD ) if( mePageKind == PK_STANDARD )
{ {
const long nLftBorder = GetLftBorder(); const long nLftBorder = GetLftBorder();
const long nUppBorder = GetUppBorder(); const long nUppBorder = GetUppBorder();
Size aPageSize ( GetSize() ); Point aPos ( nLftBorder, nUppBorder );
aPageSize.Width() -= nLftBorder + GetRgtBorder(); Size aSize ( GetSize() );
aPageSize.Height() -= nUppBorder + GetLwrBorder();
const int Y = long(nUppBorder + aPageSize.Height() * 0.911); aSize.Width() -= nLftBorder + GetRgtBorder();
const int W1 = long(aPageSize.Width() * 0.233); aSize.Height() -= nUppBorder + GetLwrBorder();
const int W2 = long(aPageSize.Width() * 0.317);
const int H = long(aPageSize.Height() * 0.069);
if( eObjKind == PRESOBJ_DATETIME ) getPresObjProp( *this, sObjKind, sPageKind, propvalue);
{ aPos.X() += long( aSize.Width() * propvalue[2] );
Point aPos( long(nLftBorder+(aPageSize.Width()*0.05)), Y ); aPos.Y() += long( aSize.Height() * propvalue[3] );
Size aSize( W1, H ); aSize.Width() = long( aSize.Width() * propvalue[1] );
Rectangle aRect( aPos, aSize ); aSize.Height() = long( aSize.Height() * propvalue[0] );
return CreatePresObj( PRESOBJ_DATETIME, sal_False, aRect, bInsert );
} if(eObjKind == PRESOBJ_HEADER )
else if( eObjKind == PRESOBJ_FOOTER )
{
Point aPos( long(nLftBorder+ aPageSize.Width() * 0.342), Y );
Size aSize( W2, H );
Rectangle aRect( aPos, aSize );
return CreatePresObj( PRESOBJ_FOOTER, sal_False, aRect, bInsert );
}
else if( eObjKind == PRESOBJ_SLIDENUMBER )
{ {
Point aPos( long(nLftBorder+(aPageSize.Width()*0.717)), Y ); OSL_FAIL( "SdPage::CreateDefaultPresObj() - can't create a header placeholder for a slide master" );
Size aSize( W1, H ); return NULL;
Rectangle aRect( aPos, aSize );
return CreatePresObj( PRESOBJ_SLIDENUMBER, sal_False, aRect, bInsert );
} }
else else
{ {
OSL_FAIL( "SdPage::CreateDefaultPresObj() - can't create a header placeholder for a slide master" ); Rectangle aRect( aPos, aSize );
return NULL; return CreatePresObj( eObjKind, sal_False, aRect, bInsert );
} }
} }
else else
...@@ -918,44 +979,24 @@ SdrObject* SdPage::CreateDefaultPresObj(PresObjKind eObjKind, bool bInsert) ...@@ -918,44 +979,24 @@ SdrObject* SdPage::CreateDefaultPresObj(PresObjKind eObjKind, bool bInsert)
aPageSize.Width() -= GetLftBorder() + GetRgtBorder(); aPageSize.Width() -= GetLftBorder() + GetRgtBorder();
aPageSize.Height() -= GetUppBorder() + GetLwrBorder(); aPageSize.Height() -= GetUppBorder() + GetLwrBorder();
Point aPosition ( GetLftBorder(), GetUppBorder() );
const int NOTES_HEADER_FOOTER_WIDTH = long(aPageSize.Width() * 0.434); getPresObjProp( *this, sObjKind, sPageKind, propvalue);
const int NOTES_HEADER_FOOTER_HEIGHT = long(aPageSize.Height() * 0.05); int NOTES_HEADER_FOOTER_WIDTH = long(aPageSize.Width() * propvalue[1]);
int NOTES_HEADER_FOOTER_HEIGHT = long(aPageSize.Height() * propvalue[0]);
Size aSize( NOTES_HEADER_FOOTER_WIDTH, NOTES_HEADER_FOOTER_HEIGHT ); Size aSize( NOTES_HEADER_FOOTER_WIDTH, NOTES_HEADER_FOOTER_HEIGHT );
Point aPos ( 0 ,0 );
if( propvalue[2] == 0 )
aPos.X() = aPosition.X();
else
aPos.X() = aPosition.X() + long( aPageSize.Width() - NOTES_HEADER_FOOTER_WIDTH );
if( propvalue[3] == 0 )
aPos.Y() = aPosition.Y();
else
aPos.Y() = aPosition.Y() + long( aPageSize.Height() - NOTES_HEADER_FOOTER_HEIGHT );
const int X1 = GetLftBorder();
const int X2 = GetLftBorder() + long(aPageSize.Width() - NOTES_HEADER_FOOTER_WIDTH);
const int Y1 = GetUppBorder();
const int Y2 = GetUppBorder() + long(aPageSize.Height() - NOTES_HEADER_FOOTER_HEIGHT );
if( eObjKind == PRESOBJ_HEADER )
{
Point aPos( X1, Y1 );
Rectangle aRect( aPos, aSize );
return CreatePresObj( PRESOBJ_HEADER, sal_False, aRect, bInsert );
}
else if( eObjKind == PRESOBJ_DATETIME )
{
Point aPos( X2, Y1 );
Rectangle aRect( aPos, aSize );
return CreatePresObj( PRESOBJ_DATETIME, sal_False, aRect, bInsert );
}
else if( eObjKind == PRESOBJ_FOOTER )
{
Point aPos( X1, Y2 );
Rectangle aRect( aPos, aSize );
return CreatePresObj( PRESOBJ_FOOTER, sal_False, aRect, bInsert );
}
else if( eObjKind == PRESOBJ_SLIDENUMBER )
{
Point aPos( X2, Y2 );
Rectangle aRect( aPos, aSize ); Rectangle aRect( aPos, aSize );
return CreatePresObj( PRESOBJ_SLIDENUMBER, sal_False, aRect, bInsert ); return CreatePresObj( eObjKind, sal_False, aRect, bInsert );
}
OSL_FAIL("SdPage::CreateDefaultPresObj() - this should not happen!");
return NULL;
} }
} }
else else
...@@ -974,6 +1015,7 @@ SdrObject* SdPage::CreateDefaultPresObj(PresObjKind eObjKind, bool bInsert) ...@@ -974,6 +1015,7 @@ SdrObject* SdPage::CreateDefaultPresObj(PresObjKind eObjKind, bool bInsert)
Rectangle SdPage::GetTitleRect() const Rectangle SdPage::GetTitleRect() const
{ {
Rectangle aTitleRect; Rectangle aTitleRect;
double propvalue[] = {0,0,0,0};
if (mePageKind != PK_HANDOUT) if (mePageKind != PK_HANDOUT)
{ {
...@@ -984,21 +1026,26 @@ Rectangle SdPage::GetTitleRect() const ...@@ -984,21 +1026,26 @@ Rectangle SdPage::GetTitleRect() const
Size aTitleSize ( GetSize() ); Size aTitleSize ( GetSize() );
aTitleSize.Width() -= GetLftBorder() + GetRgtBorder(); aTitleSize.Width() -= GetLftBorder() + GetRgtBorder();
aTitleSize.Height() -= GetUppBorder() + GetLwrBorder(); aTitleSize.Height() -= GetUppBorder() + GetLwrBorder();
rtl::OUString sPageKind = PageKindVector[mePageKind];
if (mePageKind == PK_STANDARD) if (mePageKind == PK_STANDARD)
{ {
aTitlePos.X() += long( aTitleSize.Width() * 0.05 ); getPresObjProp( *this , "PRESOBJ_TITLE" ,sPageKind, propvalue);
aTitlePos.Y() += long( aTitleSize.Height() * 0.0399 ); aTitlePos.X() += long( aTitleSize.Width() * propvalue[2] );
aTitleSize.Width() = long( aTitleSize.Width() * 0.9 ); aTitlePos.Y() += long( aTitleSize.Height() * propvalue[3] );
aTitleSize.Height() = long( aTitleSize.Height() * 0.167 ); aTitleSize.Width() = long( aTitleSize.Width() * propvalue[1] );
aTitleSize.Height() = long( aTitleSize.Height() * propvalue[0] );
} }
else if (mePageKind == PK_NOTES) else if (mePageKind == PK_NOTES)
{ {
Point aPos = aTitlePos; Point aPos = aTitlePos;
aPos.Y() += long( aTitleSize.Height() * 0.076 ); getPresObjProp( *this, "PRESOBJ_TITLE" ,sPageKind, propvalue);
aPos.X() += long( aTitleSize.Width() * propvalue[2] );
aPos.Y() += long( aTitleSize.Height() * propvalue[3] );
// limit height // limit height
aTitleSize.Height() = (long) (aTitleSize.Height() * 0.375); aTitleSize.Height() = long( aTitleSize.Height() * propvalue[0] );
aTitleSize.Width() = long( aTitleSize.Width() * propvalue[1] );
Size aPartArea = aTitleSize; Size aPartArea = aTitleSize;
Size aSize; Size aSize;
...@@ -1052,6 +1099,7 @@ Rectangle SdPage::GetTitleRect() const ...@@ -1052,6 +1099,7 @@ Rectangle SdPage::GetTitleRect() const
Rectangle SdPage::GetLayoutRect() const Rectangle SdPage::GetLayoutRect() const
{ {
Rectangle aLayoutRect; Rectangle aLayoutRect;
double propvalue[] = {0,0,0,0};
if (mePageKind != PK_HANDOUT) if (mePageKind != PK_HANDOUT)
{ {
...@@ -1059,22 +1107,25 @@ Rectangle SdPage::GetLayoutRect() const ...@@ -1059,22 +1107,25 @@ Rectangle SdPage::GetLayoutRect() const
Size aLayoutSize ( GetSize() ); Size aLayoutSize ( GetSize() );
aLayoutSize.Width() -= GetLftBorder() + GetRgtBorder(); aLayoutSize.Width() -= GetLftBorder() + GetRgtBorder();
aLayoutSize.Height() -= GetUppBorder() + GetLwrBorder(); aLayoutSize.Height() -= GetUppBorder() + GetLwrBorder();
rtl::OUString sPageKind = PageKindVector[mePageKind];
if (mePageKind == PK_STANDARD) if (mePageKind == PK_STANDARD)
{ {
aLayoutPos.X() += long( aLayoutSize.Width() * 0.05 ); getPresObjProp( *this ,"PRESOBJ_OUTLINE", sPageKind, propvalue);
aLayoutPos.Y() += long( aLayoutSize.Height() * 0.234 ); aLayoutPos.X() += long( aLayoutSize.Width() * propvalue[2] );
aLayoutSize.Width() = long( aLayoutSize.Width() * 0.9 ); aLayoutPos.Y() += long( aLayoutSize.Height() * propvalue[3] );
aLayoutSize.Height() = long( aLayoutSize.Height() * 0.58 ); aLayoutSize.Width() = long( aLayoutSize.Width() * propvalue[1] );
aLayoutSize.Height() = long( aLayoutSize.Height() * propvalue[0] );
aLayoutRect.SetPos(aLayoutPos); aLayoutRect.SetPos(aLayoutPos);
aLayoutRect.SetSize(aLayoutSize); aLayoutRect.SetSize(aLayoutSize);
} }
else if (mePageKind == PK_NOTES) else if (mePageKind == PK_NOTES)
{ {
aLayoutPos.X() += long( aLayoutSize.Width() * 0.1 ); getPresObjProp( *this, "PRESOBJ_NOTES", sPageKind, propvalue);
aLayoutPos.Y() += long( aLayoutSize.Height() * 0.475 ); aLayoutPos.X() += long( aLayoutSize.Width() * propvalue[2] );
aLayoutSize.Width() = long( aLayoutSize.Width() * 0.8 ); aLayoutPos.Y() += long( aLayoutSize.Height() * propvalue[3] );
aLayoutSize.Height() = long( aLayoutSize.Height() * 0.45 ); aLayoutSize.Width() = long( aLayoutSize.Width() * propvalue[1] );
aLayoutSize.Height() = long( aLayoutSize.Height() * propvalue[0] );
aLayoutRect.SetPos(aLayoutPos); aLayoutRect.SetPos(aLayoutPos);
aLayoutRect.SetSize(aLayoutSize); aLayoutRect.SetSize(aLayoutSize);
} }
......
<?xml version="1.0"?> <?xml version="1.0" encoding="UTF-8"?>
<!--
* 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/.
*
-->
<object-list> <object-list>
<object pagekind="PK_STANDARD" type="PRESOBJ_DATETIME" relative-height="0.069" relative-width="0.233" relative-posX="0.05" relative-posY="0.911"/> <object type="PRESOBJ_DATETIME">
<object pagekind="PK_HANDOUT" type="PRESOBJ_DATETIME" relative-height="0.434" relative-width="0.05" relative-posX="0.434" relative-posY="0"/> <object-prop pagekind="PK_STANDARD" relative-height="0.069" relative-width="0.233" relative-posX="0.05" relative-posY="0.911"/>
<object pagekind="PK_NOTES" type="PRESOBJ_DATETIME" relative-height="0.434" relative-width="0.05" relative-posX="0.434" relative-posY="0"/> <object-prop pagekind="PK_HANDOUT" relative-height="0.05" relative-width="0.434" relative-posX="0.434" relative-posY="0"/>
<object pagekind="PK_STANDARD" type="PRESOBJ_FOOTER" relative-height="0.069" relative-width="0.317" relative-posX="0.342" relative-posY="0.911"/> <object-prop pagekind="PK_NOTES" relative-height="0.05" relative-width="0.434" relative-posX="0.434" relative-posY="0"/>
<object pagekind="PK_HANDOUT" type="PRESOBJ_FOOTER" relative-height="0.434" relative-width="0.05" relative-posX="0" relative-posY="0.05"/> </object>
<object pagekind="PK_NOTES" type="PRESOBJ_FOOTER" relative-height="0.434" relative-width="0.05" relative-posX="0" relative-posY="0.05"/> <object type="PRESOBJ_FOOTER">
<object pagekind="PK_STANDARD" type="PRESOBJ_SLIDENUMBER" relative-height="0.069" relative-width="0.317" relative-posX="0.717" relative-posY="0.911"/> <object-prop pagekind="PK_STANDARD" relative-height="0.069" relative-width="0.317" relative-posX="0.342" relative-posY="0.911"/>
<object pagekind="PK_HANDOUT" type="PRESOBJ_SLIDENUMBER" relative-height="0.434" relative-width="0.05" relative-posX="0" relative-posY="0.05"/> <object-prop pagekind="PK_HANDOUT" relative-height="0.05" relative-width="0.434" relative-posX="0" relative-posY="0.05"/>
<object pagekind="PK_NOTES" type="PRESOBJ_SLIDENUMBER" relative-height="0.434" relative-width="0.05" relative-posX="0" relative-posY="0.05"/> <object-prop pagekind="PK_NOTES" relative-height="0.05" relative-width="0.434" relative-posX="0" relative-posY="0.05"/>
<object pagekind="PK_STANDARD" type="PRESOBJ_HEADER" relative-height="0.069" relative-width="0.317" relative-posX="0.717" relative-posY="0.911"/> </object>
<object pagekind="PK_HANDOUT" type="PRESOBJ_HEADER" relative-height="0.434" relative-width="0.05" relative-posX="0" relative-posY="0"/> <object type="PRESOBJ_SLIDENUMBER">
<object pagekind="PK_NOTES" type="PRESOBJ_HEADER" relative-height="0.434" relative-width="0.05" relative-posX="0" relative-posY="0"/> <object-prop pagekind="PK_STANDARD" relative-height="0.069" relative-width="0.233" relative-posX="0.717" relative-posY="0.911"/>
<object pagekind="PK_STANDARD" type="PRESOBJ_TITLE" relative-height="0.167" relative-width="0.9" relative-posX="0.05" relative-posY="0.0399"/> <object-prop pagekind="PK_HANDOUT" relative-height="0.05" relative-width="0.434" relative-posX="0.434" relative-posY="0.05"/>
<object pagekind="PK_NOTES" type="PRESOBJ_TITLE" relative-height="0.375" relative-width="1" relative-posX="0" relative-posY="0.076"/> <object-prop pagekind="PK_NOTES" relative-height="0.05" relative-width="0.434" relative-posX="0.434" relative-posY="0.05"/>
<object pagekind="PK_STANDARD" type="PRESOBJ_OUTLINE" relative-height="0.58" relative-width="0.9" relative-posX="0.05" relative-posY="0.234"/> </object>
<object pagekind="PK_NOTES" type="PRESOBJ_OUTLINE" relative-height="0.45" relative-width="0.1" relative-posX="0.1" relative-posY="0.475"/> <object type="PRESOBJ_HEADER">
<object-prop pagekind="PK_STANDARD" relative-height="0.069" relative-width="0.317" relative-posX="0.717" relative-posY="0.911"/>
<object-prop pagekind="PK_HANDOUT" relative-height="0.05" relative-width="0.434" relative-posX="0" relative-posY="0"/>
<object-prop pagekind="PK_NOTES" relative-height="0.05" relative-width="0.434" relative-posX="0" relative-posY="0"/>
</object>
<object type="PRESOBJ_TITLE">
<object-prop pagekind="PK_STANDARD" relative-height="0.167" relative-width="0.9" relative-posX="0.05" relative-posY="0.0399"/>
<object-prop pagekind="PK_NOTES" relative-height="0.375" relative-width="1" relative-posX="0" relative-posY="0.076"/>
</object>
<object type="PRESOBJ_OUTLINE">
<object-prop pagekind="PK_STANDARD" relative-height="0.58" relative-width="0.9" relative-posX="0.05" relative-posY="0.234"/>
</object>
<object type="PRESOBJ_NOTES">
<object-prop pagekind="PK_NOTES" relative-height="0.45" relative-width="0.8" relative-posX="0.1" relative-posY="0.475"/>
</object>
</object-list> </object-list>
\ No newline at end of file
...@@ -23,6 +23,7 @@ $(eval $(call gb_Package_add_file,test_unittest,unittest/install/share/config/so ...@@ -23,6 +23,7 @@ $(eval $(call gb_Package_add_file,test_unittest,unittest/install/share/config/so
$(eval $(call gb_Package_add_file,test_unittest,unittest/install/share/config/soffice.cfg/simpress/transitions-ogl.xml,user/config/soffice.cfg/simpress/transitions-ogl.xml)) $(eval $(call gb_Package_add_file,test_unittest,unittest/install/share/config/soffice.cfg/simpress/transitions-ogl.xml,user/config/soffice.cfg/simpress/transitions-ogl.xml))
$(eval $(call gb_Package_add_file,test_unittest,unittest/install/share/config/soffice.cfg/simpress/effects.xml,user/config/soffice.cfg/simpress/effects.xml)) $(eval $(call gb_Package_add_file,test_unittest,unittest/install/share/config/soffice.cfg/simpress/effects.xml,user/config/soffice.cfg/simpress/effects.xml))
$(eval $(call gb_Package_add_file,test_unittest,unittest/install/share/config/soffice.cfg/simpress/layoutlist.xml,user/config/soffice.cfg/simpress/layoutlist.xml)) $(eval $(call gb_Package_add_file,test_unittest,unittest/install/share/config/soffice.cfg/simpress/layoutlist.xml,user/config/soffice.cfg/simpress/layoutlist.xml))
$(eval $(call gb_Package_add_file,test_unittest,unittest/install/share/config/soffice.cfg/simpress/objectlist.xml,user/config/soffice.cfg/simpress/objectlist.xml))
$(eval $(call gb_Package_add_file,test_unittest,unittest/user/config/psetupl.xpm,user/config/psetupl.xpm)) $(eval $(call gb_Package_add_file,test_unittest,unittest/user/config/psetupl.xpm,user/config/psetupl.xpm))
# vim: set noet sw=4 ts=4: # vim: set noet sw=4 ts=4:
<?xml version="1.0" encoding="UTF-8"?>
<!--
* 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/.
*
-->
<object-list>
<object type="PRESOBJ_DATETIME">
<object-prop pagekind="PK_STANDARD" relative-height="0.069" relative-width="0.233" relative-posX="0.05" relative-posY="0.911"/>
<object-prop pagekind="PK_HANDOUT" relative-height="0.05" relative-width="0.434" relative-posX="0.434" relative-posY="0"/>
<object-prop pagekind="PK_NOTES" relative-height="0.05" relative-width="0.434" relative-posX="0.434" relative-posY="0"/>
</object>
<object type="PRESOBJ_FOOTER">
<object-prop pagekind="PK_STANDARD" relative-height="0.069" relative-width="0.317" relative-posX="0.342" relative-posY="0.911"/>
<object-prop pagekind="PK_HANDOUT" relative-height="0.05" relative-width="0.434" relative-posX="0" relative-posY="0.05"/>
<object-prop pagekind="PK_NOTES" relative-height="0.05" relative-width="0.434" relative-posX="0" relative-posY="0.05"/>
</object>
<object type="PRESOBJ_SLIDENUMBER">
<object-prop pagekind="PK_STANDARD" relative-height="0.069" relative-width="0.233" relative-posX="0.717" relative-posY="0.911"/>
<object-prop pagekind="PK_HANDOUT" relative-height="0.05" relative-width="0.434" relative-posX="0.434" relative-posY="0.05"/>
<object-prop pagekind="PK_NOTES" relative-height="0.05" relative-width="0.434" relative-posX="0.434" relative-posY="0.05"/>
</object>
<object type="PRESOBJ_HEADER">
<object-prop pagekind="PK_STANDARD" relative-height="0.069" relative-width="0.317" relative-posX="0.717" relative-posY="0.911"/>
<object-prop pagekind="PK_HANDOUT" relative-height="0.05" relative-width="0.434" relative-posX="0" relative-posY="0"/>
<object-prop pagekind="PK_NOTES" relative-height="0.05" relative-width="0.434" relative-posX="0" relative-posY="0"/>
</object>
<object type="PRESOBJ_TITLE">
<object-prop pagekind="PK_STANDARD" relative-height="0.167" relative-width="0.9" relative-posX="0.05" relative-posY="0.0399"/>
<object-prop pagekind="PK_NOTES" relative-height="0.375" relative-width="1" relative-posX="0" relative-posY="0.076"/>
</object>
<object type="PRESOBJ_OUTLINE">
<object-prop pagekind="PK_STANDARD" relative-height="0.58" relative-width="0.9" relative-posX="0.05" relative-posY="0.234"/>
</object>
<object type="PRESOBJ_NOTES">
<object-prop pagekind="PK_NOTES" relative-height="0.45" relative-width="0.8" relative-posX="0.1" relative-posY="0.475"/>
</object>
</object-list>
\ No newline at end of file
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