summaryrefslogtreecommitdiffstats
path: root/filter
diff options
context:
space:
mode:
authorMarco Cecchetti <mrcekets@gmail.com>2011-07-08 05:38:42 +0200
committerThorsten Behrens <tbehrens@novell.com>2011-07-08 05:43:23 +0200
commit99f33e30dd55cbfa3296bbda206f2230e31e0c42 (patch)
tree0111dc839976abd686f8941498d339563481e39e /filter
parentRemove online registration related code (diff)
downloadcore-99f33e30dd55cbfa3296bbda206f2230e31e0c42.tar.gz
core-99f33e30dd55cbfa3296bbda206f2230e31e0c42.zip
Enhancing svg export
* Add support for exporting any subset of slides from an Impress presentation to a svg document * Adding support for exporting meta information (for each slide) on the master slide placeholders (slide number, date/time, footer). * Implemented a slide index. Supported browser Firefox 4.x, Chrome 12.x. * Removed some dead source code; metadata info is generated before (shape, GDIMetaFile) map * Implemented a glyph workaround for Webkit based browsers. * Fixed the following bug: exporting a single slide is broken. * Updated to the latest version of the JavaScript based presentation engine. * GSoC midterm result
Diffstat (limited to 'filter')
-rw-r--r--filter/source/svg/makefile.mk3
-rw-r--r--filter/source/svg/svgexport.cxx1442
-rw-r--r--filter/source/svg/svgfilter.cxx130
-rw-r--r--filter/source/svg/svgfilter.hxx128
-rw-r--r--filter/source/svg/svgscript.hxx1716
-rw-r--r--filter/source/svg/svgwriter.cxx18
-rw-r--r--filter/source/svg/svgwriter.hxx55
7 files changed, 2894 insertions, 598 deletions
diff --git a/filter/source/svg/makefile.mk b/filter/source/svg/makefile.mk
index 4c914539299d..425eae9489a2 100644
--- a/filter/source/svg/makefile.mk
+++ b/filter/source/svg/makefile.mk
@@ -84,7 +84,8 @@ SHL1STDLIBS=\
$(CPPUHELPERLIB) \
$(CPPULIB) \
$(SALLIB) \
- $(LIBXML)
+ $(LIBXML) \
+ $(SVLLIB)
SHL1DEPN=
SHL1IMPLIB= i$(SHL1TARGET)
diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx
index b59830fb1743..1d43cc23ae19 100644
--- a/filter/source/svg/svgexport.cxx
+++ b/filter/source/svg/svgexport.cxx
@@ -47,9 +47,271 @@
#include <editeng/outliner.hxx>
#include <editeng/flditem.hxx>
#include <editeng/numitem.hxx>
+#include <comphelper/processfactory.hxx>
+#include <i18npool/lang.h>
+#include <svl/zforlist.hxx>
using ::rtl::OUString;
+
+
+
+// -------------------------------
+// - ooo elements and attributes -
+// -------------------------------
+
+#define NSPREFIX "ooo:"
+
+// ooo xml elements
+static const char aOOOElemMetaSlides[] = NSPREFIX "meta_slides";
+static const char aOOOElemMetaSlide[] = NSPREFIX "meta_slide";
+static const char aOOOElemTextField[] = NSPREFIX "text_field";
+
+// ooo xml attributes for meta_slides
+static const char aOOOAttrNumberOfSlides[] = NSPREFIX "number-of-slides";
+static const char aOOOAttrNumberingType[] = NSPREFIX "page-numbering-type";
+
+// ooo xml attributes for meta_slide
+static const char aOOOAttrSlide[] = NSPREFIX "slide";
+static const char aOOOAttrMaster[] = NSPREFIX "master";
+static const char aOOOAttrBackgroundVisibility[] = NSPREFIX "background-visibility";
+static const char aOOOAttrMasterObjectsVisibility[] = NSPREFIX "master-objects-visibility";
+static const char aOOOAttrPageNumberVisibility[] = NSPREFIX "page-number-visibility";
+static const char aOOOAttrDateTimeVisibility[] = NSPREFIX "date-time-visibility";
+static const char aOOOAttrFooterVisibility[] = NSPREFIX "footer-visibility";
+static const char aOOOAttrDateTimeField[] = NSPREFIX "date-time-field";
+static const char aOOOAttrFooterField[] = NSPREFIX "footer-field";
+static const char aOOOAttrHeaderField[] = NSPREFIX "header-field";
+
+// ooo xml attributes for date_time_field
+static const char aOOOAttrDateTimeFormat[] = NSPREFIX "date-time-format";
+
+// ooo xml attributes for Placeholder Shapes
+static const char aOOOAttrTextAdjust[] = NSPREFIX "text-adjust";
+
+
+
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * - Text Field Class Hierarchy - *
+ * *
+ * This is a set of classes for exporting text field meta info. *
+ * *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#define TEXT_FIELD_GET_CLASS_NAME_METHOD( class_name ) \
+virtual ::rtl::OUString getClassName() const \
+{ \
+ static const char className[] = #class_name; \
+ return B2UCONST( className ); \
+}
+
+
+class TextField
+{
+protected:
+ SVGFilter::ObjectSet mMasterPageSet;
+public:
+
+ TEXT_FIELD_GET_CLASS_NAME_METHOD( TextField )
+ virtual sal_Bool equalTo( const TextField & aTextField ) const = 0;
+ virtual void growCharSet( SVGFilter::UCharSetMapMap & aTextFieldCharSets ) const = 0;
+ virtual void elementExport( SVGExport* pSVGExport ) const
+ {
+ pSVGExport->AddAttribute( XML_NAMESPACE_NONE, "class", getClassName() );
+ }
+ void insertMasterPage( Reference< XDrawPage> xMasterPage )
+ {
+ mMasterPageSet.insert( xMasterPage );
+ }
+ virtual ~TextField() {}
+protected:
+ void implGrowCharSet( SVGFilter::UCharSetMapMap & aTextFieldCharSets, ::rtl::OUString sText, ::rtl::OUString sTextFieldId ) const
+ {
+ const sal_Unicode * ustr = sText.getStr();
+ sal_Int32 nLength = sText.getLength();
+ SVGFilter::ObjectSet::const_iterator aMasterPageIt = mMasterPageSet.begin();
+ for( ; aMasterPageIt != mMasterPageSet.end(); ++aMasterPageIt )
+ {
+ const Reference< XInterface > & xMasterPage = *aMasterPageIt;
+ for( sal_Int32 i = 0; i < nLength; ++i )
+ {
+ aTextFieldCharSets[ xMasterPage ][ sTextFieldId ].insert( ustr[i] );
+ }
+ }
+ }
+};
+
+class FixedTextField : public TextField
+{
+public:
+ ::rtl::OUString text;
+
+ TEXT_FIELD_GET_CLASS_NAME_METHOD( FixedTextField )
+ virtual sal_Bool equalTo( const TextField & aTextField ) const
+ {
+ if( const FixedTextField* aFixedTextField = dynamic_cast< const FixedTextField* >( &aTextField ) )
+ {
+ return ( text == aFixedTextField->text );
+ }
+ return false;
+ }
+ virtual void elementExport( SVGExport* pSVGExport ) const
+ {
+ TextField::elementExport( pSVGExport );
+ SvXMLElementExport aExp( *pSVGExport, XML_NAMESPACE_NONE, "g", sal_True, sal_True );
+ pSVGExport->GetDocHandler()->characters( text );
+ }
+ virtual ~FixedTextField() {}
+};
+
+class FixedDateTimeField : public FixedTextField
+{
+public:
+ FixedDateTimeField() {}
+ TEXT_FIELD_GET_CLASS_NAME_METHOD( FixedDateTimeField )
+ virtual void growCharSet( SVGFilter::UCharSetMapMap & aTextFieldCharSets ) const
+ {
+ static const ::rtl::OUString sFieldId = B2UCONST( aOOOAttrDateTimeField );
+ implGrowCharSet( aTextFieldCharSets, text, sFieldId );
+ }
+ virtual ~FixedDateTimeField() {}
+};
+
+class FooterField : public FixedTextField
+{
+public:
+ FooterField() {}
+ TEXT_FIELD_GET_CLASS_NAME_METHOD( FooterField )
+ virtual void growCharSet( SVGFilter::UCharSetMapMap & aTextFieldCharSets ) const
+ {
+ static const ::rtl::OUString sFieldId = B2UCONST( aOOOAttrFooterField );
+ implGrowCharSet( aTextFieldCharSets, text, sFieldId );
+ }
+ virtual ~FooterField() {}
+};
+
+class HeaderField : public FixedTextField
+{
+public:
+ HeaderField() {}
+ TEXT_FIELD_GET_CLASS_NAME_METHOD( HeaderField )
+ virtual void growCharSet( SVGFilter::UCharSetMapMap & aTextFieldCharSets ) const
+ {
+ static const ::rtl::OUString sFieldId = B2UCONST( aOOOAttrHeaderField );
+ implGrowCharSet( aTextFieldCharSets, text, sFieldId );
+ }
+ virtual ~HeaderField() {}
+};
+
+class VariableTextField : public TextField
+{
+public:
+ TEXT_FIELD_GET_CLASS_NAME_METHOD( VariableTextField )
+ virtual ~VariableTextField() {}
+};
+
+class VariableDateTimeField : public VariableTextField
+{
+public:
+ sal_Int32 format;
+
+ VariableDateTimeField() {}
+ TEXT_FIELD_GET_CLASS_NAME_METHOD( VariableDateTimeField )
+ virtual sal_Bool equalTo( const TextField & aTextField ) const
+ {
+ if( const VariableDateTimeField* aField = dynamic_cast< const VariableDateTimeField* >( &aTextField ) )
+ {
+ return ( format == aField->format );
+ }
+ return false;
+ }
+ virtual void elementExport( SVGExport* pSVGExport ) const
+ {
+ VariableTextField::elementExport( pSVGExport );
+ OUString sDateFormat, sTimeFormat;
+ SvxDateFormat eDateFormat = (SvxDateFormat)( format & 0x0f );
+ if( eDateFormat )
+ {
+ switch( eDateFormat )
+ {
+ case SVXDATEFORMAT_STDSMALL: ;
+ case SVXDATEFORMAT_A: // 13.02.96
+ sDateFormat = B2UCONST( "" );
+ break;
+ case SVXDATEFORMAT_C: // 13.Feb 1996
+ sDateFormat = B2UCONST( "" );
+ break;
+ case SVXDATEFORMAT_D: // 13.February 1996
+ sDateFormat = B2UCONST( "" );
+ break;
+ case SVXDATEFORMAT_E: // Tue, 13.February 1996
+ sDateFormat = B2UCONST( "" );
+ break;
+ case SVXDATEFORMAT_STDBIG: ;
+ case SVXDATEFORMAT_F: // Tuesday, 13.February 1996
+ sDateFormat = B2UCONST( "" );
+ break;
+ // default case
+ case SVXDATEFORMAT_B: ; // 13.02.1996
+ default:
+ sDateFormat = B2UCONST( "" );
+ break;
+ }
+ }
+
+ SvxTimeFormat eTimeFormat = (SvxTimeFormat)( ( format >> 4 ) & 0x0f );
+ if( eTimeFormat )
+ {
+ switch( eTimeFormat )
+ {
+ case SVXTIMEFORMAT_24_HMS: // 13:49:38
+ sTimeFormat = B2UCONST( "" );
+ break;
+ case SVXTIMEFORMAT_AM_HM: ; // 01:49 PM
+ case SVXTIMEFORMAT_12_HM:
+ sTimeFormat = B2UCONST( "" );
+ break;
+ case SVXTIMEFORMAT_AM_HMS: ; // 01:49:38 PM
+ case SVXTIMEFORMAT_12_HMS:
+ sTimeFormat = B2UCONST( "" );
+ break;
+ // default case
+ case SVXTIMEFORMAT_24_HM: ; // 13:49
+ default:
+ sTimeFormat = B2UCONST( "" );
+ break;
+ }
+ }
+
+ OUString sDateTimeFormat = sDateFormat;
+ sDateTimeFormat += OUString::valueOf( sal_Unicode(' ') );
+ sDateTimeFormat += sTimeFormat;
+
+ pSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrDateTimeFormat, sDateTimeFormat );
+ SvXMLElementExport aExp( *pSVGExport, XML_NAMESPACE_NONE, "g", sal_True, sal_True );
+ }
+ virtual void growCharSet( SVGFilter::UCharSetMapMap & aTextFieldCharSets ) const
+ {
+ // we use the unicode char set in an improper way: we put in the date/time fortat
+ // in order to pass it to the CalcFieldValue method
+ static const ::rtl::OUString sFieldId = B2UCONST( aOOOAttrDateTimeField ) + B2UCONST( "-variable" );
+ SVGFilter::ObjectSet::const_iterator aMasterPageIt = mMasterPageSet.begin();
+ for( ; aMasterPageIt != mMasterPageSet.end(); ++aMasterPageIt )
+ {
+ aTextFieldCharSets[ *aMasterPageIt ][ sFieldId ].insert( (sal_Unicode)( format ) );
+ }
+ }
+ virtual ~VariableDateTimeField() {}
+};
+
+sal_Bool operator==( const TextField & aLhsTextField, const TextField & aRhsTextField )
+{
+ return aLhsTextField.equalTo( aRhsTextField );
+}
+
+
+
// -------------
// - SVGExport -
// -------------
@@ -62,6 +324,8 @@ SVGExport::SVGExport(
mrFilterData( rFilterData )
{
SetDocHandler( rxHandler );
+ sal_uInt16 nExportFlags = getExportFlags() | EXPORT_PRETTY;
+ setExportFlags( nExportFlags );
GetDocHandler()->startDocument();
}
@@ -233,11 +497,10 @@ sal_Bool ObjectRepresentation::operator==( const ObjectRepresentation& rPresenta
sal_Bool SVGFilter::implExport( const Sequence< PropertyValue >& rDescriptor )
throw (RuntimeException)
{
- Reference< XMultiServiceFactory > xServiceFactory( ::comphelper::getProcessServiceFactory() ) ;
+ Reference< XMultiServiceFactory > xServiceFactory( ::comphelper::getProcessServiceFactory() ) ;
Reference< XOutputStream > xOStm;
SvStream* pOStm = NULL;
- sal_Int32 nLength = rDescriptor.getLength();
- sal_Int32 nPageToExport = SVG_EXPORT_ALLPAGES;
+ sal_Int32 nLength = rDescriptor.getLength();
const PropertyValue* pValue = rDescriptor.getConstArray();
sal_Bool bRet = sal_False;
@@ -258,8 +521,6 @@ sal_Bool SVGFilter::implExport( const Sequence< PropertyValue >& rDescriptor )
if( pOStm )
xOStm = Reference< XOutputStream >( new ::utl::OOutputStreamWrapper ( *pOStm ) );
}
- else if( pValue[ i ].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "PagePos" ) ) )
- pValue[ i ].Value >>= nPageToExport;
else if( pValue[ i ].Name.equalsAscii( "FilterData" ) )
{
pValue[ i ].Value >>= maFilterData;
@@ -318,88 +579,57 @@ sal_Bool SVGFilter::implExport( const Sequence< PropertyValue >& rDescriptor )
if( xOStm.is() && xServiceFactory.is() )
{
- Reference< XMasterPagesSupplier > xMasterPagesSupplier( mxSrcDoc, UNO_QUERY );
- Reference< XDrawPagesSupplier > xDrawPagesSupplier( mxSrcDoc, UNO_QUERY );
-
- if( xMasterPagesSupplier.is() && xDrawPagesSupplier.is() )
+ if( mSelectedPages.hasElements() && mMasterPageTargets.hasElements() )
{
- Reference< XDrawPages > xMasterPages( xMasterPagesSupplier->getMasterPages(), UNO_QUERY );
- Reference< XDrawPages > xDrawPages( xDrawPagesSupplier->getDrawPages(), UNO_QUERY );
+ Reference< XDocumentHandler > xDocHandler( implCreateExportDocumentHandler( xOStm ) );
- if( xMasterPages.is() && xMasterPages->getCount() && xDrawPages.is() && xDrawPages->getCount() )
+ if( xDocHandler.is() )
{
- Reference< XDocumentHandler > xDocHandler( implCreateExportDocumentHandler( xOStm ) );
+ mbPresentation = Reference< XPresentationSupplier >( mxSrcDoc, UNO_QUERY ).is();
+ mpObjects = new ObjectMap;
- if( xDocHandler.is() )
- {
- mbPresentation = Reference< XPresentationSupplier >( mxSrcDoc, UNO_QUERY ).is();
- mpObjects = new ObjectMap;
-
- // #110680#
- // mpSVGExport = new SVGExport( xDocHandler );
+ // #110680#
+ // mpSVGExport = new SVGExport( xDocHandler );
mpSVGExport = new SVGExport( xServiceFactory, xDocHandler, maFilterData );
- if( nPageToExport < 0 || nPageToExport >= xDrawPages->getCount() )
- nPageToExport = SVG_EXPORT_ALLPAGES;
+ try
+ {
+ mxDefaultPage = mSelectedPages[0];
- try
+ if( mxDefaultPage.is() )
{
- const sal_Int32 nDefaultPage = ( ( SVG_EXPORT_ALLPAGES == nPageToExport ) ? 0 : nPageToExport );
+ SvxDrawPage* pSvxDrawPage = SvxDrawPage::getImplementation( mxDefaultPage );
- xDrawPages->getByIndex( nDefaultPage ) >>= mxDefaultPage;
-
- if( mxDefaultPage.is() )
+ if( pSvxDrawPage )
{
- SvxDrawPage* pSvxDrawPage = SvxDrawPage::getImplementation( mxDefaultPage );
+ mpDefaultSdrPage = pSvxDrawPage->GetSdrPage();
+ mpSdrModel = mpDefaultSdrPage->GetModel();
- if( pSvxDrawPage )
+ if( mpSdrModel )
{
- mpDefaultSdrPage = pSvxDrawPage->GetSdrPage();
- mpSdrModel = mpDefaultSdrPage->GetModel();
-
- if( mpSdrModel )
- {
- SdrOutliner& rOutl = mpSdrModel->GetDrawOutliner(NULL);
+ SdrOutliner& rOutl = mpSdrModel->GetDrawOutliner(NULL);
- maOldFieldHdl = rOutl.GetCalcFieldValueHdl();
- rOutl.SetCalcFieldValueHdl( LINK( this, SVGFilter, CalcFieldHdl) );
- }
- }
-
- if( implCreateObjects( xMasterPages, xDrawPages, nPageToExport ) )
- {
- ObjectMap::const_iterator aIter( mpObjects->begin() );
- ::std::vector< ObjectRepresentation > aObjects( mpObjects->size() );
- sal_uInt32 nPos = 0;
-
- while( aIter != mpObjects->end() )
- {
- aObjects[ nPos++ ] = (*aIter).second;
- ++aIter;
- }
-
- mpSVGFontExport = new SVGFontExport( *mpSVGExport, aObjects );
- mpSVGWriter = new SVGActionWriter( *mpSVGExport, *mpSVGFontExport );
-
- bRet = implExportDocument( xMasterPages, xDrawPages, nPageToExport );
+ maOldFieldHdl = rOutl.GetCalcFieldValueHdl();
+ rOutl.SetCalcFieldValueHdl( LINK( this, SVGFilter, CalcFieldHdl) );
}
}
+ bRet = implExportDocument();
}
- catch( ... )
- {
- delete mpSVGDoc, mpSVGDoc = NULL;
- OSL_FAIL( "Exception caught" );
- }
+ }
+ catch( ... )
+ {
+ delete mpSVGDoc, mpSVGDoc = NULL;
+ OSL_FAIL( "Exception caught" );
+ }
- if( mpSdrModel )
- mpSdrModel->GetDrawOutliner( NULL ).SetCalcFieldValueHdl( maOldFieldHdl );
+ if( mpSdrModel )
+ mpSdrModel->GetDrawOutliner( NULL ).SetCalcFieldValueHdl( maOldFieldHdl );
- delete mpSVGWriter, mpSVGWriter = NULL;
- delete mpSVGExport, mpSVGExport = NULL;
- delete mpSVGFontExport, mpSVGFontExport = NULL;
- delete mpObjects, mpObjects = NULL;
- mbPresentation = sal_False;
- }
+ delete mpSVGWriter, mpSVGWriter = NULL;
+ delete mpSVGExport, mpSVGExport = NULL;
+ delete mpSVGFontExport, mpSVGFontExport = NULL;
+ delete mpObjects, mpObjects = NULL;
+ mbPresentation = sal_False;
}
}
}
@@ -436,20 +666,63 @@ Reference< XDocumentHandler > SVGFilter::implCreateExportDocumentHandler( const
// -----------------------------------------------------------------------------
-sal_Bool SVGFilter::implExportDocument( const Reference< XDrawPages >& rxMasterPages,
- const Reference< XDrawPages >& rxDrawPages,
- sal_Int32 nPageToExport )
+inline
+sal_Bool SVGFilter::implLookForFirstVisiblePage()
+{
+ sal_Int32 nCurPage = 0, nLastPage = mSelectedPages.getLength() - 1;
+
+ while( ( nCurPage <= nLastPage ) && ( -1 == mnVisiblePage ) )
+ {
+ const Reference< XDrawPage > & xDrawPage = mSelectedPages[nCurPage];
+
+ if( xDrawPage.is() )
+ {
+ Reference< XPropertySet > xPropSet( xDrawPage, UNO_QUERY );
+
+ if( xPropSet.is() )
+ {
+ sal_Bool bVisible = sal_False;
+
+ if( !mbPresentation || mbSinglePage ||
+ ( ( xPropSet->getPropertyValue( B2UCONST( "Visible" ) ) >>= bVisible ) && bVisible ) )
+ {
+ mnVisiblePage = nCurPage;
+
+ Reference< XMasterPageTarget > xMasterTarget( xDrawPage, UNO_QUERY );
+ if( xMasterTarget.is() )
+ {
+ Reference< XDrawPage > xMasterPage( xMasterTarget->getMasterPage() );
+
+ for( sal_Int32 nMaster = 0, nMasterCount = mMasterPageTargets.getLength();
+ ( nMaster < nMasterCount ) && ( -1 == mnVisibleMasterPage );
+ ++nMaster )
+ {
+ const Reference< XDrawPage > & xMasterTestPage = mMasterPageTargets[nMaster];
+
+ if( xMasterTestPage.is() && xMasterTestPage == xMasterPage )
+ mnVisibleMasterPage = nMaster;
+ }
+ }
+ }
+ }
+ }
+ ++nCurPage;
+ }
+
+ return ( mnVisiblePage != -1 );
+}
+
+// -----------------------------------------------------------------------------
+sal_Bool SVGFilter::implExportDocument()
{
- DBG_ASSERT( rxMasterPages.is() && rxDrawPages.is(),
- "SVGFilter::implExportDocument: invalid parameter" );
+ OUString aAttr;
+ sal_Int32 nDocWidth = 0, nDocHeight = 0;
+ sal_Bool bRet = sal_False;
+ sal_Int32 nLastPage = mSelectedPages.getLength() - 1;
- OUString aAttr;
- sal_Int32 nDocWidth = 0, nDocHeight = 0;
- sal_Int32 nVisible = -1, nVisibleMaster = -1;
- sal_Bool bRet = sal_False;
- const sal_Bool bSinglePage = ( rxDrawPages->getCount() == 1 ) || ( SVG_EXPORT_ALLPAGES != nPageToExport );
- const sal_Int32 nFirstPage = ( ( SVG_EXPORT_ALLPAGES == nPageToExport ) ? 0 : nPageToExport );
- sal_Int32 nCurPage = nFirstPage, nLastPage = ( bSinglePage ? nFirstPage : ( rxDrawPages->getCount() - 1 ) );
+ mbSinglePage = (nLastPage == 0);
+ mnVisiblePage = -1;
+ mnVisibleMasterPage = -1;
const Reference< XPropertySet > xDefaultPagePropertySet( mxDefaultPage, UNO_QUERY );
const Reference< XExtendedDocumentHandler > xExtDocHandler( mpSVGExport->GetDocHandler(), UNO_QUERY );
@@ -470,6 +743,10 @@ sal_Bool SVGFilter::implExportDocument( const Reference< XDrawPages >& rxMasterP
if( mpSVGExport->IsUseTinyProfile() )
mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "baseProfile", B2UCONST( "tiny" ) );
+// enabling _SVG_WRITE_EXTENTS means that the slide size is not adapted
+// to the size of the browser window, moreover the slide is top left aligned
+// instead of centered.
+#undef _SVG_WRITE_EXTENTS
#ifdef _SVG_WRITE_EXTENTS
aAttr = OUString::valueOf( nDocWidth * 0.01 );
aAttr += B2UCONST( "mm" );
@@ -485,15 +762,19 @@ sal_Bool SVGFilter::implExportDocument( const Reference< XDrawPages >& rxMasterP
aAttr += B2UCONST( " " );
aAttr += OUString::valueOf( nDocHeight );
+ msClipPathId = B2UCONST( "presentation_clip_path" );
+ OUString sClipPathAttrValue = B2UCONST( "url(#" ) + msClipPathId + B2UCONST( ")" );
+
mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "viewBox", aAttr );
mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "preserveAspectRatio", B2UCONST( "xMidYMid" ) );
mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "fill-rule", B2UCONST( "evenodd" ) );
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "clip-path", sClipPathAttrValue );
// standard line width is based on 1 pixel on a 90 DPI device (0.28222mmm)
mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "stroke-width", OUString::valueOf( 28.222 ) );
mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "stroke-linejoin", B2UCONST( "round" ) );
- if( !bSinglePage )
+ if( !mbSinglePage )
{
mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "xmlns:ooo", B2UCONST( "http://xml.openoffice.org/svg/export" ) );
}
@@ -506,128 +787,312 @@ sal_Bool SVGFilter::implExportDocument( const Reference< XDrawPages >& rxMasterP
mpSVGDoc = new SvXMLElementExport( *mpSVGExport, XML_NAMESPACE_NONE, "svg", sal_True, sal_True );
- while( ( nCurPage <= nLastPage ) && ( -1 == nVisible ) )
+ // Create a ClipPath element that will be used for cutting bitmaps and other elements that could exceed the page margins.
{
- Reference< XDrawPage > xDrawPage;
+ SvXMLElementExport aDefsElem( *mpSVGExport, XML_NAMESPACE_NONE, "defs", sal_True, sal_True );
+ {
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", msClipPathId );
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "clipPathUnits", B2UCONST( "userSpaceOnUse" ) );
+ SvXMLElementExport aClipPathElem( *mpSVGExport, XML_NAMESPACE_NONE, "clipPath", sal_True, sal_True );
+ {
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "x", OUString::valueOf( 0 ) );
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "y", OUString::valueOf( 0 ) );
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "width", OUString::valueOf( nDocWidth ) );
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "height", OUString::valueOf( nDocHeight ) );
+ SvXMLElementExport aRectElem( *mpSVGExport, XML_NAMESPACE_NONE, "rect", sal_True, sal_True );
+ }
+ }
+ }
- rxDrawPages->getByIndex( nCurPage ) >>= xDrawPage;
+ if( implLookForFirstVisiblePage() ) // OK! We found at least one visible page.
+ {
+ if( !mbSinglePage )
+ {
+ implGenerateMetaData();
+ }
+ else
+ {
+ implGetPagePropSet( mSelectedPages[0] );
+ }
- if( xDrawPage.is() )
+ // Create the (Shape, GDIMetaFile) map
+ if( implCreateObjects() )
{
- Reference< XPropertySet > xPropSet( xDrawPage, UNO_QUERY );
+ ObjectMap::const_iterator aIter( mpObjects->begin() );
+ ::std::vector< ObjectRepresentation > aObjects( mpObjects->size() );
+ sal_uInt32 nPos = 0;
- if( xPropSet.is() )
+ while( aIter != mpObjects->end() )
{
- sal_Bool bVisible = sal_False;
-
- if( !mbPresentation || bSinglePage ||
- ( ( xPropSet->getPropertyValue( B2UCONST( "Visible" ) ) >>= bVisible ) && bVisible ) )
- {
- Reference< XMasterPageTarget > xMasterTarget( xDrawPage, UNO_QUERY );
+ aObjects[ nPos++ ] = (*aIter).second;
+ ++aIter;
+ }
- if( xMasterTarget.is() )
- {
- Reference< XDrawPage > xMasterPage( xMasterTarget->getMasterPage() );
+ mpSVGFontExport = new SVGFontExport( *mpSVGExport, aObjects );
+ mpSVGWriter = new SVGActionWriter( *mpSVGExport, *mpSVGFontExport );
- nVisible = nCurPage;
- for( sal_Int32 nMaster = 0, nMasterCount = rxMasterPages->getCount();
- ( nMaster < nMasterCount ) && ( -1 == nVisibleMaster );
- ++nMaster )
- {
- Reference< XDrawPage > xMasterTestPage;
+ if( mpSVGExport->IsEmbedFonts() )
+ {
+ mpSVGFontExport->EmbedFonts();
+ }
- rxMasterPages->getByIndex( nMaster ) >>= xMasterTestPage;
+ implExportPages( mMasterPageTargets, 0, mMasterPageTargets.getLength() - 1, mnVisibleMasterPage, sal_True /* is a master page */ );
+ implExportPages( mSelectedPages, 0, nLastPage, mnVisiblePage, sal_False /* is not a master page */ );
- if( xMasterTestPage == xMasterPage )
- nVisibleMaster = nMaster;
- }
- }
- }
+ if( !mbSinglePage )
+ {
+ implGenerateScript();
}
- }
- ++nCurPage;
+ delete mpSVGDoc, mpSVGDoc = NULL;
+ bRet = sal_True;
+ }
}
- if( mpSVGExport->IsEmbedFonts() )
- {
- mpSVGFontExport->EmbedFonts();
- }
+ return bRet;
+}
+
- if( -1 != nVisible )
+//------------------------------------------------------------------------------
+// Append aField to aFieldSet if it is not already present in the set
+// and create the field id sFieldId
+//
+
+template< typename TextFieldType >
+OUString implGenerateFieldId( std::vector< TextField* > & aFieldSet,
+ const TextFieldType & aField,
+ const OUString & sOOOElemField,
+ Reference< XDrawPage > xMasterPage )
+{
+ sal_Bool bFound = sal_False;
+ sal_Int32 i;
+ sal_Int32 nSize = aFieldSet.size();
+ for( i = 0; i < nSize; ++i )
{
- if( bSinglePage )
- implExportPages( rxMasterPages, nVisibleMaster, nVisibleMaster, nVisibleMaster, sal_True );
- else
+ if( *(aFieldSet[i]) == aField )
{
- implGenerateMetaData( rxMasterPages, rxDrawPages );
- implGenerateScript( rxMasterPages, rxDrawPages );
- implExportPages( rxMasterPages, 0, rxMasterPages->getCount() - 1, nVisibleMaster, sal_True );
+ bFound = sal_True;
+ break;
}
-
- implExportPages( rxDrawPages, nFirstPage, nLastPage, nVisible, sal_False );
-
- delete mpSVGDoc, mpSVGDoc = NULL;
- bRet = sal_True;
}
-
- return bRet;
+ OUString sFieldId( sOOOElemField );
+ sFieldId += OUString::valueOf( sal_Unicode('_') );
+ if( !bFound )
+ {
+ aFieldSet.push_back( new TextFieldType( aField ) );
+ }
+ aFieldSet[i]->insertMasterPage( xMasterPage );
+ sFieldId += OUString::valueOf( i );
+ return sFieldId;
}
-// -----------------------------------------------------------------------------
+//------------------------------------------------------------------------------
-sal_Bool SVGFilter::implGenerateMetaData( const Reference< XDrawPages >& /* rxMasterPages */,
- const Reference< XDrawPages >& rxDrawPages )
+sal_Bool SVGFilter::implGenerateMetaData()
{
sal_Bool bRet = sal_False;
-
- if( rxDrawPages->getCount() )
+ sal_Int32 nCount = mSelectedPages.getLength();
+ if( nCount != 0 )
{
- mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", B2UCONST( "meta_slides" ) );
- mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "ooo:numberOfSlides", OUString::valueOf( rxDrawPages->getCount() ) );
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", B2UCONST( aOOOElemMetaSlides ) );
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrNumberOfSlides, OUString::valueOf( nCount ) );
+
+ /*
+ * Add a (global) Page Numbering Type attribute for the document
+ */
+ // NOTE:
+ // at present pSdrModel->GetPageNumType() returns always SVX_ARABIC
+ // so the following code fragment is pretty unuseful
+ sal_Int32 nPageNumberingType = SVX_ARABIC;
+ SvxDrawPage* pSvxDrawPage = SvxDrawPage::getImplementation( mSelectedPages[0] );
+ if( pSvxDrawPage )
+ {
+ SdrPage* pSdrPage = pSvxDrawPage->GetSdrPage();
+ SdrModel* pSdrModel = pSdrPage->GetModel();
+ nPageNumberingType = pSdrModel->GetPageNumType();
+ }
+ if( nPageNumberingType != SVX_NUMBER_NONE )
+ {
+ OUString sNumberingType;
+ switch( nPageNumberingType )
+ {
+ case SVX_CHARS_UPPER_LETTER:
+ sNumberingType = B2UCONST( "alpha-upper" );
+ break;
+ case SVX_CHARS_LOWER_LETTER:
+ sNumberingType = B2UCONST( "alpha-lower" );
+ break;
+ case SVX_ROMAN_UPPER:
+ sNumberingType = B2UCONST( "roman-upper" );
+ break;
+ case SVX_ROMAN_LOWER:
+ sNumberingType = B2UCONST( "roman-lower" );
+ break;
+ // arabic numbering type is the default, so we do not append any attribute for it
+ case SVX_ARABIC: ;
+ // in case the numbering type is not handled we fall back on arabic numbering
+ default: ;
+ break;
+ }
+ if( !sNumberingType.isEmpty() )
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrNumberingType, sNumberingType );
+ }
+
{
- SvXMLElementExport aExp( *mpSVGExport, XML_NAMESPACE_NONE, "g", sal_True, sal_True );
- const OUString aId( B2UCONST( "meta_slide" ) );
+ SvXMLElementExport aExp( *mpSVGExport, XML_NAMESPACE_NONE, "g", sal_True, sal_True );
+ const OUString aId( B2UCONST( aOOOElemMetaSlide ) );
+ const OUString aElemTextFieldId( B2UCONST( aOOOElemTextField ) );
+ std::vector< TextField* > aFieldSet;
- for( sal_Int32 i = 0, nCount = rxDrawPages->getCount(); i < nCount; ++i )
+ for( sal_Int32 i = 0; i < nCount; ++i )
{
- OUString aSlideId( aId );
- Reference< XDrawPage > xDrawPage( rxDrawPages->getByIndex( i ), UNO_QUERY );
- Reference< XMasterPageTarget > xMasterPageTarget( xDrawPage, UNO_QUERY );
- Reference< XDrawPage > xMasterPage( xMasterPageTarget->getMasterPage(), UNO_QUERY );
- sal_Bool bMasterVisible = sal_True;
- OUString aMasterVisibility;
-
+ const Reference< XDrawPage > & xDrawPage = mSelectedPages[i];
+ Reference< XMasterPageTarget > xMasterPageTarget( xDrawPage, UNO_QUERY );
+ Reference< XDrawPage > xMasterPage( xMasterPageTarget->getMasterPage(), UNO_QUERY );
+ OUString aSlideId( aId );
+ aSlideId += OUString::valueOf( sal_Unicode('_') );
aSlideId += OUString::valueOf( i );
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", aSlideId );
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrSlide, implGetValidIDFromInterface( xDrawPage ) );
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrMaster, implGetValidIDFromInterface( xMasterPage ) );
+
+
if( mbPresentation )
{
Reference< XPropertySet > xPropSet( xDrawPage, UNO_QUERY );
if( xPropSet.is() )
- xPropSet->getPropertyValue( B2UCONST( "Background" ) ) >>= bMasterVisible;
+ {
+ sal_Bool bBackgroundVisibility = sal_True; // default: visible
+ sal_Bool bBackgroundObjectsVisibility = sal_True; // default: visible
+ sal_Bool bPageNumberVisibility = sal_False; // default: hidden
+ sal_Bool bDateTimeVisibility = sal_True; // default: visible
+ sal_Bool bFooterVisibility = sal_True; // default: visible
+ sal_Bool bHeaderVisibility = sal_True; // default: visible
+ sal_Bool bDateTimeFixed = sal_True; // default: fixed
+
+ FixedDateTimeField aFixedDateTimeField;
+ VariableDateTimeField aVariableDateTimeField;
+ FooterField aFooterField;
+
+ xPropSet->getPropertyValue( B2UCONST( "IsBackgroundVisible" ) ) >>= bBackgroundVisibility;
+ // in case the attribute is set to its default value it is not appended to the meta-slide element
+ if( !bBackgroundVisibility ) // visibility default value: 'visible'
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrBackgroundVisibility, B2UCONST( "hidden" ) );
+
+ // Page Number, Date/Time, Footer and Header Fields are regarded as background objects.
+ // So bBackgroundObjectsVisibility overrides visibility of master page text fields.
+ xPropSet->getPropertyValue( B2UCONST( "IsBackgroundObjectsVisible" ) ) >>= bBackgroundObjectsVisibility;
+ if( bBackgroundObjectsVisibility ) // visibility default value: 'visible'
+ {
+ /*
+ * Page Number Field
+ */
+ xPropSet->getPropertyValue( B2UCONST( "IsPageNumberVisible" ) ) >>= bPageNumberVisibility;
+ bPageNumberVisibility = bPageNumberVisibility && ( nPageNumberingType != SVX_NUMBER_NONE );
+ if( bPageNumberVisibility ) // visibility default value: 'hidden'
+ {
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrPageNumberVisibility, B2UCONST( "visible" ) );
+ }
+ /*
+ * Date/Time Field
+ */
+ xPropSet->getPropertyValue( B2UCONST( "IsDateTimeVisible" ) ) >>= bDateTimeVisibility;
+ if( bDateTimeVisibility ) // visibility default value: 'visible'
+ {
+ xPropSet->getPropertyValue( B2UCONST( "IsDateTimeFixed" ) ) >>= bDateTimeFixed;
+ if( bDateTimeFixed ) // we are interested only in the field text not in the date/time format
+ {
+ xPropSet->getPropertyValue( B2UCONST( "DateTimeText" ) ) >>= aFixedDateTimeField.text;
+ if( !aFixedDateTimeField.text.isEmpty() )
+ {
+ OUString sFieldId = implGenerateFieldId( aFieldSet, aFixedDateTimeField, aElemTextFieldId, xMasterPage );
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrDateTimeField, sFieldId );
+ }
+ }
+ else // the inverse applies: we are interested only in the date/time format not in the field text
+ {
+ xPropSet->getPropertyValue( B2UCONST( "DateTimeFormat" ) ) >>= aVariableDateTimeField.format;
+ OUString sFieldId = implGenerateFieldId( aFieldSet, aVariableDateTimeField, aElemTextFieldId, xMasterPage );
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrDateTimeField, sFieldId );
+ }
+ }
+ else
+ {
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrDateTimeVisibility, B2UCONST( "hidden" ) );
+ }
+ /*
+ * Footer Field
+ */
+ xPropSet->getPropertyValue( B2UCONST( "IsFooterVisible" ) ) >>= bFooterVisibility;
+ if( bFooterVisibility ) // visibility default value: 'visible'
+ {
+ xPropSet->getPropertyValue( B2UCONST( "FooterText" ) ) >>= aFooterField.text;
+ if( !aFooterField.text.isEmpty() )
+ {
+ OUString sFieldId = implGenerateFieldId( aFieldSet, aFooterField, aElemTextFieldId, xMasterPage );
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrFooterField, sFieldId );
+ }
+ }
+ else
+ {
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrFooterVisibility, B2UCONST( "hidden" ) );
+ }
+ }
+ else
+ {
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrMasterObjectsVisibility, B2UCONST( "hidden" ) );
+ }
+ if( i == mnVisiblePage )
+ {
+ mVisiblePagePropSet.bIsBackgroundVisible = bBackgroundVisibility;
+ mVisiblePagePropSet.bAreBackgroundObjectsVisible = bBackgroundObjectsVisibility;
+ mVisiblePagePropSet.bIsPageNumberFieldVisible = bPageNumberVisibility;
+ mVisiblePagePropSet.bIsDateTimeFieldVisible = bDateTimeVisibility;
+ mVisiblePagePropSet.bIsFooterFieldVisible = bFooterVisibility;
+ mVisiblePagePropSet.bIsHeaderFieldVisible = bHeaderVisibility;
+ mVisiblePagePropSet.nPageNumberingType = nPageNumberingType;
+ mVisiblePagePropSet.bIsDateTimeFieldFixed = bDateTimeFixed;
+ mVisiblePagePropSet.nDateTimeFormat = aVariableDateTimeField.format;
+ mVisiblePagePropSet.sDateTimeText = aFixedDateTimeField.text;
+ mVisiblePagePropSet.sFooterText = aFooterField.text;
+ }
+ }
}
- if( bMasterVisible )
- aMasterVisibility = B2UCONST( "visible" );
- else
- aMasterVisibility = B2UCONST( "hidden" );
+ {
+ SvXMLElementExport aExp2( *mpSVGExport, XML_NAMESPACE_NONE, "g", sal_True, sal_True );
+ } // when the aExp2 destructor is called the </g> tag is appended to the output file
+ }
- mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", aSlideId );
- mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "ooo:slide", implGetValidIDFromInterface( xDrawPage ) );
- mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "ooo:master", implGetValidIDFromInterface( xMasterPage ) );
- mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "ooo:master-visibility", aMasterVisibility );
+ // export text field elements
+ if( mbPresentation )
+ {
+ for( sal_Int32 i = 0, nSize = aFieldSet.size(); i < nSize; ++i )
+ {
+ OUString sElemId = B2UCONST( aOOOElemTextField );
+ sElemId += OUString::valueOf( sal_Unicode('_') );
+ sElemId += OUString::valueOf( i );
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", sElemId );
+ aFieldSet[i]->elementExport( mpSVGExport );
+
+ aFieldSet[i]->growCharSet( mTextFieldCharSets );
+ }
+ }
+ // text fields are used only for generating meta info so we don't need them anymore
+ for( sal_uInt32 i = 0; i < aFieldSet.size(); ++i )
+ {
+ if( aFieldSet[i] != NULL )
{
- SvXMLElementExport aExp2( *mpSVGExport, XML_NAMESPACE_NONE, "g", sal_True, sal_True );
+ delete aFieldSet[i];
}
}
}
-
-
- bRet =sal_True;
+ bRet = sal_True;
}
return bRet;
@@ -635,22 +1100,17 @@ sal_Bool SVGFilter::implGenerateMetaData( const Reference< XDrawPages >& /* rxMa
// -----------------------------------------------------------------------------
-sal_Bool SVGFilter::implGenerateScript( const Reference< XDrawPages >& /* rxMasterPages */,
- const Reference< XDrawPages >& /* rxDrawPages */ )
+sal_Bool SVGFilter::implGenerateScript()
{
mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "type", B2UCONST( "text/ecmascript" ) );
{
- SvXMLElementExport aExp( *mpSVGExport, XML_NAMESPACE_NONE, "script", sal_True, sal_True );
- Reference< XExtendedDocumentHandler > xExtDocHandler( mpSVGExport->GetDocHandler(), UNO_QUERY );
+ SvXMLElementExport aExp( *mpSVGExport, XML_NAMESPACE_NONE, "script", sal_True, sal_True );
+ Reference< XExtendedDocumentHandler > xExtDocHandler( mpSVGExport->GetDocHandler(), UNO_QUERY );
if( xExtDocHandler.is() )
{
- xExtDocHandler->unknown( OUString::createFromAscii( aSVGScript1 ) );
- xExtDocHandler->unknown( OUString::createFromAscii( aSVGScript2 ) );
- xExtDocHandler->unknown( OUString::createFromAscii( aSVGScript3 ) );
- xExtDocHandler->unknown( OUString::createFromAscii( aSVGScript4 ) );
- xExtDocHandler->unknown( OUString::createFromAscii( aSVGScript5 ) );
+ xExtDocHandler->unknown( OUString::createFromAscii( aSVGScript ) );
}
}
@@ -659,7 +1119,86 @@ sal_Bool SVGFilter::implGenerateScript( const Reference< XDrawPages >& /* rxMast
// -----------------------------------------------------------------------------
-sal_Bool SVGFilter::implExportPages( const Reference< XDrawPages >& rxPages,
+Any SVGFilter::implSafeGetPagePropSet( const OUString & sPropertyName,
+ const Reference< XPropertySet > & rxPropSet,
+ const Reference< XPropertySetInfo > & rxPropSetInfo )
+{
+ Any result;
+ if( rxPropSetInfo->hasPropertyByName( sPropertyName ) )
+ {
+ result = rxPropSet->getPropertyValue( sPropertyName );
+ }
+ return result;
+}
+
+// -----------------------------------------------------------------------------
+
+/* SVGFilter::implGetPagePropSet
+ *
+ * We collect info on master page elements visibility,
+ * and placeholder text shape content.
+ * This method is used when exporting a single page
+ * as implGenerateMetaData is not invoked.
+ */
+sal_Bool SVGFilter::implGetPagePropSet( const Reference< XDrawPage > & rxPage )
+{
+ sal_Bool bRet = sal_False;
+
+ mVisiblePagePropSet.bIsBackgroundVisible = true;
+ mVisiblePagePropSet.bAreBackgroundObjectsVisible = true;
+ mVisiblePagePropSet.bIsPageNumberFieldVisible = false;;
+ mVisiblePagePropSet.bIsHeaderFieldVisible = false;
+ mVisiblePagePropSet.bIsFooterFieldVisible = true;
+ mVisiblePagePropSet.bIsDateTimeFieldVisible = true;
+ mVisiblePagePropSet.bIsDateTimeFieldFixed = true;
+ mVisiblePagePropSet.nDateTimeFormat = SVXDATEFORMAT_B;
+ mVisiblePagePropSet.nPageNumberingType = SVX_ARABIC;
+
+ /* We collect info on master page elements visibility,
+ * and placeholder text shape content.
+ */
+ Any result;
+ Reference< XPropertySet > xPropSet( rxPage, UNO_QUERY );
+ if( xPropSet.is() )
+ {
+ Reference< XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
+ if( xPropSetInfo.is() )
+ {
+ implSafeGetPagePropSet( B2UCONST( "IsBackgroundVisible" ), xPropSet, xPropSetInfo ) >>= mVisiblePagePropSet.bIsBackgroundVisible;
+ implSafeGetPagePropSet( B2UCONST( "IsBackgroundObjectsVisible" ), xPropSet, xPropSetInfo ) >>= mVisiblePagePropSet.bAreBackgroundObjectsVisible;
+ implSafeGetPagePropSet( B2UCONST( "IsPageNumberVisible" ), xPropSet, xPropSetInfo ) >>= mVisiblePagePropSet.bIsPageNumberFieldVisible;
+ implSafeGetPagePropSet( B2UCONST( "IsHeaderVisible" ), xPropSet, xPropSetInfo ) >>= mVisiblePagePropSet.bIsHeaderFieldVisible;
+ implSafeGetPagePropSet( B2UCONST( "IsFooterVisible" ), xPropSet, xPropSetInfo ) >>= mVisiblePagePropSet.bIsFooterFieldVisible;
+ implSafeGetPagePropSet( B2UCONST( "IsDateTimeVisible" ), xPropSet, xPropSetInfo ) >>= mVisiblePagePropSet.bIsDateTimeFieldVisible;
+
+ implSafeGetPagePropSet( B2UCONST( "IsDateTimeFixed" ), xPropSet, xPropSetInfo ) >>= mVisiblePagePropSet.bIsDateTimeFieldFixed;
+ implSafeGetPagePropSet( B2UCONST( "DateTimeFormat" ), xPropSet, xPropSetInfo ) >>= mVisiblePagePropSet.nDateTimeFormat;
+ implSafeGetPagePropSet( B2UCONST( "Number" ), xPropSet, xPropSetInfo ) >>= mVisiblePagePropSet.nPageNumber;
+ implSafeGetPagePropSet( B2UCONST( "DateTimeText" ), xPropSet, xPropSetInfo ) >>= mVisiblePagePropSet.sDateTimeText;
+ implSafeGetPagePropSet( B2UCONST( "FooterText" ), xPropSet, xPropSetInfo ) >>= mVisiblePagePropSet.sFooterText;
+ implSafeGetPagePropSet( B2UCONST( "HeaderText" ), xPropSet, xPropSetInfo ) >>= mVisiblePagePropSet.sHeaderText;
+
+ if( mVisiblePagePropSet.bIsPageNumberFieldVisible )
+ {
+ SvxDrawPage* pSvxDrawPage = SvxDrawPage::getImplementation( rxPage );
+ if( pSvxDrawPage )
+ {
+ SdrPage* pSdrPage = pSvxDrawPage->GetSdrPage();
+ SdrModel* pSdrModel = pSdrPage->GetModel();
+ mVisiblePagePropSet.nPageNumberingType = pSdrModel->GetPageNumType();
+ }
+ }
+
+ bRet = sal_True;
+ }
+ }
+
+ return bRet;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SVGFilter::implExportPages( const SVGFilter::XDrawPageSequence & rxPages,
sal_Int32 nFirstPage, sal_Int32 nLastPage,
sal_Int32 nVisiblePage, sal_Bool bMaster )
{
@@ -670,36 +1209,15 @@ sal_Bool SVGFilter::implExportPages( const Reference< XDrawPages >& rxPages,
for( sal_Int32 i = nFirstPage; i <= nLastPage; ++i )
{
- Reference< XDrawPage > xDrawPage;
-
- rxPages->getByIndex( i ) >>= xDrawPage;
-
- if( xDrawPage.is() )
+ if( rxPages[i].is() )
{
- Reference< XShapes > xShapes( xDrawPage, UNO_QUERY );
+ Reference< XShapes > xShapes( rxPages[i], UNO_QUERY );
if( xShapes.is() )
{
- OUString aVisibility, aId, aSlideName( implGetValidIDFromInterface( xShapes, sal_True ) );
-
- // add visibility attribute
- if( i == nVisiblePage )
- aVisibility = B2UCONST( "visible" );
- else
- aVisibility = B2UCONST( "hidden" );
-
- mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "visibility", aVisibility );
-
// add id attribute
- if( bMaster )
- aId = ( B2UCONST( "MasterSlide_" ) ) += ::rtl::OUString::valueOf( ++mnMasterSlideId );
- else
- aId = ( B2UCONST( "Slide_" ) ) += ::rtl::OUString::valueOf( ++mnSlideId );
-
- if( aSlideName.getLength() )
- ( ( aId += B2UCONST( "(" ) ) += aSlideName ) += B2UCONST( ")" );
-
- mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", aId );
+ OUString sPageId = implGetValidIDFromInterface( xShapes );
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", sPageId );
{
{
@@ -718,17 +1236,99 @@ sal_Bool SVGFilter::implExportPages( const Reference< XDrawPages >& rxPages,
}
}
+ // We don't set a visibility attribute for a master page element
+ // as the visibility of each master page sub element (background,
+ // placeholder shapes, background objects) is managed separately.
+ OUString aAttrVisibilityValue;
+ if( !bMaster )
+ {
+ if( i == nVisiblePage )
+ aAttrVisibilityValue = B2UCONST( "visible" );
+ else
+ aAttrVisibilityValue = B2UCONST( "hidden" );
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "visibility", aAttrVisibilityValue );
+ }
+ else
+ { // when we export the shapes of a master page (implExportShape) we need
+ // to know if it is the master page targeted by the initially visible slide
+ mbIsPageVisible = ( i == nVisiblePage );
+ }
+
+ // Adding a clip path to each exported slide and master page,
+ // so in case bitmaps or other elements exceed the slide margins
+ // they are trimmed, even when they are shown inside a thumbnail view.
+ OUString sClipPathAttrValue = B2UCONST( "url(#" ) + msClipPathId + B2UCONST( ")" );
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "clip-path", sClipPathAttrValue );
+
+ // insert the <g> open tag related to the Slide/Master_Slide
SvXMLElementExport aExp( *mpSVGExport, XML_NAMESPACE_NONE, "g", sal_True, sal_True );
- const Point aNullPt;
- if( bMaster )
+ // In case the page has a background object we append it .
+ if( (mpObjects->find( rxPages[i] ) != mpObjects->end()) )
{
- const GDIMetaFile& rMtf = (*mpObjects)[ xDrawPage ].GetRepresentation();
- mpSVGWriter->WriteMetaFile( aNullPt, rMtf.GetPrefSize(), rMtf, SVGWRITER_WRITE_FILL );
+ const GDIMetaFile& rMtf = (*mpObjects)[ rxPages[i] ].GetRepresentation();
+ if( rMtf.GetActionSize() )
+ {
+ // background id = "bg-" + page id
+ OUString sBackgroundId = B2UCONST( "bg-" );
+ sBackgroundId += sPageId;
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", sBackgroundId );
+
+ // At present (LibreOffice 3.4.0) the 'IsBackgroundVisible' property is not handled
+ // by Impress; anyway we handle this property as referring only to the visibility
+ // of the master page background. So if a slide has its own background object,
+ // the visibility of such a background object is always inherited from the visibility
+ // of the parent slide regardless of the value of the 'IsBackgroundVisible' property.
+ // This means that we need to set up the visibility attribute only for the background
+ // element of a master page.
+ if( bMaster )
+ {
+ if( i == nVisiblePage && mVisiblePagePropSet.bIsBackgroundVisible )
+ aAttrVisibilityValue = B2UCONST( "visible" );
+ else
+ aAttrVisibilityValue = B2UCONST( "hidden" );
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "visibility", aAttrVisibilityValue );
+ }
+
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "class", B2UCONST( "Background" ) );
+
+ // insert the <g> open tag related to the Background
+ SvXMLElementExport aExp2( *mpSVGExport, XML_NAMESPACE_NONE, "g", sal_True, sal_True );
+
+ // append all elements that make up the Background
+ const Point aNullPt;
+ mpSVGWriter->WriteMetaFile( aNullPt, rMtf.GetPrefSize(), rMtf, SVGWRITER_WRITE_FILL );
+ } // insert the </g> closing tag related to the Background
}
- bRet = implExportShapes( xShapes ) || bRet;
- }
+ // In case we are dealing with a master page we need to to group all its shapes
+ // into a group element, this group will make up the so named "background objects"
+ if( bMaster )
+ {
+ // background objects id = "bo-" + page id
+ OUString sBackgroundObjectsId = B2UCONST( "bo-" );
+ sBackgroundObjectsId += sPageId;
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", sBackgroundObjectsId );
+
+ if( i == nVisiblePage && mVisiblePagePropSet.bAreBackgroundObjectsVisible )
+ aAttrVisibilityValue = B2UCONST( "visible" );
+ else
+ aAttrVisibilityValue = B2UCONST( "hidden" );
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "visibility", aAttrVisibilityValue );
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "class", B2UCONST( "BackgroundObjects" ) );
+
+ // insert the <g> open tag related to the Background Objects
+ SvXMLElementExport aExp2( *mpSVGExport, XML_NAMESPACE_NONE, "g", sal_True, sal_True );
+
+ // append all shapes that make up the Master Slide
+ bRet = implExportShapes( xShapes ) || bRet;
+ } // append the </g> closing tag related to the Background Objects
+ else
+ {
+ // append all shapes that make up the Slide
+ bRet = implExportShapes( xShapes ) || bRet;
+ }
+ } // append the </g> closing tag related to the Slide/Master_Slide
}
}
}
@@ -769,52 +1369,6 @@ sal_Bool SVGFilter::implExportShape( const Reference< XShape >& rxShape )
if( mbPresentation )
{
xShapePropSet->getPropertyValue( B2UCONST( "IsEmptyPresentationObject" ) ) >>= bHideObj;
-
- if( !bHideObj )
- {
- const Reference< XPropertySet > xDefaultPagePropertySet( mxDefaultPage, UNO_QUERY );
- Reference< XPropertySetInfo > xPagePropSetInfo( xDefaultPagePropertySet->getPropertySetInfo() );
-
- if( xPagePropSetInfo.is() )
- {
- const ::rtl::OUString aHeaderString( B2UCONST( "IsHeaderVisible" ) );
- const ::rtl::OUString aFooterString( B2UCONST( "IsFooterVisible" ) );
- const ::rtl::OUString aDateTimeString( B2UCONST( "IsDateTimeVisible" ) );
- const ::rtl::OUString aPageNumberString( B2UCONST( "IsPageNumberVisible" ) );
-
- Any aProperty;
- sal_Bool bValue = sal_False;
-
- if( ( aShapeType.lastIndexOf( B2UCONST( "presentation.HeaderShape" ) ) != -1 ) &&
- xPagePropSetInfo->hasPropertyByName( aHeaderString ) &&
- ( ( aProperty = xDefaultPagePropertySet->getPropertyValue( aHeaderString ) ) >>= bValue ) &&
- !bValue )
- {
- bHideObj = sal_True;
- }
- else if( ( aShapeType.lastIndexOf( B2UCONST( "presentation.FooterShape" ) ) != -1 ) &&
- xPagePropSetInfo->hasPropertyByName( aFooterString ) &&
- ( ( aProperty = xDefaultPagePropertySet->getPropertyValue( aFooterString ) ) >>= bValue ) &&
- !bValue )
- {
- bHideObj = sal_True;
- }
- else if( ( aShapeType.lastIndexOf( B2UCONST( "presentation.DateTimeShape" ) ) != -1 ) &&
- xPagePropSetInfo->hasPropertyByName( aDateTimeString ) &&
- ( ( aProperty = xDefaultPagePropertySet->getPropertyValue( aDateTimeString ) ) >>= bValue ) &&
- !bValue )
- {
- bHideObj = sal_True;
- }
- else if( ( aShapeType.lastIndexOf( B2UCONST( "presentation.SlideNumberShape" ) ) != -1 ) &&
- xPagePropSetInfo->hasPropertyByName( aPageNumberString ) &&
- ( ( aProperty = xDefaultPagePropertySet->getPropertyValue( aPageNumberString ) ) >>= bValue ) &&
- !bValue )
- {
- bHideObj = sal_True;
- }
- }
- }
}
if( !bHideObj )
@@ -835,8 +1389,8 @@ sal_Bool SVGFilter::implExportShape( const Reference< XShape >& rxShape )
if( !bRet && mpObjects->find( rxShape ) != mpObjects->end() )
{
Reference< XText > xText( rxShape, UNO_QUERY );
- ::com::sun::star::awt::Rectangle aBoundRect;
- const GDIMetaFile& rMtf = (*mpObjects)[ rxShape ].GetRepresentation();
+ ::com::sun::star::awt::Rectangle aBoundRect;
+ const GDIMetaFile& rMtf = (*mpObjects)[ rxShape ].GetRepresentation();
xShapePropSet->getPropertyValue( B2UCONST( "BoundRect" ) ) >>= aBoundRect;
@@ -844,8 +1398,53 @@ sal_Bool SVGFilter::implExportShape( const Reference< XShape >& rxShape )
const Size aSize( aBoundRect.Width, aBoundRect.Height );
if( rMtf.GetActionSize() )
- {
- mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "class", implGetClassFromShape( rxShape ) );
+ { // for text field shapes we set up visibility and text-adjust attributes
+ // TODO should we set up visibility for all text field shapes to hidden at start ?
+ OUString aShapeClass = implGetClassFromShape( rxShape );
+ if( mbPresentation )
+ {
+ sal_Bool bIsPageNumber = aShapeClass.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Slide_Number" ) );
+ sal_Bool bIsFooter = aShapeClass.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Footer" ) );
+ sal_Bool bIsDateTime = aShapeClass.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Date/Time" ) );
+ if( bIsPageNumber || bIsDateTime || bIsFooter )
+ {
+ // if the text field does not belong to the visible page its svg:visibility
+ // attribute is set to 'hidden'; else it depends on the related property of the visible page
+ OUString aAttrVisibilityValue( B2UCONST( "hidden" ) );
+ if(mbIsPageVisible && mVisiblePagePropSet.bAreBackgroundObjectsVisible && (
+ ( bIsPageNumber && mVisiblePagePropSet.bIsPageNumberFieldVisible ) ||
+ ( bIsDateTime && mVisiblePagePropSet.bIsDateTimeFieldVisible ) ||
+ ( bIsFooter && mVisiblePagePropSet.bIsFooterFieldVisible ) ) )
+ {
+ aAttrVisibilityValue = B2UCONST( "visible" );
+ }
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "visibility", aAttrVisibilityValue );
+
+ if( !mbSinglePage )
+ {
+ sal_uInt16 nTextAdjust = ParagraphAdjust_LEFT;
+ OUString sTextAdjust;
+ xShapePropSet->getPropertyValue( B2UCONST( "ParaAdjust" ) ) >>= nTextAdjust;
+
+ switch( nTextAdjust )
+ {
+ case ParagraphAdjust_LEFT:
+ sTextAdjust = B2UCONST( "left" );
+ break;
+ case ParagraphAdjust_CENTER:
+ sTextAdjust = B2UCONST( "center" );
+ break;
+ case ParagraphAdjust_RIGHT:
+ sTextAdjust = B2UCONST( "right" );
+ break;
+ default:
+ break;
+ }
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrTextAdjust, sTextAdjust );
+ }
+ }
+ }
+ mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "class", aShapeClass );
SvXMLElementExport aExp( *mpSVGExport, XML_NAMESPACE_NONE, "g", sal_True, sal_True );
OUString aId( B2UCONST( "DrawingGroup_" ) );
OUString aObjName( implGetValidIDFromInterface( rxShape, true ) ), aObjDesc;
@@ -887,81 +1486,60 @@ sal_Bool SVGFilter::implExportShape( const Reference< XShape >& rxShape )
// -----------------------------------------------------------------------------
-sal_Bool SVGFilter::implCreateObjects( const Reference< XDrawPages >& rxMasterPages,
- const Reference< XDrawPages >& rxDrawPages,
- sal_Int32 nPageToExport )
+sal_Bool SVGFilter::implCreateObjects()
{
- if( SVG_EXPORT_ALLPAGES == nPageToExport )
- {
- sal_Int32 i, nCount;
-
- for( i = 0, nCount = rxMasterPages->getCount(); i < nCount; ++i )
- {
- Reference< XDrawPage > xMasterPage;
+ sal_Int32 i, nCount;
- rxMasterPages->getByIndex( i ) >>= xMasterPage;
-
- if( xMasterPage.is() )
- {
- Reference< XShapes > xShapes( xMasterPage, UNO_QUERY );
-
- implCreateObjectsFromBackground( xMasterPage );
-
- if( xShapes.is() )
- implCreateObjectsFromShapes( xShapes );
- }
- }
+ for( i = 0, nCount = mMasterPageTargets.getLength(); i < nCount; ++i )
+ {
+ const Reference< XDrawPage > & xMasterPage = mMasterPageTargets[i];
- for( i = 0, nCount = rxDrawPages->getCount(); i < nCount; ++i )
+ if( xMasterPage.is() )
{
- Reference< XDrawPage > xDrawPage;
+ mCreateOjectsCurrentMasterPage = xMasterPage;
+ implCreateObjectsFromBackground( xMasterPage );
- rxDrawPages->getByIndex( i ) >>= xDrawPage;
-
- if( xDrawPage.is() )
- {
- Reference< XShapes > xShapes( xDrawPage, UNO_QUERY );
+ Reference< XShapes > xShapes( xMasterPage, UNO_QUERY );
- if( xShapes.is() )
- implCreateObjectsFromShapes( xShapes );
- }
+ if( xShapes.is() )
+ implCreateObjectsFromShapes( xShapes );
}
}
- else
- {
- DBG_ASSERT( nPageToExport >= 0 && nPageToExport < rxDrawPages->getCount(),
- "SVGFilter::implCreateObjects: invalid page number to export" );
-
- Reference< XDrawPage > xDrawPage;
- rxDrawPages->getByIndex( nPageToExport ) >>= xDrawPage;
-
- if( xDrawPage.is() )
- {
- Reference< XMasterPageTarget > xMasterTarget( xDrawPage, UNO_QUERY );
+ for( i = 0, nCount = mSelectedPages.getLength(); i < nCount; ++i )
+ {
+ const Reference< XDrawPage > & xDrawPage = mSelectedPages[i];
- if( xMasterTarget.is() )
+ if( xDrawPage.is() )
+ {
+#if ENABLE_EXPORT_CUSTOM_SLIDE_BACKGROUND
+ // TODO complete the implementation for exporting custom background for each slide
+ // implementation status:
+ // - hatch stroke color is set to 'none' so the hatch is not visible, why ?
+ // - gradient look is not really awesome, too few colors are used;
+ // - stretched bitmap, gradient and hatch are not exported only once
+ // and then referenced in case more than one slide uses them.
+ // - tiled bitmap: an image element is exported for each tile,
+ // this is really too expensive!
+ Reference< XPropertySet > xPropSet( xDrawPage, UNO_QUERY );
+ Reference< XPropertySet > xBackground;
+ xPropSet->getPropertyValue( B2UCONST( "Background" ) ) >>= xBackground;
+ if( xBackground.is() )
{
- Reference< XDrawPage > xMasterPage( xMasterTarget->getMasterPage() );
-
- if( xMasterPage.is() )
+ drawing::FillStyle aFillStyle;
+ sal_Bool assigned = ( xBackground->getPropertyValue( B2UCONST( "FillStyle" ) ) >>= aFillStyle );
+ if( assigned && aFillStyle != drawing::FillStyle_NONE )
{
- Reference< XShapes > xShapes( xMasterPage, UNO_QUERY );
-
- implCreateObjectsFromBackground( xMasterPage );
-
- if( xShapes.is() )
- implCreateObjectsFromShapes( xShapes );
+ implCreateObjectsFromBackground( xDrawPage );
}
}
-
+#endif
Reference< XShapes > xShapes( xDrawPage, UNO_QUERY );
- if( xShapes.is() )
- implCreateObjectsFromShapes( xShapes );
- }
+ if( xShapes.is() )
+ implCreateObjectsFromShapes( xShapes );
+ }
}
-
return sal_True;
}
@@ -988,7 +1566,6 @@ sal_Bool SVGFilter::implCreateObjectsFromShapes( const Reference< XShapes >& rxS
sal_Bool SVGFilter::implCreateObjectsFromShape( const Reference< XShape >& rxShape )
{
sal_Bool bRet = sal_False;
-
if( rxShape->getShapeType().lastIndexOf( B2UCONST( "drawing.GroupShape" ) ) != -1 )
{
Reference< XShapes > xShapes( rxShape, UNO_QUERY );
@@ -1008,9 +1585,9 @@ sal_Bool SVGFilter::implCreateObjectsFromShape( const Reference< XShape >& rxSha
{
if( aGraphic.GetType() == GRAPHIC_BITMAP )
{
- GDIMetaFile aMtf;
- const Point aNullPt;
- const Size aSize( pObj->GetCurrentBoundRect().GetSize() );
+ GDIMetaFile aMtf;
+ const Point aNullPt;
+ const Size aSize( pObj->GetCurrentBoundRect().GetSize() );
aMtf.AddAction( new MetaBmpExScaleAction( aNullPt, aSize, aGraphic.GetBitmapEx() ) );
aMtf.SetPrefSize( aSize );
@@ -1031,14 +1608,14 @@ sal_Bool SVGFilter::implCreateObjectsFromShape( const Reference< XShape >& rxSha
// -----------------------------------------------------------------------------
-sal_Bool SVGFilter::implCreateObjectsFromBackground( const Reference< XDrawPage >& rxMasterPage )
+sal_Bool SVGFilter::implCreateObjectsFromBackground( const Reference< XDrawPage >& rxDrawPage )
{
- Reference< XExporter > xExporter( mxMSF->createInstance( B2UCONST( "com.sun.star.drawing.GraphicExportFilter" ) ), UNO_QUERY );
+ Reference< XExporter > xExporter( mxMSF->createInstance( B2UCONST( "com.sun.star.drawing.GraphicExportFilter" ) ), UNO_QUERY );
sal_Bool bRet = sal_False;
if( xExporter.is() )
{
- GDIMetaFile aMtf;
+ GDIMetaFile aMtf;
Reference< XFilter > xFilter( xExporter, UNO_QUERY );
utl::TempFile aFile;
@@ -1052,11 +1629,11 @@ sal_Bool SVGFilter::implCreateObjectsFromBackground( const Reference< XDrawPage
aDescriptor[2].Name = B2UCONST( "ExportOnlyBackground" );
aDescriptor[2].Value <<= (sal_Bool) sal_True;
- xExporter->setSourceDocument( Reference< XComponent >( rxMasterPage, UNO_QUERY ) );
+ xExporter->setSourceDocument( Reference< XComponent >( rxDrawPage, UNO_QUERY ) );
xFilter->filter( aDescriptor );
aMtf.Read( *aFile.GetStream( STREAM_READ ) );
- (*mpObjects)[ rxMasterPage ] = ObjectRepresentation( rxMasterPage, aMtf );
+ (*mpObjects)[ rxDrawPage ] = ObjectRepresentation( rxDrawPage, aMtf );
bRet = sal_True;
}
@@ -1086,7 +1663,8 @@ OUString SVGFilter::implGetClassFromShape( const Reference< XShape >& rxShape )
else if( aShapeType.lastIndexOf( B2UCONST( "presentation.SlideNumberShape" ) ) != -1 )
aRet = B2UCONST( "Slide_Number" );
else
- aRet = B2UCONST( "Drawing" );
+ aRet = aShapeType;
+ //aRet = B2UCONST( "Drawing" );
return aRet;
}
@@ -1128,85 +1706,207 @@ IMPL_LINK( SVGFilter, CalcFieldHdl, EditFieldInfo*, pInfo )
{
OUString aRepresentation;
sal_Bool bFieldProcessed = sal_False;
-
- if( pInfo )
+ if( pInfo && mbPresentation )
{
- const ::rtl::OUString aHeaderText( B2UCONST( "HeaderText" ) );
- const ::rtl::OUString aFooterText( B2UCONST( "FooterText" ) );
- const ::rtl::OUString aDateTimeText( B2UCONST( "DateTimeText" ) );
- const ::rtl::OUString aPageNumberText( B2UCONST( "Number" ) );
-
- const Reference< XPropertySet > xDefaultPagePropertySet( mxDefaultPage, UNO_QUERY );
- Reference< XPropertySetInfo > xDefaultPagePropSetInfo( xDefaultPagePropertySet->getPropertySetInfo() );
+ bFieldProcessed = true;
- if( xDefaultPagePropSetInfo.is() )
+ if( !mbSinglePage )
{
- const SvxFieldData* pField = pInfo->GetField().GetField();
- Any aProperty;
+ static const ::rtl::OUString aHeaderId( B2UCONST( aOOOAttrHeaderField ) );
+ static const ::rtl::OUString aFooterId( B2UCONST( aOOOAttrFooterField ) );
+ static const ::rtl::OUString aDateTimeId( B2UCONST( aOOOAttrDateTimeField ) );
+ static const ::rtl::OUString aVariableDateTimeId( B2UCONST( aOOOAttrDateTimeField ) + B2UCONST( "-variable" ) );
+
- if( pField->ISA( SvxHeaderField ) &&
- xDefaultPagePropSetInfo->hasPropertyByName( aHeaderText ) )
+ const UCharSet * pCharSet = NULL;
+ UCharSetMap & aCharSetMap = mTextFieldCharSets[ mCreateOjectsCurrentMasterPage ];
+ const SvxFieldData* pField = pInfo->GetField().GetField();
+ if( ( pField->GetClassId() == SVX_HEADERFIELD ) && ( aCharSetMap.find( aHeaderId ) != aCharSetMap.end() ) )
{
- xDefaultPagePropertySet->getPropertyValue( aHeaderText ) >>= aRepresentation;
- bFieldProcessed = sal_True;
+ pCharSet = &( aCharSetMap[ aHeaderId ] );
}
- else if( pField->ISA( SvxFooterField ) &&
- xDefaultPagePropSetInfo->hasPropertyByName( aFooterText ) )
+ else if( ( pField->GetClassId() == SVX_FOOTERFIELD ) && ( aCharSetMap.find( aFooterId ) != aCharSetMap.end() ) )
{
- xDefaultPagePropertySet->getPropertyValue( aFooterText ) >>= aRepresentation;
- bFieldProcessed = sal_True;
+ pCharSet = &( aCharSetMap[ aFooterId ] );
}
- else if( pField->ISA( SvxDateTimeField ) &&
- xDefaultPagePropSetInfo->hasPropertyByName( aDateTimeText ) )
+ else if( pField->GetClassId() == SVX_DATEFIMEFIELD )
{
- xDefaultPagePropertySet->getPropertyValue( aDateTimeText ) >>= aRepresentation;
- bFieldProcessed = sal_True;
+ if( aCharSetMap.find( aDateTimeId ) != aCharSetMap.end() )
+ {
+ pCharSet = &( aCharSetMap[ aDateTimeId ] );
+ }
+ if( ( aCharSetMap.find( aVariableDateTimeId ) != aCharSetMap.end() ) && !aCharSetMap[ aVariableDateTimeId ].empty() )
+ {
+ SvxDateFormat eDateFormat = SVXDATEFORMAT_B, eCurDateFormat;
+ const UCharSet & aCharSet = aCharSetMap[ aVariableDateTimeId ];
+ UCharSet::const_iterator aChar = aCharSet.begin();
+ // we look for the most verbose date format
+ for( ; aChar != aCharSet.end(); ++aChar )
+ {
+ eCurDateFormat = (SvxDateFormat)( (int)( *aChar ) & 0x0f );
+ switch( eDateFormat )
+ {
+ case SVXDATEFORMAT_STDSMALL: ;
+ case SVXDATEFORMAT_A: ; // 13.02.96
+ case SVXDATEFORMAT_B: // 13.02.1996
+ switch( eCurDateFormat )
+ {
+ case SVXDATEFORMAT_C: ; // 13.Feb 1996
+ case SVXDATEFORMAT_D: // 13.February 1996
+ case SVXDATEFORMAT_E: ; // Tue, 13.February 1996
+ case SVXDATEFORMAT_STDBIG: ;
+ case SVXDATEFORMAT_F: // Tuesday, 13.February 1996
+ eDateFormat = eCurDateFormat;
+ break;
+ default:
+ break;
+ }
+ case SVXDATEFORMAT_C: ; // 13.Feb 1996
+ case SVXDATEFORMAT_D: // 13.February 1996
+ switch( eCurDateFormat )
+ {
+ case SVXDATEFORMAT_E: ; // Tue, 13.February 1996
+ case SVXDATEFORMAT_STDBIG: ;
+ case SVXDATEFORMAT_F: // Tuesday, 13.February 1996
+ eDateFormat = eCurDateFormat;
+ break;
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ // Independently of the date format, we always put all these characters by default.
+ // They should be enough to cover every time format.
+ aRepresentation = B2UCONST( "0123456789.:/-APM" );
+
+ if( eDateFormat )
+ {
+ String sDate;
+ LanguageType eLang = pInfo->GetOutliner()->GetLanguage( pInfo->GetPara(), pInfo->GetPos() );
+ SvNumberFormatter * pNumberFormatter = new SvNumberFormatter( ::comphelper::getProcessServiceFactory(), LANGUAGE_SYSTEM );
+ // We always collect the characters obtained by using the SVXDATEFORMAT_B (as: 13.02.1996)
+ // so we are sure to include any unusual day|month|year separator.
+ Date aDate( 1, 1, 1996 );
+ sDate += SvxDateField::GetFormatted( aDate, SVXDATEFORMAT_B, *pNumberFormatter, eLang );
+ switch( eDateFormat )
+ {
+ case SVXDATEFORMAT_E: ; // Tue, 13.February 1996
+ case SVXDATEFORMAT_STDBIG: ;
+ case SVXDATEFORMAT_F: // Tuesday, 13.February 1996
+ for( sal_uInt16 i = 1; i <= 7; ++i ) // we get all days in a week
+ {
+ aDate.SetDay( i );
+ sDate += SvxDateField::GetFormatted( aDate, eDateFormat, *pNumberFormatter, eLang );
+ }
+ // No break here! We need months too!
+ case SVXDATEFORMAT_C: ; // 13.Feb 1996
+ case SVXDATEFORMAT_D: // 13.February 1996
+ for( sal_uInt16 i = 1; i <= 12; ++i ) // we get all months in a year
+ {
+ aDate.SetMonth( i );
+ sDate += SvxDateField::GetFormatted( aDate, eDateFormat, *pNumberFormatter, eLang );
+ }
+ break;
+ case SVXDATEFORMAT_STDSMALL: ;
+ case SVXDATEFORMAT_A: ; // 13.02.96
+ case SVXDATEFORMAT_B: ; // 13.02.1996
+ default:
+ // nothing to do here, we always collect the characters needed for these cases.
+ break;
+ }
+ aRepresentation += sDate;
+ }
+ }
}
- else if( pField->ISA( SvxPageField ) &&
- xDefaultPagePropSetInfo->hasPropertyByName( aPageNumberText ) )
+ else if( pField->GetClassId() == SVX_PAGEFIELD )
{
- String aPageNumValue;
- sal_Int16 nPageNumber = 0;
-
- xDefaultPagePropertySet->getPropertyValue( aPageNumberText ) >>= nPageNumber;
-
- if( mpSdrModel )
+ switch( mVisiblePagePropSet.nPageNumberingType )
{
- sal_Bool bUpper = sal_False;
+ case SVX_CHARS_UPPER_LETTER:
+ aRepresentation = B2UCONST( "QWERTYUIOPASDFGHJKLZXCVBNM" );
+ break;
+ case SVX_CHARS_LOWER_LETTER:
+ aRepresentation = B2UCONST( "qwertyuiopasdfghjklzxcvbnm" );
+ break;
+ case SVX_ROMAN_UPPER:
+ aRepresentation = B2UCONST( "IVXLCDM" );
+ break;
+ case SVX_ROMAN_LOWER:
+ aRepresentation = B2UCONST( "ivxlcdm" );
+ break;
+ // arabic numbering type is the default
+ case SVX_ARABIC: ;
+ // in case the numbering type is not handled we fall back on arabic numbering
+ default:
+ aRepresentation = B2UCONST( "0123456789" );
+ break;
+ }
+ }
- switch( mpSdrModel->GetPageNumType() )
+ if( pCharSet != NULL )
+ {
+ UCharSet::const_iterator aChar = pCharSet->begin();
+ for( ; aChar != pCharSet->end(); ++aChar )
+ {
+ aRepresentation += OUString::valueOf( *aChar );
+ }
+ }
+ if( aRepresentation.isEmpty() )
+ aRepresentation = B2UCONST( "MM" );
+ pInfo->SetRepresentation( aRepresentation );
+ }
+ else
+ {
+ if( mVisiblePagePropSet.bAreBackgroundObjectsVisible )
+ {
+ const SvxFieldData* pField = pInfo->GetField().GetField();
+ if( ( pField->GetClassId() == SVX_HEADERFIELD ) && mVisiblePagePropSet.bIsHeaderFieldVisible )
+ {
+ aRepresentation = mVisiblePagePropSet.sHeaderText;
+ }
+ else if( ( pField->GetClassId() == SVX_FOOTERFIELD ) && mVisiblePagePropSet.bIsFooterFieldVisible )
+ {
+ aRepresentation = mVisiblePagePropSet.sFooterText;
+ }
+ else if( ( pField->GetClassId() == SVX_DATEFIMEFIELD ) && mVisiblePagePropSet.bIsDateTimeFieldVisible )
+ {
+ // TODO: implement the variable case
+ aRepresentation = mVisiblePagePropSet.sDateTimeText;
+ }
+ else if( ( pField->GetClassId() == SVX_PAGEFIELD ) && mVisiblePagePropSet.bIsPageNumberFieldVisible )
+ {
+ sal_Int16 nPageNumber = mVisiblePagePropSet.nPageNumber;
+ switch( mVisiblePagePropSet.nPageNumberingType )
{
case SVX_CHARS_UPPER_LETTER:
- aPageNumValue += (sal_Unicode)(char)( ( nPageNumber - 1 ) % 26 + 'A' );
+ aRepresentation = OUString::valueOf( (sal_Unicode)(char)( ( nPageNumber - 1 ) % 26 + 'A' ) );
break;
case SVX_CHARS_LOWER_LETTER:
- aPageNumValue += (sal_Unicode)(char)( ( nPageNumber- 1 ) % 26 + 'a' );
+ aRepresentation = OUString::valueOf( (sal_Unicode)(char)( ( nPageNumber - 1 ) % 26 + 'a' ) );
break;
case SVX_ROMAN_UPPER:
- bUpper = sal_True;
+ aRepresentation = SvxNumberFormat::CreateRomanString( nPageNumber, true /* upper */ );
+ break;
case SVX_ROMAN_LOWER:
- aPageNumValue += SvxNumberFormat::CreateRomanString( nPageNumber, bUpper );
+ aRepresentation = SvxNumberFormat::CreateRomanString( nPageNumber, false /* lower */ );
break;
- case SVX_NUMBER_NONE:
- aPageNumValue.Erase();
- aPageNumValue += sal_Unicode(' ');
+ // arabic numbering type is the default
+ case SVX_ARABIC: ;
+ // in case the numbering type is not handled we fall back on arabic numbering
+ default:
+ aRepresentation = OUString::valueOf( nPageNumber );
break;
- default : break;
}
- }
-
- if( !aPageNumValue.Len() )
- aPageNumValue += String::CreateFromInt32( nPageNumber );
-
- aRepresentation = aPageNumValue;
- bFieldProcessed = sal_True;
+ }
}
- }
- pInfo->SetRepresentation( aRepresentation );
+ pInfo->SetRepresentation( aRepresentation );
+ }
}
-
- return( bFieldProcessed ? 0 : maOldFieldHdl.Call( pInfo ) );
+ return ( bFieldProcessed ? 0 : maOldFieldHdl.Call( pInfo ) );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/svg/svgfilter.cxx b/filter/source/svg/svgfilter.cxx
index caf4fc67c71b..4baaa80d43cb 100644
--- a/filter/source/svg/svgfilter.cxx
+++ b/filter/source/svg/svgfilter.cxx
@@ -37,6 +37,30 @@
#include <com/sun/star/drawing/XDrawView.hpp>
#include <com/sun/star/frame/XDesktop.hdl>
#include <com/sun/star/frame/XController.hdl>
+
+
+#include <com/sun/star/view/XSelectionSupplier.hdl>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+#include <com/sun/star/drawing/XDrawSubController.hdl>
+#include <com/sun/star/drawing/XDrawSubController.hpp>
+#include <com/sun/star/container/XNamed.hdl>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/uno/XComponentContext.hdl>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/drawing/framework/XControllerManager.hdl>
+#include <com/sun/star/drawing/framework/XControllerManager.hpp>
+#include <com/sun/star/drawing/framework/XConfigurationController.hdl>
+#include <com/sun/star/drawing/framework/XConfigurationController.hpp>
+#include <com/sun/star/drawing/framework/XResource.hdl>
+#include <com/sun/star/drawing/framework/XResource.hpp>
+#include <com/sun/star/drawing/framework/XView.hdl>
+#include <com/sun/star/drawing/framework/XView.hpp>
+#include <com/sun/star/drawing/framework/ResourceId.hpp>
+#include <comphelper/processfactory.hxx>
+
+
+
+
#include <osl/mutex.hxx>
#include "svgfilter.hxx"
@@ -58,7 +82,9 @@ SVGFilter::SVGFilter( const Reference< XComponentContext >& rxCtx ) :
mpDefaultSdrPage( NULL ),
mpSdrModel( NULL ),
mbPresentation( sal_False ),
+ mbExportAll( sal_False ),
mpObjects( NULL )
+
{
}
@@ -75,6 +101,7 @@ SVGFilter::~SVGFilter()
// -----------------------------------------------------------------------------
+
sal_Bool SAL_CALL SVGFilter::filter( const Sequence< PropertyValue >& rDescriptor )
throw (RuntimeException)
{
@@ -90,47 +117,102 @@ sal_Bool SAL_CALL SVGFilter::filter( const Sequence< PropertyValue >& rDescripto
else
if( mxSrcDoc.is() )
{
- sal_Int16 nCurrentPageNumber = -1;
- uno::Reference< frame::XDesktop > xDesktop( mxMSF->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" )) ),
- uno::UNO_QUERY);
- if( xDesktop.is() )
+ if( !mbExportAll )
{
- uno::Reference< frame::XFrame > xFrame( xDesktop->getCurrentFrame() );
-
- if( xFrame.is() )
+ uno::Reference< frame::XDesktop > xDesktop( mxMSF->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" )) ),
+ uno::UNO_QUERY);
+ if( xDesktop.is() )
{
- uno::Reference< frame::XController > xController( xFrame->getController() );
+ uno::Reference< frame::XFrame > xFrame( xDesktop->getCurrentFrame() );
- if( xController.is() )
+ if( xFrame.is() )
{
- uno::Reference< drawing::XDrawView > xDrawView( xController, uno::UNO_QUERY );
+ uno::Reference< frame::XController > xController( xFrame->getController() );
- if( xDrawView.is() )
+ if( xController.is() )
{
- uno::Reference< drawing::XDrawPage > xDrawPage( xDrawView->getCurrentPage() );
-
- if( xDrawPage.is() )
+ /*
+ * Get the selection from the Slide Sorter Center Pane
+ */
+ if( !mSelectedPages.hasElements() )
{
- uno::Reference< beans::XPropertySet >( xDrawPage, uno::UNO_QUERY )->
- getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Number" ) ) ) >>= nCurrentPageNumber;
+ uno::Reference< beans::XPropertySet > xControllerPropertySet( xController, uno::UNO_QUERY );
+ uno::Reference< drawing::XDrawSubController > xSubController;
+ xControllerPropertySet->getPropertyValue(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SubController" ) ) )
+ >>= xSubController;
+
+ if( xSubController.is() )
+ {
+ uno::Any aSelection = xSubController->getSelection();
+ if( aSelection.hasValue() )
+ {
+ ObjectSequence aSelectedPageSequence;
+ aSelection >>= aSelectedPageSequence;
+ mSelectedPages.realloc( aSelectedPageSequence.getLength() );
+ for( sal_Int32 i = 0; i < mSelectedPages.getLength(); ++i )
+ {
+ uno::Reference< drawing::XDrawPage > xDrawPage( aSelectedPageSequence[i], uno::UNO_QUERY );
+ mSelectedPages[i] = xDrawPage;
+ }
+ }
+ }
}
}
}
}
}
- Sequence< PropertyValue > aNewDescriptor( rDescriptor );
-
- if( nCurrentPageNumber > 0 )
+ /*
+ * Export all slides
+ */
+ if( !mSelectedPages.hasElements() )
{
- const sal_uInt32 nOldLength = rDescriptor.getLength();
+ uno::Reference< drawing::XMasterPagesSupplier > xMasterPagesSupplier( mxSrcDoc, uno::UNO_QUERY );
+ uno::Reference< drawing::XDrawPagesSupplier > xDrawPagesSupplier( mxSrcDoc, uno::UNO_QUERY );
- aNewDescriptor.realloc( nOldLength + 1 );
- aNewDescriptor[ nOldLength ].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PagePos" ) );
- aNewDescriptor[ nOldLength ].Value <<= static_cast< sal_Int16 >( nCurrentPageNumber - 1 );
+ if( xMasterPagesSupplier.is() && xDrawPagesSupplier.is() )
+ {
+ uno::Reference< drawing::XDrawPages > xMasterPages( xMasterPagesSupplier->getMasterPages(), uno::UNO_QUERY );
+ uno::Reference< drawing::XDrawPages > xDrawPages( xDrawPagesSupplier->getDrawPages(), uno::UNO_QUERY );
+ if( xMasterPages.is() && xMasterPages->getCount() &&
+ xDrawPages.is() && xDrawPages->getCount() )
+ {
+ sal_Int32 nDPCount = xDrawPages->getCount();
+
+ mSelectedPages.realloc( nDPCount );
+ sal_Int32 i;
+ for( i = 0; i < nDPCount; ++i )
+ {
+ uno::Reference< drawing::XDrawPage > xDrawPage( xDrawPages->getByIndex( i ), uno::UNO_QUERY );
+ mSelectedPages[i] = xDrawPage;
+ }
+ }
+ }
+ }
+
+ /*
+ * We get all master page that are targeted by at least one draw page.
+ * The master page are put in an unordered set.
+ */
+ ObjectSet aMasterPageTargetSet;
+ for( sal_Int32 i = 0; i < mSelectedPages.getLength(); ++i )
+ {
+ uno::Reference< drawing::XMasterPageTarget > xMasterPageTarget( mSelectedPages[i], uno::UNO_QUERY );
+ if( xMasterPageTarget.is() )
+ {
+ aMasterPageTargetSet.insert( xMasterPageTarget->getMasterPage() );
+ }
+ }
+ // Later we move them to a uno::Sequence so we can get them by index
+ mMasterPageTargets.realloc( aMasterPageTargetSet.size() );
+ ObjectSet::const_iterator aElem = aMasterPageTargetSet.begin();
+ for( sal_Int32 i = 0; aElem != aMasterPageTargetSet.end(); ++aElem, ++i)
+ {
+ uno::Reference< drawing::XDrawPage > xMasterPage( *aElem, uno::UNO_QUERY );
+ mMasterPageTargets[i] = xMasterPage;
}
- bRet = implExport( aNewDescriptor );
+ bRet = implExport( rDescriptor );
}
else
bRet = sal_False;
diff --git a/filter/source/svg/svgfilter.hxx b/filter/source/svg/svgfilter.hxx
index 8ef5b626042f..6ddd10575470 100644
--- a/filter/source/svg/svgfilter.hxx
+++ b/filter/source/svg/svgfilter.hxx
@@ -58,7 +58,14 @@
#include <com/sun/star/java/XJavaVM.hpp>
#include <com/sun/star/java/XJavaThreadRegister_11.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/style/ParagraphAdjust.hdl>
+#include <com/sun/star/style/ParagraphAdjust.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/graphic/XGraphicProvider.hpp>
+#include <com/sun/star/graphic/XGraphicProvider.hdl>
+
+#include <boost/unordered_set.hpp>
#include <boost/unordered_map.hpp>
#include <osl/diagnose.h>
#include <rtl/process.h>
@@ -84,7 +91,9 @@
#include "svgfilter.hxx"
#include "svgscript.hxx"
+//#include "local/helpfunc.hpp"
+//using namespace ::com::sun::star;
#include <cstdio>
using namespace ::com::sun::star::uno;
@@ -96,6 +105,7 @@ using namespace ::com::sun::star::drawing;
using namespace ::com::sun::star::presentation;
using namespace ::com::sun::star::document;
using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::style;
using namespace ::com::sun::star::io;
using namespace ::com::sun::star::xml::sax;
using namespace ::std;
@@ -137,11 +147,11 @@ public:
protected:
-virtual void _ExportStyles( sal_Bool /* bUsed */ ) {}
-virtual void _ExportAutoStyles() {}
-virtual void _ExportContent() {}
-virtual void _ExportMasterStyles() {}
-virtual sal_uInt32 exportDoc( enum ::xmloff::token::XMLTokenEnum /* eClass */ ) { return 0; }
+ virtual void _ExportStyles( sal_Bool /* bUsed */ ) {}
+ virtual void _ExportAutoStyles() {}
+ virtual void _ExportContent() {}
+ virtual void _ExportMasterStyles() {}
+ virtual sal_uInt32 exportDoc( enum ::xmloff::token::XMLTokenEnum /* eClass */ ) { return 0; }
private:
@@ -164,20 +174,43 @@ private:
public:
- ObjectRepresentation();
- ObjectRepresentation( const Reference< XInterface >& rxIf,
- const GDIMetaFile& rMtf );
- ObjectRepresentation( const ObjectRepresentation& rPresentation );
- ~ObjectRepresentation();
+ ObjectRepresentation();
+ ObjectRepresentation( const Reference< XInterface >& rxIf,
+ const GDIMetaFile& rMtf );
+ ObjectRepresentation( const ObjectRepresentation& rPresentation );
+ ~ObjectRepresentation();
+
+ ObjectRepresentation& operator=( const ObjectRepresentation& rPresentation );
+ sal_Bool operator==( const ObjectRepresentation& rPresentation ) const;
+
+ const Reference< XInterface >& GetObject() const { return mxObject; }
+ sal_Bool HasRepresentation() const { return mpMtf != NULL; }
+ const GDIMetaFile& GetRepresentation() const { return *mpMtf; }
+};
- ObjectRepresentation& operator=( const ObjectRepresentation& rPresentation );
- sal_Bool operator==( const ObjectRepresentation& rPresentation ) const;
+// -------------------
+// - PagePropertySet -
+// -------------------
- const Reference< XInterface >& GetObject() const { return mxObject; }
- sal_Bool HasRepresentation() const { return mpMtf != NULL; }
- const GDIMetaFile& GetRepresentation() const { return *mpMtf; }
+struct PagePropertySet
+{
+ sal_Bool bIsBackgroundVisible;
+ sal_Bool bAreBackgroundObjectsVisible;
+ sal_Bool bIsPageNumberFieldVisible;
+ sal_Bool bIsDateTimeFieldVisible;
+ sal_Bool bIsFooterFieldVisible;
+ sal_Bool bIsHeaderFieldVisible;
+ sal_Int32 nPageNumberingType;
+ sal_Bool bIsDateTimeFieldFixed;
+ sal_Int16 nPageNumber;
+ sal_Int32 nDateTimeFormat;
+ ::rtl::OUString sDateTimeText;
+ ::rtl::OUString sFooterText;
+ ::rtl::OUString sHeaderText;
};
+
+
// ---------------------------
// - HashReferenceXInterface -
// ---------------------------
@@ -190,6 +223,25 @@ struct HashReferenceXInterface
}
};
+// ---------------------------
+// - HashOUString -
+// ---------------------------
+
+struct HashOUString
+{
+ size_t operator()( const ::rtl::OUString& oustr ) const { return static_cast< size_t >( oustr.hashCode() ); }
+};
+
+// ---------------------------
+// - HashUChar -
+// ---------------------------
+
+struct HashUChar
+{
+ size_t operator()( const sal_Unicode uchar ) const { return static_cast< size_t >( uchar ); }
+};
+
+
// -------------
// - SVGFilter -
// -------------
@@ -203,8 +255,16 @@ class SVGFilter : public cppu::WeakImplHelper4 < XFilter,
XExporter,
XExtendedFilterDetection >
{
- typedef ::boost::unordered_map< Reference< XInterface >, ObjectRepresentation, HashReferenceXInterface > ObjectMap;
+public:
+ typedef ::boost::unordered_map< Reference< XInterface >, ObjectRepresentation, HashReferenceXInterface > ObjectMap;
typedef ::std::vector< ::rtl::OUString > UniqueIdVector;
+ typedef ::boost::unordered_set< Reference< XInterface >, HashReferenceXInterface > ObjectSet;
+ typedef Sequence< Reference< XInterface > > ObjectSequence;
+ typedef Sequence< Reference< XDrawPage > > XDrawPageSequence;
+
+ typedef ::boost::unordered_set< sal_Unicode, HashUChar > UCharSet;
+ typedef ::boost::unordered_map< ::rtl::OUString, UCharSet, HashOUString > UCharSetMap;
+ typedef ::boost::unordered_map< Reference< XInterface >, UCharSetMap, HashReferenceXInterface > UCharSetMapMap;
private:
@@ -216,12 +276,24 @@ private:
SdrPage* mpDefaultSdrPage;
SdrModel* mpSdrModel;
sal_Bool mbPresentation;
+ sal_Bool mbExportAll;
+ sal_Bool mbSinglePage;
+ sal_Int32 mnVisiblePage;
+ sal_Int32 mnVisibleMasterPage;
+ sal_Bool mbIsPageVisible;
+ PagePropertySet mVisiblePagePropSet;
+ ::rtl::OUString msClipPathId;
+ UCharSetMapMap mTextFieldCharSets;
+ Reference< XInterface > mCreateOjectsCurrentMasterPage;
ObjectMap* mpObjects;
Reference< XComponent > mxSrcDoc;
Reference< XComponent > mxDstDoc;
Reference< XDrawPage > mxDefaultPage;
Sequence< PropertyValue > maFilterData;
+ XDrawPageSequence mSelectedPages;
+ XDrawPageSequence mMasterPageTargets;
+
UniqueIdVector maUniqueIdVector;
sal_Int32 mnMasterSlideId;
sal_Int32 mnSlideId;
@@ -234,32 +306,30 @@ private:
sal_Bool implExport( const Sequence< PropertyValue >& rDescriptor ) throw (RuntimeException);
Reference< XDocumentHandler > implCreateExportDocumentHandler( const Reference< XOutputStream >& rxOStm );
- sal_Bool implGenerateMetaData( const Reference< XDrawPages >& rxMasterPages,
- const Reference< XDrawPages >& rxDrawPages );
- sal_Bool implGenerateScript( const Reference< XDrawPages >& rxMasterPages,
- const Reference< XDrawPages >& rxDrawPages );
+ sal_Bool implGetPagePropSet( const Reference< XDrawPage > & rxPage );
+ sal_Bool implGenerateMetaData();
+ sal_Bool implGenerateScript();
- sal_Bool implExportDocument( const Reference< XDrawPages >& rxMasterPages,
- const Reference< XDrawPages >& rxDrawPages,
- sal_Int32 nPageToExport );
+ sal_Bool implExportDocument();
- sal_Bool implExportPages( const Reference< XDrawPages >& rxPages,
+ sal_Bool implExportPages( const XDrawPageSequence& rxPages,
sal_Int32 nFirstPage, sal_Int32 nLastPage,
sal_Int32 nVisiblePage, sal_Bool bMaster );
sal_Bool implExportShapes( const Reference< XShapes >& rxShapes );
sal_Bool implExportShape( const Reference< XShape >& rxShape );
- sal_Bool implCreateObjects( const Reference< XDrawPages >& rxMasterPages,
- const Reference< XDrawPages >& rxDrawPages,
- sal_Int32 nPageToExport );
+ sal_Bool implCreateObjects();
sal_Bool implCreateObjectsFromShapes( const Reference< XShapes >& rxShapes );
sal_Bool implCreateObjectsFromShape( const Reference< XShape >& rxShape );
sal_Bool implCreateObjectsFromBackground( const Reference< XDrawPage >& rxMasterPage );
::rtl::OUString implGetClassFromShape( const Reference< XShape >& rxShape );
::rtl::OUString implGetValidIDFromInterface( const Reference< XInterface >& rxIf, sal_Bool bUnique = sal_False );
-
+ sal_Bool implLookForFirstVisiblePage();
+ Any implSafeGetPagePropSet( const ::rtl::OUString & sPropertyName,
+ const Reference< XPropertySet > & rxPropSet,
+ const Reference< XPropertySetInfo > & rxPropSetInfo );
DECL_LINK( CalcFieldHdl, EditFieldInfo* );
protected:
@@ -280,7 +350,7 @@ protected:
public:
explicit SVGFilter( const Reference< XComponentContext >& rxCtx );
- virtual ~SVGFilter();
+ virtual ~SVGFilter();
};
// -----------------------------------------------------------------------------
diff --git a/filter/source/svg/svgscript.hxx b/filter/source/svg/svgscript.hxx
index 0c714f3a6952..f7b01e02b1df 100644
--- a/filter/source/svg/svgscript.hxx
+++ b/filter/source/svg/svgscript.hxx
@@ -26,132 +26,1379 @@
*
************************************************************************/
-static const char aSVGScriptA[] =
+
+static const char aSVGScript[] =
"<![CDATA[\n\
+\n\
+ /** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \n\
+ * - Presentation Engine v4.6 -\n\
+ * \n\
+ ** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \n\
+ * This program is free software: you can redistribute it and/or modify \n\
+ * it under the terms of the GNU General Public License as published by \n\
+ * the Free Software Foundation, either version 3 of the License, or \n\
+ * (at your option) any later version. \n\
+ * \n\
+ * This program is distributed in the hope that it will be useful, \n\
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of \n\
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the \n\
+ * GNU General Public License for more details. \n\
+ * \n\
+ * You should have received a copy of the GNU General Public License \n\
+ * along with this program. If not, see http://www.gnu.org/licenses/. \n\
+ * \n\
+ ** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \n\
+ * Some parts of this script are based on the JessyInk project:\n\
+ * http://code.google.com/p/jessyink/\n\
+ * \n\
+ ** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */\n\
+\n\
+ window.onload = init;\n\
+ \n\
+ \n\
+ // ooo elements\n\
+ var aOOOElemMetaSlides = 'ooo:meta_slides';\n\
+ var aOOOElemMetaSlide = 'ooo:meta_slide';\n\
+ var aOOOElemTextField = 'ooo:text_field';\n\
+ \n\
+ // ooo attributes\n\
+ var aOOOAttrNumberOfSlides = 'number-of-slides';\n\
+ var aOOOAttrNumberingType = 'page-numbering-type';\n\
+ \n\
+ var aOOOAttrSlide = 'slide';\n\
+ var aOOOAttrMaster = 'master';\n\
+ var aOOOAttrBackgroundVisibility = 'background-visibility';\n\
+ var aOOOAttrMasterObjectsVisibility = 'master-objects-visibility';\n\
+ var aOOOAttrPageNumberVisibility = 'page-number-visibility';\n\
+ var aOOOAttrDateTimeVisibility = 'date-time-visibility';\n\
+ var aOOOAttrFooterVisibility = 'footer-visibility';\n\
+ var aOOOAttrHeaderVisibility = 'header-visibility';\n\
+ var aOOOAttrDateTimeField = 'date-time-field';\n\
+ var aOOOAttrFooterField = 'footer-field';\n\
+ var aOOOAttrHeaderField = 'header-field';\n\
+ \n\
+ var aOOOAttrDateTimeFormat = 'date-time-format';\n\
+ \n\
+ var aOOOAttrTextAdjust = 'text-adjust';\n\
+ \n\
+ // Placeholder class names\n\
+ var aSlideNumberClassName = 'Slide_Number';\n\
+ var aDateTimeClassName = 'Date/Time';\n\
+ var aFooterClassName = 'Footer';\n\
+ var aHeaderClassName = 'Header';\n\
+ \n\
+ // Creating a namespace dictionary.\n\
+ var NSS = new Object();\n\
+ NSS['svg']='http://www.w3.org/2000/svg';\n\
+ NSS['rdf']='http://www.w3.org/1999/02/22-rdf-syntax-ns#';\n\
+ NSS['xlink']='http://www.w3.org/1999/xlink';\n\
+ NSS['xml']='http://www.w3.org/XML/1998/namespace';\n\
+ NSS['ooo'] = 'http://xml.openoffice.org/svg/export';\n\
+\n\
+ // Presentation modes.\n\
+ var SLIDE_MODE = 1;\n\
+ var INDEX_MODE = 2;\n\
+ \n\
+ // Mouse handler actions.\n\
+ var MOUSE_UP = 1;\n\
+ var MOUSE_DOWN = 2;\n\
+ var MOUSE_MOVE = 3;\n\
+ var MOUSE_WHEEL = 4;\n\
+ \n\
+ // Keycodes.\n\
+ var LEFT_KEY = 37; // cursor left keycode\n\
+ var UP_KEY = 38; // cursor up keycode\n\
+ var RIGHT_KEY = 39; // cursor right keycode\n\
+ var DOWN_KEY = 40; // cursor down keycode\n\
+ var PAGE_UP_KEY = 33; // page up keycode\n\
+ var PAGE_DOWN_KEY = 34; // page down keycode\n\
+ var HOME_KEY = 36; // home keycode\n\
+ var END_KEY = 35; // end keycode\n\
+ var ENTER_KEY = 13; \n\
+ var SPACE_KEY = 32;\n\
+ var ESCAPE_KEY = 27;\n\
+ \n\
+ // Visibility Values\n\
+ var HIDDEN = 0;\n\
+ var VISIBLE = 1;\n\
+ var INHERIT = 2;\n\
+ var aVisibilityAttributeValue = [ 'hidden', 'visible', 'inherit' ];\n\
+ var aVisibilityValue = { 'hidden' : HIDDEN, 'visible' : VISIBLE, 'inherit' : INHERIT };\n\
+ \n\
+ // Parameters\n\
+ var ROOT_NODE = document.getElementsByTagNameNS( NSS['svg'], 'svg' )[0];\n\
+ var WIDTH = 0;\n\
+ var HEIGHT = 0;\n\
+ var INDEX_COLUMNS_DEFAULT = 3;\n\
+ var INDEX_OFFSET = 0;\n\
+\n\
+ // Initialization.\n\
+ var theMetaDoc;\n\
+ var theSlideIndexPage;\n\
+ var currentMode = SLIDE_MODE; \n\
+ var processingEffect = false;\n\
var nCurSlide = 0;\n\
- var nSlides = 0;\n\
- var aSlides = new Object();\n\
- var aMasters = new Object();\n\
- var aMasterVisibilities = new Object();\n\
\n\
- function onClick( aEvt )\n\
+ // Initialize char and key code dictionaries.\n\
+ var charCodeDictionary = getDefaultCharCodeDictionary();\n\
+ var keyCodeDictionary = getDefaultKeyCodeDictionary();\n\
+ \n\
+ // Initialize mouse handler dictionary.\n\
+ var mouseHandlerDictionary = getDefaultMouseHandlerDictionary();\n\
+ \n\
+ /***************************\n\
+ ** OOP support functions **\n\
+ ***************************/\n\
+ \n\
+ function object( aObject )\n\
{\n\
- var nOffset = 0;\n\
+ var F = function() {};\n\
+ F.prototype = aObject;\n\
+ return new F();\n\
+ }\n\
+ \n\
+ function extend( aSubType, aSuperType ) \n\
+ {\n\
+ if (!aSuperType || !aSubType) {\n\
+ alert('extend failed, verify dependencies');\n\
+ }\n\
+ var OP = Object.prototype;\n\
+ var sp = aSuperType.prototype;\n\
+ var rp = object( sp );\n\
+ aSubType.prototype = rp;\n\
\n\
- if( aEvt.getButton() == 0 ) \n\
- nOffset = 1;\n\
- else if( aEvt.getButton() == 2 ) \n\
- nOffset = -1;\n\
+ rp.constructor = aSubType;\n\
+ aSubType.superclass = sp;\n\
\n\
- if( 0 != nOffset )\n\
- switchSlide( aEvt, nOffset );\n\
- }\n\
+ // assign constructor property\n\
+ if (aSuperType != Object && sp.constructor == OP.constructor) {\n\
+ sp.constructor = aSuperType;\n\
+ }\n\
\n\
- function onKeyPress( aEvt ) \n\
+ return aSubType;\n\
+ }\n\
+ \n\
+ // ------------------------------------------------------------------------------------------ //\n\
+ /**********************************\n\
+ ** Helper functions and classes **\n\
+ **********************************/\n\
+ \n\
+ function Rectangle( aSVGRectElem )\n\
{\n\
- var nCode = String.fromCharCode( aEvt.getCharCode() );\n\
- var nOffset = 0;\n\
+ var x = parseInt( aSVGRectElem.getAttribute( 'x' ) );\n\
+ var y = parseInt( aSVGRectElem.getAttribute( 'y' ) );\n\
+ var width = parseInt( aSVGRectElem.getAttribute( 'width' ) );\n\
+ var height = parseInt( aSVGRectElem.getAttribute( 'height' ) );\n\
+ \n\
+ this.left = x;\n\
+ this.right = x + width;\n\
+ this.top = y;\n\
+ this.bottom = y + height;\n\
+ }\n\
+ \n\
+ function log( message )\n\
+ {\n\
+ if( typeof console == 'object' )\n\
+ {\n\
+ console.log( message );\n\
+ } \n\
+ else if( typeof opera == 'object' )\n\
+ {\n\
+ opera.postError( message );\n\
+ } \n\
+ else if( typeof java == 'object' && typeof java.lang == 'object' )\n\
+ {\n\
+ java.lang.System.out.println( message );\n\
+ }\n\
+ }\n\
\n\
- if( ( ' ' == nCode ) || \n\
- ( ( !aEvt.getCtrlKey() && !aEvt.getAltKey() && !aEvt.getMetaKey() && !aEvt.getShiftKey() ) && \n\
- ( aEvt.getKeyCode() == aEvt.DOM_VK_PAGE_DOWN() ||\n\
- aEvt.getKeyCode() == aEvt.DOM_VK_PAGE_RIGHT() ) ) )\n\
+ function getNSAttribute( sNSPrefix, aElem, sAttrName )\n\
+ {\n\
+ if( !aElem ) return null;\n\
+ if( aElem.hasAttributeNS( NSS[sNSPrefix], sAttrName ) )\n\
{\n\
- nOffset = 1;\n\
+ return aElem.getAttributeNS( NSS[sNSPrefix], sAttrName );\n\
}\n\
- else if( ( !aEvt.getCtrlKey() && !aEvt.getAltKey() && !aEvt.getMetaKey() && !aEvt.getShiftKey() ) && \n\
- ( aEvt.getKeyCode() == aEvt.DOM_VK_PAGE_UP() ||\n\
- aEvt.getKeyCode() == aEvt.DOM_VK_LEFT() ) )\n\
+ return null;\n\
+ }\n\
+ \n\
+ function getOOOAttribute( aElem, sAttrName )\n\
+ {\n\
+ return getNSAttribute( 'ooo', aElem, sAttrName );\n\
+ }\n\
+ \n\
+ function setNSAttribute( sNSPrefix, aElem, sAttrName, aValue )\n\
+ {\n\
+ if( !aElem ) return false;\n\
+ if( 'setAttributeNS' in aElem )\n\
+ {\n\
+ aElem.setAttributeNS( NSS[sNSPrefix], sAttrName, aValue );\n\
+ return true;\n\
+ }\n\
+ else\n\
{\n\
- nOffset = -1\n\
+ aElem.setAttribute(sNSPrefix + ':' + sAttrName, aValue );\n\
+ return true;\n\
}\n\
+ }\n\
+ \n\
+ function setOOOAttribute( aElem, sAttrName, aValue )\n\
+ {\n\
+ return setNSAttribute( 'ooo', aElem, sAttrName, aValue );\n\
+ }\n\
+ \n\
+ function checkElemAndSetAttribute( aElem, sAttrName, aValue )\n\
+ {\n\
+ if( aElem ) \n\
+ aElem.setAttribute( sAttrName, aValue );\n\
+ }\n\
+ \n\
+ function getElementsByProperty( node, name )\n\
+ {\n\
+ var elems = new Array();\n\
\n\
- if( 0 != nOffset )\n\
- switchSlide( aEvt, nOffset );\n\
+ if( node.getAttribute( name ) )\n\
+ elems.push( node );\n\
+\n\
+ for( var counter = 0; counter < node.childNodes.length; ++counter )\n\
+ {\n\
+ if( node.childNodes[counter].nodeType == 1 )\n\
+ elems = elems.concat( getElementsByProperty( node.childNodes[counter], name ) );\n\
+ }\n\
+ return elems;\n\
}\n\
\n\
-";
-
-static const char aSVGScriptB[] =
-" function switchSlide( aEvt, nOffset ) \n\
+ function getElementsByClassName( aElem, sClassName )\n\
{\n\
- var nNextSlide = nCurSlide + nOffset;\n\
+ \n\
+ var aElementSet = new Array();\n\
+ // not all browsers support the 'getElementsByClassName' method\n\
+ if( 'getElementsByClassName' in aElem )\n\
+ {\n\
+ aElementSet = aElem.getElementsByClassName( sClassName );\n\
+ }\n\
+ else\n\
+ { \n\
+ var aElementSetByClassProperty = getElementsByProperty( aElem, 'class' );\n\
+ for( var i = 0; i < aElementSetByClassProperty.length; ++i )\n\
+ {\n\
+ var sAttrClassName = aElementSetByClassProperty[i].getAttribute( 'class' );\n\
+ if( sAttrClassName == sClassName )\n\
+ {\n\
+ aElementSet.push( aElementSetByClassProperty[i] );\n\
+ }\n\
+ }\n\
+ }\n\
+ return aElementSet;\n\
+ }\n\
+ \n\
+ function getElementByClassName( aElem, sClassName /*, sTagName */)\n\
+ {\n\
+ var aElementSet = getElementsByClassName( aElem, sClassName );\n\
+ if ( aElementSet.length == 1 )\n\
+ return aElementSet[0];\n\
+ else\n\
+ return null;\n\
+ }\n\
+ \n\
+ function getClassAttribute( aElem )\n\
+ {\n\
+ if( aElem )\n\
+ return aElem.getAttribute( 'class' );\n\
+ return '';\n\
+ }\n\
+ \n\
+ function initVisibilityProperty( aElement )\n\
+ {\n\
+ var nVisibility = VISIBLE;\n\
+ var sVisibility = aElement.getAttribute( 'visibility' );\n\
+ if( sVisibility ) nVisibility = aVisibilityValue[ sVisibility ];\n\
+ return nVisibility;\n\
+ }\n\
+ \n\
+ function setElementVisibility( aElement, nCurrentVisibility, nNewVisibility )\n\
+ {\n\
+ if( nCurrentVisibility != nNewVisibility )\n\
+ {\n\
+ checkElemAndSetAttribute( aElement, 'visibility', aVisibilityAttributeValue[nNewVisibility] );\n\
+ return nNewVisibility;\n\
+ }\n\
+ return nCurrentVisibility;\n\
+ }\n\
+ \n\
+ function getSafeIndex( nIndex, nMin, nMax )\n\
+ {\n\
+ if( nIndex < nMin )\n\
+ return nMin;\n\
+ else if( nIndex > nMax )\n\
+ return nMax;\n\
+ else\n\
+ return nIndex;\n\
+ }\n\
+\n\
+\n\
+ // ------------------------------------------------------------------------------------------ //\n\
+ /******************\n\
+ ** Core Classes **\n\
+ ******************/\n\
+ \n\
+ /** Class MetaDocument **\n\
+ * This class provides a pool of properties related to the whole presentation and \n\
+ * it is responsible for initializing the set of MetaSlide objects that handle \n\
+ * the meta information for each slide.\n\
+ */\n\
+ function MetaDocument( aMetaDocElem )\n\
+ {\n\
+ this.nNumberOfSlides = parseInt( aMetaDocElem.getAttributeNS( NSS['ooo'], aOOOAttrNumberOfSlides ) );\n\
+ assert( typeof this.nNumberOfSlides == 'number' && this.nNumberOfSlides > 0, \n\
+ 'MetaDocument: number of slides is zero or undefined.' );\n\
+ this.startSlideNumber = 0;\n\
+ this.sPageNumberingType = aMetaDocElem.getAttributeNS( NSS['ooo'], aOOOAttrNumberingType ) || 'arabic';\n\
+ this.aMetaSlideSet = new Array();\n\
+ this.aMasterPageSet = new Object();\n\
+ this.aTextFieldSet = new Array();\n\
+ this.slideNumberField = new SlideNumberField( this.sPageNumberingType );\n\
+ \n\
+ for( var i = 0; i < this.nNumberOfSlides; ++i )\n\
+ {\n\
+ var sMetaSlideId = aOOOElemMetaSlide + '_' + i;\n\
+ this.aMetaSlideSet.push( new MetaSlide( sMetaSlideId, this ) );\n\
+ }\n\
+ assert( this.aMetaSlideSet.length == this.nNumberOfSlides,\n\
+ 'MetaDocument: aMetaSlideSet.length != nNumberOfSlides.' );\n\
+ this.aMetaSlideSet[ this.startSlideNumber ].show();\n\
+ }\n\
+ \n\
+ MetaDocument.prototype.initPlaceholderShapes = function()\n\
+ {\n\
+ this.aMetaSlideSet[0].initPlaceholderShapes();\n\
+ };\n\
+ \n\
+ \n\
+ /** Class MetaSlide **\n\
+ * This class is responsible for managing the visibility of all master page shapes \n\
+ * and background related to a given slide element; it performs the creation and \n\
+ * the initialization of each Text Field object.\n\
+ */\n\
+ function MetaSlide( sMetaSlideId, aMetaDoc )\n\
+ {\n\
+ this.theDocument = document;\n\
+ this.id = sMetaSlideId;\n\
+ this.theMetaDoc = aMetaDoc;\n\
+ this.element = this.theDocument.getElementById( this.id );\n\
+ assert( this.element, 'MetaSlide: meta_slide element <' + this.id + '> not found.' );\n\
+ // - Initialize the Slide Element -\n\
+ this.slideId = this.element.getAttributeNS( NSS['ooo'], aOOOAttrSlide );\n\
+ this.slideElement = this.theDocument.getElementById( this.slideId );\n\
+ assert( this.slideElement, 'MetaSlide: slide element <' + this.slideId + '> not found.' );\n\
+ // - Initialize the Target Master Page Element -\n\
+ this.masterPage = this.initMasterPage();\n\
+ // - Initialize Background - \n\
+ //this.aBackground = getElementByClassName( this.aSlide, 'Background' );\n\
+ // - Initialize Visibility Properties -\n\
+ this.nAreMasterObjectsVisible = this.initVisibilityProperty( aOOOAttrMasterObjectsVisibility, VISIBLE );\n\
+ this.nIsBackgroundVisible = this.initVisibilityProperty( aOOOAttrBackgroundVisibility, VISIBLE );\n\
+ this.nIsPageNumberVisible = this.initVisibilityProperty( aOOOAttrPageNumberVisibility, HIDDEN );\n\
+ this.nIsDateTimeVisible = this.initVisibilityProperty( aOOOAttrDateTimeVisibility, VISIBLE );\n\
+ this.nIsFooterVisible = this.initVisibilityProperty( aOOOAttrFooterVisibility, VISIBLE );\n\
+ this.nIsHeaderVisible = this.initVisibilityProperty( aOOOAttrHeaderVisibility, VISIBLE );\n\
+ // - Initialize Master Page Text Fields (Placeholders)-\n\
+ this.aMPTextFieldSet = new Object();\n\
+ this.aMPTextFieldSet[aSlideNumberClassName] = this.initSlideNumberField();\n\
+ this.aMPTextFieldSet[aDateTimeClassName] = this.initDateTimeField( aOOOAttrDateTimeField );\n\
+ this.aMPTextFieldSet[aFooterClassName] = this.initFixedTextField( aOOOAttrFooterField );\n\
+ this.aMPTextFieldSet[aHeaderClassName] = this.initFixedTextField( aOOOAttrHeaderField );\n\
+ }\n\
+ \n\
+ /*** MetaSlide methods ***/\n\
+ MetaSlide.prototype =\n\
+ { \n\
+ /*** public methods ***/\n\
+ hide : function()\n\
+ {\n\
+ checkElemAndSetAttribute( this.slideElement, 'visibility', 'hidden' );\n\
+ \n\
+ this.masterPage.hide();\n\
+ this.masterPage.hideBackground();\n\
+ \n\
+ var aFieldSet = this.aMPTextFieldSet;\n\
+ var aShapeSet = this.masterPage.aPlaceholderShapeSet;\n\
+ if( aFieldSet[aSlideNumberClassName] ) aFieldSet[aSlideNumberClassName].hide( aShapeSet[aSlideNumberClassName] );\n\
+ if( aFieldSet[aDateTimeClassName] ) aFieldSet[aDateTimeClassName].hide( aShapeSet[aDateTimeClassName] );\n\
+ if( aFieldSet[aFooterClassName] ) aFieldSet[aFooterClassName].hide( aShapeSet[aFooterClassName] );\n\
+ if( aFieldSet[aHeaderClassName] ) aFieldSet[aHeaderClassName].hide( aShapeSet[aHeaderClassName] );\n\
+ },\n\
+ \n\
+ hideExceptMaster : function()\n\
+ {\n\
+ checkElemAndSetAttribute( this.slideElement, 'visibility', 'hidden' );\n\
+ },\n\
+ \n\
+ show : function()\n\
+ {\n\
+ checkElemAndSetAttribute( this.slideElement, 'visibility', 'visible' );\n\
+ \n\
+ this.masterPage.setVisibility( this.nAreMasterObjectsVisible );\n\
+ this.masterPage.setVisibilityBackground( this.nIsBackgroundVisible );\n\
\n\
- if( nNextSlide < 0 && nSlides > 0 )\n\
- nNextSlide = nSlides - 1;\n\
- else if( nNextSlide >= nSlides ) \n\
- nNextSlide = 0;\n\
\n\
- aSlides[ nCurSlide ].setAttributeNS( null, \"visibility\", \"hidden\" );\n\
- aSlides[ nNextSlide ].setAttributeNS( null, \"visibility\", \"visible\" );\n\
+ this.setTextFieldVisibility( aSlideNumberClassName, this.nIsPageNumberVisible );\n\
+ this.setTextFieldVisibility( aDateTimeClassName, this.nIsDateTimeVisible );\n\
+ this.setTextFieldVisibility( aFooterClassName, this.nIsFooterVisible );\n\
+ this.setTextFieldVisibility( aHeaderClassName, this.nIsHeaderVisible );\n\
+ },\n\
\n\
- var aCurMaster = aMasters[ nCurSlide ];\n\
- var aCurMasterVisibility = aMasterVisibilities[ nCurSlide ];\n\
+ getMasterPageId : function()\n\
+ {\n\
+ return this.masterPage.id;\n\
+ },\n\
+ \n\
+ getMasterPageElement : function()\n\
+ {\n\
+ return this.masterPage.element;\n\
+ },\n\
+ \n\
+ getBackground : function()\n\
+ {\n\
+ return getElementByClassName( this.slideElement, 'Background' );\n\
+ },\n\
\n\
- var aNextMaster = aMasters[ nNextSlide ];\n\
- var aNextMasterVisibility = aMasterVisibilities[ nNextSlide ];\n\
+ getMasterPageBackground : function()\n\
+ {\n\
+ return this.masterPage.background;\n\
+ },\n\
+ \n\
+ /*** private methods ***/\n\
+ initMasterPage : function()\n\
+ {\n\
+ var sMasterPageId = this.element.getAttributeNS( NSS['ooo'], aOOOAttrMaster );\n\
+ if( !this.theMetaDoc.aMasterPageSet.hasOwnProperty( sMasterPageId ) )\n\
+ this.theMetaDoc.aMasterPageSet[ sMasterPageId ] = new MasterPage( sMasterPageId );\n\
+ return this.theMetaDoc.aMasterPageSet[ sMasterPageId ];\n\
+ },\n\
+ \n\
+ initVisibilityProperty : function( aVisibilityAttribute, nDefaultValue )\n\
+ {\n\
+ var nVisibility = nDefaultValue;\n\
+ var sVisibility = getOOOAttribute( this.element, aVisibilityAttribute );\n\
+ if( sVisibility )\n\
+ nVisibility = aVisibilityValue[ sVisibility ];\n\
+ return nVisibility;\n\
+ },\n\
+ \n\
+ initSlideNumberField : function()\n\
+ {\n\
+ return this.theMetaDoc.slideNumberField;\n\
+ },\n\
+ \n\
+ initDateTimeField : function( aOOOAttrDateTimeField )\n\
+ {\n\
+ var sTextFieldId = getOOOAttribute( this.element, aOOOAttrDateTimeField );\n\
+ if( !sTextFieldId ) return null;\n\
\n\
- if( ( aCurMaster != aNextMaster ) || ( aCurMasterVisibility != aNextMasterVisibility ) ) \n\
+ var nLength = aOOOElemTextField.length + 1;\n\
+ var nIndex = parseInt(sTextFieldId.substring( nLength ) );\n\
+ if( typeof nIndex != 'number') return null;\n\
+ \n\
+ if( !this.theMetaDoc.aTextFieldSet[ nIndex ] )\n\
+ { \n\
+ var aTextField;\n\
+ var aTextFieldElem = document.getElementById( sTextFieldId );\n\
+ var sClassName = getClassAttribute( aTextFieldElem );\n\
+ if( sClassName == 'FixedDateTimeField' )\n\
+ {\n\
+ aTextField = new FixedTextField( aTextFieldElem );\n\
+ }\n\
+ else if( sClassName == 'VariableDateTimeField' )\n\
+ {\n\
+ aTextField = new VariableDateTimeField( aTextFieldElem );\n\
+ }\n\
+ else\n\
+ {\n\
+ aTextField = null;\n\
+ }\n\
+ this.theMetaDoc.aTextFieldSet[ nIndex ] = aTextField;\n\
+ }\n\
+ return this.theMetaDoc.aTextFieldSet[ nIndex ];\n\
+ },\n\
+ \n\
+ initFixedTextField : function( aOOOAttribute )\n\
{\n\
- if( aCurMaster != aNextMaster )\n\
- aCurMaster.setAttributeNS( null, \"visibility\", \"hidden\" );\n\
+ var sTextFieldId = getOOOAttribute( this.element, aOOOAttribute );\n\
+ if( !sTextFieldId ) return null;\n\
+ \n\
+ var nLength = aOOOElemTextField.length + 1;\n\
+ var nIndex = parseInt( sTextFieldId.substring( nLength ) );\n\
+ if( typeof nIndex != 'number') return null;\n\
\n\
- aNextMaster.setAttributeNS( null, \"visibility\", aNextMasterVisibility );\n\
+ if( !this.theMetaDoc.aTextFieldSet[ nIndex ] )\n\
+ {\n\
+ var aTextFieldElem = document.getElementById( sTextFieldId );\n\
+ this.theMetaDoc.aTextFieldSet[ nIndex ] \n\
+ = new FixedTextField( aTextFieldElem );\n\
+ }\n\
+ return this.theMetaDoc.aTextFieldSet[ nIndex ];\n\
+ },\n\
+ \n\
+ setTextFieldVisibility : function( sClassName, nVisible )\n\
+ {\n\
+ var aTextField = this.aMPTextFieldSet[ sClassName ];\n\
+ var aPlaceholderShape = this.masterPage.aPlaceholderShapeSet[ sClassName ];\n\
+ if( !aTextField ) return;\n\
+ aTextField.setVisibility( this.nAreMasterObjectsVisible & nVisible, aPlaceholderShape );\n\
}\n\
-\n\
- nCurSlide = nNextSlide; \n\
+ };\n\
+ \n\
+ /** Class MasterPage **\n\
+ * This class gives access to a master page element, its background and \n\
+ * each placeholder shape present in the master page element.\n\
+ */\n\
+ function MasterPage( sMasterPageId )\n\
+ {\n\
+ this.id = sMasterPageId;\n\
+ this.element = document.getElementById( this.id );\n\
+ assert( this.element, 'MasterPage: master page element <' + this.id + '> not found.' );\n\
+ this.background = getElementByClassName( this.element, 'Background' );\n\
+ this.backgroundId = this.background.getAttribute( 'id' );\n\
+ this.backgroundVisibility = initVisibilityProperty( this.background );\n\
+ this.backgroundObjects = getElementByClassName( this.element, 'BackgroundObjects' );\n\
+ this.backgroundObjectsId = this.backgroundObjects.getAttribute( 'id' );\n\
+ this.backgroundObjectsVisibility = initVisibilityProperty( this.backgroundObjects );\n\
+ this.aPlaceholderShapeSet = new Object();\n\
+ this.initPlaceholderShapes();\n\
}\n\
+ \n\
+ /*** MasterPage methods ***/\n\
+ MasterPage.prototype =\n\
+ {\n\
+ /*** public method ***/ \n\
+ setVisibility : function( nVisibility )\n\
+ {\n\
+ this.backgroundObjectsVisibility = setElementVisibility( this.backgroundObjects, this.backgroundObjectsVisibility, nVisibility );\n\
+ },\n\
+ \n\
+ setVisibilityBackground : function( nVisibility )\n\
+ {\n\
+ this.backgroundVisibility = setElementVisibility( this.background, this.backgroundVisibility, nVisibility );\n\
+ },\n\
\n\
- function init() \n\
+ hide : function()\n\
+ {\n\
+ this.setVisibility( HIDDEN );\n\
+ },\n\
+ \n\
+ show : function()\n\
+ {\n\
+ this.setVisibility( VISIBLE );\n\
+ },\n\
+ \n\
+ hideBackground : function()\n\
+ {\n\
+ this.setVisibilityBackground( HIDDEN );\n\
+ },\n\
+ \n\
+ showBackground : function()\n\
+ {\n\
+ this.setVisibilityBackground( VISIBLE );\n\
+ },\n\
+ \n\
+ /*** private method ***/\n\
+ initPlaceholderShapes : function()\n\
+ {\n\
+ this.aPlaceholderShapeSet[ aSlideNumberClassName ] = new PlaceholderShape( this, aSlideNumberClassName );\n\
+ this.aPlaceholderShapeSet[ aDateTimeClassName ] = new PlaceholderShape( this, aDateTimeClassName );\n\
+ this.aPlaceholderShapeSet[ aFooterClassName ] = new PlaceholderShape( this, aFooterClassName );\n\
+ this.aPlaceholderShapeSet[ aHeaderClassName ] = new PlaceholderShape( this, aHeaderClassName );\n\
+ }\n\
+ };\n\
+ \n\
+ /** Class PlaceholderShape **\n\
+ * This class manages the visibility and the text content of a placeholder shape. \n\
+ */\n\
+ function PlaceholderShape( aMasterPage, sClassName )\n\
+ {\n\
+ this.masterPage = aMasterPage;\n\
+ this.className = sClassName;\n\
+ this.element = null;\n\
+ this.textElement = null;\n\
+ \n\
+ this.init();\n\
+ }\n\
+ \n\
+ /* public methods */\n\
+ PlaceholderShape.prototype.setTextContent = function( sText )\n\
+ {\n\
+ if( !this.textElement )\n\
+ {\n\
+ log( 'error: PlaceholderShape.setTextContent: text element is not valid in placeholder of type ' \n\
+ + this.className + ' that belongs to master slide ' + this.masterPage.id );\n\
+ return; \n\
+ }\n\
+ this.textElement.textContent = sText;\n\
+ };\n\
+ \n\
+ PlaceholderShape.prototype.setVisibility = function( nVisibility )\n\
+ {\n\
+ this.element.setAttribute( 'visibility', aVisibilityAttributeValue[nVisibility] );\n\
+ };\n\
+ \n\
+ PlaceholderShape.prototype.show = function()\n\
+ {\n\
+ this.element.setAttribute( 'visibility', 'visible' );\n\
+ };\n\
+ \n\
+ PlaceholderShape.prototype.hide = function()\n\
{\n\
- nSlides = document.getElementById( \"meta_slides\" ).getAttributeNS( null, \"numberOfSlides\" );\n\
+ this.element.setAttribute( 'visibility', 'hidden' );\n\
+ };\n\
+ \n\
+ /* private methods */\n\
+ PlaceholderShape.prototype.init = function()\n\
+ {\n\
+ var aShapeElem = getElementByClassName( this.masterPage.backgroundObjects, this.className );\n\
+ if( !aShapeElem ) return;\n\
+ \n\
+ this.element = aShapeElem;\n\
+ this.element.setAttribute( 'visibility', 'hidden' );\n\
+ \n\
+ var aSVGRectElemSet = this.element.getElementsByTagName( 'rect' );\n\
+ if( aSVGRectElemSet.length != 1) return;\n\
+ \n\
+ var aRect = new Rectangle( aSVGRectElemSet[0] );\n\
+ \n\
+ var sTextAdjust = getOOOAttribute( this.element, aOOOAttrTextAdjust ) || 'left';\n\
+ var sTextAnchor, sX;\n\
+ if( sTextAdjust == 'left' )\n\
+ {\n\
+ sTextAnchor = 'start';\n\
+ sX = String( aRect.left );\n\
+ }\n\
+ else if( sTextAdjust == 'right' )\n\
+ {\n\
+ sTextAnchor = 'end';\n\
+ sX = String( aRect.right );\n\
+ }\n\
+ else if( sTextAdjust == 'center' )\n\
+ {\n\
+ sTextAnchor = 'middle';\n\
+ var nMiddle = ( aRect.left + aRect.right ) / 2;\n\
+ sX = String( parseInt( String( nMiddle ) ) );\n\
+ }\n\
+ \n\
+ \n\
+ var aTextBlockElemArray = getElementsByClassName( this.element, 'TextBlock' );\n\
+ if( aTextBlockElemArray.length == 0 ) return;\n\
+ \n\
+ var aParentElem = aTextBlockElemArray[0].parentNode;\n\
+ var aTextBlockElem = aTextBlockElemArray[0].cloneNode( false /* no deep clone */ );\n\
+ \n\
+ var aGlyphElemArray = aTextBlockElemArray[0].getElementsByTagName( 'text' );\n\
+ //var aGlyphElemArray = getElementsByClassName( aTextBlockElemArray[0], 'Glyph' );\n\
+ if( aGlyphElemArray.length == 0 ) return;\n\
+ var sY = String( aGlyphElemArray[0].getAttribute( 'y' ) ); \n\
+ \n\
+ \n\
+ var aTextElem = document.createElementNS( NSS['svg'], 'text' );\n\
+ aTextElem.setAttribute( 'class', 'PlaceholderContent' );\n\
+ aTextElem.setAttribute( 'text-anchor', sTextAnchor );\n\
+ aTextElem.setAttribute( 'x', sX );\n\
+ aTextElem.setAttribute( 'y', sY );\n\
+ aTextBlockElem.appendChild( aTextElem );\n\
+ aParentElem.replaceChild( aTextBlockElem, aTextBlockElemArray[0] );\n\
+ \n\
+ var nLast = aTextBlockElemArray.length - 1;\n\
+ for( var i = nLast; i > 0 ; --i )\n\
+ {\n\
+ aParentElem.removeChild( aTextBlockElemArray[i] );\n\
+ }\n\
\n\
- for( i = 0; i < nSlides; i++ )\n\
+ this.textElement = getElementByClassName( aParentElem, 'PlaceholderContent' );\n\
+ };\n\
+\n\
+ \n\
+ // ------------------------------------------------------------------------------------------ //\n\
+ /********************************\n\
+ ** Text Field Class Hierarchy **\n\
+ ********************************/\n\
+ \n\
+ /** Class TextField **\n\
+ * This class is the root abstract class of the hierarchy.\n\
+ * The 'shapeElement' property is the shape element to which \n\
+ * this TextField object provides the text content.\n\
+ */\n\
+ function TextField( aTextFieldElem )\n\
+ {\n\
+ this.bIsUpdated = false;\n\
+ }\n\
+ \n\
+ /*** TextField public methods ***/\n\
+ TextField.prototype.getShapeElement = function()\n\
+ {\n\
+ return this.shapeElement;\n\
+ };\n\
+ \n\
+ TextField.prototype.setVisibility = function( nVisibility, aPlaceholderShape )\n\
+ {\n\
+ if( !this.bIsUpdated )\n\
+ {\n\
+ if( nVisibility )\n\
+ {\n\
+ this.update( aPlaceholderShape );\n\
+ this.bIsUpdated = true;\n\
+ }\n\
+ aPlaceholderShape.setVisibility( nVisibility );\n\
+ }\n\
+ else if( !nVisibility ) \n\
{\n\
- var aSlide = document.getElementById( \"meta_slide\" + i );\n\
+ aPlaceholderShape.hide();\n\
+ this.bIsUpdated = false;\n\
+ }\n\
+ };\n\
+ \n\
+ TextField.prototype.show = function( aPlaceholderShape )\n\
+ {\n\
+ this.setVisibility( VISIBLE, aPlaceholderShape );\n\
+ };\n\
+ \n\
+ TextField.prototype.hide = function( aPlaceholderShape )\n\
+ {\n\
+ this.setVisibility( HIDDEN, aPlaceholderShape );\n\
+ };\n\
+ \n\
+ \n\
+ /** Class FixedTextField **\n\
+ * This class handles text field with a fixed text.\n\
+ * The text content is provided by the 'text' property.\n\
+ */\n\
+ function FixedTextField( aTextFieldElem )\n\
+ {\n\
+ TextField.call( this, aTextFieldElem );\n\
+ this.text = aTextFieldElem.textContent;\n\
+ }\n\
+ extend( FixedTextField, TextField );\n\
+ \n\
+ FixedTextField.prototype.update = function( aPlaceholderShape )\n\
+ { \n\
+ aPlaceholderShape.setTextContent( this.text );\n\
+ };\n\
+\n\
\n\
- aSlides[ i ] = document.getElementById( aSlide.getAttributeNS( null, \"slide\" ) );\n\
- aMasters[ i ] = document.getElementById( aSlide.getAttributeNS( null, \"master\" ) );\n\
- aMasterVisibilities[ i ] = aSlide.getAttributeNS( null, \"master-visibility\" );\n\
+ /** Class VariableDateTimeField **\n\
+ * Provide the text content for the related shape by generating the current \n\
+ * date/time in the format specified by the 'dateTimeFormat' property.\n\
+ */\n\
+ function VariableDateTimeField( aTextFieldElem )\n\
+ {\n\
+ VariableDateTimeField.superclass.constructor.call( this, aTextFieldElem );\n\
+ this.dateTimeFormat = getOOOAttribute( aTextFieldElem, aOOOAttrDateTimeFormat );\n\
+ }\n\
+ extend( VariableDateTimeField, TextField );\n\
+ \n\
+ /*** public methods ***/\n\
+ VariableDateTimeField.prototype.update = function( aPlaceholderShape )\n\
+ { \n\
+ var sText = this.createDateTimeText( this.dateTimeFormat );\n\
+ aPlaceholderShape.setTextContent( sText );\n\
+ };\n\
+ \n\
+ VariableDateTimeField.prototype.createDateTimeText = function( sDateTimeFormat )\n\
+ {\n\
+ // TODO handle date/time format\n\
+ var aDate = Date();\n\
+ var sDate = aDate.toLocaleString();\n\
+ return sDate;\n\
+ };\n\
+ \n\
+ /** Class SlideNumberField **\n\
+ * Provides the text content to the related shape by generating \n\
+ * the current page number in the given page numbering type.\n\
+ */\n\
+ function SlideNumberField( sPageNumberingType )\n\
+ {\n\
+ SlideNumberField.superclass.constructor.call( this, null );\n\
+ this.pageNumberingType = sPageNumberingType;\n\
+ }\n\
+ extend( SlideNumberField, TextField );\n\
+ \n\
+ /*** public methods ***/\n\
+ SlideNumberField.prototype.getNumberingType = function()\n\
+ {\n\
+ return this.pageNumberingType;\n\
+ };\n\
+ \n\
+ SlideNumberField.prototype.update = function( aPlaceholderShape )\n\
+ { \n\
+ var sText = this.createSlideNumberText( nCurSlide + 1, this.getNumberingType() );\n\
+ aPlaceholderShape.setTextContent( sText );\n\
+ };\n\
+ \n\
+ SlideNumberField.prototype.createSlideNumberText = function( nSlideNumber, sNumberingType )\n\
+ {\n\
+ // TODO handle page numbering type\n\
+ return String( nSlideNumber );\n\
+ };\n\
+ \n\
+ \n\
+ \n\
+ //------------------------------------------------------------------------------------------- //\n\
+ /********************************\n\
+ ** Slide Index Classes **\n\
+ ********************************/\n\
+ \n\
+ /** Class SlideIndePagex **\n\
+ * This class is responsible for handling the slide index page\n\
+ */\n\
+ function SlideIndexPage()\n\
+ {\n\
+ this.pageElementId = 'slide_index';\n\
+ this.pageBgColor = 'rgb(252,252,252)';\n\
+ this.pageElement = this.createPageElement();\n\
+ assert( this.pageElement, 'SlideIndexPage: pageElement is not valid' );\n\
+ this.indexColumns = INDEX_COLUMNS_DEFAULT;\n\
+ this.totalThumbnails = this.indexColumns * this.indexColumns;\n\
+ this.selectedSlideIndex = nCurSlide;\n\
+ \n\
+ // set up layout paramers\n\
+ this.xSpacingFactor = 600/28000;\n\
+ this.ySpacingFactor = 450/21000;\n\
+ this.xSpacing = WIDTH * this.xSpacingFactor;\n\
+ this.ySpacing = HEIGHT * this.ySpacingFactor;\n\
+ this.halfBorderWidthFactor = ( 300/28000 ) * ( this.indexColumns / 3 );\n\
+ this.halfBorderWidth = WIDTH * this.halfBorderWidthFactor;\n\
+ this.borderWidth = 2 * this.halfBorderWidth;\n\
+ // the following formula is used to compute the slide shrinking factor: \n\
+ // scaleFactor = ( WIDTH - ( columns + 1 ) * xSpacing ) / ( columns * ( WIDTH + borderWidth ) )\n\
+ // indeed we can divide everything by WIDTH:\n\
+ this.scaleFactor = ( 1 - ( this.indexColumns + 1 ) * this.xSpacingFactor ) / \n\
+ ( this.indexColumns * ( 1 + 2 * this.halfBorderWidthFactor ) );\n\
+ \n\
+ // We create a Thumbnail Border and Thumbnail MouseArea rectangle template that will be \n\
+ // used by every Thumbnail. The Mouse Area rectangle is used in order to trigger the \n\
+ // mouseover event properly even when the slide background is hidden.\n\
+ this.thumbnailMouseAreaTemplateId = 'thumbnail_mouse_area';\n\
+ this.thumbnailMouseAreaTemplateElement = null;\n\
+ this.thumbnailBorderTemplateId = 'thumbnail_border';\n\
+ this.thumbnailBorderTemplateElement = null;\n\
+ this.createTemplateElements();\n\
+ \n\
+ // Now we create the grid of thumbnails\n\
+ this.aThumbnailSet = new Array( this.totalThumbnails );\n\
+ for( var i = 0; i < this.totalThumbnails; ++i )\n\
+ {\n\
+ this.aThumbnailSet[i] = new Thumbnail( this, i );\n\
+ this.aThumbnailSet[i].updateView();\n\
}\n\
+ \n\
+ this.curThumbnailIndex = this.selectedSlideIndex % this.totalThumbnails;\n\
+ this.aThumbnailSet[ this.curThumbnailIndex ].select();\n\
}\n\
+ \n\
+ \n\
+ /* public methods */\n\
+ SlideIndexPage.prototype.getTotalThumbnails = function()\n\
+ {\n\
+ return this.totalThumbnails;\n\
+ };\n\
+ \n\
+ SlideIndexPage.prototype.show = function()\n\
+ {\n\
+ this.pageElement.setAttribute( 'display', 'inherit' ); \n\
+ };\n\
+ \n\
+ SlideIndexPage.prototype.hide = function()\n\
+ {\n\
+ this.pageElement.setAttribute( 'display', 'none' );\n\
+ };\n\
+ \n\
+ /** setSelection\n\
+ * \n\
+ * Change the selected thumbnail from the current one to the thumbnail with index nIndex.\n\
+ * \n\
+ * @param nIndex - the thumbnail index\n\
+ */\n\
+ SlideIndexPage.prototype.setSelection = function( nIndex )\n\
+ {\n\
+ nIndex = getSafeIndex( nIndex, 0, this.getTotalThumbnails() - 1 );\n\
+ if( this.curThumbnailIndex != nIndex )\n\
+ {\n\
+ this.aThumbnailSet[ this.curThumbnailIndex ].unselect();\n\
+ this.aThumbnailSet[ nIndex ].select();\n\
+ this.curThumbnailIndex = nIndex;\n\
+ }\n\
+ this.selectedSlideIndex = this.aThumbnailSet[ nIndex ].slideIndex;\n\
+ };\n\
+ \n\
+ SlideIndexPage.prototype.createPageElement = function()\n\
+ {\n\
+ var aPageElement = document.createElementNS( NSS['svg'], 'g' );\n\
+ aPageElement.setAttribute( 'id', this.pageElementId );\n\
+ aPageElement.setAttribute( 'display', 'none' );\n\
+ \n\
+ // the slide index page background\n\
+ var sPageBgColor = this.pageBgColor + ';';\n\
+ var aRectElement = document.createElementNS( NSS['svg'], 'rect' );\n\
+ aRectElement.setAttribute( 'x', 0 );\n\
+ aRectElement.setAttribute( 'y', 0 );\n\
+ aRectElement.setAttribute( 'width', WIDTH );\n\
+ aRectElement.setAttribute( 'height', HEIGHT );\n\
+ aRectElement.setAttribute( 'style', 'stroke:none;fill:' + sPageBgColor );\n\
+ \n\
+ aPageElement.appendChild( aRectElement );\n\
+ // The index page is appended after all slide elements \n\
+ // so when it is displayed it covers them all\n\
+ ROOT_NODE.appendChild( aPageElement );\n\
+ return( document.getElementById( this.pageElementId ) );\n\
+ };\n\
+ \n\
+ SlideIndexPage.prototype.createTemplateElements = function()\n\
+ { \n\
+ // We define a Rect element as a template of thumbnail border for all slide-thumbnails.\n\
+ // The stroke color is defined individually by each thumbnail according to \n\
+ // its selection status.\n\
+ var aDefsElement = document.createElementNS( NSS['svg'], 'defs' );\n\
+ var aRectElement = document.createElementNS( NSS['svg'], 'rect' );\n\
+ aRectElement.setAttribute( 'id', this.thumbnailBorderTemplateId );\n\
+ aRectElement.setAttribute( 'x', -this.halfBorderWidth );\n\
+ aRectElement.setAttribute( 'y', -this.halfBorderWidth );\n\
+ aRectElement.setAttribute( 'rx', this.halfBorderWidth );\n\
+ aRectElement.setAttribute( 'ry', this.halfBorderWidth );\n\
+ aRectElement.setAttribute( 'width', WIDTH + this.halfBorderWidth );\n\
+ aRectElement.setAttribute( 'height', HEIGHT + this.halfBorderWidth );\n\
+ aRectElement.setAttribute( 'stroke-width', this.borderWidth );\n\
+ aRectElement.setAttribute( 'fill', 'none' );\n\
+ aDefsElement.appendChild( aRectElement );\n\
+ \n\
+ // We define a Rect element as a template of mouse area for triggering the mouseover event.\n\
+ // A copy is used by each thumbnail element.\n\
+ aRectElement = document.createElementNS( NSS['svg'], 'rect' );\n\
+ aRectElement.setAttribute( 'id', this.thumbnailMouseAreaTemplateId );\n\
+ aRectElement.setAttribute( 'x', 0 );\n\
+ aRectElement.setAttribute( 'y', 0 );\n\
+ aRectElement.setAttribute( 'width', WIDTH );\n\
+ aRectElement.setAttribute( 'height', HEIGHT );\n\
+ aRectElement.setAttribute( 'fill', this.pageBgColor );\n\
+ aDefsElement.appendChild( aRectElement );\n\
+ \n\
+ this.pageElement.appendChild( aDefsElement );\n\
+ \n\
+ this.thumbnailMouseAreaTemplateElement = document.getElementById( this.thumbnailMouseAreaTemplateId );\n\
+ this.thumbnailBorderTemplateElement = document.getElementById( this.thumbnailBorderTemplateId );\n\
+ };\n\
+ \n\
+ SlideIndexPage.prototype.decreaseNumberOfColumns = function()\n\
+ {\n\
+ this.setNumberOfColumns( this.indexColumns - 1 );\n\
+ };\n\
+ \n\
+ SlideIndexPage.prototype.increaseNumberOfColumns = function()\n\
+ {\n\
+ this.setNumberOfColumns( this.indexColumns + 1 );\n\
+ };\n\
+ \n\
+ SlideIndexPage.prototype.resetNumberOfColumns = function()\n\
+ {\n\
+ this.setNumberOfColumns( INDEX_COLUMNS_DEFAULT );\n\
+ };\n\
+ \n\
+ /** setNumberOfColumns\n\
+ * \n\
+ * Change the size of the thumbnail grid.\n\
+ * \n\
+ * @param nNumberOfColumns - the new number of columns/rows of the thumbnail grid\n\
+ */\n\
+ SlideIndexPage.prototype.setNumberOfColumns = function( nNumberOfColumns )\n\
+ {\n\
+ if( this.indexColumns == nNumberOfColumns ) return;\n\
+ if( nNumberOfColumns < 2 || nNumberOfColumns > 6 ) return;\n\
+ \n\
+ var suspendHandle = ROOT_NODE.suspendRedraw(500);\n\
+ \n\
+ var nOldTotalThumbnails = this.totalThumbnails;\n\
+ this.indexColumns = nNumberOfColumns;\n\
+ this.totalThumbnails = nNumberOfColumns * nNumberOfColumns;;\n\
+ \n\
+ this.aThumbnailSet[this.curThumbnailIndex].unselect();\n\
+ \n\
+ // if we decreased the number of used columns we remove the exceding thumbnail elements\n\
+ for( var i = this.totalThumbnails; i < nOldTotalThumbnails; ++i )\n\
+ {\n\
+ this.aThumbnailSet[i].removeElement();\n\
+ };\n\
+ \n\
+ // if we increased the number of used columns we create the needed thumbnail objects\n\
+ for( var i = nOldTotalThumbnails; i < this.totalThumbnails; ++i )\n\
+ {\n\
+ this.aThumbnailSet[i] = new Thumbnail( this, i );\n\
+ };\n\
+ \n\
+ // we set up layout parameters that depend on the number of columns\n\
+ this.halfBorderWidthFactor = ( 300/28000 ) * ( this.indexColumns / 3 );\n\
+ this.halfBorderWidth = WIDTH * this.halfBorderWidthFactor;\n\
+ this.borderWidth = 2 * this.halfBorderWidth;\n\
+ // scaleFactor = ( WIDTH - ( columns + 1 ) * xSpacing ) / ( columns * ( WIDTH + borderWidth ) )\n\
+ this.scaleFactor = ( 1 - ( this.indexColumns + 1 ) * this.xSpacingFactor ) / \n\
+ ( this.indexColumns * ( 1 + 2 * this.halfBorderWidthFactor ) );\n\
+ \n\
+ // update the thumbnail border size\n\
+ var aRectElement = this.thumbnailBorderTemplateElement;\n\
+ aRectElement.setAttribute( 'x', -this.halfBorderWidth );\n\
+ aRectElement.setAttribute( 'y', -this.halfBorderWidth );\n\
+ aRectElement.setAttribute( 'rx', this.halfBorderWidth );\n\
+ aRectElement.setAttribute( 'ry', this.halfBorderWidth );\n\
+ aRectElement.setAttribute( 'width', WIDTH + this.halfBorderWidth );\n\
+ aRectElement.setAttribute( 'height', HEIGHT + this.halfBorderWidth );\n\
+ aRectElement.setAttribute( 'stroke-width', this.borderWidth );\n\
+ \n\
+ // now we update the displacement on the index page of each thumbnail (old and new)\n\
+ for( var i = 0; i < this.totalThumbnails; ++i )\n\
+ {\n\
+ this.aThumbnailSet[i].updateView();\n\
+ }\n\
\n\
- init();\n\
-]]>";
-
-static const char aSVGScript1[] =
-"<![CDATA[\n\
+ this.curThumbnailIndex = this.selectedSlideIndex % this.totalThumbnails;\n\
+ this.aThumbnailSet[this.curThumbnailIndex].select();\n\
+ \n\
+ // needed for forcing the indexSetPageSlide routine to update the INDEX_OFFSET\n\
+ INDEX_OFFSET = -1; \n\
+ indexSetPageSlide( this.selectedSlideIndex );\n\
+ \n\
+ ROOT_NODE.unsuspendRedraw( suspendHandle );\n\
+ ROOT_NODE.forceRedraw(); \n\
+ };\n\
+ \n\
+ \n\
+ /** Class Thumbnail **\n\
+ * This class handles a slide thumbnail.\n\
+ */\n\
+ function Thumbnail( aSlideIndexPage, nIndex )\n\
+ {\n\
+ this.container = aSlideIndexPage;\n\
+ this.index = nIndex;//= getSafeIndex( nIndex, 0, this.container.getTotalThumbnails() );\n\
+ this.pageElement = this.container.pageElement;\n\
+ this.thumbnailId = 'thumbnail' + this.index;\n\
+ this.thumbnailElement = this.createThumbnailElement(); \n\
+ this.slideElement = getElementByClassName( this.thumbnailElement, 'Slide' );\n\
+ this.backgroundElement = getElementByClassName( this.thumbnailElement, 'Background' );\n\
+ this.backgroundObjectsElement = getElementByClassName( this.thumbnailElement, 'BackgroundObjects' );\n\
+ this.borderElement = getElementByClassName( this.thumbnailElement, 'Border' );\n\
+ this.aTransformSet = new Array( 3 );\n\
+ this.visibility = VISIBLE; \n\
+ this.isSelected = false; \n\
+ };\n\
+ \n\
+ /* static const class member */\n\
+ Thumbnail.prototype.sNormalBorderColor = 'rgb(216,216,216)';\n\
+ Thumbnail.prototype.sSelectionBorderColor = 'rgb(92,92,255)';\n\
+ \n\
+ /* public methods */ \n\
+ Thumbnail.prototype.removeElement = function()\n\
+ {\n\
+ if( this.thumbnailElement )\n\
+ this.container.pageElement.removeChild( this.thumbnailElement );\n\
+ };\n\
+ \n\
+ Thumbnail.prototype.show = function()\n\
+ {\n\
+ if( this.visibility == HIDDEN )\n\
+ { \n\
+ this.thumbnailElement.setAttribute( 'display', 'inherit' );\n\
+ this.visibility = VISIBLE;\n\
+ }\n\
+ };\n\
+ \n\
+ Thumbnail.prototype.hide = function()\n\
+ {\n\
+ if( this.visibility == VISIBLE )\n\
+ {\n\
+ this.thumbnailElement.setAttribute( 'display', 'none' );\n\
+ this.visibility = HIDDEN;\n\
+ }\n\
+ };\n\
+ \n\
+ Thumbnail.prototype.select = function()\n\
+ {\n\
+ if( !this.isSelected )\n\
+ {\n\
+ this.borderElement.setAttribute( 'stroke', this.sSelectionBorderColor );\n\
+ this.isSelected = true;\n\
+ }\n\
+ };\n\
+ \n\
+ Thumbnail.prototype.unselect = function()\n\
+ {\n\
+ if( this.isSelected )\n\
+ {\n\
+ this.borderElement.setAttribute( 'stroke', this.sNormalBorderColor );\n\
+ this.isSelected = false;\n\
+ }\n\
+ };\n\
+ \n\
+ /** updateView\n\
+ * \n\
+ * This method updates the displacement of the thumbnail on the slide index page, \n\
+ * the value of the row, column coordinates of the thumbnail in the grid, and\n\
+ * the onmouseover property of the thumbnail element.\n\
+ * \n\
+ */\n\
+ Thumbnail.prototype.updateView = function()\n\
+ {\n\
+ this.column = this.index % this.container.indexColumns;\n\
+ this.row = ( this.index - this.column ) / this.container.indexColumns;\n\
+ this.halfBorderWidth = this.container.halfBorderWidth;\n\
+ this.borderWidth = this.container.borderWidth;\n\
+ this.width = ( WIDTH + this.borderWidth ) * this.container.scaleFactor;\n\
+ this.height = ( HEIGHT + this.borderWidth ) * this.container.scaleFactor;\n\
+ this.aTransformSet[2] = 'translate(' + this.halfBorderWidth + ' ' + this.halfBorderWidth + ')';\n\
+ this.aTransformSet[1] = 'scale(' + this.container.scaleFactor + ')';\n\
+ var sTransformAttrValue = this.computeTransform();\n\
+ this.thumbnailElement.setAttribute( 'transform', sTransformAttrValue );\n\
+ this.thumbnailElement.setAttribute( 'onmouseover', 'theSlideIndexPage.aThumbnailSet[' + this.index + '].onMouseOver()' );\n\
+ };\n\
+ \n\
+ /** update\n\
+ * \n\
+ * This method update the content of the thumbnail view\n\
+ * \n\
+ * @param nIndex - the index of the slide to be shown in the thumbnail\n\
+ */ \n\
+ Thumbnail.prototype.update = function( nIndex )\n\
+ {\n\
+ if( this.slideIndex == nIndex ) return;\n\
+ \n\
+ var aMetaSlide = theMetaDoc.aMetaSlideSet[nIndex];\n\
+ setNSAttribute( 'xlink', this.slideElement, 'href', '#' + aMetaSlide.slideId );\n\
+ if( aMetaSlide.nIsBackgroundVisible )\n\
+ {\n\
+ setNSAttribute( 'xlink', this.backgroundElement, 'href', '#' + aMetaSlide.masterPage.backgroundId );\n\
+ this.backgroundElement.setAttribute( 'visibility', 'inherit' );\n\
+ }\n\
+ else\n\
+ {\n\
+ this.backgroundElement.setAttribute( 'visibility', 'hidden' );\n\
+ }\n\
+ if( aMetaSlide.nAreMasterObjectsVisible )\n\
+ {\n\
+ setNSAttribute( 'xlink', this.backgroundObjectsElement, 'href', '#' + aMetaSlide.masterPage.backgroundObjectsId );\n\
+ this.backgroundObjectsElement.setAttribute( 'visibility', 'inherit' );\n\
+ }\n\
+ else\n\
+ {\n\
+ this.backgroundObjectsElement.setAttribute( 'visibility', 'hidden' );\n\
+ }\n\
+ this.slideIndex = nIndex;\n\
+ };\n\
+ \n\
+ Thumbnail.prototype.clear = function( nIndex )\n\
+ { \n\
+ setNSAttribute( 'xlink', this.slideElement, 'href', '' );\n\
+ setNSAttribute( 'xlink', this.backgroundElement, 'href', '' );\n\
+ setNSAttribute( 'xlink', this.backgroundObjectsElement, 'href', '' );\n\
+ };\n\
+ \n\
+ /* private methods */\n\
+ Thumbnail.prototype.createThumbnailElement = function()\n\
+ {\n\
+ var aThumbnailElement = document.createElementNS( NSS['svg'], 'g' );\n\
+ aThumbnailElement.setAttribute( 'id', this.thumbnailId );\n\
+ aThumbnailElement.setAttribute( 'display', 'inherit' );\n\
+ \n\
+ var aMouseAreaElement = document.createElementNS( NSS['svg'], 'use' );\n\
+ setNSAttribute( 'xlink', aMouseAreaElement, 'href', '#' + this.container.thumbnailMouseAreaTemplateId );\n\
+ aMouseAreaElement.setAttribute( 'class', 'MouseArea' );\n\
+ aThumbnailElement.appendChild( aMouseAreaElement );\n\
\n\
- window.onload = init;\n\
+ var aBackgroundElement = document.createElementNS( NSS['svg'], 'use' );\n\
+ setNSAttribute( 'xlink', aBackgroundElement, 'href', '' );\n\
+ aBackgroundElement.setAttribute( 'visibility', 'inherit');\n\
+ aBackgroundElement.setAttribute( 'class', 'Background' );\n\
+ aThumbnailElement.appendChild( aBackgroundElement );\n\
\n\
- // Keycodes.\n\
- var LEFT_KEY = 37; // cursor left keycode\n\
- var UP_KEY = 38; // cursor up keycode\n\
- var RIGHT_KEY = 39; // cursor right keycode\n\
- var DOWN_KEY = 40; // cursor down keycode\n\
- var PAGE_UP_KEY = 33; // page up keycode\n\
- var PAGE_DOWN_KEY = 34; // page down keycode\n\
- var HOME_KEY = 36; // home keycode\n\
- var END_KEY = 35; // end keycode\n\
- var ENTER_KEY = 13; \n\
- var SPACE_KEY = 32;\n\
- var ESCAPE_KEY = 27;\n\
+ var aBackgroundObjectsElement = document.createElementNS( NSS['svg'], 'use' );\n\
+ setNSAttribute( 'xlink', aBackgroundObjectsElement, 'href', '' );\n\
+ aBackgroundObjectsElement.setAttribute( 'visibility', 'inherit');\n\
+ aBackgroundObjectsElement.setAttribute( 'class', 'BackgroundObjects' );\n\
+ aThumbnailElement.appendChild( aBackgroundObjectsElement );\n\
+ \n\
+ var aSlideElement = document.createElementNS( NSS['svg'], 'use' );\n\
+ setNSAttribute( 'xlink', aSlideElement, 'href', '' );\n\
+ aSlideElement.setAttribute( 'class', 'Slide' );\n\
+ aThumbnailElement.appendChild( aSlideElement );\n\
+ \n\
+ var aBorderElement = document.createElementNS( NSS['svg'], 'use' );\n\
+ setNSAttribute( 'xlink', aBorderElement, 'href', '#' + this.container.thumbnailBorderTemplateId );\n\
+ aBorderElement.setAttribute( 'stroke', this.sNormalBorderColor );\n\
+ aBorderElement.setAttribute( 'class', 'Border' );\n\
+ aThumbnailElement.appendChild( aBorderElement );\n\
+ \n\
+ this.container.pageElement.appendChild( aThumbnailElement );\n\
+ return( document.getElementById( this.thumbnailId ) ); \n\
+ };\n\
+\n\
+ Thumbnail.prototype.computeTransform = function()\n\
+ { \n\
+ var nXSpacing = this.container.xSpacing;\n\
+ var nYSpacing = this.container.ySpacing;\n\
+ \n\
+ var nXOffset = nXSpacing + ( this.width + nXSpacing ) * this.column;\n\
+ var nYOffset = nYSpacing + ( this.height + nYSpacing ) * this.row;\n\
+ \n\
+ this.aTransformSet[0] = 'translate(' + nXOffset + ' ' + nYOffset + ')';\n\
+ \n\
+ sTransform = this.aTransformSet.join( ' ' );\n\
+ \n\
+ return sTransform;\n\
+ };\n\
\n\
+ Thumbnail.prototype.onMouseOver = function()\n\
+ {\n\
+ if( ( currentMode == INDEX_MODE ) && ( this.container.curThumbnailIndex != this.index ) ) \n\
+ {\n\
+ this.container.setSelection( this.index );\n\
+ }\n\
+ };\n\
\n\
- var nCurSlide = 0;\n\
- var nSlides = 0;\n\
- var aSlides = new Array();\n\
- var aMasters = new Array();\n\
- var aMasterVisibilities = new Array();\n\
+ \n\
+ \n\
+\n\
+ // ------------------------------------------------------------------------------------------ //\n\
+ /** Initialization function.\n\
+ * The whole presentation is set-up in this function.\n\
+ */\n\
+ function init() \n\
+ {\n\
+ \n\
+ var VIEWBOX = ROOT_NODE.getAttribute('viewBox');\n\
\n\
+ if( VIEWBOX )\n\
+ {\n\
+ WIDTH = ROOT_NODE.viewBox.animVal.width;\n\
+ HEIGHT = ROOT_NODE.viewBox.animVal.height;\n\
+ }\n\
\n\
+ var aMetaDocElem = document.getElementById( aOOOElemMetaSlides );\n\
+ assert( aMetaDocElem, 'init: meta document element not found' );\n\
+ theMetaDoc = new MetaDocument( aMetaDocElem );\n\
+ theSlideIndexPage = new SlideIndexPage();\n\
\n\
+ \n\
+ }\n\
+ \n\
+ function presentationEngineStop()\n\
+ {\n\
+ alert( 'We are sorry! An unexpected error occurred.\\nThe presentation engine will be stopped' );\n\
+ document.onkeydown = null;\n\
+ document.onkeypress = null; \n\
+ document.onclick = null;\n\
+ window.onmousewheel = null;\n\
+ }\n\
+ \n\
+ function assert( condition, message )\n\
+ {\n\
+ if (!condition)\n\
+ {\n\
+ presentationEngineStop();\n\
+ if (typeof console == 'object')\n\
+ console.trace();\n\
+ throw new Error( message );\n\
+ }\n\
+ }\n\
\n\
-";
-
-
-static const char aSVGScript2[] =
-" function onClick( aEvt )\n\
+ /** Event handler for key press.\n\
+ *\n\
+ * @param aEvt the event\n\
+ */\n\
+ function onKeyDown( aEvt )\n\
+ {\n\
+ if ( !aEvt )\n\
+ aEvt = window.event;\n\
+\n\
+ code = aEvt.keyCode || aEvt.charCode;\n\
+\n\
+ if ( !processingEffect && keyCodeDictionary[currentMode] && keyCodeDictionary[currentMode][code] )\n\
+ return keyCodeDictionary[currentMode][code]();\n\
+ else\n\
+ document.onkeypress = onKeyPress;\n\
+ }\n\
+ // Set event handler for key down.\n\
+ document.onkeydown = onKeyDown;\n\
+\n\
+ /** Event handler for key press.\n\
+ *\n\
+ * @param aEvt the event\n\
+ */\n\
+ function onKeyPress( aEvt )\n\
+ {\n\
+ document.onkeypress = null;\n\
+\n\
+ if ( !aEvt )\n\
+ aEvt = window.event;\n\
+\n\
+ str = String.fromCharCode( aEvt.keyCode || aEvt.charCode );\n\
+\n\
+ if ( !processingEffect && charCodeDictionary[currentMode] && charCodeDictionary[currentMode][str] )\n\
+ return charCodeDictionary[currentMode][str]();\n\
+ }\n\
+ \n\
+ /** Function to supply the default key code dictionary.\n\
+ *\n\
+ * @returns default key code dictionary\n\
+ */\n\
+ function getDefaultKeyCodeDictionary()\n\
+ {\n\
+ var keyCodeDict = new Object();\n\
+ \n\
+ keyCodeDict[SLIDE_MODE] = new Object();\n\
+ keyCodeDict[INDEX_MODE] = new Object();\n\
+\n\
+ keyCodeDict[SLIDE_MODE][LEFT_KEY] = function() { return dispatchEffects(-1); };\n\
+ keyCodeDict[SLIDE_MODE][RIGHT_KEY] = function() { return dispatchEffects(1); };\n\
+ keyCodeDict[SLIDE_MODE][UP_KEY] = function() { return skipEffects(-1); };\n\
+ keyCodeDict[SLIDE_MODE][DOWN_KEY] = function() { return skipEffects(1); };\n\
+ keyCodeDict[SLIDE_MODE][PAGE_UP_KEY] = function() { return dispatchEffects(-1); };\n\
+ keyCodeDict[SLIDE_MODE][PAGE_DOWN_KEY] = function() { return dispatchEffects(1); };\n\
+ keyCodeDict[SLIDE_MODE][HOME_KEY] = function() { return slideSetActiveSlide(0); };\n\
+ keyCodeDict[SLIDE_MODE][END_KEY] = function() { return slideSetActiveSlide(theMetaDoc.nNumberOfSlides - 1); };\n\
+ keyCodeDict[SLIDE_MODE][SPACE_KEY] = function() { return dispatchEffects(1); };\n\
+ \n\
+ keyCodeDict[INDEX_MODE][LEFT_KEY] = function() { return indexSetPageSlide( theSlideIndexPage.selectedSlideIndex - 1 ); };\n\
+ keyCodeDict[INDEX_MODE][RIGHT_KEY] = function() { return indexSetPageSlide( theSlideIndexPage.selectedSlideIndex + 1 ); };\n\
+ keyCodeDict[INDEX_MODE][UP_KEY] = function() { return indexSetPageSlide( theSlideIndexPage.selectedSlideIndex - theSlideIndexPage.indexColumns ); };\n\
+ keyCodeDict[INDEX_MODE][DOWN_KEY] = function() { return indexSetPageSlide( theSlideIndexPage.selectedSlideIndex + theSlideIndexPage.indexColumns ); };\n\
+ keyCodeDict[INDEX_MODE][PAGE_UP_KEY] = function() { return indexSetPageSlide( theSlideIndexPage.selectedSlideIndex - theSlideIndexPage.getTotalThumbnails() ); };\n\
+ keyCodeDict[INDEX_MODE][PAGE_DOWN_KEY] = function() { return indexSetPageSlide( theSlideIndexPage.selectedSlideIndex + theSlideIndexPage.getTotalThumbnails() ); };\n\
+ keyCodeDict[INDEX_MODE][HOME_KEY] = function() { return indexSetPageSlide( 0 ); };\n\
+ keyCodeDict[INDEX_MODE][END_KEY] = function() { return indexSetPageSlide( theMetaDoc.nNumberOfSlides - 1 ); };\n\
+ keyCodeDict[INDEX_MODE][ENTER_KEY] = function() { return toggleSlideIndex(); };\n\
+ keyCodeDict[INDEX_MODE][SPACE_KEY] = function() { return toggleSlideIndex(); };\n\
+ keyCodeDict[INDEX_MODE][ESCAPE_KEY] = function() { return abandonIndexMode(); };\n\
+\n\
+ return keyCodeDict;\n\
+ }\n\
+\n\
+ /** Function to supply the default char code dictionary.\n\
+ *\n\
+ * @returns default char code dictionary\n\
+ */\n\
+ function getDefaultCharCodeDictionary()\n\
+ {\n\
+ var charCodeDict = new Object();\n\
+\n\
+ charCodeDict[SLIDE_MODE] = new Object();\n\
+ charCodeDict[INDEX_MODE] = new Object();\n\
+ \n\
+ charCodeDict[SLIDE_MODE]['i'] = function () { return toggleSlideIndex(); };\n\
+ \n\
+ charCodeDict[INDEX_MODE]['i'] = function () { return toggleSlideIndex(); };\n\
+ charCodeDict[INDEX_MODE]['-'] = function () { return theSlideIndexPage.decreaseNumberOfColumns(); };\n\
+ charCodeDict[INDEX_MODE]['='] = function () { return theSlideIndexPage.increaseNumberOfColumns(); };\n\
+ charCodeDict[INDEX_MODE]['+'] = function () { return theSlideIndexPage.increaseNumberOfColumns(); };\n\
+ charCodeDict[INDEX_MODE]['0'] = function () { return theSlideIndexPage.resetNumberOfColumns(); };\n\
+\n\
+ return charCodeDict;\n\
+ }\n\
+ \n\
+\n\
+ function slideOnMouseDown( aEvt )\n\
{\n\
if (!aEvt)\n\
aEvt = window.event;\n\
@@ -164,88 +1411,275 @@ static const char aSVGScript2[] =
nOffset = -1;\n\
\n\
if( 0 != nOffset )\n\
- switchSlide( aEvt, nOffset );\n\
+ switchSlide( nOffset );\n\
}\n\
- document.onclick = onClick;\n\
\n\
- \n\
-";
-
-static const char aSVGScript3[] =
-" function onKeyPress( aEvt )\n\
+ /** Event handler for mouse wheel events in slide mode.\n\
+ * based on http://adomas.org/javascript-mouse-wheel/\n\
+ *\n\
+ * @param aEvt the event\n\
+ */\n\
+ function slideOnMouseWheel(aEvt)\n\
{\n\
+ var delta = 0;\n\
+\n\
if (!aEvt)\n\
aEvt = window.event;\n\
- \n\
- var nCode = aEvt.keyCode || aEvt.charCode;\n\
- var nOffset = 0;\n\
- if( nCode == SPACE_KEY || nCode == PAGE_DOWN_KEY || nCode == RIGHT_KEY )\n\
- {\n\
- nOffset = 1;\n\
+\n\
+ if (aEvt.wheelDelta)\n\
+ { // IE Opera\n\
+ delta = aEvt.wheelDelta/120;\n\
+ }\n\
+ else if (aEvt.detail)\n\
+ { // MOZ\n\
+ delta = -aEvt.detail/3;\n\
}\n\
- else if( nCode == PAGE_UP_KEY ||nCode == LEFT_KEY )\n\
+\n\
+ if (delta > 0)\n\
+ skipEffects(-1);\n\
+ else if (delta < 0)\n\
+ skipEffects(1);\n\
+\n\
+ if (aEvt.preventDefault)\n\
+ aEvt.preventDefault();\n\
+\n\
+ aEvt.returnValue = false;\n\
+ }\n\
+ \n\
+ // Mozilla\n\
+ if( window.addEventListener )\n\
+ {\n\
+ window.addEventListener( 'DOMMouseScroll', function( aEvt ) { return mouseHandlerDispatch( aEvt, MOUSE_WHEEL ); }, false );\n\
+ }\n\
+\n\
+ // Opera Safari OK - may not work in IE\n\
+ window.onmousewheel = function( aEvt ) { return mouseHandlerDispatch( aEvt, MOUSE_WHEEL ); }; \n\
+ \n\
+ /** Function to handle all mouse events.\n\
+ *\n\
+ * @param aEvt event\n\
+ * @param anAction type of event (e.g. mouse up, mouse wheel)\n\
+ */\n\
+ function mouseHandlerDispatch( aEvt, anAction )\n\
+ {\n\
+ if( !aEvt )\n\
+ aEvt = window.event;\n\
+ \n\
+ var retVal = true;\n\
+ \n\
+ if ( mouseHandlerDictionary[currentMode] && mouseHandlerDictionary[currentMode][anAction] )\n\
{\n\
- nOffset = -1;\n\
+ var subRetVal = mouseHandlerDictionary[currentMode][anAction]( aEvt );\n\
+ \n\
+ if( subRetVal != null && subRetVal != undefined )\n\
+ retVal = subRetVal;\n\
}\n\
\n\
- if( 0 != nOffset )\n\
- switchSlide( aEvt, nOffset );\n\
+ if( aEvt.preventDefault && !retVal )\n\
+ aEvt.preventDefault();\n\
+ \n\
+ aEvt.returnValue = retVal;\n\
+ \n\
+ return retVal;\n\
+ }\n\
+\n\
+ // Set mouse event handler.\n\
+ document.onmousedown = function( aEvt ) { return mouseHandlerDispatch( aEvt, MOUSE_DOWN ); };\n\
+ //document.onmousemove = function( aEvt ) { return mouseHandlerDispatch( aEvt, MOUSE_MOVE ); };\n\
+ \n\
+ /** Function to supply the default mouse handler dictionary.\n\
+ *\n\
+ * @returns default mouse handler dictionary\n\
+ */\n\
+ function getDefaultMouseHandlerDictionary()\n\
+ {\n\
+ var mouseHandlerDict = new Object();\n\
+ \n\
+ mouseHandlerDict[SLIDE_MODE] = new Object();\n\
+ mouseHandlerDict[INDEX_MODE] = new Object();\n\
+ \n\
+ \n\
+ mouseHandlerDict[SLIDE_MODE][MOUSE_DOWN] = function( aEvt ) { return slideOnMouseDown( aEvt ); };\n\
+ mouseHandlerDict[SLIDE_MODE][MOUSE_WHEEL] = function( aEvt ) { return slideOnMouseWheel( aEvt ); };\n\
+ \n\
+ mouseHandlerDict[INDEX_MODE][MOUSE_DOWN] = function( aEvt ) { return toggleSlideIndex(); };\n\
+ \n\
+ return mouseHandlerDict;\n\
+ }\n\
+\n\
+ /** Function to dispatch the next effect, if there is none left, change the slide.\n\
+ *\n\
+ * @param dir direction of the change (1 = forwards, -1 = backwards)\n\
+ */\n\
+ function dispatchEffects(dir)\n\
+ {\n\
+ // TODO to be implemented\n\
+ switchSlide(dir);\n\
}\n\
- document.onkeypress = onKeyPress; \n\
\n\
-";
-
-static const char aSVGScript4[] =
-" function switchSlide( aEvt, nOffset ) \n\
+ /** Function to skip effects and directly either put the slide into start or end state or change slides.\n\
+ *\n\
+ * @param dir direction of the change (1 = forwards, -1 = backwards)\n\
+ */\n\
+ function skipEffects(dir)\n\
+ {\n\
+ // TODO to be implemented\n\
+ switchSlide(dir);\n\
+ }\n\
+ \n\
+ /** Function to change between slides.\n\
+ *\n\
+ * @param nOffset direction (1 = forwards, -1 = backwards)\n\
+ */\n\
+ function switchSlide( nOffset ) \n\
{\n\
var nNextSlide = nCurSlide + nOffset;\n\
+ slideSetActiveSlide( nNextSlide );\n\
+ }\n\
+ \n\
+ /** Function to display the index sheet.\n\
+ *\n\
+ * @param offsetNumber offset number\n\
+ */\n\
+ function displayIndex( offsetNumber )\n\
+ {\n\
+ var aMetaSlideSet = theMetaDoc.aMetaSlideSet;\n\
+ offsetNumber = getSafeIndex( offsetNumber, 0, aMetaSlideSet.length - 1 );\n\
\n\
- if( nNextSlide < 0 && nSlides > 0 )\n\
- nNextSlide = nSlides - 1;\n\
- else if( nNextSlide >= nSlides ) \n\
- nNextSlide = 0;\n\
+ var nTotalThumbnails = theSlideIndexPage.getTotalThumbnails();\n\
+ var nEnd = Math.min( offsetNumber + nTotalThumbnails, aMetaSlideSet.length);\n\
+ \n\
+ var aThumbnailSet = theSlideIndexPage.aThumbnailSet;\n\
+ var j = 0;\n\
+ for( var i = offsetNumber; i < nEnd; ++i, ++j )\n\
+ {\n\
+ aThumbnailSet[j].update( i );\n\
+ aThumbnailSet[j].show();\n\
+ }\n\
+ for( ; j < nTotalThumbnails; ++j )\n\
+ {\n\
+ aThumbnailSet[j].hide();\n\
+ }\n\
+ \n\
+ //do we need to save the current offset?\n\
+ if (INDEX_OFFSET != offsetNumber)\n\
+ INDEX_OFFSET = offsetNumber;\n\
+ }\n\
+ \n\
+ /** Function to set the active slide in the slide view.\n\
+ *\n\
+ * @param nNewSlide index of the active slide\n\
+ */\n\
+ function slideSetActiveSlide( nNewSlide )\n\
+ {\n\
+ var aMetaDoc = theMetaDoc;\n\
+ var nSlides = aMetaDoc.nNumberOfSlides;\n\
+ if( nNewSlide < 0 && nSlides > 0 )\n\
+ nNewSlide = nSlides - 1;\n\
+ else if( nNewSlide >= nSlides ) \n\
+ nNewSlide = 0;\n\
+ \n\
+ if( nNewSlide == nCurSlide ) return;\n\
+ var nOldSlide = nCurSlide;\n\
+ nCurSlide = nNewSlide;\n\
+ \n\
+ var oldMetaSlide = aMetaDoc.aMetaSlideSet[nOldSlide];\n\
+ var newMetaSlide = aMetaDoc.aMetaSlideSet[nNewSlide];\n\
+ \n\
+ oldMetaSlide.hide();\n\
+ newMetaSlide.show();\n\
+ }\n\
+ \n\
+ /** Function to set the page and active slide in index view. \n\
+ *\n\
+ * @param nIndex index of the active slide\n\
+ *\n\
+ * NOTE: To force a redraw,\n\
+ * set INDEX_OFFSET to -1 before calling indexSetPageSlide().\n\
+ *\n\
+ * This is necessary for zooming (otherwise the index might not\n\
+ * get redrawn) and when switching to index mode.\n\
+ *\n\
+ * INDEX_OFFSET = -1\n\
+ * indexSetPageSlide(activeSlide);\n\
+ */\n\
+ function indexSetPageSlide( nIndex )\n\
+ {\n\
+ var aMetaSlideSet = theMetaDoc.aMetaSlideSet;\n\
+ nIndex = getSafeIndex( nIndex, 0, aMetaSlideSet.length - 1 );\n\
\n\
- aSlides[ nCurSlide ].setAttribute( \"visibility\", \"hidden\" );\n\
- aSlides[ nNextSlide ].setAttribute( \"visibility\", \"visible\" );\n\
+ //calculate the offset\n\
+ var nSelectedThumbnailIndex = nIndex % theSlideIndexPage.getTotalThumbnails();\n\
+ var offset = nIndex - nSelectedThumbnailIndex;\n\
\n\
- var aCurMaster = aMasters[ nCurSlide ];\n\
- var aCurMasterVisibility = aMasterVisibilities[ nCurSlide ];\n\
- \n\
- var aNextMaster = aMasters[ nNextSlide ];\n\
- var aNextMasterVisibility = aMasterVisibilities[ nNextSlide ];\n\
+ if( offset < 0 )\n\
+ offset = 0;\n\
\n\
- if( ( aCurMaster != aNextMaster ) || ( aCurMasterVisibility != aNextMasterVisibility ) ) \n\
- {\n\
- if( aCurMaster != aNextMaster )\n\
- aCurMaster.setAttribute(\"visibility\", \"hidden\" );\n\
- \n\
- aNextMaster.setAttribute( \"visibility\", aNextMasterVisibility );\n\
- }\n\
+ //if different from kept offset, then record and change the page\n\
+ if( offset != INDEX_OFFSET )\n\
+ {\n\
+ INDEX_OFFSET = offset;\n\
+ displayIndex( INDEX_OFFSET );\n\
+ }\n\
\n\
- nCurSlide = nNextSlide; \n\
- }\n\
+ //set the selected thumbnail and the current slide\n\
+ theSlideIndexPage.setSelection( nSelectedThumbnailIndex );\n\
+ }\n\
\n\
-";
-
-static const char aSVGScript5[] =
-" function init() \n\
+ /** Function to toggle between index and slide mode.\n\
+ */\n\
+ function toggleSlideIndex()\n\
{\n\
- nSlides = document.getElementById( \"meta_slides\" ).getAttribute( \"ooo:numberOfSlides\" );\n\
-\n\
- for( i = 0; i < nSlides; i++ )\n\
+ var suspendHandle = ROOT_NODE.suspendRedraw(500);\n\
+ var aMetaSlideSet = theMetaDoc.aMetaSlideSet;\n\
+ \n\
+ if (currentMode == SLIDE_MODE)\n\
+ { \n\
+ aMetaSlideSet[nCurSlide].hide();\n\
+ for( var counter = 0; counter < aMetaSlideSet.length; ++counter )\n\
+ {\n\
+ checkElemAndSetAttribute( aMetaSlideSet[counter].slideElement, 'visibility', 'inherit' );\n\
+ aMetaSlideSet[counter].masterPage.setVisibilityBackground( INHERIT );\n\
+ aMetaSlideSet[counter].masterPage.setVisibility( INHERIT );\n\
+ }\n\
+ INDEX_OFFSET = -1;\n\
+ indexSetPageSlide( nCurSlide );\n\
+ theSlideIndexPage.show();\n\
+ currentMode = INDEX_MODE;\n\
+ }\n\
+ else if (currentMode == INDEX_MODE)\n\
{\n\
- var aMetaSlide = document.getElementById( \"meta_slide\" + i );\n\
- if( aMetaSlide )\n\
+ theSlideIndexPage.hide();\n\
+ nCurSlide = theSlideIndexPage.selectedSlideIndex;\n\
+ \n\
+ for( var counter = 0; counter < aMetaSlideSet.length; ++counter )\n\
{\n\
- aSlides.push( document.getElementById( aMetaSlide.getAttribute( \"ooo:slide\" ) ) );\n\
- aMasters.push( document.getElementById( aMetaSlide.getAttribute( \"ooo:master\" ) ) );\n\
- aMasterVisibilities.push( aMetaSlide.getAttribute( \"ooo:master-visibility\" ) );\n\
+ var aMetaSlide = aMetaSlideSet[counter];\n\
+ aMetaSlide.slideElement.setAttribute( 'visibility', 'hidden' );\n\
+ aMetaSlide.masterPage.setVisibilityBackground( HIDDEN );\n\
+ aMetaSlide.masterPage.setVisibility( HIDDEN ); \n\
}\n\
+ \n\
+ aMetaSlideSet[nCurSlide].show();\n\
+ //activeEffect = 0;\n\
+\n\
+ currentMode = SLIDE_MODE;\n\
+ //setSlideToState(nCurSlide, STATE_START);\n\
}\n\
+\n\
+ ROOT_NODE.unsuspendRedraw(suspendHandle);\n\
+ ROOT_NODE.forceRedraw(); \n\
+ }\n\
+ \n\
+ /** Function that exit from the index mode without changing the shown slide\n\
+ * \n\
+ */\n\
+ function abandonIndexMode()\n\
+ {\n\
+ theSlideIndexPage.selectedSlideIndex = nCurSlide;\n\
+ toggleSlideIndex();\n\
}\n\
- \n\
+\n\
]]>";
-
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx
index 56b5af4fba0d..b6878891baba 100644
--- a/filter/source/svg/svgwriter.cxx
+++ b/filter/source/svg/svgwriter.cxx
@@ -1174,8 +1174,15 @@ void SVGActionWriter::ImplWriteText( const Point& rPos, const String& rText,
mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrTransform, aTransform );
}
+ // this class attribute is used by the JavaScript based presentation engine
+ // to modify the text content of placeholder text shapes of the master slide
+ mrExport.AddAttribute( XML_NAMESPACE_NONE, "class", B2UCONST( "TextBlock" ) );
+
mpContext->AddPaintAttr( COL_TRANSPARENT, aTextColor );
+ // for each line of text there should be at least one group element of class TextBlock
+ SvXMLElementExport aSVGGElem( mrExport, XML_NAMESPACE_NONE, aXMLElemG, sal_True, sal_False );
+
if( nLen > 1 )
{
aNormSize.Width() = pDX[ nLen - 2 ] + mpVDev->GetTextWidth( rText.GetChar( nLen - 1 ) );
@@ -1840,7 +1847,10 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
ImplMap( Size( 0, aFont.GetHeight() ), aSz );
aFont.SetHeight( aSz.Height() );
- mpContext->AddPaintAttr( COL_TRANSPARENT, mpVDev->GetTextColor() );
+ // lead to a browser error since it duplicates the stroke and
+ // the fill attributes on the first glyph of each line when
+ // the text font is the same
+ //mpContext->AddPaintAttr( COL_TRANSPARENT, mpVDev->GetTextColor() );
mpContext->SetFontAttr( aFont );
ImplWriteText( pA->GetPoint(), aText, NULL, 0 );
}
@@ -1862,7 +1872,7 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
ImplMap( Size( 0, aFont.GetHeight() ), aSz );
aFont.SetHeight( aSz.Height() );
- mpContext->AddPaintAttr( COL_TRANSPARENT, mpVDev->GetTextColor() );
+ //mpContext->AddPaintAttr( COL_TRANSPARENT, mpVDev->GetTextColor() );
mpContext->SetFontAttr( aFont );
ImplWriteText( pA->GetRect().TopLeft(), pA->GetText(), NULL, 0 );
}
@@ -1885,7 +1895,7 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
ImplMap( Size( 0, aFont.GetHeight() ), aSz );
aFont.SetHeight( aSz.Height() );
- mpContext->AddPaintAttr( COL_TRANSPARENT, mpVDev->GetTextColor() );
+ //mpContext->AddPaintAttr( COL_TRANSPARENT, mpVDev->GetTextColor() );
mpContext->SetFontAttr( aFont );
ImplWriteText( pA->GetPoint(), aText, pA->GetDXArray(), 0 );
}
@@ -1908,7 +1918,7 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
ImplMap( Size( 0, aFont.GetHeight() ), aSz );
aFont.SetHeight( aSz.Height() );
- mpContext->AddPaintAttr( COL_TRANSPARENT, mpVDev->GetTextColor() );
+ //mpContext->AddPaintAttr( COL_TRANSPARENT, mpVDev->GetTextColor() );
mpContext->SetFontAttr( aFont );
ImplWriteText( pA->GetPoint(), aText, NULL, pA->GetWidth() );
}
diff --git a/filter/source/svg/svgwriter.hxx b/filter/source/svg/svgwriter.hxx
index b21d86095700..b2c9a9460c00 100644
--- a/filter/source/svg/svgwriter.hxx
+++ b/filter/source/svg/svgwriter.hxx
@@ -80,17 +80,17 @@
#define NMSP_REGISTRY com::sun::star::registry
-#define REF( _def_Obj ) NMSP_UNO::Reference< _def_Obj >
-#define SEQ( _def_Obj ) NMSP_UNO::Sequence< _def_Obj >
-#define B2UCONST( _def_pChar ) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(_def_pChar )))
-#define SVG_DTD_STRING B2UCONST( "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">" )
+#define REF( _def_Obj ) NMSP_UNO::Reference< _def_Obj >
+#define SEQ( _def_Obj ) NMSP_UNO::Sequence< _def_Obj >
+#define B2UCONST( _def_pChar ) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(_def_pChar )))
+#define SVG_DTD_STRING B2UCONST( "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">" )
#define SVG_TINY_DTD_STRING B2UCONST( "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG Tiny 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd\">" )
-#define SVGWRITER_WRITE_NONE 0x00000000
-#define SVGWRITER_WRITE_FILL 0x00000001
-#define SVGWRITER_WRITE_TEXT 0x00000002
+#define SVGWRITER_WRITE_NONE 0x00000000
+#define SVGWRITER_WRITE_FILL 0x00000001
+#define SVGWRITER_WRITE_TEXT 0x00000002
#define SVGWRITER_NO_SHAPE_COMMENTS 0x01000000
-#define SVGWRITER_WRITE_ALL 0xFFFFFFFF
+#define SVGWRITER_WRITE_ALL 0xFFFFFFFF
// ----------------------
// - SVGAttributeWriter -
@@ -104,13 +104,13 @@ class SVGAttributeWriter
{
private:
- Font maCurFont;
- Color maCurLineColor;
- Color maCurFillColor;
- SVGExport& mrExport;
- SVGFontExport& mrFontExport;
- SvXMLElementExport* mpElemFont;
- SvXMLElementExport* mpElemPaint;
+ Font maCurFont;
+ Color maCurLineColor;
+ Color maCurFillColor;
+ SVGExport& mrExport;
+ SVGFontExport& mrFontExport;
+ SvXMLElementExport* mpElemFont;
+ SvXMLElementExport* mpElemPaint;
SVGAttributeWriter();
@@ -168,25 +168,25 @@ private:
sal_Int32 mnCurGradientId;
sal_Int32 mnCurMaskId;
sal_Int32 mnCurPatternId;
- Stack maContextStack;
+ Stack maContextStack;
::std::auto_ptr< SVGShapeDescriptor > mapCurShape;
- SVGExport& mrExport;
+ SVGExport& mrExport;
SVGFontExport& mrFontExport;
SVGAttributeWriter* mpContext;
- VirtualDevice* mpVDev;
- MapMode maTargetMapMode;
+ VirtualDevice* mpVDev;
+ MapMode maTargetMapMode;
sal_uInt32 mnInnerMtfCount;
- sal_Bool mbDestroyVDev;
- sal_Bool mbPaintAttrChanged;
- sal_Bool mbFontAttrChanged;
+ sal_Bool mbDestroyVDev;
+ sal_Bool mbPaintAttrChanged;
+ sal_Bool mbFontAttrChanged;
sal_Bool mbClipAttrChanged;
SVGAttributeWriter* ImplAcquireContext() { maContextStack.Push( mpContext = new SVGAttributeWriter( mrExport, mrFontExport ) ); return mpContext; }
- void ImplReleaseContext() { delete (SVGAttributeWriter*) maContextStack.Pop(); mpContext = (SVGAttributeWriter*) maContextStack.Top(); }
+ void ImplReleaseContext() { delete (SVGAttributeWriter*) maContextStack.Pop(); mpContext = (SVGAttributeWriter*) maContextStack.Top(); }
long ImplMap( sal_Int32 nVal ) const;
- Point& ImplMap( const Point& rPt, Point& rDstPt ) const;
- Size& ImplMap( const Size& rSz, Size& rDstSz ) const;
+ Point& ImplMap( const Point& rPt, Point& rDstPt ) const;
+ Size& ImplMap( const Size& rSz, Size& rDstSz ) const;
Rectangle& ImplMap( const Rectangle& rRect, Rectangle& rDstRect ) const;
Polygon& ImplMap( const Polygon& rPoly, Polygon& rDstPoly ) const;
PolyPolygon& ImplMap( const PolyPolygon& rPolyPoly, PolyPolygon& rDstPolyPoly ) const;
@@ -208,8 +208,7 @@ private:
Color ImplGetColorWithIntensity( const Color& rColor, sal_uInt16 nIntensity );
Color ImplGetGradientColor( const Color& rStartColor, const Color& rEndColor, double fOffset );
void ImplWriteMask( GDIMetaFile& rMtf, const Point& rDestPt, const Size& rDestSize, const Gradient& rGradient, sal_uInt32 nWriteFlags );
- void ImplWriteText( const Point& rPos, const String& rText, const sal_Int32* pDXArray, long nWidth,
- sal_Bool bApplyMapping = sal_True );
+ void ImplWriteText( const Point& rPos, const String& rText, const sal_Int32* pDXArray, long nWidth, sal_Bool bApplyMapping = sal_True );
void ImplWriteText( const Point& rPos, const String& rText, const sal_Int32* pDXArray, long nWidth, Color aTextColor, sal_Bool bApplyMapping );
void ImplWriteBmp( const BitmapEx& rBmpEx, const Point& rPt, const Size& rSz, const Point& rSrcPt, const Size& rSrcSz,
sal_Bool bApplyMapping = sal_True );
@@ -221,7 +220,7 @@ private:
public:
- static ::rtl::OUString GetPathString( const PolyPolygon& rPolyPoly, sal_Bool bLine );
+ static ::rtl::OUString GetPathString( const PolyPolygon& rPolyPoly, sal_Bool bLine );
public: