summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVishv Brahmbhatt <vishvbrahmbhatt19@gmail.com>2013-08-28 01:52:17 +0530
committerThorsten Behrens <tbehrens@suse.com>2013-09-10 13:14:30 +0200
commitd50bd55c5d78dc10d40be502f8d6638bcc0ce890 (patch)
treee65f13d467edd623699ebcbb3c6ae30f98eeae7b
parentb1e464999e387e44f0e021d52f2673c2fe7822a0 (diff)
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
-rw-r--r--comphelper/Library_comphelper.mk1
-rw-r--r--comphelper/source/misc/expandmacro.cxx59
-rw-r--r--include/comphelper/expandmacro.hxx57
-rw-r--r--officecfg/registry/schema/org/openoffice/Office/Impress.xcs14
-rw-r--r--sd/Package_xml.mk1
-rw-r--r--sd/inc/drawdoc.hxx8
-rw-r--r--sd/source/core/drawdoc.cxx64
-rw-r--r--sd/source/core/sdpage.cxx271
-rw-r--r--sd/xml/objectlist.xml56
-rw-r--r--test/Package_unittest.mk1
-rw-r--r--test/user-template/user/config/soffice.cfg/simpress/objectlist.xml41
11 files changed, 417 insertions, 156 deletions
diff --git a/comphelper/Library_comphelper.mk b/comphelper/Library_comphelper.mk
index 09a68895f81f..4b303386b953 100644
--- a/comphelper/Library_comphelper.mk
+++ b/comphelper/Library_comphelper.mk
@@ -86,6 +86,7 @@ $(eval $(call gb_Library_add_exception_objects,comphelper,\
comphelper/source/misc/documentiologring \
comphelper/source/misc/evtlistenerhlp \
comphelper/source/misc/evtmethodhelper \
+ comphelper/source/misc/expandmacro \
comphelper/source/misc/ihwrapnofilter \
comphelper/source/misc/instancelocker \
comphelper/source/misc/interaction \
diff --git a/comphelper/source/misc/expandmacro.cxx b/comphelper/source/misc/expandmacro.cxx
new file mode 100644
index 000000000000..a7eae4b12548
--- /dev/null
+++ b/comphelper/source/misc/expandmacro.cxx
@@ -0,0 +1,59 @@
+/* -*- 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;
+ }
+}
diff --git a/include/comphelper/expandmacro.hxx b/include/comphelper/expandmacro.hxx
new file mode 100644
index 000000000000..efd255249aa2
--- /dev/null
+++ b/include/comphelper/expandmacro.hxx
@@ -0,0 +1,57 @@
+/* -*- 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
diff --git a/officecfg/registry/schema/org/openoffice/Office/Impress.xcs b/officecfg/registry/schema/org/openoffice/Office/Impress.xcs
index c971846a8ff2..b740aca6ce04 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Impress.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Impress.xcs
@@ -482,6 +482,20 @@
</info>
<value oor:separator=";">vnd.sun.star.expand:$BRAND_BASE_DIR/$BRAND_SHARE_SUBDIR/config/soffice.cfg/simpress/layoutlist.xml</value>
</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">
<!-- OldPath: -->
<!-- OldLocation: -->
diff --git a/sd/Package_xml.mk b/sd/Package_xml.mk
index 694d452e87dc..ae635d47dfd3 100644
--- a/sd/Package_xml.mk
+++ b/sd/Package_xml.mk
@@ -15,6 +15,7 @@ $(eval $(call gb_Package_add_files,sd_xml,$(LIBO_SHARE_FOLDER)/config/soffice.cf
effects.xml \
transitions.xml \
layoutlist.xml \
+ objectlist.xml \
))
# vim: set noet sw=4 ts=4:
diff --git a/sd/inc/drawdoc.hxx b/sd/inc/drawdoc.hxx
index 22fb05b58eb2..85f4ab276837 100644
--- a/sd/inc/drawdoc.hxx
+++ b/sd/inc/drawdoc.hxx
@@ -192,6 +192,9 @@ private:
std::vector<com::sun::star::uno::Reference<
com::sun::star::xml::dom::XNode> > maLayoutInfo;
+ std::vector<com::sun::star::uno::Reference<
+ com::sun::star::xml::dom::XNode> > maPresObjectInfo;
+
bool mbUseEmbedFonts;
protected:
@@ -272,6 +275,10 @@ public:
com::sun::star::xml::dom::XNode> >& GetLayoutVector() const
{ 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
This method inserts whole pages into this document, either
@@ -317,6 +324,7 @@ public:
Whether the replace operation should take the name from the new
page, or preserve the old name
*/
+
sal_Bool InsertBookmarkAsPage(const std::vector<OUString> &rBookmarkList,
std::vector<OUString> *pExchangeList,
sal_Bool bLink, sal_Bool bReplace, sal_uInt16 nPgPos,
diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx
index 6c20c7e8e0e0..e327215f8968 100644
--- a/sd/source/core/drawdoc.cxx
+++ b/sd/source/core/drawdoc.cxx
@@ -70,11 +70,9 @@
#include <com/sun/star/xml/dom/XNamedNodeMap.hpp>
#include <com/sun/star/xml/dom/DocumentBuilder.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/uri.hxx>
-#include <osl/file.h>
+#include <comphelper/expandmacro.hxx>
#include <editeng/outliner.hxx>
#include "drawdoc.hxx"
@@ -105,9 +103,7 @@ using namespace ::com::sun::star::linguistic2;
using namespace com::sun::star::xml::dom;
using ::com::sun::star::uno::Reference;
-using ::com::sun::star::io::XInputStream;
using ::com::sun::star::lang::XMultiServiceFactory;
-using ::com::sun::star::container::XNameAccess;
using ::com::sun::star::beans::PropertyValue;
TYPEINIT1( SdDrawDocument, FmFormModel );
@@ -183,6 +179,7 @@ SdDrawDocument::SdDrawDocument(DocumentType eType, SfxObjectShell* pDrDocSh)
new ImpMasterPageListWatcher(*this));
InitLayoutVector();
+ InitObjectVector();
SetObjectShell(pDrDocSh); // for VCDrawModel
if (mpDocSh)
@@ -995,36 +992,16 @@ void SdDrawDocument::InitLayoutVector()
{
const Reference<css::uno::XComponentContext> xContext(
::comphelper::getProcessComponentContext() );
- Reference< util::XMacroExpander > xMacroExpander(
- util::theMacroExpander::get( xContext ) );
// get file list from configuration
Sequence< rtl::OUString > aFiles(
officecfg::Office::Impress::Misc::LayoutListFiles::get(xContext) );
- // loop over each file in sequence
- rtl::OUString aFilename;
+ rtl::OUString sFilename;
for( sal_Int32 i=0; i < aFiles.getLength(); ++i )
{
- aFilename = aFiles[i];
- 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;
- }
+ rtl::OUString filepath = aFiles[i];
+ sFilename= ::comphelper::getExpandedFilePath(filepath,xContext);
// load layout file into DOM
Reference< XMultiServiceFactory > xServiceFactory(
@@ -1033,7 +1010,7 @@ void SdDrawDocument::InitLayoutVector()
DocumentBuilder::create( comphelper::getComponentContext (xServiceFactory) ));
// 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 int nElements = layoutlist->getLength();
for(int index=0; index < nElements; index++)
@@ -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: */
diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx
index 47dbc71202b0..bd806eeb15e8 100644
--- a/sd/source/core/sdpage.cxx
+++ b/sd/source/core/sdpage.cxx
@@ -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)
{
+ double propvalue[] = {0,0,0,0};
+
if( eObjKind == PRESOBJ_TITLE )
{
Rectangle aTitleRect( GetTitleRect() );
@@ -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 ) )
{
+ rtl::OUString sObjKind = PresObjKindVector[eObjKind];
+ rtl::OUString sPageKind = PageKindVector[mePageKind];
// create footer objects for standard master page
if( mePageKind == PK_STANDARD )
{
const long nLftBorder = GetLftBorder();
const long nUppBorder = GetUppBorder();
- Size aPageSize ( GetSize() );
- aPageSize.Width() -= nLftBorder + GetRgtBorder();
- aPageSize.Height() -= nUppBorder + GetLwrBorder();
+ Point aPos ( nLftBorder, nUppBorder );
+ Size aSize ( GetSize() );
- const int Y = long(nUppBorder + aPageSize.Height() * 0.911);
- const int W1 = long(aPageSize.Width() * 0.233);
- const int W2 = long(aPageSize.Width() * 0.317);
- const int H = long(aPageSize.Height() * 0.069);
+ aSize.Width() -= nLftBorder + GetRgtBorder();
+ aSize.Height() -= nUppBorder + GetLwrBorder();
- if( eObjKind == PRESOBJ_DATETIME )
- {
- Point aPos( long(nLftBorder+(aPageSize.Width()*0.05)), Y );
- Size aSize( W1, H );
- Rectangle aRect( aPos, aSize );
- return CreatePresObj( PRESOBJ_DATETIME, sal_False, aRect, bInsert );
- }
- 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 )
+ getPresObjProp( *this, sObjKind, sPageKind, propvalue);
+ aPos.X() += long( aSize.Width() * propvalue[2] );
+ aPos.Y() += long( aSize.Height() * propvalue[3] );
+ aSize.Width() = long( aSize.Width() * propvalue[1] );
+ aSize.Height() = long( aSize.Height() * propvalue[0] );
+
+ if(eObjKind == PRESOBJ_HEADER )
{
- Point aPos( long(nLftBorder+(aPageSize.Width()*0.717)), Y );
- Size aSize( W1, H );
- Rectangle aRect( aPos, aSize );
- return CreatePresObj( PRESOBJ_SLIDENUMBER, sal_False, aRect, bInsert );
+ OSL_FAIL( "SdPage::CreateDefaultPresObj() - can't create a header placeholder for a slide master" );
+ return NULL;
}
else
{
- OSL_FAIL( "SdPage::CreateDefaultPresObj() - can't create a header placeholder for a slide master" );
- return NULL;
+ Rectangle aRect( aPos, aSize );
+ return CreatePresObj( eObjKind, sal_False, aRect, bInsert );
}
}
else
@@ -918,44 +979,24 @@ SdrObject* SdPage::CreateDefaultPresObj(PresObjKind eObjKind, bool bInsert)
aPageSize.Width() -= GetLftBorder() + GetRgtBorder();
aPageSize.Height() -= GetUppBorder() + GetLwrBorder();
+ Point aPosition ( GetLftBorder(), GetUppBorder() );
- const int NOTES_HEADER_FOOTER_WIDTH = long(aPageSize.Width() * 0.434);
- const int NOTES_HEADER_FOOTER_HEIGHT = long(aPageSize.Height() * 0.05);
-
+ getPresObjProp( *this, sObjKind, sPageKind, propvalue);
+ 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 );
+ 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 );
- return CreatePresObj( PRESOBJ_SLIDENUMBER, sal_False, aRect, bInsert );
- }
-
- OSL_FAIL("SdPage::CreateDefaultPresObj() - this should not happen!");
- return NULL;
+ Rectangle aRect( aPos, aSize );
+ return CreatePresObj( eObjKind, sal_False, aRect, bInsert );
}
}
else
@@ -974,6 +1015,7 @@ SdrObject* SdPage::CreateDefaultPresObj(PresObjKind eObjKind, bool bInsert)
Rectangle SdPage::GetTitleRect() const
{
Rectangle aTitleRect;
+ double propvalue[] = {0,0,0,0};
if (mePageKind != PK_HANDOUT)
{
@@ -984,21 +1026,26 @@ Rectangle SdPage::GetTitleRect() const
Size aTitleSize ( GetSize() );
aTitleSize.Width() -= GetLftBorder() + GetRgtBorder();
aTitleSize.Height() -= GetUppBorder() + GetLwrBorder();
+ rtl::OUString sPageKind = PageKindVector[mePageKind];
if (mePageKind == PK_STANDARD)
- {
- aTitlePos.X() += long( aTitleSize.Width() * 0.05 );
- aTitlePos.Y() += long( aTitleSize.Height() * 0.0399 );
- aTitleSize.Width() = long( aTitleSize.Width() * 0.9 );
- aTitleSize.Height() = long( aTitleSize.Height() * 0.167 );
+ {
+ getPresObjProp( *this , "PRESOBJ_TITLE" ,sPageKind, propvalue);
+ aTitlePos.X() += long( aTitleSize.Width() * propvalue[2] );
+ aTitlePos.Y() += long( aTitleSize.Height() * propvalue[3] );
+ aTitleSize.Width() = long( aTitleSize.Width() * propvalue[1] );
+ aTitleSize.Height() = long( aTitleSize.Height() * propvalue[0] );
}
else if (mePageKind == PK_NOTES)
{
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
- 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 aSize;
@@ -1052,6 +1099,7 @@ Rectangle SdPage::GetTitleRect() const
Rectangle SdPage::GetLayoutRect() const
{
Rectangle aLayoutRect;
+ double propvalue[] = {0,0,0,0};
if (mePageKind != PK_HANDOUT)
{
@@ -1059,22 +1107,25 @@ Rectangle SdPage::GetLayoutRect() const
Size aLayoutSize ( GetSize() );
aLayoutSize.Width() -= GetLftBorder() + GetRgtBorder();
aLayoutSize.Height() -= GetUppBorder() + GetLwrBorder();
+ rtl::OUString sPageKind = PageKindVector[mePageKind];
if (mePageKind == PK_STANDARD)
{
- aLayoutPos.X() += long( aLayoutSize.Width() * 0.05 );
- aLayoutPos.Y() += long( aLayoutSize.Height() * 0.234 );
- aLayoutSize.Width() = long( aLayoutSize.Width() * 0.9 );
- aLayoutSize.Height() = long( aLayoutSize.Height() * 0.58 );
+ getPresObjProp( *this ,"PRESOBJ_OUTLINE", sPageKind, propvalue);
+ aLayoutPos.X() += long( aLayoutSize.Width() * propvalue[2] );
+ aLayoutPos.Y() += long( aLayoutSize.Height() * propvalue[3] );
+ aLayoutSize.Width() = long( aLayoutSize.Width() * propvalue[1] );
+ aLayoutSize.Height() = long( aLayoutSize.Height() * propvalue[0] );
aLayoutRect.SetPos(aLayoutPos);
aLayoutRect.SetSize(aLayoutSize);
}
else if (mePageKind == PK_NOTES)
{
- aLayoutPos.X() += long( aLayoutSize.Width() * 0.1 );
- aLayoutPos.Y() += long( aLayoutSize.Height() * 0.475 );
- aLayoutSize.Width() = long( aLayoutSize.Width() * 0.8 );
- aLayoutSize.Height() = long( aLayoutSize.Height() * 0.45 );
+ getPresObjProp( *this, "PRESOBJ_NOTES", sPageKind, propvalue);
+ aLayoutPos.X() += long( aLayoutSize.Width() * propvalue[2] );
+ aLayoutPos.Y() += long( aLayoutSize.Height() * propvalue[3] );
+ aLayoutSize.Width() = long( aLayoutSize.Width() * propvalue[1] );
+ aLayoutSize.Height() = long( aLayoutSize.Height() * propvalue[0] );
aLayoutRect.SetPos(aLayoutPos);
aLayoutRect.SetSize(aLayoutSize);
}
@@ -1170,53 +1221,53 @@ rtl::OUString enumtoString(AutoLayout aut)
switch (aut)
{
case AUTOLAYOUT_TITLE_CONTENT:
- retstr="AUTOLAYOUT_TITLE_CONTENT";
- break;
+ retstr="AUTOLAYOUT_TITLE_CONTENT";
+ break;
case AUTOLAYOUT_TITLE_CONTENT_OVER_CONTENT:
- retstr="AUTOLAYOUT_TITLE_CONTENT_OVER_CONTENT";
- break;
+ retstr="AUTOLAYOUT_TITLE_CONTENT_OVER_CONTENT";
+ break;
case AUTOLAYOUT_TITLE_CONTENT_2CONTENT:
- retstr="AUTOLAYOUT_TITLE_CONTENT_2CONTENT";
- break;
+ retstr="AUTOLAYOUT_TITLE_CONTENT_2CONTENT";
+ break;
case AUTOLAYOUT_TITLE_4CONTENT:
- retstr="AUTOLAYOUT_TITLE_4CONTENT";
- break;
+ retstr="AUTOLAYOUT_TITLE_4CONTENT";
+ break;
case AUTOLAYOUT_ONLY_TEXT:
- retstr="AUTOLAYOUT_ONLY_TEXT";
- break;
+ retstr="AUTOLAYOUT_ONLY_TEXT";
+ break;
case AUTOLAYOUT_TITLE_ONLY:
- retstr="AUTOLAYOUT_TITLE_ONLY";
- break;
+ retstr="AUTOLAYOUT_TITLE_ONLY";
+ break;
case AUTOLAYOUT_TITLE_6CONTENT:
- retstr="AUTOLAYOUT_TITLE_6CONTENT";
- break;
+ retstr="AUTOLAYOUT_TITLE_6CONTENT";
+ break;
case AUTOLAYOUT__START:
- retstr="AUTOLAYOUT__START";
- break;
+ retstr="AUTOLAYOUT__START";
+ break;
case AUTOLAYOUT_TITLE_2CONTENT_CONTENT:
- retstr="AUTOLAYOUT_TITLE_2CONTENT_CONTENT";
- break;
+ retstr="AUTOLAYOUT_TITLE_2CONTENT_CONTENT";
+ break;
case AUTOLAYOUT_TITLE_2CONTENT_OVER_CONTENT:
- retstr="AUTOLAYOUT_TITLE_2CONTENT_OVER_CONTENT";
- break;
+ retstr="AUTOLAYOUT_TITLE_2CONTENT_OVER_CONTENT";
+ break;
case AUTOLAYOUT_TITLE_2CONTENT:
- retstr="AUTOLAYOUT_TITLE_2CONTENT";
- break;
+ retstr="AUTOLAYOUT_TITLE_2CONTENT";
+ break;
case AUTOLAYOUT_VTITLE_VCONTENT:
- retstr="AUTOLAYOUT_VTITLE_VCONTENT";
- break;
+ retstr="AUTOLAYOUT_VTITLE_VCONTENT";
+ break;
case AUTOLAYOUT_VTITLE_VCONTENT_OVER_VCONTENT:
- retstr="AUTOLAYOUT_VTITLE_VCONTENT_OVER_VCONTENT";
- break;
+ retstr="AUTOLAYOUT_VTITLE_VCONTENT_OVER_VCONTENT";
+ break;
case AUTOLAYOUT_TITLE_VCONTENT:
- retstr="AUTOLAYOUT_TITLE_VCONTENT";
- break;
+ retstr="AUTOLAYOUT_TITLE_VCONTENT";
+ break;
case AUTOLAYOUT_TITLE_2VTEXT:
- retstr="AUTOLAYOUT_TITLE_2VTEXT";
- break;
+ retstr="AUTOLAYOUT_TITLE_2VTEXT";
+ break;
default:
- retstr="unknown";
- break;
+ retstr="unknown";
+ break;
// case AUTOLAYOUT_TITLE_4SCONTENT: return "AUTOLAYOUT_TITLE_4SCONTENT";
}
return retstr;
diff --git a/sd/xml/objectlist.xml b/sd/xml/objectlist.xml
index b354185927c3..40ecec350255 100644
--- a/sd/xml/objectlist.xml
+++ b/sd/xml/objectlist.xml
@@ -1,19 +1,41 @@
-<?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 pagekind="PK_STANDARD" type="PRESOBJ_DATETIME" relative-height="0.069" relative-width="0.233" relative-posX="0.05" relative-posY="0.911"/>
- <object pagekind="PK_HANDOUT" type="PRESOBJ_DATETIME" relative-height="0.434" relative-width="0.05" relative-posX="0.434" relative-posY="0"/>
- <object pagekind="PK_NOTES" type="PRESOBJ_DATETIME" relative-height="0.434" relative-width="0.05" 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 pagekind="PK_HANDOUT" type="PRESOBJ_FOOTER" relative-height="0.434" relative-width="0.05" relative-posX="0" relative-posY="0.05"/>
- <object pagekind="PK_NOTES" type="PRESOBJ_FOOTER" relative-height="0.434" relative-width="0.05" relative-posX="0" relative-posY="0.05"/>
- <object pagekind="PK_STANDARD" type="PRESOBJ_SLIDENUMBER" relative-height="0.069" relative-width="0.317" relative-posX="0.717" 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 pagekind="PK_NOTES" type="PRESOBJ_SLIDENUMBER" relative-height="0.434" relative-width="0.05" 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 pagekind="PK_HANDOUT" type="PRESOBJ_HEADER" relative-height="0.434" relative-width="0.05" relative-posX="0" relative-posY="0"/>
- <object pagekind="PK_NOTES" type="PRESOBJ_HEADER" relative-height="0.434" relative-width="0.05" relative-posX="0" relative-posY="0"/>
- <object pagekind="PK_STANDARD" type="PRESOBJ_TITLE" relative-height="0.167" relative-width="0.9" relative-posX="0.05" relative-posY="0.0399"/>
- <object pagekind="PK_NOTES" type="PRESOBJ_TITLE" relative-height="0.375" relative-width="1" relative-posX="0" relative-posY="0.076"/>
- <object pagekind="PK_STANDARD" type="PRESOBJ_OUTLINE" relative-height="0.58" relative-width="0.9" relative-posX="0.05" relative-posY="0.234"/>
- <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_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
diff --git a/test/Package_unittest.mk b/test/Package_unittest.mk
index cbab559f726f..2a992efd22c7 100644
--- a/test/Package_unittest.mk
+++ b/test/Package_unittest.mk
@@ -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/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/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))
# vim: set noet sw=4 ts=4:
diff --git a/test/user-template/user/config/soffice.cfg/simpress/objectlist.xml b/test/user-template/user/config/soffice.cfg/simpress/objectlist.xml
new file mode 100644
index 000000000000..40ecec350255
--- /dev/null
+++ b/test/user-template/user/config/soffice.cfg/simpress/objectlist.xml
@@ -0,0 +1,41 @@
+<?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