diff options
Diffstat (limited to 'sd')
-rw-r--r-- | sd/prj/build.lst | 2 | ||||
-rw-r--r-- | sd/source/filter/pptx/eppt.hxx | 596 | ||||
-rw-r--r-- | sd/source/filter/pptx/pptx-eppt.cxx | 1585 | ||||
-rw-r--r-- | sd/source/filter/pptx/pptx-epptso.cxx | 2091 |
4 files changed, 451 insertions, 3823 deletions
diff --git a/sd/prj/build.lst b/sd/prj/build.lst index d6a6a389f0da..db9214a64774 100644 --- a/sd/prj/build.lst +++ b/sd/prj/build.lst @@ -1,4 +1,4 @@ -sd sd : filter l10n animations svx sfx2 stoc canvas NULL +sd sd : filter l10n animations svx sfx2 stoc canvas slideshow oox NULL sd sd usr1 - all sd_mkout NULL sd sd\inc nmake - all sd_inc NULL sd sd\prj get - all sd_prj NULL diff --git a/sd/source/filter/pptx/eppt.hxx b/sd/source/filter/pptx/eppt.hxx index 98beb7fd2aac..e5e1dcd3d4b1 100644 --- a/sd/source/filter/pptx/eppt.hxx +++ b/sd/source/filter/pptx/eppt.hxx @@ -36,13 +36,11 @@ #endif #include <tools/solar.h> #include <sot/storage.hxx> -#include <tools/gen.hxx> #include <vcl/graph.hxx> #include <unotools/fontcvt.hxx> -#include <tools/string.hxx> #include "pptexanimations.hxx" #include <pptexsoundcollection.hxx> - +#include "text.hxx" // ------------------------------------------------------------------------ #include <vcl/mapmod.hxx> @@ -66,11 +64,7 @@ #include <com/sun/star/drawing/Hatch.hpp> #include <com/sun/star/drawing/LineDash.hpp> #include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp> -#include <com/sun/star/presentation/XPresentationSupplier.hpp> #include <com/sun/star/presentation/XCustomPresentationSupplier.hpp> -#include <com/sun/star/drawing/XMasterPageTarget.hpp> -#include <com/sun/star/drawing/XDrawPagesSupplier.hpp> -#include <com/sun/star/drawing/XMasterPagesSupplier.hpp> #include <com/sun/star/awt/XGraphics.hpp> #include <com/sun/star/task/XStatusIndicatorSupplier.hpp> #include <com/sun/star/presentation/AnimationEffect.hpp> @@ -81,12 +75,10 @@ #include <com/sun/star/text/XTextFieldsSupplier.hpp> #include <com/sun/star/text/XTextField.hpp> #include <com/sun/star/container/XNamed.hpp> -#include <com/sun/star/awt/FontDescriptor.hpp> #include <com/sun/star/container/XIndexContainer.hpp> #include <com/sun/star/awt/XControlModel.hpp> #include <com/sun/star/style/TabStop.hpp> #include <filter/msfilter/msocximex.hxx> -#include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/XPropertyState.hpp> #include <com/sun/star/beans/XPropertySetInfo.hpp> #include <com/sun/star/awt/FontFamily.hpp> @@ -95,7 +87,7 @@ #include <com/sun/star/text/WritingMode.hpp> #include <com/sun/star/lang/Locale.hpp> -enum PageType { NORMAL = 0, MASTER = 1, NOTICE = 2, UNDEFINED = 3 }; +#include <epptbase.hxx> #define EPP_MAINMASTER_PERSIST_KEY 0x80010000 #define EPP_MAINNOTESMASTER_PERSIST_KEY 0x80020000 @@ -116,283 +108,11 @@ enum PageType { NORMAL = 0, MASTER = 1, NOTICE = 2, UNDEFINED = 3 }; #define EPP_TEXTSTYLE_BODY 0x00000100 #define EPP_TEXTSTYLE_TEXT 0x00001000 -// PLACEMENT_ID -#define EPP_LAYOUT_TITLESLIDE 0 /* The slide is a title slide */ -#define EPP_LAYOUT_TITLEANDBODYSLIDE 1 /* Title and body slide */ -#define EPP_LAYOUT_TITLEMASTERSLIDE 2 /* Title master slide */ -#define EPP_LAYOUT_MASTERSLIDE 3 /* Master slide layout */ -#define EPP_LAYOUT_MASTERNOTES 4 /* Master notes layout */ -#define EPP_LAYOUT_NOTESTITLEBODY 5 /* Notes title/body layout */ -#define EPP_LAYOUT_HANDOUTLAYOUT 6 /* Handout layout, therefore it doesn't have placeholders except header, footer, and date */ -#define EPP_LAYOUT_ONLYTITLE 7 /* Only title placeholder */ -#define EPP_LAYOUT_2COLUMNSANDTITLE 8 /* Body of the slide has 2 columns and a title */ -#define EPP_LAYOUT_2ROWSANDTITLE 9 /* Slide's body has 2 rows and a title */ -#define EPP_LAYOUT_RIGHTCOLUMN2ROWS 10 /* Body contains 2 columns, right column has 2 rows */ -#define EPP_LAYOUT_LEFTCOLUMN2ROWS 11 /* Body contains 2 columns, left column has 2 rows */ -#define EPP_LAYOUT_BOTTOMROW2COLUMNS 12 /* Body contains 2 rows, bottom row has 2 columns */ -#define EPP_LAYOUT_TOPROW2COLUMN 13 /* Body contains 2 rows, top row has 2 columns */ -#define EPP_LAYOUT_4OBJECTS 14 /* 4 objects */ -#define EPP_LAYOUT_BIGOBJECT 15 /* Big object */ -#define EPP_LAYOUT_BLANCSLIDE 16 /* Blank slide */ -#define EPP_LAYOUT_TITLERIGHTBODYLEFT 17 /* Vertical title on the right, body on the left */ -#define EPP_LAYOUT_TITLERIGHT2BODIESLEFT 18 /* Vertical title on the right, body on the left split into 2 rows */ - class Polygon; -class PptEscherEx; class XStatusIndicatorRef; -struct PHLayout -{ - sal_Int32 nLayout; - sal_uInt8 nPlaceHolder[ 8 ]; - - sal_uInt8 nUsedObjectPlaceHolder; - sal_uInt8 nTypeOfTitle; - sal_uInt8 nTypeOfOutliner; - - BOOL bTitlePossible; - BOOL bOutlinerPossible; - BOOL bSecOutlinerPossible; -}; - -struct SOParagraph -{ - sal_Bool bExtendedParameters; - sal_uInt32 nParaFlags; - sal_Int16 nBulletFlags; - String sPrefix; - String sSuffix; - String sGraphicUrl; // String auf eine Graphic - Size aBuGraSize; - sal_uInt32 nNumberingType; // in wirlichkeit ist dies ein SvxEnum - sal_uInt32 nHorzAdjust; - sal_uInt32 nBulletColor; - sal_Int32 nBulletOfs; - sal_Int16 nStartWith; // Start der nummerierung - sal_Int16 nTextOfs; - sal_Int16 nBulletRealSize; // GroessenVerhaeltnis in Proz - sal_Int16 nDepth; // aktuelle tiefe - sal_Unicode cBulletId; // wenn Numbering Type == CharSpecial - ::com::sun::star::awt::FontDescriptor aFontDesc; - - sal_Bool bExtendedBulletsUsed; - sal_uInt16 nBulletId; - sal_uInt32 nMappedNumType; - sal_Bool bNumberingIsNumber; - - SOParagraph() - { - nDepth = 0; - bExtendedParameters = FALSE; - nParaFlags = 0; - nBulletFlags = 0; - nBulletOfs = 0; - nTextOfs = 0; - bExtendedBulletsUsed = FALSE; - nBulletId = 0xffff; - bNumberingIsNumber = sal_True; - }; -}; - // ------------------------------------------------------------------------ -class EscherGraphicProvider; -class PPTExBulletProvider -{ - friend struct PPTExParaSheet; - - protected : - - SvMemoryStream aBuExPictureStream; - SvMemoryStream aBuExOutlineStream; - SvMemoryStream aBuExMasterStream; - - EscherGraphicProvider* pGraphicProv; - - public : - - sal_uInt16 GetId( const ByteString& rUniqueId, Size& rGraphicSize ); - - PPTExBulletProvider(); - ~PPTExBulletProvider(); -}; - -struct FontCollectionEntry -{ - String Name; - double Scaling; - sal_Int16 Family; - sal_Int16 Pitch; - sal_Int16 CharSet; - - String Original; - sal_Bool bIsConverted; - - FontCollectionEntry( const String& rName, sal_Int16 nFamily, sal_Int16 nPitch, sal_Int16 nCharSet ) : - Scaling ( 1.0 ), - Family ( nFamily ), - Pitch ( nPitch ), - CharSet ( nCharSet ), - Original( rName ) - { - ImplInit( rName ); - }; - - FontCollectionEntry( const String& rName ) : - Scaling ( 1.0 ), - Original( rName ) - { - ImplInit( rName ); - }; - ~FontCollectionEntry(); - - private : - - FontCollectionEntry() {}; - - void ImplInit( const String& rName ); -}; - -class VirtualDevice; -class FontCollection : private List -{ - VirtualDevice* pVDev; - public : - FontCollection(); - ~FontCollection(); - - short GetScriptDirection( const String& rText ) const; - sal_uInt32 GetId( FontCollectionEntry& rFontDescriptor ); - sal_uInt32 GetCount() const { return List::Count(); }; - const FontCollectionEntry* GetById( sal_uInt32 nId ); - FontCollectionEntry& GetLast() { return *(FontCollectionEntry*)List::Last(); }; -}; - -// ------------------------------------------------------------------------ - -#define PPTEX_STYLESHEETENTRYS 9 - -enum PPTExTextAttr -{ - ParaAttr_BulletOn, - ParaAttr_BuHardFont, - ParaAttr_BuHardColor, - ParaAttr_BuHardHeight, - ParaAttr_BulletChar, - ParaAttr_BulletFont, - ParaAttr_BulletHeight, - ParaAttr_BulletColor, - ParaAttr_Adjust, - ParaAttr_LineFeed, - ParaAttr_UpperDist, - ParaAttr_LowerDist, - ParaAttr_TextOfs, - ParaAttr_BulletOfs, - ParaAttr_DefaultTab, - ParaAttr_AsianLB_1, - ParaAttr_AsianLB_2, - ParaAttr_AsianLB_3, - ParaAttr_BiDi, - CharAttr_Bold, - CharAttr_Italic, - CharAttr_Underline, - CharAttr_Shadow, - CharAttr_Strikeout, - CharAttr_Embossed, - CharAttr_Font, - CharAttr_AsianOrComplexFont, - CharAttr_Symbol, - CharAttr_FontHeight, - CharAttr_FontColor, - CharAttr_Escapement -}; - -struct PPTExCharLevel -{ - sal_uInt16 mnFlags; - sal_uInt16 mnFont; - sal_uInt16 mnAsianOrComplexFont; - sal_uInt16 mnFontHeight; - sal_uInt16 mnEscapement; - sal_uInt32 mnFontColor; -}; - -struct PPTExCharSheet -{ - PPTExCharLevel maCharLevel[ 5 ]; - - PPTExCharSheet( int nInstance ); - - void SetStyleSheet( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &, - FontCollection& rFontCollection, int nLevel ); - void Write( SvStream& rSt, PptEscherEx* pEx, sal_uInt16 nLev, sal_Bool bFirst, sal_Bool bSimpleText, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rPagePropSet ); - -}; - -struct PPTExParaLevel -{ - sal_Bool mbIsBullet; - sal_uInt16 mnBulletChar; - sal_uInt16 mnBulletFont; - sal_uInt16 mnBulletHeight; - sal_uInt32 mnBulletColor; - - sal_uInt16 mnAdjust; - sal_uInt16 mnLineFeed; - sal_uInt16 mnUpperDist; - sal_uInt16 mnLowerDist; - sal_uInt16 mnTextOfs; - sal_uInt16 mnBulletOfs; - sal_uInt16 mnDefaultTab; - - sal_Bool mbExtendedBulletsUsed; - sal_uInt16 mnBulletId; - sal_uInt16 mnBulletStart; - sal_uInt32 mnMappedNumType; - sal_uInt32 mnNumberingType; - sal_uInt16 mnAsianSettings; - sal_uInt16 mnBiDi; -}; - -struct PPTExParaSheet -{ - PPTExBulletProvider& rBuProv; - - sal_uInt32 mnInstance; - - PPTExParaLevel maParaLevel[ 5 ]; - PPTExParaSheet( int nInstance, sal_uInt16 nDefaultTab, PPTExBulletProvider& rProv ); - - void SetStyleSheet( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &, - FontCollection& rFontCollection, int nLevel, const PPTExCharLevel& rCharLevel ); - void Write( SvStream& rSt, PptEscherEx* pEx, sal_uInt16 nLev, sal_Bool bFirst, sal_Bool bSimpleText, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rPagePropSet ); -}; - -class PPTExStyleSheet -{ - - public : - - PPTExCharSheet* mpCharSheet[ PPTEX_STYLESHEETENTRYS ]; - PPTExParaSheet* mpParaSheet[ PPTEX_STYLESHEETENTRYS ]; - - PPTExStyleSheet( sal_uInt16 nDefaultTab, PPTExBulletProvider& rBuProv ); - ~PPTExStyleSheet(); - - PPTExParaSheet& GetParaSheet( int nInstance ) { return *mpParaSheet[ nInstance ]; }; - PPTExCharSheet& GetCharSheet( int nInstance ) { return *mpCharSheet[ nInstance ]; }; - - void SetStyleSheet( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &, - FontCollection& rFontCollection, int nInstance, int nLevel ); - sal_Bool IsHardAttribute( sal_uInt32 nInstance, sal_uInt32 nLevel, PPTExTextAttr eAttr, sal_uInt32 nValue ); - - sal_uInt32 SizeOfTxCFStyleAtom() const; - void WriteTxCFStyleAtom( SvStream& rSt ); -}; - - struct EPPTHyperlink { String aURL; @@ -437,296 +157,34 @@ struct TextRuleEntry ~TextRuleEntry() { delete pOut; }; }; -// ------------------------------------------------------------------------ - -struct GroupEntry +class TextObjBinary : public TextObj { - sal_uInt32 mnCurrentPos; - sal_uInt32 mnCount; - ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > mXIndexAccess; - GroupEntry( ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > & rIndex ) - { - mXIndexAccess = rIndex; - mnCount =mXIndexAccess->getCount(); - mnCurrentPos = 0; - }; - GroupEntry( sal_uInt32 nCount ) - { - mnCount = nCount; - mnCurrentPos = 0; - }; - ~GroupEntry(){}; -}; - -// ------------------------------------------------------------------------ +public: + TextObjBinary( ::com::sun::star::uno::Reference< ::com::sun::star::text::XSimpleText > & + rXText, int nInstance, FontCollection& rFontCollection, PPTExBulletProvider& rBuProv ) : TextObj( rXText, nInstance, rFontCollection, rBuProv ) {} -class GroupTable -{ - protected: - - sal_uInt32 mnIndex; - sal_uInt32 mnCurrentGroupEntry; - sal_uInt32 mnMaxGroupEntry; - sal_uInt32 mnGroupsClosed; - GroupEntry** mpGroupEntry; - - void ImplResizeGroupTable( sal_uInt32 nEntrys ); - - public: - - sal_uInt32 GetCurrentGroupIndex() const { return mnIndex; }; - sal_Int32 GetCurrentGroupLevel() const { return mnCurrentGroupEntry - 1; }; - ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > & - GetCurrentGroupAccess() const { return mpGroupEntry[ mnCurrentGroupEntry - 1 ]->mXIndexAccess; }; - sal_uInt32 GetGroupsClosed(); - void SkipCurrentGroup(); - void ResetGroupTable( sal_uInt32 nCount ); - void ClearGroupTable(); - sal_Bool EnterGroup( ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > & rIndex ); - sal_Bool GetNextGroupEntry(); - GroupTable(); - ~GroupTable(); -}; - -class PropValue -{ - protected : - - ::com::sun::star::uno::Any mAny; - - ::com::sun::star::uno::Reference - < ::com::sun::star::beans::XPropertySet > mXPropSet; - - sal_Bool ImplGetPropertyValue( const String& rString ); - sal_Bool ImplGetPropertyValue( const ::com::sun::star::uno::Reference - < ::com::sun::star::beans::XPropertySet > &, const String& ); - - public : - - static sal_Bool GetPropertyValue( - ::com::sun::star::uno::Any& rAny, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &, - const String& rPropertyName, - sal_Bool bTestPropertyAvailability = sal_False ); - - static ::com::sun::star::beans::PropertyState GetPropertyState( - const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > &, - const String& rPropertyName ); -}; - -class PropStateValue : public PropValue -{ - protected : - - ::com::sun::star::beans::PropertyState ePropState; - ::com::sun::star::uno::Reference - < ::com::sun::star::beans::XPropertyState > mXPropState; - - sal_Bool ImplGetPropertyValue( const String& rString, sal_Bool bGetPropertyState = TRUE ); - -}; - -// ------------------------------------------------------------------------ - -struct FieldEntry; -class PortionObj : public PropStateValue -{ - - friend class ParagraphObj; - - protected : - - void ImplClear(); - void ImplConstruct( PortionObj& rPortionObj ); - sal_uInt32 ImplGetTextField( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & rXTextRangeRef, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSetRef, String& rURL ); - sal_uInt32 ImplCalculateTextPositions( sal_uInt32 nCurrentTextPosition ); - void ImplGetPortionValues( FontCollection& rFontCollection, sal_Bool bGetPropStateValue = FALSE ); - - public : - - ::com::sun::star::beans::PropertyState meCharColor; - ::com::sun::star::beans::PropertyState meCharHeight; - ::com::sun::star::beans::PropertyState meFontName; - ::com::sun::star::beans::PropertyState meAsianOrComplexFont; - ::com::sun::star::beans::PropertyState meCharEscapement; - ::com::sun::star::lang::Locale meCharLocale; - sal_uInt16 mnCharAttrHard; - - sal_uInt32 mnCharColor; - sal_uInt16 mnCharAttr; - sal_uInt16 mnCharHeight; - sal_uInt16 mnFont; - sal_uInt16 mnAsianOrComplexFont; - sal_Int16 mnCharEscapement; - - sal_uInt32 mnTextSize; - sal_Bool mbLastPortion; - - sal_uInt16* mpText; - FieldEntry* mpFieldEntry; - - PortionObj( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & rXTextRangeRef, - sal_Bool bLast, FontCollection& rFontCollection ); - PortionObj( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSetRef, - FontCollection& rFontCollection ); - PortionObj( PortionObj& rPortionObj ); - ~PortionObj(); - - void Write( SvStream* pStrm, sal_Bool bLast ); - sal_uInt32 Count() const { return mnTextSize; }; - - PortionObj& operator=( PortionObj& rPortionObj ); -}; - -struct ParaFlags -{ - sal_Bool bFirstParagraph : 1; - sal_Bool bLastParagraph : 1; - - ParaFlags() { bFirstParagraph = TRUE; bLastParagraph = FALSE; }; -}; - -class ParagraphObj : public List, public PropStateValue, public SOParagraph -{ - friend class TextObj; - friend struct PPTExParaSheet; - - MapMode maMapModeSrc; - MapMode maMapModeDest; - - protected : - - void ImplConstruct( ParagraphObj& rParagraphObj ); - void ImplClear(); - sal_uInt32 ImplCalculateTextPositions( sal_uInt32 nCurrentTextPosition ); - ::com::sun::star::awt::Size ImplMapSize( const ::com::sun::star::awt::Size& rSize ); - void ImplGetParagraphValues( PPTExBulletProvider& rBuProv, sal_Bool bGetPropStateValue = FALSE ); - void ImplGetNumberingLevel( PPTExBulletProvider& rBuProv, sal_Int16 nDepth, sal_Bool bIsBullet, sal_Bool bGetPropStateValue = FALSE ); - - public : - - ::com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop > maTabStop; - - sal_uInt32 mnTextSize; - - sal_Bool mbIsBullet; - sal_Bool mbFirstParagraph; - sal_Bool mbLastParagraph; - - ::com::sun::star::beans::PropertyState meBullet; - ::com::sun::star::beans::PropertyState meTextAdjust; - ::com::sun::star::beans::PropertyState meLineSpacing; - ::com::sun::star::beans::PropertyState meLineSpacingTop; - ::com::sun::star::beans::PropertyState meLineSpacingBottom; - ::com::sun::star::beans::PropertyState meForbiddenRules; - ::com::sun::star::beans::PropertyState meParagraphPunctation; - ::com::sun::star::beans::PropertyState meBiDi; - - sal_uInt16 mnTextAdjust; - sal_Int16 mnLineSpacing; - sal_Bool mbFixedLineSpacing; - sal_Int16 mnLineSpacingTop; - sal_Int16 mnLineSpacingBottom; - sal_Bool mbForbiddenRules; - sal_Bool mbParagraphPunctation; - sal_uInt16 mnBiDi; - - ParagraphObj( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > & rXTextContentRef, - ParaFlags, FontCollection& rFontCollection, - PPTExBulletProvider& rBuProv ); - ParagraphObj( ParagraphObj& rParargraphObj ); - ParagraphObj( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSetRef, - PPTExBulletProvider& rBuProv ); - - void CalculateGraphicBulletSize( sal_uInt16 nFontHeight ); - ~ParagraphObj(); - - void Write( SvStream* pStrm ); - sal_uInt32 Count() const { return mnTextSize; }; - - ParagraphObj& operator=( ParagraphObj& rParagraphObj ); -}; - -struct ImplTextObj -{ - sal_uInt32 mnRefCount; - sal_uInt32 mnTextSize; - int mnInstance; - List* mpList; - sal_Bool mbHasExtendedBullets; - sal_Bool mbFixedCellHeightUsed; - - ImplTextObj( int nInstance ); - ~ImplTextObj(); -}; - -class TextObj -{ - ImplTextObj* mpImplTextObj; - void ImplCalculateTextPositions(); - - public : - TextObj( ::com::sun::star::uno::Reference< ::com::sun::star::text::XSimpleText > & - rXText, int nInstance, FontCollection& rFontCollection, PPTExBulletProvider& rBuProv ); - TextObj( TextObj& rTextObj ); - ~TextObj(); - - void Write( SvStream* pStrm ); - - ParagraphObj* First(){ return (ParagraphObj*)mpImplTextObj->mpList->First(); }; - ParagraphObj* Next(){ return(ParagraphObj*)mpImplTextObj->mpList->Next(); }; - sal_uInt32 Count() const { return mpImplTextObj->mnTextSize; }; - int GetInstance() const { return mpImplTextObj->mnInstance; }; - sal_Bool HasExtendedBullets(){ return mpImplTextObj->mbHasExtendedBullets; }; - void WriteTextSpecInfo( SvStream* pStrm ); - - TextObj& operator=( TextObj& rTextObj ); + void Write( SvStream* pStrm ); + void WriteTextSpecInfo( SvStream* pStrm ); }; // ------------------------------------------------------------------------ struct CellBorder; -class PPTWriter : public GroupTable, public PropValue, public PPTExBulletProvider +class PPTWriter : public PPTWriterBase, public PPTExBulletProvider { + sal_uInt32 mnCnvrtFlags; sal_Bool mbStatus; sal_Bool mbUseNewAnimations; sal_uInt32 mnStatMaxValue; sal_uInt32 mnLatestStatValue; - std::vector< PPTExStyleSheet* > maStyleSheetList; - PPTExStyleSheet* mpStyleSheet; EscherGraphicProvider* mpGraphicProvider; - Fraction maFraction; - MapMode maMapModeSrc; - MapMode maMapModeDest; - ::com::sun::star::awt::Size maDestPageSize; - ::com::sun::star::awt::Size maNotesPageSize; - PageType meLatestPageType; List maSlideNameList; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mXModel; - ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > mXStatusIndicator; - ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPagesSupplier > mXDrawPagesSupplier; - ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XMasterPagesSupplier > mXMasterPagesSupplier; - ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPages > mXDrawPages; - ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > mXDrawPage; - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mXPagePropSet; - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mXBackgroundPropSet; - ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > mXShapes; - ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mXShape; ::com::sun::star::uno::Reference< ::com::sun::star::text::XSimpleText > mXText; // TextRef des globalen Text ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > mXCursor; ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > mXCursorText; // TextRef des Teilstuecks des Cursors ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > mXCursorPropSet; // die Properties des Teilstueckes ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextField > mXTextField; - ::com::sun::star::awt::Size maSize; - ::com::sun::star::awt::Point maPosition; - Rectangle maRect; - ByteString mType; - sal_Bool mbPresObj; - sal_Bool mbEmptyPresObj; - sal_Bool mbStatusIndicator; - sal_Int32 mnAngle; sal_uInt32 mnTextStyle; sal_Bool mbFontIndependentLineSpacing; @@ -744,8 +202,6 @@ class PPTWriter : public GroupTable, public PropValue, public PPTExBulletProvide sal_uInt32 mnExEmbed; SvMemoryStream* mpExEmbed; - sal_uInt32 mnPages; // anzahl einzelner Slides ( ohne masterpages & notes & handout ) - sal_uInt32 mnMasterPages; // sal_uInt32 mnDrawings; // anzahl Slides + masterpages + notes + handout sal_uInt32 mnPagesWritten; sal_uInt32 mnUniqueSlideIdentifier; @@ -757,13 +213,10 @@ class PPTWriter : public GroupTable, public PropValue, public PPTExBulletProvide sal_uInt32 mnShapeMasterTitle; sal_uInt32 mnShapeMasterBody; - List maTextRuleList; // TextRuleEntry's List maHyperlink; - FontCollection maFontCollection; ppt::ExSoundCollection maSoundCollection; - PHLayout& ImplGetLayout( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rXPropSet ) const; void ImplWriteExtParaHeader( SvMemoryStream& rSt, sal_uInt32 nRef, sal_uInt32 nInstance, sal_uInt32 nSlideId ); @@ -778,29 +231,22 @@ class PPTWriter : public GroupTable, public PropValue, public PPTExBulletProvide protected: - sal_Bool ImplCreateDocumentSummaryInformation( sal_uInt32 nCnvrtFlags ); + sal_Bool ImplCreateDocumentSummaryInformation(); sal_Bool ImplCreateCurrentUserStream(); void ImplCreateHeaderFooterStrings( SvStream& rOut, ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rXPagePropSet ); void ImplCreateHeaderFooters( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rXPagePropSet ); - sal_Bool ImplCreateDocument(); + virtual sal_Bool ImplCreateDocument(); sal_Bool ImplCreateHyperBlob( SvMemoryStream& rStream ); sal_uInt32 ImplInsertBookmarkURL( const String& rBookmark, const sal_uInt32 nType, const String& rStringVer0, const String& rStringVer1, const String& rStringVer2, const String& rStringVer3 ); - sal_Bool ImplCreateMaster( sal_uInt32 nPageNum ); - sal_Bool ImplCreateMainNotes(); - sal_Bool ImplCreateSlide( sal_uInt32 nPageNum ); + virtual sal_Bool ImplCreateMainNotes(); sal_Bool ImplCreateNotes( sal_uInt32 nPageNum ); void ImplWriteBackground( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXBackgroundPropSet ); - void ImplWriteVBA( SvMemoryStream* pVBA ); - void ImplWriteOLE( sal_uInt32 nCnvrtFlags ); + void ImplWriteVBA(); + void ImplWriteOLE(); sal_Bool ImplWriteAtomEnding(); - sal_Bool ImplInitSOIface(); - sal_Bool ImplSetCurrentStyleSheet( sal_uInt32 nPageNum ); - sal_Bool ImplGetPageByIndex( sal_uInt32 nIndex, PageType ); - sal_Bool ImplGetShapeByIndex( sal_uInt32 nIndex, sal_Bool bGroup = FALSE ); - sal_uInt32 ImplGetMasterIndex( PageType ePageType ); void ImplFlipBoundingBox( EscherPropertyContainer& rPropOpt ); sal_Bool ImplGetText(); sal_Bool ImplCreatePresentationPlaceholder( const sal_Bool bMaster, const PageType PageType, @@ -814,7 +260,6 @@ class PPTWriter : public GroupTable, public PropValue, public PPTExBulletProvide ::com::sun::star::presentation::AnimationEffect eTextEffect, sal_uInt16 nOrder ); void ImplWriteClickAction( SvStream& rSt, ::com::sun::star::presentation::ClickAction eAction, sal_Bool bMediaClickAction ); - sal_Bool ImplGetStyleSheets(); void ImplWriteParagraphs( SvStream& rOutStrm, TextObj& rTextObj ); void ImplWritePortions( SvStream& rOutStrm, TextObj& rTextObj ); void ImplWriteTextStyleAtom( SvStream& rOut, int nTextInstance, sal_uInt32 nAtomInstance, @@ -831,13 +276,15 @@ class PPTWriter : public GroupTable, public PropValue, public PPTExBulletProvide void ImplCreateCellBorder( const CellBorder* pCellBorder, sal_Int32 nX1, sal_Int32 nY1, sal_Int32 nX2, sal_Int32 nY2 ); void ImplCreateTable( com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& rXShape, EscherSolverContainer& aSolverContainer, EscherPropertyContainer& aPropOpt ); - ::com::sun::star::awt::Point ImplMapPoint( const ::com::sun::star::awt::Point& ); - ::com::sun::star::awt::Size ImplMapSize( const ::com::sun::star::awt::Size& ); - Rectangle ImplMapRectangle( const ::com::sun::star::awt::Rectangle& ); sal_Bool ImplCloseDocument(); // die font-, hyper-, Soundliste wird geschrieben .. void ImplWriteCString( SvStream&, const String&, sal_uInt32 nInstance = 0 ); + virtual void ImplWriteSlide( sal_uInt32 nPageNum, sal_uInt32 nMasterID, sal_uInt16 nMode, + sal_Bool bHasBackground, ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > aXBackgroundPropSet ); + virtual void ImplWriteNotes( sal_uInt32 nPageNum ); + virtual void ImplWriteSlideMaster( sal_uInt32 nPageNum, ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > aXBackgroundPropSet ); + public: PPTWriter( SvStorageRef& rSvStorage, ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & rModel, @@ -847,6 +294,9 @@ class PPTWriter : public GroupTable, public PropValue, public PPTExBulletProvide ~PPTWriter(); sal_Bool IsValid() const { return mbStatus; }; + + virtual void exportPPTPre(); + virtual void exportPPTPost(); }; diff --git a/sd/source/filter/pptx/pptx-eppt.cxx b/sd/source/filter/pptx/pptx-eppt.cxx index a36a724de88f..02a3fedbe38e 100644 --- a/sd/source/filter/pptx/pptx-eppt.cxx +++ b/sd/source/filter/pptx/pptx-eppt.cxx @@ -59,62 +59,13 @@ #include <svx/msdffimp.hxx> #include <svx/flditem.hxx> #include <sfx2/docinf.hxx> +#include <oox/export/utils.hxx> -#define PPT_TRANSITION_TYPE_NONE 0 -#define PPT_TRANSITION_TYPE_RANDOM 1 -#define PPT_TRANSITION_TYPE_BLINDS 2 -#define PPT_TRANSITION_TYPE_CHECKER 3 -#define PPT_TRANSITION_TYPE_COVER 4 -#define PPT_TRANSITION_TYPE_DISSOLVE 5 -#define PPT_TRANSITION_TYPE_FADE 6 -#define PPT_TRANSITION_TYPE_PULL 7 -#define PPT_TRANSITION_TYPE_RANDOM_BARS 8 -#define PPT_TRANSITION_TYPE_STRIPS 9 -#define PPT_TRANSITION_TYPE_WIPE 10 -#define PPT_TRANSITION_TYPE_ZOOM 11 -#define PPT_TRANSITION_TYPE_SPLIT 13 - -// effects, new in xp -#define PPT_TRANSITION_TYPE_DIAMOND 17 -#define PPT_TRANSITION_TYPE_PLUS 18 -#define PPT_TRANSITION_TYPE_WEDGE 19 -#define PPT_TRANSITION_TYPE_PUSH 20 -#define PPT_TRANSITION_TYPE_COMB 21 -#define PPT_TRANSITION_TYPE_NEWSFLASH 22 -#define PPT_TRANSITION_TYPE_SMOOTHFADE 23 -#define PPT_TRANSITION_TYPE_WHEEL 26 -#define PPT_TRANSITION_TYPE_CIRCLE 27 - -using namespace com::sun::star; - -static PHLayout pPHLayout[] = -{ - { EPP_LAYOUT_TITLESLIDE, { 0x0d, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x0d, 0x10, TRUE, TRUE, FALSE }, - { EPP_LAYOUT_TITLEANDBODYSLIDE, { 0x0d, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x0d, 0x0e, TRUE, TRUE, FALSE }, - { EPP_LAYOUT_TITLEANDBODYSLIDE, { 0x0d, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x14, 0x0d, 0x0e, TRUE, TRUE, FALSE }, - { EPP_LAYOUT_2COLUMNSANDTITLE, { 0x0d, 0x0e, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x0d, 0x0e, TRUE, TRUE, TRUE }, - { EPP_LAYOUT_2COLUMNSANDTITLE, { 0x0d, 0x0e, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x14, 0x0d, 0x0e, TRUE, TRUE, FALSE }, - { EPP_LAYOUT_BLANCSLIDE, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x0d, 0x0e, FALSE, FALSE, FALSE }, - { EPP_LAYOUT_2COLUMNSANDTITLE, { 0x0d, 0x0e, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x16, 0x0d, 0x0e, TRUE, TRUE, FALSE }, - { EPP_LAYOUT_2COLUMNSANDTITLE, { 0x0d, 0x14, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x14, 0x0d, 0x0e, TRUE, TRUE, FALSE }, - { EPP_LAYOUT_TITLEANDBODYSLIDE, { 0x0d, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x15, 0x0d, 0x0e, TRUE, FALSE, FALSE }, - { EPP_LAYOUT_2COLUMNSANDTITLE, { 0x0d, 0x16, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x16, 0x0d, 0x0e, TRUE, TRUE, FALSE }, - { EPP_LAYOUT_2COLUMNSANDTITLE, { 0x0d, 0x0e, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, TRUE, TRUE, FALSE }, - { EPP_LAYOUT_TITLEANDBODYSLIDE, { 0x0d, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, TRUE, FALSE, FALSE }, - { EPP_LAYOUT_RIGHTCOLUMN2ROWS, { 0x0d, 0x0e, 0x13, 0x13, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, TRUE, TRUE, FALSE }, - { EPP_LAYOUT_2COLUMNSANDTITLE, { 0x0d, 0x13, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, TRUE, TRUE, FALSE }, - { EPP_LAYOUT_2ROWSANDTITLE, { 0x0d, 0x13, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, TRUE, TRUE, FALSE }, - { EPP_LAYOUT_LEFTCOLUMN2ROWS, { 0x0d, 0x13, 0x13, 0x0e, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, TRUE, TRUE, FALSE }, - { EPP_LAYOUT_TOPROW2COLUMN, { 0x0d, 0x13, 0x13, 0x0e, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, TRUE, TRUE, FALSE }, - { EPP_LAYOUT_2ROWSANDTITLE, { 0x0d, 0x0e, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, TRUE, TRUE, FALSE }, - { EPP_LAYOUT_4OBJECTS, { 0x0d, 0x13, 0x13, 0x13, 0x13, 0x00, 0x00, 0x00 }, 0x13, 0x0d, 0x0e, TRUE, FALSE, FALSE }, - { EPP_LAYOUT_ONLYTITLE, { 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x0d, 0x0e, TRUE, FALSE, FALSE }, - { EPP_LAYOUT_BLANCSLIDE, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x0d, 0x0e, FALSE, FALSE, FALSE }, - { EPP_LAYOUT_TITLERIGHT2BODIESLEFT, { 0x11, 0x12, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x14, 0x11, 0x12, TRUE, TRUE, FALSE }, - { EPP_LAYOUT_TITLERIGHTBODYLEFT, { 0x11, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x11, 0x12, TRUE, TRUE, FALSE }, - { EPP_LAYOUT_TITLEANDBODYSLIDE, { 0x0d, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x00, 0x0d, 0x12, TRUE, TRUE, FALSE }, - { EPP_LAYOUT_2COLUMNSANDTITLE, { 0x0d, 0x16, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00 }, 0x16, 0x0d, 0x12, TRUE, TRUE, FALSE } -}; +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::presentation; + +using ::com::sun::star::beans::XPropertySet; //============================ PPTWriter ================================== @@ -122,16 +73,12 @@ PPTWriter::PPTWriter( SvStorageRef& rSvStorage, ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & rXModel, ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator > & rXStatInd, SvMemoryStream* pVBA, sal_uInt32 nCnvrtFlags ) : + PPTWriterBase ( rXModel, rXStatInd ), + mnCnvrtFlags ( nCnvrtFlags ), mbStatus ( sal_False ), mbUseNewAnimations ( sal_True ), mnLatestStatValue ( 0 ), - maFraction ( 1, 576 ), - maMapModeSrc ( MAP_100TH_MM ), - maMapModeDest ( MAP_INCH, Point(), maFraction, maFraction ), - meLatestPageType ( NORMAL ), - mXModel ( rXModel ), - mXStatusIndicator ( rXStatInd ), - mbStatusIndicator ( FALSE ), + mrStg ( rSvStorage ), mpCurUserStrm ( NULL ), mpStrm ( NULL ), mpPicStrm ( NULL ), @@ -143,38 +90,10 @@ PPTWriter::PPTWriter( SvStorageRef& rSvStorage, mnPagesWritten ( 0 ), mnTxId ( 0x7a2f64 ) { - sal_uInt32 i; - if ( !ImplInitSOIface() ) - return; - - FontCollectionEntry aDefaultFontDesc( String( RTL_CONSTASCII_USTRINGPARAM( "Times New Roman" ) ), - ::com::sun::star::awt::FontFamily::ROMAN, - ::com::sun::star::awt::FontPitch::VARIABLE, - RTL_TEXTENCODING_MS_1252 ); - maFontCollection.GetId( aDefaultFontDesc ); // default is always times new roman - - if ( !ImplGetPageByIndex( 0, NOTICE ) ) - return; - INT32 nWidth = 21000; - if ( ImplGetPropertyValue( mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Width" ) ) ) ) - mAny >>= nWidth; - INT32 nHeight = 29700; - if ( ImplGetPropertyValue( mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Height" ) ) ) ) - mAny >>= nHeight; - - maNotesPageSize = ImplMapSize( ::com::sun::star::awt::Size( nWidth, nHeight ) ); +} - if ( !ImplGetPageByIndex( 0, MASTER ) ) - return; - nWidth = 28000; - if ( ImplGetPropertyValue( mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Width" ) ) ) ) - mAny >>= nWidth; - nHeight = 21000; - if ( ImplGetPropertyValue( mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Height" ) ) ) ) - mAny >>= nHeight; - maDestPageSize = ImplMapSize( ::com::sun::star::awt::Size( nWidth, nHeight ) ); - - mrStg = rSvStorage; +void PPTWriter::exportPPTPre() +{ if ( !mrStg.Is() ) return; @@ -203,32 +122,10 @@ PPTWriter::PPTWriter( SvStorageRef& rSvStorage, mpPicStrm = mrStg->OpenSotStream( String( RTL_CONSTASCII_USTRINGPARAM( "Pictures" ) ) ); mpPptEscherEx = new PptEscherEx( *mpStrm, mnDrawings ); +}; - if ( !ImplGetStyleSheets() ) - return; - - if ( !ImplCreateDocument() ) - return; - - for ( i = 0; i < mnMasterPages; i++ ) - { - if ( !ImplCreateMaster( i ) ) - return; - } - if ( !ImplCreateMainNotes() ) - return; - maTextRuleList.First(); // rewind list, so we can get the current or next entry without - // searching, all entrys are sorted# - for ( i = 0; i < mnPages; i++ ) - { - if ( !ImplCreateSlide( i ) ) - return; - } - for ( i = 0; i < mnPages; i++ ) - { - if ( !ImplCreateNotes( i ) ) - return; - } +void PPTWriter::exportPPTPost() +{ if ( !ImplCloseDocument() ) return; @@ -243,19 +140,328 @@ PPTWriter::PPTWriter( SvStorageRef& rSvStorage, } } - ImplWriteOLE( nCnvrtFlags ); + ImplWriteOLE(); - ImplWriteVBA( pVBA ); + ImplWriteVBA(); if ( !ImplWriteAtomEnding() ) return; - if ( !ImplCreateDocumentSummaryInformation( nCnvrtFlags ) ) + if ( !ImplCreateDocumentSummaryInformation() ) return; mbStatus = TRUE; -}; +} + +// --------------------------------------------------------------------------------------------- + +void PPTWriter::ImplWriteSlide( sal_uInt32 nPageNum, sal_uInt32 nMasterNum, sal_uInt16 nMode, + sal_Bool bHasBackground, Reference< XPropertySet > aXBackgroundPropSet ) +{ + Any aAny; + + const PHLayout& rLayout = GetLayout( mXPagePropSet ); + mpPptEscherEx->PtReplaceOrInsert( EPP_Persist_Slide | nPageNum, mpStrm->Tell() ); + mpPptEscherEx->OpenContainer( EPP_Slide ); + mpPptEscherEx->AddAtom( 24, EPP_SlideAtom, 2 ); + *mpStrm << rLayout.nLayout; + mpStrm->Write( rLayout.nPlaceHolder, 8 ); // placeholderIDs ( 8Stueck ) + *mpStrm << (sal_uInt32)(nMasterNum | 0x80000000) // master ID ( ist gleich 0x80000000 bei einer masterpage ) + << (sal_uInt32)nPageNum + 0x100 // notes ID ( ist gleich null wenn keine notizen vorhanden ) + << nMode + << (sal_uInt16)0; // padword + mnDiaMode = 0; + sal_Bool bVisible = sal_True; + FadeEffect eFe = FadeEffect_NONE; + + if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Visible" ) ) ) ) + aAny >>= bVisible; + if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Change" ) ) ) ) + { + switch ( *(INT32*)aAny.getValue() ) + { + case 1 : // automatisch + mnDiaMode++; + case 2 : // halbautomatisch + mnDiaMode++; + default : + case 0 : // manuell + break; + } + } + if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Effect" ) ) ) ) + aAny >>= eFe; + + sal_uInt32 nSoundRef = 0; + sal_Bool bIsSound = sal_False; + sal_Bool bStopSound = sal_False; + sal_Bool bLoopSound = sal_False; + + if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Sound" ) ) ) ) + { + rtl::OUString aSoundURL; + if ( aAny >>= aSoundURL ) + { + nSoundRef = maSoundCollection.GetId( aSoundURL ); + bIsSound = sal_True; + } + else + aAny >>= bStopSound; + } + if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "LoopSound" ) ) ) ) + aAny >>= bLoopSound; + + + sal_Bool bNeedsSSSlideInfoAtom = ( bVisible == FALSE ) + || ( mnDiaMode == 2 ) + || ( bIsSound ) + || ( bStopSound ) + || ( eFe != FadeEffect_NONE ); + + if ( bNeedsSSSlideInfoAtom ) + { + sal_uInt8 nDirection = 0; + sal_uInt8 nTransitionType = 0; + sal_uInt16 nBuildFlags = 1; // advange by mouseclick + INT32 nSlideTime = 0; // muss noch !!! + sal_uInt8 nSpeed = 1; + + if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Speed" ) ) ) ) + { + AnimationSpeed aAs; + aAny >>= aAs; + nSpeed = (sal_uInt8)aAs; + } + + sal_Int16 nTT = 0, nTST = 0; + if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "TransitionType" ) ) ) + && ( aAny >>= nTT ) ) + if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "TransitionSubtype" ) ) ) + && ( aAny >>= nTST ) ) + nTransitionType = GetTransition( nTT, nTST, eFe, nDirection ); + + if( !nTransitionType ) + nTransitionType = GetTransition( eFe, nDirection ); + + if ( mnDiaMode == 2 ) // automatic ? + nBuildFlags |= 0x400; + if ( bVisible == FALSE ) + nBuildFlags |= 4; + if ( bIsSound ) + nBuildFlags |= 16; + if ( bLoopSound ) + nBuildFlags |= 64; + if ( bStopSound ) + nBuildFlags |= 256; + + if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Duration" ) ) ) )// duration of this slide + nSlideTime = *(INT32*)aAny.getValue() << 10; // in ticks + + + mpPptEscherEx->AddAtom( 16, EPP_SSSlideInfoAtom ); + *mpStrm << nSlideTime // standtime in ticks + << nSoundRef + << nDirection + << nTransitionType + << nBuildFlags + << nSpeed + << (sal_uInt8)0 << (sal_uInt8)0 << (sal_uInt8)0; + } + + ImplCreateHeaderFooters( mXPagePropSet ); + + EscherSolverContainer aSolverContainer; + mpPptEscherEx->OpenContainer( EPP_PPDrawing ); + mpPptEscherEx->OpenContainer( ESCHER_DgContainer ); + mpPptEscherEx->EnterGroup(0,0); + ImplWritePage( rLayout, aSolverContainer, NORMAL, FALSE, nPageNum ); // Die Shapes der Seite werden im PPT Dok. erzeugt + mpPptEscherEx->LeaveGroup(); + + if ( bHasBackground ) + ImplWriteBackground( aXBackgroundPropSet ); + else + { + mpPptEscherEx->OpenContainer( ESCHER_SpContainer ); + mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, 0xc00 ); // Flags: Connector | Background | HasSpt + EscherPropertyContainer aPropOpt; + aPropOpt.AddOpt( ESCHER_Prop_fillRectRight, PPTtoEMU( maDestPageSize.Width ) ); + aPropOpt.AddOpt( ESCHER_Prop_fillRectBottom, PPTtoEMU( maDestPageSize.Width ) ); + aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x120012 ); + aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x80000 ); + aPropOpt.AddOpt( ESCHER_Prop_bWMode, ESCHER_wDontShow ); + aPropOpt.AddOpt( ESCHER_Prop_fBackground, 0x10001 ); // if true, this is the background shape + aPropOpt.Commit( *mpStrm ); + mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer + } + + aSolverContainer.WriteSolver( *mpStrm ); + + mpPptEscherEx->CloseContainer(); // ESCHER_DgContainer + mpPptEscherEx->CloseContainer(); // EPP_Drawing + mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 1 ); + *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0x99cc00 << (sal_uInt32)0xcc3333 << (sal_uInt32)0xffcccc << (sal_uInt32)0xb2b2b2; + + if ( mbUseNewAnimations ) + { + SvMemoryStream amsofbtAnimGroup; + ppt::AnimationExporter aExporter( aSolverContainer, maSoundCollection ); + aExporter.doexport( mXDrawPage, amsofbtAnimGroup ); + sal_uInt32 nmsofbtAnimGroupSize = amsofbtAnimGroup.Tell(); + if ( nmsofbtAnimGroupSize ) + { + EscherExContainer aProgTags ( *mpStrm, EPP_ProgTags ); + EscherExContainer aProgBinaryTag( *mpStrm, EPP_ProgBinaryTag ); + { + EscherExAtom aCString( *mpStrm, EPP_CString ); + *mpStrm << (sal_uInt32)0x5f005f + << (sal_uInt32)0x50005f + << (sal_uInt32)0x540050 + << (sal_uInt16)0x31 + << (sal_uInt16)0x30; + } + { + EscherExAtom aBinaryTagData( *mpStrm, EPP_BinaryTagData ); + { + { + EscherExAtom aMagic2( *mpStrm, 0x2eeb ); + *mpStrm << (sal_uInt32)0x01c45df9 + << (sal_uInt32)0xe1471b30; + } + { + EscherExAtom aMagic( *mpStrm, 0x2b00 ); + *mpStrm << (sal_uInt32)0; + } + } + mpStrm->Write( amsofbtAnimGroup.GetData(), amsofbtAnimGroup.Tell() ); + { + EscherExContainer aMagic2( *mpStrm, 0x2b02 ); + } + } + } + } + mpPptEscherEx->CloseContainer(); // EPP_Slide +} + +// --------------------------------------------------------------------------------------------- + +void PPTWriter::ImplWriteSlideMaster( sal_uInt32 nPageNum, Reference< XPropertySet > aXBackgroundPropSet ) +{ + sal_uInt32 nFillColor = 0xffffff; + sal_uInt32 nFillBackColor = 0x000000; + + ::com::sun::star::drawing::FillStyle aFS = ::com::sun::star::drawing::FillStyle_NONE; + if ( ImplGetPropertyValue( aXBackgroundPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillStyle" ) ) ) ) + mAny >>= aFS; + switch ( aFS ) + { + case ::com::sun::star::drawing::FillStyle_GRADIENT : + { + if ( ImplGetPropertyValue( aXBackgroundPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillGradient" ) ) ) ) + { + nFillColor = EscherPropertyContainer::GetGradientColor( (::com::sun::star::awt::Gradient*)mAny.getValue(), 0 ); + nFillBackColor = EscherPropertyContainer::GetGradientColor( (::com::sun::star::awt::Gradient*)mAny.getValue(), 1 ); + } + } + break; + + case ::com::sun::star::drawing::FillStyle_SOLID : + { + if ( ImplGetPropertyValue( aXBackgroundPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillColor" ) ) ) ) + { + nFillColor = mpPptEscherEx->GetColor( *((sal_uInt32*)mAny.getValue()) ); + nFillBackColor = nFillColor ^ 0xffffff; + } + } + break; + + default: + break; + } + + mpPptEscherEx->PtReplaceOrInsert( EPP_Persist_MainMaster | nPageNum, mpStrm->Tell() ); + mpPptEscherEx->OpenContainer( EPP_MainMaster ); + mpPptEscherEx->AddAtom( 24, EPP_SlideAtom, 2 ); + *mpStrm << (INT32)EPP_LAYOUT_TITLEANDBODYSLIDE // slide layout -> title and body slide + << (sal_uInt8)1 << (sal_uInt8)2 << (sal_uInt8)0 << (sal_uInt8)0 << (sal_uInt8)0 << (sal_uInt8)0 << (sal_uInt8)0 << (sal_uInt8)0 // placeholderID + << (sal_uInt32)0 // master ID ( ist gleich null bei einer masterpage ) + << (sal_uInt32)0 // notes ID ( ist gleich null wenn keine notizen vorhanden ) + << (sal_uInt16)0 // Bit 1: Follow master objects, Bit 2: Follow master scheme, Bit 3: Follow master background + << (sal_uInt16)0; // padword + + mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 ); + *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0x99cc00 << (sal_uInt32)0xcc3333 << (sal_uInt32)0xffcccc << (sal_uInt32)0xb2b2b2; + mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 ); + *mpStrm << (sal_uInt32)0xff0000 << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x00ffff << (sal_uInt32)0x0099ff << (sal_uInt32)0xffff00 << (sal_uInt32)0x0000ff << (sal_uInt32)0x969696; + mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 ); + *mpStrm << (sal_uInt32)0xccffff << (sal_uInt32)0x000000 << (sal_uInt32)0x336666 << (sal_uInt32)0x008080 << (sal_uInt32)0x339933 << (sal_uInt32)0x000080 << (sal_uInt32)0xcc3300 << (sal_uInt32)0x66ccff; + mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 ); + *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x333333 << (sal_uInt32)0x000000 << (sal_uInt32)0xdddddd << (sal_uInt32)0x808080 << (sal_uInt32)0x4d4d4d << (sal_uInt32)0xeaeaea; + mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 ); + *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0x66ccff << (sal_uInt32)0xff0000 << (sal_uInt32)0xcc00cc << (sal_uInt32)0xc0c0c0; + mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 ); + *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0xc0c0c0 << (sal_uInt32)0xff6600 << (sal_uInt32)0x0000ff << (sal_uInt32)0x009900; + mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 ); + *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0xff9933 << (sal_uInt32)0xccff99 << (sal_uInt32)0xcc00cc << (sal_uInt32)0xb2b2b2; + + for ( int nInstance = EPP_TEXTTYPE_Title; nInstance <= EPP_TEXTTYPE_QuarterBody; nInstance++ ) + { + if ( nInstance == EPP_TEXTTYPE_notUsed ) + continue; + + // the auto color is dependent to the page background,so we have to set a page that is in the right context + if ( nInstance == EPP_TEXTTYPE_Notes ) + GetPageByIndex( 0, NOTICE ); + else + GetPageByIndex( 0, MASTER ); + + mpPptEscherEx->BeginAtom(); + + sal_Bool bFirst = TRUE; + sal_Bool bSimpleText = FALSE; + + *mpStrm << (sal_uInt16)5; // paragraph count + + for ( sal_uInt16 nLev = 0; nLev < 5; nLev++ ) + { + if ( nInstance >= EPP_TEXTTYPE_CenterBody ) + { + bFirst = FALSE; + bSimpleText = TRUE; + *mpStrm << nLev; + } + mpStyleSheet->mpParaSheet[ nInstance ]->Write( *mpStrm, mpPptEscherEx, nLev, bFirst, bSimpleText, mXPagePropSet ); + mpStyleSheet->mpCharSheet[ nInstance ]->Write( *mpStrm, mpPptEscherEx, nLev, bFirst, bSimpleText, mXPagePropSet ); + bFirst = FALSE; + } + mpPptEscherEx->EndAtom( EPP_TxMasterStyleAtom, 0, nInstance ); + } + GetPageByIndex( nPageNum, MASTER ); + + EscherSolverContainer aSolverContainer; + + mpPptEscherEx->OpenContainer( EPP_PPDrawing ); + mpPptEscherEx->OpenContainer( ESCHER_DgContainer ); + + mpPptEscherEx->EnterGroup(0,0); + ImplWritePage( GetLayout(0), aSolverContainer, MASTER, TRUE ); // Die Shapes der Seite werden im PPT Dok. erzeugt + mpPptEscherEx->LeaveGroup(); + + ImplWriteBackground( aXBackgroundPropSet ); + + aSolverContainer.WriteSolver( *mpStrm ); + + mpPptEscherEx->CloseContainer(); // ESCHER_DgContainer + mpPptEscherEx->CloseContainer(); // EPP_Drawing + mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 1 ); + *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0x99cc00 << (sal_uInt32)0xcc3333 << (sal_uInt32)0xffcccc << (sal_uInt32)0xb2b2b2; + + if ( aBuExMasterStream.Tell() ) + { + ImplProgTagContainer( mpStrm, &aBuExMasterStream ); + } + mpPptEscherEx->CloseContainer(); // EPP_MainMaster +} // --------------------------------------------------------------------------------------------- @@ -277,16 +483,6 @@ PPTWriter::~PPTWriter() delete (EPPTHyperlink*)pPtr; for ( pPtr = maExOleObj.First(); pPtr; pPtr = maExOleObj.Next() ) delete (PPTExOleObjEntry*)pPtr; - - if ( mbStatusIndicator ) - mXStatusIndicator->end(); -} - -// --------------------------------------------------------------------------------------------- - -static inline sal_uInt32 PPTtoEMU( INT32 nPPT ) -{ - return (sal_uInt32)( (double)nPPT * 1587.5 ); } // --------------------------------------------------------------------------------------------- @@ -323,7 +519,7 @@ sal_Bool PPTWriter::ImplCreateCurrentUserStream() // --------------------------------------------------------------------------------------------- -sal_Bool PPTWriter::ImplCreateDocumentSummaryInformation( sal_uInt32 nCnvrtFlags ) +sal_Bool PPTWriter::ImplCreateDocumentSummaryInformation() { uno::Reference<document::XDocumentPropertiesSupplier> xDPS( mXModel, uno::UNO_QUERY_THROW); @@ -353,10 +549,10 @@ sal_Bool PPTWriter::ImplCreateDocumentSummaryInformation( sal_uInt32 nCnvrtFlags aHyperSeq[j] = pBlob[j]; } - if ( nCnvrtFlags & 0x8000 ) + if ( mnCnvrtFlags & 0x8000 ) { uno::Sequence<sal_uInt8> aThumbSeq; - if ( ImplGetPageByIndex( 0, NORMAL ) && + if ( GetPageByIndex( 0, NORMAL ) && ImplGetPropertyValue( mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "PreviewBitmap" ) ) ) ) { @@ -543,13 +739,13 @@ sal_Bool PPTWriter::ImplCreateDocument() mpPptEscherEx->OpenContainer( EPP_HeadersFooters, 3 ); //Master footer (default) mpPptEscherEx->AddAtom( 4, EPP_HeadersFootersAtom ); *mpStrm << (sal_uInt32)0x25000d; - if ( ImplGetPageByIndex( 0, MASTER ) ) + if ( GetPageByIndex( 0, MASTER ) ) ImplCreateHeaderFooterStrings( *mpStrm, mXPagePropSet ); mpPptEscherEx->CloseContainer(); mpPptEscherEx->OpenContainer( EPP_HeadersFooters, 4 ); //NotesMaster footer (default) mpPptEscherEx->AddAtom( 4, EPP_HeadersFootersAtom ); *mpStrm << (sal_uInt32)0x3d000d; - if ( ImplGetPageByIndex( 0, NOTICE ) ) + if ( GetPageByIndex( 0, NOTICE ) ) ImplCreateHeaderFooterStrings( *mpStrm, mXPagePropSet ); mpPptEscherEx->CloseContainer(); @@ -575,11 +771,11 @@ sal_Bool PPTWriter::ImplCreateDocument() << (INT32)i + 0x100 // slideId - Unique slide identifier, used for OLE link monikers for example << (sal_uInt32)0; // reserved, usualy 0 - if ( !ImplGetPageByIndex( i, NORMAL ) ) // sehr aufregend: noch einmal ueber alle seiten + if ( !GetPageByIndex( i, NORMAL ) ) // sehr aufregend: noch einmal ueber alle seiten return FALSE; - ImplSetCurrentStyleSheet( ImplGetMasterIndex( NORMAL ) ); + SetCurrentStyleSheet( GetMasterIndex( NORMAL ) ); - const PHLayout& rLayout = ImplGetLayout( mXPagePropSet ); + const PHLayout& rLayout = GetLayout( mXPagePropSet ); ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > aXName( mXDrawPage, ::com::sun::star::uno::UNO_QUERY ); @@ -600,7 +796,7 @@ sal_Bool PPTWriter::ImplCreateDocument() { for ( sal_uInt32 nIndex = 0; nIndex < nShapes; nIndex++ ) { - if ( !ImplGetShapeByIndex( nIndex ) ) + if ( !GetShapeByIndex( nIndex ) ) continue; if ( mbPresObj && ( ( mType == "presentation.Outliner" ) || ( mType == "presentation.Subtitle" ) ) ) @@ -626,7 +822,7 @@ sal_Bool PPTWriter::ImplCreateDocument() { if ( ( nIndex + 1 ) < nShapes ) { - if ( ImplGetShapeByIndex( nIndex + 1 ) && mType == "presentation.Outliner" ) + if ( GetShapeByIndex( nIndex + 1 ) && mType == "presentation.Outliner" ) { bSecOutl = TRUE; TextRuleEntry* pTempRule = new TextRuleEntry( i ); @@ -681,24 +877,13 @@ sal_Bool PPTWriter::ImplCreateDocument() mpPptEscherEx->OpenContainer( EPP_SlideListWithText, 2 ); // Animation info fuer die notes for( i = 0; i < mnPages; i++ ) { - if ( !ImplGetPageByIndex( i, NOTICE ) ) + if ( !GetPageByIndex( i, NOTICE ) ) return FALSE; - nShapes = mXShapes->getCount(); - - bOtherThanPlaceHolders = FALSE; - if ( nShapes ) - { - for ( sal_uInt32 nIndex = 0; ( nIndex < nShapes ) && ( bOtherThanPlaceHolders == FALSE ); nIndex++ ) - { - if ( ImplGetShapeByIndex( nIndex ) && ( mType != "drawing.Page" ) ) - bOtherThanPlaceHolders = TRUE; - } - } mpPptEscherEx->AddAtom( 20, EPP_SlidePersistAtom ); mpPptEscherEx->InsertPersistOffset( EPP_MAINNOTES_PERSIST_KEY | i, mpStrm->Tell() ); *mpStrm << (sal_uInt32)0 - << (sal_uInt32)( ( bOtherThanPlaceHolders ) ? 4 : 0 ) + << (sal_uInt32)( ( ContainsOtherShapeThanPlaceholders( FALSE ) ) ? 4 : 0 ) << (INT32)0 << (INT32)i + 0x100 << (sal_uInt32)0; @@ -816,7 +1001,7 @@ sal_Bool PPTWriter::ImplCreateDocument() *mpStrm << (sal_uInt16)( pCustomShow[ i ] ); } } - for ( i = nCustomShowNameLen; i < 32; i++, *mpStrm << (sal_uInt16)0 ) ; + for ( i = nCustomShowNameLen; i < 32; i++, *mpStrm << (sal_uInt16)0 ) {} *mpStrm << nFlags; ::com::sun::star::uno::Reference< ::com::sun::star::presentation::XCustomPresentationSupplier > @@ -845,7 +1030,7 @@ sal_Bool PPTWriter::ImplCreateDocument() nNamedShowLen = 31; mpPptEscherEx->AddAtom( nNamedShowLen << 1, EPP_CString ); const sal_Unicode* pCustomShowName = pUString[ i ].getStr(); - for ( sal_uInt32 k = 0; k < nNamedShowLen; *mpStrm << (sal_uInt16)( pCustomShowName[ k++ ] ) ) ; + for ( sal_uInt32 k = 0; k < nNamedShowLen; *mpStrm << (sal_uInt16)( pCustomShowName[ k++ ] ) ) {} mAny = aXCont->getByName( pUString[ i ] ); if ( mAny.getValue() ) { @@ -988,184 +1173,10 @@ sal_Bool PPTWriter::ImplCreateHyperBlob( SvMemoryStream& rStrm ) return TRUE; } -PHLayout& PPTWriter::ImplGetLayout( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rXPropSet ) const -{ - ::com::sun::star::uno::Any aAny; - sal_Int16 nLayout = 20; - if ( GetPropertyValue( aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Layout" ) ) ), sal_True ) - aAny >>= nLayout; - - if ( ( nLayout >= 21 ) && ( nLayout <= 26 ) ) // NOTES _> HANDOUT6 - nLayout = 20; - if ( ( nLayout >= 27 ) && ( nLayout <= 30 ) ) // VERTICAL LAYOUT - nLayout -= 6; - else if ( nLayout > 30 ) - nLayout = 20; - return pPHLayout[ nLayout ]; -} - - -// --------------------------------------------------------------------------------------------- - -sal_Bool PPTWriter::ImplCreateMaster( sal_uInt32 nPageNum ) -{ - if ( !ImplGetPageByIndex( nPageNum, MASTER ) ) - return FALSE; - ImplSetCurrentStyleSheet( nPageNum ); - - if ( !ImplGetPropertyValue( mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Background" ) ) ) ) // Backgroundshape laden - return FALSE; - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > aXBackgroundPropSet; - if ( !( mAny >>= aXBackgroundPropSet ) ) - return FALSE; - - sal_uInt32 nFillColor = 0xffffff; - sal_uInt32 nFillBackColor = 0x000000; - - ::com::sun::star::drawing::FillStyle aFS = ::com::sun::star::drawing::FillStyle_NONE; - if ( ImplGetPropertyValue( aXBackgroundPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillStyle" ) ) ) ) - mAny >>= aFS; - switch ( aFS ) - { - case ::com::sun::star::drawing::FillStyle_GRADIENT : - { - if ( ImplGetPropertyValue( aXBackgroundPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillGradient" ) ) ) ) - { - nFillColor = EscherPropertyContainer::GetGradientColor( (::com::sun::star::awt::Gradient*)mAny.getValue(), 0 ); - nFillBackColor = EscherPropertyContainer::GetGradientColor( (::com::sun::star::awt::Gradient*)mAny.getValue(), 1 ); - } - } - break; - - case ::com::sun::star::drawing::FillStyle_SOLID : - { - if ( ImplGetPropertyValue( aXBackgroundPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "FillColor" ) ) ) ) - { - nFillColor = mpPptEscherEx->GetColor( *((sal_uInt32*)mAny.getValue()) ); - nFillBackColor = nFillColor ^ 0xffffff; - } - } - break; - - default: - break; - } - - mpPptEscherEx->PtReplaceOrInsert( EPP_Persist_MainMaster | nPageNum, mpStrm->Tell() ); - mpPptEscherEx->OpenContainer( EPP_MainMaster ); - mpPptEscherEx->AddAtom( 24, EPP_SlideAtom, 2 ); - *mpStrm << (INT32)EPP_LAYOUT_TITLEANDBODYSLIDE // slide layout -> title and body slide - << (sal_uInt8)1 << (sal_uInt8)2 << (sal_uInt8)0 << (sal_uInt8)0 << (sal_uInt8)0 << (sal_uInt8)0 << (sal_uInt8)0 << (sal_uInt8)0 // placeholderID - << (sal_uInt32)0 // master ID ( ist gleich null bei einer masterpage ) - << (sal_uInt32)0 // notes ID ( ist gleich null wenn keine notizen vorhanden ) - << (sal_uInt16)0 // Bit 1: Follow master objects, Bit 2: Follow master scheme, Bit 3: Follow master background - << (sal_uInt16)0; // padword - - mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 ); - *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0x99cc00 << (sal_uInt32)0xcc3333 << (sal_uInt32)0xffcccc << (sal_uInt32)0xb2b2b2; - mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 ); - *mpStrm << (sal_uInt32)0xff0000 << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x00ffff << (sal_uInt32)0x0099ff << (sal_uInt32)0xffff00 << (sal_uInt32)0x0000ff << (sal_uInt32)0x969696; - mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 ); - *mpStrm << (sal_uInt32)0xccffff << (sal_uInt32)0x000000 << (sal_uInt32)0x336666 << (sal_uInt32)0x008080 << (sal_uInt32)0x339933 << (sal_uInt32)0x000080 << (sal_uInt32)0xcc3300 << (sal_uInt32)0x66ccff; - mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 ); - *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x333333 << (sal_uInt32)0x000000 << (sal_uInt32)0xdddddd << (sal_uInt32)0x808080 << (sal_uInt32)0x4d4d4d << (sal_uInt32)0xeaeaea; - mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 ); - *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0x66ccff << (sal_uInt32)0xff0000 << (sal_uInt32)0xcc00cc << (sal_uInt32)0xc0c0c0; - mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 ); - *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0xc0c0c0 << (sal_uInt32)0xff6600 << (sal_uInt32)0x0000ff << (sal_uInt32)0x009900; - mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 6 ); - *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0xff9933 << (sal_uInt32)0xccff99 << (sal_uInt32)0xcc00cc << (sal_uInt32)0xb2b2b2; - - for ( int nInstance = EPP_TEXTTYPE_Title; nInstance <= EPP_TEXTTYPE_QuarterBody; nInstance++ ) - { - if ( nInstance == EPP_TEXTTYPE_notUsed ) - continue; - - // the auto color is dependent to the page background,so we have to set a page that is in the right context - if ( nInstance == EPP_TEXTTYPE_Notes ) - ImplGetPageByIndex( 0, NOTICE ); - else - ImplGetPageByIndex( 0, MASTER ); - - mpPptEscherEx->BeginAtom(); - - sal_Bool bFirst = TRUE; - sal_Bool bSimpleText = FALSE; - - *mpStrm << (sal_uInt16)5; // paragraph count - - for ( sal_uInt16 nLev = 0; nLev < 5; nLev++ ) - { - if ( nInstance >= EPP_TEXTTYPE_CenterBody ) - { - bFirst = FALSE; - bSimpleText = TRUE; - *mpStrm << nLev; - } - mpStyleSheet->mpParaSheet[ nInstance ]->Write( *mpStrm, mpPptEscherEx, nLev, bFirst, bSimpleText, mXPagePropSet ); - mpStyleSheet->mpCharSheet[ nInstance ]->Write( *mpStrm, mpPptEscherEx, nLev, bFirst, bSimpleText, mXPagePropSet ); - bFirst = FALSE; - } - mpPptEscherEx->EndAtom( EPP_TxMasterStyleAtom, 0, nInstance ); - } - ImplGetPageByIndex( nPageNum, MASTER ); - - EscherSolverContainer aSolverContainer; - - mpPptEscherEx->OpenContainer( EPP_PPDrawing ); - mpPptEscherEx->OpenContainer( ESCHER_DgContainer ); - - mpPptEscherEx->EnterGroup(0,0); - ImplWritePage( pPHLayout[ 0 ], aSolverContainer, MASTER, TRUE ); // Die Shapes der Seite werden im PPT Dok. erzeugt - mpPptEscherEx->LeaveGroup(); - - ImplWriteBackground( aXBackgroundPropSet ); - - aSolverContainer.WriteSolver( *mpStrm ); - - mpPptEscherEx->CloseContainer(); // ESCHER_DgContainer - mpPptEscherEx->CloseContainer(); // EPP_Drawing - mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 1 ); - *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0x99cc00 << (sal_uInt32)0xcc3333 << (sal_uInt32)0xffcccc << (sal_uInt32)0xb2b2b2; - - if ( aBuExMasterStream.Tell() ) - { - ImplProgTagContainer( mpStrm, &aBuExMasterStream ); - } - mpPptEscherEx->CloseContainer(); // EPP_MainMaster - return TRUE; -}; - // --------------------------------------------------------------------------------------------- sal_Bool PPTWriter::ImplCreateMainNotes() { - if ( !ImplGetPageByIndex( 0, NOTICE ) ) - return FALSE; - ImplSetCurrentStyleSheet( 0 ); - - ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XMasterPageTarget > - aXMasterPageTarget( mXDrawPage, ::com::sun::star::uno::UNO_QUERY ); - - if ( !aXMasterPageTarget.is() ) - return FALSE; - - mXDrawPage = aXMasterPageTarget->getMasterPage(); - if ( !mXDrawPage.is() ) - return FALSE; - - mXPropSet = ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > - ( mXDrawPage, ::com::sun::star::uno::UNO_QUERY ); - if ( !mXPropSet.is() ) - return FALSE; - - mXShapes = ::com::sun::star::uno::Reference< - ::com::sun::star::drawing::XShapes > - ( mXDrawPage, ::com::sun::star::uno::UNO_QUERY ); - if ( !mXShapes.is() ) - return FALSE; - EscherSolverContainer aSolverContainer; mpPptEscherEx->PtReplaceOrInsert( EPP_Persist_MainNotes, mpStrm->Tell() ); @@ -1177,7 +1188,7 @@ sal_Bool PPTWriter::ImplCreateMainNotes() mpPptEscherEx->OpenContainer( ESCHER_DgContainer ); mpPptEscherEx->EnterGroup(0,0); - ImplWritePage( pPHLayout[ 20 ], aSolverContainer, NOTICE, TRUE ); + ImplWritePage( GetLayout( 20 ), aSolverContainer, NOTICE, TRUE ); mpPptEscherEx->LeaveGroup(); mpPptEscherEx->OpenContainer( ESCHER_SpContainer ); @@ -1204,420 +1215,8 @@ sal_Bool PPTWriter::ImplCreateMainNotes() return TRUE; } -// --------------------------------------------------------------------------------------------- - -sal_Bool PPTWriter::ImplCreateSlide( sal_uInt32 nPageNum ) +void PPTWriter::ImplWriteNotes( sal_uInt32 nPageNum ) { - ::com::sun::star::uno::Any aAny; - - if ( !ImplGetPageByIndex( nPageNum, NORMAL ) ) - return FALSE; - sal_uInt32 nMasterID = ImplGetMasterIndex( NORMAL ); - ImplSetCurrentStyleSheet( nMasterID ); - nMasterID |= 0x80000000; - - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > aXBackgroundPropSet; - sal_Bool bHasBackground = GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Background" ) ) ); - if ( bHasBackground ) - bHasBackground = ( aAny >>= aXBackgroundPropSet ); - - sal_uInt16 nMode = 7; // Bit 1: Follow master objects, Bit 2: Follow master scheme, Bit 3: Follow master background - if ( bHasBackground ) - nMode &=~4; - -/* sj: Don't know what's IsBackgroundVisible for, have to ask cl - if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsBackgroundVisible" ) ) ) ) - { - sal_Bool bBackgroundVisible; - if ( aAny >>= bBackgroundVisible ) - { - if ( bBackgroundVisible ) - nMode &= ~4; - } - } -*/ - if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsBackgroundObjectsVisible" ) ) ) ) - { - sal_Bool bBackgroundObjectsVisible = sal_False; - if ( aAny >>= bBackgroundObjectsVisible ) - { - if ( !bBackgroundObjectsVisible ) - nMode &= ~1; - } - } - - const PHLayout& rLayout = ImplGetLayout( mXPagePropSet ); - mpPptEscherEx->PtReplaceOrInsert( EPP_Persist_Slide | nPageNum, mpStrm->Tell() ); - mpPptEscherEx->OpenContainer( EPP_Slide ); - mpPptEscherEx->AddAtom( 24, EPP_SlideAtom, 2 ); - *mpStrm << rLayout.nLayout; - mpStrm->Write( rLayout.nPlaceHolder, 8 ); // placeholderIDs ( 8Stueck ) - *mpStrm << (sal_uInt32)nMasterID // master ID ( ist gleich 0x80000000 bei einer masterpage ) - << (sal_uInt32)nPageNum + 0x100 // notes ID ( ist gleich null wenn keine notizen vorhanden ) - << nMode - << (sal_uInt16)0; // padword - - mnDiaMode = 0; - sal_Bool bVisible = sal_True; - ::com::sun::star::presentation::FadeEffect eFe = ::com::sun::star::presentation::FadeEffect_NONE; - - if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Visible" ) ) ) ) - aAny >>= bVisible; - if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Change" ) ) ) ) - { - switch ( *(INT32*)aAny.getValue() ) - { - case 1 : // automatisch - mnDiaMode++; - case 2 : // halbautomatisch - mnDiaMode++; - default : - case 0 : // manuell - break; - } - } - if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Effect" ) ) ) ) - aAny >>= eFe; - - sal_uInt32 nSoundRef = 0; - sal_Bool bIsSound = sal_False; - sal_Bool bStopSound = sal_False; - sal_Bool bLoopSound = sal_False; - - if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Sound" ) ) ) ) - { - rtl::OUString aSoundURL; - if ( aAny >>= aSoundURL ) - { - nSoundRef = maSoundCollection.GetId( aSoundURL ); - bIsSound = sal_True; - } - else - aAny >>= bStopSound; - } - if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "LoopSound" ) ) ) ) - aAny >>= bLoopSound; - - - sal_Bool bNeedsSSSlideInfoAtom = ( bVisible == FALSE ) - || ( mnDiaMode == 2 ) - || ( bIsSound ) - || ( bStopSound ) - || ( eFe != ::com::sun::star::presentation::FadeEffect_NONE ); - if ( bNeedsSSSlideInfoAtom ) - { - sal_uInt8 nDirection = 0; - sal_uInt8 nTransitionType = 0; - sal_uInt16 nBuildFlags = 1; // advange by mouseclick - INT32 nSlideTime = 0; // muss noch !!! - sal_uInt8 nSpeed = 1; - - if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Speed" ) ) ) ) - { - ::com::sun::star::presentation::AnimationSpeed aAs; - aAny >>= aAs; - nSpeed = (sal_uInt8)aAs; - } - sal_Int16 nTT = 0, nTST = 0; - if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "TransitionType" ) ) ) - && ( aAny >>= nTT ) ) - { - if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "TransitionSubtype" ) ) ) - && ( aAny >>= nTST ) ) - { - switch( nTT ) - { - case animations::TransitionType::FADE : - { - if ( nTST == animations::TransitionSubType::CROSSFADE ) - nTransitionType = PPT_TRANSITION_TYPE_SMOOTHFADE; - else if ( nTST == animations::TransitionSubType::FADEOVERCOLOR ) - nTransitionType = PPT_TRANSITION_TYPE_FADE; - } - break; - case PPT_TRANSITION_TYPE_COMB : - { - nTransitionType = PPT_TRANSITION_TYPE_COMB; - if ( nTST == animations::TransitionSubType::COMBVERTICAL ) - nDirection++; - } - break; - case animations::TransitionType::PUSHWIPE : - { - nTransitionType = PPT_TRANSITION_TYPE_PUSH; - switch( nTST ) - { - case animations::TransitionSubType::FROMRIGHT: nDirection = 0; break; - case animations::TransitionSubType::FROMBOTTOM: nDirection = 1; break; - case animations::TransitionSubType::FROMLEFT: nDirection = 2; break; - case animations::TransitionSubType::FROMTOP: nDirection = 3; break; - } - } - break; - case animations::TransitionType::PINWHEELWIPE : - { - nTransitionType = PPT_TRANSITION_TYPE_WHEEL; - switch( nTST ) - { - case animations::TransitionSubType::ONEBLADE: nDirection = 1; break; - case animations::TransitionSubType::TWOBLADEVERTICAL : nDirection = 2; break; - case animations::TransitionSubType::THREEBLADE : nDirection = 3; break; - case animations::TransitionSubType::FOURBLADE: nDirection = 4; break; - case animations::TransitionSubType::EIGHTBLADE: nDirection = 8; break; - } - } - break; - case animations::TransitionType::FANWIPE : - { - nTransitionType = PPT_TRANSITION_TYPE_WEDGE; - } - break; - case animations::TransitionType::ELLIPSEWIPE : - { - nTransitionType = PPT_TRANSITION_TYPE_CIRCLE; - } - break; - case animations::TransitionType::FOURBOXWIPE : - { - nTransitionType = PPT_TRANSITION_TYPE_PLUS; - } - break; - case animations::TransitionType::IRISWIPE : - { - nTransitionType = PPT_TRANSITION_TYPE_DIAMOND; - } - break; - } - } - } - if ( !nTransitionType ) - { - switch ( eFe ) - { - default : - case ::com::sun::star::presentation::FadeEffect_RANDOM : - nTransitionType = PPT_TRANSITION_TYPE_RANDOM; - break; - - case ::com::sun::star::presentation::FadeEffect_HORIZONTAL_STRIPES : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_VERTICAL_STRIPES : - nTransitionType = PPT_TRANSITION_TYPE_BLINDS; - break; - - case ::com::sun::star::presentation::FadeEffect_VERTICAL_CHECKERBOARD : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_HORIZONTAL_CHECKERBOARD : - nTransitionType = PPT_TRANSITION_TYPE_CHECKER; - break; - - case ::com::sun::star::presentation::FadeEffect_MOVE_FROM_UPPERLEFT : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_MOVE_FROM_UPPERRIGHT : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_MOVE_FROM_LOWERLEFT : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_MOVE_FROM_LOWERRIGHT : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_MOVE_FROM_TOP : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_MOVE_FROM_LEFT : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_MOVE_FROM_BOTTOM : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_MOVE_FROM_RIGHT : - nTransitionType = PPT_TRANSITION_TYPE_COVER; - break; - - case ::com::sun::star::presentation::FadeEffect_DISSOLVE : - nTransitionType = PPT_TRANSITION_TYPE_DISSOLVE; - break; - - case ::com::sun::star::presentation::FadeEffect_VERTICAL_LINES : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_HORIZONTAL_LINES : - nTransitionType = PPT_TRANSITION_TYPE_RANDOM_BARS; - break; - - case ::com::sun::star::presentation::FadeEffect_CLOSE_HORIZONTAL : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_OPEN_HORIZONTAL : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_CLOSE_VERTICAL : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_OPEN_VERTICAL : - nTransitionType = PPT_TRANSITION_TYPE_SPLIT; - break; - - case ::com::sun::star::presentation::FadeEffect_FADE_FROM_UPPERLEFT : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_FADE_FROM_UPPERRIGHT : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_FADE_FROM_LOWERLEFT : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_FADE_FROM_LOWERRIGHT : - nDirection += 4; - nTransitionType = PPT_TRANSITION_TYPE_STRIPS; - break; - - case ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_LOWERRIGHT : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_LOWERLEFT : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_UPPERRIGHT : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_UPPERLEFT : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_BOTTOM : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_RIGHT : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_TOP : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_UNCOVER_TO_LEFT : - nTransitionType = PPT_TRANSITION_TYPE_PULL; - break; - - case ::com::sun::star::presentation::FadeEffect_FADE_FROM_TOP : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_FADE_FROM_LEFT : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_FADE_FROM_BOTTOM : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_FADE_FROM_RIGHT : - nTransitionType = PPT_TRANSITION_TYPE_WIPE; - break; - - case ::com::sun::star::presentation::FadeEffect_ROLL_FROM_TOP : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_ROLL_FROM_LEFT : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_ROLL_FROM_BOTTOM : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_ROLL_FROM_RIGHT : - nTransitionType = PPT_TRANSITION_TYPE_WIPE; - break; - - case ::com::sun::star::presentation::FadeEffect_FADE_TO_CENTER : - nDirection++; - case ::com::sun::star::presentation::FadeEffect_FADE_FROM_CENTER : - nTransitionType = PPT_TRANSITION_TYPE_ZOOM; - break; - - case ::com::sun::star::presentation::FadeEffect_NONE : - nDirection = 2; - break; - } - } - if ( mnDiaMode == 2 ) // automatic ? - nBuildFlags |= 0x400; - if ( bVisible == FALSE ) - nBuildFlags |= 4; - if ( bIsSound ) - nBuildFlags |= 16; - if ( bLoopSound ) - nBuildFlags |= 64; - if ( bStopSound ) - nBuildFlags |= 256; - - if ( GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Duration" ) ) ) )// duration of this slide - nSlideTime = *(INT32*)aAny.getValue() << 10; // in ticks - - - mpPptEscherEx->AddAtom( 16, EPP_SSSlideInfoAtom ); - *mpStrm << nSlideTime // standtime in ticks - << nSoundRef - << nDirection - << nTransitionType - << nBuildFlags - << nSpeed - << (sal_uInt8)0 << (sal_uInt8)0 << (sal_uInt8)0; - } - - ImplCreateHeaderFooters( mXPagePropSet ); - - EscherSolverContainer aSolverContainer; - mpPptEscherEx->OpenContainer( EPP_PPDrawing ); - mpPptEscherEx->OpenContainer( ESCHER_DgContainer ); - mpPptEscherEx->EnterGroup(0,0); - ImplWritePage( rLayout, aSolverContainer, NORMAL, FALSE, nPageNum ); // Die Shapes der Seite werden im PPT Dok. erzeugt - mpPptEscherEx->LeaveGroup(); - - if ( bHasBackground ) - ImplWriteBackground( aXBackgroundPropSet ); - else - { - mpPptEscherEx->OpenContainer( ESCHER_SpContainer ); - mpPptEscherEx->AddShape( ESCHER_ShpInst_Rectangle, 0xc00 ); // Flags: Connector | Background | HasSpt - EscherPropertyContainer aPropOpt; - aPropOpt.AddOpt( ESCHER_Prop_fillRectRight, PPTtoEMU( maDestPageSize.Width ) ); - aPropOpt.AddOpt( ESCHER_Prop_fillRectBottom, PPTtoEMU( maDestPageSize.Width ) ); - aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x120012 ); - aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x80000 ); - aPropOpt.AddOpt( ESCHER_Prop_bWMode, ESCHER_wDontShow ); - aPropOpt.AddOpt( ESCHER_Prop_fBackground, 0x10001 ); // if true, this is the background shape - aPropOpt.Commit( *mpStrm ); - mpPptEscherEx->CloseContainer(); // ESCHER_SpContainer - } - - aSolverContainer.WriteSolver( *mpStrm ); - - mpPptEscherEx->CloseContainer(); // ESCHER_DgContainer - mpPptEscherEx->CloseContainer(); // EPP_Drawing - mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 1 ); - *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0x99cc00 << (sal_uInt32)0xcc3333 << (sal_uInt32)0xffcccc << (sal_uInt32)0xb2b2b2; - - if ( mbUseNewAnimations ) - { - SvMemoryStream amsofbtAnimGroup; - ppt::AnimationExporter aExporter( aSolverContainer, maSoundCollection ); - aExporter.doexport( mXDrawPage, amsofbtAnimGroup ); - sal_uInt32 nmsofbtAnimGroupSize = amsofbtAnimGroup.Tell(); - if ( nmsofbtAnimGroupSize ) - { - EscherExContainer aProgTags ( *mpStrm, EPP_ProgTags ); - EscherExContainer aProgBinaryTag( *mpStrm, EPP_ProgBinaryTag ); - { - EscherExAtom aCString( *mpStrm, EPP_CString ); - *mpStrm << (sal_uInt32)0x5f005f - << (sal_uInt32)0x50005f - << (sal_uInt32)0x540050 - << (sal_uInt16)0x31 - << (sal_uInt16)0x30; - } - { - EscherExAtom aBinaryTagData( *mpStrm, EPP_BinaryTagData ); - { - { - EscherExAtom aMagic2( *mpStrm, 0x2eeb ); - *mpStrm << (sal_uInt32)0x01c45df9 - << (sal_uInt32)0xe1471b30; - } - { - EscherExAtom aMagic( *mpStrm, 0x2b00 ); - *mpStrm << (sal_uInt32)0; - } - } - mpStrm->Write( amsofbtAnimGroup.GetData(), amsofbtAnimGroup.Tell() ); - { - EscherExContainer aMagic2( *mpStrm, 0x2b02 ); - } - } - } - } - mpPptEscherEx->CloseContainer(); // EPP_Slide - return TRUE; -}; - -// --------------------------------------------------------------------------------------------- - -sal_Bool PPTWriter::ImplCreateNotes( sal_uInt32 nPageNum ) -{ - if ( !ImplGetPageByIndex( nPageNum, NOTICE ) ) - return FALSE; - ImplSetCurrentStyleSheet( ImplGetMasterIndex( NORMAL ) ); - - mpPptEscherEx->PtReplaceOrInsert( EPP_Persist_Notes | nPageNum, mpStrm->Tell() ); mpPptEscherEx->OpenContainer( EPP_Notes ); mpPptEscherEx->AddAtom( 8, EPP_NotesAtom, 1 ); @@ -1633,7 +1232,7 @@ sal_Bool PPTWriter::ImplCreateNotes( sal_uInt32 nPageNum ) mpPptEscherEx->OpenContainer( ESCHER_DgContainer ); mpPptEscherEx->EnterGroup(0,0); - ImplWritePage( pPHLayout[ 20 ], aSolverContainer, NOTICE, FALSE ); // Die Shapes der Seite werden im PPT Dok. erzeugt + ImplWritePage( GetLayout( 20 ), aSolverContainer, NOTICE, FALSE ); // Die Shapes der Seite werden im PPT Dok. erzeugt mpPptEscherEx->LeaveGroup(); mpPptEscherEx->OpenContainer( ESCHER_SpContainer ); @@ -1657,8 +1256,7 @@ sal_Bool PPTWriter::ImplCreateNotes( sal_uInt32 nPageNum ) mpPptEscherEx->AddAtom( 32, EPP_ColorSchemeAtom, 0, 1 ); *mpStrm << (sal_uInt32)0xffffff << (sal_uInt32)0x000000 << (sal_uInt32)0x808080 << (sal_uInt32)0x000000 << (sal_uInt32)0x99cc00 << (sal_uInt32)0xcc3333 << (sal_uInt32)0xffcccc << (sal_uInt32)0xb2b2b2; mpPptEscherEx->CloseContainer(); // EPP_Notes - return TRUE; -}; +} void PPTWriter::ImplWriteBackground( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet ) { @@ -1734,18 +1332,18 @@ void PPTWriter::ImplWriteCString( SvStream& rSt, const String& rString, sal_uInt } } -void PPTWriter::ImplWriteVBA( SvMemoryStream* pVBA ) +void PPTWriter::ImplWriteVBA() { - if ( pVBA ) + if ( mpVBA ) { - pVBA->Seek( STREAM_SEEK_TO_END ); - sal_uInt32 nLen = pVBA->Tell(); + mpVBA->Seek( STREAM_SEEK_TO_END ); + sal_uInt32 nLen = mpVBA->Tell(); if ( nLen > 8 ) { nLen -= 8; mnVBAOleOfs = mpStrm->Tell(); mpPptEscherEx->BeginAtom(); - mpStrm->Write( (sal_Int8*)pVBA->GetData() + 8, nLen ); + mpStrm->Write( (sal_Int8*)mpVBA->GetData() + 8, nLen ); mpPptEscherEx->EndAtom( EPP_ExOleObjStg, 0, 1 ); } } @@ -1753,11 +1351,11 @@ void PPTWriter::ImplWriteVBA( SvMemoryStream* pVBA ) // --------------------------------------------------------------------------------------------- -void PPTWriter::ImplWriteOLE( sal_uInt32 nCnvrtFlags ) +void PPTWriter::ImplWriteOLE() { PPTExOleObjEntry* pPtr; - SvxMSExportOLEObjects aOleExport( nCnvrtFlags ); + SvxMSExportOLEObjects aOleExport( mnCnvrtFlags ); for ( pPtr = (PPTExOleObjEntry*)maExOleObj.First(); pPtr; pPtr = (PPTExOleObjEntry*)maExOleObj.Next() ) @@ -1954,482 +1552,6 @@ sal_Bool PPTWriter::ImplWriteAtomEnding() // --------------------------------------------------------------------------------------------- -PPTExCharSheet::PPTExCharSheet( int nInstance ) -{ - sal_uInt16 nFontHeight = 24; - - for ( int nDepth = 0; nDepth < 5; nDepth++ ) - { - PPTExCharLevel& rLev = maCharLevel[ nDepth ]; - switch ( nInstance ) - { - case EPP_TEXTTYPE_Title : - case EPP_TEXTTYPE_CenterTitle : - nFontHeight = 44; - break; - case EPP_TEXTTYPE_Body : - case EPP_TEXTTYPE_CenterBody : - case EPP_TEXTTYPE_HalfBody : - case EPP_TEXTTYPE_QuarterBody : - { - switch ( nDepth ) - { - case 0 : nFontHeight = 32; break; - case 1 : nFontHeight = 28; break; - case 2 : nFontHeight = 24; break; - default :nFontHeight = 20; break; - } - } - break; - case EPP_TEXTTYPE_Notes : - nFontHeight = 12; - break; - case EPP_TEXTTYPE_notUsed : - case EPP_TEXTTYPE_Other : - nFontHeight = 24; - break; - } - rLev.mnFlags = 0; - rLev.mnFont = 0; - rLev.mnAsianOrComplexFont = 0xffff; - rLev.mnFontHeight = nFontHeight; - rLev.mnFontColor = 0; - rLev.mnEscapement = 0; - } -} - - -void PPTExCharSheet::SetStyleSheet( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, - FontCollection& rFontCollection, int nLevel ) -{ - PortionObj aPortionObj( rXPropSet, rFontCollection ); - - PPTExCharLevel& rLev = maCharLevel[ nLevel ]; - - if ( aPortionObj.meCharColor == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) - rLev.mnFontColor = aPortionObj.mnCharColor; - if ( aPortionObj.meCharEscapement == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) - rLev.mnEscapement = aPortionObj.mnCharEscapement; - if ( aPortionObj.meCharHeight == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) - rLev.mnFontHeight = aPortionObj.mnCharHeight; - if ( aPortionObj.meFontName == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) - rLev.mnFont = aPortionObj.mnFont; - if ( aPortionObj.meAsianOrComplexFont == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) - rLev.mnAsianOrComplexFont = aPortionObj.mnAsianOrComplexFont; - rLev.mnFlags = aPortionObj.mnCharAttr; -} - -void PPTExCharSheet::Write( SvStream& rSt, PptEscherEx*, sal_uInt16 nLev, sal_Bool, sal_Bool bSimpleText, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rPagePropSet ) -{ - const PPTExCharLevel& rLev = maCharLevel[ nLev ]; - - sal_uInt32 nCharFlags = 0xefffff; - if ( bSimpleText ) - nCharFlags = 0x7ffff; - - rSt << nCharFlags - << rLev.mnFlags - << rLev.mnFont; - - sal_uInt32 nFontColor = rLev.mnFontColor; - if ( nFontColor == COL_AUTO ) - { - sal_Bool bIsDark = sal_False; - ::com::sun::star::uno::Any aAny; - if ( PropValue::GetPropertyValue( aAny, rPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsBackgroundDark" ) ), sal_True ) ) - aAny >>= bIsDark; - nFontColor = bIsDark ? 0xffffff : 0x000000; - } - nFontColor &= 0xffffff; - nFontColor |= 0xfe000000; - if ( bSimpleText ) - { - rSt << rLev.mnFontHeight - << nFontColor; - } - else - { - rSt << rLev.mnAsianOrComplexFont - << (sal_uInt16)0xffff // unbekannt - << (sal_uInt16)0xffff // unbekannt - << rLev.mnFontHeight - << nFontColor - << rLev.mnEscapement; - } -} - -PPTExParaSheet::PPTExParaSheet( int nInstance, sal_uInt16 nDefaultTab, PPTExBulletProvider& rProv ) : - rBuProv ( rProv ), - mnInstance ( nInstance ) -{ - sal_Bool bHasBullet = FALSE; - - sal_uInt16 nUpperDist = 0; - sal_uInt16 nBulletChar = 0x2022; - sal_uInt16 nBulletOfs = 0; - sal_uInt16 nTextOfs = 0; - - for ( int nDepth = 0; nDepth < 5; nDepth++ ) - { - PPTExParaLevel& rLev = maParaLevel[ nDepth ]; - switch ( nInstance ) - { - case EPP_TEXTTYPE_Title : - case EPP_TEXTTYPE_CenterTitle : - break; - case EPP_TEXTTYPE_Body : - case EPP_TEXTTYPE_CenterBody : - case EPP_TEXTTYPE_HalfBody : - case EPP_TEXTTYPE_QuarterBody : - { - bHasBullet = TRUE; - nUpperDist = 0x14; - } - break; - case EPP_TEXTTYPE_Notes : - nUpperDist = 0x1e; - break; - -// default : -// case EPP_TEXTTYPE_notUsed : -// case EPP_TEXTTYPE_Other : -// break; - } - switch ( nDepth ) - { - case 0 : - { - nBulletChar = 0x2022; - nBulletOfs = 0; - nTextOfs = ( bHasBullet ) ? 0xd8 : 0; - } - break; - case 1 : - { - nBulletChar = 0x2013; - nBulletOfs = 0x120; - nTextOfs = 0x1d4; - } - break; - case 2 : - { - nBulletChar = 0x2022; - nBulletOfs = 0x240; - nTextOfs = 0x2d0; - } - break; - case 3 : - { - nBulletChar = 0x2013; - nBulletOfs = 0x360; - nTextOfs = 0x3f0; - } - break; - case 4 : - { - nBulletChar = 0xbb; - nBulletOfs = 0x480; - nTextOfs = 0x510; - } - break; - } - rLev.mbIsBullet = bHasBullet; - rLev.mnBulletChar = nBulletChar; - rLev.mnBulletFont = 0; - rLev.mnBulletHeight = 100; - rLev.mnBulletColor = 0; - rLev.mnAdjust = 0; - rLev.mnLineFeed = 100; - rLev.mnLowerDist = 0; - rLev.mnUpperDist = nUpperDist; - rLev.mnTextOfs = nTextOfs; - rLev.mnBulletOfs = nBulletOfs; - rLev.mnDefaultTab = nDefaultTab; - rLev.mnAsianSettings = 2; - rLev.mnBiDi = 0; - - rLev.mbExtendedBulletsUsed = FALSE; - rLev.mnBulletId = 0xffff; - rLev.mnBulletStart = 0; - rLev.mnMappedNumType = 0; - rLev.mnNumberingType = 0; - } -} - -void PPTExParaSheet::SetStyleSheet( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, - FontCollection& rFontCollection, int nLevel, const PPTExCharLevel& rCharLevel ) -{ - ParagraphObj aParagraphObj( rXPropSet, rBuProv ); - aParagraphObj.CalculateGraphicBulletSize( rCharLevel.mnFontHeight ); - PPTExParaLevel& rLev = maParaLevel[ nLevel ]; - - if ( aParagraphObj.meTextAdjust == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) - rLev.mnAdjust = aParagraphObj.mnTextAdjust; - if ( aParagraphObj.meLineSpacing == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) - { - sal_Int16 nLineSpacing = aParagraphObj.mnLineSpacing; - if ( nLineSpacing > 0 ) // if nLinespacing is < 0 the linespacing is an absolute spacing - { - sal_Bool bFixedLineSpacing = sal_False; - uno::Any aAny = rXPropSet->getPropertyValue( ::rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "FontIndependentLineSpacing" ) ) ); - if( !(aAny >>= bFixedLineSpacing) || !bFixedLineSpacing ) - { - const FontCollectionEntry* pDesc = rFontCollection.GetById( rCharLevel.mnFont ); - if ( pDesc ) - nLineSpacing = (sal_Int16)( (double)nLineSpacing * pDesc->Scaling + 0.5 ); - } - } - else - { - if ( rCharLevel.mnFontHeight > (sal_uInt16)( ((double)-nLineSpacing) * 0.001 * 72.0 / 2.54 ) ) // 1/100mm to point - { - const FontCollectionEntry* pDesc = rFontCollection.GetById( rCharLevel.mnFont ); - if ( pDesc ) - nLineSpacing = (sal_Int16)( (double)100.0 * pDesc->Scaling + 0.5 ); - else - nLineSpacing = 100; - } - else - nLineSpacing = (sal_Int16)( (double)nLineSpacing / 4.40972 ); - } - rLev.mnLineFeed = nLineSpacing; - } - if ( aParagraphObj.meLineSpacingBottom == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) - rLev.mnLowerDist = aParagraphObj.mnLineSpacingBottom; - if ( aParagraphObj.meLineSpacingTop == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) - rLev.mnUpperDist = aParagraphObj.mnLineSpacingTop; - if ( aParagraphObj.meForbiddenRules == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) - { - rLev.mnAsianSettings &=~1; - if ( aParagraphObj.mbForbiddenRules ) - rLev.mnAsianSettings |= 1; - } - if ( aParagraphObj.meParagraphPunctation == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) - { - rLev.mnAsianSettings &=~4; - if ( aParagraphObj.mbParagraphPunctation ) - rLev.mnAsianSettings |= 4; - } - - if ( aParagraphObj.meBiDi == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) - rLev.mnBiDi = aParagraphObj.mnBiDi; - - rLev.mbIsBullet = aParagraphObj.mbIsBullet; //( ( aParagraphObj.nBulletFlags & 1 ) != 0 ); - - if ( !nLevel ) - { - if ( ( aParagraphObj.meBullet == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) - && aParagraphObj.bExtendedParameters ) - { - for ( sal_Int16 i = 0; i < 5; i++ ) - { - PPTExParaLevel& rLevel = maParaLevel[ i ]; - if ( i ) - aParagraphObj.ImplGetNumberingLevel( rBuProv, i, FALSE ); -// rLevel.mbIsBullet = ( ( aParagraphObj.nBulletFlags & 1 ) != 0 ); - rLevel.mnTextOfs = aParagraphObj.nTextOfs; - rLevel.mnBulletOfs = (sal_uInt16)aParagraphObj.nBulletOfs; - rLevel.mnBulletChar = aParagraphObj.cBulletId; - FontCollectionEntry aFontDescEntry( aParagraphObj.aFontDesc.Name, aParagraphObj.aFontDesc.Family, - aParagraphObj.aFontDesc.Pitch, aParagraphObj.aFontDesc.CharSet ); - rLevel.mnBulletFont = (sal_uInt16)rFontCollection.GetId( aFontDescEntry ); - rLevel.mnBulletHeight = aParagraphObj.nBulletRealSize; - rLevel.mnBulletColor = aParagraphObj.nBulletColor; - - rLevel.mbExtendedBulletsUsed = aParagraphObj.bExtendedBulletsUsed; - rLevel.mnBulletId = aParagraphObj.nBulletId; - rLevel.mnNumberingType = aParagraphObj.nNumberingType; - rLevel.mnBulletStart = aParagraphObj.nStartWith; - rLevel.mnMappedNumType = aParagraphObj.nMappedNumType; - } - } - } -} - -void PPTExParaSheet::Write( SvStream& rSt, PptEscherEx*, sal_uInt16 nLev, sal_Bool, sal_Bool bSimpleText, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rPagePropSet ) -{ - const PPTExParaLevel& rLev = maParaLevel[ nLev ]; - - if ( maParaLevel[ 0 ].mbExtendedBulletsUsed || maParaLevel[ 1 ].mbExtendedBulletsUsed || - maParaLevel[ 2 ].mbExtendedBulletsUsed || maParaLevel[ 3 ].mbExtendedBulletsUsed || - maParaLevel[ 4 ].mbExtendedBulletsUsed ) - { - SvStream& rOut = rBuProv.aBuExMasterStream; - if ( !nLev ) - { - rOut << (sal_uInt32)( ( EPP_PST_ExtendedParagraphMasterAtom << 16 ) | ( mnInstance << 4 ) ) - << (sal_uInt32)( 5 * 16 + 2 ) - << (sal_uInt16)5; // depth - } - sal_uInt16 nBulletId = rLev.mnBulletId; - if ( rLev.mnNumberingType != SVX_NUM_BITMAP ) - nBulletId = 0xffff; - rOut << (sal_uInt32)0x03800000 - << (sal_uInt16)nBulletId - << (sal_uInt32)rLev.mnMappedNumType - << (sal_uInt16)rLev.mnBulletStart - << (sal_uInt32)0; - } - - sal_uInt32 nParaFlags = 0x3ffdff; - sal_uInt16 nBulletFlags = ( rLev.mbIsBullet ) ? 0xf : 0xe; - - if ( nLev ) - nParaFlags &= 0x207fff; - if ( bSimpleText ) - nParaFlags &= 0x7fff; - sal_uInt32 nBulletColor = rLev.mnBulletColor; - if ( nBulletColor == COL_AUTO ) - { - sal_Bool bIsDark = sal_False; - ::com::sun::star::uno::Any aAny; - if ( PropValue::GetPropertyValue( aAny, rPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsBackgroundDark" ) ), sal_True ) ) - aAny >>= bIsDark; - nBulletColor = bIsDark ? 0xffffff : 0x000000; - } - nBulletColor &= 0xffffff; - nBulletColor |= 0xfe000000; - rSt << nParaFlags - << nBulletFlags - << rLev.mnBulletChar - << rLev.mnBulletFont - << rLev.mnBulletHeight - << nBulletColor - << rLev.mnAdjust - << rLev.mnLineFeed - << rLev.mnUpperDist - << rLev.mnLowerDist - << rLev.mnTextOfs - << rLev.mnBulletOfs; - - if ( bSimpleText || nLev ) - { - if ( nParaFlags & 0x200000 ) - rSt << rLev.mnBiDi; - } - else - { - rSt << rLev.mnDefaultTab - << (sal_uInt16)0 - << (sal_uInt16)0 - << rLev.mnAsianSettings - << rLev.mnBiDi; - } -} - - -PPTExStyleSheet::PPTExStyleSheet( sal_uInt16 nDefaultTab, PPTExBulletProvider& rBuProv ) -{ - for ( int nInstance = EPP_TEXTTYPE_Title; nInstance <= EPP_TEXTTYPE_QuarterBody; nInstance++ ) - { - mpParaSheet[ nInstance ] = ( nInstance == EPP_TEXTTYPE_notUsed ) ? NULL : new PPTExParaSheet( nInstance, nDefaultTab, rBuProv ); - mpCharSheet[ nInstance ] = ( nInstance == EPP_TEXTTYPE_notUsed ) ? NULL : new PPTExCharSheet( nInstance ); - } -} - -PPTExStyleSheet::~PPTExStyleSheet() -{ - for ( int nInstance = EPP_TEXTTYPE_Title; nInstance <= EPP_TEXTTYPE_QuarterBody; nInstance++ ) - { - if ( nInstance == EPP_TEXTTYPE_notUsed ) - continue; - - delete mpParaSheet[ nInstance ]; - delete mpCharSheet[ nInstance ]; - } -} - -void PPTExStyleSheet::SetStyleSheet( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, - FontCollection& rFontCollection, int nInstance, int nLevel ) -{ - if ( nInstance == EPP_TEXTTYPE_notUsed ) - return; - mpCharSheet[ nInstance ]->SetStyleSheet( rXPropSet, rFontCollection, nLevel ); - mpParaSheet[ nInstance ]->SetStyleSheet( rXPropSet, rFontCollection, nLevel, mpCharSheet[ nInstance ]->maCharLevel[ nLevel ] ); -} - -sal_Bool PPTExStyleSheet::IsHardAttribute( sal_uInt32 nInstance, sal_uInt32 nLevel, PPTExTextAttr eAttr, sal_uInt32 nValue ) -{ - const PPTExParaLevel& rPara = mpParaSheet[ nInstance ]->maParaLevel[ nLevel ]; - const PPTExCharLevel& rChar = mpCharSheet[ nInstance ]->maCharLevel[ nLevel ]; - - sal_uInt32 nFlag = 0; - - switch ( eAttr ) - { - case ParaAttr_BulletOn : return ( rPara.mbIsBullet ) ? ( nValue ) ? FALSE : TRUE : ( nValue ) ? TRUE : FALSE; - case ParaAttr_BuHardFont : - case ParaAttr_BulletFont : return ( rPara.mnBulletFont != nValue ); - case ParaAttr_BuHardColor : - case ParaAttr_BulletColor : return ( rPara.mnBulletColor != nValue ); - case ParaAttr_BuHardHeight : - case ParaAttr_BulletHeight : return ( rPara.mnBulletHeight != nValue ); - case ParaAttr_BulletChar : return ( rPara.mnBulletChar != nValue ); - case ParaAttr_Adjust : return ( rPara.mnAdjust != nValue ); - case ParaAttr_LineFeed : return ( rPara.mnLineFeed != nValue ); - case ParaAttr_UpperDist : return ( rPara.mnUpperDist != nValue ); - case ParaAttr_LowerDist : return ( rPara.mnLowerDist != nValue ); - case ParaAttr_TextOfs : return ( rPara.mnTextOfs != nValue ); - case ParaAttr_BulletOfs : return ( rPara.mnBulletOfs != nValue ); - case ParaAttr_DefaultTab : return ( rPara.mnDefaultTab != nValue ); - case ParaAttr_BiDi : return ( rPara.mnBiDi != nValue ); - case CharAttr_Bold : nFlag = 1; break; - case CharAttr_Italic : nFlag = 2; break; - case CharAttr_Underline : nFlag = 4; break; - case CharAttr_Shadow : nFlag = 16; break; - case CharAttr_Strikeout : nFlag = 256; break; - case CharAttr_Embossed : nFlag = 512; break; - case CharAttr_Font : return ( rChar.mnFont != nValue ); - case CharAttr_AsianOrComplexFont : return ( rChar.mnAsianOrComplexFont != nValue ); - case CharAttr_Symbol : return TRUE; - case CharAttr_FontHeight : return ( rChar.mnFontHeight != nValue ); - case CharAttr_FontColor : return ( rChar.mnFontColor != nValue ); - case CharAttr_Escapement : return ( rChar.mnEscapement != nValue ); - default: - break; - }; - if ( nFlag ) - { - if ( rChar.mnFlags & nFlag ) - return ( ( nValue & nFlag ) == 0 ); - else - return ( ( nValue & nFlag ) != 0 ); - } - return TRUE; -} - -sal_uInt32 PPTExStyleSheet::SizeOfTxCFStyleAtom() const -{ - return 24; -} - -// the TxCFStyleAtom stores the text properties that are used -// when creating new objects in PowerPoint. - -void PPTExStyleSheet::WriteTxCFStyleAtom( SvStream& rSt ) -{ - const PPTExCharLevel& rCharStyle = mpCharSheet[ EPP_TEXTTYPE_Other ]->maCharLevel[ 0 ]; - - sal_uInt16 nFlags = 0x60 // ?? - | 0x02 // fontsize; - | 0x04; // fontcolor - - sal_uInt32 nCharFlags = rCharStyle.mnFlags; - nCharFlags &= CharAttr_Italic | CharAttr_Bold | CharAttr_Underline | CharAttr_Shadow; - - rSt << (sal_uInt32)( EPP_TxCFStyleAtom << 16 ) // recordheader - << SizeOfTxCFStyleAtom() - 8 - << (sal_uInt16)( 0x80 | nCharFlags ) - << (sal_uInt16)nFlags - << (sal_uInt16)nCharFlags - << (sal_Int32)-1 // ? - << rCharStyle.mnFontHeight - << rCharStyle.mnFontColor; -} // --------------------------------------------------------------------------------------------- @@ -2449,6 +1571,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT BOOL __LOADONCALLAPI ExportPPT( SvStorageRef& rS pPPTWriter = new PPTWriter( rSvStorage, rXModel, rXStatInd, pVBA, nCnvrtFlags ); if ( pPPTWriter ) { + pPPTWriter->exportPPT(); bStatus = ( pPPTWriter->IsValid() == TRUE ); delete pPPTWriter; } diff --git a/sd/source/filter/pptx/pptx-epptso.cxx b/sd/source/filter/pptx/pptx-epptso.cxx index fd33ce7566e1..e8c080e118fc 100644 --- a/sd/source/filter/pptx/pptx-epptso.cxx +++ b/sd/source/filter/pptx/pptx-epptso.cxx @@ -32,6 +32,7 @@ #include "precompiled_sd.hxx" #include <osl/endian.h> #include <eppt.hxx> +#include "text.hxx" #include "epptdef.hxx" #ifndef _PptEscherEx_HXX #include "escherex.hxx" @@ -46,7 +47,6 @@ #include <vcl/virdev.hxx> #include <vcl/gradient.hxx> #include <sfx2/app.hxx> -#include <svtools/languageoptions.hxx> //#ifndef _SVX_XIT_HXX //#include <svx/xit.hxx> //#endif @@ -55,7 +55,6 @@ #include <svx/svdoashp.hxx> #include <com/sun/star/style/VerticalAlignment.hpp> #include <com/sun/star/container/XIndexReplace.hpp> -#include <com/sun/star/presentation/XPresentationPage.hpp> #include <com/sun/star/awt/XFont.hpp> #ifndef _COM_SUN_STAR_AWT_XFONTWEIGHT_HPP_ #include <com/sun/star/awt/FontWeight.hpp> @@ -63,9 +62,6 @@ #ifndef _COM_SUN_STAR_AWT_XFONTUNDERLINE_HPP_ #include <com/sun/star/awt/FontUnderline.hpp> #endif -#include <com/sun/star/style/ParagraphAdjust.hpp> -#include <com/sun/star/style/LineSpacing.hpp> -#include <com/sun/star/style/LineSpacingMode.hpp> #ifndef _COM_SUN_STAR_STYLE_XSTYLEFAMILIESSUPPLIER_PP_ #include <com/sun/star/style/XStyleFamiliesSupplier.hpp> #endif @@ -154,9 +150,6 @@ using namespace ::com::sun::star; // --------------------------------------------------------------------------------------------- -com::sun::star::uno::Reference< com::sun::star::i18n::XBreakIterator > xPPTBreakIter; -com::sun::star::uno::Reference< com::sun::star::i18n::XScriptTypeDetector > xScriptTypeDetector; - PPTExBulletProvider::PPTExBulletProvider() { pGraphicProv = new EscherGraphicProvider( _E_GRAPH_PROV_USE_INSTANCES | _E_GRAPH_PROV_DO_NOT_ROTATE_METAFILES ); @@ -215,219 +208,6 @@ sal_uInt16 PPTExBulletProvider::GetId( const ByteString& rUniqueId, Size& rGraph // --------------------------------------------------------------------------------------------- -GroupTable::GroupTable() : - mnCurrentGroupEntry ( 0 ), - mnMaxGroupEntry ( 0 ), - mnGroupsClosed ( 0 ), - mpGroupEntry ( NULL ) -{ - ImplResizeGroupTable( 32 ); -} - -// --------------------------------------------------------------------------------------------- - -GroupTable::~GroupTable() -{ - for ( sal_uInt32 i = 0; i < mnCurrentGroupEntry; delete mpGroupEntry[ i++ ] ) ; - delete[] mpGroupEntry; -} - -// --------------------------------------------------------------------------------------------- - -void GroupTable::ImplResizeGroupTable( sal_uInt32 nEntrys ) -{ - if ( nEntrys > mnMaxGroupEntry ) - { - mnMaxGroupEntry = nEntrys; - GroupEntry** pTemp = new GroupEntry*[ nEntrys ]; - for ( sal_uInt32 i = 0; i < mnCurrentGroupEntry; i++ ) - pTemp[ i ] = mpGroupEntry[ i ]; - if ( mpGroupEntry ) - delete[] mpGroupEntry; - mpGroupEntry = pTemp; - } -} - -// --------------------------------------------------------------------------------------------- - -sal_Bool GroupTable::EnterGroup( ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& rXIndexAccessRef ) -{ - sal_Bool bRet = sal_False; - if ( rXIndexAccessRef.is() ) - { - GroupEntry* pNewGroup = new GroupEntry( rXIndexAccessRef ); - if ( pNewGroup->mnCount ) - { - if ( mnMaxGroupEntry == mnCurrentGroupEntry ) - ImplResizeGroupTable( mnMaxGroupEntry + 8 ); - mpGroupEntry[ mnCurrentGroupEntry++ ] = pNewGroup; - bRet = sal_True; - } - else - delete pNewGroup; - } - return bRet; -} - -// --------------------------------------------------------------------------------------------- - -sal_uInt32 GroupTable::GetGroupsClosed() -{ - sal_uInt32 nRet = mnGroupsClosed; - mnGroupsClosed = 0; - return nRet; -} - -// --------------------------------------------------------------------------------------------- - -void GroupTable::ClearGroupTable() -{ - for ( sal_uInt32 i = 0; i < mnCurrentGroupEntry; i++, delete mpGroupEntry[ i ] ) ; - mnCurrentGroupEntry = 0; -} - -// --------------------------------------------------------------------------------------------- - -void GroupTable::ResetGroupTable( sal_uInt32 nCount ) -{ - ClearGroupTable(); - mpGroupEntry[ mnCurrentGroupEntry++ ] = new GroupEntry( nCount ); -} - -// --------------------------------------------------------------------------------------------- - -sal_Bool GroupTable::GetNextGroupEntry() -{ - while ( mnCurrentGroupEntry ) - { - mnIndex = mpGroupEntry[ mnCurrentGroupEntry - 1 ]->mnCurrentPos++; - - if ( mpGroupEntry[ mnCurrentGroupEntry - 1 ]->mnCount > mnIndex ) - return TRUE; - - delete ( mpGroupEntry[ --mnCurrentGroupEntry ] ); - - if ( mnCurrentGroupEntry ) - mnGroupsClosed++; - } - return FALSE; -} - -// --------------------------------------------------------------------------------------------- - -void GroupTable::SkipCurrentGroup() -{ - if ( mnCurrentGroupEntry ) - delete ( mpGroupEntry[ --mnCurrentGroupEntry ] ); -} - -// --------------------------------------------------------------------------------------------- - -FontCollectionEntry::~FontCollectionEntry() -{ -} - -// --------------------------------------------------------------------------------------------- - -void FontCollectionEntry::ImplInit( const String& rName ) -{ - String aSubstName( GetSubsFontName( rName, SUBSFONT_ONLYONE | SUBSFONT_MS ) ); - if ( aSubstName.Len() ) - { - Name = aSubstName; - bIsConverted = sal_True; - } - else - { - Name = rName; - bIsConverted = sal_False; - } -} - -FontCollection::~FontCollection() -{ - for( void* pStr = List::First(); pStr; pStr = List::Next() ) - delete (FontCollectionEntry*)pStr; - delete pVDev; - xPPTBreakIter = NULL; - xScriptTypeDetector = NULL; -} - -FontCollection::FontCollection() : - pVDev ( NULL ) -{ - com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > - xMSF = ::comphelper::getProcessServiceFactory(); - com::sun::star::uno::Reference< com::sun::star::uno::XInterface > - xInterface = xMSF->createInstance( rtl::OUString::createFromAscii( "com.sun.star.i18n.BreakIterator" ) ); - if ( xInterface.is() ) - xPPTBreakIter = com::sun::star::uno::Reference< com::sun::star::i18n::XBreakIterator > - ( xInterface, com::sun::star::uno::UNO_QUERY ); - - xInterface = xMSF->createInstance( rtl::OUString::createFromAscii( "com.sun.star.i18n.ScriptTypeDetector" ) ); - if ( xInterface.is() ) - xScriptTypeDetector = com::sun::star::uno::Reference< com::sun::star::i18n::XScriptTypeDetector > - ( xInterface, com::sun::star::uno::UNO_QUERY ); -} - -short FontCollection::GetScriptDirection( const String& rString ) const -{ - short nRet = com::sun::star::i18n::ScriptDirection::NEUTRAL; - if ( xScriptTypeDetector.is() ) - { - const rtl::OUString sT( rString ); - nRet = xScriptTypeDetector->getScriptDirection( sT, 0, com::sun::star::i18n::ScriptDirection::NEUTRAL ); - } - return nRet; -} - -sal_uInt32 FontCollection::GetId( FontCollectionEntry& rEntry ) -{ - if( rEntry.Name.Len() ) - { - const sal_uInt32 nFonts = GetCount(); - - for( sal_uInt32 i = 0; i < nFonts; i++ ) - { - const FontCollectionEntry* pEntry = GetById( i ); - if( pEntry->Name == rEntry.Name ) - return i; - } - Font aFont; - aFont.SetCharSet( rEntry.CharSet ); - aFont.SetName( rEntry.Original ); -// aFont.SetFamily( rEntry.Family ); -// aFont.SetPitch( rEntry.Pitch ); - aFont.SetHeight( 100 ); - - if ( !pVDev ) - pVDev = new VirtualDevice; - - pVDev->SetFont( aFont ); - FontMetric aMetric( pVDev->GetFontMetric() ); - - sal_uInt16 nTxtHeight = (sal_uInt16)aMetric.GetAscent() + (sal_uInt16)aMetric.GetDescent(); - - if ( nTxtHeight ) - { - double fScaling = (double)nTxtHeight / 120.0; - if ( ( fScaling > 0.50 ) && ( fScaling < 1.5 ) ) - rEntry.Scaling = fScaling; - } - - List::Insert( new FontCollectionEntry( rEntry ), LIST_APPEND ); - return nFonts; - } - return 0; -} - -const FontCollectionEntry* FontCollection::GetById( sal_uInt32 nId ) -{ - return (FontCollectionEntry*)List::GetObject( nId ); -} - -// --------------------------------------------------------------------------------------------- - sal_uInt32 PPTWriter::ImplVBAInfoContainer( SvStream* pStrm ) { sal_uInt32 nSize = 28; @@ -977,360 +757,6 @@ sal_Bool PropStateValue::ImplGetPropertyValue( const String& rString, sal_Bool b // --------------------------------------------------------------------------------------------- -sal_Bool PPTWriter::ImplInitSOIface() -{ - while( TRUE ) - { - mXDrawPagesSupplier = ::com::sun::star::uno::Reference< - ::com::sun::star::drawing::XDrawPagesSupplier > - ( mXModel, ::com::sun::star::uno::UNO_QUERY ); - if ( !mXDrawPagesSupplier.is() ) - break; - - mXMasterPagesSupplier = ::com::sun::star::uno::Reference< - ::com::sun::star::drawing::XMasterPagesSupplier > - ( mXModel, ::com::sun::star::uno::UNO_QUERY ); - if ( !mXMasterPagesSupplier.is() ) - break; - mXDrawPages = mXMasterPagesSupplier->getMasterPages(); - if ( !mXDrawPages.is() ) - break; - mnMasterPages = mXDrawPages->getCount(); - mXDrawPages = mXDrawPagesSupplier->getDrawPages(); - if( !mXDrawPages.is() ) - break; - mnPages = mXDrawPages->getCount(); - if ( !ImplGetPageByIndex( 0, NORMAL ) ) - break; - - return TRUE; - } - return FALSE; -} - -// --------------------------------------------------------------------------------------------- - -sal_Bool PPTWriter::ImplSetCurrentStyleSheet( sal_uInt32 nPageNum ) -{ - sal_Bool bRet = sal_False; - if ( nPageNum >= maStyleSheetList.size() ) - nPageNum = 0; - else - bRet = sal_True; - mpStyleSheet = maStyleSheetList[ nPageNum ]; - return bRet; -} - -// --------------------------------------------------------------------------------------------- - -sal_Bool PPTWriter::ImplGetPageByIndex( sal_uInt32 nIndex, PageType ePageType ) -{ - while( TRUE ) - { - if ( ePageType != meLatestPageType ) - { - switch( ePageType ) - { - case NORMAL : - case NOTICE : - { - mXDrawPages = mXDrawPagesSupplier->getDrawPages(); - if( !mXDrawPages.is() ) - return FALSE; - } - break; - - case MASTER : - { - mXDrawPages = mXMasterPagesSupplier->getMasterPages(); - if( !mXDrawPages.is() ) - return FALSE; - } - break; - default: - break; - } - meLatestPageType = ePageType; - } - ::com::sun::star::uno::Any aAny( mXDrawPages->getByIndex( nIndex ) ); - aAny >>= mXDrawPage; - if ( !mXDrawPage.is() ) - break; - if ( ePageType == NOTICE ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::presentation::XPresentationPage > - aXPresentationPage( mXDrawPage, ::com::sun::star::uno::UNO_QUERY ); - if ( !aXPresentationPage.is() ) - break; - mXDrawPage = aXPresentationPage->getNotesPage(); - if ( !mXDrawPage.is() ) - break; - } - mXPagePropSet = ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > - ( mXDrawPage, ::com::sun::star::uno::UNO_QUERY ); - if ( !mXPagePropSet.is() ) - break; - - mXShapes = ::com::sun::star::uno::Reference< - ::com::sun::star::drawing::XShapes > - ( mXDrawPage, ::com::sun::star::uno::UNO_QUERY ); - if ( !mXShapes.is() ) - break; - - /* try to get the "real" background PropertySet. If the normal page is not supporting this property, it is - taken the property from the master */ - sal_Bool bHasBackground = GetPropertyValue( aAny, mXPagePropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Background" ) ), sal_True ); - if ( bHasBackground ) - bHasBackground = ( aAny >>= mXBackgroundPropSet ); - if ( !bHasBackground ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XMasterPageTarget > - aXMasterPageTarget( mXDrawPage, ::com::sun::star::uno::UNO_QUERY ); - if ( aXMasterPageTarget.is() ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > aXMasterDrawPage; - aXMasterDrawPage = aXMasterPageTarget->getMasterPage(); - if ( aXMasterDrawPage.is() ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > aXMasterPagePropSet; - aXMasterPagePropSet = ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > - ( aXMasterDrawPage, ::com::sun::star::uno::UNO_QUERY ); - if ( aXMasterPagePropSet.is() ) - { - sal_Bool bBackground = GetPropertyValue( aAny, aXMasterPagePropSet, - String( RTL_CONSTASCII_USTRINGPARAM( "Background" ) ) ); - if ( bBackground ) - { - aAny >>= mXBackgroundPropSet; - } - } - } - } - } - return TRUE; - } - return FALSE; -} - -// --------------------------------------------------------------------------------------------- - -sal_Bool PPTWriter::ImplGetShapeByIndex( sal_uInt32 nIndex, sal_Bool bGroup ) -{ - while(TRUE) - { - if ( ( bGroup == FALSE ) || ( GetCurrentGroupLevel() == 0 ) ) - { - ::com::sun::star::uno::Any aAny( mXShapes->getByIndex( nIndex ) ); - aAny >>= mXShape; - } - else - { - ::com::sun::star::uno::Any aAny( GetCurrentGroupAccess()->getByIndex( GetCurrentGroupIndex() ) ); - aAny >>= mXShape; - } - if ( !mXShape.is() ) - break; - - ::com::sun::star::uno::Any aAny( mXShape->queryInterface( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >*) 0 ) )); - aAny >>= mXPropSet; - - if ( !mXPropSet.is() ) - break; - maPosition = ImplMapPoint( mXShape->getPosition() ); - maSize = ImplMapSize( mXShape->getSize() ); - maRect = Rectangle( Point( maPosition.X, maPosition.Y ), Size( maSize.Width, maSize.Height ) ); - mType = ByteString( String( mXShape->getShapeType() ), RTL_TEXTENCODING_UTF8 ); - mType.Erase( 0, 13 ); // "com.sun.star." entfernen - sal_uInt16 nPos = mType.Search( (const char*)"Shape" ); - mType.Erase( nPos, 5 ); - - mbPresObj = mbEmptyPresObj = FALSE; - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "IsPresentationObject" ) ) ) ) - mAny >>= mbPresObj; - - if ( mbPresObj && ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "IsEmptyPresentationObject" ) ) ) ) - mAny >>= mbEmptyPresObj; - - mnAngle = ( PropValue::GetPropertyValue( aAny, - mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "RotateAngle" ) ), sal_True ) ) - ? *((sal_Int32*)aAny.getValue() ) - : 0; - - return TRUE; - } - return FALSE; -} - -// ----------------------------------------------------------------------- - -sal_uInt32 PPTWriter::ImplGetMasterIndex( PageType ePageType ) -{ - sal_uInt32 nRetValue = 0; - ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XMasterPageTarget > - aXMasterPageTarget( mXDrawPage, ::com::sun::star::uno::UNO_QUERY ); - - if ( aXMasterPageTarget.is() ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > - aXDrawPage = aXMasterPageTarget->getMasterPage(); - if ( aXDrawPage.is() ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > - aXPropertySet( aXDrawPage, ::com::sun::star::uno::UNO_QUERY ); - - if ( aXPropertySet.is() ) - { - if ( ImplGetPropertyValue( aXPropertySet, String( RTL_CONSTASCII_USTRINGPARAM( "Number" ) ) ) ) - nRetValue |= *(sal_Int16*)mAny.getValue(); - if ( nRetValue & 0xffff ) // ueberlauf vermeiden - nRetValue--; - } - } - } - if ( ePageType == NOTICE ) - nRetValue += mnMasterPages; - return nRetValue; -} - -// ----------------------------------------------------------------------- - -sal_Bool PPTWriter::ImplGetStyleSheets() -{ - int nInstance, nLevel; - sal_Bool bRetValue = sal_False; - sal_uInt32 nPageNum; - - for ( nPageNum = 0; nPageNum < mnMasterPages; nPageNum++ ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > - aXNamed; - - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > - aXNameAccess; - - ::com::sun::star::uno::Reference< ::com::sun::star::style::XStyleFamiliesSupplier > - aXStyleFamiliesSupplier( mXModel, ::com::sun::star::uno::UNO_QUERY ); - - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > - aXPropSet( mXModel, ::com::sun::star::uno::UNO_QUERY ); - - sal_uInt16 nDefaultTab = ( aXPropSet.is() && ImplGetPropertyValue( aXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "TabStop" ) ) ) ) - ? (sal_uInt16)( *(sal_Int32*)mAny.getValue() / 4.40972 ) - : 1250; - - maStyleSheetList.push_back( new PPTExStyleSheet( nDefaultTab, (PPTExBulletProvider&)*this ) ); - ImplSetCurrentStyleSheet( nPageNum ); - if ( ImplGetPageByIndex( nPageNum, MASTER ) ) - aXNamed = ::com::sun::star::uno::Reference< ::com::sun::star::container::XNamed > - ( mXDrawPage, ::com::sun::star::uno::UNO_QUERY ); - - if ( aXStyleFamiliesSupplier.is() ) - aXNameAccess = aXStyleFamiliesSupplier->getStyleFamilies(); - - bRetValue = aXNamed.is() && aXNameAccess.is() && aXStyleFamiliesSupplier.is(); - if ( bRetValue ) - { - for ( nInstance = EPP_TEXTTYPE_Title; nInstance <= EPP_TEXTTYPE_CenterTitle; nInstance++ ) - { - String aStyle; - String aFamily; - switch ( nInstance ) - { - case EPP_TEXTTYPE_CenterTitle : - case EPP_TEXTTYPE_Title : - { - aStyle = String( RTL_CONSTASCII_USTRINGPARAM( "title" ) ); - aFamily = aXNamed->getName(); - } - break; - case EPP_TEXTTYPE_Body : - { - aStyle = String( RTL_CONSTASCII_USTRINGPARAM( "outline1" ) ); // SD_LT_SEPARATOR - aFamily = aXNamed->getName(); - } - break; - case EPP_TEXTTYPE_Other : - { - aStyle = String( RTL_CONSTASCII_USTRINGPARAM( "standard" ) ); - aFamily = String( RTL_CONSTASCII_USTRINGPARAM( "graphics" ) ); - } - break; - case EPP_TEXTTYPE_CenterBody : - { - aStyle = String( RTL_CONSTASCII_USTRINGPARAM( "subtitle" ) ); - aFamily = aXNamed->getName(); - } - break; - } - if ( aStyle.Len() && aFamily.Len() ) - { - try - { - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >xNameAccess; - if ( aXNameAccess->hasByName( aFamily ) ) - { - ::com::sun::star::uno::Any aAny( aXNameAccess->getByName( aFamily ) ); - if( aAny.getValue() && ::cppu::extractInterface( xNameAccess, aAny ) ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > aXFamily; - if ( aAny >>= aXFamily ) - { - if ( aXFamily->hasByName( aStyle ) ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::style::XStyle > xStyle; - aAny = aXFamily->getByName( aStyle ); - if( aAny.getValue() && ::cppu::extractInterface( xStyle, aAny ) ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::style::XStyle > aXStyle; - aAny >>= aXStyle; - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > - xPropSet( aXStyle, ::com::sun::star::uno::UNO_QUERY ); - if( xPropSet.is() ) - mpStyleSheet->SetStyleSheet( xPropSet, maFontCollection, nInstance, 0 ); - for ( nLevel = 1; nLevel < 5; nLevel++ ) - { - if ( nInstance == EPP_TEXTTYPE_Body ) - { - sal_Unicode cTemp = aStyle.GetChar( aStyle.Len() - 1 ); - aStyle.SetChar( aStyle.Len() - 1, ++cTemp ); - if ( aXFamily->hasByName( aStyle ) ) - { - aXFamily->getByName( aStyle ) >>= xStyle; - if( xStyle.is() ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > - xPropertySet( xStyle, ::com::sun::star::uno::UNO_QUERY ); - if ( xPropertySet.is() ) - mpStyleSheet->SetStyleSheet( xPropertySet, maFontCollection, nInstance, nLevel ); - } - } - } - else - mpStyleSheet->SetStyleSheet( xPropSet, maFontCollection, nInstance, nLevel ); - } - } - } - } - } - } - } - catch( ::com::sun::star::uno::Exception& ) - { - // - } - } - } - for ( ; nInstance <= EPP_TEXTTYPE_QuarterBody; nInstance++ ) - { - - } - } - } - return bRetValue; -} - -// ----------------------------------------------------------------------- - void PPTWriter::ImplWriteParagraphs( SvStream& rOut, TextObj& rTextObj ) { sal_Bool bFirstParagraph = TRUE; @@ -1707,1385 +1133,6 @@ void PPTWriter::ImplFlipBoundingBox( EscherPropertyContainer& rPropOpt ) // ----------------------------------------------------------------------- -struct FieldEntry -{ - sal_uInt32 nFieldType; - sal_uInt32 nFieldStartPos; - sal_uInt32 nFieldEndPos; - String aRepresentation; - String aFieldUrl; - - FieldEntry( sal_uInt32 nType, sal_uInt32 nStart, sal_uInt32 nEnd ) - { - nFieldType = nType; - nFieldStartPos = nStart; - nFieldEndPos = nEnd; - } -}; - -// ----------------------------------------------------------------------- - -PortionObj::PortionObj( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, - FontCollection& rFontCollection ) : - mnCharAttrHard ( 0 ), - mnCharAttr ( 0 ), - mnFont ( 0 ), - mnAsianOrComplexFont( 0xffff ), - mnTextSize ( 0 ), - mbLastPortion ( TRUE ), - mpText ( NULL ), - mpFieldEntry ( NULL ) -{ - mXPropSet = rXPropSet; - - ImplGetPortionValues( rFontCollection, FALSE ); -} - -PortionObj::PortionObj( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & rXTextRange, - sal_Bool bLast, FontCollection& rFontCollection ) : - mnCharAttrHard ( 0 ), - mnCharAttr ( 0 ), - mnFont ( 0 ), - mnAsianOrComplexFont ( 0xffff ), - mbLastPortion ( bLast ), - mpText ( NULL ), - mpFieldEntry ( NULL ) -{ - String aString( rXTextRange->getString() ); - String aURL; - BOOL bRTL_endingParen = FALSE; - - mnTextSize = aString.Len(); - if ( bLast ) - mnTextSize++; - - if ( mnTextSize ) - { - mpFieldEntry = NULL; - sal_uInt32 nFieldType = 0; - - mXPropSet = ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > - ( rXTextRange, ::com::sun::star::uno::UNO_QUERY ); - mXPropState = ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertyState > - ( rXTextRange, ::com::sun::star::uno::UNO_QUERY ); - - sal_Bool bPropSetsValid = ( mXPropSet.is() && mXPropState.is() ); - if ( bPropSetsValid ) - nFieldType = ImplGetTextField( rXTextRange, mXPropSet, aURL ); - if ( nFieldType ) - { - mpFieldEntry = new FieldEntry( nFieldType, 0, mnTextSize ); - if ( ( nFieldType >> 28 == 4 ) ) - { - mpFieldEntry->aRepresentation = aString; - mpFieldEntry->aFieldUrl = aURL; - } - } - sal_Bool bSymbol = FALSE; - - if ( bPropSetsValid && ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontCharSet" ) ), FALSE ) ) - { - sal_Int16 nCharset; - mAny >>= nCharset; - if ( nCharset == ::com::sun::star::awt::CharSet::SYMBOL ) - bSymbol = TRUE; - } - if ( mpFieldEntry && ( nFieldType & 0x800000 ) ) // placeholder ? - { - mnTextSize = 1; - if ( bLast ) - mnTextSize++; - mpText = new sal_uInt16[ mnTextSize ]; - mpText[ 0 ] = 0x2a; - } - else - { - const sal_Unicode* pText = aString.GetBuffer(); - // For i39516 - a closing parenthesis that ends an RTL string is displayed backwards by PPT - // Solution: add a Unicode Right-to-Left Mark, following the method described in i18024 - if ( bLast && pText[ aString.Len() - 1 ] == sal_Unicode(')') && rFontCollection.GetScriptDirection( aString ) == com::sun::star::i18n::ScriptDirection::RIGHT_TO_LEFT ) - { - mnTextSize++; - bRTL_endingParen = TRUE; - } - mpText = new sal_uInt16[ mnTextSize ]; - sal_uInt16 nChar; - for ( int i = 0; i < aString.Len(); i++ ) - { - nChar = (sal_uInt16)pText[ i ]; - if ( nChar == 0xa ) - nChar++; - else if ( !bSymbol ) - { - switch ( nChar ) - { - // Currency - case 128: nChar = 0x20AC; break; - // Punctuation and other - case 130: nChar = 0x201A; break;// SINGLE LOW-9 QUOTATION MARK - case 131: nChar = 0x0192; break;// LATIN SMALL LETTER F WITH HOOK - case 132: nChar = 0x201E; break;// DOUBLE LOW-9 QUOTATION MARK - // LOW DOUBLE PRIME QUOTATION MARK - case 133: nChar = 0x2026; break;// HORIZONTAL ELLIPSES - case 134: nChar = 0x2020; break;// DAGGER - case 135: nChar = 0x2021; break;// DOUBLE DAGGER - case 136: nChar = 0x02C6; break;// MODIFIER LETTER CIRCUMFLEX ACCENT - case 137: nChar = 0x2030; break;// PER MILLE SIGN - case 138: nChar = 0x0160; break;// LATIN CAPITAL LETTER S WITH CARON - case 139: nChar = 0x2039; break;// SINGLE LEFT-POINTING ANGLE QUOTATION MARK - case 140: nChar = 0x0152; break;// LATIN CAPITAL LIGATURE OE - case 142: nChar = 0x017D; break;// LATIN CAPITAL LETTER Z WITH CARON - case 145: nChar = 0x2018; break;// LEFT SINGLE QUOTATION MARK - // MODIFIER LETTER TURNED COMMA - case 146: nChar = 0x2019; break;// RIGHT SINGLE QUOTATION MARK - // MODIFIER LETTER APOSTROPHE - case 147: nChar = 0x201C; break;// LEFT DOUBLE QUOTATION MARK - // REVERSED DOUBLE PRIME QUOTATION MARK - case 148: nChar = 0x201D; break;// RIGHT DOUBLE QUOTATION MARK - // REVERSED DOUBLE PRIME QUOTATION MARK - case 149: nChar = 0x2022; break;// BULLET - case 150: nChar = 0x2013; break;// EN DASH - case 151: nChar = 0x2014; break;// EM DASH - case 152: nChar = 0x02DC; break;// SMALL TILDE - case 153: nChar = 0x2122; break;// TRADE MARK SIGN - case 154: nChar = 0x0161; break;// LATIN SMALL LETTER S WITH CARON - case 155: nChar = 0x203A; break;// SINGLE RIGHT-POINTING ANGLE QUOTATION MARK - case 156: nChar = 0x0153; break;// LATIN SMALL LIGATURE OE - case 158: nChar = 0x017E; break;// LATIN SMALL LETTER Z WITH CARON - case 159: nChar = 0x0178; break;// LATIN CAPITAL LETTER Y WITH DIAERESIS -// case 222: nChar = 0x00B6; break;// PILCROW SIGN / PARAGRAPH SIGN - } - } - mpText[ i ] = nChar; - } - } - if ( bRTL_endingParen ) - mpText[ mnTextSize - 2 ] = 0x200F; // Unicode Right-to-Left mark - - if ( bLast ) - mpText[ mnTextSize - 1 ] = 0xd; - - if ( bPropSetsValid ) - ImplGetPortionValues( rFontCollection, TRUE ); - } -} - -PortionObj::PortionObj( PortionObj& rPortionObj ) -: PropStateValue( rPortionObj ) -{ - ImplConstruct( rPortionObj ); -} - -PortionObj::~PortionObj() -{ - ImplClear(); -} - -void PortionObj::Write( SvStream* pStrm, sal_Bool bLast ) -{ - sal_uInt32 nCount = mnTextSize; - if ( bLast && mbLastPortion ) - nCount--; - for ( sal_uInt32 i = 0; i < nCount; i++ ) - *pStrm << (sal_uInt16)mpText[ i ]; -} - -void PortionObj::ImplGetPortionValues( FontCollection& rFontCollection, sal_Bool bGetPropStateValue ) -{ - - sal_Bool bOk = ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontName" ) ), bGetPropStateValue ); - meFontName = ePropState; - if ( bOk ) - { - FontCollectionEntry aFontDesc( *(::rtl::OUString*)mAny.getValue() ); - sal_uInt32 nCount = rFontCollection.GetCount(); - mnFont = (sal_uInt16)rFontCollection.GetId( aFontDesc ); - if ( mnFont == nCount ) - { - FontCollectionEntry& rFontDesc = rFontCollection.GetLast(); - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontCharSet" ) ), sal_False ) ) - mAny >>= rFontDesc.CharSet; - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontFamily" ) ), sal_False ) ) - mAny >>= rFontDesc.Family; - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontPitch" ) ), sal_False ) ) - mAny >>= rFontDesc.Pitch; - } - } - - sal_Int16 nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( Application::GetSettings().GetLanguage() ); - if ( mpText && mnTextSize && xPPTBreakIter.is() ) - { - rtl::OUString sT( mpText, mnTextSize ); - nScriptType = xPPTBreakIter->getScriptType( sT, 0 ); - } - if ( nScriptType != com::sun::star::i18n::ScriptType::COMPLEX ) - { - bOk = ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontNameAsian" ) ), bGetPropStateValue ); - meAsianOrComplexFont = ePropState; - if ( bOk ) - { - FontCollectionEntry aFontDesc( *(::rtl::OUString*)mAny.getValue() ); - sal_uInt32 nCount = rFontCollection.GetCount(); - mnAsianOrComplexFont = (sal_uInt16)rFontCollection.GetId( aFontDesc ); - if ( mnAsianOrComplexFont == nCount ) - { - FontCollectionEntry& rFontDesc = rFontCollection.GetLast(); - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontCharSetAsian" ) ), sal_False ) ) - mAny >>= rFontDesc.CharSet; - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontFamilyAsian" ) ), sal_False ) ) - mAny >>= rFontDesc.Family; - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontPitchAsian" ) ), sal_False ) ) - mAny >>= rFontDesc.Pitch; - } - } - } - else - { - bOk = ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontNameComplex" ) ), bGetPropStateValue ); - meAsianOrComplexFont = ePropState; - if ( bOk ) - { - FontCollectionEntry aFontDesc( *(::rtl::OUString*)mAny.getValue() ); - sal_uInt32 nCount = rFontCollection.GetCount(); - mnAsianOrComplexFont = (sal_uInt16)rFontCollection.GetId( aFontDesc ); - if ( mnAsianOrComplexFont == nCount ) - { - FontCollectionEntry& rFontDesc = rFontCollection.GetLast(); - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontCharSetComplex" ) ), sal_False ) ) - mAny >>= rFontDesc.CharSet; - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontFamilyComplex" ) ), sal_False ) ) - mAny >>= rFontDesc.Family; - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharFontPitchComplex" ) ), sal_False ) ) - mAny >>= rFontDesc.Pitch; - } - } - } - - if ( nScriptType != com::sun::star::i18n::ScriptType::COMPLEX ) - { - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharWeight" ) ), bGetPropStateValue ) ) - { - float fFloat; - mAny >>= fFloat; - if ( fFloat >= ::com::sun::star::awt::FontWeight::SEMIBOLD ) - mnCharAttr |= 1; - } - } - else - { - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharWeightComplex" ) ), bGetPropStateValue ) ) - { - float fFloat; - mAny >>= fFloat; - if ( fFloat >= ::com::sun::star::awt::FontWeight::SEMIBOLD ) - mnCharAttr |= 1; - } - } - - if ( ePropState == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) - mnCharAttrHard |= 1; - - if ( nScriptType != com::sun::star::i18n::ScriptType::COMPLEX ) - { - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharPosture" ) ), bGetPropStateValue ) ) - { - ::com::sun::star::awt::FontSlant aFS; - mAny >>= aFS; - switch ( aFS ) - { - case ::com::sun::star::awt::FontSlant_OBLIQUE : - case ::com::sun::star::awt::FontSlant_ITALIC : - mnCharAttr |= 2; - break; - default: - break; - } - } - } - else - { - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharPostureComplex" ) ), bGetPropStateValue ) ) - { - ::com::sun::star::awt::FontSlant aFS; - mAny >>= aFS; - switch ( aFS ) - { - case ::com::sun::star::awt::FontSlant_OBLIQUE : - case ::com::sun::star::awt::FontSlant_ITALIC : - mnCharAttr |= 2; - break; - default: - break; - } - } - } - - if ( ePropState == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) - mnCharAttrHard |= 2; - - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharUnderline" ) ), bGetPropStateValue ) ) - { - sal_Int16 nVal; - mAny >>= nVal; - switch ( nVal ) - { - case ::com::sun::star::awt::FontUnderline::SINGLE : - case ::com::sun::star::awt::FontUnderline::DOUBLE : - case ::com::sun::star::awt::FontUnderline::DOTTED : - mnCharAttr |= 4; - } - } - if ( ePropState == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) - mnCharAttrHard |= 4; - - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharShadowed" ) ), bGetPropStateValue ) ) - { - sal_Bool bBool; - mAny >>= bBool; - if ( bBool ) - mnCharAttr |= 0x10; - } - if ( ePropState == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) - mnCharAttrHard |= 16; - - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharLocale" ) ), bGetPropStateValue ) ) - { - com::sun::star::lang::Locale eLocale; - if ( mAny >>= eLocale ) - meCharLocale = eLocale; - } - - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharRelief" ) ), bGetPropStateValue ) ) - { - sal_Int16 nVal; - mAny >>= nVal; - if ( nVal != ::com::sun::star::text::FontRelief::NONE ) - mnCharAttr |= 512; - } - if ( ePropState == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) - mnCharAttrHard |= 512; - - mnCharHeight = 24; - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharHeight" ) ), bGetPropStateValue ) ) - { - float fVal; - mAny >>= fVal; - mnCharHeight = (sal_uInt16)( fVal + 0.5 ); - } - meCharHeight = ePropState; - - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharColor" ) ), bGetPropStateValue ) ) - { - sal_uInt32 nSOColor = *( (sal_uInt32*)mAny.getValue() ); - mnCharColor = nSOColor & 0xff00ff00; // green and hibyte - mnCharColor |= (sal_uInt8)( nSOColor ) << 16; // red and blue is switched - mnCharColor |= (sal_uInt8)( nSOColor >> 16 ); - } - meCharColor = ePropState; - - mnCharEscapement = 0; - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CharEscapement" ) ), bGetPropStateValue ) ) - { - mAny >>= mnCharEscapement; - if ( mnCharEscapement > 100 ) - mnCharEscapement = 33; - else if ( mnCharEscapement < -100 ) - mnCharEscapement = -33; - } - meCharEscapement = ePropState; -} - -void PortionObj::ImplClear() -{ - delete (FieldEntry*)mpFieldEntry; - delete[] mpText; -} - -void PortionObj::ImplConstruct( PortionObj& rPortionObj ) -{ - mbLastPortion = rPortionObj.mbLastPortion; - mnTextSize = rPortionObj.mnTextSize; - mnCharColor = rPortionObj.mnCharColor; - mnCharEscapement = rPortionObj.mnCharEscapement; - mnCharAttr = rPortionObj.mnCharAttr; - mnCharHeight = rPortionObj.mnCharHeight; - mnFont = rPortionObj.mnFont; - mnAsianOrComplexFont = rPortionObj.mnAsianOrComplexFont; - - if ( rPortionObj.mpText ) - { - mpText = new sal_uInt16[ mnTextSize ]; - memcpy( mpText, rPortionObj.mpText, mnTextSize << 1 ); - } - else - mpText = NULL; - - if ( rPortionObj.mpFieldEntry ) - mpFieldEntry = new FieldEntry( *( rPortionObj.mpFieldEntry ) ); - else - mpFieldEntry = NULL; -} - -sal_uInt32 PortionObj::ImplCalculateTextPositions( sal_uInt32 nCurrentTextPosition ) -{ - if ( mpFieldEntry && ( !mpFieldEntry->nFieldStartPos ) ) - { - mpFieldEntry->nFieldStartPos += nCurrentTextPosition; - mpFieldEntry->nFieldEndPos += nCurrentTextPosition; - } - return mnTextSize; -} - -// ----------------------------------------------------------------------- -// Rueckgabe: 0 = kein TextField -// bit28->31 text field type : -// 1 = Date -// 2 = Time -// 3 = SlideNumber -// 4 = Url -// 5 = DateTime -// 6 = header -// 7 = footer -// bit24->27 text field sub type (optional) -// 23-> PPT Textfield needs a placeholder - -sal_uInt32 PortionObj::ImplGetTextField( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > & , - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, String& rURL ) -{ - sal_uInt32 nRetValue = 0; - sal_Int32 nFormat; - ::com::sun::star::uno::Any aAny; - if ( GetPropertyValue( aAny, rXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "TextPortionType" ) ), sal_True ) ) - { - String aTextFieldType( *(::rtl::OUString*)aAny.getValue() ); - if ( aTextFieldType == String( RTL_CONSTASCII_USTRINGPARAM( "TextField" ) ) ) - { - if ( GetPropertyValue( aAny, rXPropSet, aTextFieldType, sal_True ) ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextField > aXTextField; - if ( aAny >>= aXTextField ) - { - if ( aXTextField.is() ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > - xFieldPropSet( aXTextField, ::com::sun::star::uno::UNO_QUERY ); - if ( xFieldPropSet.is() ) - { - String aFieldKind( aXTextField->getPresentation( TRUE ) ); - if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "Date" ) ) ) - { - if ( GetPropertyValue( aAny, xFieldPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsFix" ) ) ), sal_True ) - { - sal_Bool bBool; - aAny >>= bBool; - if ( !bBool ) // Fixed DateFields gibt es in PPT nicht - { - if ( GetPropertyValue( aAny, xFieldPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Format" ) ) ), sal_True ) - { - nFormat = *(sal_Int32*)aAny.getValue(); - switch ( nFormat ) - { - default: - case 5 : - case 4 : - case 2 : nFormat = 0; break; - case 8 : - case 9 : - case 3 : nFormat = 1; break; - case 7 : - case 6 : nFormat = 2; break; - } - nRetValue |= ( ( ( 1 << 4 ) | nFormat ) << 24 ) | 0x800000; - } - } - } - } - else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "URL" ) ) ) - { - if ( GetPropertyValue( aAny, xFieldPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "URL" ) ) ), sal_True ) - rURL = String( *(::rtl::OUString*)aAny.getValue() ); - nRetValue = 4 << 28; - } - else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "Page" ) ) ) - { - nRetValue = 3 << 28 | 0x800000; - } - else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "Pages" ) ) ) - { - - } - else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "Time" ) ) ) - { - if ( GetPropertyValue( aAny, xFieldPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsFix" ) ) ), sal_True ) - { - sal_Bool bBool; - aAny >>= bBool; - if ( !bBool ) - { - if ( GetPropertyValue( aAny, xFieldPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsFix" ) ) ), sal_True ) - { - nFormat = *(sal_Int32*)aAny.getValue(); - nRetValue |= ( ( ( 2 << 4 ) | nFormat ) << 24 ) | 0x800000; - } - } - } - } - else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "File" ) ) ) - { - - } - else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "Table" ) ) ) - { - - } - else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "ExtTime" ) ) ) - { - if ( GetPropertyValue( aAny, xFieldPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "IsFix" ) ) ), sal_True ) - { - sal_Bool bBool; - aAny >>= bBool; - if ( !bBool ) - { - if ( GetPropertyValue( aAny, xFieldPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "Format" ) ) ), sal_True ) - { - nFormat = *(sal_Int32*)aAny.getValue(); - switch ( nFormat ) - { - default: - case 6 : - case 7 : - case 8 : - case 2 : nFormat = 12; break; - case 3 : nFormat = 9; break; - case 5 : - case 4 : nFormat = 10; break; - - } - nRetValue |= ( ( ( 2 << 4 ) | nFormat ) << 24 ) | 0x800000; - } - } - } - } - else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "ExtFile" ) ) ) - { - - } - else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "Author" ) ) ) - { - - } - else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "DateTime" ) ) ) - { - nRetValue = 5 << 28 | 0x800000; - } - else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "Header" ) ) ) - { - nRetValue = 6 << 28 | 0x800000; - } - else if ( aFieldKind == String( RTL_CONSTASCII_USTRINGPARAM( "Footer" ) ) ) - { - nRetValue = 7 << 28 | 0x800000; - } - } - } - } - } - } - } - return nRetValue; -} - -PortionObj& PortionObj::operator=( PortionObj& rPortionObj ) -{ - if ( this != &rPortionObj ) - { - ImplClear(); - ImplConstruct( rPortionObj ); - } - return *this; -} - -// ----------------------------------------------------------------------- - -ParagraphObj::ParagraphObj( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, - PPTExBulletProvider& rProv ) : - maMapModeSrc ( MAP_100TH_MM ), - maMapModeDest ( MAP_INCH, Point(), Fraction( 1, 576 ), Fraction( 1, 576 ) ) -{ - mXPropSet = rXPropSet; - - bExtendedParameters = FALSE; - - nDepth = 0; - nBulletFlags = 0; - nParaFlags = 0; - - ImplGetParagraphValues( rProv, FALSE ); -} - - ParagraphObj::ParagraphObj( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > & rXTextContent, - ParaFlags aParaFlags, FontCollection& rFontCollection, PPTExBulletProvider& rProv ) : - maMapModeSrc ( MAP_100TH_MM ), - maMapModeDest ( MAP_INCH, Point(), Fraction( 1, 576 ), Fraction( 1, 576 ) ), - mbFirstParagraph ( aParaFlags.bFirstParagraph ), - mbLastParagraph ( aParaFlags.bLastParagraph ) -{ - bExtendedParameters = FALSE; - - nDepth = 0; - nBulletFlags = 0; - nParaFlags = 0; - - mXPropSet = ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet > - ( rXTextContent, ::com::sun::star::uno::UNO_QUERY ); - - mXPropState = ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertyState > - ( rXTextContent, ::com::sun::star::uno::UNO_QUERY ); - - if ( mXPropSet.is() && mXPropState.is() ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumerationAccess > - aXTextPortionEA( rXTextContent, ::com::sun::star::uno::UNO_QUERY ); - if ( aXTextPortionEA.is() ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > - aXTextPortionE( aXTextPortionEA->createEnumeration() ); - if ( aXTextPortionE.is() ) - { - while ( aXTextPortionE->hasMoreElements() ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > aXCursorText; - ::com::sun::star::uno::Any aAny( aXTextPortionE->nextElement() ); - if ( aAny >>= aXCursorText ) - { - PortionObj* pPortionObj = new PortionObj( aXCursorText, !aXTextPortionE->hasMoreElements(), rFontCollection ); - if ( pPortionObj->Count() ) - Insert( pPortionObj, LIST_APPEND ); - else - delete pPortionObj; - } - } - } - } - ImplGetParagraphValues( rProv, TRUE );// - } -} - -ParagraphObj::ParagraphObj( ParagraphObj& rObj ) -: List() -, PropStateValue() -, SOParagraph() -{ - ImplConstruct( rObj ); -} - -ParagraphObj::~ParagraphObj() -{ - ImplClear(); -} - -void ParagraphObj::Write( SvStream* pStrm ) -{ - for ( void* pPtr = First(); pPtr; pPtr = Next() ) - ((PortionObj*)pPtr)->Write( pStrm, mbLastParagraph ); -} - -void ParagraphObj::ImplClear() -{ - for ( void* pPtr = First(); pPtr; pPtr = Next() ) - delete (PortionObj*)pPtr; -} - -void ParagraphObj::CalculateGraphicBulletSize( sal_uInt16 nFontHeight ) -{ - if ( ( (SvxExtNumType)nNumberingType == SVX_NUM_BITMAP ) && ( nBulletId != 0xffff ) ) - { - // calculate the bulletrealsize for this grafik - if ( aBuGraSize.Width() && aBuGraSize.Height() ) - { - double fCharHeight = nFontHeight; - double fLen = aBuGraSize.Height(); - fCharHeight = fCharHeight * 0.2540; - double fQuo = fLen / fCharHeight; - nBulletRealSize = (sal_Int16)( fQuo + 0.5 ); - if ( (sal_uInt16)nBulletRealSize > 400 ) - nBulletRealSize = 400; - } - } -} - -// from sw/source/filter/ww8/wrtw8num.cxx for default bullets to export to MS intact -static void lcl_SubstituteBullet(String& rNumStr, rtl_TextEncoding& rChrSet, String& rFontName) -{ - StarSymbolToMSMultiFont *pConvert = 0; - FontFamily eFamily = FAMILY_DECORATIVE; - - if (!pConvert) - { - pConvert = CreateStarSymbolToMSMultiFont(); - } - sal_Unicode cChar = rNumStr.GetChar(0); - String sFont = pConvert->ConvertChar(cChar); - if (sFont.Len()) - { - rNumStr = static_cast< sal_Unicode >(cChar | 0xF000); - rFontName = sFont; - rChrSet = RTL_TEXTENCODING_SYMBOL; - } - else if ( (rNumStr.GetChar(0) < 0xE000 || rNumStr.GetChar(0) > 0xF8FF) ) - { - /* - Ok we can't fit into a known windows unicode font, but - we are not in the private area, so we are a - standardized symbol, so turn off the symbol bit and - let words own font substitution kick in - */ - rChrSet = RTL_TEXTENCODING_UNICODE; - eFamily = FAMILY_SWISS; - rFontName = ::GetFontToken(rFontName, 0); - } - else - { - /* - Well we don't have an available substition, and we're - in our private area, so give up and show a standard - bullet symbol - */ - rFontName.AssignAscii(RTL_CONSTASCII_STRINGPARAM("Wingdings")); - rNumStr = static_cast< sal_Unicode >(0x6C); - } - delete pConvert; -} - -void ParagraphObj::ImplGetNumberingLevel( PPTExBulletProvider& rBuProv, sal_Int16 nNumberingDepth, sal_Bool bIsBullet, sal_Bool bGetPropStateValue ) -{ - ::com::sun::star::uno::Any aAny; - if ( GetPropertyValue( aAny, mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "ParaLeftMargin" ) ) ) ) - { - sal_Int32 nVal; - if ( aAny >>= nVal ) - nTextOfs = static_cast< sal_Int16 >( nVal / ( 2540.0 / 576 ) + 0.5 ) ; - } - if ( GetPropertyValue( aAny, mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "ParaFirstLineIndent" ) ) ) ) - { - if ( aAny >>= nBulletOfs ) - nBulletOfs = static_cast< sal_Int32 >( nBulletOfs / ( 2540.0 / 576 ) + 0.5 ); - } - if ( GetPropertyValue( aAny, mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "NumberingIsNumber" ) ) ) ) - aAny >>= bNumberingIsNumber; - - ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexReplace > aXIndexReplace; - - if ( bIsBullet && ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "NumberingRules" ) ), bGetPropStateValue ) ) - { - if ( ( mAny >>= aXIndexReplace ) && nNumberingDepth < aXIndexReplace->getCount() ) - { - mAny <<= aXIndexReplace->getByIndex( nNumberingDepth ); - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue> - aPropertySequence( *( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>*)mAny.getValue() ); - - const ::com::sun::star::beans::PropertyValue* pPropValue = aPropertySequence.getArray(); - - sal_Int32 nPropertyCount = aPropertySequence.getLength(); - if ( nPropertyCount ) - { - bExtendedParameters = TRUE; - nBulletRealSize = 100; - nMappedNumType = 0; - - String aGraphicURL; - for ( sal_Int32 i = 0; i < nPropertyCount; i++ ) - { - const void* pValue = pPropValue[ i ].Value.getValue(); - if ( pValue ) - { - ::rtl::OUString aPropName( pPropValue[ i ].Name ); - if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "NumberingType" ) ) ) - nNumberingType = *( (sal_Int16*)pValue ); - else if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Adjust" ) ) ) - nHorzAdjust = *( (sal_Int16*)pValue ); - else if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "BulletChar" ) ) ) - { - String aString( *( (String*)pValue ) ); - if ( aString.Len() ) - cBulletId = aString.GetChar( 0 ); - } - else if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "BulletFont" ) ) ) - { - aFontDesc = *( (::com::sun::star::awt::FontDescriptor*)pValue ); - - // Our numbullet dialog has set the wrong textencoding for our "StarSymbol" font, - // instead of a Unicode encoding the encoding RTL_TEXTENCODING_SYMBOL was used. - // Because there might exist a lot of damaged documemts I added this two lines - // which fixes the bullet problem for the export. - if ( aFontDesc.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "StarSymbol" ) ) ) - aFontDesc.CharSet = RTL_TEXTENCODING_MS_1252; - - } - else if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "GraphicURL" ) ) ) - aGraphicURL = ( *(::rtl::OUString*)pValue ); - else if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "GraphicSize" ) ) ) - { - if ( pPropValue[ i ].Value.getValueType() == ::getCppuType( (::com::sun::star::awt::Size*)0) ) - { - // don't cast awt::Size to Size as on 64-bits they are not the same. - ::com::sun::star::awt::Size aSize; - pPropValue[ i ].Value >>= aSize; - aBuGraSize.nA = aSize.Width; - aBuGraSize.nB = aSize.Height; - } - } - else if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "StartWith" ) ) ) - nStartWith = *( (sal_Int16*)pValue ); - else if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "LeftMargin" ) ) ) - nTextOfs = nTextOfs + static_cast< sal_Int16 >( *( (sal_Int32*)pValue ) / ( 2540.0 / 576 ) ); - else if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FirstLineOffset" ) ) ) - nBulletOfs += (sal_Int16)( *( (sal_Int32*)pValue ) / ( 2540.0 / 576 ) ); - else if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "BulletColor" ) ) ) - { - sal_uInt32 nSOColor = *( (sal_uInt32*)pValue ); - nBulletColor = nSOColor & 0xff00ff00; // green and hibyte - nBulletColor |= (sal_uInt8)( nSOColor ) << 16; // red - nBulletColor |= (sal_uInt8)( nSOColor >> 16 ) | 0xfe000000; // blue - } - else if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "BulletRelSize" ) ) ) - { - nBulletRealSize = *( (sal_Int16*)pValue ); - nParaFlags |= 0x40; - nBulletFlags |= 8; - } - else if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Prefix" ) ) ) - sPrefix = ( *(::rtl::OUString*)pValue ); - else if ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Suffix" ) ) ) - sSuffix = ( *(::rtl::OUString*)pValue ); -#ifdef DBG_UTIL - else if ( ! ( - ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "SymbolTextDistance" ) ) ) - || ( aPropName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Graphic" ) ) ) ) ) - { - DBG_ERROR( "Unbekanntes Property" ); - } -#endif - } - } - - if ( aGraphicURL.Len() ) - { - if ( aBuGraSize.Width() && aBuGraSize.Height() ) - { - xub_StrLen nIndex = aGraphicURL.Search( (sal_Unicode)':', 0 ); - if ( nIndex != STRING_NOTFOUND ) - { - nIndex++; - if ( aGraphicURL.Len() > nIndex ) - { - ByteString aUniqueId( aGraphicURL, nIndex, aGraphicURL.Len() - nIndex, RTL_TEXTENCODING_UTF8 ); - if ( aUniqueId.Len() ) - { - nBulletId = rBuProv.GetId( aUniqueId, aBuGraSize ); - if ( nBulletId != 0xffff ) - bExtendedBulletsUsed = TRUE; - } - } - } - } - else - { - nNumberingType = SVX_NUM_NUMBER_NONE; - } - } - - PortionObj* pPortion = (PortionObj*)First(); - CalculateGraphicBulletSize( ( pPortion ) ? pPortion->mnCharHeight : 24 ); - - switch( (SvxExtNumType)nNumberingType ) - { - case SVX_NUM_NUMBER_NONE : nParaFlags |= 0xf; break; - - case SVX_NUM_CHAR_SPECIAL : // Bullet - { - if ( aFontDesc.Name.equalsIgnoreAsciiCaseAscii("starsymbol") || - aFontDesc.Name.equalsIgnoreAsciiCaseAscii("opensymbol") ) - { - String sFontName = aFontDesc.Name; - String sNumStr = cBulletId; - rtl_TextEncoding eChrSet = aFontDesc.CharSet; - lcl_SubstituteBullet(sNumStr,eChrSet,sFontName); - aFontDesc.Name = sFontName; - cBulletId = sNumStr.GetChar( 0 ); - aFontDesc.CharSet = eChrSet; - } - - if ( aFontDesc.Name.getLength() ) - { -/* - if ( aFontDesc.CharSet != ::com::sun::star::awt::CharSet::SYMBOL ) - { - switch ( cBulletId ) - { - // Currency - case 128: cBulletId = 0x20AC; break; - // Punctuation and other - case 130: cBulletId = 0x201A; break;// SINGLE LOW-9 QUOTATION MARK - case 131: cBulletId = 0x0192; break;// LATIN SMALL LETTER F WITH HOOK - case 132: cBulletId = 0x201E; break;// DOUBLE LOW-9 QUOTATION MARK - // LOW DOUBLE PRIME QUOTATION MARK - case 133: cBulletId = 0x2026; break;// HORIZONTAL ELLIPSES - case 134: cBulletId = 0x2020; break;// DAGGER - case 135: cBulletId = 0x2021; break;// DOUBLE DAGGER - case 136: cBulletId = 0x02C6; break;// MODIFIER LETTER CIRCUMFLEX ACCENT - case 137: cBulletId = 0x2030; break;// PER MILLE SIGN - case 138: cBulletId = 0x0160; break;// LATIN CAPITAL LETTER S WITH CARON - case 139: cBulletId = 0x2039; break;// SINGLE LEFT-POINTING ANGLE QUOTATION MARK - case 140: cBulletId = 0x0152; break;// LATIN CAPITAL LIGATURE OE - case 142: cBulletId = 0x017D; break;// LATIN CAPITAL LETTER Z WITH CARON - case 145: cBulletId = 0x2018; break;// LEFT SINGLE QUOTATION MARK - // MODIFIER LETTER TURNED COMMA - case 146: cBulletId = 0x2019; break;// RIGHT SINGLE QUOTATION MARK - // MODIFIER LETTER APOSTROPHE - case 147: cBulletId = 0x201C; break;// LEFT DOUBLE QUOTATION MARK - // REVERSED DOUBLE PRIME QUOTATION MARK - case 148: cBulletId = 0x201D; break;// RIGHT DOUBLE QUOTATION MARK - // REVERSED DOUBLE PRIME QUOTATION MARK - case 149: cBulletId = 0x2022; break;// BULLET - case 150: cBulletId = 0x2013; break;// EN DASH - case 151: cBulletId = 0x2014; break;// EM DASH - case 152: cBulletId = 0x02DC; break;// SMALL TILDE - case 153: cBulletId = 0x2122; break;// TRADE MARK SIGN - case 154: cBulletId = 0x0161; break;// LATIN SMALL LETTER S WITH CARON - case 155: cBulletId = 0x203A; break;// SINGLE RIGHT-POINTING ANGLE QUOTATION MARK - case 156: cBulletId = 0x0153; break;// LATIN SMALL LIGATURE OE - case 158: cBulletId = 0x017E; break;// LATIN SMALL LETTER Z WITH CARON - case 159: cBulletId = 0x0178; break;// LATIN CAPITAL LETTER Y WITH DIAERESIS -// case 222: cBulletId = 0x00B6; break;// PILCROW SIGN / PARAGRAPH SIGN - } - } -*/ - nParaFlags |= 0x90; // wir geben den Font und den Charset vor - } - } - case SVX_NUM_CHARS_UPPER_LETTER : // zaehlt von a-z, aa - az, ba - bz, ... - case SVX_NUM_CHARS_LOWER_LETTER : - case SVX_NUM_ROMAN_UPPER : - case SVX_NUM_ROMAN_LOWER : - case SVX_NUM_ARABIC : - case SVX_NUM_PAGEDESC : // Numerierung aus der Seitenvorlage - case SVX_NUM_BITMAP : - case SVX_NUM_CHARS_UPPER_LETTER_N : // zaehlt von a-z, aa-zz, aaa-zzz - case SVX_NUM_CHARS_LOWER_LETTER_N : - { - if ( nNumberingType != SVX_NUM_CHAR_SPECIAL ) - { - bExtendedBulletsUsed = TRUE; - if ( nNumberingDepth & 1 ) - cBulletId = 0x2013; // defaulting bullet characters for ppt97 - else if ( nNumberingDepth == 4 ) - cBulletId = 0xbb; - else - cBulletId = 0x2022; - - switch( (SvxExtNumType)nNumberingType ) - { - case SVX_NUM_CHARS_UPPER_LETTER : - case SVX_NUM_CHARS_UPPER_LETTER_N : - { - if ( sSuffix == String( RTL_CONSTASCII_USTRINGPARAM( ")" ) ) ) - { - if ( sPrefix == String( RTL_CONSTASCII_USTRINGPARAM( "(" ) ) ) - nMappedNumType = 0xa0001; // (A) - else - nMappedNumType = 0xb0001; // A) - } - else - nMappedNumType = 0x10001; // A. - } - break; - case SVX_NUM_CHARS_LOWER_LETTER : - case SVX_NUM_CHARS_LOWER_LETTER_N : - { - if ( sSuffix == String( RTL_CONSTASCII_USTRINGPARAM( ")" ) ) ) - { - if ( sPrefix == String( RTL_CONSTASCII_USTRINGPARAM( "(" ) ) ) - nMappedNumType = 0x80001; // (a) - else - nMappedNumType = 0x90001; // a) - } - else - nMappedNumType = 0x00001; // a. - } - break; - case SVX_NUM_ROMAN_UPPER : - { - if ( sSuffix == String( RTL_CONSTASCII_USTRINGPARAM( ")" ) ) ) - { - if ( sPrefix == String( RTL_CONSTASCII_USTRINGPARAM( "(" ) ) ) - nMappedNumType = 0xe0001; // (I) - else - nMappedNumType = 0xf0001; // I) - } - else - nMappedNumType = 0x70001; // I. - } - break; - case SVX_NUM_ROMAN_LOWER : - { - if ( sSuffix == String( RTL_CONSTASCII_USTRINGPARAM( ")" ) ) ) - { - if ( sPrefix == String( RTL_CONSTASCII_USTRINGPARAM( "(" ) ) ) - nMappedNumType = 0x40001; // (i) - else - nMappedNumType = 0x50001; // i) - } - else - nMappedNumType = 0x60001; // i. - } - break; - case SVX_NUM_ARABIC : - { - if ( sSuffix == String( RTL_CONSTASCII_USTRINGPARAM( ")" ) ) ) - { - if ( sPrefix == String( RTL_CONSTASCII_USTRINGPARAM( "(" ) ) ) - nMappedNumType = 0xc0001; // (1) - else - nMappedNumType = 0x20001; // 1) - } - else - { - if ( ! ( sSuffix.Len() + sPrefix.Len() ) ) - nMappedNumType = 0xd0001; // 1 - else - nMappedNumType = 0x30001; // 1. - } - } - break; - default: - break; - } - } - nParaFlags |= 0x2f; - nBulletFlags |= 6; - if ( mbIsBullet && bNumberingIsNumber ) - nBulletFlags |= 1; - } - } - } - } - } - nBulletOfs = nTextOfs + nBulletOfs; - if ( nBulletOfs < 0 ) - nBulletOfs = 0; -} - -void ParagraphObj::ImplGetParagraphValues( PPTExBulletProvider& rBuProv, sal_Bool bGetPropStateValue ) -{ - static String sNumberingLevel ( RTL_CONSTASCII_USTRINGPARAM( "NumberingLevel" ) ); - - ::com::sun::star::uno::Any aAny; - if ( GetPropertyValue( aAny, mXPropSet, sNumberingLevel, sal_True ) ) - { - if ( bGetPropStateValue ) - meBullet = GetPropertyState( mXPropSet, sNumberingLevel ); - nDepth = *( (sal_Int16*)aAny.getValue() ); - - if ( nDepth < 0 ) - { - mbIsBullet = sal_False; - nDepth = 0; - } - else - { - if ( nDepth > 4 ) - nDepth = 4; - mbIsBullet = sal_True; - } - } - else - { - nDepth = 0; - mbIsBullet = sal_False; - } - ImplGetNumberingLevel( rBuProv, nDepth, mbIsBullet, bGetPropStateValue ); - - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "ParaTabStops" ) ), bGetPropStateValue ) ) - maTabStop = *( ::com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop>*)mAny.getValue(); - sal_Int16 eTextAdjust( ::com::sun::star::style::ParagraphAdjust_LEFT ); - if ( GetPropertyValue( aAny, mXPropSet, String( RTL_CONSTASCII_USTRINGPARAM( "ParaAdjust" ) ), bGetPropStateValue ) ) - aAny >>= eTextAdjust; - switch ( (::com::sun::star::style::ParagraphAdjust)eTextAdjust ) - { - case ::com::sun::star::style::ParagraphAdjust_CENTER : - mnTextAdjust = 1; - break; - case ::com::sun::star::style::ParagraphAdjust_RIGHT : - mnTextAdjust = 2; - break; - case ::com::sun::star::style::ParagraphAdjust_BLOCK : - mnTextAdjust = 3; - break; - default : - case ::com::sun::star::style::ParagraphAdjust_LEFT : - mnTextAdjust = 0; - break; - } - meTextAdjust = ePropState; - - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "ParaLineSpacing" ) ), bGetPropStateValue ) ) - { - ::com::sun::star::style::LineSpacing aLineSpacing - = *( (::com::sun::star::style::LineSpacing*)mAny.getValue() ); - switch ( aLineSpacing.Mode ) - { - case ::com::sun::star::style::LineSpacingMode::FIX : - mnLineSpacing = (sal_Int16)(-( aLineSpacing.Height ) ); - mbFixedLineSpacing = TRUE; - break; - case ::com::sun::star::style::LineSpacingMode::MINIMUM : - case ::com::sun::star::style::LineSpacingMode::LEADING : - mnLineSpacing = (sal_Int16)(-( aLineSpacing.Height ) ); - mbFixedLineSpacing = FALSE; - break; - - case ::com::sun::star::style::LineSpacingMode::PROP : - default: - mnLineSpacing = (sal_Int16)( aLineSpacing.Height ); - break; - } - } - meLineSpacing = ePropState; - - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "ParaBottomMargin" ) ), bGetPropStateValue ) ) - { - double fSpacing = *( (sal_uInt32*)mAny.getValue() ) + ( 2540.0 / 576.0 ) - 1; - mnLineSpacingBottom = (sal_Int16)(-( fSpacing * 576.0 / 2540.0 ) ); - } - meLineSpacingBottom = ePropState; - - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "ParaTopMargin" ) ), bGetPropStateValue ) ) - { - double fSpacing = *( (sal_uInt32*)mAny.getValue() ) + ( 2540.0 / 576.0 ) - 1; - mnLineSpacingTop = (sal_Int16)(-( fSpacing * 576.0 / 2540.0 ) ); - } - meLineSpacingTop = ePropState; - - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "ParaIsForbiddenRules" ) ), bGetPropStateValue ) ) - mAny >>= mbForbiddenRules; - meForbiddenRules = ePropState; - - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "ParaIsHangingPunctuation" ) ), bGetPropStateValue ) ) - mAny >>= mbParagraphPunctation; - meParagraphPunctation = ePropState; - - mnBiDi = 0; - if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "WritingMode" ) ), bGetPropStateValue ) ) - { - sal_Int16 nWritingMode; - mAny >>= nWritingMode; - - SvxFrameDirection eWritingMode( (SvxFrameDirection)nWritingMode ); - if ( ( eWritingMode == FRMDIR_HORI_RIGHT_TOP ) - || ( eWritingMode == FRMDIR_VERT_TOP_RIGHT ) ) - { - mnBiDi = 1; - } - } - meBiDi = ePropState; -} - -void ParagraphObj::ImplConstruct( ParagraphObj& rParagraphObj ) -{ - mnTextSize = rParagraphObj.mnTextSize; - mnTextAdjust = rParagraphObj.mnTextAdjust; - mnLineSpacing = rParagraphObj.mnLineSpacing; - mnLineSpacingTop = rParagraphObj.mnLineSpacingTop; - mnLineSpacingBottom = rParagraphObj.mnLineSpacingBottom; - mbFirstParagraph = rParagraphObj.mbFirstParagraph; - mbLastParagraph = rParagraphObj.mbLastParagraph; - mbParagraphPunctation = rParagraphObj.mbParagraphPunctation; - mbForbiddenRules = rParagraphObj.mbForbiddenRules; - mnBiDi = rParagraphObj.mnBiDi; - - for ( void* pPtr = rParagraphObj.First(); pPtr; pPtr = rParagraphObj.Next() ) - Insert( new PortionObj( *(PortionObj*)pPtr ), LIST_APPEND ); - - maTabStop = rParagraphObj.maTabStop; - bExtendedParameters = rParagraphObj.bExtendedParameters; - nParaFlags = rParagraphObj.nParaFlags; - nBulletFlags = rParagraphObj.nBulletFlags; - sPrefix = rParagraphObj.sPrefix; - sSuffix = rParagraphObj.sSuffix; - sGraphicUrl = rParagraphObj.sGraphicUrl; // String auf eine Graphic - aBuGraSize = rParagraphObj.aBuGraSize; - nNumberingType = rParagraphObj.nNumberingType; // in wirlichkeit ist dies ein SvxEnum - nHorzAdjust = rParagraphObj.nHorzAdjust; - nBulletColor = rParagraphObj.nBulletColor; - nBulletOfs = rParagraphObj.nBulletOfs; - nStartWith = rParagraphObj.nStartWith; // Start der nummerierung - nTextOfs = rParagraphObj.nTextOfs; - nBulletRealSize = rParagraphObj.nBulletRealSize; // GroessenVerhaeltnis in Proz - nDepth = rParagraphObj.nDepth; // aktuelle tiefe - cBulletId = rParagraphObj.cBulletId; // wenn Numbering Type == CharSpecial - aFontDesc = rParagraphObj.aFontDesc; - - bExtendedBulletsUsed = rParagraphObj.bExtendedBulletsUsed; - nBulletId = rParagraphObj.nBulletId; -} - -::com::sun::star::awt::Size ParagraphObj::ImplMapSize( const ::com::sun::star::awt::Size& rSize ) -{ - Size aSize( OutputDevice::LogicToLogic( Size( rSize.Width, rSize.Height ), maMapModeSrc, maMapModeDest ) ); - if ( !aSize.Width() ) - aSize.Width()++; - if ( !aSize.Height() ) - aSize.Height()++; - return ::com::sun::star::awt::Size( aSize.Width(), aSize.Height() ); -} - -sal_uInt32 ParagraphObj::ImplCalculateTextPositions( sal_uInt32 nCurrentTextPosition ) -{ - mnTextSize = 0; - for ( void* pPtr = First(); pPtr; pPtr = Next() ) - mnTextSize += ((PortionObj*)pPtr)->ImplCalculateTextPositions( nCurrentTextPosition + mnTextSize ); - return mnTextSize; -} - -ParagraphObj& ParagraphObj::operator=( ParagraphObj& rParagraphObj ) -{ - if ( this != &rParagraphObj ) - { - ImplClear(); - ImplConstruct( rParagraphObj ); - } - return *this; -} - -// ----------------------------------------------------------------------- - -ImplTextObj::ImplTextObj( int nInstance ) -{ - mnRefCount = 1; - mnTextSize = 0; - mnInstance = nInstance; - mpList = new List; - mbHasExtendedBullets = FALSE; - mbFixedCellHeightUsed = FALSE; -} - -ImplTextObj::~ImplTextObj() -{ - for ( ParagraphObj* pPtr = (ParagraphObj*)mpList->First(); pPtr; pPtr = (ParagraphObj*)mpList->Next() ) - delete pPtr; - delete mpList; -} - -TextObj::TextObj( ::com::sun::star::uno::Reference< ::com::sun::star::text::XSimpleText > & rXTextRef, - int nInstance, FontCollection& rFontCollection, PPTExBulletProvider& rProv ) -{ - mpImplTextObj = new ImplTextObj( nInstance ); - - ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumerationAccess > - aXTextParagraphEA( rXTextRef, ::com::sun::star::uno::UNO_QUERY ); - - if ( aXTextParagraphEA.is() ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > - aXTextParagraphE( aXTextParagraphEA->createEnumeration() ); - if ( aXTextParagraphE.is() ) - { - ParaFlags aParaFlags; - while ( aXTextParagraphE->hasMoreElements() ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > aXParagraph; - ::com::sun::star::uno::Any aAny( aXTextParagraphE->nextElement() ); - if ( aAny >>= aXParagraph ) - { - if ( !aXTextParagraphE->hasMoreElements() ) - aParaFlags.bLastParagraph = TRUE; - ParagraphObj* pPara = new ParagraphObj( aXParagraph, aParaFlags, rFontCollection, rProv ); - mpImplTextObj->mbHasExtendedBullets |= pPara->bExtendedBulletsUsed; - mpImplTextObj->mpList->Insert( pPara, LIST_APPEND ); - aParaFlags.bFirstParagraph = FALSE; - } - } - } - } - ImplCalculateTextPositions(); -} - -TextObj::TextObj( TextObj& rTextObj ) -{ - mpImplTextObj = rTextObj.mpImplTextObj; - mpImplTextObj->mnRefCount++; -} - -TextObj::~TextObj() -{ - if ( ! ( --mpImplTextObj->mnRefCount ) ) - delete mpImplTextObj; -} - -void TextObj::Write( SvStream* pStrm ) -{ - sal_uInt32 nSize, nPos = pStrm->Tell(); - *pStrm << (sal_uInt32)( EPP_TextCharsAtom << 16 ) << (sal_uInt32)0; - for ( void* pPtr = First(); pPtr; pPtr = Next() ) - ((ParagraphObj*)pPtr)->Write( pStrm ); - nSize = pStrm->Tell() - nPos; - pStrm->SeekRel( - ( (sal_Int32)nSize - 4 ) ); - *pStrm << (sal_uInt32)( nSize - 8 ); - pStrm->SeekRel( nSize - 8 ); -} - -void TextObj::ImplCalculateTextPositions() -{ - mpImplTextObj->mnTextSize = 0; - for ( void* pPtr = First(); pPtr; pPtr = Next() ) - mpImplTextObj->mnTextSize += ((ParagraphObj*)pPtr)->ImplCalculateTextPositions( mpImplTextObj->mnTextSize ); -} - -TextObj& TextObj::operator=( TextObj& rTextObj ) -{ - if ( this != &rTextObj ) - { - if ( ! ( --mpImplTextObj->mnRefCount ) ) - delete mpImplTextObj; - mpImplTextObj = rTextObj.mpImplTextObj; - mpImplTextObj->mnRefCount++; - } - return *this; -} - -void TextObj::WriteTextSpecInfo( SvStream* pStrm ) -{ - sal_uInt32 nCharactersLeft( Count() ); - if ( nCharactersLeft >= 1 ) - { - EscherExAtom aAnimationInfoAtom( *pStrm, EPP_TextSpecInfoAtom, 0, 0 ); - for ( ParagraphObj* pPtr = static_cast < ParagraphObj * >( First() ); nCharactersLeft && pPtr; pPtr = static_cast< ParagraphObj* >( Next() ) ) - { - for ( PortionObj* pPortion = static_cast< PortionObj* >( pPtr->First() ); nCharactersLeft && pPortion; pPortion = static_cast< PortionObj* >( pPtr->Next() ) ) - { - sal_Int32 nPortionSize = pPortion->mnTextSize >= nCharactersLeft ? nCharactersLeft : pPortion->mnTextSize; - sal_Int32 nFlags = 7; - nCharactersLeft -= nPortionSize; - *pStrm << static_cast< sal_uInt32 >( nPortionSize ) - << nFlags - << static_cast< sal_Int16 >( 1 ) // spellinfo -> needs rechecking - << static_cast< sal_Int16 >( MsLangId::convertLocaleToLanguageWithFallback( pPortion->meCharLocale ) ) - << static_cast< sal_Int16 >( 0 ); // alt language - } - } - if ( nCharactersLeft ) - *pStrm << nCharactersLeft << static_cast< sal_Int32 >( 1 ) << static_cast< sal_Int16 >( 1 ); - - } -} - -// ----------------------------------------------------------------------- - void PPTWriter::ImplAdjustFirstLineLineSpacing( TextObj& rTextObj, EscherPropertyContainer& rPropOpt ) { if ( !mbFontIndependentLineSpacing ) @@ -3160,7 +1207,7 @@ void PPTWriter::ImplWriteTextStyleAtom( SvStream& rOut, int nTextInstance, sal_u if ( !mbEmptyPresObj ) { ParagraphObj* pPara; - TextObj aTextObj( mXText, nTextInstance, maFontCollection, (PPTExBulletProvider&)*this ); + TextObjBinary aTextObj( mXText, nTextInstance, maFontCollection, (PPTExBulletProvider&)*this ); // leaving out EPP_TextCharsAtom w/o text - still write out // attribute info though @@ -3321,7 +1368,7 @@ void PPTWriter::ImplWriteTextStyleAtom( SvStream& rOut, int nTextInstance, sal_u } nParaFlags >>= 16; - sal_uInt32 nDefaultTabSize = ImplMapSize( ::com::sun::star::awt::Size( 2011, 1 ) ).Width; + sal_uInt32 nDefaultTabSize = MapSize( ::com::sun::star::awt::Size( 2011, 1 ) ).Width; sal_uInt32 nDefaultTabs = abs( maRect.GetWidth() ) / nDefaultTabSize; if ( nTabs ) nDefaultTabs -= (sal_Int32)( ( ( pTabStop[ nTabs - 1 ].Position / 4.40972 ) + nTextOfs ) / nDefaultTabSize ); @@ -4121,7 +2168,7 @@ void PPTWriter::ImplWriteClickAction( SvStream& rSt, ::com::sun::star::presentat rSt << (sal_uInt32)( ( EPP_InteractiveInfo << 16 ) | 0x1f ) << (sal_uInt32)24 // Mouse Over Action << (sal_uInt32)( EPP_InteractiveInfo << 16 ) << (sal_uInt32)16; - for ( int i = 0; i < 4; i++, rSt << (sal_uInt32)0 ) ; + for ( int i = 0; i < 4; i++, rSt << (sal_uInt32)0 ) {} } // ----------------------------------------------------------------------- @@ -4273,9 +2320,9 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a } } nGroups = GetGroupsClosed(); - for ( sal_uInt32 i = 0; i < nGroups; i++, mpPptEscherEx->LeaveGroup() ) ; + for ( sal_uInt32 i = 0; i < nGroups; i++, mpPptEscherEx->LeaveGroup() ) {} - if ( ImplGetShapeByIndex( GetCurrentGroupIndex(), TRUE ) ) + if ( GetShapeByIndex( GetCurrentGroupIndex(), TRUE ) ) { sal_Bool bIsSound; sal_Bool bMediaClickAction = sal_False; @@ -4345,8 +2392,8 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "BoundRect" ) ) ) ) { ::com::sun::star::awt::Rectangle aRect( *(::com::sun::star::awt::Rectangle*)mAny.getValue() ); - maPosition = ImplMapPoint( ::com::sun::star::awt::Point( aRect.X, aRect.Y ) ); - maSize = ImplMapSize( ::com::sun::star::awt::Size( aRect.Width, aRect.Height ) ); + maPosition = MapPoint( ::com::sun::star::awt::Point( aRect.X, aRect.Y ) ); + maSize = MapSize( ::com::sun::star::awt::Size( aRect.Width, aRect.Height ) ); maRect = Rectangle( Point( maPosition.X, maPosition.Y ), Size( maSize.Width, maSize.Height ) ); } mType = "drawing.dontknow"; @@ -4373,8 +2420,8 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a if ( pObj ) { Rectangle aBound = pObj->GetCurrentBoundRect(); - maPosition = ImplMapPoint( ::com::sun::star::awt::Point( aBound.Left(), aBound.Top() ) ); - maSize = ImplMapSize( ::com::sun::star::awt::Size ( aBound.GetWidth(), aBound.GetHeight() ) ); + maPosition = MapPoint( ::com::sun::star::awt::Point( aBound.Left(), aBound.Top() ) ); + maSize = MapSize( ::com::sun::star::awt::Size ( aBound.GetWidth(), aBound.GetHeight() ) ); maRect = Rectangle( Point( maPosition.X, maPosition.Y ), Size( maSize.Width, maSize.Height ) ); mnAngle = 0; } @@ -4399,7 +2446,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a if ( ImplGetPropertyValue( String( RTL_CONSTASCII_USTRINGPARAM( "CornerRadius" ) ) ) ) { mAny >>= nRadius; - nRadius = ImplMapSize( ::com::sun::star::awt::Size( nRadius, 0 ) ).Width; + nRadius = MapSize( ::com::sun::star::awt::Size( nRadius, 0 ) ).Width; } if ( nRadius ) { @@ -4518,7 +2565,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a } break; } - maRect = ImplMapRectangle( aNewRect ); + maRect = MapRectangle( aNewRect ); maPosition = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() ); maSize = ::com::sun::star::awt::Size( maRect.GetWidth(), maRect.GetHeight() ); if ( bNeedText && ImplGetText() ) @@ -4662,7 +2709,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a if ( aPropOpt.CreateConnectorProperties( mXShape, aSolverContainer, aNewRect, nSpType, nSpFlags ) == sal_False ) continue; - maRect = ImplMapRectangle( aNewRect ); + maRect = MapRectangle( aNewRect ); maPosition = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() ); maSize = ::com::sun::star::awt::Size( maRect.GetWidth(), maRect.GetHeight() ); @@ -4677,7 +2724,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a { ::com::sun::star::awt::Rectangle aNewRect; aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_LINE, sal_False, aNewRect, NULL ); - maRect = ImplMapRectangle( aNewRect ); + maRect = MapRectangle( aNewRect ); maPosition = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() ); maSize = ::com::sun::star::awt::Size( maRect.GetWidth(), maRect.GetHeight() ); if ( ImplGetText() ) @@ -4712,7 +2759,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a ImplCreateShape( ESCHER_ShpInst_NotPrimitive, 0xa00, aSolverContainer ); // Flags: Connector | HasSpt ::com::sun::star::awt::Rectangle aNewRect; aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_POLYPOLYGON, sal_False, aNewRect, NULL ); - maRect = ImplMapRectangle( aNewRect ); + maRect = MapRectangle( aNewRect ); maPosition = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() ); maSize = ::com::sun::star::awt::Size( maRect.GetWidth(), maRect.GetHeight() ); aPropOpt.CreateFillProperties( mXPropSet, sal_True ); @@ -4731,7 +2778,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a ImplCreateShape( ESCHER_ShpInst_NotPrimitive, 0xa00, aSolverContainer ); // Flags: Connector | HasSpt ::com::sun::star::awt::Rectangle aNewRect; aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_POLYLINE, sal_False, aNewRect, NULL ); - maRect = ImplMapRectangle( aNewRect ); + maRect = MapRectangle( aNewRect ); maPosition = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() ); maSize = ::com::sun::star::awt::Size( maRect.GetWidth(), maRect.GetHeight() ); aPropOpt.CreateLineProperties( mXPropSet, sal_False ); @@ -4750,7 +2797,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a ImplCreateShape( ESCHER_ShpInst_NotPrimitive, 0xa00, aSolverContainer ); // Flags: Connector | HasSpt ::com::sun::star::awt::Rectangle aNewRect; aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_POLYLINE, sal_True, aNewRect, NULL ); - maRect = ImplMapRectangle( aNewRect ); + maRect = MapRectangle( aNewRect ); maPosition = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() ); maSize = ::com::sun::star::awt::Size( maRect.GetWidth(), maRect.GetHeight() ); aPropOpt.CreateLineProperties( mXPropSet, sal_False ); @@ -4769,7 +2816,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a ImplCreateShape( ESCHER_ShpInst_NotPrimitive, 0xa00, aSolverContainer ); // Flags: Connector | HasSpt ::com::sun::star::awt::Rectangle aNewRect; aPropOpt.CreatePolygonProperties( mXPropSet, ESCHER_CREATEPOLYGON_POLYPOLYGON, sal_True, aNewRect, NULL ); - maRect = ImplMapRectangle( aNewRect ); + maRect = MapRectangle( aNewRect ); maPosition = ::com::sun::star::awt::Point( maRect.Left(), maRect.Top() ); maSize = ::com::sun::star::awt::Size( maRect.GetWidth(), maRect.GetHeight() ); aPropOpt.CreateFillProperties( mXPropSet, sal_True ); @@ -4851,7 +2898,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a bIsTitlePossible = FALSE; ImplGetText(); - TextObj aTextObj( mXText, EPP_TEXTTYPE_Title, maFontCollection, (PPTExBulletProvider&)*this ); + TextObjBinary aTextObj( mXText, EPP_TEXTTYPE_Title, maFontCollection, (PPTExBulletProvider&)*this ); if ( ePageType == MASTER ) { if ( mnTextSize ) @@ -4942,12 +2989,12 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a if ( mbPresObj ) { nOutlinerCount++; - if ( rLayout.bOutlinerPossible && ( nOutlinerCount == 1 ) || + if ( ( rLayout.bOutlinerPossible && ( nOutlinerCount == 1 ) ) || ( ( rLayout.bSecOutlinerPossible && ( nOutlinerCount == 2 ) ) && ( nPrevTextStyle == EPP_TEXTSTYLE_BODY ) ) ) { ImplGetText(); - TextObj aTextObj( mXText, EPP_TEXTTYPE_Body, maFontCollection, (PPTExBulletProvider&)*this ); + TextObjBinary aTextObj( mXText, EPP_TEXTTYPE_Body, maFontCollection, (PPTExBulletProvider&)*this ); if ( ePageType == MASTER ) { nPrevTextStyle = EPP_TEXTSTYLE_TITLE; @@ -5507,44 +3554,12 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a } ClearGroupTable(); // gruppierungen wegschreiben, sofern noch irgendwelche offen sind, was eigendlich nicht sein sollte nGroups = GetGroupsClosed(); - for ( sal_uInt32 i = 0; i < nGroups; i++, mpPptEscherEx->LeaveGroup() ) ; + for ( sal_uInt32 i = 0; i < nGroups; i++, mpPptEscherEx->LeaveGroup() ) {} mnPagesWritten++; } // ----------------------------------------------------------------------- -::com::sun::star::awt::Point PPTWriter::ImplMapPoint( const ::com::sun::star::awt::Point& rPoint ) -{ - Point aRet( OutputDevice::LogicToLogic( Point( rPoint.X, rPoint.Y ), maMapModeSrc, maMapModeDest ) ); - return ::com::sun::star::awt::Point( aRet.X(), aRet.Y() ); -} - -// ----------------------------------------------------------------------- - -::com::sun::star::awt::Size PPTWriter::ImplMapSize( const ::com::sun::star::awt::Size& rSize ) -{ - Size aRetSize( OutputDevice::LogicToLogic( Size( rSize.Width, rSize.Height ), maMapModeSrc, maMapModeDest ) ); - - if ( !aRetSize.Width() ) - aRetSize.Width()++; - if ( !aRetSize.Height() ) - aRetSize.Height()++; - return ::com::sun::star::awt::Size( aRetSize.Width(), aRetSize.Height() ); -} - -// ----------------------------------------------------------------------- - -Rectangle PPTWriter::ImplMapRectangle( const ::com::sun::star::awt::Rectangle& rRect ) -{ - ::com::sun::star::awt::Point aPoint( rRect.X, rRect.Y ); - ::com::sun::star::awt::Size aSize( rRect.Width, rRect.Height ); - ::com::sun::star::awt::Point aP( ImplMapPoint( aPoint ) ); - ::com::sun::star::awt::Size aS( ImplMapSize( aSize ) ); - return Rectangle( Point( aP.X, aP.Y ), Size( aS.Width, aS.Height ) ); -} - -// ----------------------------------------------------------------------- - struct CellBorder { sal_Int32 mnPos; // specifies the distance to the top/left position of the table @@ -5619,14 +3634,14 @@ void PPTWriter::ImplCreateTable( uno::Reference< drawing::XShape >& rXShape, Esc std::vector< std::pair< sal_Int32, sal_Int32 > > aColumns; std::vector< std::pair< sal_Int32, sal_Int32 > > aRows; - awt::Point aPosition( ImplMapPoint( rXShape->getPosition() ) ); + awt::Point aPosition( MapPoint( rXShape->getPosition() ) ); sal_uInt32 nPosition = aPosition.X; for ( sal_Int32 x = 0; x < nColumnCount; x++ ) { uno::Reference< beans::XPropertySet > xPropSet( xColumns->getByIndex( x ), uno::UNO_QUERY_THROW ); awt::Size aS( 0, 0 ); xPropSet->getPropertyValue( sWidth ) >>= aS.Width; - awt::Size aM( ImplMapSize( aS ) ); + awt::Size aM( MapSize( aS ) ); aColumns.push_back( std::pair< sal_Int32, sal_Int32 >( nPosition, aM.Width ) ); nPosition += aM.Width; } @@ -5637,7 +3652,7 @@ void PPTWriter::ImplCreateTable( uno::Reference< drawing::XShape >& rXShape, Esc uno::Reference< beans::XPropertySet > xPropSet( xRows->getByIndex( y ), uno::UNO_QUERY_THROW ); awt::Size aS( 0, 0 ); xPropSet->getPropertyValue( sHeight ) >>= aS.Height; - awt::Size aM( ImplMapSize( aS ) ); + awt::Size aM( MapSize( aS ) ); aRows.push_back( std::pair< sal_Int32, sal_Int32 >( nPosition, aM.Height ) ); nPosition += aM.Height; } @@ -5743,17 +3758,17 @@ void PPTWriter::ImplCreateTable( uno::Reference< drawing::XShape >& rXShape, Esc static const rtl::OUString sDiagonalBLTR( RTL_CONSTASCII_USTRINGPARAM ( "DiagonalBLTR" ) ); // creating horz lines - sal_Int32 nYPos = ImplMapPoint( rXShape->getPosition() ).Y; + sal_Int32 nYPos = MapPoint( rXShape->getPosition() ).Y; for( sal_Int32 nLine = 0; nLine < ( xRows->getCount() + 1 ); nLine++ ) { - sal_Int32 nXPos = ImplMapPoint( rXShape->getPosition() ).X; + sal_Int32 nXPos = MapPoint( rXShape->getPosition() ).X; std::vector< CellBorder > vCellBorders; for( sal_Int32 nColumn = 0; nColumn < xColumns->getCount(); nColumn++ ) { uno::Reference< beans::XPropertySet > xPropSet( xColumns->getByIndex( nColumn ), uno::UNO_QUERY_THROW ); awt::Size aS( 0, 0 ); xPropSet->getPropertyValue( sWidth ) >>= aS.Width; - awt::Size aM( ImplMapSize( aS ) ); + awt::Size aM( MapSize( aS ) ); CellBorder aCellBorder; aCellBorder.mnPos = nXPos; @@ -5789,23 +3804,23 @@ void PPTWriter::ImplCreateTable( uno::Reference< drawing::XShape >& rXShape, Esc uno::Reference< beans::XPropertySet > xPropSet( xRows->getByIndex( nLine ), uno::UNO_QUERY_THROW ); awt::Size aS( 0, 0 ); xPropSet->getPropertyValue( sHeight ) >>= aS.Height; - awt::Size aM( ImplMapSize( aS ) ); + awt::Size aM( MapSize( aS ) ); nYPos += aM.Height; } } // creating vertical lines - sal_Int32 nXPos = ImplMapPoint( rXShape->getPosition() ).X; + sal_Int32 nXPos = MapPoint( rXShape->getPosition() ).X; for( sal_Int32 nLine = 0; nLine < ( xColumns->getCount() + 1 ); nLine++ ) { - nYPos = ImplMapPoint( rXShape->getPosition() ).Y; + nYPos = MapPoint( rXShape->getPosition() ).Y; std::vector< CellBorder > vCellBorders; for( sal_Int32 nRow = 0; nRow < xRows->getCount(); nRow++ ) { uno::Reference< beans::XPropertySet > xPropSet( xRows->getByIndex( nRow ), uno::UNO_QUERY_THROW ); awt::Size aS( 0, 0 ); xPropSet->getPropertyValue( sHeight ) >>= aS.Height; - awt::Size aM( ImplMapSize( aS ) ); + awt::Size aM( MapSize( aS ) ); CellBorder aCellBorder; aCellBorder.mnPos = nYPos; @@ -5841,7 +3856,7 @@ void PPTWriter::ImplCreateTable( uno::Reference< drawing::XShape >& rXShape, Esc uno::Reference< beans::XPropertySet > xPropSet( xColumns->getByIndex( nLine ), uno::UNO_QUERY_THROW ); awt::Size aS( 0, 0 ); xPropSet->getPropertyValue( sWidth ) >>= aS.Width; - awt::Size aM( ImplMapSize( aS ) ); + awt::Size aM( MapSize( aS ) ); nXPos += aM.Width; } } @@ -5853,3 +3868,43 @@ void PPTWriter::ImplCreateTable( uno::Reference< drawing::XShape >& rXShape, Esc } mpPptEscherEx->CloseContainer(); } + +//---------------------------------------------------------------------------------------------------------- + +void TextObjBinary::Write( SvStream* pStrm ) +{ + sal_uInt32 nSize, nPos = pStrm->Tell(); + *pStrm << (sal_uInt32)( EPP_TextCharsAtom << 16 ) << (sal_uInt32)0; + for ( void* pPtr = First(); pPtr; pPtr = Next() ) + ((ParagraphObj*)pPtr)->Write( pStrm ); + nSize = pStrm->Tell() - nPos; + pStrm->SeekRel( - ( (sal_Int32)nSize - 4 ) ); + *pStrm << (sal_uInt32)( nSize - 8 ); + pStrm->SeekRel( nSize - 8 ); +} + +void TextObjBinary::WriteTextSpecInfo( SvStream* pStrm ) +{ + sal_uInt32 nCharactersLeft( Count() ); + if ( nCharactersLeft >= 1 ) + { + EscherExAtom aAnimationInfoAtom( *pStrm, EPP_TextSpecInfoAtom, 0, 0 ); + for ( ParagraphObj* pPtr = static_cast < ParagraphObj * >( First() ); nCharactersLeft && pPtr; pPtr = static_cast< ParagraphObj* >( Next() ) ) + { + for ( PortionObj* pPortion = static_cast< PortionObj* >( pPtr->First() ); nCharactersLeft && pPortion; pPortion = static_cast< PortionObj* >( pPtr->Next() ) ) + { + sal_Int32 nPortionSize = pPortion->mnTextSize >= nCharactersLeft ? nCharactersLeft : pPortion->mnTextSize; + sal_Int32 nFlags = 7; + nCharactersLeft -= nPortionSize; + *pStrm << static_cast< sal_uInt32 >( nPortionSize ) + << nFlags + << static_cast< sal_Int16 >( 1 ) // spellinfo -> needs rechecking + << static_cast< sal_Int16 >( MsLangId::convertLocaleToLanguageWithFallback( pPortion->meCharLocale ) ) + << static_cast< sal_Int16 >( 0 ); // alt language + } + } + if ( nCharactersLeft ) + *pStrm << nCharactersLeft << static_cast< sal_Int32 >( 1 ) << static_cast< sal_Int16 >( 1 ); + + } +} |