update dev300-m58
[ooovba.git] / sc / workben / test.cxx
blob85ad74364a0705ecfb5b6e6be3b82c9d75b64c47
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: test.cxx,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #include <tools/debug.hxx>
32 #include <svtools/libcall.hxx>
33 #include <vcl/msgbox.hxx>
34 #include <vcl/window.hxx>
35 #include <vcl/imagebtn.hxx>
36 #include <vcl/field.hxx>
37 #include <vcl/fixed.hxx>
38 #include <vcl/help.hxx>
39 #include <usr/conver.hxx>
40 #include <usr/uno.hxx>
41 #include <usr/refl.hxx>
42 #include <stardiv/one/frame/xcollect.hxx>
43 #include <stardiv/one/text/offfield.hxx>
44 #include <stardiv/one/offmisc.hxx>
45 #include <stardiv/one/sheet/offtable.hxx>
46 #include <stardiv/one/text/offtext.hxx>
47 #include <stardiv/one/offstyle.hxx>
48 #include <stardiv/one/offview.hxx>
49 #include <stardiv/uno/repos/serinfo.hxx>
50 #include <stardiv/one/sheet/sctypes.hxx>
51 #include <stardiv/one/sheet/scmodel.hxx>
52 #include <stardiv/one/sheet/sccells.hxx>
53 #include <stardiv/one/sheet/sctables.hxx>
54 #include <stardiv/one/sheet/sctable.hxx>
55 #include <stardiv/one/sheet/sccell.hxx>
56 #include <stardiv/one/sheet/scpostit.hxx>
57 #include <stardiv/one/sheet/scview.hxx>
58 #include <stardiv/one/sheet/scdata.hxx>
59 #include <stardiv/one/sheet/scattr.hxx>
61 //! das muss als Konstante in irgendeine idl-Datei!!!!
62 #define TEXTCONTROLCHAR_PARAGRAPH_BREAK 0
65 class MyFixedText : public FixedText
67 protected:
68 void RequestHelp( const HelpEvent& rHEvt );
69 public:
70 MyFixedText(Window* pParent) : FixedText(pParent) {}
73 class MyWindow : public Window
75 private:
76 NumericField aCountField;
77 PushButton aCountButton;
78 MyFixedText aTimeText;
79 NumericField aColField;
80 NumericField aRowField;
81 NumericField aPosField;
82 NumericField aLenField;
83 Edit aTextEdit;
84 PushButton aTextButton;
85 PushButton aBlaButton;
86 PushButton aTabButton;
87 PushButton aViewButton;
89 public:
90 MyWindow( Window *pParent );
92 DECL_LINK(CountHdl, PushButton*);
93 DECL_LINK(TextHdl, PushButton*);
94 DECL_LINK(BlaHdl, PushButton*);
95 DECL_LINK(TabHdl, PushButton*);
96 DECL_LINK(ViewHdl, PushButton*);
99 //-----------------------------------------------------------------------
101 class ScTestListener : public XSelectionChangeListener, public UsrObject
103 private:
104 FixedText* pFixedText;
106 public:
107 ScTestListener(FixedText* pF);
108 virtual ~ScTestListener();
110 SMART_UNO_DECLARATION( ScTestListener, UsrObject );
112 virtual XInterface * queryInterface( UsrUik );
113 virtual XIdlClassRef getIdlClass(void);
115 virtual void disposing(const EventObject& Source);
117 // XSelectionChangeListener
118 virtual void selectionChanged(const EventObject& aEvent);
121 //-----------------------------------------------------------------------
123 static long nBla = 0;
125 static XCellRef xGlobalCell;
127 //-----------------------------------------------------------------------
129 ScTestListener::ScTestListener(FixedText* pF) :
130 pFixedText( pF )
134 ScTestListener::~ScTestListener()
138 XInterface* ScTestListener::queryInterface( UsrUik aUIK )
140 if ( aUIK == XSelectionChangeListener::getSmartUik() )
141 return (XSelectionChangeListener*) this;
143 return UsrObject::queryInterface( aUIK );
146 XIdlClassRef ScTestListener::getIdlClass(void)
148 static XIdlClassRef xClass = createStandardClass( L"ScTestListener",
149 UsrObject::getUsrObjectIdlClass(),
150 1, XSelectionChangeListener_getReflection() );
151 return xClass;
154 void ScTestListener::disposing(const EventObject& Source)
158 // XSelectionChangeListener
160 void ScTestListener::selectionChanged(const EventObject& aEvent)
162 static USHORT nBla = 0;
163 pFixedText->SetText(++nBla);
165 XInterfaceRef xInt = aEvent.Source;
166 if (!xInt) return;
167 XDocumentViewRef xView = (XDocumentView*)xInt->queryInterface(XDocumentView::getSmartUik());
168 if (!xView) return;
169 XInterfaceRef xSelInt = xView->getSelection();
170 if (!xSelInt) return;
171 XCellCollectionRef xCells = (XCellCollection*)
172 xSelInt->queryInterface(XCellCollection::getSmartUik());
173 if (!xCells) return;
175 String aStr = OUStringToString( xCells->getAddress(), CHARSET_SYSTEM );
176 pFixedText->SetText(aStr);
180 //-----------------------------------------------------------------------
182 extern "C" Window* __LOADONCALLAPI CreateWindow( Window *pParent, const String& rParam )
184 MyWindow *pWin = new MyWindow( pParent );
185 return pWin;
188 void MyFixedText::RequestHelp( const HelpEvent& rHEvt )
190 String aTxtStr=GetText();
191 Size aTxtSize=GetTextSize(aTxtStr);
192 Point aShowPoint= OutputToScreenPixel(Point(0,0));
193 if ( ( rHEvt.GetMode() & HELPMODE_QUICK ) == HELPMODE_QUICK &&
194 aTxtSize.Width()>GetSizePixel().Width())
195 Help::ShowQuickHelp( Rectangle(aShowPoint,aTxtSize), aTxtStr, QUICKHELP_TOP|QUICKHELP_LEFT );
196 else
197 FixedText::RequestHelp( rHEvt );
200 MyWindow::MyWindow( Window *pParent ) :
201 Window( pParent ),
202 aCountField( this, WinBits(WB_SPIN | WB_REPEAT | WB_BORDER) ),
203 aCountButton( this ),
204 aTimeText( this ),
205 aColField( this, WinBits(WB_SPIN | WB_REPEAT | WB_BORDER) ),
206 aRowField( this, WinBits(WB_SPIN | WB_REPEAT | WB_BORDER) ),
207 aPosField( this, WinBits(WB_SPIN | WB_REPEAT | WB_BORDER) ),
208 aLenField( this, WinBits(WB_SPIN | WB_REPEAT | WB_BORDER) ),
209 aTextEdit( this, WinBits(WB_BORDER) ),
210 aTextButton( this ),
211 aBlaButton( this ),
212 aTabButton( this ),
213 aViewButton( this )
215 aCountField.SetPosSizePixel( Point(10,10), Size(40,20) );
216 aCountField.SetValue(1);
218 aCountButton.SetPosSizePixel( Point(10,40), Size(100,30) );
219 aCountButton.SetText("hochzaehlen");
221 aTimeText.SetPosSizePixel( Point(10,80), Size(100,20) );
223 aColField.SetPosSizePixel( Point(10,120), Size(40,20) );
224 aRowField.SetPosSizePixel( Point(60,120), Size(40,20) );
225 aPosField.SetPosSizePixel( Point(10,150), Size(40,20) );
226 aLenField.SetPosSizePixel( Point(60,150), Size(40,20) );
227 aTextEdit.SetPosSizePixel( Point(10,180), Size(100,20) );
229 aTextButton.SetPosSizePixel( Point(10,210), Size(100,30) );
230 aTextButton.SetText("col/row/pos/len");
232 aBlaButton.SetPosSizePixel( Point(10,260), Size(100,30) );
233 aBlaButton.SetText("Bla");
235 aTabButton.SetPosSizePixel( Point(10,310), Size(100,30) );
236 aTabButton.SetText("Tabellen");
238 aViewButton.SetPosSizePixel( Point(10,360), Size(100,30) );
239 aViewButton.SetText("Pfui");
241 aCountButton.SetClickHdl(LINK(this, MyWindow, CountHdl));
242 aTextButton.SetClickHdl(LINK(this, MyWindow, TextHdl));
243 aBlaButton.SetClickHdl(LINK(this, MyWindow, BlaHdl));
244 aTabButton.SetClickHdl(LINK(this, MyWindow, TabHdl));
245 aViewButton.SetClickHdl(LINK(this, MyWindow, ViewHdl));
247 aCountField.Show();
248 aCountButton.Show();
249 aTimeText.Show();
250 aColField.Show();
251 aRowField.Show();
252 aPosField.Show();
253 aLenField.Show();
254 aTextEdit.Show();
255 aTextButton.Show();
256 aBlaButton.Show();
257 aTabButton.Show();
258 aViewButton.Show();
261 //-----------------------------------------------------------------------
263 XSpreadsheetDocumentRef lcl_GetDocument()
265 XServiceManagerRef xProv = getGlobalServiceManager();
266 DBG_ASSERT( xProv.is(), "Kein ServiceManager!" );
268 XServiceRegistryRef xReg = (XServiceRegistry*)xProv->queryInterface(XServiceRegistry::getSmartUik());
269 if ( !xReg )
270 return NULL;
272 Sequence<Uik> aIfaces( 1 );
273 aIfaces.getArray()[0] = XModelCollection::getSmartUik();
274 XServiceProviderRef xSSI = xProv->getServiceProvider( L"stardiv.desktop.ModelCollection",
275 aIfaces, Sequence<Uik>() );
277 XModelCollectionRef aCollRef = (XModelCollection*)
278 xSSI->newInstance()->queryInterface( XModelCollection::getSmartUik() );
279 USHORT nCount = aCollRef->getCount();
281 XSpreadsheetDocumentRef xModel; // Calc-Model
282 for (USHORT nMod=0; nMod<nCount && !xModel; nMod++) // Calc-Doc suchen
284 XModelRef aRef = aCollRef->getItemByIndex( nMod );
285 if ( aRef )
287 aRef->acquire();
288 xModel = (XSpreadsheetDocument*) aRef->queryInterface( XSpreadsheetDocument::getSmartUik() );
289 aRef->release();
292 return xModel;
295 XInterfaceRef lcl_GetView()
297 XInterfaceRef xView;
298 XSpreadsheetDocumentRef xDoc = lcl_GetDocument(); // Calc-Model
299 if (xDoc)
300 xView = xDoc->getDDELinks(); //! temporaer zum Testen !!!!!!!!!
302 return xView;
305 //-----------------------------------------------------------------------
307 void lcl_OutputNames( const XInterfaceRef& xSource, // XNameAccess
308 const XSpreadsheetDocumentRef& xDoc,
309 USHORT nCol, USHORT nRow, USHORT nTab )
311 CellAddress aAdr;
312 aAdr.Sheet = nTab;
313 aAdr.Column = nCol;
314 aAdr.Row = nRow;
316 XNameAccessRef xNames = (XNameAccess*)xSource->queryInterface(XNameAccess::getSmartUik());
317 if (!xNames) return;
318 Sequence<UString> aSeq = xNames->getElementNames();
320 USHORT nLen = (USHORT)aSeq.getLen();
322 XCellRef xCell = xDoc->getCell(aAdr);
323 if (!xCell) return;
324 xCell->setValue( nLen );
325 ++aAdr.Row;
327 UString* pAry = aSeq.getArray();
328 for (USHORT i=0; i<nLen; i++)
330 xCell = xDoc->getCell(aAdr);
331 if (!xCell) return;
332 XTextRef xText = (XText*)xCell->queryInterface(XText::getSmartUik());
333 if (!xText) return;
334 xText->setText( pAry[i] );
335 ++aAdr.Row;
339 //-----------------------------------------------------------------------
341 void lcl_SetText( const XTextRef& xText )
343 if (!xText.is()) return;
344 XTextCursorRef xCursor = xText->createTextCursor();
345 if (!xCursor.is()) return;
346 XTextPositionRef xPos = (XTextPosition*)xCursor->queryInterface(XTextPosition::getSmartUik());
347 XPropertySetRef xProp = (XPropertySet*)xCursor->queryInterface(XPropertySet::getSmartUik());
348 XControlCharacterInsertableRef xControl = (XControlCharacterInsertable*)
349 xCursor->queryInterface(XControlCharacterInsertable::getSmartUik());
350 XParagraphCursorRef xPara = (XParagraphCursor*)
351 xCursor->queryInterface(XParagraphCursor::getSmartUik());
353 if (!xPos.is() || !xControl.is() || !xPara.is()) return; // PropertySet kann fehlen
355 xText->setText(L"bla fasel");
356 xCursor->gotoEnd(FALSE);
357 xControl->insertControlCharacter( TEXTCONTROLCHAR_PARAGRAPH_BREAK );
358 xPos->collapseToEnd();
359 xPos->setText(L"s\xFClz"); // zweiter Absatz
361 xCursor->gotoStart(FALSE);
362 xPara->gotoEndOfParagraph(FALSE);
363 xCursor->goLeft(5, TRUE); // letzte 5 Zeichen im 1. Absatz
364 if (xProp.is())
365 xProp->setPropertyValue(L"Bold", UsrAny((BOOL)TRUE));
368 //-----------------------------------------------------------------------
370 void lcl_DoCount()
372 XSpreadsheetDocumentRef xDoc = lcl_GetDocument(); // Calc-Model
373 if (xDoc)
375 XActionLockableRef xLock = (XActionLockable*)
376 xDoc->queryInterface(XActionLockable::getSmartUik());
377 XCalculateRef xCalc = (XCalculate*)
378 xDoc->queryInterface(XCalculate::getSmartUik());
379 if (xLock)
380 xLock->addActionLock(); // nicht zwischendurch painten
381 if (xCalc)
382 xCalc->setAutomaticCalculation(FALSE);
384 CellAddress aPos;
385 aPos.Sheet = 0;
387 for (USHORT nRow = 0; nRow < 20; nRow++)
389 aPos.Row = nRow;
390 for (USHORT nCol = 0; nCol < 10; nCol++)
392 aPos.Column = nCol;
393 XCellRef xCell = xDoc->getCell(aPos);
394 if ( xCell )
396 // Wert der Zelle um 1 hochzaehlen
398 double fVal = xCell->getValue();
399 fVal += 1.0;
400 xCell->setValue( fVal );
405 if (xCalc)
406 xCalc->setAutomaticCalculation(TRUE);
407 if (xLock)
408 xLock->removeActionLock();
413 void lcl_GlobalCell()
415 if ( xGlobalCell )
417 String aStr = OUStringToString( xGlobalCell->getFormula(), CHARSET_SYSTEM );
418 aStr+='0';
419 xGlobalCell->setFormula( StringToOUString( aStr, CHARSET_SYSTEM ) );
424 void lcl_Annotations( FixedText& aTimeText )
426 XSpreadsheetDocumentRef xDoc = lcl_GetDocument(); // Calc-Model
427 if (xDoc)
429 CellAddress aPos;
430 aPos.Sheet = 0;
431 aPos.Column = 1;
432 aPos.Row = 2;
433 XCellRef xCell = xDoc->getCell(aPos);
434 if ( xCell )
436 XSheetAnnotationAnchorRef xAnchor =
437 (XSheetAnnotationAnchor*)xCell->queryInterface(XSheetAnnotationAnchor::getSmartUik());
438 if ( xAnchor )
440 XSheetAnnotationRef xAnnotation = xAnchor->getAnnotation();
441 if ( xAnnotation )
443 String aBlubb = OUStringToString( xAnnotation->getAuthor(), CHARSET_SYSTEM )+
444 String(" - ")+
445 OUStringToString( xAnnotation->getDate(), CHARSET_SYSTEM );
446 aTimeText.SetText(aBlubb);
448 XTextRef xAnnotationText =
449 (XText*)xAnnotation->queryInterface(XText::getSmartUik());
450 if ( xAnnotationText )
452 XTextCursorRef xCursor = xAnnotationText->createTextCursor();
453 if (xCursor)
455 XTextPositionRef xPos = (XTextPosition*)
456 xCursor->queryInterface(XTextPosition::getSmartUik());
457 XControlCharacterInsertableRef xControl = (XControlCharacterInsertable*)
458 xCursor->queryInterface(XControlCharacterInsertable::getSmartUik());
460 if (xPos && xControl)
462 ULONG nStart = Time::GetSystemTicks();
464 xAnnotationText->setText(L"bla");
465 xCursor->gotoEnd(FALSE);
466 xCursor->goLeft(1,TRUE);
467 xPos->setText(L"ubb");
468 for (USHORT i=0; i<10; i++)
470 xPos->collapseToEnd();
471 xControl->insertControlCharacter( TEXTCONTROLCHAR_PARAGRAPH_BREAK );
472 xPos->collapseToEnd();
473 xPos->setText(L"dumdi");
476 ULONG nEnd = Time::GetSystemTicks();
477 aTimeText.SetText(String(nEnd-nStart)+String(" ms"));
488 void lcl_Cursor( FixedText& aTimeText )
490 aTimeText.SetText( "..." );
491 XSpreadsheetDocumentRef xDoc = lcl_GetDocument(); // Calc-Model
492 if (xDoc)
494 XActionLockableRef xLock = (XActionLockable*)
495 xDoc->queryInterface(XActionLockable::getSmartUik());
496 if (xLock)
497 xLock->addActionLock();
499 CellAddress aPos;
500 aPos.Sheet = 0;
501 aPos.Column = 1;
502 aPos.Row = 2;
503 XCellRef xCell = xDoc->getCell(aPos);
504 if ( xCell )
506 XTextRef xText = (XText*)xCell->queryInterface(XText::getSmartUik());
507 XCellCollectionRef xColl = (XCellCollection*)xCell->queryInterface(XCellCollection::getSmartUik());
508 if ( xText && xColl )
510 xText->setText(L"bla");
511 XLineCursorRef xCursor = xColl->createCursor();
512 if ( xCursor )
514 XCellCursorRef xCC = (XCellCursor*)xCursor->queryInterface(XCellCursor::getSmartUik());
515 XCellRangesCursorRef xRC = (XCellRangesCursor*)
516 xCursor->queryInterface(XCellRangesCursor::getSmartUik());
518 if ( xCC && xRC )
520 xCursor->goDown( 1, FALSE );
522 xColl = xCC->getRanges();
523 if ( xColl )
525 // XText ist drin, wenn's ne einzelne Zelle ist
526 xText = (XText*)xColl->queryInterface(XText::getSmartUik());
527 if ( xText )
529 xText->setText(L"fasel");
533 CellRangeAddress aSecond;
534 aSecond.Sheet = 0;
535 aSecond.StartColumn = 3;
536 aSecond.StartRow = 4;
537 aSecond.EndColumn = 3;
538 aSecond.EndRow = 4;
539 xRC->gotoUnion(aSecond);
541 xColl = xCC->getRanges();
542 if ( xColl )
544 XPropertySetRef xProp = (XPropertySet*)
545 xColl->queryInterface(XPropertySet::getSmartUik());
546 if ( xProp )
548 UsrAny aAny;
550 aAny = xProp->getPropertyValue(L"ShadowFormat");
551 if ( aAny.getReflection()->getName() ==
552 ShadowFormat_getReflection()->getName() )
554 //ShadowFormat* pOld = (ShadowFormat*)aAny.get();
555 ShadowFormat aNew;
556 aNew.Location = SHADOWLOCATION_BOTTOMRIGHT;
557 aNew.ShadowWidth = 100;
558 aNew.IsTransparent = FALSE;
559 aNew.Color = 0xff0000L;
560 aAny.set( &aNew, aAny.getReflection() );
561 xProp->setPropertyValue(L"ShadowFormat", aAny);
564 aAny = xProp->getPropertyValue(L"RotationValue");
565 aAny.setINT32(4500);
566 xProp->setPropertyValue(L"RotationValue", aAny);
568 aAny = xProp->getPropertyValue(L"FontHeight");
569 aAny.setUINT32(280);
570 xProp->setPropertyValue(L"FontHeight", aAny);
572 aAny = xProp->getPropertyValue(L"TransparentBackground");
573 aAny.setBOOL(FALSE);
574 xProp->setPropertyValue(L"TransparentBackground", aAny);
576 aAny = xProp->getPropertyValue(L"BackgroundColor");
577 aAny.setUINT32(0xffff00);
578 xProp->setPropertyValue(L"BackgroundColor", aAny);
580 aAny = xProp->getPropertyValue(L"CellProtection");
581 if ( aAny.getReflection()->getName() ==
582 CellProtection_getReflection()->getName() )
584 //CellProtection* pOld = (CellProtection*)aAny.get();
585 CellProtection aNew;
586 aNew.Locked = FALSE;
587 aNew.FormulaHidden = FALSE;
588 aNew.Hidden = FALSE;
589 aNew.PrintHidden = FALSE;
590 aAny.set( &aNew, aAny.getReflection() );
591 xProp->setPropertyValue(L"CellProtection", aAny);
595 // XIndexAccess gibts nur wenn's mehrere sind (??!??!)
596 XIndexAccessRef xIndex = (XIndexAccess*)
597 xColl->queryInterface(XIndexAccess::getSmartUik());
598 if ( xIndex )
600 USHORT nCount = (USHORT)xIndex->getCount();
601 aTimeText.SetText( String(nCount) );
609 if (xLock)
610 xLock->removeActionLock();
615 void lcl_Cells( FixedText& aTimeText )
617 aTimeText.SetText( "..." );
618 XSpreadsheetDocumentRef xDoc = lcl_GetDocument(); // Calc-Model
619 if (xDoc)
621 long nCount = 0;
622 ULONG nStart = Time::GetSystemTicks();
624 XActionLockableRef xLock = (XActionLockable*)
625 xDoc->queryInterface(XActionLockable::getSmartUik());
626 // if (xLock)
627 // xLock->addActionLock();
629 CellRangeAddress aRngAddr;
630 aRngAddr.Sheet = 0;
631 aRngAddr.StartColumn = 0;
632 aRngAddr.StartRow = 0;
633 aRngAddr.EndColumn = 9;
634 aRngAddr.EndRow = 19;
635 XCellRangeRef xRange = xDoc->getCellRange(aRngAddr);
636 if (xRange)
638 XCellCollectionRef xColl = (XCellCollection*)
639 xRange->queryInterface(XCellCollection::getSmartUik());
640 if (xColl)
642 XEnumerationAccessRef xEnAcc = xColl->getCells();
643 if (xEnAcc)
645 XEnumerationRef xEnum = xEnAcc->getEnumeration();
646 if (xEnum)
648 while (xEnum->hasMoreElements())
650 XInterfaceRef xInt = xEnum->nextElement();
651 if (xInt)
653 ++nCount;
661 ULONG nEnd = Time::GetSystemTicks();
662 aTimeText.SetText(String(nCount)+String(" ")+String(nEnd-nStart)+String(" ms"));
665 // if (xLock)
666 // xLock->removeActionLock();
670 void lcl_Sheet( FixedText& aTimeText )
672 aTimeText.SetText( "..." );
673 XSpreadsheetDocumentRef xDoc = lcl_GetDocument(); // Calc-Model
674 if (!xDoc) return;
675 XSpreadsheetsRef xSheets = xDoc->getSheets();
676 if (!xSheets) return;
677 XTableSheetRef xSheet = xSheets->getSheetByIndex(0);
678 if (!xSheet) return;
679 XNamedRef xNamed = (XNamed*)xSheet->queryInterface(XNamed::getSmartUik());
680 if (!xNamed) return;
682 String aName = OUStringToString( xNamed->getName(), CHARSET_SYSTEM );
683 aName += 'X';
684 xNamed->setName(StringToOUString( aName, CHARSET_SYSTEM ));
686 XCellRangeRef xRange = (XCellRange*)xSheet->queryInterface(XCellRange::getSmartUik());
687 if (!xRange) return;
688 XCellRef xCell = xRange->getCell(2,1);
689 if (!xCell) return;
690 XTextRef xText = (XText*)xCell->queryInterface(XText::getSmartUik());
691 if (!xText) return;
692 String aBla = OUStringToString( xText->getText(), CHARSET_SYSTEM );
693 aBla += "bla";
694 xText->setText(StringToOUString( aBla, CHARSET_SYSTEM ));
696 XColumnRowRangeRef xCRR = (XColumnRowRange*)xSheet->queryInterface(XColumnRowRange::getSmartUik());
697 if (!xCRR) return;
699 XTableColumnsRef xCols = xCRR->getColumns();
700 if (!xCols) return;
701 XPropertySetRef xCol = xCols->getColumnByIndex(2);
702 if (!xCol) return;
704 UINT16 nWidth = TypeConversion::toUINT16(xCol->getPropertyValue(L"Width"));
705 // UINT16 nNewWidth = nWidth + 100;
706 // xCol->setPropertyValue(L"Width", UsrAny(nNewWidth));
708 xCol->setPropertyValue(L"OptimalWidth", UsrAny((BOOL)TRUE));
709 xCol->setPropertyValue(L"NewPage", UsrAny((BOOL)FALSE));
711 UsrAny aAny = xCol->getPropertyValue(L"ShadowFormat");
712 if ( aAny.getReflection()->getName() ==
713 ShadowFormat_getReflection()->getName() )
715 //ShadowFormat* pOld = (ShadowFormat*)aAny.get();
716 ShadowFormat aNew;
717 aNew.Location = SHADOWLOCATION_BOTTOMRIGHT;
718 aNew.ShadowWidth = 100;
719 aNew.IsTransparent = FALSE;
720 aNew.Color = 0xff0000L;
721 aAny.set( &aNew, aAny.getReflection() );
722 xCol->setPropertyValue(L"ShadowFormat", aAny);
725 XTableRowsRef xRows = xCRR->getRows();
726 if (!xRows) return;
727 XPropertySetRef xRow = xRows->getRowByIndex(1);
728 if (!xRow) return;
730 xRows->removeRowsByIndex( 2, 1 );
732 UINT16 nHeight = TypeConversion::toUINT16(xRow->getPropertyValue(L"Height"));
733 BOOL bOptH = TypeConversion::toBOOL(xRow->getPropertyValue(L"OptimalHeight"));
735 UINT16 nNewHeight = nHeight + 100;
736 xRow->setPropertyValue(L"Height", UsrAny(nNewHeight));
738 aTimeText.SetText(String("W:")+String(nWidth)+String(" H:")+String(nHeight)+
739 String(" ")+String((USHORT)bOptH));
742 void lcl_Names( FixedText& aTimeText )
744 aTimeText.SetText( "..." );
745 XSpreadsheetDocumentRef xDoc = lcl_GetDocument(); // Calc-Model
746 if (!xDoc) return;
747 XNamedRangesRef xNames = xDoc->getNamedRanges();
748 if (!xNames) return;
749 XNamedRangeRef xName = xNames->getRangeByName(L"bla");
750 if (!xName) return;
751 String aCont = OUStringToString( xName->getContent(), CHARSET_SYSTEM );
752 aTimeText.SetText(aCont);
754 XCellRangeSourceRef xSource = (XCellRangeSource*)
755 xName->queryInterface(XCellRangeSource::getSmartUik());
756 if (!xSource) return;
757 XCellRangeRef xRange = xSource->getReferredCells();
758 if (!xRange) return;
759 XPropertySetRef xProp = (XPropertySet*)xRange->queryInterface(XPropertySet::getSmartUik());
760 if (!xProp) return;
761 UsrAny aAny = xProp->getPropertyValue(L"RotationValue");
762 aAny.setINT32(3000);
763 xProp->setPropertyValue(L"RotationValue", aAny);
766 void lcl_Sheets( FixedText& aTimeText )
768 aTimeText.SetText( "..." );
769 XSpreadsheetDocumentRef xDoc = lcl_GetDocument(); // Calc-Model
770 if (!xDoc) return;
771 XSpreadsheetsRef xSheets = xDoc->getSheets();
772 if (!xSheets) return;
774 #if 0
775 xSheets->insertSheet( "hinten", 100 );
776 xSheets->insertSheet( "vorne", 0 );
777 xSheets->removeSheetByName( "hinten" );
778 xSheets->removeSheetByName( "vorne" );
779 #endif
781 xSheets->moveSheet(0, 1, TRUE);
782 xSheets->moveSheet(0, 2, FALSE);
785 void lcl_Goal( FixedText& aTimeText )
787 XSpreadsheetDocumentRef xDoc = lcl_GetDocument(); // Calc-Model
788 if (!xDoc) return;
789 XGoalSeekRef xGoal = (XGoalSeek*)xDoc->queryInterface(XGoalSeek::getSmartUik());
790 if (!xGoal) return;
792 double fResult;
793 CellAddress aFormula; // A1
794 aFormula.Sheet = 0;
795 aFormula.Column = 0;
796 aFormula.Row = 0;
797 CellAddress aVar; // A2
798 aVar.Sheet = 0;
799 aVar.Column = 0;
800 aVar.Row = 1;
801 BOOL bFound = xGoal->doGoalSeek(fResult, aFormula, aVar, L"42");
803 if (bFound)
805 CellAddress aOut; // A3
806 aOut.Sheet = 0;
807 aOut.Column = 0;
808 aOut.Row = 2;
810 XCellRef xCell = xDoc->getCell(aOut);
811 if (!xCell) return;
812 xCell->setValue(fResult);
816 void lcl_TabOp( FixedText& aTimeText )
818 // Mehrfachoperation auf Tabelle2
819 XSpreadsheetDocumentRef xDoc = lcl_GetDocument(); // Calc-Model
820 if (!xDoc) return;
822 XCellRangeRef xRange;
823 XTableOperationRef xGoal;
824 CellRangeAddress aRangeAddr;
825 CellRangeAddress aFormulaRange;
826 CellAddress aColumnCell;
827 CellAddress aRowCell;
828 TableOperationMode nMode;
830 aRangeAddr.Sheet = 1; // c9:e11
831 aRangeAddr.StartColumn = 2;
832 aRangeAddr.StartRow = 8;
833 aRangeAddr.EndColumn = 4;
834 aRangeAddr.EndRow = 10;
835 aFormulaRange.Sheet = 1; // c6:c7
836 aFormulaRange.StartColumn = 2;
837 aFormulaRange.StartRow = 5;
838 aFormulaRange.EndColumn = 2;
839 aFormulaRange.EndRow = 6;
840 aColumnCell.Sheet = 0; // nicht benutzt
841 aColumnCell.Column = 0;
842 aColumnCell.Row = 0;
843 aRowCell.Sheet = 1; // c5
844 aRowCell.Column = 2;
845 aRowCell.Row = 4;
846 nMode = TABLEOP_ROW;
848 xRange = xDoc->getCellRange(aRangeAddr);
849 if (!xRange) return;
850 xGoal = (XTableOperation*)xRange->queryInterface(XTableOperation::getSmartUik());
851 if (!xGoal) return;
852 xGoal->setTableOperation( nMode, aFormulaRange, aColumnCell, aRowCell );
854 aRangeAddr.Sheet = 1; // b19:d21
855 aRangeAddr.StartColumn = 1;
856 aRangeAddr.StartRow = 18;
857 aRangeAddr.EndColumn = 3;
858 aRangeAddr.EndRow = 20;
859 aFormulaRange.Sheet = 1; // c16:d16
860 aFormulaRange.StartColumn = 2;
861 aFormulaRange.StartRow = 15;
862 aFormulaRange.EndColumn = 3;
863 aFormulaRange.EndRow = 15;
864 aColumnCell.Sheet = 1; // b16
865 aColumnCell.Column = 1;
866 aColumnCell.Row = 15;
867 aRowCell.Sheet = 0; // nicht benutzt
868 aRowCell.Column = 0;
869 aRowCell.Row = 0;
870 nMode = TABLEOP_COLUMN;
872 xRange = xDoc->getCellRange(aRangeAddr);
873 if (!xRange) return;
874 xGoal = (XTableOperation*)xRange->queryInterface(XTableOperation::getSmartUik());
875 if (!xGoal) return;
876 xGoal->setTableOperation( nMode, aFormulaRange, aColumnCell, aRowCell );
878 aRangeAddr.Sheet = 1; // b29:e32
879 aRangeAddr.StartColumn = 1;
880 aRangeAddr.StartRow = 28;
881 aRangeAddr.EndColumn = 4;
882 aRangeAddr.EndRow = 31;
883 aFormulaRange.Sheet = 1; // c27:c27
884 aFormulaRange.StartColumn = 2;
885 aFormulaRange.StartRow = 26;
886 aFormulaRange.EndColumn = 2;
887 aFormulaRange.EndRow = 26;
888 aColumnCell.Sheet = 1; // c25
889 aColumnCell.Column = 2;
890 aColumnCell.Row = 24;
891 aRowCell.Sheet = 1; // c26
892 aRowCell.Column = 2;
893 aRowCell.Row = 25;
894 nMode = TABLEOP_BOTH;
896 xRange = xDoc->getCellRange(aRangeAddr);
897 if (!xRange) return;
898 xGoal = (XTableOperation*)xRange->queryInterface(XTableOperation::getSmartUik());
899 if (!xGoal) return;
900 xGoal->setTableOperation( nMode, aFormulaRange, aColumnCell, aRowCell );
903 void lcl_Fill( FixedText& aTimeText )
905 XInterfaceRef xInt = lcl_GetView();
906 if (!xInt) return;
907 XDocumentViewRef xView = (XDocumentView*)xInt->queryInterface(XDocumentView::getSmartUik());
908 if (!xView) return;
910 XInterfaceRef xSelInt = xView->getSelection();
911 if (!xSelInt) return;
913 XCellSeriesRef xFill = (XCellSeries*)xSelInt->queryInterface(XCellSeries::getSmartUik());
914 if (!xFill) return;
916 // xFill->fillAuto( FILL_DIRECTION_TO_BOTTOM, 2 );
918 xFill->fillSeries( FILL_DIRECTION_TO_LEFT, FILL_MODE_GROWTH, FILL_DATE_DAY,
919 2.0, 1000.0 );
922 void lcl_Audi( FixedText& aTimeText )
924 aTimeText.SetText( "..." );
925 XSpreadsheetDocumentRef xDoc = lcl_GetDocument(); // Calc-Model
926 if (!xDoc) return;
927 XSpreadsheetsRef xSheets = xDoc->getSheets();
928 if (!xSheets) return;
929 XTableSheetRef xSheet = xSheets->getSheetByIndex(0);
930 if (!xSheet) return;
932 XSheetAuditingRef xAudi = (XSheetAuditing*)xSheet->queryInterface(XSheetAuditing::getSmartUik());
933 if (!xAudi) return;
935 CellAddress aPosition;
936 aPosition.Sheet = 0;
937 aPosition.Column = 0;
938 aPosition.Row = 0;
939 xAudi->showDependents(aPosition);
942 void lcl_Consoli( FixedText& aTimeText )
944 XSpreadsheetDocumentRef xDoc = lcl_GetDocument(); // Calc-Model
945 if (!xDoc) return;
946 XConsolidationRef xCons = (XConsolidation*)xDoc->queryInterface(XConsolidation::getSmartUik());
947 if (!xCons) return;
948 XConsolidationDescriptorRef xDesc = xCons->createConsolidationDescriptor(FALSE);
949 if (!xDesc) return;
950 xDesc->setFunction(SUMMARY_COUNTNUMS);
951 xCons->consolidate(xDesc);
954 void lcl_Sort( FixedText& aTimeText )
956 XInterfaceRef xInt = lcl_GetView();
957 if (!xInt) return;
958 XDocumentViewRef xView = (XDocumentView*)xInt->queryInterface(XDocumentView::getSmartUik());
959 if (!xView) return;
960 XInterfaceRef xSelInt = xView->getSelection();
961 if (!xSelInt) return;
962 XSortableRef xSort = (XSortable*)xSelInt->queryInterface(XSortable::getSmartUik());
963 if (!xSort) return;
964 XSortDescriptorRef xDesc = xSort->createSortDescriptor(FALSE);
965 if (!xDesc) return;
966 Sequence<SortField> aFields = xDesc->getSortFields();
967 if (aFields.getLen())
969 // 1.Feld umkehren
970 SortField* pAry = aFields.getArray();
971 if (!pAry) return;
972 pAry[0].Ascending = !pAry[0].Ascending;
974 else // neue Sequence, 1. Spalte aufsteigend
976 aFields = Sequence<SortField>(1);
977 SortField* pAry = aFields.getArray();
978 if (!pAry) return;
979 pAry[0].Field = 0;
980 pAry[0].Ascending = TRUE;
981 pAry[0].Type = SORT_FIELD_AUTOMATIC;
983 xDesc->setSortFields(aFields);
985 XTableSortDescriptorRef xTableSort = (XTableSortDescriptor*)
986 xDesc->queryInterface(XTableSortDescriptor::getSmartUik());
987 if (!xTableSort) return;
988 CellAddress aOutPos;
989 aOutPos.Sheet = 2;
990 aOutPos.Column = 0;
991 aOutPos.Row = 0;
992 xTableSort->setUseOutputPosition(TRUE);
993 xTableSort->setOutputPosition(aOutPos);
995 XPropertySetRef xPropSet = (XPropertySet*)
996 xDesc->queryInterface(XPropertySet::getSmartUik());
997 if (!xPropSet) return;
998 xPropSet->setPropertyValue(L"IncludeFormats", UsrAny((BOOL)FALSE));
1000 xSort->sort(xDesc);
1003 void lcl_Filter( FixedText& aTimeText )
1005 aTimeText.SetText("...");
1007 XInterfaceRef xInt = lcl_GetView();
1008 if (!xInt) return;
1009 XDocumentViewRef xView = (XDocumentView*)xInt->queryInterface(XDocumentView::getSmartUik());
1010 if (!xView) return;
1011 XInterfaceRef xSelInt = xView->getSelection();
1012 if (!xSelInt) return;
1013 XFilterableRef xFilter = (XFilterable*)xSelInt->queryInterface(XFilterable::getSmartUik());
1014 if (!xFilter) return;
1016 #if 0
1017 XTableFilterDescriptorRef xDesc = xFilter->createFilterDescriptor(FALSE);
1018 if (!xDesc) return;
1019 Sequence<TableFilterField> aFields = xDesc->getFilterFields();
1020 if (aFields.getLen())
1022 // 1.Feld zwischen 1. und 2. Spalte toggeln
1023 TableFilterField* pAry = aFields.getArray();
1024 if (!pAry) return;
1025 pAry[0].Field = pAry[0].Field ? 0 : 1;
1027 xDesc->setFilterFields(aFields);
1028 xFilter->filter(xDesc);
1029 #endif
1031 XSpreadsheetDocumentRef xDoc = lcl_GetDocument(); // Calc-Model
1032 if (!xDoc) return;
1033 CellRangeAddress aAddress;
1034 aAddress.Sheet = 3;
1035 aAddress.StartColumn = 0;
1036 aAddress.StartRow = 0;
1037 aAddress.EndColumn = 1;
1038 aAddress.EndRow = 2;
1039 XCellRangeRef xRange = xDoc->getCellRange(aAddress);
1040 if (!xRange) return;
1041 XAdvancedFilterSourceRef xSource = (XAdvancedFilterSource*)
1042 xRange->queryInterface(XAdvancedFilterSource::getSmartUik());
1043 if (!xSource) return;
1045 XTableFilterDescriptorRef xDesc = xSource->createAdvancedFilter(xFilter);
1046 if (!xDesc)
1048 aTimeText.SetText("kein Filter");
1049 return;
1051 aTimeText.SetText("Filter gefunden");
1052 xFilter->filter(xDesc);
1055 void lcl_AutoFilter( FixedText& aTimeText )
1057 XInterfaceRef xInt = lcl_GetView();
1058 if (!xInt) return;
1059 XDocumentViewRef xView = (XDocumentView*)xInt->queryInterface(XDocumentView::getSmartUik());
1060 if (!xView) return;
1061 XInterfaceRef xSelInt = xView->getSelection();
1062 if (!xSelInt) return;
1063 XFilterableRef xFilter = (XFilterable*)xSelInt->queryInterface(XFilterable::getSmartUik());
1064 if (!xFilter) return;
1066 BOOL bAuto = xFilter->getAutoFilter();
1067 xFilter->setAutoFilter(!bAuto);
1070 void lcl_Merge( FixedText& aTimeText )
1072 static BOOL bMerged = FALSE;
1074 XInterfaceRef xInt = lcl_GetView();
1075 if (!xInt) return;
1076 XDocumentViewRef xView = (XDocumentView*)xInt->queryInterface(XDocumentView::getSmartUik());
1077 if (!xView) return;
1078 XInterfaceRef xSelInt = xView->getSelection();
1079 if (!xSelInt) return;
1080 XMergeableRef xMerge = (XMergeable*)xSelInt->queryInterface(XMergeable::getSmartUik());
1081 if (!xMerge) return;
1083 if (bMerged)
1084 xMerge->unmergeCells();
1085 else
1086 xMerge->mergeCells();
1087 bMerged = !bMerged;
1090 void lcl_Outline( FixedText& aTimeText )
1092 static BOOL bOutline = FALSE;
1094 XSpreadsheetDocumentRef xDoc = lcl_GetDocument(); // Calc-Model
1095 if (!xDoc) return;
1096 XSpreadsheetsRef xSheets = xDoc->getSheets();
1097 if (!xSheets) return;
1098 XTableSheetRef xSheet = xSheets->getSheetByIndex(0);
1099 if (!xSheet) return;
1100 XSheetOutlineRef xOut = (XSheetOutline*)xSheet->queryInterface(XSheetOutline::getSmartUik());
1101 if (!xOut) return;
1103 XInterfaceRef xInt = lcl_GetView();
1104 if (!xInt) return;
1105 XDocumentViewRef xView = (XDocumentView*)xInt->queryInterface(XDocumentView::getSmartUik());
1106 if (!xView) return;
1107 XInterfaceRef xSelInt = xView->getSelection();
1108 if (!xSelInt) return;
1109 XAddressableCellRangeRef xRange = (XAddressableCellRange*)
1110 xSelInt->queryInterface(XAddressableCellRange::getSmartUik());
1111 if (!xRange) return;
1112 CellRangeAddress aRange = xRange->getRangeAddress();
1114 if (bOutline)
1115 xOut->showDetail( aRange );
1116 else
1117 xOut->hideDetail( aRange );
1119 bOutline = !bOutline;
1122 void lcl_Bla( FixedText& aTimeText )
1124 aTimeText.SetText("...");
1126 XSpreadsheetDocumentRef xDoc = lcl_GetDocument(); // Calc-Model
1127 if (!xDoc) return;
1128 XActionLockableRef xLock = (XActionLockable*)xDoc->queryInterface(XActionLockable::getSmartUik());
1129 if (!xLock) return;
1130 xLock->addActionLock();
1131 xLock->addActionLock();
1132 USHORT nCount = xLock->resetActionLocks(); // sollte 2 sein
1133 String aBla = nCount;
1134 xLock->setActionLocks(nCount);
1135 xLock->removeActionLock();
1136 xLock->removeActionLock();
1138 aBla += '/'; aBla += xLock->resetActionLocks(); // sollte 0 sein
1140 aTimeText.SetText(aBla);
1143 void lcl_CellCursor( FixedText& aTimeText )
1145 static int nCursorCount = 0;
1147 XInterfaceRef xInt = lcl_GetView();
1148 if (!xInt) return;
1149 XDocumentViewRef xView = (XDocumentView*)xInt->queryInterface(XDocumentView::getSmartUik());
1150 if (!xView) return;
1151 XInterfaceRef xSelInt = xView->getSelection();
1152 if (!xSelInt) return;
1153 XCellCollectionRef xColl = (XCellCollection*)xSelInt->queryInterface(XCellCollection::getSmartUik());
1154 if (!xColl) return;
1156 XLineCursorRef xCursor = xColl->createCursor();
1157 if (!xCursor) return;
1158 XCellCursorRef xCC = (XCellCursor*)xCursor->queryInterface(XCellCursor::getSmartUik());
1159 if (!xCC) return;
1160 XCellRangesCursorRef xCRC = (XCellRangesCursor*)xCursor->queryInterface(XCellRangesCursor::getSmartUik());
1161 if (!xCRC) return;
1162 XCellRangeCursorRef xCR = (XCellRangeCursor*)xCursor->queryInterface(XCellRangeCursor::getSmartUik());
1163 if (!xCR) return;
1164 XCellContentCursorRef xCCC = (XCellContentCursor*)xCursor->queryInterface(XCellContentCursor::getSmartUik());
1165 if (!xCCC) return;
1166 XFormulaCursorRef xFC = (XFormulaCursor*)xCursor->queryInterface(XFormulaCursor::getSmartUik());
1167 if (!xFC) return;
1169 CellAddress aPos;
1170 aPos.Sheet = 0; // ignored
1171 aPos.Row = 3;
1172 aPos.Column = 2;
1174 switch (nCursorCount++)
1176 case 0:
1177 xFC->gotoDependents(FALSE);
1178 break;
1179 case 1:
1180 xFC->gotoDependents(TRUE);
1181 break;
1182 case 2:
1183 xFC->gotoPrecedents(FALSE);
1184 break;
1185 case 3:
1186 xFC->gotoPrecedents(TRUE);
1188 nCursorCount = 0;
1189 break;
1192 XCellCollectionRef xNew = xCC->getRanges();
1193 if (!xNew) return;
1194 xView->select( xNew );
1197 void lcl_Notes( FixedText& aTimeText )
1199 aTimeText.SetText( "..." );
1200 XSpreadsheetDocumentRef xDoc = lcl_GetDocument(); // Calc-Model
1201 if (!xDoc) return;
1202 XSpreadsheetsRef xSheets = xDoc->getSheets();
1203 if (!xSheets) return;
1204 XTableSheetRef xSheet = xSheets->getSheetByIndex(0);
1205 if (!xSheet) return;
1207 XSheetAnnotationsRef xNotes = xSheet->getAnnotations();
1208 if (!xNotes) return;
1209 XIndexAccessRef xNIndex = (XIndexAccess*)xNotes->queryInterface(XIndexAccess::getSmartUik());
1210 if (!xNIndex) return;
1212 CellAddress aPos;
1213 aPos.Column = 0;
1214 aPos.Row = 0;
1215 aPos.Sheet = 0;
1216 xNotes->addAnnotation( L"neu", aPos );
1218 ULONG nCount = xNIndex->getCount();
1219 for (ULONG i=0; i<nCount; i++)
1221 XSheetAnnotationRef xAnn = xNotes->getAnnotationByIndex((UINT16)i);
1222 XTextRef xText = (XText*)xAnn->queryInterface(XText::getSmartUik());
1223 if (xText)
1225 String aStr = OUStringToString( xText->getText(), CHARSET_SYSTEM );
1226 aStr += "x";
1227 xText->setText(StringToOUString( aStr, CHARSET_SYSTEM ));
1232 void lcl_Scenario( FixedText& aTimeText )
1234 aTimeText.SetText( "..." );
1235 XSpreadsheetDocumentRef xDoc = lcl_GetDocument(); // Calc-Model
1236 if (!xDoc) return;
1237 XSpreadsheetsRef xSheets = xDoc->getSheets();
1238 if (!xSheets) return;
1239 XTableSheetRef xSheet = xSheets->getSheetByIndex(0);
1240 if (!xSheet) return;
1242 XScenariosRef xColl = xSheet->getScenarios();
1243 if (!xColl) return;
1245 Sequence<CellRangeAddress> aRanges(2);
1246 CellRangeAddress* pAry = aRanges.getArray();
1247 if (!pAry) return;
1248 pAry[0].Sheet = 0;
1249 pAry[0].StartColumn = 0;
1250 pAry[0].StartRow = 0;
1251 pAry[0].EndColumn = 1;
1252 pAry[0].EndRow = 1;
1253 pAry[1].Sheet = 0;
1254 pAry[1].StartColumn = 3;
1255 pAry[1].StartRow = 3;
1256 pAry[1].EndColumn = 4;
1257 pAry[1].EndRow = 4;
1259 xColl->addScenario( aRanges, L"bla", L"bla blubb" );
1261 XIndexAccessRef xIndex = (XIndexAccess*)xColl->queryInterface(XIndexAccess::getSmartUik());
1262 if (!xIndex) return;
1263 ULONG nCount = xIndex->getCount();
1264 aTimeText.SetText( nCount );
1266 XScenarioRef xScen = xColl->getScenarioByIndex(0);
1267 if (!xScen) return;
1269 aRanges = Sequence<CellRangeAddress>(1);
1270 pAry = aRanges.getArray();
1271 if (!pAry) return;
1272 pAry[0].Sheet = 0;
1273 pAry[0].StartColumn = 6;
1274 pAry[0].StartRow = 6;
1275 pAry[0].EndColumn = 7;
1276 pAry[0].EndRow = 7;
1278 xScen->addRanges( aRanges );
1280 XTableSheetRef xSh2 = xSheets->getSheetByIndex(1);
1281 if (!xSh2) return;
1283 xSh2->setVisible( TRUE );
1284 xSh2->setVisible( FALSE );
1287 void lcl_Formula( FixedText& aTimeText )
1289 aTimeText.SetText("...");
1291 XSpreadsheetDocumentRef xDoc = lcl_GetDocument(); // Calc-Model
1292 if (!xDoc) return;
1293 CellAddress aPos;
1294 aPos.Sheet = 0;
1295 aPos.Column = 0;
1296 aPos.Row = 0;
1297 XCellRef xCell = xDoc->getCell(aPos);
1298 if (!xCell) return;
1300 // String aStr = OUStringToString( xCell->getFormula(), CHARSET_SYSTEM );
1301 // aTimeText.SetText(aStr);
1303 XTextRef xText = (XText*)xCell->queryInterface(XText::getSmartUik());
1304 if (!xText) return;
1305 String aStr = OUStringToString( xText->getText(), CHARSET_SYSTEM );
1306 aTimeText.SetText(aStr);
1309 void lcl_DBRange( FixedText& aTimeText ) // 23
1311 aTimeText.SetText("...");
1313 XSpreadsheetDocumentRef xDoc = lcl_GetDocument(); // Calc-Model
1314 if (!xDoc) return;
1315 XDatabaseRangesRef xDBs = xDoc->getDatabaseRanges();
1316 if (!xDBs) return;
1318 CellRangeAddress aRange;
1319 aRange.Sheet = 0;
1320 aRange.StartColumn = 1;
1321 aRange.StartRow = 1;
1322 aRange.EndColumn = 3;
1323 aRange.EndRow = 10;
1325 xDBs->addRange( L"blubb", aRange );
1327 xDBs->removeRangeByName( L"gaga" );
1329 XDatabaseRangeRef xDB = xDBs->getRangeByName( L"blubb" );
1330 if (!xDB) return;
1332 String aName = OUStringToString( xDB->getName(), CHARSET_SYSTEM );
1333 aTimeText.SetText(aName);
1335 xDB->setName( L"gaga" );
1337 CellRangeAddress aDBRange = xDB->getDataArea();
1338 ++aDBRange.Sheet;
1339 xDB->setDataArea(aDBRange);
1342 void lcl_FillTab( FixedText& aTimeText ) // 24
1344 aTimeText.SetText("...");
1346 XInterfaceRef xInt = lcl_GetView();
1347 if (!xInt) return;
1348 XDocumentViewRef xView = (XDocumentView*)xInt->queryInterface(XDocumentView::getSmartUik());
1349 if (!xView) return;
1350 XInterfaceRef xSelInt = xView->getSelection();
1351 if (!xSelInt) return;
1353 XCellRangesRef xRanges = (XCellRanges*)xSelInt->queryInterface(XCellRanges::getSmartUik());
1354 XIndexAccessRef xIndex = (XIndexAccess*)xSelInt->queryInterface(XIndexAccess::getSmartUik());
1355 if (!xRanges || !xIndex) return;
1357 ULONG nCount = xIndex->getCount();
1358 aTimeText.SetText(nCount);
1361 void lcl_Listener( FixedText& aTimeText ) // 25
1363 XInterfaceRef xInt = lcl_GetView();
1364 if (!xInt) return;
1365 XStarCalcViewRef xView = (XStarCalcView*)xInt->queryInterface(XStarCalcView::getSmartUik());
1366 if (!xView) return;
1367 xView->addSelectionChangeListener( new ScTestListener(&aTimeText) );
1370 void lcl_CellAttrib( FixedText& aTimeText ) // 26
1372 XInterfaceRef xInt = lcl_GetView();
1373 if (!xInt) return;
1374 XDocumentViewRef xView = (XDocumentView*)xInt->queryInterface(XDocumentView::getSmartUik());
1375 if (!xView) return;
1376 XInterfaceRef xSelInt = xView->getSelection();
1377 if (!xSelInt) return;
1378 XTextRef xText = (XText*)xSelInt->queryInterface(XText::getSmartUik());
1379 if (!xText) return;
1381 XTextCursorRef xCursor = xText->createTextCursor();
1382 if (!xCursor) return;
1384 XTextPositionRef xPos = (XTextPosition*)xCursor->queryInterface(XTextPosition::getSmartUik());
1385 XPropertySetRef xProp = (XPropertySet*)xCursor->queryInterface(XPropertySet::getSmartUik());
1386 XParagraphCursorRef xPar = (XParagraphCursor*)xCursor->queryInterface(XParagraphCursor::getSmartUik());
1387 if (!xPos || !xProp || !xPar) return;
1389 xCursor->gotoStart(FALSE);
1390 xCursor->goRight(1,FALSE);
1391 xCursor->goRight(1,TRUE);
1393 UsrAny aAny = xProp->getPropertyValue(L"FontHeight");
1394 UINT32 nOld = aAny.getUINT32();
1395 aAny.setUINT32(nOld*11/10);
1396 xProp->setPropertyValue(L"FontHeight", aAny);
1398 xPos->collapseToEnd();
1399 xCursor->goRight(1,TRUE);
1401 xProp->setPropertyValue(L"Bold", UsrAny((BOOL)TRUE));
1403 xPos->setText(L"x");
1405 xPos->collapseToEnd();
1406 xPar->gotoNextParagraph(FALSE,TRUE);
1407 xProp->setPropertyValue(L"Italic", UsrAny((BOOL)TRUE));
1408 xProp->setPropertyValue(L"Underlined", UsrAny((BOOL)TRUE));
1411 void lcl_Styles( FixedText& aTimeText ) // 27
1413 aTimeText.SetText("...");
1414 XSpreadsheetDocumentRef xDoc = lcl_GetDocument(); // Calc-Model
1415 if (!xDoc) return;
1416 XStyleFamiliesRef xFamilies = xDoc->getStyleFamilies();
1417 if (!xFamilies) return;
1418 XStyleFamilyRef xFamily = xFamilies->getStyleFamilyByType( STYLE_FAMILY_CELL );
1419 // XStyleFamilyRef xFamily = xFamilies->getStyleFamilyByType( STYLE_FAMILY_PAGE );
1420 if (!xFamily) return;
1421 long nCount = xFamily->getCount();
1422 aTimeText.SetText(nCount);
1424 XStyleRef xStyle = xFamily->getStyleByName(L"rot");
1425 if (!xStyle) return;
1426 // XPropertySetRef xProp = (XPropertySet*)xStyle->queryInterface(XPropertySet::getSmartUik());
1427 // if (!xProp) return;
1429 XStyleRef xNew = xFamily->addStyle( L"gaga", xStyle );
1430 if (!xNew) return;
1431 XPropertySetRef xProp = (XPropertySet*)xNew->queryInterface(XPropertySet::getSmartUik());
1432 if (!xProp) return;
1434 UsrAny aAny;
1435 aAny = xProp->getPropertyValue(L"TransparentBackground");
1436 aAny.setBOOL(FALSE);
1437 xProp->setPropertyValue(L"TransparentBackground", aAny);
1438 aAny = xProp->getPropertyValue(L"BackgroundColor");
1439 aAny.setUINT32(0xffff00);
1440 xProp->setPropertyValue(L"BackgroundColor", aAny);
1442 xFamily->removeStyle( L"rot" );
1445 void lcl_PageStyle( FixedText& aTimeText ) // 28
1447 aTimeText.SetText("...");
1449 XSpreadsheetDocumentRef xDoc = lcl_GetDocument(); // Calc-Model
1450 if (!xDoc) return;
1451 XStyleFamiliesRef xFamilies = xDoc->getStyleFamilies();
1452 if (!xFamilies) return;
1453 XStyleFamilyRef xFamily = xFamilies->getStyleFamilyByType( STYLE_FAMILY_PAGE );
1454 if (!xFamily) return;
1455 XStyleRef xStyle = xFamily->getStyleByName(L"Standard");
1456 if (!xStyle) return;
1457 XPropertySetRef xProp = (XPropertySet*)xStyle->queryInterface(XPropertySet::getSmartUik());
1458 if (!xProp) return;
1460 UsrAny aAny;
1461 aAny = xProp->getPropertyValue(L"RightPageHeaderContent");
1463 // geht nicht:
1464 // if ( !XHeaderFooterContent_getReflection()->equals(*aAny.getReflection()) )
1465 // return;
1467 XHeaderFooterContentRef* pxContent = (XHeaderFooterContentRef*)aAny.get();
1468 if (!pxContent || !pxContent->is()) return;
1470 XTextRef xText = (*pxContent)->getCenterText();
1471 if (!xText) return;
1473 String aVal = OUStringToString(xText->getText(), CHARSET_SYSTEM);
1474 aTimeText.SetText(aVal);
1476 // xText->setText(L"Bla fasel s\xFClz");
1477 lcl_SetText(xText);
1479 xProp->setPropertyValue(L"RightPageHeaderContent", aAny);
1482 void lcl_AutoForm( FixedText& aTimeText ) // 29
1484 XInterfaceRef xInt = lcl_GetView();
1485 if (!xInt) return;
1487 #if 0
1488 //! Test - AutoFormat muss von der App kommen
1489 XStarCalcViewRef xView = (XStarCalcView*)xInt->queryInterface(XStarCalcView::getSmartUik());
1490 if (!xView) return;
1491 XTableAutoFormatsRef xFormats = xView->getTableAutoFormats();
1492 if (!xFormats) return;
1493 //! Test
1494 #endif
1495 XTableAutoFormatsRef xFormats;
1497 XTableAutoFormatRef xFormat = xFormats->getAutoFormatByName(L"gaga");
1498 if (!xFormat) return;
1499 XPropertySetRef xProp = (XPropertySet*)xFormat->queryInterface(XPropertySet::getSmartUik());
1500 if (!xProp) return;
1502 BOOL bVal = TypeConversion::toBOOL(xProp->getPropertyValue(L"IncludeBackground"));
1503 xProp->setPropertyValue(L"IncludeBackground", UsrAny(BOOL(!bVal)));
1505 XNamedRef xNamed = (XNamed*)xFormat->queryInterface(XNamed::getSmartUik());
1506 if (!xNamed) return;
1507 xNamed->setName(L"zzz");
1509 xFormats->addAutoFormat(L"gaga");
1510 XTableAutoFormatRef xNew = xFormats->getAutoFormatByName(L"gaga");
1511 if (!xNew) return;
1513 for (USHORT i=0; i<16; i++)
1515 XPropertySetRef xNewProp = xNew->getFieldByIndex(i);
1516 if (!xNewProp) return;
1518 xNewProp->setPropertyValue(L"TransparentBackground", UsrAny(BOOL(FALSE)));
1519 UINT32 nColor = 0x111100 * i;
1520 xNewProp->setPropertyValue(L"BackgroundColor", UsrAny(nColor));
1524 void lcl_Pivot( FixedText& aTimeText ) // 30
1526 XSpreadsheetDocumentRef xDoc = lcl_GetDocument(); // Calc-Model
1527 if (!xDoc) return;
1529 XSpreadsheetsRef xSheets = xDoc->getSheets();
1530 if (!xSheets) return;
1531 XIndexAccessRef xInd = (XIndexAccess*)xSheets->queryInterface(XIndexAccess::getSmartUik());
1532 if (!xInd) return;
1533 USHORT nCount = (USHORT)xInd->getCount();
1535 for (USHORT nTab=0; nTab<nCount; nTab++)
1537 XTableSheetRef xSheet = xSheets->getSheetByIndex(nTab);
1538 if (!xSheet) return;
1539 XDataPilotTablesRef xPivots = xSheet->getDataPilotTables();
1540 if (!xPivots) return;
1541 lcl_OutputNames( xPivots, xDoc, nTab,0,0 );
1542 XIndexAccessRef xPInd = (XIndexAccess*)xPivots->queryInterface(XIndexAccess::getSmartUik());
1543 if (!xPInd) return;
1544 USHORT nPCount = (USHORT)xPInd->getCount();
1545 for (USHORT nP=0; nP<nPCount; nP++)
1547 XDataPilotTableRef xTable = xPivots->getTableByIndex(nP);
1548 if (!xTable) return;
1550 // xTable->refreshTable();
1552 XDataPilotDescriptorRef xDesc = (XDataPilotDescriptor*)
1553 xTable->queryInterface(XDataPilotDescriptor::getSmartUik());
1554 if (!xDesc) return;
1555 CellRangeAddress aSource = xDesc->getSourceRange();
1556 ++aSource.Sheet;
1557 xDesc->setSourceRange(aSource);
1559 CellRangeAddress aAddr = xTable->getOutputRange();
1560 XCellRangeRef xRange = xDoc->getCellRange(aAddr);
1561 if (!xRange) return;
1562 XPropertySetRef xProp = (XPropertySet*)xRange->queryInterface(XPropertySet::getSmartUik());
1563 if (!xProp) return;
1564 xProp->setPropertyValue(L"TransparentBackground", UsrAny(BOOL(FALSE)));
1565 xProp->setPropertyValue(L"BackgroundColor", UsrAny((UINT32)0x00FF00));
1570 IMPL_LINK(MyWindow, CountHdl, PushButton*, EMPTYARG)
1572 #if 0
1574 long nCount = aCountField.GetValue();
1575 if (nCount < 1)
1576 nCount = 1;
1578 ULONG nStart = Time::GetSystemTicks();
1579 for (long i=0; i<nCount; i++)
1580 lcl_DoCount();
1581 ULONG nEnd = Time::GetSystemTicks();
1582 aTimeText.SetText(String(nCount)+String(" x Count: ")+String(nEnd-nStart)+String(" ms"));
1584 #else
1586 long nCount = aCountField.GetValue();
1587 switch ( nCount )
1589 case 0:
1591 ULONG nStart = Time::GetSystemTicks();
1592 lcl_DoCount();
1593 ULONG nEnd = Time::GetSystemTicks();
1594 aTimeText.SetText(String("Count: ")+String(nEnd-nStart)+String(" ms"));
1596 break;
1597 case 1:
1598 lcl_GlobalCell();
1599 break;
1600 case 2:
1601 lcl_Annotations(aTimeText);
1602 break;
1603 case 3:
1604 lcl_Cursor(aTimeText);
1605 break;
1606 case 4:
1607 lcl_Cells(aTimeText);
1608 break;
1609 case 5:
1610 lcl_Sheet(aTimeText);
1611 break;
1612 case 6:
1613 lcl_Names(aTimeText);
1614 break;
1615 case 7:
1616 lcl_Sheets(aTimeText);
1617 break;
1618 case 8:
1619 lcl_Goal(aTimeText);
1620 break;
1621 case 9:
1622 lcl_TabOp(aTimeText);
1623 break;
1624 case 10:
1625 lcl_Fill(aTimeText);
1626 break;
1627 case 11:
1628 lcl_Audi(aTimeText);
1629 break;
1630 case 12:
1631 lcl_Consoli(aTimeText);
1632 break;
1633 case 13:
1634 lcl_Sort(aTimeText);
1635 break;
1636 case 14:
1637 lcl_Filter(aTimeText);
1638 break;
1639 case 15:
1640 lcl_AutoFilter(aTimeText);
1641 break;
1642 case 16:
1643 lcl_Merge(aTimeText);
1644 break;
1645 case 17:
1646 lcl_Outline(aTimeText);
1647 break;
1648 case 18:
1649 lcl_Bla(aTimeText);
1650 break;
1651 case 19:
1652 lcl_CellCursor(aTimeText);
1653 break;
1654 case 20:
1655 lcl_Notes(aTimeText);
1656 break;
1657 case 21:
1658 lcl_Scenario(aTimeText);
1659 break;
1660 case 22:
1661 lcl_Formula(aTimeText);
1662 break;
1663 case 23:
1664 lcl_DBRange(aTimeText);
1665 break;
1666 case 24:
1667 lcl_FillTab(aTimeText);
1668 break;
1669 case 25:
1670 lcl_Listener(aTimeText);
1671 break;
1672 case 26:
1673 lcl_CellAttrib(aTimeText);
1674 break;
1675 case 27:
1676 lcl_Styles(aTimeText);
1677 break;
1678 case 28:
1679 lcl_PageStyle(aTimeText);
1680 break;
1681 case 29:
1682 lcl_AutoForm(aTimeText);
1683 break;
1684 case 30:
1685 lcl_Pivot(aTimeText);
1686 break;
1689 #endif
1691 return 0;
1694 //-----------------------------------------------------------------------
1696 IMPL_LINK(MyWindow, TextHdl, PushButton*, EMPTYARG)
1698 USHORT nTab = 0;
1699 USHORT nCol = (USHORT)aColField.GetValue();
1700 USHORT nRow = (USHORT)aRowField.GetValue();
1701 USHORT nPos = (USHORT)aPosField.GetValue();
1702 USHORT nLen = (USHORT)aLenField.GetValue();
1703 String aStr = aTextEdit.GetText();
1705 aTimeText.SetText("...");
1707 XSpreadsheetDocumentRef xDoc = lcl_GetDocument(); // Calc-Model
1708 if (xDoc)
1710 CellAddress aPos;
1711 aPos.Sheet = nTab;
1712 aPos.Column = nCol;
1713 aPos.Row = nRow;
1714 XCellRef xCell = xDoc->getCell(aPos);
1715 if ( xCell )
1717 XTextRef xCellText = (XText*)xCell->queryInterface(XText::getSmartUik());
1718 if (xCellText)
1720 XTextCursorRef xCursor = xCellText->createTextCursor();
1721 if (xCursor)
1723 XTextPositionRef xPos = (XTextPosition*)
1724 xCursor->queryInterface(XTextPosition::getSmartUik());
1725 XControlCharacterInsertableRef xControl = (XControlCharacterInsertable*)
1726 xCursor->queryInterface(XControlCharacterInsertable::getSmartUik());
1728 if (xPos && xControl)
1730 xCursor->gotoStart(FALSE);
1731 xCursor->goRight(11,TRUE);
1732 String aVal = OUStringToString( xPos->getText(), CHARSET_SYSTEM );
1733 aTimeText.SetText(aVal);
1740 return 0;
1743 //-----------------------------------------------------------------------
1745 IMPL_LINK(MyWindow, BlaHdl, PushButton*, EMPTYARG)
1747 aTimeText.SetText("...");
1749 XSpreadsheetDocumentRef xDoc = lcl_GetDocument(); // Calc-Model
1750 if (xDoc)
1752 CellAddress aPos;
1753 aPos.Sheet = 0;
1754 aPos.Column = 1;
1755 aPos.Row = 2;
1756 XCellRef xCell = xDoc->getCell(aPos);
1757 if ( xCell )
1759 XTextRef xText = (XText*)xCell->queryInterface(XText::getSmartUik());
1760 XFieldContainerRef xCont = (XFieldContainer*)
1761 xCell->queryInterface(XFieldContainer::getSmartUik());
1763 if ( xText && xCont )
1765 XFieldTypesRef xTypes = xCont->getFieldTypes();
1766 if ( xTypes )
1768 XTextFieldTypeRef xType = xTypes->getFieldType( FIELDTYPE_INTERNET );
1769 XTextCursorRef xCursor = xText->createTextCursor();
1770 if ( xCursor && xType )
1772 #if 0
1773 // Feld einfuegen
1774 XTextPositionRef xPos = (XTextPosition*)
1775 xCursor->queryInterface(XTextPosition::getSmartUik());
1776 if ( xPos )
1778 xCursor->gotoEnd(FALSE);
1779 XTextFieldRef xField = xTypes->insertTextField( xType, xPos );
1780 if (xField)
1782 // Eigenschaften setzen
1783 XPropertySetRef xProp = (XPropertySet*)xField->
1784 queryInterface(XPropertySet::getSmartUik());
1785 if ( xProp )
1787 xProp->setPropertyValue(L"URL",
1788 UsrAny(String("http://www.mopo.de/")));
1789 xProp->setPropertyValue(L"Representation",
1790 UsrAny(String("ein Hyperlink")));
1794 #endif
1796 // letztes Feld loeschen
1797 XIndexAccessRef xIndex = (XIndexAccess*)
1798 xType->queryInterface(XIndexAccess::getSmartUik());
1799 if (xIndex)
1801 String aBla;
1802 ULONG nCount = xIndex->getCount();
1803 for (ULONG i=0; i<nCount; i++)
1805 XInterfaceRef xInt = xIndex->getElementByIndex(i);
1806 if (xInt)
1808 XPropertySetRef xProp = (XPropertySet*)xInt->
1809 queryInterface(XPropertySet::getSmartUik());
1810 if ( xProp )
1812 if (aBla.Len()) aBla += ',';
1813 aBla += OUStringToString(
1814 TypeConversion::toString(
1815 xProp->getPropertyValue(L"URL") ),
1816 CHARSET_SYSTEM );
1818 if ( i+1 == nCount ) // letztes
1820 XTextFieldRef xField = (XTextField*)xInt->
1821 queryInterface(XTextField::getSmartUik());
1822 if (xField)
1823 xTypes->removeTextField(xField);
1827 aTimeText.SetText(aBla);
1834 xGlobalCell = xCell;
1836 return 0;
1840 //-----------------------------------------------------------------------
1842 IMPL_LINK(MyWindow, TabHdl, PushButton*, EMPTYARG)
1844 String aResult;
1846 XSpreadsheetDocumentRef xDoc = lcl_GetDocument(); // Calc-Model
1847 if (xDoc)
1849 XSpreadsheetsRef xSheets = xDoc->getSheets();
1850 if (xSheets)
1852 XIndexAccessRef xIndex = (XIndexAccess*)xSheets->queryInterface(XIndexAccess::getSmartUik());
1853 if (xIndex)
1855 USHORT nCount = (USHORT) xIndex->getCount();
1856 for (USHORT nTab=0; nTab<nCount; nTab++)
1858 XInterfaceRef xInt = xIndex->getElementByIndex(nTab);
1859 if (xInt)
1861 XNamedRef xNamed = (XNamed*)xInt->queryInterface(XNamed::getSmartUik());
1862 if (xNamed)
1864 if (nTab)
1865 aResult += ",";
1866 aResult += OUStringToString( xNamed->getName(), CHARSET_SYSTEM );
1872 CellAddress aPos;
1873 aPos.Sheet = 0;
1874 aPos.Column = 0;
1875 aPos.Row = 0;
1877 XEnumerationAccessRef xEAcc = (XEnumerationAccess*)
1878 xSheets->queryInterface(XEnumerationAccess::getSmartUik());
1879 if (xEAcc)
1881 XEnumerationRef xEnum = xEAcc->getEnumeration();
1882 if (xEnum)
1884 while (xEnum->hasMoreElements())
1886 XInterfaceRef xInt = xEnum->nextElement();
1887 if (xInt)
1889 XNamedRef xNamed = (XNamed*)xInt->queryInterface(XNamed::getSmartUik());
1890 if (xNamed)
1892 UString aName = xNamed->getName();
1893 XCellRef xCell = xDoc->getCell(aPos);
1894 if ( xCell )
1896 XTextRef xText = (XText*)xCell->queryInterface(XText::getSmartUik());
1897 xText->setText( aName );
1898 ++aPos.Row;
1908 aTimeText.SetText(aResult);
1910 return 0;
1913 //-----------------------------------------------------------------------
1915 void lcl_FillCells(XCellCollectionRef xColl)
1917 XEnumerationAccessRef xEnAcc = xColl->getCells();
1918 if (!xEnAcc) return;
1919 XEnumerationRef xEnum = xEnAcc->getEnumeration();
1920 if (!xEnum) return;
1921 while (xEnum->hasMoreElements())
1923 XInterfaceRef xInt = xEnum->nextElement();
1924 if (xInt)
1926 XCellRef xCell = (XCell*)xInt->queryInterface(XCell::getSmartUik());
1927 if (xCell)
1929 xCell->setValue(42.0);
1935 IMPL_LINK(MyWindow, ViewHdl, PushButton*, EMPTYARG)
1937 XSpreadsheetDocumentRef xDoc = lcl_GetDocument(); // Calc-Model
1938 XInterfaceRef xInt = lcl_GetView();
1939 if (!xInt) return 0;
1940 XDocumentViewRef xView = (XDocumentView*)xInt->queryInterface(XDocumentView::getSmartUik());
1941 if (!xView) return 0;
1943 XInterfaceRef xSelInt = xView->getSelection();
1944 if (!xSelInt) return 0;
1946 #if 0
1947 XPropertySetRef xProp = (XPropertySet*)xSelInt->queryInterface(XPropertySet::getSmartUik());
1948 if ( xProp )
1950 UsrAny aAny;
1952 aAny = xProp->getPropertyValue(L"TransparentBackground");
1953 aAny.setBOOL(FALSE);
1954 xProp->setPropertyValue(L"TransparentBackground", aAny);
1956 aAny = xProp->getPropertyValue(L"BackgroundColor");
1957 aAny.setUINT32(0xffff00);
1958 xProp->setPropertyValue(L"BackgroundColor", aAny);
1960 XIndentRef xInd = (XIndent*)xSelInt->queryInterface(XIndent::getSmartUik());
1961 if ( xInd )
1963 xInd->incrementIndent();
1965 #endif
1967 XAutoFormattableRef xAuto = (XAutoFormattable*)xSelInt->
1968 queryInterface(XAutoFormattable::getSmartUik());
1969 if ( xAuto )
1970 xAuto->applyAutoFormat( L"gaga" );
1972 XFormulaArrayRef xArr = (XFormulaArray*)xSelInt->queryInterface(XFormulaArray::getSmartUik());
1973 if ( xArr )
1975 // xArr->setFormulaArray( "123" );
1976 String aFormula = OUStringToString( xArr->getFormulaArray(), CHARSET_SYSTEM );
1977 aTimeText.SetText(aFormula);
1979 else
1980 aTimeText.SetText("...");
1982 XTextRef xText = (XText*)xSelInt->queryInterface(XText::getSmartUik());
1983 if ( xText )
1985 String aStr = OUStringToString( xText->getText(), CHARSET_SYSTEM );
1986 aStr += 'X';
1987 xText->setText(StringToOUString(aStr, CHARSET_SYSTEM));
1990 // Zelle selektieren
1992 #if 0
1993 if (xDoc)
1995 CellAddress aPos;
1996 aPos.Sheet = 0;
1997 aPos.Column = 1;
1998 aPos.Row = 2;
1999 XCellRef xCell = xDoc->getCell(aPos);
2000 if ( xCell )
2001 xView->select( xCell );
2003 #endif
2005 XPrintableRef xPrint = (XPrintable*)xInt->queryInterface(XPrintable::getSmartUik());
2006 String aName = OUStringToString( xPrint->getPrinterName(), CHARSET_SYSTEM );
2007 // aTimeText.SetText(aName);
2009 xPrint->setPrinterName(L"HP5_2");
2010 // xPrint->setPrinterName(L"blubb");
2012 // XPropertySetRef xOptions;
2013 // xPrint->print(xOptions);
2015 /* XViewPaneRef xPane = (XViewPane*)xInt->queryInterface(XViewPane::getSmartUik());
2016 if (!xPane) return 0;
2017 xPane->setScrollRow( 2 );
2020 XCellRangeSourceRef xSrc = (XCellRangeSource*)
2021 xInt->queryInterface(XCellRangeSource::getSmartUik());
2022 if (!xSrc) return 0;
2023 XCellRangeRef xRange = xSrc->getReferredCells();
2024 if (!xRange) return 0;
2025 XCellCollectionRef xColl = (XCellCollection*)
2026 xRange->queryInterface(XCellCollection::getSmartUik());
2027 if (!xColl) return 0;
2029 XActionLockableRef xLock = (XActionLockable*)
2030 xDoc->queryInterface(XActionLockable::getSmartUik());
2031 if (xLock)
2032 xLock->addActionLock(); // nicht zwischendurch painten
2034 // lcl_FillCells(xColl);
2036 if (xLock)
2037 xLock->removeActionLock(); // nicht zwischendurch painten
2039 XStarCalcViewRef xCalc = (XStarCalcView*)xInt->queryInterface(XStarCalcView::getSmartUik());
2040 if (!xCalc) return 0;
2042 return 0;