summaryrefslogtreecommitdiff
path: root/starmath/source/view.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'starmath/source/view.cxx')
-rwxr-xr-xstarmath/source/view.cxx189
1 files changed, 118 insertions, 71 deletions
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index 748e62e3536e..7dc10ad5ecea 100755
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -34,6 +34,9 @@
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
#include <com/sun/star/accessibility/XAccessible.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/frame/XDesktop.hpp>
+#include <com/sun/star/frame/XFramesSupplier.hpp>
+#include <com/sun/star/container/XChild.hpp>
#include <comphelper/processfactory.hxx>
#include <comphelper/storagehelper.hxx>
@@ -98,7 +101,7 @@ SmGraphicWindow::SmGraphicWindow(SmViewShell* pShell):
pAccessible(0),
pViewShell(pShell),
nZoom(100),
- bIsCursorVisible(FALSE)
+ bIsCursorVisible(sal_False)
{
// docking windows are usually hidden (often already done in the
// resource) and will be shown by the sfx framework.
@@ -184,7 +187,7 @@ void SmGraphicWindow::MouseButtonDown(const MouseEvent& rMEvt)
#ifdef notnow
// include introducing symbols of special char and text
// (ie '%' and '"')
- USHORT nExtra = (aToken.eType == TSPECIAL || aToken.eType == TTEXT) ? 1 : 0;
+ sal_uInt16 nExtra = (aToken.eType == TSPECIAL || aToken.eType == TTEXT) ? 1 : 0;
// set selection to the beginning of the token
ESelection aSel (aToken.nRow - 1, aToken.nCol - 1 - nExtra);
@@ -200,7 +203,7 @@ void SmGraphicWindow::MouseButtonDown(const MouseEvent& rMEvt)
ESelection aSel (aToken.nRow - 1, aToken.nCol - 1);
if (rMEvt.GetClicks() != 1 || aToken.eType == TPLACE)
- aSel.nEndPos = aSel.nEndPos + sal::static_int_cast< USHORT >(aToken.aText.Len());
+ aSel.nEndPos = aSel.nEndPos + sal::static_int_cast< sal_uInt16 >(aToken.aText.Len());
pEdit->SetSelection(aSel);
SetCursor(pNode);
@@ -239,10 +242,10 @@ void SmGraphicWindow::LoseFocus()
}
}
-void SmGraphicWindow::ShowCursor(BOOL bShow)
- // shows or hides the formula-cursor depending on 'bShow' is TRUE or not
+void SmGraphicWindow::ShowCursor(sal_Bool bShow)
+ // shows or hides the formula-cursor depending on 'bShow' is sal_True or not
{
- BOOL bInvert = bShow != IsCursorVisible();
+ sal_Bool bInvert = bShow != IsCursorVisible();
if (bInvert)
InvertTracking(aCursorRect, SHOWTRACK_SMALL | SHOWTRACK_WINDOW);
@@ -273,13 +276,13 @@ void SmGraphicWindow::SetCursor(const Rectangle &rRect)
SmModule *pp = SM_MOD();
if (IsCursorVisible())
- ShowCursor(FALSE); // clean up remainings of old cursor
+ ShowCursor(sal_False); // clean up remainings of old cursor
aCursorRect = rRect;
if (pp->GetConfig()->IsShowFormulaCursor())
- ShowCursor(TRUE); // draw new cursor
+ ShowCursor(sal_True); // draw new cursor
}
-const SmNode * SmGraphicWindow::SetCursorPos(USHORT nRow, USHORT nCol)
+const SmNode * SmGraphicWindow::SetCursorPos(sal_uInt16 nRow, sal_uInt16 nCol)
// looks for a VISIBLE node in the formula tree with it's token at
// (or around) the position 'nRow', 'nCol' in the edit window
// (row and column numbering starts with 1 there!).
@@ -296,7 +299,7 @@ const SmNode * SmGraphicWindow::SetCursorPos(USHORT nRow, USHORT nCol)
if (pNode)
SetCursor(pNode);
else
- ShowCursor(FALSE);
+ ShowCursor(sal_False);
return pNode;
}
@@ -313,12 +316,12 @@ void SmGraphicWindow::Paint(const Rectangle&)
//! corner of the formula
SetFormulaDrawPos(aPoint);
- SetIsCursorVisible(FALSE); // (old) cursor must be drawn again
+ SetIsCursorVisible(sal_False); // (old) cursor must be drawn again
const SmEditWindow *pEdit = pViewShell->GetEditWindow();
if (pEdit)
{ // get new position for formula-cursor (for possible altered formula)
- USHORT nRow, nCol;
+ sal_uInt16 nRow, nCol;
SmGetLeftSelectionPart(pEdit->GetSelection(), nRow, nCol);
nRow++;
nCol++;
@@ -326,7 +329,7 @@ void SmGraphicWindow::Paint(const Rectangle&)
SmModule *pp = SM_MOD();
if (pFound && pp->GetConfig()->IsShowFormulaCursor())
- ShowCursor(TRUE);
+ ShowCursor(sal_True);
}
}
@@ -349,7 +352,7 @@ void SmGraphicWindow::KeyInput(const KeyEvent& rKEvt)
void SmGraphicWindow::Command(const CommandEvent& rCEvt)
{
- BOOL bCallBase = TRUE;
+ sal_Bool bCallBase = sal_True;
if ( !pViewShell->GetViewFrame()->GetFrame().IsInPlace() )
{
switch ( rCEvt.GetCommand() )
@@ -371,7 +374,7 @@ void SmGraphicWindow::Command(const CommandEvent& rCEvt)
//pPopupMenu->Execute( this, aPos );
delete pPopupMenu;
- bCallBase = FALSE;
+ bCallBase = sal_False;
}
break;
@@ -380,13 +383,13 @@ void SmGraphicWindow::Command(const CommandEvent& rCEvt)
const CommandWheelData* pWData = rCEvt.GetWheelData();
if ( pWData && COMMAND_WHEEL_ZOOM == pWData->GetMode() )
{
- USHORT nTmpZoom = GetZoom();
+ sal_uInt16 nTmpZoom = GetZoom();
if( 0L > pWData->GetDelta() )
nTmpZoom -= 10;
else
nTmpZoom += 10;
SetZoom( nTmpZoom );
- bCallBase = FALSE;
+ bCallBase = sal_False;
}
}
break;
@@ -407,9 +410,9 @@ IMPL_LINK_INLINE_START( SmGraphicWindow, MenuSelectHdl, Menu *, pMenu )
IMPL_LINK_INLINE_END( SmGraphicWindow, MenuSelectHdl, Menu *, pMenu )
-void SmGraphicWindow::SetZoom(USHORT Factor)
+void SmGraphicWindow::SetZoom(sal_uInt16 Factor)
{
- nZoom = Min(Max((USHORT) Factor, (USHORT) MINZOOM), (USHORT) MAXZOOM);
+ nZoom = Min(Max((sal_uInt16) Factor, (sal_uInt16) MINZOOM), (sal_uInt16) MAXZOOM);
Fraction aFraction (nZoom, 100);
SetMapMode( MapMode(MAP_100TH_MM, Point(), aFraction, aFraction) );
SetTotalSize();
@@ -434,7 +437,7 @@ void SmGraphicWindow::ZoomToFitInWindow()
{
long nVal = Min ((85 * aWindowSize.Width()) / aSize.Width(),
(85 * aWindowSize.Height()) / aSize.Height());
- SetZoom ( sal::static_int_cast< USHORT >(nVal) );
+ SetZoom ( sal::static_int_cast< sal_uInt16 >(nVal) );
}
}
@@ -452,7 +455,7 @@ uno::Reference< XAccessible > SmGraphicWindow::CreateAccessible()
SmGraphicController::SmGraphicController(SmGraphicWindow &rSmGraphic,
- USHORT nId_,
+ sal_uInt16 nId_,
SfxBindings &rBindings) :
SfxControllerItem(nId_, rBindings),
rGraphic(rSmGraphic)
@@ -460,7 +463,7 @@ SmGraphicController::SmGraphicController(SmGraphicWindow &rSmGraphic,
}
-void SmGraphicController::StateChanged(USHORT nSID, SfxItemState eState, const SfxPoolItem* pState)
+void SmGraphicController::StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState)
{
rGraphic.SetTotalSize();
rGraphic.Invalidate();
@@ -472,7 +475,7 @@ void SmGraphicController::StateChanged(USHORT nSID, SfxItemState eState, const S
SmEditController::SmEditController(SmEditWindow &rSmEdit,
- USHORT nId_,
+ sal_uInt16 nId_,
SfxBindings &rBindings) :
SfxControllerItem(nId_, rBindings),
rEdit(rSmEdit)
@@ -487,7 +490,7 @@ SmEditController::~SmEditController()
#endif
-void SmEditController::StateChanged(USHORT nSID, SfxItemState eState, const SfxPoolItem* pState)
+void SmEditController::StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState)
{
const SfxStringItem *pItem = PTR_CAST(SfxStringItem, pState);
@@ -504,7 +507,7 @@ SmCmdBoxWindow::SmCmdBoxWindow(SfxBindings *pBindings_, SfxChildWindow *pChildWi
SfxDockingWindow(pBindings_, pChildWindow, pParent, SmResId(RID_CMDBOXWINDOW)),
aEdit (*this),
aController (aEdit, SID_TEXT, *pBindings_),
- bExiting (FALSE)
+ bExiting (sal_False)
{
Hide ();
@@ -516,7 +519,7 @@ SmCmdBoxWindow::SmCmdBoxWindow(SfxBindings *pBindings_, SfxChildWindow *pChildWi
SmCmdBoxWindow::~SmCmdBoxWindow ()
{
aInitialFocusTimer.Stop();
- bExiting = TRUE;
+ bExiting = sal_True;
}
@@ -634,7 +637,7 @@ void SmCmdBoxWindow::StateChanged( StateChangedType nStateChange )
Resize(); // #98848# avoid SmEditWindow not being painted correctly
// set initial position of window in floating mode
- if (TRUE == IsFloatingMode())
+ if (sal_True == IsFloatingMode())
AdjustPosition(); //! don't change pos in docking-mode !
// // make sure the formula can be edited right away
@@ -652,7 +655,51 @@ void SmCmdBoxWindow::StateChanged( StateChangedType nStateChange )
IMPL_LINK( SmCmdBoxWindow, InitialFocusTimerHdl, Timer *, EMPTYARG /*pTimer*/ )
{
- aEdit.GrabFocus();
+ // We want to have the focus in the edit window once Math has been opened
+ // to allow for immediate typing.
+ // Problem: There is no proper way to do this
+ // Thus: this timer based soultion has been implemented (see GrabFocus below)
+ //
+ // Follow-up problem (#i114910): grabing the focus may bust the help system since
+ // it relies on getting the current frame which conflicts with grabbing the focus.
+ // Thus aside from the 'GrabFocus' call everything else is to get the
+ // help reliably working despite using 'GrabFocus'.
+
+ try
+ {
+ uno::Reference< frame::XDesktop > xDesktop;
+ uno::Reference< lang::XMultiServiceFactory > xSMGR( comphelper::getProcessServiceFactory() );
+ if (xSMGR.is())
+ {
+ xDesktop = uno::Reference< frame::XDesktop >(
+ xSMGR->createInstance( rtl::OUString::createFromAscii( "com.sun.star.frame.Desktop" )), uno::UNO_QUERY_THROW );
+ }
+
+ aEdit.GrabFocus();
+
+ if (xDesktop.is())
+ {
+ bool bInPlace = GetView()->GetViewFrame()->GetFrame().IsInPlace();
+ uno::Reference< frame::XFrame > xFrame( GetBindings().GetDispatcher()->GetFrame()->GetFrame().GetFrameInterface());
+ if ( bInPlace )
+ {
+ uno::Reference< container::XChild > xModel( GetView()->GetDoc()->GetModel(), uno::UNO_QUERY_THROW );
+ uno::Reference< frame::XModel > xParent( xModel->getParent(), uno::UNO_QUERY_THROW );
+ uno::Reference< frame::XController > xParentCtrler( xParent->getCurrentController() );
+ uno::Reference< frame::XFramesSupplier > xParentFrame( xParentCtrler->getFrame(), uno::UNO_QUERY_THROW );
+ xParentFrame->setActiveFrame( xFrame );
+ }
+ else
+ {
+ uno::Reference< frame::XFramesSupplier > xFramesSupplier( xDesktop, uno::UNO_QUERY );
+ xFramesSupplier->setActiveFrame( xFrame );
+ }
+ }
+ }
+ catch (uno::Exception &)
+ {
+ DBG_ASSERT( 0, "failed to properly set initial focus to edit window" );
+ }
return 0;
}
@@ -692,7 +739,7 @@ void SmCmdBoxWindow::GetFocus()
SFX_IMPL_DOCKINGWINDOW(SmCmdBoxWrapper, SID_CMDBOXWINDOW);
-SmCmdBoxWrapper::SmCmdBoxWrapper(Window *pParentWindow, USHORT nId,
+SmCmdBoxWrapper::SmCmdBoxWrapper(Window *pParentWindow, sal_uInt16 nId,
SfxBindings *pBindings,
SfxChildWinInfo *pInfo) :
SfxChildWindow(pParentWindow, nId)
@@ -810,7 +857,7 @@ void SmViewShell::SetZoomFactor( const Fraction &rX, const Fraction &rY )
RTL_LOGFILE_CONTEXT( aLog, "starmath: SmViewShell::SetZoomFactor" );
const Fraction &rFrac = rX < rY ? rX : rY;
- GetGraphicWindow().SetZoom( (USHORT) long(rFrac * Fraction( 100, 1 )) );
+ GetGraphicWindow().SetZoom( (sal_uInt16) long(rFrac * Fraction( 100, 1 )) );
//Um Rundungsfehler zu minimieren lassen wir von der Basisklasse ggf.
//auch die krummen Werte einstellen
@@ -824,7 +871,7 @@ Size SmViewShell::GetTextLineSize(OutputDevice& rDevice, const String& rLine)
String aText;
Size aSize(rDevice.GetTextWidth(rLine), rDevice.GetTextHeight());
- USHORT nTabs = rLine.GetTokenCount('\t');
+ sal_uInt16 nTabs = rLine.GetTokenCount('\t');
if (nTabs > 0)
{
@@ -832,7 +879,7 @@ Size SmViewShell::GetTextLineSize(OutputDevice& rDevice, const String& rLine)
aSize.Width() = 0;
- for (USHORT i = 0; i < nTabs; i++)
+ for (sal_uInt16 i = 0; i < nTabs; i++)
{
if (i > 0)
aSize.Width() = ((aSize.Width() / TabPos) + 1) * TabPos;
@@ -856,9 +903,9 @@ Size SmViewShell::GetTextSize(OutputDevice& rDevice, const String& rText, long M
String aLine;
Size TextSize;
String aText;
- USHORT nLines = rText.GetTokenCount('\n');
+ sal_uInt16 nLines = rText.GetTokenCount('\n');
- for (USHORT i = 0; i < nLines; i++)
+ for (sal_uInt16 i = 0; i < nLines; i++)
{
aLine = rText.GetToken(i, '\n');
aLine.EraseAllChars('\r');
@@ -916,13 +963,13 @@ void SmViewShell::DrawTextLine(OutputDevice& rDevice, const Point& rPosition, co
String aText;
Point aPoint (rPosition);
- USHORT nTabs = rLine.GetTokenCount('\t');
+ sal_uInt16 nTabs = rLine.GetTokenCount('\t');
if (nTabs > 0)
{
long TabPos = rDevice.GetTextWidth('n') * 8;
- for (USHORT i = 0; i < nTabs; i++)
+ for (sal_uInt16 i = 0; i < nTabs; i++)
{
if (i > 0)
aPoint.X() = ((aPoint.X() / TabPos) + 1) * TabPos;
@@ -939,17 +986,17 @@ void SmViewShell::DrawTextLine(OutputDevice& rDevice, const Point& rPosition, co
}
-void SmViewShell::DrawText(OutputDevice& rDevice, const Point& rPosition, const String& rText, USHORT MaxWidth)
+void SmViewShell::DrawText(OutputDevice& rDevice, const Point& rPosition, const String& rText, sal_uInt16 MaxWidth)
{
RTL_LOGFILE_CONTEXT( aLog, "starmath: SmViewShell::DrawText" );
- USHORT nLines = rText.GetTokenCount('\n');
+ sal_uInt16 nLines = rText.GetTokenCount('\n');
Point aPoint (rPosition);
Size aSize;
String aLine;
String aText;
- for (USHORT i = 0; i < nLines; i++)
+ for (sal_uInt16 i = 0; i < nLines; i++)
{
aLine = rText.GetToken(i, '\n');
aLine.EraseAllChars('\r');
@@ -1013,7 +1060,7 @@ void SmViewShell::Impl_Print(
const bool bIsPrintFrame = rPrintUIOptions.getBoolValue( PRTUIOPT_BORDER, sal_True );
const bool bIsPrintFormulaText = rPrintUIOptions.getBoolValue( PRTUIOPT_FORMULA_TEXT, sal_True );
SmPrintSize ePrintSize( static_cast< SmPrintSize >( rPrintUIOptions.getIntValue( PRTUIOPT_PRINT_FORMAT, PRINT_SIZE_NORMAL ) ));
- const USHORT nZoomFactor = static_cast< USHORT >(rPrintUIOptions.getIntValue( PRTUIOPT_PRINT_SCALE, 100 ));
+ const sal_uInt16 nZoomFactor = static_cast< sal_uInt16 >(rPrintUIOptions.getIntValue( PRTUIOPT_PRINT_SCALE, 100 ));
// IsIgnoreSpacesRight is a parser option! Thus it does not get evaluated here anymore (too late).
// const bool bNoRightSpaces = rPrintUIOptions.getBoolValue( PRTUIOPT_NO_RIGHT_SPACE, sal_True );
@@ -1053,7 +1100,7 @@ void SmViewShell::Impl_Print(
Point aPoint(aOutRect.Left() + (aOutRect.GetWidth() - aTitleSize.Width()) / 2,
aOutRect.Top());
DrawText(rOutDev, aPoint, GetDoc()->GetTitle(),
- sal::static_int_cast< USHORT >(aOutRect.GetWidth() - 200));
+ sal::static_int_cast< sal_uInt16 >(aOutRect.GetWidth() - 200));
aOutRect.Top() += aTitleSize.Height() + 200;
// output description
@@ -1063,7 +1110,7 @@ void SmViewShell::Impl_Print(
aPoint.X() = aOutRect.Left() + (aOutRect.GetWidth() - aDescSize.Width()) / 2;
aPoint.Y() = aOutRect.Top();
DrawText(rOutDev, aPoint, GetDoc()->GetComment(),
- sal::static_int_cast< USHORT >(aOutRect.GetWidth() - 200));
+ sal::static_int_cast< sal_uInt16 >(aOutRect.GetWidth() - 200));
aOutRect.Top() += aDescSize.Height() + 300;
}
@@ -1088,7 +1135,7 @@ void SmViewShell::Impl_Print(
Point aPoint (aOutRect.Left() + (aOutRect.GetWidth() - aSize.Width()) / 2,
aOutRect.Bottom() + 300);
DrawText(rOutDev, aPoint, GetDoc()->GetText(),
- sal::static_int_cast< USHORT >(aOutRect.GetWidth() - 200));
+ sal::static_int_cast< sal_uInt16 >(aOutRect.GetWidth() - 200));
aOutRect.Bottom() -= 200;
}
@@ -1118,9 +1165,9 @@ void SmViewShell::Impl_Print(
Size OutputSize (rOutDev.LogicToPixel(Size(aOutRect.GetWidth(),
aOutRect.GetHeight()), MapMode(MAP_100TH_MM)));
Size GraphicSize (rOutDev.LogicToPixel(aSize, MapMode(MAP_100TH_MM)));
- USHORT nZ = (USHORT) Min((long)Fraction(OutputSize.Width() * 100L, GraphicSize.Width()),
+ sal_uInt16 nZ = (sal_uInt16) Min((long)Fraction(OutputSize.Width() * 100L, GraphicSize.Width()),
(long)Fraction(OutputSize.Height() * 100L, GraphicSize.Height()));
- Fraction aFraction ((USHORT) Max ((USHORT) MINZOOM, Min((USHORT) MAXZOOM, (USHORT) (nZ - 10))), (USHORT) 100);
+ Fraction aFraction ((sal_uInt16) Max ((sal_uInt16) MINZOOM, Min((sal_uInt16) MAXZOOM, (sal_uInt16) (nZ - 10))), (sal_uInt16) 100);
OutputMapMode = MapMode(MAP_100TH_MM, aZeroPoint, aFraction, aFraction);
}
@@ -1156,7 +1203,7 @@ void SmViewShell::Impl_Print(
rOutDev.Pop();
}
-USHORT SmViewShell::Print(SfxProgress & /*rProgress*/, BOOL /*bIsAPI*/, PrintDialog * /*pPrintDialog*/)
+sal_uInt16 SmViewShell::Print(SfxProgress & /*rProgress*/, sal_Bool /*bIsAPI*/)
{
RTL_LOGFILE_CONTEXT( aLog, "starmath: SmViewShell::Print" );
DBG_ASSERT( 0, "SmViewShell::Print: no longer used with new UI print dialog. Should be removed!!" );
@@ -1164,7 +1211,7 @@ USHORT SmViewShell::Print(SfxProgress & /*rProgress*/, BOOL /*bIsAPI*/, PrintDia
}
-SfxPrinter* SmViewShell::GetPrinter(BOOL bCreate)
+SfxPrinter* SmViewShell::GetPrinter(sal_Bool bCreate)
{
RTL_LOGFILE_CONTEXT( aLog, "starmath: SmViewShell::GetPrinter" );
@@ -1175,7 +1222,7 @@ SfxPrinter* SmViewShell::GetPrinter(BOOL bCreate)
}
-USHORT SmViewShell::SetPrinter(SfxPrinter *pNewPrinter, USHORT nDiffFlags, bool )
+sal_uInt16 SmViewShell::SetPrinter(SfxPrinter *pNewPrinter, sal_uInt16 nDiffFlags, bool )
{
RTL_LOGFILE_CONTEXT( aLog, "starmath: SmViewShell::SetPrinter" );
SfxPrinter *pOld = GetDoc()->GetPrinter();
@@ -1268,14 +1315,14 @@ void SmViewShell::PrevError()
}
-BOOL SmViewShell::Insert( SfxMedium& rMedium )
+sal_Bool SmViewShell::Insert( SfxMedium& rMedium )
{
RTL_LOGFILE_CONTEXT( aLog, "starmath: SmViewShell::Insert" );
SmDocShell *pDoc = GetDoc();
String aText( pDoc->GetText() );
String aTemp = aText;
- BOOL bRet = FALSE, bChkOldVersion = TRUE;
+ sal_Bool bRet = sal_False, bChkOldVersion = sal_True;
uno::Reference < embed::XStorage > xStorage = rMedium.GetStorage();
uno::Reference< container::XNameAccess > xNameAccess( xStorage, uno::UNO_QUERY );
@@ -1283,7 +1330,7 @@ BOOL SmViewShell::Insert( SfxMedium& rMedium )
{
if ( xNameAccess->hasByName( C2S( "content.xml" ) ) || xNameAccess->hasByName( C2S( "Content.xml" ) ))
{
- bChkOldVersion = FALSE;
+ bChkOldVersion = sal_False;
// is this a fabulous math package ?
Reference<com::sun::star::frame::XModel> xModel(pDoc->GetModel());
SmXMLImportWrapper aEquation(xModel); //!! modifies the result of pDoc->GetText() !!
@@ -1305,7 +1352,7 @@ BOOL SmViewShell::Insert( SfxMedium& rMedium )
}
pDoc->Parse();
- pDoc->SetModified(TRUE);
+ pDoc->SetModified(sal_True);
SfxBindings &rBnd = GetViewFrame()->GetBindings();
rBnd.Invalidate(SID_GAPHIC_SM);
@@ -1315,11 +1362,11 @@ BOOL SmViewShell::Insert( SfxMedium& rMedium )
}
-BOOL SmViewShell::InsertFrom(SfxMedium &rMedium)
+sal_Bool SmViewShell::InsertFrom(SfxMedium &rMedium)
{
RTL_LOGFILE_CONTEXT( aLog, "starmath: SmViewShell::InsertFrom" );
- BOOL bSuccess = FALSE;
+ sal_Bool bSuccess = sal_False;
SmDocShell *pDoc = GetDoc();
SvStream *pStream = rMedium.GetInStream();
String aText( pDoc->GetText() );
@@ -1354,7 +1401,7 @@ BOOL SmViewShell::InsertFrom(SfxMedium &rMedium)
}
pDoc->Parse();
- pDoc->SetModified(TRUE);
+ pDoc->SetModified(sal_True);
SfxBindings &rBnd = GetViewFrame()->GetBindings();
rBnd.Invalidate(SID_GAPHIC_SM);
@@ -1380,9 +1427,9 @@ void SmViewShell::Execute(SfxRequest& rReq)
const SfxItemSet *pArgs = rReq.GetArgs();
const SfxPoolItem *pItem;
- BOOL bVal;
+ sal_Bool bVal;
if ( pArgs &&
- SFX_ITEM_SET == pArgs->GetItemState( SID_FORMULACURSOR, FALSE, &pItem))
+ SFX_ITEM_SET == pArgs->GetItemState( SID_FORMULACURSOR, sal_False, &pItem))
bVal = ((SfxBoolItem *) pItem)->GetValue();
else
bVal = !pp->GetConfig()->IsShowFormulaCursor();
@@ -1423,7 +1470,7 @@ void SmViewShell::Execute(SfxRequest& rReq)
break;
case SID_ZOOMOUT:
- DBG_ASSERT(aGraphic.GetZoom() >= 25, "Sm: falsches USHORT Argument");
+ DBG_ASSERT(aGraphic.GetZoom() >= 25, "Sm: falsches sal_uInt16 Argument");
aGraphic.SetZoom(aGraphic.GetZoom() - 25);
break;
@@ -1496,7 +1543,7 @@ void SmViewShell::Execute(SfxRequest& rReq)
case SID_PASTE:
{
- BOOL bCallExec = 0 == pWin;
+ sal_Bool bCallExec = 0 == pWin;
if( !bCallExec )
{
TransferableDataHelper aDataHelper(
@@ -1507,7 +1554,7 @@ void SmViewShell::Execute(SfxRequest& rReq)
aDataHelper.HasFormat( FORMAT_STRING ))
pWin->Paste();
else
- bCallExec = TRUE;
+ bCallExec = sal_True;
}
if( bCallExec )
{
@@ -1632,7 +1679,7 @@ void SmViewShell::Execute(SfxRequest& rReq)
switch( rZoom.GetType() )
{
case SVX_ZOOM_PERCENT:
- aGraphic.SetZoom((USHORT)rZoom.GetValue ());
+ aGraphic.SetZoom((sal_uInt16)rZoom.GetValue ());
break;
case SVX_ZOOM_OPTIMAL:
@@ -1643,13 +1690,13 @@ void SmViewShell::Execute(SfxRequest& rReq)
case SVX_ZOOM_WHOLEPAGE:
{
const MapMode aMap( MAP_100TH_MM );
- SfxPrinter *pPrinter = GetPrinter( TRUE );
+ SfxPrinter *pPrinter = GetPrinter( sal_True );
Point aPoint;
Rectangle OutputRect(aPoint, pPrinter->GetOutputSize());
Size OutputSize(pPrinter->LogicToPixel(Size(OutputRect.GetWidth(),
OutputRect.GetHeight()), aMap));
Size GraphicSize(pPrinter->LogicToPixel(GetDoc()->GetSize(), aMap));
- USHORT nZ = (USHORT) Min((long)Fraction(OutputSize.Width() * 100L, GraphicSize.Width()),
+ sal_uInt16 nZ = (sal_uInt16) Min((long)Fraction(OutputSize.Width() * 100L, GraphicSize.Width()),
(long)Fraction(OutputSize.Height() * 100L, GraphicSize.Height()));
aGraphic.SetZoom (nZ);
break;
@@ -1695,7 +1742,7 @@ void SmViewShell::GetState(SfxItemSet &rSet)
SfxWhichIter aIter(rSet);
SmEditWindow *pEditWin = GetEditWindow();
- for (USHORT nWh = aIter.FirstWhich(); nWh != 0; nWh = aIter.NextWhich())
+ for (sal_uInt16 nWh = aIter.FirstWhich(); nWh != 0; nWh = aIter.NextWhich())
{
switch (nWh)
{
@@ -1762,11 +1809,11 @@ void SmViewShell::GetState(SfxItemSet &rSet)
case SID_TOOLBOX:
{
- BOOL bState = FALSE;
+ sal_Bool bState = sal_False;
SfxChildWindow *pChildWnd = GetViewFrame()->
GetChildWindow( SmToolBoxWrapper::GetChildWindowId() );
if (pChildWnd && pChildWnd->GetWindow()->IsVisible())
- bState = TRUE;
+ bState = sal_True;
rSet.Put(SfxBoolItem(SID_TOOLBOX, bState));
}
break;
@@ -1807,7 +1854,7 @@ SmViewShell::~SmViewShell()
delete pImpl;
}
-void SmViewShell::Deactivate( BOOL bIsMDIActivate )
+void SmViewShell::Deactivate( sal_Bool bIsMDIActivate )
{
RTL_LOGFILE_CONTEXT( aLog, "starmath: SmViewShell::Deactivate" );
@@ -1819,7 +1866,7 @@ void SmViewShell::Deactivate( BOOL bIsMDIActivate )
}
-void SmViewShell::Activate( BOOL bIsMDIActivate )
+void SmViewShell::Activate( sal_Bool bIsMDIActivate )
{
RTL_LOGFILE_CONTEXT( aLog, "starmath: SmViewShell::Activate" );
@@ -1849,7 +1896,7 @@ IMPL_LINK( SmViewShell, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg )
if ( ERRCODE_NONE == _pFileDlg->GetError() )
{
- //USHORT nSlot = pImpl->pRequest->GetSlot();
+ //sal_uInt16 nSlot = pImpl->pRequest->GetSlot();
SfxMedium* pMedium = pImpl->pDocInserter->CreateMedium();
if ( pMedium != NULL )
@@ -1869,7 +1916,7 @@ IMPL_LINK( SmViewShell, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg )
}
}
- pImpl->pRequest->SetReturnValue( SfxBoolItem( pImpl->pRequest->GetSlot(), TRUE ) );
+ pImpl->pRequest->SetReturnValue( SfxBoolItem( pImpl->pRequest->GetSlot(), sal_True ) );
pImpl->pRequest->Done();
return 0;
}
@@ -1882,7 +1929,7 @@ void SmViewShell::Notify( SfxBroadcaster& , const SfxHint& rHint )
{
case SFX_HINT_MODECHANGED:
case SFX_HINT_DOCCHANGED:
- GetViewFrame()->GetBindings().InvalidateAll(FALSE);
+ GetViewFrame()->GetBindings().InvalidateAll(sal_False);
break;
default:
break;