diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-09-04 21:17:16 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-09-05 10:54:19 +0100 |
commit | e99a072c0e19d1bab68a49758acaac22dd981e0c (patch) | |
tree | 927772b072c8cf79026a2146478f9e1c267cac5a | |
parent | callcatcher: some more unused code (diff) | |
download | core-e99a072c0e19d1bab68a49758acaac22dd981e0c.tar.gz core-e99a072c0e19d1bab68a49758acaac22dd981e0c.zip |
add a fairly efficient read_LEuInt16s_AsOUString, merge similar things
-rw-r--r-- | filter/inc/filter/msfilter/mstoolbar.hxx | 29 | ||||
-rw-r--r-- | filter/source/msfilter/msocximex.cxx | 323 | ||||
-rw-r--r-- | filter/source/msfilter/mstoolbar.cxx | 143 | ||||
-rw-r--r-- | svtools/Library_svt.mk | 1 | ||||
-rw-r--r-- | svtools/Package_inc.mk | 1 | ||||
-rw-r--r-- | svtools/inc/svtools/filterutils.hxx | 24 | ||||
-rw-r--r-- | svtools/source/misc/filterutils.cxx | 39 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par.cxx | 18 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par2.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8scan.cxx | 8 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8toolbar.cxx | 246 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8toolbar.hxx | 42 | ||||
-rw-r--r-- | tools/inc/tools/stream.hxx | 10 | ||||
-rw-r--r-- | tools/qa/cppunit/test_stream.cxx | 8 | ||||
-rw-r--r-- | tools/source/stream/stream.cxx | 45 |
15 files changed, 445 insertions, 494 deletions
diff --git a/filter/inc/filter/msfilter/mstoolbar.hxx b/filter/inc/filter/msfilter/mstoolbar.hxx index 2556c0997405..6cb7ef47bc22 100644 --- a/filter/inc/filter/msfilter/mstoolbar.hxx +++ b/filter/inc/filter/msfilter/mstoolbar.hxx @@ -103,9 +103,8 @@ protected: public: TBBase() : nOffSet( 0 ) {} virtual ~TBBase(){} - rtl::OUString readUnicodeString( SvStream* pS, sal_Size nChars ); - virtual bool Read(SvStream *pS) = 0; + virtual bool Read(SvStream &rS) = 0; virtual void Print( FILE* ) {} // #FIXME remove this an implement the debug routines in all the classes below to enable some sort of readable output sal_uInt32 GetOffset() { return nOffSet; } }; @@ -132,7 +131,7 @@ class MSFILTER_DLLPUBLIC WString : public TBBase public: WString(){}; ~WString(){}; - bool Read(SvStream *pS); + bool Read(SvStream &rS); rtl::OUString getString(){ return sString; } }; @@ -151,7 +150,7 @@ class MSFILTER_DLLPUBLIC TBCExtraInfo : public TBBase public: TBCExtraInfo(); ~TBCExtraInfo(){} - bool Read(SvStream *pS); + bool Read(SvStream &rS); void Print( FILE* ); rtl::OUString getOnAction(); }; @@ -167,7 +166,7 @@ class MSFILTER_DLLPUBLIC TBCGeneralInfo : public TBBase public: TBCGeneralInfo(); ~TBCGeneralInfo() {} - bool Read(SvStream *pS); + bool Read(SvStream &rS); void Print( FILE* ); bool ImportToolBarControlData( CustomToolBarImportHelper&, std::vector< css::beans::PropertyValue >& ); rtl::OUString CustomText() { return customText.getString(); } @@ -184,7 +183,7 @@ friend class TBCBSpecific; // #FIXME hacky access, need to fix public: TBCBitMap(); ~TBCBitMap(); - bool Read(SvStream *pS); + bool Read(SvStream &rS); void Print( FILE* ); Bitmap& getBitMap(); }; @@ -196,7 +195,7 @@ class MSFILTER_DLLPUBLIC TBCMenuSpecific : public TBBase public: TBCMenuSpecific(); ~TBCMenuSpecific(){} - bool Read(SvStream *pS); + bool Read(SvStream &rS); void Print( FILE* ); rtl::OUString Name(); }; @@ -214,7 +213,7 @@ class MSFILTER_DLLPUBLIC TBCCDData : public TBBase public: TBCCDData(); ~TBCCDData(); - bool Read(SvStream *pS); + bool Read(SvStream &rS); void Print( FILE* ); }; @@ -224,7 +223,7 @@ class TBCComboDropdownSpecific : public TBBase public: TBCComboDropdownSpecific( const TBCHeader& header ); TBCComboDropdownSpecific(){} - bool Read(SvStream *pS); + bool Read(SvStream &rS); void Print( FILE* ); }; @@ -239,7 +238,7 @@ class TBCBSpecific : public TBBase public: TBCBSpecific(); ~TBCBSpecific(){} - bool Read(SvStream *pS); + bool Read(SvStream &rS); void Print( FILE* ); // #TODO just add a getGraphic member here TBCBitMap* getIcon(); @@ -287,7 +286,7 @@ public: sal_uInt16 getTcID() const { return tcid; } bool isVisible() { return !( bFlagsTCR & 0x1 ); } bool isBeginGroup() { return ( bFlagsTCR & 0x2 ); } - bool Read(SvStream *pS); + bool Read(SvStream &rS); void Print( FILE* ); sal_uInt32 getTbct() { return tbct; }; }; @@ -302,7 +301,7 @@ class MSFILTER_DLLPUBLIC TBCData : public TBBase public: TBCData( const TBCHeader& Header ); ~TBCData(){} - bool Read(SvStream *pS); + bool Read(SvStream &rS); void Print( FILE* ); bool ImportToolBarControl( CustomToolBarImportHelper&, std::vector< css::beans::PropertyValue >&, bool& bBeginGroup, bool bIsMenuBar ); TBCGeneralInfo& getGeneralInfo() { return controlGeneralInfo; } @@ -322,7 +321,7 @@ class MSFILTER_DLLPUBLIC TB : public TBBase public: TB(); ~TB(){} - bool Read(SvStream *pS); + bool Read(SvStream &rS); void Print( FILE* ); sal_Int16 getcCL(){ return cCL; } WString& getName(){ return name; } @@ -339,7 +338,7 @@ public: sal_Int16 top; sal_Int16 right; sal_Int16 bottom; - bool Read( SvStream* pS ) { *pS >> left >> top >> right >> bottom; return true; } + bool Read( SvStream &rS ) { rS >> left >> top >> right >> bottom; return true; } void Print( FILE* fo ); }; @@ -358,7 +357,7 @@ class MSFILTER_DLLPUBLIC TBVisualData : public TBBase public: TBVisualData(); ~TBVisualData(){} - bool Read(SvStream *pS); + bool Read(SvStream &rS); void Print( FILE* ); }; #endif diff --git a/filter/source/msfilter/msocximex.cxx b/filter/source/msfilter/msocximex.cxx index 2bc00155b05e..4e65bb919e99 100644 --- a/filter/source/msfilter/msocximex.cxx +++ b/filter/source/msfilter/msocximex.cxx @@ -87,26 +87,19 @@ #include <com/sun/star/sheet/XSpreadsheetView.hpp> #include <com/sun/star/sheet/XCellRangeAddressable.hpp> #include <com/sun/star/sheet/XCellRangeReferrer.hpp> -#include <svtools/filterutils.hxx> // #TODO remove this when oox is used for control/userform import #include <com/sun/star/util/MeasureUnit.hpp> #include <com/sun/star/awt/XDevice.hpp> #include <com/sun/star/awt/XUnitConversion.hpp> -#ifndef C2S -#define C2S(cChar) String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM(cChar)) -#endif #ifndef C2U -#define C2U(cChar) rtl::OUString::createFromAscii(cChar) +#define C2U(cChar) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(cChar)) #endif using namespace ::com::sun::star; using namespace ::rtl; using namespace cppu; - -#define WW8_ASCII2STR(s) String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM(s)) - static char sWW8_form[] = "WW-Standard"; sal_uInt8 const OCX_Control::aObjInfo[4] = { 0x00, 0x12, 0x03, 0x00 }; @@ -468,7 +461,7 @@ const uno::Reference< container::XIndexContainer >& return xFormComps; uno::Reference< uno::XInterface > xCreate = - rServiceFactory->createInstance(WW8_ASCII2STR( + rServiceFactory->createInstance(C2U( "com.sun.star.form.component.Form")); if( xCreate.is() ) { @@ -476,7 +469,7 @@ const uno::Reference< container::XIndexContainer >& uno::UNO_QUERY ); uno::Any aTmp(&sName,getCppuType((OUString *)0)); - xFormPropSet->setPropertyValue( WW8_ASCII2STR("Name"), aTmp ); + xFormPropSet->setPropertyValue( C2U("Name"), aTmp ); uno::Reference< form::XForm > xForm( xCreate, uno::UNO_QUERY ); DBG_ASSERT(xForm.is(), "keine Form?"); @@ -523,17 +516,17 @@ sal_Bool OCX_CommandButton::WriteContents(SvStorageStreamRef& rContents, sal_uInt32 nOldPos = rContents->Tell(); rContents->SeekRel(8); - uno::Any aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("TextColor")); + uno::Any aTmp = rPropSet->getPropertyValue(C2U("TextColor")); if (aTmp.hasValue()) aTmp >>= mnForeColor; *rContents << ExportColor(mnForeColor); - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("BackgroundColor")); + aTmp = rPropSet->getPropertyValue(C2U("BackgroundColor")); if (aTmp.hasValue()) aTmp >>= mnBackColor; *rContents << ExportColor(mnBackColor); - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("Enabled")); + aTmp = rPropSet->getPropertyValue(C2U("Enabled")); fEnabled = any2bool(aTmp); sal_uInt8 nTemp=0;//fEnabled; if (fEnabled) @@ -544,14 +537,14 @@ sal_Bool OCX_CommandButton::WriteContents(SvStorageStreamRef& rContents, *rContents << sal_uInt8(0x00); nTemp = 0; - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("MultiLine")); + aTmp = rPropSet->getPropertyValue(C2U("MultiLine")); fWordWrap = any2bool(aTmp); if (fWordWrap) nTemp |= 0x80; *rContents << nTemp; *rContents << sal_uInt8(0x00); - SvxOcxString aCaption( rPropSet->getPropertyValue(WW8_ASCII2STR("Label")) ); + SvxOcxString aCaption( rPropSet->getPropertyValue(C2U("Label")) ); aCaption.WriteLenField( *rContents ); aCaption.WriteCharArray( *rContents ); @@ -561,7 +554,7 @@ sal_Bool OCX_CommandButton::WriteContents(SvStorageStreamRef& rContents, *rContents << rSize.Height; // "take focus on click" is directly in content flags, not in option field... - mbTakeFocus = any2bool( rPropSet->getPropertyValue( WW8_ASCII2STR( "FocusOnClick" ) ) ); + mbTakeFocus = any2bool( rPropSet->getPropertyValue( C2U( "FocusOnClick" ) ) ); nFixedAreaLen = static_cast<sal_uInt16>(rContents->Tell()-nOldPos-4); @@ -612,13 +605,13 @@ sal_Bool OCX_CommandButton::Export(SvStorageRef &rObj, }; { - SvStorageStreamRef xStor( rObj->OpenSotStream( C2S("\1CompObj"))); + SvStorageStreamRef xStor( rObj->OpenSotStream( C2U("\1CompObj"))); xStor->Write(aCompObj,sizeof(aCompObj)); DBG_ASSERT((xStor.Is() && (SVSTREAM_OK == xStor->GetError())),"damn"); } { - SvStorageStreamRef xStor3( rObj->OpenSotStream( C2S("\3ObjInfo"))); + SvStorageStreamRef xStor3( rObj->OpenSotStream( C2U("\3ObjInfo"))); xStor3->Write(aObjInfo,sizeof(aObjInfo)); DBG_ASSERT((xStor3.Is() && (SVSTREAM_OK == xStor3->GetError())),"damn"); } @@ -631,12 +624,12 @@ sal_Bool OCX_CommandButton::Export(SvStorageRef &rObj, }; { - SvStorageStreamRef xStor2( rObj->OpenSotStream( C2S("\3OCXNAME"))); + SvStorageStreamRef xStor2( rObj->OpenSotStream( C2U("\3OCXNAME"))); xStor2->Write(aOCXNAME,sizeof(aOCXNAME)); DBG_ASSERT((xStor2.Is() && (SVSTREAM_OK == xStor2->GetError())),"damn"); } - SvStorageStreamRef xContents( rObj->OpenSotStream( C2S("contents"))); + SvStorageStreamRef xContents( rObj->OpenSotStream( C2U("contents"))); return WriteContents(xContents,rPropSet,rSize); } @@ -650,12 +643,12 @@ sal_Bool OCX_ImageButton::WriteContents(SvStorageStreamRef &rContents, sal_uInt32 nOldPos = rContents->Tell(); rContents->SeekRel(8); - uno::Any aTmp=rPropSet->getPropertyValue(WW8_ASCII2STR("BackgroundColor")); + uno::Any aTmp=rPropSet->getPropertyValue(C2U("BackgroundColor")); if (aTmp.hasValue()) aTmp >>= mnBackColor; *rContents << ExportColor(mnBackColor); - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("Enabled")); + aTmp = rPropSet->getPropertyValue(C2U("Enabled")); fEnabled = any2bool(aTmp); sal_uInt8 nTemp=0;//fEnabled; if (fEnabled) @@ -714,13 +707,13 @@ sal_Bool OCX_ImageButton::Export(SvStorageRef &rObj, }; { - SvStorageStreamRef xStor( rObj->OpenSotStream( C2S("\1CompObj"))); + SvStorageStreamRef xStor( rObj->OpenSotStream( C2U("\1CompObj"))); xStor->Write(aCompObj,sizeof(aCompObj)); DBG_ASSERT((xStor.Is() && (SVSTREAM_OK == xStor->GetError())),"damn"); } { - SvStorageStreamRef xStor3( rObj->OpenSotStream( C2S("\3ObjInfo"))); + SvStorageStreamRef xStor3( rObj->OpenSotStream( C2U("\3ObjInfo"))); xStor3->Write(aObjInfo,sizeof(aObjInfo)); DBG_ASSERT((xStor3.Is() && (SVSTREAM_OK == xStor3->GetError())),"damn"); } @@ -733,12 +726,12 @@ sal_Bool OCX_ImageButton::Export(SvStorageRef &rObj, }; { - SvStorageStreamRef xStor2( rObj->OpenSotStream( C2S("\3OCXNAME"))); + SvStorageStreamRef xStor2( rObj->OpenSotStream( C2U("\3OCXNAME"))); xStor2->Write(aOCXNAME,sizeof(aOCXNAME)); DBG_ASSERT((xStor2.Is() && (SVSTREAM_OK == xStor2->GetError())),"damn"); } - SvStorageStreamRef xContents( rObj->OpenSotStream( C2S("contents"))); + SvStorageStreamRef xContents( rObj->OpenSotStream( C2U("contents"))); return WriteContents(xContents,rPropSet,rSize); } @@ -854,10 +847,10 @@ sal_Bool OCX_OptionButton::WriteContents(SvStorageStreamRef &rContents, pBlockFlags[6] = 0; pBlockFlags[7] = 0; - uno::Any aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("Enabled")); + uno::Any aTmp = rPropSet->getPropertyValue(C2U("Enabled")); fEnabled = any2bool(aTmp); - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("BackgroundColor")); + aTmp = rPropSet->getPropertyValue(C2U("BackgroundColor")); if (aTmp.hasValue()) aTmp >>= mnBackColor; else @@ -872,7 +865,7 @@ sal_Bool OCX_OptionButton::WriteContents(SvStorageStreamRef &rContents, pBlockFlags[0] |= 0x01; *rContents << sal_uInt8(0x00); nTemp = 0; - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("MultiLine")); + aTmp = rPropSet->getPropertyValue(C2U("MultiLine")); fWordWrap = any2bool(aTmp); if (fWordWrap) nTemp |= 0x80; @@ -882,7 +875,7 @@ sal_Bool OCX_OptionButton::WriteContents(SvStorageStreamRef &rContents, *rContents << ExportColor(mnBackColor); pBlockFlags[0] |= 0x02; - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("TextColor")); + aTmp = rPropSet->getPropertyValue(C2U("TextColor")); if (aTmp.hasValue()) aTmp >>= mnForeColor; *rContents << ExportColor(mnForeColor); @@ -894,19 +887,19 @@ sal_Bool OCX_OptionButton::WriteContents(SvStorageStreamRef &rContents, WriteAlign(rContents,4); nValueLen = 1|SVX_MSOCX_COMPRESSED; - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("DefaultState")); + aTmp = rPropSet->getPropertyValue(C2U("DefaultState")); sal_Int16 nDefault = sal_Int16(); aTmp >>= nDefault; *rContents << nValueLen; pBlockFlags[2] |= 0x40; - SvxOcxString aCaption( rPropSet->getPropertyValue(WW8_ASCII2STR("Label")) ); + SvxOcxString aCaption( rPropSet->getPropertyValue(C2U("Label")) ); if (aCaption.HasData()) pBlockFlags[2] |= 0x80; aCaption.WriteLenField( *rContents ); - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("VisualEffect")); + aTmp = rPropSet->getPropertyValue(C2U("VisualEffect")); if (aTmp.hasValue()) { sal_Int16 nApiSpecEffect = sal_Int16(); @@ -974,13 +967,13 @@ sal_Bool OCX_OptionButton::Export(SvStorageRef &rObj, }; { - SvStorageStreamRef xStor( rObj->OpenSotStream( C2S("\1CompObj"))); + SvStorageStreamRef xStor( rObj->OpenSotStream( C2U("\1CompObj"))); xStor->Write(aCompObj,sizeof(aCompObj)); DBG_ASSERT((xStor.Is() && (SVSTREAM_OK == xStor->GetError())),"damn"); } { - SvStorageStreamRef xStor3( rObj->OpenSotStream( C2S("\3ObjInfo"))); + SvStorageStreamRef xStor3( rObj->OpenSotStream( C2U("\3ObjInfo"))); xStor3->Write(aObjInfo,sizeof(aObjInfo)); DBG_ASSERT((xStor3.Is() && (SVSTREAM_OK == xStor3->GetError())),"damn"); } @@ -993,12 +986,12 @@ sal_Bool OCX_OptionButton::Export(SvStorageRef &rObj, }; { - SvStorageStreamRef xStor2( rObj->OpenSotStream( C2S("\3OCXNAME"))); + SvStorageStreamRef xStor2( rObj->OpenSotStream( C2U("\3OCXNAME"))); xStor2->Write(aOCXNAME,sizeof(aOCXNAME)); DBG_ASSERT((xStor2.Is() && (SVSTREAM_OK == xStor2->GetError())),"damn"); } - SvStorageStreamRef xContents( rObj->OpenSotStream( C2S("contents"))); + SvStorageStreamRef xContents( rObj->OpenSotStream( C2U("contents"))); return WriteContents(xContents, rPropSet, rSize); } @@ -1021,12 +1014,12 @@ sal_Bool OCX_TextBox::WriteContents(SvStorageStreamRef &rContents, sal_uInt8 nTemp=0x19; - uno::Any aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("Enabled")); + uno::Any aTmp = rPropSet->getPropertyValue(C2U("Enabled")); fEnabled = any2bool(aTmp); if (fEnabled) nTemp |= 0x02; - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("ReadOnly")); + aTmp = rPropSet->getPropertyValue(C2U("ReadOnly")); fLocked = any2bool(aTmp); if (fLocked) nTemp |= 0x04; @@ -1036,8 +1029,8 @@ sal_Bool OCX_TextBox::WriteContents(SvStorageStreamRef &rContents, *rContents << sal_uInt8(0x48); *rContents << sal_uInt8(0x80); - fMultiLine = any2bool(rPropSet->getPropertyValue(WW8_ASCII2STR("MultiLine"))); - fHideSelection = any2bool(rPropSet->getPropertyValue(WW8_ASCII2STR("HideInactiveSelection"))); + fMultiLine = any2bool(rPropSet->getPropertyValue(C2U("MultiLine"))); + fHideSelection = any2bool(rPropSet->getPropertyValue(C2U("HideInactiveSelection"))); nTemp = 0x0C; if (fMultiLine) nTemp |= 0x80; @@ -1045,33 +1038,33 @@ sal_Bool OCX_TextBox::WriteContents(SvStorageStreamRef &rContents, nTemp |= 0x20; *rContents << nTemp; - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("BackgroundColor")); + aTmp = rPropSet->getPropertyValue(C2U("BackgroundColor")); if (aTmp.hasValue()) aTmp >>= mnBackColor; *rContents << ExportColor(mnBackColor); pBlockFlags[0] |= 0x02; - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("TextColor")); + aTmp = rPropSet->getPropertyValue(C2U("TextColor")); if (aTmp.hasValue()) aTmp >>= mnForeColor; *rContents << ExportColor(mnForeColor); pBlockFlags[0] |= 0x04; - aTmp = rPropSet->getPropertyValue( WW8_ASCII2STR("MaxTextLen")); + aTmp = rPropSet->getPropertyValue( C2U("MaxTextLen")); aTmp >>= nMaxLength; *rContents << nMaxLength; pBlockFlags[0] |= 0x08; - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("Border")); + aTmp = rPropSet->getPropertyValue(C2U("Border")); sal_Int16 nBorder = sal_Int16(); aTmp >>= nBorder; nSpecialEffect = ExportBorder(nBorder,nBorderStyle); *rContents << nBorderStyle; pBlockFlags[0] |= 0x10; - aTmp = rPropSet->getPropertyValue( WW8_ASCII2STR("HScroll")); + aTmp = rPropSet->getPropertyValue( C2U("HScroll")); sal_Bool bTemp1 = any2bool(aTmp); - aTmp = rPropSet->getPropertyValue( WW8_ASCII2STR("VScroll")); + aTmp = rPropSet->getPropertyValue( C2U("VScroll")); sal_Bool bTemp2 = any2bool(aTmp); if (!bTemp1 && !bTemp2) nScrollBars =0; @@ -1084,20 +1077,20 @@ sal_Bool OCX_TextBox::WriteContents(SvStorageStreamRef &rContents, *rContents << nScrollBars; pBlockFlags[0] |= 0x20; - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("EchoChar")); + aTmp = rPropSet->getPropertyValue(C2U("EchoChar")); sal_uInt16 nTmp = sal_uInt16(); aTmp >>= nTmp; nPasswordChar = static_cast<sal_uInt8>(nTmp); *rContents << nPasswordChar; pBlockFlags[1] |= 0x02; - SvxOcxString aValue( rPropSet->getPropertyValue(WW8_ASCII2STR("DefaultText")) ); + SvxOcxString aValue( rPropSet->getPropertyValue(C2U("DefaultText")) ); aValue.WriteLenField( *rContents ); if (aValue.HasData()) pBlockFlags[2] |= 0x40; WriteAlign(rContents,4); - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("BorderColor")); + aTmp = rPropSet->getPropertyValue(C2U("BorderColor")); if (aTmp.hasValue()) aTmp >>= nBorderColor; *rContents << ExportColor(nBorderColor); @@ -1160,13 +1153,13 @@ sal_Bool OCX_TextBox::Export(SvStorageRef &rObj, }; { - SvStorageStreamRef xStor( rObj->OpenSotStream( C2S("\1CompObj"))); + SvStorageStreamRef xStor( rObj->OpenSotStream( C2U("\1CompObj"))); xStor->Write(aCompObj,sizeof(aCompObj)); DBG_ASSERT((xStor.Is() && (SVSTREAM_OK == xStor->GetError())),"damn"); } { - SvStorageStreamRef xStor3( rObj->OpenSotStream( C2S("\3ObjInfo"))); + SvStorageStreamRef xStor3( rObj->OpenSotStream( C2U("\3ObjInfo"))); xStor3->Write(aObjInfo,sizeof(aObjInfo)); DBG_ASSERT((xStor3.Is() && (SVSTREAM_OK == xStor3->GetError())),"damn"); } @@ -1178,12 +1171,12 @@ sal_Bool OCX_TextBox::Export(SvStorageRef &rObj, }; { - SvStorageStreamRef xStor2( rObj->OpenSotStream( C2S("\3OCXNAME"))); + SvStorageStreamRef xStor2( rObj->OpenSotStream( C2U("\3OCXNAME"))); xStor2->Write(aOCXNAME,sizeof(aOCXNAME)); DBG_ASSERT((xStor2.Is() && (SVSTREAM_OK == xStor2->GetError())),"damn"); } - SvStorageStreamRef xContents( rObj->OpenSotStream( C2S("contents"))); + SvStorageStreamRef xContents( rObj->OpenSotStream( C2U("contents"))); return WriteContents(xContents, rPropSet, rSize); } @@ -1206,12 +1199,12 @@ sal_Bool OCX_FieldControl::WriteContents(SvStorageStreamRef &rContents, sal_uInt8 nTemp=0x19; - uno::Any aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("Enabled")); + uno::Any aTmp = rPropSet->getPropertyValue(C2U("Enabled")); fEnabled = any2bool(aTmp); if (fEnabled) nTemp |= 0x02; - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("ReadOnly")); + aTmp = rPropSet->getPropertyValue(C2U("ReadOnly")); fLocked = any2bool(aTmp); if (fLocked) nTemp |= 0x04; @@ -1224,19 +1217,19 @@ sal_Bool OCX_FieldControl::WriteContents(SvStorageStreamRef &rContents, nTemp = 0x2C; *rContents << nTemp; - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("BackgroundColor")); + aTmp = rPropSet->getPropertyValue(C2U("BackgroundColor")); if (aTmp.hasValue()) aTmp >>= mnBackColor; *rContents << ExportColor(mnBackColor); pBlockFlags[0] |= 0x02; - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("TextColor")); + aTmp = rPropSet->getPropertyValue(C2U("TextColor")); if (aTmp.hasValue()) aTmp >>= mnForeColor; *rContents << ExportColor(mnForeColor); pBlockFlags[0] |= 0x04; - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("Border")); + aTmp = rPropSet->getPropertyValue(C2U("Border")); sal_Int16 nBorder = sal_Int16(); aTmp >>= nBorder; nSpecialEffect = ExportBorder(nBorder,nBorderStyle); @@ -1244,7 +1237,7 @@ sal_Bool OCX_FieldControl::WriteContents(SvStorageStreamRef &rContents, pBlockFlags[0] |= 0x10; #if 0 //Each control has a different Value format, and how to convert each to text has to be found out - SvxOcxString aValue( rPropSet->getPropertyValue(WW8_ASCII2STR("DefaultText")) ); + SvxOcxString aValue( rPropSet->getPropertyValue(C2U("DefaultText")) ); aValue.WriteLenField( *rContents ); if (aValue.HasData()) pBlockFlags[2] |= 0x40; @@ -1308,13 +1301,13 @@ sal_Bool OCX_FieldControl::Export(SvStorageRef &rObj, }; { - SvStorageStreamRef xStor( rObj->OpenSotStream( C2S("\1CompObj"))); + SvStorageStreamRef xStor( rObj->OpenSotStream( C2U("\1CompObj"))); xStor->Write(aCompObj,sizeof(aCompObj)); DBG_ASSERT((xStor.Is() && (SVSTREAM_OK == xStor->GetError())),"damn"); } { - SvStorageStreamRef xStor3( rObj->OpenSotStream( C2S("\3ObjInfo"))); + SvStorageStreamRef xStor3( rObj->OpenSotStream( C2U("\3ObjInfo"))); xStor3->Write(aObjInfo,sizeof(aObjInfo)); DBG_ASSERT((xStor3.Is() && (SVSTREAM_OK == xStor3->GetError())),"damn"); } @@ -1326,12 +1319,12 @@ sal_Bool OCX_FieldControl::Export(SvStorageRef &rObj, }; { - SvStorageStreamRef xStor2( rObj->OpenSotStream( C2S("\3OCXNAME"))); + SvStorageStreamRef xStor2( rObj->OpenSotStream( C2U("\3OCXNAME"))); xStor2->Write(aOCXNAME,sizeof(aOCXNAME)); DBG_ASSERT((xStor2.Is() && (SVSTREAM_OK == xStor2->GetError())),"damn"); } - SvStorageStreamRef xContents( rObj->OpenSotStream( C2S("contents"))); + SvStorageStreamRef xContents( rObj->OpenSotStream( C2U("contents"))); return WriteContents(xContents, rPropSet, rSize); } @@ -1359,13 +1352,13 @@ sal_Bool OCX_ToggleButton::Export( }; { - SvStorageStreamRef xStor( rObj->OpenSotStream( C2S("\1CompObj"))); + SvStorageStreamRef xStor( rObj->OpenSotStream( C2U("\1CompObj"))); xStor->Write(aCompObj,sizeof(aCompObj)); DBG_ASSERT((xStor.Is() && (SVSTREAM_OK == xStor->GetError())),"damn"); } { - SvStorageStreamRef xStor3( rObj->OpenSotStream( C2S("\3ObjInfo"))); + SvStorageStreamRef xStor3( rObj->OpenSotStream( C2U("\3ObjInfo"))); xStor3->Write(aObjInfo,sizeof(aObjInfo)); DBG_ASSERT((xStor3.Is() && (SVSTREAM_OK == xStor3->GetError())),"damn"); } @@ -1378,12 +1371,12 @@ sal_Bool OCX_ToggleButton::Export( }; { - SvStorageStreamRef xStor2( rObj->OpenSotStream( C2S("\3OCXNAME"))); + SvStorageStreamRef xStor2( rObj->OpenSotStream( C2U("\3OCXNAME"))); xStor2->Write(aOCXNAME,sizeof(aOCXNAME)); DBG_ASSERT((xStor2.Is() && (SVSTREAM_OK == xStor2->GetError())),"damn"); } - SvStorageStreamRef xContents( rObj->OpenSotStream( C2S("contents"))); + SvStorageStreamRef xContents( rObj->OpenSotStream( C2U("contents"))); return WriteContents(xContents,rPropSet,rSize); } @@ -1405,7 +1398,7 @@ sal_Bool OCX_ToggleButton::WriteContents(SvStorageStreamRef &rContents, pBlockFlags[6] = 0; pBlockFlags[7] = 0; - uno::Any aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("Enabled")); + uno::Any aTmp = rPropSet->getPropertyValue(C2U("Enabled")); fEnabled = any2bool(aTmp); sal_uInt8 nTemp=fEnabled; @@ -1417,20 +1410,20 @@ sal_Bool OCX_ToggleButton::WriteContents(SvStorageStreamRef &rContents, pBlockFlags[0] |= 0x01; *rContents << sal_uInt8(0x00); nTemp = 0; - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("MultiLine")); + aTmp = rPropSet->getPropertyValue(C2U("MultiLine")); fWordWrap = any2bool(aTmp); if (fWordWrap) nTemp |= 0x80; *rContents << nTemp; *rContents << sal_uInt8(0x00); - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("BackgroundColor")); + aTmp = rPropSet->getPropertyValue(C2U("BackgroundColor")); if (aTmp.hasValue()) aTmp >>= mnBackColor; *rContents << ExportColor(mnBackColor); pBlockFlags[0] |= 0x02; - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("TextColor")); + aTmp = rPropSet->getPropertyValue(C2U("TextColor")); if (aTmp.hasValue()) aTmp >>= mnForeColor; *rContents << ExportColor(mnForeColor); @@ -1443,12 +1436,12 @@ sal_Bool OCX_ToggleButton::WriteContents(SvStorageStreamRef &rContents, WriteAlign(rContents,4); nValueLen = 1|SVX_MSOCX_COMPRESSED; bool bDefault = false; - rPropSet->getPropertyValue(WW8_ASCII2STR("DefaultState")) >>= bDefault; + rPropSet->getPropertyValue(C2U("DefaultState")) >>= bDefault; sal_uInt8 nDefault = static_cast< sal_uInt8 >( bDefault ? '1' : '0' ); *rContents << nValueLen; pBlockFlags[2] |= 0x40; - SvxOcxString aCaption( rPropSet->getPropertyValue(WW8_ASCII2STR("Label")) ); + SvxOcxString aCaption( rPropSet->getPropertyValue(C2U("Label")) ); aCaption.WriteLenField( *rContents ); if (aCaption.HasData()) pBlockFlags[2] |= 0x80; @@ -1502,12 +1495,12 @@ sal_Bool OCX_ComboBox::WriteContents(SvStorageStreamRef &rContents, sal_uInt8 nTemp=0x19;//fEnabled; - uno::Any aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("Enabled")); + uno::Any aTmp = rPropSet->getPropertyValue(C2U("Enabled")); fEnabled = any2bool(aTmp); if (fEnabled) nTemp |= 0x02; - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("ReadOnly")); + aTmp = rPropSet->getPropertyValue(C2U("ReadOnly")); fLocked = any2bool(aTmp); if (fLocked) nTemp |= 0x04; @@ -1518,24 +1511,24 @@ sal_Bool OCX_ComboBox::WriteContents(SvStorageStreamRef &rContents, *rContents << sal_uInt8(0x80); nTemp = 0x0C; - fHideSelection = any2bool(rPropSet->getPropertyValue(WW8_ASCII2STR("HideInactiveSelection"))); + fHideSelection = any2bool(rPropSet->getPropertyValue(C2U("HideInactiveSelection"))); if( fHideSelection ) nTemp |= 0x20; *rContents << nTemp; - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("BackgroundColor")); + aTmp = rPropSet->getPropertyValue(C2U("BackgroundColor")); if (aTmp.hasValue()) aTmp >>= mnBackColor; *rContents << ExportColor(mnBackColor); pBlockFlags[0] |= 0x02; - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("TextColor")); + aTmp = rPropSet->getPropertyValue(C2U("TextColor")); if (aTmp.hasValue()) aTmp >>= mnForeColor; *rContents << ExportColor(mnForeColor); pBlockFlags[0] |= 0x04; - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("Border")); + aTmp = rPropSet->getPropertyValue(C2U("Border")); sal_Int16 nBorder = sal_Int16(); aTmp >>= nBorder; nSpecialEffect = ExportBorder(nBorder,nBorderStyle); @@ -1548,7 +1541,7 @@ sal_Bool OCX_ComboBox::WriteContents(SvStorageStreamRef &rContents, WriteAlign(rContents,2); - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("LineCount")); + aTmp = rPropSet->getPropertyValue(C2U("LineCount")); aTmp >>= nListRows; *rContents << nListRows; pBlockFlags[1] |= 0x40; @@ -1556,20 +1549,20 @@ sal_Bool OCX_ComboBox::WriteContents(SvStorageStreamRef &rContents, *rContents << sal_uInt8(1); //DefaultSelected One pBlockFlags[2] |= 0x01; - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("Dropdown")); + aTmp = rPropSet->getPropertyValue(C2U("Dropdown")); nDropButtonStyle = any2bool(aTmp); if (nDropButtonStyle) nDropButtonStyle=0x02; *rContents << nDropButtonStyle; pBlockFlags[2] |= 0x04; - SvxOcxString aValue( rPropSet->getPropertyValue(WW8_ASCII2STR("Text")) ); + SvxOcxString aValue( rPropSet->getPropertyValue(C2U("Text")) ); aValue.WriteLenField( *rContents ); if (aValue.HasData()) pBlockFlags[2] |= 0x40; WriteAlign(rContents,4); - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("BorderColor")); + aTmp = rPropSet->getPropertyValue(C2U("BorderColor")); if (aTmp.hasValue()) aTmp >>= nBorderColor; *rContents << ExportColor(nBorderColor); @@ -1632,13 +1625,13 @@ sal_Bool OCX_ComboBox::Export(SvStorageRef &rObj, }; { - SvStorageStreamRef xStor( rObj->OpenSotStream( C2S("\1CompObj"))); + SvStorageStreamRef xStor( rObj->OpenSotStream( C2U("\1CompObj"))); xStor->Write(aCompObj,sizeof(aCompObj)); DBG_ASSERT((xStor.Is() && (SVSTREAM_OK == xStor->GetError())),"damn"); } { - SvStorageStreamRef xStor3( rObj->OpenSotStream( C2S("\3ObjInfo"))); + SvStorageStreamRef xStor3( rObj->OpenSotStream( C2U("\3ObjInfo"))); xStor3->Write(aObjInfo,sizeof(aObjInfo)); DBG_ASSERT((xStor3.Is() && (SVSTREAM_OK == xStor3->GetError())),"damn"); } @@ -1650,12 +1643,12 @@ sal_Bool OCX_ComboBox::Export(SvStorageRef &rObj, }; { - SvStorageStreamRef xStor2( rObj->OpenSotStream( C2S("\3OCXNAME"))); + SvStorageStreamRef xStor2( rObj->OpenSotStream( C2U("\3OCXNAME"))); xStor2->Write(aOCXNAME,sizeof(aOCXNAME)); DBG_ASSERT((xStor2.Is() && (SVSTREAM_OK == xStor2->GetError())),"damn"); } - SvStorageStreamRef xContents( rObj->OpenSotStream( C2S("contents"))); + SvStorageStreamRef xContents( rObj->OpenSotStream( C2U("contents"))); return WriteContents(xContents, rPropSet, rSize); } @@ -1676,13 +1669,13 @@ sal_Bool OCX_ListBox::WriteContents(SvStorageStreamRef &rContents, pBlockFlags[6] = 0; pBlockFlags[7] = 0; - uno::Any aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("Enabled")); + uno::Any aTmp = rPropSet->getPropertyValue(C2U("Enabled")); fEnabled = any2bool(aTmp); sal_uInt8 nTemp=fEnabled; if (fEnabled) nTemp = nTemp << 1; - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("ReadOnly")); + aTmp = rPropSet->getPropertyValue(C2U("ReadOnly")); fLocked = any2bool(aTmp); if (fLocked) nTemp |= 0x04; @@ -1693,19 +1686,19 @@ sal_Bool OCX_ListBox::WriteContents(SvStorageStreamRef &rContents, *rContents << sal_uInt8(0x00); *rContents << sal_uInt8(0x00); - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("BackgroundColor")); + aTmp = rPropSet->getPropertyValue(C2U("BackgroundColor")); if (aTmp.hasValue()) aTmp >>= mnBackColor; *rContents << ExportColor(mnBackColor); pBlockFlags[0] |= 0x02; - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("TextColor")); + aTmp = rPropSet->getPropertyValue(C2U("TextColor")); if (aTmp.hasValue()) aTmp >>= mnForeColor; *rContents << ExportColor(mnForeColor); pBlockFlags[0] |= 0x04; - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("Border")); + aTmp = rPropSet->getPropertyValue(C2U("Border")); sal_Int16 nBorder = sal_Int16(); aTmp >>= nBorder; nSpecialEffect = ExportBorder(nBorder,nBorderStyle); @@ -1713,7 +1706,7 @@ sal_Bool OCX_ListBox::WriteContents(SvStorageStreamRef &rContents, *rContents << nBorderStyle; pBlockFlags[0] |= 0x10; - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("MultiSelection")); + aTmp = rPropSet->getPropertyValue(C2U("MultiSelection")); nMultiState = any2bool(aTmp); if (nMultiState) @@ -1730,7 +1723,7 @@ sal_Bool OCX_ListBox::WriteContents(SvStorageStreamRef &rContents, WriteAlign(rContents,4); #if 0 - SvxOcxString aValue( rPropSet->getPropertyValue(WW8_ASCII2STR("DefaultText")) ); + SvxOcxString aValue( rPropSet->getPropertyValue(C2U("DefaultText")) ); aValue.WriteLenField( *rContents ); if (aValue.HasData()) pBlockFlags[2] |= 0x40; @@ -1739,7 +1732,7 @@ sal_Bool OCX_ListBox::WriteContents(SvStorageStreamRef &rContents, #endif WriteAlign(rContents,4); - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("BorderColor")); + aTmp = rPropSet->getPropertyValue(C2U("BorderColor")); if (aTmp.hasValue()) aTmp >>= nBorderColor; *rContents << ExportColor(nBorderColor); @@ -1803,13 +1796,13 @@ sal_Bool OCX_ListBox::Export(SvStorageRef &rObj, }; { - SvStorageStreamRef xStor( rObj->OpenSotStream( C2S("\1CompObj"))); + SvStorageStreamRef xStor( rObj->OpenSotStream( C2U("\1CompObj"))); xStor->Write(aCompObj,sizeof(aCompObj)); DBG_ASSERT((xStor.Is() && (SVSTREAM_OK == xStor->GetError())),"damn"); } { - SvStorageStreamRef xStor3( rObj->OpenSotStream( C2S("\3ObjInfo"))); + SvStorageStreamRef xStor3( rObj->OpenSotStream( C2U("\3ObjInfo"))); xStor3->Write(aObjInfo,sizeof(aObjInfo)); DBG_ASSERT((xStor3.Is() && (SVSTREAM_OK == xStor3->GetError())),"damn"); } @@ -1821,12 +1814,12 @@ sal_Bool OCX_ListBox::Export(SvStorageRef &rObj, }; { - SvStorageStreamRef xStor2( rObj->OpenSotStream( C2S("\3OCXNAME"))); + SvStorageStreamRef xStor2( rObj->OpenSotStream( C2U("\3OCXNAME"))); xStor2->Write(aOCXNAME,sizeof(aOCXNAME)); DBG_ASSERT((xStor2.Is() && (SVSTREAM_OK == xStor2->GetError())),"damn"); } - SvStorageStreamRef xContents( rObj->OpenSotStream( C2S("contents"))); + SvStorageStreamRef xContents( rObj->OpenSotStream( C2U("contents"))); return WriteContents(xContents, rPropSet, rSize); } @@ -1842,19 +1835,19 @@ sal_Bool OCX_Label::WriteContents(SvStorageStreamRef &rContents, pBlockFlags[2] = 0; pBlockFlags[3] = 0; - uno::Any aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("TextColor")); + uno::Any aTmp = rPropSet->getPropertyValue(C2U("TextColor")); if (aTmp.hasValue()) aTmp >>= mnForeColor; *rContents << ExportColor(mnForeColor); pBlockFlags[0] |= 0x01; - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("BackgroundColor")); + aTmp = rPropSet->getPropertyValue(C2U("BackgroundColor")); if (aTmp.hasValue()) aTmp >>= mnBackColor; *rContents << ExportColor(mnBackColor); pBlockFlags[0] |= 0x02; - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("Enabled")); + aTmp = rPropSet->getPropertyValue(C2U("Enabled")); fEnabled = any2bool(aTmp); sal_uInt8 nTemp=fEnabled; if (fEnabled) @@ -1862,7 +1855,7 @@ sal_Bool OCX_Label::WriteContents(SvStorageStreamRef &rContents, *rContents << nTemp; *rContents << sal_uInt8(0x00); - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("MultiLine")); + aTmp = rPropSet->getPropertyValue(C2U("MultiLine")); fWordWrap = any2bool(aTmp); nTemp=fWordWrap; nTemp = nTemp << 7; @@ -1870,19 +1863,19 @@ sal_Bool OCX_Label::WriteContents(SvStorageStreamRef &rContents, *rContents << sal_uInt8(0x00); pBlockFlags[0] |= 0x04; - SvxOcxString aCaption( rPropSet->getPropertyValue(WW8_ASCII2STR("Label")) ); + SvxOcxString aCaption( rPropSet->getPropertyValue(C2U("Label")) ); aCaption.WriteLenField( *rContents ); if (aCaption.HasData()) pBlockFlags[0] |= 0x08; WriteAlign(rContents,4); - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("BorderColor")); + aTmp = rPropSet->getPropertyValue(C2U("BorderColor")); if (aTmp.hasValue()) aTmp >>= nBorderColor; *rContents << ExportColor(nBorderColor); pBlockFlags[0] |= 0x80; - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("Border")); + aTmp = rPropSet->getPropertyValue(C2U("Border")); sal_Int16 nBorder = sal_Int16(); aTmp >>= nBorder; sal_uInt8 nNewBorder; @@ -1940,13 +1933,13 @@ sal_Bool OCX_Label::Export(SvStorageRef &rObj, }; { - SvStorageStreamRef xStor( rObj->OpenSotStream( C2S("\1CompObj"))); + SvStorageStreamRef xStor( rObj->OpenSotStream( C2U("\1CompObj"))); xStor->Write(aCompObj,sizeof(aCompObj)); DBG_ASSERT((xStor.Is() && (SVSTREAM_OK == xStor->GetError())),"damn"); } { - SvStorageStreamRef xStor3( rObj->OpenSotStream( C2S("\3ObjInfo"))); + SvStorageStreamRef xStor3( rObj->OpenSotStream( C2U("\3ObjInfo"))); xStor3->Write(aObjInfo,sizeof(aObjInfo)); DBG_ASSERT((xStor3.Is() && (SVSTREAM_OK == xStor3->GetError())),"damn"); } @@ -1957,12 +1950,12 @@ sal_Bool OCX_Label::Export(SvStorageRef &rObj, }; { - SvStorageStreamRef xStor2( rObj->OpenSotStream( C2S("\3OCXNAME"))); + SvStorageStreamRef xStor2( rObj->OpenSotStream( C2U("\3OCXNAME"))); xStor2->Write(aOCXNAME,sizeof(aOCXNAME)); DBG_ASSERT((xStor2.Is() && (SVSTREAM_OK == xStor2->GetError())),"damn"); } - SvStorageStreamRef xContents( rObj->OpenSotStream( C2S("contents"))); + SvStorageStreamRef xContents( rObj->OpenSotStream( C2U("contents"))); return WriteContents(xContents, rPropSet, rSize); } @@ -2104,7 +2097,7 @@ OCX_Control * SvxMSConvertOCXControls::OCX_Factory( // distinguish between push button and toggle button if( nClassId == form::FormComponentType::COMMANDBUTTON ) { - pEntry = any2bool(xPropSet->getPropertyValue(WW8_ASCII2STR("Toggle"))) ? + pEntry = any2bool(xPropSet->getPropertyValue(C2U("Toggle"))) ? (aOCXTab + 1) : aOCXTab; } else @@ -2150,7 +2143,7 @@ sal_Bool SvxMSConvertOCXControls::WriteOCXStream( SvStorageRef& rSrc1, /* #117832# - also enable export of control name */ OUString sCName; - xPropSet->getPropertyValue(C2S("Name")) >>= sCName; + xPropSet->getPropertyValue(C2U("Name")) >>= sCName; pObj->sName = sCName; SvGlobalName aName; @@ -2165,7 +2158,7 @@ sal_Bool SvxMSConvertOCXControls::WriteOCXStream( SvStorageRef& rSrc1, // cmc bRet = pObj->Export(rSrc1,xPropSet,rSize); - SvStorageStreamRef xStor2( rSrc1->OpenSotStream( WW8_ASCII2STR("\3OCXNAME"))); + SvStorageStreamRef xStor2( rSrc1->OpenSotStream( C2U("\3OCXNAME"))); /* #117832# - also enable export of control name */ writeOCXNAME( sCName, xStor2 ); delete pObj; @@ -2228,10 +2221,10 @@ sal_Bool OCX_CheckBox::WriteContents(SvStorageStreamRef &rContents, pBlockFlags[6] = 0; pBlockFlags[7] = 0; - uno::Any aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("Enabled")); + uno::Any aTmp = rPropSet->getPropertyValue(C2U("Enabled")); fEnabled = any2bool(aTmp); - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("BackgroundColor")); + aTmp = rPropSet->getPropertyValue(C2U("BackgroundColor")); fBackStyle = aTmp.hasValue() ? 1 : 0; if (fBackStyle) aTmp >>= mnBackColor; @@ -2245,7 +2238,7 @@ sal_Bool OCX_CheckBox::WriteContents(SvStorageStreamRef &rContents, pBlockFlags[0] |= 0x01; *rContents << sal_uInt8(0x00); nTemp = 0; - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("MultiLine")); + aTmp = rPropSet->getPropertyValue(C2U("MultiLine")); fWordWrap = any2bool(aTmp); if (fWordWrap) nTemp |= 0x80; @@ -2255,7 +2248,7 @@ sal_Bool OCX_CheckBox::WriteContents(SvStorageStreamRef &rContents, *rContents << ExportColor(mnBackColor); pBlockFlags[0] |= 0x02; - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("TextColor")); + aTmp = rPropSet->getPropertyValue(C2U("TextColor")); if (aTmp.hasValue()) aTmp >>= mnForeColor; *rContents << ExportColor(mnForeColor); @@ -2265,25 +2258,25 @@ sal_Bool OCX_CheckBox::WriteContents(SvStorageStreamRef &rContents, *rContents << nStyle; pBlockFlags[0] |= 0x40; - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("TriState")); + aTmp = rPropSet->getPropertyValue(C2U("TriState")); nMultiState = any2bool(aTmp); *rContents << nMultiState; pBlockFlags[2] |= 0x20; WriteAlign(rContents,4); nValueLen = 1|SVX_MSOCX_COMPRESSED; - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("DefaultState")); + aTmp = rPropSet->getPropertyValue(C2U("DefaultState")); sal_Int16 nDefault = sal_Int16(); aTmp >>= nDefault; *rContents << nValueLen; pBlockFlags[2] |= 0x40; - SvxOcxString aCaption( rPropSet->getPropertyValue(WW8_ASCII2STR("Label")) ); + SvxOcxString aCaption( rPropSet->getPropertyValue(C2U("Label")) ); aCaption.WriteLenField( *rContents ); if (aCaption.HasData()) pBlockFlags[2] |= 0x80; - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("VisualEffect")); + aTmp = rPropSet->getPropertyValue(C2U("VisualEffect")); if (aTmp.hasValue()) { sal_Int16 nApiSpecEffect = sal_Int16(); @@ -2350,13 +2343,13 @@ sal_Bool OCX_CheckBox::Export(SvStorageRef &rObj, }; { - SvStorageStreamRef xStor( rObj->OpenSotStream( C2S("\1CompObj"))); + SvStorageStreamRef xStor( rObj->OpenSotStream( C2U("\1CompObj"))); xStor->Write(aCompObj,sizeof(aCompObj)); DBG_ASSERT((xStor.Is() && (SVSTREAM_OK == xStor->GetError())),"damn"); } { - SvStorageStreamRef xStor3( rObj->OpenSotStream( C2S("\3ObjInfo"))); + SvStorageStreamRef xStor3( rObj->OpenSotStream( C2U("\3ObjInfo"))); xStor3->Write(aObjInfo,sizeof(aObjInfo)); DBG_ASSERT((xStor3.Is() && (SVSTREAM_OK == xStor3->GetError())),"damn"); } @@ -2367,12 +2360,12 @@ sal_Bool OCX_CheckBox::Export(SvStorageRef &rObj, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00 }; { - SvStorageStreamRef xStor2( rObj->OpenSotStream( C2S("\3OCXNAME"))); + SvStorageStreamRef xStor2( rObj->OpenSotStream( C2U("\3OCXNAME"))); xStor2->Write(aOCXNAME,sizeof(aOCXNAME)); DBG_ASSERT((xStor2.Is() && (SVSTREAM_OK == xStor2->GetError())),"damn"); } - SvStorageStreamRef xContents( rObj->OpenSotStream( C2S("contents"))); + SvStorageStreamRef xContents( rObj->OpenSotStream( C2U("contents"))); return WriteContents(xContents, rPropSet, rSize); } @@ -2387,7 +2380,7 @@ sal_Bool OCX_FontData::Export(SvStorageStreamRef &rContent, uno::Any aTmp; if (bHasFont) - aFontName = rPropSet->getPropertyValue(WW8_ASCII2STR("FontName")); + aFontName = rPropSet->getPropertyValue(C2U("FontName")); if (!aFontName.HasData()) aFontName = OUString( RTL_CONSTASCII_USTRINGPARAM( "Times New Roman" ) ); aFontName.WriteLenField( *rContent ); @@ -2395,7 +2388,7 @@ sal_Bool OCX_FontData::Export(SvStorageStreamRef &rContent, if (bHasFont) { - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("FontWeight")); + aTmp = rPropSet->getPropertyValue(C2U("FontWeight")); float nBold = 0; aTmp >>= nBold; @@ -2410,7 +2403,7 @@ sal_Bool OCX_FontData::Export(SvStorageStreamRef &rContent, *rContent << nTmp; } - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("FontHeight")); + aTmp = rPropSet->getPropertyValue(C2U("FontHeight")); float nFontHeight = 0; aTmp >>= nFontHeight; if (nFontHeight) @@ -2430,7 +2423,7 @@ sal_Bool OCX_FontData::Export(SvStorageStreamRef &rContent, nFlags |= 0x20; // ? - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("Align")); + aTmp = rPropSet->getPropertyValue(C2U("Align")); nFlags |= 0x40; sal_Int16 nAlign(0); if (aTmp.hasValue()) @@ -2470,14 +2463,14 @@ sal_Bool OCX_Image::WriteContents(SvStorageStreamRef &rContents, pBlockFlags[3] = 0; uno::Any aTmp = rPropSet->getPropertyValue( - WW8_ASCII2STR("BackgroundColor")); + C2U("BackgroundColor")); if (aTmp.hasValue()) aTmp >>= mnBackColor; *rContents << ExportColor(mnBackColor); pBlockFlags[0] |= 0x10; - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("Border")); + aTmp = rPropSet->getPropertyValue(C2U("Border")); sal_Int16 nBorder = sal_Int16(); aTmp >>= nBorder; nSpecialEffect = ExportBorder(nBorder,nBorderStyle); @@ -2489,7 +2482,7 @@ sal_Bool OCX_Image::WriteContents(SvStorageStreamRef &rContents, WriteAlign(rContents,4); - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("Enabled")); + aTmp = rPropSet->getPropertyValue(C2U("Enabled")); fEnabled = any2bool(aTmp); if (fEnabled) { @@ -2501,7 +2494,7 @@ sal_Bool OCX_Image::WriteContents(SvStorageStreamRef &rContents, *rContents << sal_uInt8(0x00); } - aTmp = rPropSet->getPropertyValue(WW8_ASCII2STR("ImageURL")); + aTmp = rPropSet->getPropertyValue(C2U("ImageURL")); /*Magically fetch that image and turn it into something that *we can store in ms controls, wmf,png,jpg are almost certainly *the options we have for export...*/ @@ -2549,13 +2542,13 @@ sal_Bool OCX_Image::Export(SvStorageRef &rObj, }; { - SvStorageStreamRef xStor( rObj->OpenSotStream( C2S("\1CompObj"))); + SvStorageStreamRef xStor( rObj->OpenSotStream( C2U("\1CompObj"))); xStor->Write(aCompObj,sizeof(aCompObj)); DBG_ASSERT((xStor.Is() && (SVSTREAM_OK == xStor->GetError())),"damn"); } { - SvStorageStreamRef xStor3( rObj->OpenSotStream( C2S("\3ObjInfo"))); + SvStorageStreamRef xStor3( rObj->OpenSotStream( C2U("\3ObjInfo"))); xStor3->Write(aObjInfo,sizeof(aObjInfo)); DBG_ASSERT((xStor3.Is() && (SVSTREAM_OK == xStor3->GetError())),"damn"); } @@ -2566,12 +2559,12 @@ sal_Bool OCX_Image::Export(SvStorageRef &rObj, }; { - SvStorageStreamRef xStor2( rObj->OpenSotStream( C2S("\3OCXNAME"))); + SvStorageStreamRef xStor2( rObj->OpenSotStream( C2U("\3OCXNAME"))); xStor2->Write(aOCXNAME,sizeof(aOCXNAME)); DBG_ASSERT((xStor2.Is() && (SVSTREAM_OK == xStor2->GetError())),"damn"); } - SvStorageStreamRef xContents( rObj->OpenSotStream( C2S("contents"))); + SvStorageStreamRef xContents( rObj->OpenSotStream( C2U("contents"))); return WriteContents(xContents, rPropSet, rSize); } @@ -2627,13 +2620,13 @@ sal_Bool OCX_SpinButton::Export( }; { - SvStorageStreamRef xStor( rObj->OpenSotStream( C2S("\1CompObj"))); + SvStorageStreamRef xStor( rObj->OpenSotStream( C2U("\1CompObj"))); xStor->Write(aCompObj,sizeof(aCompObj)); DBG_ASSERT((xStor.Is() && (SVSTREAM_OK == xStor->GetError())),"damn"); } { - SvStorageStreamRef xStor3( rObj->OpenSotStream( C2S("\3ObjInfo"))); + SvStorageStreamRef xStor3( rObj->OpenSotStream( C2U("\3ObjInfo"))); xStor3->Write(aObjInfo,sizeof(aObjInfo)); DBG_ASSERT((xStor3.Is() && (SVSTREAM_OK == xStor3->GetError())),"damn"); } @@ -2647,12 +2640,12 @@ sal_Bool OCX_SpinButton::Export( }; { - SvStorageStreamRef xStor2( rObj->OpenSotStream( C2S("\3OCXNAME"))); + SvStorageStreamRef xStor2( rObj->OpenSotStream( C2U("\3OCXNAME"))); xStor2->Write(aOCXNAME,sizeof(aOCXNAME)); DBG_ASSERT((xStor2.Is() && (SVSTREAM_OK == xStor2->GetError())),"damn"); } - SvStorageStreamRef xContents( rObj->OpenSotStream( C2S("contents"))); + SvStorageStreamRef xContents( rObj->OpenSotStream( C2U("contents"))); return WriteContents(xContents, rPropSet, rSize); } @@ -2668,18 +2661,18 @@ sal_Bool OCX_SpinButton::WriteContents( nWidth = rSize.Width; nHeight = rSize.Height; - GetInt32Property( mnForeColor, rPropSet, WW8_ASCII2STR( "SymbolColor" ), 0x00000001 ); - GetInt32Property( mnBackColor, rPropSet, WW8_ASCII2STR( "BackgroundColor" ), 0x00000002 ); - GetBoolProperty( mbEnabled, rPropSet, WW8_ASCII2STR( "Enabled" ), 0x00000304 ); - GetInt32Property( mnMin, rPropSet, WW8_ASCII2STR( "SpinValueMin" ), 0x00000020 ); - GetInt32Property( mnMax, rPropSet, WW8_ASCII2STR( "SpinValueMax" ), 0x00000040 ); - GetInt32Property( mnValue, rPropSet, WW8_ASCII2STR( "SpinValue" ), 0x00000080 ); - GetInt32Property( mnSmallStep, rPropSet, WW8_ASCII2STR( "SpinIncrement" ), 0x00000800 ); - GetInt32Property( mnDelay, rPropSet, WW8_ASCII2STR( "RepeatDelay" ), 0x00008000 ); + GetInt32Property( mnForeColor, rPropSet, C2U( "SymbolColor" ), 0x00000001 ); + GetInt32Property( mnBackColor, rPropSet, C2U( "BackgroundColor" ), 0x00000002 ); + GetBoolProperty( mbEnabled, rPropSet, C2U( "Enabled" ), 0x00000304 ); + GetInt32Property( mnMin, rPropSet, C2U( "SpinValueMin" ), 0x00000020 ); + GetInt32Property( mnMax, rPropSet, C2U( "SpinValueMax" ), 0x00000040 ); + GetInt32Property( mnValue, rPropSet, C2U( "SpinValue" ), 0x00000080 ); + GetInt32Property( mnSmallStep, rPropSet, C2U( "SpinIncrement" ), 0x00000800 ); + GetInt32Property( mnDelay, rPropSet, C2U( "RepeatDelay" ), 0x00008000 ); namespace AwtScrollOrient = ::com::sun::star::awt::ScrollBarOrientation; sal_Int16 nApiOrient = sal_Int16(); - if( rPropSet->getPropertyValue( WW8_ASCII2STR( "Orientation" ) ) >>= nApiOrient ) + if( rPropSet->getPropertyValue( C2U( "Orientation" ) ) >>= nApiOrient ) UpdateInt32Property( mnOrient, (nApiOrient == AwtScrollOrient::VERTICAL) ? 0 : 1, 0x00002000 ); return WriteData( *rObj ); @@ -2800,13 +2793,13 @@ sal_Bool OCX_ScrollBar::Export( }; { - SvStorageStreamRef xStor( rObj->OpenSotStream( C2S("\1CompObj"))); + SvStorageStreamRef xStor( rObj->OpenSotStream( C2U("\1CompObj"))); xStor->Write(aCompObj,sizeof(aCompObj)); DBG_ASSERT((xStor.Is() && (SVSTREAM_OK == xStor->GetError())),"damn"); } { - SvStorageStreamRef xStor3( rObj->OpenSotStream( C2S("\3ObjInfo"))); + SvStorageStreamRef xStor3( rObj->OpenSotStream( C2U("\3ObjInfo"))); xStor3->Write(aObjInfo,sizeof(aObjInfo)); DBG_ASSERT((xStor3.Is() && (SVSTREAM_OK == xStor3->GetError())),"damn"); } @@ -2819,12 +2812,12 @@ sal_Bool OCX_ScrollBar::Export( }; { - SvStorageStreamRef xStor2( rObj->OpenSotStream( C2S("\3OCXNAME"))); + SvStorageStreamRef xStor2( rObj->OpenSotStream( C2U("\3OCXNAME"))); xStor2->Write(aOCXNAME,sizeof(aOCXNAME)); DBG_ASSERT((xStor2.Is() && (SVSTREAM_OK == xStor2->GetError())),"damn"); } - SvStorageStreamRef xContents( rObj->OpenSotStream( C2S("contents"))); + SvStorageStreamRef xContents( rObj->OpenSotStream( C2U("contents"))); return WriteContents(xContents, rPropSet, rSize); } @@ -2840,19 +2833,19 @@ sal_Bool OCX_ScrollBar::WriteContents( nWidth = rSize.Width; nHeight = rSize.Height; - GetInt32Property( mnForeColor, rPropSet, WW8_ASCII2STR( "SymbolColor" ), 0x00000001 ); - GetInt32Property( mnBackColor, rPropSet, WW8_ASCII2STR( "BackgroundColor" ), 0x00000002 ); - GetBoolProperty( mbEnabled, rPropSet, WW8_ASCII2STR( "Enabled" ), 0x00000304 ); - GetInt32Property( mnMin, rPropSet, WW8_ASCII2STR( "ScrollValueMin" ), 0x00000020 ); - GetInt32Property( mnMax, rPropSet, WW8_ASCII2STR( "ScrollValueMax" ), 0x00000040 ); - GetInt32Property( mnValue, rPropSet, WW8_ASCII2STR( "ScrollValue" ), 0x00000080 ); - GetInt32Property( mnSmallStep, rPropSet, WW8_ASCII2STR( "LineIncrement" ), 0x00000800 ); - GetInt32Property( mnPageStep, rPropSet, WW8_ASCII2STR( "BlockIncrement" ), 0x00001000 ); - GetInt32Property( mnDelay, rPropSet, WW8_ASCII2STR( "RepeatDelay" ), 0x00008000 ); + GetInt32Property( mnForeColor, rPropSet, C2U( "SymbolColor" ), 0x00000001 ); + GetInt32Property( mnBackColor, rPropSet, C2U( "BackgroundColor" ), 0x00000002 ); + GetBoolProperty( mbEnabled, rPropSet, C2U( "Enabled" ), 0x00000304 ); + GetInt32Property( mnMin, rPropSet, C2U( "ScrollValueMin" ), 0x00000020 ); + GetInt32Property( mnMax, rPropSet, C2U( "ScrollValueMax" ), 0x00000040 ); + GetInt32Property( mnValue, rPropSet, C2U( "ScrollValue" ), 0x00000080 ); + GetInt32Property( mnSmallStep, rPropSet, C2U( "LineIncrement" ), 0x00000800 ); + GetInt32Property( mnPageStep, rPropSet, C2U( "BlockIncrement" ), 0x00001000 ); + GetInt32Property( mnDelay, rPropSet, C2U( "RepeatDelay" ), 0x00008000 ); namespace AwtScrollOrient = ::com::sun::star::awt::ScrollBarOrientation; sal_Int16 nApiOrient = sal_Int16(); - if( rPropSet->getPropertyValue( WW8_ASCII2STR( "Orientation" ) ) >>= nApiOrient ) + if( rPropSet->getPropertyValue( C2U( "Orientation" ) ) >>= nApiOrient ) UpdateInt32Property( mnOrient, (nApiOrient == AwtScrollOrient::VERTICAL) ? 0 : 1, 0x00002000 ); UpdateBoolProperty( mbPropThumb, true, 0x00004000 ); diff --git a/filter/source/msfilter/mstoolbar.cxx b/filter/source/msfilter/mstoolbar.cxx index 398d281088f5..83e4dd44fe4a 100644 --- a/filter/source/msfilter/mstoolbar.cxx +++ b/filter/source/msfilter/mstoolbar.cxx @@ -43,8 +43,6 @@ #include <map> #include <sfx2/objsh.hxx> #include <basic/basmgr.hxx> -#include <svtools/filterutils.hxx> -#include <boost/scoped_array.hpp> #include <filter/msfilter/msvbahelper.hxx> #include <svtools/miscopt.hxx> #include <vcl/svapp.hxx> @@ -215,15 +213,6 @@ TBBase::indent_printf( FILE* fp, const char* format, ... ) va_end( ap ); } -rtl::OUString TBBase::readUnicodeString( SvStream* pS, sal_Size nChars ) -{ - sal_Size nBufSize = nChars * 2; - boost::scoped_array< sal_uInt8 > pArray( new sal_uInt8[ nBufSize ] ); - sal_Size nReadSize = pS->Read( pArray.get(), nBufSize ); - OSL_ASSERT(nReadSize == nBufSize); - return svt::BinFilterUtils::CreateOUStringFromUniStringArray( reinterpret_cast< const char* >( pArray.get() ), nReadSize ); -} - TBCHeader::TBCHeader() : bSignature( 0x3 ) ,bVersion( 0x01 ) ,bFlagsTCR( 0 ) @@ -238,17 +227,17 @@ TBCHeader::~TBCHeader() { } -bool TBCHeader::Read( SvStream* pS ) +bool TBCHeader::Read( SvStream &rS ) { - OSL_TRACE("TBCHeader::Read() stream pos 0x%x", pS->Tell() ); - nOffSet = pS->Tell(); - *pS >> bSignature >> bVersion >> bFlagsTCR >> tct >> tcid >> tbct >> bPriority; + OSL_TRACE("TBCHeader::Read() stream pos 0x%x", rS.Tell() ); + nOffSet = rS.Tell(); + rS >> bSignature >> bVersion >> bFlagsTCR >> tct >> tcid >> tbct >> bPriority; // bit 4 ( from lsb ) if ( bFlagsTCR & 0x10 ) { width.reset( new sal_uInt16 ); height.reset( new sal_uInt16 ); - *pS >> *width >> *height; + rS >> *width >> *height; } return true; } @@ -274,11 +263,11 @@ TBCData::TBCData( const TBCHeader& Header ) : rHeader( Header ) { } -bool TBCData::Read(SvStream *pS) +bool TBCData::Read(SvStream &rS) { - OSL_TRACE("TBCData::Read() stream pos 0x%x", pS->Tell() ); - nOffSet = pS->Tell(); - if ( !controlGeneralInfo.Read(pS) /*|| !controlSpecificInfo.Read(pS)*/ ) + OSL_TRACE("TBCData::Read() stream pos 0x%x", rS.Tell() ); + nOffSet = rS.Tell(); + if ( !controlGeneralInfo.Read(rS) /*|| !controlSpecificInfo.Read(rS)*/ ) return false; switch ( rHeader.getTct() ) { @@ -304,7 +293,7 @@ bool TBCData::Read(SvStream *pS) break; } if ( controlSpecificInfo.get() ) - return controlSpecificInfo->Read( pS ); + return controlSpecificInfo->Read( rS ); //#FIXME I need to be able to handle different controlSpecificInfo types. return true; } @@ -417,13 +406,13 @@ void TBCData::Print( FILE* fp ) } bool -WString::Read( SvStream *pS ) +WString::Read( SvStream &rS ) { - OSL_TRACE("WString::Read() stream pos 0x%x", pS->Tell() ); - nOffSet = pS->Tell(); + OSL_TRACE("WString::Read() stream pos 0x%x", rS.Tell() ); + nOffSet = rS.Tell(); sal_uInt8 nChars = 0; - *pS >> nChars; - sString = readUnicodeString( pS, nChars ); + rS >> nChars; + sString = read_LEuInt16s_AsOUString(rS, nChars); return true; } @@ -432,19 +421,19 @@ TBCExtraInfo::TBCExtraInfo() : idHelpContext( 0 ) } bool -TBCExtraInfo::Read( SvStream *pS ) +TBCExtraInfo::Read( SvStream &rS ) { - OSL_TRACE("TBCExtraInfo::Read() stream pos 0x%x", pS->Tell() ); - nOffSet = pS->Tell(); - if( !wstrHelpFile.Read( pS ) ) + OSL_TRACE("TBCExtraInfo::Read() stream pos 0x%x", rS.Tell() ); + nOffSet = rS.Tell(); + if( !wstrHelpFile.Read( rS ) ) return false; - *pS >> idHelpContext; + rS >> idHelpContext; - if ( !wstrTag.Read( pS ) || !wstrOnAction.Read( pS ) || !wstrParam.Read( pS ) ) + if ( !wstrTag.Read( rS ) || !wstrOnAction.Read( rS ) || !wstrParam.Read( rS ) ) return false; - *pS >> tbcu >> tbmg; + rS >> tbcu >> tbmg; return true; } @@ -477,17 +466,17 @@ TBCGeneralInfo::TBCGeneralInfo() : bFlags( 0 ) { } -bool TBCGeneralInfo::Read( SvStream *pS ) +bool TBCGeneralInfo::Read( SvStream &rS ) { - OSL_TRACE("TBCGeneralInfo::Read() stream pos 0x%x", pS->Tell() ); - nOffSet = pS->Tell(); - *pS >> bFlags; + OSL_TRACE("TBCGeneralInfo::Read() stream pos 0x%x", rS.Tell() ); + nOffSet = rS.Tell(); + rS >> bFlags; - if ( ( bFlags & 0x1 ) && !customText.Read( pS ) ) + if ( ( bFlags & 0x1 ) && !customText.Read( rS ) ) return false; - if ( ( bFlags & 0x2 ) && ( !descriptionText.Read( pS ) || !tooltip.Read( pS ) ) ) + if ( ( bFlags & 0x2 ) && ( !descriptionText.Read( rS ) || !tooltip.Read( rS ) ) ) return false; - if ( ( bFlags & 0x4 ) && !extraInfo.Read( pS ) ) + if ( ( bFlags & 0x4 ) && !extraInfo.Read( rS ) ) return false; return true; } @@ -557,15 +546,15 @@ TBCMenuSpecific::TBCMenuSpecific() : tbid( 0 ) } bool -TBCMenuSpecific::Read( SvStream *pS) +TBCMenuSpecific::Read( SvStream &rS) { - OSL_TRACE("TBCMenuSpecific::Read() stream pos 0x%x", pS->Tell() ); - nOffSet = pS->Tell(); - *pS >> tbid; + OSL_TRACE("TBCMenuSpecific::Read() stream pos 0x%x", rS.Tell() ); + nOffSet = rS.Tell(); + rS >> tbid; if ( tbid == 1 ) { name.reset( new WString() ); - return name->Read( pS ); + return name->Read( rS ); } return true; } @@ -592,11 +581,11 @@ TBCBSpecific::TBCBSpecific() : bFlags( 0 ) { } -bool TBCBSpecific::Read( SvStream *pS) +bool TBCBSpecific::Read( SvStream &rS) { - OSL_TRACE("TBCBSpecific::Read() stream pos 0x%x", pS->Tell() ); - nOffSet = pS->Tell(); - *pS >> bFlags; + OSL_TRACE("TBCBSpecific::Read() stream pos 0x%x", rS.Tell() ); + nOffSet = rS.Tell(); + rS >> bFlags; // bFlags determines what we read next @@ -605,20 +594,20 @@ bool TBCBSpecific::Read( SvStream *pS) { icon.reset( new TBCBitMap() ); iconMask.reset( new TBCBitMap() ); - if ( !icon->Read( pS ) || !iconMask->Read( pS ) ) + if ( !icon->Read( rS ) || !iconMask->Read( rS ) ) return false; } // if bFlags.fCustomBtnFace = 1 ( 0x10 ) if ( bFlags & 0x10 ) { iBtnFace.reset( new sal_uInt16 ); - *pS >> *iBtnFace.get(); + rS >> *iBtnFace.get(); } // if bFlags.fAccelerator equals 1 ( 0x04 ) if ( bFlags & 0x04 ) { wstrAcc.reset( new WString() ); - return wstrAcc->Read( pS ); + return wstrAcc->Read( rS ); } return true; } @@ -671,11 +660,11 @@ TBCComboDropdownSpecific::TBCComboDropdownSpecific(const TBCHeader& header ) data.reset( new TBCCDData() ); } -bool TBCComboDropdownSpecific::Read( SvStream *pS) +bool TBCComboDropdownSpecific::Read( SvStream &rS) { - nOffSet = pS->Tell(); + nOffSet = rS.Tell(); if ( data.get() ) - return data->Read( pS ); + return data->Read( rS ); return true; } @@ -700,23 +689,23 @@ TBCCDData::~TBCCDData() { } -bool TBCCDData::Read( SvStream *pS) +bool TBCCDData::Read( SvStream &rS) { - nOffSet = pS->Tell(); - *pS >> cwstrItems; + nOffSet = rS.Tell(); + rS >> cwstrItems; if ( cwstrItems ) { for( sal_Int32 index=0; index < cwstrItems; ++index ) { WString aString; - if ( !aString.Read( pS ) ) + if ( !aString.Read( rS ) ) return false; wstrList.push_back( aString ); } } - *pS >> cwstrMRU >> iSel >> cLines >> dxWidth; + rS >> cwstrMRU >> iSel >> cLines >> dxWidth; - return wstrEdit.Read( pS ); + return wstrEdit.Read( rS ); } void TBCCDData::Print( FILE* fp) @@ -751,13 +740,13 @@ TBCBitMap::getBitMap() return mBitMap; } -bool TBCBitMap::Read( SvStream* pS) +bool TBCBitMap::Read( SvStream& rS) { - OSL_TRACE("TBCBitMap::Read() stream pos 0x%x", pS->Tell() ); - nOffSet = pS->Tell(); - *pS >> cbDIB; + OSL_TRACE("TBCBitMap::Read() stream pos 0x%x", rS.Tell() ); + nOffSet = rS.Tell(); + rS >> cbDIB; // cbDIB = sizeOf(biHeader) + sizeOf(colors) + sizeOf(bitmapData) + 10 - return mBitMap.Read( *pS, sal_False, sal_True ); + return mBitMap.Read( rS, sal_False, sal_True ); } void TBCBitMap::Print( FILE* fp ) @@ -777,12 +766,12 @@ bFlags( 0 ) { } -bool TB::Read(SvStream *pS) +bool TB::Read(SvStream &rS) { - OSL_TRACE("TB::Read() stream pos 0x%x", pS->Tell() ); - nOffSet = pS->Tell(); - *pS >> bSignature >> bVersion >> cCL >> ltbid >> ltbtr >> cRowsDefault >> bFlags; - name.Read( pS ); + OSL_TRACE("TB::Read() stream pos 0x%x", rS.Tell() ); + nOffSet = rS.Tell(); + rS >> bSignature >> bVersion >> cCL >> ltbid >> ltbtr >> cRowsDefault >> bFlags; + name.Read( rS ); return true; } @@ -815,13 +804,13 @@ TBVisualData::TBVisualData() : tbds(0), tbv(0), tbdsDock(0), iRow(0) { } -bool TBVisualData::Read( SvStream* pS ) +bool TBVisualData::Read( SvStream& rS ) { - OSL_TRACE("TBVisualData::Read() stream pos 0x%x", pS->Tell() ); - nOffSet = pS->Tell(); - *pS >> tbds >> tbv >> tbdsDock >> iRow; - rcDock.Read( pS ); - rcFloat.Read( pS ); + OSL_TRACE("TBVisualData::Read() stream pos 0x%x", rS.Tell() ); + nOffSet = rS.Tell(); + rS >> tbds >> tbv >> tbdsDock >> iRow; + rcDock.Read( rS ); + rcFloat.Read( rS ); return true; } diff --git a/svtools/Library_svt.mk b/svtools/Library_svt.mk index 7bedf766aa02..8d012052d7b9 100644 --- a/svtools/Library_svt.mk +++ b/svtools/Library_svt.mk @@ -208,7 +208,6 @@ $(eval $(call gb_Library_add_exception_objects,svt,\ svtools/source/misc/ehdl \ svtools/source/misc/embedhlp \ svtools/source/misc/embedtransfer \ - svtools/source/misc/filterutils \ svtools/source/misc/filechangedchecker \ svtools/source/misc/helpagentwindow \ svtools/source/misc/imagemgr \ diff --git a/svtools/Package_inc.mk b/svtools/Package_inc.mk index 540db0909d9c..0a94ec8c8947 100644 --- a/svtools/Package_inc.mk +++ b/svtools/Package_inc.mk @@ -69,7 +69,6 @@ $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/filedlg2.hrc,svtools/f $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/fileurlbox.hxx,svtools/fileurlbox.hxx)) $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/fileview.hxx,svtools/fileview.hxx)) $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/filter.hxx,svtools/filter.hxx)) -$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/filterutils.hxx,svtools/filterutils.hxx)) $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/filechangedchecker.hxx,svtools/filechangedchecker.hxx)) $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/fixedhyper.hxx,svtools/fixedhyper.hxx)) $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/fltcall.hxx,svtools/fltcall.hxx)) diff --git a/svtools/inc/svtools/filterutils.hxx b/svtools/inc/svtools/filterutils.hxx deleted file mode 100644 index 0676ce968da8..000000000000 --- a/svtools/inc/svtools/filterutils.hxx +++ /dev/null @@ -1,24 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -#ifndef SVTOOLS_INC_FILTERUTILS_HXX -#define SVTOOLS_INC_FILTERUTILS_HXX - -#include "svtools/svtdllapi.h" -#include <com/sun/star/uno/RuntimeException.hpp> -namespace svt -{ - class BinFilterUtils - { - private: - BinFilterUtils(); // never implemented - - public: - SVT_DLLPUBLIC static rtl::OUString CreateOUStringFromUniStringArray( const char* pcCharArr, sal_uInt32 nBufSize ); - }; - -//........................................................................ -} // namespace svt -//........................................................................ - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/misc/filterutils.cxx b/svtools/source/misc/filterutils.cxx deleted file mode 100644 index d0d481a81988..000000000000 --- a/svtools/source/misc/filterutils.cxx +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include <svtools/filterutils.hxx> -#include <rtl/ustrbuf.hxx> - -namespace svt -{ -//........................................................................ - - using namespace ::com::sun::star; - - rtl::OUString lcl_createStringFromArray( const char* pcCharArr, sal_uInt32 nBufSize ) - { - rtl::OUStringBuffer aBuffer; - // buffer contains Little-Endian Unicode - sal_Int32 nStrLen = static_cast< sal_Int32 >( nBufSize ) / 2; - aBuffer.setLength( nStrLen ); - const char* pcCurrChar = pcCharArr; - for( sal_Int32 nChar = 0; nChar < nStrLen; ++nChar ) - { - /* *pcCurrChar may contain negative values and therefore MUST be - casted to unsigned char, before assigned to a sal_Unicode. */ - sal_Unicode cChar = static_cast< unsigned char >( *pcCurrChar++ ); - cChar |= (static_cast< unsigned char >( *pcCurrChar++ ) << 8); - aBuffer.setCharAt( nChar, cChar ); - } - return aBuffer.makeStringAndClear(); - } - - rtl::OUString BinFilterUtils::CreateOUStringFromUniStringArray( const char* pcCharArr, sal_uInt32 nBufSize ) - { - return lcl_createStringFromArray( pcCharArr, nBufSize ); - } -//........................................................................ -} // namespace svt -//........................................................................ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 7e5aaa1b842e..1b63541d5f7f 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -257,7 +257,7 @@ struct SBBItem public: Sttb(); ~Sttb(); - bool Read(SvStream *pS); + bool Read(SvStream &rS); void Print( FILE* fp ); rtl::OUString getStringAtIndex( sal_uInt32 ); }; @@ -272,18 +272,18 @@ Sttb::~Sttb() { } -bool Sttb::Read( SvStream* pS ) +bool Sttb::Read( SvStream& rS ) { - OSL_TRACE("Sttb::Read() stream pos 0x%x", pS->Tell() ); - nOffSet = pS->Tell(); - *pS >> fExtend >> cData >> cbExtra; + OSL_TRACE("Sttb::Read() stream pos 0x%x", rS.Tell() ); + nOffSet = rS.Tell(); + rS >> fExtend >> cData >> cbExtra; if ( cData ) { for ( sal_Int32 index = 0; index < cData; ++index ) { SBBItem aItem; - *pS >> aItem.cchData; - aItem.data = readUnicodeString( pS, aItem.cchData ); + rS >> aItem.cchData; + aItem.data = read_LEuInt16s_AsOUString(rS, aItem.cchData); dataItems.push_back( aItem ); } } @@ -4189,7 +4189,7 @@ void SwWW8ImplReader::ReadDocInfo() long nCur = pTableStream->Tell(); Sttb aSttb; pTableStream->Seek( pWwFib->fcSttbfAssoc ); // point at tgc record - if (!aSttb.Read( pTableStream ) ) + if (!aSttb.Read( *pTableStream ) ) OSL_TRACE("** Read of SttbAssoc data failed!!!! "); pTableStream->Seek( nCur ); // return to previous position, is that necessary? #if DEBUG @@ -4263,7 +4263,7 @@ bool WW8Customizations::Import( SwDocShell* pShell ) Tcg aTCG; long nCur = mpTableStream->Tell(); mpTableStream->Seek( mWw8Fib.fcCmds ); // point at tgc record - bool bReadResult = aTCG.Read( mpTableStream ); + bool bReadResult = aTCG.Read( *mpTableStream ); mpTableStream->Seek( nCur ); // return to previous position, is that necessary? if ( !bReadResult ) { diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index 613a6e1ffe60..5ec7a2e8d69e 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -4337,7 +4337,7 @@ void WW8RStyle::ImportOldFormatStyles() } else // user style { - rtl::OString aTmp = readBytesAsOString(rSt, nCount); + rtl::OString aTmp = read_uInt8s_AsOString(rSt, nCount); nByteCount += aTmp.getLength(); sName = rtl::OStringToOUString(aTmp, eStructChrSet); } diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index 0419c44852d2..c058e36e373c 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -2006,7 +2006,7 @@ xub_StrLen WW8ScannerBase::WW8ReadString( SvStream& rStrm, String& rStr, else { // Alloc method automatically sets Zero at the end - rtl::OString aByteStr = readBytesAsOString(rStrm, nLen); + rtl::OString aByteStr = read_uInt8s_AsOString(rStrm, nLen); rStr.Append(String(rtl::OStringToOUString(aByteStr, eEnc))); } nTotalRead += nLen; @@ -3910,7 +3910,7 @@ void WW8ReadSTTBF(bool bVer8, SvStream& rStrm, sal_uInt32 nStart, sal_Int32 nLen { sal_uInt8 nBChar(0); rStrm >> nBChar; - rtl::OString aTmp = readBytesAsOString(rStrm, nBChar); + rtl::OString aTmp = read_uInt8s_AsOString(rStrm, nBChar); rArray.push_back(rtl::OStringToOUString(aTmp, eCS)); } @@ -3943,7 +3943,7 @@ void WW8ReadSTTBF(bool bVer8, SvStream& rStrm, sal_uInt32 nStart, sal_Int32 nLen { sal_uInt8 nBChar(0); rStrm >> nBChar; - rtl::OString aTmp = readBytesAsOString(rStrm, nBChar); + rtl::OString aTmp = read_uInt8s_AsOString(rStrm, nBChar); pValueArray->push_back(rtl::OStringToOUString(aTmp, eCS)); } } @@ -3969,7 +3969,7 @@ void WW8ReadSTTBF(bool bVer8, SvStream& rStrm, sal_uInt32 nStart, sal_Int32 nLen ++nRead; if (nBChar) { - rtl::OString aTmp = readBytesAsOString(rStrm, nBChar); + rtl::OString aTmp = read_uInt8s_AsOString(rStrm, nBChar); nRead += aTmp.getLength(); rArray.push_back(rtl::OStringToOUString(aTmp, eCS)); } diff --git a/sw/source/filter/ww8/ww8toolbar.cxx b/sw/source/filter/ww8/ww8toolbar.cxx index 57fd027b81bd..1147e9e6b010 100644 --- a/sw/source/filter/ww8/ww8toolbar.cxx +++ b/sw/source/filter/ww8/ww8toolbar.cxx @@ -127,19 +127,19 @@ CTB* CTBWrapper::GetCustomizationData( const rtl::OUString& sTBName ) return pCTB; } -bool CTBWrapper::Read( SvStream* pS ) -{ - OSL_TRACE("CTBWrapper::Read() stream pos 0x%x", pS->Tell() ); - nOffSet = pS->Tell(); - Tcg255SubStruct::Read( pS ); - *pS >> reserved2 >> reserved3 >> reserved4 >> reserved5; - *pS >> cbTBD >> cCust >> cbDTBC; - long nExpectedPos = pS->Tell() + cbDTBC; +bool CTBWrapper::Read( SvStream& rS ) +{ + OSL_TRACE("CTBWrapper::Read() stream pos 0x%x", rS.Tell() ); + nOffSet = rS.Tell(); + Tcg255SubStruct::Read( rS ); + rS >> reserved2 >> reserved3 >> reserved4 >> reserved5; + rS >> cbTBD >> cCust >> cbDTBC; + long nExpectedPos = rS.Tell() + cbDTBC; if ( cbDTBC ) { // cbDTBC is the size in bytes of the TBC array // but the size of a TBC element is dynamic ( and this relates to TBDelta's - int nStart = pS->Tell(); + int nStart = rS.Tell(); int bytesRead = 0; int bytesToRead = cbDTBC - bytesRead; @@ -149,28 +149,28 @@ bool CTBWrapper::Read( SvStream* pS ) do { TBC aTBC; - if ( !aTBC.Read( pS ) ) + if ( !aTBC.Read( rS ) ) return false; rtbdc.push_back( aTBC ); - bytesToRead = cbDTBC - ( pS->Tell() - nStart ); + bytesToRead = cbDTBC - ( rS.Tell() - nStart ); } while ( bytesToRead > 0 ); } - if ( static_cast< long >( pS->Tell() ) != nExpectedPos ) + if ( static_cast< long >( rS.Tell() ) != nExpectedPos ) { // Strange error condition, shouldn't happen ( but does in at least // one test document ) In the case where it happens the TBC & // TBCHeader records seem blank??? ( and incorrect ) - OSL_ENSURE( static_cast< long >(pS->Tell()) == nExpectedPos, "### Error: Expected pos not equal to actual pos after reading rtbdc"); - OSL_TRACE("\tPos now is 0x%x should be 0x%x", pS->Tell(), nExpectedPos ); + OSL_ENSURE( static_cast< long >(rS.Tell()) == nExpectedPos, "### Error: Expected pos not equal to actual pos after reading rtbdc"); + OSL_TRACE("\tPos now is 0x%x should be 0x%x", rS.Tell(), nExpectedPos ); // seek to correct position after rtbdc - pS->Seek( nExpectedPos ); + rS.Seek( nExpectedPos ); } if ( cCust ) { for ( sal_Int32 index = 0; index < cCust; ++index ) { Customization aCust( this ); - if ( !aCust.Read( pS ) ) + if ( !aCust.Read( rS ) ) return false; rCustomizations.push_back( aCust ); } @@ -267,17 +267,17 @@ Customization::~Customization() { } -bool Customization::Read( SvStream *pS) +bool Customization::Read( SvStream &rS) { - OSL_TRACE("Custimization::Read() stream pos 0x%x", pS->Tell() ); - nOffSet = pS->Tell(); - *pS >> tbidForTBD >> reserved1 >> ctbds; + OSL_TRACE("Custimization::Read() stream pos 0x%x", rS.Tell() ); + nOffSet = rS.Tell(); + rS >> tbidForTBD >> reserved1 >> ctbds; if ( tbidForTBD ) { for ( sal_Int32 index = 0; index < ctbds; ++index ) { TBDelta aTBDelta; - if (!aTBDelta.Read( pS ) ) + if (!aTBDelta.Read( rS ) ) return false; customizationDataTBDelta.push_back( aTBDelta ); // Only set the drop down for menu's associated with standard toolbar @@ -288,7 +288,7 @@ bool Customization::Read( SvStream *pS) else { customizationDataCTB.reset( new CTB() ); - if ( !customizationDataCTB->Read( pS ) ) + if ( !customizationDataCTB->Read( rS ) ) return false; } return true; @@ -457,12 +457,12 @@ sal_Int16 TBDelta::CustomizationIndex() return nIndex; } -bool TBDelta::Read(SvStream *pS) +bool TBDelta::Read(SvStream &rS) { - OSL_TRACE("TBDelta::Read() stream pos 0x%x", pS->Tell() ); - nOffSet = pS->Tell(); - *pS >> doprfatendFlags >> ibts >> cidNext >> cid >> fc ; - *pS >> CiTBDE >> cbTBC; + OSL_TRACE("TBDelta::Read() stream pos 0x%x", rS.Tell() ); + nOffSet = rS.Tell(); + rS >> doprfatendFlags >> ibts >> cidNext >> cid >> fc ; + rS >> CiTBDE >> cbTBC; return true; } @@ -504,30 +504,30 @@ bool CTB::IsMenuToolbar() } -bool CTB::Read( SvStream *pS) +bool CTB::Read( SvStream &rS) { - OSL_TRACE("CTB::Read() stream pos 0x%x", pS->Tell() ); - nOffSet = pS->Tell(); - if ( !name.Read( pS ) ) + OSL_TRACE("CTB::Read() stream pos 0x%x", rS.Tell() ); + nOffSet = rS.Tell(); + if ( !name.Read( rS ) ) return false; - *pS >> cbTBData; - if ( !tb.Read( pS ) ) + rS >> cbTBData; + if ( !tb.Read( rS ) ) return false; for ( short index = 0; index < nVisualData; ++index ) { TBVisualData aVisData; - aVisData.Read( pS ); + aVisData.Read( rS ); rVisualData.push_back( aVisData ); } - *pS >> iWCTBl >> reserved >> unused >> cCtls; + rS >> iWCTBl >> reserved >> unused >> cCtls; if ( cCtls ) { for ( sal_Int32 index = 0; index < cCtls; ++index ) { TBC aTBC; - if ( !aTBC.Read( pS ) ) + if ( !aTBC.Read( rS ) ) return false; rTBC.push_back( aTBC ); } @@ -626,22 +626,22 @@ TBC::~TBC() { } -bool TBC::Read( SvStream *pS ) +bool TBC::Read( SvStream &rS ) { - OSL_TRACE("TBC::Read() stream pos 0x%x", pS->Tell() ); - nOffSet = pS->Tell(); - if ( !tbch.Read( pS ) ) + OSL_TRACE("TBC::Read() stream pos 0x%x", rS.Tell() ); + nOffSet = rS.Tell(); + if ( !tbch.Read( rS ) ) return false; if ( tbch.getTcID() != 0x1 && tbch.getTcID() != 0x1051 ) { cid.reset( new sal_uInt32 ); - *pS >> *cid; + rS >> *cid; } // MUST exist if tbch.tct is not equal to 0x16 if ( tbch.getTct() != 0x16 ) { tbcd.reset( new TBCData( tbch ) ); - if ( !tbcd->Read( pS ) ) + if ( !tbcd->Read( rS ) ) return false; } return true; @@ -782,13 +782,13 @@ TBC::GetCustomText() } bool -Xst::Read( SvStream* pS ) +Xst::Read( SvStream& rS ) { - OSL_TRACE("Xst::Read() stream pos 0x%x", pS->Tell() ); - nOffSet = pS->Tell(); + OSL_TRACE("Xst::Read() stream pos 0x%x", rS.Tell() ); + nOffSet = rS.Tell(); sal_Int16 nChars = 0; - *pS >> nChars; - sString = readUnicodeString( pS, static_cast< sal_Int32 >( nChars ) ); + rS >> nChars; + sString = read_LEuInt16s_AsOUString(rS, nChars); return true; } @@ -804,15 +804,15 @@ Tcg::Tcg() : nTcgVer( 255 ) { } -bool Tcg::Read(SvStream *pS) +bool Tcg::Read(SvStream &rS) { - OSL_TRACE("Tcg::Read() stream pos 0x%x", pS->Tell() ); - nOffSet = pS->Tell(); - *pS >> nTcgVer; + OSL_TRACE("Tcg::Read() stream pos 0x%x", rS.Tell() ); + nOffSet = rS.Tell(); + rS >> nTcgVer; if ( nTcgVer != (sal_Int8)255 ) return false; tcg.reset( new Tcg255() ); - return tcg->Read( pS ); + return tcg->Read( rS ); } void Tcg::Print( FILE* fp ) @@ -842,7 +842,7 @@ Tcg255::~Tcg255() delete *it; } -bool Tcg255::processSubStruct( sal_uInt8 nId, SvStream *pS ) +bool Tcg255::processSubStruct( sal_uInt8 nId, SvStream &rS ) { Tcg255SubStruct* pSubStruct = NULL; switch ( nId ) @@ -883,7 +883,7 @@ bool Tcg255::processSubStruct( sal_uInt8 nId, SvStream *pS ) return false; } pSubStruct->ch = nId; - if ( !pSubStruct->Read( pS ) ) + if ( !pSubStruct->Read( rS ) ) return false; rgtcgData.push_back( pSubStruct ); return true; @@ -909,18 +909,18 @@ bool Tcg255::ImportCustomToolBar( SfxObjectShell& rDocSh ) } -bool Tcg255::Read(SvStream *pS) +bool Tcg255::Read(SvStream &rS) { - OSL_TRACE("Tcg255::Read() stream pos 0x%x", pS->Tell() ); - nOffSet = pS->Tell(); + OSL_TRACE("Tcg255::Read() stream pos 0x%x", rS.Tell() ); + nOffSet = rS.Tell(); sal_uInt8 nId = 0x40; - *pS >> nId; + rS >> nId; while ( nId != 0x40 ) { - if ( !processSubStruct( nId, pS ) ) + if ( !processSubStruct( nId, rS ) ) return false; nId = 0x40; - *pS >> nId; + rS >> nId; } return true; // Peek at @@ -947,12 +947,12 @@ Tcg255SubStruct::Tcg255SubStruct( bool bReadId ) : mbReadId( bReadId ), ch(0) { } -bool Tcg255SubStruct::Read(SvStream *pS) +bool Tcg255SubStruct::Read(SvStream &rS) { - OSL_TRACE("Tcg255SubStruct::Read() stream pos 0x%x", pS->Tell() ); - nOffSet = pS->Tell(); + OSL_TRACE("Tcg255SubStruct::Read() stream pos 0x%x", rS.Tell() ); + nOffSet = rS.Tell(); if ( mbReadId ) - *pS >> ch; + rS >> ch; return true; } @@ -966,18 +966,18 @@ PlfMcd::~PlfMcd() delete[] rgmcd; } -bool PlfMcd::Read(SvStream *pS) +bool PlfMcd::Read(SvStream &rS) { - OSL_TRACE("PffMcd::Read() stream pos 0x%x", pS->Tell() ); - nOffSet = pS->Tell(); - Tcg255SubStruct::Read( pS ); - *pS >> iMac; + OSL_TRACE("PffMcd::Read() stream pos 0x%x", rS.Tell() ); + nOffSet = rS.Tell(); + Tcg255SubStruct::Read( rS ); + rS >> iMac; if ( iMac ) { rgmcd = new MCD[ iMac ]; for ( sal_Int32 index = 0; index < iMac; ++index ) { - if ( !rgmcd[ index ].Read( pS ) ) + if ( !rgmcd[ index ].Read( rS ) ) return false; } } @@ -1011,18 +1011,18 @@ PlfAcd::~PlfAcd() delete[] rgacd; } -bool PlfAcd::Read( SvStream *pS) +bool PlfAcd::Read( SvStream &rS) { - OSL_TRACE("PffAcd::Read() stream pos 0x%x", pS->Tell() ); - nOffSet = pS->Tell(); - Tcg255SubStruct::Read( pS ); - *pS >> iMac; + OSL_TRACE("PffAcd::Read() stream pos 0x%x", rS.Tell() ); + nOffSet = rS.Tell(); + Tcg255SubStruct::Read( rS ); + rS >> iMac; if ( iMac ) { rgacd = new Acd[ iMac ]; for ( sal_Int32 index = 0; index < iMac; ++index ) { - if ( !rgacd[ index ].Read( pS ) ) + if ( !rgacd[ index ].Read( rS ) ) return false; } } @@ -1054,18 +1054,18 @@ PlfKme::~PlfKme() delete[] rgkme; } -bool PlfKme::Read(SvStream *pS) +bool PlfKme::Read(SvStream &rS) { - OSL_TRACE("PlfKme::Read() stream pos 0x%x", pS->Tell() ); - nOffSet = pS->Tell(); - Tcg255SubStruct::Read( pS ); - *pS >> iMac; + OSL_TRACE("PlfKme::Read() stream pos 0x%x", rS.Tell() ); + nOffSet = rS.Tell(); + Tcg255SubStruct::Read( rS ); + rS >> iMac; if ( iMac ) { rgkme = new Kme[ iMac ]; for( sal_Int32 index=0; index<iMac; ++index ) { - if ( !rgkme[ index ].Read( pS ) ) + if ( !rgkme[ index ].Read( rS ) ) return false; } } @@ -1090,12 +1090,12 @@ TcgSttbf::TcgSttbf( bool bReadId ) : Tcg255SubStruct( bReadId ) { } -bool TcgSttbf::Read( SvStream *pS) +bool TcgSttbf::Read( SvStream &rS) { - OSL_TRACE("TcgSttbf::Read() stream pos 0x%x", pS->Tell() ); - nOffSet = pS->Tell(); - Tcg255SubStruct::Read( pS ); - return sttbf.Read( pS ); + OSL_TRACE("TcgSttbf::Read() stream pos 0x%x", rS.Tell() ); + nOffSet = rS.Tell(); + Tcg255SubStruct::Read( rS ); + return sttbf.Read( rS ); } void TcgSttbf::Print( FILE* fp ) @@ -1118,19 +1118,19 @@ TcgSttbfCore::~TcgSttbfCore() delete[] dataItems; } -bool TcgSttbfCore::Read( SvStream* pS ) +bool TcgSttbfCore::Read( SvStream& rS ) { - OSL_TRACE("TcgSttbfCore::Read() stream pos 0x%x", pS->Tell() ); - nOffSet = pS->Tell(); - *pS >> fExtend >> cData >> cbExtra; + OSL_TRACE("TcgSttbfCore::Read() stream pos 0x%x", rS.Tell() ); + nOffSet = rS.Tell(); + rS >> fExtend >> cData >> cbExtra; if ( cData ) { dataItems = new SBBItem[ cData ]; for ( sal_Int32 index = 0; index < cData; ++index ) { - *pS >> dataItems[ index ].cchData; - dataItems[ index ].data = readUnicodeString( pS, dataItems[ index ].cchData ); - *pS >> dataItems[ index ].extraData; + rS >> dataItems[ index ].cchData; + dataItems[ index ].data = read_LEuInt16s_AsOUString(rS, dataItems[index].cchData); + rS >> dataItems[ index ].extraData; } } return true; @@ -1163,18 +1163,18 @@ MacroNames::~MacroNames() delete[] rgNames; } -bool MacroNames::Read( SvStream *pS) +bool MacroNames::Read( SvStream &rS) { - OSL_TRACE("MacroNames::Read() stream pos 0x%x", pS->Tell() ); - nOffSet = pS->Tell(); - Tcg255SubStruct::Read( pS ); - *pS >> iMac; + OSL_TRACE("MacroNames::Read() stream pos 0x%x", rS.Tell() ); + nOffSet = rS.Tell(); + Tcg255SubStruct::Read( rS ); + rS >> iMac; if ( iMac ) { rgNames = new MacroName[ iMac ]; for ( sal_Int32 index = 0; index < iMac; ++index ) { - if ( !rgNames[ index ].Read( pS ) ) + if ( !rgNames[ index ].Read( rS ) ) return false; } } @@ -1200,12 +1200,12 @@ MacroName::MacroName():ibst(0) } -bool MacroName::Read(SvStream *pS) +bool MacroName::Read(SvStream &rS) { - OSL_TRACE("MacroName::Read() stream pos 0x%x", pS->Tell() ); - nOffSet = pS->Tell(); - *pS >> ibst; - return xstz.Read( pS ); + OSL_TRACE("MacroName::Read() stream pos 0x%x", rS.Tell() ); + nOffSet = rS.Tell(); + rS >> ibst; + return xstz.Read( rS ); } void MacroName::Print( FILE* fp ) @@ -1223,13 +1223,13 @@ Xstz::Xstz():chTerm(0) } bool -Xstz::Read(SvStream *pS) +Xstz::Read(SvStream &rS) { - OSL_TRACE("Xstz::Read() stream pos 0x%x", pS->Tell() ); - nOffSet = pS->Tell(); - if ( !xst.Read( pS ) ) + OSL_TRACE("Xstz::Read() stream pos 0x%x", rS.Tell() ); + nOffSet = rS.Tell(); + if ( !xst.Read( rS ) ) return false; - *pS >> chTerm; + rS >> chTerm; if ( chTerm != 0 ) // should be an assert return false; return true; @@ -1258,11 +1258,11 @@ Kme::~Kme() } bool -Kme::Read(SvStream *pS) +Kme::Read(SvStream &rS) { - OSL_TRACE("Kme::Read() stream pos 0x%x", pS->Tell() ); - nOffSet = pS->Tell(); - *pS >> reserved1 >> reserved2 >> kcm1 >> kcm2 >> kt >> param; + OSL_TRACE("Kme::Read() stream pos 0x%x", rS.Tell() ); + nOffSet = rS.Tell(); + rS >> reserved1 >> reserved2 >> kcm1 >> kcm2 >> kt >> param; return true; } @@ -1284,11 +1284,11 @@ Acd::Acd() : ibst( 0 ) { } -bool Acd::Read(SvStream *pS) +bool Acd::Read(SvStream &rS) { - OSL_TRACE("Acd::Read() stream pos 0x%x", pS->Tell() ); - nOffSet = pS->Tell(); - *pS >> ibst >> fciBasedOnABC; + OSL_TRACE("Acd::Read() stream pos 0x%x", rS.Tell() ); + nOffSet = rS.Tell(); + rS >> ibst >> fciBasedOnABC; return true; } @@ -1313,12 +1313,12 @@ MCD::MCD() : reserved1(0x56) { } -bool MCD::Read(SvStream *pS) +bool MCD::Read(SvStream &rS) { - OSL_TRACE("MCD::Read() stream pos 0x%x", pS->Tell() ); - nOffSet = pS->Tell(); - *pS >> reserved1 >> reserved2 >> ibst >> ibstName >> reserved3; - *pS >> reserved4 >> reserved5 >> reserved6 >> reserved7; + OSL_TRACE("MCD::Read() stream pos 0x%x", rS.Tell() ); + nOffSet = rS.Tell(); + rS >> reserved1 >> reserved2 >> ibst >> ibstName >> reserved3; + rS >> reserved4 >> reserved5 >> reserved6 >> reserved7; return true; } diff --git a/sw/source/filter/ww8/ww8toolbar.hxx b/sw/source/filter/ww8/ww8toolbar.hxx index b983eaff0c53..a99c65f05214 100644 --- a/sw/source/filter/ww8/ww8toolbar.hxx +++ b/sw/source/filter/ww8/ww8toolbar.hxx @@ -40,7 +40,7 @@ class Xst : public TBBase rtl::OUString sString; public: Xst(){} - bool Read(SvStream *pS); + bool Read(SvStream &rS); rtl::OUString getString() { return sString; } void Print( FILE* fp ); }; @@ -54,7 +54,7 @@ class TBC : public TBBase public: TBC(); ~TBC(); - bool Read(SvStream *pS); + bool Read(SvStream &rS); void Print( FILE* ); bool ImportToolBarControl( CTBWrapper&, const css::uno::Reference< css::container::XIndexContainer >&, CustomToolBarImportHelper&, bool ); rtl::OUString GetCustomText(); @@ -77,7 +77,7 @@ class CTB : public TBBase public: CTB(); ~CTB(); - bool Read(SvStream *pS); + bool Read(SvStream &rS); void Print( FILE* fp ); bool IsMenuToolbar(); bool ImportCustomToolBar( CTBWrapper&, CustomToolBarImportHelper& ); @@ -98,7 +98,7 @@ class TBDelta : public TBBase public: TBDelta(); ~TBDelta(){} - bool Read(SvStream *pS); + bool Read(SvStream &rS); void Print( FILE* ); bool ControlIsModified(); bool ControlIsInserted(); @@ -121,7 +121,7 @@ public: Tcg255SubStruct( bool bReadId ); ~Tcg255SubStruct(){} virtual sal_uInt8 id() const { return ch; } - bool Read(SvStream *pS); + bool Read(SvStream &rS); }; class CTBWrapper; @@ -139,7 +139,7 @@ friend class CTBWrapper; public: Customization( CTBWrapper* rapper ); ~Customization(); - bool Read(SvStream *pS); + bool Read(SvStream &rS); bool ImportCustomToolBar( CTBWrapper&, CustomToolBarImportHelper& ); bool ImportMenu( CTBWrapper&, CustomToolBarImportHelper& ); void Print( FILE* ); @@ -172,7 +172,7 @@ public: ~CTBWrapper(); void InsertDropIndex( sal_Int32 aIndex ) { dropDownMenuIndices.push_back( aIndex ); } TBC* GetTBCAtOffset( sal_uInt32 nStreamOffset ); - bool Read(SvStream *pS); + bool Read(SvStream &rS); bool ImportCustomToolBar( SfxObjectShell& rDocSh ); Customization* GetCustomizaton( sal_Int16 index ); @@ -197,7 +197,7 @@ class MCD : public TBBase public: MCD(); ~MCD(){} - bool Read(SvStream *pS); + bool Read(SvStream &rS); void Print( FILE* ); }; @@ -210,7 +210,7 @@ class PlfMcd : public Tcg255SubStruct public: PlfMcd( bool bReadId = true ); ~PlfMcd(); - bool Read(SvStream *pS); + bool Read(SvStream &rS); void Print( FILE* ); }; @@ -223,7 +223,7 @@ class Acd : public TBBase public: Acd(); ~Acd(){} - bool Read(SvStream *pS); + bool Read(SvStream &rS); void Print( FILE* ); }; @@ -236,7 +236,7 @@ class PlfAcd: public Tcg255SubStruct public: PlfAcd( bool bReadId = true ); ~PlfAcd(); - bool Read(SvStream *pS); + bool Read(SvStream &rS); void Print(FILE*); }; @@ -254,7 +254,7 @@ class Kme : public TBBase public: Kme(); ~Kme(); - bool Read(SvStream *pS); + bool Read(SvStream &rS); void Print( FILE* ); }; @@ -267,7 +267,7 @@ class PlfKme : public Tcg255SubStruct public: PlfKme( bool bReadId = true ); ~PlfKme(); - bool Read(SvStream *pS); + bool Read(SvStream &rS); void Print( FILE* ); }; @@ -289,7 +289,7 @@ struct SBBItem public: TcgSttbfCore(); ~TcgSttbfCore(); - bool Read(SvStream *pS); + bool Read(SvStream &rS); void Print( FILE* fp ); }; @@ -301,7 +301,7 @@ class TcgSttbf : public Tcg255SubStruct public: TcgSttbf( bool bReadId = true ); ~TcgSttbf(){} - bool Read(SvStream *pS); + bool Read(SvStream &rS); void Print( FILE* fp ); }; @@ -315,7 +315,7 @@ class Xstz : public TBBase public: Xstz(); ~Xstz(){} - bool Read(SvStream *pS); + bool Read(SvStream &rS); void Print( FILE* fp ); }; @@ -328,7 +328,7 @@ class MacroName : public TBBase public: MacroName(); ~MacroName(){} - bool Read(SvStream *pS); + bool Read(SvStream &rS); void Print( FILE* ); }; @@ -342,7 +342,7 @@ class MacroNames : public Tcg255SubStruct public: MacroNames( bool bReadId = true ); ~MacroNames(); - bool Read(SvStream *pS); + bool Read(SvStream &rS); void Print( FILE* ); }; @@ -351,11 +351,11 @@ class Tcg255 : public TBBase std::vector< Tcg255SubStruct* > rgtcgData; // array of sub structures Tcg255(const Tcg255&); Tcg255& operator = ( const Tcg255&); - bool processSubStruct( sal_uInt8 nId, SvStream* ); + bool processSubStruct( sal_uInt8 nId, SvStream& ); public: Tcg255(); ~Tcg255(); - bool Read(SvStream *pS); + bool Read(SvStream &rS); void Print( FILE* ); bool ImportCustomToolBar( SfxObjectShell& rDocSh ); }; @@ -369,7 +369,7 @@ class Tcg: public TBBase public: Tcg(); ~Tcg(){} - bool Read(SvStream *pS); + bool Read(SvStream &rS); bool ImportCustomToolBar( SfxObjectShell& rDocSh ); void Print( FILE* ); }; diff --git a/tools/inc/tools/stream.hxx b/tools/inc/tools/stream.hxx index baaf758125c4..28e96aea0e03 100644 --- a/tools/inc/tools/stream.hxx +++ b/tools/inc/tools/stream.hxx @@ -564,9 +564,13 @@ TOOLS_DLLPUBLIC SvStream& endlu( SvStream& rStr ); /// call endlu() if eStreamCharSet==RTL_TEXTECODING_UNICODE otherwise endl() TOOLS_DLLPUBLIC SvStream& endlub( SvStream& rStr ); -//Attempt to read nSize bytes to an OString, returned rtl::OString's length is -//number of bytes successfully read -TOOLS_DLLPUBLIC rtl::OString readBytesAsOString(SvStream& rStr, sal_Size nSize); +//Attempt to read nLen 8bit units to an OString, returned rtl::OString's length +//is number of units successfully read +TOOLS_DLLPUBLIC rtl::OString read_uInt8s_AsOString(SvStream& rStr, sal_Size nLen); + +//Attempt to read nLen little endian 16bit units to an OUString, returned +//rtl::OUString's length is number of units successfully read +TOOLS_DLLPUBLIC rtl::OUString read_LEuInt16s_AsOUString(SvStream& rStr, sal_Size nLen); // -------------- // - FileStream - diff --git a/tools/qa/cppunit/test_stream.cxx b/tools/qa/cppunit/test_stream.cxx index ae098e5b836d..515952d93563 100644 --- a/tools/qa/cppunit/test_stream.cxx +++ b/tools/qa/cppunit/test_stream.cxx @@ -127,18 +127,18 @@ namespace char foo[] = "foobar"; SvMemoryStream aMemStream(RTL_CONSTASCII_STRINGPARAM(foo), STREAM_READ); - rtl::OString aOne = readBytesAsOString(aMemStream, 3); + rtl::OString aOne = read_uInt8s_AsOString(aMemStream, 3); CPPUNIT_ASSERT(aOne.equalsL(RTL_CONSTASCII_STRINGPARAM("foo"))); - rtl::OString aTwo = readBytesAsOString(aMemStream, 3); + rtl::OString aTwo = read_uInt8s_AsOString(aMemStream, 3); CPPUNIT_ASSERT(aTwo.equalsL(RTL_CONSTASCII_STRINGPARAM("bar"))); - rtl::OString aThree = readBytesAsOString(aMemStream, 3); + rtl::OString aThree = read_uInt8s_AsOString(aMemStream, 3); CPPUNIT_ASSERT(!aThree.getLength()); aMemStream.Seek(0); - rtl::OString aFour = readBytesAsOString(aMemStream, 100); + rtl::OString aFour = read_uInt8s_AsOString(aMemStream, 100); CPPUNIT_ASSERT(aFour.equalsL(RTL_CONSTASCII_STRINGPARAM(foo))); } diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx index 312cd5f35b22..f5d8a9f77a9b 100644 --- a/tools/source/stream/stream.cxx +++ b/tools/source/stream/stream.cxx @@ -2474,20 +2474,20 @@ void SvDataCopyStream::Assign( const SvDataCopyStream& ) { } -//Create a OString of nSize bytes from rStream -rtl::OString readBytesAsOString(SvStream& rStrm, sal_Size nSize) +//Create a OString of nLen bytes from rStream +rtl::OString read_uInt8s_AsOString(SvStream& rStrm, sal_Size nLen) { using comphelper::string::rtl_string_alloc; rtl_String *pStr = NULL; - if (nSize) + if (nLen) { - nSize = std::min(nSize, static_cast<sal_Size>(SAL_MAX_INT32)); + nLen = std::min(nLen, static_cast<sal_Size>(SAL_MAX_INT32)); //alloc a (ref-count 1) rtl_String of the desired length. //rtl_String's buffer is uninitialized, except for null termination - pStr = rtl_string_alloc(sal::static_int_cast<sal_Int32>(nSize)); - sal_Size nWasRead = rStrm.Read(pStr->buffer, nSize); - if (nWasRead != nSize) + pStr = rtl_string_alloc(sal::static_int_cast<sal_Int32>(nLen)); + sal_Size nWasRead = rStrm.Read(pStr->buffer, nLen); + if (nWasRead != nLen) { //on (typically unlikely) short read set length to what we could //read, and null terminate. Excess buffer capacity remains of @@ -2501,4 +2501,35 @@ rtl::OString readBytesAsOString(SvStream& rStrm, sal_Size nSize) return pStr ? rtl::OString(pStr, SAL_NO_ACQUIRE) : rtl::OString(); } +//Create a OUString of nLen little endian sal_Unicodes from rStream +rtl::OUString read_LEuInt16s_AsOUString(SvStream& rStrm, sal_Size nLen) +{ + using comphelper::string::rtl_uString_alloc; + + rtl_uString *pStr = NULL; + if (nLen) + { + nLen = std::min(nLen, static_cast<sal_Size>(SAL_MAX_INT32)); + //alloc a (ref-count 1) rtl_uString of the desired length. + //rtl_String's buffer is uninitialized, except for null termination + pStr = rtl_uString_alloc(sal::static_int_cast<sal_Int32>(nLen)); + sal_Size nWasRead = rStrm.Read(pStr->buffer, nLen*2)/2; + if (nWasRead != nLen) + { + //on (typically unlikely) short read set length to what we could + //read, and null terminate. Excess buffer capacity remains of + //course, could create a (true) replacement OUString if it matters. + pStr->length = sal::static_int_cast<sal_Int32>(nWasRead); + pStr->buffer[pStr->length] = 0; + } +#ifdef OSL_BIGENDIAN + for (sal_Int32 i = 0; i < pStr->length; ++i) + pStr->buffer[i] = SWAPSHORT(pStr->buffer[i]); +#endif + } + + //take ownership of buffer and return, otherwise return empty string + return pStr ? rtl::OUString(pStr, SAL_NO_ACQUIRE) : rtl::OUString(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |