1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 #ifndef _MSOCXIMEX_HXX 24 #define _MSOCXIMEX_HXX 25 26 #include <sot/storage.hxx> 27 #include <tools/debug.hxx> 28 29 //!! no such defines in global namespaces - it will break other existing code that uses the same define!! 30 //#ifndef C2U 31 //#define C2U(cChar) rtl::OUString::createFromAscii(cChar) 32 //#endif 33 #include "filter/msfilter/msfilterdllapi.h" 34 #include <vector> 35 #include <hash_map> 36 37 namespace com{namespace sun{namespace star{ 38 namespace drawing{ 39 class XDrawPage; 40 class XShape; 41 class XShapes; 42 } 43 namespace form{ 44 class XFormComponent; 45 } 46 namespace lang{ 47 class XMultiServiceFactory; 48 } 49 namespace container{ 50 class XIndexContainer; 51 class XNameContainer; 52 } 53 namespace beans{ 54 class XPropertySet; 55 } 56 namespace text{ 57 class XText; 58 } 59 namespace awt{ 60 struct Size; 61 class XControlModel; 62 } 63 namespace uno{ 64 class XComponentContext; 65 } 66 67 }}} 68 69 class OCX_Control; 70 class SfxObjectShell; 71 class SwPaM; 72 73 class TypeName 74 { 75 public: 76 String msName; 77 sal_uInt16 mnType; 78 sal_Int32 mnLeft; 79 sal_Int32 mnTop; 80 sal_Int32 mnStoreId; 81 TypeName(sal_Char *pName, sal_uInt32 nStoreId, sal_uInt32 nLen, sal_uInt16 nType, 82 sal_Int32 nLeft, sal_Int32 nTop); 83 }; 84 85 86 class MSFILTER_DLLPUBLIC SvxMSConvertOCXControls 87 { 88 public: 89 SvxMSConvertOCXControls( SfxObjectShell *pDSh,SwPaM *pP ); 90 virtual ~SvxMSConvertOCXControls(); 91 92 //Reads a control from the given storage, constructed shape in pShapeRef 93 sal_Bool ReadOCXStream( SotStorageRef& rSrc1, 94 com::sun::star::uno::Reference< 95 com::sun::star::drawing::XShape > *pShapeRef=0, 96 sal_Bool bFloatingCtrl=sal_False ); 97 98 99 //Excel has a nasty kludged mechanism for this, read 100 //the comments in the source to follow it 101 sal_Bool ReadOCXExcelKludgeStream(SotStorageStreamRef& rSrc1, 102 com::sun::star::uno::Reference < 103 com::sun::star::drawing::XShape > *pShapeRef,sal_Bool bFloatingCtrl); 104 105 106 //Writes the given Uno Control into the given storage 107 108 static sal_Bool WriteOCXStream(SotStorageRef &rSrc1, 109 const com::sun::star::uno::Reference< 110 com::sun::star::awt::XControlModel > &rControlModel, 111 const com::sun::star::awt::Size& rSize,String &rName); 112 113 //Excel has a nasty kludged mechanism for this, read 114 //the comments in the source to follow it 115 static sal_Bool WriteOCXExcelKludgeStream(SotStorageStreamRef& rContents, 116 const com::sun::star::uno::Reference< 117 com::sun::star::awt::XControlModel > &rControlModel, 118 const com::sun::star::awt::Size &rSize, String &rName); 119 120 //Generate an OCX converter based on the OLE2 name 121 static OCX_Control *OCX_Factory(const String &rId); 122 123 //Generate an OCX converter based on the StarOffice UNO id 124 static OCX_Control *OCX_Factory( const com::sun::star::uno::Reference< 125 com::sun::star::awt::XControlModel > &rControlModel, 126 String &rId,String &rName); 127 InsertControl(const com::sun::star::uno::Reference<com::sun::star::form::XFormComponent> &,const com::sun::star::awt::Size &,com::sun::star::uno::Reference<com::sun::star::drawing::XShape> *,sal_Bool)128 virtual sal_Bool InsertControl( 129 const com::sun::star::uno::Reference< 130 com::sun::star::form::XFormComponent >& /*rFComp*/, 131 const com::sun::star::awt::Size& /*rSize*/, 132 com::sun::star::uno::Reference< 133 com::sun::star::drawing::XShape >* /*pShape*/, 134 sal_Bool /*bFloatingCtrl*/ ) {return sal_False;} 135 136 /*begin: Backwards compatibility with office 95 import, modify later*/ 137 const com::sun::star::uno::Reference< 138 com::sun::star::lang::XMultiServiceFactory > & GetServiceFactory(); 139 GetEditNum()140 sal_uInt16 GetEditNum() { return ++nEdit; } GetCheckboxNum()141 sal_uInt16 GetCheckboxNum() { return ++nCheckbox; } 142 /*end: Backwards compatibility*/ 143 protected: 144 const com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > & 145 GetShapes(); 146 147 const com::sun::star::uno::Reference< 148 com::sun::star::container::XIndexContainer > & GetFormComps(); 149 150 SfxObjectShell *pDocSh; 151 SwPaM *pPaM; 152 153 // gecachte Interfaces 154 com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage > 155 xDrawPage; 156 com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > 157 xShapes; 158 com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > xServiceFactory; 159 160 // das einzige Formular 161 com::sun::star::uno::Reference< com::sun::star::container::XIndexContainer > 162 xFormComps; 163 164 sal_uInt16 nEdit; 165 sal_uInt16 nCheckbox; 166 167 virtual const com::sun::star::uno::Reference< 168 com::sun::star::drawing::XDrawPage > & GetDrawPage(); 169 }; 170 171 class OCX_FontData 172 { 173 public: OCX_FontData()174 OCX_FontData() : nFontNameLen(0), fBold(0), fItalic(0), fUnderline(0), 175 fStrike(0), nFontSize(12), nJustification(1), nDefaultAlign(0), pFontName(0), 176 bHasAlign(sal_False), bHasFont(sal_True) {} ~OCX_FontData()177 ~OCX_FontData() { 178 if (pFontName) 179 delete [] pFontName; 180 } 181 sal_Bool Read(SotStorageStream *pS); 182 void Import(com::sun::star::uno::Reference< 183 com::sun::star::beans::XPropertySet > &rPropSet); 184 185 sal_Bool Export(SotStorageStreamRef &rContent, 186 const com::sun::star::uno::Reference< 187 com::sun::star::beans::XPropertySet> &rPropSet); 188 189 sal_uInt16 nIdentifier; 190 sal_uInt16 nFixedAreaLen; 191 sal_uInt8 pBlockFlags[4]; 192 193 sal_uInt32 nFontNameLen; 194 195 sal_uInt8 fBold:1; 196 sal_uInt8 fItalic:1; 197 sal_uInt8 fUnderline:1; 198 sal_uInt8 fStrike:1; 199 sal_uInt8 fUnknown1:4; 200 201 sal_uInt8 nUnknown2; 202 sal_uInt8 nUnknown3; 203 sal_uInt8 nUnknown4; 204 205 sal_uInt32 nFontSize; 206 sal_uInt16 nLanguageID; 207 sal_uInt8 nJustification; 208 sal_uInt16 nFontWeight; 209 sal_Int16 nDefaultAlign; 210 char *pFontName; SetHasAlign(sal_Bool bIn)211 void SetHasAlign(sal_Bool bIn) {bHasAlign=bIn;} SetHasFont(sal_Bool bIn)212 void SetHasFont(sal_Bool bIn) {bHasFont=bIn;} 213 protected: 214 static sal_uInt16 nStandardId; 215 sal_uInt8 ExportAlign(sal_Int16 nAlign) const; 216 sal_Int16 ImportAlign(sal_uInt8 nJustification) const; 217 private: 218 sal_Bool bHasAlign; 219 sal_Bool bHasFont; 220 }; 221 222 class MSFILTER_DLLPUBLIC OCX_Control 223 { 224 public: OCX_Control(UniString sN,OCX_Control * parent=NULL)225 OCX_Control(UniString sN, OCX_Control* parent = NULL ) : nWidth( 0 ), nHeight( 0 ), mnLeft(0), mnTop(0), 226 mnStep(0), mnBackColor(0x8000000FL), mnForeColor(0), mnTabPos(0), mbVisible(true), sName(sN), pDocSh(0), 227 bSetInDialog(sal_False), mpParent( parent ) {} FullRead(SotStorageStream * pS)228 sal_Bool FullRead(SotStorageStream *pS) 229 { 230 return Read(pS) && ReadFontData(pS); 231 }; 232 virtual sal_Bool Read(SotStorageStream *pS); 233 virtual sal_Bool ReadFontData(SotStorageStream *pS); 234 virtual sal_Bool Import(const com::sun::star::uno::Reference< 235 com::sun::star::lang::XMultiServiceFactory > &rServiceFactory, 236 com::sun::star::uno::Reference< 237 com::sun::star::form::XFormComponent > &rFComp, 238 com::sun::star::awt::Size &rSz); 239 virtual sal_Bool Import(com::sun::star::uno::Reference< 240 com::sun::star::container::XNameContainer> 241 &rDialog); Import(com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> &)242 virtual sal_Bool Import(com::sun::star::uno::Reference< 243 com::sun::star::beans::XPropertySet>& /*rPropSet*/) 244 {return sal_False;} 245 //Export exports a control as an OLE style storage stream tree Export(SotStorageRef &,const com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> &,const com::sun::star::awt::Size &)246 virtual sal_Bool Export(SotStorageRef& /*rObj*/, 247 const com::sun::star::uno::Reference< 248 com::sun::star::beans::XPropertySet>& /*rPropSet*/, 249 const com::sun::star::awt::Size& /*rSize*/) {return sal_False;} 250 251 //WriteContents writes the contents of a contents stream, for 252 //the Excel export you cannot use Export, only WriteContents instead WriteContents(SotStorageStreamRef &,const com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> &,const com::sun::star::awt::Size &)253 virtual sal_Bool WriteContents(SotStorageStreamRef& /*rObj*/, 254 const com::sun::star::uno::Reference< 255 com::sun::star::beans::XPropertySet>& /*rPropSet*/, 256 const com::sun::star::awt::Size& /*rSize*/) {return sal_False;} SetInDialog(bool bState)257 void SetInDialog(bool bState) { bSetInDialog = bState; } GetInDialog()258 bool GetInDialog() { return bSetInDialog; } 259 ReadAndImport(SotStorageStream * pS,com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory> & rSF,com::sun::star::uno::Reference<com::sun::star::form::XFormComponent> & rFComp,com::sun::star::awt::Size & rSz)260 sal_Bool ReadAndImport(SotStorageStream *pS, 261 com::sun::star::uno::Reference< 262 com::sun::star::lang::XMultiServiceFactory > &rSF, 263 com::sun::star::uno::Reference< 264 com::sun::star::form::XFormComponent > &rFComp, 265 com::sun::star::awt::Size &rSz) 266 { 267 if (Read(pS)) 268 return Import(rSF,rFComp,rSz); 269 return sal_False; 270 } ~OCX_Control()271 virtual ~OCX_Control() {} 272 273 static void FillSystemColors(); 274 275 sal_uInt32 nWidth; 276 sal_uInt32 nHeight; 277 sal_Int32 mnLeft; 278 sal_Int32 mnTop; 279 sal_Int32 mnStep; 280 sal_Int32 mnBackColor; 281 sal_Int32 mnForeColor; 282 sal_uInt16 mnTabPos; 283 bool mbVisible; 284 UniString sName; 285 UniString msToolTip; 286 OCX_FontData aFontData; 287 SfxObjectShell *pDocSh; 288 protected: 289 290 sal_uInt32 ImportColor(sal_uInt32 nColorCode) const; 291 sal_uInt32 ExportColor(sal_uInt32 nColorCode) const; 292 sal_uInt32 SwapColor(sal_uInt32 nColorCode) const; 293 sal_Int16 ImportBorder(sal_uInt16 nSpecialEffect,sal_uInt16 nBorderStyle) 294 const; 295 sal_uInt8 ExportBorder(sal_uInt16 nBorder,sal_uInt8 &rBorderStyle) const; 296 bool bSetInDialog; 297 sal_Int16 ImportSpecEffect( sal_uInt8 nSpecialEffect ) const; 298 sal_uInt8 ExportSpecEffect( sal_Int16 nApiEffect ) const; 299 static sal_uInt16 nStandardId; 300 static sal_uInt8 __READONLY_DATA aObjInfo[4]; 301 rtl::OUString msFormType; 302 rtl::OUString msDialogType; 303 OCX_Control* mpParent; 304 private: 305 static sal_uInt32 pColor[25]; 306 }; 307 308 class OCX_ModernControl : public OCX_Control 309 { 310 public: OCX_ModernControl(UniString sN)311 OCX_ModernControl(UniString sN) : OCX_Control(sN), 312 fEnabled(1), fLocked(0), fBackStyle(1), fColumnHeads(0), fIntegralHeight(1), 313 fMatchRequired(0), fAlignment(1), fDragBehaviour(0), fEnterKeyBehaviour(0), 314 fEnterFieldBehaviour(0), fTabKeyBehaviour(0), fWordWrap(1), 315 fSelectionMargin(1), fAutoWordSelect(1), fAutoSize(0), fHideSelection(1), 316 fAutoTab(0), fMultiLine(1), nMaxLength(0), nBorderStyle(0), nScrollBars(0), 317 nStyle(0), nMousePointer(0), nPasswordChar(0), nListWidth(0), 318 nBoundColumn(1), nTextColumn(-1), nColumnCount(1), nListRows(8), 319 nMatchEntry(2), nListStyle(0), nShowDropButtonWhen(0), nDropButtonStyle(1), 320 nMultiState(0), nValueLen(0), nCaptionLen(0), nVertPos(1), nHorzPos(7), 321 nSpecialEffect(2), nIcon(0), nPicture(0), nAccelerator(0), nGroupNameLen(0), 322 pValue(0), pCaption(0), pGroupName(0), nIconLen(0), pIcon(0), 323 nPictureLen(0), pPicture(0) {} 324 ~OCX_ModernControl()325 ~OCX_ModernControl() { 326 if (pValue) delete[] pValue; 327 if (pCaption) delete[] pCaption; 328 if (pGroupName) delete[] pGroupName; 329 if (pIcon) delete[] pIcon; 330 if (pPicture) delete[] pPicture; 331 } 332 sal_Bool Read(SotStorageStream *pS); 333 334 335 /*sal_uInt8 for sal_uInt8 Word Struct*/ 336 sal_uInt16 nIdentifier; 337 sal_uInt16 nFixedAreaLen; 338 sal_uInt8 pBlockFlags[8]; 339 340 sal_uInt8 fUnknown1:1; 341 sal_uInt8 fEnabled:1; 342 sal_uInt8 fLocked:1; 343 sal_uInt8 fBackStyle:1; 344 sal_uInt8 fUnknown2:4; 345 346 sal_uInt8 fUnknown3:2; 347 sal_uInt8 fColumnHeads:1; 348 sal_uInt8 fIntegralHeight:1; 349 sal_uInt8 fMatchRequired:1; 350 sal_uInt8 fAlignment:1; 351 sal_uInt8 fUnknown4:2; 352 353 sal_uInt8 fUnknown5:3; 354 sal_uInt8 fDragBehaviour:1; 355 sal_uInt8 fEnterKeyBehaviour:1; 356 sal_uInt8 fEnterFieldBehaviour:1; 357 sal_uInt8 fTabKeyBehaviour:1; 358 sal_uInt8 fWordWrap:1; 359 360 sal_uInt8 fUnknown6:2; 361 sal_uInt8 fSelectionMargin:1; 362 sal_uInt8 fAutoWordSelect:1; 363 sal_uInt8 fAutoSize:1; 364 sal_uInt8 fHideSelection:1; 365 sal_uInt8 fAutoTab:1; 366 sal_uInt8 fMultiLine:1; 367 368 sal_uInt32 nMaxLength; 369 sal_uInt8 nBorderStyle; 370 sal_uInt8 nScrollBars; 371 sal_uInt8 nStyle; 372 sal_uInt8 nMousePointer; 373 sal_uInt8 nUnknown7; 374 sal_uInt8 nPasswordChar; 375 sal_uInt32 nListWidth; 376 sal_uInt16 nBoundColumn; 377 sal_Int16 nTextColumn; 378 sal_uInt16 nColumnCount; 379 sal_uInt16 nListRows; 380 sal_uInt16 nUnknown8; 381 sal_uInt8 nMatchEntry; 382 sal_uInt8 nListStyle; 383 sal_uInt8 nShowDropButtonWhen; 384 sal_uInt8 nDropButtonStyle; 385 sal_uInt8 nMultiState; 386 sal_uInt32 nValueLen; 387 sal_uInt32 nCaptionLen; 388 389 sal_uInt16 nVertPos; 390 sal_uInt16 nHorzPos; 391 392 sal_uInt32 nBorderColor; 393 sal_uInt8 nSpecialEffect; 394 sal_uInt16 nIcon; 395 sal_uInt16 nPicture; 396 sal_uInt8 nAccelerator; 397 sal_uInt8 nUnknown9; 398 sal_uInt32 nGroupNameLen; 399 sal_uInt32 nUnknown10; 400 401 char *pValue; 402 char *pCaption; 403 char *pGroupName; 404 405 sal_uInt8 pIconHeader[20]; 406 sal_uInt32 nIconLen; 407 sal_uInt8 *pIcon; 408 409 sal_uInt8 pPictureHeader[20]; 410 sal_uInt32 nPictureLen; 411 sal_uInt8 *pPicture; 412 413 }; 414 415 class OCX_TabStrip : public OCX_Control 416 { 417 public: OCX_TabStrip()418 OCX_TabStrip() : OCX_Control( rtl::OUString::createFromAscii("TabStrip")) {} 419 virtual sal_Bool ReadFontData(SotStorageStream *pS); 420 virtual sal_Bool Read(SotStorageStream *pS); 421 422 sal_uInt16 nIdentifier; 423 sal_uInt16 nFixedAreaLen; 424 sal_uInt8 pBlockFlags[4]; 425 sal_uInt16 nNumTabs; 426 }; 427 428 class OCX_Image : public OCX_Control 429 { 430 public: OCX_Image()431 OCX_Image() : OCX_Control(rtl::OUString::createFromAscii("Image")), fEnabled(1), fBackStyle(0), bPictureTiling(false), bAutoSize(false) { 432 msFormType = rtl::OUString::createFromAscii("com.sun.star.form.component.DatabaseImageControl"); 433 msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlImageControlModel"); 434 } 435 ~OCX_Image()436 ~OCX_Image() { } 437 /*sal_uInt8 for sal_uInt8 Word Struct*/ 438 sal_uInt16 nIdentifier; 439 sal_uInt16 nFixedAreaLen; 440 sal_uInt8 pBlockFlags[4]; 441 442 sal_uInt32 nBorderColor; 443 sal_uInt8 nBorderStyle; 444 sal_uInt8 nMousePointer; 445 sal_uInt8 nPictureSizeMode; 446 447 448 sal_uInt8 fUnknown1:1; 449 sal_uInt8 fEnabled:1; 450 sal_uInt8 fUnknown2:2; 451 sal_uInt8 fBackStyle:1; 452 sal_uInt8 fUnknown3:3; 453 454 sal_uInt8 nPictureAlignment; 455 bool bPictureTiling; 456 sal_uInt8 nSpecialEffect; 457 458 bool bAutoSize; 459 ::rtl::OUString sImageUrl; 460 sal_Bool Read(SotStorageStream *pS); 461 462 using OCX_Control::Import; // to not hide the other two import methods 463 virtual sal_Bool Import(com::sun::star::uno::Reference< 464 com::sun::star::beans::XPropertySet>& rPropSet); 465 sal_Bool Export(SotStorageRef &rObj, 466 const com::sun::star::uno::Reference< 467 com::sun::star::beans::XPropertySet> &rPropSet, 468 const com::sun::star::awt::Size& rSize); 469 sal_Bool WriteContents(SotStorageStreamRef &rObj, 470 const com::sun::star::uno::Reference< 471 com::sun::star::beans::XPropertySet> &rPropSet, 472 const com::sun::star::awt::Size& rSize); 473 // No Font record ReadFontData(SvStorageStream *)474 virtual sal_Bool ReadFontData(SvStorageStream* /*pS*/) { return sal_True; } 475 Create()476 static OCX_Control *Create() { return new OCX_Image;} 477 }; 478 struct ContainerRecord 479 { ContainerRecordContainerRecord480 ContainerRecord():nTop(0), nLeft(0), nSubStorageId(0), nSubStreamLen(0), nTabPos(0), nTypeIdent(0), bVisible( true ) {} 481 482 ::rtl::OUString cName; 483 ::rtl::OUString controlTip; 484 485 sal_uInt32 nTop; 486 sal_uInt32 nLeft; 487 sal_uInt32 nSubStorageId; 488 sal_uInt32 nSubStreamLen; 489 sal_uInt16 nTabPos; 490 sal_uInt16 nTypeIdent; 491 bool bVisible; 492 }; 493 494 typedef std::vector<OCX_Control*>::iterator CtrlIterator; 495 typedef std::vector<OCX_Control*>::const_iterator CtrlIteratorConst; 496 typedef std::vector<OCX_Control*> CtrlList; 497 498 499 500 class RBGroup 501 { 502 public: RBGroup()503 RBGroup():mRBGroupPos(0){} RBGroup(sal_uInt16 & groupPos)504 RBGroup(sal_uInt16& groupPos ):mRBGroupPos(groupPos){} tabPos() const505 sal_Int16 tabPos() const { return mRBGroupPos; } numControls()506 std::vector<OCX_Control*>::size_type numControls() 507 { return mpControls.size(); } controls()508 std::vector<OCX_Control*>& controls() { return mpControls; } 509 510 void add(OCX_Control* pRB); 511 private: 512 sal_uInt16 mRBGroupPos; 513 std::vector<OCX_Control*> mpControls; 514 }; 515 516 typedef ::std::hash_map < ::rtl::OUString, RBGroup*, ::rtl::OUStringHash, 517 ::std::equal_to< ::rtl::OUString > > RBGroupHash; 518 typedef std::vector<RBGroup*>::iterator GroupIterator; 519 520 class OCX_OptionButton; 521 522 class RBGroupManager 523 { 524 public: 525 RBGroupManager( String& defaultName ); 526 ~RBGroupManager(); 527 528 CtrlList insertGroupsIntoControlList( const CtrlList& sourceList ); 529 void addRadioButton( OCX_OptionButton* pRButton ); 530 private: 531 532 void addSeperator( std::vector< OCX_Control* >& dest ); 533 void copyList( std::vector< OCX_Control* >& src, 534 std::vector< OCX_Control* >& dest, 535 bool addGroupSeperator ); 536 537 RBGroupHash rbGroups; 538 String mSDefaultName; 539 std::vector< RBGroup* > groupList; 540 sal_uInt16 numRadioButtons; 541 }; 542 543 544 545 546 class OCX_ContainerControl : public OCX_Control 547 { 548 public: 549 virtual ~OCX_ContainerControl(); 550 // sub class will process the control specific information 551 // e.g frame or userform ( maybe tab, mulipage in the future ) 552 // Base (this) class will process the container specific information 553 // e.g. the controls contained by this container 554 // will 555 // a) create the controls 556 // b) read the controls 557 // c) store these controls in a list for post processing 558 // e.g. import 559 // 560 virtual sal_Bool Read(SvStorageStream *pS); 561 // No Font record ReadFontData(SvStorageStream *)562 virtual sal_Bool ReadFontData(SvStorageStream* /*pS*/) { return sal_True; } 563 564 using OCX_Control::Import; // to not hide the other two import methods 565 virtual sal_Bool Import(com::sun::star::uno::Reference< 566 com::sun::star::beans::XPropertySet> &rPropSet); 567 getContainerStream()568 SotStorageStreamRef getContainerStream() { return mContainerStream; } 569 570 virtual void ProcessControl( OCX_Control* pControl, SvStorageStream* pS, ContainerRecord& rec ); 571 bool createFromContainerRecord( const ContainerRecord& record, 572 OCX_Control*& ); 573 protected: 574 // This class not meant to be instantiated 575 // needs to be subclassed 576 OCX_ContainerControl( SotStorageRef& parent, 577 const ::rtl::OUString& storageName, 578 const ::rtl::OUString& sN, 579 const com::sun::star::uno::Reference< 580 com::sun::star::container::XNameContainer > &rParent, 581 OCX_Control* pParent = NULL ); 582 rtl::OUString createSubStreamName( const sal_uInt32& subStorageID ); 583 584 RBGroupManager rbGroupMgr; 585 com::sun::star::uno::Reference< 586 com::sun::star::container::XNameContainer > mxParent; 587 std::vector<OCX_Control*> mpControls; 588 SotStorageRef mContainerStorage; 589 SotStorageStreamRef mContainerStream; 590 SotStorageStreamRef mContainedControlsStream; 591 sal_uInt32 nNoRecords; 592 sal_uInt32 nTotalLen; 593 sal_uInt32 containerType; 594 595 private: 596 OCX_ContainerControl(); // not implemented 597 OCX_ContainerControl(const OCX_ContainerControl&); // not implemented 598 }; 599 600 601 class OCX_MultiPage : public OCX_ContainerControl 602 { 603 public: 604 OCX_MultiPage( SotStorageRef& parent, 605 const ::rtl::OUString& storageName, 606 const ::rtl::OUString& sN, 607 const com::sun::star::uno::Reference< 608 com::sun::star::container::XNameContainer > &rDialog, OCX_Control* pParent = NULL); ~OCX_MultiPage()609 virtual ~OCX_MultiPage() 610 { 611 delete[] pCaption; 612 delete[] pIcon; 613 delete[] pPicture; 614 } 615 virtual sal_Bool Read(SvStorageStream *pS); 616 617 using OCX_ContainerControl::Import; // to not hide the other two import methods 618 virtual sal_Bool Import(com::sun::star::uno::Reference< 619 com::sun::star::beans::XPropertySet> &rPropSet); 620 virtual sal_Bool Import(com::sun::star::uno::Reference< 621 com::sun::star::container::XNameContainer> 622 &rDialog); 623 virtual void ProcessControl( OCX_Control* pControl, SvStorageStream* pS, ContainerRecord& rec ); 624 /*sal_uInt8 for sal_uInt8 Word Struct*/ 625 sal_uInt16 nIdentifier; 626 sal_uInt16 nFixedAreaLen; 627 sal_uInt8 pBlockFlags[4]; 628 629 sal_uInt32 fUnknown1; 630 631 sal_uInt8 fUnknown2:1; 632 sal_uInt8 fEnabled:1; 633 sal_uInt8 fLocked:1; 634 sal_uInt8 fBackStyle:1; 635 sal_uInt8 fUnknown3:4; 636 637 sal_uInt8 fUnknown4:8; 638 639 sal_uInt8 fUnknown5:7; 640 sal_uInt8 fWordWrap:1; 641 642 sal_uInt8 fUnknown6:4; 643 sal_uInt8 fAutoSize:1; 644 sal_uInt8 fUnknown7:3; 645 646 sal_uInt32 nCaptionLen; 647 sal_uInt16 nVertPos; 648 sal_uInt16 nHorzPos; 649 sal_uInt8 nMousePointer; 650 sal_uInt32 nBorderColor; 651 sal_uInt32 fUnknown8; 652 sal_uInt32 fUnknown9; 653 sal_uInt8 nKeepScrollBarsVisible; 654 sal_uInt8 nCycle; 655 sal_uInt16 nBorderStyle; 656 sal_uInt16 nSpecialEffect; 657 sal_uInt16 nPicture; 658 sal_uInt8 nPictureAlignment; 659 sal_uInt8 nPictureSizeMode; 660 bool bPictureTiling; 661 sal_uInt16 nAccelerator; 662 sal_uInt16 nIcon; 663 664 char *pCaption; 665 666 sal_uInt32 nScrollWidth; 667 sal_uInt32 nScrollHeight; 668 669 670 sal_uInt8 pIconHeader[20]; 671 sal_uInt32 nIconLen; 672 sal_uInt8 *pIcon; 673 674 sal_uInt8 pPictureHeader[20]; 675 sal_uInt32 nPictureLen; 676 sal_uInt8 *pPicture; 677 private: 678 sal_Int32 mnCurrentPageStep; 679 }; 680 681 682 683 class OCX_Page : public OCX_ContainerControl 684 { 685 public: 686 OCX_Page( SotStorageRef& parentStorage, 687 const ::rtl::OUString& storageName, 688 const ::rtl::OUString& sN, 689 const com::sun::star::uno::Reference< 690 com::sun::star::container::XNameContainer > &rDialog, OCX_Control* parent = NULL); ~OCX_Page()691 virtual ~OCX_Page() 692 { 693 delete[] pCaption; 694 delete[] pIcon; 695 delete[] pPicture; 696 } 697 virtual sal_Bool Read(SvStorageStream *pS); 698 699 using OCX_ContainerControl::Import; // to not hide the other two import methods 700 virtual sal_Bool Import(com::sun::star::uno::Reference< 701 com::sun::star::container::XNameContainer> 702 &rDialog); 703 /* virtual sal_Bool Import(com::sun::star::uno::Reference< 704 com::sun::star::beans::XPropertySet> &rPropSet); 705 */ 706 /*sal_uInt8 for sal_uInt8 Word Struct*/ 707 sal_uInt16 nIdentifier; 708 sal_uInt16 nFixedAreaLen; 709 sal_uInt8 pBlockFlags[4]; 710 711 sal_uInt32 fUnknown1; 712 713 sal_uInt8 fUnknown2:1; 714 sal_uInt8 fEnabled:1; 715 sal_uInt8 fLocked:1; 716 sal_uInt8 fBackStyle:1; 717 sal_uInt8 fUnknown3:4; 718 719 sal_uInt8 fUnknown4:8; 720 721 sal_uInt8 fUnknown5:7; 722 sal_uInt8 fWordWrap:1; 723 724 sal_uInt8 fUnknown6:4; 725 sal_uInt8 fAutoSize:1; 726 sal_uInt8 fUnknown7:3; 727 728 sal_uInt32 nCaptionLen; 729 sal_uInt16 nVertPos; 730 sal_uInt16 nHorzPos; 731 sal_uInt8 nMousePointer; 732 sal_uInt32 nBorderColor; 733 sal_uInt32 fUnknown8; 734 sal_uInt32 fUnknown9; 735 sal_uInt8 nKeepScrollBarsVisible; 736 sal_uInt8 nCycle; 737 sal_uInt16 nBorderStyle; 738 sal_uInt16 nSpecialEffect; 739 sal_uInt16 nPicture; 740 sal_uInt8 nPictureAlignment; 741 sal_uInt8 nPictureSizeMode; 742 bool bPictureTiling; 743 sal_uInt16 nAccelerator; 744 sal_uInt16 nIcon; 745 746 char *pCaption; 747 748 sal_uInt32 nScrollWidth; 749 sal_uInt32 nScrollHeight; 750 751 752 sal_uInt8 pIconHeader[20]; 753 sal_uInt32 nIconLen; 754 sal_uInt8 *pIcon; 755 756 sal_uInt8 pPictureHeader[20]; 757 sal_uInt32 nPictureLen; 758 sal_uInt8 *pPicture; 759 private: 760 }; 761 762 763 class OCX_Frame : public OCX_ContainerControl 764 { 765 public: 766 OCX_Frame( SotStorageRef& parent, 767 const ::rtl::OUString& storageName, 768 const ::rtl::OUString& sN, 769 const com::sun::star::uno::Reference< 770 com::sun::star::container::XNameContainer > &rDialog, OCX_Control* pParent = NULL); ~OCX_Frame()771 virtual ~OCX_Frame() 772 { 773 delete[] pCaption; 774 delete[] pIcon; 775 delete[] pPicture; 776 } 777 virtual sal_Bool Read(SvStorageStream *pS); 778 779 using OCX_ContainerControl::Import; // to not hide the other two import methods 780 virtual sal_Bool Import(com::sun::star::uno::Reference< 781 com::sun::star::beans::XPropertySet> &rPropSet); 782 783 /*sal_uInt8 for sal_uInt8 Word Struct*/ 784 sal_uInt16 nIdentifier; 785 sal_uInt16 nFixedAreaLen; 786 sal_uInt8 pBlockFlags[4]; 787 788 sal_uInt32 fUnknown1; 789 790 sal_uInt8 fUnknown2:1; 791 sal_uInt8 fEnabled:1; 792 sal_uInt8 fLocked:1; 793 sal_uInt8 fBackStyle:1; 794 sal_uInt8 fUnknown3:4; 795 796 sal_uInt8 fUnknown4:8; 797 798 sal_uInt8 fUnknown5:7; 799 sal_uInt8 fWordWrap:1; 800 801 sal_uInt8 fUnknown6:4; 802 sal_uInt8 fAutoSize:1; 803 sal_uInt8 fUnknown7:3; 804 805 sal_uInt32 nCaptionLen; 806 sal_uInt16 nVertPos; 807 sal_uInt16 nHorzPos; 808 sal_uInt8 nMousePointer; 809 sal_uInt32 nBorderColor; 810 sal_uInt32 fUnknown8; 811 sal_uInt32 fUnknown9; 812 sal_uInt8 nKeepScrollBarsVisible; 813 sal_uInt8 nCycle; 814 sal_uInt16 nBorderStyle; 815 sal_uInt16 nSpecialEffect; 816 sal_uInt16 nPicture; 817 sal_uInt8 nPictureAlignment; 818 sal_uInt8 nPictureSizeMode; 819 bool bPictureTiling; 820 sal_uInt16 nAccelerator; 821 sal_uInt16 nIcon; 822 823 char *pCaption; 824 825 sal_uInt32 nScrollWidth; 826 sal_uInt32 nScrollHeight; 827 sal_uInt32 nScrollLeft; 828 sal_uInt32 nScrollTop; 829 830 831 sal_uInt8 pIconHeader[20]; 832 sal_uInt32 nIconLen; 833 sal_uInt8 *pIcon; 834 835 sal_uInt8 pPictureHeader[20]; 836 sal_uInt32 nPictureLen; 837 sal_uInt8 *pPicture; 838 private: 839 }; 840 841 class OCX_UserForm : public OCX_ContainerControl 842 { 843 public: 844 OCX_UserForm( SotStorageRef& parent, 845 const ::rtl::OUString& storageName, 846 const ::rtl::OUString& sN, 847 const com::sun::star::uno::Reference< 848 com::sun::star::container::XNameContainer > &rDialog, 849 const com::sun::star::uno::Reference< 850 com::sun::star::lang::XMultiServiceFactory >& rMsf); ~OCX_UserForm()851 ~OCX_UserForm() 852 { 853 delete[] pCaption; 854 delete[] pIcon; 855 delete[] pPicture; 856 } 857 858 virtual sal_Bool Read(SvStorageStream *pS); 859 860 using OCX_ContainerControl::Import; // to not hide the other two import methods 861 virtual sal_Bool Import( com::sun::star::uno::Reference< 862 com::sun::star::container::XNameContainer> 863 &rDialog); 864 865 /*sal_uInt8 for sal_uInt8 Word Struct*/ 866 sal_uInt16 nIdentifier; 867 sal_uInt16 nFixedAreaLen; 868 sal_uInt8 pBlockFlags[4]; 869 870 sal_uInt32 nChildrenA; 871 872 sal_uInt8 fUnknown1:1; 873 sal_uInt8 fEnabled:1; 874 sal_uInt8 fLocked:1; 875 sal_uInt8 fBackStyle:1; 876 sal_uInt8 fUnknown2:4; 877 878 sal_uInt8 fUnknown3:8; 879 880 sal_uInt8 fUnknown4:7; 881 sal_uInt8 fWordWrap:1; 882 883 sal_uInt8 fUnknown5:4; 884 sal_uInt8 fAutoSize:1; 885 sal_uInt8 fUnknown6:3; 886 887 sal_uInt32 nCaptionLen; 888 sal_uInt16 nVertPos; 889 sal_uInt16 nHorzPos; 890 sal_uInt8 nMousePointer; 891 sal_uInt32 nBorderColor; 892 sal_uInt32 nDrawBuffer; 893 sal_uInt32 nChildrenB; 894 sal_uInt8 nKeepScrollBarsVisible; 895 sal_uInt8 nCycle; 896 sal_uInt16 nBorderStyle; 897 sal_uInt8 nSpecialEffect; 898 sal_uInt16 nPicture; 899 sal_uInt8 nPictureAlignment; 900 sal_uInt8 nPictureSizeMode; 901 bool bPictureTiling; 902 sal_uInt16 nAccelerator; 903 sal_uInt16 nIcon; 904 sal_uInt16 fUnknown7; 905 906 char *pCaption; 907 908 sal_uInt32 nScrollWidth; 909 sal_uInt32 nScrollHeight; 910 sal_uInt32 nScrollLeft; 911 sal_uInt32 nScrollTop; 912 913 sal_uInt8 pIconHeader[20]; 914 sal_uInt32 nIconLen; 915 sal_uInt8 *pIcon; 916 917 sal_uInt8 pPictureHeader[20]; 918 sal_uInt32 nPictureLen; 919 sal_uInt8 *pPicture; 920 private: 921 com::sun::star::uno::Reference< 922 com::sun::star::uno::XComponentContext> mxCtx; 923 }; 924 925 926 927 class OCX_CheckBox : public OCX_ModernControl 928 { 929 public: OCX_CheckBox()930 OCX_CheckBox() : OCX_ModernControl(rtl::OUString::createFromAscii("CheckBox")){ 931 msFormType = rtl::OUString::createFromAscii("com.sun.star.form.component.CheckBox"); 932 msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlCheckBoxModel"); 933 mnBackColor = 0x80000005L; 934 mnForeColor = 0x80000008L; 935 aFontData.SetHasAlign(sal_True); 936 } 937 938 using OCX_ModernControl::Import; // to not hide the other two import methods 939 virtual sal_Bool Import(com::sun::star::uno::Reference< 940 com::sun::star::beans::XPropertySet> &rPropSet); 941 sal_Bool Export(SotStorageRef &rObj, 942 const com::sun::star::uno::Reference< 943 com::sun::star::beans::XPropertySet> &rPropSet, 944 const com::sun::star::awt::Size& rSize); 945 sal_Bool WriteContents(SotStorageStreamRef &rObj, 946 const com::sun::star::uno::Reference< 947 com::sun::star::beans::XPropertySet> &rPropSet, 948 const com::sun::star::awt::Size& rSize); Create()949 static OCX_Control *Create() { return new OCX_CheckBox;} 950 }; 951 952 class OCX_OptionButton : public OCX_ModernControl 953 { 954 public: OCX_OptionButton()955 OCX_OptionButton() : OCX_ModernControl(rtl::OUString::createFromAscii("OptionButton")) 956 { 957 msFormType = rtl::OUString::createFromAscii("com.sun.star.form.component.RadioButton"); 958 msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlRadioButtonModel"); 959 mnBackColor = 0x80000005L; 960 mnForeColor = 0x80000008L; 961 aFontData.SetHasAlign(sal_True); 962 } 963 964 using OCX_ModernControl::Import; // to not hide the other two import methods 965 virtual sal_Bool Import(com::sun::star::uno::Reference< 966 com::sun::star::beans::XPropertySet> &rPropSet); 967 sal_Bool Export(SotStorageRef &rObj, 968 const com::sun::star::uno::Reference< 969 com::sun::star::beans::XPropertySet> &rPropSet, 970 const com::sun::star::awt::Size& rSize); 971 sal_Bool WriteContents(SotStorageStreamRef &rObj, 972 const com::sun::star::uno::Reference< 973 com::sun::star::beans::XPropertySet> &rPropSet, 974 const com::sun::star::awt::Size& rSize); 975 976 Create()977 static OCX_Control *Create() { return new OCX_OptionButton;} 978 }; 979 980 class OCX_TextBox : public OCX_ModernControl 981 { 982 public: OCX_TextBox()983 OCX_TextBox() : OCX_ModernControl(rtl::OUString::createFromAscii("TextBox")) { 984 msFormType = rtl::OUString::createFromAscii("com.sun.star.form.component.TextField"); 985 msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlEditModel"); 986 mnBackColor = 0x80000005L; 987 mnForeColor = 0x80000008L; 988 nBorderColor = 0x80000006L; 989 aFontData.SetHasAlign(sal_True); 990 } 991 992 using OCX_ModernControl::Import; // to not hide the other two import methods 993 virtual sal_Bool Import(com::sun::star::uno::Reference< 994 com::sun::star::beans::XPropertySet> &rPropSet); 995 996 sal_Bool Export(SotStorageRef &rObj, 997 const com::sun::star::uno::Reference< 998 com::sun::star::beans::XPropertySet> &rPropSet, 999 const com::sun::star::awt::Size& rSize); 1000 sal_Bool WriteContents(SotStorageStreamRef &rObj, 1001 const com::sun::star::uno::Reference< 1002 com::sun::star::beans::XPropertySet> &rPropSet, 1003 const com::sun::star::awt::Size& rSize); Create()1004 static OCX_Control *Create() { return new OCX_TextBox;} 1005 }; 1006 1007 class OCX_FieldControl: public OCX_ModernControl 1008 { 1009 public: OCX_FieldControl()1010 OCX_FieldControl() : OCX_ModernControl(rtl::OUString::createFromAscii("TextBox")) { 1011 mnBackColor = 0x80000005L; 1012 mnForeColor = 0x80000008L; 1013 nBorderColor = 0x80000006L; 1014 } 1015 sal_Bool Export(SotStorageRef &rObj, 1016 const com::sun::star::uno::Reference< 1017 com::sun::star::beans::XPropertySet> &rPropSet, 1018 const com::sun::star::awt::Size& rSize); 1019 sal_Bool WriteContents(SotStorageStreamRef &rObj, 1020 const com::sun::star::uno::Reference< 1021 com::sun::star::beans::XPropertySet> &rPropSet, 1022 const com::sun::star::awt::Size& rSize); Create()1023 static OCX_Control *Create() { return new OCX_FieldControl;} 1024 }; 1025 1026 1027 class OCX_ToggleButton : public OCX_ModernControl 1028 { 1029 public: OCX_ToggleButton()1030 OCX_ToggleButton() : OCX_ModernControl(rtl::OUString::createFromAscii("ToggleButton")) { 1031 msFormType = rtl::OUString::createFromAscii("com.sun.star.form.component.CommandButton"); 1032 msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlButtonModel"); 1033 1034 mnBackColor = 0x8000000F; 1035 mnForeColor = 0x80000012; 1036 aFontData.SetHasAlign(sal_True); 1037 aFontData.nJustification = 3; // centered by default 1038 } Create()1039 static OCX_Control *Create() { return new OCX_ToggleButton;} 1040 1041 using OCX_ModernControl::Import; // to not hide the other two import methods 1042 virtual sal_Bool Import(com::sun::star::uno::Reference< 1043 com::sun::star::beans::XPropertySet> &rPropSet); 1044 sal_Bool Export(SvStorageRef &rObj, 1045 const com::sun::star::uno::Reference< 1046 com::sun::star::beans::XPropertySet> &rPropSet, 1047 const com::sun::star::awt::Size& rSize); 1048 sal_Bool WriteContents(SvStorageStreamRef &rObj, 1049 const com::sun::star::uno::Reference< 1050 com::sun::star::beans::XPropertySet> &rPropSet, 1051 const com::sun::star::awt::Size& rSize); 1052 }; 1053 1054 class OCX_ComboBox : public OCX_ModernControl 1055 { 1056 public: OCX_ComboBox()1057 OCX_ComboBox() : OCX_ModernControl(rtl::OUString::createFromAscii("ComboBox")){ 1058 msFormType = rtl::OUString::createFromAscii("com.sun.star.form.component.ComboBox"); 1059 msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlComboBoxModel"); 1060 mnBackColor = 0x80000005; 1061 mnForeColor = 0x80000008; 1062 nBorderColor = 0x80000006; 1063 aFontData.SetHasAlign(sal_True); 1064 } Create()1065 static OCX_Control *Create() { return new OCX_ComboBox;} 1066 using OCX_ModernControl::Import; // to not hide the other two import methods 1067 virtual sal_Bool Import(com::sun::star::uno::Reference< 1068 com::sun::star::beans::XPropertySet> &rPropSet); 1069 sal_Bool Export(SotStorageRef &rObj, 1070 const com::sun::star::uno::Reference< 1071 com::sun::star::beans::XPropertySet> &rPropSet, 1072 const com::sun::star::awt::Size& rSize); 1073 sal_Bool WriteContents(SotStorageStreamRef &rObj, 1074 const com::sun::star::uno::Reference< 1075 com::sun::star::beans::XPropertySet> &rPropSet, 1076 const com::sun::star::awt::Size& rSize); 1077 }; 1078 1079 class OCX_ListBox : public OCX_ModernControl 1080 { 1081 public: OCX_ListBox()1082 OCX_ListBox() : OCX_ModernControl(rtl::OUString::createFromAscii("ListBox")){ 1083 msFormType = rtl::OUString::createFromAscii("com.sun.star.form.component.ListBox"); 1084 msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlListBoxModel"); 1085 mnBackColor = 0x80000005; 1086 mnForeColor = 0x80000008; 1087 nBorderColor = 0x80000006; 1088 aFontData.SetHasAlign(sal_True); 1089 } Create()1090 static OCX_Control *Create() { return new OCX_ListBox;} 1091 using OCX_ModernControl::Import; // to not hide the other two import methods 1092 virtual sal_Bool Import(com::sun::star::uno::Reference< 1093 com::sun::star::beans::XPropertySet> &rPropSet); 1094 sal_Bool Export(SotStorageRef &rObj, 1095 const com::sun::star::uno::Reference< 1096 com::sun::star::beans::XPropertySet> &rPropSet, 1097 const com::sun::star::awt::Size& rSize); 1098 sal_Bool WriteContents(SotStorageStreamRef &rObj, 1099 const com::sun::star::uno::Reference< 1100 com::sun::star::beans::XPropertySet> &rPropSet, 1101 const com::sun::star::awt::Size& rSize); 1102 1103 }; 1104 1105 class OCX_CommandButton : public OCX_Control 1106 { 1107 public: OCX_CommandButton()1108 OCX_CommandButton() : OCX_Control(String::CreateFromAscii("CommandButton")), 1109 fEnabled(1), fLocked(0), fBackStyle(1), fWordWrap(0), fAutoSize(0), 1110 nCaptionLen(0), nVertPos(1), nHorzPos(7), nMousePointer(0), nPicture(0), 1111 nAccelerator(0), nIcon(0), pCaption(0), nIconLen(0), pIcon(0), nPictureLen(0), 1112 pPicture(0), mbTakeFocus( true ) 1113 { 1114 msFormType = rtl::OUString::createFromAscii("com.sun.star.form.component.CommandButton"); 1115 msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlButtonModel"); 1116 mnForeColor = 0x80000012L; 1117 mnBackColor = 0x8000000FL; 1118 aFontData.SetHasAlign(sal_True); 1119 } 1120 ~OCX_CommandButton()1121 ~OCX_CommandButton() { 1122 if (pCaption) delete[] pCaption; 1123 if (pIcon) delete[] pIcon; 1124 if (pPicture) delete[] pPicture; 1125 } 1126 sal_Bool Read(SotStorageStream *pS); 1127 1128 /*sal_uInt8 for sal_uInt8 Word Struct*/ 1129 sal_uInt16 nIdentifier; 1130 sal_uInt16 nFixedAreaLen; 1131 sal_uInt8 pBlockFlags[4]; 1132 1133 1134 sal_uInt8 fUnknown1:1; 1135 sal_uInt8 fEnabled:1; 1136 sal_uInt8 fLocked:1; 1137 sal_uInt8 fBackStyle:1; 1138 sal_uInt8 fUnknown2:4; 1139 1140 sal_uInt8 fUnknown3:8; 1141 1142 sal_uInt8 fUnknown4:7; 1143 sal_uInt8 fWordWrap:1; 1144 1145 sal_uInt8 fUnknown5:4; 1146 sal_uInt8 fAutoSize:1; 1147 sal_uInt8 fUnknown6:3; 1148 1149 sal_uInt32 nCaptionLen; 1150 1151 sal_uInt16 nVertPos; 1152 sal_uInt16 nHorzPos; 1153 1154 sal_uInt16 nMousePointer; 1155 sal_uInt16 nPicture; 1156 sal_uInt16 nAccelerator; 1157 sal_uInt16 nIcon; 1158 1159 char *pCaption; 1160 1161 sal_uInt8 pIconHeader[20]; 1162 sal_uInt32 nIconLen; 1163 sal_uInt8 *pIcon; 1164 1165 sal_uInt8 pPictureHeader[20]; 1166 sal_uInt32 nPictureLen; 1167 sal_uInt8 *pPicture; 1168 1169 bool mbTakeFocus; 1170 Create()1171 static OCX_Control *Create() { return new OCX_CommandButton;} 1172 using OCX_Control::Import; // to not hide the other two import methods 1173 virtual sal_Bool Import(com::sun::star::uno::Reference< 1174 com::sun::star::beans::XPropertySet> &rPropSet); 1175 sal_Bool Export(SotStorageRef &rObj, 1176 const com::sun::star::uno::Reference< 1177 com::sun::star::beans::XPropertySet> &rPropSet, 1178 const com::sun::star::awt::Size& rSize); 1179 sal_Bool WriteContents(SotStorageStreamRef &rObj, 1180 const com::sun::star::uno::Reference< 1181 com::sun::star::beans::XPropertySet> &rPropSet, 1182 const com::sun::star::awt::Size& rSize); 1183 1184 }; 1185 1186 class OCX_ImageButton: public OCX_CommandButton 1187 { 1188 public: OCX_ImageButton()1189 OCX_ImageButton() { 1190 aFontData.SetHasAlign(sal_False); 1191 aFontData.SetHasFont(sal_False); 1192 } Create()1193 static OCX_Control *Create() { return new OCX_ImageButton;} 1194 sal_Bool Export(SotStorageRef &rObj, 1195 const com::sun::star::uno::Reference< 1196 com::sun::star::beans::XPropertySet> &rPropSet, 1197 const com::sun::star::awt::Size& rSize); 1198 sal_Bool WriteContents(SotStorageStreamRef &rObj, 1199 const com::sun::star::uno::Reference< 1200 com::sun::star::beans::XPropertySet> &rPropSet, 1201 const com::sun::star::awt::Size& rSize); 1202 1203 }; 1204 1205 class OCX_GroupBox: public OCX_Control 1206 { 1207 public: OCX_GroupBox()1208 OCX_GroupBox() : OCX_Control(String::CreateFromAscii("GroupBox")) {} Create()1209 static OCX_Control *Create() { return new OCX_GroupBox;} 1210 sal_Bool Export(SotStorageRef &rObj, 1211 const com::sun::star::uno::Reference< 1212 com::sun::star::beans::XPropertySet> &rPropSet, 1213 const com::sun::star::awt::Size& rSize); 1214 sal_Bool WriteContents(SotStorageStreamRef &rObj, 1215 const com::sun::star::uno::Reference< 1216 com::sun::star::beans::XPropertySet> &rPropSet, 1217 const com::sun::star::awt::Size& rSize); 1218 1219 }; 1220 1221 class OCX_Label : public OCX_Control 1222 { 1223 public: OCX_Label(OCX_Control * pParent=NULL)1224 OCX_Label(OCX_Control* pParent = NULL ) : OCX_Control(rtl::OUString::createFromAscii("Label"), pParent ), fEnabled(1), 1225 fLocked(0),fBackStyle(1),fWordWrap(1), 1226 fAutoSize(0),nCaptionLen(0),nVertPos(1),nHorzPos(7),nMousePointer(0), 1227 nBorderColor(0x80000006),nBorderStyle(0),nSpecialEffect(0), 1228 nPicture(0),nAccelerator(0),nIcon(0),pCaption(0),nIconLen(0),pIcon(0), 1229 nPictureLen(0),pPicture(0) 1230 { 1231 msFormType = rtl::OUString::createFromAscii("com.sun.star.form.component.FixedText"); 1232 msDialogType = rtl::OUString::createFromAscii("com.sun.star.awt.UnoControlFixedTextModel"); 1233 mnForeColor = 0x80000008; 1234 mnBackColor = 0x80000005; 1235 aFontData.SetHasAlign(sal_True); 1236 } 1237 ~OCX_Label()1238 ~OCX_Label() { 1239 if (pCaption) delete[] pCaption; 1240 if (pIcon) delete[] pIcon; 1241 if (pPicture) delete[] pPicture; 1242 } 1243 sal_Bool Read(SotStorageStream *pS); 1244 1245 /*sal_uInt8 for sal_uInt8 Word Struct*/ 1246 sal_uInt16 nIdentifier; 1247 sal_uInt16 nFixedAreaLen; 1248 sal_uInt8 pBlockFlags[4]; 1249 1250 1251 sal_uInt8 fUnknown1:1; 1252 sal_uInt8 fEnabled:1; 1253 sal_uInt8 fLocked:1; 1254 sal_uInt8 fBackStyle:1; 1255 sal_uInt8 fUnknown2:4; 1256 1257 sal_uInt8 fUnknown3:8; 1258 1259 sal_uInt8 fUnknown4:7; 1260 sal_uInt8 fWordWrap:1; 1261 1262 sal_uInt8 fUnknown5:4; 1263 sal_uInt8 fAutoSize:1; 1264 sal_uInt8 fUnknown6:3; 1265 1266 sal_uInt32 nCaptionLen; 1267 sal_uInt16 nVertPos; 1268 sal_uInt16 nHorzPos; 1269 sal_uInt8 nMousePointer; 1270 sal_uInt32 nBorderColor; 1271 sal_uInt16 nBorderStyle; 1272 sal_uInt16 nSpecialEffect; 1273 sal_uInt16 nPicture; 1274 sal_uInt16 nAccelerator; 1275 sal_uInt16 nIcon; 1276 1277 char *pCaption; 1278 1279 sal_uInt8 pIconHeader[20]; 1280 sal_uInt32 nIconLen; 1281 sal_uInt8 *pIcon; 1282 1283 sal_uInt8 pPictureHeader[20]; 1284 sal_uInt32 nPictureLen; 1285 sal_uInt8 *pPicture; 1286 Create()1287 static OCX_Control *Create() { return new OCX_Label;} 1288 1289 using OCX_Control::Import; // to not hide the other two import methods 1290 virtual sal_Bool Import(com::sun::star::uno::Reference< 1291 com::sun::star::beans::XPropertySet> &rPropSet); 1292 1293 sal_Bool Export(SotStorageRef &rObj, 1294 const com::sun::star::uno::Reference< 1295 com::sun::star::beans::XPropertySet> &rPropSet, 1296 const com::sun::star::awt::Size& rSize); 1297 sal_Bool WriteContents(SotStorageStreamRef &rObj, 1298 const com::sun::star::uno::Reference< 1299 com::sun::star::beans::XPropertySet> &rPropSet, 1300 const com::sun::star::awt::Size& rSize); 1301 1302 }; 1303 1304 1305 class OCX_ProgressBar : public OCX_Control 1306 { 1307 public: 1308 explicit OCX_ProgressBar(); 1309 1310 static OCX_Control* Create(); 1311 1312 virtual sal_Bool Read( SvStorageStream *pS ); 1313 using OCX_Control::Import; // to not hide the other two import methods 1314 virtual sal_Bool Import(com::sun::star::uno::Reference< 1315 com::sun::star::beans::XPropertySet> &rPropSet); 1316 // No Font record ReadFontData(SvStorageStream *)1317 virtual sal_Bool ReadFontData(SvStorageStream* /*pS*/) { return sal_True; } 1318 private: 1319 sal_Int32 nMin; 1320 sal_Int32 nMax; 1321 bool bFixedSingle; 1322 bool bEnabled; 1323 bool b3d; 1324 }; 1325 1326 class OCX_SpinButton : public OCX_Control 1327 { 1328 public: 1329 explicit OCX_SpinButton(); 1330 1331 static OCX_Control* Create(); 1332 1333 virtual sal_Bool Read( SvStorageStream *pS ); 1334 1335 virtual sal_Bool ReadFontData( SvStorageStream *pS ); 1336 1337 using OCX_Control::Import; // to not hide the other two import methods 1338 virtual sal_Bool Import(com::sun::star::uno::Reference< 1339 com::sun::star::beans::XPropertySet> &rPropSet); 1340 //Export exports a control as an OLE style storage stream tree 1341 virtual sal_Bool Export( SvStorageRef &rObj, 1342 const com::sun::star::uno::Reference< 1343 com::sun::star::beans::XPropertySet> &rPropSet, 1344 const com::sun::star::awt::Size& rSize ); 1345 1346 //WriteContents writes the contents of a contents stream, for 1347 //the Excel export you cannot use Export, only WriteContents instead 1348 virtual sal_Bool WriteContents( SvStorageStreamRef &rObj, 1349 const com::sun::star::uno::Reference< 1350 com::sun::star::beans::XPropertySet> &rPropSet, 1351 const com::sun::star::awt::Size& rSize ); 1352 1353 protected: 1354 void UpdateInt32Property( 1355 sal_Int32& rnCoreValue, sal_Int32 nNewValue, 1356 sal_Int32 nBlockFlag ); 1357 1358 void GetInt32Property( 1359 sal_Int32& rnCoreValue, 1360 const com::sun::star::uno::Reference< 1361 com::sun::star::beans::XPropertySet >& rxPropSet, 1362 const rtl::OUString& rPropName, 1363 sal_Int32 nBlockFlag ); 1364 1365 void UpdateBoolProperty( 1366 bool& rbCoreValue, bool bNewValue, 1367 sal_Int32 nBlockFlag ); 1368 1369 void GetBoolProperty( 1370 bool& rbCoreValue, 1371 const com::sun::star::uno::Reference< 1372 com::sun::star::beans::XPropertySet >& rxPropSet, 1373 const rtl::OUString& rPropName, 1374 sal_Int32 nBlockFlag ); 1375 1376 /** Writes the data from own members to stream. */ 1377 sal_Bool WriteData( SvStream& rStrm ) const; 1378 1379 sal_Int32 mnBlockFlags; 1380 sal_Int32 mnValue; 1381 sal_Int32 mnMin; 1382 sal_Int32 mnMax; 1383 sal_Int32 mnSmallStep; 1384 sal_Int32 mnPageStep; 1385 sal_Int32 mnOrient; 1386 sal_Int32 mnDelay; 1387 bool mbEnabled; 1388 bool mbLocked; 1389 bool mbPropThumb; 1390 }; 1391 1392 class OCX_ScrollBar : public OCX_SpinButton 1393 { 1394 public: 1395 explicit OCX_ScrollBar(); 1396 1397 static OCX_Control* Create(); 1398 1399 using OCX_Control::Import; // to not hide the other two import methods 1400 virtual sal_Bool Import(com::sun::star::uno::Reference< 1401 com::sun::star::beans::XPropertySet> &rPropSet); 1402 1403 //Export exports a control as an OLE style storage stream tree 1404 virtual sal_Bool Export( SvStorageRef &rObj, 1405 const com::sun::star::uno::Reference< 1406 com::sun::star::beans::XPropertySet> &rPropSet, 1407 const com::sun::star::awt::Size& rSize ); 1408 1409 //WriteContents writes the contents of a contents stream, for 1410 //the Excel export you cannot use Export, only WriteContents instead 1411 virtual sal_Bool WriteContents( SvStorageStreamRef &rObj, 1412 const com::sun::star::uno::Reference< 1413 com::sun::star::beans::XPropertySet> &rPropSet, 1414 const com::sun::star::awt::Size& rSize ); 1415 }; 1416 1417 #endif 1418